diff --git a/dist/332.js b/dist/332.js index e499359..e0e6019 100644 --- a/dist/332.js +++ b/dist/332.js @@ -1 +1 @@ -var A={d:(e,t)=>{for(var i in t)A.o(t,i)&&!A.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o:(A,e)=>Object.prototype.hasOwnProperty.call(A,e)},e=globalThis.pdfjsWorker={};A.d(e,{WorkerMessageHandler:()=>wd});const t=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),i=[1,0,0,1,0,0],a=[.001,0,0,.001,0,0],s=1.35,n=.25925925925925924,g="pdfjs_internal_editor_",r={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},o="Group",I=8192,c=65536,C={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"},B={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},h={O:"PageOpen",C:"PageClose"},Q=10,l=11,E=12,u=37,d=44,f=58,p=59,m=70,y=71,w=83,D=85;let b=1;function k(){return b}function F(A){b>=5&&console.log(`Info: ${A}`)}function S(A){b>=1&&console.log(`Warning: ${A}`)}function R(A){throw new Error(A)}function G(A,e){A||R(e)}function N(A,e=null,t=null){if(!A)return null;try{if(t&&"string"==typeof A){if(t.addDefaultProtocol&&A.startsWith("www.")){const e=A.match(/\./g);e?.length>=2&&(A=`http://${A}`)}if(t.tryConvertEncoding)try{A=z(A)}catch{}}const i=e?new URL(A,e):new URL(A);if(function(A){switch(A?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(i))return i}catch{}return null}function x(A,e,t,i=!1){return Object.defineProperty(A,e,{value:t,enumerable:!i,configurable:!0,writable:!1}),t}const U=function(){function A(A,e){this.message=A,this.name=e}return A.prototype=new Error,A.constructor=A,A}();class M extends U{constructor(A,e){super(A,"PasswordException"),this.code=e}}class L extends U{constructor(A,e){super(A,"UnknownErrorException"),this.details=e}}class J extends U{constructor(A){super(A,"InvalidPDFException")}}class H extends U{constructor(A){super(A,"MissingPDFException")}}class Y extends U{constructor(A,e){super(A,"UnexpectedResponseException"),this.status=e}}class v extends U{constructor(A){super(A,"FormatError")}}class K extends U{constructor(A){super(A,"AbortException")}}function q(A){"object"==typeof A&&void 0!==A?.length||R("Invalid argument for bytesToString");const e=A.length,t=8192;if(e>24&255,A>>16&255,A>>8&255,255&A)}function W(A){return Object.keys(A).length}class Z{static get isLittleEndian(){return x(this,"isLittleEndian",function(){const A=new Uint8Array(4);return A[0]=1,1===new Uint32Array(A.buffer,0,1)[0]}())}static get isEvalSupported(){return x(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return x(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?x(this,"platform",{isMac:navigator.platform.includes("Mac")}):x(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){return x(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const O=Array.from(Array(256).keys(),(A=>A.toString(16).padStart(2,"0")));class X{static makeHexColor(A,e,t){return`#${O[A]}${O[e]}${O[t]}`}static scaleMinMax(A,e){let t;A[0]?(A[0]<0&&(t=e[0],e[0]=e[2],e[2]=t),e[0]*=A[0],e[2]*=A[0],A[3]<0&&(t=e[1],e[1]=e[3],e[3]=t),e[1]*=A[3],e[3]*=A[3]):(t=e[0],e[0]=e[1],e[1]=t,t=e[2],e[2]=e[3],e[3]=t,A[1]<0&&(t=e[1],e[1]=e[3],e[3]=t),e[1]*=A[1],e[3]*=A[1],A[2]<0&&(t=e[0],e[0]=e[2],e[2]=t),e[0]*=A[2],e[2]*=A[2]),e[0]+=A[4],e[1]+=A[5],e[2]+=A[4],e[3]+=A[5]}static transform(A,e){return[A[0]*e[0]+A[2]*e[1],A[1]*e[0]+A[3]*e[1],A[0]*e[2]+A[2]*e[3],A[1]*e[2]+A[3]*e[3],A[0]*e[4]+A[2]*e[5]+A[4],A[1]*e[4]+A[3]*e[5]+A[5]]}static applyTransform(A,e){return[A[0]*e[0]+A[1]*e[2]+e[4],A[0]*e[1]+A[1]*e[3]+e[5]]}static applyInverseTransform(A,e){const t=e[0]*e[3]-e[1]*e[2];return[(A[0]*e[3]-A[1]*e[2]+e[2]*e[5]-e[4]*e[3])/t,(-A[0]*e[1]+A[1]*e[0]+e[4]*e[1]-e[5]*e[0])/t]}static getAxialAlignedBoundingBox(A,e){const t=this.applyTransform(A,e),i=this.applyTransform(A.slice(2,4),e),a=this.applyTransform([A[0],A[3]],e),s=this.applyTransform([A[2],A[1]],e);return[Math.min(t[0],i[0],a[0],s[0]),Math.min(t[1],i[1],a[1],s[1]),Math.max(t[0],i[0],a[0],s[0]),Math.max(t[1],i[1],a[1],s[1])]}static inverseTransform(A){const e=A[0]*A[3]-A[1]*A[2];return[A[3]/e,-A[1]/e,-A[2]/e,A[0]/e,(A[2]*A[5]-A[4]*A[3])/e,(A[4]*A[1]-A[5]*A[0])/e]}static singularValueDecompose2dScale(A){const e=[A[0],A[2],A[1],A[3]],t=A[0]*e[0]+A[1]*e[2],i=A[0]*e[1]+A[1]*e[3],a=A[2]*e[0]+A[3]*e[2],s=A[2]*e[1]+A[3]*e[3],n=(t+s)/2,g=Math.sqrt((t+s)**2-4*(t*s-a*i))/2,r=n+g||1,o=n-g||1;return[Math.sqrt(r),Math.sqrt(o)]}static normalizeRect(A){const e=A.slice(0);return A[0]>A[2]&&(e[0]=A[2],e[2]=A[0]),A[1]>A[3]&&(e[1]=A[3],e[3]=A[1]),e}static intersect(A,e){const t=Math.max(Math.min(A[0],A[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(A[0],A[2]),Math.max(e[0],e[2]));if(t>i)return null;const a=Math.max(Math.min(A[1],A[3]),Math.min(e[1],e[3])),s=Math.min(Math.max(A[1],A[3]),Math.max(e[1],e[3]));return a>s?null:[t,a,i,s]}static#A(A,e,t,i,a,s,n,g,r,o){if(r<=0||r>=1)return;const I=1-r,c=r*r,C=c*r,B=I*(I*(I*A+3*r*e)+3*c*t)+C*i,h=I*(I*(I*a+3*r*s)+3*c*n)+C*g;o[0]=Math.min(o[0],B),o[1]=Math.min(o[1],h),o[2]=Math.max(o[2],B),o[3]=Math.max(o[3],h)}static#e(A,e,t,i,a,s,n,g,r,o,I,c){if(Math.abs(r)<1e-12)return void(Math.abs(o)>=1e-12&&this.#A(A,e,t,i,a,s,n,g,-I/o,c));const C=o**2-4*I*r;if(C<0)return;const B=Math.sqrt(C),h=2*r;this.#A(A,e,t,i,a,s,n,g,(-o+B)/h,c),this.#A(A,e,t,i,a,s,n,g,(-o-B)/h,c)}static bezierBoundingBox(A,e,t,i,a,s,n,g,r){return r?(r[0]=Math.min(r[0],A,n),r[1]=Math.min(r[1],e,g),r[2]=Math.max(r[2],A,n),r[3]=Math.max(r[3],e,g)):r=[Math.min(A,n),Math.min(e,g),Math.max(A,n),Math.max(e,g)],this.#e(A,t,a,n,e,i,s,g,3*(3*(t-a)-A+n),6*(A-2*t+a),3*(t-A),r),this.#e(A,t,a,n,e,i,s,g,3*(3*(i-s)-e+g),6*(e-2*i+s),3*(i-e),r),r}}const V=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function j(A){if(A[0]>="ï"){let e;if("þ"===A[0]&&"ÿ"===A[1]?(e="utf-16be",A.length%2==1&&(A=A.slice(0,-1))):"ÿ"===A[0]&&"þ"===A[1]?(e="utf-16le",A.length%2==1&&(A=A.slice(0,-1))):"ï"===A[0]&&"»"===A[1]&&"¿"===A[2]&&(e="utf-8"),e)try{const t=new TextDecoder(e,{fatal:!0}),i=T(A),a=t.decode(i);return a.includes("")?a.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g,""):a}catch(A){S(`stringToPDFString: "${A}".`)}}const e=[];for(let t=0,i=A.length;t{R("Should not call `set` on the empty dictionary.")},x(this,"empty",A)}static merge({xref:A,dictArray:e,mergeSubDicts:t=!1}){const i=new cA(A),a=new Map;for(const A of e)if(A instanceof cA)for(const[e,i]of Object.entries(A._map)){let A=a.get(e);if(void 0===A)A=[],a.set(e,A);else if(!(t&&i instanceof cA))continue;A.push(i)}for(const[e,t]of a){if(1===t.length||!(t[0]instanceof cA)){i._map[e]=t[0];continue}const a=new cA(A);for(const A of t)for(const[e,t]of Object.entries(A._map))void 0===a._map[e]&&(a._map[e]=t);a.size>0&&(i._map[e]=a)}return a.clear(),i.size>0?i:cA.empty}clone(){const A=new cA(this.xref);for(const e of this.getKeys())A.set(e,this.getRaw(e));return A}delete(A){delete this._map[A]}}class CA{constructor(A,e){this.num=A,this.gen=e}toString(){return 0===this.gen?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(A){const e=gA[A];if(e)return e;const t=/^(\d+)R(\d*)$/.exec(A);return t&&"0"!==t[1]?gA[A]=new CA(parseInt(t[1]),t[2]?parseInt(t[2]):0):null}static get(A,e){const t=0===e?`${A}R`:`${A}R${e}`;return gA[t]||=new CA(A,e)}}class BA{constructor(A=null){this._set=new Set(A?._set)}has(A){return this._set.has(A.toString())}put(A){this._set.add(A.toString())}remove(A){this._set.delete(A.toString())}[Symbol.iterator](){return this._set.values()}clear(){this._set.clear()}}class hA{constructor(){this._map=new Map}get size(){return this._map.size}get(A){return this._map.get(A.toString())}has(A){return this._map.has(A.toString())}put(A,e){this._map.set(A.toString(),e)}putAlias(A,e){this._map.set(A.toString(),this.get(e))}[Symbol.iterator](){return this._map.values()}clear(){this._map.clear()}*items(){for(const[A,e]of this._map)yield[CA.fromString(A),e]}}function QA(A,e){return A instanceof rA&&(void 0===e||A.name===e)}function lA(A,e){return A instanceof oA&&(void 0===e||A.cmd===e)}function EA(A,e){return A instanceof cA&&(void 0===e||QA(A.get("Type"),e))}function uA(A,e){return A.num===e.num&&A.gen===e.gen}class dA{get length(){R("Abstract getter `length` accessed")}get isEmpty(){R("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return x(this,"isDataLoaded",!0)}getByte(){R("Abstract method `getByte` called")}getBytes(A){R("Abstract method `getBytes` called")}async getImageData(A,e){return this.getBytes(A,e)}async asyncGetBytes(){R("Abstract method `asyncGetBytes` called")}get isAsync(){return!1}get canAsyncDecodeImageFromBuffer(){return!1}peekByte(){const A=this.getByte();return-1!==A&&this.pos--,A}peekBytes(A){const e=this.getBytes(A);return this.pos-=e.length,e}getUint16(){const A=this.getByte(),e=this.getByte();return-1===A||-1===e?-1:(A<<8)+e}getInt32(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()}getByteRange(A,e){R("Abstract method `getByteRange` called")}getString(A){return q(this.getBytes(A))}skip(A){this.pos+=A||1}reset(){R("Abstract method `reset` called")}moveStart(){R("Abstract method `moveStart` called")}makeSubStream(A,e,t=null){R("Abstract method `makeSubStream` called")}getBaseStreams(){return null}}const fA=/^[1-9]\.\d$/;function pA(A){let e;return function(){return A&&(e=Object.create(null),A(e),A=null),e}}class mA extends U{constructor(A,e){super(`Missing data [${A}, ${e})`,"MissingDataException"),this.begin=A,this.end=e}}class yA extends U{constructor(A){super(A,"ParserEOFException")}}class wA extends U{constructor(A){super(A,"XRefEntryException")}}class DA extends U{constructor(A){super(A,"XRefParseException")}}function bA(A){const e=A.length;if(0===e)return new Uint8Array(0);if(1===e)return new Uint8Array(A[0]);let t=0;for(let i=0;i0,"The number should be a positive integer.");const t=[];let i;for(;A>=1e3;)A-=1e3,t.push("M");i=A/100|0,A%=100,t.push(FA[i]),i=A/10|0,A%=10,t.push(FA[10+i]),t.push(FA[20+A]);const a=t.join("");return e?a.toLowerCase():a}function RA(A){return A<=0?0:Math.ceil(Math.log2(A))}function GA(A,e){return A[e]<<24>>24}function NA(A,e){return A[e]<<8|A[e+1]}function xA(A,e){return(A[e]<<24|A[e+1]<<16|A[e+2]<<8|A[e+3])>>>0}function UA(A){return 32===A||9===A||13===A||10===A}function MA(A,e){return Array.isArray(A)?(null===e||A.length===e)&&A.every((A=>"number"==typeof A)):ArrayBuffer.isView(A)&&(0===A.length||"number"==typeof A[0])&&(null===e||A.length===e)}function LA(A,e){return MA(A,6)?A:e}function JA(A,e){return MA(A,4)?A:e}function HA(A,e){return MA(A,4)?X.normalizeRect(A):e}function YA(A){const e=/(.+)\[(\d+)\]$/;return A.split(".").map((A=>{const t=A.match(e);return t?{name:t[1],pos:parseInt(t[2],10)}:{name:A,pos:0}}))}function vA(A){const e=[];let t=0;for(let i=0,a=A.length;i126||35===a||40===a||41===a||60===a||62===a||91===a||93===a||123===a||125===a||47===a||37===a)&&(t"\n"===A?"\\n":"\r"===A?"\\r":`\\${A}`))}function qA(A,e,t,i){if(!A)return;let a=null;if(A instanceof CA){if(i.has(A))return;a=A,i.put(a),A=e.fetch(A)}if(Array.isArray(A))for(const a of A)qA(a,e,t,i);else if(A instanceof cA){if(QA(A.get("S"),"JavaScript")){const e=A.get("JS");let i;e instanceof dA?i=e.getString():"string"==typeof e&&(i=e),i&&=j(i).replaceAll("\0",""),i&&t.push(i)}qA(A.getRaw("Next"),e,t,i)}a&&i.remove(a)}function TA(A,e,t){const i=Object.create(null),a=kA({dict:e,key:"AA",stopWhenFound:!1});if(a)for(let e=a.length-1;e>=0;e--){const s=a[e];if(s instanceof cA)for(const e of s.getKeys()){const a=t[e];if(!a)continue;const n=[];qA(s.getRaw(e),A,n,new BA),n.length>0&&(i[a]=n)}}if(e.has("A")){const t=[];qA(e.get("A"),A,t,new BA),t.length>0&&(i.Action=t)}return W(i)>0?i:null}const PA={60:"<",62:">",38:"&",34:""",39:"'"};function*WA(A){for(let e=0,t=A.length;e55295&&(t<57344||t>65533)&&e++,yield t}}function ZA(A){const e=[];let t=0;for(let i=0,a=A.length;i55295&&(a<57344||a>65533)&&i++,t=i+1}return 0===e.length?A:(t: ${A}.`),!1;return!0}function XA(A){const e=new Set(["100","200","300","400","500","600","700","800","900","1000","normal","bold","bolder","lighter"]),{fontFamily:t,fontWeight:i,italicAngle:a}=A;if(!OA(t,!0))return!1;const s=i?i.toString():"";A.fontWeight=e.has(s)?s:"400";const n=parseFloat(a);return A.italicAngle=isNaN(n)||n<-90||n>90?"14":a.toString(),!0}function VA(A){const e=new RegExp("^\\s*("+["app.launchURL","window.open","xfa.host.gotoURL"].join("|").replaceAll(".","\\.")+")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))","i").exec(A);if(e?.[2]){const A=e[2];let t=!1;return"true"===e[3]&&"app.launchURL"===e[1]&&(t=!0),{url:A,newWindow:t}}return null}function jA(A){if(Number.isInteger(A))return A.toString();const e=Math.round(100*A);return e%100==0?(e/100).toString():e%10==0?A.toFixed(1):A.toFixed(2)}function zA(A){if(!A)return null;const e=new Map;for(const[t,i]of A){if(!t.startsWith(g))continue;let A=e.get(i.pageIndex);A||(A=[],e.set(i.pageIndex,A)),A.push(i)}return e.size>0?e:null}function _A(A){return function(A){return/^[\x00-\x7F]*$/.test(A)}(A)?A:Ae(A,!0)}function $A(A){const e=[];for(let t=0,i=A.length;t>8&255).toString(16).padStart(2,"0"),(255&i).toString(16).padStart(2,"0"))}return e.join("")}function Ae(A,e=!1){const t=[];e&&t.push("þÿ");for(let e=0,i=A.length;e>8&255),String.fromCharCode(255&i))}return t.join("")}function ee(A,e,t){switch(A){case 90:return[0,1,-1,0,e,0];case 180:return[-1,0,0,-1,e,t];case 270:return[0,-1,1,0,0,t];default:throw new Error("Invalid rotation")}}function te(A){return Math.ceil(Math.ceil(Math.log2(1+A))/8)}class ie extends dA{constructor(A,e,t,i){super(),this.bytes=A instanceof Uint8Array?A:new Uint8Array(A),this.start=e||0,this.pos=this.start,this.end=e+t||this.bytes.length,this.dict=i}get length(){return this.end-this.start}get isEmpty(){return 0===this.length}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getBytes(A){const e=this.bytes,t=this.pos,i=this.end;if(!A)return e.subarray(t,i);let a=t+A;return a>i&&(a=i),this.pos=a,e.subarray(t,a)}getByteRange(A,e){return A<0&&(A=0),e>this.end&&(e=this.end),this.bytes.subarray(A,e)}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(A,e,t=null){return new ie(this.bytes.buffer,A,e,t)}}class ae extends ie{constructor(A){super(T(A))}}class se extends ie{constructor(){super(new Uint8Array(0))}}class ne extends ie{constructor(A,e,t){super(new Uint8Array(A),0,A,null),this.chunkSize=e,this._loadedChunks=new Set,this.numChunks=Math.ceil(A/e),this.manager=t,this.progressiveDataLength=0,this.lastSuccessfulEnsureByteChunk=-1}getMissingChunks(){const A=[];for(let e=0,t=this.numChunks;e=this.end?this.numChunks:Math.floor(e/this.chunkSize);for(let A=t;Athis.numChunks)&&e!==this.lastSuccessfulEnsureByteChunk){if(!this._loadedChunks.has(e))throw new mA(A,A+1);this.lastSuccessfulEnsureByteChunk=e}}ensureRange(A,e){if(A>=e)return;if(e<=this.progressiveDataLength)return;const t=Math.floor(A/this.chunkSize);if(t>this.numChunks)return;const i=Math.min(Math.floor((e-1)/this.chunkSize)+1,this.numChunks);for(let a=t;a=this.end?-1:(A>=this.progressiveDataLength&&this.ensureByte(A),this.bytes[this.pos++])}getBytes(A){const e=this.bytes,t=this.pos,i=this.end;if(!A)return i>this.progressiveDataLength&&this.ensureRange(t,i),e.subarray(t,i);let a=t+A;return a>i&&(a=i),a>this.progressiveDataLength&&this.ensureRange(t,a),this.pos=a,e.subarray(t,a)}getByteRange(A,e){return A<0&&(A=0),e>this.end&&(e=this.end),e>this.progressiveDataLength&&this.ensureRange(A,e),this.bytes.subarray(A,e)}makeSubStream(A,e,t=null){function i(){}e?A+e>this.progressiveDataLength&&this.ensureRange(A,A+e):A>=this.progressiveDataLength&&this.ensureByte(A),i.prototype=Object.create(this),i.prototype.getMissingChunks=function(){const A=this.chunkSize,e=Math.floor(this.start/A),t=Math.floor((this.end-1)/A)+1,i=[];for(let A=e;A{const s=({value:n,done:g})=>{try{if(g){const e=bA(i);return i=null,void A(e)}a+=n.byteLength,t.isStreamingSupported&&this.onProgress({loaded:a}),i.push(n),t.read().then(s,e)}catch(A){e(A)}};t.read().then(s,e)})).then((e=>{this.aborted||this.onReceiveData({chunk:e,begin:A})}))}requestAllChunks(A=!1){if(!A){const A=this.stream.getMissingChunks();this._requestChunks(A)}return this._loadedStreamCapability.promise}_requestChunks(A){const e=this.currRequestId++,t=new Set;this._chunksNeededByRequest.set(e,t);for(const e of A)this.stream.hasChunk(e)||t.add(e);if(0===t.size)return Promise.resolve();const i=Promise.withResolvers();this._promisesByRequest.set(e,i);const a=[];for(const A of t){let t=this._requestsByChunk.get(A);t||(t=[],this._requestsByChunk.set(A,t),a.push(A)),t.push(e)}if(a.length>0){const A=this.groupChunks(a);for(const e of A){const A=e.beginChunk*this.chunkSize,t=Math.min(e.endChunk*this.chunkSize,this.length);this.sendRequest(A,t).catch(i.reject)}}return i.promise.catch((A=>{if(!this.aborted)throw A}))}getStream(){return this.stream}requestRange(A,e){e=Math.min(e,this.length);const t=this.getBeginChunk(A),i=this.getEndChunk(e),a=[];for(let A=t;A=0&&i+1!==s&&(e.push({beginChunk:t,endChunk:i+1}),t=s),a+1===A.length&&e.push({beginChunk:t,endChunk:s+1}),i=s}return e}onProgress(A){this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize+A.loaded,total:this.length})}onReceiveData(A){const e=A.chunk,t=void 0===A.begin,i=t?this.progressiveDataLength:A.begin,a=i+e.byteLength,s=Math.floor(i/this.chunkSize),n=a0||g.push(t)}}}if(!this.disableAutoFetch&&0===this._requestsByChunk.size){let A;if(1===this.stream.numChunksLoaded){const e=this.stream.numChunks-1;this.stream.hasChunk(e)||(A=e)}else A=this.stream.nextEmptyChunk(n);Number.isInteger(A)&&this._requestChunks([A])}for(const A of g){const e=this._promisesByRequest.get(A);this._promisesByRequest.delete(A),e.resolve()}this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize,total:this.length})}onError(A){this._loadedStreamCapability.reject(A)}getBeginChunk(A){return Math.floor(A/this.chunkSize)}getEndChunk(A){return Math.floor((A-1)/this.chunkSize)+1}abort(A){this.aborted=!0,this.pdfNetworkStream?.cancelAllRequests(A);for(const e of this._promisesByRequest.values())e.reject(A)}}class re{constructor(A,e){this.name=A,this.numComps=e}getRgb(A,e){const t=new Uint8ClampedArray(3);return this.getRgbItem(A,e,t,0),t}getRgbItem(A,e,t,i){R("Should not call ColorSpace.getRgbItem")}getRgbBuffer(A,e,t,i,a,s,n){R("Should not call ColorSpace.getRgbBuffer")}getOutputLength(A,e){R("Should not call ColorSpace.getOutputLength")}isPassthrough(A){return!1}isDefaultDecode(A,e){return re.isDefaultDecode(A,this.numComps)}fillRgb(A,e,t,i,a,s,n,g,r){const o=e*t;let I=null;const c=1<c&&"DeviceGray"!==this.name&&"DeviceRGB"!==this.name){const e=n<=8?new Uint8Array(c):new Uint16Array(c);for(let A=0;A=.99554525?1:this.#Q(0,1,1.055*A**(1/2.4)-.055)}#Q(A,e,t){return Math.max(A,Math.min(e,t))}#l(A){return A<0?-this.#l(-A):A>8?((A+16)/116)**3:A*Ee.#I}#E(A,e,t){if(0===A[0]&&0===A[1]&&0===A[2])return t[0]=e[0],t[1]=e[1],void(t[2]=e[2]);const i=this.#l(0),a=(1-i)/(1-this.#l(A[0])),s=1-a,n=(1-i)/(1-this.#l(A[1])),g=1-n,r=(1-i)/(1-this.#l(A[2])),o=1-r;t[0]=e[0]*a+s,t[1]=e[1]*n+g,t[2]=e[2]*r+o}#u(A,e,t){if(1===A[0]&&1===A[2])return t[0]=e[0],t[1]=e[1],void(t[2]=e[2]);const i=t;this.#c(Ee.#i,e,i);const a=Ee.#g;this.#C(A,i,a),this.#c(Ee.#a,a,t)}#d(A,e,t){const i=t;this.#c(Ee.#i,e,i);const a=Ee.#g;this.#B(A,i,a),this.#c(Ee.#a,a,t)}#t(A,e,t,i,a){const s=this.#Q(0,1,A[e]*a),n=this.#Q(0,1,A[e+1]*a),g=this.#Q(0,1,A[e+2]*a),r=1===s?1:s**this.GR,o=1===n?1:n**this.GG,I=1===g?1:g**this.GB,c=this.MXA*r+this.MXB*o+this.MXC*I,C=this.MYA*r+this.MYB*o+this.MYC*I,B=this.MZA*r+this.MZB*o+this.MZC*I,h=Ee.#r;h[0]=c,h[1]=C,h[2]=B;const Q=Ee.#o;this.#u(this.whitePoint,h,Q);const l=Ee.#r;this.#E(this.blackPoint,Q,l);const E=Ee.#o;this.#d(Ee.#n,l,E);const u=Ee.#r;this.#c(Ee.#s,E,u),t[i]=255*this.#h(u[0]),t[i+1]=255*this.#h(u[1]),t[i+2]=255*this.#h(u[2])}getRgbItem(A,e,t,i){this.#t(A,e,t,i,1)}getRgbBuffer(A,e,t,i,a,s,n){const g=1/((1<this.amax||this.bmin>this.bmax)&&(F("Invalid Range, falling back to defaults"),this.amin=-100,this.amax=100,this.bmin=-100,this.bmax=100)}#f(A){return A>=6/29?A**3:108/841*(A-4/29)}#p(A,e,t,i){return t+A*(i-t)/e}#t(A,e,t,i,a){let s=A[e],n=A[e+1],g=A[e+2];!1!==t&&(s=this.#p(s,t,0,100),n=this.#p(n,t,this.amin,this.amax),g=this.#p(g,t,this.bmin,this.bmax)),n>this.amax?n=this.amax:nthis.bmax?g=this.bmax:g>>0}function fe(A,e){return 1===e?String.fromCharCode(A[0],A[1]):3===e?String.fromCharCode(A[0],A[1],A[2],A[3]):String.fromCharCode(...A.subarray(0,e+1))}function pe(A,e,t){let i=0;for(let a=t;a>=0;a--)i+=A[a]+e[a],A[a]=255&i,i>>=8}function me(A,e){let t=1;for(let i=e;i>=0&&t>0;i--)t+=A[i],A[i]=255&t,t>>=8}const ye=16;class we{constructor(A){this.buffer=A,this.pos=0,this.end=A.length,this.tmpBuf=new Uint8Array(19)}readByte(){return this.pos>=this.end?-1:this.buffer[this.pos++]}readNumber(){let A,e=0;do{const t=this.readByte();if(t<0)throw new v("unexpected EOF in bcmap");A=!(128&t),e=e<<7|127&t}while(!A);return e}readSigned(){const A=this.readNumber();return 1&A?~(A>>>1):A>>>1}readHex(A,e){A.set(this.buffer.subarray(this.pos,this.pos+e+1)),this.pos+=e+1}readHexNumber(A,e){let t;const i=this.tmpBuf;let a=0;do{const A=this.readByte();if(A<0)throw new v("unexpected EOF in bcmap");t=!(128&A),i[a++]=127&A}while(!t);let s=e,n=0,g=0;for(;s>=0;){for(;g<8&&i.length>0;)n|=i[--a]<>=8,g-=8}}readHexSigned(A,e){this.readHexNumber(A,e);const t=1&A[e]?255:0;let i=0;for(let a=0;a<=e;a++)i=(1&i)<<8|A[a],A[a]=i>>1^t}readString(){const A=this.readNumber(),e=new Array(A);for(let t=0;t=0;){const A=C>>5;if(7===A){switch(31&C){case 0:i.readString();break;case 1:s=i.readString()}continue}const t=!!(16&C),a=15&C;if(a+1>ye)throw new Error("BinaryCMapReader.process: Invalid dataSize.");const B=1,h=i.readNumber();switch(A){case 0:i.readHex(n,a),i.readHexNumber(g,a),pe(g,n,a),e.addCodespaceRange(a+1,de(n,a),de(g,a));for(let A=1;Aa&&(i=a)}else{for(;!this.eof;)this.readBlock(e);i=this.bufferLength}return this.pos=i,this.buffer.subarray(t,i)}async getImageData(A,e=null){if(!this.canAsyncDecodeImageFromBuffer)return this.getBytes(A,e);const t=await this.stream.asyncGetBytes();return this.decodeImage(t,e)}reset(){this.pos=0}makeSubStream(A,e,t=null){if(void 0===e)for(;!this.eof;)this.readBlock();else{const t=A+e;for(;this.bufferLength<=t&&!this.eof;)this.readBlock()}return new ie(this.buffer,A,e,t)}getBaseStreams(){return this.str?this.str.getBaseStreams():null}}class Fe extends ke{constructor(A,e=null){let t=0;for(const e of A)t+=e instanceof ke?e._rawMinBufferLength:e.length;super(t),this.streams=A,this._onError=e}readBlock(){const A=this.streams;if(0===A.length)return void(this.eof=!0);const e=A.shift();let t;try{t=e.getBytes()}catch(A){if(this._onError)return void this._onError(A,e.dict?.objId);throw A}const i=this.bufferLength,a=i+t.length;this.ensureBuffer(a).set(t,i),this.bufferLength=a}getBaseStreams(){const A=[];for(const e of this.streams){const t=e.getBaseStreams();t&&A.push(...t)}return A.length>0?A:null}}class Se extends ke{constructor(A,e){e&&(e*=.8),super(e),this.str=A,this.dict=A.dict,this.input=new Uint8Array(5)}readBlock(){const A=this.str;let e=A.getByte();for(;UA(e);)e=A.getByte();if(-1===e||126===e)return void(this.eof=!0);const t=this.bufferLength;let i,a;if(122===e){for(i=this.ensureBuffer(t+4),a=0;a<4;++a)i[t+a]=0;this.bufferLength+=4}else{const s=this.input;for(s[0]=e,a=1;a<5;++a){for(e=A.getByte();UA(e);)e=A.getByte();if(s[a]=e,-1===e||126===e)break}if(i=this.ensureBuffer(t+a-1),this.bufferLength+=a-1,a<5){for(;a<5;++a)s[a]=117;this.eof=!0}let n=0;for(a=0;a<5;++a)n=85*n+(s[a]-33);for(a=3;a>=0;--a)i[t+a]=255&n,n>>=8}}}class Re extends ke{constructor(A,e){e&&(e*=.5),super(e),this.str=A,this.dict=A.dict,this.firstDigit=-1}readBlock(){const A=this.str.getBytes(8e3);if(!A.length)return void(this.eof=!0);const e=A.length+1>>1,t=this.ensureBuffer(this.bufferLength+e);let i=this.bufferLength,a=this.firstDigit;for(const e of A){let A;if(e>=48&&e<=57)A=15&e;else{if(!(e>=65&&e<=70||e>=97&&e<=102)){if(62===e){this.eof=!0;break}continue}A=9+(15&e)}a<0?a=A:(t[i++]=a<<4|A,a=-1)}a>=0&&this.eof&&(t[i++]=a<<4,a=-1),this.firstDigit=a,this.bufferLength=i}}const Ge=-1,Ne=[[-1,-1],[-1,-1],[7,8],[7,7],[6,6],[6,6],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]],xe=[[-1,-1],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],Ue=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]],Me=[[-1,-1],[-1,-1],[12,-2],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],Le=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],Je=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];class He{constructor(A,e={}){if(!A||"function"!=typeof A.next)throw new Error('CCITTFaxDecoder - invalid "source" parameter.');let t;for(this.source=A,this.eof=!1,this.encoding=e.K||0,this.eoline=e.EndOfLine||!1,this.byteAlign=e.EncodedByteAlign||!1,this.columns=e.Columns||1728,this.rows=e.Rows||0,this.eoblock=e.EndOfBlock??!0,this.black=e.BlackIs1||!1,this.codingLine=new Uint32Array(this.columns+1),this.refLine=new Uint32Array(this.columns+2),this.codingLine[0]=this.columns,this.codingPos=0,this.row=0,this.nextLine2D=this.encoding<0,this.inputBits=0,this.inputBuf=0,this.outputBits=0,this.rowsDone=!1;0===(t=this._lookBits(12));)this._eatBits(1);1===t&&this._eatBits(12),this.encoding>0&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1))}readNextChar(){if(this.eof)return-1;const A=this.refLine,e=this.codingLine,t=this.columns;let i,a,s,n,g;if(0===this.outputBits){if(this.rowsDone&&(this.eof=!0),this.eof)return-1;let s,g,r;if(this.err=!1,this.nextLine2D){for(n=0;e[n]=64);do{g+=r=this._getWhiteCode()}while(r>=64)}else{do{s+=r=this._getWhiteCode()}while(r>=64);do{g+=r=this._getBlackCode()}while(r>=64)}for(this._addPixels(e[this.codingPos]+s,a),e[this.codingPos]0?--i:++i;A[i]<=e[this.codingPos]&&A[i]0?--i:++i;A[i]<=e[this.codingPos]&&A[i]0?--i:++i;A[i]<=e[this.codingPos]&&A[i]=64);else do{s+=r=this._getWhiteCode()}while(r>=64);this._addPixels(e[this.codingPos]+s,a),a^=1}let o=!1;if(this.byteAlign&&(this.inputBits&=-8),this.eoblock||this.row!==this.rows-1){if(s=this._lookBits(12),this.eoline)for(;s!==Ge&&1!==s;)this._eatBits(1),s=this._lookBits(12);else for(;0===s;)this._eatBits(1),s=this._lookBits(12);1===s?(this._eatBits(12),o=!0):s===Ge&&(this.eof=!0)}else this.rowsDone=!0;if(!this.eof&&this.encoding>0&&!this.rowsDone&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1)),this.eoblock&&o&&this.byteAlign){if(s=this._lookBits(12),1===s){if(this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1)),this.encoding>=0)for(n=0;n<4;++n)s=this._lookBits(12),1!==s&&F("bad rtc code: "+s),this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1));this.eof=!0}}else if(this.err&&this.eoline){for(;;){if(s=this._lookBits(13),s===Ge)return this.eof=!0,-1;if(s>>1==1)break;this._eatBits(1)}this._eatBits(12),this.encoding>0&&(this._eatBits(1),this.nextLine2D=!(1&s))}this.outputBits=e[0]>0?e[this.codingPos=0]:e[this.codingPos=1],this.row++}if(this.outputBits>=8)g=1&this.codingPos?0:255,this.outputBits-=8,0===this.outputBits&&e[this.codingPos]s?(g<<=s,1&this.codingPos||(g|=255>>8-s),this.outputBits-=s,s=0):(g<<=this.outputBits,1&this.codingPos||(g|=255>>8-this.outputBits),s-=this.outputBits,this.outputBits=0,e[this.codingPos]0&&(g<<=s,s=0))}while(s)}return this.black&&(g^=255),g}_addPixels(A,e){const t=this.codingLine;let i=this.codingPos;A>t[i]&&(A>this.columns&&(F("row is wrong length"),this.err=!0,A=this.columns),1&i^e&&++i,t[i]=A),this.codingPos=i}_addPixelsNeg(A,e){const t=this.codingLine;let i=this.codingPos;if(A>t[i])A>this.columns&&(F("row is wrong length"),this.err=!0,A=this.columns),1&i^e&&++i,t[i]=A;else if(A0&&A=a){const e=t[A-a];if(e[0]===i)return this._eatBits(i),[!0,e[1],!0]}}return[!1,0,!1]}_getTwoDimCode(){let A,e=0;if(this.eoblock){if(e=this._lookBits(7),A=Ne[e],A?.[0]>0)return this._eatBits(A[0]),A[1]}else{const A=this._findTableCode(1,7,Ne);if(A[0]&&A[2])return A[1]}return F("Bad two dim code"),Ge}_getWhiteCode(){let A,e=0;if(this.eoblock){if(e=this._lookBits(12),e===Ge)return 1;if(A=e>>5?Ue[e>>3]:xe[e],A[0]>0)return this._eatBits(A[0]),A[1]}else{let A=this._findTableCode(1,9,Ue);if(A[0])return A[1];if(A=this._findTableCode(11,12,xe),A[0])return A[1]}return F("bad white code"),this._eatBits(1),1}_getBlackCode(){let A,e;if(this.eoblock){if(A=this._lookBits(13),A===Ge)return 1;if(e=A>>7?!(A>>9)&&A>>7?Le[(A>>1)-64]:Je[A>>7]:Me[A],e[0]>0)return this._eatBits(e[0]),e[1]}else{let A=this._findTableCode(2,6,Je);if(A[0])return A[1];if(A=this._findTableCode(7,12,Le,64),A[0])return A[1];if(A=this._findTableCode(10,13,Me),A[0])return A[1]}return F("bad black code"),this._eatBits(1),1}_lookBits(A){let e;for(;this.inputBits>16-A;this.inputBuf=this.inputBuf<<8|e,this.inputBits+=8}return this.inputBuf>>this.inputBits-A&65535>>16-A}_eatBits(A){(this.inputBits-=A)<0&&(this.inputBits=0)}}class Ye extends ke{constructor(A,e,t){super(e),this.str=A,this.dict=A.dict,t instanceof cA||(t=cA.empty);const i={next:()=>A.getByte()};this.ccittFaxDecoder=new He(i,{K:t.get("K"),EndOfLine:t.get("EndOfLine"),EncodedByteAlign:t.get("EncodedByteAlign"),Columns:t.get("Columns"),Rows:t.get("Rows"),EndOfBlock:t.get("EndOfBlock"),BlackIs1:t.get("BlackIs1")})}readBlock(){for(;!this.eof;){const A=this.ccittFaxDecoder.readNextChar();if(-1===A)return void(this.eof=!0);this.ensureBuffer(this.bufferLength+1),this.buffer[this.bufferLength++]=A}}}const ve=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ke=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),qe=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),Te=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],Pe=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];class We extends ke{constructor(A,e){super(e),this.str=A,this.dict=A.dict;const t=A.getByte(),i=A.getByte();if(-1===t||-1===i)throw new v(`Invalid header in flate stream: ${t}, ${i}`);if(8!=(15&t))throw new v(`Unknown compression method in flate stream: ${t}, ${i}`);if(((t<<8)+i)%31!=0)throw new v(`Bad FCHECK in flate stream: ${t}, ${i}`);if(32&i)throw new v(`FDICT bit set in flate stream: ${t}, ${i}`);this.codeSize=0,this.codeBuf=0}async getImageData(A,e){const t=await this.asyncGetBytes();return t?.subarray(0,A)||this.getBytes(A)}async asyncGetBytes(){this.str.reset();const A=this.str.getBytes();try{const{readable:e,writable:t}=new DecompressionStream("deflate"),i=t.getWriter();i.write(A),i.close();const a=[];let s=0;for await(const A of e)a.push(A),s+=A.byteLength;const n=new Uint8Array(s);let g=0;for(const A of a)n.set(A,g),g+=A.byteLength;return n}catch{return this.str=new ie(A,2,A.length,this.str.dict),this.reset(),null}}get isAsync(){return!0}getBits(A){const e=this.str;let t,i=this.codeSize,a=this.codeBuf;for(;i>A,this.codeSize=i-=A,t}getCode(A){const e=this.str,t=A[0],i=A[1];let a,s=this.codeSize,n=this.codeBuf;for(;s>16,o=65535&g;if(r<1||s>r,this.codeSize=s-r,o}generateHuffmanTable(A){const e=A.length;let t,i=0;for(t=0;ti&&(i=A[t]);const a=1<>=1;for(t=A;t>=1,0===e){let e;if(-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");let t=e;if(-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");if(t|=e<<8,-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");let a=e;if(-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");if(a|=e<<8,a!==(65535&~t)&&(0!==t||0!==a))throw new v("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;const s=this.bufferLength,n=s+t;if(A=this.ensureBuffer(n),this.bufferLength=n,0===t)-1===i.peekByte()&&(this.eof=!0);else{const e=i.getBytes(t);A.set(e,s),e.length0;)I[g++]=B}a=this.generateHuffmanTable(I.subarray(0,A)),s=this.generateHuffmanTable(I.subarray(A,o))}}A=this.buffer;let n=A?A.length:0,g=this.bufferLength;for(;;){let e=this.getCode(a);if(e<256){g+1>=n&&(A=this.ensureBuffer(g+1),n=A.length),A[g++]=e;continue}if(256===e)return void(this.bufferLength=g);e-=257,e=Ke[e];let i=e>>16;i>0&&(i=this.getBits(i)),t=(65535&e)+i,e=this.getCode(s),e=qe[e],i=e>>16,i>0&&(i=this.getBits(i));const r=(65535&e)+i;g+t>=n&&(A=this.ensureBuffer(g+t),n=A.length);for(let e=0;e>9&127,this.clow=this.clow<<7&65535,this.ct-=7,this.a=32768}byteIn(){const A=this.data;let e=this.bp;255===A[e]?A[e+1]>143?(this.clow+=65280,this.ct=8):(e++,this.clow+=A[e]<<9,this.ct=7,this.bp=e):(e++,this.clow+=e65535&&(this.chigh+=this.clow>>16,this.clow&=65535)}readBit(A,e){let t=A[e]>>1,i=1&A[e];const a=Ze[t],s=a.qe;let n,g=this.a-s;if(this.chigh>15&1,this.clow=this.clow<<1&65535,this.ct--}while(!(32768&g));return this.a=g,A[e]=t<<1|i,n}}class Xe extends U{constructor(A){super(A,"Jbig2Error")}}class Ve{getContexts(A){return A in this?this[A]:this[A]=new Int8Array(65536)}}class je{constructor(A,e,t){this.data=A,this.start=e,this.end=t}get decoder(){return x(this,"decoder",new Oe(this.data,this.start,this.end))}get contextCache(){return x(this,"contextCache",new Ve)}}function ze(A,e,t){const i=A.getContexts(e);let a=1;function s(A){let e=0;for(let s=0;s>>0}const n=s(1),g=s(1)?s(1)?s(1)?s(1)?s(1)?s(32)+4436:s(12)+340:s(8)+84:s(6)+20:s(4)+4:s(2);let r;return 0===n?r=g:g>0&&(r=-g),r>=-2147483648&&r<=2147483647?r:null}function _e(A,e,t){const i=A.getContexts("IAID");let a=1;for(let A=0;A=w&&N=D)for(H=H<<1&l,Q=0;Q=0&&U=0&&(M=S[x][U],M&&(H|=M<=A?o<<=1:o=o<<1|p[g][r];for(B=0;B=d||r<0||r>=u?o<<=1:o=o<<1|i[g][r];const h=m.readBit(y,o);e[n]=h}}return p}function nt(A,e,t,i,a,s,n,g,r,o,I,c,C,B,h,Q,l,E,u){if(A&&e)throw new Xe("refinement with Huffman is not supported");const d=[];let f,p;for(f=0;f1&&(a=A?u.readBits(E):ze(y,"IAIT",m));const s=n*w+a,D=A?B.symbolIDTable.decode(u):_e(y,m,r),b=e&&(A?u.readBit():ze(y,"IARI",m));let k=g[D],F=k[0].length,S=k.length;if(b){const A=ze(y,"IARDW",m),e=ze(y,"IARDH",m);F+=A,S+=e,k=st(F,S,h,k,(A>>1)+ze(y,"IARDX",m),(e>>1)+ze(y,"IARDY",m),!1,Q,l)}let R=0;o?1&c?R=S-1:i+=S-1:c>1?i+=F-1:R=F-1;const G=s-(1&c?0:S-1),N=i-(2&c?F-1:0);let x,U,M;if(o)for(x=0;x>5&7;const r=[31&n];let o=e+6;if(7===n){g=536870911&xA(A,o-1),o+=3;let e=g+7>>3;for(r[0]=A[o++];--e>0;)r.push(A[o++])}else if(5===n||6===n)throw new Xe("invalid referred-to flags");t.retainBits=r;let I=4;t.number<=256?I=1:t.number<=65536&&(I=2);const c=[];let C,B;for(C=0;C>>24&255,s[3]=e.height>>16&255,s[4]=e.height>>8&255,s[5]=255&e.height,C=o,B=A.length;C>2&3,A.huffmanDWSelector=e>>4&3,A.bitmapSizeSelector=e>>6&1,A.aggregationInstancesSelector=e>>7&1,A.bitmapCodingContextUsed=!!(256&e),A.bitmapCodingContextRetained=!!(512&e),A.template=e>>10&3,A.refinementTemplate=e>>12&1,o+=2,!A.huffman){for(r=0===A.template?4:1,n=[],g=0;g>2&3,I.stripSize=1<>4&3,I.transposed=!!(64&c),I.combinationOperator=c>>7&3,I.defaultPixelValue=c>>9&1,I.dsOffset=c<<17>>27,I.refinementTemplate=c>>15&1,I.huffman){const A=NA(i,o);o+=2,I.huffmanFS=3&A,I.huffmanDS=A>>2&3,I.huffmanDT=A>>4&3,I.huffmanRefinementDW=A>>6&3,I.huffmanRefinementDH=A>>8&3,I.huffmanRefinementDX=A>>10&3,I.huffmanRefinementDY=A>>12&3,I.huffmanRefinementSizeSelector=!!(16384&A)}if(I.refinement&&!I.refinementTemplate){for(n=[],g=0;g<2;g++)n.push({x:GA(i,o),y:GA(i,o+1)}),o+=2;I.refinementAt=n}I.numberOfSymbolInstances=xA(i,o),o+=4,s=[I,t.referredTo,i,o,a];break;case 16:const C={},B=i[o++];C.mmr=!!(1&B),C.template=B>>1&3,C.patternWidth=i[o++],C.patternHeight=i[o++],C.maxPatternIndex=xA(i,o),o+=4,s=[C,t.number,i,o,a];break;case 22:case 23:const h={};h.info=ot(i,o),o+=It;const Q=i[o++];h.mmr=!!(1&Q),h.template=Q>>1&3,h.enableSkip=!!(8&Q),h.combinationOperator=Q>>4&7,h.defaultPixelValue=Q>>7&1,h.gridWidth=xA(i,o),o+=4,h.gridHeight=xA(i,o),o+=4,h.gridOffsetX=4294967295&xA(i,o),o+=4,h.gridOffsetY=4294967295&xA(i,o),o+=4,h.gridVectorX=NA(i,o),o+=2,h.gridVectorY=NA(i,o),o+=2,s=[h,t.referredTo,i,o,a];break;case 38:case 39:const l={};l.info=ot(i,o),o+=It;const E=i[o++];if(l.mmr=!!(1&E),l.template=E>>1&3,l.prediction=!!(8&E),!l.mmr){for(r=0===l.template?4:1,n=[],g=0;g>2&1,u.combinationOperator=d>>3&3,u.requiresBuffer=!!(32&d),u.combinationOperatorOverride=!!(64&d),s=[u];break;case 49:case 50:case 51:case 62:break;case 53:s=[t.number,i,o,a];break;default:throw new Xe(`segment type ${t.typeName}(${t.type}) is not implemented`)}const I="on"+t.typeName;I in e&&e[I].apply(e,s)}function Ct(A,e){for(let t=0,i=A.length;t>3,t=new Uint8ClampedArray(e*A.height);A.defaultPixelValue&&t.fill(255),this.buffer=t}drawBitmap(A,e){const t=this.currentPageInfo,i=A.width,a=A.height,s=t.width+7>>3,n=t.combinationOperatorOverride?A.combinationOperator:t.combinationOperator,g=this.buffer,r=128>>(7&A.x);let o,I,c,C,B=A.y*s+(A.x>>3);switch(n){case 0:for(o=0;o>=1,c||(c=128,C++);B+=s}break;case 2:for(o=0;o>=1,c||(c=128,C++);B+=s}break;default:throw new Xe(`operator ${n} is not supported`)}}onImmediateGenericRegion(A,e,t,i){const a=A.info,s=new je(e,t,i),n=at(A.mmr,a.width,a.height,A.template,A.prediction,null,A.at,s);this.drawBitmap(a,n)}onImmediateLosslessGenericRegion(){this.onImmediateGenericRegion(...arguments)}onSymbolDictionary(A,e,t,i,a,s){let n,g;A.huffman&&(n=function(A,e,t){let i,a,s,n,g=0;switch(A.huffmanDHSelector){case 0:case 1:i=ut(A.huffmanDHSelector+4);break;case 3:i=ft(g,e,t),g++;break;default:throw new Xe("invalid Huffman DH selector")}switch(A.huffmanDWSelector){case 0:case 1:a=ut(A.huffmanDWSelector+2);break;case 3:a=ft(g,e,t),g++;break;default:throw new Xe("invalid Huffman DW selector")}return A.bitmapSizeSelector?(s=ft(g,e,t),g++):s=ut(1),n=A.aggregationInstancesSelector?ft(g,e,t):ut(1),{tableDeltaHeight:i,tableDeltaWidth:a,tableBitmapSize:s,tableAggregateInstances:n}}(A,t,this.customTables),g=new dt(i,a,s));let r=this.symbols;r||(this.symbols=r={});const o=[];for(const A of t){const e=r[A];e&&o.push(...e)}const I=new je(i,a,s);r[e]=function(A,e,t,i,a,s,n,g,r,o,I,c){if(A&&e)throw new Xe("symbol refinement with Huffman is not supported");const C=[];let B=0,h=RA(t.length+i);const Q=I.decoder,l=I.contextCache;let E,u;for(A&&(E=ut(1),u=[],h=Math.max(h,1));C.length1)d=nt(A,e,i,B,0,a,1,t.concat(C),h,0,0,1,0,s,r,o,I,0,c);else{const A=_e(l,Q,h),e=ze(l,"IARDX",Q),a=ze(l,"IARDY",Q);d=st(i,B,r,A=32){let t,i,n;switch(e){case 32:if(0===A)throw new Xe("no previous value in symbol ID table");i=a.readBits(2)+3,t=s[A-1].prefixLength;break;case 33:i=a.readBits(3)+3,t=0;break;case 34:i=a.readBits(7)+11,t=0;break;default:throw new Xe("invalid code length in symbol ID table")}for(n=0;n=0;l--)k=A?mt(b,r,o,!0):at(!1,r,o,t,!1,null,w,h),D[l]=k;for(F=0;F=0;E--)R^=D[E][F][S],G|=R<>8,U=c+F*C-S*B>>8,x>=0&&x+p<=i&&U>=0&&U+m<=a)for(l=0;l=a))for(L=Q[e],M=N[l],E=0;E=0&&A>1&7),r=1+(i>>4&7),o=[];let I,c,C=a;do{I=n.readBits(g),c=n.readBits(r),o.push(new ht([C,I,c,0])),C+=1<>e&1;if(e<=0)this.children[t]=new Qt(A);else{let i=this.children[t];i||(this.children[t]=i=new Qt(null)),i.buildTree(A,e-1)}}decodeNode(A){if(this.isLeaf){if(this.isOOB)return null;const e=A.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-e:e)}const e=this.children[A.readBit()];if(!e)throw new Xe("invalid Huffman data");return e.decodeNode(A)}}class lt{constructor(A,e){e||this.assignPrefixCodes(A),this.rootNode=new Qt(null);for(let e=0,t=A.length;e0&&this.rootNode.buildTree(t,t.prefixLength-1)}}decode(A){return this.rootNode.decodeNode(A)}assignPrefixCodes(A){const e=A.length;let t=0;for(let i=0;i=this.end)throw new Xe("end of data while reading bit");this.currentByte=this.data[this.position++],this.shift=7}const A=this.currentByte>>this.shift&1;return this.shift--,A}readBits(A){let e,t=0;for(e=A-1;e>=0;e--)t|=this.readBit()<=this.end?-1:this.data[this.position++]}}function ft(A,e,t){let i=0;for(let a=0,s=e.length;a>t&1,t--}if(i&&!g){const A=5;for(let e=0;e>3,c=7&i,C=A.length;t=new Uint32Array(t.buffer);let B=0;for(let i=0;i0&&!A[s-1];)s--;const n=[{children:[],index:0}];let g,r=n[0];for(t=0;t0;)r=n.pop();for(r.index++,n.push(r);n.length<=t;)n.push(g={children:[],index:0}),r.children[r.index]=g.children,r=g;a++}t+10)return h--,B>>h&1;if(B=A[e++],255===B){const i=A[e++];if(i){if(220===i&&o){const i=NA(A,e+=2);if(e+=2,i>0&&i!==t.scanLines)throw new kt("Found DNL marker (0xFFDC) while parsing scan data",i)}else if(217===i){if(o){const A=m*(8===t.precision?8:0);if(A>0&&Math.round(t.scanLines/A)>=5)throw new kt("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",A)}throw new Ft("Found EOI marker (0xFFD9) while parsing scan data")}throw new bt(`unexpected marker ${(B<<8|i).toString(16)}`)}}return h=7,B>>>7}function l(A){let e=A;for(;;){switch(e=e[Q()],typeof e){case"number":return e;case"object":continue}throw new bt("invalid huffman sequence")}}function E(A){let e=0;for(;A>0;)e=e<<1|Q(),A--;return e}function u(A){if(1===A)return 1===Q()?1:-1;const e=E(A);return e>=1<0)return void f--;let t=s;const i=n;for(;t<=i;){const i=l(A.huffmanTableAC),a=15&i,s=i>>4;if(0===a){if(s<15){f=E(s)+(1<>4,0===a)o<15?(f=E(o)+(1<>4;if(0===i){if(s<15)break;a+=16;continue}a+=s;const n=St[a];A.blockData[e+n]=u(i),a++}};let x,U=0;const M=1===D?i[0].blocksPerLine*i[0].blocksPerColumn:I*t.mcusPerColumn;let L,J;for(;U<=M;){const t=a?Math.min(M-U,a):M;if(t>0){for(k=0;k0?"unexpected":"excessive"} MCU data, current marker is: ${x.invalid}`),e=x.offset),!(x.marker>=65488&&x.marker<=65495))break;e+=2}return e-C}function Kt(A,e,t){const i=A.quantizationTable,a=A.blockData;let s,n,g,r,o,I,c,C,B,h,Q,l,E,u,d,f,p;if(!i)throw new bt("missing required Quantization Table.");for(let A=0;A<64;A+=8)B=a[e+A],h=a[e+A+1],Q=a[e+A+2],l=a[e+A+3],E=a[e+A+4],u=a[e+A+5],d=a[e+A+6],f=a[e+A+7],B*=i[A],h|Q|l|E|u|d|f?(h*=i[A+1],Q*=i[A+2],l*=i[A+3],E*=i[A+4],u*=i[A+5],d*=i[A+6],f*=i[A+7],s=Lt*B+128>>8,n=Lt*E+128>>8,g=Q,r=d,o=Jt*(h-f)+128>>8,C=Jt*(h+f)+128>>8,I=l<<4,c=u<<4,s=s+n+1>>1,n=s-n,p=g*Mt+r*Ut+128>>8,g=g*Ut-r*Mt+128>>8,r=p,o=o+c+1>>1,c=o-c,C=C+I+1>>1,I=C-I,s=s+r+1>>1,r=s-r,n=n+g+1>>1,g=n-g,p=o*xt+C*Nt+2048>>12,o=o*Nt-C*xt+2048>>12,C=p,p=I*Gt+c*Rt+2048>>12,I=I*Rt-c*Gt+2048>>12,c=p,t[A]=s+C,t[A+7]=s-C,t[A+1]=n+c,t[A+6]=n-c,t[A+2]=g+I,t[A+5]=g-I,t[A+3]=r+o,t[A+4]=r-o):(p=Lt*B+512>>10,t[A]=p,t[A+1]=p,t[A+2]=p,t[A+3]=p,t[A+4]=p,t[A+5]=p,t[A+6]=p,t[A+7]=p);for(let A=0;A<8;++A)B=t[A],h=t[A+8],Q=t[A+16],l=t[A+24],E=t[A+32],u=t[A+40],d=t[A+48],f=t[A+56],h|Q|l|E|u|d|f?(s=Lt*B+2048>>12,n=Lt*E+2048>>12,g=Q,r=d,o=Jt*(h-f)+2048>>12,C=Jt*(h+f)+2048>>12,I=l,c=u,s=4112+(s+n+1>>1),n=s-n,p=g*Mt+r*Ut+2048>>12,g=g*Ut-r*Mt+2048>>12,r=p,o=o+c+1>>1,c=o-c,C=C+I+1>>1,I=C-I,s=s+r+1>>1,r=s-r,n=n+g+1>>1,g=n-g,p=o*xt+C*Nt+2048>>12,o=o*Nt-C*xt+2048>>12,C=p,p=I*Gt+c*Rt+2048>>12,I=I*Rt-c*Gt+2048>>12,c=p,B=s+C,f=s-C,h=n+c,d=n-c,Q=g+I,u=g-I,l=r+o,E=r-o,B<16?B=0:B>=4080?B=255:B>>=4,h<16?h=0:h>=4080?h=255:h>>=4,Q<16?Q=0:Q>=4080?Q=255:Q>>=4,l<16?l=0:l>=4080?l=255:l>>=4,E<16?E=0:E>=4080?E=255:E>>=4,u<16?u=0:u>=4080?u=255:u>>=4,d<16?d=0:d>=4080?d=255:d>>=4,f<16?f=0:f>=4080?f=255:f>>=4,a[e+A]=B,a[e+A+8]=h,a[e+A+16]=Q,a[e+A+24]=l,a[e+A+32]=E,a[e+A+40]=u,a[e+A+48]=d,a[e+A+56]=f):(p=Lt*B+8192>>14,p=p<-2040?0:p>=2024?255:p+2056>>4,a[e+A]=p,a[e+A+8]=p,a[e+A+16]=p,a[e+A+24]=p,a[e+A+32]=p,a[e+A+40]=p,a[e+A+48]=p,a[e+A+56]=p)}function qt(A,e){const t=e.blocksPerLine,i=e.blocksPerColumn,a=new Int16Array(64);for(let A=0;A=i)return null;const s=NA(A,e);if(s>=65472&&s<=65534)return{invalid:null,marker:s,offset:e};let n=NA(A,a);for(;!(n>=65472&&n<=65534);){if(++a>=i)return null;n=NA(A,a)}return{invalid:s.toString(16),marker:n,offset:a}}class Pt{constructor({decodeTransform:A=null,colorTransform:e=-1}={}){this._decodeTransform=A,this._colorTransform=e}parse(A,{dnlScanLines:e=null}={}){function t(){const e=NA(A,n);n+=2;let t=n+e-2;const i=Tt(A,t,n);i?.invalid&&(S("readDataBlock - incorrect length, current marker is: "+i.invalid),t=i.offset);const a=A.subarray(n,t);return n+=a.length,a}function i(A){const e=Math.ceil(A.samplesPerLine/8/A.maxH),t=Math.ceil(A.scanLines/8/A.maxV);for(const i of A.components){const a=Math.ceil(Math.ceil(A.samplesPerLine/8)*i.h/A.maxH),s=Math.ceil(Math.ceil(A.scanLines/8)*i.v/A.maxV),n=e*i.h,g=t*i.v*64*(n+1);i.blockData=new Int16Array(g),i.blocksPerLine=a,i.blocksPerColumn=s}A.mcusPerLine=e,A.mcusPerColumn=t}let a,s,n=0,g=null,r=null,o=0;const I=[],c=[],C=[];let B=NA(A,n);if(n+=2,65496!==B)throw new bt("SOI not found");B=NA(A,n),n+=2;A:for(;65497!==B;){let h,Q,l;switch(B){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:const E=t();65504===B&&74===E[0]&&70===E[1]&&73===E[2]&&70===E[3]&&0===E[4]&&(g={version:{major:E[5],minor:E[6]},densityUnits:E[7],xDensity:E[8]<<8|E[9],yDensity:E[10]<<8|E[11],thumbWidth:E[12],thumbHeight:E[13],thumbData:E.subarray(14,14+3*E[12]*E[13])}),65518===B&&65===E[0]&&100===E[1]&&111===E[2]&&98===E[3]&&101===E[4]&&(r={version:E[5]<<8|E[6],flags0:E[7]<<8|E[8],flags1:E[9]<<8|E[10],transformCode:E[11]});break;case 65499:const u=NA(A,n);n+=2;const d=u+n-2;let f;for(;n>4){if(e>>4!=1)throw new bt("DQT - invalid table spec");for(Q=0;Q<64;Q++)f=St[Q],t[f]=NA(A,n),n+=2}else for(Q=0;Q<64;Q++)f=St[Q],t[f]=A[n++];I[15&e]=t}break;case 65472:case 65473:case 65474:if(a)throw new bt("Only single frame JPEGs supported");n+=2,a={},a.extended=65473===B,a.progressive=65474===B,a.precision=A[n++];const p=NA(A,n);n+=2,a.scanLines=e||p,a.samplesPerLine=NA(A,n),n+=2,a.components=[],a.componentIds={};const m=A[n++];let y=0,w=0;for(h=0;h>4,i=15&A[n+1];y>4?c:C)[15&e]=Ht(t,a)}break;case 65501:n+=2,s=NA(A,n),n+=2;break;case 65498:const b=1==++o&&!e;n+=2;const k=A[n++],F=[];for(h=0;h>4],i.huffmanTableAC=c[15&s],F.push(i)}const R=A[n++],G=A[n++],N=A[n++];try{const e=vt(A,n,a,F,s,R,G,N>>4,15&N,b);n+=e}catch(e){if(e instanceof kt)return S(`${e.message} -- attempting to re-parse the JPEG image.`),this.parse(A,{dnlScanLines:e.scanLines});if(e instanceof Ft){S(`${e.message} -- ignoring the rest of the image data.`);break A}throw e}break;case 65500:n+=4;break;case 65535:255!==A[n]&&n--;break;default:const x=Tt(A,n-2,n-3);if(x?.invalid){S("JpegImage.parse - unexpected data, current marker is: "+x.invalid),n=x.offset;break}if(!x||n>=A.length-1){S("JpegImage.parse - reached the end of the image data without finding an EOI marker (0xFFD9).");break A}throw new bt("JpegImage.parse - unknown marker: "+B.toString(16))}B=NA(A,n),n+=2}if(!a)throw new bt("JpegImage.parse - no frame data found.");this.width=a.samplesPerLine,this.height=a.scanLines,this.jfif=g,this.adobe=r,this.components=[];for(const A of a.components){const e=I[A.quantizationId];e&&(A.quantizationTable=e),this.components.push({index:A.index,output:qt(0,A),scaleX:A.h/a.maxH,scaleY:A.v/a.maxV,blocksPerLine:A.blocksPerLine,blocksPerColumn:A.blocksPerColumn})}this.numComponents=this.components.length}_getLinearizedBlockData(A,e,t=!1){const i=this.width/A,a=this.height/e;let s,n,g,r,o,I,c,C,B,h,Q,l=0;const E=this.components.length,u=A*e*E,d=new Uint8ClampedArray(u),f=new Uint32Array(A),p=4294967288;let m;for(c=0;c>8)+y[B+1];return d}get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this._colorTransform&&(82!==this.components[0].index||71!==this.components[1].index||66!==this.components[2].index):1===this._colorTransform}_convertYccToRgb(A){let e,t,i;for(let a=0,s=A.length;a4)throw new bt("Unsupported color mode");const s=this._getLinearizedBlockData(A,e,a);if(1===this.numComponents&&(t||i)){const A=s.length*(t?4:3),e=new Uint8ClampedArray(A);let i=0;if(t)!function(A,e){if(Z.isLittleEndian)for(let t=0,i=A.length;t0&&(A=A.subarray(e));break}const e={decodeTransform:void 0,colorTransform:void 0},t=this.dict.getArray("D","Decode");if((this.forceRGBA||this.forceRGB)&&Array.isArray(t)){const A=this.dict.get("BPC","BitsPerComponent")||8,i=t.length,a=new Int32Array(i);let s=!1;const n=(1<{e=A,t=i})),i.decode=function(A,{numComponents:e=4,isIndexedColormap:t=!1,smaskInData:a=!1}){const s=A.length,n=i._malloc(s);i.HEAPU8.set(A,n);const g=i._jp2_decode(n,s,e>0?e:0,!!t,!!a);if(i._free(n),g){const{errorMessages:A}=i;return A?(delete i.errorMessages,A):"Unknown error"}const{imageData:r}=i;return i.imageData=null,r};var a=Object.assign({},i),s="./this.program",n="";"undefined"!=typeof document&&document.currentScript&&(n=document.currentScript.src),Zt&&(n=Zt),n=n.startsWith("blob:")?"":n.substr(0,n.replace(/[?#].*/,"").lastIndexOf("/")+1);var g,r,o,I,c,C=i.print||console.log.bind(console),B=i.printErr||console.error.bind(console);function h(){var A=r.buffer;i.HEAP8=o=new Int8Array(A),i.HEAP16=new Int16Array(A),i.HEAPU8=I=new Uint8Array(A),i.HEAPU16=new Uint16Array(A),i.HEAP32=new Int32Array(A),i.HEAPU32=c=new Uint32Array(A),i.HEAPF32=new Float32Array(A),i.HEAPF64=new Float64Array(A)}Object.assign(i,a),a=null,i.arguments&&i.arguments,i.thisProgram&&(s=i.thisProgram),i.quit&&i.quit,i.wasmBinary&&(g=i.wasmBinary);var Q,l=[],E=[],u=[],d=0,f=null,p=null,m="data:application/octet-stream;base64,",y=A=>A.startsWith(m);function w(A,e){var t,i=function(A){if(A==Q&&g)return new Uint8Array(g);var e=function(A){if(y(A))return function(A){for(var e=atob(A),t=new Uint8Array(e.length),i=0;i{for(;A.length>0;)A.shift()(i)};i.noExitRuntime;var b,k=A=>{var e=(A-r.buffer.byteLength+65535)/65536;try{return r.grow(e),h(),1}catch(A){}},F={},S=()=>{if(!S.strings){var A={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:s||"./this.program"};for(var e in F)void 0===F[e]?delete A[e]:A[e]=F[e];var t=[];for(var e in A)t.push(`${e}=${A[e]}`);S.strings=t}return S.strings},R=[null,[],[]],G="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,N=(A,e,t)=>{for(var i=e+t,a=e;A[a]&&!(a>=i);)++a;if(a-e>16&&A.buffer&&G)return G.decode(A.subarray(e,a));for(var s="";e>10,56320|1023&o)}}else s+=String.fromCharCode((31&n)<<6|g)}else s+=String.fromCharCode(n)}return s},x=(A,e)=>A?N(I,A,e):"",U={c:(A,e,t)=>I.copyWithin(A,e,e+t),g:function(A,e){A>>=2;const t=i.imageData=new Uint8ClampedArray(e),a=i.HEAP32.subarray(A,A+e);t.set(a)},f:function(A,e,t,a){A>>=2,e>>=2,t>>=2;const s=i.imageData=new Uint8ClampedArray(3*a),n=i.HEAP32.subarray(A,A+a),g=i.HEAP32.subarray(e,e+a),r=i.HEAP32.subarray(t,t+a);for(let A=0;A>=2,e>>=2,t>>=2,a>>=2;const n=i.imageData=new Uint8ClampedArray(4*s),g=i.HEAP32.subarray(A,A+s),r=i.HEAP32.subarray(e,e+s),o=i.HEAP32.subarray(t,t+s),I=i.HEAP32.subarray(a,a+s);for(let A=0;A{var e=I.length,t=2147483648;if((A>>>=0)>t)return!1;for(var i,a=1;a<=4;a*=2){var s=e*(1+.2/a);s=Math.min(s,A+100663296);var n=Math.min(t,(i=Math.max(A,s))+(65536-i%65536)%65536);if(k(n))return!0}return!1},l:(A,e)=>{var t=0;return S().forEach(((i,a)=>{var s=e+t;c[A+4*a>>2]=s,((A,e)=>{for(var t=0;t{var t=S();c[A>>2]=t.length;var i=0;return t.forEach((A=>i+=A.length+1)),c[e>>2]=i,0},n:A=>52,j:function(A,e,t,i,a){return 70},b:(A,e,t,i)=>{for(var a,s,n,g=0,r=0;r>2],h=c[e+4>>2];e+=8;for(var Q=0;Q>2]=g,0},o:function(A,e){A>>=2;const t=i.imageData=new Uint8ClampedArray(4*e),a=i.HEAP32.subarray(A,A+e);for(let A=0;A>=2,e>>=2;const a=i.imageData=new Uint8ClampedArray(4*t),s=i.HEAP32.subarray(A,A+t),n=i.HEAP32.subarray(e,e+t);for(let A=0;A>=2,e>>=2,t>>=2;const s=i.imageData=new Uint8ClampedArray(4*a),n=i.HEAP32.subarray(A,A+a),g=i.HEAP32.subarray(e,e+a),r=i.HEAP32.subarray(t,t+a);for(let A=0;A0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)A=i.preRun.shift(),l.unshift(A);var A;D(l)}(),d>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),A()}),1)):A()))}if(M.q,i._malloc=M.r,i._free=M.s,i._jp2_decode=M.u,p=function A(){b||L(),b||(p=A)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return L(),i});const Xt=Ot;class Vt extends U{constructor(A){super(A,"JpxError")}}class jt{static#y=null;static decode(A,e){e||={},this.#y||=Xt({warn:S});const t=this.#y.decode(A,e);if("string"==typeof t)throw new Vt(t);return t}static cleanup(){this.#y=null}static parseImageProperties(A){let e=A.getByte();for(;e>=0;){const t=e;if(e=A.getByte(),65361==(t<<8|e)){A.skip(4);const e=A.getInt32()>>>0,t=A.getInt32()>>>0,i=A.getInt32()>>>0,a=A.getInt32()>>>0;return A.skip(16),{width:e-i,height:t-a,bitsPerComponent:8,componentsCount:A.getUint16()}}}throw new Vt("No size marker found in JPX stream")}}class zt extends ke{constructor(A,e,t){super(e),this.stream=A,this.dict=A.dict,this.maybeLength=e,this.params=t}get bytes(){return x(this,"bytes",this.stream.getBytes(this.maybeLength))}ensureBuffer(A){}readBlock(A){this.decodeImage(null,A)}decodeImage(A,e){return this.eof||(A||=this.bytes,this.buffer=jt.decode(A,e),this.bufferLength=this.buffer.length,this.eof=!0),this.buffer}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}}class _t extends ke{constructor(A,e,t){super(e),this.str=A,this.dict=A.dict,this.cachedData=0,this.bitsCached=0;const i=4096,a={earlyChange:t,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(i),dictionaryLengths:new Uint16Array(i),dictionaryPrevCodes:new Uint16Array(i),currentSequence:new Uint8Array(i),currentSequenceLength:0};for(let A=0;A<256;++A)a.dictionaryValues[A]=A,a.dictionaryLengths[A]=1;this.lzwState=a}readBits(A){let e=this.bitsCached,t=this.cachedData;for(;e>>e&(1<0;if(A<256)C[0]=A,B=1;else{if(!(A>=258)){if(256===A){I=9,n=258,B=0;continue}this.eof=!0,delete this.lzwState;break}if(A=0;e--)C[e]=g[t],t=o[t];else C[B++]=C[0]}if(a&&(o[n]=c,r[n]=r[c]+1,g[n]=C[0],n++,I=n+s&n+s-1?I:0|Math.min(Math.log(n+s)/.6931471805599453+1,12)),c=A,h+=B,i15))throw new v(`Unsupported predictor: ${i}`);this.readBlock=2===i?this.readBlockTiff:this.readBlockPng,this.str=A,this.dict=A.dict;const a=this.colors=t.get("Colors")||1,s=this.bits=t.get("BPC","BitsPerComponent")||8,n=this.columns=t.get("Columns")||1;return this.pixBytes=a*s+7>>3,this.rowBytes=n*a*s+7>>3,this}readBlockTiff(){const A=this.rowBytes,e=this.bufferLength,t=this.ensureBuffer(e+A),i=this.bits,a=this.colors,s=this.str.getBytes(A);if(this.eof=!s.length,this.eof)return;let n,g=0,r=0,o=0,I=0,c=e;if(1===i&&1===a)for(n=0;n>1,A^=A>>2,A^=A>>4,g=(1&A)<<7,t[c++]=A}else if(8===i){for(n=0;n>8&255,t[c++]=255&A}}else{const A=new Uint8Array(a+1),c=(1<>o-i)&c,o-=i,r=r<=8&&(t[B++]=r>>I-8&255,I-=8);I>0&&(t[B++]=(r<<8-I)+(g&(1<<8-I)-1))}this.bufferLength+=A}readBlockPng(){const A=this.rowBytes,e=this.pixBytes,t=this.str.getByte(),i=this.str.getBytes(A);if(this.eof=!i.length,this.eof)return;const a=this.bufferLength,s=this.ensureBuffer(a+A);let n=s.subarray(a-A,a);0===n.length&&(n=new Uint8Array(A));let g,r,o,I=a;switch(t){case 0:for(g=0;g>1)+i[g];for(;g>1)+i[g]&255,I++;break;case 4:for(g=0;g0){const A=this.str.getBytes(i);e.set(A,t),t+=i}}else{i=257-i;const a=A[1];e=this.ensureBuffer(t+i+1);for(let A=0;A>")&&this.buf1!==aA;){if(!(this.buf1 instanceof rA)){F("Malformed dictionary: key must be a name object"),this.shift();continue}const e=this.buf1.name;if(this.shift(),this.buf1===aA)break;i.set(e,this.getObj(A))}if(this.buf1===aA){if(this.recoveryMode)return i;throw new yA("End of file inside dictionary.")}return lA(this.buf2,"stream")?this.allowStreams?this.makeStream(i,A):i:(this.shift(),i);default:return e}if(Number.isInteger(e)){if(Number.isInteger(this.buf1)&&lA(this.buf2,"R")){const A=CA.get(e,this.buf1);return this.shift(),this.shift(),A}return e}return"string"==typeof e&&A?A.decryptString(e):e}findDefaultInlineStreamEnd(A){const{knownCommands:e}=this.lexer,t=A.pos;let i,a,s=0;for(;-1!==(i=A.getByte());)if(0===s)s=69===i?1:0;else if(1===s)s=73===i?2:0;else if(32===i||10===i||13===i){a=A.pos;const t=A.peekBytes(15),n=t.length;if(0===n)break;for(let A=0;A127)){s=0;break}if(2!==s)continue;if(!e){S("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");continue}const g=new ai(new ie(t.slice()),e);g._hexStringWarn=()=>{};let r=0;for(;;){const A=g.getObj();if(A===aA){s=0;break}if(A instanceof oA){const t=e[A.cmd];if(!t){s=0;break}if(t.variableArgs?r<=t.numArgs:r===t.numArgs)break;r=0}else r++}if(2===s)break}else s=0;-1===i&&(S("findDefaultInlineStreamEnd: Reached the end of the stream without finding a valid EI marker"),a&&(S('... trying to recover by using the last "EI" occurrence.'),A.skip(-(A.pos-a))));let n=4;return A.skip(-n),i=A.peekByte(),A.skip(n),UA(i)||n--,A.pos-n-t}findDCTDecodeInlineStreamEnd(A){const e=A.pos;let t,i,a=!1;for(;-1!==(t=A.getByte());)if(255===t){switch(A.getByte()){case 0:break;case 255:A.skip(-1);break;case 217:a=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:i=A.getUint16(),i>2?A.skip(i-2):A.skip(-2)}if(a)break}const s=A.pos-e;return-1===t?(S("Inline DCTDecode image stream: EOI marker not found, searching for /EI/ instead."),A.skip(-s),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),s)}findASCII85DecodeInlineStreamEnd(A){const e=A.pos;let t;for(;-1!==(t=A.getByte());)if(126===t){const e=A.pos;for(t=A.peekByte();UA(t);)A.skip(),t=A.peekByte();if(62===t){A.skip();break}if(A.pos>e){const e=A.peekBytes(2);if(69===e[0]&&73===e[1])break}}const i=A.pos-e;return-1===t?(S("Inline ASCII85Decode image stream: EOD marker not found, searching for /EI/ instead."),A.skip(-i),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),i)}findASCIIHexDecodeInlineStreamEnd(A){const e=A.pos;let t;for(;-1!==(t=A.getByte())&&62!==t;);const i=A.pos-e;return-1===t?(S("Inline ASCIIHexDecode image stream: EOD marker not found, searching for /EI/ instead."),A.skip(-i),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),i)}inlineStreamSkipEI(A){let e,t=0;for(;-1!==(e=A.getByte());)if(0===t)t=69===e?1:0;else if(1===t)t=73===e?2:0;else if(2===t)break}makeInlineImage(A){const e=this.lexer,t=e.stream,i=Object.create(null);let a;for(;!lA(this.buf1,"ID")&&this.buf1!==aA;){if(!(this.buf1 instanceof rA))throw new v("Dictionary key must be a name object");const e=this.buf1.name;if(this.shift(),this.buf1===aA)break;i[e]=this.getObj(A)}-1!==e.beginInlineImagePos&&(a=t.pos-e.beginInlineImagePos);const s=this.xref.fetchIfRef(i.F||i.Filter);let n;if(s instanceof rA)n=s.name;else if(Array.isArray(s)){const A=this.xref.fetchIfRef(s[0]);A instanceof rA&&(n=A.name)}const g=t.pos;let r,o;switch(n){case"DCT":case"DCTDecode":r=this.findDCTDecodeInlineStreamEnd(t);break;case"A85":case"ASCII85Decode":r=this.findASCII85DecodeInlineStreamEnd(t);break;case"AHx":case"ASCIIHexDecode":r=this.findASCIIHexDecodeInlineStreamEnd(t);break;default:r=this.findDefaultInlineStreamEnd(t)}if(r<1e3&&a>0){const A=t.pos;t.pos=e.beginInlineImagePos,o=function(A){const e=[],t=A.length;let i=0;for(;i=i){let i=!1;for(const A of a){const e=A.length;let a=0;for(;a=s){i=!0;break}if(a>=e){UA(n[r+g+a])&&(F(`Found "${q([...t,...A])}" when searching for endstream command.`),i=!0);break}}if(i)return e.pos+=r,e.pos-A}r++}e.pos+=g}return-1}makeStream(A,e){const t=this.lexer;let i=t.stream;t.skipToNextLine();const a=i.pos-1;let s=A.get("Length");if(Number.isInteger(s)||(F(`Bad length "${s&&s.toString()}" in stream.`),s=0),i.pos=a+s,t.nextChar(),this.tryShift()&&lA(this.buf2,"endstream"))this.shift();else{if(s=this.#w(a),s<0)throw new v("Missing endstream command.");t.nextChar(),this.shift(),this.shift()}return this.shift(),i=i.makeSubStream(a,s,A),e&&(i=e.createStream(i,s)),i=this.filter(i,A,s),i.dict=A,i}filter(A,e,t){let i=e.get("F","Filter"),a=e.get("DP","DecodeParms");if(i instanceof rA)return Array.isArray(a)&&S("/DecodeParms should not be an Array, when /Filter is a Name."),this.makeFilter(A,i.name,t,a);let s=t;if(Array.isArray(i)){const e=i,t=a;for(let n=0,g=e.length;n=48&&A<=57?15&A:A>=65&&A<=70||A>=97&&A<=102?9+(15&A):-1}class ai{constructor(A,e=null){this.stream=A,this.nextChar(),this.strBuf=[],this.knownCommands=e,this._hexStringNumWarn=0,this.beginInlineImagePos=-1}nextChar(){return this.currentChar=this.stream.getByte()}peekChar(){return this.stream.peekByte()}getNumber(){let A=this.currentChar,e=!1,t=0,i=1;if(45===A?(i=-1,A=this.nextChar(),45===A&&(A=this.nextChar())):43===A&&(A=this.nextChar()),10===A||13===A)do{A=this.nextChar()}while(10===A||13===A);if(46===A&&(t=10,A=this.nextChar()),A<48||A>57){const e=`Invalid number: ${String.fromCharCode(A)} (charCode ${A})`;if(UA(A)||-1===A)return F(`Lexer.getNumber - "${e}".`),0;throw new v(e)}let a=A-48,s=0,n=1;for(;(A=this.nextChar())>=0;)if(A>=48&&A<=57){const i=A-48;e?s=10*s+i:(0!==t&&(t*=10),a=10*a+i)}else if(46===A){if(0!==t)break;t=1}else if(45===A)S("Badly formatted number: minus sign in the middle");else{if(69!==A&&101!==A)break;if(A=this.peekChar(),43===A||45===A)n=45===A?-1:1,this.nextChar();else if(A<48||A>57)break;e=!0}return 0!==t&&(a/=t),e&&(a*=10**(n*s)),i*a}getString(){let A=1,e=!1;const t=this.strBuf;t.length=0;let i=this.nextChar();for(;;){let a=!1;switch(0|i){case-1:S("Unterminated string"),e=!0;break;case 40:++A,t.push("(");break;case 41:0==--A?(this.nextChar(),e=!0):t.push(")");break;case 92:switch(i=this.nextChar(),i){case-1:S("Unterminated string"),e=!0;break;case 110:t.push("\n");break;case 114:t.push("\r");break;case 116:t.push("\t");break;case 98:t.push("\b");break;case 102:t.push("\f");break;case 92:case 40:case 41:t.push(String.fromCharCode(i));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:let A=15&i;i=this.nextChar(),a=!0,i>=48&&i<=55&&(A=(A<<3)+(15&i),i=this.nextChar(),i>=48&&i<=55&&(a=!1,A=(A<<3)+(15&i))),t.push(String.fromCharCode(A));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:t.push(String.fromCharCode(i))}break;default:t.push(String.fromCharCode(i))}if(e)break;a||(i=this.nextChar())}return t.join("")}getName(){let A,e;const t=this.strBuf;for(t.length=0;(A=this.nextChar())>=0&&!ti[A];)if(35===A){if(A=this.nextChar(),ti[A]){S("Lexer_getName: NUMBER SIGN (#) should be followed by a hexadecimal number."),t.push("#");break}const i=ii(A);if(-1!==i){e=A,A=this.nextChar();const a=ii(A);if(-1===a){if(S(`Lexer_getName: Illegal digit (${String.fromCharCode(A)}) in hexadecimal number.`),t.push("#",String.fromCharCode(e)),ti[A])break;t.push(String.fromCharCode(A));continue}t.push(String.fromCharCode(i<<4|a))}else t.push("#",String.fromCharCode(A))}else t.push(String.fromCharCode(A));return t.length>127&&S(`Name token is longer than allowed by the spec: ${t.length}`),rA.get(t.join(""))}_hexStringWarn(A){5!=this._hexStringNumWarn++?this._hexStringNumWarn>5||S(`getHexString - ignoring invalid character: ${A}`):S("getHexString - ignoring additional invalid characters.")}getHexString(){const A=this.strBuf;A.length=0;let e=this.currentChar,t=-1,i=-1;for(this._hexStringNumWarn=0;;){if(e<0){S("Unterminated hex string");break}if(62===e){this.nextChar();break}1!==ti[e]?(i=ii(e),-1===i?this._hexStringWarn(e):-1===t?t=i:(A.push(String.fromCharCode(t<<4|i)),t=-1),e=this.nextChar()):e=this.nextChar()}return-1!==t&&A.push(String.fromCharCode(t<<4)),A.join("")}getObj(){let A=!1,e=this.currentChar;for(;;){if(e<0)return aA;if(A)10!==e&&13!==e||(A=!1);else if(37===e)A=!0;else if(1!==ti[e])break;e=this.nextChar()}switch(0|e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:return this.nextChar(),oA.get("[");case 93:return this.nextChar(),oA.get("]");case 60:return e=this.nextChar(),60===e?(this.nextChar(),oA.get("<<")):this.getHexString();case 62:return e=this.nextChar(),62===e?(this.nextChar(),oA.get(">>")):oA.get(">");case 123:return this.nextChar(),oA.get("{");case 125:return this.nextChar(),oA.get("}");case 41:throw this.nextChar(),new v(`Illegal character: ${e}`)}let t=String.fromCharCode(e);if(e<32||e>127){const A=this.peekChar();if(A>=32&&A<=127)return this.nextChar(),oA.get(t)}const i=this.knownCommands;let a=void 0!==i?.[t];for(;(e=this.nextChar())>=0&&!ti[e];){const A=t+String.fromCharCode(e);if(a&&void 0===i[A])break;if(128===t.length)throw new v(`Command token too long: ${t.length}`);t=A,a=void 0!==i?.[t]}return"true"===t||"false"!==t&&("null"===t?null:("BI"===t&&(this.beginInlineImagePos=this.stream.pos),oA.get(t)))}skipToNextLine(){let A=this.currentChar;for(;A>=0;){if(13===A){A=this.nextChar(),10===A&&this.nextChar();break}if(10===A){this.nextChar();break}A=this.nextChar()}}}class si{static create(A){function e(A,e,t=!1){const i=A.get(e);if(Number.isInteger(i)&&(t?i>=0:i>0))return i;throw new Error(`The "${e}" parameter in the linearization dictionary is invalid.`)}const t=new ei({lexer:new ai(A),xref:null}),i=t.getObj(),a=t.getObj(),s=t.getObj(),n=t.getObj();let g,r;if(!(Number.isInteger(i)&&Number.isInteger(a)&&lA(s,"obj")&&n instanceof cA&&"number"==typeof(g=n.get("Linearized"))&&g>0))return null;if((r=e(n,"L"))!==A.length)throw new Error('The "L" parameter in the linearization dictionary does not equal the stream length.');return{length:r,hints:function(A){const e=A.get("H");let t;if(Array.isArray(e)&&(2===(t=e.length)||4===t)){for(let A=0;A0))throw new Error(`Hint (${A}) in the linearization dictionary is invalid.`)}return e}throw new Error("Hint array in the linearization dictionary is invalid.")}(n),objectNumberFirst:e(n,"O"),endFirst:e(n,"E"),numPages:e(n,"N"),mainXRefEntriesOffset:e(n,"T"),pageFirst:n.has("P")?e(n,"P",!0):0}}}const ni=["Adobe-GB1-UCS2","Adobe-CNS1-UCS2","Adobe-Japan1-UCS2","Adobe-Korea1-UCS2","78-EUC-H","78-EUC-V","78-H","78-RKSJ-H","78-RKSJ-V","78-V","78ms-RKSJ-H","78ms-RKSJ-V","83pv-RKSJ-H","90ms-RKSJ-H","90ms-RKSJ-V","90msp-RKSJ-H","90msp-RKSJ-V","90pv-RKSJ-H","90pv-RKSJ-V","Add-H","Add-RKSJ-H","Add-RKSJ-V","Add-V","Adobe-CNS1-0","Adobe-CNS1-1","Adobe-CNS1-2","Adobe-CNS1-3","Adobe-CNS1-4","Adobe-CNS1-5","Adobe-CNS1-6","Adobe-GB1-0","Adobe-GB1-1","Adobe-GB1-2","Adobe-GB1-3","Adobe-GB1-4","Adobe-GB1-5","Adobe-Japan1-0","Adobe-Japan1-1","Adobe-Japan1-2","Adobe-Japan1-3","Adobe-Japan1-4","Adobe-Japan1-5","Adobe-Japan1-6","Adobe-Korea1-0","Adobe-Korea1-1","Adobe-Korea1-2","B5-H","B5-V","B5pc-H","B5pc-V","CNS-EUC-H","CNS-EUC-V","CNS1-H","CNS1-V","CNS2-H","CNS2-V","ETHK-B5-H","ETHK-B5-V","ETen-B5-H","ETen-B5-V","ETenms-B5-H","ETenms-B5-V","EUC-H","EUC-V","Ext-H","Ext-RKSJ-H","Ext-RKSJ-V","Ext-V","GB-EUC-H","GB-EUC-V","GB-H","GB-V","GBK-EUC-H","GBK-EUC-V","GBK2K-H","GBK2K-V","GBKp-EUC-H","GBKp-EUC-V","GBT-EUC-H","GBT-EUC-V","GBT-H","GBT-V","GBTpc-EUC-H","GBTpc-EUC-V","GBpc-EUC-H","GBpc-EUC-V","H","HKdla-B5-H","HKdla-B5-V","HKdlb-B5-H","HKdlb-B5-V","HKgccs-B5-H","HKgccs-B5-V","HKm314-B5-H","HKm314-B5-V","HKm471-B5-H","HKm471-B5-V","HKscs-B5-H","HKscs-B5-V","Hankaku","Hiragana","KSC-EUC-H","KSC-EUC-V","KSC-H","KSC-Johab-H","KSC-Johab-V","KSC-V","KSCms-UHC-H","KSCms-UHC-HW-H","KSCms-UHC-HW-V","KSCms-UHC-V","KSCpc-EUC-H","KSCpc-EUC-V","Katakana","NWP-H","NWP-V","RKSJ-H","RKSJ-V","Roman","UniCNS-UCS2-H","UniCNS-UCS2-V","UniCNS-UTF16-H","UniCNS-UTF16-V","UniCNS-UTF32-H","UniCNS-UTF32-V","UniCNS-UTF8-H","UniCNS-UTF8-V","UniGB-UCS2-H","UniGB-UCS2-V","UniGB-UTF16-H","UniGB-UTF16-V","UniGB-UTF32-H","UniGB-UTF32-V","UniGB-UTF8-H","UniGB-UTF8-V","UniJIS-UCS2-H","UniJIS-UCS2-HW-H","UniJIS-UCS2-HW-V","UniJIS-UCS2-V","UniJIS-UTF16-H","UniJIS-UTF16-V","UniJIS-UTF32-H","UniJIS-UTF32-V","UniJIS-UTF8-H","UniJIS-UTF8-V","UniJIS2004-UTF16-H","UniJIS2004-UTF16-V","UniJIS2004-UTF32-H","UniJIS2004-UTF32-V","UniJIS2004-UTF8-H","UniJIS2004-UTF8-V","UniJISPro-UCS2-HW-V","UniJISPro-UCS2-V","UniJISPro-UTF8-V","UniJISX0213-UTF32-H","UniJISX0213-UTF32-V","UniJISX02132004-UTF32-H","UniJISX02132004-UTF32-V","UniKS-UCS2-H","UniKS-UCS2-V","UniKS-UTF16-H","UniKS-UTF16-V","UniKS-UTF32-H","UniKS-UTF32-V","UniKS-UTF8-H","UniKS-UTF8-V","V","WP-Symbol"],gi=2**24-1;class ri{constructor(A=!1){this.codespaceRanges=[[],[],[],[]],this.numCodespaceRanges=0,this._map=[],this.name="",this.vertical=!1,this.useCMap=null,this.builtInCMap=A}addCodespaceRange(A,e,t){this.codespaceRanges[A-1].push(e,t),this.numCodespaceRanges++}mapCidRange(A,e,t){if(e-A>gi)throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");for(;A<=e;)this._map[A++]=t++}mapBfRange(A,e,t){if(e-A>gi)throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");const i=t.length-1;for(;A<=e;){this._map[A++]=t;const e=t.charCodeAt(i)+1;t=e>255?t.substring(0,i-1)+String.fromCharCode(t.charCodeAt(i-1)+1)+"\0":t.substring(0,i)+String.fromCharCode(e)}}mapBfRangeToArray(A,e,t){if(e-A>gi)throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");const i=t.length;let a=0;for(;A<=e&&a>>0;const n=a[s];for(let A=0,e=n.length;A=e&&i<=a)return t.charcode=i,void(t.length=s+1)}}t.charcode=0,t.length=1}getCharCodeLength(A){const e=this.codespaceRanges;for(let t=0,i=e.length;t=a&&A<=s)return t+1}}return 1}get length(){return this._map.length}get isIdentityCMap(){if("Identity-H"!==this.name&&"Identity-V"!==this.name)return!1;if(65536!==this._map.length)return!1;for(let A=0;A<65536;A++)if(this._map[A]!==A)return!1;return!0}}class oi extends ri{constructor(A,e){super(),this.vertical=A,this.addCodespaceRange(e,0,65535)}mapCidRange(A,e,t){R("should not call mapCidRange")}mapBfRange(A,e,t){R("should not call mapBfRange")}mapBfRangeToArray(A,e,t){R("should not call mapBfRangeToArray")}mapOne(A,e){R("should not call mapCidOne")}lookup(A){return Number.isInteger(A)&&A<=65535?A:void 0}contains(A){return Number.isInteger(A)&&A<=65535}forEach(A){for(let e=0;e<=65535;e++)A(e,e)}charCodeOf(A){return Number.isInteger(A)&&A<=65535?A:-1}getMap(){const A=new Array(65536);for(let e=0;e<=65535;e++)A[e]=e;return A}get length(){return 65536}get isIdentityCMap(){R("should not access .isIdentityCMap")}}function Ii(A){let e=0;for(let t=0;t>>0}function ci(A){if("string"!=typeof A)throw new v("Malformed CMap: expected string.")}function Ci(A){if(!Number.isInteger(A))throw new v("Malformed CMap: expected int.")}function Bi(A,e){for(;;){let t=e.getObj();if(t===aA)break;if(lA(t,"endbfchar"))return;ci(t);const i=Ii(t);t=e.getObj(),ci(t);const a=t;A.mapOne(i,a)}}function hi(A,e){for(;;){let t=e.getObj();if(t===aA)break;if(lA(t,"endbfrange"))return;ci(t);const i=Ii(t);t=e.getObj(),ci(t);const a=Ii(t);if(t=e.getObj(),Number.isInteger(t)||"string"==typeof t){const e=Number.isInteger(t)?String.fromCharCode(t):t;A.mapBfRange(i,a,e)}else{if(!lA(t,"["))break;{t=e.getObj();const s=[];for(;!lA(t,"]")&&t!==aA;)s.push(t),t=e.getObj();A.mapBfRangeToArray(i,a,s)}}}throw new v("Invalid bf range.")}function Qi(A,e){for(;;){let t=e.getObj();if(t===aA)break;if(lA(t,"endcidchar"))return;ci(t);const i=Ii(t);t=e.getObj(),Ci(t);const a=t;A.mapOne(i,a)}}function li(A,e){for(;;){let t=e.getObj();if(t===aA)break;if(lA(t,"endcidrange"))return;ci(t);const i=Ii(t);t=e.getObj(),ci(t);const a=Ii(t);t=e.getObj(),Ci(t);const s=t;A.mapCidRange(i,a,s)}}function Ei(A,e){for(;;){let t=e.getObj();if(t===aA)break;if(lA(t,"endcodespacerange"))return;if("string"!=typeof t)break;const i=Ii(t);if(t=e.getObj(),"string"!=typeof t)break;const a=Ii(t);A.addCodespaceRange(t.length,i,a)}throw new v("Invalid codespace range.")}function ui(A,e){const t=e.getObj();Number.isInteger(t)&&(A.vertical=!!t)}function di(A,e){const t=e.getObj();t instanceof rA&&(A.name=t.name)}async function fi(A,e,t,i){let a,s;A:for(;;)try{const t=e.getObj();if(t===aA)break;if(t instanceof rA)"WMode"===t.name?ui(A,e):"CMapName"===t.name&&di(A,e),a=t;else if(t instanceof oA)switch(t.cmd){case"endcmap":break A;case"usecmap":a instanceof rA&&(s=a.name);break;case"begincodespacerange":Ei(A,e);break;case"beginbfchar":Bi(A,e);break;case"begincidchar":Qi(A,e);break;case"beginbfrange":hi(A,e);break;case"begincidrange":li(A,e)}}catch(A){if(A instanceof mA)throw A;S("Invalid cMap data: "+A);continue}return!i&&s&&(i=s),i?pi(A,t,i):A}async function pi(A,e,t){if(A.useCMap=await mi(t,e),0===A.numCodespaceRanges){const e=A.useCMap.codespaceRanges;for(let t=0;tpi(a,e,A)));if(0===i){const A=new ai(new ie(t));return fi(a,A,e,null)}throw new Error(`Invalid CMap "compressionType" value: ${i}`)}class yi{static async create({encoding:A,fetchBuiltInCMap:e,useCMap:t}){if(A instanceof rA)return mi(A.name,e);if(A instanceof dA){const i=await fi(new ri,new ai(A),e,t);return i.isIdentityCMap?mi(i.name,e):i}throw new Error("Encoding required.")}}const wi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],Di=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],bi=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],ki=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Fi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","centoldstyle","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","","threequartersemdash","","questionsmall","","","","","Ethsmall","","","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","","","","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hypheninferior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","asuperior","centsuperior","","","","","Aacutesmall","Agravesmall","Acircumflexsmall","Adieresissmall","Atildesmall","Aringsmall","Ccedillasmall","Eacutesmall","Egravesmall","Ecircumflexsmall","Edieresissmall","Iacutesmall","Igravesmall","Icircumflexsmall","Idieresissmall","Ntildesmall","Oacutesmall","Ogravesmall","Ocircumflexsmall","Odieresissmall","Otildesmall","Uacutesmall","Ugravesmall","Ucircumflexsmall","Udieresissmall","","eightsuperior","fourinferior","threeinferior","sixinferior","eightinferior","seveninferior","Scaronsmall","","centinferior","twoinferior","","Dieresissmall","","Caronsmall","osuperior","fiveinferior","","commainferior","periodinferior","Yacutesmall","","dollarinferior","","","Thornsmall","","nineinferior","zeroinferior","Zcaronsmall","AEsmall","Oslashsmall","questiondownsmall","oneinferior","Lslashsmall","","","","","","","Cedillasmall","","","","","","OEsmall","figuredash","hyphensuperior","","","","","exclamdownsmall","","Ydieresissmall","","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","ninesuperior","zerosuperior","","esuperior","rsuperior","tsuperior","","","isuperior","ssuperior","dsuperior","","","","","","lsuperior","Ogoneksmall","Brevesmall","Macronsmall","bsuperior","nsuperior","msuperior","commasuperior","periodsuperior","Dotaccentsmall","Ringsmall","","","",""],Si=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","space","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron"],Ri=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls","","","",""],Gi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","bullet","Euro","bullet","quotesinglbase","florin","quotedblbase","ellipsis","dagger","daggerdbl","circumflex","perthousand","Scaron","guilsinglleft","OE","bullet","Zcaron","bullet","bullet","quoteleft","quoteright","quotedblleft","quotedblright","bullet","endash","emdash","tilde","trademark","scaron","guilsinglright","oe","bullet","zcaron","Ydieresis","space","exclamdown","cent","sterling","currency","yen","brokenbar","section","dieresis","copyright","ordfeminine","guillemotleft","logicalnot","hyphen","registered","macron","degree","plusminus","twosuperior","threesuperior","acute","mu","paragraph","periodcentered","cedilla","onesuperior","ordmasculine","guillemotright","onequarter","onehalf","threequarters","questiondown","Agrave","Aacute","Acircumflex","Atilde","Adieresis","Aring","AE","Ccedilla","Egrave","Eacute","Ecircumflex","Edieresis","Igrave","Iacute","Icircumflex","Idieresis","Eth","Ntilde","Ograve","Oacute","Ocircumflex","Otilde","Odieresis","multiply","Oslash","Ugrave","Uacute","Ucircumflex","Udieresis","Yacute","Thorn","germandbls","agrave","aacute","acircumflex","atilde","adieresis","aring","ae","ccedilla","egrave","eacute","ecircumflex","edieresis","igrave","iacute","icircumflex","idieresis","eth","ntilde","ograve","oacute","ocircumflex","otilde","odieresis","divide","oslash","ugrave","uacute","ucircumflex","udieresis","yacute","thorn","ydieresis"],Ni=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","universal","numbersign","existential","percent","ampersand","suchthat","parenleft","parenright","asteriskmath","plus","comma","minus","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","congruent","Alpha","Beta","Chi","Delta","Epsilon","Phi","Gamma","Eta","Iota","theta1","Kappa","Lambda","Mu","Nu","Omicron","Pi","Theta","Rho","Sigma","Tau","Upsilon","sigma1","Omega","Xi","Psi","Zeta","bracketleft","therefore","bracketright","perpendicular","underscore","radicalex","alpha","beta","chi","delta","epsilon","phi","gamma","eta","iota","phi1","kappa","lambda","mu","nu","omicron","pi","theta","rho","sigma","tau","upsilon","omega1","omega","xi","psi","zeta","braceleft","bar","braceright","similar","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Euro","Upsilon1","minute","lessequal","fraction","infinity","florin","club","diamond","heart","spade","arrowboth","arrowleft","arrowup","arrowright","arrowdown","degree","plusminus","second","greaterequal","multiply","proportional","partialdiff","bullet","divide","notequal","equivalence","approxequal","ellipsis","arrowvertex","arrowhorizex","carriagereturn","aleph","Ifraktur","Rfraktur","weierstrass","circlemultiply","circleplus","emptyset","intersection","union","propersuperset","reflexsuperset","notsubset","propersubset","reflexsubset","element","notelement","angle","gradient","registerserif","copyrightserif","trademarkserif","product","radical","dotmath","logicalnot","logicaland","logicalor","arrowdblboth","arrowdblleft","arrowdblup","arrowdblright","arrowdbldown","lozenge","angleleft","registersans","copyrightsans","trademarksans","summation","parenlefttp","parenleftex","parenleftbt","bracketlefttp","bracketleftex","bracketleftbt","bracelefttp","braceleftmid","braceleftbt","braceex","","angleright","integral","integraltp","integralex","integralbt","parenrighttp","parenrightex","parenrightbt","bracketrighttp","bracketrightex","bracketrightbt","bracerighttp","bracerightmid","bracerightbt",""],xi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","a1","a2","a202","a3","a4","a5","a119","a118","a117","a11","a12","a13","a14","a15","a16","a105","a17","a18","a19","a20","a21","a22","a23","a24","a25","a26","a27","a28","a6","a7","a8","a9","a10","a29","a30","a31","a32","a33","a34","a35","a36","a37","a38","a39","a40","a41","a42","a43","a44","a45","a46","a47","a48","a49","a50","a51","a52","a53","a54","a55","a56","a57","a58","a59","a60","a61","a62","a63","a64","a65","a66","a67","a68","a69","a70","a71","a72","a73","a74","a203","a75","a204","a76","a77","a78","a79","a81","a82","a83","a84","a97","a98","a99","a100","","a89","a90","a93","a94","a91","a92","a205","a85","a206","a86","a87","a88","a95","a96","","","","","","","","","","","","","","","","","","","","a101","a102","a103","a104","a106","a107","a108","a112","a111","a110","a109","a120","a121","a122","a123","a124","a125","a126","a127","a128","a129","a130","a131","a132","a133","a134","a135","a136","a137","a138","a139","a140","a141","a142","a143","a144","a145","a146","a147","a148","a149","a150","a151","a152","a153","a154","a155","a156","a157","a158","a159","a160","a161","a163","a164","a196","a165","a192","a166","a167","a168","a169","a170","a171","a172","a173","a162","a174","a175","a176","a177","a178","a179","a193","a180","a199","a181","a200","a182","","a201","a183","a184","a197","a185","a194","a198","a186","a195","a187","a188","a189","a190","a191",""];function Ui(A){switch(A){case"WinAnsiEncoding":return Gi;case"StandardEncoding":return Ri;case"MacRomanEncoding":return Si;case"SymbolSetEncoding":return Ni;case"ZapfDingbatsEncoding":return xi;case"ExpertEncoding":return ki;case"MacExpertEncoding":return Fi;default:return null}}const Mi=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Li=[null,{id:"hstem",min:2,stackClearing:!0,stem:!0},null,{id:"vstem",min:2,stackClearing:!0,stem:!0},{id:"vmoveto",min:1,stackClearing:!0},{id:"rlineto",min:2,resetStack:!0},{id:"hlineto",min:1,resetStack:!0},{id:"vlineto",min:1,resetStack:!0},{id:"rrcurveto",min:6,resetStack:!0},null,{id:"callsubr",min:1,undefStack:!0},{id:"return",min:0,undefStack:!0},null,null,{id:"endchar",min:0,stackClearing:!0},null,null,null,{id:"hstemhm",min:2,stackClearing:!0,stem:!0},{id:"hintmask",min:0,stackClearing:!0},{id:"cntrmask",min:0,stackClearing:!0},{id:"rmoveto",min:2,stackClearing:!0},{id:"hmoveto",min:1,stackClearing:!0},{id:"vstemhm",min:2,stackClearing:!0,stem:!0},{id:"rcurveline",min:8,resetStack:!0},{id:"rlinecurve",min:8,resetStack:!0},{id:"vvcurveto",min:4,resetStack:!0},{id:"hhcurveto",min:4,resetStack:!0},null,{id:"callgsubr",min:1,undefStack:!0},{id:"vhcurveto",min:4,resetStack:!0},{id:"hvcurveto",min:4,resetStack:!0}],Ji=[null,null,null,{id:"and",min:2,stackDelta:-1},{id:"or",min:2,stackDelta:-1},{id:"not",min:1,stackDelta:0},null,null,null,{id:"abs",min:1,stackDelta:0},{id:"add",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]+A[e-1]}},{id:"sub",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]-A[e-1]}},{id:"div",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]/A[e-1]}},null,{id:"neg",min:1,stackDelta:0,stackFn(A,e){A[e-1]=-A[e-1]}},{id:"eq",min:2,stackDelta:-1},null,null,{id:"drop",min:1,stackDelta:-1},null,{id:"put",min:2,stackDelta:-2},{id:"get",min:1,stackDelta:0},{id:"ifelse",min:4,stackDelta:-3},{id:"random",min:0,stackDelta:1},{id:"mul",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]*A[e-1]}},null,{id:"sqrt",min:1,stackDelta:0},{id:"dup",min:1,stackDelta:1},{id:"exch",min:2,stackDelta:0},{id:"index",min:2,stackDelta:0},{id:"roll",min:3,stackDelta:-2},null,null,null,{id:"hflex",min:7,resetStack:!0},{id:"flex",min:13,resetStack:!0},{id:"hflex1",min:9,resetStack:!0},{id:"flex1",min:11,resetStack:!0}];class Hi{constructor(A,e,t){this.bytes=A.getBytes(),this.properties=e,this.seacAnalysisEnabled=!!t}parse(){const A=this.properties,e=new Yi;this.cff=e;const t=this.parseHeader(),i=this.parseIndex(t.endPos),a=this.parseIndex(i.endPos),s=this.parseIndex(a.endPos),n=this.parseIndex(s.endPos),g=this.parseDict(a.obj.get(0)),r=this.createDict(Wi,g,e.strings);e.header=t.obj,e.names=this.parseNameIndex(i.obj),e.strings=this.parseStringIndex(s.obj),e.topDict=r,e.globalSubrIndex=n.obj,this.parsePrivateDict(e.topDict),e.isCIDFont=r.hasName("ROS");const o=r.getByName("CharStrings"),I=this.parseIndex(o).obj,c=r.getByName("FontMatrix");c&&(A.fontMatrix=c);const C=r.getByName("FontBBox");let B,h;if(C&&(A.ascent=Math.max(C[3],C[1]),A.descent=Math.min(C[1],C[3]),A.ascentScaled=!0),e.isCIDFont){const A=this.parseIndex(r.getByName("FDArray")).obj;for(let t=0,i=A.count;t=e)throw new v("Invalid CFF header");0!==t&&(F("cff data is shifted"),A=A.subarray(t),this.bytes=A);const i=A[0],a=A[1],s=A[2],n=A[3];return{obj:new vi(i,a,s,n),endPos:s}}parseDict(A){let e=0;function t(){let t=A[e++];return 30===t?function(){let t="";const i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"],a=A.length;for(;e>4,n=15&a;if(15===s)break;if(t+=i[s],15===n)break;t+=i[n]}return parseFloat(t)}():28===t?(t=A[e++],t=(t<<24|A[e++]<<16)>>16,t):29===t?(t=A[e++],t=t<<8|A[e++],t=t<<8|A[e++],t=t<<8|A[e++],t):t>=32&&t<=246?t-139:t>=247&&t<=250?256*(t-247)+A[e++]+108:t>=251&&t<=254?-256*(t-251)-A[e++]-108:(S('CFFParser_parseDict: "'+t+'" is a reserved command.'),NaN)}let i=[];const a=[];e=0;const s=A.length;for(;e10)return!1;let a=A.stackSize;const s=A.stack;let n=e.length;for(let g=0;g>16,g+=2,a++;else if(14===r){if(a>=4&&(a-=4,this.seacAnalysisEnabled))return A.seac=s.slice(a,a+4),!1;o=Li[r]}else if(r>=32&&r<=246)s[a]=r-139,a++;else if(r>=247&&r<=254)s[a]=r<251?(r-247<<8)+e[g]+108:-(r-251<<8)-e[g]-108,g++,a++;else if(255===r)s[a]=(e[g]<<24|e[g+1]<<16|e[g+2]<<8|e[g+3])/65536,g+=4,a++;else if(19===r||20===r){if(A.hints+=a>>1,0===A.hints){e.copyWithin(g-1,g,-1),g-=1,n-=1;continue}g+=A.hints+7>>3,a%=2,o=Li[r]}else{if(10===r||29===r){const e=10===r?t:i;if(!e)return o=Li[r],S("Missing subrsIndex for "+o.id),!1;let n=32768;e.count<1240?n=107:e.count<33900&&(n=1131);const g=s[--a]+n;if(g<0||g>=e.count||isNaN(g))return o=Li[r],S("Out of bounds subrIndex for "+o.id),!1;if(A.stackSize=a,A.callDepth++,!this.parseCharString(A,e.get(g),t,i))return!1;A.callDepth--,a=A.stackSize;continue}if(11===r)return A.stackSize=a,!0;if(0===r&&g===e.length)e[g-1]=14,o=Li[14];else{if(9===r){e.copyWithin(g-1,g,-1),g-=1,n-=1;continue}o=Li[r]}}if(o){if(o.stem&&(A.hints+=a>>1,3===r||23===r?A.hasVStems=!0:!A.hasVStems||1!==r&&18!==r||(S("CFF stem hints are in wrong order"),e[g-1]=1===r?3:23)),"min"in o&&!A.undefStack&&a=2&&o.stem?a%=2:a>1&&S("Found too many parameters for stack-clearing command"),a>0&&(A.width=s[a-1])),"stackDelta"in o?("stackFn"in o&&o.stackFn(s,a),a+=o.stackDelta):o.stackClearing?a=0:o.resetStack?(a=0,A.undefStack=!1):o.undefStack&&(a=0,A.undefStack=!0,A.firstStackClearing=!1)}}return n=a.length&&(S("Invalid fd index for glyph index."),c=!1),c&&(B=a[A].privateDict,C=B.subrsIndex)}else e&&(C=e);if(c&&(c=this.parseCharString(I,r,C,t)),null!==I.width){const A=B.getByName("nominalWidthX");g[o]=A+I.width}else{const A=B.getByName("defaultWidthX");g[o]=A}null!==I.seac&&(n[o]=I.seac),c||A.set(o,new Uint8Array([14]))}return{charStrings:A,seacs:n,widths:g}}emptyPrivateDictionary(A){const e=this.createDict(Oi,[],A.strings);A.setByKey(18,[0,0]),A.privateDict=e}parsePrivateDict(A){if(!A.hasName("Private"))return void this.emptyPrivateDictionary(A);const e=A.getByName("Private");if(!Array.isArray(e)||2!==e.length)return void A.removeByName("Private");const t=e[0],i=e[1];if(0===t||i>=this.bytes.length)return void this.emptyPrivateDictionary(A);const a=i+t,s=this.bytes.subarray(i,a),n=this.parseDict(s),g=this.createDict(Oi,n,A.strings);if(A.privateDict=g,0===g.getByName("ExpansionFactor")&&g.setByName("ExpansionFactor",.06),!g.getByName("Subrs"))return;const r=g.getByName("Subrs"),o=i+r;if(0===r||o>=this.bytes.length)return void this.emptyPrivateDictionary(A);const I=this.parseIndex(o);g.subrsIndex=I.obj}parseCharsets(A,e,t,i){if(0===A)return new Vi(!0,Xi.ISO_ADOBE,wi);if(1===A)return new Vi(!0,Xi.EXPERT,Di);if(2===A)return new Vi(!0,Xi.EXPERT_SUBSET,bi);const a=this.bytes,s=A,n=a[A++],g=[i?0:".notdef"];let r,o,I;switch(e-=1,n){case 0:for(I=0;I=65535)return void S("Not enough space in charstrings to duplicate first glyph.");const A=this.charStrings.get(0);this.charStrings.add(A),this.isCIDFont&&this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0])}hasGlyphId(A){return!(A<0||A>=this.charStrings.count)&&this.charStrings.get(A).length>0}}class vi{constructor(A,e,t,i){this.major=A,this.minor=e,this.hdrSize=t,this.offSize=i}}class Ki{constructor(){this.strings=[]}get(A){return A>=0&&A<=390?Mi[A]:A-391<=this.strings.length?this.strings[A-391]:Mi[0]}getSID(A){let e=Mi.indexOf(A);return-1!==e?e:(e=this.strings.indexOf(A),-1!==e?e+391:-1)}add(A){this.strings.push(A)}get count(){return this.strings.length}}class qi{constructor(){this.objects=[],this.length=0}add(A){this.length+=A.length,this.objects.push(A)}set(A,e){this.length+=e.length-this.objects[A].length,this.objects[A]=e}get(A){return this.objects[A]}get count(){return this.objects.length}}class Ti{constructor(A,e){this.keyToNameMap=A.keyToNameMap,this.nameToKeyMap=A.nameToKeyMap,this.defaults=A.defaults,this.types=A.types,this.opcodes=A.opcodes,this.order=A.order,this.strings=e,this.values=Object.create(null)}setByKey(A,e){if(!(A in this.keyToNameMap))return!1;if(0===e.length)return!0;for(const t of e)if(isNaN(t))return S(`Invalid CFFDict value: "${e}" for key "${A}".`),!0;const t=this.types[A];return"num"!==t&&"sid"!==t&&"offset"!==t||(e=e[0]),this.values[A]=e,!0}setByName(A,e){if(!(A in this.nameToKeyMap))throw new v(`Invalid dictionary name "${A}"`);this.values[this.nameToKeyMap[A]]=e}hasName(A){return this.nameToKeyMap[A]in this.values}getByName(A){if(!(A in this.nameToKeyMap))throw new v(`Invalid dictionary name ${A}"`);const e=this.nameToKeyMap[A];return e in this.values?this.values[e]:this.defaults[e]}removeByName(A){delete this.values[this.nameToKeyMap[A]]}static createTables(A){const e={keyToNameMap:{},nameToKeyMap:{},defaults:{},types:{},opcodes:{},order:[]};for(const t of A){const A=Array.isArray(t[0])?(t[0][0]<<8)+t[0][1]:t[0];e.keyToNameMap[A]=t[1],e.nameToKeyMap[t[1]]=A,e.types[A]=t[2],e.defaults[A]=t[3],e.opcodes[A]=Array.isArray(t[0])?t[0]:[t[0]],e.order.push(A)}return e}}const Pi=[[[12,30],"ROS",["sid","sid","num"],null],[[12,20],"SyntheticBase","num",null],[0,"version","sid",null],[1,"Notice","sid",null],[[12,0],"Copyright","sid",null],[2,"FullName","sid",null],[3,"FamilyName","sid",null],[4,"Weight","sid",null],[[12,1],"isFixedPitch","num",0],[[12,2],"ItalicAngle","num",0],[[12,3],"UnderlinePosition","num",-100],[[12,4],"UnderlineThickness","num",50],[[12,5],"PaintType","num",0],[[12,6],"CharstringType","num",2],[[12,7],"FontMatrix",["num","num","num","num","num","num"],[.001,0,0,.001,0,0]],[13,"UniqueID","num",null],[5,"FontBBox",["num","num","num","num"],[0,0,0,0]],[[12,8],"StrokeWidth","num",0],[14,"XUID","array",null],[15,"charset","offset",0],[16,"Encoding","offset",0],[17,"CharStrings","offset",0],[18,"Private",["offset","offset"],null],[[12,21],"PostScript","sid",null],[[12,22],"BaseFontName","sid",null],[[12,23],"BaseFontBlend","delta",null],[[12,31],"CIDFontVersion","num",0],[[12,32],"CIDFontRevision","num",0],[[12,33],"CIDFontType","num",0],[[12,34],"CIDCount","num",8720],[[12,35],"UIDBase","num",null],[[12,37],"FDSelect","offset",null],[[12,36],"FDArray","offset",null],[[12,38],"FontName","sid",null]];class Wi extends Ti{static get tables(){return x(this,"tables",this.createTables(Pi))}constructor(A){super(Wi.tables,A),this.privateDict=null}}const Zi=[[6,"BlueValues","delta",null],[7,"OtherBlues","delta",null],[8,"FamilyBlues","delta",null],[9,"FamilyOtherBlues","delta",null],[[12,9],"BlueScale","num",.039625],[[12,10],"BlueShift","num",7],[[12,11],"BlueFuzz","num",1],[10,"StdHW","num",null],[11,"StdVW","num",null],[[12,12],"StemSnapH","delta",null],[[12,13],"StemSnapV","delta",null],[[12,14],"ForceBold","num",0],[[12,17],"LanguageGroup","num",0],[[12,18],"ExpansionFactor","num",.06],[[12,19],"initialRandomSeed","num",0],[20,"defaultWidthX","num",0],[21,"nominalWidthX","num",0],[19,"Subrs","offset",null]];class Oi extends Ti{static get tables(){return x(this,"tables",this.createTables(Zi))}constructor(A){super(Oi.tables,A),this.subrsIndex=null}}const Xi={ISO_ADOBE:0,EXPERT:1,EXPERT_SUBSET:2};class Vi{constructor(A,e,t,i){this.predefined=A,this.format=e,this.charset=t,this.raw=i}}class ji{constructor(A,e,t,i){this.predefined=A,this.format=e,this.encoding=t,this.raw=i}}class zi{constructor(A,e){this.format=A,this.fdSelect=e}getFDIndex(A){return A<0||A>=this.fdSelect.length?-1:this.fdSelect[A]}}class _i{constructor(){this.offsets=Object.create(null)}isTracking(A){return A in this.offsets}track(A,e){if(A in this.offsets)throw new v(`Already tracking location of ${A}`);this.offsets[A]=e}offset(A){for(const e in this.offsets)this.offsets[e]+=A}setEntryLocation(A,e,t){if(!(A in this.offsets))throw new v(`Not tracking location of ${A}`);const i=t.data,a=this.offsets[A];for(let A=0,t=e.length;A>24&255,i[n]=o>>16&255,i[g]=o>>8&255,i[r]=255&o}}}class $i{constructor(A){this.cff=A}compile(){const A=this.cff,e={data:[],length:0,add(A){try{this.data.push(...A)}catch{this.data=this.data.concat(A)}this.length=this.data.length}},t=this.compileHeader(A.header);e.add(t);const i=this.compileNameIndex(A.names);if(e.add(i),A.isCIDFont&&A.topDict.hasName("FontMatrix")){const e=A.topDict.getByName("FontMatrix");A.topDict.removeByName("FontMatrix");for(const t of A.fdArray){let A=e.slice(0);t.hasName("FontMatrix")&&(A=X.transform(A,t.getByName("FontMatrix"))),t.setByName("FontMatrix",A)}}const a=A.topDict.getByName("XUID");a?.length>16&&A.topDict.removeByName("XUID"),A.topDict.setByName("charset",0);let s=this.compileTopDicts([A.topDict],e.length,A.isCIDFont);e.add(s.output);const n=s.trackers[0],g=this.compileStringIndex(A.strings.strings);e.add(g);const r=this.compileIndex(A.globalSubrIndex);if(e.add(r),A.encoding&&A.topDict.hasName("Encoding"))if(A.encoding.predefined)n.setEntryLocation("Encoding",[A.encoding.format],e);else{const t=this.compileEncoding(A.encoding);n.setEntryLocation("Encoding",[e.length],e),e.add(t)}const o=this.compileCharset(A.charset,A.charStrings.count,A.strings,A.isCIDFont);n.setEntryLocation("charset",[e.length],e),e.add(o);const I=this.compileCharStrings(A.charStrings);if(n.setEntryLocation("CharStrings",[e.length],e),e.add(I),A.isCIDFont){n.setEntryLocation("FDSelect",[e.length],e);const t=this.compileFDSelect(A.fdSelect);e.add(t),s=this.compileTopDicts(A.fdArray,e.length,!0),n.setEntryLocation("FDArray",[e.length],e),e.add(s.output);const i=s.trackers;this.compilePrivateDicts(A.fdArray,i,e)}return this.compilePrivateDicts([A.topDict],[n],e),e.add([0]),e.data}encodeNumber(A){return Number.isInteger(A)?this.encodeInteger(A):this.encodeFloat(A)}static get EncodeFloatRegExp(){return x(this,"EncodeFloatRegExp",/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/)}encodeFloat(A){let e=A.toString();const t=$i.EncodeFloatRegExp.exec(e);if(t){const i=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(A*i)/i).toString()}let i,a,s="";for(i=0,a=e.length;i=-107&&A<=107?[A+139]:A>=108&&A<=1131?[247+((A-=108)>>8),255&A]:A>=-1131&&A<=-108?[251+((A=-A-108)>>8),255&A]:A>=-32768&&A<=32767?[28,A>>8&255,255&A]:[29,A>>24&255,A>>16&255,A>>8&255,255&A],e}compileHeader(A){return[A.major,A.minor,4,A.offSize]}compileNameIndex(A){const e=new qi;for(const t of A){const A=Math.min(t.length,127);let i=new Array(A);for(let e=0;e"~"||"["===A||"]"===A||"("===A||")"===A||"{"===A||"}"===A||"<"===A||">"===A||"/"===A||"%"===A)&&(A="_"),i[e]=A}i=i.join(""),""===i&&(i="Bad_Font_Name"),e.add(T(i))}return this.compileIndex(e)}compileTopDicts(A,e,t){const i=[];let a=new qi;for(const s of A){t&&(s.removeByName("CIDFontVersion"),s.removeByName("CIDFontRevision"),s.removeByName("CIDFontType"),s.removeByName("CIDCount"),s.removeByName("UIDBase"));const A=new _i,n=this.compileDict(s,A);i.push(A),a.add(n),A.offset(e)}return a=this.compileIndex(a,i),{trackers:i,output:a}}compilePrivateDicts(A,e,t){for(let i=0,a=A.length;i>8&255,255&s]);else{a=new Uint8Array(1+2*s),a[0]=0;let e=0;const i=A.charset.length;let n=!1;for(let s=1;s>8&255,a[s+1]=255&g}}return this.compileTypedArray(a)}compileEncoding(A){return this.compileTypedArray(A.raw)}compileFDSelect(A){const e=A.format;let t,i;switch(e){case 0:for(t=new Uint8Array(1+A.fdSelect.length),t[0]=e,i=0;i>8&255,255&a,s];for(i=1;i>8&255,255&i,e),s=e)}const g=(n.length-3)/3;n[1]=g>>8&255,n[2]=255&g,n.push(i>>8&255,255&i),t=new Uint8Array(n)}return this.compileTypedArray(t)}compileTypedArray(A){return Array.from(A)}compileIndex(A,e=[]){const t=A.objects,i=t.length;if(0===i)return[0,0];const a=[i>>8&255,255&i];let s,n,g=1;for(s=0;s>8&255,255&r):3===n?a.push(r>>16&255,r>>8&255,255&r):a.push(r>>>24&255,r>>16&255,r>>8&255,255&r),t[s]&&(r+=t[s].length);for(s=0;s=5&&e<=7))return-1;i=A.substring(1)}if(i===i.toUpperCase()&&(t=parseInt(i,16),t>=0))return t}return-1}const aa=[[0,127],[128,255],[256,383],[384,591],[592,687,7424,7551,7552,7615],[688,767,42752,42783],[768,879,7616,7679],[880,1023],[11392,11519],[1024,1279,1280,1327,11744,11775,42560,42655],[1328,1423],[1424,1535],[42240,42559],[1536,1791,1872,1919],[1984,2047],[2304,2431],[2432,2559],[2560,2687],[2688,2815],[2816,2943],[2944,3071],[3072,3199],[3200,3327],[3328,3455],[3584,3711],[3712,3839],[4256,4351,11520,11567],[6912,7039],[4352,4607],[7680,7935,11360,11391,42784,43007],[7936,8191],[8192,8303,11776,11903],[8304,8351],[8352,8399],[8400,8447],[8448,8527],[8528,8591],[8592,8703,10224,10239,10496,10623,11008,11263],[8704,8959,10752,11007,10176,10223,10624,10751],[8960,9215],[9216,9279],[9280,9311],[9312,9471],[9472,9599],[9600,9631],[9632,9727],[9728,9983],[9984,10175],[12288,12351],[12352,12447],[12448,12543,12784,12799],[12544,12591,12704,12735],[12592,12687],[43072,43135],[12800,13055],[13056,13311],[44032,55215],[55296,57343],[67840,67871],[19968,40959,11904,12031,12032,12255,12272,12287,13312,19903,131072,173791,12688,12703],[57344,63743],[12736,12783,63744,64255,194560,195103],[64256,64335],[64336,65023],[65056,65071],[65040,65055],[65104,65135],[65136,65279],[65280,65519],[65520,65535],[3840,4095],[1792,1871],[1920,1983],[3456,3583],[4096,4255],[4608,4991,4992,5023,11648,11743],[5024,5119],[5120,5759],[5760,5791],[5792,5887],[6016,6143],[6144,6319],[10240,10495],[40960,42127],[5888,5919,5920,5951,5952,5983,5984,6015],[66304,66351],[66352,66383],[66560,66639],[118784,119039,119040,119295,119296,119375],[119808,120831],[1044480,1048573],[65024,65039,917760,917999],[917504,917631],[6400,6479],[6480,6527],[6528,6623],[6656,6687],[11264,11359],[11568,11647],[19904,19967],[43008,43055],[65536,65663,65664,65791,65792,65855],[65856,65935],[66432,66463],[66464,66527],[66640,66687],[66688,66735],[67584,67647],[68096,68191],[119552,119647],[73728,74751,74752,74879],[119648,119679],[7040,7103],[7168,7247],[7248,7295],[43136,43231],[43264,43311],[43312,43359],[43520,43615],[65936,65999],[66e3,66047],[66208,66271,66176,66207,67872,67903],[127024,127135,126976,127023]];function sa(A,e=-1){if(-1!==e){const t=aa[e];for(let i=0,a=t.length;i=t[i]&&A<=t[i+1])return e}for(let e=0,t=aa.length;e=t[i]&&A<=t[i+1])return e}return-1}const na=new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$","u"),ga=new Map,ra=!0,oa=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function Ia(A,e){if(void 0!==e[A])return A;const t=ia(A,e);if(-1!==t)for(const A in e)if(e[A]===t)return A;return F("Unable to recover a standard glyph name for: "+A),A}function ca(A,e,t){const i=Object.create(null);let a,s,n;const g=!!(4&A.flags);if(A.isInternalFont)for(n=e,s=0;s=0?a:0;else if(A.baseEncodingName)for(n=Ui(A.baseEncodingName),s=0;s=0?a:0;else if(g)for(s in e)i[s]=e[s];else for(n=Ri,s=0;s=0?a:0;const r=A.differences;let o;if(r)for(s in r){const A=r[s];if(a=t.indexOf(A),-1===a){o||(o=Aa());const e=Ia(A,o);e!==A&&(a=t.indexOf(e))}i[s]=a>=0?a:0}return i}function Ca(A){return A.replaceAll(/[,_]/g,"-").replaceAll(/\s/g,"")}const Ba=pA((A=>{A[8211]=65074,A[8212]=65073,A[8229]=65072,A[8230]=65049,A[12289]=65041,A[12290]=65042,A[12296]=65087,A[12297]=65088,A[12298]=65085,A[12299]=65086,A[12300]=65089,A[12301]=65090,A[12302]=65091,A[12303]=65092,A[12304]=65083,A[12305]=65084,A[12308]=65081,A[12309]=65082,A[12310]=65047,A[12311]=65048,A[65103]=65076,A[65281]=65045,A[65288]=65077,A[65289]=65078,A[65292]=65040,A[65306]=65043,A[65307]=65044,A[65311]=65046,A[65339]=65095,A[65341]=65096,A[65343]=65075,A[65371]=65079,A[65373]=65080})),ha=pA((function(A){A["Times-Roman"]="Times-Roman",A.Helvetica="Helvetica",A.Courier="Courier",A.Symbol="Symbol",A["Times-Bold"]="Times-Bold",A["Helvetica-Bold"]="Helvetica-Bold",A["Courier-Bold"]="Courier-Bold",A.ZapfDingbats="ZapfDingbats",A["Times-Italic"]="Times-Italic",A["Helvetica-Oblique"]="Helvetica-Oblique",A["Courier-Oblique"]="Courier-Oblique",A["Times-BoldItalic"]="Times-BoldItalic",A["Helvetica-BoldOblique"]="Helvetica-BoldOblique",A["Courier-BoldOblique"]="Courier-BoldOblique",A.ArialNarrow="Helvetica",A["ArialNarrow-Bold"]="Helvetica-Bold",A["ArialNarrow-BoldItalic"]="Helvetica-BoldOblique",A["ArialNarrow-Italic"]="Helvetica-Oblique",A.ArialBlack="Helvetica",A["ArialBlack-Bold"]="Helvetica-Bold",A["ArialBlack-BoldItalic"]="Helvetica-BoldOblique",A["ArialBlack-Italic"]="Helvetica-Oblique",A["Arial-Black"]="Helvetica",A["Arial-Black-Bold"]="Helvetica-Bold",A["Arial-Black-BoldItalic"]="Helvetica-BoldOblique",A["Arial-Black-Italic"]="Helvetica-Oblique",A.Arial="Helvetica",A["Arial-Bold"]="Helvetica-Bold",A["Arial-BoldItalic"]="Helvetica-BoldOblique",A["Arial-Italic"]="Helvetica-Oblique",A.ArialMT="Helvetica",A["Arial-BoldItalicMT"]="Helvetica-BoldOblique",A["Arial-BoldMT"]="Helvetica-Bold",A["Arial-ItalicMT"]="Helvetica-Oblique",A["Arial-BoldItalicMT-BoldItalic"]="Helvetica-BoldOblique",A["Arial-BoldMT-Bold"]="Helvetica-Bold",A["Arial-ItalicMT-Italic"]="Helvetica-Oblique",A.ArialUnicodeMS="Helvetica",A["ArialUnicodeMS-Bold"]="Helvetica-Bold",A["ArialUnicodeMS-BoldItalic"]="Helvetica-BoldOblique",A["ArialUnicodeMS-Italic"]="Helvetica-Oblique",A["Courier-BoldItalic"]="Courier-BoldOblique",A["Courier-Italic"]="Courier-Oblique",A.CourierNew="Courier",A["CourierNew-Bold"]="Courier-Bold",A["CourierNew-BoldItalic"]="Courier-BoldOblique",A["CourierNew-Italic"]="Courier-Oblique",A["CourierNewPS-BoldItalicMT"]="Courier-BoldOblique",A["CourierNewPS-BoldMT"]="Courier-Bold",A["CourierNewPS-ItalicMT"]="Courier-Oblique",A.CourierNewPSMT="Courier",A["Helvetica-BoldItalic"]="Helvetica-BoldOblique",A["Helvetica-Italic"]="Helvetica-Oblique",A["Symbol-Bold"]="Symbol",A["Symbol-BoldItalic"]="Symbol",A["Symbol-Italic"]="Symbol",A.TimesNewRoman="Times-Roman",A["TimesNewRoman-Bold"]="Times-Bold",A["TimesNewRoman-BoldItalic"]="Times-BoldItalic",A["TimesNewRoman-Italic"]="Times-Italic",A.TimesNewRomanPS="Times-Roman",A["TimesNewRomanPS-Bold"]="Times-Bold",A["TimesNewRomanPS-BoldItalic"]="Times-BoldItalic",A["TimesNewRomanPS-BoldItalicMT"]="Times-BoldItalic",A["TimesNewRomanPS-BoldMT"]="Times-Bold",A["TimesNewRomanPS-Italic"]="Times-Italic",A["TimesNewRomanPS-ItalicMT"]="Times-Italic",A.TimesNewRomanPSMT="Times-Roman",A["TimesNewRomanPSMT-Bold"]="Times-Bold",A["TimesNewRomanPSMT-BoldItalic"]="Times-BoldItalic",A["TimesNewRomanPSMT-Italic"]="Times-Italic"})),Qa=pA((function(A){A.Courier="FoxitFixed.pfb",A["Courier-Bold"]="FoxitFixedBold.pfb",A["Courier-BoldOblique"]="FoxitFixedBoldItalic.pfb",A["Courier-Oblique"]="FoxitFixedItalic.pfb",A.Helvetica="LiberationSans-Regular.ttf",A["Helvetica-Bold"]="LiberationSans-Bold.ttf",A["Helvetica-BoldOblique"]="LiberationSans-BoldItalic.ttf",A["Helvetica-Oblique"]="LiberationSans-Italic.ttf",A["Times-Roman"]="FoxitSerif.pfb",A["Times-Bold"]="FoxitSerifBold.pfb",A["Times-BoldItalic"]="FoxitSerifBoldItalic.pfb",A["Times-Italic"]="FoxitSerifItalic.pfb",A.Symbol="FoxitSymbol.pfb",A.ZapfDingbats="FoxitDingbats.pfb",A["LiberationSans-Regular"]="LiberationSans-Regular.ttf",A["LiberationSans-Bold"]="LiberationSans-Bold.ttf",A["LiberationSans-Italic"]="LiberationSans-Italic.ttf",A["LiberationSans-BoldItalic"]="LiberationSans-BoldItalic.ttf"})),la=pA((function(A){A.Calibri="Helvetica",A["Calibri-Bold"]="Helvetica-Bold",A["Calibri-BoldItalic"]="Helvetica-BoldOblique",A["Calibri-Italic"]="Helvetica-Oblique",A.CenturyGothic="Helvetica",A["CenturyGothic-Bold"]="Helvetica-Bold",A["CenturyGothic-BoldItalic"]="Helvetica-BoldOblique",A["CenturyGothic-Italic"]="Helvetica-Oblique",A.ComicSansMS="Comic Sans MS",A["ComicSansMS-Bold"]="Comic Sans MS-Bold",A["ComicSansMS-BoldItalic"]="Comic Sans MS-BoldItalic",A["ComicSansMS-Italic"]="Comic Sans MS-Italic",A.Impact="Helvetica",A["ItcSymbol-Bold"]="Helvetica-Bold",A["ItcSymbol-BoldItalic"]="Helvetica-BoldOblique",A["ItcSymbol-Book"]="Helvetica",A["ItcSymbol-BookItalic"]="Helvetica-Oblique",A["ItcSymbol-Medium"]="Helvetica",A["ItcSymbol-MediumItalic"]="Helvetica-Oblique",A.LucidaConsole="Courier",A["LucidaConsole-Bold"]="Courier-Bold",A["LucidaConsole-BoldItalic"]="Courier-BoldOblique",A["LucidaConsole-Italic"]="Courier-Oblique",A["LucidaSans-Demi"]="Helvetica-Bold",A["MS-Gothic"]="MS Gothic",A["MS-Gothic-Bold"]="MS Gothic-Bold",A["MS-Gothic-BoldItalic"]="MS Gothic-BoldItalic",A["MS-Gothic-Italic"]="MS Gothic-Italic",A["MS-Mincho"]="MS Mincho",A["MS-Mincho-Bold"]="MS Mincho-Bold",A["MS-Mincho-BoldItalic"]="MS Mincho-BoldItalic",A["MS-Mincho-Italic"]="MS Mincho-Italic",A["MS-PGothic"]="MS PGothic",A["MS-PGothic-Bold"]="MS PGothic-Bold",A["MS-PGothic-BoldItalic"]="MS PGothic-BoldItalic",A["MS-PGothic-Italic"]="MS PGothic-Italic",A["MS-PMincho"]="MS PMincho",A["MS-PMincho-Bold"]="MS PMincho-Bold",A["MS-PMincho-BoldItalic"]="MS PMincho-BoldItalic",A["MS-PMincho-Italic"]="MS PMincho-Italic",A.NuptialScript="Times-Italic",A.SegoeUISymbol="Helvetica"})),Ea=pA((function(A){A["Adobe Jenson"]=!0,A["Adobe Text"]=!0,A.Albertus=!0,A.Aldus=!0,A.Alexandria=!0,A.Algerian=!0,A["American Typewriter"]=!0,A.Antiqua=!0,A.Apex=!0,A.Arno=!0,A.Aster=!0,A.Aurora=!0,A.Baskerville=!0,A.Bell=!0,A.Bembo=!0,A["Bembo Schoolbook"]=!0,A.Benguiat=!0,A["Berkeley Old Style"]=!0,A["Bernhard Modern"]=!0,A["Berthold City"]=!0,A.Bodoni=!0,A["Bauer Bodoni"]=!0,A["Book Antiqua"]=!0,A.Bookman=!0,A["Bordeaux Roman"]=!0,A["Californian FB"]=!0,A.Calisto=!0,A.Calvert=!0,A.Capitals=!0,A.Cambria=!0,A.Cartier=!0,A.Caslon=!0,A.Catull=!0,A.Centaur=!0,A["Century Old Style"]=!0,A["Century Schoolbook"]=!0,A.Chaparral=!0,A["Charis SIL"]=!0,A.Cheltenham=!0,A["Cholla Slab"]=!0,A.Clarendon=!0,A.Clearface=!0,A.Cochin=!0,A.Colonna=!0,A["Computer Modern"]=!0,A["Concrete Roman"]=!0,A.Constantia=!0,A["Cooper Black"]=!0,A.Corona=!0,A.Ecotype=!0,A.Egyptienne=!0,A.Elephant=!0,A.Excelsior=!0,A.Fairfield=!0,A["FF Scala"]=!0,A.Folkard=!0,A.Footlight=!0,A.FreeSerif=!0,A["Friz Quadrata"]=!0,A.Garamond=!0,A.Gentium=!0,A.Georgia=!0,A.Gloucester=!0,A["Goudy Old Style"]=!0,A["Goudy Schoolbook"]=!0,A["Goudy Pro Font"]=!0,A.Granjon=!0,A["Guardian Egyptian"]=!0,A.Heather=!0,A.Hercules=!0,A["High Tower Text"]=!0,A.Hiroshige=!0,A["Hoefler Text"]=!0,A["Humana Serif"]=!0,A.Imprint=!0,A["Ionic No. 5"]=!0,A.Janson=!0,A.Joanna=!0,A.Korinna=!0,A.Lexicon=!0,A.LiberationSerif=!0,A["Liberation Serif"]=!0,A["Linux Libertine"]=!0,A.Literaturnaya=!0,A.Lucida=!0,A["Lucida Bright"]=!0,A.Melior=!0,A.Memphis=!0,A.Miller=!0,A.Minion=!0,A.Modern=!0,A["Mona Lisa"]=!0,A["Mrs Eaves"]=!0,A["MS Serif"]=!0,A["Museo Slab"]=!0,A["New York"]=!0,A["Nimbus Roman"]=!0,A["NPS Rawlinson Roadway"]=!0,A.NuptialScript=!0,A.Palatino=!0,A.Perpetua=!0,A.Plantin=!0,A["Plantin Schoolbook"]=!0,A.Playbill=!0,A["Poor Richard"]=!0,A["Rawlinson Roadway"]=!0,A.Renault=!0,A.Requiem=!0,A.Rockwell=!0,A.Roman=!0,A["Rotis Serif"]=!0,A.Sabon=!0,A.Scala=!0,A.Seagull=!0,A.Sistina=!0,A.Souvenir=!0,A.STIX=!0,A["Stone Informal"]=!0,A["Stone Serif"]=!0,A.Sylfaen=!0,A.Times=!0,A.Trajan=!0,A["Trinité"]=!0,A["Trump Mediaeval"]=!0,A.Utopia=!0,A["Vale Type"]=!0,A["Bitstream Vera"]=!0,A["Vera Serif"]=!0,A.Versailles=!0,A.Wanted=!0,A.Weiss=!0,A["Wide Latin"]=!0,A.Windsor=!0,A.XITS=!0})),ua=pA((function(A){A.Dingbats=!0,A.Symbol=!0,A.ZapfDingbats=!0,A.Wingdings=!0,A["Wingdings-Bold"]=!0,A["Wingdings-Regular"]=!0})),da=pA((function(A){A[2]=10,A[3]=32,A[4]=33,A[5]=34,A[6]=35,A[7]=36,A[8]=37,A[9]=38,A[10]=39,A[11]=40,A[12]=41,A[13]=42,A[14]=43,A[15]=44,A[16]=45,A[17]=46,A[18]=47,A[19]=48,A[20]=49,A[21]=50,A[22]=51,A[23]=52,A[24]=53,A[25]=54,A[26]=55,A[27]=56,A[28]=57,A[29]=58,A[30]=894,A[31]=60,A[32]=61,A[33]=62,A[34]=63,A[35]=64,A[36]=65,A[37]=66,A[38]=67,A[39]=68,A[40]=69,A[41]=70,A[42]=71,A[43]=72,A[44]=73,A[45]=74,A[46]=75,A[47]=76,A[48]=77,A[49]=78,A[50]=79,A[51]=80,A[52]=81,A[53]=82,A[54]=83,A[55]=84,A[56]=85,A[57]=86,A[58]=87,A[59]=88,A[60]=89,A[61]=90,A[62]=91,A[63]=92,A[64]=93,A[65]=94,A[66]=95,A[67]=96,A[68]=97,A[69]=98,A[70]=99,A[71]=100,A[72]=101,A[73]=102,A[74]=103,A[75]=104,A[76]=105,A[77]=106,A[78]=107,A[79]=108,A[80]=109,A[81]=110,A[82]=111,A[83]=112,A[84]=113,A[85]=114,A[86]=115,A[87]=116,A[88]=117,A[89]=118,A[90]=119,A[91]=120,A[92]=121,A[93]=122,A[94]=123,A[95]=124,A[96]=125,A[97]=126,A[98]=196,A[99]=197,A[100]=199,A[101]=201,A[102]=209,A[103]=214,A[104]=220,A[105]=225,A[106]=224,A[107]=226,A[108]=228,A[109]=227,A[110]=229,A[111]=231,A[112]=233,A[113]=232,A[114]=234,A[115]=235,A[116]=237,A[117]=236,A[118]=238,A[119]=239,A[120]=241,A[121]=243,A[122]=242,A[123]=244,A[124]=246,A[125]=245,A[126]=250,A[127]=249,A[128]=251,A[129]=252,A[130]=8224,A[131]=176,A[132]=162,A[133]=163,A[134]=167,A[135]=8226,A[136]=182,A[137]=223,A[138]=174,A[139]=169,A[140]=8482,A[141]=180,A[142]=168,A[143]=8800,A[144]=198,A[145]=216,A[146]=8734,A[147]=177,A[148]=8804,A[149]=8805,A[150]=165,A[151]=181,A[152]=8706,A[153]=8721,A[154]=8719,A[156]=8747,A[157]=170,A[158]=186,A[159]=8486,A[160]=230,A[161]=248,A[162]=191,A[163]=161,A[164]=172,A[165]=8730,A[166]=402,A[167]=8776,A[168]=8710,A[169]=171,A[170]=187,A[171]=8230,A[179]=8220,A[180]=8221,A[181]=8216,A[182]=8217,A[200]=193,A[203]=205,A[207]=211,A[210]=218,A[223]=711,A[224]=321,A[225]=322,A[226]=352,A[227]=353,A[228]=381,A[229]=382,A[233]=221,A[234]=253,A[252]=263,A[253]=268,A[254]=269,A[258]=258,A[260]=260,A[261]=261,A[265]=280,A[266]=281,A[267]=282,A[268]=283,A[269]=313,A[275]=323,A[276]=324,A[278]=328,A[283]=344,A[284]=345,A[285]=346,A[286]=347,A[292]=367,A[295]=377,A[296]=378,A[298]=380,A[305]=963,A[306]=964,A[307]=966,A[308]=8215,A[309]=8252,A[310]=8319,A[311]=8359,A[312]=8592,A[313]=8593,A[337]=9552,A[493]=1039,A[494]=1040,A[672]=1488,A[673]=1489,A[674]=1490,A[675]=1491,A[676]=1492,A[677]=1493,A[678]=1494,A[679]=1495,A[680]=1496,A[681]=1497,A[682]=1498,A[683]=1499,A[684]=1500,A[685]=1501,A[686]=1502,A[687]=1503,A[688]=1504,A[689]=1505,A[690]=1506,A[691]=1507,A[692]=1508,A[693]=1509,A[694]=1510,A[695]=1511,A[696]=1512,A[697]=1513,A[698]=1514,A[705]=1524,A[706]=8362,A[710]=64288,A[711]=64298,A[759]=1617,A[761]=1776,A[763]=1778,A[775]=1652,A[777]=1764,A[778]=1780,A[779]=1781,A[780]=1782,A[782]=771,A[783]=64726,A[786]=8363,A[788]=8532,A[790]=768,A[791]=769,A[792]=768,A[795]=803,A[797]=64336,A[798]=64337,A[799]=64342,A[800]=64343,A[801]=64344,A[802]=64345,A[803]=64362,A[804]=64363,A[805]=64364,A[2424]=7821,A[2425]=7822,A[2426]=7823,A[2427]=7824,A[2428]=7825,A[2429]=7826,A[2430]=7827,A[2433]=7682,A[2678]=8045,A[2679]=8046,A[2830]=1552,A[2838]=686,A[2840]=751,A[2842]=753,A[2843]=754,A[2844]=755,A[2846]=757,A[2856]=767,A[2857]=848,A[2858]=849,A[2862]=853,A[2863]=854,A[2864]=855,A[2865]=861,A[2866]=862,A[2906]=7460,A[2908]=7462,A[2909]=7463,A[2910]=7464,A[2912]=7466,A[2913]=7467,A[2914]=7468,A[2916]=7470,A[2917]=7471,A[2918]=7472,A[2920]=7474,A[2921]=7475,A[2922]=7476,A[2924]=7478,A[2925]=7479,A[2926]=7480,A[2928]=7482,A[2929]=7483,A[2930]=7484,A[2932]=7486,A[2933]=7487,A[2934]=7488,A[2936]=7490,A[2937]=7491,A[2938]=7492,A[2940]=7494,A[2941]=7495,A[2942]=7496,A[2944]=7498,A[2946]=7500,A[2948]=7502,A[2950]=7504,A[2951]=7505,A[2952]=7506,A[2954]=7508,A[2955]=7509,A[2956]=7510,A[2958]=7512,A[2959]=7513,A[2960]=7514,A[2962]=7516,A[2963]=7517,A[2964]=7518,A[2966]=7520,A[2967]=7521,A[2968]=7522,A[2970]=7524,A[2971]=7525,A[2972]=7526,A[2974]=7528,A[2975]=7529,A[2976]=7530,A[2978]=1537,A[2979]=1538,A[2980]=1539,A[2982]=1549,A[2983]=1551,A[2984]=1552,A[2986]=1554,A[2987]=1555,A[2988]=1556,A[2990]=1623,A[2991]=1624,A[2995]=1775,A[2999]=1791,A[3002]=64290,A[3003]=64291,A[3004]=64292,A[3006]=64294,A[3007]=64295,A[3008]=64296,A[3011]=1900,A[3014]=8223,A[3015]=8244,A[3017]=7532,A[3018]=7533,A[3019]=7534,A[3075]=7590,A[3076]=7591,A[3079]=7594,A[3080]=7595,A[3083]=7598,A[3084]=7599,A[3087]=7602,A[3088]=7603,A[3091]=7606,A[3092]=7607,A[3095]=7610,A[3096]=7611,A[3099]=7614,A[3100]=7615,A[3103]=7618,A[3104]=7619,A[3107]=8337,A[3108]=8338,A[3116]=1884,A[3119]=1885,A[3120]=1885,A[3123]=1886,A[3124]=1886,A[3127]=1887,A[3128]=1887,A[3131]=1888,A[3132]=1888,A[3135]=1889,A[3136]=1889,A[3139]=1890,A[3140]=1890,A[3143]=1891,A[3144]=1891,A[3147]=1892,A[3148]=1892,A[3153]=580,A[3154]=581,A[3157]=584,A[3158]=585,A[3161]=588,A[3162]=589,A[3165]=891,A[3166]=892,A[3169]=1274,A[3170]=1275,A[3173]=1278,A[3174]=1279,A[3181]=7622,A[3182]=7623,A[3282]=11799,A[3316]=578,A[3379]=42785,A[3393]=1159,A[3416]=8377})),fa=pA((function(A){A[227]=322,A[264]=261,A[291]=346})),pa=pA((function(A){A[1]=32,A[4]=65,A[5]=192,A[6]=193,A[9]=196,A[17]=66,A[18]=67,A[21]=268,A[24]=68,A[28]=69,A[29]=200,A[30]=201,A[32]=282,A[38]=70,A[39]=71,A[44]=72,A[47]=73,A[48]=204,A[49]=205,A[58]=74,A[60]=75,A[62]=76,A[68]=77,A[69]=78,A[75]=79,A[76]=210,A[80]=214,A[87]=80,A[89]=81,A[90]=82,A[92]=344,A[94]=83,A[97]=352,A[100]=84,A[104]=85,A[109]=220,A[115]=86,A[116]=87,A[121]=88,A[122]=89,A[124]=221,A[127]=90,A[129]=381,A[258]=97,A[259]=224,A[260]=225,A[263]=228,A[268]=261,A[271]=98,A[272]=99,A[273]=263,A[275]=269,A[282]=100,A[286]=101,A[287]=232,A[288]=233,A[290]=283,A[295]=281,A[296]=102,A[336]=103,A[346]=104,A[349]=105,A[350]=236,A[351]=237,A[361]=106,A[364]=107,A[367]=108,A[371]=322,A[373]=109,A[374]=110,A[381]=111,A[382]=242,A[383]=243,A[386]=246,A[393]=112,A[395]=113,A[396]=114,A[398]=345,A[400]=115,A[401]=347,A[403]=353,A[410]=116,A[437]=117,A[442]=252,A[448]=118,A[449]=119,A[454]=120,A[455]=121,A[457]=253,A[460]=122,A[462]=382,A[463]=380,A[853]=44,A[855]=58,A[856]=46,A[876]=47,A[878]=45,A[882]=45,A[894]=40,A[895]=41,A[896]=91,A[897]=93,A[923]=64,A[1004]=48,A[1005]=49,A[1006]=50,A[1007]=51,A[1008]=52,A[1009]=53,A[1010]=54,A[1011]=55,A[1012]=56,A[1013]=57,A[1081]=37,A[1085]=43,A[1086]=45}));function ma(A){const e=Ca(A);return ha()[e]}function ya(A){const e=Ca(A);return!!(ha()[e]||la()[e]||Ea()[e]||ua()[e])}class wa{constructor(A=[]){this._map=A}get length(){return this._map.length}forEach(A){for(const e in this._map)A(e,this._map[e].charCodeAt(0))}has(A){return void 0!==this._map[A]}get(A){return this._map[A]}charCodeOf(A){const e=this._map;if(e.length<=65536)return e.indexOf(A);for(const t in e)if(e[t]===A)return 0|t;return-1}amend(A){for(const e in A)this._map[e]=A[e]}}class Da{constructor(A,e){this.firstChar=A,this.lastChar=e}get length(){return this.lastChar+1-this.firstChar}forEach(A){for(let e=this.firstChar,t=this.lastChar;e<=t;e++)A(e,e)}has(A){return this.firstChar<=A&&A<=this.lastChar}get(A){if(this.firstChar<=A&&A<=this.lastChar)return String.fromCharCode(A)}charCodeOf(A){return Number.isInteger(A)&&A>=this.firstChar&&A<=this.lastChar?A:-1}amend(A){R("Should not call amend()")}}class ba{constructor(A,e){this.properties=e;const t=new Hi(A,e,ra);this.cff=t.parse(),this.cff.duplicateFirstGlyph();const i=new $i(this.cff);this.seacs=this.cff.seacs;try{this.data=i.compile()}catch{S("Failed to compile font "+e.loadedName),this.data=A}this._createBuiltInEncoding()}get numGlyphs(){return this.cff.charStrings.count}getCharset(){return this.cff.charset.charset}getGlyphMapping(){const A=this.cff,e=this.properties,{cidToGidMap:t,cMap:i}=e,a=A.charset.charset;let s,n;if(e.composite){let e,g;if(t?.length>0){e=Object.create(null);for(let A=0,i=t.length;A=0){const i=t[e];i&&(a[A]=i)}}a.length>0&&(this.properties.builtInEncoding=a)}}function ka(A,e){return(A[e]<<24|A[e+1]<<16|A[e+2]<<8|A[e+3])>>>0}function Fa(A,e){return A[e]<<8|A[e+1]}function Sa(A,e){return(A[e]<<24|A[e+1]<<16)>>16}function Ra(A,e){return A[e]<<24>>24}function Ga(A,e){return Sa(A,e)/16384}function Na(A){const e=A.length;let t=32768;return e<1240?t=107:e<33900&&(t=1131),t}function xa(A,e,t){const i=1===Fa(A,e+2)?ka(A,e+8):ka(A,e+16),a=Fa(A,e+i);let s,n,g;if(4===a){Fa(A,e+i+2);const t=Fa(A,e+i+6)>>1;for(n=e+i+14,s=[],g=0;g>1;t0;)B.push({flags:r})}for(t=0;t>1,m=!0;break;case 4:o+=g.pop(),a(r,o),m=!0;break;case 5:for(;g.length>0;)r+=g.shift(),o+=g.shift(),s(r,o);break;case 6:for(;g.length>0&&(r+=g.shift(),s(r,o),0!==g.length);)o+=g.shift(),s(r,o);break;case 7:for(;g.length>0&&(o+=g.shift(),s(r,o),0!==g.length);)r+=g.shift(),s(r,o);break;case 8:for(;g.length>0;)B=r+g.shift(),Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+g.shift(),n(B,Q,h,l,r,o);break;case 10:if(f=g.pop(),p=null,t.isCFFCIDFont){const A=t.fdSelect.getFDIndex(i);if(A>=0&&AMath.abs(o-e)?r+=g.shift():o+=g.shift(),n(B,Q,h,l,r,o);break;default:throw new v(`unknown operator: 12 ${y}`)}break;case 14:if(g.length>=4){const A=g.pop(),i=g.pop();o=g.pop(),r=g.pop(),e.add(5),e.add(8,[r,o]);let a=Ma(t.cmap,String.fromCharCode(t.glyphNameMap[Ri[A]]));Ja(t.glyphs[a.glyphId],e,t,a.glyphId),e.add(4),a=Ma(t.cmap,String.fromCharCode(t.glyphNameMap[Ri[i]])),Ja(t.glyphs[a.glyphId],e,t,a.glyphId)}return;case 19:case 20:I+=g.length>>1,C+=I+7>>3,m=!0;break;case 21:o+=g.pop(),r+=g.pop(),a(r,o),m=!0;break;case 22:r+=g.pop(),a(r,o),m=!0;break;case 24:for(;g.length>2;)B=r+g.shift(),Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+g.shift(),n(B,Q,h,l,r,o);r+=g.shift(),o+=g.shift(),s(r,o);break;case 25:for(;g.length>6;)r+=g.shift(),o+=g.shift(),s(r,o);B=r+g.shift(),Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+g.shift(),n(B,Q,h,l,r,o);break;case 26:for(g.length%2&&(r+=g.shift());g.length>0;)B=r,Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h,o=l+g.shift(),n(B,Q,h,l,r,o);break;case 27:for(g.length%2&&(o+=g.shift());g.length>0;)B=r+g.shift(),Q=o,h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l,n(B,Q,h,l,r,o);break;case 28:g.push((c[C]<<24|c[C+1]<<16)>>16),C+=2;break;case 29:f=g.pop()+t.gsubrsBias,p=t.gsubrs[f],p&&A(p);break;case 30:for(;g.length>0&&(B=r,Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+(1===g.length?g.shift():0),n(B,Q,h,l,r,o),0!==g.length);)B=r+g.shift(),Q=o,h=B+g.shift(),l=Q+g.shift(),o=l+g.shift(),r=h+(1===g.length?g.shift():0),n(B,Q,h,l,r,o);break;case 31:for(;g.length>0&&(B=r+g.shift(),Q=o,h=B+g.shift(),l=Q+g.shift(),o=l+g.shift(),r=h+(1===g.length?g.shift():0),n(B,Q,h,l,r,o),0!==g.length);)B=r,Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+(1===g.length?g.shift():0),n(B,Q,h,l,r,o);break;default:if(y<32)throw new v(`unknown operator: ${y}`);y<247?g.push(y-139):y<251?g.push(256*(y-247)+c[C++]+108):y<255?g.push(256*-(y-251)-c[C++]-108):(g.push((c[C]<<24|c[C+1]<<16|c[C+2]<<8|c[C+3])/65536),C+=4)}m&&(g.length=0)}}(A)}const Ha=[];class Ya{cmds=[];add(A,e){if(e)if(MA(e,null))this.cmds.push(A,...e);else{S(`Commands.add - "${A}" has at least one non-number arg: "${e}".`);const t=e.map((A=>"number"==typeof A?A:0));this.cmds.push(A,...t)}else this.cmds.push(A)}}class va{constructor(A){this.fontMatrix=A,this.compiledGlyphs=Object.create(null),this.compiledCharCodeToGlyphId=Object.create(null)}getPathJs(A){const{charCode:e,glyphId:t}=Ma(this.cmap,A);let i,a=this.compiledGlyphs[t];if(!a){try{a=this.compileGlyph(this.glyphs[t],t)}catch(A){a=Ha,i=A}this.compiledGlyphs[t]=a}if(this.compiledCharCodeToGlyphId[e]??=t,i)throw i;return a}compileGlyph(A,e){if(!A||0===A.length||14===A[0])return Ha;let t=this.fontMatrix;if(this.isCFFCIDFont){const A=this.fdSelect.getFDIndex(e);A>=0&&A2*Fa(A,e));const s=[];let n=a(e,0);for(let t=i;tA+(e.getSize()+3&-4)),0)}write(){const A=this.getSize(),e=new DataView(new ArrayBuffer(A)),t=A>131070,i=t?4:2,a=new DataView(new ArrayBuffer((this.glyphs.length+1)*i));t?a.setUint32(0,0):a.setUint16(0,0);let s=0,n=0;for(const A of this.glyphs)s+=A.write(s,e),s=s+3&-4,n+=i,t?a.setUint32(n,s):a.setUint16(n,s>>1);return{isLocationLong:t,loca:new Uint8Array(a.buffer),glyf:new Uint8Array(e.buffer)}}scale(A){for(let e=0,t=this.glyphs.length;eA+e.getSize()),0);return this.header.getSize()+A}write(A,e){if(!this.header)return 0;const t=A;if(A+=this.header.write(A,e),this.simple)A+=this.simple.write(A,e);else for(const t of this.composites)A+=t.write(A,e);return A-t}scale(A){if(!this.header)return;const e=(this.header.xMin+this.header.xMax)/2;if(this.header.scale(e,A),this.simple)this.simple.scale(e,A);else for(const t of this.composites)t.scale(e,A)}}class Xa{constructor({numberOfContours:A,xMin:e,yMin:t,xMax:i,yMax:a}){this.numberOfContours=A,this.xMin=e,this.yMin=t,this.xMax=i,this.yMax=a}static parse(A,e){return[10,new Xa({numberOfContours:e.getInt16(A),xMin:e.getInt16(A+2),yMin:e.getInt16(A+4),xMax:e.getInt16(A+6),yMax:e.getInt16(A+8)})]}getSize(){return 10}write(A,e){return e.setInt16(A,this.numberOfContours),e.setInt16(A+2,this.xMin),e.setInt16(A+4,this.yMin),e.setInt16(A+6,this.xMax),e.setInt16(A+8,this.yMax),10}scale(A,e){this.xMin=Math.round(A+(this.xMin-A)*e),this.xMax=Math.round(A+(this.xMax-A)*e)}}class Va{constructor({flags:A,xCoordinates:e,yCoordinates:t}){this.xCoordinates=e,this.yCoordinates=t,this.flags=A}}class ja{constructor({contours:A,instructions:e}){this.contours=A,this.instructions=e}static parse(A,e,t){const i=[];for(let a=0;a255?A+=2:g>0&&(A+=1),e=s,g=Math.abs(n-t),g>255?A+=2:g>0&&(A+=1),t=n}}return A}write(A,e){const t=A,i=[],a=[],s=[];let n=0,g=0;for(const t of this.contours){for(let A=0,e=t.xCoordinates.length;A=0?18:2,i.push(A)):i.push(o)}n=r;const I=t.yCoordinates[A];if(o=I-g,0===o)e|=32,a.push(0);else{const A=Math.abs(o);A<=255?(e|=o>=0?36:4,a.push(A)):a.push(o)}g=I,s.push(e)}e.setUint16(A,i.length-1),A+=2}e.setUint16(A,this.instructions.length),A+=2,this.instructions.length&&(new Uint8Array(e.buffer,0,e.buffer.byteLength).set(this.instructions,A),A+=this.instructions.length);for(const t of s)e.setUint8(A++,t);for(let t=0,a=i.length;t=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(A+=2):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(A+=2),A}write(A,e){const t=A;return 2&this.flags?this.argument1>=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(this.flags|=1):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(this.flags|=1),e.setUint16(A,this.flags),e.setUint16(A+2,this.glyphIndex),A+=4,1&this.flags?(2&this.flags?(e.setInt16(A,this.argument1),e.setInt16(A+2,this.argument2)):(e.setUint16(A,this.argument1),e.setUint16(A+2,this.argument2)),A+=4):(e.setUint8(A,this.argument1),e.setUint8(A+1,this.argument2),A+=2),256&this.flags&&(e.setUint16(A,this.instructions.length),A+=2,this.instructions.length&&(new Uint8Array(e.buffer,0,e.buffer.byteLength).set(this.instructions,A),A+=this.instructions.length)),A-t}scale(A,e){}}function _a(A,e,t){A[e]=t>>8&255,A[e+1]=255&t}function $a(A,e,t){A[e]=t>>24&255,A[e+1]=t>>16&255,A[e+2]=t>>8&255,A[e+3]=255&t}function As(A,e,t){if(t instanceof Uint8Array)A.set(t,e);else if("string"==typeof t)for(let i=0,a=t.length;it;)t<<=1,i++;const a=t*e;return{range:a,entry:i,rangeShift:e*A-a}}toArray(){let A=this.sfnt;const e=this.tables,t=Object.keys(e);t.sort();const i=t.length;let a,s,n,g,r,o=12+16*i;const I=[o];for(a=0;a>>0,I.push(o);const c=new Uint8Array(o);for(a=0;a>>0;$a(c,o+4,A),$a(c,o+8,I[a]),$a(c,o+12,e[r].length),o+=16}return c}addTable(A,e){if(A in this.tables)throw new Error("Table "+A+" already exists");this.tables[A]=e}}const ts=[4],is=[5],as=[6],ss=[7],ns=[8],gs=[12,35],rs=[14],os=[21],Is=[22],cs=[30],Cs=[31];class Bs{constructor(){this.width=0,this.lsb=0,this.flexing=!1,this.output=[],this.stack=[]}convert(A,e,t){const i=A.length;let a,s,n,g=!1;for(let r=0;ri)return!0;const a=i-A;for(let A=a;A>8&255,255&e):(e=65536*e|0,this.output.push(255,e>>24&255,e>>16&255,e>>8&255,255&e))}return this.output.push(...e),t?this.stack.splice(a,A):this.stack.length=0,!1}}function hs(A){return A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102}function Qs(A,e,t){if(t>=A.length)return new Uint8Array(0);let i,a,s=0|e;for(i=0;i>8,s=52845*(e+s)+22719&65535}return g}function ls(A){return 47===A||91===A||93===A||123===A||125===A||40===A||41===A}class Es{constructor(A,e,t){if(e){const e=A.getBytes(),t=!((hs(e[0])||UA(e[0]))&&hs(e[1])&&hs(e[2])&&hs(e[3])&&hs(e[4])&&hs(e[5])&&hs(e[6])&&hs(e[7]));A=new ie(t?Qs(e,55665,4):function(A){let e=55665;const t=A.length,i=new Uint8Array(t>>>1);let a,s;for(a=0,s=0;a>8,e=52845*(A+e)+22719&65535}}return i.slice(4,s)}(e))}this.seacAnalysisEnabled=!!t,this.stream=A,this.nextChar()}readNumberArray(){this.getToken();const A=[];for(;;){const e=this.getToken();if(null===e||"]"===e||"}"===e)break;A.push(parseFloat(e||0))}return A}readNumber(){const A=this.getToken();return parseFloat(A||0)}readInt(){const A=this.getToken();return 0|parseInt(A||0,10)}readBoolean(){return"true"===this.getToken()?1:0}nextChar(){return this.currentChar=this.stream.getByte()}prevChar(){return this.stream.skip(-2),this.currentChar=this.stream.getByte()}getToken(){let A=!1,e=this.currentChar;for(;;){if(-1===e)return null;if(A)10!==e&&13!==e||(A=!1);else if(37===e)A=!0;else if(!UA(e))break;e=this.nextChar()}if(ls(e))return this.nextChar(),String.fromCharCode(e);let t="";do{t+=String.fromCharCode(e),e=this.nextChar()}while(e>=0&&!UA(e)&&!ls(e));return t}readCharStrings(A,e){return-1===e?A:Qs(A,4330,e)}extractFontProgram(A){const e=this.stream,t=[],i=[],a=Object.create(null);a.lenIV=4;const s={subrs:[],charstrings:[],properties:{privateData:a}};let n,g,r,o;for(;null!==(n=this.getToken());)if("/"===n)switch(n=this.getToken(),n){case"CharStrings":for(this.getToken(),this.getToken(),this.getToken(),this.getToken();n=this.getToken(),null!==n&&"end"!==n;){if("/"!==n)continue;const A=this.getToken();g=this.readInt(),this.getToken(),r=g>0?e.getBytes(g):new Uint8Array(0),o=s.properties.privateData.lenIV;const t=this.readCharStrings(r,o);this.nextChar(),n=this.getToken(),"noaccess"===n?this.getToken():"/"===n&&this.prevChar(),i.push({glyph:A,encoded:t})}break;case"Subrs":for(this.readInt(),this.getToken();"dup"===this.getToken();){const A=this.readInt();g=this.readInt(),this.getToken(),r=g>0?e.getBytes(g):new Uint8Array(0),o=s.properties.privateData.lenIV;const i=this.readCharStrings(r,o);this.nextChar(),n=this.getToken(),"noaccess"===n&&this.getToken(),t[A]=i}break;case"BlueValues":case"OtherBlues":case"FamilyBlues":case"FamilyOtherBlues":const A=this.readNumberArray();A.length>0&&A.length;break;case"StemSnapH":case"StemSnapV":s.properties.privateData[n]=this.readNumberArray();break;case"StdHW":case"StdVW":s.properties.privateData[n]=this.readNumberArray()[0];break;case"BlueShift":case"lenIV":case"BlueFuzz":case"BlueScale":case"LanguageGroup":s.properties.privateData[n]=this.readNumber();break;case"ExpansionFactor":s.properties.privateData[n]=this.readNumber()||.06;break;case"ForceBold":s.properties.privateData[n]=this.readBoolean()}for(const{encoded:e,glyph:a}of i){const i=new Bs,n=i.convert(e,t,this.seacAnalysisEnabled);let g=i.output;n&&(g=[14]);const r={glyphName:a,charstring:g,width:i.width,lsb:i.lsb,seac:i.seac};if(".notdef"===a?s.charstrings.unshift(r):s.charstrings.push(r),A.builtInEncoding){const e=A.builtInEncoding.indexOf(a);e>-1&&void 0===A.widths[e]&&e>=A.firstChar&&e<=A.lastChar&&(A.widths[e]=i.width)}}return s}extractFontHeader(A){let e;for(;null!==(e=this.getToken());)if("/"===e)switch(e=this.getToken(),e){case"FontMatrix":const t=this.readNumberArray();A.fontMatrix=t;break;case"Encoding":const i=this.getToken();let a;if(/^\d+$/.test(i)){a=[];const A=0|parseInt(i,10);this.getToken();for(let t=0;t=a){for(n+=t;n=0&&(i[A]=a)}return ca(A,i,t)}hasGlyphId(A){return!(A<0||A>=this.numGlyphs)&&(0===A||this.charstrings[A-1].charstring.length>0)}getSeacs(A){const e=[];for(let t=0,i=A.length;t0;A--)e[A]-=e[A-1];B.setByName(A,e)}s.topDict.privateDict=B;const Q=new qi;for(I=0,c=i.length;I0&&A.toUnicode.amend(e)}class bs{constructor(A,e,t,i,a,s,n,g,r){this.originalCharCode=A,this.fontChar=e,this.unicode=t,this.accent=i,this.width=a,this.vmetric=s,this.operatorListId=n,this.isSpace=g,this.isInFont=r}get category(){return x(this,"category",function(A){const e=ga.get(A);if(e)return e;const t=A.match(na),i={isWhitespace:!!t?.[1],isZeroWidthDiacritic:!!t?.[2],isInvisibleFormatMark:!!t?.[3]};return ga.set(A,i),i}(this.unicode),!0)}}function ks(A,e){return(A<<8)+e}function Fs(A,e,t){A[e+1]=t,A[e]=t>>>8}function Ss(A,e){const t=(A<<8)+e;return 32768&t?t-65536:t}function Rs(A){return String.fromCharCode(A>>8&255,255&A)}function Gs(A){return A>32767?A=32767:A<-32768&&(A=-32768),String.fromCharCode(A>>8&255,255&A)}function Ns(A){return"ttcf"===q(A.peekBytes(4))}function xs(A,e){for(const t in e)A[+t]=e[t]}function Us(A,e,t){const i=[];let a;for(let t=0,s=A.length;tI){if(r++,r>=fs.length){S("Ran out of space in font private use area.");break}o=fs[r][0],I=fs[r][1]}const h=o++;0===B&&(B=t);let Q=i.get(C);"string"==typeof Q&&(Q=Q.codePointAt(0)),!Q||(c=Q,fs[0][0]<=c&&c<=fs[0][1]||fs[1][0]<=c&&c<=fs[1][1])||g.has(B)||(s.set(Q,B),g.add(B)),a[h]=B,n[C]=h}var c;return{toFontChar:n,charCodeToGlyphId:a,toUnicodeExtraMap:s,nextAvailableFontCharCode:o}}function Ys(A,e,t){const i=function(A,e,t){const i=[];for(const e in A)A[e]>=t||i.push({fontCharCode:0|e,glyphId:A[e]});if(e)for(const[A,a]of e)a>=t||i.push({fontCharCode:A,glyphId:a});0===i.length&&i.push({fontCharCode:0,glyphId:0}),i.sort((function(A,e){return A.fontCharCode-e.fontCharCode}));const a=[],s=i.length;for(let A=0;A65535?2:1;let s,n,g,r,o="\0\0"+Rs(a)+"\0\0"+P(4+8*a);for(s=i.length-1;s>=0&&!(i[s][0]<=65535);--s);const I=s+1;i[s][0]<65535&&65535===i[s][1]&&(i[s][1]=65534);const c=i[s][1]<65535?1:0,C=I+c,B=es.getSearchParams(C,2);let h,Q,l,E,u="",d="",f="",p="",m="",y=0;for(s=0,n=I;s0&&(d+="ÿÿ",u+="ÿÿ",f+="\0",p+="\0\0");const w="\0\0"+Rs(2*C)+Rs(B.range)+Rs(B.entry)+Rs(B.rangeShift)+d+"\0\0"+u+f+p+m;let D="",b="";if(a>1){for(o+="\0\0\n"+P(4+8*a+4+w.length),D="",s=0,n=i.length;sA||!g)&&(g=A),r 123 are reserved for internal usage");n|=1<65535&&(r=65535)}else g=0,r=255;const I=A.bbox||[0,0,0,0],c=t.unitsPerEm||(A.fontMatrix?1/Math.max(...A.fontMatrix.slice(0,4).map(Math.abs)):1e3),C=A.ascentScaled?1:c/ps,B=t.ascent||Math.round(C*(A.ascent||I[3]));let h=t.descent||Math.round(C*(A.descent||I[1]));h>0&&A.descent>0&&I[1]<0&&(h=-h);const Q=t.yMax||B,l=-t.yMin||-h;return"\0$ô\0\0\0Š»\0\0\0ŒŠ»\0\0ß\x001\0\0\0\0"+String.fromCharCode(A.fixedPitch?9:0)+"\0\0\0\0\0\0"+P(i)+P(a)+P(s)+P(n)+"*21*"+Rs(A.italicAngle?1:0)+Rs(g||A.firstChar)+Rs(r||A.lastChar)+Rs(B)+Rs(h)+"\0d"+Rs(Q)+Rs(l)+"\0\0\0\0\0\0\0\0"+Rs(A.xHeight)+Rs(A.capHeight)+Rs(0)+Rs(g||A.firstChar)+"\0"}function Ks(A){return"\0\0\0"+P(Math.floor(65536*A.italicAngle))+"\0\0\0\0"+P(A.fixedPitch?1:0)+"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}function qs(A){return A.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g,"").slice(0,63)}function Ts(A,e){e||(e=[[],[]]);const t=[e[0][0]||"Original licence",e[0][1]||A,e[0][2]||"Unknown",e[0][3]||"uniqueID",e[0][4]||A,e[0][5]||"Version 0.11",e[0][6]||qs(A),e[0][7]||"Unknown",e[0][8]||"Unknown",e[0][9]||"Unknown"],i=[];let a,s,n,g,r;for(a=0,s=t.length;a=1&&e[3]>=1&&e[3]<=4}(A)?i?(a="CIDFontType0",s="CIDFontType0C"):(a="MMType1"===e?"MMType1":"Type1",s="Type1C"):(S("getFontFileType: Unable to detect correct font file Type/Subtype."),a=e,s=t),[a,s]}(e,t),a===this.type&&s===this.subtype||F(`Inconsistent font file Type/SubType, expected: ${this.type}/${this.subtype} but found: ${a}/${s}.`);try{switch(a){case"MMType1":F("MMType1 font ("+A+"), falling back to Type1.");case"Type1":case"CIDFontType0":this.mimetype="font/opentype";const i="Type1C"===s||"CIDFontType0C"===s?new ba(e,t):new ds(A,e,t);ws(t),g=this.convert(A,i,t);break;case"OpenType":case"TrueType":case"CIDFontType2":this.mimetype="font/opentype",g=this.checkAndRepair(A,e,t),this.isOpenType&&(ws(t),a="OpenType");break;default:throw new v(`Font ${a} is not supported`)}}catch(A){return S(A),void this.fallbackToSystemFont(t)}Ds(t),this.data=g,this.type=a,this.subtype=s,this.fontMatrix=t.fontMatrix,this.widths=t.widths,this.defaultWidth=t.defaultWidth,this.toUnicode=t.toUnicode,this.seacMap=t.seacMap}get renderer(){return x(this,"renderer",Ta.create(this,ra))}exportData(A=!1){const e=A?[...ms,...ys]:ms,t=Object.create(null);let i,a;for(i of e)a=this[i],void 0!==a&&(t[i]=a);return t}fallbackToSystemFont(A){this.missingFile=!0;const{name:e,type:t}=this;let i=Ca(e);const a=ha(),s=la(),n=!!a[i],g=!(!s[i]||!a[s[i]]);i=a[i]||s[i]||i;const r=Wa()[i];r&&(isNaN(this.ascent)&&(this.ascent=r.ascent/ps),isNaN(this.descent)&&(this.descent=r.descent/ps),isNaN(this.capHeight)&&(this.capHeight=r.capHeight/ps)),this.bold=/bold/gi.test(i),this.italic=/oblique|italic/gi.test(i),this.black=/Black/g.test(e);const o=/Narrow/g.test(e);if(this.remeasure=(!n||o)&&Object.keys(this.widths).length>0,(n||g)&&"CIDFontType2"===t&&this.cidEncoding.startsWith("Identity-")){const t=A.cidToGidMap,i=[];if(xs(i,da()),/Arial-?Black/i.test(e)?xs(i,fa()):/Calibri/i.test(e)&&xs(i,pa()),t){for(const A in i){const e=i[A];void 0!==t[e]&&(i[+A]=t[e])}t.length!==this.toUnicode.length&&A.hasIncludedToUnicodeMap&&this.toUnicode instanceof Da&&this.toUnicode.forEach((function(A,e){const a=i[A];void 0===t[a]&&(i[+A]=e)}))}this.toUnicode instanceof Da||this.toUnicode.forEach((function(A,e){i[+A]=e})),this.toFontChar=i,this.toUnicode=new wa(i)}else if(/Symbol/i.test(i))this.toFontChar=Us(Ni,Aa(),this.differences);else if(/Dingbats/i.test(i))this.toFontChar=Us(xi,ea(),this.differences);else if(n||g){const A=Us(this.defaultEncoding,Aa(),this.differences);"CIDFontType2"!==t||this.cidEncoding.startsWith("Identity-")||this.toUnicode instanceof Da||this.toUnicode.forEach((function(e,t){A[+e]=t})),this.toFontChar=A}else{const A=Aa(),t=[];this.toUnicode.forEach(((e,i)=>{if(!this.composite){const t=ia(this.differences[e]||this.defaultEncoding[e],A);-1!==t&&(i=t)}t[+e]=i})),this.composite&&this.toUnicode instanceof Da&&/Tahoma|Verdana/i.test(e)&&xs(t,da()),this.toFontChar=t}Ds(A),this.loadedName=i.split("-",1)[0]}checkAndRepair(A,e,t){const i=["OS/2","cmap","head","hhea","hmtx","maxp","name","post","loca","glyf","fpgm","prep","cvt ","CFF "];function a(A,e){const t=Object.create(null);t["OS/2"]=null,t.cmap=null,t.head=null,t.hhea=null,t.hmtx=null,t.maxp=null,t.name=null,t.post=null;for(let a=0;a>>0,i=A.getInt32()>>>0,a=A.getInt32()>>>0,s=A.pos;A.pos=A.start||0,A.skip(i);const n=A.getBytes(a);return A.pos=s,"head"===e&&(n[8]=n[9]=n[10]=n[11]=0,n[17]|=32),{tag:e,checksum:t,length:a,offset:i,data:n}}function n(A){return{version:A.getString(4),numTables:A.getUint16(),searchRange:A.getUint16(),entrySelector:A.getUint16(),rangeShift:A.getUint16()}}function g(A,e,t,i,a,s){const n={length:0,sizeOfInstructions:0};if(e<0||e>=A.length||t>A.length||t-e<=12)return n;const g=A.subarray(e,t),r=Ss(g[2],g[3]),o=Ss(g[4],g[5]),I=Ss(g[6],g[7]),c=Ss(g[8],g[9]);r>I&&(Fs(g,2,I),Fs(g,6,r)),o>c&&(Fs(g,4,c),Fs(g,8,o));const C=Ss(g[0],g[1]);if(C<0)return C<-1||(i.set(g,a),n.length=g.length),n;let B,h=10,Q=0;for(B=0;Bg.length?n:!s&&E>0?(i.set(g.subarray(0,l),a),i.set([0,0],a+l),i.set(g.subarray(u,f),a+l+2),f-=E,g.length-f>3&&(f=f+3&-4),n.length=f,n):g.length-f>3?(f=f+3&-4,i.set(g.subarray(0,f),a),n.length=f,n):(i.set(g,a),n.length=g.length,n)}function r(A){const t=(e.start||0)+A.offset;e.pos=t;const i=[[],[]],a=[],s=A.length,n=t+s;if(0!==e.getUint16()||s<6)return[i,a];const g=e.getUint16(),r=e.getUint16();let o,I;for(o=0;on)continue;e.pos=s;const g=A.name;if(A.encoding){let t="";for(let i=0,a=A.length;i0&&(r+=A-1)}}else(l||u)&&(S("TT: nested FDEFs not allowed"),Q=!0),l=!0,c=r,s=C.pop(),e.functionsDefined[s]={data:g,i:r};else if(!l&&!u)if(s=C.at(-1),isNaN(s))F("TT: CALL empty stack (or invalid entry).");else if(e.functionsUsed[s]=!0,s in e.functionsStackDeltas){const A=C.length+e.functionsStackDeltas[s];if(A<0)return S("TT: CALL invalid functions stack delta."),void(e.hintsValid=!1);C.length=A}else if(s in e.functionsDefined&&!h.includes(s)){if(B.push({data:g,i:r,stackTop:C.length-1}),h.push(s),n=e.functionsDefined[s],!n)return S("TT: CALL non-existent function"),void(e.hintsValid=!1);g=n.data,r=n.i}if(!l&&!u){let e=0;for(A<=142?e=o[A]:A>=192&&A<=223?e=-1:A>=224&&(e=-2),A>=113&&A<=117&&(i=C.pop(),isNaN(i)||(e=2*-i));e<0&&C.length>0;)C.pop(),e++;for(;e>0;)C.push(NaN),e--}}e.tooComplexToFollowFunctions=Q;const d=[g];r>g.length&&d.push(new Uint8Array(r-g.length)),c>I&&(S("TT: complementing a missing function tail"),d.push(new Uint8Array([34,45]))),function(A,e){if(e.length>1){let t,i,a=0;for(t=0,i=e.length;t>>0,s=[];for(let e=0;e>>0);const n={ttcTag:e,majorVersion:t,minorVersion:i,numFonts:a,offsetTable:s};switch(t){case 1:return n;case 2:return n.dsigTag=A.getInt32()>>>0,n.dsigLength=A.getInt32()>>>0,n.dsigOffset=A.getInt32()>>>0,n}throw new v(`Invalid TrueType Collection majorVersion: ${t}.`)}(A),s=e.split("+");let g;for(let o=0;o0||!(t.cMap instanceof oi));if("OTTO"===c.version&&!e||!C.head||!C.hhea||!C.maxp||!C.post)return h=new ie(C["CFF "].data),B=new ba(h,t),ws(t),this.convert(A,B,t);delete C.glyf,delete C.loca,delete C.fpgm,delete C.prep,delete C["cvt "],this.isOpenType=!0}if(!C.maxp)throw new v('Required "maxp" table is not found');e.pos=(e.start||0)+C.maxp.offset;let l=e.getInt32();const E=e.getUint16();if(65536!==l&&20480!==l){if(6===C.maxp.length)l=20480;else{if(!(C.maxp.length>=32))throw new v('"maxp" table has a wrong version number');l=65536}d=l,(u=C.maxp.data)[3+0]=255&d,u[2]=d>>>8,u[1]=d>>>16,u[0]=d>>>24}var u,d;if(t.scaleFactors?.length===E&&Q){const{scaleFactors:A}=t,e=ks(C.head.data[50],C.head.data[51]),i=new Za({glyfTable:C.glyf.data,isGlyphLocationsLong:e,locaTable:C.loca.data,numGlyphs:E});i.scale(A);const{glyf:a,loca:s,isLocationLong:n}=i.write();C.glyf.data=a,C.loca.data=s,n!==!!e&&(C.head.data[50]=0,C.head.data[51]=n?1:0);const g=C.hmtx.data;for(let e=0;e>8&255,g[t+1]=255&i,Fs(g,t+2,Math.round(A[e]*Ss(g[t+2],g[t+3])))}}let f=E+1,p=!0;f>65535&&(p=!1,f=E,S("Not enough space in glyfs to duplicate first glyph."));let m=0,y=0;l>=65536&&C.maxp.length>=32&&(e.pos+=8,e.getUint16()>2&&(C.maxp.data[14]=0,C.maxp.data[15]=2),e.pos+=4,m=e.getUint16(),e.pos+=4,y=e.getUint16()),C.maxp.data[4]=f>>8,C.maxp.data[5]=255&f;const w=function(A,e,t,i){const a={functionsDefined:[],functionsUsed:[],functionsStackDeltas:[],tooComplexToFollowFunctions:!1,hintsValid:!0};if(A&&I(A,a),e&&I(e,a),A&&function(A,e){if(!A.tooComplexToFollowFunctions){if(A.functionsDefined.length>e)return S("TT: more functions defined than expected"),void(A.hintsValid=!1);for(let t=0,i=A.functionsUsed.length;te)return S("TT: invalid function id: "+t),void(A.hintsValid=!1);if(A.functionsUsed[t]&&!A.functionsDefined[t])return S("TT: undefined function: "+t),void(A.hintsValid=!1)}}}(a,i),t&&1&t.length){const A=new Uint8Array(t.length+1);A.set(t.data),t.data=A}return a.hintsValid}(C.fpgm,C.prep,C["cvt "],m);if(w||(delete C.fpgm,delete C.prep,delete C["cvt "]),function(A,e,t,i,a,s){if(!e)return void(t&&(t.data=null));A.pos=(A.start||0)+e.offset,A.pos+=4,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2;const n=A.getUint16();A.pos+=8,A.pos+=2;let g=A.getUint16();0!==n&&(2&ks(i.data[44],i.data[45])||(e.data[22]=0,e.data[23]=0)),g>a&&(F(`The numOfMetrics (${g}) should not be greater than the numGlyphs (${a}).`),g=a,e.data[34]=(65280&g)>>8,e.data[35]=255&g);const r=a-g-(t.length-4*g>>1);if(r>0){const A=new Uint8Array(t.length+2*r);A.set(t.data),s&&(A[t.length]=t.data[2],A[t.length+1]=t.data[3]),t.data=A}}(e,C.hhea,C.hmtx,C.head,f,p),!C.head)throw new v('Required "head" table is not found');!function(A,e,t){const i=A.data,a=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3];a>>16!=1&&(F("Attempting to fix invalid version in head table: "+a),i[0]=0,i[1]=1,i[2]=0,i[3]=0);const s=ks(i[50],i[51]);if(s<0||s>1){F("Attempting to fix invalid indexToLocFormat in head table: "+s);const A=e+1;if(t===A<<1)i[50]=0,i[51]=0;else{if(t!==A<<2)throw new v("Could not fix indexToLocFormat: "+s);i[50]=0,i[51]=1}}}(C.head,E,Q?C.loca.length:0);let D=Object.create(null);if(Q){const A=ks(C.head.data[50],C.head.data[51]),e=function(A,e,t,i,a,s,n){let r,o,I;i?(r=4,o=function(A,e){return A[e]<<24|A[e+1]<<16|A[e+2]<<8|A[e+3]},I=function(A,e,t){A[e]=t>>>24&255,A[e+1]=t>>16&255,A[e+2]=t>>8&255,A[e+3]=255&t}):(r=2,o=function(A,e){return A[e]<<9|A[e+1]<<1},I=function(A,e,t){A[e]=t>>9&255,A[e+1]=t>>1&255});const c=s?t+1:t,C=r*(1+c),B=new Uint8Array(C);B.set(A.data.subarray(0,C)),A.data=B;const h=e.data,Q=h.length,l=new Uint8Array(Q);let E,u;const d=[];for(E=0,u=0;EQ&&(A=Q),d.push({index:E,offset:A,endOffset:0})}for(d.sort(((A,e)=>A.offset-e.offset)),E=0;EA.index-e.index)),E=0;En&&(n=A.sizeOfInstructions),m+=e,I(B,u,m)}if(0===m){const A=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]);for(E=0,u=r;Et+m?e.data=l.subarray(0,t+m):(e.data=new Uint8Array(t+m),e.data.set(l.subarray(0,m))),e.data.set(l.subarray(0,t),m),I(A.data,B.length-r,m+t)}else e.data=l.subarray(0,m);return{missingGlyphs:p,maxSizeOfInstructions:n}}(C.loca,C.glyf,E,A,w,p,y);D=e.missingGlyphs,l>=65536&&C.maxp.length>=32&&(C.maxp.data[26]=e.maxSizeOfInstructions>>8,C.maxp.data[27]=255&e.maxSizeOfInstructions)}if(!C.hhea)throw new v('Required "hhea" table is not found');0===C.hhea.data[10]&&0===C.hhea.data[11]&&(C.hhea.data[10]=255,C.hhea.data[11]=255);const b={unitsPerEm:ks(C.head.data[18],C.head.data[19]),yMax:Ss(C.head.data[42],C.head.data[43]),yMin:Ss(C.head.data[38],C.head.data[39]),ascent:Ss(C.hhea.data[4],C.hhea.data[5]),descent:Ss(C.hhea.data[6],C.hhea.data[7]),lineGap:Ss(C.hhea.data[8],C.hhea.data[9])};this.ascent=b.ascent/b.unitsPerEm,this.descent=b.descent/b.unitsPerEm,this.lineGap=b.lineGap/b.unitsPerEm,this.cssFontInfo?.lineHeight?(this.lineHeight=this.cssFontInfo.metrics.lineHeight,this.lineGap=this.cssFontInfo.metrics.lineGap):this.lineHeight=this.ascent-this.descent+this.lineGap,C.post&&function(A,t,i){const a=(e.start||0)+A.offset;e.pos=a;const s=a+A.length,n=e.getInt32();let g;e.skip(28);let r,o=!0;switch(n){case 65536:g=oa;break;case 131072:const A=e.getUint16();if(A!==i){o=!1;break}const a=[];for(r=0;r=32768){o=!1;break}a.push(A)}if(!o)break;const I=[],c=[];for(;e.pos65535)throw new v("Max size of CID is 65,535");let a=-1;e?a=i:void 0!==A[i]&&(a=A[i]),a>=0&&a>>0;let I=!1;if(g?.platformId!==a||g?.encodingId!==s){if(0!==a||0!==s&&1!==s&&3!==s)if(1===a&&0===s)I=!0;else if(3!==a||1!==s||!i&&g){if(t&&3===a&&0===s){I=!0;let t=!0;if(A>3;A.push(i),t=Math.max(i,t)}const i=[];for(let A=0;A<=t;A++)i.push({firstCode:e.getUint16(),entryCount:e.getUint16(),idDelta:Ss(e.getByte(),e.getByte()),idRangePos:e.pos+e.getUint16()});for(let t=0;t<256;t++)if(0===A[t])e.pos=i[0].idRangePos+2*t,B=e.getUint16(),c.push({charCode:t,glyphId:B});else{const a=i[A[t]];for(C=0;C>1;e.skip(6);const t=[];let i;for(i=0;i>1)-(A-i),a.offsetIndex=n,g=Math.max(g,n+a.end-a.start+1)):a.offsetIndex=-1}const r=[];for(C=0;C>>0;for(C=0;C>>0,t=e.getInt32()>>>0;let i=e.getInt32()>>>0;for(let e=A;e<=t;e++)c.push({charCode:e,glyphId:i++})}}}c.sort((function(A,e){return A.charCode-e.charCode}));for(let A=1;A=61440&&e<=61695&&(e&=255),k[e]=A.glyphId}else for(const A of s)k[A.charCode]=A.glyphId;if(t.glyphNames&&(n.length||this.differences.length))for(let A=0;A<256;++A){if(!g&&void 0!==k[A])continue;const e=this.differences[A]||n[A];if(!e)continue;const i=t.glyphNames.indexOf(e);i>0&&R(i)&&(k[A]=i)}}0===k.length&&(k[0]=0);let N=f-1;if(p||(N=0),!t.cssFontInfo){const A=Hs(k,R,N,this.toUnicode);this.toFontChar=A.toFontChar,C.cmap={tag:"cmap",data:Ys(A.charCodeToGlyphId,A.toUnicodeExtraMap,f)},C["OS/2"]&&function(A,e){e.pos=(e.start||0)+A.offset;const t=e.getUint16();e.skip(60);const i=e.getUint16();return!(t<4&&768&i||e.getUint16()>e.getUint16()||(e.skip(6),0===e.getUint16()||(A.data[8]=A.data[9]=0,0)))}(C["OS/2"],e)||(C["OS/2"]={tag:"OS/2",data:vs(t,A.charCodeToGlyphId,b)})}if(!Q)try{h=new ie(C["CFF "].data),B=new Hi(h,t,ra).parse(),B.duplicateFirstGlyph();const A=new $i(B);C["CFF "].data=A.compile()}catch{S("Failed to compile font "+t.loadedName)}if(C.name){const[e,i]=r(C.name);C.name.data=Ts(A,e),this.psName=e[0][6]||null,t.composite||function(A,e,t){if(A.isInternalFont)return;if(A.hasIncludedToUnicodeMap)return;if(A.hasEncoding)return;if(A.toUnicode instanceof Da)return;if(!e)return;if(0===t.length)return;if(A.defaultEncoding===Gi)return;for(const A of t)if(!Ls(A))return;const i=Gi,a=[],s=Aa();for(const A in i){const e=i[A];if(""===e)continue;const t=s[e];void 0!==t&&(a[A]=String.fromCharCode(t))}a.length>0&&A.toUnicode.amend(a)}(t,this.isSymbolicFont,i)}else C.name={tag:"name",data:Ts(this.name)};const x=new es(c.version);for(const A in C)x.addTable(A,C[A].data);return x.toArray()}convert(A,e,t){t.fixedPitch=!1,t.builtInEncoding&&function(A,e){if(A.isInternalFont)return;if(A.hasIncludedToUnicodeMap)return;if(e===A.defaultEncoding)return;if(A.toUnicode instanceof Da)return;const t=[],i=Aa();for(const a in e){if(A.hasEncoding&&(A.baseEncodingName||void 0!==A.differences[a]))continue;const s=ia(e[a],i);-1!==s&&(t[a]=String.fromCharCode(s))}t.length>0&&A.toUnicode.amend(t)}(t,t.builtInEncoding);let i=1;e instanceof ba&&(i=e.numGlyphs-1);const s=e.getGlyphMapping(t);let n=null,g=s,r=null;t.cssFontInfo||(n=Hs(s,e.hasGlyphId.bind(e),i,this.toUnicode),this.toFontChar=n.toFontChar,g=n.charCodeToGlyphId,r=n.toUnicodeExtraMap);const o=e.numGlyphs;function I(A,e){let t=null;for(const i in A)e===A[i]&&(t||=[]).push(0|i);return t}function c(A,e){for(const t in A)if(e===A[t])return 0|t;return n.charCodeToGlyphId[n.nextAvailableFontCharCode]=e,n.nextAvailableFontCharCode++}const C=e.seacs;if(n&&C?.length){const A=t.fontMatrix||a,i=e.getCharset(),g=Object.create(null);for(let e in C){e|=0;const t=C[e],a=Ri[t[2]],r=Ri[t[3]],o=i.indexOf(a),B=i.indexOf(r);if(o<0||B<0)continue;const h={x:t[0]*A[0]+t[1]*A[2]+A[4],y:t[0]*A[1]+t[1]*A[3]+A[5]},Q=I(s,e);if(Q)for(const A of Q){const e=n.charCodeToGlyphId,t=c(e,o),i=c(e,B);g[A]={baseFontCharCode:t,accentFontCharCode:i,accentOffset:h}}}t.seacMap=g}const B=t.fontMatrix?1/Math.max(...t.fontMatrix.slice(0,4).map(Math.abs)):1e3,h=new es("OTTO");return h.addTable("CFF ",e.data),h.addTable("OS/2",vs(t,g)),h.addTable("cmap",Ys(g,r,o)),h.addTable("head","\0\0\0\0\0\0\0\0\0\0_<õ\0\0"+Gs(B)+"\0\0\0\0ž\v~'\0\0\0\0ž\v~'\0\0"+Gs(t.descent)+"ÿ"+Gs(t.ascent)+Rs(t.italicAngle?2:0)+"\0\0\0\0\0\0\0"),h.addTable("hhea","\0\0\0"+Gs(t.ascent)+Gs(t.descent)+"\0\0ÿÿ\0\0\0\0\0\0"+Gs(t.capHeight)+Gs(Math.tan(t.italicAngle)*t.xHeight)+"\0\0\0\0\0\0\0\0\0\0\0\0"+Rs(o)),h.addTable("hmtx",function(){const A=e.charstrings,t=e.cff?e.cff.widths:null;let i="\0\0\0\0";for(let e=1,a=o;e=65520&&I<=65535?0:I>=62976&&I<=63743?ta()[I]||I:173===I?45:I}var I;this.isType3Font&&(a=t);let c=null;if(this.seacMap?.[A]){o=!0;const e=this.seacMap[A];t=e.baseFontCharCode,c={fontChar:String.fromCodePoint(e.accentFontCharCode),offset:e.accentOffset}}let C="";if("number"==typeof t&&(t<=1114111?C=String.fromCodePoint(t):S(`charToGlyph - invalid fontCharCode: ${t}`)),this.missingFile&&this.vertical&&1===C.length){const A=Ba()[C.charCodeAt(0)];A&&(C=r=String.fromCharCode(A))}return s=new bs(A,C,r,c,i,g,a,e,o),this._glyphCache[A]=s}charsToGlyphs(A){let e=this._charsCache[A];if(e)return e;if(e=[],this.cMap){const t=Object.create(null),i=A.length;let a=0;for(;ae.length%2==1,a=this.toUnicode instanceof Da?A=>this.toUnicode.charCodeOf(A):A=>this.toUnicode.charCodeOf(String.fromCodePoint(A));for(let s=0,n=A.length;s55295&&(n<57344||n>65533)&&s++,this.toUnicode){const A=a(n);if(-1!==A){i()&&(e.push(t.join("")),t.length=0);for(let e=(this.cMap?this.cMap.getCharCodeLength(A):1)-1;e>=0;e--)t.push(String.fromCharCode(A>>8*e&255));continue}}i()||(e.push(t.join("")),t.length=0),t.push(String.fromCodePoint(n))}return e.push(t.join("")),e}}class Ws{constructor(A){this.error=A,this.loadedName="g_font_error",this.missingFile=!0}charsToGlyphs(){return[]}encodeString(A){return[A]}exportData(A=!1){return{error:this.error}}}class Zs{constructor(){R("Cannot initialize Pattern.")}static parseShading(A,e,t,i,a){const s=A instanceof dA?A.dict:A,n=s.get("ShadingType");try{switch(n){case 2:case 3:return new Xs(s,e,t,i,a);case 4:case 5:case 6:case 7:return new _s(A,e,t,i,a);default:throw new v("Unsupported ShadingType: "+n)}}catch(A){if(A instanceof mA)throw A;return S(A),new $s}}}class Os{static SMALL_NUMBER=1e-6;getIR(){R("Abstract method `getIR` called.")}}class Xs extends Os{constructor(A,e,t,i,a){super(),this.shadingType=A.get("ShadingType");let s=0;if(2===this.shadingType?s=4:3===this.shadingType&&(s=6),this.coordsArr=A.getArray("Coords"),!MA(this.coordsArr,s))throw new v("RadialAxialShading: Invalid /Coords array.");const n=re.parse({cs:A.getRaw("CS")||A.getRaw("ColorSpace"),xref:e,resources:t,pdfFunctionFactory:i,localColorSpaceCache:a});this.bbox=HA(A.getArray("BBox"),null);let g=0,r=1;const o=A.getArray("Domain");MA(o,2)&&([g,r]=o);let I=!1,c=!1;const C=A.getArray("Extend");var B;if(B=C,Array.isArray(B)&&2===B.length&&B.every((A=>"boolean"==typeof A))&&([I,c]=C),!(3!==this.shadingType||I&&c)){const[A,e,t,i,a,s]=this.coordsArr,n=Math.hypot(A-i,e-a);t<=s+n&&s<=t+n&&S("Unsupported radial gradient.")}this.extendStart=I,this.extendEnd=c;const h=A.getRaw("Function"),Q=i.createFromArray(h),l=(r-g)/840,E=this.colorStops=[];if(g>=r||l<=0)return void F("Bad shading domain.");const u=new Float32Array(n.numComps),d=new Float32Array(1);let f,p=0;d[0]=g,Q(d,0,u,0);let m=n.getRgb(u,0);const y=X.makeHexColor(m[0],m[1],m[2]);E.push([0,y]);let w=1;d[0]=g+l,Q(d,0,u,0);let D=n.getRgb(u,0),b=D[0]-m[0]+1,k=D[1]-m[1]+1,R=D[2]-m[2]+1,G=D[0]-m[0]-1,N=D[1]-m[1]-1,x=D[2]-m[2]-1;for(let A=2;A<840;A++){d[0]=g+A*l,Q(d,0,u,0),f=n.getRgb(u,0);const e=A-p;if(b=Math.min(b,(f[0]-m[0]+1)/e),k=Math.min(k,(f[1]-m[1]+1)/e),R=Math.min(R,(f[2]-m[2]+1)/e),G=Math.max(G,(f[0]-m[0]-1)/e),N=Math.max(N,(f[1]-m[1]-1)/e),x=Math.max(x,(f[2]-m[2]-1)/e),!(G<=b&&N<=k&&x<=R)){const A=X.makeHexColor(D[0],D[1],D[2]);E.push([w/840,A]),b=f[0]-D[0]+1,k=f[1]-D[1]+1,R=f[2]-D[2]+1,G=f[0]-D[0]-1,N=f[1]-D[1]-1,x=f[2]-D[2]-1,p=w,m=D}w=A,D=f}const U=X.makeHexColor(D[0],D[1],D[2]);E.push([1,U]);let M="transparent";A.has("Background")&&(f=n.getRgb(A.get("Background"),0),M=X.makeHexColor(f[0],f[1],f[2])),I||(E.unshift([0,M]),E[1][0]+=Os.SMALL_NUMBER),c||(E.at(-1)[0]-=Os.SMALL_NUMBER,E.push([1,M])),this.colorStops=E}getIR(){const{coordsArr:A,shadingType:e}=this;let t,i,a,s,n;return 2===e?(i=[A[0],A[1]],a=[A[2],A[3]],s=null,n=null,t="axial"):3===e?(i=[A[0],A[1]],a=[A[3],A[4]],s=A[2],n=A[5],t="radial"):R(`getPattern type unknown: ${e}`),["RadialAxial",t,this.bbox,this.colorStops,i,a,s,n]}}class Vs{constructor(A,e){this.stream=A,this.context=e,this.buffer=0,this.bufferLength=0;const t=e.numComps;this.tmpCompsBuf=new Float32Array(t);const i=e.colorSpace.numComps;this.tmpCsCompsBuf=e.colorFn?new Float32Array(i):this.tmpCompsBuf}get hasData(){if(this.stream.end)return this.stream.pos0)return!0;const A=this.stream.getByte();return!(A<0||(this.buffer=A,this.bufferLength=8,0))}readBits(A){let e=this.buffer,t=this.bufferLength;if(32===A){if(0===t)return(this.stream.getByte()<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte())>>>0;e=e<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte();const A=this.stream.getByte();return this.buffer=A&(1<>t)>>>0}if(8===A&&0===t)return this.stream.getByte();for(;t>t}align(){this.buffer=0,this.bufferLength=0}readFlag(){return this.readBits(this.context.bitsPerFlag)}readCoordinate(){const A=this.context.bitsPerCoordinate,e=this.readBits(A),t=this.readBits(A),i=this.context.decode,a=A<32?1/((1<s?s:A,e=e>n?n:e,t=tA*a[e])):t;let n,g=-2;const r=[];for(const[A,e]of i.map(((A,e)=>[A,e])).sort((([A],[e])=>A-e)))-1!==A&&(A===g+1?(n.push(s[e]),g+=1):(g=A,n=[s[e]],r.push(A,n)));return r}(A),t=new cA(null);t.set("BaseFont",rA.get(A)),t.set("Type",rA.get("Font")),t.set("Subtype",rA.get("CIDFontType2")),t.set("Encoding",rA.get("Identity-H")),t.set("CIDToGIDMap",rA.get("Identity")),t.set("W",e),t.set("FirstChar",e[0]),t.set("LastChar",e.at(-2)+e.at(-1).length-1);const i=new cA(null);t.set("FontDescriptor",i);const a=new cA(null);return a.set("Ordering","Identity"),a.set("Registry","Adobe"),a.set("Supplement",0),t.set("CIDSystemInfo",a),t}class Wn{constructor(A){this.lexer=A,this.operators=[],this.token=null,this.prev=null}nextToken(){this.prev=this.token,this.token=this.lexer.getToken()}accept(A){return this.token.type===A&&(this.nextToken(),!0)}expect(A){if(this.accept(A))return!0;throw new v(`Unexpected symbol: found ${this.token.type} expected ${A}.`)}parse(){return this.nextToken(),this.expect(Zn.LBRACE),this.parseBlock(),this.expect(Zn.RBRACE),this.operators}parseBlock(){for(;;)if(this.accept(Zn.NUMBER))this.operators.push(this.prev.value);else if(this.accept(Zn.OPERATOR))this.operators.push(this.prev.value);else{if(!this.accept(Zn.LBRACE))return;this.parseCondition()}}parseCondition(){const A=this.operators.length;if(this.operators.push(null,null),this.parseBlock(),this.expect(Zn.RBRACE),this.accept(Zn.IF))this.operators[A]=this.operators.length,this.operators[A+1]="jz";else{if(!this.accept(Zn.LBRACE))throw new v("PS Function: error parsing conditional.");{const e=this.operators.length;this.operators.push(null,null);const t=this.operators.length;this.parseBlock(),this.expect(Zn.RBRACE),this.expect(Zn.IFELSE),this.operators[e]=this.operators.length,this.operators[e+1]="j",this.operators[A]=t,this.operators[A+1]="jz"}}}}const Zn={LBRACE:0,RBRACE:1,NUMBER:2,OPERATOR:3,IF:4,IFELSE:5};class On{static get opCache(){return x(this,"opCache",Object.create(null))}constructor(A,e){this.type=A,this.value=e}static getOperator(A){return On.opCache[A]||=new On(Zn.OPERATOR,A)}static get LBRACE(){return x(this,"LBRACE",new On(Zn.LBRACE,"{"))}static get RBRACE(){return x(this,"RBRACE",new On(Zn.RBRACE,"}"))}static get IF(){return x(this,"IF",new On(Zn.IF,"IF"))}static get IFELSE(){return x(this,"IFELSE",new On(Zn.IFELSE,"IFELSE"))}}class Xn{constructor(A){this.stream=A,this.nextChar(),this.strBuf=[]}nextChar(){return this.currentChar=this.stream.getByte()}getToken(){let A=!1,e=this.currentChar;for(;;){if(e<0)return aA;if(A)10!==e&&13!==e||(A=!1);else if(37===e)A=!0;else if(!UA(e))break;e=this.nextChar()}switch(0|e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return new On(Zn.NUMBER,this.getNumber());case 123:return this.nextChar(),On.LBRACE;case 125:return this.nextChar(),On.RBRACE}const t=this.strBuf;for(t.length=0,t[0]=String.fromCharCode(e);(e=this.nextChar())>=0&&(e>=65&&e<=90||e>=97&&e<=122);)t.push(String.fromCharCode(e));const i=t.join("");switch(i.toLowerCase()){case"if":return On.IF;case"ifelse":return On.IFELSE;default:return On.getOperator(i)}}getNumber(){let A=this.currentChar;const e=this.strBuf;for(e.length=0,e[0]=String.fromCharCode(A);(A=this.nextChar())>=0&&(A>=48&&A<=57||45===A||46===A);)e.push(String.fromCharCode(A));const t=parseFloat(e.join(""));if(isNaN(t))throw new v(`Invalid floating point number: ${t}`);return t}}class Vn{constructor(A){this._onlyRefs=!0===A?.onlyRefs,this._onlyRefs||(this._nameRefMap=new Map,this._imageMap=new Map),this._imageCache=new hA}getByName(A){this._onlyRefs&&R("Should not call `getByName` method.");const e=this._nameRefMap.get(A);return e?this.getByRef(e):this._imageMap.get(A)||null}getByRef(A){return this._imageCache.get(A)||null}set(A,e,t){R("Abstract method `set` called.")}}class jn extends Vn{set(A,e=null,t){if("string"!=typeof A)throw new Error('LocalImageCache.set - expected "name" argument.');if(e){if(this._imageCache.has(e))return;return this._nameRefMap.set(A,e),void this._imageCache.put(e,t)}this._imageMap.has(A)||this._imageMap.set(A,t)}}class zn extends Vn{set(A=null,e=null,t){if("string"!=typeof A&&!e)throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');if(e){if(this._imageCache.has(e))return;return null!==A&&this._nameRefMap.set(A,e),void this._imageCache.put(e,t)}this._imageMap.has(A)||this._imageMap.set(A,t)}}class _n extends Vn{constructor(A){super({onlyRefs:!0})}set(A=null,e,t){if(!e)throw new Error('LocalFunctionCache.set - expected "ref" argument.');this._imageCache.has(e)||this._imageCache.put(e,t)}}class $n extends Vn{set(A,e=null,t){if("string"!=typeof A)throw new Error('LocalGStateCache.set - expected "name" argument.');if(e){if(this._imageCache.has(e))return;return this._nameRefMap.set(A,e),void this._imageCache.put(e,t)}this._imageMap.has(A)||this._imageMap.set(A,t)}}class Ag extends Vn{constructor(A){super({onlyRefs:!0})}set(A=null,e,t){if(!e)throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');this._imageCache.has(e)||this._imageCache.put(e,t)}}class eg extends Vn{constructor(A){super({onlyRefs:!0})}set(A=null,e,t){if(!e)throw new Error('RegionalImageCache.set - expected "ref" argument.');this._imageCache.has(e)||this._imageCache.put(e,t)}}class tg{static NUM_PAGES_THRESHOLD=2;static MIN_IMAGES_TO_CACHE=10;static MAX_BYTE_SIZE=5e7;#D=new BA;constructor(){this._refCache=new hA,this._imageCache=new hA}get#b(){let A=0;for(const e of this._imageCache)A+=e.byteSize;return A}get#k(){return!(this._imageCache.size+A)):null}class sg{static getSampleArray(A,e,t,i){let a,s,n=1;for(a=0,s=A.length;a>r)*I,o&=(1<t?A=t:A0&&(C=s[c-1]);let B=i[1];c>1,o=a.length>>1,I=new rg(g),c=Object.create(null);let C=8192;const B=new Float32Array(o);return function(A,e,t,i){let a,n,g="";const h=B;for(a=0;aA&&(n=A)),l[a]=n}C>0&&(C--,c[g]=l),t.set(l,i)}}}function ng(A){let e;if(A instanceof cA)e=A;else{if(!(A instanceof dA))return!1;e=A.dict}return e.has("FunctionType")}class gg{static MAX_STACK_SIZE=100;constructor(A){this.stack=A?Array.from(A):[]}push(A){if(this.stack.length>=gg.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");this.stack.push(A)}pop(){if(this.stack.length<=0)throw new Error("PostScript function stack underflow.");return this.stack.pop()}copy(A){if(this.stack.length+A>=gg.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");const e=this.stack;for(let t=e.length-A,i=A-1;i>=0;i--,t++)e.push(e[t])}index(A){this.push(this.stack[this.stack.length-A-1])}roll(A,e){const t=this.stack,i=t.length-A,a=t.length-1,s=i+(e-Math.floor(e/A)*A);for(let A=i,e=a;A0?e.push(n<>g);break;case"ceiling":n=e.pop(),e.push(Math.ceil(n));break;case"copy":n=e.pop(),e.copy(n);break;case"cos":n=e.pop(),e.push(Math.cos(n%360/180*Math.PI));break;case"cvi":n=0|e.pop(),e.push(n);break;case"cvr":break;case"div":g=e.pop(),n=e.pop(),e.push(n/g);break;case"dup":e.copy(1);break;case"eq":g=e.pop(),n=e.pop(),e.push(n===g);break;case"exch":e.roll(2,1);break;case"exp":g=e.pop(),n=e.pop(),e.push(n**g);break;case"false":e.push(!1);break;case"floor":n=e.pop(),e.push(Math.floor(n));break;case"ge":g=e.pop(),n=e.pop(),e.push(n>=g);break;case"gt":g=e.pop(),n=e.pop(),e.push(n>g);break;case"idiv":g=e.pop(),n=e.pop(),e.push(n/g|0);break;case"index":n=e.pop(),e.index(n);break;case"le":g=e.pop(),n=e.pop(),e.push(n<=g);break;case"ln":n=e.pop(),e.push(Math.log(n));break;case"log":n=e.pop(),e.push(Math.log10(n));break;case"lt":g=e.pop(),n=e.pop(),e.push(n=e?new cg(e):A.max<=e?A:new Bg(A,e)}class pg{compile(A,e,t){const i=[],a=[],s=e.length>>1,n=t.length>>1;let g,r,o,I,c,C,B,h,Q=0;for(let A=0;Ae.min&&(g.unshift("Math.max(",s,", "),g.push(")")),n4?(i=!0,e=0):(i=!1,e=1));const r=[];for(s=0;s=0&&"ET"===Gg[A];--A)Gg[A]="EN";for(let A=s+1;A0&&(e=Gg[s-1]);let t=c;A+1h&&wg(h)&&(l=h);for(h=Q;h>=l;--h){let A=-1;for(s=0,n=r.length;s=0&&(Fg(Rg,A,s),A=-1):A<0&&(A=s);A>=0&&Fg(Rg,A,r.length)}for(s=0,n=Rg.length;s"!==A||(Rg[s]="")}return Sg(Rg.join(""),i)}const xg={style:"normal",weight:"normal"},Ug={style:"normal",weight:"bold"},Mg={style:"italic",weight:"normal"},Lg={style:"italic",weight:"bold"},Jg=new Map([["Times-Roman",{local:["Times New Roman","Times-Roman","Times","Liberation Serif","Nimbus Roman","Nimbus Roman L","Tinos","Thorndale","TeX Gyre Termes","FreeSerif","Linux Libertine O","Libertinus Serif","DejaVu Serif","Bitstream Vera Serif","Ubuntu"],style:xg,ultimate:"serif"}],["Times-Bold",{alias:"Times-Roman",style:Ug,ultimate:"serif"}],["Times-Italic",{alias:"Times-Roman",style:Mg,ultimate:"serif"}],["Times-BoldItalic",{alias:"Times-Roman",style:Lg,ultimate:"serif"}],["Helvetica",{local:["Helvetica","Helvetica Neue","Arial","Arial Nova","Liberation Sans","Arimo","Nimbus Sans","Nimbus Sans L","A030","TeX Gyre Heros","FreeSans","DejaVu Sans","Albany","Bitstream Vera Sans","Arial Unicode MS","Microsoft Sans Serif","Apple Symbols","Cantarell"],path:"LiberationSans-Regular.ttf",style:xg,ultimate:"sans-serif"}],["Helvetica-Bold",{alias:"Helvetica",path:"LiberationSans-Bold.ttf",style:Ug,ultimate:"sans-serif"}],["Helvetica-Oblique",{alias:"Helvetica",path:"LiberationSans-Italic.ttf",style:Mg,ultimate:"sans-serif"}],["Helvetica-BoldOblique",{alias:"Helvetica",path:"LiberationSans-BoldItalic.ttf",style:Lg,ultimate:"sans-serif"}],["Courier",{local:["Courier","Courier New","Liberation Mono","Nimbus Mono","Nimbus Mono L","Cousine","Cumberland","TeX Gyre Cursor","FreeMono","Linux Libertine Mono O","Libertinus Mono"],style:xg,ultimate:"monospace"}],["Courier-Bold",{alias:"Courier",style:Ug,ultimate:"monospace"}],["Courier-Oblique",{alias:"Courier",style:Mg,ultimate:"monospace"}],["Courier-BoldOblique",{alias:"Courier",style:Lg,ultimate:"monospace"}],["ArialBlack",{local:["Arial Black"],style:{style:"normal",weight:"900"},fallback:"Helvetica-Bold"}],["ArialBlack-Bold",{alias:"ArialBlack"}],["ArialBlack-Italic",{alias:"ArialBlack",style:{style:"italic",weight:"900"},fallback:"Helvetica-BoldOblique"}],["ArialBlack-BoldItalic",{alias:"ArialBlack-Italic"}],["ArialNarrow",{local:["Arial Narrow","Liberation Sans Narrow","Helvetica Condensed","Nimbus Sans Narrow","TeX Gyre Heros Cn"],style:xg,fallback:"Helvetica"}],["ArialNarrow-Bold",{alias:"ArialNarrow",style:Ug,fallback:"Helvetica-Bold"}],["ArialNarrow-Italic",{alias:"ArialNarrow",style:Mg,fallback:"Helvetica-Oblique"}],["ArialNarrow-BoldItalic",{alias:"ArialNarrow",style:Lg,fallback:"Helvetica-BoldOblique"}],["Calibri",{local:["Calibri","Carlito"],style:xg,fallback:"Helvetica"}],["Calibri-Bold",{alias:"Calibri",style:Ug,fallback:"Helvetica-Bold"}],["Calibri-Italic",{alias:"Calibri",style:Mg,fallback:"Helvetica-Oblique"}],["Calibri-BoldItalic",{alias:"Calibri",style:Lg,fallback:"Helvetica-BoldOblique"}],["Wingdings",{local:["Wingdings","URW Dingbats"],style:xg}],["Wingdings-Regular",{alias:"Wingdings"}],["Wingdings-Bold",{alias:"Wingdings"}]]),Hg=new Map([["Arial-Black","ArialBlack"]]);function Yg(A){const e=new Set(["thin","extralight","ultralight","demilight","semilight","light","book","regular","normal","medium","demibold","semibold","bold","extrabold","ultrabold","black","heavy","extrablack","ultrablack","roman","italic","oblique","ultracondensed","extracondensed","condensed","semicondensed","normal","semiexpanded","expanded","extraexpanded","ultraexpanded","bolditalic"]);return A.split(/[- ,+]+/g).filter((A=>!e.has(A.toLowerCase()))).join(" ")}function vg({alias:A,local:e,path:t,fallback:i,style:a,ultimate:s},n,g,r=!0,o=!0,I=""){const c={style:null,ultimate:null};if(e){const A=I?` ${I}`:"";for(const t of e)n.push(`local(${t}${A})`)}if(A){const e=Jg.get(A),s=I||function(A){switch(A){case Ug:return"Bold";case Mg:return"Italic";case Lg:return"Bold Italic";default:if("bold"===A?.weight)return"Bold";if("italic"===A?.style)return"Italic"}return""}(a);Object.assign(c,vg(e,n,g,r&&!i,o&&!t,s))}if(a&&(c.style=a),s&&(c.ultimate=s),r&&i){const A=Jg.get(i),{ultimate:e}=vg(A,n,g,r,o&&!t,I);c.ultimate||=e}return o&&t&&g&&n.push(`url(${g}${t})`),c}function Kg(A,e,t,i,a,s){if(i.startsWith("InvalidPDFjsFont_"))return null;"TrueType"!==s&&"Type1"!==s||!/^[A-Z]{6}\+/.test(i)||(i=i.slice(7));const n=i=Ca(i);let g=A.get(n);if(g)return g;let r=Jg.get(i);if(!r)for(const[A,e]of Hg)if(i.startsWith(A)){i=`${e}${i.substring(A.length)}`,r=Jg.get(i);break}let o=!1;r||(r=Jg.get(a),o=!0);const I=`${e.getDocId()}_s${e.createFontId()}`;if(!r){if(!OA(i))return S(`Cannot substitute the font because of its name: ${i}`),A.set(n,null),null;const e=/bold/gi.test(i),t=/oblique|italic/gi.test(i),a=e&&t&&Lg||e&&Ug||t&&Mg||xg;return g={css:`"${Yg(i)}",${I}`,guessFallback:!0,loadedName:I,baseFontName:i,src:`local(${i})`,style:a},A.set(n,g),g}const c=[];o&&OA(i)&&c.push(`local(${i})`);const{style:C,ultimate:B}=vg(r,c,t),h=null===B,Q=h?"":`,${B}`;return g={css:`"${Yg(i)}",${I}${Q}`,guessFallback:h,loadedName:I,baseFontName:i,src:c.join(","),style:C},A.set(n,g),g}class qg{constructor(A,e){this._imgData=A,this._isMask=e}static needsToBeResized(A,e){if(A<=this._goodSquareLength&&e<=this._goodSquareLength)return!1;const{MAX_DIM:t}=this;if(A>t||e>t)return!0;const i=A*e;return this._hasMaxArea?i>this.MAX_AREA:!(i(this.MAX_AREA=this._goodSquareLength**2)))}static get MAX_DIM(){return x(this,"MAX_DIM",this._guessMax(2048,65537,0,1))}static get MAX_AREA(){return this._hasMaxArea=!0,x(this,"MAX_AREA",this._guessMax(qg._goodSquareLength,this.MAX_DIM,128,0)**2)}static set MAX_AREA(A){A>=0&&(this._hasMaxArea=!0,x(this,"MAX_AREA",A))}static setMaxArea(A){this._hasMaxArea||(this.MAX_AREA=A>>2)}static _areGoodDims(A,e){try{const t=new OffscreenCanvas(A,e),i=t.getContext("2d");i.fillRect(0,0,1,1);const a=i.getImageData(0,0,1,1).data[3];return t.width=t.height=1,0!==a}catch{return!1}}static _guessMax(A,e,t,i){for(;A+t+1>3,n=t+3&-4;if(t!==n){const A=new Uint8Array(n*e);let i=0;for(let s=0,g=e*t;s>>8,e[t++]=255&a)}}else{if(!ArrayBuffer.isView(A))throw new Error("Invalid data format, must be a string or TypedArray.");e=A.slice(),t=e.byteLength}const i=t>>2,a=t-4*i,s=new Uint32Array(e.buffer,0,i);let n=0,g=0,r=this.h1,o=this.h2;const I=3432918353,c=461845907,C=11601,B=13715;for(let A=0;A>>17,n=n*c&Pg|n*B&Wg,r^=n,r=r<<13|r>>>19,r=5*r+3864292196):(g=s[A],g=g*I&Pg|g*C&Wg,g=g<<15|g>>>17,g=g*c&Pg|g*B&Wg,o^=g,o=o<<13|o>>>19,o=5*o+3864292196);switch(n=0,a){case 3:n^=e[4*i+2]<<16;case 2:n^=e[4*i+1]<<8;case 1:n^=e[4*i],n=n*I&Pg|n*C&Wg,n=n<<15|n>>>17,n=n*c&Pg|n*B&Wg,1&i?r^=n:o^=n}this.h1=r,this.h2=o}hexdigest(){let A=this.h1,e=this.h2;return A^=e>>>1,A=3981806797*A&Pg|36045*A&Wg,e=4283543511*e&Pg|(2950163797*(e<<16|A>>>16)&Pg)>>>16,A^=e>>>1,A=444984403*A&Pg|60499*A&Wg,e=3301882366*e&Pg|(3120437893*(e<<16|A>>>16)&Pg)>>>16,A^=e>>>1,(A>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}function Og(A,e,t,i,a){let s=A;for(let A=0,t=e.length-1;A1e3&&(o=Math.max(o,C),B+=c+2,C=0,c=0),I.push({transform:e,x:C,y:B,w:t.width,h:t.height}),C+=t.width+2,c=Math.max(c,t.height)}const h=Math.max(o,C)+1,Q=B+c+1,l=new Uint8Array(h*Q*4),E=h<<2;for(let A=0;A=0;)e[s-4]=e[s],e[s-3]=e[s+1],e[s-2]=e[s+2],e[s-1]=e[s+3],e[s+t]=e[s+t-4],e[s+t+1]=e[s+t-3],e[s+t+2]=e[s+t-2],e[s+t+3]=e[s+t-1],s-=E}const u={width:h,height:Q};if(A.isOffscreenCanvasSupported){const A=new OffscreenCanvas(h,Q);A.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(l.buffer),h,Q),0,0),u.bitmap=A.transferToImageBitmap(),u.data=null}else u.kind=3,u.data=l;return t.splice(s,4*r,87),i.splice(s,4*r,[u,I]),s+1})),Og(Xg,[Q,E,w,l],null,(function(A,e){const t=A.fnArray,i=(e-(A.iCurr-3))%4;switch(i){case 0:return t[e]===Q;case 1:return t[e]===E;case 2:return t[e]===w;case 3:return t[e]===l}throw new Error(`iterateImageMaskGroup - invalid pos: ${i}`)}),(function(A,e){const t=A.fnArray,i=A.argsArray,a=A.iCurr,s=a-3,n=a-2,g=a-1;let r=Math.floor((e-s)/4);if(r<10)return e-(e-s)%4;let o,I,c=!1;const C=i[g][0],B=i[n][0],h=i[n][1],Q=i[n][2],l=i[n][3];if(h===Q){c=!0,o=n+4;let A=g+4;for(let e=1;e=4&&t[s-4]===t[n]&&t[s-3]===t[g]&&t[s-2]===t[r]&&t[s-1]===t[o]&&i[s-4][0]===I&&i[s-4][1]===c&&(C++,B-=5);let h=B+4;for(let A=1;A=t)break}i=(i||Xg)[A[e]],i&&!Array.isArray(i)?(s.iCurr=e,e++,!i.checkFn||(0,i.checkFn)(s)?(a=i,i=null):i=null):e++}this.state=i,this.match=a,this.lastProcessed=e}flush(){for(;this.match;){const A=this.queue.fnArray.length;this.lastProcessed=(0,this.match.processFn)(this.context,A),this.match=null,this.state=null,this._optimize()}}reset(){this.state=null,this.match=null,this.lastProcessed=0}}class zg{static CHUNK_SIZE=1e3;static CHUNK_SIZE_ABOUT=this.CHUNK_SIZE-5;constructor(A=0,e){this._streamSink=e,this.fnArray=[],this.argsArray=[],this.optimizer=!e||256&A?new Vg(this):new jg(this),this.dependencies=new Set,this._totalLength=0,this.weight=0,this._resolved=e?null:Promise.resolve()}set isOffscreenCanvasSupported(A){this.optimizer.isOffscreenCanvasSupported=A}get length(){return this.argsArray.length}get ready(){return this._resolved||this._streamSink.ready}get totalLength(){return this._totalLength+this.length}addOp(A,e){this.optimizer.push(A,e),this.weight++,this._streamSink&&(this.weight>=zg.CHUNK_SIZE||this.weight>=zg.CHUNK_SIZE_ABOUT&&(A===l||32===A))&&this.flush()}addImageOps(A,e,t){void 0!==t&&this.addOp(m,["OC",t]),this.addOp(A,e),void 0!==t&&this.addOp(y,[])}addDependency(A){this.dependencies.has(A)||(this.dependencies.add(A),this.addOp(1,[A]))}addDependencies(A){for(const e of A)this.addDependency(e)}addOpList(A){if(A instanceof zg){for(const e of A.dependencies)this.dependencies.add(e);for(let e=0,t=A.length;ei&&(A=i),A}function $g(A,e,t,i,a,s){const n=a*s;let g;g=e<=8?new Uint8Array(n):e<=16?new Uint16Array(n):new Uint32Array(n);const r=t/a,o=i/s;let I,c,C,B,h=0;const Q=new Uint16Array(a),l=t;for(I=0;I0&&Number.isInteger(t.height)&&t.height>0&&(t.width!==C||t.height!==B)&&(S("PDFImage - using the Width/Height of the image data, rather than the image dictionary."),C=t.width,B=t.height),C<1||B<1)throw new v(`Invalid image width: ${C} or height: ${B}`);this.width=C,this.height=B,this.interpolate=o.get("I","Interpolate"),this.imageMask=o.get("IM","ImageMask")||!1,this.matte=o.get("Matte")||!1;let h=t.bitsPerComponent;if(!h&&(h=o.get("BPC","BitsPerComponent"),!h)){if(!this.imageMask)throw new v(`Bits per component missing in image: ${this.imageMask}`);h=1}if(this.bpc=h,!this.imageMask){let a=o.getRaw("CS")||o.getRaw("ColorSpace");const s=!!a;if(s)this.jpxDecoderOptions?.smaskInData&&(a=rA.get("DeviceRGBA"));else if(this.jpxDecoderOptions)a=rA.get("DeviceRGBA");else switch(t.numComps){case 1:a=rA.get("DeviceGray");break;case 3:a=rA.get("DeviceRGB");break;case 4:a=rA.get("DeviceCMYK");break;default:throw new Error(`Images with ${t.numComps} color components not supported.`)}this.colorSpace=re.parse({cs:a,xref:A,resources:i?e:null,pdfFunctionFactory:g,localColorSpaceCache:r}),this.numComps=this.colorSpace.numComps,this.jpxDecoderOptions&&(this.jpxDecoderOptions.numComponents=s?this.numComp:0,this.jpxDecoderOptions.isIndexedColormap="Indexed"===this.colorSpace.name)}if(this.decode=o.getArray("D","Decode"),this.needsDecode=!1,this.decode&&(this.colorSpace&&!this.colorSpace.isDefaultDecode(this.decode,h)||n&&!re.isDefaultDecode(this.decode,1))){this.needsDecode=!0;const A=(1<>3)*t,g=A.byteLength;let r,o;if(!i||a&&n!==g?a?(r=new Uint8Array(n),r.set(A),r.fill(255,g)):r=new Uint8Array(A):r=A,a)for(o=0;o>7&1,n[C+1]=c>>6&1,n[C+2]=c>>5&1,n[C+3]=c>>4&1,n[C+4]=c>>3&1,n[C+5]=c>>2&1,n[C+6]=c>>1&1,n[C+7]=1&c,C+=8;if(C>=1}}else{let t=0;for(c=0,C=0,I=s;C>i;a<0?a=0:a>o&&(a=o),n[C]=a,c&=(1<n[i+1]){e=255;break}}g[I]=e}}}if(g)for(I=0,C=3,c=e*i;I>3,I=e&&qg.needsToBeResized(t,i);if("DeviceRGBA"===this.colorSpace.name){a.kind=3;const A=a.data=await this.getImageBytes(g*n*4,{});return e?I?qg.createImage(a,!1):this.createBitmap(3,t,i,A):a}if(!A){let A;if("DeviceGray"===this.colorSpace.name&&1===r?A=1:"DeviceRGB"!==this.colorSpace.name||8!==r||this.needsDecode||(A=2),A&&!this.smask&&!this.mask&&t===n&&i===g){const s=await this.getImageBytes(g*o,{});if(e)return I?qg.createImage({data:s,kind:A,width:t,height:i,interpolate:this.interpolate},this.needsDecode):this.createBitmap(A,n,g,s);if(a.kind=A,a.data=s,this.needsDecode){G(1===A,"PDFImage.createImageData: The image must be grayscale.");const e=a.data;for(let A=0,t=e.length;A>3,n=await this.getImageBytes(i*s,{internal:!0}),g=this.getComponents(n);let r,o;if(1===a){if(o=t*i,this.needsDecode)for(r=0;r>2,r=new Uint32Array(A.buffer,e,g);if(Z.isLittleEndian){for(;n>>24|e<<8|4278190080,t[i+2]=e>>>16|a<<16|4278190080,t[i+3]=a>>>8|4278190080}for(let e=4*n,a=A.length;e>>8|255,t[i+2]=e<<16|a>>>16|255,t[i+3]=a<<8|255}for(let e=4*n,a=A.length;e0&&e.args[0].count++}class sr{static TIME_SLOT_DURATION_MS=20;static CHECK_TIME_EVERY=100;constructor(){this.reset()}check(){return!(++this.checkedc){const A="Image exceeded maximum allowed size and was removed.";if(this.options.ignoreErrors)return void S(A);throw new Error(A)}let C,B,h;if(g.has("OC")&&(C=await this.parseMarkedContentProps(g.get("OC"),A)),g.get("IM","ImageMask")){const A=g.get("I","Interpolate"),t=o+7>>3,n=e.getBytes(t*I),c=g.getArray("D","Decode");if(this.parsingType3Font){if(B=Ar.createRawMask({imgArray:n,width:o,height:I,imageIsFromDecodeStream:e instanceof ke,inverseDecode:c?.[0]>0,interpolate:A}),B.cached=!!a,h=[B],i.addImageOps(w,h,C),a){const A={fn:w,args:h,optionalContent:C};s.set(a,r,A),r&&this._regionalImageCache.set(null,r,A)}return}if(B=await Ar.createMask({imgArray:n,width:o,height:I,imageIsFromDecodeStream:e instanceof ke,inverseDecode:c?.[0]>0,interpolate:A,isOffscreenCanvasSupported:this.options.isOffscreenCanvasSupported}),B.isSingleOpaquePixel){if(i.addImageOps(90,[],C),a){const A={fn:90,args:[],optionalContent:C};s.set(a,r,A),r&&this._regionalImageCache.set(null,r,A)}return}const Q=`mask_${this.idFactory.createObjId()}`;if(i.addDependency(Q),B.dataLen=B.bitmap?B.width*B.height*4:B.data.length,this._sendImgData(Q,B),h=[{data:Q,width:B.width,height:B.height,interpolate:B.interpolate,count:1}],i.addImageOps(w,h,C),a){const A={objId:Q,fn:w,args:h,optionalContent:C};s.set(a,r,A),r&&this._regionalImageCache.set(null,r,A)}return}if(t&&o+I<200&&!g.has("SMask")&&!g.has("Mask")){try{const a=new Ar({xref:this.xref,res:A,image:e,isInline:t,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:n});B=await a.createImageData(!0,!1),i.isOffscreenCanvasSupported=this.options.isOffscreenCanvasSupported,i.addImageOps(86,[B],C)}catch(A){const e=`Unable to decode inline image: "${A}".`;if(!this.options.ignoreErrors)throw new Error(e);S(e)}return}let Q=`img_${this.idFactory.createObjId()}`,l=!1;if(this.parsingType3Font?Q=`${this.idFactory.getDocId()}_type3_${Q}`:a&&r&&(l=this.globalImageCache.shouldCache(r,this.pageIndex),l&&(G(!t,"Cannot cache an inline image globally."),Q=`${this.idFactory.getDocId()}_${Q}`)),i.addDependency(Q),h=[Q,o,I],i.addImageOps(D,h,C),l){if(this.globalImageCache.hasDecodeFailed(r))return this.globalImageCache.setData(r,{objId:Q,fn:D,args:h,optionalContent:C,byteSize:0}),void this._sendImgData(Q,null,l);if(o*I>25e4||g.has("SMask")||g.has("Mask")){const A=await this.handler.sendWithPromise("commonobj",[Q,"CopyLocalImage",{imageRef:r}]);if(A)return this.globalImageCache.setData(r,{objId:Q,fn:D,args:h,optionalContent:C,byteSize:0}),void this.globalImageCache.addByteSize(r,A)}}if(Ar.buildImage({xref:this.xref,res:A,image:e,isInline:t,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:n}).then((async A=>(B=await A.createImageData(!1,this.options.isOffscreenCanvasSupported),B.dataLen=B.bitmap?B.width*B.height*4:B.data.length,B.ref=r,l&&this.globalImageCache.addByteSize(r,B.dataLen),this._sendImgData(Q,B,l)))).catch((A=>(S(`Unable to decode image "${Q}": "${A}".`),r&&this.globalImageCache.addDecodeFailed(r),this._sendImgData(Q,null,l)))),a){const A={objId:Q,fn:D,args:h,optionalContent:C};s.set(a,r,A),r&&(this._regionalImageCache.set(null,r,A),l&&this.globalImageCache.setData(r,{objId:Q,fn:D,args:h,optionalContent:C,byteSize:0}))}}handleSMask(A,e,t,i,a,s){const n=A.get("G"),g={subtype:A.get("S").name,backdrop:A.get("BC")},r=A.get("TR");if(ng(r)){const A=this._pdfFunctionFactory.create(r),e=new Uint8Array(256),t=new Float32Array(1);for(let i=0;i<256;i++)t[0]=i/255,A(t,0,t,0),e[i]=255*t[0]|0;g.transferMap=e}return this.buildFormXObject(e,n,g,t,i,a.state.clone(),s)}handleTransferFunction(A){let e;if(Array.isArray(A))e=A;else{if(!ng(A))return null;e=[A]}const t=[];let i=0,a=0;for(const A of e){const e=this.xref.fetchIfRef(A);if(i++,QA(e,"Identity")){t.push(null);continue}if(!ng(e))return null;const s=this._pdfFunctionFactory.create(e),n=new Uint8Array(256),g=new Float32Array(1);for(let A=0;A<256;A++)g[0]=A/255,s(g,0,g,0),n[A]=255*g[0]|0;t.push(n),a++}return 1!==i&&4!==i||0===a?null:t}handleTilingType(A,e,t,i,a,s,n,g){const r=new zg,o=cA.merge({xref:this.xref,dictArray:[a.get("Resources"),t]});return this.getOperatorList({stream:i,task:n,resources:o,operatorList:r}).then((function(){const t=r.getIR(),i=An(t,a,e);s.addDependencies(r.dependencies),s.addOp(A,i),a.objId&&g.set(null,a.objId,{operatorListIR:t,dict:a})})).catch((A=>{if(!(A instanceof K)){if(!this.options.ignoreErrors)throw A;S(`handleTilingType - ignoring pattern: "${A}".`)}}))}async handleSetFont(A,e,t,i,a,s,n=null,g=null){const r=e?.[0]instanceof rA?e[0].name:null;let o=await this.loadFont(r,t,A,n,g);if(o.font.isType3Font)try{await o.loadType3Data(this,A,a),i.addDependencies(o.type3Dependencies)}catch(A){o=new gr({loadedName:"g_font_error",font:new Ws(`Type3 font load error: ${A}`),dict:o.font,evaluatorOptions:this.options})}return s.font=o.font,o.send(this.handler),o.loadedName}handleText(A,e){const t=e.font,i=t.charsToGlyphs(A);return t.data&&(4&e.textRenderingMode||"Pattern"===e.fillColorSpace.name||t.disableFontFace||this.options.disableFontFace)&&nr.buildFontPaths(t,i,this.handler,this.options),i}ensureStateFont(A){if(A.font)return;const e=new v("Missing setFont (Tf) operator before text rendering operator.");if(!this.options.ignoreErrors)throw e;S(`ensureStateFont: "${e}".`)}async setGState({resources:A,gState:e,operatorList:t,cacheKey:i,task:a,stateManager:s,localGStateCache:n,localColorSpaceCache:g}){const r=e.objId;let o=!0;const I=[];let c=Promise.resolve();for(const i of e.getKeys()){const n=e.get(i);switch(i){case"Type":break;case"LW":case"LC":case"LJ":case"ML":case"D":case"RI":case"FL":case"CA":case"ca":I.push([i,n]);break;case"Font":o=!1,c=c.then((()=>this.handleSetFont(A,null,n[0],t,a,s.state).then((function(A){t.addDependency(A),I.push([i,[A,n[1]]])}))));break;case"BM":I.push([i,ir(n)]);break;case"SMask":if(QA(n,"None")){I.push([i,!1]);break}n instanceof cA?(o=!1,c=c.then((()=>this.handleSMask(n,A,t,a,s,g))),I.push([i,!0])):S("Unsupported SMask type");break;case"TR":const e=this.handleTransferFunction(n);I.push([i,e]);break;case"OP":case"op":case"OPM":case"BG":case"BG2":case"UCR":case"UCR2":case"TR2":case"HT":case"SM":case"SA":case"AIS":case"TK":F("graphic state operator "+i);break;default:F("Unknown graphic state operator "+i)}}await c,I.length>0&&t.addOp(9,[I]),o&&n.set(i,r,I)}loadFont(A,e,t,i=null,a=null){const s=async()=>new gr({loadedName:"g_font_error",font:new Ws(`Font "${A}" is not available.`),dict:e,evaluatorOptions:this.options});let n;if(e)e instanceof CA&&(n=e);else{const e=t.get("Font");e&&(n=e.getRaw(A))}if(n){if(this.type3FontRefs?.has(n))return s();if(this.fontCache.has(n))return this.fontCache.get(n);try{e=this.xref.fetchIfRef(n)}catch(A){S(`loadFont - lookup failed: "${A}".`)}}if(!(e instanceof cA)){if(!this.options.ignoreErrors&&!this.parsingType3Font)return S(`Font "${A}" is not available.`),s();S(`Font "${A}" is not available -- attempting to fallback to a default font.`),e=i||nr.fallbackFontDict}if(e.cacheKey&&this.fontCache.has(e.cacheKey))return this.fontCache.get(e.cacheKey);const{promise:g,resolve:r}=Promise.withResolvers();let o;try{o=this.preEvaluateFont(e),o.cssFontInfo=a}catch(A){return S(`loadFont - preEvaluateFont failed: "${A}".`),s()}const{descriptor:I,hash:c}=o,C=n instanceof CA;let B;if(c&&I instanceof cA){const A=I.fontAliases||=Object.create(null);if(A[c]){const e=A[c].aliasRef;if(C&&e&&this.fontCache.has(e))return this.fontCache.putAlias(n,e),this.fontCache.get(n)}else A[c]={fontID:this.idFactory.createFontId()};C&&(A[c].aliasRef=n),B=A[c].fontID}else B=this.idFactory.createFontId();return G(B?.startsWith("f"),'The "fontID" must be (correctly) defined.'),C?this.fontCache.put(n,g):(e.cacheKey=`cacheKey_${B}`,this.fontCache.put(e.cacheKey,g)),e.loadedName=`${this.idFactory.getDocId()}_${B}`,this.translateFont(o).then((A=>{r(new gr({loadedName:e.loadedName,font:A,dict:e,evaluatorOptions:this.options}))})).catch((A=>{S(`loadFont - translateFont failed: "${A}".`),r(new gr({loadedName:e.loadedName,font:new Ws(A instanceof Error?A.message:A),dict:e,evaluatorOptions:this.options}))})),g}buildPath(A,e,t,i=!1){const a=A.length-1;if(t||(t=[]),a<0||91!==A.fnArray[a]){let a;switch(i&&(S(`Encountered path operator "${e}" inside of a text object.`),A.addOp(Q,null)),e){case 19:const A=t[0]+t[2],e=t[1]+t[3];a=[Math.min(t[0],A),Math.min(t[1],e),Math.max(t[0],A),Math.max(t[1],e)];break;case 13:case 14:a=[t[0],t[1],t[0],t[1]];break;default:a=[1/0,1/0,-1/0,-1/0]}A.addOp(91,[[e],t,a]),i&&A.addOp(l,null)}else{const i=A.argsArray[a];i[0].push(e),i[1].push(...t);const s=i[2];switch(e){case 19:const A=t[0]+t[2],e=t[1]+t[3];s[0]=Math.min(s[0],t[0],A),s[1]=Math.min(s[1],t[1],e),s[2]=Math.max(s[2],t[0],A),s[3]=Math.max(s[3],t[1],e);break;case 13:case 14:s[0]=Math.min(s[0],t[0]),s[1]=Math.min(s[1],t[1]),s[2]=Math.max(s[2],t[0]),s[3]=Math.max(s[3],t[1])}}}parseColorSpace({cs:A,resources:e,localColorSpaceCache:t}){return re.parseAsync({cs:A,xref:this.xref,resources:e,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:t}).catch((A=>{if(A instanceof K)return null;if(this.options.ignoreErrors)return S(`parseColorSpace - ignoring ColorSpace: "${A}".`),null;throw A}))}parseShading({shading:A,resources:e,localColorSpaceCache:t,localShadingPatternCache:i}){let a,s=i.get(A);if(s)return s;try{a=Zs.parseShading(A,this.xref,e,this._pdfFunctionFactory,t).getIR()}catch(e){if(e instanceof K)return null;if(this.options.ignoreErrors)return S(`parseShading - ignoring shading: "${e}".`),i.set(A,null),null;throw e}return s=`pattern_${this.idFactory.createObjId()}`,this.parsingType3Font&&(s=`${this.idFactory.getDocId()}_type3_${s}`),i.set(A,s),this.parsingType3Font?this.handler.send("commonobj",[s,"Pattern",a]):this.handler.send("obj",[s,this.pageIndex,"Pattern",a]),s}handleColorN(A,e,t,i,a,s,n,g,r,o){const I=t.pop();if(I instanceof rA){const c=a.getRaw(I.name),C=c instanceof CA&&r.getByRef(c);if(C)try{const a=i.base?i.base.getRgb(t,0):null,s=An(C.operatorListIR,C.dict,a);return void A.addOp(e,s)}catch{}const B=this.xref.fetchIfRef(c);if(B){const a=B instanceof dA?B.dict:B,I=a.get("PatternType");if(1===I){const g=i.base?i.base.getRgb(t,0):null;return this.handleTilingType(e,g,s,B,a,A,n,r)}if(2===I){const t=a.get("Shading"),i=this.parseShading({shading:t,resources:s,localColorSpaceCache:g,localShadingPatternCache:o});if(i){const t=LA(a.getArray("Matrix"),null);A.addOp(e,["Shading",i,t])}return}throw new v(`Unknown PatternType: ${I}`)}}throw new v(`Unknown PatternName: ${I}`)}_parseVisibilityExpression(A,e,t){if(++e>10)return void S("Visibility expression is too deeply nested");const i=A.length,a=this.xref.fetchIfRef(A[0]);if(!(i<2)&&a instanceof rA){switch(a.name){case"And":case"Or":case"Not":t.push(a.name);break;default:return void S(`Invalid operator ${a.name} in visibility expression`)}for(let a=1;a0)return{type:"OCMD",expression:e}}const e=t.get("OCGs");if(Array.isArray(e)||e instanceof cA){const A=[];if(Array.isArray(e))for(const t of e)A.push(t.toString());else A.push(e.objId);return{type:i,ids:A,policy:t.get("P")instanceof rA?t.get("P").name:null,expression:null}}if(e instanceof CA)return{type:i,id:e.toString()}}return null}getOperatorList({stream:A,task:e,resources:t,operatorList:i,initialState:a=null,fallbackFontDict:s=null}){if(t||=cA.empty,a||=new Ir,!i)throw new Error('getOperatorList: missing "operatorList" parameter');const n=this,g=this.xref;let r=!1;const o=new jn,I=new zn,c=new $n,C=new Ag,B=new Map,h=t.get("XObject")||cA.empty,Q=t.get("Pattern")||cA.empty,E=new rr(a),y=new cr(A,g,E),w=new sr;function D(A){for(let A=0,e=y.savedStatesDepth;A0&&i.addOp(9,[e]),A=null;continue}}return void b(new Promise((function(A,a){if(!M)throw new v("GState must be referred to by name.");const s=t.get("ExtGState");if(!(s instanceof cA))throw new v("ExtGState should be a dictionary.");const g=s.get(U);if(!(g instanceof cA))throw new v("GState should be a dictionary.");n.setGState({resources:t,gState:g,operatorList:i,cacheKey:U,task:e,stateManager:E,localGStateCache:c,localColorSpaceCache:I}).then(A,a)})).catch((function(A){if(!(A instanceof K)){if(!n.options.ignoreErrors)throw A;S(`getOperatorList - ignoring ExtGState: "${A}".`)}})));case 13:case 14:case 15:case 16:case 17:case 18:case 19:n.buildPath(i,a,A,r);continue;case 67:case 68:case 72:case 73:continue;case m:if(!(A[0]instanceof rA)){S(`Expected name for beginMarkedContentProps arg0=${A[0]}`),i.addOp(m,["OC",null]);continue}if("OC"===A[0].name)return void b(n.parseMarkedContentProps(A[1],t).then((A=>{i.addOp(m,["OC",A])})).catch((A=>{if(!(A instanceof K)){if(n.options.ignoreErrors)return S(`getOperatorList - ignoring beginMarkedContentProps: "${A}".`),void i.addOp(m,["OC",null]);throw A}})));A=[A[0].name,A[1]instanceof cA?A[1].get("MCID"):null];break;default:if(null!==A){for(G=0,N=A.length;G{if(!(A instanceof K)){if(this.options.ignoreErrors)return S(`getOperatorList - ignoring errors during "${e.name}" task: "${A}".`),void D();throw A}}))}getTextContent({stream:A,task:e,resources:t,stateManager:s=null,includeMarkedContent:n=!1,sink:g,seenStyles:r=new Set,viewBox:o,lang:I=null,markedContentData:c=null,disableNormalization:C=!1,keepWhiteSpace:B=!1}){t||=cA.empty,s||=new rr(new or),n&&(c||={level:0});const h={items:[],styles:Object.create(null),lang:I},Q={initialized:!1,str:[],totalWidth:0,totalHeight:0,width:0,height:0,vertical:!1,prevTransform:null,textAdvanceScale:0,spaceInFlowMin:0,spaceInFlowMax:0,trackingSpaceMin:1/0,negativeSpaceMax:-1/0,notASpace:-1/0,transform:null,fontName:null,hasEOL:!1},E=[" "," "];let f=0;function p(A){const e=(f+1)%2,t=" "!==E[f]&&" "===E[e];return E[f]=A,f=e,!B&&t}function w(){return!B&&" "!==E[f]&&" "===E[(f+1)%2]}function D(){E[0]=E[1]=" ",f=0}const b=this,k=this.xref,F=[];let R=null;const G=new jn,N=new $n,x=new cr(A,k,s);let U;function M({width:A=0,height:e=0,transform:t=Q.prevTransform,fontName:i=Q.fontName}){h.items.push({str:" ",dir:"ltr",width:A,height:e,transform:t,fontName:i,hasEOL:!1})}function L(){const A=U.font,e=[U.fontSize*U.textHScale,0,0,U.fontSize,0,U.textRise];if(A.isType3Font&&(U.fontSize<=1||A.isCharBBox)&&!$(U.fontMatrix,a)){const t=A.bbox[3]-A.bbox[1];t>0&&(e[3]*=t*U.fontMatrix[3])}return X.transform(U.ctm,X.transform(U.textMatrix,e))}function J(){if(Q.initialized)return Q;const{font:A,loadedName:e}=U;if(!r.has(e)&&(r.add(e),h.styles[e]={fontFamily:A.fallbackName,ascent:A.ascent,descent:A.descent,vertical:A.vertical},b.options.fontExtraProperties&&A.systemFontInfo)){const t=h.styles[e];t.fontSubstitution=A.systemFontInfo.css,t.fontSubstitutionLoadedName=A.systemFontInfo.loadedName}Q.fontName=e;const t=Q.transform=L();A.vertical?(Q.width=Q.totalWidth=Math.hypot(t[0],t[1]),Q.height=Q.totalHeight=0,Q.vertical=!0):(Q.width=Q.totalWidth=0,Q.height=Q.totalHeight=Math.hypot(t[2],t[3]),Q.vertical=!1);const i=Math.hypot(U.textLineMatrix[0],U.textLineMatrix[1]),a=Math.hypot(U.ctm[0],U.ctm[1]);Q.textAdvanceScale=a*i;const{fontSize:s}=U;return Q.trackingSpaceMin=.102*s,Q.notASpace=.03*s,Q.negativeSpaceMax=-.2*s,Q.spaceInFlowMin=.102*s,Q.spaceInFlowMax=.6*s,Q.hasEOL=!1,Q.initialized=!0,Q}function H(){if(!Q.initialized)return;const A=Math.hypot(U.textLineMatrix[0],U.textLineMatrix[1]),e=Math.hypot(U.ctm[0],U.ctm[1])*A;e!==Q.textAdvanceScale&&(Q.vertical?(Q.totalHeight+=Q.height*Q.textAdvanceScale,Q.height=0):(Q.totalWidth+=Q.width*Q.textAdvanceScale,Q.width=0),Q.textAdvanceScale=e)}async function Y(A,i){const s=await b.loadFont(A,i,t);if(s.font.isType3Font)try{await s.loadType3Data(b,t,e)}catch{}U.loadedName=s.loadedName,U.font=s.font,U.fontMatrix=s.font.fontMatrix||a}function q(A,e,t){const i=Math.hypot(t[0],t[1]);return[(t[0]*A+t[1]*e)/i,(t[2]*A+t[3]*e)/i]}function T(A){const e=L();let t=e[4],i=e[5];if(U.font?.vertical){if(to[2]||i+Ao[3])return!1}else if(t+Ao[2]||io[3])return!1;if(!U.font||!Q.prevTransform)return!0;let a=Q.prevTransform[4],s=Q.prevTransform[5];if(a===t&&s===i)return!0;let n=-1;switch(e[0]&&0===e[1]&&0===e[2]?n=e[0]>0?0:180:e[1]&&0===e[0]&&0===e[3]&&(n=e[1]>0?90:270),n){case 0:break;case 90:[t,i]=[i,t],[a,s]=[s,a];break;case 180:[t,i,a,s]=[-t,-i,-a,-s];break;case 270:[t,i]=[-i,-t],[a,s]=[-s,-a];break;default:[t,i]=q(t,i,e),[a,s]=q(a,s,Q.prevTransform)}if(U.font.vertical){const A=(s-i)/Q.textAdvanceScale,e=t-a,n=Math.sign(Q.height);return A.5*Q.width?(W(),!0):(D(),O(),!0):Math.abs(e)>Q.width?(W(),!0):(A<=n*Q.notASpace&&D(),A<=n*Q.trackingSpaceMin?w()?(D(),O(),M({height:Math.abs(A)})):Q.height+=A:Z(A,Q.prevTransform,n)||(0===Q.str.length?(D(),M({height:Math.abs(A)})):Q.height+=A),Math.abs(e)>.25*Q.width&&O(),!0)}const g=(t-a)/Q.textAdvanceScale,r=i-s,I=Math.sign(Q.width);return g.5*Q.height?(W(),!0):(D(),O(),!0):Math.abs(r)>Q.height?(W(),!0):(g<=I*Q.notASpace&&D(),g<=I*Q.trackingSpaceMin?w()?(D(),O(),M({width:Math.abs(g)})):Q.width+=g:Z(g,Q.prevTransform,I)||(0===Q.str.length?(D(),M({width:Math.abs(g)})):Q.width+=g),Math.abs(r)>.25*Q.height&&O(),!0)}function P({chars:A,extraSpacing:e}){const t=U.font;if(!A){const A=U.charSpacing+e;return A&&(t.vertical?U.translateTextMatrix(0,-A):U.translateTextMatrix(A*U.textHScale,0)),void(B&&T(0))}const i=t.charsToGlyphs(A),a=U.fontMatrix[0]*U.fontSize;for(let A=0,s=i.length;Ae?e.normalize("NFKC"):tA.get(t))));const i=Ng(e,-1,A.vertical);return{str:i.str,dir:i.dir,width:Math.abs(A.totalWidth),height:Math.abs(A.totalHeight),transform:A.transform,fontName:A.fontName,hasEOL:A.hasEOL}}(Q)),Q.initialized=!1,Q.str.length=0)}function V(A=!1){const e=h.items.length;0!==e&&(A&&e<10||(g.enqueue(h,e),h.items=[],h.styles=Object.create(null)))}const j=new sr;return new Promise((function A(a,Q){const E=function(e){V(!0),Promise.all([e,g.ready]).then((function(){try{A(a,Q)}catch(A){Q(A)}}),Q)};e.ensureNotTerminated(),j.reset();const f={};let p,w=[];for(;!(p=j.check())&&(w.length=0,f.args=w,x.read(f));){const A=U;U=s.state;const a=f.fn;switch(w=f.args,0|a){case u:var D=w[0].name,M=w[1];if(U.font&&D===U.fontName&&M===U.fontSize)break;return O(),U.fontName=D,U.fontSize=M,void E(Y(D,null));case 39:U.textRise=w[0];break;case 35:U.textHScale=w[0]/100;break;case 36:U.leading=w[0];break;case 40:U.translateTextLineMatrix(w[0],w[1]),U.textMatrix=U.textLineMatrix.slice();break;case 41:U.leading=-w[1],U.translateTextLineMatrix(w[0],w[1]),U.textMatrix=U.textLineMatrix.slice();break;case 43:U.carriageReturn();break;case 42:U.setTextMatrix(w[0],w[1],w[2],w[3],w[4],w[5]),U.setTextLineMatrix(w[0],w[1],w[2],w[3],w[4],w[5]),H();break;case 33:U.charSpacing=w[0];break;case 34:U.wordSpacing=w[0];break;case 31:U.textMatrix=i.slice(),U.textLineMatrix=i.slice();break;case 45:if(!s.state.font){b.ensureStateFont(s.state);continue}const a=(U.font.vertical?1:-1)*U.fontSize/1e3,Q=w[0];for(let A=0,e=Q.length;A0){const A=F.join("");F.length=0,P({chars:A,extraSpacing:0})}break;case d:if(!s.state.font){b.ensureStateFont(s.state);continue}P({chars:w[0],extraSpacing:0});break;case 46:if(!s.state.font){b.ensureStateFont(s.state);continue}U.carriageReturn(),P({chars:w[0],extraSpacing:0});break;case 47:if(!s.state.font){b.ensureStateFont(s.state);continue}U.wordSpacing=w[0],U.charSpacing=w[1],U.carriageReturn(),P({chars:w[2],extraSpacing:0});break;case 66:O(),R||(R=t.get("XObject")||cA.empty);var L=w[0]instanceof rA,J=w[0].name;if(L&&G.getByName(J))break;return void E(new Promise((function(A,i){if(!L)throw new v("XObject must be referred to by name.");let a=R.getRaw(J);if(a instanceof CA){if(G.getByRef(a))return void A();if(b.globalImageCache.getData(a,b.pageIndex))return void A();a=k.fetch(a)}if(!(a instanceof dA))throw new v("XObject should be a stream");const h=a.dict.get("Subtype");if(!(h instanceof rA))throw new v("XObject should have a Name subtype");if("Form"!==h.name)return G.set(J,a.dict.objId,!0),void A();const Q=s.state.clone(),l=new rr(Q),E=LA(a.dict.getArray("Matrix"),null);E&&l.transform(E),V();const u={enqueueInvoked:!1,enqueue(A,e){this.enqueueInvoked=!0,g.enqueue(A,e)},get desiredSize(){return g.desiredSize},get ready(){return g.ready}};b.getTextContent({stream:a,task:e,resources:a.dict.get("Resources")||t,stateManager:l,includeMarkedContent:n,sink:u,seenStyles:r,viewBox:o,lang:I,markedContentData:c,disableNormalization:C,keepWhiteSpace:B}).then((function(){u.enqueueInvoked||G.set(J,a.dict.objId,!0),A()}),i)})).catch((function(A){if(!(A instanceof K)){if(!b.options.ignoreErrors)throw A;S(`getTextContent - ignoring XObject: "${A}".`)}})));case 9:if(L=w[0]instanceof rA,J=w[0].name,L&&N.getByName(J))break;return void E(new Promise((function(A,e){if(!L)throw new v("GState must be referred to by name.");const i=t.get("ExtGState");if(!(i instanceof cA))throw new v("ExtGState should be a dictionary.");const a=i.get(J);if(!(a instanceof cA))throw new v("GState should be a dictionary.");const s=a.get("Font");if(!s)return N.set(J,a.objId,!0),void A();O(),U.fontName=null,U.fontSize=s[1],Y(null,s[0]).then(A,e)})).catch((function(A){if(!(A instanceof K)){if(!b.options.ignoreErrors)throw A;S(`getTextContent - ignoring ExtGState: "${A}".`)}})));case 69:O(),n&&(c.level++,h.items.push({type:"beginMarkedContent",tag:w[0]instanceof rA?w[0].name:null}));break;case m:if(O(),n){c.level++;let A=null;w[1]instanceof cA&&(A=w[1].get("MCID")),h.items.push({type:"beginMarkedContentProps",id:Number.isInteger(A)?`${b.idFactory.getPageObjId()}_mc${A}`:null,tag:w[0]instanceof rA?w[0].name:null})}break;case y:if(O(),n){if(0===c.level)break;c.level--,h.items.push({type:"endMarkedContent"})}break;case l:!A||A.font===U.font&&A.fontSize===U.fontSize&&A.fontName===U.fontName||O()}if(h.items.length>=g.desiredSize){p=!0;break}}p?E(tr):(O(),V(),a())})).catch((A=>{if(!(A instanceof K)){if(this.options.ignoreErrors)return S(`getTextContent - ignoring errors during "${e.name}" task: "${A}".`),O(),void V();throw A}}))}async extractDataStructures(A,e){const t=this.xref;let i;const a=this.readToUnicode(e.toUnicode);if(e.composite){const t=A.get("CIDSystemInfo");t instanceof cA&&(e.cidSystemInfo={registry:j(t.get("Registry")),ordering:j(t.get("Ordering")),supplement:t.get("Supplement")});try{const e=A.get("CIDToGIDMap");e instanceof dA&&(i=e.getBytes())}catch(A){if(!this.options.ignoreErrors)throw A;S(`extractDataStructures - ignoring CIDToGIDMap data: "${A}".`)}}const s=[];let n,g=null;if(A.has("Encoding")){if(n=A.get("Encoding"),n instanceof cA){if(g=n.get("BaseEncoding"),g=g instanceof rA?g.name:null,n.has("Differences")){const A=n.get("Differences");let e=0;for(const i of A){const A=t.fetchIfRef(i);if("number"==typeof A)e=A;else{if(!(A instanceof rA))throw new v(`Invalid entry in 'Differences' array: ${A}`);s[e++]=A.name}}}}else if(n instanceof rA)g=n.name;else{const A="Encoding is not a Name nor a Dict";if(!this.options.ignoreErrors)throw new v(A);S(A)}"MacRomanEncoding"!==g&&"MacExpertEncoding"!==g&&"WinAnsiEncoding"!==g&&(g=null)}const r=!e.file||e.isInternalFont,o=ua()[e.name];if(g&&r&&o&&(g=null),g)e.defaultEncoding=Ui(g);else{const A=!!(4&e.flags),t=!!(32&e.flags);n=Ri,"TrueType"!==e.type||t||(n=Gi),(A||o)&&(n=Si,r&&(/Symbol/i.test(e.name)?n=Ni:/Dingbats/i.test(e.name)?n=xi:/Wingdings/i.test(e.name)&&(n=Gi))),e.defaultEncoding=n}e.differences=s,e.baseEncodingName=g,e.hasEncoding=!!g||s.length>0,e.dict=A,e.toUnicode=await a;const I=await this.buildToUnicode(e);return e.toUnicode=I,i&&(e.cidToGidMap=this.readCidToGidMap(i,I)),e}_simpleFontToUnicode(A,e=!1){G(!A.composite,"Must be a simple font.");const t=[],i=A.defaultEncoding.slice(),a=A.baseEncodingName,s=A.differences;for(const A in s){const e=s[A];".notdef"!==e&&(i[A]=e)}const n=Aa();for(const s in i){let g=i[s];if(""===g)continue;let r=n[g];if(void 0!==r){t[s]=String.fromCharCode(r);continue}let o=0;switch(g[0]){case"G":3===g.length&&(o=parseInt(g.substring(1),16));break;case"g":5===g.length&&(o=parseInt(g.substring(1),16));break;case"C":case"c":if(g.length>=3&&g.length<=4){const t=g.substring(1);if(e){o=parseInt(t,16);break}if(o=+t,Number.isNaN(o)&&Number.isInteger(parseInt(t,16)))return this._simpleFontToUnicode(A,!0)}break;case"u":r=ia(g,n),-1!==r&&(o=r);break;default:switch(g){case"f_h":case"f_t":case"T_h":t[s]=g.replaceAll("_","");continue}}if(o>0&&o<=1114111&&Number.isInteger(o)){if(a&&o===+s){const A=Ui(a);if(A&&(g=A[s])){t[s]=String.fromCharCode(n[g]);continue}}t[s]=String.fromCodePoint(o)}}return t}async buildToUnicode(A){if(A.hasIncludedToUnicodeMap=A.toUnicode?.length>0,A.hasIncludedToUnicodeMap)return!A.composite&&A.hasEncoding&&(A.fallbackToUnicode=this._simpleFontToUnicode(A)),A.toUnicode;if(!A.composite)return new wa(this._simpleFontToUnicode(A));if(A.composite&&(A.cMap.builtInCMap&&!(A.cMap instanceof oi)||"Adobe"===A.cidSystemInfo?.registry&&("GB1"===A.cidSystemInfo.ordering||"CNS1"===A.cidSystemInfo.ordering||"Japan1"===A.cidSystemInfo.ordering||"Korea1"===A.cidSystemInfo.ordering))){const{registry:e,ordering:t}=A.cidSystemInfo,i=rA.get(`${e}-${t}-UCS2`),a=await yi.create({encoding:i,fetchBuiltInCMap:this._fetchBuiltInCMapBound,useCMap:null}),s=[],n=[];return A.cMap.forEach((function(A,e){if(e>65535)throw new v("Max size of CID is 65,535");const t=a.lookup(e);if(t){n.length=0;for(let A=0,e=t.length;A>1;(0!==a||e.has(s))&&(t[s]=a)}return t}extractWidths(A,e,t){const i=this.xref;let a=[],s=0;const n=[];let g;if(t.composite){const e=A.get("DW");s="number"==typeof e?Math.ceil(e):1e3;const r=A.get("W");if(Array.isArray(r))for(let A=0,e=r.length;A{const e=r.get(A),a=new zg;return i.getOperatorList({stream:e,task:t,resources:o,operatorList:a}).then((()=>{49===a.fnArray[0]&&this._removeType3ColorOperators(a,h),I[A]=a.getIR();for(const A of a.dependencies)n.add(A)})).catch((function(e){S(`Type3 font resource "${A}" is not available.`);const t=new zg;I[A]=t.getIR()}))}));return this.type3Loaded=g.then((()=>{s.charProcOperatorList=I,this._bbox&&(s.isCharBBox=!0,s.bbox=this._bbox)})),this.type3Loaded}_removeType3ColorOperators(A,e=NaN){const t=X.normalizeRect(A.argsArray[0].slice(2)),i=t[2]-t[0],a=t[3]-t[1],s=Math.hypot(i,a);0===i||0===a?(A.fnArray.splice(0,1),A.argsArray.splice(0,1)):(0===e||Math.round(s/e)>=10)&&(this._bbox||(this._bbox=[1/0,1/0,-1/0,-1/0]),this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[2]),this._bbox[3]=Math.max(this._bbox[3],t[3]));let n=0,g=A.length;for(;n=13&&s<=28,a.variableArgs)g>n&&F(`Command ${i}: expected [0, ${n}] args, but received ${g} args.`);else{if(g!==n){const A=this.nonProcessedArgs;for(;g>n;)A.push(e.shift()),g--;for(;gcr.MAX_INVALID_PATH_OPS)throw new v(`Invalid ${A}`);S(`Skipping ${A}`),null!==e&&(e.length=0);continue}}return this.preprocessCommand(s,e),A.fn=s,A.args=e,!0}if(t===aA)return!1;if(null!==t&&(null===e&&(e=[]),e.push(t),e.length>33))throw new v("Too many arguments")}}preprocessCommand(A,e){switch(0|A){case Q:this.stateManager.save();break;case l:this.stateManager.restore();break;case E:this.stateManager.transform(e)}}}class Cr extends cr{constructor(A){super(new ae(A))}parse(){const A={fn:0,args:[]},e={fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3)};try{for(;A.args.length=0,this.read(A);){if(0!==this.savedStatesDepth)continue;const{fn:t,args:i}=A;switch(0|t){case u:const[A,t]=i;A instanceof rA&&(e.fontName=A.name),"number"==typeof t&&t>0&&(e.fontSize=t);break;case p:re.singletons.rgb.getRgbItem(i,0,e.fontColor,0);break;case 57:re.singletons.gray.getRgbItem(i,0,e.fontColor,0);break;case 61:re.singletons.cmyk.getRgbItem(i,0,e.fontColor,0)}}}catch(A){S(`parseDefaultAppearance - ignoring errors: "${A}".`)}return e}}function Br(A){return new Cr(A).parse()}class hr extends cr{constructor(A,e,t){super(A),this.stream=A,this.evaluatorOptions=e,this.xref=t,this.resources=A.dict?.get("Resources")}parse(){const A={fn:0,args:[]};let e={scaleFactor:1,fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3),fillColorSpace:re.singletons.gray},t=!1;const i=[];try{for(;A.args.length=0,!t&&this.read(A);){const{fn:a,args:s}=A;switch(0|a){case Q:i.push({scaleFactor:e.scaleFactor,fontSize:e.fontSize,fontName:e.fontName,fontColor:e.fontColor.slice(),fillColorSpace:e.fillColorSpace});break;case l:e=i.pop()||e;break;case 42:e.scaleFactor*=Math.hypot(s[0],s[1]);break;case u:const[A,a]=s;A instanceof rA&&(e.fontName=A.name),"number"==typeof a&&a>0&&(e.fontSize=a*e.scaleFactor);break;case 51:e.fillColorSpace=re.parse({cs:s[0],xref:this.xref,resources:this.resources,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:this._localColorSpaceCache});break;case 54:e.fillColorSpace.getRgbItem(s,0,e.fontColor,0);break;case p:re.singletons.rgb.getRgbItem(s,0,e.fontColor,0);break;case 57:re.singletons.gray.getRgbItem(s,0,e.fontColor,0);break;case 61:re.singletons.cmyk.getRgbItem(s,0,e.fontColor,0);break;case d:case 45:case 46:case 47:t=!0}}}catch(A){S(`parseAppearanceStream - ignoring errors: "${A}".`)}return this.stream.reset(),delete e.scaleFactor,delete e.fillColorSpace,e}get _localColorSpaceCache(){return x(this,"_localColorSpaceCache",new zn)}get _pdfFunctionFactory(){return x(this,"_pdfFunctionFactory",new ig({xref:this.xref,isEvalSupported:this.evaluatorOptions.isEvalSupported}))}}function Qr(A,e){return A[0]===A[1]&&A[1]===A[2]?`${jA(A[0]/255)} ${e?"g":"G"}`:Array.from(A,(A=>jA(A/255))).join(" ")+" "+(e?"rg":"RG")}class lr{constructor(A,e){this.xref=A,this.widths=null,this.firstChar=1/0,this.lastChar=-1/0,this.fontFamily=e;const t=new OffscreenCanvas(1,1);this.ctxMeasure=t.getContext("2d",{willReadFrequently:!0}),lr._fontNameId||(lr._fontNameId=1),this.fontName=rA.get(`InvalidPDFjsFont_${e}_${lr._fontNameId++}`)}get fontDescriptorRef(){if(!lr._fontDescriptorRef){const A=new cA(this.xref);A.set("Type",rA.get("FontDescriptor")),A.set("FontName",this.fontName),A.set("FontFamily","MyriadPro Regular"),A.set("FontBBox",[0,0,0,0]),A.set("FontStretch",rA.get("Normal")),A.set("FontWeight",400),A.set("ItalicAngle",0),lr._fontDescriptorRef=this.xref.getNewPersistentRef(A)}return lr._fontDescriptorRef}get descendantFontRef(){const A=new cA(this.xref);A.set("BaseFont",this.fontName),A.set("Type",rA.get("Font")),A.set("Subtype",rA.get("CIDFontType0")),A.set("CIDToGIDMap",rA.get("Identity")),A.set("FirstChar",this.firstChar),A.set("LastChar",this.lastChar),A.set("FontDescriptor",this.fontDescriptorRef),A.set("DW",1e3);const e=[],t=[...this.widths.entries()].sort();let i=null,a=null;for(const[A,s]of t)i?A===i+a.length?a.push(s):(e.push(i,a),i=A,a=[s]):(i=A,a=[s]);i&&e.push(i,a),A.set("W",e);const s=new cA(this.xref);return s.set("Ordering","Identity"),s.set("Registry","Adobe"),s.set("Supplement",0),A.set("CIDSystemInfo",s),this.xref.getNewPersistentRef(A)}get baseFontRef(){const A=new cA(this.xref);return A.set("BaseFont",this.fontName),A.set("Type",rA.get("Font")),A.set("Subtype",rA.get("Type0")),A.set("Encoding",rA.get("Identity-H")),A.set("DescendantFonts",[this.descendantFontRef]),A.set("ToUnicode",rA.get("Identity-H")),this.xref.getNewPersistentRef(A)}get resources(){const A=new cA(this.xref),e=new cA(this.xref);return e.set(this.fontName.name,this.baseFontRef),A.set("Font",e),A}_createContext(){return this.widths=new Map,this.ctxMeasure.font=`1000px ${this.fontFamily}`,this.ctxMeasure}createFontResources(A){const e=this._createContext();for(const t of A.split(/\r\n?|\n/))for(const A of t.split("")){const t=A.charCodeAt(0);if(this.widths.has(t))continue;const i=e.measureText(A),a=Math.ceil(i.width);this.widths.set(t,a),this.firstChar=Math.min(t,this.firstChar),this.lastChar=Math.max(t,this.lastChar)}return this.resources}static getFirstPositionInfo(A,e,t){const[i,a,n,g]=A;let r=n-i,o=g-a;e%180!=0&&([r,o]=[o,r]);const I=s*t;return{coords:[0,o+.35*t-I],bbox:[0,0,r,o],matrix:0!==e?ee(e,o,I):void 0}}createAppearance(A,e,t,i,a,n){const g=this._createContext(),r=[];let o=-1/0;for(const e of A.split(/\r\n?|\n/)){r.push(e);const A=g.measureText(e).width;o=Math.max(o,A);for(const A of WA(e)){const e=String.fromCodePoint(A);let t=this.widths.get(A);if(void 0===t){const i=g.measureText(e);t=Math.ceil(i.width),this.widths.set(A,t),this.firstChar=Math.min(A,this.firstChar),this.lastChar=Math.max(A,this.lastChar)}}}o*=i/1e3;const[I,c,C,B]=e;let h=C-I,Q=B-c;t%180!=0&&([h,Q]=[Q,h]);let l=1;o>h&&(l=h/o);let E=1;const u=s*i,d=.35*i,f=u*r.length;f>Q&&(E=Q/f);const p=i*Math.min(l,E),m=["q",`0 0 ${jA(h)} ${jA(Q)} re W n`,"BT",`1 0 0 1 0 ${jA(Q+d)} Tm 0 Tc ${Qr(a,!0)}`,`/${this.fontName.name} ${jA(p)} Tf`],{resources:y}=this;if(1!==(n="number"==typeof n&&n>=0&&n<=1?n:1)){m.push("/R0 gs");const A=new cA(this.xref),e=new cA(this.xref);e.set("ca",n),e.set("CA",n),e.set("Type",rA.get("ExtGState")),A.set("R0",e),y.set("ExtGState",A)}const w=jA(u);for(const A of r)m.push(`0 -${w} Td <${$A(A)}> Tj`);m.push("ET","Q");const D=m.join("\n"),b=new cA(this.xref);if(b.set("Subtype",rA.get("Form")),b.set("Type",rA.get("XObject")),b.set("BBox",[0,0,h,Q]),b.set("Length",D.length),b.set("Resources",y),t){const A=ee(t,h,Q);b.set("Matrix",A)}const k=new ae(D);return k.dict=b,k}}class Er{constructor(A,e,t){this.root=A,this.xref=e,this._type=t}getAll(){const A=new Map;if(!this.root)return A;const e=this.xref,t=new BA;t.put(this.root);const i=[this.root];for(;i.length>0;){const a=e.fetchIfRef(i.shift());if(!(a instanceof cA))continue;if(a.has("Kids")){const A=a.get("Kids");if(!Array.isArray(A))continue;for(const e of A){if(t.has(e))throw new v(`Duplicate entry in "${this._type}" tree.`);i.push(e),t.put(e)}continue}const s=a.get(this._type);if(Array.isArray(s))for(let t=0,i=s.length;t10)return S(`Search depth limit reached for "${this._type}" tree.`),null;const a=t.get("Kids");if(!Array.isArray(a))return null;let s=0,n=a.length-1;for(;s<=n;){const i=s+n>>1,g=e.fetchIfRef(a[i]),r=g.get("Limits");if(Ae.fetchIfRef(r[1]))){t=g;break}s=i+1}}if(s>n)return null}const a=t.get(this._type);if(Array.isArray(a)){let t=0,i=a.length-2;for(;t<=i;){const s=t+i>>1,n=s+(1&s),g=e.fetchIfRef(a[n]);if(Ag))return e.fetchIfRef(a[n+1]);t=n+2}}}return null}}class ur extends Er{constructor(A,e){super(A,e,"Names")}}class dr extends Er{constructor(A,e){super(A,e,"Nums")}}function fr(){js=Object.create(null),sA=Object.create(null),nA=Object.create(null),gA=Object.create(null),ga.clear(),jt.cleanup()}function pr(A){return A instanceof cA?A.has("UF")?A.get("UF"):A.has("F")?A.get("F"):A.has("Unix")?A.get("Unix"):A.has("Mac")?A.get("Mac"):A.has("DOS")?A.get("DOS"):null:null}class mr{#F=!1;constructor(A,e,t=!1){A instanceof cA&&(this.xref=e,this.root=A,A.has("FS")&&(this.fs=A.get("FS")),A.has("RF")&&S("Related file specifications are not supported"),t||(A.has("EF")?this.#F=!0:S("Non-embedded file specifications are not supported")))}get filename(){let A="";const e=pr(this.root);return e&&"string"==typeof e&&(A=j(e).replaceAll("\\\\","\\").replaceAll("\\/","/").replaceAll("\\","/")),x(this,"filename",A||"unnamed")}get content(){if(!this.#F)return null;this._contentRef||=pr(this.root?.get("EF"));let A=null;if(this._contentRef){const e=this.xref.fetchIfRef(this._contentRef);e instanceof dA?A=e.getBytes():S("Embedded file specification points to non-existing/invalid content")}else S("Embedded file specification does not have any content");return A}get description(){let A="";const e=this.root?.get("Desc");return e&&"string"==typeof e&&(A=j(e)),x(this,"description",A)}get serializable(){return{rawFilename:this.filename,filename:(A=this.filename,A.substring(A.lastIndexOf("/")+1)),content:this.content,description:this.description};var A}}function yr(A,e){const t=A[e];return" "===t||"\n"===t||"\r"===t||"\t"===t}class wr{_resolveEntities(A){return A.replaceAll(/&([^;]+);/g,((A,e)=>{if("#x"===e.substring(0,2))return String.fromCodePoint(parseInt(e.substring(2),16));if("#"===e.substring(0,1))return String.fromCodePoint(parseInt(e.substring(1),10));switch(e){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return'"';case"apos":return"'"}return this.onResolveEntity(e)}))}_parseContent(A,e){const t=[];let i=e;function a(){for(;i"!==A[i]&&"/"!==A[i];)++i;const s=A.substring(e,i);for(a();i"!==A[i]&&"/"!==A[i]&&"?"!==A[i];){a();let e="",s="";for(;i"!==A[t]&&"?"!==A[t]&&"/"!==A[t];)++t;const i=A.substring(e,t);!function(){for(;t"!==A[t+1]);)++t;return{name:i,value:A.substring(a,t),parsed:t-e}}parseXml(A){let e=0;for(;e",t),e<0)return void this.onError(-9);this.onEndElement(A.substring(t,e)),t=e+1;break;case"?":++t;const i=this._parseProcessingInstruction(A,t);if("?>"!==A.substring(t+i.parsed,t+i.parsed+2))return void this.onError(-3);this.onPi(i.name,i.value),t+=i.parsed+2;break;case"!":if("--"===A.substring(t+1,t+3)){if(e=A.indexOf("--\x3e",t+3),e<0)return void this.onError(-5);this.onComment(A.substring(t+3,e)),t=e+3}else if("[CDATA["===A.substring(t+1,t+8)){if(e=A.indexOf("]]>",t+8),e<0)return void this.onError(-2);this.onCdata(A.substring(t+8,e)),t=e+3}else{if("DOCTYPE"!==A.substring(t+1,t+8))return void this.onError(-6);{const i=A.indexOf("[",t+8);let a=!1;if(e=A.indexOf(">",t+8),e<0)return void this.onError(-4);if(i>0&&e>i){if(e=A.indexOf("]>",t+8),e<0)return void this.onError(-4);a=!0}const s=A.substring(t+8,e+(a?1:0));this.onDoctype(s),t=e+(a?2:1)}}break;default:const a=this._parseContent(A,t);if(null===a)return void this.onError(-6);let s=!1;if("/>"===A.substring(t+a.parsed,t+a.parsed+2))s=!0;else if(">"!==A.substring(t+a.parsed,t+a.parsed+1))return void this.onError(-9);this.onBeginElement(a.name,a.attributes,s),t+=a.parsed+(s?2:1)}}else{for(;t0}searchNode(A,e){if(e>=A.length)return this;const t=A[e];if(t.name.startsWith("#")&&e0)i.push([a,0]),a=a.childNodes[0];else{if(0===i.length)return null;for(;0!==i.length;){const[A,e]=i.pop(),t=e+1;if(t");for(const e of this.childNodes)e.dump(A);A.push(``)}else this.nodeValue?A.push(`>${ZA(this.nodeValue)}`):A.push("/>")}else A.push(ZA(this.nodeValue))}}class br extends wr{constructor({hasAttributes:A=!1,lowerCaseName:e=!1}){super(),this._currentFragment=null,this._stack=null,this._errorCode=0,this._hasAttributes=A,this._lowerCaseName=e}parseFromString(A){if(this._currentFragment=[],this._stack=[],this._errorCode=0,this.parseXml(A),0!==this._errorCode)return;const[e]=this._currentFragment;return e?{documentElement:e}:void 0}onText(A){if(function(A){for(let e=0,t=A.length;e\\376\\377([^<]+)/g,(function(A,e){const t=e.replaceAll(/\\([0-3])([0-7])([0-7])/g,(function(A,e,t,i){return String.fromCharCode(64*e+8*t+1*i)})).replaceAll(/&(amp|apos|gt|lt|quot);/g,(function(A,e){switch(e){case"amp":return"&";case"apos":return"'";case"gt":return">";case"lt":return"<";case"quot":return'"'}throw new Error(`_repair: ${e} isn't defined.`)})),i=[">"];for(let A=0,e=t.length;A=32&&e<127&&60!==e&&62!==e&&38!==e?i.push(String.fromCharCode(e)):i.push("&#x"+(65536+e).toString(16).substring(1)+";")}return i.join("")}))}_getSequence(A){const e=A.nodeName;return"rdf:bag"!==e&&"rdf:seq"!==e&&"rdf:alt"!==e?null:A.childNodes.filter((A=>"rdf:li"===A.nodeName))}_parseArray(A){if(!A.hasChildNodes())return;const[e]=A.childNodes,t=this._getSequence(e)||[];this._metadataMap.set(A.nodeName,t.map((A=>A.textContent.trim())))}_parse(A){let e=A.documentElement;if("rdf:rdf"!==e.nodeName)for(e=e.firstChild;e&&"rdf:rdf"!==e.nodeName;)e=e.nextSibling;if(e&&"rdf:rdf"===e.nodeName&&e.hasChildNodes())for(const A of e.childNodes)if("rdf:description"===A.nodeName)for(const e of A.childNodes){const A=e.nodeName;switch(A){case"#text":continue;case"dc:creator":case"dc:subject":this._parseArray(e);continue}this._metadataMap.set(A,e.textContent.trim())}}get serializable(){return{parsedData:this._metadataMap,rawData:this._data}}}class Fr extends ke{constructor(A,e,t){super(e),this.str=A,this.dict=A.dict,this.decrypt=t,this.nextChunk=null,this.initialized=!1}readBlock(){let A;if(this.initialized?A=this.nextChunk:(A=this.str.getBytes(512),this.initialized=!0),!A||0===A.length)return void(this.eof=!0);this.nextChunk=this.str.getBytes(512);const e=this.nextChunk?.length>0;A=(0,this.decrypt)(A,!e);const t=this.bufferLength,i=t+A.length;this.ensureBuffer(i).set(A,t),this.bufferLength=i}}class Sr{constructor(A){this.a=0,this.b=0;const e=new Uint8Array(256),t=A.length;for(let A=0;A<256;++A)e[A]=A;for(let i=0,a=0;i<256;++i){const s=e[i];a=a+s+A[i%t]&255,e[i]=e[a],e[a]=s}this.s=e}encryptBlock(A){let e=this.a,t=this.b;const i=this.s,a=A.length,s=new Uint8Array(a);for(let n=0;n>5&255,I[c++]=a>>13&255,I[c++]=a>>21&255,I[c++]=a>>>29&255,I[c++]=0,I[c++]=0,I[c++]=0;const h=new Int32Array(16);for(c=0;c>>32-g)|0,a=s}s=s+a|0,n=n+o|0,g=g+B|0,r=r+Q|0}return new Uint8Array([255&s,s>>8&255,s>>16&255,s>>>24&255,255&n,n>>8&255,n>>16&255,n>>>24&255,255&g,g>>8&255,g>>16&255,g>>>24&255,255&r,r>>8&255,r>>16&255,r>>>24&255])}}();class Gr{constructor(A,e){this.high=0|A,this.low=0|e}and(A){this.high&=A.high,this.low&=A.low}xor(A){this.high^=A.high,this.low^=A.low}or(A){this.high|=A.high,this.low|=A.low}shiftRight(A){A>=32?(this.low=this.high>>>A-32|0,this.high=0):(this.low=this.low>>>A|this.high<<32-A,this.high=this.high>>>A|0)}shiftLeft(A){A>=32?(this.high=this.low<>>32-A,this.low<<=A)}rotateRight(A){let e,t;32&A?(t=this.low,e=this.high):(e=this.low,t=this.high),A&=31,this.low=e>>>A|t<<32-A,this.high=t>>>A|e<<32-A}not(){this.high=~this.high,this.low=~this.low}add(A){const e=(this.low>>>0)+(A.low>>>0);let t=(this.high>>>0)+(A.high>>>0);e>4294967295&&(t+=1),this.low=0|e,this.high=0|t}copyTo(A,e){A[e]=this.high>>>24&255,A[e+1]=this.high>>16&255,A[e+2]=this.high>>8&255,A[e+3]=255&this.high,A[e+4]=this.low>>>24&255,A[e+5]=this.low>>16&255,A[e+6]=this.low>>8&255,A[e+7]=255&this.low}assign(A){this.high=A.high,this.low=A.low}}const Nr=function(){function A(A,e){return A>>>e|A<<32-e}function e(A,e,t){return A&e^~A&t}function t(A,e,t){return A&e^A&t^e&t}function i(e){return A(e,2)^A(e,13)^A(e,22)}function a(e){return A(e,6)^A(e,11)^A(e,25)}function s(e){return A(e,7)^A(e,18)^e>>>3}const n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];return function(g,r,o){let I=1779033703,c=3144134277,C=1013904242,B=2773480762,h=1359893119,Q=2600822924,l=528734635,E=1541459225;const u=64*Math.ceil((o+9)/64),d=new Uint8Array(u);let f,p;for(f=0;f>>29&255,d[f++]=o>>21&255,d[f++]=o>>13&255,d[f++]=o>>5&255,d[f++]=o<<3&255;const y=new Uint32Array(64);for(f=0;f>>10)+y[p-7]+s(y[p-15])+y[p-16];let g,r,o=I,u=c,m=C,D=B,b=h,k=Q,F=l,S=E;for(p=0;p<64;++p)g=S+a(b)+e(b,k,F)+n[p]+y[p],r=i(o)+t(o,u,m),S=F,F=k,k=b,b=D+g|0,D=m,m=u,u=o,o=g+r|0;I=I+o|0,c=c+u|0,C=C+m|0,B=B+D|0,h=h+b|0,Q=Q+k|0,l=l+F|0,E=E+S|0}var w;return new Uint8Array([I>>24&255,I>>16&255,I>>8&255,255&I,c>>24&255,c>>16&255,c>>8&255,255&c,C>>24&255,C>>16&255,C>>8&255,255&C,B>>24&255,B>>16&255,B>>8&255,255&B,h>>24&255,h>>16&255,h>>8&255,255&h,Q>>24&255,Q>>16&255,Q>>8&255,255&Q,l>>24&255,l>>16&255,l>>8&255,255&l,E>>24&255,E>>16&255,E>>8&255,255&E])}}(),xr=function(){function A(A,e,t,i,a){A.assign(e),A.and(t),a.assign(e),a.not(),a.and(i),A.xor(a)}function e(A,e,t,i,a){A.assign(e),A.and(t),a.assign(e),a.and(i),A.xor(a),a.assign(t),a.and(i),A.xor(a)}function t(A,e,t){A.assign(e),A.rotateRight(28),t.assign(e),t.rotateRight(34),A.xor(t),t.assign(e),t.rotateRight(39),A.xor(t)}function i(A,e,t){A.assign(e),A.rotateRight(14),t.assign(e),t.rotateRight(18),A.xor(t),t.assign(e),t.rotateRight(41),A.xor(t)}function a(A,e,t){A.assign(e),A.rotateRight(1),t.assign(e),t.rotateRight(8),A.xor(t),t.assign(e),t.shiftRight(7),A.xor(t)}function s(A,e,t){A.assign(e),A.rotateRight(19),t.assign(e),t.rotateRight(61),A.xor(t),t.assign(e),t.shiftRight(6),A.xor(t)}const n=[new Gr(1116352408,3609767458),new Gr(1899447441,602891725),new Gr(3049323471,3964484399),new Gr(3921009573,2173295548),new Gr(961987163,4081628472),new Gr(1508970993,3053834265),new Gr(2453635748,2937671579),new Gr(2870763221,3664609560),new Gr(3624381080,2734883394),new Gr(310598401,1164996542),new Gr(607225278,1323610764),new Gr(1426881987,3590304994),new Gr(1925078388,4068182383),new Gr(2162078206,991336113),new Gr(2614888103,633803317),new Gr(3248222580,3479774868),new Gr(3835390401,2666613458),new Gr(4022224774,944711139),new Gr(264347078,2341262773),new Gr(604807628,2007800933),new Gr(770255983,1495990901),new Gr(1249150122,1856431235),new Gr(1555081692,3175218132),new Gr(1996064986,2198950837),new Gr(2554220882,3999719339),new Gr(2821834349,766784016),new Gr(2952996808,2566594879),new Gr(3210313671,3203337956),new Gr(3336571891,1034457026),new Gr(3584528711,2466948901),new Gr(113926993,3758326383),new Gr(338241895,168717936),new Gr(666307205,1188179964),new Gr(773529912,1546045734),new Gr(1294757372,1522805485),new Gr(1396182291,2643833823),new Gr(1695183700,2343527390),new Gr(1986661051,1014477480),new Gr(2177026350,1206759142),new Gr(2456956037,344077627),new Gr(2730485921,1290863460),new Gr(2820302411,3158454273),new Gr(3259730800,3505952657),new Gr(3345764771,106217008),new Gr(3516065817,3606008344),new Gr(3600352804,1432725776),new Gr(4094571909,1467031594),new Gr(275423344,851169720),new Gr(430227734,3100823752),new Gr(506948616,1363258195),new Gr(659060556,3750685593),new Gr(883997877,3785050280),new Gr(958139571,3318307427),new Gr(1322822218,3812723403),new Gr(1537002063,2003034995),new Gr(1747873779,3602036899),new Gr(1955562222,1575990012),new Gr(2024104815,1125592928),new Gr(2227730452,2716904306),new Gr(2361852424,442776044),new Gr(2428436474,593698344),new Gr(2756734187,3733110249),new Gr(3204031479,2999351573),new Gr(3329325298,3815920427),new Gr(3391569614,3928383900),new Gr(3515267271,566280711),new Gr(3940187606,3454069534),new Gr(4118630271,4000239992),new Gr(116418474,1914138554),new Gr(174292421,2731055270),new Gr(289380356,3203993006),new Gr(460393269,320620315),new Gr(685471733,587496836),new Gr(852142971,1086792851),new Gr(1017036298,365543100),new Gr(1126000580,2618297676),new Gr(1288033470,3409855158),new Gr(1501505948,4234509866),new Gr(1607167915,987167468),new Gr(1816402316,1246189591)];return function(g,r,o,I=!1){let c,C,B,h,Q,l,E,u;I?(c=new Gr(3418070365,3238371032),C=new Gr(1654270250,914150663),B=new Gr(2438529370,812702999),h=new Gr(355462360,4144912697),Q=new Gr(1731405415,4290775857),l=new Gr(2394180231,1750603025),E=new Gr(3675008525,1694076839),u=new Gr(1203062813,3204075428)):(c=new Gr(1779033703,4089235720),C=new Gr(3144134277,2227873595),B=new Gr(1013904242,4271175723),h=new Gr(2773480762,1595750129),Q=new Gr(1359893119,2917565137),l=new Gr(2600822924,725511199),E=new Gr(528734635,4215389547),u=new Gr(1541459225,327033209));const d=128*Math.ceil((o+17)/128),f=new Uint8Array(d);let p,m;for(p=0;p>>29&255,f[p++]=o>>21&255,f[p++]=o>>13&255,f[p++]=o>>5&255,f[p++]=o<<3&255;const w=new Array(80);for(p=0;p<80;p++)w[p]=new Gr(0,0);let D=new Gr(0,0),b=new Gr(0,0),k=new Gr(0,0),F=new Gr(0,0),S=new Gr(0,0),R=new Gr(0,0),G=new Gr(0,0),N=new Gr(0,0);const x=new Gr(0,0),U=new Gr(0,0),M=new Gr(0,0),L=new Gr(0,0);let J,H;for(p=0;p=1;--A){t=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=t,t=s[14],i=s[10],s[14]=s[6],s[10]=s[2],s[6]=t,s[2]=i,t=s[15],i=s[11],a=s[7],s[15]=s[3],s[11]=t,s[7]=i,s[3]=a;for(let A=0;A<16;++A)s[A]=this._inv_s[s[A]];for(let t=0,i=16*A;t<16;++t,++i)s[t]^=e[i];for(let A=0;A<16;A+=4){const e=this._mix[s[A]],i=this._mix[s[A+1]],a=this._mix[s[A+2]],n=this._mix[s[A+3]];t=e^i>>>8^i<<24^a>>>16^a<<16^n>>>24^n<<8,s[A]=t>>>24&255,s[A+1]=t>>16&255,s[A+2]=t>>8&255,s[A+3]=255&t}}t=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=t,t=s[14],i=s[10],s[14]=s[6],s[10]=s[2],s[6]=t,s[2]=i,t=s[15],i=s[11],a=s[7],s[15]=s[3],s[11]=t,s[7]=i,s[3]=a;for(let A=0;A<16;++A)s[A]=this._inv_s[s[A]],s[A]^=e[A];return s}_encrypt(A,e){const t=this._s;let i,a,s;const n=new Uint8Array(16);n.set(A);for(let A=0;A<16;++A)n[A]^=e[A];for(let A=1;A=i;--t)if(A[t]!==e){e=0;break}g-=e,s[s.length-1]=A.subarray(0,16-e)}}const r=new Uint8Array(g);for(let A=0,e=0,t=s.length;A=256&&(g=255&(27^g)));for(let e=0;e<4;++e)t[A]=i^=t[A-32],A++,t[A]=a^=t[A-32],A++,t[A]=s^=t[A-32],A++,t[A]=n^=t[A-32],A++}return t}}class Hr{checkOwnerPassword(A,e,t,i){const a=new Uint8Array(A.length+56);return a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length),$(Nr(a,0,a.length),i)}checkUserPassword(A,e,t){const i=new Uint8Array(A.length+8);return i.set(A,0),i.set(e,A.length),$(Nr(i,0,i.length),t)}getOwnerKey(A,e,t,i){const a=new Uint8Array(A.length+56);a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length);const s=Nr(a,0,a.length);return new Jr(s).decryptBlock(i,!1,new Uint8Array(16))}getUserKey(A,e,t){const i=new Uint8Array(A.length+8);i.set(A,0),i.set(e,A.length);const a=Nr(i,0,i.length);return new Jr(a).decryptBlock(t,!1,new Uint8Array(16))}}class Yr{_hash(A,e,t){let i=Nr(e,0,e.length).subarray(0,32),a=[0],s=0;for(;s<64||a.at(-1)>s-32;){const e=A.length+i.length+t.length,r=new Uint8Array(e);let o=0;r.set(A,o),o+=A.length,r.set(i,o),o+=i.length,r.set(t,o);const I=new Uint8Array(64*e);for(let A=0,t=0;A<64;A++,t+=e)I.set(r,t);a=new Lr(i.subarray(0,16)).encrypt(I,i.subarray(16,32));const c=a.slice(0,16).reduce(((A,e)=>A+e),0)%3;0===c?i=Nr(a,0,a.length):1===c?(n=a,g=a.length,i=xr(n,0,g,!0)):2===c&&(i=xr(a,0,a.length)),s++}var n,g;return i.subarray(0,32)}checkOwnerPassword(A,e,t,i){const a=new Uint8Array(A.length+56);return a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length),$(this._hash(A,a,t),i)}checkUserPassword(A,e,t){const i=new Uint8Array(A.length+8);return i.set(A,0),i.set(e,A.length),$(this._hash(A,i,[]),t)}getOwnerKey(A,e,t,i){const a=new Uint8Array(A.length+56);a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length);const s=this._hash(A,a,t);return new Jr(s).decryptBlock(i,!1,new Uint8Array(16))}getUserKey(A,e,t){const i=new Uint8Array(A.length+8);i.set(A,0),i.set(e,A.length);const a=this._hash(A,i,[]);return new Jr(a).decryptBlock(t,!1,new Uint8Array(16))}}class vr{constructor(A,e){this.StringCipherConstructor=A,this.StreamCipherConstructor=e}createStream(A,e){const t=new this.StreamCipherConstructor;return new Fr(A,e,(function(A,e){return t.decryptBlock(A,e)}))}decryptString(A){const e=new this.StringCipherConstructor;let t=T(A);return t=e.decryptBlock(t,!0),q(t)}encryptString(A){const e=new this.StringCipherConstructor;if(e instanceof Mr){const t=16-A.length%16;A+=String.fromCharCode(t).repeat(t);const i=new Uint8Array(16);if("undefined"!=typeof crypto)crypto.getRandomValues(i);else for(let A=0;A<16;A++)i[A]=Math.floor(256*Math.random());let a=T(A);a=e.encrypt(a,i);const s=new Uint8Array(16+a.length);return s.set(i),s.set(a,16),q(s)}let t=T(A);return t=e.encrypt(t),q(t)}}class Kr{static#S=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]);#R(A,e,t,i,a,s,n,g,r,o,I,c){if(e){const A=Math.min(127,e.length);e=e.subarray(0,A)}else e=[];const C=6===A?new Yr:new Hr;return C.checkUserPassword(e,g,n)?C.getUserKey(e,r,I):e.length&&C.checkOwnerPassword(e,i,s,t)?C.getOwnerKey(e,a,s,o):null}#G(A,e,t,i,a,s,n,g){const r=40+t.length+A.length,o=new Uint8Array(r);let I,c,C=0;if(e)for(c=Math.min(32,e.length);C>8&255,o[C++]=a>>16&255,o[C++]=a>>>24&255,I=0,c=A.length;I=4&&!g&&(o[C++]=255,o[C++]=255,o[C++]=255,o[C++]=255);let B=Rr(o,0,C);const h=n>>3;if(s>=3)for(I=0;I<50;++I)B=Rr(B,0,h);const Q=B.subarray(0,h);let l,E;if(s>=3){for(C=0;C<32;++C)o[C]=Kr.#S[C];for(I=0,c=A.length;I>3;if(t>=3)for(g=0;g<50;++g)r=Rr(r,0,r.length);let I,c;if(t>=3){c=e;const A=new Uint8Array(o);for(g=19;g>=0;g--){for(let e=0;e>8&255,a[n++]=A>>16&255,a[n++]=255&e,a[n++]=e>>8&255,i&&(a[n++]=115,a[n++]=65,a[n++]=108,a[n++]=84),Rr(a,0,n).subarray(0,Math.min(t.length+5,16))}#U(A,e,t,i,a){if(!(e instanceof rA))throw new v("Invalid crypt filter name.");const s=this,n=A.get(e.name),g=n?.get("CFM");if(!g||"None"===g.name)return function(){return new Ur};if("V2"===g.name)return function(){return new Sr(s.#x(t,i,a,!1))};if("AESV2"===g.name)return function(){return new Lr(s.#x(t,i,a,!0))};if("AESV3"===g.name)return function(){return new Jr(a)};throw new v("Unknown crypto method")}constructor(A,e,t){const i=A.get("Filter");if(!QA(i,"Standard"))throw new v("unknown encryption method");this.filterName=i.name,this.dict=A;const a=A.get("V");if(!Number.isInteger(a)||1!==a&&2!==a&&4!==a&&5!==a)throw new v("unsupported encryption algorithm");this.algorithm=a;let s=A.get("Length");if(!s)if(a<=3)s=40;else{const e=A.get("CF"),t=A.get("StmF");if(e instanceof cA&&t instanceof rA){e.suppressEncryption=!0;const A=e.get(t.name);s=A?.get("Length")||128,s<40&&(s<<=3)}}if(!Number.isInteger(s)||s<40||s%8!=0)throw new v("invalid key length");const n=T(A.get("O")),g=T(A.get("U")),r=n.subarray(0,32),o=g.subarray(0,32),I=A.get("P"),c=A.get("R"),C=(4===a||5===a)&&!1!==A.get("EncryptMetadata");this.encryptMetadata=C;const B=T(e);let h,Q;if(t){if(6===c)try{t=_(t)}catch{S("CipherTransformFactory: Unable to convert UTF8 encoded password.")}h=T(t)}if(5!==a)Q=this.#G(B,h,r,o,I,c,s,C);else{const e=n.subarray(32,40),t=n.subarray(40,48),i=g.subarray(0,48),a=g.subarray(32,40),s=g.subarray(40,48),I=T(A.get("OE")),C=T(A.get("UE")),B=T(A.get("Perms"));Q=this.#R(c,h,r,e,t,i,o,a,s,I,C,B)}if(!Q&&!t)throw new M("No password given",1);if(!Q&&t){const A=this.#N(h,r,c,s);Q=this.#G(B,A,r,o,I,c,s,C)}if(!Q)throw new M("Incorrect Password",2);if(this.encryptionKey=Q,a>=4){const e=A.get("CF");e instanceof cA&&(e.suppressEncryption=!0),this.cf=e,this.stmf=A.get("StmF")||rA.get("Identity"),this.strf=A.get("StrF")||rA.get("Identity"),this.eff=A.get("EFF")||this.stmf}}createCipherTransform(A,e){if(4===this.algorithm||5===this.algorithm)return new vr(this.#U(this.cf,this.strf,A,e,this.encryptionKey),this.#U(this.cf,this.stmf,A,e,this.encryptionKey));const t=this.#x(A,e,this.encryptionKey,!1),i=function(){return new Sr(t)};return new vr(i,i)}}async function qr(A,e,t,{encrypt:i=null}){const a=i?.createCipherTransform(A.num,A.gen);t.push(`${A.num} ${A.gen} obj\n`),e instanceof cA?await Tr(e,t,a):e instanceof dA?await Pr(e,t,a):(Array.isArray(e)||ArrayBuffer.isView(e))&&await Wr(e,t,a),t.push("\nendobj\n")}async function Tr(A,e,t){e.push("<<");for(const i of A.getKeys())e.push(` /${vA(i)} `),await Zr(A.getRaw(i),e,t);e.push(">>")}async function Pr(A,e,t){let i=A.getBytes();const{dict:a}=A,[s,n]=await Promise.all([a.getAsync("Filter"),a.getAsync("DecodeParms")]),g=QA(Array.isArray(s)?await a.xref.fetchIfRefAsync(s[0]):s,"FlateDecode");if(i.length>=256||g)try{const A=new CompressionStream("deflate"),e=A.writable.getWriter();e.write(i),e.close();const t=await new Response(A.readable).arrayBuffer();let r,o;i=new Uint8Array(t),s?g||(r=Array.isArray(s)?[rA.get("FlateDecode"),...s]:[rA.get("FlateDecode"),s],n&&(o=Array.isArray(n)?[null,...n]:[null,n])):r=rA.get("FlateDecode"),r&&a.set("Filter",r),o&&a.set("DecodeParms",o)}catch(A){F(`writeStream - cannot compress data: "${A}".`)}let r=q(i);t&&(r=t.encryptString(r)),a.set("Length",r.length),await Tr(a,e,t),e.push(" stream\n",r,"\nendstream")}async function Wr(A,e,t){e.push("[");let i=!0;for(const a of A)i?i=!1:e.push(" "),await Zr(a,e,t);e.push("]")}async function Zr(A,e,t){A instanceof rA?e.push(`/${vA(A.name)}`):A instanceof CA?e.push(`${A.num} ${A.gen} R`):Array.isArray(A)||ArrayBuffer.isView(A)?await Wr(A,e,t):"string"==typeof A?(t&&(A=t.encryptString(A)),e.push(`(${KA(A)})`)):"number"==typeof A?e.push(jA(A)):"boolean"==typeof A?e.push(A.toString()):A instanceof cA?await Tr(A,e,t):A instanceof dA?await Pr(A,e,t):null===A?e.push("null"):S(`Unhandled value in writer: ${typeof A}, please file a bug.`)}function Or(A,e,t,i){for(let a=e+t-1;a>t-1;a--)i[a]=255&A,A>>=8;return t+e}function Xr(A,e,t){for(let i=0,a=A.length;i0){const i=function(A,e){const t=Math.floor(Date.now()/1e3),i=e.filename||"",a=[t.toString(),i,A.toString()];let s=a.reduce(((A,e)=>A+e.length),0);for(const A of Object.values(e.info))a.push(A),s+=A.length;const n=new Uint8Array(s);let g=0;for(const A of a)Xr(A,g,n),g+=A.length;return q(Rr(n))}(A,e);t.set("ID",[e.fileIds[0],i])}}async function zr({originalData:A,xrefInfo:e,newRefs:t,xref:i=null,hasXfa:a=!1,xfaDatasetsRef:s=null,hasXfaDatasetsEntry:n=!1,needAppearances:g,acroFormRef:r=null,acroForm:o=null,xfaData:I=null,useXrefStream:c=!1}){await async function({xref:A,acroForm:e,acroFormRef:t,hasXfa:i,hasXfaDatasetsEntry:a,xfaDatasetsRef:s,needAppearances:n,newRefs:g}){if(!i||a||s||S("XFA - Cannot save it"),!n&&(!i||!s||a))return;const r=e.clone();if(i&&!a){const A=e.get("XFA").slice();A.splice(2,0,"datasets"),A.splice(3,0,s),r.set("XFA",A)}n&&r.set("NeedAppearances",!0);const o=[];await qr(t,r,o,A),g.push({ref:t,data:o.join("")})}({xref:i,acroForm:o,acroFormRef:r,hasXfa:a,hasXfaDatasetsEntry:n,xfaDatasetsRef:s,needAppearances:g,newRefs:t}),a&&function({xfaData:A,xfaDatasetsRef:e,newRefs:t,xref:i}){null===A&&(A=function(A,e){const t=new br({hasAttributes:!0}).parseFromString(A);for(const{xfa:A}of e){if(!A)continue;const{path:e,value:i}=A;if(!e)continue;const a=YA(e);let s=t.documentElement.searchNode(a,0);!s&&a.length>1&&(s=t.documentElement.searchNode([a.at(-1)],0)),s?s.childNodes=Array.isArray(i)?i.map((A=>new Dr("value",A))):[new Dr("#text",i)]:S(`Node not found for path: ${e}`)}const i=[];return t.documentElement.dump(i),i.join("")}(i.fetchIfRef(e).getString(),t));const a=i.encrypt;a&&(A=a.createCipherTransform(e.num,e.gen).encryptString(A));const s=`${e.num} ${e.gen} obj\n<< /Type /EmbeddedFile /Length ${A.length}>>\nstream\n`+A+"\nendstream\nendobj\n";t.push({ref:e,data:s})}({xfaData:I,xfaDatasetsRef:s,newRefs:t,xref:i});const C=[];let B=A.length;const h=A.at(-1);10!==h&&13!==h&&(C.push("\n"),B+=1);const Q=function(A,e,t){const i=new cA(null);i.set("Prev",A.startXRef);const a=A.newRef;return t?(e.push({ref:a,data:""}),i.set("Size",a.num+1),i.set("Type",rA.get("XRef"))):i.set("Size",a.num),null!==A.rootRef&&i.set("Root",A.rootRef),null!==A.infoRef&&i.set("Info",A.infoRef),null!==A.encryptRef&&i.set("Encrypt",A.encryptRef),i}(e,t,c);t=t.sort(((A,e)=>A.ref.num-e.ref.num));for(const{data:A}of t)null!==A&&C.push(A);await(c?async function(A,e,t,i,a){const s=[];let n=0,g=0;for(const{ref:A,data:i}of t){let t;n=Math.max(n,e),null!==i?(t=Math.min(A.gen,65535),s.push([1,e,t]),e+=i.length):(t=Math.min(A.gen+1,65535),s.push([0,0,t])),g=Math.max(g,t)}i.set("Index",Vr(t));const r=[1,te(n),te(g)];i.set("W",r),jr(e,A,i);const o=r.reduce(((A,e)=>A+e),0),I=new Uint8Array(o*s.length),c=new ie(I);c.dict=i;let C=0;for(const[A,e,t]of s)C=Or(A,r[0],C,I),C=Or(e,r[1],C,I),C=Or(t,r[2],C,I);await qr(A.newRef,c,a,{}),a.push("startxref\n",e.toString(),"\n%%EOF\n")}(e,B,t,Q,C):async function(A,e,t,i,a){a.push("xref\n");const s=Vr(t);let n=0;for(const{ref:A,data:i}of t)A.num===s[n]&&(a.push(`${s[n]} ${s[n+1]}\n`),n+=2),null!==i?(a.push(`${e.toString().padStart(10,"0")} ${Math.min(A.gen,65535).toString().padStart(5,"0")} n\r\n`),e+=i.length):a.push(`0000000000 ${Math.min(A.gen+1,65535).toString().padStart(5,"0")} f\r\n`);jr(e,A,i),a.push("trailer\n"),await Tr(i,a),a.push("\nstartxref\n",e.toString(),"\n%%EOF\n")}(e,B,t,Q,C));const l=C.reduce(((A,e)=>A+e.length),A.length),E=new Uint8Array(l);E.set(A);let u=A.length;for(const A of C)Xr(A,u,E),u+=A.length;return E}class _r{constructor(A,e){this.dict=A,this.ref=e instanceof CA?e:null,this.roleMap=new Map,this.structParentIds=null}init(){this.readRoleMap()}#M(A,e,t){if(!(A instanceof CA)||e<0)return;this.structParentIds||=new hA;let i=this.structParentIds.get(A);i||(i=[],this.structParentIds.put(A,i)),i.push([e,t])}addAnnotationIdToPage(A,e){this.#M(A,e,4)}readRoleMap(){const A=this.dict.get("RoleMap");A instanceof cA&&A.forEach(((A,e)=>{e instanceof rA&&this.roleMap.set(A,e.name)}))}static async canCreateStructureTree({catalogRef:A,pdfManager:e,newAnnotationsByPage:t}){if(!(A instanceof CA))return S("Cannot save the struct tree: no catalog reference."),!1;let i=0,a=!0;for(const[A,s]of t){const{ref:t}=await e.getPage(A);if(!(t instanceof CA)){S(`Cannot save the struct tree: page ${A} has no ref.`),a=!0;break}for(const A of s)A.accessibilityData?.type&&(A.parentTreeId=i++,a=!1)}if(a){for(const A of t.values())for(const e of A)delete e.parentTreeId;return!1}return!0}static async createStructureTree({newAnnotationsByPage:A,xref:e,catalogRef:t,pdfManager:i,newRefs:a}){const s=i.catalog.cloneDict(),n=new hA;n.put(t,s);const g=e.getNewTemporaryRef();s.set("StructTreeRoot",g);const r=new cA(e);r.set("Type",rA.get("StructTreeRoot"));const o=e.getNewTemporaryRef();r.set("ParentTree",o);const I=[];r.set("K",I),n.put(g,r);const c=new cA(e),C=[];c.set("Nums",C);const B=await this.#L({newAnnotationsByPage:A,structTreeRootRef:g,kids:I,nums:C,xref:e,pdfManager:i,cache:n});r.set("ParentTreeNextKey",B),n.put(o,c);const h=[];for(const[A,t]of n.items())h.length=0,await qr(A,t,h,e),a.push({ref:A,data:h.join("")})}async canUpdateStructTree({pdfManager:A,xref:e,newAnnotationsByPage:t}){if(!this.ref)return S("Cannot update the struct tree: no root reference."),!1;let i=this.dict.get("ParentTreeNextKey");if(!Number.isInteger(i)||i<0)return S("Cannot update the struct tree: invalid next key."),!1;const a=this.dict.get("ParentTree");if(!(a instanceof cA))return S("Cannot update the struct tree: ParentTree isn't a dict."),!1;const s=a.get("Nums");if(!Array.isArray(s))return S("Cannot update the struct tree: nums isn't an array."),!1;const n=new dr(a,e);for(const e of t.keys()){const{pageDict:t}=await A.getPage(e);if(!t.has("StructParents"))continue;const i=t.get("StructParents");if(!Number.isInteger(i)||!Array.isArray(n.get(i)))return S(`Cannot save the struct tree: page ${e} has a wrong id.`),!1}let g=!0;for(const[e,a]of t){const{pageDict:t}=await A.getPage(e);_r.#J({elements:a,xref:this.dict.xref,pageDict:t,numberTree:n});for(const A of a)A.accessibilityData?.type&&(A.parentTreeId=i++,g=!1)}if(g){for(const A of t.values())for(const e of A)delete e.parentTreeId,delete e.structTreeParent;return!1}return!0}async updateStructureTree({newAnnotationsByPage:A,pdfManager:e,newRefs:t}){const i=this.dict.xref,a=this.dict.clone(),s=this.ref,n=new hA;n.put(s,a);let g,r=a.getRaw("ParentTree");r instanceof CA?g=i.fetch(r):(g=r,r=i.getNewTemporaryRef(),a.set("ParentTree",r)),g=g.clone(),n.put(r,g);let o=g.getRaw("Nums"),I=null;o instanceof CA&&(I=o,o=i.fetch(I)),o=o.slice(),I||g.set("Nums",o);const c=await _r.#L({newAnnotationsByPage:A,structTreeRootRef:s,kids:null,nums:o,xref:i,pdfManager:e,cache:n});a.set("ParentTreeNextKey",c),I&&n.put(I,o);const C=[];for(const[A,e]of n.items())C.length=0,await qr(A,e,C,i),t.push({ref:A,data:C.join("")})}static async#L({newAnnotationsByPage:A,structTreeRootRef:e,kids:t,nums:i,xref:a,pdfManager:s,cache:n}){const g=rA.get("OBJR");let r=-1/0;for(const[o,I]of A){const{ref:A}=await s.getPage(o),c=A instanceof CA;for(const{accessibilityData:s,ref:o,parentTreeId:C,structTreeParent:B}of I){if(!s?.type)continue;const{type:I,title:h,lang:Q,alt:l,expanded:E,actualText:u}=s;r=Math.max(r,C);const d=a.getNewTemporaryRef(),f=new cA(a);f.set("S",rA.get(I)),h&&f.set("T",_A(h)),Q&&f.set("Lang",Q),l&&f.set("Alt",_A(l)),E&&f.set("E",_A(E)),u&&f.set("ActualText",_A(u)),await this.#H({structTreeParent:B,tagDict:f,newTagRef:d,structTreeRootRef:e,fallbackKids:t,xref:a,cache:n});const p=new cA(a);f.set("K",p),p.set("Type",g),c&&p.set("Pg",A),p.set("Obj",o),n.put(d,f),i.push(C,d)}}return r+1}static#J({elements:A,xref:e,pageDict:t,numberTree:i}){const a=new Map;for(const e of A)if(e.structTreeParentId){const A=parseInt(e.structTreeParentId.split("_mc")[1],10);let t=a.get(A);t||(t=[],a.set(A,t)),t.push(e)}const s=t.get("StructParents");if(!Number.isInteger(s))return;const n=i.get(s),g=(A,t,i)=>{const s=a.get(A);if(s){const A=t.getRaw("P"),a=e.fetchIfRef(A);if(A instanceof CA&&a instanceof cA){const A={ref:i,dict:t};for(const e of s)e.structTreeParent=A}return!0}return!1};for(const A of n){if(!(A instanceof CA))continue;const t=e.fetch(A),i=t.get("K");if(Number.isInteger(i))g(i,t,A);else if(Array.isArray(i))for(let a of i){if(a=e.fetchIfRef(a),Number.isInteger(a)&&g(a,t,A))break;if(!(a instanceof cA))continue;if(!QA(a.get("Type"),"MCR"))break;const i=a.get("MCID");if(Number.isInteger(i)&&g(i,t,A))break}}}static async#H({structTreeParent:A,tagDict:e,newTagRef:t,structTreeRootRef:i,fallbackKids:a,xref:s,cache:n}){let g,r=null;A?(({ref:r}=A),g=A.dict.getRaw("P")||i):g=i,e.set("P",g);const o=s.fetchIfRef(g);if(!o)return void a.push(t);let I=n.get(g);I||(I=o.clone(),n.put(g,I));const c=I.getRaw("K");let C=c instanceof CA?n.get(c):null;if(!C){C=s.fetchIfRef(c),C=Array.isArray(C)?C.slice():[c];const A=s.getNewTemporaryRef();I.set("K",A),n.put(A,C)}const B=C.indexOf(r);C.splice(B>=0?B+1:C.length,0,t)}}class $r{constructor(A,e){this.tree=A,this.dict=e,this.kids=[],this.parseKids()}get role(){const A=this.dict.get("S"),e=A instanceof rA?A.name:"",{root:t}=this.tree;return t.roleMap.has(e)?t.roleMap.get(e):e}parseKids(){let A=null;const e=this.dict.getRaw("Pg");e instanceof CA&&(A=e.toString());const t=this.dict.get("K");if(Array.isArray(t))for(const e of t){const t=this.parseKid(A,e);t&&this.kids.push(t)}else{const e=this.parseKid(A,t);e&&this.kids.push(e)}}parseKid(A,e){if(Number.isInteger(e))return this.tree.pageDict.objId!==A?null:new Ao({type:1,mcid:e,pageObjId:A});let t=null;if(e instanceof CA?t=this.dict.xref.fetch(e):e instanceof cA&&(t=e),!t)return null;const i=t.getRaw("Pg");i instanceof CA&&(A=i.toString());const a=t.get("Type")instanceof rA?t.get("Type").name:null;if("MCR"===a){if(this.tree.pageDict.objId!==A)return null;const e=t.getRaw("Stm");return new Ao({type:2,refObjId:e instanceof CA?e.toString():null,pageObjId:A,mcid:t.get("MCID")})}if("OBJR"===a){if(this.tree.pageDict.objId!==A)return null;const e=t.getRaw("Obj");return new Ao({type:3,refObjId:e instanceof CA?e.toString():null,pageObjId:A})}return new Ao({type:5,dict:t})}}class Ao{constructor({type:A,dict:e=null,mcid:t=null,pageObjId:i=null,refObjId:a=null}){this.type=A,this.dict=e,this.mcid=t,this.pageObjId=i,this.refObjId=a,this.parentNode=null}}class eo{constructor(A,e){this.root=A,this.rootDict=A?A.dict:null,this.pageDict=e,this.nodes=[]}parse(A){if(!this.root||!this.rootDict)return;const e=this.rootDict.get("ParentTree");if(!e)return;const t=this.pageDict.get("StructParents"),i=A instanceof CA&&this.root.structParentIds?.get(A);if(!Number.isInteger(t)&&!i)return;const a=new Map,s=new dr(e,this.rootDict.xref);if(Number.isInteger(t)){const A=s.get(t);if(Array.isArray(A))for(const e of A)e instanceof CA&&this.addNode(this.rootDict.xref.fetch(e),a)}if(i)for(const[A,e]of i){const t=s.get(A);if(t){const A=this.addNode(this.rootDict.xref.fetchIfRef(t),a);1===A?.kids?.length&&3===A.kids[0].type&&(A.kids[0].type=e)}}}addNode(A,e,t=0){if(t>40)return S("StructTree MAX_DEPTH reached."),null;if(!(A instanceof cA))return null;if(e.has(A))return e.get(A);const i=new $r(this,A);e.set(A,i);const a=A.get("P");if(!a||QA(a.get("Type"),"StructTreeRoot"))return this.addTopLevelNode(A,i)||e.delete(A),i;const s=this.addNode(a,e,t+1);if(!s)return i;let n=!1;for(const e of s.kids)5===e.type&&e.dict===A&&(e.parentNode=i,n=!0);return n||e.delete(A),i}addTopLevelNode(A,e){const t=this.rootDict.get("K");if(!t)return!1;if(t instanceof cA)return t.objId===A.objId&&(this.nodes[0]=e,!0);if(!Array.isArray(t))return!0;let i=!1;for(let a=0;a40)return void S("StructTree too deep to be fully serialized.");const a=Object.create(null);a.role=e.role,a.children=[],t.children.push(a);const s=e.dict.get("Alt");"string"==typeof s&&(a.alt=j(s));const n=e.dict.get("Lang");"string"==typeof n&&(a.lang=j(n));for(const t of e.kids){const e=5===t.type?t.parentNode:null;e?A(e,a,i+1):1===t.type||2===t.type?a.children.push({type:"content",id:`p${t.pageObjId}_mc${t.mcid}`}):3===t.type?a.children.push({type:"object",id:t.refObjId}):4===t.type&&a.children.push({type:"annotation",id:`pdfjs_internal_id_${t.refObjId}`})}}const e=Object.create(null);e.children=[],e.role="Root";for(const t of this.nodes)t&&A(t,e);return e}}function to(A){if(!Array.isArray(A)||A.length<2)return!1;const[e,t,...i]=A;if(!(e instanceof CA||Number.isInteger(e)))return!1;if(!(t instanceof rA))return!1;const a=i.length;let s=!0;switch(t.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return 0===a;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(4!==a)return!1;s=!1;break;default:return!1}for(const A of i)if(!("number"==typeof A||s&&null===A))return!1;return!0}function io(A){return A instanceof cA&&(A=A.get("D")),to(A)?A:null}function ao(A){let e=A.get("D");if(e){if(e instanceof rA&&(e=e.name),"string"==typeof e)return j(e);if(to(e))return JSON.stringify(e)}return null}class so{constructor(A,e){if(this.pdfManager=A,this.xref=e,this._catDict=e.getCatalogObj(),!(this._catDict instanceof cA))throw new v("Catalog object is not a dictionary.");this.toplevelPagesDict,this._actualNumPages=null,this.fontCache=new hA,this.builtInCMapCache=new Map,this.standardFontDataCache=new Map,this.globalImageCache=new tg,this.pageKidsCountCache=new hA,this.pageIndexCache=new hA,this.pageDictCache=new hA,this.nonBlendModesSet=new BA,this.systemFontCache=new Map}cloneDict(){return this._catDict.clone()}get version(){const A=this._catDict.get("Version");if(A instanceof rA){if(fA.test(A.name))return x(this,"version",A.name);S(`Invalid PDF catalog version: ${A.name}`)}return x(this,"version",null)}get lang(){const A=this._catDict.get("Lang");return x(this,"lang",A&&"string"==typeof A?j(A):null)}get needsRendering(){const A=this._catDict.get("NeedsRendering");return x(this,"needsRendering","boolean"==typeof A&&A)}get collection(){let A=null;try{const e=this._catDict.get("Collection");e instanceof cA&&e.size>0&&(A=e)}catch(A){if(A instanceof mA)throw A;F("Cannot fetch Collection entry; assuming no collection is present.")}return x(this,"collection",A)}get acroForm(){let A=null;try{const e=this._catDict.get("AcroForm");e instanceof cA&&e.size>0&&(A=e)}catch(A){if(A instanceof mA)throw A;F("Cannot fetch AcroForm entry; assuming no forms are present.")}return x(this,"acroForm",A)}get acroFormRef(){const A=this._catDict.getRaw("AcroForm");return x(this,"acroFormRef",A instanceof CA?A:null)}get metadata(){const A=this._catDict.getRaw("Metadata");if(!(A instanceof CA))return x(this,"metadata",null);let e=null;try{const t=this.xref.fetch(A,!this.xref.encrypt?.encryptMetadata);if(t instanceof dA&&t.dict instanceof cA){const A=t.dict.get("Type"),i=t.dict.get("Subtype");if(QA(A,"Metadata")&&QA(i,"XML")){const A=z(t.getString());A&&(e=new kr(A).serializable)}}}catch(A){if(A instanceof mA)throw A;F(`Skipping invalid Metadata: "${A}".`)}return x(this,"metadata",e)}get markInfo(){let A=null;try{A=this._readMarkInfo()}catch(A){if(A instanceof mA)throw A;S("Unable to read mark info.")}return x(this,"markInfo",A)}_readMarkInfo(){const A=this._catDict.get("MarkInfo");if(!(A instanceof cA))return null;const e={Marked:!1,UserProperties:!1,Suspects:!1};for(const t in e){const i=A.get(t);"boolean"==typeof i&&(e[t]=i)}return e}get structTreeRoot(){let A=null;try{A=this._readStructTreeRoot()}catch(A){if(A instanceof mA)throw A;S("Unable read to structTreeRoot info.")}return x(this,"structTreeRoot",A)}_readStructTreeRoot(){const A=this._catDict.getRaw("StructTreeRoot"),e=this.xref.fetchIfRef(A);if(!(e instanceof cA))return null;const t=new _r(e,A);return t.init(),t}get toplevelPagesDict(){const A=this._catDict.get("Pages");if(!(A instanceof cA))throw new v("Invalid top-level pages dictionary.");return x(this,"toplevelPagesDict",A)}get documentOutline(){let A=null;try{A=this._readDocumentOutline()}catch(A){if(A instanceof mA)throw A;S("Unable to read document outline.")}return x(this,"documentOutline",A)}_readDocumentOutline(){let A=this._catDict.get("Outlines");if(!(A instanceof cA))return null;if(A=A.getRaw("First"),!(A instanceof CA))return null;const e={items:[]},t=[{obj:A,parent:e}],i=new BA;i.put(A);const a=this.xref,s=new Uint8ClampedArray(3);for(;t.length>0;){const e=t.shift(),n=a.fetchIfRef(e.obj);if(null===n)continue;n.has("Title")||S("Invalid outline item encountered.");const g={url:null,dest:null,action:null};so.parseDestDictionary({destDict:n,resultObj:g,docBaseUrl:this.baseUrl,docAttachments:this.attachments});const r=n.get("Title"),o=n.get("F")||0,I=n.getArray("C"),c=n.get("Count");let C=s;!MA(I,3)||0===I[0]&&0===I[1]&&0===I[2]||(C=re.singletons.rgb.getRgb(I,0));const B={action:g.action,attachment:g.attachment,dest:g.dest,url:g.url,unsafeUrl:g.unsafeUrl,newWindow:g.newWindow,setOCGState:g.setOCGState,title:"string"==typeof r?j(r):"",color:C,count:Number.isInteger(c)?c:void 0,bold:!!(2&o),italic:!!(1&o),items:[]};e.parent.items.push(B),A=n.getRaw("First"),A instanceof CA&&!i.has(A)&&(t.push({obj:A,parent:B}),i.put(A)),A=n.getRaw("Next"),A instanceof CA&&!i.has(A)&&(t.push({obj:A,parent:e.parent}),i.put(A))}return e.items.length>0?e.items:null}get permissions(){let A=null;try{A=this._readPermissions()}catch(A){if(A instanceof mA)throw A;S("Unable to read permissions.")}return x(this,"permissions",A)}_readPermissions(){const A=this.xref.trailer.get("Encrypt");if(!(A instanceof cA))return null;let e=A.get("P");if("number"!=typeof e)return null;e+=2**32;const t=[];for(const A in r){const i=r[A];e&i&&t.push(i)}return t}get optionalContentConfig(){let A=null;try{const e=this._catDict.get("OCProperties");if(!e)return x(this,"optionalContentConfig",null);const t=e.get("D");if(!t)return x(this,"optionalContentConfig",null);const i=e.get("OCGs");if(!Array.isArray(i))return x(this,"optionalContentConfig",null);const a=[],s=new BA;for(const A of i)A instanceof CA&&!s.has(A)&&(s.put(A),a.push(this.#Y(A)));A=this.#v(t,s),A.groups=a}catch(A){if(A instanceof mA)throw A;S(`Unable to read optional content config: ${A}`)}return x(this,"optionalContentConfig",A)}#Y(A){const e=this.xref.fetch(A),t={id:A.toString(),name:null,intent:null,usage:{print:null,view:null}},i=e.get("Name");"string"==typeof i&&(t.name=j(i));let a=e.getArray("Intent");Array.isArray(a)||(a=[a]),a.every((A=>A instanceof rA))&&(t.intent=a.map((A=>A.name)));const s=e.get("Usage");if(!(s instanceof cA))return t;const n=t.usage,g=s.get("Print");if(g instanceof cA){const A=g.get("PrintState");if(A instanceof rA)switch(A.name){case"ON":case"OFF":n.print={printState:A.name}}}const r=s.get("View");if(r instanceof cA){const A=r.get("ViewState");if(A instanceof rA)switch(A.name){case"ON":case"OFF":n.view={viewState:A.name}}}return t}#v(A,e){function t(A){const t=[];if(Array.isArray(A))for(const i of A)i instanceof CA&&e.has(i)&&t.push(i.toString());return t}function i(A,t=0){if(!Array.isArray(A))return null;const i=[];for(const s of A){if(s instanceof CA&&e.has(s)){n.put(s),i.push(s.toString());continue}const A=a(s,t);A&&i.push(A)}if(t>0)return i;const s=[];for(const A of e)n.has(A)||s.push(A.toString());return s.length&&i.push({name:null,order:s}),i}function a(A,e){if(++e>g)return S("parseNestedOrder - reached MAX_NESTED_LEVELS."),null;const t=s.fetchIfRef(A);if(!Array.isArray(t))return null;const a=s.fetchIfRef(t[0]);if("string"!=typeof a)return null;const n=i(t.slice(1),e);return n&&n.length?{name:j(a),order:n}:null}const s=this.xref,n=new BA,g=10;return{name:"string"==typeof A.get("Name")?j(A.get("Name")):null,creator:"string"==typeof A.get("Creator")?j(A.get("Creator")):null,baseState:A.get("BaseState")instanceof rA?A.get("BaseState").name:null,on:t(A.get("ON")),off:t(A.get("OFF")),order:i(A.get("Order")),groups:null}}setActualNumPages(A=null){this._actualNumPages=A}get hasActualNumPages(){return null!==this._actualNumPages}get _pagesCount(){const A=this.toplevelPagesDict.get("Count");if(!Number.isInteger(A))throw new v("Page count in top-level pages dictionary is not an integer.");return x(this,"_pagesCount",A)}get numPages(){return this.hasActualNumPages?this._actualNumPages:this._pagesCount}get destinations(){const A=this._readDests(),e=Object.create(null);if(A instanceof ur)for(const[t,i]of A.getAll()){const A=io(i);A&&(e[j(t)]=A)}else A instanceof cA&&A.forEach((function(A,t){const i=io(t);i&&(e[A]=i)}));return x(this,"destinations",e)}getDestination(A){const e=this._readDests();if(e instanceof ur){const t=io(e.get(A));if(t)return t;const i=this.destinations[A];if(i)return S(`Found "${A}" at an incorrect position in the NameTree.`),i}else if(e instanceof cA){const t=io(e.get(A));if(t)return t}return null}_readDests(){const A=this._catDict.get("Names");return A?.has("Dests")?new ur(A.getRaw("Dests"),this.xref):this._catDict.has("Dests")?this._catDict.get("Dests"):void 0}get pageLabels(){let A=null;try{A=this._readPageLabels()}catch(A){if(A instanceof mA)throw A;S("Unable to read page labels.")}return x(this,"pageLabels",A)}_readPageLabels(){const A=this._catDict.getRaw("PageLabels");if(!A)return null;const e=new Array(this.numPages);let t=null,i="";const a=new dr(A,this.xref).getAll();let s="",n=1;for(let A=0,g=this.numPages;A=1))throw new v("Invalid start in PageLabel dictionary.");n=A}else n=1}switch(t){case"D":s=n;break;case"R":case"r":s=SA(n,"r"===t);break;case"A":case"a":const A=26,e="a"===t?97:65,i=n-1;s=String.fromCharCode(e+i%A).repeat(Math.floor(i/A)+1);break;default:if(t)throw new v(`Invalid style "${t}" in PageLabel dictionary.`);s=""}e[A]=i+s,n++}return e}get pageLayout(){const A=this._catDict.get("PageLayout");let e="";if(A instanceof rA)switch(A.name){case"SinglePage":case"OneColumn":case"TwoColumnLeft":case"TwoColumnRight":case"TwoPageLeft":case"TwoPageRight":e=A.name}return x(this,"pageLayout",e)}get pageMode(){const A=this._catDict.get("PageMode");let e="UseNone";if(A instanceof rA)switch(A.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"FullScreen":case"UseOC":case"UseAttachments":e=A.name}return x(this,"pageMode",e)}get viewerPreferences(){const A=this._catDict.get("ViewerPreferences");if(!(A instanceof cA))return x(this,"viewerPreferences",null);let e=null;for(const t of A.getKeys()){const i=A.get(t);let a;switch(t){case"HideToolbar":case"HideMenubar":case"HideWindowUI":case"FitWindow":case"CenterWindow":case"DisplayDocTitle":case"PickTrayByPDFSize":"boolean"==typeof i&&(a=i);break;case"NonFullScreenPageMode":if(i instanceof rA)switch(i.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"UseOC":a=i.name;break;default:a="UseNone"}break;case"Direction":if(i instanceof rA)switch(i.name){case"L2R":case"R2L":a=i.name;break;default:a="L2R"}break;case"ViewArea":case"ViewClip":case"PrintArea":case"PrintClip":if(i instanceof rA)switch(i.name){case"MediaBox":case"CropBox":case"BleedBox":case"TrimBox":case"ArtBox":a=i.name;break;default:a="CropBox"}break;case"PrintScaling":if(i instanceof rA)switch(i.name){case"None":case"AppDefault":a=i.name;break;default:a="AppDefault"}break;case"Duplex":if(i instanceof rA)switch(i.name){case"Simplex":case"DuplexFlipShortEdge":case"DuplexFlipLongEdge":a=i.name;break;default:a="None"}break;case"PrintPageRange":Array.isArray(i)&&i.length%2==0&&i.every(((A,e,t)=>Number.isInteger(A)&&A>0&&(0===e||A>=t[e-1])&&A<=this.numPages))&&(a=i);break;case"NumCopies":Number.isInteger(i)&&i>0&&(a=i);break;default:S(`Ignoring non-standard key in ViewerPreferences: ${t}.`);continue}void 0!==a?(e||(e=Object.create(null)),e[t]=a):S(`Bad value, for key "${t}", in ViewerPreferences: ${i}.`)}return x(this,"viewerPreferences",e)}get openAction(){const A=this._catDict.get("OpenAction"),e=Object.create(null);if(A instanceof cA){const t=new cA(this.xref);t.set("A",A);const i={url:null,dest:null,action:null};so.parseDestDictionary({destDict:t,resultObj:i}),Array.isArray(i.dest)?e.dest=i.dest:i.action&&(e.action=i.action)}else Array.isArray(A)&&(e.dest=A);return x(this,"openAction",W(e)>0?e:null)}get attachments(){const A=this._catDict.get("Names");let e=null;if(A instanceof cA&&A.has("EmbeddedFiles")){const t=new ur(A.getRaw("EmbeddedFiles"),this.xref);for(const[A,i]of t.getAll()){const t=new mr(i,this.xref);e||(e=Object.create(null)),e[j(A)]=t.serializable}}return x(this,"attachments",e)}get xfaImages(){const A=this._catDict.get("Names");let e=null;if(A instanceof cA&&A.has("XFAImages")){const t=new ur(A.getRaw("XFAImages"),this.xref);for(const[A,i]of t.getAll())e||(e=new cA(this.xref)),e.set(j(A),i)}return x(this,"xfaImages",e)}_collectJavaScript(){const A=this._catDict.get("Names");let e=null;function t(A,t){if(!(t instanceof cA))return;if(!QA(t.get("S"),"JavaScript"))return;let i=t.get("JS");if(i instanceof dA)i=i.getString();else if("string"!=typeof i)return;i=j(i).replaceAll("\0",""),i&&(e||=new Map).set(A,i)}if(A instanceof cA&&A.has("JavaScript")){const e=new ur(A.getRaw("JavaScript"),this.xref);for(const[A,i]of e.getAll())t(j(A),i)}const i=this._catDict.get("OpenAction");return i&&t("OpenAction",i),e}get jsActions(){const A=this._collectJavaScript();let e=TA(this.xref,this._catDict,B);if(A){e||=Object.create(null);for(const[t,i]of A)t in e?e[t].push(i):e[t]=[i]}return x(this,"jsActions",e)}async fontFallback(A,e){const t=await Promise.all(this.fontCache);for(const i of t)if(i.loadedName===A)return void i.fallback(e)}async cleanup(A=!1){fr(),this.globalImageCache.clear(A),this.pageKidsCountCache.clear(),this.pageIndexCache.clear(),this.pageDictCache.clear(),this.nonBlendModesSet.clear();const e=await Promise.all(this.fontCache);for(const{dict:A}of e)delete A.cacheKey;this.fontCache.clear(),this.builtInCMapCache.clear(),this.standardFontDataCache.clear(),this.systemFontCache.clear()}async getPageDict(A){const e=[this.toplevelPagesDict],t=new BA,i=this._catDict.getRaw("Pages");i instanceof CA&&t.put(i);const a=this.xref,s=this.pageKidsCountCache,n=this.pageIndexCache,g=this.pageDictCache;let r=0;for(;e.length;){const i=e.pop();if(i instanceof CA){const o=s.get(i);if(o>=0&&r+o<=A){r+=o;continue}if(t.has(i))throw new v("Pages tree contains circular reference.");t.put(i);const I=await(g.get(i)||a.fetchAsync(i));if(I instanceof cA){let e=I.getRaw("Type");if(e instanceof CA&&(e=await a.fetchAsync(e)),QA(e,"Page")||!I.has("Kids")){if(s.has(i)||s.put(i,1),n.has(i)||n.put(i,r),r===A)return[I,i];r++;continue}}e.push(I);continue}if(!(i instanceof cA))throw new v("Page dictionary kid reference points to wrong type of object.");const{objId:o}=i;let I=i.getRaw("Count");if(I instanceof CA&&(I=await a.fetchAsync(I)),Number.isInteger(I)&&I>=0&&(o&&!s.has(o)&&s.put(o,I),r+I<=A)){r+=I;continue}let c=i.getRaw("Kids");if(c instanceof CA&&(c=await a.fetchAsync(c)),!Array.isArray(c)){let e=i.getRaw("Type");if(e instanceof CA&&(e=await a.fetchAsync(e)),QA(e,"Page")||!i.has("Kids")){if(r===A)return[i,null];r++;continue}throw new v("Page dictionary kids object is not an array.")}for(let A=c.length-1;A>=0;A--){const t=c[A];e.push(t),i===this.toplevelPagesDict&&t instanceof CA&&!g.has(t)&&g.put(t,a.fetchAsync(t))}}throw new Error(`Page index ${A} not found.`)}async getAllPageDicts(A=!1){const{ignoreErrors:e}=this.pdfManager.evaluatorOptions,t=[{currentNode:this.toplevelPagesDict,posInKids:0}],i=new BA,a=this._catDict.getRaw("Pages");a instanceof CA&&i.put(a);const s=new Map,n=this.xref,g=this.pageIndexCache;let r=0;function o(t){if(t instanceof wA&&!A)throw t;A&&e&&0===r&&(S(`getAllPageDicts - Skipping invalid first page: "${t}".`),t=cA.empty),s.set(r++,[t,null])}for(;t.length>0;){const A=t.at(-1),{currentNode:e,posInKids:a}=A;let C=e.getRaw("Kids");if(C instanceof CA)try{C=await n.fetchAsync(C)}catch(A){o(A);break}if(!Array.isArray(C)){o(new v("Page dictionary kids object is not an array."));break}if(a>=C.length){t.pop();continue}const B=C[a];let h;if(B instanceof CA){if(i.has(B)){o(new v("Pages tree contains circular reference."));break}i.put(B);try{h=await n.fetchAsync(B)}catch(A){o(A);break}}else h=B;if(!(h instanceof cA)){o(new v("Page dictionary kid reference points to wrong type of object."));break}let Q=h.getRaw("Type");if(Q instanceof CA)try{Q=await n.fetchAsync(Q)}catch(A){o(A);break}QA(Q,"Page")||!h.has("Kids")?(I=h,(c=B instanceof CA?B:null)&&!g.has(c)&&g.put(c,r),s.set(r++,[I,c])):t.push({currentNode:h,posInKids:0}),A.posInKids++}var I,c;return s}getPageIndex(A){const e=this.pageIndexCache.get(A);if(void 0!==e)return Promise.resolve(e);const t=this.xref;let i=0;const a=e=>function(e){let i,a=0;return t.fetchAsync(e).then((function(t){if(uA(e,A)&&!EA(t,"Page")&&!(t instanceof cA&&!t.has("Type")&&t.has("Contents")))throw new v("The reference does not point to a /Page dictionary.");if(!t)return null;if(!(t instanceof cA))throw new v("Node must be a dictionary.");return i=t.getRaw("Parent"),t.getAsync("Parent")})).then((function(A){if(!A)return null;if(!(A instanceof cA))throw new v("Parent must be a dictionary.");return A.getAsync("Kids")})).then((function(A){if(!A)return null;const s=[];let n=!1;for(const i of A){if(!(i instanceof CA))throw new v("Kid must be a reference.");if(uA(i,e)){n=!0;break}s.push(t.fetchAsync(i).then((function(A){if(!(A instanceof cA))throw new v("Kid node must be a dictionary.");A.has("Count")?a+=A.get("Count"):a++})))}if(!n)throw new v("Kid reference not found in parent's kids.");return Promise.all(s).then((function(){return[a,i]}))}))}(e).then((e=>{if(!e)return this.pageIndexCache.put(A,i),i;const[t,s]=e;return i+=t,a(s)}));return a(A)}get baseUrl(){const A=this._catDict.get("URI");if(A instanceof cA){const e=A.get("Base");if("string"==typeof e){const A=N(e,null,{tryConvertEncoding:!0});if(A)return x(this,"baseUrl",A.href)}}return x(this,"baseUrl",this.pdfManager.docBaseUrl)}static parseDestDictionary({destDict:A,resultObj:e,docBaseUrl:t=null,docAttachments:i=null}){if(!(A instanceof cA))return void S("parseDestDictionary: `destDict` must be a dictionary.");let a,s,n=A.get("A");if(n instanceof cA||(A.has("Dest")?n=A.get("Dest"):(n=A.get("AA"),n instanceof cA&&(n.has("D")?n=n.get("D"):n.has("U")&&(n=n.get("U"))))),n instanceof cA){const A=n.get("S");if(!(A instanceof rA))return void S("parseDestDictionary: Invalid type in Action dictionary.");const t=A.name;switch(t){case"ResetForm":const A=n.get("Flags"),g=!(1&("number"==typeof A?A:0)),r=[],o=[];for(const A of n.get("Fields")||[])A instanceof CA?o.push(A.toString()):"string"==typeof A&&r.push(j(A));e.resetForm={fields:r,refs:o,include:g};break;case"URI":a=n.get("URI"),a instanceof rA&&(a="/"+a.name);break;case"GoTo":s=n.get("D");break;case"Launch":case"GoToR":const I=n.get("F");if(I instanceof cA){const A=new mr(I,null,!0),{rawFilename:e}=A.serializable;a=e}else"string"==typeof I&&(a=I);const c=ao(n);c&&"string"==typeof a&&(a=a.split("#",1)[0]+"#"+c);const C=n.get("NewWindow");"boolean"==typeof C&&(e.newWindow=C);break;case"GoToE":const B=n.get("T");let h;if(i&&B instanceof cA){const A=B.get("R"),e=B.get("N");QA(A,"C")&&"string"==typeof e&&(h=i[j(e)])}if(h){e.attachment=h;const A=ao(n);A&&(e.attachmentDest=A)}else S('parseDestDictionary - unimplemented "GoToE" action.');break;case"Named":const Q=n.get("N");Q instanceof rA&&(e.action=Q.name);break;case"SetOCGState":const l=n.get("State"),E=n.get("PreserveRB");if(!Array.isArray(l)||0===l.length)break;const u=[];for(const A of l)if(A instanceof rA)switch(A.name){case"ON":case"OFF":case"Toggle":u.push(A.name)}else A instanceof CA&&u.push(A.toString());if(u.length!==l.length)break;e.setOCGState={state:u,preserveRB:"boolean"!=typeof E||E};break;case"JavaScript":const d=n.get("JS");let f;d instanceof dA?f=d.getString():"string"==typeof d&&(f=d);const p=f&&VA(j(f));if(p){a=p.url,e.newWindow=p.newWindow;break}default:if("JavaScript"===t||"SubmitForm"===t)break;S(`parseDestDictionary - unsupported action: "${t}".`)}}else A.has("Dest")&&(s=A.get("Dest"));if("string"==typeof a){const A=N(a,t,{addDefaultProtocol:!0,tryConvertEncoding:!0});A&&(e.url=A.href),e.unsafeUrl=a}s&&(s instanceof rA&&(s=s.name),"string"==typeof s?e.dest=j(s):to(s)&&(e.dest=s))}}function no(A,e){if(A instanceof cA)A=A.getRawValues();else if(A instanceof dA)A=A.dict.getRawValues();else if(!Array.isArray(A))return;for(const i of A)((t=i)instanceof CA||t instanceof cA||t instanceof dA||Array.isArray(t))&&e.push(i);var t}class go{constructor(A,e,t){this.dict=A,this.keys=e,this.xref=t,this.refSet=null}async load(){if(this.xref.stream.isDataLoaded)return;const{keys:A,dict:e}=this;this.refSet=new BA;const t=[];for(const i of A){const A=e.getRaw(i);void 0!==A&&t.push(A)}return this._walk(t)}async _walk(A){const e=[],t=[];for(;A.length;){let i=A.pop();if(i instanceof CA){if(this.refSet.has(i))continue;try{this.refSet.put(i),i=this.xref.fetch(i)}catch(A){if(!(A instanceof mA)){S(`ObjectLoader._walk - requesting all data: "${A}".`),this.refSet=null;const{manager:e}=this.xref.stream;return e.requestAllChunks()}e.push(i),t.push({begin:A.begin,end:A.end})}}if(i instanceof dA){const A=i.getBaseStreams();if(A){let a=!1;for(const e of A)e.isDataLoaded||(a=!0,t.push({begin:e.start,end:e.end}));a&&e.push(i)}}no(i,A)}if(t.length){await this.xref.stream.manager.requestRanges(t);for(const A of e)A instanceof CA&&this.refSet.remove(A);return this._walk(e)}this.refSet=null}}const ro=Symbol(),oo=Symbol(),Io=Symbol(),co=Symbol(),Co=Symbol(),Bo=Symbol(),ho=Symbol(),Qo=Symbol(),lo=Symbol(),Eo=Symbol("content"),uo=Symbol("data"),fo=Symbol(),po=Symbol("extra"),mo=Symbol(),yo=Symbol(),wo=Symbol(),Do=Symbol(),bo=Symbol(),ko=Symbol(),Fo=Symbol(),So=Symbol(),Ro=Symbol(),Go=Symbol(),No=Symbol(),xo=Symbol(),Uo=Symbol(),Mo=Symbol(),Lo=Symbol(),Jo=Symbol(),Ho=Symbol(),Yo=Symbol(),vo=Symbol(),Ko=Symbol(),qo=Symbol(),To=Symbol(),Po=Symbol(),Wo=Symbol(),Zo=Symbol(),Oo=Symbol(),Xo=Symbol(),Vo=Symbol(),jo=Symbol(),zo=Symbol(),_o=Symbol(),$o=Symbol(),AI=Symbol("namespaceId"),eI=Symbol("nodeName"),tI=Symbol(),iI=Symbol(),aI=Symbol(),sI=Symbol(),nI=Symbol(),gI=Symbol(),rI=Symbol(),oI=Symbol(),II=Symbol("root"),cI=Symbol(),CI=Symbol(),BI=Symbol(),hI=Symbol(),QI=Symbol(),lI=Symbol(),EI=Symbol(),uI=Symbol(),dI=Symbol(),fI=Symbol(),pI=Symbol(),mI=Symbol("uid"),yI=Symbol(),wI={config:{id:0,check:A=>A.startsWith("http://www.xfa.org/schema/xci/")},connectionSet:{id:1,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-connection-set/")},datasets:{id:2,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-data/")},form:{id:3,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-form/")},localeSet:{id:4,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-locale-set/")},pdf:{id:5,check:A=>"http://ns.adobe.com/xdp/pdf/"===A},signature:{id:6,check:A=>"http://www.w3.org/2000/09/xmldsig#"===A},sourceSet:{id:7,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-source-set/")},stylesheet:{id:8,check:A=>"http://www.w3.org/1999/XSL/Transform"===A},template:{id:9,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-template/")},xdc:{id:10,check:A=>A.startsWith("http://www.xfa.org/schema/xdc/")},xdp:{id:11,check:A=>"http://ns.adobe.com/xdp/"===A},xfdf:{id:12,check:A=>"http://ns.adobe.com/xfdf/"===A},xhtml:{id:13,check:A=>"http://www.w3.org/1999/xhtml"===A},xmpmeta:{id:14,check:A=>"http://ns.adobe.com/xmpmeta/"===A}},DI={pt:A=>A,cm:A=>A/2.54*72,mm:A=>A/25.4*72,in:A=>72*A,px:A=>A},bI=/([+-]?\d+\.?\d*)(.*)/;function kI(A){return A.startsWith("'")||A.startsWith('"')?A.slice(1,-1):A}function FI({data:A,defaultValue:e,validate:t}){if(!A)return e;A=A.trim();const i=parseInt(A,10);return!isNaN(i)&&t(i)?i:e}function SI({data:A,defaultValue:e,validate:t}){if(!A)return e;A=A.trim();const i=parseFloat(A);return!isNaN(i)&&t(i)?i:e}function RI({data:A,defaultValue:e,validate:t}){return A&&t(A=A.trim())?A:e}function GI(A,e){return RI({data:A,defaultValue:e[0],validate:A=>e.includes(A)})}function NI(A,e="0"){if(e||="0",!A)return NI(e);const t=A.trim().match(bI);if(!t)return NI(e);const[,i,a]=t,s=parseFloat(i);if(isNaN(s))return NI(e);if(0===s)return 0;const n=DI[a];return n?n(s):s}function xI(A){if(!A)return{num:1,den:1};const e=A.trim().split(/\s*:\s*/).map((A=>parseFloat(A))).filter((A=>!isNaN(A)));if(1===e.length&&e.push(1),0===e.length)return{num:1,den:1};const[t,i]=e;return{num:t,den:i}}function UI(A){return A?A.trim().split(/\s+/).map((A=>({excluded:"-"===A[0],viewname:A.substring(1)}))):[]}class MI{static get FAILURE(){return x(this,"FAILURE",new MI(!1,null,null,null))}static get EMPTY(){return x(this,"EMPTY",new MI(!0,null,null,null))}constructor(A,e,t,i){this.success=A,this.html=e,this.bbox=t,this.breakNode=i}isBreak(){return!!this.breakNode}static breakNode(A){return new MI(!1,null,null,A)}static success(A,e=null){return new MI(!0,A,e,null)}}class LI{constructor(A){this.fonts=new Map,this.cache=new Map,this.warned=new Set,this.defaultFont=null,this.add(A)}add(A,e=null){for(const e of A)this.addPdfFont(e);for(const A of this.fonts.values())A.regular||(A.regular=A.italic||A.bold||A.bolditalic);if(!e||0===e.size)return;const t=this.fonts.get("PdfJS-Fallback-PdfJS-XFA");for(const A of e)this.fonts.set(A,t)}addPdfFont(A){const e=A.cssFontInfo,t=e.fontFamily;let i=this.fonts.get(t);i||(i=Object.create(null),this.fonts.set(t,i),this.defaultFont||(this.defaultFont=i));let a="";const s=parseFloat(e.fontWeight);0!==parseFloat(e.italicAngle)?a=s>=700?"bolditalic":"italic":s>=700&&(a="bold"),a||((A.name.includes("Bold")||A.psName?.includes("Bold"))&&(a="bold"),(A.name.includes("Italic")||A.name.endsWith("It")||A.psName?.includes("Italic")||A.psName?.endsWith("It"))&&(a+="italic")),a||(a="regular"),i[a]=A}getDefault(){return this.defaultFont}find(A,e=!0){let t=this.fonts.get(A)||this.cache.get(A);if(t)return t;const i=/,|-|_| |bolditalic|bold|italic|regular|it/gi;let a=A.replaceAll(i,"");if(t=this.fonts.get(a),t)return this.cache.set(A,t),t;a=a.toLowerCase();const s=[];for(const[A,e]of this.fonts.entries())A.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(e);if(0===s.length)for(const[,A]of this.fonts.entries())A.regular.name?.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(A);if(0===s.length){a=a.replaceAll(/psmt|mt/gi,"");for(const[A,e]of this.fonts.entries())A.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(e)}if(0===s.length)for(const A of this.fonts.values())A.regular.name?.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(A);return s.length>=1?(1!==s.length&&e&&S(`XFA - Too many choices to guess the correct font: ${A}`),this.cache.set(A,s[0]),s[0]):(e&&!this.warned.has(A)&&(this.warned.add(A),S(`XFA - Cannot find the font: ${A}`)),null)}}function JI(A,e){return"italic"===A.posture?"bold"===A.weight?e.bolditalic:e.italic:"bold"===A.weight?e.bold:e.regular}class HI{constructor(A,e,t,i){if(this.lineHeight=t,this.paraMargin=e||{top:0,bottom:0,left:0,right:0},!A)return void([this.pdfFont,this.xfaFont]=this.defaultFont(i));this.xfaFont={typeface:A.typeface,posture:A.posture,weight:A.weight,size:A.size,letterSpacing:A.letterSpacing};const a=i.find(A.typeface);a?(this.pdfFont=JI(A,a),this.pdfFont||([this.pdfFont,this.xfaFont]=this.defaultFont(i))):[this.pdfFont,this.xfaFont]=this.defaultFont(i)}defaultFont(A){const e=A.find("Helvetica",!1)||A.find("Myriad Pro",!1)||A.find("Arial",!1)||A.getDefault();if(e?.regular){const A=e.regular;return[A,{typeface:A.cssFontInfo.fontFamily,posture:"normal",weight:"normal",size:10,letterSpacing:0}]}return[null,{typeface:"Courier",posture:"normal",weight:"normal",size:10,letterSpacing:0}]}}class YI{constructor(A,e,t,i){this.fontFinder=i,this.stack=[new HI(A,e,t,i)]}pushData(A,e,t){const i=this.stack.at(-1);for(const e of["typeface","posture","weight","size","letterSpacing"])A[e]||(A[e]=i.xfaFont[e]);for(const A of["top","bottom","left","right"])isNaN(e[A])&&(e[A]=i.paraMargin[A]);const a=new HI(A,e,t||i.lineHeight,this.fontFinder);a.pdfFont||(a.pdfFont=i.pdfFont),this.stack.push(a)}popFont(){this.stack.pop()}topFont(){return this.stack.at(-1)}}class vI{constructor(A,e,t,i){this.glyphs=[],this.fontSelector=new YI(A,e,t,i),this.extraHeight=0}pushData(A,e,t){this.fontSelector.pushData(A,e,t)}popFont(A){return this.fontSelector.popFont()}addPara(){const A=this.fontSelector.topFont();this.extraHeight+=A.paraMargin.top+A.paraMargin.bottom}addString(A){if(!A)return;const e=this.fontSelector.topFont(),t=e.xfaFont.size;if(e.pdfFont){const i=e.xfaFont.letterSpacing,a=e.pdfFont,s=a.lineHeight||1.2,n=e.lineHeight||Math.max(1.2,s)*t,g=s-(void 0===a.lineGap?.2:a.lineGap),r=Math.max(1,g)*t,o=t/1e3,I=a.defaultWidth||a.charsToGlyphs(" ")[0].width;for(const e of A.split(/[\u2029\n]/)){const A=a.encodeString(e).join(""),t=a.charsToGlyphs(A);for(const A of t){const e=A.width||I;this.glyphs.push([e*o+i,n,r,A.unicode,!1])}this.glyphs.push([0,0,0,"\n",!0])}this.glyphs.pop()}else{for(const e of A.split(/[\u2029\n]/)){for(const A of e.split(""))this.glyphs.push([t,1.2*t,t,A,!1]);this.glyphs.push([0,0,0,"\n",!0])}this.glyphs.pop()}}compute(A){let e=-1,t=0,i=0,a=0,s=0,n=0,g=!1,r=!0;for(let o=0,I=this.glyphs.length;oA?(i=Math.max(i,s),s=0,a+=n,n=l,e=-1,t=0,g=!0,r=!1):(n=Math.max(l,n),t=s,s+=I,e=o):s+I>A?(a+=n,n=l,-1!==e?(o=e,i=Math.max(i,t),s=0,e=-1,t=0):(i=Math.max(i,s),s=I),g=!0,r=!1):(s+=I,n=Math.max(l,n))}return i=Math.max(i,s),a+=n+this.extraHeight,{width:1.02*i,height:a,isBroken:g}}}const KI=/^[^.[]+/,qI=/^[^\]]+/,TI=new Map([["$data",(A,e)=>A.datasets?A.datasets.data:A],["$record",(A,e)=>(A.datasets?A.datasets.data:A)[xo]()[0]],["$template",(A,e)=>A.template],["$connectionSet",(A,e)=>A.connectionSet],["$form",(A,e)=>A.form],["$layout",(A,e)=>A.layout],["$host",(A,e)=>A.host],["$dataWindow",(A,e)=>A.dataWindow],["$event",(A,e)=>A.event],["!",(A,e)=>A.datasets],["$xfa",(A,e)=>A],["xfa",(A,e)=>A],["$",(A,e)=>e]]),PI=new WeakMap;function WI(A,e,t=!0){let i=A.match(KI);if(!i)return null;let[a]=i;const s=[{name:a,cacheName:"."+a,index:0,js:null,formCalc:null,operator:0}];let n=a.length;for(;n0&&I.push(A)}if(0!==I.length||g||0!==r)A=isFinite(o)?I.filter((A=>oA[o])):I.flat();else{const t=e[Jo]();if(!(e=t))return null;r=-1,A=[e]}}return 0===A.length?null:A}function OI(A,e,t){const i=WI(t);if(!i)return null;if(i.some((A=>1===A.operator)))return null;const a=TI.get(i[0].name);let s=0;a?(A=a(A,e),s=1):A=e||A;for(let e=i.length;sA[EI]())).join("")}get[jI](){const A=Object.getPrototypeOf(this);if(!A._attributes){const e=A._attributes=new Set;for(const A of Object.getOwnPropertyNames(this)){if(null===this[A]||this[A]instanceof Bc||this[A]instanceof hc)break;e.add(A)}}return x(this,jI,A._attributes)}[Oo](A){let e=this;for(;e;){if(e===A)return!0;e=e[Jo]()}return!1}[Jo](){return this[gc]}[Lo](){return this[Jo]()}[xo](A=null){return A?this[A]:this[zI]}[fo](){const A=Object.create(null);this[Eo]&&(A.$content=this[Eo]);for(const e of Object.getOwnPropertyNames(this)){const t=this[e];null!==t&&(t instanceof Bc?A[e]=t[fo]():t instanceof hc?t.isEmpty()||(A[e]=t.dump()):A[e]=t)}return A}[pI](){return null}[dI](){return MI.EMPTY}*[Uo](){for(const A of this[xo]())yield A}*[ec](A,e){for(const t of this[Uo]())if(!A||e===A.has(t[eI])){const A=this[bo](),e=t[dI](A);e.success||(this[po].failingNode=t),yield e}}[yo](){return null}[oo](A,e){this[po].children.push(A)}[bo](){}[co]({filter:A=null,include:e=!0}){if(this[po].generator){const A=this[bo](),e=this[po].failingNode[dI](A);if(!e.success)return e;e.html&&this[oo](e.html,e.bbox),delete this[po].failingNode}else this[po].generator=this[ec](A,e);for(;;){const A=this[po].generator.next();if(A.done)break;const e=A.value;if(!e.success)return e;e.html&&this[oo](e.html,e.bbox)}return this[po].generator=null,MI.EMPTY}[hI](A){this[oc]=new Set(Object.keys(A))}[ic](A){const e=this[jI],t=this[oc];return[...A].filter((A=>e.has(A)&&!t.has(A)))}[cI](A,e=new Set){for(const t of this[zI])t[rc](A,e)}[rc](A,e){const t=this[tc](A,e);t?this[XI](t,A,e):this[cI](A,e)}[tc](A,e){const{use:t,usehref:i}=this;if(!t&&!i)return null;let a=null,s=null,n=null,g=t;if(i?(g=i,i.startsWith("#som(")&&i.endsWith(")")?s=i.slice(5,-1):i.startsWith(".#som(")&&i.endsWith(")")?s=i.slice(6,-1):i.startsWith("#")?n=i.slice(1):i.startsWith(".#")&&(n=i.slice(2))):t.startsWith("#")?n=t.slice(1):s=t,this.use=this.usehref="",n?a=A.get(n):(a=ZI(A.get(II),this,s,!0,!1),a&&(a=a[0])),!a)return S(`XFA - Invalid prototype reference: ${g}.`),null;if(a[eI]!==this[eI])return S(`XFA - Incompatible prototype: ${a[eI]} !== ${this[eI]}.`),null;if(e.has(a))return S("XFA - Cycle detected in prototypes use."),null;e.add(a);const r=a[tc](A,e);return r&&a[XI](r,A,e),a[cI](A,e),e.delete(a),a}[XI](A,e,t){if(t.has(A))S("XFA - Cycle detected in prototypes use.");else{!this[Eo]&&A[Eo]&&(this[Eo]=A[Eo]),new Set(t).add(A);for(const e of this[ic](A[oc]))this[e]=A[e],this[oc]&&this[oc].add(e);for(const i of Object.getOwnPropertyNames(this)){if(this[jI].has(i))continue;const a=this[i],s=A[i];if(a instanceof hc){for(const A of a[zI])A[rc](e,t);for(let i=a[zI].length,n=s[zI].length;iBc[_I](A))):"object"==typeof A&&null!==A?Object.assign({},A):A}[Qo](){const A=Object.create(Object.getPrototypeOf(this));for(const e of Object.getOwnPropertySymbols(this))try{A[e]=this[e]}catch{x(A,e,this[e])}A[mI]=`${A[eI]}${cc++}`,A[zI]=[];for(const e of Object.getOwnPropertyNames(this)){if(this[jI].has(e)){A[e]=Bc[_I](this[e]);continue}const t=this[e];A[e]=t instanceof hc?new hc(t[sc]):null}for(const e of this[zI]){const t=e[eI],i=e[Qo]();A[zI].push(i),i[gc]=A,null===A[t]?A[t]=i:A[t][zI].push(i)}return A}[xo](A=null){return A?this[zI].filter((e=>e[eI]===A)):this[zI]}[ko](A){return this[A]}[Fo](A,e,t=!0){return Array.from(this[So](A,e,t))}*[So](A,e,t=!0){if("parent"!==A){for(const t of this[zI])t[eI]===A&&(yield t),t.name===A&&(yield t),(e||t[zo]())&&(yield*t[So](A,e,!1));t&&this[jI].has(A)&&(yield new Qc(this,A,this[A]))}else yield this[gc]}}class hc{constructor(A=1/0){this[sc]=A,this[zI]=[]}get isXFAObject(){return!1}get isXFAObjectArray(){return!0}push(A){return this[zI].length<=this[sc]?(this[zI].push(A),!0):(S(`XFA - node "${A[eI]}" accepts no more than ${this[sc]} children`),!1)}isEmpty(){return 0===this[zI].length}dump(){return 1===this[zI].length?this[zI][0][fo]():this[zI].map((A=>A[fo]()))}[Qo](){const A=new hc(this[sc]);return A[zI]=this[zI].map((A=>A[Qo]())),A}get children(){return this[zI]}clear(){this[zI].length=0}}class Qc{constructor(A,e,t){this[gc]=A,this[eI]=e,this[Eo]=t,this[lo]=!1,this[mI]="attribute"+cc++}[Jo](){return this[gc]}[Zo](){return!0}[Ro](){return this[Eo].trim()}[QI](A){A=A.value||"",this[Eo]=A.toString()}[EI](){return this[Eo]}[Oo](A){return this[gc]===A||this[gc][Oo](A)}}class lc extends Bc{constructor(A,e,t={}){if(super(A,e),this[Eo]="",this[$I]=null,"#text"!==e){const A=new Map;this[VI]=A;for(const[e,i]of Object.entries(t))A.set(e,new Qc(this,e,i));if(t.hasOwnProperty(tI)){const A=t[tI].xfa.dataNode;void 0!==A&&("dataGroup"===A?this[$I]=!1:"dataValue"===A&&(this[$I]=!0))}}this[lo]=!1}[fI](A){const e=this[eI];if("#text"===e)return void A.push(ZA(this[Eo]));const t=_(e),i=this[AI]===Cc?"xfa:":"";A.push(`<${i}${t}`);for(const[e,t]of this[VI].entries()){const i=_(e);A.push(` ${i}="${ZA(t[Eo])}"`)}if(null!==this[$I]&&(this[$I]?A.push(' xfa:dataNode="dataValue"'):A.push(' xfa:dataNode="dataGroup"')),this[Eo]||0!==this[zI].length){if(A.push(">"),this[Eo])"string"==typeof this[Eo]?A.push(ZA(this[Eo])):this[Eo][fI](A);else for(const e of this[zI])e[fI](A);A.push(``)}else A.push("/>")}[iI](A){if(this[Eo]){const A=new lc(this[AI],"#text");this[Io](A),A[Eo]=this[Eo],this[Eo]=""}return this[Io](A),!0}[sI](A){this[Eo]+=A}[mo](){if(this[Eo]&&this[zI].length>0){const A=new lc(this[AI],"#text");this[Io](A),A[Eo]=this[Eo],delete this[Eo]}}[dI](){return"#text"===this[eI]?MI.success({name:"#text",value:this[Eo]}):MI.EMPTY}[xo](A=null){return A?this[zI].filter((e=>e[eI]===A)):this[zI]}[Do](){return this[VI]}[ko](A){const e=this[VI].get(A);return void 0!==e?e:this[xo](A)}*[So](A,e){const t=this[VI].get(A);t&&(yield t);for(const t of this[zI])t[eI]===A&&(yield t),e&&(yield*t[So](A,e))}*[wo](A,e){const t=this[VI].get(A);!t||e&&t[lo]||(yield t);for(const t of this[zI])yield*t[wo](A,e)}*[No](A,e,t){for(const i of this[zI])i[eI]!==A||t&&i[lo]||(yield i),e&&(yield*i[No](A,e,t))}[Zo](){return null===this[$I]?0===this[zI].length||this[zI][0][AI]===wI.xhtml.id:this[$I]}[Ro](){return null===this[$I]?0===this[zI].length?this[Eo].trim():this[zI][0][AI]===wI.xhtml.id?this[zI][0][EI]().trim():null:this[Eo].trim()}[QI](A){A=A.value||"",this[Eo]=A.toString()}[fo](A=!1){const e=Object.create(null);A&&(e.$ns=this[AI]),this[Eo]&&(e.$content=this[Eo]),e.$name=this[eI],e.children=[];for(const t of this[zI])e.children.push(t[fo](A));e.attributes=Object.create(null);for(const[A,t]of this[VI])e.attributes[A]=t[Eo];return e}}class Ec extends Bc{constructor(A,e){super(A,e),this[Eo]=""}[sI](A){this[Eo]+=A}[mo](){}}class uc extends Ec{constructor(A,e,t){super(A,e),this[nc]=t}[mo](){this[Eo]=RI({data:this[Eo],defaultValue:this[nc][0],validate:A=>this[nc].includes(A)})}[Co](A){super[Co](A),delete this[nc]}}class dc extends Ec{[mo](){this[Eo]=this[Eo].trim()}}class fc extends Ec{constructor(A,e,t,i){super(A,e),this[Ac]=t,this[Ic]=i}[mo](){this[Eo]=FI({data:this[Eo],defaultValue:this[Ac],validate:this[Ic]})}[Co](A){super[Co](A),delete this[Ac],delete this[Ic]}}class pc extends fc{constructor(A,e){super(A,e,0,(A=>1===A))}}class mc extends fc{constructor(A,e){super(A,e,1,(A=>0===A))}}function yc(A){return"string"==typeof A?"0px":Number.isInteger(A)?`${A}px`:`${A.toFixed(2)}px`}const wc={anchorType(A,e){const t=A[Lo]();if(t&&(!t.layout||"position"===t.layout))switch("transform"in e||(e.transform=""),A.anchorType){case"bottomCenter":e.transform+="translate(-50%, -100%)";break;case"bottomLeft":e.transform+="translate(0,-100%)";break;case"bottomRight":e.transform+="translate(-100%,-100%)";break;case"middleCenter":e.transform+="translate(-50%,-50%)";break;case"middleLeft":e.transform+="translate(0,-50%)";break;case"middleRight":e.transform+="translate(-100%,-50%)";break;case"topCenter":e.transform+="translate(-50%,0)";break;case"topRight":e.transform+="translate(-100%,0)"}},dimensions(A,e){const t=A[Lo]();let i=A.w;const a=A.h;if(t.layout?.includes("row")){const e=t[po],a=A.colSpan;let s;-1===a?(s=e.columnWidths.slice(e.currentColumn).reduce(((A,e)=>A+e),0),e.currentColumn=0):(s=e.columnWidths.slice(e.currentColumn,e.currentColumn+a).reduce(((A,e)=>A+e),0),e.currentColumn=(e.currentColumn+A.colSpan)%e.columnWidths.length),isNaN(s)||(i=A.w=s)}e.width=""!==i?yc(i):"auto",e.height=""!==a?yc(a):"auto"},position(A,e){const t=A[Lo]();t?.layout&&"position"!==t.layout||(e.position="absolute",e.left=yc(A.x),e.top=yc(A.y))},rotate(A,e){A.rotate&&("transform"in e||(e.transform=""),e.transform+=`rotate(-${A.rotate}deg)`,e.transformOrigin="top left")},presence(A,e){switch(A.presence){case"invisible":e.visibility="hidden";break;case"hidden":case"inactive":e.display="none"}},hAlign(A,e){if("para"===A[eI])switch(A.hAlign){case"justifyAll":e.textAlign="justify-all";break;case"radix":e.textAlign="left";break;default:e.textAlign=A.hAlign}else switch(A.hAlign){case"left":e.alignSelf="start";break;case"center":e.alignSelf="center";break;case"right":e.alignSelf="end"}},margin(A,e){A.margin&&(e.margin=A.margin[pI]().margin)}};function Dc(A,e){"position"===A[Lo]().layout&&(A.minW>0&&(e.minWidth=yc(A.minW)),A.maxW>0&&(e.maxWidth=yc(A.maxW)),A.minH>0&&(e.minHeight=yc(A.minH)),A.maxH>0&&(e.maxHeight=yc(A.maxH)))}function bc(A,e,t,i,a,s){const n=new vI(e,t,i,a);return"string"==typeof A?n.addString(A):A[nI](n),n.compute(s)}function kc(A,e){let t=null,i=null,a=!1;if((!A.w||!A.h)&&A.value){let s=0,n=0;A.margin&&(s=A.margin.leftInset+A.margin.rightInset,n=A.margin.topInset+A.margin.bottomInset);let g=null,r=null;A.para&&(r=Object.create(null),g=""===A.para.lineHeight?null:A.para.lineHeight,r.top=""===A.para.spaceAbove?0:A.para.spaceAbove,r.bottom=""===A.para.spaceBelow?0:A.para.spaceBelow,r.left=""===A.para.marginLeft?0:A.para.marginLeft,r.right=""===A.para.marginRight?0:A.para.marginRight);let o=A.font;if(!o){const e=A[Ho]();let t=A[Jo]();for(;t&&t!==e;){if(t.font){o=t.font;break}t=t[Jo]()}}const I=(A.w||e.width)-s,c=A[Yo].fontFinder;if(A.value.exData&&A.value.exData[Eo]&&"text/html"===A.value.exData.contentType){const e=bc(A.value.exData[Eo],o,r,g,c,I);i=e.width,t=e.height,a=e.isBroken}else{const e=A.value[EI]();if(e){const A=bc(e,o,r,g,c,I);i=A.width,t=A.height,a=A.isBroken}}null===i||A.w||(i+=s),null===t||A.h||(t+=n)}return{w:i,h:t,isBroken:a}}function Fc(A,e,t){let i;if(""!==A.w&&""!==A.h)i=[A.x,A.y,A.w,A.h];else{if(!t)return null;let a=A.w;if(""===a){if(0===A.maxW){const e=A[Lo]();a="position"===e.layout&&""!==e.w?0:A.minW}else a=Math.min(A.maxW,t.width);e.attributes.style.width=yc(a)}let s=A.h;if(""===s){if(0===A.maxH){const e=A[Lo]();s="position"===e.layout&&""!==e.h?0:A.minH}else s=Math.min(A.maxH,t.height);e.attributes.style.height=yc(s)}i=[A.x,A.y,a,s]}return i}function Sc(A){const e=A[Lo]();if(e.layout?.includes("row")){const t=e[po],i=A.colSpan;let a;a=-1===i?t.columnWidths.slice(t.currentColumn).reduce(((A,e)=>A+e),0):t.columnWidths.slice(t.currentColumn,t.currentColumn+i).reduce(((A,e)=>A+e),0),isNaN(a)||(A.w=a)}e.layout&&"position"!==e.layout&&(A.x=A.y=0),"table"===A.layout&&""===A.w&&Array.isArray(A.columnWidths)&&(A.w=A.columnWidths.reduce(((A,e)=>A+e),0))}function Rc(A){switch(A.layout){case"position":default:return"xfaPosition";case"lr-tb":return"xfaLrTb";case"rl-row":return"xfaRlRow";case"rl-tb":return"xfaRlTb";case"row":return"xfaRow";case"table":return"xfaTable";case"tb":return"xfaTb"}}function Gc(A,...e){const t=Object.create(null);for(const i of e){const e=A[i];if(null!==e)if(wc.hasOwnProperty(i))wc[i](A,t);else if(e instanceof Bc){const A=e[pI]();A?Object.assign(t,A):S(`(DEBUG) - XFA - style for ${i} not implemented yet`)}}return t}function Nc(A,e){const{attributes:t}=e,{style:i}=t,a={name:"div",attributes:{class:["xfaWrapper"],style:Object.create(null)},children:[]};if(t.class.push("xfaWrapped"),A.border){const{widths:t,insets:s}=A.border[po];let n,g,r=s[0],o=s[3];const I=s[0]+s[2],c=s[1]+s[3];switch(A.border.hand){case"even":r-=t[0]/2,o-=t[3]/2,n=`calc(100% + ${(t[1]+t[3])/2-c}px)`,g=`calc(100% + ${(t[0]+t[2])/2-I}px)`;break;case"left":r-=t[0],o-=t[3],n=`calc(100% + ${t[1]+t[3]-c}px)`,g=`calc(100% + ${t[0]+t[2]-I}px)`;break;case"right":n=c?`calc(100% - ${c}px)`:"100%",g=I?`calc(100% - ${I}px)`:"100%"}const C=["xfaBorder"];Mc(A.border)&&C.push("xfaPrintOnly");const B={name:"div",attributes:{class:C,style:{top:`${r}px`,left:`${o}px`,width:n,height:g}},children:[]};for(const A of["border","borderWidth","borderColor","borderRadius","borderStyle"])void 0!==i[A]&&(B.attributes.style[A]=i[A],delete i[A]);a.children.push(B,e)}else a.children.push(e);for(const A of["background","backgroundClip","top","left","width","height","minWidth","minHeight","maxWidth","maxHeight","transform","transformOrigin","visibility"])void 0!==i[A]&&(a.attributes.style[A]=i[A],delete i[A]);return a.attributes.style.position="absolute"===i.position?"absolute":"relative",delete i.position,i.alignSelf&&(a.attributes.style.alignSelf=i.alignSelf,delete i.alignSelf),a}function xc(A){const e=NI(A.textIndent,"0px");if(e>=0)return;const t="padding"+("left"==("right"===A.textAlign?"right":"left")?"Left":"Right"),i=NI(A[t],"0px");A[t]=i-e+"px"}function Uc(A,e){switch(A.access){case"nonInteractive":e.push("xfaNonInteractive");break;case"readOnly":e.push("xfaReadOnly");break;case"protected":e.push("xfaDisabled")}}function Mc(A){return A.relevant.length>0&&!A.relevant[0].excluded&&"print"===A.relevant[0].viewname}function Lc(A){const e=A[Ho]()[po].paraStack;return e.length?e.at(-1):null}function Jc(A,e,t){if(t.attributes.class?.includes("xfaRich")){e&&(""===A.h&&(e.height="auto"),""===A.w&&(e.width="auto"));const i=Lc(A);if(i){const A=t.attributes.style;switch(A.display="flex",A.flexDirection="column",i.vAlign){case"top":A.justifyContent="start";break;case"bottom":A.justifyContent="end";break;case"middle":A.justifyContent="center"}const e=i[pI]();for(const[t,i]of Object.entries(e))t in A||(A[t]=i)}}}function Hc(A,e,t,i){if(!t)return void delete i.fontFamily;const a=kI(A.typeface);i.fontFamily=`"${a}"`;const s=t.find(a);if(s){const{fontFamily:t}=s.regular.cssFontInfo;t!==a&&(i.fontFamily=`"${t}"`);const n=Lc(e);if(n&&""!==n.lineHeight)return;if(i.lineHeight)return;const g=JI(A,s);g&&(i.lineHeight=Math.max(1.2,g.lineHeight))}}function Yc(A){const e=N(A,null,{addDefaultProtocol:!0,tryConvertEncoding:!0});return e?e.href:null}function vc(A,e){return{name:"div",attributes:{class:["lr-tb"===A.layout?"xfaLr":"xfaRl"]},children:e}}function Kc(A){if(!A[po])return null;const e={name:"div",attributes:A[po].attributes,children:A[po].children};if(A[po].failingNode){const t=A[po].failingNode[yo]();t&&(A.layout.endsWith("-tb")?e.children.push(vc(A,[t])):e.children.push(t))}return 0===e.children.length?null:e}function qc(A,e,t){const i=A[po],a=i.availableSpace,[s,n,g,r]=t;switch(A.layout){case"position":i.width=Math.max(i.width,s+g),i.height=Math.max(i.height,n+r),i.children.push(e);break;case"lr-tb":case"rl-tb":i.line&&1!==i.attempt||(i.line=vc(A,[]),i.children.push(i.line),i.numberInLine=0),i.numberInLine+=1,i.line.children.push(e),0===i.attempt?(i.currentWidth+=g,i.height=Math.max(i.height,i.prevHeight+r)):(i.currentWidth=g,i.prevHeight=i.height,i.height+=r,i.attempt=0),i.width=Math.max(i.width,i.currentWidth);break;case"rl-row":case"row":{i.children.push(e),i.width+=g,i.height=Math.max(i.height,r);const A=yc(i.height);for(const e of i.children)e.attributes.style.height=A;break}case"table":case"tb":i.width=Math.min(a.width,Math.max(i.width,g)),i.height+=r,i.children.push(e)}}function Tc(A){const e=A[po].availableSpace,t=A.margin?A.margin.topInset+A.margin.bottomInset:0,i=A.margin?A.margin.leftInset+A.margin.rightInset:0;switch(A.layout){case"lr-tb":case"rl-tb":return 0===A[po].attempt?{width:e.width-i-A[po].currentWidth,height:e.height-t-A[po].prevHeight}:{width:e.width-i,height:e.height-t-A[po].height};case"rl-row":case"row":return{width:A[po].columnWidths.slice(A[po].currentColumn).reduce(((A,e)=>A+e)),height:e.height-i};case"table":case"tb":return{width:e.width-i,height:e.height-t-A[po].height};default:return e}}function Pc(A,e){if(null===A[Ho]()[po].firstUnsplittable)return!0;if(0===A.w||0===A.h)return!0;const t=A[Lo](),i=t[po]?.attempt||0,[,a,s,n]=function(A){let e,t,i=""===A.w?NaN:A.w,a=""===A.h?NaN:A.h,[s,n]=[0,0];switch(A.anchorType||""){case"bottomCenter":[s,n]=[i/2,a];break;case"bottomLeft":[s,n]=[0,a];break;case"bottomRight":[s,n]=[i,a];break;case"middleCenter":[s,n]=[i/2,a/2];break;case"middleLeft":[s,n]=[0,a/2];break;case"middleRight":[s,n]=[i,a/2];break;case"topCenter":[s,n]=[i/2,0];break;case"topRight":[s,n]=[i,0]}switch(A.rotate||0){case 0:[e,t]=[-s,-n];break;case 90:[e,t]=[-n,s],[i,a]=[a,-i];break;case 180:[e,t]=[s,n],[i,a]=[-i,-a];break;case 270:[e,t]=[n,-s],[i,a]=[-a,i]}return[A.x+e+Math.min(0,i),A.y+t+Math.min(0,a),Math.abs(i),Math.abs(a)]}(A);switch(t.layout){case"lr-tb":case"rl-tb":return 0===i?A[Ho]()[po].noLayoutFailure?""!==A.w?Math.round(s-e.width)<=2:e.width>2:!(""!==A.h&&Math.round(n-e.height)>2)&&(""!==A.w?Math.round(s-e.width)<=2||0===t[po].numberInLine&&e.height>2:e.width>2):!!A[Ho]()[po].noLayoutFailure||!(""!==A.h&&Math.round(n-e.height)>2)&&(""===A.w||Math.round(s-e.width)<=2||!t[jo]())&&e.height>2;case"table":case"tb":return!!A[Ho]()[po].noLayoutFailure||(""===A.h||A[Vo]()?(""===A.w||Math.round(s-e.width)<=2||!t[jo]())&&e.height>2:Math.round(n-e.height)<=2);case"position":return!!A[Ho]()[po].noLayoutFailure||(""===A.h||Math.round(n+a-e.height)<=2||n+a>A[Ho]()[po].currentContentArea.h);case"rl-row":case"row":return!!A[Ho]()[po].noLayoutFailure||""===A.h||Math.round(n-e.height)<=2;default:return!0}}const Wc=wI.template.id,Zc="http://www.w3.org/2000/svg",Oc=/^H(\d+)$/,Xc=new Set(["image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/apng","image/x-png","image/bmp","image/x-ms-bmp","image/tiff","image/tif","application/octet-stream"]),Vc=[[[66,77],"image/bmp"],[[255,216,255],"image/jpeg"],[[73,73,42,0],"image/tiff"],[[77,77,0,42],"image/tiff"],[[71,73,70,56,57,97],"image/gif"],[[137,80,78,71,13,10,26,10],"image/png"]];function jc(A){if(!A||!A.border)return{w:0,h:0};const e=A.border[Go]();return e?{w:e.widths[0]+e.widths[2]+e.insets[0]+e.insets[2],h:e.widths[1]+e.widths[3]+e.insets[1]+e.insets[3]}:{w:0,h:0}}function zc(A){return A.margin&&(A.margin.topInset||A.margin.rightInset||A.margin.bottomInset||A.margin.leftInset)}function _c(A,e){if(!A.value){const e=new Ch({});A[Io](e),A.value=e}A.value[QI](e)}function*$c(A){for(const e of A[xo]())e instanceof _B?yield*e[Uo]():yield e}function AC(A){return"error"===A.validate?.nullTest}function eC(A){for(;A;){if(!A.traversal)return void(A[lI]=A[Jo]()[lI]);if(A[lI])return;let e=null;for(const t of A.traversal[xo]())if("next"===t.operation){e=t;break}if(!e||!e.ref)return void(A[lI]=A[Jo]()[lI]);const t=A[Ho]();A[lI]=++t[lI];const i=t[CI](e.ref,A);if(!i)return;A=i[0]}}function tC(A,e){const t=A.assist;if(t){const A=t[dI]();A&&(e.title=A);const i=t.role.match(Oc);if(i){const A="heading",t=i[1];e.role=A,e["aria-level"]=t}}if("table"===A.layout)e.role="table";else if("row"===A.layout)e.role="row";else{const t=A[Jo]();"row"===t.layout&&(e.role="TH"===t.assist?.role?"columnheader":"cell")}}function iC(A){if(!A.assist)return null;const e=A.assist;return e.speak&&""!==e.speak[Eo]?e.speak[Eo]:e.toolTip?e.toolTip[Eo]:null}function aC(A){return MI.success({name:"div",attributes:{class:["xfaRich"],style:Object.create(null)},children:[{name:"span",attributes:{style:Object.create(null)},value:A}]})}function sC(A){const e=A[Ho]();null===e[po].firstUnsplittable&&(e[po].firstUnsplittable=A,e[po].noLayoutFailure=!0)}function nC(A){const e=A[Ho]();e[po].firstUnsplittable===A&&(e[po].noLayoutFailure=!1)}function gC(A){if(A[po])return!1;if(A[po]=Object.create(null),"auto"===A.targetType)return!1;const e=A[Ho]();let t=null;if(A.target){if(t=e[CI](A.target,A[Jo]()),!t)return!1;t=t[0]}const{currentPageArea:i,currentContentArea:a}=e[po];if("pageArea"===A.targetType)return t instanceof GB||(t=null),A.startNew?(A[po].target=t||i,!0):!(!t||t===i||(A[po].target=t,0));t instanceof NC||(t=null);const s=t&&t[Jo]();let n,g=s;if(A.startNew)if(t){const A=s.contentArea.children,e=A.indexOf(a),i=A.indexOf(t);-1!==e&&eA,i[po].noLayoutFailure=!0;const n=e[dI](t);A[oo](n.html,n.bbox),i[po].noLayoutFailure=a,e[Lo]=s}class oC extends dc{constructor(A){super(Wc,"appearanceFilter"),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class IC extends Bc{constructor(A){super(Wc,"arc",!0),this.circular=FI({data:A.circular,defaultValue:0,validate:A=>1===A}),this.hand=GI(A.hand,["even","left","right"]),this.id=A.id||"",this.startAngle=SI({data:A.startAngle,defaultValue:0,validate:A=>!0}),this.sweepAngle=SI({data:A.sweepAngle,defaultValue:360,validate:A=>!0}),this.use=A.use||"",this.usehref=A.usehref||"",this.edge=null,this.fill=null}[dI](){const A=this.edge||new TC({}),e=A[pI](),t=Object.create(null);let i;"visible"===this.fill?.presence?Object.assign(t,this.fill[pI]()):t.fill="transparent",t.strokeWidth=yc("visible"===A.presence?A.thickness:0),t.stroke=e.color;const a={xmlns:Zc,style:{width:"100%",height:"100%",overflow:"visible"}};if(360===this.sweepAngle)i={name:"ellipse",attributes:{xmlns:Zc,cx:"50%",cy:"50%",rx:"50%",ry:"50%",style:t}};else{const A=this.startAngle*Math.PI/180,e=this.sweepAngle*Math.PI/180,s=this.sweepAngle>180?1:0,[n,g,r,o]=[50*(1+Math.cos(A)),50*(1-Math.sin(A)),50*(1+Math.cos(A+e)),50*(1-Math.sin(A+e))];i={name:"path",attributes:{xmlns:Zc,d:`M ${n} ${g} A 50 50 0 ${s} 0 ${r} ${o}`,vectorEffect:"non-scaling-stroke",style:t}},Object.assign(a,{viewBox:"0 0 100 100",preserveAspectRatio:"none"})}const s={name:"svg",children:[i],attributes:a};return zc(this[Jo]()[Jo]())?MI.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[s]}):(s.attributes.style.position="absolute",MI.success(s))}}class cC extends Bc{constructor(A){super(Wc,"area",!0),this.colSpan=FI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.id=A.id||"",this.name=A.name||"",this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.x=NI(A.x,"0pt"),this.y=NI(A.y,"0pt"),this.desc=null,this.extras=null,this.area=new hc,this.draw=new hc,this.exObject=new hc,this.exclGroup=new hc,this.field=new hc,this.subform=new hc,this.subformSet=new hc}*[Uo](){yield*$c(this)}[zo](){return!0}[Wo](){return!0}[oo](A,e){const[t,i,a,s]=e;this[po].width=Math.max(this[po].width,t+a),this[po].height=Math.max(this[po].height,i+s),this[po].children.push(A)}[bo](){return this[po].availableSpace}[dI](A){const e=Gc(this,"position"),t={style:e,id:this[mI],class:["xfaArea"]};Mc(this)&&t.class.push("xfaPrintOnly"),this.name&&(t.xfaName=this.name);const i=[];this[po]={children:i,width:0,height:0,availableSpace:A};const a=this[co]({filter:new Set(["area","draw","field","exclGroup","subform","subformSet"]),include:!0});if(!a.success)return a.isBreak()?a:(delete this[po],MI.FAILURE);e.width=yc(this[po].width),e.height=yc(this[po].height);const s={name:"div",attributes:t,children:i},n=[this.x,this.y,this[po].width,this[po].height];return delete this[po],MI.success(s,n)}}class CC extends Bc{constructor(A){super(Wc,"assist",!0),this.id=A.id||"",this.role=A.role||"",this.use=A.use||"",this.usehref=A.usehref||"",this.speak=null,this.toolTip=null}[dI](){return this.toolTip?.[Eo]||null}}class BC extends Bc{constructor(A){super(Wc,"barcode",!0),this.charEncoding=RI({data:A.charEncoding?A.charEncoding.toLowerCase():"",defaultValue:"",validate:A=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(A)||A.match(/iso-8859-\d{2}/)}),this.checksum=GI(A.checksum,["none","1mod10","1mod10_1mod11","2mod10","auto"]),this.dataColumnCount=FI({data:A.dataColumnCount,defaultValue:-1,validate:A=>A>=0}),this.dataLength=FI({data:A.dataLength,defaultValue:-1,validate:A=>A>=0}),this.dataPrep=GI(A.dataPrep,["none","flateCompress"]),this.dataRowCount=FI({data:A.dataRowCount,defaultValue:-1,validate:A=>A>=0}),this.endChar=A.endChar||"",this.errorCorrectionLevel=FI({data:A.errorCorrectionLevel,defaultValue:-1,validate:A=>A>=0&&A<=8}),this.id=A.id||"",this.moduleHeight=NI(A.moduleHeight,"5mm"),this.moduleWidth=NI(A.moduleWidth,"0.25mm"),this.printCheckDigit=FI({data:A.printCheckDigit,defaultValue:0,validate:A=>1===A}),this.rowColumnRatio=xI(A.rowColumnRatio),this.startChar=A.startChar||"",this.textLocation=GI(A.textLocation,["below","above","aboveEmbedded","belowEmbedded","none"]),this.truncate=FI({data:A.truncate,defaultValue:0,validate:A=>1===A}),this.type=GI(A.type?A.type.toLowerCase():"",["aztec","codabar","code2of5industrial","code2of5interleaved","code2of5matrix","code2of5standard","code3of9","code3of9extended","code11","code49","code93","code128","code128a","code128b","code128c","code128sscc","datamatrix","ean8","ean8add2","ean8add5","ean13","ean13add2","ean13add5","ean13pwcd","fim","logmars","maxicode","msi","pdf417","pdf417macro","plessey","postauscust2","postauscust3","postausreplypaid","postausstandard","postukrm4scc","postusdpbc","postusimb","postusstandard","postus5zip","qrcode","rfid","rss14","rss14expanded","rss14limited","rss14stacked","rss14stackedomni","rss14truncated","telepen","ucc128","ucc128random","ucc128sscc","upca","upcaadd2","upcaadd5","upcapwcd","upce","upceadd2","upceadd5","upcean2","upcean5","upsmaxicode"]),this.upsMode=GI(A.upsMode,["usCarrier","internationalCarrier","secureSymbol","standardSymbol"]),this.use=A.use||"",this.usehref=A.usehref||"",this.wideNarrowRatio=xI(A.wideNarrowRatio),this.encrypt=null,this.extras=null}}class hC extends Bc{constructor(A){super(Wc,"bind",!0),this.match=GI(A.match,["once","dataRef","global","none"]),this.ref=A.ref||"",this.picture=null}}class QC extends Bc{constructor(A){super(Wc,"bindItems"),this.connection=A.connection||"",this.labelRef=A.labelRef||"",this.ref=A.ref||"",this.valueRef=A.valueRef||""}}class lC extends Bc{constructor(A){super(Wc,"bookend"),this.id=A.id||"",this.leader=A.leader||"",this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||""}}class EC extends pc{constructor(A){super(Wc,"boolean"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[dI](A){return aC(1===this[Eo]?"1":"0")}}class uC extends Bc{constructor(A){super(Wc,"border",!0),this.break=GI(A.break,["close","open"]),this.hand=GI(A.hand,["even","left","right"]),this.id=A.id||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.corner=new hc(4),this.edge=new hc(4),this.extras=null,this.fill=null,this.margin=null}[Go](){if(!this[po]){const A=this.edge.children.slice();if(A.length<4){const e=A.at(-1)||new TC({});for(let t=A.length;t<4;t++)A.push(e)}const e=A.map((A=>A.thickness)),t=[0,0,0,0];this.margin&&(t[0]=this.margin.topInset,t[1]=this.margin.rightInset,t[2]=this.margin.bottomInset,t[3]=this.margin.leftInset),this[po]={widths:e,insets:t,edges:A}}return this[po]}[pI](){const{edges:A}=this[Go](),e=A.map((A=>{const e=A[pI]();return e.color||="#000000",e})),t=Object.create(null);if(this.margin&&Object.assign(t,this.margin[pI]()),"visible"===this.fill?.presence&&Object.assign(t,this.fill[pI]()),this.corner.children.some((A=>0!==A.radius))){const A=this.corner.children.map((A=>A[pI]()));if(2===A.length||3===A.length){const e=A.at(-1);for(let t=A.length;t<4;t++)A.push(e)}t.borderRadius=A.map((A=>A.radius)).join(" ")}switch(this.presence){case"invisible":case"hidden":t.borderStyle="";break;case"inactive":t.borderStyle="none";break;default:t.borderStyle=e.map((A=>A.style)).join(" ")}return t.borderWidth=e.map((A=>A.width)).join(" "),t.borderColor=e.map((A=>A.color)).join(" "),t}}class dC extends Bc{constructor(A){super(Wc,"break",!0),this.after=GI(A.after,["auto","contentArea","pageArea","pageEven","pageOdd"]),this.afterTarget=A.afterTarget||"",this.before=GI(A.before,["auto","contentArea","pageArea","pageEven","pageOdd"]),this.beforeTarget=A.beforeTarget||"",this.bookendLeader=A.bookendLeader||"",this.bookendTrailer=A.bookendTrailer||"",this.id=A.id||"",this.overflowLeader=A.overflowLeader||"",this.overflowTarget=A.overflowTarget||"",this.overflowTrailer=A.overflowTrailer||"",this.startNew=FI({data:A.startNew,defaultValue:0,validate:A=>1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}}class fC extends Bc{constructor(A){super(Wc,"breakAfter",!0),this.id=A.id||"",this.leader=A.leader||"",this.startNew=FI({data:A.startNew,defaultValue:0,validate:A=>1===A}),this.target=A.target||"",this.targetType=GI(A.targetType,["auto","contentArea","pageArea"]),this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||"",this.script=null}}class pC extends Bc{constructor(A){super(Wc,"breakBefore",!0),this.id=A.id||"",this.leader=A.leader||"",this.startNew=FI({data:A.startNew,defaultValue:0,validate:A=>1===A}),this.target=A.target||"",this.targetType=GI(A.targetType,["auto","contentArea","pageArea"]),this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||"",this.script=null}[dI](A){return this[po]={},MI.FAILURE}}class mC extends Bc{constructor(A){super(Wc,"button",!0),this.highlight=GI(A.highlight,["inverted","none","outline","push"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[dI](A){const e=this[Jo]()[Jo](),t={name:"button",attributes:{id:this[mI],class:["xfaButton"],style:{}},children:[]};for(const A of e.event.children){if("click"!==A.activity||!A.script)continue;const e=VA(A.script[Eo]);if(!e)continue;const i=Yc(e.url);i&&t.children.push({name:"a",attributes:{id:"link"+this[mI],href:i,newWindow:e.newWindow,class:["xfaLink"],style:{}},children:[]})}return MI.success(t)}}class yC extends Bc{constructor(A){super(Wc,"calculate",!0),this.id=A.id||"",this.override=GI(A.override,["disabled","error","ignore","warning"]),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.message=null,this.script=null}}class wC extends Bc{constructor(A){super(Wc,"caption",!0),this.id=A.id||"",this.placement=GI(A.placement,["left","bottom","inline","right","top"]),this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.reserve=Math.ceil(NI(A.reserve)),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.font=null,this.margin=null,this.para=null,this.value=null}[QI](A){_c(this,A)}[Go](A){if(!this[po]){let{width:e,height:t}=A;switch(this.placement){case"left":case"right":case"inline":e=this.reserve<=0?e:this.reserve;break;case"top":case"bottom":t=this.reserve<=0?t:this.reserve}this[po]=kc(this,{width:e,height:t})}return this[po]}[dI](A){if(!this.value)return MI.EMPTY;this[rI]();const e=this.value[dI](A).html;if(!e)return this[gI](),MI.EMPTY;const t=this.reserve;if(this.reserve<=0){const{w:e,h:t}=this[Go](A);switch(this.placement){case"left":case"right":case"inline":this.reserve=e;break;case"top":case"bottom":this.reserve=t}}const i=[];"string"==typeof e?i.push({name:"#text",value:e}):i.push(e);const a=Gc(this,"font","margin","visibility");switch(this.placement){case"left":case"right":this.reserve>0&&(a.width=yc(this.reserve));break;case"top":case"bottom":this.reserve>0&&(a.height=yc(this.reserve))}return Jc(this,null,e),this[gI](),this.reserve=t,MI.success({name:"div",attributes:{style:a,class:["xfaCaption"]},children:i})}}class DC extends dc{constructor(A){super(Wc,"certificate"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class bC extends Bc{constructor(A){super(Wc,"certificates",!0),this.credentialServerPolicy=GI(A.credentialServerPolicy,["optional","required"]),this.id=A.id||"",this.url=A.url||"",this.urlPolicy=A.urlPolicy||"",this.use=A.use||"",this.usehref=A.usehref||"",this.encryption=null,this.issuers=null,this.keyUsage=null,this.oids=null,this.signing=null,this.subjectDNs=null}}class kC extends Bc{constructor(A){super(Wc,"checkButton",!0),this.id=A.id||"",this.mark=GI(A.mark,["default","check","circle","cross","diamond","square","star"]),this.shape=GI(A.shape,["square","round"]),this.size=NI(A.size,"10pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[dI](A){const e=Gc("margin"),t=yc(this.size);let i,a,s;e.width=e.height=t;const n=this[Jo]()[Jo](),g=n.items.children.length&&n.items.children[0][dI]().html||[],r={on:(void 0!==g[0]?g[0]:"on").toString(),off:(void 0!==g[1]?g[1]:"off").toString()},o=(n.value?.[EI]()||"off")===r.on||void 0,I=n[Lo](),c=n[mI];let C;I instanceof AB?(s=I[mI],i="radio",a="xfaRadio",C=I[uo]?.[mI]||I[mI]):(i="checkbox",a="xfaCheckbox",C=n[uo]?.[mI]||n[mI]);const B={name:"input",attributes:{class:[a],style:e,fieldId:c,dataId:C,type:i,checked:o,xfaOn:r.on,xfaOff:r.off,"aria-label":iC(n),"aria-required":!1}};return s&&(B.attributes.name=s),AC(n)&&(B.attributes["aria-required"]=!0,B.attributes.required=!0),MI.success({name:"label",attributes:{class:["xfaLabel"]},children:[B]})}}class FC extends Bc{constructor(A){super(Wc,"choiceList",!0),this.commitOn=GI(A.commitOn,["select","exit"]),this.id=A.id||"",this.open=GI(A.open,["userControl","always","multiSelect","onEntry"]),this.textEntry=FI({data:A.textEntry,defaultValue:0,validate:A=>1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[dI](A){const e=Gc(this,"border","margin"),t=this[Jo]()[Jo](),i={fontSize:`calc(${t.font?.size||10}px * var(--scale-factor))`},a=[];if(t.items.children.length>0){const A=t.items;let e=0,s=0;2===A.children.length&&(e=A.children[0].save,s=1-e);const n=A.children[e][dI]().html,g=A.children[s][dI]().html;let r=!1;const o=t.value?.[EI]()||"";for(let A=0,e=n.length;AMath.min(Math.max(0,parseInt(A.trim(),10)),255))).map((A=>isNaN(A)?0:A));return s.length<3||([t,i,a]=s),{r:t,g:i,b:a}}(A.value):"",this.extras=null}[vo](){return!1}[pI](){return this.value?X.makeHexColor(this.value.r,this.value.g,this.value.b):null}}class RC extends Bc{constructor(A){super(Wc,"comb"),this.id=A.id||"",this.numberOfCells=FI({data:A.numberOfCells,defaultValue:0,validate:A=>A>=0}),this.use=A.use||"",this.usehref=A.usehref||""}}class GC extends Bc{constructor(A){super(Wc,"connect",!0),this.connection=A.connection||"",this.id=A.id||"",this.ref=A.ref||"",this.usage=GI(A.usage,["exportAndImport","exportOnly","importOnly"]),this.use=A.use||"",this.usehref=A.usehref||"",this.picture=null}}class NC extends Bc{constructor(A){super(Wc,"contentArea",!0),this.h=NI(A.h),this.id=A.id||"",this.name=A.name||"",this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.w=NI(A.w),this.x=NI(A.x,"0pt"),this.y=NI(A.y,"0pt"),this.desc=null,this.extras=null}[dI](A){const e={left:yc(this.x),top:yc(this.y),width:yc(this.w),height:yc(this.h)},t=["xfaContentarea"];return Mc(this)&&t.push("xfaPrintOnly"),MI.success({name:"div",children:[],attributes:{style:e,class:t,id:this[mI]}})}}class xC extends Bc{constructor(A){super(Wc,"corner",!0),this.id=A.id||"",this.inverted=FI({data:A.inverted,defaultValue:0,validate:A=>1===A}),this.join=GI(A.join,["square","round"]),this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.radius=NI(A.radius),this.stroke=GI(A.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]),this.thickness=NI(A.thickness,"0.5pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[pI](){const A=Gc(this,"visibility");return A.radius=yc("square"===this.join?0:this.radius),A}}class UC extends Ec{constructor(A){super(Wc,"date"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){const A=this[Eo].trim();this[Eo]=A?new Date(A):null}[dI](A){return aC(this[Eo]?this[Eo].toString():"")}}class MC extends Ec{constructor(A){super(Wc,"dateTime"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){const A=this[Eo].trim();this[Eo]=A?new Date(A):null}[dI](A){return aC(this[Eo]?this[Eo].toString():"")}}class LC extends Bc{constructor(A){super(Wc,"dateTimeEdit",!0),this.hScrollPolicy=GI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.picker=GI(A.picker,["host","none"]),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.comb=null,this.extras=null,this.margin=null}[dI](A){const e=Gc(this,"border","font","margin"),t=this[Jo]()[Jo](),i={name:"input",attributes:{type:"text",fieldId:t[mI],dataId:t[uo]?.[mI]||t[mI],class:["xfaTextfield"],style:e,"aria-label":iC(t),"aria-required":!1}};return AC(t)&&(i.attributes["aria-required"]=!0,i.attributes.required=!0),MI.success({name:"label",attributes:{class:["xfaLabel"]},children:[i]})}}class JC extends Ec{constructor(A){super(Wc,"decimal"),this.fracDigits=FI({data:A.fracDigits,defaultValue:2,validate:A=>!0}),this.id=A.id||"",this.leadDigits=FI({data:A.leadDigits,defaultValue:-1,validate:A=>!0}),this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){const A=parseFloat(this[Eo].trim());this[Eo]=isNaN(A)?null:A}[dI](A){return aC(null!==this[Eo]?this[Eo].toString():"")}}class HC extends Bc{constructor(A){super(Wc,"defaultUi",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}}class YC extends Bc{constructor(A){super(Wc,"desc",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new hc,this.date=new hc,this.dateTime=new hc,this.decimal=new hc,this.exData=new hc,this.float=new hc,this.image=new hc,this.integer=new hc,this.text=new hc,this.time=new hc}}class vC extends uc{constructor(A){super(Wc,"digestMethod",["","SHA1","SHA256","SHA512","RIPEMD160"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class KC extends Bc{constructor(A){super(Wc,"digestMethods",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.digestMethod=new hc}}class qC extends Bc{constructor(A){super(Wc,"draw",!0),this.anchorType=GI(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=FI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.h=A.h?NI(A.h):"",this.hAlign=GI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.locale=A.locale||"",this.maxH=NI(A.maxH,"0pt"),this.maxW=NI(A.maxW,"0pt"),this.minH=NI(A.minH,"0pt"),this.minW=NI(A.minW,"0pt"),this.name=A.name||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=UI(A.relevant),this.rotate=FI({data:A.rotate,defaultValue:0,validate:A=>A%90==0}),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?NI(A.w):"",this.x=NI(A.x,"0pt"),this.y=NI(A.y,"0pt"),this.assist=null,this.border=null,this.caption=null,this.desc=null,this.extras=null,this.font=null,this.keep=null,this.margin=null,this.para=null,this.traversal=null,this.ui=null,this.value=null,this.setProperty=new hc}[QI](A){_c(this,A)}[dI](A){if(eC(this),"hidden"===this.presence||"inactive"===this.presence)return MI.EMPTY;Sc(this),this[rI]();const e=this.w,t=this.h,{w:i,h:a,isBroken:s}=kc(this,A);if(i&&""===this.w){if(s&&this[Lo]()[jo]())return this[gI](),MI.FAILURE;this.w=i}if(a&&""===this.h&&(this.h=a),sC(this),!Pc(this,A))return this.w=e,this.h=t,this[gI](),MI.FAILURE;nC(this);const n=Gc(this,"font","hAlign","dimensions","position","presence","rotate","anchorType","border","margin");Dc(this,n),n.margin&&(n.padding=n.margin,delete n.margin);const g=["xfaDraw"];this.font&&g.push("xfaFont"),Mc(this)&&g.push("xfaPrintOnly");const r={style:n,id:this[mI],class:g};this.name&&(r.xfaName=this.name);const o={name:"div",attributes:r,children:[]};tC(this,r);const I=Fc(this,o,A),c=this.value?this.value[dI](A).html:null;return null===c?(this.w=e,this.h=t,this[gI](),MI.success(Nc(this,o),I)):(o.children.push(c),Jc(this,n,c),this.w=e,this.h=t,this[gI](),MI.success(Nc(this,o),I))}}class TC extends Bc{constructor(A){super(Wc,"edge",!0),this.cap=GI(A.cap,["square","butt","round"]),this.id=A.id||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.stroke=GI(A.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]),this.thickness=NI(A.thickness,"0.5pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[pI](){const A=Gc(this,"visibility");if(Object.assign(A,{linecap:this.cap,width:yc(this.thickness),color:this.color?this.color[pI]():"#000000",style:""}),"visible"!==this.presence)A.style="none";else switch(this.stroke){case"solid":A.style="solid";break;case"dashDot":case"dashDotDot":case"dashed":A.style="dashed";break;case"dotted":A.style="dotted";break;case"embossed":A.style="ridge";break;case"etched":A.style="groove";break;case"lowered":A.style="inset";break;case"raised":A.style="outset"}return A}}class PC extends uc{constructor(A){super(Wc,"encoding",["adbe.x509.rsa_sha1","adbe.pkcs7.detached","adbe.pkcs7.sha1"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class WC extends Bc{constructor(A){super(Wc,"encodings",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.encoding=new hc}}class ZC extends Bc{constructor(A){super(Wc,"encrypt",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=null}}class OC extends Bc{constructor(A){super(Wc,"encryptData",!0),this.id=A.id||"",this.operation=GI(A.operation,["encrypt","decrypt"]),this.target=A.target||"",this.use=A.use||"",this.usehref=A.usehref||"",this.filter=null,this.manifest=null}}class XC extends Bc{constructor(A){super(Wc,"encryption",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new hc}}class VC extends uc{constructor(A){super(Wc,"encryptionMethod",["","AES256-CBC","TRIPLEDES-CBC","AES128-CBC","AES192-CBC"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class jC extends Bc{constructor(A){super(Wc,"encryptionMethods",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.encryptionMethod=new hc}}class zC extends Bc{constructor(A){super(Wc,"event",!0),this.activity=GI(A.activity,["click","change","docClose","docReady","enter","exit","full","indexChange","initialize","mouseDown","mouseEnter","mouseExit","mouseUp","postExecute","postOpen","postPrint","postSave","postSign","postSubmit","preExecute","preOpen","prePrint","preSave","preSign","preSubmit","ready","validationState"]),this.id=A.id||"",this.listen=GI(A.listen,["refOnly","refAndDescendents"]),this.name=A.name||"",this.ref=A.ref||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.encryptData=null,this.execute=null,this.script=null,this.signData=null,this.submit=null}}class _C extends Ec{constructor(A){super(Wc,"exData"),this.contentType=A.contentType||"",this.href=A.href||"",this.id=A.id||"",this.maxLength=FI({data:A.maxLength,defaultValue:-1,validate:A=>A>=-1}),this.name=A.name||"",this.rid=A.rid||"",this.transferEncoding=GI(A.transferEncoding,["none","base64","package"]),this.use=A.use||"",this.usehref=A.usehref||""}[Po](){return"text/html"===this.contentType}[iI](A){return("text/html"===this.contentType&&A[AI]===wI.xhtml.id||"text/xml"===this.contentType)&&(this[Eo]=A,!0)}[dI](A){return"text/html"===this.contentType&&this[Eo]?this[Eo][dI](A):MI.EMPTY}}class $C extends Bc{constructor(A){super(Wc,"exObject",!0),this.archive=A.archive||"",this.classId=A.classId||"",this.codeBase=A.codeBase||"",this.codeType=A.codeType||"",this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.boolean=new hc,this.date=new hc,this.dateTime=new hc,this.decimal=new hc,this.exData=new hc,this.exObject=new hc,this.float=new hc,this.image=new hc,this.integer=new hc,this.text=new hc,this.time=new hc}}class AB extends Bc{constructor(A){super(Wc,"exclGroup",!0),this.access=GI(A.access,["open","nonInteractive","protected","readOnly"]),this.accessKey=A.accessKey||"",this.anchorType=GI(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=FI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.h=A.h?NI(A.h):"",this.hAlign=GI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.layout=GI(A.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]),this.maxH=NI(A.maxH,"0pt"),this.maxW=NI(A.maxW,"0pt"),this.minH=NI(A.minH,"0pt"),this.minW=NI(A.minW,"0pt"),this.name=A.name||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?NI(A.w):"",this.x=NI(A.x,"0pt"),this.y=NI(A.y,"0pt"),this.assist=null,this.bind=null,this.border=null,this.calculate=null,this.caption=null,this.desc=null,this.extras=null,this.margin=null,this.para=null,this.traversal=null,this.validate=null,this.connect=new hc,this.event=new hc,this.field=new hc,this.setProperty=new hc}[Wo](){return!0}[vo](){return!0}[QI](A){for(const e of this.field.children){if(!e.value){const A=new Ch({});e[Io](A),e.value=A}e.value[QI](A)}}[jo](){return this.layout.endsWith("-tb")&&0===this[po].attempt&&this[po].numberInLine>0||this[Jo]()[jo]()}[Vo](){const A=this[Lo]();return!!A[Vo]()&&(void 0!==this[po]._isSplittable?this[po]._isSplittable:"position"===this.layout||this.layout.includes("row")?(this[po]._isSplittable=!1,!1):!(A.layout?.endsWith("-tb")&&0!==A[po].numberInLine||(this[po]._isSplittable=!0,0)))}[yo](){return Kc(this)}[oo](A,e){qc(this,A,e)}[bo](){return Tc(this)}[dI](A){if(eC(this),"hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return MI.EMPTY;Sc(this);const e=[],t={id:this[mI],class:[]};Uc(this,t.class),this[po]||(this[po]=Object.create(null)),Object.assign(this[po],{children:e,attributes:t,attempt:0,line:null,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,A.width),height:Math.min(this.h||1/0,A.height)},width:0,height:0,prevHeight:0,currentWidth:0});const i=this[Vo]();if(i||sC(this),!Pc(this,A))return MI.FAILURE;const a=new Set(["field"]);if(this.layout.includes("row")){const A=this[Lo]().columnWidths;Array.isArray(A)&&A.length>0&&(this[po].columnWidths=A,this[po].currentColumn=0)}const s=Gc(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),n=["xfaExclgroup"],g=Rc(this);g&&n.push(g),Mc(this)&&n.push("xfaPrintOnly"),t.style=s,t.class=n,this.name&&(t.xfaName=this.name),this[rI]();const r="lr-tb"===this.layout||"rl-tb"===this.layout,o=r?2:1;for(;this[po].attemptA>=1||-1===A}),this.h=A.h?NI(A.h):"",this.hAlign=GI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.locale=A.locale||"",this.maxH=NI(A.maxH,"0pt"),this.maxW=NI(A.maxW,"0pt"),this.minH=NI(A.minH,"0pt"),this.minW=NI(A.minW,"0pt"),this.name=A.name||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=UI(A.relevant),this.rotate=FI({data:A.rotate,defaultValue:0,validate:A=>A%90==0}),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?NI(A.w):"",this.x=NI(A.x,"0pt"),this.y=NI(A.y,"0pt"),this.assist=null,this.bind=null,this.border=null,this.calculate=null,this.caption=null,this.desc=null,this.extras=null,this.font=null,this.format=null,this.items=new hc(2),this.keep=null,this.margin=null,this.para=null,this.traversal=null,this.ui=null,this.validate=null,this.value=null,this.bindItems=new hc,this.connect=new hc,this.event=new hc,this.setProperty=new hc}[Wo](){return!0}[QI](A){_c(this,A)}[dI](A){if(eC(this),!this.ui){let A;switch(this.ui=new Ih({}),this.ui[Yo]=this[Yo],this[Io](this.ui),this.items.children.length){case 0:A=new ah({}),this.ui.textEdit=A;break;case 1:A=new kC({}),this.ui.checkButton=A;break;case 2:A=new FC({}),this.ui.choiceList=A}this.ui[Io](A)}if(!this.ui||"hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return MI.EMPTY;this.caption&&delete this.caption[po],this[rI]();const e=this.caption?this.caption[dI](A).html:null,t=this.w,i=this.h;let a=0,s=0;this.margin&&(a=this.margin.leftInset+this.margin.rightInset,s=this.margin.topInset+this.margin.bottomInset);let n=null;if(""===this.w||""===this.h){let e=null,t=null,i=0,g=0;if(this.ui.checkButton)i=g=this.ui.checkButton.size;else{const{w:e,h:t}=kc(this,A);null!==e?(i=e,g=t):g=function(A,e=!1){let t=null;if(A){const e=kI(A.typeface),i=A[Yo].fontFinder.find(e);t=JI(A,i)}if(!t)return{lineHeight:12,lineGap:2,lineNoGap:10};const i=A.size||10,a=t.lineHeight?Math.max(e?0:1.2,t.lineHeight):1.2,s=void 0===t.lineGap?.2:t.lineGap;return{lineHeight:a*i,lineGap:s*i,lineNoGap:Math.max(1,a-s)*i}}(this.font,!0).lineNoGap}if(n=jc(this.ui[Go]()),i+=n.w,g+=n.h,this.caption){const{w:a,h:s,isBroken:n}=this.caption[Go](A);if(n&&this[Lo]()[jo]())return this[gI](),MI.FAILURE;switch(e=a,t=s,this.caption.placement){case"left":case"right":case"inline":e+=i;break;case"top":case"bottom":t+=g}}else e=i,t=g;e&&""===this.w&&(e+=a,this.w=Math.min(this.maxW<=0?1/0:this.maxW,this.minW+1A>=1&&A<=5}),this.appearanceFilter=null,this.certificates=null,this.digestMethods=null,this.encodings=null,this.encryptionMethods=null,this.handler=null,this.lockDocument=null,this.mdp=null,this.reasons=null,this.timeStamp=null}}class nB extends Ec{constructor(A){super(Wc,"float"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){const A=parseFloat(this[Eo].trim());this[Eo]=isNaN(A)?null:A}[dI](A){return aC(null!==this[Eo]?this[Eo].toString():"")}}class gB extends Bc{constructor(A){super(Wc,"font",!0),this.baselineShift=NI(A.baselineShift),this.fontHorizontalScale=SI({data:A.fontHorizontalScale,defaultValue:100,validate:A=>A>=0}),this.fontVerticalScale=SI({data:A.fontVerticalScale,defaultValue:100,validate:A=>A>=0}),this.id=A.id||"",this.kerningMode=GI(A.kerningMode,["none","pair"]),this.letterSpacing=NI(A.letterSpacing,"0"),this.lineThrough=FI({data:A.lineThrough,defaultValue:0,validate:A=>1===A||2===A}),this.lineThroughPeriod=GI(A.lineThroughPeriod,["all","word"]),this.overline=FI({data:A.overline,defaultValue:0,validate:A=>1===A||2===A}),this.overlinePeriod=GI(A.overlinePeriod,["all","word"]),this.posture=GI(A.posture,["normal","italic"]),this.size=NI(A.size,"10pt"),this.typeface=A.typeface||"Courier",this.underline=FI({data:A.underline,defaultValue:0,validate:A=>1===A||2===A}),this.underlinePeriod=GI(A.underlinePeriod,["all","word"]),this.use=A.use||"",this.usehref=A.usehref||"",this.weight=GI(A.weight,["normal","bold"]),this.extras=null,this.fill=null}[Co](A){super[Co](A),this[Yo].usedTypefaces.add(this.typeface)}[pI](){const A=Gc(this,"fill"),e=A.color;return e&&("#000000"===e?delete A.color:e.startsWith("#")||(A.background=e,A.backgroundClip="text",A.color="transparent")),this.baselineShift&&(A.verticalAlign=yc(this.baselineShift)),A.fontKerning="none"===this.kerningMode?"none":"normal",A.letterSpacing=yc(this.letterSpacing),0!==this.lineThrough&&(A.textDecoration="line-through",2===this.lineThrough&&(A.textDecorationStyle="double")),0!==this.overline&&(A.textDecoration="overline",2===this.overline&&(A.textDecorationStyle="double")),A.fontStyle=this.posture,A.fontSize=yc(.99*this.size),Hc(this,this,this[Yo].fontFinder,A),0!==this.underline&&(A.textDecoration="underline",2===this.underline&&(A.textDecorationStyle="double")),A.fontWeight=this.weight,A}}class rB extends Bc{constructor(A){super(Wc,"format",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.picture=null}}class oB extends dc{constructor(A){super(Wc,"handler"),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class IB extends Bc{constructor(A){super(Wc,"hyphenation"),this.excludeAllCaps=FI({data:A.excludeAllCaps,defaultValue:0,validate:A=>1===A}),this.excludeInitialCap=FI({data:A.excludeInitialCap,defaultValue:0,validate:A=>1===A}),this.hyphenate=FI({data:A.hyphenate,defaultValue:0,validate:A=>1===A}),this.id=A.id||"",this.pushCharacterCount=FI({data:A.pushCharacterCount,defaultValue:3,validate:A=>A>=0}),this.remainCharacterCount=FI({data:A.remainCharacterCount,defaultValue:3,validate:A=>A>=0}),this.use=A.use||"",this.usehref=A.usehref||"",this.wordCharacterCount=FI({data:A.wordCharacterCount,defaultValue:7,validate:A=>A>=0})}}class cB extends dc{constructor(A){super(Wc,"image"),this.aspect=GI(A.aspect,["fit","actual","height","none","width"]),this.contentType=A.contentType||"",this.href=A.href||"",this.id=A.id||"",this.name=A.name||"",this.transferEncoding=GI(A.transferEncoding,["base64","none","package"]),this.use=A.use||"",this.usehref=A.usehref||""}[dI](){if(this.contentType&&!Xc.has(this.contentType.toLowerCase()))return MI.EMPTY;let A=this[Yo].images&&this[Yo].images.get(this.href);if(!A&&(this.href||!this[Eo]))return MI.EMPTY;if(A||"base64"!==this.transferEncoding||(A=T(atob(this[Eo]))),!A)return MI.EMPTY;if(!this.contentType){for(const[e,t]of Vc)if(A.length>e.length&&e.every(((e,t)=>e===A[t]))){this.contentType=t;break}if(!this.contentType)return MI.EMPTY}const e=new Blob([A],{type:this.contentType});let t;switch(this.aspect){case"fit":case"actual":break;case"height":t={height:"100%",objectFit:"fill"};break;case"none":t={width:"100%",height:"100%",objectFit:"fill"};break;case"width":t={width:"100%",objectFit:"fill"}}const i=this[Jo]();return MI.success({name:"img",attributes:{class:["xfaImage"],style:t,src:URL.createObjectURL(e),alt:i?iC(i[Jo]()):null}})}}class CB extends Bc{constructor(A){super(Wc,"imageEdit",!0),this.data=GI(A.data,["link","embed"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[dI](A){return"embed"===this.data?MI.success({name:"div",children:[],attributes:{}}):MI.EMPTY}}class BB extends Ec{constructor(A){super(Wc,"integer"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){const A=parseInt(this[Eo].trim(),10);this[Eo]=isNaN(A)?null:A}[dI](A){return aC(null!==this[Eo]?this[Eo].toString():"")}}class hB extends Bc{constructor(A){super(Wc,"issuers",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new hc}}class QB extends Bc{constructor(A){super(Wc,"items",!0),this.id=A.id||"",this.name=A.name||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.ref=A.ref||"",this.save=FI({data:A.save,defaultValue:0,validate:A=>1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new hc,this.date=new hc,this.dateTime=new hc,this.decimal=new hc,this.exData=new hc,this.float=new hc,this.image=new hc,this.integer=new hc,this.text=new hc,this.time=new hc}[dI](){const A=[];for(const e of this[xo]())A.push(e[EI]());return MI.success(A)}}class lB extends Bc{constructor(A){super(Wc,"keep",!0),this.id=A.id||"";const e=["none","contentArea","pageArea"];this.intact=GI(A.intact,e),this.next=GI(A.next,e),this.previous=GI(A.previous,e),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}}class EB extends Bc{constructor(A){super(Wc,"keyUsage");const e=["","yes","no"];this.crlSign=GI(A.crlSign,e),this.dataEncipherment=GI(A.dataEncipherment,e),this.decipherOnly=GI(A.decipherOnly,e),this.digitalSignature=GI(A.digitalSignature,e),this.encipherOnly=GI(A.encipherOnly,e),this.id=A.id||"",this.keyAgreement=GI(A.keyAgreement,e),this.keyCertSign=GI(A.keyCertSign,e),this.keyEncipherment=GI(A.keyEncipherment,e),this.nonRepudiation=GI(A.nonRepudiation,e),this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class uB extends Bc{constructor(A){super(Wc,"line",!0),this.hand=GI(A.hand,["even","left","right"]),this.id=A.id||"",this.slope=GI(A.slope,["\\","/"]),this.use=A.use||"",this.usehref=A.usehref||"",this.edge=null}[dI](){const A=this[Jo]()[Jo](),e=this.edge||new TC({}),t=e[pI](),i=Object.create(null),a="visible"===e.presence?e.thickness:0;let s,n,g,r;i.strokeWidth=yc(a),i.stroke=t.color;let o="100%",I="100%";A.w<=a?([s,n,g,r]=["50%",0,"50%","100%"],o=i.strokeWidth):A.h<=a?([s,n,g,r]=[0,"50%","100%","50%"],I=i.strokeWidth):"\\"===this.slope?[s,n,g,r]=[0,0,"100%","100%"]:[s,n,g,r]=[0,"100%","100%",0];const c={name:"svg",children:[{name:"line",attributes:{xmlns:Zc,x1:s,y1:n,x2:g,y2:r,style:i}}],attributes:{xmlns:Zc,width:o,height:I,style:{overflow:"visible"}}};return zc(A)?MI.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[c]}):(c.attributes.style.position="absolute",MI.success(c))}}class dB extends Bc{constructor(A){super(Wc,"linear",!0),this.id=A.id||"",this.type=GI(A.type,["toRight","toBottom","toLeft","toTop"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[pI](A){return A=A?A[pI]():"#FFFFFF",`linear-gradient(${this.type.replace(/([RBLT])/," $1").toLowerCase()}, ${A}, ${this.color?this.color[pI]():"#000000"})`}}class fB extends Ec{constructor(A){super(Wc,"lockDocument"),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}[mo](){this[Eo]=GI(this[Eo],["auto","0","1"])}}class pB extends Bc{constructor(A){super(Wc,"manifest",!0),this.action=GI(A.action,["include","all","exclude"]),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.ref=new hc}}class mB extends Bc{constructor(A){super(Wc,"margin",!0),this.bottomInset=NI(A.bottomInset,"0"),this.id=A.id||"",this.leftInset=NI(A.leftInset,"0"),this.rightInset=NI(A.rightInset,"0"),this.topInset=NI(A.topInset,"0"),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[pI](){return{margin:yc(this.topInset)+" "+yc(this.rightInset)+" "+yc(this.bottomInset)+" "+yc(this.leftInset)}}}class yB extends Bc{constructor(A){super(Wc,"mdp"),this.id=A.id||"",this.permissions=FI({data:A.permissions,defaultValue:2,validate:A=>1===A||3===A}),this.signatureType=GI(A.signatureType,["filler","author"]),this.use=A.use||"",this.usehref=A.usehref||""}}class wB extends Bc{constructor(A){super(Wc,"medium"),this.id=A.id||"",this.imagingBBox=function(A){const e=-1;if(!A)return{x:e,y:e,width:e,height:e};const t=A.trim().split(/\s*,\s*/).map((A=>NI(A,"-1")));if(t.length<4||t[2]<0||t[3]<0)return{x:e,y:e,width:e,height:e};const[i,a,s,n]=t;return{x:i,y:a,width:s,height:n}}(A.imagingBBox),this.long=NI(A.long),this.orientation=GI(A.orientation,["portrait","landscape"]),this.short=NI(A.short),this.stock=A.stock||"",this.trayIn=GI(A.trayIn,["auto","delegate","pageFront"]),this.trayOut=GI(A.trayOut,["auto","delegate"]),this.use=A.use||"",this.usehref=A.usehref||""}}class DB extends Bc{constructor(A){super(Wc,"message",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.text=new hc}}class bB extends Bc{constructor(A){super(Wc,"numericEdit",!0),this.hScrollPolicy=GI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.comb=null,this.extras=null,this.margin=null}[dI](A){const e=Gc(this,"border","font","margin"),t=this[Jo]()[Jo](),i={name:"input",attributes:{type:"text",fieldId:t[mI],dataId:t[uo]?.[mI]||t[mI],class:["xfaTextfield"],style:e,"aria-label":iC(t),"aria-required":!1}};return AC(t)&&(i.attributes["aria-required"]=!0,i.attributes.required=!0),MI.success({name:"label",attributes:{class:["xfaLabel"]},children:[i]})}}class kB extends Bc{constructor(A){super(Wc,"occur",!0),this.id=A.id||"",this.initial=""!==A.initial?FI({data:A.initial,defaultValue:"",validate:A=>!0}):"",this.max=""!==A.max?FI({data:A.max,defaultValue:1,validate:A=>!0}):"",this.min=""!==A.min?FI({data:A.min,defaultValue:1,validate:A=>!0}):"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[Co](){const A=this[Jo](),e=this.min;""===this.min&&(this.min=A instanceof GB||A instanceof NB?0:1),""===this.max&&(this.max=""===e?A instanceof GB||A instanceof NB?-1:1:this.min),-1!==this.max&&this.max!0}),this.name=A.name||"",this.numbered=FI({data:A.numbered,defaultValue:1,validate:A=>!0}),this.oddOrEven=GI(A.oddOrEven,["any","even","odd"]),this.pagePosition=GI(A.pagePosition,["any","first","last","only","rest"]),this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.desc=null,this.extras=null,this.medium=null,this.occur=null,this.area=new hc,this.contentArea=new hc,this.draw=new hc,this.exclGroup=new hc,this.field=new hc,this.subform=new hc}[_o](){return this[po]?!this.occur||-1===this.occur.max||this[po].numberOfUseA.oddOrEven===e&&A.pagePosition===t));return i||(i=this.pageArea.children.find((A=>"any"===A.oddOrEven&&A.pagePosition===t)),i||(i=this.pageArea.children.find((A=>"any"===A.oddOrEven&&"any"===A.pagePosition)),i||this.pageArea.children[0]))}}class xB extends Bc{constructor(A){super(Wc,"para",!0),this.hAlign=GI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.lineHeight=A.lineHeight?NI(A.lineHeight,"0pt"):"",this.marginLeft=A.marginLeft?NI(A.marginLeft,"0pt"):"",this.marginRight=A.marginRight?NI(A.marginRight,"0pt"):"",this.orphans=FI({data:A.orphans,defaultValue:0,validate:A=>A>=0}),this.preserve=A.preserve||"",this.radixOffset=A.radixOffset?NI(A.radixOffset,"0pt"):"",this.spaceAbove=A.spaceAbove?NI(A.spaceAbove,"0pt"):"",this.spaceBelow=A.spaceBelow?NI(A.spaceBelow,"0pt"):"",this.tabDefault=A.tabDefault?NI(this.tabDefault):"",this.tabStops=(A.tabStops||"").trim().split(/\s+/).map(((A,e)=>e%2==1?NI(A):A)),this.textIndent=A.textIndent?NI(A.textIndent,"0pt"):"",this.use=A.use||"",this.usehref=A.usehref||"",this.vAlign=GI(A.vAlign,["top","bottom","middle"]),this.widows=FI({data:A.widows,defaultValue:0,validate:A=>A>=0}),this.hyphenation=null}[pI](){const A=Gc(this,"hAlign");return""!==this.marginLeft&&(A.paddingLeft=yc(this.marginLeft)),""!==this.marginRight&&(A.paddingight=yc(this.marginRight)),""!==this.spaceAbove&&(A.paddingTop=yc(this.spaceAbove)),""!==this.spaceBelow&&(A.paddingBottom=yc(this.spaceBelow)),""!==this.textIndent&&(A.textIndent=yc(this.textIndent),xc(A)),this.lineHeight>0&&(A.lineHeight=yc(this.lineHeight)),""!==this.tabDefault&&(A.tabSize=yc(this.tabDefault)),this.tabStops.length,this.hyphenatation&&Object.assign(A,this.hyphenatation[pI]()),A}}class UB extends Bc{constructor(A){super(Wc,"passwordEdit",!0),this.hScrollPolicy=GI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.passwordChar=A.passwordChar||"*",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}}class MB extends Bc{constructor(A){super(Wc,"pattern",!0),this.id=A.id||"",this.type=GI(A.type,["crossHatch","crossDiagonal","diagonalLeft","diagonalRight","horizontal","vertical"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[pI](A){A=A?A[pI]():"#FFFFFF";const e=this.color?this.color[pI]():"#000000",t="repeating-linear-gradient",i=`${A},${A} 5px,${e} 5px,${e} 10px`;switch(this.type){case"crossHatch":return`${t}(to top,${i}) ${t}(to right,${i})`;case"crossDiagonal":return`${t}(45deg,${i}) ${t}(-45deg,${i})`;case"diagonalLeft":return`${t}(45deg,${i})`;case"diagonalRight":return`${t}(-45deg,${i})`;case"horizontal":return`${t}(to top,${i})`;case"vertical":return`${t}(to right,${i})`}return""}}class LB extends dc{constructor(A){super(Wc,"picture"),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class JB extends Bc{constructor(A){super(Wc,"proto",!0),this.appearanceFilter=new hc,this.arc=new hc,this.area=new hc,this.assist=new hc,this.barcode=new hc,this.bindItems=new hc,this.bookend=new hc,this.boolean=new hc,this.border=new hc,this.break=new hc,this.breakAfter=new hc,this.breakBefore=new hc,this.button=new hc,this.calculate=new hc,this.caption=new hc,this.certificate=new hc,this.certificates=new hc,this.checkButton=new hc,this.choiceList=new hc,this.color=new hc,this.comb=new hc,this.connect=new hc,this.contentArea=new hc,this.corner=new hc,this.date=new hc,this.dateTime=new hc,this.dateTimeEdit=new hc,this.decimal=new hc,this.defaultUi=new hc,this.desc=new hc,this.digestMethod=new hc,this.digestMethods=new hc,this.draw=new hc,this.edge=new hc,this.encoding=new hc,this.encodings=new hc,this.encrypt=new hc,this.encryptData=new hc,this.encryption=new hc,this.encryptionMethod=new hc,this.encryptionMethods=new hc,this.event=new hc,this.exData=new hc,this.exObject=new hc,this.exclGroup=new hc,this.execute=new hc,this.extras=new hc,this.field=new hc,this.fill=new hc,this.filter=new hc,this.float=new hc,this.font=new hc,this.format=new hc,this.handler=new hc,this.hyphenation=new hc,this.image=new hc,this.imageEdit=new hc,this.integer=new hc,this.issuers=new hc,this.items=new hc,this.keep=new hc,this.keyUsage=new hc,this.line=new hc,this.linear=new hc,this.lockDocument=new hc,this.manifest=new hc,this.margin=new hc,this.mdp=new hc,this.medium=new hc,this.message=new hc,this.numericEdit=new hc,this.occur=new hc,this.oid=new hc,this.oids=new hc,this.overflow=new hc,this.pageArea=new hc,this.pageSet=new hc,this.para=new hc,this.passwordEdit=new hc,this.pattern=new hc,this.picture=new hc,this.radial=new hc,this.reason=new hc,this.reasons=new hc,this.rectangle=new hc,this.ref=new hc,this.script=new hc,this.setProperty=new hc,this.signData=new hc,this.signature=new hc,this.signing=new hc,this.solid=new hc,this.speak=new hc,this.stipple=new hc,this.subform=new hc,this.subformSet=new hc,this.subjectDN=new hc,this.subjectDNs=new hc,this.submit=new hc,this.text=new hc,this.textEdit=new hc,this.time=new hc,this.timeStamp=new hc,this.toolTip=new hc,this.traversal=new hc,this.traverse=new hc,this.ui=new hc,this.validate=new hc,this.value=new hc,this.variables=new hc}}class HB extends Bc{constructor(A){super(Wc,"radial",!0),this.id=A.id||"",this.type=GI(A.type,["toEdge","toCenter"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[pI](A){A=A?A[pI]():"#FFFFFF";const e=this.color?this.color[pI]():"#000000";return`radial-gradient(circle at center, ${"toEdge"===this.type?`${A},${e}`:`${e},${A}`})`}}class YB extends dc{constructor(A){super(Wc,"reason"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class vB extends Bc{constructor(A){super(Wc,"reasons",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.reason=new hc}}class KB extends Bc{constructor(A){super(Wc,"rectangle",!0),this.hand=GI(A.hand,["even","left","right"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.corner=new hc(4),this.edge=new hc(4),this.fill=null}[dI](){const A=this.edge.children.length?this.edge.children[0]:new TC({}),e=A[pI](),t=Object.create(null);"visible"===this.fill?.presence?Object.assign(t,this.fill[pI]()):t.fill="transparent",t.strokeWidth=yc("visible"===A.presence?A.thickness:0),t.stroke=e.color;const i=(this.corner.children.length?this.corner.children[0]:new xC({}))[pI](),a={name:"svg",children:[{name:"rect",attributes:{xmlns:Zc,width:"100%",height:"100%",x:0,y:0,rx:i.radius,ry:i.radius,style:t}}],attributes:{xmlns:Zc,style:{overflow:"visible"},width:"100%",height:"100%"}};return zc(this[Jo]()[Jo]())?MI.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[a]}):(a.attributes.style.position="absolute",MI.success(a))}}class qB extends dc{constructor(A){super(Wc,"ref"),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class TB extends dc{constructor(A){super(Wc,"script"),this.binding=A.binding||"",this.contentType=A.contentType||"",this.id=A.id||"",this.name=A.name||"",this.runAt=GI(A.runAt,["client","both","server"]),this.use=A.use||"",this.usehref=A.usehref||""}}class PB extends Bc{constructor(A){super(Wc,"setProperty"),this.connection=A.connection||"",this.ref=A.ref||"",this.target=A.target||""}}class WB extends Bc{constructor(A){super(Wc,"signData",!0),this.id=A.id||"",this.operation=GI(A.operation,["sign","clear","verify"]),this.ref=A.ref||"",this.target=A.target||"",this.use=A.use||"",this.usehref=A.usehref||"",this.filter=null,this.manifest=null}}class ZB extends Bc{constructor(A){super(Wc,"signature",!0),this.id=A.id||"",this.type=GI(A.type,["PDF1.3","PDF1.6"]),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.filter=null,this.manifest=null,this.margin=null}}class OB extends Bc{constructor(A){super(Wc,"signing",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new hc}}class XB extends Bc{constructor(A){super(Wc,"solid",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[pI](A){return A?A[pI]():"#FFFFFF"}}class VB extends dc{constructor(A){super(Wc,"speak"),this.disable=FI({data:A.disable,defaultValue:0,validate:A=>1===A}),this.id=A.id||"",this.priority=GI(A.priority,["custom","caption","name","toolTip"]),this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}}class jB extends Bc{constructor(A){super(Wc,"stipple",!0),this.id=A.id||"",this.rate=FI({data:A.rate,defaultValue:50,validate:A=>A>=0&&A<=100}),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[pI](A){const e=this.rate/100;return X.makeHexColor(Math.round(A.value.r*(1-e)+this.value.r*e),Math.round(A.value.g*(1-e)+this.value.g*e),Math.round(A.value.b*(1-e)+this.value.b*e))}}class zB extends Bc{constructor(A){super(Wc,"subform",!0),this.access=GI(A.access,["open","nonInteractive","protected","readOnly"]),this.allowMacro=FI({data:A.allowMacro,defaultValue:0,validate:A=>1===A}),this.anchorType=GI(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=FI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.columnWidths=(A.columnWidths||"").trim().split(/\s+/).map((A=>"-1"===A?-1:NI(A))),this.h=A.h?NI(A.h):"",this.hAlign=GI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.layout=GI(A.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]),this.locale=A.locale||"",this.maxH=NI(A.maxH,"0pt"),this.maxW=NI(A.maxW,"0pt"),this.mergeMode=GI(A.mergeMode,["consumeData","matchTemplate"]),this.minH=NI(A.minH,"0pt"),this.minW=NI(A.minW,"0pt"),this.name=A.name||"",this.presence=GI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=UI(A.relevant),this.restoreState=GI(A.restoreState,["manual","auto"]),this.scope=GI(A.scope,["name","none"]),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?NI(A.w):"",this.x=NI(A.x,"0pt"),this.y=NI(A.y,"0pt"),this.assist=null,this.bind=null,this.bookend=null,this.border=null,this.break=null,this.calculate=null,this.desc=null,this.extras=null,this.keep=null,this.margin=null,this.occur=null,this.overflow=null,this.pageSet=null,this.para=null,this.traversal=null,this.validate=null,this.variables=null,this.area=new hc,this.breakAfter=new hc,this.breakBefore=new hc,this.connect=new hc,this.draw=new hc,this.event=new hc,this.exObject=new hc,this.exclGroup=new hc,this.field=new hc,this.proto=new hc,this.setProperty=new hc,this.subform=new hc,this.subformSet=new hc}[Lo](){const A=this[Jo]();return A instanceof _B?A[Lo]():A}[Wo](){return!0}[jo](){return this.layout.endsWith("-tb")&&0===this[po].attempt&&this[po].numberInLine>0||this[Jo]()[jo]()}*[Uo](){yield*$c(this)}[yo](){return Kc(this)}[oo](A,e){qc(this,A,e)}[bo](){return Tc(this)}[Vo](){const A=this[Lo]();return!!A[Vo]()&&(void 0!==this[po]._isSplittable?this[po]._isSplittable:"position"===this.layout||this.layout.includes("row")||this.keep&&"none"!==this.keep.intact?(this[po]._isSplittable=!1,!1):!(A.layout?.endsWith("-tb")&&0!==A[po].numberInLine||(this[po]._isSplittable=!0,0)))}[dI](A){if(eC(this),this.break){if("auto"!==this.break.after||""!==this.break.afterTarget){const A=new fC({targetType:this.break.after,target:this.break.afterTarget,startNew:this.break.startNew.toString()});A[Yo]=this[Yo],this[Io](A),this.breakAfter.push(A)}if("auto"!==this.break.before||""!==this.break.beforeTarget){const A=new pC({targetType:this.break.before,target:this.break.beforeTarget,startNew:this.break.startNew.toString()});A[Yo]=this[Yo],this[Io](A),this.breakBefore.push(A)}if(""!==this.break.overflowTarget){const A=new RB({target:this.break.overflowTarget,leader:this.break.overflowLeader,trailer:this.break.overflowTrailer});A[Yo]=this[Yo],this[Io](A),this.overflow.push(A)}this[oI](this.break),this.break=null}if("hidden"===this.presence||"inactive"===this.presence)return MI.EMPTY;if((this.breakBefore.children.length>1||this.breakAfter.children.length>1)&&S("XFA - Several breakBefore or breakAfter in subforms: please file a bug."),this.breakBefore.children.length>=1){const A=this.breakBefore.children[0];if(gC(A))return MI.breakNode(A)}if(this[po]?.afterBreakAfter)return MI.EMPTY;Sc(this);const e=[],t={id:this[mI],class:[]};Uc(this,t.class),this[po]||(this[po]=Object.create(null)),Object.assign(this[po],{children:e,line:null,attributes:t,attempt:0,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,A.width),height:Math.min(this.h||1/0,A.height)},width:0,height:0,prevHeight:0,currentWidth:0});const i=this[Ho](),a=i[po].noLayoutFailure,s=this[Vo]();if(s||sC(this),!Pc(this,A))return MI.FAILURE;const n=new Set(["area","draw","exclGroup","field","subform","subformSet"]);if(this.layout.includes("row")){const A=this[Lo]().columnWidths;Array.isArray(A)&&A.length>0&&(this[po].columnWidths=A,this[po].currentColumn=0)}const g=Gc(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),r=["xfaSubform"],o=Rc(this);if(o&&r.push(o),t.style=g,t.class=r,this.name&&(t.xfaName=this.name),this.overflow){const e=this.overflow[Go]();e.addLeader&&(e.addLeader=!1,rC(this,e.leader,A))}this[rI]();const I="lr-tb"===this.layout||"rl-tb"===this.layout,c=I?2:1;for(;this[po].attempt=1){const A=this.breakAfter.children[0];if(gC(A))return this[po].afterBreakAfter=u,MI.breakNode(A)}return delete this[po],u}}class _B extends Bc{constructor(A){super(Wc,"subformSet",!0),this.id=A.id||"",this.name=A.name||"",this.relation=GI(A.relation,["ordered","choice","unordered"]),this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.bookend=null,this.break=null,this.desc=null,this.extras=null,this.occur=null,this.overflow=null,this.breakAfter=new hc,this.breakBefore=new hc,this.subform=new hc,this.subformSet=new hc}*[Uo](){yield*$c(this)}[Lo](){let A=this[Jo]();for(;!(A instanceof zB);)A=A[Jo]();return A}[Wo](){return!0}}class $B extends Ec{constructor(A){super(Wc,"subjectDN"),this.delimiter=A.delimiter||",",this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){this[Eo]=new Map(this[Eo].split(this.delimiter).map((A=>((A=A.split("=",2))[0]=A[0].trim(),A))))}}class Ah extends Bc{constructor(A){super(Wc,"subjectDNs",!0),this.id=A.id||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.subjectDN=new hc}}class eh extends Bc{constructor(A){super(Wc,"submit",!0),this.embedPDF=FI({data:A.embedPDF,defaultValue:0,validate:A=>1===A}),this.format=GI(A.format,["xdp","formdata","pdf","urlencoded","xfd","xml"]),this.id=A.id||"",this.target=A.target||"",this.textEncoding=RI({data:A.textEncoding?A.textEncoding.toLowerCase():"",defaultValue:"",validate:A=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(A)||A.match(/iso-8859-\d{2}/)}),this.use=A.use||"",this.usehref=A.usehref||"",this.xdpContent=A.xdpContent||"",this.encrypt=null,this.encryptData=new hc,this.signData=new hc}}class th extends Bc{constructor(A){super(Wc,"template",!0),this.baseProfile=GI(A.baseProfile,["full","interactiveForms"]),this.extras=null,this.subform=new hc}[mo](){0===this.subform.children.length&&S("XFA - No subforms in template node."),this.subform.children.length>=2&&S("XFA - Several subforms in template node: please file a bug."),this[lI]=5e3}[Vo](){return!0}[CI](A,e){return A.startsWith("#")?[this[Ko].get(A.slice(1))]:ZI(this,e,A,!0,!0)}*[uI](){if(!this.subform.children.length)return MI.success({name:"div",children:[]});this[po]={overflowNode:null,firstUnsplittable:null,currentContentArea:null,currentPageArea:null,noLayoutFailure:!1,pageNumber:1,pagePosition:"first",oddOrEven:"odd",blankOrNotBlank:"nonBlank",paraStack:[]};const A=this.subform.children[0];A.pageSet[Bo]();const e=A.pageSet.pageArea.children,t={name:"div",children:[]};let i=null,a=null,s=null;if(A.breakBefore.children.length>=1?(a=A.breakBefore.children[0],s=a.target):A.subform.children.length>=1&&A.subform.children[0].breakBefore.children.length>=1?(a=A.subform.children[0].breakBefore.children[0],s=a.target):A.break?.beforeTarget?(a=A.break,s=a.beforeTarget):A.subform.children.length>=1&&A.subform.children[0].break?.beforeTarget&&(a=A.subform.children[0].break,s=a.beforeTarget),a){const A=this[CI](s,a[Jo]());A instanceof GB&&(i=A,a[po]={})}i||(i=e[0]),i[po]={numberOfUse:1};const n=i[Jo]();let g;n[po]={numberOfUse:1,pageIndex:n.pageArea.children.indexOf(i),pageSetIndex:0};let r=null,o=null,I=!0,c=0,C=0;for(;;){if(I)c=0;else if(t.children.pop(),3==++c)return S("XFA - Something goes wrong: please file a bug."),t;g=null,this[po].currentPageArea=i;const e=i[dI]().html;t.children.push(e),r&&(this[po].noLayoutFailure=!0,e.children.push(r[dI](i[po].space).html),r=null),o&&(this[po].noLayoutFailure=!0,e.children.push(o[dI](i[po].space).html),o=null);const a=i.contentArea.children,s=e.children.filter((A=>A.attributes.class.includes("xfaContentarea")));I=!1,this[po].firstUnsplittable=null,this[po].noLayoutFailure=!1;const n=e=>{const t=A[yo]();t&&(I||=t.children?.length>0,s[e].children.push(t))};for(let e=C,i=a.length;e0,s[e].children.push(B.html)):!I&&t.children.length>1&&t.children.pop(),t;if(B.isBreak()){const A=B.breakNode;if(n(e),"auto"===A.targetType)continue;A.leader&&(r=this[CI](A.leader,A[Jo]()),r=r?r[0]:null),A.trailer&&(o=this[CI](A.trailer,A[Jo]()),o=o?o[0]:null),"pageArea"===A.targetType?(g=A[po].target,e=1/0):A[po].target?(g=A[po].target,C=A[po].index+1,e=1/0):e=A[po].index}else if(this[po].overflowNode){const A=this[po].overflowNode;this[po].overflowNode=null;const t=A[Go](),i=t.target;t.addLeader=null!==t.leader,t.addTrailer=null!==t.trailer,n(e);const s=e;if(e=1/0,i instanceof GB)g=i;else if(i instanceof NC){const A=a.indexOf(i);-1!==A?A>s?e=A-1:C=A:(g=i[Jo](),C=g.contentArea.children.indexOf(i))}}else n(e)}this[po].pageNumber+=1,g&&(g[_o]()?g[po].numberOfUse+=1:g=null),i=g||i[Mo](),yield null}}}class ih extends Ec{constructor(A){super(Wc,"text"),this.id=A.id||"",this.maxChars=FI({data:A.maxChars,defaultValue:0,validate:A=>A>=0}),this.name=A.name||"",this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}[ro](){return!0}[iI](A){return A[AI]===wI.xhtml.id?(this[Eo]=A,!0):(S(`XFA - Invalid content in Text: ${A[eI]}.`),!1)}[sI](A){this[Eo]instanceof Bc||super[sI](A)}[mo](){"string"==typeof this[Eo]&&(this[Eo]=this[Eo].replaceAll("\r\n","\n"))}[Go](){return"string"==typeof this[Eo]?this[Eo].split(/[\u2029\u2028\n]/).reduce(((A,e)=>(e&&A.push(e),A)),[]).join("\n"):this[Eo][EI]()}[dI](A){if("string"==typeof this[Eo]){const A=aC(this[Eo]).html;return this[Eo].includes("\u2029")?(A.name="div",A.children=[],this[Eo].split("\u2029").map((A=>A.split(/[\u2028\n]/).reduce(((A,e)=>(A.push({name:"span",value:e},{name:"br"}),A)),[]))).forEach((e=>{A.children.push({name:"p",children:e})}))):/[\u2028\n]/.test(this[Eo])&&(A.name="div",A.children=[],this[Eo].split(/[\u2028\n]/).forEach((e=>{A.children.push({name:"span",value:e},{name:"br"})}))),MI.success(A)}return this[Eo][dI](A)}}class ah extends Bc{constructor(A){super(Wc,"textEdit",!0),this.allowRichText=FI({data:A.allowRichText,defaultValue:0,validate:A=>1===A}),this.hScrollPolicy=GI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.multiLine=FI({data:A.multiLine,defaultValue:"",validate:A=>0===A||1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.vScrollPolicy=GI(A.vScrollPolicy,["auto","off","on"]),this.border=null,this.comb=null,this.extras=null,this.margin=null}[dI](A){const e=Gc(this,"border","font","margin");let t;const i=this[Jo]()[Jo]();return""===this.multiLine&&(this.multiLine=i instanceof qC?1:0),t=1===this.multiLine?{name:"textarea",attributes:{dataId:i[uo]?.[mI]||i[mI],fieldId:i[mI],class:["xfaTextfield"],style:e,"aria-label":iC(i),"aria-required":!1}}:{name:"input",attributes:{type:"text",dataId:i[uo]?.[mI]||i[mI],fieldId:i[mI],class:["xfaTextfield"],style:e,"aria-label":iC(i),"aria-required":!1}},AC(i)&&(t.attributes["aria-required"]=!0,t.attributes.required=!0),MI.success({name:"label",attributes:{class:["xfaLabel"]},children:[t]})}}class sh extends dc{constructor(A){super(Wc,"time"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[mo](){const A=this[Eo].trim();this[Eo]=A?new Date(A):null}[dI](A){return aC(this[Eo]?this[Eo].toString():"")}}class nh extends Bc{constructor(A){super(Wc,"timeStamp"),this.id=A.id||"",this.server=A.server||"",this.type=GI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class gh extends dc{constructor(A){super(Wc,"toolTip"),this.id=A.id||"",this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}}class rh extends Bc{constructor(A){super(Wc,"traversal",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.traverse=new hc}}class oh extends Bc{constructor(A){super(Wc,"traverse",!0),this.id=A.id||"",this.operation=GI(A.operation,["next","back","down","first","left","right","up"]),this.ref=A.ref||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.script=null}get name(){return this.operation}[zo](){return!1}}class Ih extends Bc{constructor(A){super(Wc,"ui",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.picture=null,this.barcode=null,this.button=null,this.checkButton=null,this.choiceList=null,this.dateTimeEdit=null,this.defaultUi=null,this.imageEdit=null,this.numericEdit=null,this.passwordEdit=null,this.signature=null,this.textEdit=null}[Go](){if(void 0===this[po]){for(const A of Object.getOwnPropertyNames(this)){if("extras"===A||"picture"===A)continue;const e=this[A];if(e instanceof Bc)return this[po]=e,e}this[po]=null}return this[po]}[dI](A){const e=this[Go]();return e?e[dI](A):MI.EMPTY}}class ch extends Bc{constructor(A){super(Wc,"validate",!0),this.formatTest=GI(A.formatTest,["warning","disabled","error"]),this.id=A.id||"",this.nullTest=GI(A.nullTest,["disabled","error","warning"]),this.scriptTest=GI(A.scriptTest,["error","disabled","warning"]),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.message=null,this.picture=null,this.script=null}}class Ch extends Bc{constructor(A){super(Wc,"value",!0),this.id=A.id||"",this.override=FI({data:A.override,defaultValue:0,validate:A=>1===A}),this.relevant=UI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.arc=null,this.boolean=null,this.date=null,this.dateTime=null,this.decimal=null,this.exData=null,this.float=null,this.image=null,this.integer=null,this.line=null,this.rectangle=null,this.text=null,this.time=null}[QI](A){const e=this[Jo]();if(e instanceof iB&&e.ui?.imageEdit)return this.image||(this.image=new cB({}),this[Io](this.image)),void(this.image[Eo]=A[Eo]);const t=A[eI];if(null===this[t]){for(const A of Object.getOwnPropertyNames(this)){const e=this[A];e instanceof Bc&&(this[A]=null,this[oI](e))}this[A[eI]]=A,this[Io](A)}else this[t][Eo]=A[Eo]}[EI](){if(this.exData)return"string"==typeof this.exData[Eo]?this.exData[Eo].trim():this.exData[Eo][EI]().trim();for(const A of Object.getOwnPropertyNames(this)){if("image"===A)continue;const e=this[A];if(e instanceof Bc)return(e[Eo]||"").toString().trim()}return null}[dI](A){for(const e of Object.getOwnPropertyNames(this)){const t=this[e];if(t instanceof Bc)return t[dI](A)}return MI.EMPTY}}class Bh extends Bc{constructor(A){super(Wc,"variables",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new hc,this.date=new hc,this.dateTime=new hc,this.decimal=new hc,this.exData=new hc,this.float=new hc,this.image=new hc,this.integer=new hc,this.manifest=new hc,this.script=new hc,this.text=new hc,this.time=new hc}[zo](){return!0}}class hh{static[yI](A,e){if(hh.hasOwnProperty(A)){const t=hh[A](e);return t[hI](e),t}}static appearanceFilter(A){return new oC(A)}static arc(A){return new IC(A)}static area(A){return new cC(A)}static assist(A){return new CC(A)}static barcode(A){return new BC(A)}static bind(A){return new hC(A)}static bindItems(A){return new QC(A)}static bookend(A){return new lC(A)}static boolean(A){return new EC(A)}static border(A){return new uC(A)}static break(A){return new dC(A)}static breakAfter(A){return new fC(A)}static breakBefore(A){return new pC(A)}static button(A){return new mC(A)}static calculate(A){return new yC(A)}static caption(A){return new wC(A)}static certificate(A){return new DC(A)}static certificates(A){return new bC(A)}static checkButton(A){return new kC(A)}static choiceList(A){return new FC(A)}static color(A){return new SC(A)}static comb(A){return new RC(A)}static connect(A){return new GC(A)}static contentArea(A){return new NC(A)}static corner(A){return new xC(A)}static date(A){return new UC(A)}static dateTime(A){return new MC(A)}static dateTimeEdit(A){return new LC(A)}static decimal(A){return new JC(A)}static defaultUi(A){return new HC(A)}static desc(A){return new YC(A)}static digestMethod(A){return new vC(A)}static digestMethods(A){return new KC(A)}static draw(A){return new qC(A)}static edge(A){return new TC(A)}static encoding(A){return new PC(A)}static encodings(A){return new WC(A)}static encrypt(A){return new ZC(A)}static encryptData(A){return new OC(A)}static encryption(A){return new XC(A)}static encryptionMethod(A){return new VC(A)}static encryptionMethods(A){return new jC(A)}static event(A){return new zC(A)}static exData(A){return new _C(A)}static exObject(A){return new $C(A)}static exclGroup(A){return new AB(A)}static execute(A){return new eB(A)}static extras(A){return new tB(A)}static field(A){return new iB(A)}static fill(A){return new aB(A)}static filter(A){return new sB(A)}static float(A){return new nB(A)}static font(A){return new gB(A)}static format(A){return new rB(A)}static handler(A){return new oB(A)}static hyphenation(A){return new IB(A)}static image(A){return new cB(A)}static imageEdit(A){return new CB(A)}static integer(A){return new BB(A)}static issuers(A){return new hB(A)}static items(A){return new QB(A)}static keep(A){return new lB(A)}static keyUsage(A){return new EB(A)}static line(A){return new uB(A)}static linear(A){return new dB(A)}static lockDocument(A){return new fB(A)}static manifest(A){return new pB(A)}static margin(A){return new mB(A)}static mdp(A){return new yB(A)}static medium(A){return new wB(A)}static message(A){return new DB(A)}static numericEdit(A){return new bB(A)}static occur(A){return new kB(A)}static oid(A){return new FB(A)}static oids(A){return new SB(A)}static overflow(A){return new RB(A)}static pageArea(A){return new GB(A)}static pageSet(A){return new NB(A)}static para(A){return new xB(A)}static passwordEdit(A){return new UB(A)}static pattern(A){return new MB(A)}static picture(A){return new LB(A)}static proto(A){return new JB(A)}static radial(A){return new HB(A)}static reason(A){return new YB(A)}static reasons(A){return new vB(A)}static rectangle(A){return new KB(A)}static ref(A){return new qB(A)}static script(A){return new TB(A)}static setProperty(A){return new PB(A)}static signData(A){return new WB(A)}static signature(A){return new ZB(A)}static signing(A){return new OB(A)}static solid(A){return new XB(A)}static speak(A){return new VB(A)}static stipple(A){return new jB(A)}static subform(A){return new zB(A)}static subformSet(A){return new _B(A)}static subjectDN(A){return new $B(A)}static subjectDNs(A){return new Ah(A)}static submit(A){return new eh(A)}static template(A){return new th(A)}static text(A){return new ih(A)}static textEdit(A){return new ah(A)}static time(A){return new sh(A)}static timeStamp(A){return new nh(A)}static toolTip(A){return new gh(A)}static traversal(A){return new rh(A)}static traverse(A){return new oh(A)}static ui(A){return new Ih(A)}static validate(A){return new ch(A)}static value(A){return new Ch(A)}static variables(A){return new Bh(A)}}const Qh=wI.datasets.id;function lh(A){const e=new ih({});return e[Eo]=A,e}class Eh{constructor(A){this.root=A,this.datasets=A.datasets,this.data=A.datasets?.data||new lc(wI.datasets.id,"data"),this.emptyMerge=0===this.data[xo]().length,this.root.form=this.form=A.template[Qo]()}_isConsumeData(){return!this.emptyMerge&&this._mergeMode}_isMatchTemplate(){return!this._isConsumeData()}bind(){return this._bindElement(this.form,this.data),this.form}getData(){return this.data}_bindValue(A,e,t){if(A[uo]=e,A[vo]())if(e[Zo]()){const t=e[Ro]();A[QI](lh(t))}else if(A instanceof iB&&"multiSelect"===A.ui?.choiceList?.open){const t=e[xo]().map((A=>A[Eo].trim())).join("\n");A[QI](lh(t))}else this._isConsumeData()&&S("XFA - Nodes haven't the same type.");else!e[Zo]()||this._isMatchTemplate()?this._bindElement(A,e):S("XFA - Nodes haven't the same type.")}_findDataByNameToConsume(A,e,t,i){if(!A)return null;let a,s;for(let i=0;i<3;i++){for(a=t[No](A,!1,!0);s=a.next().value,s;)if(e===s[Zo]())return s;if(t[AI]===wI.datasets.id&&"data"===t[eI])break;t=t[Jo]()}return i?(a=this.data[No](A,!0,!1),s=a.next().value,s||(a=this.data[wo](A,!0),s=a.next().value,s?.[Zo]()?s:null)):null}_setProperties(A,e){if(A.hasOwnProperty("setProperty"))for(const{ref:t,target:i,connection:a}of A.setProperty.children){if(a)continue;if(!t)continue;const s=ZI(this.root,e,t,!1,!1);if(!s){S(`XFA - Invalid reference: ${t}.`);continue}const[n]=s;if(!n[Oo](this.data)){S("XFA - Invalid node: must be a data node.");continue}const g=ZI(this.root,A,i,!1,!1);if(!g){S(`XFA - Invalid target: ${i}.`);continue}const[r]=g;if(!r[Oo](A)){S("XFA - Invalid target: must be a property or subproperty.");continue}const o=r[Jo]();if(r instanceof PB||o instanceof PB){S("XFA - Invalid target: cannot be a setProperty or one of its properties.");continue}if(r instanceof QC||o instanceof QC){S("XFA - Invalid target: cannot be a bindItems or one of its properties.");continue}const I=n[EI](),c=r[eI];if(r instanceof Qc){const A=Object.create(null);A[c]=I;const e=Reflect.construct(Object.getPrototypeOf(o).constructor,[A]);o[c]=e[c]}else r.hasOwnProperty(Eo)?(r[uo]=n,r[Eo]=I,r[mo]()):S("XFA - Invalid node to use in setProperty")}}_bindItems(A,e){if(!A.hasOwnProperty("items")||!A.hasOwnProperty("bindItems")||A.bindItems.isEmpty())return;for(const e of A.items.children)A[oI](e);A.items.clear();const t=new QB({}),i=new QB({});A[Io](t),A.items.push(t),A[Io](i),A.items.push(i);for(const{ref:a,labelRef:s,valueRef:n,connection:g}of A.bindItems.children){if(g)continue;if(!a)continue;const A=ZI(this.root,e,a,!1,!1);if(A)for(const e of A){if(!e[Oo](this.datasets)){S(`XFA - Invalid ref (${a}): must be a datasets child.`);continue}const A=ZI(this.root,e,s,!0,!1);if(!A){S(`XFA - Invalid label: ${s}.`);continue}const[g]=A;if(!g[Oo](this.datasets)){S("XFA - Invalid label: must be a datasets child.");continue}const r=ZI(this.root,e,n,!0,!1);if(!r){S(`XFA - Invalid value: ${n}.`);continue}const[o]=r;if(!o[Oo](this.datasets)){S("XFA - Invalid value: must be a datasets child.");continue}const I=lh(g[EI]()),c=lh(o[EI]());t[Io](I),t.text.push(I),i[Io](c),i.text.push(c)}else S(`XFA - Invalid reference: ${a}.`)}}_bindOccurrences(A,e,t){let i;if(e.length>1&&(i=A[Qo](),i[oI](i.occur),i.occur=null),this._bindValue(A,e[0],t),this._setProperties(A,e[0]),this._bindItems(A,e[0]),1===e.length)return;const a=A[Jo](),s=A[eI],n=a[qo](A);for(let A=1,g=e.length;Ae.name===A.name)).length:t[i].children.length;const s=t[qo](A)+1,n=e.initial-a;if(n){const e=A[Qo]();e[oI](e.occur),e.occur=null,t[i].push(e),t[To](s,e);for(let A=1;A0)this._bindOccurrences(i,[A[0]],null);else if(this.emptyMerge){const A=e[AI]===Qh?-1:e[AI],t=i[uo]=new lc(A,i.name||"root");e[Io](t),this._bindElement(i,t)}continue}if(!i[Wo]())continue;let A=!1,a=null,s=null,n=null;if(i.bind){switch(i.bind.match){case"none":this._setAndBind(i,e);continue;case"global":A=!0;break;case"dataRef":if(!i.bind.ref){S(`XFA - ref is empty in node ${i[eI]}.`),this._setAndBind(i,e);continue}s=i.bind.ref}i.bind.picture&&(a=i.bind.picture[Eo])}const[g,r]=this._getOccurInfo(i);if(s){if(n=ZI(this.root,e,s,!0,!1),null===n){if(n=OI(this.data,e,s),!n)continue;this._isConsumeData()&&(n[lo]=!0),this._setAndBind(i,n);continue}this._isConsumeData()&&(n=n.filter((A=>!A[lo]))),n.length>r?n=n.slice(0,r):0===n.length&&(n=null),n&&this._isConsumeData()&&n.forEach((A=>{A[lo]=!0}))}else{if(!i.name){this._setAndBind(i,e);continue}if(this._isConsumeData()){const t=[];for(;t.length0?t:null}else{if(n=e[No](i.name,!1,this.emptyMerge).next().value,!n){if(0===g){t.push(i);continue}const A=e[AI]===Qh?-1:e[AI];n=i[uo]=new lc(A,i.name),this.emptyMerge&&(n[lo]=!0),e[Io](n),this._setAndBind(i,n);continue}this.emptyMerge&&(n[lo]=!0),n=[n]}}n?this._bindOccurrences(i,n,a):g>0?this._setAndBind(i,e):t.push(i)}t.forEach((A=>A[Jo]()[oI](A)))}}class uh{constructor(A,e){this.data=e,this.dataset=A.datasets||null}serialize(A){const e=[[-1,this.data[xo]()]];for(;e.length>0;){const t=e.at(-1),[i,a]=t;if(i+1===a.length){e.pop();continue}const s=a[++t[0]],n=A.get(s[mI]);if(n)s[QI](n);else{const e=s[Do]();for(const t of e.values()){const e=A.get(t[mI]);if(e){t[QI](e);break}}}const g=s[xo]();g.length>0&&e.push([-1,g])}const t=[''];if(this.dataset)for(const A of this.dataset[xo]())"data"!==A[eI]&&A[fI](t);return this.data[fI](t),t.push(""),t.join("")}}const dh=wI.config.id;class fh extends Bc{constructor(A){super(dh,"acrobat",!0),this.acrobat7=null,this.autoSave=null,this.common=null,this.validate=null,this.validateApprovalSignatures=null,this.submitUrl=new hc}}class ph extends Bc{constructor(A){super(dh,"acrobat7",!0),this.dynamicRender=null}}class mh extends uc{constructor(A){super(dh,"ADBE_JSConsole",["delegate","Enable","Disable"])}}class yh extends uc{constructor(A){super(dh,"ADBE_JSDebugger",["delegate","Enable","Disable"])}}class wh extends pc{constructor(A){super(dh,"addSilentPrint")}}class Dh extends pc{constructor(A){super(dh,"addViewerPreferences")}}class bh extends mc{constructor(A){super(dh,"adjustData")}}class kh extends fc{constructor(A){super(dh,"adobeExtensionLevel",0,(A=>A>=1&&A<=8))}}class Fh extends Bc{constructor(A){super(dh,"agent",!0),this.name=A.name?A.name.trim():"",this.common=new hc}}class Sh extends Ec{constructor(A){super(dh,"alwaysEmbed")}}class Rh extends dc{constructor(A){super(dh,"amd")}}class Gh extends Bc{constructor(A){super(dh,"area"),this.level=FI({data:A.level,defaultValue:0,validate:A=>A>=1&&A<=3}),this.name=GI(A.name,["","barcode","coreinit","deviceDriver","font","general","layout","merge","script","signature","sourceSet","templateCache"])}}class Nh extends uc{constructor(A){super(dh,"attributes",["preserve","delegate","ignore"])}}class xh extends uc{constructor(A){super(dh,"autoSave",["disabled","enabled"])}}class Uh extends dc{constructor(A){super(dh,"base")}}class Mh extends Bc{constructor(A){super(dh,"batchOutput"),this.format=GI(A.format,["none","concat","zip","zipCompress"])}}class Lh extends Ec{constructor(A){super(dh,"behaviorOverride")}[mo](){this[Eo]=new Map(this[Eo].trim().split(/\s+/).filter((A=>A.includes(":"))).map((A=>A.split(":",2))))}}class Jh extends Bc{constructor(A){super(dh,"cache",!0),this.templateCache=null}}class Hh extends pc{constructor(A){super(dh,"change")}}class Yh extends Bc{constructor(A){super(dh,"common",!0),this.data=null,this.locale=null,this.localeSet=null,this.messaging=null,this.suppressBanner=null,this.template=null,this.validationMessaging=null,this.versionControl=null,this.log=new hc}}class vh extends Bc{constructor(A){super(dh,"compress"),this.scope=GI(A.scope,["imageOnly","document"])}}class Kh extends pc{constructor(A){super(dh,"compressLogicalStructure")}}class qh extends mc{constructor(A){super(dh,"compressObjectStream")}}class Th extends Bc{constructor(A){super(dh,"compression",!0),this.compressLogicalStructure=null,this.compressObjectStream=null,this.level=null,this.type=null}}class Ph extends Bc{constructor(A){super(dh,"config",!0),this.acrobat=null,this.present=null,this.trace=null,this.agent=new hc}}class Wh extends uc{constructor(A){super(dh,"conformance",["A","B"])}}class Zh extends pc{constructor(A){super(dh,"contentCopy")}}class Oh extends fc{constructor(A){super(dh,"copies",1,(A=>A>=1))}}class Xh extends dc{constructor(A){super(dh,"creator")}}class Vh extends fc{constructor(A){super(dh,"currentPage",0,(A=>A>=0))}}class jh extends Bc{constructor(A){super(dh,"data",!0),this.adjustData=null,this.attributes=null,this.incrementalLoad=null,this.outputXSL=null,this.range=null,this.record=null,this.startNode=null,this.uri=null,this.window=null,this.xsl=null,this.excludeNS=new hc,this.transform=new hc}}class zh extends Bc{constructor(A){super(dh,"debug",!0),this.uri=null}}class _h extends Ec{constructor(A){super(dh,"defaultTypeface"),this.writingScript=GI(A.writingScript,["*","Arabic","Cyrillic","EastEuropeanRoman","Greek","Hebrew","Japanese","Korean","Roman","SimplifiedChinese","Thai","TraditionalChinese","Vietnamese"])}}class $h extends uc{constructor(A){super(dh,"destination",["pdf","pcl","ps","webClient","zpl"])}}class AQ extends pc{constructor(A){super(dh,"documentAssembly")}}class eQ extends Bc{constructor(A){super(dh,"driver",!0),this.name=A.name?A.name.trim():"",this.fontInfo=null,this.xdc=null}}class tQ extends uc{constructor(A){super(dh,"duplexOption",["simplex","duplexFlipLongEdge","duplexFlipShortEdge"])}}class iQ extends uc{constructor(A){super(dh,"dynamicRender",["forbidden","required"])}}class aQ extends pc{constructor(A){super(dh,"embed")}}class sQ extends pc{constructor(A){super(dh,"encrypt")}}class nQ extends Bc{constructor(A){super(dh,"encryption",!0),this.encrypt=null,this.encryptionLevel=null,this.permissions=null}}class gQ extends uc{constructor(A){super(dh,"encryptionLevel",["40bit","128bit"])}}class rQ extends dc{constructor(A){super(dh,"enforce")}}class oQ extends Bc{constructor(A){super(dh,"equate"),this.force=FI({data:A.force,defaultValue:1,validate:A=>0===A}),this.from=A.from||"",this.to=A.to||""}}class IQ extends Bc{constructor(A){super(dh,"equateRange"),this.from=A.from||"",this.to=A.to||"",this._unicodeRange=A.unicodeRange||""}get unicodeRange(){const A=[],e=/U\+([0-9a-fA-F]+)/,t=this._unicodeRange;for(let i of t.split(",").map((A=>A.trim())).filter((A=>!!A)))i=i.split("-",2).map((A=>{const t=A.match(e);return t?parseInt(t[1],16):0})),1===i.length&&i.push(i[0]),A.push(i);return x(this,"unicodeRange",A)}}class cQ extends Ec{constructor(A){super(dh,"exclude")}[mo](){this[Eo]=this[Eo].trim().split(/\s+/).filter((A=>A&&["calculate","close","enter","exit","initialize","ready","validate"].includes(A)))}}class CQ extends dc{constructor(A){super(dh,"excludeNS")}}class BQ extends uc{constructor(A){super(dh,"flipLabel",["usePrinterSetting","on","off"])}}class hQ extends Bc{constructor(A){super(dh,"fontInfo",!0),this.embed=null,this.map=null,this.subsetBelow=null,this.alwaysEmbed=new hc,this.defaultTypeface=new hc,this.neverEmbed=new hc}}class QQ extends pc{constructor(A){super(dh,"formFieldFilling")}}class lQ extends dc{constructor(A){super(dh,"groupParent")}}class EQ extends uc{constructor(A){super(dh,"ifEmpty",["dataValue","dataGroup","ignore","remove"])}}class uQ extends dc{constructor(A){super(dh,"includeXDPContent")}}class dQ extends uc{constructor(A){super(dh,"incrementalLoad",["none","forwardOnly"])}}class fQ extends pc{constructor(A){super(dh,"incrementalMerge")}}class pQ extends pc{constructor(A){super(dh,"interactive")}}class mQ extends uc{constructor(A){super(dh,"jog",["usePrinterSetting","none","pageSet"])}}class yQ extends Bc{constructor(A){super(dh,"labelPrinter",!0),this.name=GI(A.name,["zpl","dpl","ipl","tcpl"]),this.batchOutput=null,this.flipLabel=null,this.fontInfo=null,this.xdc=null}}class wQ extends uc{constructor(A){super(dh,"layout",["paginate","panel"])}}class DQ extends fc{constructor(A){super(dh,"level",0,(A=>A>0))}}class bQ extends pc{constructor(A){super(dh,"linearized")}}class kQ extends dc{constructor(A){super(dh,"locale")}}class FQ extends dc{constructor(A){super(dh,"localeSet")}}class SQ extends Bc{constructor(A){super(dh,"log",!0),this.mode=null,this.threshold=null,this.to=null,this.uri=null}}class RQ extends Bc{constructor(A){super(dh,"map",!0),this.equate=new hc,this.equateRange=new hc}}class GQ extends Bc{constructor(A){super(dh,"mediumInfo",!0),this.map=null}}class NQ extends Bc{constructor(A){super(dh,"message",!0),this.msgId=null,this.severity=null}}class xQ extends Bc{constructor(A){super(dh,"messaging",!0),this.message=new hc}}class UQ extends uc{constructor(A){super(dh,"mode",["append","overwrite"])}}class MQ extends pc{constructor(A){super(dh,"modifyAnnots")}}class LQ extends fc{constructor(A){super(dh,"msgId",1,(A=>A>=1))}}class JQ extends dc{constructor(A){super(dh,"nameAttr")}}class HQ extends Ec{constructor(A){super(dh,"neverEmbed")}}class YQ extends fc{constructor(A){super(dh,"numberOfCopies",null,(A=>A>=2&&A<=5))}}class vQ extends Bc{constructor(A){super(dh,"openAction",!0),this.destination=null}}class KQ extends Bc{constructor(A){super(dh,"output",!0),this.to=null,this.type=null,this.uri=null}}class qQ extends dc{constructor(A){super(dh,"outputBin")}}class TQ extends Bc{constructor(A){super(dh,"outputXSL",!0),this.uri=null}}class PQ extends uc{constructor(A){super(dh,"overprint",["none","both","draw","field"])}}class WQ extends dc{constructor(A){super(dh,"packets")}[mo](){"*"!==this[Eo]&&(this[Eo]=this[Eo].trim().split(/\s+/).filter((A=>["config","datasets","template","xfdf","xslt"].includes(A))))}}class ZQ extends Bc{constructor(A){super(dh,"pageOffset"),this.x=FI({data:A.x,defaultValue:"useXDCSetting",validate:A=>!0}),this.y=FI({data:A.y,defaultValue:"useXDCSetting",validate:A=>!0})}}class OQ extends dc{constructor(A){super(dh,"pageRange")}[mo](){const A=this[Eo].trim().split(/\s+/).map((A=>parseInt(A,10))),e=[];for(let t=0,i=A.length;t!1))}}class zQ extends Bc{constructor(A){super(dh,"pcl",!0),this.name=A.name||"",this.batchOutput=null,this.fontInfo=null,this.jog=null,this.mediumInfo=null,this.outputBin=null,this.pageOffset=null,this.staple=null,this.xdc=null}}class _Q extends Bc{constructor(A){super(dh,"pdf",!0),this.name=A.name||"",this.adobeExtensionLevel=null,this.batchOutput=null,this.compression=null,this.creator=null,this.encryption=null,this.fontInfo=null,this.interactive=null,this.linearized=null,this.openAction=null,this.pdfa=null,this.producer=null,this.renderPolicy=null,this.scriptModel=null,this.silentPrint=null,this.submitFormat=null,this.tagged=null,this.version=null,this.viewerPreferences=null,this.xdc=null}}class $Q extends Bc{constructor(A){super(dh,"pdfa",!0),this.amd=null,this.conformance=null,this.includeXDPContent=null,this.part=null}}class Al extends Bc{constructor(A){super(dh,"permissions",!0),this.accessibleContent=null,this.change=null,this.contentCopy=null,this.documentAssembly=null,this.formFieldFilling=null,this.modifyAnnots=null,this.plaintextMetadata=null,this.print=null,this.printHighQuality=null}}class el extends pc{constructor(A){super(dh,"pickTrayByPDFSize")}}class tl extends dc{constructor(A){super(dh,"picture")}}class il extends pc{constructor(A){super(dh,"plaintextMetadata")}}class al extends uc{constructor(A){super(dh,"presence",["preserve","dissolve","dissolveStructure","ignore","remove"])}}class sl extends Bc{constructor(A){super(dh,"present",!0),this.behaviorOverride=null,this.cache=null,this.common=null,this.copies=null,this.destination=null,this.incrementalMerge=null,this.layout=null,this.output=null,this.overprint=null,this.pagination=null,this.paginationOverride=null,this.script=null,this.validate=null,this.xdp=null,this.driver=new hc,this.labelPrinter=new hc,this.pcl=new hc,this.pdf=new hc,this.ps=new hc,this.submitUrl=new hc,this.webClient=new hc,this.zpl=new hc}}class nl extends pc{constructor(A){super(dh,"print")}}class gl extends pc{constructor(A){super(dh,"printHighQuality")}}class rl extends uc{constructor(A){super(dh,"printScaling",["appdefault","noScaling"])}}class ol extends dc{constructor(A){super(dh,"printerName")}}class Il extends dc{constructor(A){super(dh,"producer")}}class cl extends Bc{constructor(A){super(dh,"ps",!0),this.name=A.name||"",this.batchOutput=null,this.fontInfo=null,this.jog=null,this.mediumInfo=null,this.outputBin=null,this.staple=null,this.xdc=null}}class Cl extends Ec{constructor(A){super(dh,"range")}[mo](){this[Eo]=this[Eo].trim().split(/\s*,\s*/,2).map((A=>A.split("-").map((A=>parseInt(A.trim(),10))))).filter((A=>A.every((A=>!isNaN(A))))).map((A=>(1===A.length&&A.push(A[0]),A)))}}class Bl extends Ec{constructor(A){super(dh,"record")}[mo](){this[Eo]=this[Eo].trim();const A=parseInt(this[Eo],10);!isNaN(A)&&A>=0&&(this[Eo]=A)}}class hl extends Ec{constructor(A){super(dh,"relevant")}[mo](){this[Eo]=this[Eo].trim().split(/\s+/)}}class Ql extends Ec{constructor(A){super(dh,"rename")}[mo](){this[Eo]=this[Eo].trim(),(this[Eo].toLowerCase().startsWith("xml")||new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*","u").test(this[Eo]))&&S("XFA - Rename: invalid XFA name")}}class ll extends uc{constructor(A){super(dh,"renderPolicy",["server","client"])}}class El extends uc{constructor(A){super(dh,"runScripts",["both","client","none","server"])}}class ul extends Bc{constructor(A){super(dh,"script",!0),this.currentPage=null,this.exclude=null,this.runScripts=null}}class dl extends uc{constructor(A){super(dh,"scriptModel",["XFA","none"])}}class fl extends uc{constructor(A){super(dh,"severity",["ignore","error","information","trace","warning"])}}class pl extends Bc{constructor(A){super(dh,"silentPrint",!0),this.addSilentPrint=null,this.printerName=null}}class ml extends Bc{constructor(A){super(dh,"staple"),this.mode=GI(A.mode,["usePrinterSetting","on","off"])}}class yl extends dc{constructor(A){super(dh,"startNode")}}class wl extends fc{constructor(A){super(dh,"startPage",0,(A=>!0))}}class Dl extends uc{constructor(A){super(dh,"submitFormat",["html","delegate","fdf","xml","pdf"])}}class bl extends dc{constructor(A){super(dh,"submitUrl")}}class kl extends fc{constructor(A){super(dh,"subsetBelow",100,(A=>A>=0&&A<=100))}}class Fl extends pc{constructor(A){super(dh,"suppressBanner")}}class Sl extends pc{constructor(A){super(dh,"tagged")}}class Rl extends Bc{constructor(A){super(dh,"template",!0),this.base=null,this.relevant=null,this.startPage=null,this.uri=null,this.xsl=null}}class Gl extends uc{constructor(A){super(dh,"threshold",["trace","error","information","warning"])}}class Nl extends uc{constructor(A){super(dh,"to",["null","memory","stderr","stdout","system","uri"])}}class xl extends Bc{constructor(A){super(dh,"templateCache"),this.maxEntries=FI({data:A.maxEntries,defaultValue:5,validate:A=>A>=0})}}class Ul extends Bc{constructor(A){super(dh,"trace",!0),this.area=new hc}}class Ml extends Bc{constructor(A){super(dh,"transform",!0),this.groupParent=null,this.ifEmpty=null,this.nameAttr=null,this.picture=null,this.presence=null,this.rename=null,this.whitespace=null}}class Ll extends uc{constructor(A){super(dh,"type",["none","ascii85","asciiHex","ccittfax","flate","lzw","runLength","native","xdp","mergedXDP"])}}class Jl extends dc{constructor(A){super(dh,"uri")}}class Hl extends uc{constructor(A){super(dh,"validate",["preSubmit","prePrint","preExecute","preSave"])}}class Yl extends Ec{constructor(A){super(dh,"validateApprovalSignatures")}[mo](){this[Eo]=this[Eo].trim().split(/\s+/).filter((A=>["docReady","postSign"].includes(A)))}}class vl extends uc{constructor(A){super(dh,"validationMessaging",["allMessagesIndividually","allMessagesTogether","firstMessageOnly","noMessages"])}}class Kl extends uc{constructor(A){super(dh,"version",["1.7","1.6","1.5","1.4","1.3","1.2"])}}class ql extends Bc{constructor(A){super(dh,"VersionControl"),this.outputBelow=GI(A.outputBelow,["warn","error","update"]),this.sourceAbove=GI(A.sourceAbove,["warn","error"]),this.sourceBelow=GI(A.sourceBelow,["update","maintain"])}}class Tl extends Bc{constructor(A){super(dh,"viewerPreferences",!0),this.ADBE_JSConsole=null,this.ADBE_JSDebugger=null,this.addViewerPreferences=null,this.duplexOption=null,this.enforce=null,this.numberOfCopies=null,this.pageRange=null,this.pickTrayByPDFSize=null,this.printScaling=null}}class Pl extends Bc{constructor(A){super(dh,"webClient",!0),this.name=A.name?A.name.trim():"",this.fontInfo=null,this.xdc=null}}class Wl extends uc{constructor(A){super(dh,"whitespace",["preserve","ltrim","normalize","rtrim","trim"])}}class Zl extends Ec{constructor(A){super(dh,"window")}[mo](){const A=this[Eo].trim().split(/\s*,\s*/,2).map((A=>parseInt(A,10)));A.some((A=>isNaN(A)))?this[Eo]=[0,0]:(1===A.length&&A.push(A[0]),this[Eo]=A)}}class Ol extends Bc{constructor(A){super(dh,"xdc",!0),this.uri=new hc,this.xsl=new hc}}class Xl extends Bc{constructor(A){super(dh,"xdp",!0),this.packets=null}}class Vl extends Bc{constructor(A){super(dh,"xsl",!0),this.debug=null,this.uri=null}}class jl extends Bc{constructor(A){super(dh,"zpl",!0),this.name=A.name?A.name.trim():"",this.batchOutput=null,this.flipLabel=null,this.fontInfo=null,this.xdc=null}}class zl{static[yI](A,e){if(zl.hasOwnProperty(A))return zl[A](e)}static acrobat(A){return new fh(A)}static acrobat7(A){return new ph(A)}static ADBE_JSConsole(A){return new mh(A)}static ADBE_JSDebugger(A){return new yh(A)}static addSilentPrint(A){return new wh(A)}static addViewerPreferences(A){return new Dh(A)}static adjustData(A){return new bh(A)}static adobeExtensionLevel(A){return new kh(A)}static agent(A){return new Fh(A)}static alwaysEmbed(A){return new Sh(A)}static amd(A){return new Rh(A)}static area(A){return new Gh(A)}static attributes(A){return new Nh(A)}static autoSave(A){return new xh(A)}static base(A){return new Uh(A)}static batchOutput(A){return new Mh(A)}static behaviorOverride(A){return new Lh(A)}static cache(A){return new Jh(A)}static change(A){return new Hh(A)}static common(A){return new Yh(A)}static compress(A){return new vh(A)}static compressLogicalStructure(A){return new Kh(A)}static compressObjectStream(A){return new qh(A)}static compression(A){return new Th(A)}static config(A){return new Ph(A)}static conformance(A){return new Wh(A)}static contentCopy(A){return new Zh(A)}static copies(A){return new Oh(A)}static creator(A){return new Xh(A)}static currentPage(A){return new Vh(A)}static data(A){return new jh(A)}static debug(A){return new zh(A)}static defaultTypeface(A){return new _h(A)}static destination(A){return new $h(A)}static documentAssembly(A){return new AQ(A)}static driver(A){return new eQ(A)}static duplexOption(A){return new tQ(A)}static dynamicRender(A){return new iQ(A)}static embed(A){return new aQ(A)}static encrypt(A){return new sQ(A)}static encryption(A){return new nQ(A)}static encryptionLevel(A){return new gQ(A)}static enforce(A){return new rQ(A)}static equate(A){return new oQ(A)}static equateRange(A){return new IQ(A)}static exclude(A){return new cQ(A)}static excludeNS(A){return new CQ(A)}static flipLabel(A){return new BQ(A)}static fontInfo(A){return new hQ(A)}static formFieldFilling(A){return new QQ(A)}static groupParent(A){return new lQ(A)}static ifEmpty(A){return new EQ(A)}static includeXDPContent(A){return new uQ(A)}static incrementalLoad(A){return new dQ(A)}static incrementalMerge(A){return new fQ(A)}static interactive(A){return new pQ(A)}static jog(A){return new mQ(A)}static labelPrinter(A){return new yQ(A)}static layout(A){return new wQ(A)}static level(A){return new DQ(A)}static linearized(A){return new bQ(A)}static locale(A){return new kQ(A)}static localeSet(A){return new FQ(A)}static log(A){return new SQ(A)}static map(A){return new RQ(A)}static mediumInfo(A){return new GQ(A)}static message(A){return new NQ(A)}static messaging(A){return new xQ(A)}static mode(A){return new UQ(A)}static modifyAnnots(A){return new MQ(A)}static msgId(A){return new LQ(A)}static nameAttr(A){return new JQ(A)}static neverEmbed(A){return new HQ(A)}static numberOfCopies(A){return new YQ(A)}static openAction(A){return new vQ(A)}static output(A){return new KQ(A)}static outputBin(A){return new qQ(A)}static outputXSL(A){return new TQ(A)}static overprint(A){return new PQ(A)}static packets(A){return new WQ(A)}static pageOffset(A){return new ZQ(A)}static pageRange(A){return new OQ(A)}static pagination(A){return new XQ(A)}static paginationOverride(A){return new VQ(A)}static part(A){return new jQ(A)}static pcl(A){return new zQ(A)}static pdf(A){return new _Q(A)}static pdfa(A){return new $Q(A)}static permissions(A){return new Al(A)}static pickTrayByPDFSize(A){return new el(A)}static picture(A){return new tl(A)}static plaintextMetadata(A){return new il(A)}static presence(A){return new al(A)}static present(A){return new sl(A)}static print(A){return new nl(A)}static printHighQuality(A){return new gl(A)}static printScaling(A){return new rl(A)}static printerName(A){return new ol(A)}static producer(A){return new Il(A)}static ps(A){return new cl(A)}static range(A){return new Cl(A)}static record(A){return new Bl(A)}static relevant(A){return new hl(A)}static rename(A){return new Ql(A)}static renderPolicy(A){return new ll(A)}static runScripts(A){return new El(A)}static script(A){return new ul(A)}static scriptModel(A){return new dl(A)}static severity(A){return new fl(A)}static silentPrint(A){return new pl(A)}static staple(A){return new ml(A)}static startNode(A){return new yl(A)}static startPage(A){return new wl(A)}static submitFormat(A){return new Dl(A)}static submitUrl(A){return new bl(A)}static subsetBelow(A){return new kl(A)}static suppressBanner(A){return new Fl(A)}static tagged(A){return new Sl(A)}static template(A){return new Rl(A)}static templateCache(A){return new xl(A)}static threshold(A){return new Gl(A)}static to(A){return new Nl(A)}static trace(A){return new Ul(A)}static transform(A){return new Ml(A)}static type(A){return new Ll(A)}static uri(A){return new Jl(A)}static validate(A){return new Hl(A)}static validateApprovalSignatures(A){return new Yl(A)}static validationMessaging(A){return new vl(A)}static version(A){return new Kl(A)}static versionControl(A){return new ql(A)}static viewerPreferences(A){return new Tl(A)}static webClient(A){return new Pl(A)}static whitespace(A){return new Wl(A)}static window(A){return new Zl(A)}static xdc(A){return new Ol(A)}static xdp(A){return new Xl(A)}static xsl(A){return new Vl(A)}static zpl(A){return new jl(A)}}const _l=wI.connectionSet.id;class $l extends Bc{constructor(A){super(_l,"connectionSet",!0),this.wsdlConnection=new hc,this.xmlConnection=new hc,this.xsdConnection=new hc}}class AE extends Bc{constructor(A){super(_l,"effectiveInputPolicy"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class eE extends Bc{constructor(A){super(_l,"effectiveOutputPolicy"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class tE extends dc{constructor(A){super(_l,"operation"),this.id=A.id||"",this.input=A.input||"",this.name=A.name||"",this.output=A.output||"",this.use=A.use||"",this.usehref=A.usehref||""}}class iE extends dc{constructor(A){super(_l,"rootElement"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class aE extends dc{constructor(A){super(_l,"soapAction"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class sE extends dc{constructor(A){super(_l,"soapAddress"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class nE extends dc{constructor(A){super(_l,"uri"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class gE extends dc{constructor(A){super(_l,"wsdlAddress"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class rE extends Bc{constructor(A){super(_l,"wsdlConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.effectiveInputPolicy=null,this.effectiveOutputPolicy=null,this.operation=null,this.soapAction=null,this.soapAddress=null,this.wsdlAddress=null}}class oE extends Bc{constructor(A){super(_l,"xmlConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.uri=null}}class IE extends Bc{constructor(A){super(_l,"xsdConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.rootElement=null,this.uri=null}}class cE{static[yI](A,e){if(cE.hasOwnProperty(A))return cE[A](e)}static connectionSet(A){return new $l(A)}static effectiveInputPolicy(A){return new AE(A)}static effectiveOutputPolicy(A){return new eE(A)}static operation(A){return new tE(A)}static rootElement(A){return new iE(A)}static soapAction(A){return new aE(A)}static soapAddress(A){return new sE(A)}static uri(A){return new nE(A)}static wsdlAddress(A){return new gE(A)}static wsdlConnection(A){return new rE(A)}static xmlConnection(A){return new oE(A)}static xsdConnection(A){return new IE(A)}}const CE=wI.datasets.id;class BE extends lc{constructor(A){super(CE,"data",A)}[Xo](){return!0}}class hE extends Bc{constructor(A){super(CE,"datasets",!0),this.data=null,this.Signature=null}[iI](A){const e=A[eI];("data"===e&&A[AI]===CE||"Signature"===e&&A[AI]===wI.signature.id)&&(this[e]=A),this[Io](A)}}class QE{static[yI](A,e){if(QE.hasOwnProperty(A))return QE[A](e)}static datasets(A){return new hE(A)}static data(A){return new BE(A)}}const lE=wI.localeSet.id;class EE extends Bc{constructor(A){super(lE,"calendarSymbols",!0),this.name="gregorian",this.dayNames=new hc(2),this.eraNames=null,this.meridiemNames=null,this.monthNames=new hc(2)}}class uE extends dc{constructor(A){super(lE,"currencySymbol"),this.name=GI(A.name,["symbol","isoname","decimal"])}}class dE extends Bc{constructor(A){super(lE,"currencySymbols",!0),this.currencySymbol=new hc(3)}}class fE extends dc{constructor(A){super(lE,"datePattern"),this.name=GI(A.name,["full","long","med","short"])}}class pE extends Bc{constructor(A){super(lE,"datePatterns",!0),this.datePattern=new hc(4)}}class mE extends Ec{constructor(A){super(lE,"dateTimeSymbols")}}class yE extends dc{constructor(A){super(lE,"day")}}class wE extends Bc{constructor(A){super(lE,"dayNames",!0),this.abbr=FI({data:A.abbr,defaultValue:0,validate:A=>1===A}),this.day=new hc(7)}}class DE extends dc{constructor(A){super(lE,"era")}}class bE extends Bc{constructor(A){super(lE,"eraNames",!0),this.era=new hc(2)}}class kE extends Bc{constructor(A){super(lE,"locale",!0),this.desc=A.desc||"",this.name="isoname",this.calendarSymbols=null,this.currencySymbols=null,this.datePatterns=null,this.dateTimeSymbols=null,this.numberPatterns=null,this.numberSymbols=null,this.timePatterns=null,this.typeFaces=null}}class FE extends Bc{constructor(A){super(lE,"localeSet",!0),this.locale=new hc}}class SE extends dc{constructor(A){super(lE,"meridiem")}}class RE extends Bc{constructor(A){super(lE,"meridiemNames",!0),this.meridiem=new hc(2)}}class GE extends dc{constructor(A){super(lE,"month")}}class NE extends Bc{constructor(A){super(lE,"monthNames",!0),this.abbr=FI({data:A.abbr,defaultValue:0,validate:A=>1===A}),this.month=new hc(12)}}class xE extends dc{constructor(A){super(lE,"numberPattern"),this.name=GI(A.name,["full","long","med","short"])}}class UE extends Bc{constructor(A){super(lE,"numberPatterns",!0),this.numberPattern=new hc(4)}}class ME extends dc{constructor(A){super(lE,"numberSymbol"),this.name=GI(A.name,["decimal","grouping","percent","minus","zero"])}}class LE extends Bc{constructor(A){super(lE,"numberSymbols",!0),this.numberSymbol=new hc(5)}}class JE extends dc{constructor(A){super(lE,"timePattern"),this.name=GI(A.name,["full","long","med","short"])}}class HE extends Bc{constructor(A){super(lE,"timePatterns",!0),this.timePattern=new hc(4)}}class YE extends Bc{constructor(A){super(lE,"typeFace",!0),this.name=""|A.name}}class vE extends Bc{constructor(A){super(lE,"typeFaces",!0),this.typeFace=new hc}}class KE{static[yI](A,e){if(KE.hasOwnProperty(A))return KE[A](e)}static calendarSymbols(A){return new EE(A)}static currencySymbol(A){return new uE(A)}static currencySymbols(A){return new dE(A)}static datePattern(A){return new fE(A)}static datePatterns(A){return new pE(A)}static dateTimeSymbols(A){return new mE(A)}static day(A){return new yE(A)}static dayNames(A){return new wE(A)}static era(A){return new DE(A)}static eraNames(A){return new bE(A)}static locale(A){return new kE(A)}static localeSet(A){return new FE(A)}static meridiem(A){return new SE(A)}static meridiemNames(A){return new RE(A)}static month(A){return new GE(A)}static monthNames(A){return new NE(A)}static numberPattern(A){return new xE(A)}static numberPatterns(A){return new UE(A)}static numberSymbol(A){return new ME(A)}static numberSymbols(A){return new LE(A)}static timePattern(A){return new JE(A)}static timePatterns(A){return new HE(A)}static typeFace(A){return new YE(A)}static typeFaces(A){return new vE(A)}}const qE=wI.signature.id;class TE extends Bc{constructor(A){super(qE,"signature",!0)}}class PE{static[yI](A,e){if(PE.hasOwnProperty(A))return PE[A](e)}static signature(A){return new TE(A)}}const WE=wI.stylesheet.id;class ZE extends Bc{constructor(A){super(WE,"stylesheet",!0)}}class OE{static[yI](A,e){if(OE.hasOwnProperty(A))return OE[A](e)}static stylesheet(A){return new ZE(A)}}const XE=wI.xdp.id;class VE extends Bc{constructor(A){super(XE,"xdp",!0),this.uuid=A.uuid||"",this.timeStamp=A.timeStamp||"",this.config=null,this.connectionSet=null,this.datasets=null,this.localeSet=null,this.stylesheet=new hc,this.template=null}[aI](A){const e=wI[A[eI]];return e&&A[AI]===e.id}}class jE{static[yI](A,e){if(jE.hasOwnProperty(A))return jE[A](e)}static xdp(A){return new VE(A)}}const zE=wI.xhtml.id,_E=Symbol(),$E=new Set(["color","font","font-family","font-size","font-stretch","font-style","font-weight","margin","margin-bottom","margin-left","margin-right","margin-top","letter-spacing","line-height","orphans","page-break-after","page-break-before","page-break-inside","tab-interval","tab-stop","text-align","text-decoration","text-indent","vertical-align","widows","kerning-mode","xfa-font-horizontal-scale","xfa-font-vertical-scale","xfa-spacerun","xfa-tab-stops"]),Au=new Map([["page-break-after","breakAfter"],["page-break-before","breakBefore"],["page-break-inside","breakInside"],["kerning-mode",A=>"none"===A?"none":"normal"],["xfa-font-horizontal-scale",A=>`scaleX(${Math.max(0,Math.min(parseInt(A)/100)).toFixed(2)})`],["xfa-font-vertical-scale",A=>`scaleY(${Math.max(0,Math.min(parseInt(A)/100)).toFixed(2)})`],["xfa-spacerun",""],["xfa-tab-stops",""],["font-size",(A,e)=>yc(.99*(A=e.fontSize=NI(A)))],["letter-spacing",A=>yc(NI(A))],["line-height",A=>yc(NI(A))],["margin",A=>yc(NI(A))],["margin-bottom",A=>yc(NI(A))],["margin-left",A=>yc(NI(A))],["margin-right",A=>yc(NI(A))],["margin-top",A=>yc(NI(A))],["text-indent",A=>yc(NI(A))],["font-family",A=>A],["vertical-align",A=>yc(NI(A))]]),eu=/\s+/g,tu=/[\r\n]+/g,iu=/\r\n?/g;function au(A,e,t){const i=Object.create(null);if(!A)return i;const a=Object.create(null);for(const[e,t]of A.split(";").map((A=>A.split(":",2)))){const A=Au.get(e);if(""===A)continue;let s=t;A&&(s="string"==typeof A?A:A(t,a)),e.endsWith("scale")?i.transform=i.transform?`${i[e]} ${s}`:s:i[e.replaceAll(/-([a-zA-Z])/g,((A,e)=>e.toUpperCase()))]=s}if(i.fontFamily&&Hc({typeface:i.fontFamily,weight:i.fontWeight||"normal",posture:i.fontStyle||"normal",size:a.fontSize||0},e,e[Yo].fontFinder,i),t&&i.verticalAlign&&"0px"!==i.verticalAlign&&i.fontSize){const A=.583,e=.333,t=NI(i.fontSize);i.fontSize=yc(t*A),i.verticalAlign=yc(Math.sign(NI(i.verticalAlign))*t*e)}return t&&i.fontSize&&(i.fontSize=`calc(${i.fontSize} * var(--scale-factor))`),xc(i),i}const su=new Set(["body","html"]);class nu extends lc{constructor(A,e){super(zE,e),this[_E]=!1,this.style=A.style||""}[Co](A){var e;super[Co](A),this.style=(e=this).style?e.style.trim().split(/\s*;\s*/).filter((A=>!!A)).map((A=>A.split(/\s*:\s*/,2))).filter((([A,t])=>("font-family"===A&&e[Yo].usedTypefaces.add(t),$E.has(A)))).map((A=>A.join(":"))).join(";"):""}[ro](){return!su.has(this[eI])}[sI](A,e=!1){e?this[_E]=!0:(A=A.replaceAll(tu,""),this.style.includes("xfa-spacerun:yes")||(A=A.replaceAll(eu," "))),A&&(this[Eo]+=A)}[nI](A,e=!0){const t=Object.create(null),i={top:NaN,bottom:NaN,left:NaN,right:NaN};let a=null;for(const[A,e]of this.style.split(";").map((A=>A.split(":",2))))switch(A){case"font-family":t.typeface=kI(e);break;case"font-size":t.size=NI(e);break;case"font-weight":t.weight=e;break;case"font-style":t.posture=e;break;case"letter-spacing":t.letterSpacing=NI(e);break;case"margin":const A=e.split(/ \t/).map((A=>NI(A)));switch(A.length){case 1:i.top=i.bottom=i.left=i.right=A[0];break;case 2:i.top=i.bottom=A[0],i.left=i.right=A[1];break;case 3:i.top=A[0],i.bottom=A[2],i.left=i.right=A[1];break;case 4:i.top=A[0],i.left=A[1],i.bottom=A[2],i.right=A[3]}break;case"margin-top":i.top=NI(e);break;case"margin-bottom":i.bottom=NI(e);break;case"margin-left":i.left=NI(e);break;case"margin-right":i.right=NI(e);break;case"line-height":a=NI(e)}if(A.pushData(t,i,a),this[Eo])A.addString(this[Eo]);else for(const e of this[xo]())"#text"!==e[eI]?e[nI](A):A.addString(e[Eo]);e&&A.popFont()}[dI](A){const e=[];if(this[po]={children:e},this[co]({}),0===e.length&&!this[Eo])return MI.EMPTY;let t;return t=this[_E]?this[Eo]?this[Eo].replaceAll(iu,"\n"):void 0:this[Eo]||void 0,MI.success({name:this[eI],attributes:{href:this.href,style:au(this.style,this,this[_E])},children:e,value:t})}}class gu extends nu{constructor(A){super(A,"a"),this.href=Yc(A.href)||""}}class ru extends nu{constructor(A){super(A,"b")}[nI](A){A.pushFont({weight:"bold"}),super[nI](A),A.popFont()}}class ou extends nu{constructor(A){super(A,"body")}[dI](A){const e=super[dI](A),{html:t}=e;return t?(t.name="div",t.attributes.class=["xfaRich"],e):MI.EMPTY}}class Iu extends nu{constructor(A){super(A,"br")}[EI](){return"\n"}[nI](A){A.addString("\n")}[dI](A){return MI.success({name:"br"})}}class cu extends nu{constructor(A){super(A,"html")}[dI](A){const e=[];if(this[po]={children:e},this[co]({}),0===e.length)return MI.success({name:"div",attributes:{class:["xfaRich"],style:{}},value:this[Eo]||""});if(1===e.length){const A=e[0];if(A.attributes?.class.includes("xfaRich"))return MI.success(A)}return MI.success({name:"div",attributes:{class:["xfaRich"],style:{}},children:e})}}class Cu extends nu{constructor(A){super(A,"i")}[nI](A){A.pushFont({posture:"italic"}),super[nI](A),A.popFont()}}class Bu extends nu{constructor(A){super(A,"li")}}class hu extends nu{constructor(A){super(A,"ol")}}class Qu extends nu{constructor(A){super(A,"p")}[nI](A){super[nI](A,!1),A.addString("\n"),A.addPara(),A.popFont()}[EI](){return this[Jo]()[xo]().at(-1)===this?super[EI]():super[EI]()+"\n"}}class lu extends nu{constructor(A){super(A,"span")}}class Eu extends nu{constructor(A){super(A,"sub")}}class uu extends nu{constructor(A){super(A,"sup")}}class du extends nu{constructor(A){super(A,"ul")}}class fu{static[yI](A,e){if(fu.hasOwnProperty(A))return fu[A](e)}static a(A){return new gu(A)}static b(A){return new ru(A)}static body(A){return new ou(A)}static br(A){return new Iu(A)}static html(A){return new cu(A)}static i(A){return new Cu(A)}static li(A){return new Bu(A)}static ol(A){return new hu(A)}static p(A){return new Qu(A)}static span(A){return new lu(A)}static sub(A){return new Eu(A)}static sup(A){return new uu(A)}static ul(A){return new du(A)}}const pu={config:zl,connection:cE,datasets:QE,localeSet:KE,signature:PE,stylesheet:OE,template:hh,xdp:jE,xhtml:fu};class mu{constructor(A){this.namespaceId=A}[yI](A,e){return new lc(this.namespaceId,A,e)}}class yu extends Bc{constructor(A){super(-1,"root",Object.create(null)),this.element=null,this[Ko]=A}[iI](A){return this.element=A,!0}[mo](){super[mo](),this.element.template instanceof th&&(this[Ko].set(II,this.element),this.element.template[cI](this[Ko]),this.element.template[Ko]=this[Ko])}}class wu extends Bc{constructor(){super(-1,"",Object.create(null))}[iI](A){return!1}}class Du{constructor(A=null){this._namespaceStack=[],this._nsAgnosticLevel=0,this._namespacePrefixes=new Map,this._namespaces=new Map,this._nextNsId=Math.max(...Object.values(wI).map((({id:A})=>A))),this._currentNamespace=A||new mu(++this._nextNsId)}buildRoot(A){return new yu(A)}build({nsPrefix:A,name:e,attributes:t,namespace:i,prefixes:a}){const s=null!==i;if(s&&(this._namespaceStack.push(this._currentNamespace),this._currentNamespace=this._searchNamespace(i)),a&&this._addNamespacePrefix(a),t.hasOwnProperty(tI)){const A=pu.datasets,e=t[tI];let i=null;for(const[t,a]of Object.entries(e))if(this._getNamespaceToUse(t)===A){i={xfa:a};break}i?t[tI]=i:delete t[tI]}const n=this._getNamespaceToUse(A),g=n?.[yI](e,t)||new wu;return g[Xo]()&&this._nsAgnosticLevel++,(s||a||g[Xo]())&&(g[ho]={hasNamespace:s,prefixes:a,nsAgnostic:g[Xo]()}),g}isNsAgnostic(){return this._nsAgnosticLevel>0}_searchNamespace(A){let e=this._namespaces.get(A);if(e)return e;for(const[t,{check:i}]of Object.entries(wI))if(i(A)){if(e=pu[t],e)return this._namespaces.set(A,e),e;break}return e=new mu(++this._nextNsId),this._namespaces.set(A,e),e}_addNamespacePrefix(A){for(const{prefix:e,value:t}of A){const A=this._searchNamespace(t);let i=this._namespacePrefixes.get(e);i||(i=[],this._namespacePrefixes.set(e,i)),i.push(A)}}_getNamespaceToUse(A){if(!A)return this._currentNamespace;const e=this._namespacePrefixes.get(A);return e?.length>0?e.at(-1):(S(`Unknown namespace prefix: ${A}.`),null)}clean(A){const{hasNamespace:e,prefixes:t,nsAgnostic:i}=A;e&&(this._currentNamespace=this._namespaceStack.pop()),t&&t.forEach((({prefix:A})=>{this._namespacePrefixes.get(A).pop()})),i&&this._nsAgnosticLevel--}}class bu extends wr{constructor(A=null,e=!1){super(),this._builder=new Du(A),this._stack=[],this._globalData={usedTypefaces:new Set},this._ids=new Map,this._current=this._builder.buildRoot(this._ids),this._errorCode=0,this._whiteRegex=/^\s+$/,this._nbsps=/\xa0+/g,this._richText=e}parse(A){if(this.parseXml(A),0===this._errorCode)return this._current[mo](),this._current.element}onText(A){A=A.replace(this._nbsps,(A=>A.slice(1)+" ")),this._richText||this._current[ro]()?this._current[sI](A,this._richText):this._whiteRegex.test(A)||this._current[sI](A.trim())}onCdata(A){this._current[sI](A)}_mkAttributes(A,e){let t=null,i=null;const a=Object.create({});for(const{name:s,value:n}of A)if("xmlns"===s)t?S(`XFA - multiple namespace definition in <${e}>`):t=n;else if(s.startsWith("xmlns:")){const A=s.substring(6);i||(i=[]),i.push({prefix:A,value:n})}else{const A=s.indexOf(":");if(-1===A)a[s]=n;else{let e=a[tI];e||(e=a[tI]=Object.create(null));const[t,i]=[s.slice(0,A),s.slice(A+1)];(e[t]||=Object.create(null))[i]=n}}return[t,i,a]}_getNameAndPrefix(A,e){const t=A.indexOf(":");return-1===t?[A,null]:[A.substring(t+1),e?"":A.substring(0,t)]}onBeginElement(A,e,t){const[i,a,s]=this._mkAttributes(e,A),[n,g]=this._getNameAndPrefix(A,this._builder.isNsAgnostic()),r=this._builder.build({nsPrefix:g,name:n,attributes:s,namespace:i,prefixes:a});if(r[Yo]=this._globalData,t)return r[mo](),this._current[iI](r)&&r[BI](this._ids),void r[Co](this._builder);this._stack.push(this._current),this._current=r}onEndElement(A){const e=this._current;if(e[Po]()&&"string"==typeof e[Eo]){const A=new bu;A._globalData=this._globalData;const t=A.parse(e[Eo]);e[Eo]=null,e[iI](t)}e[mo](),this._current=this._stack.pop(),this._current[iI](e)&&e[BI](this._ids),e[Co](this._builder)}onError(A){this._errorCode=A}}class ku{constructor(A){try{this.root=(new bu).parse(ku._createDocument(A));const e=new Eh(this.root);this.form=e.bind(),this.dataHandler=new uh(this.root,e.getData()),this.form[Yo].template=this.form}catch(A){S(`XFA - an error occurred during parsing and binding: ${A}`)}}isValid(){return this.root&&this.form}_createPagesHelper(){const A=this.form[uI]();return new Promise(((e,t)=>{const i=()=>{try{const t=A.next();t.done?e(t.value):setTimeout(i,0)}catch(A){t(A)}};setTimeout(i,0)}))}async _createPages(){try{this.pages=await this._createPagesHelper(),this.dims=this.pages.children.map((A=>{const{width:e,height:t}=A.attributes.style;return[0,0,parseInt(e),parseInt(t)]}))}catch(A){S(`XFA - an error occurred during layout: ${A}`)}}getBoundingBox(A){return this.dims[A]}async getNumPages(){return this.pages||await this._createPages(),this.dims.length}setImages(A){this.form[Yo].images=A}setFonts(A){this.form[Yo].fontFinder=new LI(A);const e=[];for(let A of this.form[Yo].usedTypefaces)A=kI(A),this.form[Yo].fontFinder.find(A)||e.push(A);return e.length>0?e:null}appendFonts(A,e){this.form[Yo].fontFinder.add(A,e)}async getPages(){this.pages||await this._createPages();const A=this.pages;return this.pages=null,A}serializeData(A){return this.dataHandler.serialize(A)}static _createDocument(A){return A["/xdp:xdp"]?Object.values(A).join(""):A["xdp:xdp"]}static getRichTextAsHtml(A){if(!A||"string"!=typeof A)return null;try{let e=new bu(fu,!0).parse(A);if(!["body","xhtml"].includes(e[eI])){const A=fu.body({});A[Io](e),e=A}const t=e[dI]();if(!t.success)return null;const{html:i}=t,{attributes:a}=i;return a&&(a.class&&(a.class=a.class.filter((A=>!A.startsWith("xfa")))),a.dir="auto"),{html:i,str:e[EI]()}}catch(A){S(`XFA - an error occurred during parsing of rich text: ${A}`)}return null}}class Fu{static createGlobals(A){return Promise.all([A.ensureCatalog("acroForm"),A.ensureDoc("xfaDatasets"),A.ensureCatalog("structTreeRoot"),A.ensureCatalog("baseUrl"),A.ensureCatalog("attachments")]).then((([e,t,i,a,s])=>({pdfManager:A,acroForm:e instanceof cA?e:cA.empty,xfaDatasets:t,structTreeRoot:i,baseUrl:a,attachments:s})),(A=>(S(`createGlobals: "${A}".`),null)))}static async create(A,e,t,i,a,s){const n=a?await this._getPageIndex(A,e,t.pdfManager):null;return t.pdfManager.ensure(this,"_create",[A,e,t,i,a,n,s])}static _create(A,e,t,i,a=!1,s=null,n=null){const g=A.fetchIfRef(e);if(!(g instanceof cA))return;const{acroForm:r,pdfManager:o}=t,I=e instanceof CA?e.toString():`annot_${i.createObjId()}`;let c=g.get("Subtype");c=c instanceof rA?c.name:null;const C={xref:A,ref:e,dict:g,subtype:c,id:I,annotationGlobals:t,collectFields:a,needAppearances:!a&&!0===r.get("NeedAppearances"),pageIndex:s,evaluatorOptions:o.evaluatorOptions,pageRef:n};switch(c){case"Link":return new qu(C);case"Text":return new Ku(C);case"Widget":let A=kA({dict:g,key:"FT"});switch(A=A instanceof rA?A.name:null,A){case"Tx":return new Ju(C);case"Btn":return new Hu(C);case"Ch":return new Yu(C);case"Sig":return new vu(C)}return S(`Unimplemented widget field type "${A}", falling back to base field type.`),new Lu(C);case"Popup":return new Tu(C);case"FreeText":return new Pu(C);case"Line":return new Wu(C);case"Square":return new Zu(C);case"Circle":return new Ou(C);case"PolyLine":return new Xu(C);case"Polygon":return new Vu(C);case"Caret":return new ju(C);case"Ink":return new zu(C);case"Highlight":return new _u(C);case"Underline":return new $u(C);case"Squiggly":return new Ad(C);case"StrikeOut":return new ed(C);case"Stamp":return new td(C);case"FileAttachment":return new id(C);default:return a||S(c?`Unimplemented annotation type "${c}", falling back to base annotation.`:"Annotation is missing the required /Subtype."),new xu(C)}}static async _getPageIndex(A,e,t){try{const i=await A.fetchIfRefAsync(e);if(!(i instanceof cA))return-1;const a=i.getRaw("P");if(a instanceof CA)try{return await t.ensureCatalog("getPageIndex",[a])}catch(A){F(`_getPageIndex -- not a valid page reference: "${A}".`)}if(i.has("Kids"))return-1;const s=await t.ensureDoc("numPages");for(let A=0;AA/255))}function Gu(A,e){const t=A.getArray("QuadPoints");if(!MA(t,null)||0===t.length||t.length%8>0)return null;const i=new Float32Array(t.length);for(let A=0,a=t.length;Ae[2]||he[3]))return null;i.set([C,Q,B,Q,C,h,B,h],A)}return i}function Nu(A,e,t){const[i,a,s,n]=X.getAxialAlignedBoundingBox(e,t);if(i===s||a===n)return[1,0,0,1,A[0],A[1]];const g=(A[2]-A[0])/(s-i),r=(A[3]-A[1])/(n-a);return[g,0,0,r,A[0]-i*g,A[1]-a*r]}class xu{constructor(A){const{dict:e,xref:t,annotationGlobals:i}=A;this.setTitle(e.get("T")),this.setContents(e.get("Contents")),this.setModificationDate(e.get("M")),this.setFlags(e.get("F")),this.setRectangle(e.getArray("Rect")),this.setColor(e.getArray("C")),this.setBorderStyle(e),this.setAppearance(e),this.setOptionalContent(e);const a=e.get("MK");this.setBorderAndBackgroundColors(a),this.setRotation(a,e),this.ref=A.ref instanceof CA?A.ref:null,this._streams=[],this.appearance&&this._streams.push(this.appearance);const s=!!(128&this.flags),n=!!(512&this.flags);if(i.structTreeRoot){let t=e.get("StructParent");t=Number.isInteger(t)&&t>=0?t:-1,i.structTreeRoot.addAnnotationIdToPage(A.pageRef,t)}if(this.data={annotationFlags:this.flags,borderStyle:this.borderStyle,color:this.color,backgroundColor:this.backgroundColor,borderColor:this.borderColor,rotation:this.rotation,contentsObj:this._contents,hasAppearance:!!this.appearance,id:A.id,modificationDate:this.modificationDate,rect:this.rectangle,subtype:A.subtype,hasOwnCanvas:!1,noRotate:!!(16&this.flags),noHTML:s&&n,isEditable:!1},A.collectFields){const i=e.get("Kids");if(Array.isArray(i)){const A=[];for(const e of i)e instanceof CA&&A.push(e.toString());0!==A.length&&(this.data.kidIds=A)}this.data.actions=TA(t,e,C),this.data.fieldName=this._constructFieldName(e),this.data.pageIndex=A.pageIndex}this._isOffscreenCanvasSupported=A.evaluatorOptions.isOffscreenCanvasSupported,this._fallbackFontDict=null,this._needAppearances=!1}_hasFlag(A,e){return!!(A&e)}_isViewable(A){return!this._hasFlag(A,1)&&!this._hasFlag(A,32)}_isPrintable(A){return this._hasFlag(A,4)&&!this._hasFlag(A,2)&&!this._hasFlag(A,1)}mustBeViewed(A,e){const t=A?.get(this.data.id)?.noView;return void 0!==t?!t:this.viewable&&!this._hasFlag(this.flags,2)}mustBePrinted(A){const e=A?.get(this.data.id)?.noPrint;return void 0!==e?!e:this.printable}mustBeViewedWhenEditing(A,e=null){return A?!this.data.isEditable:!e?.has(this.data.id)}get viewable(){return null!==this.data.quadPoints&&(0===this.flags||this._isViewable(this.flags))}get printable(){return null!==this.data.quadPoints&&0!==this.flags&&this._isPrintable(this.flags)}_parseStringHelper(A){const e="string"==typeof A?j(A):"";return{str:e,dir:e&&"rtl"===Ng(e).dir?"rtl":"ltr"}}setDefaultAppearance(A){const{dict:e,annotationGlobals:t}=A,i=kA({dict:e,key:"DA"})||t.acroForm.get("DA");this._defaultAppearance="string"==typeof i?i:"",this.data.defaultAppearanceData=Br(this._defaultAppearance)}setTitle(A){this._title=this._parseStringHelper(A)}setContents(A){this._contents=this._parseStringHelper(A)}setModificationDate(A){this.modificationDate="string"==typeof A?A:null}setFlags(A){this.flags=Number.isInteger(A)&&A>0?A:0,1&this.flags&&"Annotation"!==this.constructor.name&&(this.flags^=1)}hasFlag(A){return this._hasFlag(this.flags,A)}setRectangle(A){this.rectangle=HA(A,[0,0,0,0])}setColor(A){this.color=Su(A)}setLineEndings(A){if(this.lineEndings=["None","None"],Array.isArray(A)&&2===A.length)for(let e=0;e<2;e++){const t=A[e];if(t instanceof rA)switch(t.name){case"None":continue;case"Square":case"Circle":case"Diamond":case"OpenArrow":case"ClosedArrow":case"Butt":case"ROpenArrow":case"RClosedArrow":case"Slash":this.lineEndings[e]=t.name;continue}S(`Ignoring invalid lineEnding: ${t}`)}}setRotation(A,e){this.rotation=0;let t=A instanceof cA?A.get("R")||0:e.get("Rotate")||0;Number.isInteger(t)&&0!==t&&(t%=360,t<0&&(t+=360),t%90==0&&(this.rotation=t))}setBorderAndBackgroundColors(A){A instanceof cA?(this.borderColor=Su(A.getArray("BC"),null),this.backgroundColor=Su(A.getArray("BG"),null)):this.borderColor=this.backgroundColor=null}setBorderStyle(A){if(this.borderStyle=new Uu,A instanceof cA)if(A.has("BS")){const e=A.get("BS");if(e instanceof cA){const A=e.get("Type");A&&!QA(A,"Border")||(this.borderStyle.setWidth(e.get("W"),this.rectangle),this.borderStyle.setStyle(e.get("S")),this.borderStyle.setDashArray(e.getArray("D")))}}else if(A.has("Border")){const e=A.getArray("Border");Array.isArray(e)&&e.length>=3&&(this.borderStyle.setHorizontalCornerRadius(e[0]),this.borderStyle.setVerticalCornerRadius(e[1]),this.borderStyle.setWidth(e[2],this.rectangle),4===e.length&&this.borderStyle.setDashArray(e[3],!0))}else this.borderStyle.setWidth(0)}setAppearance(A){this.appearance=null;const e=A.get("AP");if(!(e instanceof cA))return;const t=e.get("N");if(t instanceof dA)return void(this.appearance=t);if(!(t instanceof cA))return;const i=A.get("AS");if(!(i instanceof rA&&t.has(i.name)))return;const a=t.get(i.name);a instanceof dA&&(this.appearance=a)}setOptionalContent(A){this.oc=null;const e=A.get("OC");e instanceof rA?S("setOptionalContent: Support for /Name-entry is not implemented."):e instanceof cA&&(this.oc=e)}loadResources(A,e){return e.dict.getAsync("Resources").then((e=>{if(e)return new go(e,A,e.xref).load().then((function(){return e}))}))}async getOperatorList(A,e,t,a){const{hasOwnCanvas:s,id:n,rect:g}=this.data;let r=this.appearance;const o=!!(s&&2&t);if(o&&(g[0]===g[2]||g[1]===g[3]))return this.data.hasOwnCanvas=!1,{opList:new zg,separateForm:!1,separateCanvas:!1};if(!r){if(!o)return{opList:new zg,separateForm:!1,separateCanvas:!1};r=new ae(""),r.dict=new cA}const I=r.dict,c=await this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"],r),C=JA(I.getArray("BBox"),[0,0,1,1]),B=LA(I.getArray("Matrix"),i),h=Nu(g,C,B),Q=new zg;let l;return this.oc&&(l=await A.parseMarkedContentProps(this.oc,null)),void 0!==l&&Q.addOp(m,["OC",l]),Q.addOp(80,[n,g,h,B,o]),await A.getOperatorList({stream:r,task:e,resources:c,operatorList:Q,fallbackFontDict:this._fallbackFontDict}),Q.addOp(81,[]),void 0!==l&&Q.addOp(y,[]),this.reset(),{opList:Q,separateForm:!1,separateCanvas:o}}async save(A,e,t){return null}get hasTextContent(){return!1}async extractTextContent(A,e,t){if(!this.appearance)return;const i=await this.loadResources(["ExtGState","Font","Properties","XObject"],this.appearance),a=[],s=[];let n=null;const g={desiredSize:Math.Infinity,ready:!0,enqueue(A,e){for(const e of A.items)void 0!==e.str&&(n||=e.transform.slice(-2),s.push(e.str),e.hasEOL&&(a.push(s.join("").trimEnd()),s.length=0))}};if(await A.getTextContent({stream:this.appearance,task:e,resources:i,includeMarkedContent:!0,keepWhiteSpace:!0,sink:g,viewBox:t}),this.reset(),s.length&&a.push(s.join("").trimEnd()),a.length>1||a[0]){const A=this.appearance.dict,e=JA(A.getArray("BBox"),null),t=LA(A.getArray("Matrix"),null);this.data.textPosition=this._transformPoint(n,e,t),this.data.textContent=a}}_transformPoint(A,e,t){const{rect:i}=this.data;e||=[0,0,1,1],t||=[1,0,0,1,0,0];const a=Nu(i,e,t);return a[4]-=i[0],a[5]-=i[1],A=X.applyTransform(A,a),X.applyTransform(A,t)}getFieldObject(){return this.data.kidIds?{id:this.data.id,actions:this.data.actions,name:this.data.fieldName,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,type:"",kidIds:this.data.kidIds,page:this.data.pageIndex,rotation:this.rotation}:null}reset(){for(const A of this._streams)A.reset()}_constructFieldName(A){if(!A.has("T")&&!A.has("Parent"))return S("Unknown field name, falling back to empty field name."),"";if(!A.has("Parent"))return j(A.get("T"));const e=[];A.has("T")&&e.unshift(j(A.get("T")));let t=A;const i=new BA;for(A.objId&&i.put(A.objId);t.has("Parent")&&(t=t.get("Parent"),t instanceof cA&&(!t.objId||!i.has(t.objId)));)t.objId&&i.put(t.objId),t.has("T")&&e.unshift(j(t.get("T")));return e.join(".")}}class Uu{constructor(){this.width=1,this.style=1,this.dashArray=[3],this.horizontalCornerRadius=0,this.verticalCornerRadius=0}setWidth(A,e=[0,0,0,0]){if(A instanceof rA)this.width=0;else if("number"==typeof A){if(A>0){const t=(e[2]-e[0])/2,i=(e[3]-e[1])/2;t>0&&i>0&&(A>t||A>i)&&(S(`AnnotationBorderStyle.setWidth - ignoring width: ${A}`),A=1)}this.width=A}}setStyle(A){if(A instanceof rA)switch(A.name){case"S":this.style=1;break;case"D":this.style=2;break;case"B":this.style=3;break;case"I":this.style=4;break;case"U":this.style=5}}setDashArray(A,e=!1){if(Array.isArray(A)){let t=!0,i=!0;for(const e of A){if(!(+e>=0)){t=!1;break}e>0&&(i=!1)}0===A.length||t&&!i?(this.dashArray=A,e&&this.setStyle(rA.get("D"))):this.width=0}else A&&(this.width=0)}setHorizontalCornerRadius(A){Number.isInteger(A)&&(this.horizontalCornerRadius=A)}setVerticalCornerRadius(A){Number.isInteger(A)&&(this.verticalCornerRadius=A)}}class Mu extends xu{constructor(A){super(A);const{dict:e}=A;if(e.has("IRT")){const A=e.getRaw("IRT");this.data.inReplyTo=A instanceof CA?A.toString():null;const t=e.get("RT");this.data.replyType=t instanceof rA?t.name:"R"}let t=null;if(this.data.replyType===o){const A=e.get("IRT");this.setTitle(A.get("T")),this.data.titleObj=this._title,this.setContents(A.get("Contents")),this.data.contentsObj=this._contents,A.has("CreationDate")?(this.setCreationDate(A.get("CreationDate")),this.data.creationDate=this.creationDate):this.data.creationDate=null,A.has("M")?(this.setModificationDate(A.get("M")),this.data.modificationDate=this.modificationDate):this.data.modificationDate=null,t=A.getRaw("Popup"),A.has("C")?(this.setColor(A.getArray("C")),this.data.color=this.color):this.data.color=null}else this.data.titleObj=this._title,this.setCreationDate(e.get("CreationDate")),this.data.creationDate=this.creationDate,t=e.getRaw("Popup"),e.has("C")||(this.data.color=null);this.data.popupRef=t instanceof CA?t.toString():null,e.has("RC")&&(this.data.richText=ku.getRichTextAsHtml(e.get("RC")))}setCreationDate(A){this.creationDate="string"==typeof A?A:null}_setDefaultAppearance({xref:A,extra:e,strokeColor:t,fillColor:i,blendMode:a,strokeAlpha:s,fillAlpha:n,pointsCallback:g}){let r=Number.MAX_VALUE,o=Number.MAX_VALUE,I=Number.MIN_VALUE,c=Number.MIN_VALUE;const C=["q"];e&&C.push(e),t&&C.push(`${t[0]} ${t[1]} ${t[2]} RG`),i&&C.push(`${i[0]} ${i[1]} ${i[2]} rg`);let B=this.data.quadPoints;B||(B=Float32Array.from([this.rectangle[0],this.rectangle[3],this.rectangle[2],this.rectangle[3],this.rectangle[0],this.rectangle[1],this.rectangle[2],this.rectangle[1]]));for(let A=0,e=B.length;A"string"==typeof A)).map((A=>j(A))):A instanceof rA?j(A.name):"string"==typeof A?j(A):null}hasFieldFlag(A){return!!(this.data.fieldFlags&A)}_isViewable(A){return!0}mustBeViewed(A,e){return e?this.viewable:super.mustBeViewed(A,e)&&!this._hasFlag(this.flags,32)}getRotationMatrix(A){let e=A?.get(this.data.id)?.rotation;return void 0===e&&(e=this.rotation),0===e?i:ee(e,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1])}getBorderAndBackgroundAppearances(A){let e=A?.get(this.data.id)?.rotation;if(void 0===e&&(e=this.rotation),!this.backgroundColor&&!this.borderColor)return"";const t=this.data.rect[2]-this.data.rect[0],i=this.data.rect[3]-this.data.rect[1],a=0===e||180===e?`0 0 ${t} ${i} re`:`0 0 ${i} ${t} re`;let s="";return this.backgroundColor&&(s=`${Qr(this.backgroundColor,!0)} ${a} f `),this.borderColor&&(s+=`${this.borderStyle.width||1} w ${Qr(this.borderColor,!1)} ${a} S `),s}async getOperatorList(A,e,t,i){if(16&t&&!(this instanceof vu)&&!this.data.noHTML&&!this.data.hasOwnCanvas)return{opList:new zg,separateForm:!0,separateCanvas:!1};if(!this._hasText)return super.getOperatorList(A,e,t,i);const a=await this._getAppearance(A,e,t,i);if(this.appearance&&null===a)return super.getOperatorList(A,e,t,i);const s=new zg;if(!this._defaultAppearance||null===a)return{opList:s,separateForm:!1,separateCanvas:!1};const n=!!(this.data.hasOwnCanvas&&2&t),g=[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]],r=Nu(this.data.rect,g,[1,0,0,1,0,0]);let o;this.oc&&(o=await A.parseMarkedContentProps(this.oc,null)),void 0!==o&&s.addOp(m,["OC",o]),s.addOp(80,[this.data.id,this.data.rect,r,this.getRotationMatrix(i),n]);const I=new ae(a);return await A.getOperatorList({stream:I,task:e,resources:this._fieldResources.mergedResources,operatorList:s}),s.addOp(81,[]),void 0!==o&&s.addOp(y,[]),{opList:s,separateForm:!1,separateCanvas:n}}_getMKDict(A){const e=new cA(null);return A&&e.set("R",A),this.borderColor&&e.set("BC",Ru(this.borderColor)),this.backgroundColor&&e.set("BG",Ru(this.backgroundColor)),e.size>0?e:null}amendSavedDict(A,e){}async save(A,e,t){const a=t?.get(this.data.id);let s=a?.value,n=a?.rotation;if(s===this.data.fieldValue||void 0===s){if(!this._hasValueFromXFA&&void 0===n)return null;s||=this.data.fieldValue}if(void 0===n&&!this._hasValueFromXFA&&Array.isArray(s)&&Array.isArray(this.data.fieldValue)&&s.length===this.data.fieldValue.length&&s.every(((A,e)=>A===this.data.fieldValue[e])))return null;void 0===n&&(n=this.rotation);let g=null;if(!this._needAppearances&&(g=await this._getAppearance(A,e,8,t),null===g))return null;let r=!1;g?.needAppearances&&(r=!0,g=null);const{xref:o}=A,I=o.fetchIfRef(this.ref);if(!(I instanceof cA))return null;const c=new cA(o);for(const A of I.getKeys())"AP"!==A&&c.set(A,I.getRaw(A));const C={path:this.data.fieldName,value:s};c.set("V",Array.isArray(s)?s.map(_A):_A(s)),this.amendSavedDict(t,c);const B=this._getMKDict(n);B&&c.set("MK",B);const h=[],Q=[{ref:this.ref,data:"",xfa:C,needAppearances:r}];if(null!==g){const A=o.getNewTemporaryRef(),e=new cA(o);c.set("AP",e),e.set("N",A);const a=this._getSaveFieldResources(o),s=new ae(g),n=s.dict=new cA(o);n.set("Subtype",rA.get("Form")),n.set("Resources",a),n.set("BBox",[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]]);const r=this.getRotationMatrix(t);r!==i&&n.set("Matrix",r),await qr(A,s,h,o),Q.push({ref:A,data:h.join(""),xfa:null,needAppearances:!1}),h.length=0}return c.set("M",`D:${AA()}`),await qr(this.ref,c,h,o),Q[0].data=h.join(""),Q}async _getAppearance(A,e,t,i){if(this.hasFieldFlag(I))return null;const a=i?.get(this.data.id);let s,g;if(a&&(s=a.formattedValue||a.value,g=a.rotation),void 0===g&&void 0===s&&!this._needAppearances&&(!this._hasValueFromXFA||this.appearance))return null;const r=this.getBorderAndBackgroundAppearances(i);if(void 0===s&&(s=this.data.fieldValue,!s))return`/Tx BMC q ${r}Q EMC`;if(Array.isArray(s)&&1===s.length&&(s=s[0]),G("string"==typeof s,"Expected `value` to be a string."),s=s.trim(),this.data.combo){const A=this.data.options.find((({exportValue:A})=>s===A));s=A?.displayValue||s}if(""===s)return`/Tx BMC q ${r}Q EMC`;void 0===g&&(g=this.rotation);let o,c=-1;this.data.multiLine?(o=s.split(/\r\n?|\n/).map((A=>A.normalize("NFC"))),c=o.length):o=[s.replace(/\r\n?|\n/,"").normalize("NFC")];let C=this.data.rect[3]-this.data.rect[1],B=this.data.rect[2]-this.data.rect[0];90!==g&&270!==g||([B,C]=[C,B]),this._defaultAppearance||(this.data.defaultAppearanceData=Br(this._defaultAppearance="/Helvetica 0 Tf 0 g"));let h,Q,l,E=await Lu._getFontData(A,e,this.data.defaultAppearanceData,this._fieldResources.mergedResources);const u=[];let d=!1;for(const A of o){const e=E.encodeString(A);e.length>1&&(d=!0),u.push(e.join(""))}if(d&&8&t)return{needAppearances:!0};if(d&&this._isOffscreenCanvasSupported){const t=this.data.comb?"monospace":"sans-serif",i=new lr(A.xref,t),a=i.createFontResources(o.join("")),n=a.getRaw("Font");if(this._fieldResources.mergedResources.has("Font")){const A=this._fieldResources.mergedResources.get("Font");for(const e of n.getKeys())A.set(e,n.getRaw(e))}else this._fieldResources.mergedResources.set("Font",n);const g=i.fontName.name;E=await Lu._getFontData(A,e,{fontName:g,fontSize:0},a);for(let A=0,e=u.length;A2?`/Tx BMC q ${r}BT `+h+` 1 0 0 1 ${jA(2)} ${jA(y)} Tm (${KA(u[0])}) Tj ET Q EMC`:`/Tx BMC q ${r}BT `+h+` 1 0 0 1 0 0 Tm ${this._renderText(u[0],E,Q,B,m,{shift:0},2,y)} ET Q EMC`}static async _getFontData(A,e,t,i){const a=new zg,s={font:null,clone(){return this}},{fontName:n,fontSize:g}=t;return await A.handleSetFont(i,[n&&rA.get(n),g],null,a,e,s,null),s.font}_getTextWidth(A,e){return e.charsToGlyphs(A).reduce(((A,e)=>A+e.width),0)/1e3}_computeFontSize(A,e,t,i,a){let{fontSize:n}=this.data.defaultAppearanceData,g=(n||12)*s,r=Math.round(A/g);if(!n){const o=A=>Math.floor(100*A)/100;if(-1===a){const a=this._getTextWidth(t,i);n=o(Math.min(A/s,a>e?e/a:1/0)),r=1}else{const I=t.split(/\r\n?|\n/),c=[];for(const A of I){const e=i.encodeString(A).join(""),t=i.charsToGlyphs(e),a=i.getCharPositions(e);c.push({line:e,glyphs:t,positions:a})}const C=t=>{let a=0;for(const s of c)if(a+=this._splitLine(null,i,t,e,s).length*t,a>A)return!0;return!1};for(r=Math.max(r,a);g=A/r,n=o(g/s),C(n);)r++}const{fontName:I,fontColor:c}=this.data.defaultAppearanceData;this._defaultAppearance=function({fontSize:A,fontName:e,fontColor:t}){return`/${vA(e)} ${A} Tf ${Qr(t,!0)}`}({fontSize:n,fontName:I,fontColor:c})}return[this._defaultAppearance,n,A/r]}_renderText(A,e,t,i,a,s,n,g){let r;r=1===a?(i-this._getTextWidth(A,e)*t)/2:2===a?i-this._getTextWidth(A,e)*t-n:n;const o=jA(r-s.shift);return s.shift=r,`${o} ${g=jA(g)} Td (${KA(A)}) Tj`}_getSaveFieldResources(A){const{localResources:e,appearanceResources:t,acroFormResources:i}=this._fieldResources,a=this.data.defaultAppearanceData?.fontName;if(!a)return e||cA.empty;for(const A of[e,t])if(A instanceof cA){const e=A.get("Font");if(e instanceof cA&&e.has(a))return A}if(i instanceof cA){const t=i.get("Font");if(t instanceof cA&&t.has(a)){const i=new cA(A);i.set(a,t.getRaw(a));const s=new cA(A);return s.set("Font",i),cA.merge({xref:A,dictArray:[s,e],mergeSubDicts:!0})}}return e||cA.empty}getFieldObject(){return null}}class Ju extends Lu{constructor(A){super(A);const{dict:e}=A;e.has("PMD")&&(this.flags|=2,this.data.hidden=!0,S("Barcodes are not supported")),this.data.hasOwnCanvas=this.data.readOnly&&!this.data.noHTML,this._hasText=!0,"string"!=typeof this.data.fieldValue&&(this.data.fieldValue="");let t=kA({dict:e,key:"Q"});(!Number.isInteger(t)||t<0||t>2)&&(t=null),this.data.textAlignment=t;let i=kA({dict:e,key:"MaxLen"});(!Number.isInteger(i)||i<0)&&(i=0),this.data.maxLen=i,this.data.multiLine=this.hasFieldFlag(4096),this.data.comb=this.hasFieldFlag(16777216)&&!this.hasFieldFlag(4096)&&!this.hasFieldFlag(I)&&!this.hasFieldFlag(1048576)&&0!==this.data.maxLen,this.data.doNotScroll=this.hasFieldFlag(8388608)}get hasTextContent(){return!!this.appearance&&!this._needAppearances}_getCombAppearance(A,e,t,i,a,s,n,g,r,o,I){const c=a/this.data.maxLen,C=this.getBorderAndBackgroundAppearances(I),B=[],h=e.getCharPositions(t);for(const[A,e]of h)B.push(`(${KA(t.substring(A,e))}) Tj`);const Q=B.join(` ${jA(c)} 0 Td `);return`/Tx BMC q ${C}BT `+A+` 1 0 0 1 ${jA(n)} ${jA(g+r)} Tm ${Q} ET Q EMC`}_getMultilineAppearance(A,e,t,i,a,s,n,g,r,o,I,c){const C=[],B=a-2*g,h={shift:0};for(let A=0,s=e.length;Ai?(r.push(A.substring(C,t)),C=t,B=Q,o=-1,c=-1):(B+=Q,o=t,I=a,c=e):B+Q>i?-1!==o?(r.push(A.substring(C,I)),C=I,e=c+1,o=-1,B=0):(r.push(A.substring(C,t)),C=t,B=Q):B+=Q}return C"Off"!==A));s.length=0,s.push("Off",A)}s.includes(this.data.fieldValue)||(this.data.fieldValue="Off"),this.data.exportValue=s[1];const n=t.get(this.data.exportValue);this.checkedAppearance=n instanceof dA?n:null;const g=t.get("Off");this.uncheckedAppearance=g instanceof dA?g:null,this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(A,"check"),this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance),this._fallbackFontDict=this.fallbackFontDict,null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processRadioButton(A){this.data.buttonValue=null;const e=A.dict.get("Parent");if(e instanceof cA){this.parent=A.dict.getRaw("Parent");const t=e.get("V");t instanceof rA&&(this.data.fieldValue=this._decodeFormValue(t))}const t=A.dict.get("AP");if(!(t instanceof cA))return;const i=t.get("N");if(!(i instanceof cA))return;for(const A of i.getKeys())if("Off"!==A){this.data.buttonValue=this._decodeFormValue(A);break}const a=i.get(this.data.buttonValue);this.checkedAppearance=a instanceof dA?a:null;const s=i.get("Off");this.uncheckedAppearance=s instanceof dA?s:null,this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(A,"disc"),this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance),this._fallbackFontDict=this.fallbackFontDict,null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processPushButton(A){const{dict:e,annotationGlobals:t}=A;e.has("A")||e.has("AA")||this.data.alternativeText?(this.data.isTooltipOnly=!e.has("A")&&!e.has("AA"),so.parseDestDictionary({destDict:e,resultObj:this.data,docBaseUrl:t.baseUrl,docAttachments:t.attachments})):S("Push buttons without action dictionaries are not supported")}getFieldObject(){let A,e="button";return this.data.checkBox?(e="checkbox",A=this.data.exportValue):this.data.radioButton&&(e="radiobutton",A=this.data.buttonValue),{id:this.data.id,value:this.data.fieldValue||"Off",defaultValue:this.data.defaultFieldValue,exportValues:A,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,hidden:this.data.hidden,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:e}}get fallbackFontDict(){const A=new cA;return A.set("BaseFont",rA.get("ZapfDingbats")),A.set("Type",rA.get("FallbackType")),A.set("Subtype",rA.get("FallbackType")),A.set("Encoding",rA.get("ZapfDingbatsEncoding")),x(this,"fallbackFontDict",A)}}class Yu extends Lu{constructor(A){super(A);const{dict:e,xref:t}=A;this.indices=e.getArray("I"),this.hasIndices=Array.isArray(this.indices)&&this.indices.length>0,this.data.options=[];const i=kA({dict:e,key:"Opt"});if(Array.isArray(i))for(let A=0,e=i.length;A=0&&e0?this.data.fieldValue[0]:null;return{id:this.data.id,value:e,defaultValue:this.data.defaultFieldValue,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,numItems:this.data.fieldValue.length,multipleSelection:this.data.multiSelect,hidden:this.data.hidden,actions:this.data.actions,items:this.data.options,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:A}}amendSavedDict(A,e){if(!this.hasIndices)return;let t=A?.get(this.data.id)?.value;Array.isArray(t)||(t=[t]);const i=[],{options:a}=this.data;for(let A=0,e=0,s=a.length;At&&(t=i,e=A)}[B,h]=this._computeFontSize(A,o-4,e,C,-1)}const Q=h*s,l=(Q-h)/2,E=Math.floor(r/Q);let u=0;if(c.length>0){const A=Math.min(...c),e=Math.max(...c);u=Math.max(0,e-E+1),u>A&&(u=A)}const d=Math.min(u+E+1,I),f=["/Tx BMC q",`1 1 ${o} ${r} re W n`];if(c.length){f.push("0.600006 0.756866 0.854904 rg");for(const A of c)u<=A&&AA.trimEnd()));const{coords:A,bbox:e,matrix:t}=lr.getFirstPositionInfo(this.rectangle,this.rotation,i);this.data.textPosition=this._transformPoint(A,e,t)}if(this._isOffscreenCanvasSupported){const a=A.dict.get("CA"),s=new lr(t,"sans-serif");this.appearance=s.createAppearance(this._contents.str,this.rectangle,this.rotation,i,e,a),this._streams.push(this.appearance)}else S("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.")}}get hasTextContent(){return this._hasAppearance}static createNewDict(A,e,{apRef:t,ap:i,oldAnnotation:a}){const{color:s,fontSize:n,rect:g,rotation:r,user:o,value:I}=A,c=a||new cA(e);c.set("Type",rA.get("Annot")),c.set("Subtype",rA.get("FreeText")),a?(c.set("M",`D:${AA()}`),c.delete("RC")):c.set("CreationDate",`D:${AA()}`),c.set("Rect",g);const C=`/Helv ${n} Tf ${Qr(s,!0)}`;if(c.set("DA",C),c.set("Contents",_A(I)),c.set("F",4),c.set("Border",[0,0,0]),c.set("Rotate",r),o&&c.set("T",_A(o)),t||i){const A=new cA(e);c.set("AP",A),t?A.set("N",t):A.set("N",i)}return c}static async createNewAppearanceStream(A,e,t){const{baseFontRef:i,evaluator:a,task:n}=t,{color:g,fontSize:r,rect:o,rotation:I,value:c}=A,C=new cA(e),B=new cA(e);if(i)B.set("Helv",i);else{const A=new cA(e);A.set("BaseFont",rA.get("Helvetica")),A.set("Type",rA.get("Font")),A.set("Subtype",rA.get("Type1")),A.set("Encoding",rA.get("WinAnsiEncoding")),B.set("Helv",A)}C.set("Font",B);const h=await Lu._getFontData(a,n,{fontName:"Helv",fontSize:r},C),[Q,l,E,u]=o;let d=E-Q,f=u-l;I%180!=0&&([d,f]=[f,d]);const p=c.split("\n"),m=r/1e3;let y=-1/0;const w=[];for(let A of p){const e=h.encodeString(A);if(e.length>1)return null;A=e.join(""),w.push(A);let t=0;const i=h.charsToGlyphs(A);for(const A of i)t+=A.width*m;y=Math.max(y,t)}let D=1;y>d&&(D=d/y);let b=1;const k=s*r,F=1*r,S=k*p.length;S>f&&(b=f/S);const R=r*Math.min(D,b);let G,N,x;switch(I){case 0:x=[1,0,0,1],N=[o[0],o[1],d,f],G=[o[0],o[3]-F];break;case 90:x=[0,1,-1,0],N=[o[1],-o[2],d,f],G=[o[1],-o[0]-F];break;case 180:x=[-1,0,0,-1],N=[-o[2],-o[3],d,f],G=[-o[2],-o[1]-F];break;case 270:x=[0,-1,1,0],N=[-o[3],o[0],d,f],G=[-o[3],o[2]-F]}const U=["q",`${x.join(" ")} 0 0 cm`,`${N.join(" ")} re W n`,"BT",`${Qr(g,!0)}`,`0 Tc /Helv ${jA(R)} Tf`];U.push(`${G.join(" ")} Td (${KA(w[0])}) Tj`);const M=jA(k);for(let A=1,e=w.length;A(A.push(`${i[0]} ${i[1]} m`,`${i[2]} ${i[3]} l`,"S"),[e[0]-r,e[2]+r,e[7]-r,e[3]+r])})}}}class Zu extends Mu{constructor(A){super(A);const{dict:e,xref:t}=A;if(this.data.annotationType=5,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,!this.appearance){const A=this.color?Ru(this.color):[0,0,0],i=e.get("CA"),a=Su(e.getArray("IC"),null),s=a?Ru(a):null,n=s?i:null;if(0===this.borderStyle.width&&!s)return;this._setDefaultAppearance({xref:t,extra:`${this.borderStyle.width} w`,strokeColor:A,fillColor:s,strokeAlpha:i,fillAlpha:n,pointsCallback:(A,e)=>{const t=e[4]+this.borderStyle.width/2,i=e[5]+this.borderStyle.width/2,a=e[6]-e[4]-this.borderStyle.width,n=e[3]-e[7]-this.borderStyle.width;return A.push(`${t} ${i} ${a} ${n} re`),s?A.push("B"):A.push("S"),[e[0],e[2],e[7],e[3]]}})}}}class Ou extends Mu{constructor(A){super(A);const{dict:e,xref:t}=A;if(this.data.annotationType=6,!this.appearance){const A=this.color?Ru(this.color):[0,0,0],i=e.get("CA"),a=Su(e.getArray("IC"),null),s=a?Ru(a):null,n=s?i:null;if(0===this.borderStyle.width&&!s)return;const g=4/3*Math.tan(Math.PI/8);this._setDefaultAppearance({xref:t,extra:`${this.borderStyle.width} w`,strokeColor:A,fillColor:s,strokeAlpha:i,fillAlpha:n,pointsCallback:(A,e)=>{const t=e[0]+this.borderStyle.width/2,i=e[1]-this.borderStyle.width/2,a=e[6]-this.borderStyle.width/2,n=e[7]+this.borderStyle.width/2,r=t+(a-t)/2,o=i+(n-i)/2,I=(a-t)/2*g,c=(n-i)/2*g;return A.push(`${r} ${n} m`,`${r+I} ${n} ${a} ${o+c} ${a} ${o} c`,`${a} ${o-c} ${r+I} ${i} ${r} ${i} c`,`${r-I} ${i} ${t} ${o-c} ${t} ${o} c`,`${t} ${o+c} ${r-I} ${n} ${r} ${n} c`,"h"),s?A.push("B"):A.push("S"),[e[0],e[2],e[7],e[3]]}})}}}class Xu extends Mu{constructor(A){super(A);const{dict:e,xref:t}=A;this.data.annotationType=8,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,this.data.vertices=null,this instanceof Vu||(this.setLineEndings(e.getArray("LE")),this.data.lineEndings=this.lineEndings);const i=e.getArray("Vertices");if(!MA(i,null))return;const a=this.data.vertices=Float32Array.from(i);if(!this.appearance){const A=this.color?Ru(this.color):[0,0,0],i=e.get("CA"),s=this.borderStyle.width||1,n=2*s,g=[1/0,1/0,-1/0,-1/0];for(let A=0,e=a.length;A{for(let e=0,t=a.length;e{for(const e of this.data.inkLists){for(let t=0,i=e.length;tA.points))),c.set("F",4),c.set("Rotate",o),g&&c.set("IT",rA.get("InkHighlight"));const C=new cA(e);c.set("BS",C),C.set("W",I),c.set("C",Array.from(a,(A=>A/255))),c.set("CA",s);const B=new cA(e);return c.set("AP",B),t?B.set("N",t):B.set("N",i),c}static async createNewAppearanceStream(A,e,t){if(A.outlines)return this.createNewAppearanceStreamForHighlight(A,e,t);const{color:i,rect:a,paths:s,thickness:n,opacity:g}=A,r=[`${n} w 1 J 1 j`,`${Qr(i,!1)}`];1!==g&&r.push("/R0 gs");const o=[];for(const{bezier:A}of s){if(o.length=0,o.push(`${jA(A[0])} ${jA(A[1])} m`),2===A.length)o.push(`${jA(A[0])} ${jA(A[1])} l S`);else{for(let e=2,t=A.length;e(A.push(`${e[0]} ${e[1]} m`,`${e[2]} ${e[3]} l`,`${e[6]} ${e[7]} l`,`${e[4]} ${e[5]} l`,"f"),[e[0],e[2],e[7],e[3]])})}}else this.data.popupRef=null}static createNewDict(A,e,{apRef:t,ap:i}){const{color:a,opacity:s,rect:n,rotation:g,user:r,quadPoints:o}=A,I=new cA(e);if(I.set("Type",rA.get("Annot")),I.set("Subtype",rA.get("Highlight")),I.set("CreationDate",`D:${AA()}`),I.set("Rect",n),I.set("F",4),I.set("Border",[0,0,0]),I.set("Rotate",g),I.set("QuadPoints",o),I.set("C",Array.from(a,(A=>A/255))),I.set("CA",s),r&&I.set("T",_A(r)),t||i){const A=new cA(e);I.set("AP",A),A.set("N",t||i)}return I}static async createNewAppearanceStream(A,e,t){const{color:i,rect:a,outlines:s,opacity:n}=A,g=[`${Qr(i,!0)}`,"/R0 gs"],r=[];for(const A of s){r.length=0,r.push(`${jA(A[0])} ${jA(A[1])} m`);for(let e=2,t=A.length;e(A.push(`${e[4]} ${e[5]+1.3} m`,`${e[6]} ${e[7]+1.3} l`,"S"),[e[0],e[2],e[7],e[3]])})}}else this.data.popupRef=null}}class Ad extends Mu{constructor(A){super(A);const{dict:e,xref:t}=A;if(this.data.annotationType=11,this.data.quadPoints=Gu(e,null)){if(!this.appearance){const A=this.color?Ru(this.color):[0,0,0],i=e.get("CA");this._setDefaultAppearance({xref:t,extra:"[] 0 d 1 w",strokeColor:A,strokeAlpha:i,pointsCallback:(A,e)=>{const t=(e[1]-e[5])/6;let i=t,a=e[4];const s=e[5],n=e[6];A.push(`${a} ${s+i} m`);do{a+=2,i=0===i?t:0,A.push(`${a} ${s+i} l`)}while(a(A.push((e[0]+e[4])/2+" "+(e[1]+e[5])/2+" m",(e[2]+e[6])/2+" "+(e[3]+e[7])/2+" l","S"),[e[0],e[2],e[7],e[3]])})}}else this.data.popupRef=null}}class td extends Mu{constructor(A){super(A),this.data.annotationType=13,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1}static async createImage(A,e){const{width:t,height:i}=A,a=new OffscreenCanvas(t,i),s=a.getContext("2d",{alpha:!0});s.drawImage(A,0,0);const n=s.getImageData(0,0,t,i).data,g=new Uint32Array(n.buffer),r=g.some(Z.isLittleEndian?A=>A>>>24!=255:A=>!!(255&~A));r&&(s.fillStyle="white",s.fillRect(0,0,t,i),s.drawImage(A,0,0));const o=a.convertToBlob({type:"image/jpeg",quality:1}).then((A=>A.arrayBuffer())),I=rA.get("XObject"),c=rA.get("Image"),C=new cA(e);C.set("Type",I),C.set("Subtype",c),C.set("BitsPerComponent",8),C.set("ColorSpace",rA.get("DeviceRGB")),C.set("Filter",rA.get("DCTDecode")),C.set("BBox",[0,0,t,i]),C.set("Width",t),C.set("Height",i);let B=null;if(r){const A=new Uint8Array(g.length);if(Z.isLittleEndian)for(let e=0,t=g.length;e>>24;else for(let e=0,t=g.length;e=0&&s<=1?s:null}}function ad(A){try{return z(A)}catch(e){return S(`UTF-8 decoding failed: "${e}".`),A}}class sd extends br{constructor(A){super(A),this.node=null}onEndElement(A){const e=super.onEndElement(A);if(e&&"xfa:datasets"===A)throw this.node=e,new Error("Aborting DatasetXMLParser.")}}class nd{constructor(A){if(A.datasets)this.node=new br({hasAttributes:!0}).parseFromString(A.datasets).documentElement;else{const e=new sd({hasAttributes:!0});try{e.parseFromString(A["xdp:xdp"])}catch{}this.node=e.node}}getValue(A){if(!this.node||!A)return"";const e=this.node.searchNode(YA(A),0);if(!e)return"";const t=e.firstChild;return"value"===t?.nodeName?e.children.map((A=>ad(A.textContent))):ad(e.textContent)}}class gd{#K=null;constructor(A,e){this.stream=A,this.pdfManager=e,this.entries=[],this._xrefStms=new Set,this._cacheMap=new Map,this._pendingRefs=new BA,this._newPersistentRefNum=null,this._newTemporaryRefNum=null,this._persistentRefsCache=null}getNewPersistentRef(A){null===this._newPersistentRefNum&&(this._newPersistentRefNum=this.entries.length||1);const e=this._newPersistentRefNum++;return this._cacheMap.set(e,A),CA.get(e,0)}getNewTemporaryRef(){if(null===this._newTemporaryRefNum&&(this._newTemporaryRefNum=this.entries.length||1,this._newPersistentRefNum)){this._persistentRefsCache=new Map;for(let A=this._newTemporaryRefNum;A0;){const[n,g]=s;if(!Number.isInteger(n)||!Number.isInteger(g))throw new v(`Invalid XRef range fields: ${n}, ${g}`);if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(a))throw new v(`Invalid XRef entry fields length: ${n}, ${g}`);for(let s=e.entryNum;s=A.length);)t+=String.fromCharCode(i),i=A[e];return t}function e(A,e,t){const i=t.length,a=A.length;let s=0;for(;e=i)break;e++,s++}return s}const t=/\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g,i=/\b(startxref|\d+\s+\d+\s+obj)\b/g,a=/^(\d+)\s+(\d+)\s+obj\b/,s=new Uint8Array([116,114,97,105,108,101,114]),n=new Uint8Array([115,116,97,114,116,120,114,101,102]),g=new Uint8Array([47,88,82,101,102]);this.entries.length=0,this._cacheMap.clear();const r=this.stream;r.pos=0;const o=r.getBytes(),I=q(o),c=o.length;let C=r.start;const B=[],h=[];for(;C=c)break;Q=o[C]}while(10!==Q&&13!==Q);continue}const l=A(o,C);let E;if(l.startsWith("xref")&&(4===l.length||/\s/.test(l[4])))C+=e(o,C,s),B.push(C),C+=e(o,C,n);else if(E=a.exec(l)){const A=0|E[1],i=0|E[2],a=C+l.length;let s,n=!1;if(this.entries[A]){if(this.entries[A].gen===i)try{new ei({lexer:new ai(r.makeSubStream(a))}).getObj(),n=!0}catch(A){A instanceof yA?S(`indexObjects -- checking object (${l}): "${A}".`):n=!0}}else n=!0;n&&(this.entries[A]={offset:C-r.start,gen:i,uncompressed:!0}),t.lastIndex=a;const B=t.exec(I);B?(s=t.lastIndex+1-C,"endobj"!==B[1]&&(S(`indexObjects: Found "${B[1]}" inside of another "obj", caused by missing "endobj" -- trying to recover.`),s-=B[1].length+1)):s=c-C;const Q=o.subarray(C,C+s),u=e(Q,0,g);u0?Math.max(...this._xrefStms):null)}getEntry(A){const e=this.entries[A];return e&&!e.free&&e.offset?e:null}fetchIfRef(A,e=!1){return A instanceof CA?this.fetch(A,e):A}fetch(A,e=!1){if(!(A instanceof CA))throw new Error("ref object is not a reference");const t=A.num,i=this._cacheMap.get(t);if(void 0!==i)return i instanceof cA&&!i.objId&&(i.objId=A.toString()),i;let a=this.getEntry(t);if(null===a)return this._cacheMap.set(t,a),a;if(this._pendingRefs.has(A))return this._pendingRefs.remove(A),S(`Ignoring circular reference: ${A}.`),iA;this._pendingRefs.put(A);try{a=a.uncompressed?this.fetchUncompressed(A,a,e):this.fetchCompressed(A,a,e),this._pendingRefs.remove(A)}catch(e){throw this._pendingRefs.remove(A),e}return a instanceof cA?a.objId=A.toString():a instanceof dA&&(a.dict.objId=A.toString()),a}fetchUncompressed(A,e,t=!1){const i=A.gen;let a=A.num;if(e.gen!==i){const s=`Inconsistent generation in XRef: ${A}`;if(this._generationFallback&&e.gen0&&e[3]-e[1]>0)return e;S(`Empty, or invalid, /${A} entry.`)}return null}get mediaBox(){return x(this,"mediaBox",this._getBoundingBox("MediaBox")||rd)}get cropBox(){return x(this,"cropBox",this._getBoundingBox("CropBox")||this.mediaBox)}get userUnit(){let A=this.pageDict.get("UserUnit");return("number"!=typeof A||A<=0)&&(A=1),x(this,"userUnit",A)}get view(){const{cropBox:A,mediaBox:e}=this;if(A!==e&&!$(A,e)){const t=X.intersect(A,e);if(t&&t[2]-t[0]>0&&t[3]-t[1]>0)return x(this,"view",t);S("Empty /CropBox and /MediaBox intersection.")}return x(this,"view",e)}get rotate(){let A=this._getInheritableProperty("Rotate")||0;return A%90!=0?A=0:A>=360?A%=360:A<0&&(A=(A%360+360)%360),x(this,"rotate",A)}_onSubStreamError(A,e){if(!this.evaluatorOptions.ignoreErrors)throw A;S(`getContentStream - ignoring sub-stream (${e}): "${A}".`)}getContentStream(){return this.pdfManager.ensure(this,"content").then((A=>A instanceof dA?A:Array.isArray(A)?new Fe(A,this._onSubStreamError.bind(this)):new se))}get xfaData(){return x(this,"xfaData",this.xfaFactory?{bbox:this.xfaFactory.getBoundingBox(this.pageIndex)}:null)}#q(A,e,t){for(const i of A)if(i.id){const A=CA.fromString(i.id);if(!A){S(`A non-linked annotation cannot be modified: ${i.id}`);continue}if(i.deleted){e.put(A,A);continue}t?.put(A),i.ref=A,delete i.id}}async saveNewAnnotations(A,e,t,i){if(this.xfaFactory)throw new Error("XFA: Cannot save new annotations.");const a=new nr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),s=new hA,n=new BA;this.#q(t,s,n);const g=this.pageDict,r=this.annotations.filter((A=>!(A instanceof CA&&s.has(A)))),o=await Fu.saveNewAnnotations(a,e,t,i);for(const{ref:A}of o.annotations)A instanceof CA&&!n.has(A)&&r.push(A);const I=g.get("Annots");g.set("Annots",r);const c=[];await qr(this.ref,g,c,this.xref),I&&g.set("Annots",I);const C=o.dependencies;C.push({ref:this.ref,data:c.join("")},...o.annotations);for(const A of s)C.push({ref:A,data:null});return C}save(A,e,t){const i=new nr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions});return this._parsedAnnotations.then((function(A){const a=[];for(const s of A)s.mustBePrinted(t)&&a.push(s.save(i,e,t).catch((function(A){return S(`save - ignoring annotation data during "${e.name}" task: "${A}".`),null})));return Promise.all(a).then((function(A){return A.filter((A=>!!A))}))}))}loadResources(A){return this.resourcesPromise||=this.pdfManager.ensure(this,"resources"),this.resourcesPromise.then((()=>new go(this.resources,A,this.xref).load()))}getOperatorList({handler:A,sink:e,task:t,intent:i,cacheKey:a,annotationStorage:s=null,modifiedIds:n=null}){const r=this.getContentStream(),o=this.loadResources(["ColorSpace","ExtGState","Font","Pattern","Properties","Shading","XObject"]),I=new nr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),c=this.xfaFactory?null:zA(s),C=c?.get(this.pageIndex);let B=Promise.resolve(null),h=null;if(C){const A=this.pdfManager.ensureDoc("annotationGlobals");let e;const i=new Set;for(const{bitmapId:A,bitmap:e}of C)!A||e||i.has(A)||i.add(A);const{isOffscreenCanvasSupported:a}=this.evaluatorOptions;if(i.size>0){const A=C.slice();for(const[e,t]of s)e.startsWith(g)&&t.bitmap&&i.has(t.bitmapId)&&A.push(t);e=Fu.generateImages(A,this.xref,a)}else e=Fu.generateImages(C,this.xref,a);h=new BA,this.#q(C,h,null),B=A.then((A=>A?Fu.printNewAnnotations(A,I,t,C,e):null))}const Q=Promise.all([r,o]).then((([s])=>{const n=new zg(i,e);return A.send("StartRenderPage",{transparency:I.hasBlendModes(this.resources,this.nonBlendModesSet),pageIndex:this.pageIndex,cacheKey:a}),I.getOperatorList({stream:s,task:t,resources:this.resources,operatorList:n}).then((function(){return n}))}));return Promise.all([Q,this._parsedAnnotations,B]).then((function([A,e,a]){if(a){e=e.filter((A=>!(A.ref&&h.has(A.ref))));for(let A=0,t=a.length;AA.ref&&uA(A.ref,i.refToReplace)));s>=0&&(e.splice(s,1,i),a.splice(A--,1),t--)}}e=e.concat(a)}if(0===e.length||64&i)return A.flush(!0),{length:A.totalLength};const g=!!(16&i),r=!!(128&i),o=!!(1&i),c=!!(2&i),C=!!(4&i),B=[];for(const A of e)(o||c&&A.mustBeViewed(s,g)&&A.mustBeViewedWhenEditing(r,n)||C&&A.mustBePrinted(s))&&B.push(A.getOperatorList(I,t,i,s).catch((function(A){return S(`getOperatorList - ignoring annotation data during "${t.name}" task: "${A}".`),{opList:null,separateForm:!1,separateCanvas:!1}})));return Promise.all(B).then((function(e){let t=!1,i=!1;for(const{opList:a,separateForm:s,separateCanvas:n}of e)A.addOpList(a),t||=s,i||=n;return A.flush(!0,{form:t,canvas:i}),{length:A.totalLength}}))}))}async extractTextContent({handler:A,task:e,includeMarkedContent:t,disableNormalization:i,sink:a}){const s=this.getContentStream(),n=this.loadResources(["ExtGState","Font","Properties","XObject"]),g=this.pdfManager.ensureCatalog("lang"),[r,,o]=await Promise.all([s,n,g]);return new nr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}).getTextContent({stream:r,task:e,resources:this.resources,includeMarkedContent:t,disableNormalization:i,sink:a,viewBox:this.view,lang:o})}async getStructTree(){const A=await this.pdfManager.ensureCatalog("structTreeRoot");return A?(await this._parsedAnnotations,(await this.pdfManager.ensure(this,"_parseStructTree",[A])).serializable):null}_parseStructTree(A){const e=new eo(A,this.pageDict);return e.parse(this.ref),e}async getAnnotationsData(A,e,t){const i=await this._parsedAnnotations;if(0===i.length)return i;const a=[],s=[];let n;const g=!!(1&t),r=!!(2&t),o=!!(4&t);for(const t of i){const i=g||r&&t.viewable;(i||o&&t.printable)&&a.push(t.data),t.hasTextContent&&i&&(n||=new nr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),s.push(t.extractTextContent(n,e,[-1/0,-1/0,1/0,1/0]).catch((function(A){S(`getAnnotationsData - ignoring textContent during "${e.name}" task: "${A}".`)}))))}return await Promise.all(s),a}get annotations(){const A=this._getInheritableProperty("Annots");return x(this,"annotations",Array.isArray(A)?A:[])}get _parsedAnnotations(){return x(this,"_parsedAnnotations",this.pdfManager.ensure(this,"annotations").then((async A=>{if(0===A.length)return A;const e=await this.pdfManager.ensureDoc("annotationGlobals");if(!e)return[];const t=[];for(const i of A)t.push(Fu.create(this.xref,i,e,this._localIdFactory,!1,this.ref).catch((function(A){return S(`_parsedAnnotations: "${A}".`),null})));const i=[];let a,s;for(const A of await Promise.all(t))A&&(A instanceof Lu?(s||=[]).push(A):A instanceof Tu?(a||=[]).push(A):i.push(A));return s&&i.push(...s),a&&i.push(...a),i})))}get jsActions(){return x(this,"jsActions",TA(this.xref,this.pageDict,h))}}const Id=new Uint8Array([37,80,68,70,45]),cd=new Uint8Array([115,116,97,114,116,120,114,101,102]),Cd=new Uint8Array([101,110,100,111,98,106]);function Bd(A,e,t=1024,i=!1){const a=e.length,s=A.peekBytes(t),n=s.length-a;if(n<=0)return!1;if(i){const t=a-1;let i=s.length-1;for(;i>=t;){let n=0;for(;n=a)return A.pos+=i-t,!0;i--}}else{let t=0;for(;t<=n;){let i=0;for(;i=a)return A.pos+=t,!0;t++}}return!1}class hd{constructor(A,e){if(e.length<=0)throw new J("The PDF file is empty, i.e. its size is zero bytes.");this.pdfManager=A,this.stream=e,this.xref=new gd(e,A),this._pagePromises=new Map,this._version=null;const t={font:0};this._globalIdFactory=class{static getDocId(){return`g_${A.docId}`}static createFontId(){return"f"+ ++t.font}static createObjId(){R("Abstract method `createObjId` called.")}static getPageObjId(){R("Abstract method `getPageObjId` called.")}}}parse(A){this.xref.parse(A),this.catalog=new so(this.pdfManager,this.xref)}get linearization(){let A=null;try{A=si.create(this.stream)}catch(A){if(A instanceof mA)throw A;F(A)}return x(this,"linearization",A)}get startXRef(){const A=this.stream;let e=0;if(this.linearization){if(A.reset(),Bd(A,Cd)){A.skip(6);let t=A.peekByte();for(;UA(t);)A.pos++,t=A.peekByte();e=A.pos-A.start}}else{const t=1024,i=cd.length;let a=!1,s=A.end;for(;!a&&s>0;)s-=t-i,s<0&&(s=0),A.pos=s,a=Bd(A,cd,t,!0);if(a){let t;A.skip(9);do{t=A.getByte()}while(UA(t));let i="";for(;t>=32&&t<=57;)i+=String.fromCharCode(t),t=A.getByte();e=parseInt(i,10),isNaN(e)&&(e=0)}}return x(this,"startXRef",e)}checkHeader(){const A=this.stream;if(A.reset(),!Bd(A,Id))return;A.moveStart(),A.skip(Id.length);let e,t="";for(;(e=A.getByte())>32&&t.length<7;)t+=String.fromCharCode(e);fA.test(t)?this._version=t:S(`Invalid PDF header version: ${t}`)}parseStartXRef(){this.xref.setStartXRef(this.startXRef)}get numPages(){let A=0;return A=this.catalog.hasActualNumPages?this.catalog.numPages:this.xfaFactory?this.xfaFactory.getNumPages():this.linearization?this.linearization.numPages:this.catalog.numPages,x(this,"numPages",A)}_hasOnlyDocumentSignatures(A,e=0){return!!Array.isArray(A)&&A.every((A=>{if(!((A=this.xref.fetchIfRef(A))instanceof cA))return!1;if(A.has("Kids"))return++e>10?(S("_hasOnlyDocumentSignatures: maximum recursion depth reached"),!1):this._hasOnlyDocumentSignatures(A.get("Kids"),e);const t=QA(A.get("FT"),"Sig"),i=A.get("Rect"),a=Array.isArray(i)&&i.every((A=>0===A));return t&&a}))}get _xfaStreams(){const A=this.catalog.acroForm;if(!A)return null;const e=A.get("XFA"),t={"xdp:xdp":"",template:"",datasets:"",config:"",connectionSet:"",localeSet:"",stylesheet:"","/xdp:xdp":""};if(e instanceof dA&&!e.isEmpty)return t["xdp:xdp"]=e,t;if(!Array.isArray(e)||0===e.length)return null;for(let A=0,i=e.length;A{c.set(A,e)}));const C=[];for(const[A,t]of c){const a=t.get("FontDescriptor");if(!(a instanceof cA))continue;let s=a.get("FontFamily");s=s.replaceAll(/[ ]+(\d)/g,"$1");const n={fontFamily:s,fontWeight:a.get("FontWeight"),italicAngle:-a.get("ItalicAngle")};XA(n)&&C.push(g.handleSetFont(i,[rA.get(A),1],null,r,e,I,null,n).catch((function(A){return S(`loadXfaFonts: "${A}".`),null})))}await Promise.all(C);const B=this.xfaFactory.setFonts(o);if(!B)return;n.ignoreErrors=!0,C.length=0,o.length=0;const h=new Set;for(const A of B)Tn(`${A}-Regular`)||h.add(A);h.size&&B.push("PdfJS-Fallback");for(const A of B)if(!h.has(A))for(const t of[{name:"Regular",fontWeight:400,italicAngle:0},{name:"Bold",fontWeight:700,italicAngle:0},{name:"Italic",fontWeight:400,italicAngle:12},{name:"BoldItalic",fontWeight:700,italicAngle:12}]){const a=`${A}-${t.name}`,s=Pn(a);C.push(g.handleSetFont(i,[rA.get(a),1],null,r,e,I,s,{fontFamily:A,fontWeight:t.fontWeight,italicAngle:t.italicAngle}).catch((function(A){return S(`loadXfaFonts: "${A}".`),null})))}await Promise.all(C),this.xfaFactory.appendFonts(o,h)}async serializeXfaData(A){return this.xfaFactory?this.xfaFactory.serializeData(A):null}get version(){return this.catalog.version||this._version}get formInfo(){const A={hasFields:!1,hasAcroForm:!1,hasXfa:!1,hasSignatures:!1},e=this.catalog.acroForm;if(!e)return x(this,"formInfo",A);try{const t=e.get("Fields"),i=Array.isArray(t)&&t.length>0;A.hasFields=i;const a=e.get("XFA");A.hasXfa=Array.isArray(a)&&a.length>0||a instanceof dA&&!a.isEmpty;const s=!!(1&e.get("SigFlags")),n=s&&this._hasOnlyDocumentSignatures(t);A.hasAcroForm=i&&!n,A.hasSignatures=s}catch(A){if(A instanceof mA)throw A;S(`Cannot fetch form information: "${A}".`)}return x(this,"formInfo",A)}get documentInfo(){const A={PDFFormatVersion:this.version,Language:this.catalog.lang,EncryptFilterName:this.xref.encrypt?this.xref.encrypt.filterName:null,IsLinearized:!!this.linearization,IsAcroFormPresent:this.formInfo.hasAcroForm,IsXFAPresent:this.formInfo.hasXfa,IsCollectionPresent:!!this.catalog.collection,IsSignaturesPresent:this.formInfo.hasSignatures};let e;try{e=this.xref.trailer.get("Info")}catch(A){if(A instanceof mA)throw A;F("The document information dictionary is invalid.")}if(!(e instanceof cA))return x(this,"documentInfo",A);for(const t of e.getKeys()){const i=e.get(t);switch(t){case"Title":case"Author":case"Subject":case"Keywords":case"Creator":case"Producer":case"CreationDate":case"ModDate":if("string"==typeof i){A[t]=j(i);continue}break;case"Trapped":if(i instanceof rA){A[t]=i;continue}break;default:let e;switch(typeof i){case"string":e=j(i);break;case"number":case"boolean":e=i;break;default:i instanceof rA&&(e=i)}if(void 0===e){S(`Bad value, for custom key "${t}", in Info: ${i}.`);continue}A.Custom||(A.Custom=Object.create(null)),A.Custom[t]=e;continue}S(`Bad value, for key "${t}", in Info: ${i}.`)}return x(this,"documentInfo",A)}get fingerprints(){function A(A){return"string"==typeof A&&A.length>0&&"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"!==A}function e(A){const e=[];for(const t of A){const A=t.toString(16);e.push(A.padStart(2,"0"))}return e.join("")}const t=this.xref.trailer.get("ID");let i,a;return Array.isArray(t)&&A(t[0])?(i=T(t[0]),t[1]!==t[0]&&A(t[1])&&(a=T(t[1]))):i=Rr(this.stream.getByteRange(0,1024),0,1024),x(this,"fingerprints",[e(i),a?e(a):null])}async _getLinearizationPage(A){const{catalog:e,linearization:t,xref:i}=this,a=CA.get(t.objectNumberFirst,0);try{const A=await i.fetchAsync(a);if(A instanceof cA){let t=A.getRaw("Type");if(t instanceof CA&&(t=await i.fetchAsync(t)),QA(t,"Page")||!A.has("Type")&&!A.has("Kids")&&A.has("Contents"))return e.pageKidsCountCache.has(a)||e.pageKidsCountCache.put(a,1),e.pageIndexCache.has(a)||e.pageIndexCache.put(a,0),[A,a]}throw new v("The Linearization dictionary doesn't point to a valid Page dictionary.")}catch(t){return S(`_getLinearizationPage: "${t.message}".`),e.getPageDict(A)}}getPage(A){const e=this._pagePromises.get(A);if(e)return e;const{catalog:t,linearization:i,xfaFactory:a}=this;let s;return s=a?Promise.resolve([cA.empty,null]):i?.pageFirst===A?this._getLinearizationPage(A):t.getPageDict(A),s=s.then((([e,i])=>new od({pdfManager:this.pdfManager,xref:this.xref,pageIndex:A,pageDict:e,ref:i,globalIdFactory:this._globalIdFactory,fontCache:t.fontCache,builtInCMapCache:t.builtInCMapCache,standardFontDataCache:t.standardFontDataCache,globalImageCache:t.globalImageCache,systemFontCache:t.systemFontCache,nonBlendModesSet:t.nonBlendModesSet,xfaFactory:a}))),this._pagePromises.set(A,s),s}async checkFirstPage(A=!1){if(!A)try{await this.getPage(0)}catch(A){if(A instanceof wA)throw this._pagePromises.delete(0),await this.cleanup(),new DA}}async checkLastPage(A=!1){const{catalog:e,pdfManager:t}=this;let i;e.setActualNumPages();try{if(await Promise.all([t.ensureDoc("xfaFactory"),t.ensureDoc("linearization"),t.ensureCatalog("numPages")]),this.xfaFactory)return;if(i=this.linearization?this.linearization.numPages:e.numPages,!Number.isInteger(i))throw new v("Page count is not an integer.");if(i<=1)return;await this.getPage(i-1)}catch(a){if(this._pagePromises.delete(i-1),await this.cleanup(),a instanceof wA&&!A)throw new DA;let s;S(`checkLastPage - invalid /Pages tree /Count: ${i}.`);try{s=await e.getAllPageDicts(A)}catch(t){if(t instanceof wA&&!A)throw new DA;return void e.setActualNumPages(1)}for(const[A,[i,a]]of s){let s;i instanceof Error?(s=Promise.reject(i),s.catch((()=>{}))):s=Promise.resolve(new od({pdfManager:t,xref:this.xref,pageIndex:A,pageDict:i,ref:a,globalIdFactory:this._globalIdFactory,fontCache:e.fontCache,builtInCMapCache:e.builtInCMapCache,standardFontDataCache:e.standardFontDataCache,globalImageCache:e.globalImageCache,systemFontCache:e.systemFontCache,nonBlendModesSet:e.nonBlendModesSet,xfaFactory:null})),this._pagePromises.set(A,s)}e.setActualNumPages(s.size)}}fontFallback(A,e){return this.catalog.fontFallback(A,e)}async cleanup(A=!1){return this.catalog?this.catalog.cleanup(A):fr()}async#T(A,e,t,i,a){const{xref:s}=this;if(!(e instanceof CA)||a.has(e))return;a.put(e);const n=await s.fetchAsync(e);if(!(n instanceof cA))return;if(n.has("T")){const e=j(await n.getAsync("T"));A=""===A?e:`${A}.${e}`}else{let e=n;for(;;){if(e=e.getRaw("Parent"),e instanceof CA){if(a.has(e))break;e=await s.fetchAsync(e)}if(!(e instanceof cA))break;if(e.has("T")){const t=j(await e.getAsync("T"));A=""===A?t:`${A}.${t}`;break}}}if(t.has(A)||t.set(A,[]),t.get(A).push(Fu.create(s,e,i,null,!0,null).then((A=>A?.getFieldObject())).catch((function(A){return S(`#collectFieldObjects: "${A}".`),null}))),!n.has("Kids"))return;const g=await n.getAsync("Kids");if(Array.isArray(g))for(const e of g)await this.#T(A,e,t,i,a)}get fieldObjects(){return this.formInfo.hasFields?x(this,"fieldObjects",Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureCatalog("acroForm")]).then((async([A,e])=>{if(!A)return null;const t=new BA,i=Object.create(null),a=new Map;for(const i of await e.getAsync("Fields"))await this.#T("",i,a,A,t);const s=[];for(const[A,e]of a)s.push(Promise.all(e).then((e=>{(e=e.filter((A=>!!A))).length>0&&(i[A]=e)})));return await Promise.all(s),i}))):x(this,"fieldObjects",Promise.resolve(null))}get hasJSActions(){return x(this,"hasJSActions",this.pdfManager.ensureDoc("_parseHasJSActions"))}async _parseHasJSActions(){const[A,e]=await Promise.all([this.pdfManager.ensureCatalog("jsActions"),this.pdfManager.ensureDoc("fieldObjects")]);return!!A||!!e&&Object.values(e).some((A=>A.some((A=>null!==A.actions))))}get calculationOrderIds(){const A=this.catalog.acroForm;if(!A?.has("CO"))return x(this,"calculationOrderIds",null);const e=A.get("CO");if(!Array.isArray(e)||0===e.length)return x(this,"calculationOrderIds",null);const t=[];for(const A of e)A instanceof CA&&t.push(A.toString());return 0===t.length?x(this,"calculationOrderIds",null):x(this,"calculationOrderIds",t)}get annotationGlobals(){return x(this,"annotationGlobals",Fu.createGlobals(this.pdfManager))}}class Qd{constructor(A){this._docBaseUrl=function(A){if(A){const e=N(A);if(e)return e.href;S(`Invalid absolute docBaseUrl: "${A}".`)}return null}(A.docBaseUrl),this._docId=A.docId,this._password=A.password,this.enableXfa=A.enableXfa,A.evaluatorOptions.isOffscreenCanvasSupported&&=Z.isOffscreenCanvasSupported,this.evaluatorOptions=Object.freeze(A.evaluatorOptions)}get docId(){return this._docId}get password(){return this._password}get docBaseUrl(){return this._docBaseUrl}get catalog(){return this.pdfDocument.catalog}ensureDoc(A,e){return this.ensure(this.pdfDocument,A,e)}ensureXRef(A,e){return this.ensure(this.pdfDocument.xref,A,e)}ensureCatalog(A,e){return this.ensure(this.pdfDocument.catalog,A,e)}getPage(A){return this.pdfDocument.getPage(A)}fontFallback(A,e){return this.pdfDocument.fontFallback(A,e)}loadXfaFonts(A,e){return this.pdfDocument.loadXfaFonts(A,e)}loadXfaImages(){return this.pdfDocument.loadXfaImages()}serializeXfaData(A){return this.pdfDocument.serializeXfaData(A)}cleanup(A=!1){return this.pdfDocument.cleanup(A)}async ensure(A,e,t){R("Abstract method `ensure` called")}requestRange(A,e){R("Abstract method `requestRange` called")}requestLoadedStream(A=!1){R("Abstract method `requestLoadedStream` called")}sendProgressiveData(A){R("Abstract method `sendProgressiveData` called")}updatePassword(A){this._password=A}terminate(A){R("Abstract method `terminate` called")}}class ld extends Qd{constructor(A){super(A);const e=new ie(A.source);this.pdfDocument=new hd(this,e),this._loadedStreamPromise=Promise.resolve(e)}async ensure(A,e,t){const i=A[e];return"function"==typeof i?i.apply(A,t):i}requestRange(A,e){return Promise.resolve()}requestLoadedStream(A=!1){return this._loadedStreamPromise}terminate(A){}}class Ed extends Qd{constructor(A){super(A),this.streamManager=new ge(A.source,{msgHandler:A.handler,length:A.length,disableAutoFetch:A.disableAutoFetch,rangeChunkSize:A.rangeChunkSize}),this.pdfDocument=new hd(this,this.streamManager.getStream())}async ensure(A,e,t){try{const i=A[e];return"function"==typeof i?i.apply(A,t):i}catch(i){if(!(i instanceof mA))throw i;return await this.requestRange(i.begin,i.end),this.ensure(A,e,t)}}requestRange(A,e){return this.streamManager.requestRange(A,e)}requestLoadedStream(A=!1){return this.streamManager.requestAllChunks(A)}sendProgressiveData(A){this.streamManager.onReceiveData({chunk:A})}terminate(A){this.streamManager.abort(A)}}function ud(A){switch(A instanceof Error||"object"==typeof A&&null!==A||R('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),A.name){case"AbortException":return new K(A.message);case"MissingPDFException":return new H(A.message);case"PasswordException":return new M(A.message,A.code);case"UnexpectedResponseException":return new Y(A.message,A.status);case"UnknownErrorException":return new L(A.message,A.details);default:return new L(A.message,A.toString())}}class dd{constructor(A,e,t){this.sourceName=A,this.targetName=e,this.comObj=t,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=A=>{const e=A.data;if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#P(e);if(e.callback){const A=e.callbackId,t=this.callbackCapabilities[A];if(!t)throw new Error(`Cannot resolve callback ${A}`);if(delete this.callbackCapabilities[A],1===e.callback)t.resolve(e.data);else{if(2!==e.callback)throw new Error("Unexpected callback case");t.reject(ud(e.reason))}return}const i=this.actionHandler[e.action];if(!i)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const A=this.sourceName,a=e.sourceName;new Promise((function(A){A(i(e.data))})).then((function(i){t.postMessage({sourceName:A,targetName:a,callback:1,callbackId:e.callbackId,data:i})}),(function(i){t.postMessage({sourceName:A,targetName:a,callback:2,callbackId:e.callbackId,reason:ud(i)})}))}else e.streamId?this.#W(e):i(e.data)},t.addEventListener("message",this._onComObjOnMessage)}on(A,e){const t=this.actionHandler;if(t[A])throw new Error(`There is already an actionName called "${A}"`);t[A]=e}send(A,e,t){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:A,data:e},t)}sendWithPromise(A,e,t){const i=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[i]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:A,callbackId:i,data:e},t)}catch(A){a.reject(A)}return a.promise}sendWithStream(A,e,t,i){const a=this.streamId++,s=this.sourceName,n=this.targetName,g=this.comObj;return new ReadableStream({start:t=>{const r=Promise.withResolvers();return this.streamControllers[a]={controller:t,startCall:r,pullCall:null,cancelCall:null,isClosed:!1},g.postMessage({sourceName:s,targetName:n,action:A,streamId:a,data:e,desiredSize:t.desiredSize},i),r.promise},pull:A=>{const e=Promise.withResolvers();return this.streamControllers[a].pullCall=e,g.postMessage({sourceName:s,targetName:n,stream:6,streamId:a,desiredSize:A.desiredSize}),e.promise},cancel:A=>{G(A instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[a].cancelCall=e,this.streamControllers[a].isClosed=!0,g.postMessage({sourceName:s,targetName:n,stream:1,streamId:a,reason:ud(A)}),e.promise}},t)}#W(A){const e=A.streamId,t=this.sourceName,i=A.sourceName,a=this.comObj,s=this,n=this.actionHandler[A.action],g={enqueue(A,s=1,n){if(this.isCancelled)return;const g=this.desiredSize;this.desiredSize-=s,g>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),a.postMessage({sourceName:t,targetName:i,stream:4,streamId:e,chunk:A},n)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:t,targetName:i,stream:3,streamId:e}),delete s.streamSinks[e])},error(A){G(A instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:t,targetName:i,stream:5,streamId:e,reason:ud(A)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:A.desiredSize,ready:null};g.sinkCapability.resolve(),g.ready=g.sinkCapability.promise,this.streamSinks[e]=g,new Promise((function(e){e(n(A.data,g))})).then((function(){a.postMessage({sourceName:t,targetName:i,stream:8,streamId:e,success:!0})}),(function(A){a.postMessage({sourceName:t,targetName:i,stream:8,streamId:e,reason:ud(A)})}))}#P(A){const e=A.streamId,t=this.sourceName,i=A.sourceName,a=this.comObj,s=this.streamControllers[e],n=this.streamSinks[e];switch(A.stream){case 8:A.success?s.startCall.resolve():s.startCall.reject(ud(A.reason));break;case 7:A.success?s.pullCall.resolve():s.pullCall.reject(ud(A.reason));break;case 6:if(!n){a.postMessage({sourceName:t,targetName:i,stream:7,streamId:e,success:!0});break}n.desiredSize<=0&&A.desiredSize>0&&n.sinkCapability.resolve(),n.desiredSize=A.desiredSize,new Promise((function(A){A(n.onPull?.())})).then((function(){a.postMessage({sourceName:t,targetName:i,stream:7,streamId:e,success:!0})}),(function(A){a.postMessage({sourceName:t,targetName:i,stream:7,streamId:e,reason:ud(A)})}));break;case 4:if(G(s,"enqueue should have stream controller"),s.isClosed)break;s.controller.enqueue(A.chunk);break;case 3:if(G(s,"close should have stream controller"),s.isClosed)break;s.isClosed=!0,s.controller.close(),this.#Z(s,e);break;case 5:G(s,"error should have stream controller"),s.controller.error(ud(A.reason)),this.#Z(s,e);break;case 2:A.success?s.cancelCall.resolve():s.cancelCall.reject(ud(A.reason)),this.#Z(s,e);break;case 1:if(!n)break;new Promise((function(e){e(n.onCancel?.(ud(A.reason)))})).then((function(){a.postMessage({sourceName:t,targetName:i,stream:2,streamId:e,success:!0})}),(function(A){a.postMessage({sourceName:t,targetName:i,stream:2,streamId:e,reason:ud(A)})})),n.sinkCapability.reject(ud(A.reason)),n.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#Z(A,e){await Promise.allSettled([A.startCall?.promise,A.pullCall?.promise,A.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}class fd{constructor(A){this._msgHandler=A,this._contentLength=null,this._fullRequestReader=null,this._rangeRequestReaders=[]}getFullReader(){return G(!this._fullRequestReader,"PDFWorkerStream.getFullReader can only be called once."),this._fullRequestReader=new pd(this._msgHandler),this._fullRequestReader}getRangeReader(A,e){const t=new md(A,e,this._msgHandler);return this._rangeRequestReaders.push(t),t}cancelAllRequests(A){this._fullRequestReader?.cancel(A);for(const e of this._rangeRequestReaders.slice(0))e.cancel(A)}}class pd{constructor(A){this._msgHandler=A,this.onProgress=null,this._contentLength=null,this._isRangeSupported=!1,this._isStreamingSupported=!1;const e=this._msgHandler.sendWithStream("GetReader");this._reader=e.getReader(),this._headersReady=this._msgHandler.sendWithPromise("ReaderHeadersReady").then((A=>{this._isStreamingSupported=A.isStreamingSupported,this._isRangeSupported=A.isRangeSupported,this._contentLength=A.contentLength}))}get headersReady(){return this._headersReady}get contentLength(){return this._contentLength}get isStreamingSupported(){return this._isStreamingSupported}get isRangeSupported(){return this._isRangeSupported}async read(){const{value:A,done:e}=await this._reader.read();return e?{value:void 0,done:!0}:{value:A.buffer,done:!1}}cancel(A){this._reader.cancel(A)}}class md{constructor(A,e,t){this._msgHandler=t,this.onProgress=null;const i=this._msgHandler.sendWithStream("GetRangeReader",{begin:A,end:e});this._reader=i.getReader()}get isStreamingSupported(){return!1}async read(){const{value:A,done:e}=await this._reader.read();return e?{value:void 0,done:!0}:{value:A.buffer,done:!1}}cancel(A){this._reader.cancel(A)}}class yd{constructor(A){this.name=A,this.terminated=!1,this._capability=Promise.withResolvers()}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}class wd{static setup(A,e){let t=!1;A.on("test",(function(e){t||(t=!0,A.send("test",e instanceof Uint8Array))})),A.on("configure",(function(A){var e;e=A.verbosity,Number.isInteger(e)&&(b=e)})),A.on("GetDocRequest",(function(A){return wd.createDocumentHandler(A,e)}))}static createDocumentHandler(A,e){let t,i=!1,a=null;const s=new Set,n=k(),{docId:g,apiVersion:r}=A,o="4.6.82";if(r!==o)throw new Error(`The API version "${r}" does not match the Worker version "${o}".`);const I=[];for(const A in[])I.push(A);if(I.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+I.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");const c=g+"_worker";let C=new dd(c,g,e);function B(){if(i)throw new Error("Worker was terminated")}function h(A){s.add(A)}function Q(A){A.finish(),s.delete(A)}async function l(A){await t.ensureDoc("checkHeader"),await t.ensureDoc("parseStartXRef"),await t.ensureDoc("parse",[A]),await t.ensureDoc("checkFirstPage",[A]),await t.ensureDoc("checkLastPage",[A]);const e=await t.ensureDoc("isPureXfa");if(e){const A=new yd("loadXfaFonts");h(A),await Promise.all([t.loadXfaFonts(C,A).catch((A=>{})).then((()=>Q(A))),t.loadXfaImages()])}const[i,a]=await Promise.all([t.ensureDoc("numPages"),t.ensureDoc("fingerprints")]);return{numPages:i,fingerprints:a,htmlForXfa:e?await t.ensureDoc("htmlForXfa"):null}}return C.on("GetPage",(function(A){return t.getPage(A.pageIndex).then((function(A){return Promise.all([t.ensure(A,"rotate"),t.ensure(A,"ref"),t.ensure(A,"userUnit"),t.ensure(A,"view")]).then((function([A,e,t,i]){return{rotate:A,ref:e,refStr:e?.toString()??null,userUnit:t,view:i}}))}))})),C.on("GetPageIndex",(function(A){const e=CA.get(A.num,A.gen);return t.ensureCatalog("getPageIndex",[e])})),C.on("GetDestinations",(function(A){return t.ensureCatalog("destinations")})),C.on("GetDestination",(function(A){return t.ensureCatalog("getDestination",[A.id])})),C.on("GetPageLabels",(function(A){return t.ensureCatalog("pageLabels")})),C.on("GetPageLayout",(function(A){return t.ensureCatalog("pageLayout")})),C.on("GetPageMode",(function(A){return t.ensureCatalog("pageMode")})),C.on("GetViewerPreferences",(function(A){return t.ensureCatalog("viewerPreferences")})),C.on("GetOpenAction",(function(A){return t.ensureCatalog("openAction")})),C.on("GetAttachments",(function(A){return t.ensureCatalog("attachments")})),C.on("GetDocJSActions",(function(A){return t.ensureCatalog("jsActions")})),C.on("GetPageJSActions",(function({pageIndex:A}){return t.getPage(A).then((function(A){return t.ensure(A,"jsActions")}))})),C.on("GetOutline",(function(A){return t.ensureCatalog("documentOutline")})),C.on("GetOptionalContentConfig",(function(A){return t.ensureCatalog("optionalContentConfig")})),C.on("GetPermissions",(function(A){return t.ensureCatalog("permissions")})),C.on("GetMetadata",(function(A){return Promise.all([t.ensureDoc("documentInfo"),t.ensureCatalog("metadata")])})),C.on("GetMarkInfo",(function(A){return t.ensureCatalog("markInfo")})),C.on("GetData",(function(A){return t.requestLoadedStream().then((function(A){return A.bytes}))})),C.on("GetAnnotations",(function({pageIndex:A,intent:e}){return t.getPage(A).then((function(t){const i=new yd(`GetAnnotations: page ${A}`);return h(i),t.getAnnotationsData(C,i,e).then((A=>(Q(i),A)),(A=>{throw Q(i),A}))}))})),C.on("GetFieldObjects",(function(A){return t.ensureDoc("fieldObjects")})),C.on("HasJSActions",(function(A){return t.ensureDoc("hasJSActions")})),C.on("GetCalculationOrderIds",(function(A){return t.ensureDoc("calculationOrderIds")})),C.on("SaveDocument",(async function({isPureXfa:A,numPages:e,annotationStorage:i,filename:a}){const s=[t.requestLoadedStream(),t.ensureCatalog("acroForm"),t.ensureCatalog("acroFormRef"),t.ensureDoc("startXRef"),t.ensureDoc("xref"),t.ensureDoc("linearization"),t.ensureCatalog("structTreeRoot")],n=[],g=A?null:zA(i),[r,o,I,c,B,h,l]=await Promise.all(s),E=B.trailer.getRaw("Root")||null;let u;if(g){l?await l.canUpdateStructTree({pdfManager:t,xref:B,newAnnotationsByPage:g})&&(u=l):await _r.canCreateStructureTree({catalogRef:E,pdfManager:t,newAnnotationsByPage:g})&&(u=null);const A=Fu.generateImages(i.values(),B,t.evaluatorOptions.isOffscreenCanvasSupported),e=void 0===u?n:[];for(const[i,a]of g)e.push(t.getPage(i).then((e=>{const t=new yd(`Save (editor): page ${i}`);return e.saveNewAnnotations(C,t,a,A).finally((function(){Q(t)}))})));null===u?n.push(Promise.all(e).then((async A=>(await _r.createStructureTree({newAnnotationsByPage:g,xref:B,catalogRef:E,pdfManager:t,newRefs:A}),A)))):u&&n.push(Promise.all(e).then((async A=>(await u.updateStructureTree({newAnnotationsByPage:g,pdfManager:t,newRefs:A}),A))))}if(A)n.push(t.serializeXfaData(i));else for(let A=0;AA.needAppearances)),y=o instanceof cA&&o.get("XFA")||null;let w=null,D=!1;if(Array.isArray(y)){for(let A=0,e=y.length;A{"string"==typeof t&&(A[e]=j(t))})),b={rootRef:E,encryptRef:B.trailer.getRaw("Encrypt")||null,newRef:B.getNewTemporaryRef(),infoRef:B.trailer.getRaw("Info")||null,info:A,fileIds:B.trailer.get("ID")||null,startXRef:h?c:B.lastXRefStreamPos??c,filename:a}}return zr({originalData:r.bytes,xrefInfo:b,newRefs:f,xref:B,hasXfa:!!y,xfaDatasetsRef:w,hasXfaDatasetsEntry:D,needAppearances:m,acroFormRef:I,acroForm:o,xfaData:p,useXrefStream:EA(B.topDict,"XRef")}).finally((()=>{B.resetNewTemporaryRef()}))})),C.on("GetOperatorList",(function(A,e){const i=A.pageIndex;t.getPage(i).then((function(t){const a=new yd(`GetOperatorList: page ${i}`);h(a);const s=n>=5?Date.now():0;t.getOperatorList({handler:C,sink:e,task:a,intent:A.intent,cacheKey:A.cacheKey,annotationStorage:A.annotationStorage,modifiedIds:A.modifiedIds}).then((function(A){Q(a),s&&F(`page=${i+1} - getOperatorList: time=${Date.now()-s}ms, len=${A.length}`),e.close()}),(function(A){Q(a),a.terminated||e.error(A)}))}))})),C.on("GetTextContent",(function(A,e){const{pageIndex:i,includeMarkedContent:a,disableNormalization:s}=A;t.getPage(i).then((function(A){const t=new yd("GetTextContent: page "+i);h(t);const g=n>=5?Date.now():0;A.extractTextContent({handler:C,task:t,sink:e,includeMarkedContent:a,disableNormalization:s}).then((function(){Q(t),g&&F(`page=${i+1} - getTextContent: time=`+(Date.now()-g)+"ms"),e.close()}),(function(A){Q(t),t.terminated||e.error(A)}))}))})),C.on("GetStructTree",(function(A){return t.getPage(A.pageIndex).then((function(A){return t.ensure(A,"getStructTree")}))})),C.on("FontFallback",(function(A){return t.fontFallback(A.id,C)})),C.on("Cleanup",(function(A){return t.cleanup(!0)})),C.on("Terminate",(function(A){i=!0;const e=[];if(t){t.terminate(new K("Worker was terminated."));const A=t.cleanup();e.push(A),t=null}else fr();a&&a(new K("Worker was terminated."));for(const A of s)e.push(A.finished),A.terminate();return Promise.all(e).then((function(){C.destroy(),C=null}))})),C.on("Ready",(function(e){!function(A){function e(A){B(),C.send("GetDoc",{pdfInfo:A})}function s(A){if(B(),A instanceof M){const e=new yd(`PasswordException: response ${A.code}`);h(e),C.sendWithPromise("PasswordRequest",A).then((function({password:A}){Q(e),t.updatePassword(A),n()})).catch((function(){Q(e),C.send("DocException",A)}))}else A instanceof J||A instanceof H||A instanceof Y||A instanceof L?C.send("DocException",A):C.send("DocException",new L(A.message,A.toString()))}function n(){B(),l(!1).then(e,(function(A){B(),A instanceof DA?t.requestLoadedStream().then((function(){B(),l(!0).then(e,s)})):s(A)}))}B(),function({data:A,password:e,disableAutoFetch:t,rangeChunkSize:i,length:s,docBaseUrl:n,enableXfa:r,evaluatorOptions:o}){const I={source:null,disableAutoFetch:t,docBaseUrl:n,docId:g,enableXfa:r,evaluatorOptions:o,handler:C,length:s,password:e,rangeChunkSize:i},c=Promise.withResolvers();let h;if(A){try{I.source=A,h=new ld(I),c.resolve(h)}catch(A){c.reject(A)}return c.promise}let Q,l=[];try{Q=new fd(C)}catch(A){return c.reject(A),c.promise}const E=Q.getFullReader();E.headersReady.then((function(){if(E.isRangeSupported){I.source=Q,I.length=E.contentLength,I.disableAutoFetch||=E.isStreamingSupported,h=new Ed(I);for(const A of l)h.sendProgressiveData(A);l=[],c.resolve(h),a=null}})).catch((function(A){c.reject(A),a=null}));let u=0;return new Promise((function(A,e){const t=function({value:A,done:i}){try{if(B(),i)return h||function(){const A=bA(l);s&&A.length!==s&&S("reported HTTP length is different from actual");try{I.source=A,h=new ld(I),c.resolve(h)}catch(A){c.reject(A)}l=[]}(),void(a=null);u+=A.byteLength,E.isStreamingSupported||C.send("DocProgress",{loaded:u,total:Math.max(u,E.contentLength||0)}),h?h.sendProgressiveData(A):l.push(A),E.read().then(t,e)}catch(A){e(A)}};E.read().then(t,e)})).catch((function(A){c.reject(A),a=null})),a=function(A){Q.cancelAllRequests(A)},c.promise}(A).then((function(A){if(i)throw A.terminate(new K("Worker was terminated.")),new Error("Worker was terminated");t=A,t.requestLoadedStream(!0).then((A=>{C.send("DataLoaded",{length:A.bytes.byteLength})}))})).then(n,s)}(A),A=null})),c}static initializeFromPort(A){const e=new dd("worker","main",A);wd.setup(e,A),e.send("ready",null)}}var Dd;"undefined"==typeof window&&!t&&"undefined"!=typeof self&&"function"==typeof(Dd=self).postMessage&&"onmessage"in Dd&&wd.initializeFromPort(self);var bd={}.false;export{bd as WorkerMessageHandler}; \ No newline at end of file +var A={d:(e,t)=>{for(var i in t)A.o(t,i)&&!A.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},o:(A,e)=>Object.prototype.hasOwnProperty.call(A,e)},e=globalThis.pdfjsWorker={};A.d(e,{WorkerMessageHandler:()=>Dd});const t=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),i=[1,0,0,1,0,0],a=[.001,0,0,.001,0,0],s=1.35,n=.25925925925925924,g="pdfjs_internal_editor_",r={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},o="Group",I=32,c=8192,C=65536,B={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"},h={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},Q={O:"PageOpen",C:"PageClose"},l=10,E=11,u=12,d=37,f=44,p=58,m=59,y=70,w=71,D=83,b=85;let k=1;function F(){return k}function S(A){k>=5&&console.log(`Info: ${A}`)}function R(A){k>=1&&console.log(`Warning: ${A}`)}function G(A){throw new Error(A)}function N(A,e){A||G(e)}function x(A,e=null,t=null){if(!A)return null;try{if(t&&"string"==typeof A){if(t.addDefaultProtocol&&A.startsWith("www.")){const e=A.match(/\./g);e?.length>=2&&(A=`http://${A}`)}if(t.tryConvertEncoding)try{A=_(A)}catch{}}const i=e?new URL(A,e):new URL(A);if(function(A){switch(A?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(i))return i}catch{}return null}function U(A,e,t,i=!1){return Object.defineProperty(A,e,{value:t,enumerable:!i,configurable:!0,writable:!1}),t}const M=function(){function A(A,e){this.message=A,this.name=e}return A.prototype=new Error,A.constructor=A,A}();class L extends M{constructor(A,e){super(A,"PasswordException"),this.code=e}}class J extends M{constructor(A,e){super(A,"UnknownErrorException"),this.details=e}}class H extends M{constructor(A){super(A,"InvalidPDFException")}}class Y extends M{constructor(A){super(A,"MissingPDFException")}}class v extends M{constructor(A,e){super(A,"UnexpectedResponseException"),this.status=e}}class K extends M{constructor(A){super(A,"FormatError")}}class q extends M{constructor(A){super(A,"AbortException")}}function T(A){"object"==typeof A&&void 0!==A?.length||G("Invalid argument for bytesToString");const e=A.length,t=8192;if(e>24&255,A>>16&255,A>>8&255,255&A)}function Z(A){return Object.keys(A).length}class O{static get isLittleEndian(){return U(this,"isLittleEndian",function(){const A=new Uint8Array(4);return A[0]=1,1===new Uint32Array(A.buffer,0,1)[0]}())}static get isEvalSupported(){return U(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return U(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"!=typeof navigator&&"string"==typeof navigator?.platform?U(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof navigator?.userAgent&&navigator.userAgent.includes("Firefox")}):U(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){return U(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const X=Array.from(Array(256).keys(),(A=>A.toString(16).padStart(2,"0")));class V{static makeHexColor(A,e,t){return`#${X[A]}${X[e]}${X[t]}`}static scaleMinMax(A,e){let t;A[0]?(A[0]<0&&(t=e[0],e[0]=e[2],e[2]=t),e[0]*=A[0],e[2]*=A[0],A[3]<0&&(t=e[1],e[1]=e[3],e[3]=t),e[1]*=A[3],e[3]*=A[3]):(t=e[0],e[0]=e[1],e[1]=t,t=e[2],e[2]=e[3],e[3]=t,A[1]<0&&(t=e[1],e[1]=e[3],e[3]=t),e[1]*=A[1],e[3]*=A[1],A[2]<0&&(t=e[0],e[0]=e[2],e[2]=t),e[0]*=A[2],e[2]*=A[2]),e[0]+=A[4],e[1]+=A[5],e[2]+=A[4],e[3]+=A[5]}static transform(A,e){return[A[0]*e[0]+A[2]*e[1],A[1]*e[0]+A[3]*e[1],A[0]*e[2]+A[2]*e[3],A[1]*e[2]+A[3]*e[3],A[0]*e[4]+A[2]*e[5]+A[4],A[1]*e[4]+A[3]*e[5]+A[5]]}static applyTransform(A,e){return[A[0]*e[0]+A[1]*e[2]+e[4],A[0]*e[1]+A[1]*e[3]+e[5]]}static applyInverseTransform(A,e){const t=e[0]*e[3]-e[1]*e[2];return[(A[0]*e[3]-A[1]*e[2]+e[2]*e[5]-e[4]*e[3])/t,(-A[0]*e[1]+A[1]*e[0]+e[4]*e[1]-e[5]*e[0])/t]}static getAxialAlignedBoundingBox(A,e){const t=this.applyTransform(A,e),i=this.applyTransform(A.slice(2,4),e),a=this.applyTransform([A[0],A[3]],e),s=this.applyTransform([A[2],A[1]],e);return[Math.min(t[0],i[0],a[0],s[0]),Math.min(t[1],i[1],a[1],s[1]),Math.max(t[0],i[0],a[0],s[0]),Math.max(t[1],i[1],a[1],s[1])]}static inverseTransform(A){const e=A[0]*A[3]-A[1]*A[2];return[A[3]/e,-A[1]/e,-A[2]/e,A[0]/e,(A[2]*A[5]-A[4]*A[3])/e,(A[4]*A[1]-A[5]*A[0])/e]}static singularValueDecompose2dScale(A){const e=[A[0],A[2],A[1],A[3]],t=A[0]*e[0]+A[1]*e[2],i=A[0]*e[1]+A[1]*e[3],a=A[2]*e[0]+A[3]*e[2],s=A[2]*e[1]+A[3]*e[3],n=(t+s)/2,g=Math.sqrt((t+s)**2-4*(t*s-a*i))/2,r=n+g||1,o=n-g||1;return[Math.sqrt(r),Math.sqrt(o)]}static normalizeRect(A){const e=A.slice(0);return A[0]>A[2]&&(e[0]=A[2],e[2]=A[0]),A[1]>A[3]&&(e[1]=A[3],e[3]=A[1]),e}static intersect(A,e){const t=Math.max(Math.min(A[0],A[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(A[0],A[2]),Math.max(e[0],e[2]));if(t>i)return null;const a=Math.max(Math.min(A[1],A[3]),Math.min(e[1],e[3])),s=Math.min(Math.max(A[1],A[3]),Math.max(e[1],e[3]));return a>s?null:[t,a,i,s]}static#A(A,e,t,i,a,s,n,g,r,o){if(r<=0||r>=1)return;const I=1-r,c=r*r,C=c*r,B=I*(I*(I*A+3*r*e)+3*c*t)+C*i,h=I*(I*(I*a+3*r*s)+3*c*n)+C*g;o[0]=Math.min(o[0],B),o[1]=Math.min(o[1],h),o[2]=Math.max(o[2],B),o[3]=Math.max(o[3],h)}static#e(A,e,t,i,a,s,n,g,r,o,I,c){if(Math.abs(r)<1e-12)return void(Math.abs(o)>=1e-12&&this.#A(A,e,t,i,a,s,n,g,-I/o,c));const C=o**2-4*I*r;if(C<0)return;const B=Math.sqrt(C),h=2*r;this.#A(A,e,t,i,a,s,n,g,(-o+B)/h,c),this.#A(A,e,t,i,a,s,n,g,(-o-B)/h,c)}static bezierBoundingBox(A,e,t,i,a,s,n,g,r){return r?(r[0]=Math.min(r[0],A,n),r[1]=Math.min(r[1],e,g),r[2]=Math.max(r[2],A,n),r[3]=Math.max(r[3],e,g)):r=[Math.min(A,n),Math.min(e,g),Math.max(A,n),Math.max(e,g)],this.#e(A,t,a,n,e,i,s,g,3*(3*(t-a)-A+n),6*(A-2*t+a),3*(t-A),r),this.#e(A,t,a,n,e,i,s,g,3*(3*(i-s)-e+g),6*(e-2*i+s),3*(i-e),r),r}}const j=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function z(A){if(A[0]>="ï"){let e;if("þ"===A[0]&&"ÿ"===A[1]?(e="utf-16be",A.length%2==1&&(A=A.slice(0,-1))):"ÿ"===A[0]&&"þ"===A[1]?(e="utf-16le",A.length%2==1&&(A=A.slice(0,-1))):"ï"===A[0]&&"»"===A[1]&&"¿"===A[2]&&(e="utf-8"),e)try{const t=new TextDecoder(e,{fatal:!0}),i=P(A),a=t.decode(i);return a.includes("")?a.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g,""):a}catch(A){R(`stringToPDFString: "${A}".`)}}const e=[];for(let t=0,i=A.length;t{G("Should not call `set` on the empty dictionary.")},U(this,"empty",A)}static merge({xref:A,dictArray:e,mergeSubDicts:t=!1}){const i=new CA(A),a=new Map;for(const A of e)if(A instanceof CA)for(const[e,i]of Object.entries(A._map)){let A=a.get(e);if(void 0===A)A=[],a.set(e,A);else if(!(t&&i instanceof CA))continue;A.push(i)}for(const[e,t]of a){if(1===t.length||!(t[0]instanceof CA)){i._map[e]=t[0];continue}const a=new CA(A);for(const A of t)for(const[e,t]of Object.entries(A._map))void 0===a._map[e]&&(a._map[e]=t);a.size>0&&(i._map[e]=a)}return a.clear(),i.size>0?i:CA.empty}clone(){const A=new CA(this.xref);for(const e of this.getKeys())A.set(e,this.getRaw(e));return A}delete(A){delete this._map[A]}}class BA{constructor(A,e){this.num=A,this.gen=e}toString(){return 0===this.gen?`${this.num}R`:`${this.num}R${this.gen}`}static fromString(A){const e=rA[A];if(e)return e;const t=/^(\d+)R(\d*)$/.exec(A);return t&&"0"!==t[1]?rA[A]=new BA(parseInt(t[1]),t[2]?parseInt(t[2]):0):null}static get(A,e){const t=0===e?`${A}R`:`${A}R${e}`;return rA[t]||=new BA(A,e)}}class hA{constructor(A=null){this._set=new Set(A?._set)}has(A){return this._set.has(A.toString())}put(A){this._set.add(A.toString())}remove(A){this._set.delete(A.toString())}[Symbol.iterator](){return this._set.values()}clear(){this._set.clear()}}class QA{constructor(){this._map=new Map}get size(){return this._map.size}get(A){return this._map.get(A.toString())}has(A){return this._map.has(A.toString())}put(A,e){this._map.set(A.toString(),e)}putAlias(A,e){this._map.set(A.toString(),this.get(e))}[Symbol.iterator](){return this._map.values()}clear(){this._map.clear()}*items(){for(const[A,e]of this._map)yield[BA.fromString(A),e]}}function lA(A,e){return A instanceof oA&&(void 0===e||A.name===e)}function EA(A,e){return A instanceof IA&&(void 0===e||A.cmd===e)}function uA(A,e){return A instanceof CA&&(void 0===e||lA(A.get("Type"),e))}function dA(A,e){return A.num===e.num&&A.gen===e.gen}class fA{get length(){G("Abstract getter `length` accessed")}get isEmpty(){G("Abstract getter `isEmpty` accessed")}get isDataLoaded(){return U(this,"isDataLoaded",!0)}getByte(){G("Abstract method `getByte` called")}getBytes(A){G("Abstract method `getBytes` called")}async getImageData(A,e){return this.getBytes(A,e)}async asyncGetBytes(){G("Abstract method `asyncGetBytes` called")}get isAsync(){return!1}get canAsyncDecodeImageFromBuffer(){return!1}peekByte(){const A=this.getByte();return-1!==A&&this.pos--,A}peekBytes(A){const e=this.getBytes(A);return this.pos-=e.length,e}getUint16(){const A=this.getByte(),e=this.getByte();return-1===A||-1===e?-1:(A<<8)+e}getInt32(){return(this.getByte()<<24)+(this.getByte()<<16)+(this.getByte()<<8)+this.getByte()}getByteRange(A,e){G("Abstract method `getByteRange` called")}getString(A){return T(this.getBytes(A))}skip(A){this.pos+=A||1}reset(){G("Abstract method `reset` called")}moveStart(){G("Abstract method `moveStart` called")}makeSubStream(A,e,t=null){G("Abstract method `makeSubStream` called")}getBaseStreams(){return null}}const pA=/^[1-9]\.\d$/;function mA(A){let e;return function(){return A&&(e=Object.create(null),A(e),A=null),e}}class yA extends M{constructor(A,e){super(`Missing data [${A}, ${e})`,"MissingDataException"),this.begin=A,this.end=e}}class wA extends M{constructor(A){super(A,"ParserEOFException")}}class DA extends M{constructor(A){super(A,"XRefEntryException")}}class bA extends M{constructor(A){super(A,"XRefParseException")}}function kA(A){const e=A.length;if(0===e)return new Uint8Array(0);if(1===e)return new Uint8Array(A[0]);let t=0;for(let i=0;i0,"The number should be a positive integer.");const t=[];let i;for(;A>=1e3;)A-=1e3,t.push("M");i=A/100|0,A%=100,t.push(SA[i]),i=A/10|0,A%=10,t.push(SA[10+i]),t.push(SA[20+A]);const a=t.join("");return e?a.toLowerCase():a}function GA(A){return A<=0?0:Math.ceil(Math.log2(A))}function NA(A,e){return A[e]<<24>>24}function xA(A,e){return A[e]<<8|A[e+1]}function UA(A,e){return(A[e]<<24|A[e+1]<<16|A[e+2]<<8|A[e+3])>>>0}function MA(A){return 32===A||9===A||13===A||10===A}function LA(A,e){return Array.isArray(A)?(null===e||A.length===e)&&A.every((A=>"number"==typeof A)):ArrayBuffer.isView(A)&&(0===A.length||"number"==typeof A[0])&&(null===e||A.length===e)}function JA(A,e){return LA(A,6)?A:e}function HA(A,e){return LA(A,4)?A:e}function YA(A,e){return LA(A,4)?V.normalizeRect(A):e}function vA(A){const e=/(.+)\[(\d+)\]$/;return A.split(".").map((A=>{const t=A.match(e);return t?{name:t[1],pos:parseInt(t[2],10)}:{name:A,pos:0}}))}function KA(A){const e=[];let t=0;for(let i=0,a=A.length;i126||35===a||40===a||41===a||60===a||62===a||91===a||93===a||123===a||125===a||47===a||37===a)&&(t"\n"===A?"\\n":"\r"===A?"\\r":`\\${A}`))}function TA(A,e,t,i){if(!A)return;let a=null;if(A instanceof BA){if(i.has(A))return;a=A,i.put(a),A=e.fetch(A)}if(Array.isArray(A))for(const a of A)TA(a,e,t,i);else if(A instanceof CA){if(lA(A.get("S"),"JavaScript")){const e=A.get("JS");let i;e instanceof fA?i=e.getString():"string"==typeof e&&(i=e),i&&=z(i).replaceAll("\0",""),i&&t.push(i)}TA(A.getRaw("Next"),e,t,i)}a&&i.remove(a)}function PA(A,e,t){const i=Object.create(null),a=FA({dict:e,key:"AA",stopWhenFound:!1});if(a)for(let e=a.length-1;e>=0;e--){const s=a[e];if(s instanceof CA)for(const e of s.getKeys()){const a=t[e];if(!a)continue;const n=[];TA(s.getRaw(e),A,n,new hA),n.length>0&&(i[a]=n)}}if(e.has("A")){const t=[];TA(e.get("A"),A,t,new hA),t.length>0&&(i.Action=t)}return Z(i)>0?i:null}const WA={60:"<",62:">",38:"&",34:""",39:"'"};function*ZA(A){for(let e=0,t=A.length;e55295&&(t<57344||t>65533)&&e++,yield t}}function OA(A){const e=[];let t=0;for(let i=0,a=A.length;i55295&&(a<57344||a>65533)&&i++,t=i+1}return 0===e.length?A:(t: ${A}.`),!1;return!0}function VA(A){const e=new Set(["100","200","300","400","500","600","700","800","900","1000","normal","bold","bolder","lighter"]),{fontFamily:t,fontWeight:i,italicAngle:a}=A;if(!XA(t,!0))return!1;const s=i?i.toString():"";A.fontWeight=e.has(s)?s:"400";const n=parseFloat(a);return A.italicAngle=isNaN(n)||n<-90||n>90?"14":a.toString(),!0}function jA(A){const e=new RegExp("^\\s*("+["app.launchURL","window.open","xfa.host.gotoURL"].join("|").replaceAll(".","\\.")+")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))","i").exec(A);if(e?.[2]){const A=e[2];let t=!1;return"true"===e[3]&&"app.launchURL"===e[1]&&(t=!0),{url:A,newWindow:t}}return null}function zA(A){if(Number.isInteger(A))return A.toString();const e=Math.round(100*A);return e%100==0?(e/100).toString():e%10==0?A.toFixed(1):A.toFixed(2)}function _A(A){if(!A)return null;const e=new Map;for(const[t,i]of A){if(!t.startsWith(g))continue;let A=e.get(i.pageIndex);A||(A=[],e.set(i.pageIndex,A)),A.push(i)}return e.size>0?e:null}function $A(A){return function(A){return/^[\x00-\x7F]*$/.test(A)}(A)?A:ee(A,!0)}function Ae(A){const e=[];for(let t=0,i=A.length;t>8&255).toString(16).padStart(2,"0"),(255&i).toString(16).padStart(2,"0"))}return e.join("")}function ee(A,e=!1){const t=[];e&&t.push("þÿ");for(let e=0,i=A.length;e>8&255),String.fromCharCode(255&i))}return t.join("")}function te(A,e,t){switch(A){case 90:return[0,1,-1,0,e,0];case 180:return[-1,0,0,-1,e,t];case 270:return[0,-1,1,0,0,t];default:throw new Error("Invalid rotation")}}function ie(A){return Math.ceil(Math.ceil(Math.log2(1+A))/8)}class ae extends fA{constructor(A,e,t,i){super(),this.bytes=A instanceof Uint8Array?A:new Uint8Array(A),this.start=e||0,this.pos=this.start,this.end=e+t||this.bytes.length,this.dict=i}get length(){return this.end-this.start}get isEmpty(){return 0===this.length}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getBytes(A){const e=this.bytes,t=this.pos,i=this.end;if(!A)return e.subarray(t,i);let a=t+A;return a>i&&(a=i),this.pos=a,e.subarray(t,a)}getByteRange(A,e){return A<0&&(A=0),e>this.end&&(e=this.end),this.bytes.subarray(A,e)}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(A,e,t=null){return new ae(this.bytes.buffer,A,e,t)}}class se extends ae{constructor(A){super(P(A))}}class ne extends ae{constructor(){super(new Uint8Array(0))}}class ge extends ae{constructor(A,e,t){super(new Uint8Array(A),0,A,null),this.chunkSize=e,this._loadedChunks=new Set,this.numChunks=Math.ceil(A/e),this.manager=t,this.progressiveDataLength=0,this.lastSuccessfulEnsureByteChunk=-1}getMissingChunks(){const A=[];for(let e=0,t=this.numChunks;e=this.end?this.numChunks:Math.floor(e/this.chunkSize);for(let A=t;Athis.numChunks)&&e!==this.lastSuccessfulEnsureByteChunk){if(!this._loadedChunks.has(e))throw new yA(A,A+1);this.lastSuccessfulEnsureByteChunk=e}}ensureRange(A,e){if(A>=e)return;if(e<=this.progressiveDataLength)return;const t=Math.floor(A/this.chunkSize);if(t>this.numChunks)return;const i=Math.min(Math.floor((e-1)/this.chunkSize)+1,this.numChunks);for(let a=t;a=this.end?-1:(A>=this.progressiveDataLength&&this.ensureByte(A),this.bytes[this.pos++])}getBytes(A){const e=this.bytes,t=this.pos,i=this.end;if(!A)return i>this.progressiveDataLength&&this.ensureRange(t,i),e.subarray(t,i);let a=t+A;return a>i&&(a=i),a>this.progressiveDataLength&&this.ensureRange(t,a),this.pos=a,e.subarray(t,a)}getByteRange(A,e){return A<0&&(A=0),e>this.end&&(e=this.end),e>this.progressiveDataLength&&this.ensureRange(A,e),this.bytes.subarray(A,e)}makeSubStream(A,e,t=null){function i(){}e?A+e>this.progressiveDataLength&&this.ensureRange(A,A+e):A>=this.progressiveDataLength&&this.ensureByte(A),i.prototype=Object.create(this),i.prototype.getMissingChunks=function(){const A=this.chunkSize,e=Math.floor(this.start/A),t=Math.floor((this.end-1)/A)+1,i=[];for(let A=e;A{const s=({value:n,done:g})=>{try{if(g){const e=kA(i);return i=null,void A(e)}a+=n.byteLength,t.isStreamingSupported&&this.onProgress({loaded:a}),i.push(n),t.read().then(s,e)}catch(A){e(A)}};t.read().then(s,e)})).then((e=>{this.aborted||this.onReceiveData({chunk:e,begin:A})}))}requestAllChunks(A=!1){if(!A){const A=this.stream.getMissingChunks();this._requestChunks(A)}return this._loadedStreamCapability.promise}_requestChunks(A){const e=this.currRequestId++,t=new Set;this._chunksNeededByRequest.set(e,t);for(const e of A)this.stream.hasChunk(e)||t.add(e);if(0===t.size)return Promise.resolve();const i=Promise.withResolvers();this._promisesByRequest.set(e,i);const a=[];for(const A of t){let t=this._requestsByChunk.get(A);t||(t=[],this._requestsByChunk.set(A,t),a.push(A)),t.push(e)}if(a.length>0){const A=this.groupChunks(a);for(const e of A){const A=e.beginChunk*this.chunkSize,t=Math.min(e.endChunk*this.chunkSize,this.length);this.sendRequest(A,t).catch(i.reject)}}return i.promise.catch((A=>{if(!this.aborted)throw A}))}getStream(){return this.stream}requestRange(A,e){e=Math.min(e,this.length);const t=this.getBeginChunk(A),i=this.getEndChunk(e),a=[];for(let A=t;A=0&&i+1!==s&&(e.push({beginChunk:t,endChunk:i+1}),t=s),a+1===A.length&&e.push({beginChunk:t,endChunk:s+1}),i=s}return e}onProgress(A){this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize+A.loaded,total:this.length})}onReceiveData(A){const e=A.chunk,t=void 0===A.begin,i=t?this.progressiveDataLength:A.begin,a=i+e.byteLength,s=Math.floor(i/this.chunkSize),n=a0||g.push(t)}}}if(!this.disableAutoFetch&&0===this._requestsByChunk.size){let A;if(1===this.stream.numChunksLoaded){const e=this.stream.numChunks-1;this.stream.hasChunk(e)||(A=e)}else A=this.stream.nextEmptyChunk(n);Number.isInteger(A)&&this._requestChunks([A])}for(const A of g){const e=this._promisesByRequest.get(A);this._promisesByRequest.delete(A),e.resolve()}this.msgHandler.send("DocProgress",{loaded:this.stream.numChunksLoaded*this.chunkSize,total:this.length})}onError(A){this._loadedStreamCapability.reject(A)}getBeginChunk(A){return Math.floor(A/this.chunkSize)}getEndChunk(A){return Math.floor((A-1)/this.chunkSize)+1}abort(A){this.aborted=!0,this.pdfNetworkStream?.cancelAllRequests(A);for(const e of this._promisesByRequest.values())e.reject(A)}}class oe{constructor(A,e){this.name=A,this.numComps=e}getRgb(A,e){const t=new Uint8ClampedArray(3);return this.getRgbItem(A,e,t,0),t}getRgbItem(A,e,t,i){G("Should not call ColorSpace.getRgbItem")}getRgbBuffer(A,e,t,i,a,s,n){G("Should not call ColorSpace.getRgbBuffer")}getOutputLength(A,e){G("Should not call ColorSpace.getOutputLength")}isPassthrough(A){return!1}isDefaultDecode(A,e){return oe.isDefaultDecode(A,this.numComps)}fillRgb(A,e,t,i,a,s,n,g,r){const o=e*t;let I=null;const c=1<c&&"DeviceGray"!==this.name&&"DeviceRGB"!==this.name){const e=n<=8?new Uint8Array(c):new Uint16Array(c);for(let A=0;A=.99554525?1:this.#Q(0,1,1.055*A**(1/2.4)-.055)}#Q(A,e,t){return Math.max(A,Math.min(e,t))}#l(A){return A<0?-this.#l(-A):A>8?((A+16)/116)**3:A*ue.#I}#E(A,e,t){if(0===A[0]&&0===A[1]&&0===A[2])return t[0]=e[0],t[1]=e[1],void(t[2]=e[2]);const i=this.#l(0),a=(1-i)/(1-this.#l(A[0])),s=1-a,n=(1-i)/(1-this.#l(A[1])),g=1-n,r=(1-i)/(1-this.#l(A[2])),o=1-r;t[0]=e[0]*a+s,t[1]=e[1]*n+g,t[2]=e[2]*r+o}#u(A,e,t){if(1===A[0]&&1===A[2])return t[0]=e[0],t[1]=e[1],void(t[2]=e[2]);const i=t;this.#c(ue.#i,e,i);const a=ue.#g;this.#C(A,i,a),this.#c(ue.#a,a,t)}#d(A,e,t){const i=t;this.#c(ue.#i,e,i);const a=ue.#g;this.#B(A,i,a),this.#c(ue.#a,a,t)}#t(A,e,t,i,a){const s=this.#Q(0,1,A[e]*a),n=this.#Q(0,1,A[e+1]*a),g=this.#Q(0,1,A[e+2]*a),r=1===s?1:s**this.GR,o=1===n?1:n**this.GG,I=1===g?1:g**this.GB,c=this.MXA*r+this.MXB*o+this.MXC*I,C=this.MYA*r+this.MYB*o+this.MYC*I,B=this.MZA*r+this.MZB*o+this.MZC*I,h=ue.#r;h[0]=c,h[1]=C,h[2]=B;const Q=ue.#o;this.#u(this.whitePoint,h,Q);const l=ue.#r;this.#E(this.blackPoint,Q,l);const E=ue.#o;this.#d(ue.#n,l,E);const u=ue.#r;this.#c(ue.#s,E,u),t[i]=255*this.#h(u[0]),t[i+1]=255*this.#h(u[1]),t[i+2]=255*this.#h(u[2])}getRgbItem(A,e,t,i){this.#t(A,e,t,i,1)}getRgbBuffer(A,e,t,i,a,s,n){const g=1/((1<this.amax||this.bmin>this.bmax)&&(S("Invalid Range, falling back to defaults"),this.amin=-100,this.amax=100,this.bmin=-100,this.bmax=100)}#f(A){return A>=6/29?A**3:108/841*(A-4/29)}#p(A,e,t,i){return t+A*(i-t)/e}#t(A,e,t,i,a){let s=A[e],n=A[e+1],g=A[e+2];!1!==t&&(s=this.#p(s,t,0,100),n=this.#p(n,t,this.amin,this.amax),g=this.#p(g,t,this.bmin,this.bmax)),n>this.amax?n=this.amax:nthis.bmax?g=this.bmax:g>>0}function pe(A,e){return 1===e?String.fromCharCode(A[0],A[1]):3===e?String.fromCharCode(A[0],A[1],A[2],A[3]):String.fromCharCode(...A.subarray(0,e+1))}function me(A,e,t){let i=0;for(let a=t;a>=0;a--)i+=A[a]+e[a],A[a]=255&i,i>>=8}function ye(A,e){let t=1;for(let i=e;i>=0&&t>0;i--)t+=A[i],A[i]=255&t,t>>=8}const we=16;class De{constructor(A){this.buffer=A,this.pos=0,this.end=A.length,this.tmpBuf=new Uint8Array(19)}readByte(){return this.pos>=this.end?-1:this.buffer[this.pos++]}readNumber(){let A,e=0;do{const t=this.readByte();if(t<0)throw new K("unexpected EOF in bcmap");A=!(128&t),e=e<<7|127&t}while(!A);return e}readSigned(){const A=this.readNumber();return 1&A?~(A>>>1):A>>>1}readHex(A,e){A.set(this.buffer.subarray(this.pos,this.pos+e+1)),this.pos+=e+1}readHexNumber(A,e){let t;const i=this.tmpBuf;let a=0;do{const A=this.readByte();if(A<0)throw new K("unexpected EOF in bcmap");t=!(128&A),i[a++]=127&A}while(!t);let s=e,n=0,g=0;for(;s>=0;){for(;g<8&&i.length>0;)n|=i[--a]<>=8,g-=8}}readHexSigned(A,e){this.readHexNumber(A,e);const t=1&A[e]?255:0;let i=0;for(let a=0;a<=e;a++)i=(1&i)<<8|A[a],A[a]=i>>1^t}readString(){const A=this.readNumber(),e=new Array(A);for(let t=0;t=0;){const A=C>>5;if(7===A){switch(31&C){case 0:i.readString();break;case 1:s=i.readString()}continue}const t=!!(16&C),a=15&C;if(a+1>we)throw new Error("BinaryCMapReader.process: Invalid dataSize.");const B=1,h=i.readNumber();switch(A){case 0:i.readHex(n,a),i.readHexNumber(g,a),me(g,n,a),e.addCodespaceRange(a+1,fe(n,a),fe(g,a));for(let A=1;Aa&&(i=a)}else{for(;!this.eof;)this.readBlock(e);i=this.bufferLength}return this.pos=i,this.buffer.subarray(t,i)}async getImageData(A,e=null){if(!this.canAsyncDecodeImageFromBuffer)return this.getBytes(A,e);const t=await this.stream.asyncGetBytes();return this.decodeImage(t,e)}reset(){this.pos=0}makeSubStream(A,e,t=null){if(void 0===e)for(;!this.eof;)this.readBlock();else{const t=A+e;for(;this.bufferLength<=t&&!this.eof;)this.readBlock()}return new ae(this.buffer,A,e,t)}getBaseStreams(){return this.str?this.str.getBaseStreams():null}}class Se extends Fe{constructor(A,e=null){let t=0;for(const e of A)t+=e instanceof Fe?e._rawMinBufferLength:e.length;super(t),this.streams=A,this._onError=e}readBlock(){const A=this.streams;if(0===A.length)return void(this.eof=!0);const e=A.shift();let t;try{t=e.getBytes()}catch(A){if(this._onError)return void this._onError(A,e.dict?.objId);throw A}const i=this.bufferLength,a=i+t.length;this.ensureBuffer(a).set(t,i),this.bufferLength=a}getBaseStreams(){const A=[];for(const e of this.streams){const t=e.getBaseStreams();t&&A.push(...t)}return A.length>0?A:null}}class Re extends Fe{constructor(A,e){e&&(e*=.8),super(e),this.str=A,this.dict=A.dict,this.input=new Uint8Array(5)}readBlock(){const A=this.str;let e=A.getByte();for(;MA(e);)e=A.getByte();if(-1===e||126===e)return void(this.eof=!0);const t=this.bufferLength;let i,a;if(122===e){for(i=this.ensureBuffer(t+4),a=0;a<4;++a)i[t+a]=0;this.bufferLength+=4}else{const s=this.input;for(s[0]=e,a=1;a<5;++a){for(e=A.getByte();MA(e);)e=A.getByte();if(s[a]=e,-1===e||126===e)break}if(i=this.ensureBuffer(t+a-1),this.bufferLength+=a-1,a<5){for(;a<5;++a)s[a]=117;this.eof=!0}let n=0;for(a=0;a<5;++a)n=85*n+(s[a]-33);for(a=3;a>=0;--a)i[t+a]=255&n,n>>=8}}}class Ge extends Fe{constructor(A,e){e&&(e*=.5),super(e),this.str=A,this.dict=A.dict,this.firstDigit=-1}readBlock(){const A=this.str.getBytes(8e3);if(!A.length)return void(this.eof=!0);const e=A.length+1>>1,t=this.ensureBuffer(this.bufferLength+e);let i=this.bufferLength,a=this.firstDigit;for(const e of A){let A;if(e>=48&&e<=57)A=15&e;else{if(!(e>=65&&e<=70||e>=97&&e<=102)){if(62===e){this.eof=!0;break}continue}A=9+(15&e)}a<0?a=A:(t[i++]=a<<4|A,a=-1)}a>=0&&this.eof&&(t[i++]=a<<4,a=-1),this.firstDigit=a,this.bufferLength=i}}const Ne=-1,xe=[[-1,-1],[-1,-1],[7,8],[7,7],[6,6],[6,6],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]],Ue=[[-1,-1],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],Me=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]],Le=[[-1,-1],[-1,-1],[12,-2],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],Je=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],He=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];class Ye{constructor(A,e={}){if(!A||"function"!=typeof A.next)throw new Error('CCITTFaxDecoder - invalid "source" parameter.');let t;for(this.source=A,this.eof=!1,this.encoding=e.K||0,this.eoline=e.EndOfLine||!1,this.byteAlign=e.EncodedByteAlign||!1,this.columns=e.Columns||1728,this.rows=e.Rows||0,this.eoblock=e.EndOfBlock??!0,this.black=e.BlackIs1||!1,this.codingLine=new Uint32Array(this.columns+1),this.refLine=new Uint32Array(this.columns+2),this.codingLine[0]=this.columns,this.codingPos=0,this.row=0,this.nextLine2D=this.encoding<0,this.inputBits=0,this.inputBuf=0,this.outputBits=0,this.rowsDone=!1;0===(t=this._lookBits(12));)this._eatBits(1);1===t&&this._eatBits(12),this.encoding>0&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1))}readNextChar(){if(this.eof)return-1;const A=this.refLine,e=this.codingLine,t=this.columns;let i,a,s,n,g;if(0===this.outputBits){if(this.rowsDone&&(this.eof=!0),this.eof)return-1;let s,g,r;if(this.err=!1,this.nextLine2D){for(n=0;e[n]=64);do{g+=r=this._getWhiteCode()}while(r>=64)}else{do{s+=r=this._getWhiteCode()}while(r>=64);do{g+=r=this._getBlackCode()}while(r>=64)}for(this._addPixels(e[this.codingPos]+s,a),e[this.codingPos]0?--i:++i;A[i]<=e[this.codingPos]&&A[i]0?--i:++i;A[i]<=e[this.codingPos]&&A[i]0?--i:++i;A[i]<=e[this.codingPos]&&A[i]=64);else do{s+=r=this._getWhiteCode()}while(r>=64);this._addPixels(e[this.codingPos]+s,a),a^=1}let o=!1;if(this.byteAlign&&(this.inputBits&=-8),this.eoblock||this.row!==this.rows-1){if(s=this._lookBits(12),this.eoline)for(;s!==Ne&&1!==s;)this._eatBits(1),s=this._lookBits(12);else for(;0===s;)this._eatBits(1),s=this._lookBits(12);1===s?(this._eatBits(12),o=!0):s===Ne&&(this.eof=!0)}else this.rowsDone=!0;if(!this.eof&&this.encoding>0&&!this.rowsDone&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1)),this.eoblock&&o&&this.byteAlign){if(s=this._lookBits(12),1===s){if(this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1)),this.encoding>=0)for(n=0;n<4;++n)s=this._lookBits(12),1!==s&&S("bad rtc code: "+s),this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1));this.eof=!0}}else if(this.err&&this.eoline){for(;;){if(s=this._lookBits(13),s===Ne)return this.eof=!0,-1;if(s>>1==1)break;this._eatBits(1)}this._eatBits(12),this.encoding>0&&(this._eatBits(1),this.nextLine2D=!(1&s))}this.outputBits=e[0]>0?e[this.codingPos=0]:e[this.codingPos=1],this.row++}if(this.outputBits>=8)g=1&this.codingPos?0:255,this.outputBits-=8,0===this.outputBits&&e[this.codingPos]s?(g<<=s,1&this.codingPos||(g|=255>>8-s),this.outputBits-=s,s=0):(g<<=this.outputBits,1&this.codingPos||(g|=255>>8-this.outputBits),s-=this.outputBits,this.outputBits=0,e[this.codingPos]0&&(g<<=s,s=0))}while(s)}return this.black&&(g^=255),g}_addPixels(A,e){const t=this.codingLine;let i=this.codingPos;A>t[i]&&(A>this.columns&&(S("row is wrong length"),this.err=!0,A=this.columns),1&i^e&&++i,t[i]=A),this.codingPos=i}_addPixelsNeg(A,e){const t=this.codingLine;let i=this.codingPos;if(A>t[i])A>this.columns&&(S("row is wrong length"),this.err=!0,A=this.columns),1&i^e&&++i,t[i]=A;else if(A0&&A=a){const e=t[A-a];if(e[0]===i)return this._eatBits(i),[!0,e[1],!0]}}return[!1,0,!1]}_getTwoDimCode(){let A,e=0;if(this.eoblock){if(e=this._lookBits(7),A=xe[e],A?.[0]>0)return this._eatBits(A[0]),A[1]}else{const A=this._findTableCode(1,7,xe);if(A[0]&&A[2])return A[1]}return S("Bad two dim code"),Ne}_getWhiteCode(){let A,e=0;if(this.eoblock){if(e=this._lookBits(12),e===Ne)return 1;if(A=e>>5?Me[e>>3]:Ue[e],A[0]>0)return this._eatBits(A[0]),A[1]}else{let A=this._findTableCode(1,9,Me);if(A[0])return A[1];if(A=this._findTableCode(11,12,Ue),A[0])return A[1]}return S("bad white code"),this._eatBits(1),1}_getBlackCode(){let A,e;if(this.eoblock){if(A=this._lookBits(13),A===Ne)return 1;if(e=A>>7?!(A>>9)&&A>>7?Je[(A>>1)-64]:He[A>>7]:Le[A],e[0]>0)return this._eatBits(e[0]),e[1]}else{let A=this._findTableCode(2,6,He);if(A[0])return A[1];if(A=this._findTableCode(7,12,Je,64),A[0])return A[1];if(A=this._findTableCode(10,13,Le),A[0])return A[1]}return S("bad black code"),this._eatBits(1),1}_lookBits(A){let e;for(;this.inputBits>16-A;this.inputBuf=this.inputBuf<<8|e,this.inputBits+=8}return this.inputBuf>>this.inputBits-A&65535>>16-A}_eatBits(A){(this.inputBits-=A)<0&&(this.inputBits=0)}}class ve extends Fe{constructor(A,e,t){super(e),this.str=A,this.dict=A.dict,t instanceof CA||(t=CA.empty);const i={next:()=>A.getByte()};this.ccittFaxDecoder=new Ye(i,{K:t.get("K"),EndOfLine:t.get("EndOfLine"),EncodedByteAlign:t.get("EncodedByteAlign"),Columns:t.get("Columns"),Rows:t.get("Rows"),EndOfBlock:t.get("EndOfBlock"),BlackIs1:t.get("BlackIs1")})}readBlock(){for(;!this.eof;){const A=this.ccittFaxDecoder.readNextChar();if(-1===A)return void(this.eof=!0);this.ensureBuffer(this.bufferLength+1),this.buffer[this.bufferLength++]=A}}}const Ke=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qe=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),Te=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),Pe=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],We=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];class Ze extends Fe{constructor(A,e){super(e),this.str=A,this.dict=A.dict;const t=A.getByte(),i=A.getByte();if(-1===t||-1===i)throw new K(`Invalid header in flate stream: ${t}, ${i}`);if(8!=(15&t))throw new K(`Unknown compression method in flate stream: ${t}, ${i}`);if(((t<<8)+i)%31!=0)throw new K(`Bad FCHECK in flate stream: ${t}, ${i}`);if(32&i)throw new K(`FDICT bit set in flate stream: ${t}, ${i}`);this.codeSize=0,this.codeBuf=0}async getImageData(A,e){const t=await this.asyncGetBytes();return t?.subarray(0,A)||this.getBytes(A)}async asyncGetBytes(){this.str.reset();const A=this.str.getBytes();try{const{readable:e,writable:t}=new DecompressionStream("deflate"),i=t.getWriter();i.write(A),i.close();const a=[];let s=0;for await(const A of e)a.push(A),s+=A.byteLength;const n=new Uint8Array(s);let g=0;for(const A of a)n.set(A,g),g+=A.byteLength;return n}catch{return this.str=new ae(A,2,A.length,this.str.dict),this.reset(),null}}get isAsync(){return!0}getBits(A){const e=this.str;let t,i=this.codeSize,a=this.codeBuf;for(;i>A,this.codeSize=i-=A,t}getCode(A){const e=this.str,t=A[0],i=A[1];let a,s=this.codeSize,n=this.codeBuf;for(;s>16,o=65535&g;if(r<1||s>r,this.codeSize=s-r,o}generateHuffmanTable(A){const e=A.length;let t,i=0;for(t=0;ti&&(i=A[t]);const a=1<>=1;for(t=A;t>=1,0===e){let e;if(-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");let t=e;if(-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");if(t|=e<<8,-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");let a=e;if(-1===(e=i.getByte()))return void this.#m("Bad block header in flate stream");if(a|=e<<8,a!==(65535&~t)&&(0!==t||0!==a))throw new K("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;const s=this.bufferLength,n=s+t;if(A=this.ensureBuffer(n),this.bufferLength=n,0===t)-1===i.peekByte()&&(this.eof=!0);else{const e=i.getBytes(t);A.set(e,s),e.length0;)I[g++]=B}a=this.generateHuffmanTable(I.subarray(0,A)),s=this.generateHuffmanTable(I.subarray(A,o))}}A=this.buffer;let n=A?A.length:0,g=this.bufferLength;for(;;){let e=this.getCode(a);if(e<256){g+1>=n&&(A=this.ensureBuffer(g+1),n=A.length),A[g++]=e;continue}if(256===e)return void(this.bufferLength=g);e-=257,e=qe[e];let i=e>>16;i>0&&(i=this.getBits(i)),t=(65535&e)+i,e=this.getCode(s),e=Te[e],i=e>>16,i>0&&(i=this.getBits(i));const r=(65535&e)+i;g+t>=n&&(A=this.ensureBuffer(g+t),n=A.length);for(let e=0;e>9&127,this.clow=this.clow<<7&65535,this.ct-=7,this.a=32768}byteIn(){const A=this.data;let e=this.bp;255===A[e]?A[e+1]>143?(this.clow+=65280,this.ct=8):(e++,this.clow+=A[e]<<9,this.ct=7,this.bp=e):(e++,this.clow+=e65535&&(this.chigh+=this.clow>>16,this.clow&=65535)}readBit(A,e){let t=A[e]>>1,i=1&A[e];const a=Oe[t],s=a.qe;let n,g=this.a-s;if(this.chigh>15&1,this.clow=this.clow<<1&65535,this.ct--}while(!(32768&g));return this.a=g,A[e]=t<<1|i,n}}class Ve extends M{constructor(A){super(A,"Jbig2Error")}}class je{getContexts(A){return A in this?this[A]:this[A]=new Int8Array(65536)}}class ze{constructor(A,e,t){this.data=A,this.start=e,this.end=t}get decoder(){return U(this,"decoder",new Xe(this.data,this.start,this.end))}get contextCache(){return U(this,"contextCache",new je)}}function _e(A,e,t){const i=A.getContexts(e);let a=1;function s(A){let e=0;for(let s=0;s>>0}const n=s(1),g=s(1)?s(1)?s(1)?s(1)?s(1)?s(32)+4436:s(12)+340:s(8)+84:s(6)+20:s(4)+4:s(2);let r;return 0===n?r=g:g>0&&(r=-g),r>=-2147483648&&r<=2147483647?r:null}function $e(A,e,t){const i=A.getContexts("IAID");let a=1;for(let A=0;A=w&&N=D)for(H=H<<1&l,Q=0;Q=0&&U=0&&(M=S[x][U],M&&(H|=M<=A?o<<=1:o=o<<1|p[g][r];for(B=0;B=d||r<0||r>=u?o<<=1:o=o<<1|i[g][r];const h=m.readBit(y,o);e[n]=h}}return p}function gt(A,e,t,i,a,s,n,g,r,o,I,c,C,B,h,Q,l,E,u){if(A&&e)throw new Ve("refinement with Huffman is not supported");const d=[];let f,p;for(f=0;f1&&(a=A?u.readBits(E):_e(y,"IAIT",m));const s=n*w+a,D=A?B.symbolIDTable.decode(u):$e(y,m,r),b=e&&(A?u.readBit():_e(y,"IARI",m));let k=g[D],F=k[0].length,S=k.length;if(b){const A=_e(y,"IARDW",m),e=_e(y,"IARDH",m);F+=A,S+=e,k=nt(F,S,h,k,(A>>1)+_e(y,"IARDX",m),(e>>1)+_e(y,"IARDY",m),!1,Q,l)}let R=0;o?1&c?R=S-1:i+=S-1:c>1?i+=F-1:R=F-1;const G=s-(1&c?0:S-1),N=i-(2&c?F-1:0);let x,U,M;if(o)for(x=0;x>5&7;const r=[31&n];let o=e+6;if(7===n){g=536870911&UA(A,o-1),o+=3;let e=g+7>>3;for(r[0]=A[o++];--e>0;)r.push(A[o++])}else if(5===n||6===n)throw new Ve("invalid referred-to flags");t.retainBits=r;let I=4;t.number<=256?I=1:t.number<=65536&&(I=2);const c=[];let C,B;for(C=0;C>>24&255,s[3]=e.height>>16&255,s[4]=e.height>>8&255,s[5]=255&e.height,C=o,B=A.length;C>2&3,A.huffmanDWSelector=e>>4&3,A.bitmapSizeSelector=e>>6&1,A.aggregationInstancesSelector=e>>7&1,A.bitmapCodingContextUsed=!!(256&e),A.bitmapCodingContextRetained=!!(512&e),A.template=e>>10&3,A.refinementTemplate=e>>12&1,o+=2,!A.huffman){for(r=0===A.template?4:1,n=[],g=0;g>2&3,I.stripSize=1<>4&3,I.transposed=!!(64&c),I.combinationOperator=c>>7&3,I.defaultPixelValue=c>>9&1,I.dsOffset=c<<17>>27,I.refinementTemplate=c>>15&1,I.huffman){const A=xA(i,o);o+=2,I.huffmanFS=3&A,I.huffmanDS=A>>2&3,I.huffmanDT=A>>4&3,I.huffmanRefinementDW=A>>6&3,I.huffmanRefinementDH=A>>8&3,I.huffmanRefinementDX=A>>10&3,I.huffmanRefinementDY=A>>12&3,I.huffmanRefinementSizeSelector=!!(16384&A)}if(I.refinement&&!I.refinementTemplate){for(n=[],g=0;g<2;g++)n.push({x:NA(i,o),y:NA(i,o+1)}),o+=2;I.refinementAt=n}I.numberOfSymbolInstances=UA(i,o),o+=4,s=[I,t.referredTo,i,o,a];break;case 16:const C={},B=i[o++];C.mmr=!!(1&B),C.template=B>>1&3,C.patternWidth=i[o++],C.patternHeight=i[o++],C.maxPatternIndex=UA(i,o),o+=4,s=[C,t.number,i,o,a];break;case 22:case 23:const h={};h.info=It(i,o),o+=ct;const Q=i[o++];h.mmr=!!(1&Q),h.template=Q>>1&3,h.enableSkip=!!(8&Q),h.combinationOperator=Q>>4&7,h.defaultPixelValue=Q>>7&1,h.gridWidth=UA(i,o),o+=4,h.gridHeight=UA(i,o),o+=4,h.gridOffsetX=4294967295&UA(i,o),o+=4,h.gridOffsetY=4294967295&UA(i,o),o+=4,h.gridVectorX=xA(i,o),o+=2,h.gridVectorY=xA(i,o),o+=2,s=[h,t.referredTo,i,o,a];break;case 38:case 39:const l={};l.info=It(i,o),o+=ct;const E=i[o++];if(l.mmr=!!(1&E),l.template=E>>1&3,l.prediction=!!(8&E),!l.mmr){for(r=0===l.template?4:1,n=[],g=0;g>2&1,u.combinationOperator=d>>3&3,u.requiresBuffer=!!(32&d),u.combinationOperatorOverride=!!(64&d),s=[u];break;case 49:case 50:case 51:case 62:break;case 53:s=[t.number,i,o,a];break;default:throw new Ve(`segment type ${t.typeName}(${t.type}) is not implemented`)}const I="on"+t.typeName;I in e&&e[I].apply(e,s)}function Bt(A,e){for(let t=0,i=A.length;t>3,t=new Uint8ClampedArray(e*A.height);A.defaultPixelValue&&t.fill(255),this.buffer=t}drawBitmap(A,e){const t=this.currentPageInfo,i=A.width,a=A.height,s=t.width+7>>3,n=t.combinationOperatorOverride?A.combinationOperator:t.combinationOperator,g=this.buffer,r=128>>(7&A.x);let o,I,c,C,B=A.y*s+(A.x>>3);switch(n){case 0:for(o=0;o>=1,c||(c=128,C++);B+=s}break;case 2:for(o=0;o>=1,c||(c=128,C++);B+=s}break;default:throw new Ve(`operator ${n} is not supported`)}}onImmediateGenericRegion(A,e,t,i){const a=A.info,s=new ze(e,t,i),n=st(A.mmr,a.width,a.height,A.template,A.prediction,null,A.at,s);this.drawBitmap(a,n)}onImmediateLosslessGenericRegion(){this.onImmediateGenericRegion(...arguments)}onSymbolDictionary(A,e,t,i,a,s){let n,g;A.huffman&&(n=function(A,e,t){let i,a,s,n,g=0;switch(A.huffmanDHSelector){case 0:case 1:i=dt(A.huffmanDHSelector+4);break;case 3:i=pt(g,e,t),g++;break;default:throw new Ve("invalid Huffman DH selector")}switch(A.huffmanDWSelector){case 0:case 1:a=dt(A.huffmanDWSelector+2);break;case 3:a=pt(g,e,t),g++;break;default:throw new Ve("invalid Huffman DW selector")}return A.bitmapSizeSelector?(s=pt(g,e,t),g++):s=dt(1),n=A.aggregationInstancesSelector?pt(g,e,t):dt(1),{tableDeltaHeight:i,tableDeltaWidth:a,tableBitmapSize:s,tableAggregateInstances:n}}(A,t,this.customTables),g=new ft(i,a,s));let r=this.symbols;r||(this.symbols=r={});const o=[];for(const A of t){const e=r[A];e&&o.push(...e)}const I=new ze(i,a,s);r[e]=function(A,e,t,i,a,s,n,g,r,o,I,c){if(A&&e)throw new Ve("symbol refinement with Huffman is not supported");const C=[];let B=0,h=GA(t.length+i);const Q=I.decoder,l=I.contextCache;let E,u;for(A&&(E=dt(1),u=[],h=Math.max(h,1));C.length1)d=gt(A,e,i,B,0,a,1,t.concat(C),h,0,0,1,0,s,r,o,I,0,c);else{const A=$e(l,Q,h),e=_e(l,"IARDX",Q),a=_e(l,"IARDY",Q);d=nt(i,B,r,A=32){let t,i,n;switch(e){case 32:if(0===A)throw new Ve("no previous value in symbol ID table");i=a.readBits(2)+3,t=s[A-1].prefixLength;break;case 33:i=a.readBits(3)+3,t=0;break;case 34:i=a.readBits(7)+11,t=0;break;default:throw new Ve("invalid code length in symbol ID table")}for(n=0;n=0;l--)k=A?yt(b,r,o,!0):st(!1,r,o,t,!1,null,w,h),D[l]=k;for(F=0;F=0;E--)R^=D[E][F][S],G|=R<>8,U=c+F*C-S*B>>8,x>=0&&x+p<=i&&U>=0&&U+m<=a)for(l=0;l=a))for(L=Q[e],M=N[l],E=0;E=0&&A>1&7),r=1+(i>>4&7),o=[];let I,c,C=a;do{I=n.readBits(g),c=n.readBits(r),o.push(new Qt([C,I,c,0])),C+=1<>e&1;if(e<=0)this.children[t]=new lt(A);else{let i=this.children[t];i||(this.children[t]=i=new lt(null)),i.buildTree(A,e-1)}}decodeNode(A){if(this.isLeaf){if(this.isOOB)return null;const e=A.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-e:e)}const e=this.children[A.readBit()];if(!e)throw new Ve("invalid Huffman data");return e.decodeNode(A)}}class Et{constructor(A,e){e||this.assignPrefixCodes(A),this.rootNode=new lt(null);for(let e=0,t=A.length;e0&&this.rootNode.buildTree(t,t.prefixLength-1)}}decode(A){return this.rootNode.decodeNode(A)}assignPrefixCodes(A){const e=A.length;let t=0;for(let i=0;i=this.end)throw new Ve("end of data while reading bit");this.currentByte=this.data[this.position++],this.shift=7}const A=this.currentByte>>this.shift&1;return this.shift--,A}readBits(A){let e,t=0;for(e=A-1;e>=0;e--)t|=this.readBit()<=this.end?-1:this.data[this.position++]}}function pt(A,e,t){let i=0;for(let a=0,s=e.length;a>t&1,t--}if(i&&!g){const A=5;for(let e=0;e>3,c=7&i,C=A.length;t=new Uint32Array(t.buffer);let B=0;for(let i=0;i0&&!A[s-1];)s--;const n=[{children:[],index:0}];let g,r=n[0];for(t=0;t0;)r=n.pop();for(r.index++,n.push(r);n.length<=t;)n.push(g={children:[],index:0}),r.children[r.index]=g.children,r=g;a++}t+10)return h--,B>>h&1;if(B=A[e++],255===B){const i=A[e++];if(i){if(220===i&&o){const i=xA(A,e+=2);if(e+=2,i>0&&i!==t.scanLines)throw new Ft("Found DNL marker (0xFFDC) while parsing scan data",i)}else if(217===i){if(o){const A=m*(8===t.precision?8:0);if(A>0&&Math.round(t.scanLines/A)>=5)throw new Ft("Found EOI marker (0xFFD9) while parsing scan data, possibly caused by incorrect `scanLines` parameter",A)}throw new St("Found EOI marker (0xFFD9) while parsing scan data")}throw new kt(`unexpected marker ${(B<<8|i).toString(16)}`)}}return h=7,B>>>7}function l(A){let e=A;for(;;){switch(e=e[Q()],typeof e){case"number":return e;case"object":continue}throw new kt("invalid huffman sequence")}}function E(A){let e=0;for(;A>0;)e=e<<1|Q(),A--;return e}function u(A){if(1===A)return 1===Q()?1:-1;const e=E(A);return e>=1<0)return void f--;let t=s;const i=n;for(;t<=i;){const i=l(A.huffmanTableAC),a=15&i,s=i>>4;if(0===a){if(s<15){f=E(s)+(1<>4,0===a)o<15?(f=E(o)+(1<>4;if(0===i){if(s<15)break;a+=16;continue}a+=s;const n=Rt[a];A.blockData[e+n]=u(i),a++}};let x,U=0;const M=1===D?i[0].blocksPerLine*i[0].blocksPerColumn:I*t.mcusPerColumn;let L,J;for(;U<=M;){const t=a?Math.min(M-U,a):M;if(t>0){for(k=0;k0?"unexpected":"excessive"} MCU data, current marker is: ${x.invalid}`),e=x.offset),!(x.marker>=65488&&x.marker<=65495))break;e+=2}return e-C}function qt(A,e,t){const i=A.quantizationTable,a=A.blockData;let s,n,g,r,o,I,c,C,B,h,Q,l,E,u,d,f,p;if(!i)throw new kt("missing required Quantization Table.");for(let A=0;A<64;A+=8)B=a[e+A],h=a[e+A+1],Q=a[e+A+2],l=a[e+A+3],E=a[e+A+4],u=a[e+A+5],d=a[e+A+6],f=a[e+A+7],B*=i[A],h|Q|l|E|u|d|f?(h*=i[A+1],Q*=i[A+2],l*=i[A+3],E*=i[A+4],u*=i[A+5],d*=i[A+6],f*=i[A+7],s=Jt*B+128>>8,n=Jt*E+128>>8,g=Q,r=d,o=Ht*(h-f)+128>>8,C=Ht*(h+f)+128>>8,I=l<<4,c=u<<4,s=s+n+1>>1,n=s-n,p=g*Lt+r*Mt+128>>8,g=g*Mt-r*Lt+128>>8,r=p,o=o+c+1>>1,c=o-c,C=C+I+1>>1,I=C-I,s=s+r+1>>1,r=s-r,n=n+g+1>>1,g=n-g,p=o*Ut+C*xt+2048>>12,o=o*xt-C*Ut+2048>>12,C=p,p=I*Nt+c*Gt+2048>>12,I=I*Gt-c*Nt+2048>>12,c=p,t[A]=s+C,t[A+7]=s-C,t[A+1]=n+c,t[A+6]=n-c,t[A+2]=g+I,t[A+5]=g-I,t[A+3]=r+o,t[A+4]=r-o):(p=Jt*B+512>>10,t[A]=p,t[A+1]=p,t[A+2]=p,t[A+3]=p,t[A+4]=p,t[A+5]=p,t[A+6]=p,t[A+7]=p);for(let A=0;A<8;++A)B=t[A],h=t[A+8],Q=t[A+16],l=t[A+24],E=t[A+32],u=t[A+40],d=t[A+48],f=t[A+56],h|Q|l|E|u|d|f?(s=Jt*B+2048>>12,n=Jt*E+2048>>12,g=Q,r=d,o=Ht*(h-f)+2048>>12,C=Ht*(h+f)+2048>>12,I=l,c=u,s=4112+(s+n+1>>1),n=s-n,p=g*Lt+r*Mt+2048>>12,g=g*Mt-r*Lt+2048>>12,r=p,o=o+c+1>>1,c=o-c,C=C+I+1>>1,I=C-I,s=s+r+1>>1,r=s-r,n=n+g+1>>1,g=n-g,p=o*Ut+C*xt+2048>>12,o=o*xt-C*Ut+2048>>12,C=p,p=I*Nt+c*Gt+2048>>12,I=I*Gt-c*Nt+2048>>12,c=p,B=s+C,f=s-C,h=n+c,d=n-c,Q=g+I,u=g-I,l=r+o,E=r-o,B<16?B=0:B>=4080?B=255:B>>=4,h<16?h=0:h>=4080?h=255:h>>=4,Q<16?Q=0:Q>=4080?Q=255:Q>>=4,l<16?l=0:l>=4080?l=255:l>>=4,E<16?E=0:E>=4080?E=255:E>>=4,u<16?u=0:u>=4080?u=255:u>>=4,d<16?d=0:d>=4080?d=255:d>>=4,f<16?f=0:f>=4080?f=255:f>>=4,a[e+A]=B,a[e+A+8]=h,a[e+A+16]=Q,a[e+A+24]=l,a[e+A+32]=E,a[e+A+40]=u,a[e+A+48]=d,a[e+A+56]=f):(p=Jt*B+8192>>14,p=p<-2040?0:p>=2024?255:p+2056>>4,a[e+A]=p,a[e+A+8]=p,a[e+A+16]=p,a[e+A+24]=p,a[e+A+32]=p,a[e+A+40]=p,a[e+A+48]=p,a[e+A+56]=p)}function Tt(A,e){const t=e.blocksPerLine,i=e.blocksPerColumn,a=new Int16Array(64);for(let A=0;A=i)return null;const s=xA(A,e);if(s>=65472&&s<=65534)return{invalid:null,marker:s,offset:e};let n=xA(A,a);for(;!(n>=65472&&n<=65534);){if(++a>=i)return null;n=xA(A,a)}return{invalid:s.toString(16),marker:n,offset:a}}class Wt{constructor({decodeTransform:A=null,colorTransform:e=-1}={}){this._decodeTransform=A,this._colorTransform=e}parse(A,{dnlScanLines:e=null}={}){function t(){const e=xA(A,n);n+=2;let t=n+e-2;const i=Pt(A,t,n);i?.invalid&&(R("readDataBlock - incorrect length, current marker is: "+i.invalid),t=i.offset);const a=A.subarray(n,t);return n+=a.length,a}function i(A){const e=Math.ceil(A.samplesPerLine/8/A.maxH),t=Math.ceil(A.scanLines/8/A.maxV);for(const i of A.components){const a=Math.ceil(Math.ceil(A.samplesPerLine/8)*i.h/A.maxH),s=Math.ceil(Math.ceil(A.scanLines/8)*i.v/A.maxV),n=e*i.h,g=t*i.v*64*(n+1);i.blockData=new Int16Array(g),i.blocksPerLine=a,i.blocksPerColumn=s}A.mcusPerLine=e,A.mcusPerColumn=t}let a,s,n=0,g=null,r=null,o=0;const I=[],c=[],C=[];let B=xA(A,n);if(n+=2,65496!==B)throw new kt("SOI not found");B=xA(A,n),n+=2;A:for(;65497!==B;){let h,Q,l;switch(B){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:const E=t();65504===B&&74===E[0]&&70===E[1]&&73===E[2]&&70===E[3]&&0===E[4]&&(g={version:{major:E[5],minor:E[6]},densityUnits:E[7],xDensity:E[8]<<8|E[9],yDensity:E[10]<<8|E[11],thumbWidth:E[12],thumbHeight:E[13],thumbData:E.subarray(14,14+3*E[12]*E[13])}),65518===B&&65===E[0]&&100===E[1]&&111===E[2]&&98===E[3]&&101===E[4]&&(r={version:E[5]<<8|E[6],flags0:E[7]<<8|E[8],flags1:E[9]<<8|E[10],transformCode:E[11]});break;case 65499:const u=xA(A,n);n+=2;const d=u+n-2;let f;for(;n>4){if(e>>4!=1)throw new kt("DQT - invalid table spec");for(Q=0;Q<64;Q++)f=Rt[Q],t[f]=xA(A,n),n+=2}else for(Q=0;Q<64;Q++)f=Rt[Q],t[f]=A[n++];I[15&e]=t}break;case 65472:case 65473:case 65474:if(a)throw new kt("Only single frame JPEGs supported");n+=2,a={},a.extended=65473===B,a.progressive=65474===B,a.precision=A[n++];const p=xA(A,n);n+=2,a.scanLines=e||p,a.samplesPerLine=xA(A,n),n+=2,a.components=[],a.componentIds={};const m=A[n++];let y=0,w=0;for(h=0;h>4,i=15&A[n+1];y>4?c:C)[15&e]=Yt(t,a)}break;case 65501:n+=2,s=xA(A,n),n+=2;break;case 65498:const b=1==++o&&!e;n+=2;const k=A[n++],F=[];for(h=0;h>4],i.huffmanTableAC=c[15&s],F.push(i)}const S=A[n++],G=A[n++],N=A[n++];try{const e=Kt(A,n,a,F,s,S,G,N>>4,15&N,b);n+=e}catch(e){if(e instanceof Ft)return R(`${e.message} -- attempting to re-parse the JPEG image.`),this.parse(A,{dnlScanLines:e.scanLines});if(e instanceof St){R(`${e.message} -- ignoring the rest of the image data.`);break A}throw e}break;case 65500:n+=4;break;case 65535:255!==A[n]&&n--;break;default:const x=Pt(A,n-2,n-3);if(x?.invalid){R("JpegImage.parse - unexpected data, current marker is: "+x.invalid),n=x.offset;break}if(!x||n>=A.length-1){R("JpegImage.parse - reached the end of the image data without finding an EOI marker (0xFFD9).");break A}throw new kt("JpegImage.parse - unknown marker: "+B.toString(16))}B=xA(A,n),n+=2}if(!a)throw new kt("JpegImage.parse - no frame data found.");this.width=a.samplesPerLine,this.height=a.scanLines,this.jfif=g,this.adobe=r,this.components=[];for(const A of a.components){const e=I[A.quantizationId];e&&(A.quantizationTable=e),this.components.push({index:A.index,output:Tt(0,A),scaleX:A.h/a.maxH,scaleY:A.v/a.maxV,blocksPerLine:A.blocksPerLine,blocksPerColumn:A.blocksPerColumn})}this.numComponents=this.components.length}_getLinearizedBlockData(A,e,t=!1){const i=this.width/A,a=this.height/e;let s,n,g,r,o,I,c,C,B,h,Q,l=0;const E=this.components.length,u=A*e*E,d=new Uint8ClampedArray(u),f=new Uint32Array(A),p=4294967288;let m;for(c=0;c>8)+y[B+1];return d}get _isColorConversionNeeded(){return this.adobe?!!this.adobe.transformCode:3===this.numComponents?0!==this._colorTransform&&(82!==this.components[0].index||71!==this.components[1].index||66!==this.components[2].index):1===this._colorTransform}_convertYccToRgb(A){let e,t,i;for(let a=0,s=A.length;a4)throw new kt("Unsupported color mode");const s=this._getLinearizedBlockData(A,e,a);if(1===this.numComponents&&(t||i)){const A=s.length*(t?4:3),e=new Uint8ClampedArray(A);let i=0;if(t)!function(A,e){if(O.isLittleEndian)for(let t=0,i=A.length;t0&&(A=A.subarray(e));break}const e={decodeTransform:void 0,colorTransform:void 0},t=this.dict.getArray("D","Decode");if((this.forceRGBA||this.forceRGB)&&Array.isArray(t)){const A=this.dict.get("BPC","BitsPerComponent")||8,i=t.length,a=new Int32Array(i);let s=!1;const n=(1<{e=A,t=i})),i.decode=function(A,{numComponents:e=4,isIndexedColormap:t=!1,smaskInData:a=!1}){const s=A.length,n=i._malloc(s);i.HEAPU8.set(A,n);const g=i._jp2_decode(n,s,e>0?e:0,!!t,!!a);if(i._free(n),g){const{errorMessages:A}=i;return A?(delete i.errorMessages,A):"Unknown error"}const{imageData:r}=i;return i.imageData=null,r};var a=Object.assign({},i),s="./this.program",n="";"undefined"!=typeof document&&document.currentScript&&(n=document.currentScript.src),Ot&&(n=Ot),n=n.startsWith("blob:")?"":n.substr(0,n.replace(/[?#].*/,"").lastIndexOf("/")+1);var g,r,o,I,c,C=i.print||console.log.bind(console),B=i.printErr||console.error.bind(console);function h(){var A=r.buffer;i.HEAP8=o=new Int8Array(A),i.HEAP16=new Int16Array(A),i.HEAPU8=I=new Uint8Array(A),i.HEAPU16=new Uint16Array(A),i.HEAP32=new Int32Array(A),i.HEAPU32=c=new Uint32Array(A),i.HEAPF32=new Float32Array(A),i.HEAPF64=new Float64Array(A)}Object.assign(i,a),a=null,i.arguments&&i.arguments,i.thisProgram&&(s=i.thisProgram),i.quit&&i.quit,i.wasmBinary&&(g=i.wasmBinary);var Q,l=[],E=[],u=[],d=0,f=null,p=null,m="data:application/octet-stream;base64,",y=A=>A.startsWith(m);function w(A,e){var t,i=function(A){if(A==Q&&g)return new Uint8Array(g);var e=function(A){if(y(A))return function(A){for(var e=atob(A),t=new Uint8Array(e.length),i=0;i{for(;A.length>0;)A.shift()(i)};i.noExitRuntime;var b,k=A=>{var e=(A-r.buffer.byteLength+65535)/65536;try{return r.grow(e),h(),1}catch(A){}},F={},S=()=>{if(!S.strings){var A={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:s||"./this.program"};for(var e in F)void 0===F[e]?delete A[e]:A[e]=F[e];var t=[];for(var e in A)t.push(`${e}=${A[e]}`);S.strings=t}return S.strings},R=[null,[],[]],G="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,N=(A,e,t)=>{for(var i=e+t,a=e;A[a]&&!(a>=i);)++a;if(a-e>16&&A.buffer&&G)return G.decode(A.subarray(e,a));for(var s="";e>10,56320|1023&o)}}else s+=String.fromCharCode((31&n)<<6|g)}else s+=String.fromCharCode(n)}return s},x=(A,e)=>A?N(I,A,e):"",U={c:(A,e,t)=>I.copyWithin(A,e,e+t),g:function(A,e){A>>=2;const t=i.imageData=new Uint8ClampedArray(e),a=i.HEAP32.subarray(A,A+e);t.set(a)},f:function(A,e,t,a){A>>=2,e>>=2,t>>=2;const s=i.imageData=new Uint8ClampedArray(3*a),n=i.HEAP32.subarray(A,A+a),g=i.HEAP32.subarray(e,e+a),r=i.HEAP32.subarray(t,t+a);for(let A=0;A>=2,e>>=2,t>>=2,a>>=2;const n=i.imageData=new Uint8ClampedArray(4*s),g=i.HEAP32.subarray(A,A+s),r=i.HEAP32.subarray(e,e+s),o=i.HEAP32.subarray(t,t+s),I=i.HEAP32.subarray(a,a+s);for(let A=0;A{var e=I.length,t=2147483648;if((A>>>=0)>t)return!1;for(var i,a=1;a<=4;a*=2){var s=e*(1+.2/a);s=Math.min(s,A+100663296);var n=Math.min(t,(i=Math.max(A,s))+(65536-i%65536)%65536);if(k(n))return!0}return!1},l:(A,e)=>{var t=0;return S().forEach(((i,a)=>{var s=e+t;c[A+4*a>>2]=s,((A,e)=>{for(var t=0;t{var t=S();c[A>>2]=t.length;var i=0;return t.forEach((A=>i+=A.length+1)),c[e>>2]=i,0},n:A=>52,j:function(A,e,t,i,a){return 70},b:(A,e,t,i)=>{for(var a,s,n,g=0,r=0;r>2],h=c[e+4>>2];e+=8;for(var Q=0;Q>2]=g,0},o:function(A,e){A>>=2;const t=i.imageData=new Uint8ClampedArray(4*e),a=i.HEAP32.subarray(A,A+e);for(let A=0;A>=2,e>>=2;const a=i.imageData=new Uint8ClampedArray(4*t),s=i.HEAP32.subarray(A,A+t),n=i.HEAP32.subarray(e,e+t);for(let A=0;A>=2,e>>=2,t>>=2;const s=i.imageData=new Uint8ClampedArray(4*a),n=i.HEAP32.subarray(A,A+a),g=i.HEAP32.subarray(e,e+a),r=i.HEAP32.subarray(t,t+a);for(let A=0;A0||(function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)A=i.preRun.shift(),l.unshift(A);var A;D(l)}(),d>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),A()}),1)):A()))}if(M.q,i._malloc=M.r,i._free=M.s,i._jp2_decode=M.u,p=function A(){b||L(),b||(p=A)},i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return L(),i});const Vt=Xt;class jt extends M{constructor(A){super(A,"JpxError")}}class zt{static#y=null;static decode(A,e){e||={},this.#y||=Vt({warn:R});const t=this.#y.decode(A,e);if("string"==typeof t)throw new jt(t);return t}static cleanup(){this.#y=null}static parseImageProperties(A){let e=A.getByte();for(;e>=0;){const t=e;if(e=A.getByte(),65361==(t<<8|e)){A.skip(4);const e=A.getInt32()>>>0,t=A.getInt32()>>>0,i=A.getInt32()>>>0,a=A.getInt32()>>>0;return A.skip(16),{width:e-i,height:t-a,bitsPerComponent:8,componentsCount:A.getUint16()}}}throw new jt("No size marker found in JPX stream")}}class _t extends Fe{constructor(A,e,t){super(e),this.stream=A,this.dict=A.dict,this.maybeLength=e,this.params=t}get bytes(){return U(this,"bytes",this.stream.getBytes(this.maybeLength))}ensureBuffer(A){}readBlock(A){this.decodeImage(null,A)}decodeImage(A,e){return this.eof||(A||=this.bytes,this.buffer=zt.decode(A,e),this.bufferLength=this.buffer.length,this.eof=!0),this.buffer}get canAsyncDecodeImageFromBuffer(){return this.stream.isAsync}}class $t extends Fe{constructor(A,e,t){super(e),this.str=A,this.dict=A.dict,this.cachedData=0,this.bitsCached=0;const i=4096,a={earlyChange:t,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(i),dictionaryLengths:new Uint16Array(i),dictionaryPrevCodes:new Uint16Array(i),currentSequence:new Uint8Array(i),currentSequenceLength:0};for(let A=0;A<256;++A)a.dictionaryValues[A]=A,a.dictionaryLengths[A]=1;this.lzwState=a}readBits(A){let e=this.bitsCached,t=this.cachedData;for(;e>>e&(1<0;if(A<256)C[0]=A,B=1;else{if(!(A>=258)){if(256===A){I=9,n=258,B=0;continue}this.eof=!0,delete this.lzwState;break}if(A=0;e--)C[e]=g[t],t=o[t];else C[B++]=C[0]}if(a&&(o[n]=c,r[n]=r[c]+1,g[n]=C[0],n++,I=n+s&n+s-1?I:0|Math.min(Math.log(n+s)/.6931471805599453+1,12)),c=A,h+=B,i15))throw new K(`Unsupported predictor: ${i}`);this.readBlock=2===i?this.readBlockTiff:this.readBlockPng,this.str=A,this.dict=A.dict;const a=this.colors=t.get("Colors")||1,s=this.bits=t.get("BPC","BitsPerComponent")||8,n=this.columns=t.get("Columns")||1;return this.pixBytes=a*s+7>>3,this.rowBytes=n*a*s+7>>3,this}readBlockTiff(){const A=this.rowBytes,e=this.bufferLength,t=this.ensureBuffer(e+A),i=this.bits,a=this.colors,s=this.str.getBytes(A);if(this.eof=!s.length,this.eof)return;let n,g=0,r=0,o=0,I=0,c=e;if(1===i&&1===a)for(n=0;n>1,A^=A>>2,A^=A>>4,g=(1&A)<<7,t[c++]=A}else if(8===i){for(n=0;n>8&255,t[c++]=255&A}}else{const A=new Uint8Array(a+1),c=(1<>o-i)&c,o-=i,r=r<=8&&(t[B++]=r>>I-8&255,I-=8);I>0&&(t[B++]=(r<<8-I)+(g&(1<<8-I)-1))}this.bufferLength+=A}readBlockPng(){const A=this.rowBytes,e=this.pixBytes,t=this.str.getByte(),i=this.str.getBytes(A);if(this.eof=!i.length,this.eof)return;const a=this.bufferLength,s=this.ensureBuffer(a+A);let n=s.subarray(a-A,a);0===n.length&&(n=new Uint8Array(A));let g,r,o,I=a;switch(t){case 0:for(g=0;g>1)+i[g];for(;g>1)+i[g]&255,I++;break;case 4:for(g=0;g0){const A=this.str.getBytes(i);e.set(A,t),t+=i}}else{i=257-i;const a=A[1];e=this.ensureBuffer(t+i+1);for(let A=0;A>")&&this.buf1!==sA;){if(!(this.buf1 instanceof oA)){S("Malformed dictionary: key must be a name object"),this.shift();continue}const e=this.buf1.name;if(this.shift(),this.buf1===sA)break;i.set(e,this.getObj(A))}if(this.buf1===sA){if(this.recoveryMode)return i;throw new wA("End of file inside dictionary.")}return EA(this.buf2,"stream")?this.allowStreams?this.makeStream(i,A):i:(this.shift(),i);default:return e}if(Number.isInteger(e)){if(Number.isInteger(this.buf1)&&EA(this.buf2,"R")){const A=BA.get(e,this.buf1);return this.shift(),this.shift(),A}return e}return"string"==typeof e&&A?A.decryptString(e):e}findDefaultInlineStreamEnd(A){const{knownCommands:e}=this.lexer,t=A.pos;let i,a,s=0;for(;-1!==(i=A.getByte());)if(0===s)s=69===i?1:0;else if(1===s)s=73===i?2:0;else if(32===i||10===i||13===i){a=A.pos;const t=A.peekBytes(15),n=t.length;if(0===n)break;for(let A=0;A127)){s=0;break}if(2!==s)continue;if(!e){R("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");continue}const g=new si(new ae(t.slice()),e);g._hexStringWarn=()=>{};let r=0;for(;;){const A=g.getObj();if(A===sA){s=0;break}if(A instanceof IA){const t=e[A.cmd];if(!t){s=0;break}if(t.variableArgs?r<=t.numArgs:r===t.numArgs)break;r=0}else r++}if(2===s)break}else s=0;-1===i&&(R("findDefaultInlineStreamEnd: Reached the end of the stream without finding a valid EI marker"),a&&(R('... trying to recover by using the last "EI" occurrence.'),A.skip(-(A.pos-a))));let n=4;return A.skip(-n),i=A.peekByte(),A.skip(n),MA(i)||n--,A.pos-n-t}findDCTDecodeInlineStreamEnd(A){const e=A.pos;let t,i,a=!1;for(;-1!==(t=A.getByte());)if(255===t){switch(A.getByte()){case 0:break;case 255:A.skip(-1);break;case 217:a=!0;break;case 192:case 193:case 194:case 195:case 197:case 198:case 199:case 201:case 202:case 203:case 205:case 206:case 207:case 196:case 204:case 218:case 219:case 220:case 221:case 222:case 223:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:i=A.getUint16(),i>2?A.skip(i-2):A.skip(-2)}if(a)break}const s=A.pos-e;return-1===t?(R("Inline DCTDecode image stream: EOI marker not found, searching for /EI/ instead."),A.skip(-s),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),s)}findASCII85DecodeInlineStreamEnd(A){const e=A.pos;let t;for(;-1!==(t=A.getByte());)if(126===t){const e=A.pos;for(t=A.peekByte();MA(t);)A.skip(),t=A.peekByte();if(62===t){A.skip();break}if(A.pos>e){const e=A.peekBytes(2);if(69===e[0]&&73===e[1])break}}const i=A.pos-e;return-1===t?(R("Inline ASCII85Decode image stream: EOD marker not found, searching for /EI/ instead."),A.skip(-i),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),i)}findASCIIHexDecodeInlineStreamEnd(A){const e=A.pos;let t;for(;-1!==(t=A.getByte())&&62!==t;);const i=A.pos-e;return-1===t?(R("Inline ASCIIHexDecode image stream: EOD marker not found, searching for /EI/ instead."),A.skip(-i),this.findDefaultInlineStreamEnd(A)):(this.inlineStreamSkipEI(A),i)}inlineStreamSkipEI(A){let e,t=0;for(;-1!==(e=A.getByte());)if(0===t)t=69===e?1:0;else if(1===t)t=73===e?2:0;else if(2===t)break}makeInlineImage(A){const e=this.lexer,t=e.stream,i=Object.create(null);let a;for(;!EA(this.buf1,"ID")&&this.buf1!==sA;){if(!(this.buf1 instanceof oA))throw new K("Dictionary key must be a name object");const e=this.buf1.name;if(this.shift(),this.buf1===sA)break;i[e]=this.getObj(A)}-1!==e.beginInlineImagePos&&(a=t.pos-e.beginInlineImagePos);const s=this.xref.fetchIfRef(i.F||i.Filter);let n;if(s instanceof oA)n=s.name;else if(Array.isArray(s)){const A=this.xref.fetchIfRef(s[0]);A instanceof oA&&(n=A.name)}const g=t.pos;let r,o;switch(n){case"DCT":case"DCTDecode":r=this.findDCTDecodeInlineStreamEnd(t);break;case"A85":case"ASCII85Decode":r=this.findASCII85DecodeInlineStreamEnd(t);break;case"AHx":case"ASCIIHexDecode":r=this.findASCIIHexDecodeInlineStreamEnd(t);break;default:r=this.findDefaultInlineStreamEnd(t)}if(r<1e3&&a>0){const A=t.pos;t.pos=e.beginInlineImagePos,o=function(A){const e=[],t=A.length;let i=0;for(;i=i){let i=!1;for(const A of a){const e=A.length;let a=0;for(;a=s){i=!0;break}if(a>=e){MA(n[r+g+a])&&(S(`Found "${T([...t,...A])}" when searching for endstream command.`),i=!0);break}}if(i)return e.pos+=r,e.pos-A}r++}e.pos+=g}return-1}makeStream(A,e){const t=this.lexer;let i=t.stream;t.skipToNextLine();const a=i.pos-1;let s=A.get("Length");if(Number.isInteger(s)||(S(`Bad length "${s&&s.toString()}" in stream.`),s=0),i.pos=a+s,t.nextChar(),this.tryShift()&&EA(this.buf2,"endstream"))this.shift();else{if(s=this.#w(a),s<0)throw new K("Missing endstream command.");t.nextChar(),this.shift(),this.shift()}return this.shift(),i=i.makeSubStream(a,s,A),e&&(i=e.createStream(i,s)),i=this.filter(i,A,s),i.dict=A,i}filter(A,e,t){let i=e.get("F","Filter"),a=e.get("DP","DecodeParms");if(i instanceof oA)return Array.isArray(a)&&R("/DecodeParms should not be an Array, when /Filter is a Name."),this.makeFilter(A,i.name,t,a);let s=t;if(Array.isArray(i)){const e=i,t=a;for(let n=0,g=e.length;n=48&&A<=57?15&A:A>=65&&A<=70||A>=97&&A<=102?9+(15&A):-1}class si{constructor(A,e=null){this.stream=A,this.nextChar(),this.strBuf=[],this.knownCommands=e,this._hexStringNumWarn=0,this.beginInlineImagePos=-1}nextChar(){return this.currentChar=this.stream.getByte()}peekChar(){return this.stream.peekByte()}getNumber(){let A=this.currentChar,e=!1,t=0,i=1;if(45===A?(i=-1,A=this.nextChar(),45===A&&(A=this.nextChar())):43===A&&(A=this.nextChar()),10===A||13===A)do{A=this.nextChar()}while(10===A||13===A);if(46===A&&(t=10,A=this.nextChar()),A<48||A>57){const e=`Invalid number: ${String.fromCharCode(A)} (charCode ${A})`;if(MA(A)||-1===A)return S(`Lexer.getNumber - "${e}".`),0;throw new K(e)}let a=A-48,s=0,n=1;for(;(A=this.nextChar())>=0;)if(A>=48&&A<=57){const i=A-48;e?s=10*s+i:(0!==t&&(t*=10),a=10*a+i)}else if(46===A){if(0!==t)break;t=1}else if(45===A)R("Badly formatted number: minus sign in the middle");else{if(69!==A&&101!==A)break;if(A=this.peekChar(),43===A||45===A)n=45===A?-1:1,this.nextChar();else if(A<48||A>57)break;e=!0}return 0!==t&&(a/=t),e&&(a*=10**(n*s)),i*a}getString(){let A=1,e=!1;const t=this.strBuf;t.length=0;let i=this.nextChar();for(;;){let a=!1;switch(0|i){case-1:R("Unterminated string"),e=!0;break;case 40:++A,t.push("(");break;case 41:0==--A?(this.nextChar(),e=!0):t.push(")");break;case 92:switch(i=this.nextChar(),i){case-1:R("Unterminated string"),e=!0;break;case 110:t.push("\n");break;case 114:t.push("\r");break;case 116:t.push("\t");break;case 98:t.push("\b");break;case 102:t.push("\f");break;case 92:case 40:case 41:t.push(String.fromCharCode(i));break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:let A=15&i;i=this.nextChar(),a=!0,i>=48&&i<=55&&(A=(A<<3)+(15&i),i=this.nextChar(),i>=48&&i<=55&&(a=!1,A=(A<<3)+(15&i))),t.push(String.fromCharCode(A));break;case 13:10===this.peekChar()&&this.nextChar();break;case 10:break;default:t.push(String.fromCharCode(i))}break;default:t.push(String.fromCharCode(i))}if(e)break;a||(i=this.nextChar())}return t.join("")}getName(){let A,e;const t=this.strBuf;for(t.length=0;(A=this.nextChar())>=0&&!ii[A];)if(35===A){if(A=this.nextChar(),ii[A]){R("Lexer_getName: NUMBER SIGN (#) should be followed by a hexadecimal number."),t.push("#");break}const i=ai(A);if(-1!==i){e=A,A=this.nextChar();const a=ai(A);if(-1===a){if(R(`Lexer_getName: Illegal digit (${String.fromCharCode(A)}) in hexadecimal number.`),t.push("#",String.fromCharCode(e)),ii[A])break;t.push(String.fromCharCode(A));continue}t.push(String.fromCharCode(i<<4|a))}else t.push("#",String.fromCharCode(A))}else t.push(String.fromCharCode(A));return t.length>127&&R(`Name token is longer than allowed by the spec: ${t.length}`),oA.get(t.join(""))}_hexStringWarn(A){5!=this._hexStringNumWarn++?this._hexStringNumWarn>5||R(`getHexString - ignoring invalid character: ${A}`):R("getHexString - ignoring additional invalid characters.")}getHexString(){const A=this.strBuf;A.length=0;let e=this.currentChar,t=-1,i=-1;for(this._hexStringNumWarn=0;;){if(e<0){R("Unterminated hex string");break}if(62===e){this.nextChar();break}1!==ii[e]?(i=ai(e),-1===i?this._hexStringWarn(e):-1===t?t=i:(A.push(String.fromCharCode(t<<4|i)),t=-1),e=this.nextChar()):e=this.nextChar()}return-1!==t&&A.push(String.fromCharCode(t<<4)),A.join("")}getObj(){let A=!1,e=this.currentChar;for(;;){if(e<0)return sA;if(A)10!==e&&13!==e||(A=!1);else if(37===e)A=!0;else if(1!==ii[e])break;e=this.nextChar()}switch(0|e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return this.getNumber();case 40:return this.getString();case 47:return this.getName();case 91:return this.nextChar(),IA.get("[");case 93:return this.nextChar(),IA.get("]");case 60:return e=this.nextChar(),60===e?(this.nextChar(),IA.get("<<")):this.getHexString();case 62:return e=this.nextChar(),62===e?(this.nextChar(),IA.get(">>")):IA.get(">");case 123:return this.nextChar(),IA.get("{");case 125:return this.nextChar(),IA.get("}");case 41:throw this.nextChar(),new K(`Illegal character: ${e}`)}let t=String.fromCharCode(e);if(e<32||e>127){const A=this.peekChar();if(A>=32&&A<=127)return this.nextChar(),IA.get(t)}const i=this.knownCommands;let a=void 0!==i?.[t];for(;(e=this.nextChar())>=0&&!ii[e];){const A=t+String.fromCharCode(e);if(a&&void 0===i[A])break;if(128===t.length)throw new K(`Command token too long: ${t.length}`);t=A,a=void 0!==i?.[t]}return"true"===t||"false"!==t&&("null"===t?null:("BI"===t&&(this.beginInlineImagePos=this.stream.pos),IA.get(t)))}skipToNextLine(){let A=this.currentChar;for(;A>=0;){if(13===A){A=this.nextChar(),10===A&&this.nextChar();break}if(10===A){this.nextChar();break}A=this.nextChar()}}}class ni{static create(A){function e(A,e,t=!1){const i=A.get(e);if(Number.isInteger(i)&&(t?i>=0:i>0))return i;throw new Error(`The "${e}" parameter in the linearization dictionary is invalid.`)}const t=new ti({lexer:new si(A),xref:null}),i=t.getObj(),a=t.getObj(),s=t.getObj(),n=t.getObj();let g,r;if(!(Number.isInteger(i)&&Number.isInteger(a)&&EA(s,"obj")&&n instanceof CA&&"number"==typeof(g=n.get("Linearized"))&&g>0))return null;if((r=e(n,"L"))!==A.length)throw new Error('The "L" parameter in the linearization dictionary does not equal the stream length.');return{length:r,hints:function(A){const e=A.get("H");let t;if(Array.isArray(e)&&(2===(t=e.length)||4===t)){for(let A=0;A0))throw new Error(`Hint (${A}) in the linearization dictionary is invalid.`)}return e}throw new Error("Hint array in the linearization dictionary is invalid.")}(n),objectNumberFirst:e(n,"O"),endFirst:e(n,"E"),numPages:e(n,"N"),mainXRefEntriesOffset:e(n,"T"),pageFirst:n.has("P")?e(n,"P",!0):0}}}const gi=["Adobe-GB1-UCS2","Adobe-CNS1-UCS2","Adobe-Japan1-UCS2","Adobe-Korea1-UCS2","78-EUC-H","78-EUC-V","78-H","78-RKSJ-H","78-RKSJ-V","78-V","78ms-RKSJ-H","78ms-RKSJ-V","83pv-RKSJ-H","90ms-RKSJ-H","90ms-RKSJ-V","90msp-RKSJ-H","90msp-RKSJ-V","90pv-RKSJ-H","90pv-RKSJ-V","Add-H","Add-RKSJ-H","Add-RKSJ-V","Add-V","Adobe-CNS1-0","Adobe-CNS1-1","Adobe-CNS1-2","Adobe-CNS1-3","Adobe-CNS1-4","Adobe-CNS1-5","Adobe-CNS1-6","Adobe-GB1-0","Adobe-GB1-1","Adobe-GB1-2","Adobe-GB1-3","Adobe-GB1-4","Adobe-GB1-5","Adobe-Japan1-0","Adobe-Japan1-1","Adobe-Japan1-2","Adobe-Japan1-3","Adobe-Japan1-4","Adobe-Japan1-5","Adobe-Japan1-6","Adobe-Korea1-0","Adobe-Korea1-1","Adobe-Korea1-2","B5-H","B5-V","B5pc-H","B5pc-V","CNS-EUC-H","CNS-EUC-V","CNS1-H","CNS1-V","CNS2-H","CNS2-V","ETHK-B5-H","ETHK-B5-V","ETen-B5-H","ETen-B5-V","ETenms-B5-H","ETenms-B5-V","EUC-H","EUC-V","Ext-H","Ext-RKSJ-H","Ext-RKSJ-V","Ext-V","GB-EUC-H","GB-EUC-V","GB-H","GB-V","GBK-EUC-H","GBK-EUC-V","GBK2K-H","GBK2K-V","GBKp-EUC-H","GBKp-EUC-V","GBT-EUC-H","GBT-EUC-V","GBT-H","GBT-V","GBTpc-EUC-H","GBTpc-EUC-V","GBpc-EUC-H","GBpc-EUC-V","H","HKdla-B5-H","HKdla-B5-V","HKdlb-B5-H","HKdlb-B5-V","HKgccs-B5-H","HKgccs-B5-V","HKm314-B5-H","HKm314-B5-V","HKm471-B5-H","HKm471-B5-V","HKscs-B5-H","HKscs-B5-V","Hankaku","Hiragana","KSC-EUC-H","KSC-EUC-V","KSC-H","KSC-Johab-H","KSC-Johab-V","KSC-V","KSCms-UHC-H","KSCms-UHC-HW-H","KSCms-UHC-HW-V","KSCms-UHC-V","KSCpc-EUC-H","KSCpc-EUC-V","Katakana","NWP-H","NWP-V","RKSJ-H","RKSJ-V","Roman","UniCNS-UCS2-H","UniCNS-UCS2-V","UniCNS-UTF16-H","UniCNS-UTF16-V","UniCNS-UTF32-H","UniCNS-UTF32-V","UniCNS-UTF8-H","UniCNS-UTF8-V","UniGB-UCS2-H","UniGB-UCS2-V","UniGB-UTF16-H","UniGB-UTF16-V","UniGB-UTF32-H","UniGB-UTF32-V","UniGB-UTF8-H","UniGB-UTF8-V","UniJIS-UCS2-H","UniJIS-UCS2-HW-H","UniJIS-UCS2-HW-V","UniJIS-UCS2-V","UniJIS-UTF16-H","UniJIS-UTF16-V","UniJIS-UTF32-H","UniJIS-UTF32-V","UniJIS-UTF8-H","UniJIS-UTF8-V","UniJIS2004-UTF16-H","UniJIS2004-UTF16-V","UniJIS2004-UTF32-H","UniJIS2004-UTF32-V","UniJIS2004-UTF8-H","UniJIS2004-UTF8-V","UniJISPro-UCS2-HW-V","UniJISPro-UCS2-V","UniJISPro-UTF8-V","UniJISX0213-UTF32-H","UniJISX0213-UTF32-V","UniJISX02132004-UTF32-H","UniJISX02132004-UTF32-V","UniKS-UCS2-H","UniKS-UCS2-V","UniKS-UTF16-H","UniKS-UTF16-V","UniKS-UTF32-H","UniKS-UTF32-V","UniKS-UTF8-H","UniKS-UTF8-V","V","WP-Symbol"],ri=2**24-1;class oi{constructor(A=!1){this.codespaceRanges=[[],[],[],[]],this.numCodespaceRanges=0,this._map=[],this.name="",this.vertical=!1,this.useCMap=null,this.builtInCMap=A}addCodespaceRange(A,e,t){this.codespaceRanges[A-1].push(e,t),this.numCodespaceRanges++}mapCidRange(A,e,t){if(e-A>ri)throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");for(;A<=e;)this._map[A++]=t++}mapBfRange(A,e,t){if(e-A>ri)throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");const i=t.length-1;for(;A<=e;){this._map[A++]=t;const e=t.charCodeAt(i)+1;t=e>255?t.substring(0,i-1)+String.fromCharCode(t.charCodeAt(i-1)+1)+"\0":t.substring(0,i)+String.fromCharCode(e)}}mapBfRangeToArray(A,e,t){if(e-A>ri)throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");const i=t.length;let a=0;for(;A<=e&&a>>0;const n=a[s];for(let A=0,e=n.length;A=e&&i<=a)return t.charcode=i,void(t.length=s+1)}}t.charcode=0,t.length=1}getCharCodeLength(A){const e=this.codespaceRanges;for(let t=0,i=e.length;t=a&&A<=s)return t+1}}return 1}get length(){return this._map.length}get isIdentityCMap(){if("Identity-H"!==this.name&&"Identity-V"!==this.name)return!1;if(65536!==this._map.length)return!1;for(let A=0;A<65536;A++)if(this._map[A]!==A)return!1;return!0}}class Ii extends oi{constructor(A,e){super(),this.vertical=A,this.addCodespaceRange(e,0,65535)}mapCidRange(A,e,t){G("should not call mapCidRange")}mapBfRange(A,e,t){G("should not call mapBfRange")}mapBfRangeToArray(A,e,t){G("should not call mapBfRangeToArray")}mapOne(A,e){G("should not call mapCidOne")}lookup(A){return Number.isInteger(A)&&A<=65535?A:void 0}contains(A){return Number.isInteger(A)&&A<=65535}forEach(A){for(let e=0;e<=65535;e++)A(e,e)}charCodeOf(A){return Number.isInteger(A)&&A<=65535?A:-1}getMap(){const A=new Array(65536);for(let e=0;e<=65535;e++)A[e]=e;return A}get length(){return 65536}get isIdentityCMap(){G("should not access .isIdentityCMap")}}function ci(A){let e=0;for(let t=0;t>>0}function Ci(A){if("string"!=typeof A)throw new K("Malformed CMap: expected string.")}function Bi(A){if(!Number.isInteger(A))throw new K("Malformed CMap: expected int.")}function hi(A,e){for(;;){let t=e.getObj();if(t===sA)break;if(EA(t,"endbfchar"))return;Ci(t);const i=ci(t);t=e.getObj(),Ci(t);const a=t;A.mapOne(i,a)}}function Qi(A,e){for(;;){let t=e.getObj();if(t===sA)break;if(EA(t,"endbfrange"))return;Ci(t);const i=ci(t);t=e.getObj(),Ci(t);const a=ci(t);if(t=e.getObj(),Number.isInteger(t)||"string"==typeof t){const e=Number.isInteger(t)?String.fromCharCode(t):t;A.mapBfRange(i,a,e)}else{if(!EA(t,"["))break;{t=e.getObj();const s=[];for(;!EA(t,"]")&&t!==sA;)s.push(t),t=e.getObj();A.mapBfRangeToArray(i,a,s)}}}throw new K("Invalid bf range.")}function li(A,e){for(;;){let t=e.getObj();if(t===sA)break;if(EA(t,"endcidchar"))return;Ci(t);const i=ci(t);t=e.getObj(),Bi(t);const a=t;A.mapOne(i,a)}}function Ei(A,e){for(;;){let t=e.getObj();if(t===sA)break;if(EA(t,"endcidrange"))return;Ci(t);const i=ci(t);t=e.getObj(),Ci(t);const a=ci(t);t=e.getObj(),Bi(t);const s=t;A.mapCidRange(i,a,s)}}function ui(A,e){for(;;){let t=e.getObj();if(t===sA)break;if(EA(t,"endcodespacerange"))return;if("string"!=typeof t)break;const i=ci(t);if(t=e.getObj(),"string"!=typeof t)break;const a=ci(t);A.addCodespaceRange(t.length,i,a)}throw new K("Invalid codespace range.")}function di(A,e){const t=e.getObj();Number.isInteger(t)&&(A.vertical=!!t)}function fi(A,e){const t=e.getObj();t instanceof oA&&(A.name=t.name)}async function pi(A,e,t,i){let a,s;A:for(;;)try{const t=e.getObj();if(t===sA)break;if(t instanceof oA)"WMode"===t.name?di(A,e):"CMapName"===t.name&&fi(A,e),a=t;else if(t instanceof IA)switch(t.cmd){case"endcmap":break A;case"usecmap":a instanceof oA&&(s=a.name);break;case"begincodespacerange":ui(A,e);break;case"beginbfchar":hi(A,e);break;case"begincidchar":li(A,e);break;case"beginbfrange":Qi(A,e);break;case"begincidrange":Ei(A,e)}}catch(A){if(A instanceof yA)throw A;R("Invalid cMap data: "+A);continue}return!i&&s&&(i=s),i?mi(A,t,i):A}async function mi(A,e,t){if(A.useCMap=await yi(t,e),0===A.numCodespaceRanges){const e=A.useCMap.codespaceRanges;for(let t=0;tmi(a,e,A)));if(0===i){const A=new si(new ae(t));return pi(a,A,e,null)}throw new Error(`Invalid CMap "compressionType" value: ${i}`)}class wi{static async create({encoding:A,fetchBuiltInCMap:e,useCMap:t}){if(A instanceof oA)return yi(A.name,e);if(A instanceof fA){const i=await pi(new oi,new si(A),e,t);return i.isIdentityCMap?yi(i.name,e):i}throw new Error("Encoding required.")}}const Di=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron"],bi=[".notdef","space","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],ki=[".notdef","space","dollaroldstyle","dollarsuperior","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","fi","fl","ffi","ffl","parenleftinferior","parenrightinferior","hyphensuperior","colonmonetary","onefitted","rupiah","centoldstyle","figuredash","hypheninferior","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior"],Fi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],Si=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","centoldstyle","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","","threequartersemdash","","questionsmall","","","","","Ethsmall","","","onequarter","onehalf","threequarters","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","","","","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hypheninferior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","asuperior","centsuperior","","","","","Aacutesmall","Agravesmall","Acircumflexsmall","Adieresissmall","Atildesmall","Aringsmall","Ccedillasmall","Eacutesmall","Egravesmall","Ecircumflexsmall","Edieresissmall","Iacutesmall","Igravesmall","Icircumflexsmall","Idieresissmall","Ntildesmall","Oacutesmall","Ogravesmall","Ocircumflexsmall","Odieresissmall","Otildesmall","Uacutesmall","Ugravesmall","Ucircumflexsmall","Udieresissmall","","eightsuperior","fourinferior","threeinferior","sixinferior","eightinferior","seveninferior","Scaronsmall","","centinferior","twoinferior","","Dieresissmall","","Caronsmall","osuperior","fiveinferior","","commainferior","periodinferior","Yacutesmall","","dollarinferior","","","Thornsmall","","nineinferior","zeroinferior","Zcaronsmall","AEsmall","Oslashsmall","questiondownsmall","oneinferior","Lslashsmall","","","","","","","Cedillasmall","","","","","","OEsmall","figuredash","hyphensuperior","","","","","exclamdownsmall","","Ydieresissmall","","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","ninesuperior","zerosuperior","","esuperior","rsuperior","tsuperior","","","isuperior","ssuperior","dsuperior","","","","","","lsuperior","Ogoneksmall","Brevesmall","Macronsmall","bsuperior","nsuperior","msuperior","commasuperior","periodsuperior","Dotaccentsmall","Ringsmall","","","",""],Ri=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","space","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron"],Gi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls","","","",""],Ni=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","bullet","Euro","bullet","quotesinglbase","florin","quotedblbase","ellipsis","dagger","daggerdbl","circumflex","perthousand","Scaron","guilsinglleft","OE","bullet","Zcaron","bullet","bullet","quoteleft","quoteright","quotedblleft","quotedblright","bullet","endash","emdash","tilde","trademark","scaron","guilsinglright","oe","bullet","zcaron","Ydieresis","space","exclamdown","cent","sterling","currency","yen","brokenbar","section","dieresis","copyright","ordfeminine","guillemotleft","logicalnot","hyphen","registered","macron","degree","plusminus","twosuperior","threesuperior","acute","mu","paragraph","periodcentered","cedilla","onesuperior","ordmasculine","guillemotright","onequarter","onehalf","threequarters","questiondown","Agrave","Aacute","Acircumflex","Atilde","Adieresis","Aring","AE","Ccedilla","Egrave","Eacute","Ecircumflex","Edieresis","Igrave","Iacute","Icircumflex","Idieresis","Eth","Ntilde","Ograve","Oacute","Ocircumflex","Otilde","Odieresis","multiply","Oslash","Ugrave","Uacute","Ucircumflex","Udieresis","Yacute","Thorn","germandbls","agrave","aacute","acircumflex","atilde","adieresis","aring","ae","ccedilla","egrave","eacute","ecircumflex","edieresis","igrave","iacute","icircumflex","idieresis","eth","ntilde","ograve","oacute","ocircumflex","otilde","odieresis","divide","oslash","ugrave","uacute","ucircumflex","udieresis","yacute","thorn","ydieresis"],xi=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","universal","numbersign","existential","percent","ampersand","suchthat","parenleft","parenright","asteriskmath","plus","comma","minus","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","congruent","Alpha","Beta","Chi","Delta","Epsilon","Phi","Gamma","Eta","Iota","theta1","Kappa","Lambda","Mu","Nu","Omicron","Pi","Theta","Rho","Sigma","Tau","Upsilon","sigma1","Omega","Xi","Psi","Zeta","bracketleft","therefore","bracketright","perpendicular","underscore","radicalex","alpha","beta","chi","delta","epsilon","phi","gamma","eta","iota","phi1","kappa","lambda","mu","nu","omicron","pi","theta","rho","sigma","tau","upsilon","omega1","omega","xi","psi","zeta","braceleft","bar","braceright","similar","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","Euro","Upsilon1","minute","lessequal","fraction","infinity","florin","club","diamond","heart","spade","arrowboth","arrowleft","arrowup","arrowright","arrowdown","degree","plusminus","second","greaterequal","multiply","proportional","partialdiff","bullet","divide","notequal","equivalence","approxequal","ellipsis","arrowvertex","arrowhorizex","carriagereturn","aleph","Ifraktur","Rfraktur","weierstrass","circlemultiply","circleplus","emptyset","intersection","union","propersuperset","reflexsuperset","notsubset","propersubset","reflexsubset","element","notelement","angle","gradient","registerserif","copyrightserif","trademarkserif","product","radical","dotmath","logicalnot","logicaland","logicalor","arrowdblboth","arrowdblleft","arrowdblup","arrowdblright","arrowdbldown","lozenge","angleleft","registersans","copyrightsans","trademarksans","summation","parenlefttp","parenleftex","parenleftbt","bracketlefttp","bracketleftex","bracketleftbt","bracelefttp","braceleftmid","braceleftbt","braceex","","angleright","integral","integraltp","integralex","integralbt","parenrighttp","parenrightex","parenrightbt","bracketrighttp","bracketrightex","bracketrightbt","bracerighttp","bracerightmid","bracerightbt",""],Ui=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","a1","a2","a202","a3","a4","a5","a119","a118","a117","a11","a12","a13","a14","a15","a16","a105","a17","a18","a19","a20","a21","a22","a23","a24","a25","a26","a27","a28","a6","a7","a8","a9","a10","a29","a30","a31","a32","a33","a34","a35","a36","a37","a38","a39","a40","a41","a42","a43","a44","a45","a46","a47","a48","a49","a50","a51","a52","a53","a54","a55","a56","a57","a58","a59","a60","a61","a62","a63","a64","a65","a66","a67","a68","a69","a70","a71","a72","a73","a74","a203","a75","a204","a76","a77","a78","a79","a81","a82","a83","a84","a97","a98","a99","a100","","a89","a90","a93","a94","a91","a92","a205","a85","a206","a86","a87","a88","a95","a96","","","","","","","","","","","","","","","","","","","","a101","a102","a103","a104","a106","a107","a108","a112","a111","a110","a109","a120","a121","a122","a123","a124","a125","a126","a127","a128","a129","a130","a131","a132","a133","a134","a135","a136","a137","a138","a139","a140","a141","a142","a143","a144","a145","a146","a147","a148","a149","a150","a151","a152","a153","a154","a155","a156","a157","a158","a159","a160","a161","a163","a164","a196","a165","a192","a166","a167","a168","a169","a170","a171","a172","a173","a162","a174","a175","a176","a177","a178","a179","a193","a180","a199","a181","a200","a182","","a201","a183","a184","a197","a185","a194","a198","a186","a195","a187","a188","a189","a190","a191",""];function Mi(A){switch(A){case"WinAnsiEncoding":return Ni;case"StandardEncoding":return Gi;case"MacRomanEncoding":return Ri;case"SymbolSetEncoding":return xi;case"ZapfDingbatsEncoding":return Ui;case"ExpertEncoding":return Fi;case"MacExpertEncoding":return Si;default:return null}}const Li=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],Ji=[null,{id:"hstem",min:2,stackClearing:!0,stem:!0},null,{id:"vstem",min:2,stackClearing:!0,stem:!0},{id:"vmoveto",min:1,stackClearing:!0},{id:"rlineto",min:2,resetStack:!0},{id:"hlineto",min:1,resetStack:!0},{id:"vlineto",min:1,resetStack:!0},{id:"rrcurveto",min:6,resetStack:!0},null,{id:"callsubr",min:1,undefStack:!0},{id:"return",min:0,undefStack:!0},null,null,{id:"endchar",min:0,stackClearing:!0},null,null,null,{id:"hstemhm",min:2,stackClearing:!0,stem:!0},{id:"hintmask",min:0,stackClearing:!0},{id:"cntrmask",min:0,stackClearing:!0},{id:"rmoveto",min:2,stackClearing:!0},{id:"hmoveto",min:1,stackClearing:!0},{id:"vstemhm",min:2,stackClearing:!0,stem:!0},{id:"rcurveline",min:8,resetStack:!0},{id:"rlinecurve",min:8,resetStack:!0},{id:"vvcurveto",min:4,resetStack:!0},{id:"hhcurveto",min:4,resetStack:!0},null,{id:"callgsubr",min:1,undefStack:!0},{id:"vhcurveto",min:4,resetStack:!0},{id:"hvcurveto",min:4,resetStack:!0}],Hi=[null,null,null,{id:"and",min:2,stackDelta:-1},{id:"or",min:2,stackDelta:-1},{id:"not",min:1,stackDelta:0},null,null,null,{id:"abs",min:1,stackDelta:0},{id:"add",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]+A[e-1]}},{id:"sub",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]-A[e-1]}},{id:"div",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]/A[e-1]}},null,{id:"neg",min:1,stackDelta:0,stackFn(A,e){A[e-1]=-A[e-1]}},{id:"eq",min:2,stackDelta:-1},null,null,{id:"drop",min:1,stackDelta:-1},null,{id:"put",min:2,stackDelta:-2},{id:"get",min:1,stackDelta:0},{id:"ifelse",min:4,stackDelta:-3},{id:"random",min:0,stackDelta:1},{id:"mul",min:2,stackDelta:-1,stackFn(A,e){A[e-2]=A[e-2]*A[e-1]}},null,{id:"sqrt",min:1,stackDelta:0},{id:"dup",min:1,stackDelta:1},{id:"exch",min:2,stackDelta:0},{id:"index",min:2,stackDelta:0},{id:"roll",min:3,stackDelta:-2},null,null,null,{id:"hflex",min:7,resetStack:!0},{id:"flex",min:13,resetStack:!0},{id:"hflex1",min:9,resetStack:!0},{id:"flex1",min:11,resetStack:!0}];class Yi{constructor(A,e,t){this.bytes=A.getBytes(),this.properties=e,this.seacAnalysisEnabled=!!t}parse(){const A=this.properties,e=new vi;this.cff=e;const t=this.parseHeader(),i=this.parseIndex(t.endPos),a=this.parseIndex(i.endPos),s=this.parseIndex(a.endPos),n=this.parseIndex(s.endPos),g=this.parseDict(a.obj.get(0)),r=this.createDict(Zi,g,e.strings);e.header=t.obj,e.names=this.parseNameIndex(i.obj),e.strings=this.parseStringIndex(s.obj),e.topDict=r,e.globalSubrIndex=n.obj,this.parsePrivateDict(e.topDict),e.isCIDFont=r.hasName("ROS");const o=r.getByName("CharStrings"),I=this.parseIndex(o).obj,c=r.getByName("FontMatrix");c&&(A.fontMatrix=c);const C=r.getByName("FontBBox");let B,h;if(C&&(A.ascent=Math.max(C[3],C[1]),A.descent=Math.min(C[1],C[3]),A.ascentScaled=!0),e.isCIDFont){const A=this.parseIndex(r.getByName("FDArray")).obj;for(let t=0,i=A.count;t=e)throw new K("Invalid CFF header");0!==t&&(S("cff data is shifted"),A=A.subarray(t),this.bytes=A);const i=A[0],a=A[1],s=A[2],n=A[3];return{obj:new Ki(i,a,s,n),endPos:s}}parseDict(A){let e=0;function t(){let t=A[e++];return 30===t?function(){let t="";const i=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"],a=A.length;for(;e>4,n=15&a;if(15===s)break;if(t+=i[s],15===n)break;t+=i[n]}return parseFloat(t)}():28===t?(t=A[e++],t=(t<<24|A[e++]<<16)>>16,t):29===t?(t=A[e++],t=t<<8|A[e++],t=t<<8|A[e++],t=t<<8|A[e++],t):t>=32&&t<=246?t-139:t>=247&&t<=250?256*(t-247)+A[e++]+108:t>=251&&t<=254?-256*(t-251)-A[e++]-108:(R('CFFParser_parseDict: "'+t+'" is a reserved command.'),NaN)}let i=[];const a=[];e=0;const s=A.length;for(;e10)return!1;let a=A.stackSize;const s=A.stack;let n=e.length;for(let g=0;g>16,g+=2,a++;else if(14===r){if(a>=4&&(a-=4,this.seacAnalysisEnabled))return A.seac=s.slice(a,a+4),!1;o=Ji[r]}else if(r>=32&&r<=246)s[a]=r-139,a++;else if(r>=247&&r<=254)s[a]=r<251?(r-247<<8)+e[g]+108:-(r-251<<8)-e[g]-108,g++,a++;else if(255===r)s[a]=(e[g]<<24|e[g+1]<<16|e[g+2]<<8|e[g+3])/65536,g+=4,a++;else if(19===r||20===r){if(A.hints+=a>>1,0===A.hints){e.copyWithin(g-1,g,-1),g-=1,n-=1;continue}g+=A.hints+7>>3,a%=2,o=Ji[r]}else{if(10===r||29===r){const e=10===r?t:i;if(!e)return o=Ji[r],R("Missing subrsIndex for "+o.id),!1;let n=32768;e.count<1240?n=107:e.count<33900&&(n=1131);const g=s[--a]+n;if(g<0||g>=e.count||isNaN(g))return o=Ji[r],R("Out of bounds subrIndex for "+o.id),!1;if(A.stackSize=a,A.callDepth++,!this.parseCharString(A,e.get(g),t,i))return!1;A.callDepth--,a=A.stackSize;continue}if(11===r)return A.stackSize=a,!0;if(0===r&&g===e.length)e[g-1]=14,o=Ji[14];else{if(9===r){e.copyWithin(g-1,g,-1),g-=1,n-=1;continue}o=Ji[r]}}if(o){if(o.stem&&(A.hints+=a>>1,3===r||23===r?A.hasVStems=!0:!A.hasVStems||1!==r&&18!==r||(R("CFF stem hints are in wrong order"),e[g-1]=1===r?3:23)),"min"in o&&!A.undefStack&&a=2&&o.stem?a%=2:a>1&&R("Found too many parameters for stack-clearing command"),a>0&&(A.width=s[a-1])),"stackDelta"in o?("stackFn"in o&&o.stackFn(s,a),a+=o.stackDelta):o.stackClearing?a=0:o.resetStack?(a=0,A.undefStack=!1):o.undefStack&&(a=0,A.undefStack=!0,A.firstStackClearing=!1)}}return n=a.length&&(R("Invalid fd index for glyph index."),c=!1),c&&(B=a[A].privateDict,C=B.subrsIndex)}else e&&(C=e);if(c&&(c=this.parseCharString(I,r,C,t)),null!==I.width){const A=B.getByName("nominalWidthX");g[o]=A+I.width}else{const A=B.getByName("defaultWidthX");g[o]=A}null!==I.seac&&(n[o]=I.seac),c||A.set(o,new Uint8Array([14]))}return{charStrings:A,seacs:n,widths:g}}emptyPrivateDictionary(A){const e=this.createDict(Xi,[],A.strings);A.setByKey(18,[0,0]),A.privateDict=e}parsePrivateDict(A){if(!A.hasName("Private"))return void this.emptyPrivateDictionary(A);const e=A.getByName("Private");if(!Array.isArray(e)||2!==e.length)return void A.removeByName("Private");const t=e[0],i=e[1];if(0===t||i>=this.bytes.length)return void this.emptyPrivateDictionary(A);const a=i+t,s=this.bytes.subarray(i,a),n=this.parseDict(s),g=this.createDict(Xi,n,A.strings);if(A.privateDict=g,0===g.getByName("ExpansionFactor")&&g.setByName("ExpansionFactor",.06),!g.getByName("Subrs"))return;const r=g.getByName("Subrs"),o=i+r;if(0===r||o>=this.bytes.length)return void this.emptyPrivateDictionary(A);const I=this.parseIndex(o);g.subrsIndex=I.obj}parseCharsets(A,e,t,i){if(0===A)return new ji(!0,Vi.ISO_ADOBE,Di);if(1===A)return new ji(!0,Vi.EXPERT,bi);if(2===A)return new ji(!0,Vi.EXPERT_SUBSET,ki);const a=this.bytes,s=A,n=a[A++],g=[i?0:".notdef"];let r,o,I;switch(e-=1,n){case 0:for(I=0;I=65535)return void R("Not enough space in charstrings to duplicate first glyph.");const A=this.charStrings.get(0);this.charStrings.add(A),this.isCIDFont&&this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0])}hasGlyphId(A){return!(A<0||A>=this.charStrings.count)&&this.charStrings.get(A).length>0}}class Ki{constructor(A,e,t,i){this.major=A,this.minor=e,this.hdrSize=t,this.offSize=i}}class qi{constructor(){this.strings=[]}get(A){return A>=0&&A<=390?Li[A]:A-391<=this.strings.length?this.strings[A-391]:Li[0]}getSID(A){let e=Li.indexOf(A);return-1!==e?e:(e=this.strings.indexOf(A),-1!==e?e+391:-1)}add(A){this.strings.push(A)}get count(){return this.strings.length}}class Ti{constructor(){this.objects=[],this.length=0}add(A){this.length+=A.length,this.objects.push(A)}set(A,e){this.length+=e.length-this.objects[A].length,this.objects[A]=e}get(A){return this.objects[A]}get count(){return this.objects.length}}class Pi{constructor(A,e){this.keyToNameMap=A.keyToNameMap,this.nameToKeyMap=A.nameToKeyMap,this.defaults=A.defaults,this.types=A.types,this.opcodes=A.opcodes,this.order=A.order,this.strings=e,this.values=Object.create(null)}setByKey(A,e){if(!(A in this.keyToNameMap))return!1;if(0===e.length)return!0;for(const t of e)if(isNaN(t))return R(`Invalid CFFDict value: "${e}" for key "${A}".`),!0;const t=this.types[A];return"num"!==t&&"sid"!==t&&"offset"!==t||(e=e[0]),this.values[A]=e,!0}setByName(A,e){if(!(A in this.nameToKeyMap))throw new K(`Invalid dictionary name "${A}"`);this.values[this.nameToKeyMap[A]]=e}hasName(A){return this.nameToKeyMap[A]in this.values}getByName(A){if(!(A in this.nameToKeyMap))throw new K(`Invalid dictionary name ${A}"`);const e=this.nameToKeyMap[A];return e in this.values?this.values[e]:this.defaults[e]}removeByName(A){delete this.values[this.nameToKeyMap[A]]}static createTables(A){const e={keyToNameMap:{},nameToKeyMap:{},defaults:{},types:{},opcodes:{},order:[]};for(const t of A){const A=Array.isArray(t[0])?(t[0][0]<<8)+t[0][1]:t[0];e.keyToNameMap[A]=t[1],e.nameToKeyMap[t[1]]=A,e.types[A]=t[2],e.defaults[A]=t[3],e.opcodes[A]=Array.isArray(t[0])?t[0]:[t[0]],e.order.push(A)}return e}}const Wi=[[[12,30],"ROS",["sid","sid","num"],null],[[12,20],"SyntheticBase","num",null],[0,"version","sid",null],[1,"Notice","sid",null],[[12,0],"Copyright","sid",null],[2,"FullName","sid",null],[3,"FamilyName","sid",null],[4,"Weight","sid",null],[[12,1],"isFixedPitch","num",0],[[12,2],"ItalicAngle","num",0],[[12,3],"UnderlinePosition","num",-100],[[12,4],"UnderlineThickness","num",50],[[12,5],"PaintType","num",0],[[12,6],"CharstringType","num",2],[[12,7],"FontMatrix",["num","num","num","num","num","num"],[.001,0,0,.001,0,0]],[13,"UniqueID","num",null],[5,"FontBBox",["num","num","num","num"],[0,0,0,0]],[[12,8],"StrokeWidth","num",0],[14,"XUID","array",null],[15,"charset","offset",0],[16,"Encoding","offset",0],[17,"CharStrings","offset",0],[18,"Private",["offset","offset"],null],[[12,21],"PostScript","sid",null],[[12,22],"BaseFontName","sid",null],[[12,23],"BaseFontBlend","delta",null],[[12,31],"CIDFontVersion","num",0],[[12,32],"CIDFontRevision","num",0],[[12,33],"CIDFontType","num",0],[[12,34],"CIDCount","num",8720],[[12,35],"UIDBase","num",null],[[12,37],"FDSelect","offset",null],[[12,36],"FDArray","offset",null],[[12,38],"FontName","sid",null]];class Zi extends Pi{static get tables(){return U(this,"tables",this.createTables(Wi))}constructor(A){super(Zi.tables,A),this.privateDict=null}}const Oi=[[6,"BlueValues","delta",null],[7,"OtherBlues","delta",null],[8,"FamilyBlues","delta",null],[9,"FamilyOtherBlues","delta",null],[[12,9],"BlueScale","num",.039625],[[12,10],"BlueShift","num",7],[[12,11],"BlueFuzz","num",1],[10,"StdHW","num",null],[11,"StdVW","num",null],[[12,12],"StemSnapH","delta",null],[[12,13],"StemSnapV","delta",null],[[12,14],"ForceBold","num",0],[[12,17],"LanguageGroup","num",0],[[12,18],"ExpansionFactor","num",.06],[[12,19],"initialRandomSeed","num",0],[20,"defaultWidthX","num",0],[21,"nominalWidthX","num",0],[19,"Subrs","offset",null]];class Xi extends Pi{static get tables(){return U(this,"tables",this.createTables(Oi))}constructor(A){super(Xi.tables,A),this.subrsIndex=null}}const Vi={ISO_ADOBE:0,EXPERT:1,EXPERT_SUBSET:2};class ji{constructor(A,e,t,i){this.predefined=A,this.format=e,this.charset=t,this.raw=i}}class zi{constructor(A,e,t,i){this.predefined=A,this.format=e,this.encoding=t,this.raw=i}}class _i{constructor(A,e){this.format=A,this.fdSelect=e}getFDIndex(A){return A<0||A>=this.fdSelect.length?-1:this.fdSelect[A]}}class $i{constructor(){this.offsets=Object.create(null)}isTracking(A){return A in this.offsets}track(A,e){if(A in this.offsets)throw new K(`Already tracking location of ${A}`);this.offsets[A]=e}offset(A){for(const e in this.offsets)this.offsets[e]+=A}setEntryLocation(A,e,t){if(!(A in this.offsets))throw new K(`Not tracking location of ${A}`);const i=t.data,a=this.offsets[A];for(let A=0,t=e.length;A>24&255,i[n]=o>>16&255,i[g]=o>>8&255,i[r]=255&o}}}class Aa{constructor(A){this.cff=A}compile(){const A=this.cff,e={data:[],length:0,add(A){try{this.data.push(...A)}catch{this.data=this.data.concat(A)}this.length=this.data.length}},t=this.compileHeader(A.header);e.add(t);const i=this.compileNameIndex(A.names);if(e.add(i),A.isCIDFont&&A.topDict.hasName("FontMatrix")){const e=A.topDict.getByName("FontMatrix");A.topDict.removeByName("FontMatrix");for(const t of A.fdArray){let A=e.slice(0);t.hasName("FontMatrix")&&(A=V.transform(A,t.getByName("FontMatrix"))),t.setByName("FontMatrix",A)}}const a=A.topDict.getByName("XUID");a?.length>16&&A.topDict.removeByName("XUID"),A.topDict.setByName("charset",0);let s=this.compileTopDicts([A.topDict],e.length,A.isCIDFont);e.add(s.output);const n=s.trackers[0],g=this.compileStringIndex(A.strings.strings);e.add(g);const r=this.compileIndex(A.globalSubrIndex);if(e.add(r),A.encoding&&A.topDict.hasName("Encoding"))if(A.encoding.predefined)n.setEntryLocation("Encoding",[A.encoding.format],e);else{const t=this.compileEncoding(A.encoding);n.setEntryLocation("Encoding",[e.length],e),e.add(t)}const o=this.compileCharset(A.charset,A.charStrings.count,A.strings,A.isCIDFont);n.setEntryLocation("charset",[e.length],e),e.add(o);const I=this.compileCharStrings(A.charStrings);if(n.setEntryLocation("CharStrings",[e.length],e),e.add(I),A.isCIDFont){n.setEntryLocation("FDSelect",[e.length],e);const t=this.compileFDSelect(A.fdSelect);e.add(t),s=this.compileTopDicts(A.fdArray,e.length,!0),n.setEntryLocation("FDArray",[e.length],e),e.add(s.output);const i=s.trackers;this.compilePrivateDicts(A.fdArray,i,e)}return this.compilePrivateDicts([A.topDict],[n],e),e.add([0]),e.data}encodeNumber(A){return Number.isInteger(A)?this.encodeInteger(A):this.encodeFloat(A)}static get EncodeFloatRegExp(){return U(this,"EncodeFloatRegExp",/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/)}encodeFloat(A){let e=A.toString();const t=Aa.EncodeFloatRegExp.exec(e);if(t){const i=parseFloat("1e"+((t[2]?+t[2]:0)+t[1].length));e=(Math.round(A*i)/i).toString()}let i,a,s="";for(i=0,a=e.length;i=-107&&A<=107?[A+139]:A>=108&&A<=1131?[247+((A-=108)>>8),255&A]:A>=-1131&&A<=-108?[251+((A=-A-108)>>8),255&A]:A>=-32768&&A<=32767?[28,A>>8&255,255&A]:[29,A>>24&255,A>>16&255,A>>8&255,255&A],e}compileHeader(A){return[A.major,A.minor,4,A.offSize]}compileNameIndex(A){const e=new Ti;for(const t of A){const A=Math.min(t.length,127);let i=new Array(A);for(let e=0;e"~"||"["===A||"]"===A||"("===A||")"===A||"{"===A||"}"===A||"<"===A||">"===A||"/"===A||"%"===A)&&(A="_"),i[e]=A}i=i.join(""),""===i&&(i="Bad_Font_Name"),e.add(P(i))}return this.compileIndex(e)}compileTopDicts(A,e,t){const i=[];let a=new Ti;for(const s of A){t&&(s.removeByName("CIDFontVersion"),s.removeByName("CIDFontRevision"),s.removeByName("CIDFontType"),s.removeByName("CIDCount"),s.removeByName("UIDBase"));const A=new $i,n=this.compileDict(s,A);i.push(A),a.add(n),A.offset(e)}return a=this.compileIndex(a,i),{trackers:i,output:a}}compilePrivateDicts(A,e,t){for(let i=0,a=A.length;i>8&255,255&s]);else{a=new Uint8Array(1+2*s),a[0]=0;let e=0;const i=A.charset.length;let n=!1;for(let s=1;s>8&255,a[s+1]=255&g}}return this.compileTypedArray(a)}compileEncoding(A){return this.compileTypedArray(A.raw)}compileFDSelect(A){const e=A.format;let t,i;switch(e){case 0:for(t=new Uint8Array(1+A.fdSelect.length),t[0]=e,i=0;i>8&255,255&a,s];for(i=1;i>8&255,255&i,e),s=e)}const g=(n.length-3)/3;n[1]=g>>8&255,n[2]=255&g,n.push(i>>8&255,255&i),t=new Uint8Array(n)}return this.compileTypedArray(t)}compileTypedArray(A){return Array.from(A)}compileIndex(A,e=[]){const t=A.objects,i=t.length;if(0===i)return[0,0];const a=[i>>8&255,255&i];let s,n,g=1;for(s=0;s>8&255,255&r):3===n?a.push(r>>16&255,r>>8&255,255&r):a.push(r>>>24&255,r>>16&255,r>>8&255,255&r),t[s]&&(r+=t[s].length);for(s=0;s=5&&e<=7))return-1;i=A.substring(1)}if(i===i.toUpperCase()&&(t=parseInt(i,16),t>=0))return t}return-1}const sa=[[0,127],[128,255],[256,383],[384,591],[592,687,7424,7551,7552,7615],[688,767,42752,42783],[768,879,7616,7679],[880,1023],[11392,11519],[1024,1279,1280,1327,11744,11775,42560,42655],[1328,1423],[1424,1535],[42240,42559],[1536,1791,1872,1919],[1984,2047],[2304,2431],[2432,2559],[2560,2687],[2688,2815],[2816,2943],[2944,3071],[3072,3199],[3200,3327],[3328,3455],[3584,3711],[3712,3839],[4256,4351,11520,11567],[6912,7039],[4352,4607],[7680,7935,11360,11391,42784,43007],[7936,8191],[8192,8303,11776,11903],[8304,8351],[8352,8399],[8400,8447],[8448,8527],[8528,8591],[8592,8703,10224,10239,10496,10623,11008,11263],[8704,8959,10752,11007,10176,10223,10624,10751],[8960,9215],[9216,9279],[9280,9311],[9312,9471],[9472,9599],[9600,9631],[9632,9727],[9728,9983],[9984,10175],[12288,12351],[12352,12447],[12448,12543,12784,12799],[12544,12591,12704,12735],[12592,12687],[43072,43135],[12800,13055],[13056,13311],[44032,55215],[55296,57343],[67840,67871],[19968,40959,11904,12031,12032,12255,12272,12287,13312,19903,131072,173791,12688,12703],[57344,63743],[12736,12783,63744,64255,194560,195103],[64256,64335],[64336,65023],[65056,65071],[65040,65055],[65104,65135],[65136,65279],[65280,65519],[65520,65535],[3840,4095],[1792,1871],[1920,1983],[3456,3583],[4096,4255],[4608,4991,4992,5023,11648,11743],[5024,5119],[5120,5759],[5760,5791],[5792,5887],[6016,6143],[6144,6319],[10240,10495],[40960,42127],[5888,5919,5920,5951,5952,5983,5984,6015],[66304,66351],[66352,66383],[66560,66639],[118784,119039,119040,119295,119296,119375],[119808,120831],[1044480,1048573],[65024,65039,917760,917999],[917504,917631],[6400,6479],[6480,6527],[6528,6623],[6656,6687],[11264,11359],[11568,11647],[19904,19967],[43008,43055],[65536,65663,65664,65791,65792,65855],[65856,65935],[66432,66463],[66464,66527],[66640,66687],[66688,66735],[67584,67647],[68096,68191],[119552,119647],[73728,74751,74752,74879],[119648,119679],[7040,7103],[7168,7247],[7248,7295],[43136,43231],[43264,43311],[43312,43359],[43520,43615],[65936,65999],[66e3,66047],[66208,66271,66176,66207,67872,67903],[127024,127135,126976,127023]];function na(A,e=-1){if(-1!==e){const t=sa[e];for(let i=0,a=t.length;i=t[i]&&A<=t[i+1])return e}for(let e=0,t=sa.length;e=t[i]&&A<=t[i+1])return e}return-1}const ga=new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$","u"),ra=new Map,oa=!0,Ia=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function ca(A,e){if(void 0!==e[A])return A;const t=aa(A,e);if(-1!==t)for(const A in e)if(e[A]===t)return A;return S("Unable to recover a standard glyph name for: "+A),A}function Ca(A,e,t){const i=Object.create(null);let a,s,n;const g=!!(4&A.flags);if(A.isInternalFont)for(n=e,s=0;s=0?a:0;else if(A.baseEncodingName)for(n=Mi(A.baseEncodingName),s=0;s=0?a:0;else if(g)for(s in e)i[s]=e[s];else for(n=Gi,s=0;s=0?a:0;const r=A.differences;let o;if(r)for(s in r){const A=r[s];if(a=t.indexOf(A),-1===a){o||(o=ea());const e=ca(A,o);e!==A&&(a=t.indexOf(e))}i[s]=a>=0?a:0}return i}function Ba(A){return A.replaceAll(/[,_]/g,"-").replaceAll(/\s/g,"")}const ha=mA((A=>{A[8211]=65074,A[8212]=65073,A[8229]=65072,A[8230]=65049,A[12289]=65041,A[12290]=65042,A[12296]=65087,A[12297]=65088,A[12298]=65085,A[12299]=65086,A[12300]=65089,A[12301]=65090,A[12302]=65091,A[12303]=65092,A[12304]=65083,A[12305]=65084,A[12308]=65081,A[12309]=65082,A[12310]=65047,A[12311]=65048,A[65103]=65076,A[65281]=65045,A[65288]=65077,A[65289]=65078,A[65292]=65040,A[65306]=65043,A[65307]=65044,A[65311]=65046,A[65339]=65095,A[65341]=65096,A[65343]=65075,A[65371]=65079,A[65373]=65080})),Qa=mA((function(A){A["Times-Roman"]="Times-Roman",A.Helvetica="Helvetica",A.Courier="Courier",A.Symbol="Symbol",A["Times-Bold"]="Times-Bold",A["Helvetica-Bold"]="Helvetica-Bold",A["Courier-Bold"]="Courier-Bold",A.ZapfDingbats="ZapfDingbats",A["Times-Italic"]="Times-Italic",A["Helvetica-Oblique"]="Helvetica-Oblique",A["Courier-Oblique"]="Courier-Oblique",A["Times-BoldItalic"]="Times-BoldItalic",A["Helvetica-BoldOblique"]="Helvetica-BoldOblique",A["Courier-BoldOblique"]="Courier-BoldOblique",A.ArialNarrow="Helvetica",A["ArialNarrow-Bold"]="Helvetica-Bold",A["ArialNarrow-BoldItalic"]="Helvetica-BoldOblique",A["ArialNarrow-Italic"]="Helvetica-Oblique",A.ArialBlack="Helvetica",A["ArialBlack-Bold"]="Helvetica-Bold",A["ArialBlack-BoldItalic"]="Helvetica-BoldOblique",A["ArialBlack-Italic"]="Helvetica-Oblique",A["Arial-Black"]="Helvetica",A["Arial-Black-Bold"]="Helvetica-Bold",A["Arial-Black-BoldItalic"]="Helvetica-BoldOblique",A["Arial-Black-Italic"]="Helvetica-Oblique",A.Arial="Helvetica",A["Arial-Bold"]="Helvetica-Bold",A["Arial-BoldItalic"]="Helvetica-BoldOblique",A["Arial-Italic"]="Helvetica-Oblique",A.ArialMT="Helvetica",A["Arial-BoldItalicMT"]="Helvetica-BoldOblique",A["Arial-BoldMT"]="Helvetica-Bold",A["Arial-ItalicMT"]="Helvetica-Oblique",A["Arial-BoldItalicMT-BoldItalic"]="Helvetica-BoldOblique",A["Arial-BoldMT-Bold"]="Helvetica-Bold",A["Arial-ItalicMT-Italic"]="Helvetica-Oblique",A.ArialUnicodeMS="Helvetica",A["ArialUnicodeMS-Bold"]="Helvetica-Bold",A["ArialUnicodeMS-BoldItalic"]="Helvetica-BoldOblique",A["ArialUnicodeMS-Italic"]="Helvetica-Oblique",A["Courier-BoldItalic"]="Courier-BoldOblique",A["Courier-Italic"]="Courier-Oblique",A.CourierNew="Courier",A["CourierNew-Bold"]="Courier-Bold",A["CourierNew-BoldItalic"]="Courier-BoldOblique",A["CourierNew-Italic"]="Courier-Oblique",A["CourierNewPS-BoldItalicMT"]="Courier-BoldOblique",A["CourierNewPS-BoldMT"]="Courier-Bold",A["CourierNewPS-ItalicMT"]="Courier-Oblique",A.CourierNewPSMT="Courier",A["Helvetica-BoldItalic"]="Helvetica-BoldOblique",A["Helvetica-Italic"]="Helvetica-Oblique",A["Symbol-Bold"]="Symbol",A["Symbol-BoldItalic"]="Symbol",A["Symbol-Italic"]="Symbol",A.TimesNewRoman="Times-Roman",A["TimesNewRoman-Bold"]="Times-Bold",A["TimesNewRoman-BoldItalic"]="Times-BoldItalic",A["TimesNewRoman-Italic"]="Times-Italic",A.TimesNewRomanPS="Times-Roman",A["TimesNewRomanPS-Bold"]="Times-Bold",A["TimesNewRomanPS-BoldItalic"]="Times-BoldItalic",A["TimesNewRomanPS-BoldItalicMT"]="Times-BoldItalic",A["TimesNewRomanPS-BoldMT"]="Times-Bold",A["TimesNewRomanPS-Italic"]="Times-Italic",A["TimesNewRomanPS-ItalicMT"]="Times-Italic",A.TimesNewRomanPSMT="Times-Roman",A["TimesNewRomanPSMT-Bold"]="Times-Bold",A["TimesNewRomanPSMT-BoldItalic"]="Times-BoldItalic",A["TimesNewRomanPSMT-Italic"]="Times-Italic"})),la=mA((function(A){A.Courier="FoxitFixed.pfb",A["Courier-Bold"]="FoxitFixedBold.pfb",A["Courier-BoldOblique"]="FoxitFixedBoldItalic.pfb",A["Courier-Oblique"]="FoxitFixedItalic.pfb",A.Helvetica="LiberationSans-Regular.ttf",A["Helvetica-Bold"]="LiberationSans-Bold.ttf",A["Helvetica-BoldOblique"]="LiberationSans-BoldItalic.ttf",A["Helvetica-Oblique"]="LiberationSans-Italic.ttf",A["Times-Roman"]="FoxitSerif.pfb",A["Times-Bold"]="FoxitSerifBold.pfb",A["Times-BoldItalic"]="FoxitSerifBoldItalic.pfb",A["Times-Italic"]="FoxitSerifItalic.pfb",A.Symbol="FoxitSymbol.pfb",A.ZapfDingbats="FoxitDingbats.pfb",A["LiberationSans-Regular"]="LiberationSans-Regular.ttf",A["LiberationSans-Bold"]="LiberationSans-Bold.ttf",A["LiberationSans-Italic"]="LiberationSans-Italic.ttf",A["LiberationSans-BoldItalic"]="LiberationSans-BoldItalic.ttf"})),Ea=mA((function(A){A.Calibri="Helvetica",A["Calibri-Bold"]="Helvetica-Bold",A["Calibri-BoldItalic"]="Helvetica-BoldOblique",A["Calibri-Italic"]="Helvetica-Oblique",A.CenturyGothic="Helvetica",A["CenturyGothic-Bold"]="Helvetica-Bold",A["CenturyGothic-BoldItalic"]="Helvetica-BoldOblique",A["CenturyGothic-Italic"]="Helvetica-Oblique",A.ComicSansMS="Comic Sans MS",A["ComicSansMS-Bold"]="Comic Sans MS-Bold",A["ComicSansMS-BoldItalic"]="Comic Sans MS-BoldItalic",A["ComicSansMS-Italic"]="Comic Sans MS-Italic",A.GillSansMT="Helvetica",A["GillSansMT-Bold"]="Helvetica-Bold",A["GillSansMT-BoldItalic"]="Helvetica-BoldOblique",A["GillSansMT-Italic"]="Helvetica-Oblique",A.Impact="Helvetica",A["ItcSymbol-Bold"]="Helvetica-Bold",A["ItcSymbol-BoldItalic"]="Helvetica-BoldOblique",A["ItcSymbol-Book"]="Helvetica",A["ItcSymbol-BookItalic"]="Helvetica-Oblique",A["ItcSymbol-Medium"]="Helvetica",A["ItcSymbol-MediumItalic"]="Helvetica-Oblique",A.LucidaConsole="Courier",A["LucidaConsole-Bold"]="Courier-Bold",A["LucidaConsole-BoldItalic"]="Courier-BoldOblique",A["LucidaConsole-Italic"]="Courier-Oblique",A["LucidaSans-Demi"]="Helvetica-Bold",A["MS-Gothic"]="MS Gothic",A["MS-Gothic-Bold"]="MS Gothic-Bold",A["MS-Gothic-BoldItalic"]="MS Gothic-BoldItalic",A["MS-Gothic-Italic"]="MS Gothic-Italic",A["MS-Mincho"]="MS Mincho",A["MS-Mincho-Bold"]="MS Mincho-Bold",A["MS-Mincho-BoldItalic"]="MS Mincho-BoldItalic",A["MS-Mincho-Italic"]="MS Mincho-Italic",A["MS-PGothic"]="MS PGothic",A["MS-PGothic-Bold"]="MS PGothic-Bold",A["MS-PGothic-BoldItalic"]="MS PGothic-BoldItalic",A["MS-PGothic-Italic"]="MS PGothic-Italic",A["MS-PMincho"]="MS PMincho",A["MS-PMincho-Bold"]="MS PMincho-Bold",A["MS-PMincho-BoldItalic"]="MS PMincho-BoldItalic",A["MS-PMincho-Italic"]="MS PMincho-Italic",A.NuptialScript="Times-Italic",A.SegoeUISymbol="Helvetica"})),ua=mA((function(A){A["Adobe Jenson"]=!0,A["Adobe Text"]=!0,A.Albertus=!0,A.Aldus=!0,A.Alexandria=!0,A.Algerian=!0,A["American Typewriter"]=!0,A.Antiqua=!0,A.Apex=!0,A.Arno=!0,A.Aster=!0,A.Aurora=!0,A.Baskerville=!0,A.Bell=!0,A.Bembo=!0,A["Bembo Schoolbook"]=!0,A.Benguiat=!0,A["Berkeley Old Style"]=!0,A["Bernhard Modern"]=!0,A["Berthold City"]=!0,A.Bodoni=!0,A["Bauer Bodoni"]=!0,A["Book Antiqua"]=!0,A.Bookman=!0,A["Bordeaux Roman"]=!0,A["Californian FB"]=!0,A.Calisto=!0,A.Calvert=!0,A.Capitals=!0,A.Cambria=!0,A.Cartier=!0,A.Caslon=!0,A.Catull=!0,A.Centaur=!0,A["Century Old Style"]=!0,A["Century Schoolbook"]=!0,A.Chaparral=!0,A["Charis SIL"]=!0,A.Cheltenham=!0,A["Cholla Slab"]=!0,A.Clarendon=!0,A.Clearface=!0,A.Cochin=!0,A.Colonna=!0,A["Computer Modern"]=!0,A["Concrete Roman"]=!0,A.Constantia=!0,A["Cooper Black"]=!0,A.Corona=!0,A.Ecotype=!0,A.Egyptienne=!0,A.Elephant=!0,A.Excelsior=!0,A.Fairfield=!0,A["FF Scala"]=!0,A.Folkard=!0,A.Footlight=!0,A.FreeSerif=!0,A["Friz Quadrata"]=!0,A.Garamond=!0,A.Gentium=!0,A.Georgia=!0,A.Gloucester=!0,A["Goudy Old Style"]=!0,A["Goudy Schoolbook"]=!0,A["Goudy Pro Font"]=!0,A.Granjon=!0,A["Guardian Egyptian"]=!0,A.Heather=!0,A.Hercules=!0,A["High Tower Text"]=!0,A.Hiroshige=!0,A["Hoefler Text"]=!0,A["Humana Serif"]=!0,A.Imprint=!0,A["Ionic No. 5"]=!0,A.Janson=!0,A.Joanna=!0,A.Korinna=!0,A.Lexicon=!0,A.LiberationSerif=!0,A["Liberation Serif"]=!0,A["Linux Libertine"]=!0,A.Literaturnaya=!0,A.Lucida=!0,A["Lucida Bright"]=!0,A.Melior=!0,A.Memphis=!0,A.Miller=!0,A.Minion=!0,A.Modern=!0,A["Mona Lisa"]=!0,A["Mrs Eaves"]=!0,A["MS Serif"]=!0,A["Museo Slab"]=!0,A["New York"]=!0,A["Nimbus Roman"]=!0,A["NPS Rawlinson Roadway"]=!0,A.NuptialScript=!0,A.Palatino=!0,A.Perpetua=!0,A.Plantin=!0,A["Plantin Schoolbook"]=!0,A.Playbill=!0,A["Poor Richard"]=!0,A["Rawlinson Roadway"]=!0,A.Renault=!0,A.Requiem=!0,A.Rockwell=!0,A.Roman=!0,A["Rotis Serif"]=!0,A.Sabon=!0,A.Scala=!0,A.Seagull=!0,A.Sistina=!0,A.Souvenir=!0,A.STIX=!0,A["Stone Informal"]=!0,A["Stone Serif"]=!0,A.Sylfaen=!0,A.Times=!0,A.Trajan=!0,A["Trinité"]=!0,A["Trump Mediaeval"]=!0,A.Utopia=!0,A["Vale Type"]=!0,A["Bitstream Vera"]=!0,A["Vera Serif"]=!0,A.Versailles=!0,A.Wanted=!0,A.Weiss=!0,A["Wide Latin"]=!0,A.Windsor=!0,A.XITS=!0})),da=mA((function(A){A.Dingbats=!0,A.Symbol=!0,A.ZapfDingbats=!0,A.Wingdings=!0,A["Wingdings-Bold"]=!0,A["Wingdings-Regular"]=!0})),fa=mA((function(A){A[2]=10,A[3]=32,A[4]=33,A[5]=34,A[6]=35,A[7]=36,A[8]=37,A[9]=38,A[10]=39,A[11]=40,A[12]=41,A[13]=42,A[14]=43,A[15]=44,A[16]=45,A[17]=46,A[18]=47,A[19]=48,A[20]=49,A[21]=50,A[22]=51,A[23]=52,A[24]=53,A[25]=54,A[26]=55,A[27]=56,A[28]=57,A[29]=58,A[30]=894,A[31]=60,A[32]=61,A[33]=62,A[34]=63,A[35]=64,A[36]=65,A[37]=66,A[38]=67,A[39]=68,A[40]=69,A[41]=70,A[42]=71,A[43]=72,A[44]=73,A[45]=74,A[46]=75,A[47]=76,A[48]=77,A[49]=78,A[50]=79,A[51]=80,A[52]=81,A[53]=82,A[54]=83,A[55]=84,A[56]=85,A[57]=86,A[58]=87,A[59]=88,A[60]=89,A[61]=90,A[62]=91,A[63]=92,A[64]=93,A[65]=94,A[66]=95,A[67]=96,A[68]=97,A[69]=98,A[70]=99,A[71]=100,A[72]=101,A[73]=102,A[74]=103,A[75]=104,A[76]=105,A[77]=106,A[78]=107,A[79]=108,A[80]=109,A[81]=110,A[82]=111,A[83]=112,A[84]=113,A[85]=114,A[86]=115,A[87]=116,A[88]=117,A[89]=118,A[90]=119,A[91]=120,A[92]=121,A[93]=122,A[94]=123,A[95]=124,A[96]=125,A[97]=126,A[98]=196,A[99]=197,A[100]=199,A[101]=201,A[102]=209,A[103]=214,A[104]=220,A[105]=225,A[106]=224,A[107]=226,A[108]=228,A[109]=227,A[110]=229,A[111]=231,A[112]=233,A[113]=232,A[114]=234,A[115]=235,A[116]=237,A[117]=236,A[118]=238,A[119]=239,A[120]=241,A[121]=243,A[122]=242,A[123]=244,A[124]=246,A[125]=245,A[126]=250,A[127]=249,A[128]=251,A[129]=252,A[130]=8224,A[131]=176,A[132]=162,A[133]=163,A[134]=167,A[135]=8226,A[136]=182,A[137]=223,A[138]=174,A[139]=169,A[140]=8482,A[141]=180,A[142]=168,A[143]=8800,A[144]=198,A[145]=216,A[146]=8734,A[147]=177,A[148]=8804,A[149]=8805,A[150]=165,A[151]=181,A[152]=8706,A[153]=8721,A[154]=8719,A[156]=8747,A[157]=170,A[158]=186,A[159]=8486,A[160]=230,A[161]=248,A[162]=191,A[163]=161,A[164]=172,A[165]=8730,A[166]=402,A[167]=8776,A[168]=8710,A[169]=171,A[170]=187,A[171]=8230,A[179]=8220,A[180]=8221,A[181]=8216,A[182]=8217,A[200]=193,A[203]=205,A[207]=211,A[210]=218,A[223]=711,A[224]=321,A[225]=322,A[226]=352,A[227]=353,A[228]=381,A[229]=382,A[233]=221,A[234]=253,A[252]=263,A[253]=268,A[254]=269,A[258]=258,A[260]=260,A[261]=261,A[265]=280,A[266]=281,A[267]=282,A[268]=283,A[269]=313,A[275]=323,A[276]=324,A[278]=328,A[283]=344,A[284]=345,A[285]=346,A[286]=347,A[292]=367,A[295]=377,A[296]=378,A[298]=380,A[305]=963,A[306]=964,A[307]=966,A[308]=8215,A[309]=8252,A[310]=8319,A[311]=8359,A[312]=8592,A[313]=8593,A[337]=9552,A[493]=1039,A[494]=1040,A[672]=1488,A[673]=1489,A[674]=1490,A[675]=1491,A[676]=1492,A[677]=1493,A[678]=1494,A[679]=1495,A[680]=1496,A[681]=1497,A[682]=1498,A[683]=1499,A[684]=1500,A[685]=1501,A[686]=1502,A[687]=1503,A[688]=1504,A[689]=1505,A[690]=1506,A[691]=1507,A[692]=1508,A[693]=1509,A[694]=1510,A[695]=1511,A[696]=1512,A[697]=1513,A[698]=1514,A[705]=1524,A[706]=8362,A[710]=64288,A[711]=64298,A[759]=1617,A[761]=1776,A[763]=1778,A[775]=1652,A[777]=1764,A[778]=1780,A[779]=1781,A[780]=1782,A[782]=771,A[783]=64726,A[786]=8363,A[788]=8532,A[790]=768,A[791]=769,A[792]=768,A[795]=803,A[797]=64336,A[798]=64337,A[799]=64342,A[800]=64343,A[801]=64344,A[802]=64345,A[803]=64362,A[804]=64363,A[805]=64364,A[2424]=7821,A[2425]=7822,A[2426]=7823,A[2427]=7824,A[2428]=7825,A[2429]=7826,A[2430]=7827,A[2433]=7682,A[2678]=8045,A[2679]=8046,A[2830]=1552,A[2838]=686,A[2840]=751,A[2842]=753,A[2843]=754,A[2844]=755,A[2846]=757,A[2856]=767,A[2857]=848,A[2858]=849,A[2862]=853,A[2863]=854,A[2864]=855,A[2865]=861,A[2866]=862,A[2906]=7460,A[2908]=7462,A[2909]=7463,A[2910]=7464,A[2912]=7466,A[2913]=7467,A[2914]=7468,A[2916]=7470,A[2917]=7471,A[2918]=7472,A[2920]=7474,A[2921]=7475,A[2922]=7476,A[2924]=7478,A[2925]=7479,A[2926]=7480,A[2928]=7482,A[2929]=7483,A[2930]=7484,A[2932]=7486,A[2933]=7487,A[2934]=7488,A[2936]=7490,A[2937]=7491,A[2938]=7492,A[2940]=7494,A[2941]=7495,A[2942]=7496,A[2944]=7498,A[2946]=7500,A[2948]=7502,A[2950]=7504,A[2951]=7505,A[2952]=7506,A[2954]=7508,A[2955]=7509,A[2956]=7510,A[2958]=7512,A[2959]=7513,A[2960]=7514,A[2962]=7516,A[2963]=7517,A[2964]=7518,A[2966]=7520,A[2967]=7521,A[2968]=7522,A[2970]=7524,A[2971]=7525,A[2972]=7526,A[2974]=7528,A[2975]=7529,A[2976]=7530,A[2978]=1537,A[2979]=1538,A[2980]=1539,A[2982]=1549,A[2983]=1551,A[2984]=1552,A[2986]=1554,A[2987]=1555,A[2988]=1556,A[2990]=1623,A[2991]=1624,A[2995]=1775,A[2999]=1791,A[3002]=64290,A[3003]=64291,A[3004]=64292,A[3006]=64294,A[3007]=64295,A[3008]=64296,A[3011]=1900,A[3014]=8223,A[3015]=8244,A[3017]=7532,A[3018]=7533,A[3019]=7534,A[3075]=7590,A[3076]=7591,A[3079]=7594,A[3080]=7595,A[3083]=7598,A[3084]=7599,A[3087]=7602,A[3088]=7603,A[3091]=7606,A[3092]=7607,A[3095]=7610,A[3096]=7611,A[3099]=7614,A[3100]=7615,A[3103]=7618,A[3104]=7619,A[3107]=8337,A[3108]=8338,A[3116]=1884,A[3119]=1885,A[3120]=1885,A[3123]=1886,A[3124]=1886,A[3127]=1887,A[3128]=1887,A[3131]=1888,A[3132]=1888,A[3135]=1889,A[3136]=1889,A[3139]=1890,A[3140]=1890,A[3143]=1891,A[3144]=1891,A[3147]=1892,A[3148]=1892,A[3153]=580,A[3154]=581,A[3157]=584,A[3158]=585,A[3161]=588,A[3162]=589,A[3165]=891,A[3166]=892,A[3169]=1274,A[3170]=1275,A[3173]=1278,A[3174]=1279,A[3181]=7622,A[3182]=7623,A[3282]=11799,A[3316]=578,A[3379]=42785,A[3393]=1159,A[3416]=8377})),pa=mA((function(A){A[227]=322,A[264]=261,A[291]=346})),ma=mA((function(A){A[1]=32,A[4]=65,A[5]=192,A[6]=193,A[9]=196,A[17]=66,A[18]=67,A[21]=268,A[24]=68,A[28]=69,A[29]=200,A[30]=201,A[32]=282,A[38]=70,A[39]=71,A[44]=72,A[47]=73,A[48]=204,A[49]=205,A[58]=74,A[60]=75,A[62]=76,A[68]=77,A[69]=78,A[75]=79,A[76]=210,A[80]=214,A[87]=80,A[89]=81,A[90]=82,A[92]=344,A[94]=83,A[97]=352,A[100]=84,A[104]=85,A[109]=220,A[115]=86,A[116]=87,A[121]=88,A[122]=89,A[124]=221,A[127]=90,A[129]=381,A[258]=97,A[259]=224,A[260]=225,A[263]=228,A[268]=261,A[271]=98,A[272]=99,A[273]=263,A[275]=269,A[282]=100,A[286]=101,A[287]=232,A[288]=233,A[290]=283,A[295]=281,A[296]=102,A[336]=103,A[346]=104,A[349]=105,A[350]=236,A[351]=237,A[361]=106,A[364]=107,A[367]=108,A[371]=322,A[373]=109,A[374]=110,A[381]=111,A[382]=242,A[383]=243,A[386]=246,A[393]=112,A[395]=113,A[396]=114,A[398]=345,A[400]=115,A[401]=347,A[403]=353,A[410]=116,A[437]=117,A[442]=252,A[448]=118,A[449]=119,A[454]=120,A[455]=121,A[457]=253,A[460]=122,A[462]=382,A[463]=380,A[853]=44,A[855]=58,A[856]=46,A[876]=47,A[878]=45,A[882]=45,A[894]=40,A[895]=41,A[896]=91,A[897]=93,A[923]=64,A[1004]=48,A[1005]=49,A[1006]=50,A[1007]=51,A[1008]=52,A[1009]=53,A[1010]=54,A[1011]=55,A[1012]=56,A[1013]=57,A[1081]=37,A[1085]=43,A[1086]=45}));function ya(A){const e=Ba(A);return Qa()[e]}function wa(A){const e=Ba(A);return!!(Qa()[e]||Ea()[e]||ua()[e]||da()[e])}class Da{constructor(A=[]){this._map=A}get length(){return this._map.length}forEach(A){for(const e in this._map)A(e,this._map[e].charCodeAt(0))}has(A){return void 0!==this._map[A]}get(A){return this._map[A]}charCodeOf(A){const e=this._map;if(e.length<=65536)return e.indexOf(A);for(const t in e)if(e[t]===A)return 0|t;return-1}amend(A){for(const e in A)this._map[e]=A[e]}}class ba{constructor(A,e){this.firstChar=A,this.lastChar=e}get length(){return this.lastChar+1-this.firstChar}forEach(A){for(let e=this.firstChar,t=this.lastChar;e<=t;e++)A(e,e)}has(A){return this.firstChar<=A&&A<=this.lastChar}get(A){if(this.firstChar<=A&&A<=this.lastChar)return String.fromCharCode(A)}charCodeOf(A){return Number.isInteger(A)&&A>=this.firstChar&&A<=this.lastChar?A:-1}amend(A){G("Should not call amend()")}}class ka{constructor(A,e){this.properties=e;const t=new Yi(A,e,oa);this.cff=t.parse(),this.cff.duplicateFirstGlyph();const i=new Aa(this.cff);this.seacs=this.cff.seacs;try{this.data=i.compile()}catch{R("Failed to compile font "+e.loadedName),this.data=A}this._createBuiltInEncoding()}get numGlyphs(){return this.cff.charStrings.count}getCharset(){return this.cff.charset.charset}getGlyphMapping(){const A=this.cff,e=this.properties,{cidToGidMap:t,cMap:i}=e,a=A.charset.charset;let s,n;if(e.composite){let e,g;if(t?.length>0){e=Object.create(null);for(let A=0,i=t.length;A=0){const i=t[e];i&&(a[A]=i)}}a.length>0&&(this.properties.builtInEncoding=a)}}function Fa(A,e){return(A[e]<<24|A[e+1]<<16|A[e+2]<<8|A[e+3])>>>0}function Sa(A,e){return A[e]<<8|A[e+1]}function Ra(A,e){return(A[e]<<24|A[e+1]<<16)>>16}function Ga(A,e){return A[e]<<24>>24}function Na(A,e){return Ra(A,e)/16384}function xa(A){const e=A.length;let t=32768;return e<1240?t=107:e<33900&&(t=1131),t}function Ua(A,e,t){const i=1===Sa(A,e+2)?Fa(A,e+8):Fa(A,e+16),a=Sa(A,e+i);let s,n,g;if(4===a){Sa(A,e+i+2);const t=Sa(A,e+i+6)>>1;for(n=e+i+14,s=[],g=0;g>1;t0;)B.push({flags:r})}for(t=0;t>1,m=!0;break;case 4:o+=g.pop(),a(r,o),m=!0;break;case 5:for(;g.length>0;)r+=g.shift(),o+=g.shift(),s(r,o);break;case 6:for(;g.length>0&&(r+=g.shift(),s(r,o),0!==g.length);)o+=g.shift(),s(r,o);break;case 7:for(;g.length>0&&(o+=g.shift(),s(r,o),0!==g.length);)r+=g.shift(),s(r,o);break;case 8:for(;g.length>0;)B=r+g.shift(),Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+g.shift(),n(B,Q,h,l,r,o);break;case 10:if(f=g.pop(),p=null,t.isCFFCIDFont){const A=t.fdSelect.getFDIndex(i);if(A>=0&&AMath.abs(o-e)?r+=g.shift():o+=g.shift(),n(B,Q,h,l,r,o);break;default:throw new K(`unknown operator: 12 ${y}`)}break;case 14:if(g.length>=4){const A=g.pop(),i=g.pop();o=g.pop(),r=g.pop(),e.add(5),e.add(8,[r,o]);let a=La(t.cmap,String.fromCharCode(t.glyphNameMap[Gi[A]]));Ha(t.glyphs[a.glyphId],e,t,a.glyphId),e.add(4),a=La(t.cmap,String.fromCharCode(t.glyphNameMap[Gi[i]])),Ha(t.glyphs[a.glyphId],e,t,a.glyphId)}return;case 19:case 20:I+=g.length>>1,C+=I+7>>3,m=!0;break;case 21:o+=g.pop(),r+=g.pop(),a(r,o),m=!0;break;case 22:r+=g.pop(),a(r,o),m=!0;break;case 24:for(;g.length>2;)B=r+g.shift(),Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+g.shift(),n(B,Q,h,l,r,o);r+=g.shift(),o+=g.shift(),s(r,o);break;case 25:for(;g.length>6;)r+=g.shift(),o+=g.shift(),s(r,o);B=r+g.shift(),Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+g.shift(),n(B,Q,h,l,r,o);break;case 26:for(g.length%2&&(r+=g.shift());g.length>0;)B=r,Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h,o=l+g.shift(),n(B,Q,h,l,r,o);break;case 27:for(g.length%2&&(o+=g.shift());g.length>0;)B=r+g.shift(),Q=o,h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l,n(B,Q,h,l,r,o);break;case 28:g.push((c[C]<<24|c[C+1]<<16)>>16),C+=2;break;case 29:f=g.pop()+t.gsubrsBias,p=t.gsubrs[f],p&&A(p);break;case 30:for(;g.length>0&&(B=r,Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+(1===g.length?g.shift():0),n(B,Q,h,l,r,o),0!==g.length);)B=r+g.shift(),Q=o,h=B+g.shift(),l=Q+g.shift(),o=l+g.shift(),r=h+(1===g.length?g.shift():0),n(B,Q,h,l,r,o);break;case 31:for(;g.length>0&&(B=r+g.shift(),Q=o,h=B+g.shift(),l=Q+g.shift(),o=l+g.shift(),r=h+(1===g.length?g.shift():0),n(B,Q,h,l,r,o),0!==g.length);)B=r,Q=o+g.shift(),h=B+g.shift(),l=Q+g.shift(),r=h+g.shift(),o=l+(1===g.length?g.shift():0),n(B,Q,h,l,r,o);break;default:if(y<32)throw new K(`unknown operator: ${y}`);y<247?g.push(y-139):y<251?g.push(256*(y-247)+c[C++]+108):y<255?g.push(256*-(y-251)-c[C++]-108):(g.push((c[C]<<24|c[C+1]<<16|c[C+2]<<8|c[C+3])/65536),C+=4)}m&&(g.length=0)}}(A)}const Ya=[];class va{cmds=[];add(A,e){if(e)if(LA(e,null))this.cmds.push(A,...e);else{R(`Commands.add - "${A}" has at least one non-number arg: "${e}".`);const t=e.map((A=>"number"==typeof A?A:0));this.cmds.push(A,...t)}else this.cmds.push(A)}}class Ka{constructor(A){this.fontMatrix=A,this.compiledGlyphs=Object.create(null),this.compiledCharCodeToGlyphId=Object.create(null)}getPathJs(A){const{charCode:e,glyphId:t}=La(this.cmap,A);let i,a=this.compiledGlyphs[t];if(!a){try{a=this.compileGlyph(this.glyphs[t],t)}catch(A){a=Ya,i=A}this.compiledGlyphs[t]=a}if(this.compiledCharCodeToGlyphId[e]??=t,i)throw i;return a}compileGlyph(A,e){if(!A||0===A.length||14===A[0])return Ya;let t=this.fontMatrix;if(this.isCFFCIDFont){const A=this.fdSelect.getFDIndex(e);A>=0&&A2*Sa(A,e));const s=[];let n=a(e,0);for(let t=i;tA+(e.getSize()+3&-4)),0)}write(){const A=this.getSize(),e=new DataView(new ArrayBuffer(A)),t=A>131070,i=t?4:2,a=new DataView(new ArrayBuffer((this.glyphs.length+1)*i));t?a.setUint32(0,0):a.setUint16(0,0);let s=0,n=0;for(const A of this.glyphs)s+=A.write(s,e),s=s+3&-4,n+=i,t?a.setUint32(n,s):a.setUint16(n,s>>1);return{isLocationLong:t,loca:new Uint8Array(a.buffer),glyf:new Uint8Array(e.buffer)}}scale(A){for(let e=0,t=this.glyphs.length;eA+e.getSize()),0);return this.header.getSize()+A}write(A,e){if(!this.header)return 0;const t=A;if(A+=this.header.write(A,e),this.simple)A+=this.simple.write(A,e);else for(const t of this.composites)A+=t.write(A,e);return A-t}scale(A){if(!this.header)return;const e=(this.header.xMin+this.header.xMax)/2;if(this.header.scale(e,A),this.simple)this.simple.scale(e,A);else for(const t of this.composites)t.scale(e,A)}}class Va{constructor({numberOfContours:A,xMin:e,yMin:t,xMax:i,yMax:a}){this.numberOfContours=A,this.xMin=e,this.yMin=t,this.xMax=i,this.yMax=a}static parse(A,e){return[10,new Va({numberOfContours:e.getInt16(A),xMin:e.getInt16(A+2),yMin:e.getInt16(A+4),xMax:e.getInt16(A+6),yMax:e.getInt16(A+8)})]}getSize(){return 10}write(A,e){return e.setInt16(A,this.numberOfContours),e.setInt16(A+2,this.xMin),e.setInt16(A+4,this.yMin),e.setInt16(A+6,this.xMax),e.setInt16(A+8,this.yMax),10}scale(A,e){this.xMin=Math.round(A+(this.xMin-A)*e),this.xMax=Math.round(A+(this.xMax-A)*e)}}class ja{constructor({flags:A,xCoordinates:e,yCoordinates:t}){this.xCoordinates=e,this.yCoordinates=t,this.flags=A}}class za{constructor({contours:A,instructions:e}){this.contours=A,this.instructions=e}static parse(A,e,t){const i=[];for(let a=0;a255?A+=2:g>0&&(A+=1),e=s,g=Math.abs(n-t),g>255?A+=2:g>0&&(A+=1),t=n}}return A}write(A,e){const t=A,i=[],a=[],s=[];let n=0,g=0;for(const t of this.contours){for(let A=0,e=t.xCoordinates.length;A=0?18:2,i.push(A)):i.push(o)}n=r;const I=t.yCoordinates[A];if(o=I-g,0===o)e|=32,a.push(0);else{const A=Math.abs(o);A<=255?(e|=o>=0?36:4,a.push(A)):a.push(o)}g=I,s.push(e)}e.setUint16(A,i.length-1),A+=2}e.setUint16(A,this.instructions.length),A+=2,this.instructions.length&&(new Uint8Array(e.buffer,0,e.buffer.byteLength).set(this.instructions,A),A+=this.instructions.length);for(const t of s)e.setUint8(A++,t);for(let t=0,a=i.length;t=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(A+=2):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(A+=2),A}write(A,e){const t=A;return 2&this.flags?this.argument1>=-128&&this.argument1<=127&&this.argument2>=-128&&this.argument2<=127||(this.flags|=1):this.argument1>=0&&this.argument1<=255&&this.argument2>=0&&this.argument2<=255||(this.flags|=1),e.setUint16(A,this.flags),e.setUint16(A+2,this.glyphIndex),A+=4,1&this.flags?(2&this.flags?(e.setInt16(A,this.argument1),e.setInt16(A+2,this.argument2)):(e.setUint16(A,this.argument1),e.setUint16(A+2,this.argument2)),A+=4):(e.setUint8(A,this.argument1),e.setUint8(A+1,this.argument2),A+=2),256&this.flags&&(e.setUint16(A,this.instructions.length),A+=2,this.instructions.length&&(new Uint8Array(e.buffer,0,e.buffer.byteLength).set(this.instructions,A),A+=this.instructions.length)),A-t}scale(A,e){}}function $a(A,e,t){A[e]=t>>8&255,A[e+1]=255&t}function As(A,e,t){A[e]=t>>24&255,A[e+1]=t>>16&255,A[e+2]=t>>8&255,A[e+3]=255&t}function es(A,e,t){if(t instanceof Uint8Array)A.set(t,e);else if("string"==typeof t)for(let i=0,a=t.length;it;)t<<=1,i++;const a=t*e;return{range:a,entry:i,rangeShift:e*A-a}}toArray(){let A=this.sfnt;const e=this.tables,t=Object.keys(e);t.sort();const i=t.length;let a,s,n,g,r,o=12+16*i;const I=[o];for(a=0;a>>0,I.push(o);const c=new Uint8Array(o);for(a=0;a>>0;As(c,o+4,A),As(c,o+8,I[a]),As(c,o+12,e[r].length),o+=16}return c}addTable(A,e){if(A in this.tables)throw new Error("Table "+A+" already exists");this.tables[A]=e}}const is=[4],as=[5],ss=[6],ns=[7],gs=[8],rs=[12,35],os=[14],Is=[21],cs=[22],Cs=[30],Bs=[31];class hs{constructor(){this.width=0,this.lsb=0,this.flexing=!1,this.output=[],this.stack=[]}convert(A,e,t){const i=A.length;let a,s,n,g=!1;for(let r=0;ri)return!0;const a=i-A;for(let A=a;A>8&255,255&e):(e=65536*e|0,this.output.push(255,e>>24&255,e>>16&255,e>>8&255,255&e))}return this.output.push(...e),t?this.stack.splice(a,A):this.stack.length=0,!1}}function Qs(A){return A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102}function ls(A,e,t){if(t>=A.length)return new Uint8Array(0);let i,a,s=0|e;for(i=0;i>8,s=52845*(e+s)+22719&65535}return g}function Es(A){return 47===A||91===A||93===A||123===A||125===A||40===A||41===A}class us{constructor(A,e,t){if(e){const e=A.getBytes(),t=!((Qs(e[0])||MA(e[0]))&&Qs(e[1])&&Qs(e[2])&&Qs(e[3])&&Qs(e[4])&&Qs(e[5])&&Qs(e[6])&&Qs(e[7]));A=new ae(t?ls(e,55665,4):function(A){let e=55665;const t=A.length,i=new Uint8Array(t>>>1);let a,s;for(a=0,s=0;a>8,e=52845*(A+e)+22719&65535}}return i.slice(4,s)}(e))}this.seacAnalysisEnabled=!!t,this.stream=A,this.nextChar()}readNumberArray(){this.getToken();const A=[];for(;;){const e=this.getToken();if(null===e||"]"===e||"}"===e)break;A.push(parseFloat(e||0))}return A}readNumber(){const A=this.getToken();return parseFloat(A||0)}readInt(){const A=this.getToken();return 0|parseInt(A||0,10)}readBoolean(){return"true"===this.getToken()?1:0}nextChar(){return this.currentChar=this.stream.getByte()}prevChar(){return this.stream.skip(-2),this.currentChar=this.stream.getByte()}getToken(){let A=!1,e=this.currentChar;for(;;){if(-1===e)return null;if(A)10!==e&&13!==e||(A=!1);else if(37===e)A=!0;else if(!MA(e))break;e=this.nextChar()}if(Es(e))return this.nextChar(),String.fromCharCode(e);let t="";do{t+=String.fromCharCode(e),e=this.nextChar()}while(e>=0&&!MA(e)&&!Es(e));return t}readCharStrings(A,e){return-1===e?A:ls(A,4330,e)}extractFontProgram(A){const e=this.stream,t=[],i=[],a=Object.create(null);a.lenIV=4;const s={subrs:[],charstrings:[],properties:{privateData:a}};let n,g,r,o;for(;null!==(n=this.getToken());)if("/"===n)switch(n=this.getToken(),n){case"CharStrings":for(this.getToken(),this.getToken(),this.getToken(),this.getToken();n=this.getToken(),null!==n&&"end"!==n;){if("/"!==n)continue;const A=this.getToken();g=this.readInt(),this.getToken(),r=g>0?e.getBytes(g):new Uint8Array(0),o=s.properties.privateData.lenIV;const t=this.readCharStrings(r,o);this.nextChar(),n=this.getToken(),"noaccess"===n?this.getToken():"/"===n&&this.prevChar(),i.push({glyph:A,encoded:t})}break;case"Subrs":for(this.readInt(),this.getToken();"dup"===this.getToken();){const A=this.readInt();g=this.readInt(),this.getToken(),r=g>0?e.getBytes(g):new Uint8Array(0),o=s.properties.privateData.lenIV;const i=this.readCharStrings(r,o);this.nextChar(),n=this.getToken(),"noaccess"===n&&this.getToken(),t[A]=i}break;case"BlueValues":case"OtherBlues":case"FamilyBlues":case"FamilyOtherBlues":const A=this.readNumberArray();A.length>0&&A.length;break;case"StemSnapH":case"StemSnapV":s.properties.privateData[n]=this.readNumberArray();break;case"StdHW":case"StdVW":s.properties.privateData[n]=this.readNumberArray()[0];break;case"BlueShift":case"lenIV":case"BlueFuzz":case"BlueScale":case"LanguageGroup":s.properties.privateData[n]=this.readNumber();break;case"ExpansionFactor":s.properties.privateData[n]=this.readNumber()||.06;break;case"ForceBold":s.properties.privateData[n]=this.readBoolean()}for(const{encoded:e,glyph:a}of i){const i=new hs,n=i.convert(e,t,this.seacAnalysisEnabled);let g=i.output;n&&(g=[14]);const r={glyphName:a,charstring:g,width:i.width,lsb:i.lsb,seac:i.seac};if(".notdef"===a?s.charstrings.unshift(r):s.charstrings.push(r),A.builtInEncoding){const e=A.builtInEncoding.indexOf(a);e>-1&&void 0===A.widths[e]&&e>=A.firstChar&&e<=A.lastChar&&(A.widths[e]=i.width)}}return s}extractFontHeader(A){let e;for(;null!==(e=this.getToken());)if("/"===e)switch(e=this.getToken(),e){case"FontMatrix":const t=this.readNumberArray();A.fontMatrix=t;break;case"Encoding":const i=this.getToken();let a;if(/^\d+$/.test(i)){a=[];const A=0|parseInt(i,10);this.getToken();for(let t=0;t=a){for(n+=t;n=0&&(i[A]=a)}return Ca(A,i,t)}hasGlyphId(A){return!(A<0||A>=this.numGlyphs)&&(0===A||this.charstrings[A-1].charstring.length>0)}getSeacs(A){const e=[];for(let t=0,i=A.length;t0;A--)e[A]-=e[A-1];B.setByName(A,e)}s.topDict.privateDict=B;const Q=new Ti;for(I=0,c=i.length;I0&&A.toUnicode.amend(e)}class ks{constructor(A,e,t,i,a,s,n,g,r){this.originalCharCode=A,this.fontChar=e,this.unicode=t,this.accent=i,this.width=a,this.vmetric=s,this.operatorListId=n,this.isSpace=g,this.isInFont=r}get category(){return U(this,"category",function(A){const e=ra.get(A);if(e)return e;const t=A.match(ga),i={isWhitespace:!!t?.[1],isZeroWidthDiacritic:!!t?.[2],isInvisibleFormatMark:!!t?.[3]};return ra.set(A,i),i}(this.unicode),!0)}}function Fs(A,e){return(A<<8)+e}function Ss(A,e,t){A[e+1]=t,A[e]=t>>>8}function Rs(A,e){const t=(A<<8)+e;return 32768&t?t-65536:t}function Gs(A){return String.fromCharCode(A>>8&255,255&A)}function Ns(A){return A>32767?A=32767:A<-32768&&(A=-32768),String.fromCharCode(A>>8&255,255&A)}function xs(A){return"ttcf"===T(A.peekBytes(4))}function Us(A,e){for(const t in e)A[+t]=e[t]}function Ms(A,e,t){const i=[];let a;for(let t=0,s=A.length;tI){if(r++,r>=ps.length){R("Ran out of space in font private use area.");break}o=ps[r][0],I=ps[r][1]}const h=o++;0===B&&(B=t);let Q=i.get(C);"string"==typeof Q&&(Q=Q.codePointAt(0)),!Q||(c=Q,ps[0][0]<=c&&c<=ps[0][1]||ps[1][0]<=c&&c<=ps[1][1])||g.has(B)||(s.set(Q,B),g.add(B)),a[h]=B,n[C]=h}var c;return{toFontChar:n,charCodeToGlyphId:a,toUnicodeExtraMap:s,nextAvailableFontCharCode:o}}function vs(A,e,t){const i=function(A,e,t){const i=[];for(const e in A)A[e]>=t||i.push({fontCharCode:0|e,glyphId:A[e]});if(e)for(const[A,a]of e)a>=t||i.push({fontCharCode:A,glyphId:a});0===i.length&&i.push({fontCharCode:0,glyphId:0}),i.sort((function(A,e){return A.fontCharCode-e.fontCharCode}));const a=[],s=i.length;for(let A=0;A65535?2:1;let s,n,g,r,o="\0\0"+Gs(a)+"\0\0"+W(4+8*a);for(s=i.length-1;s>=0&&!(i[s][0]<=65535);--s);const I=s+1;i[s][0]<65535&&65535===i[s][1]&&(i[s][1]=65534);const c=i[s][1]<65535?1:0,C=I+c,B=ts.getSearchParams(C,2);let h,Q,l,E,u="",d="",f="",p="",m="",y=0;for(s=0,n=I;s0&&(d+="ÿÿ",u+="ÿÿ",f+="\0",p+="\0\0");const w="\0\0"+Gs(2*C)+Gs(B.range)+Gs(B.entry)+Gs(B.rangeShift)+d+"\0\0"+u+f+p+m;let D="",b="";if(a>1){for(o+="\0\0\n"+W(4+8*a+4+w.length),D="",s=0,n=i.length;sA||!g)&&(g=A),r 123 are reserved for internal usage");n|=1<65535&&(r=65535)}else g=0,r=255;const I=A.bbox||[0,0,0,0],c=t.unitsPerEm||(A.fontMatrix?1/Math.max(...A.fontMatrix.slice(0,4).map(Math.abs)):1e3),C=A.ascentScaled?1:c/ms,B=t.ascent||Math.round(C*(A.ascent||I[3]));let h=t.descent||Math.round(C*(A.descent||I[1]));h>0&&A.descent>0&&I[1]<0&&(h=-h);const Q=t.yMax||B,l=-t.yMin||-h;return"\0$ô\0\0\0Š»\0\0\0ŒŠ»\0\0ß\x001\0\0\0\0"+String.fromCharCode(A.fixedPitch?9:0)+"\0\0\0\0\0\0"+W(i)+W(a)+W(s)+W(n)+"*21*"+Gs(A.italicAngle?1:0)+Gs(g||A.firstChar)+Gs(r||A.lastChar)+Gs(B)+Gs(h)+"\0d"+Gs(Q)+Gs(l)+"\0\0\0\0\0\0\0\0"+Gs(A.xHeight)+Gs(A.capHeight)+Gs(0)+Gs(g||A.firstChar)+"\0"}function qs(A){return"\0\0\0"+W(Math.floor(65536*A.italicAngle))+"\0\0\0\0"+W(A.fixedPitch?1:0)+"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}function Ts(A){return A.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g,"").slice(0,63)}function Ps(A,e){e||(e=[[],[]]);const t=[e[0][0]||"Original licence",e[0][1]||A,e[0][2]||"Unknown",e[0][3]||"uniqueID",e[0][4]||A,e[0][5]||"Version 0.11",e[0][6]||Ts(A),e[0][7]||"Unknown",e[0][8]||"Unknown",e[0][9]||"Unknown"],i=[];let a,s,n,g,r;for(a=0,s=t.length;a=1&&e[3]>=1&&e[3]<=4}(A)?i?(a="CIDFontType0",s="CIDFontType0C"):(a="MMType1"===e?"MMType1":"Type1",s="Type1C"):(R("getFontFileType: Unable to detect correct font file Type/Subtype."),a=e,s=t),[a,s]}(e,t),a===this.type&&s===this.subtype||S(`Inconsistent font file Type/SubType, expected: ${this.type}/${this.subtype} but found: ${a}/${s}.`);try{switch(a){case"MMType1":S("MMType1 font ("+A+"), falling back to Type1.");case"Type1":case"CIDFontType0":this.mimetype="font/opentype";const i="Type1C"===s||"CIDFontType0C"===s?new ka(e,t):new fs(A,e,t);Ds(t),g=this.convert(A,i,t);break;case"OpenType":case"TrueType":case"CIDFontType2":this.mimetype="font/opentype",g=this.checkAndRepair(A,e,t),this.isOpenType&&(Ds(t),a="OpenType");break;default:throw new K(`Font ${a} is not supported`)}}catch(A){return R(A),void this.fallbackToSystemFont(t)}bs(t),this.data=g,this.type=a,this.subtype=s,this.fontMatrix=t.fontMatrix,this.widths=t.widths,this.defaultWidth=t.defaultWidth,this.toUnicode=t.toUnicode,this.seacMap=t.seacMap}get renderer(){return U(this,"renderer",Pa.create(this,oa))}exportData(A=!1){const e=A?[...ys,...ws]:ys,t=Object.create(null);let i,a;for(i of e)a=this[i],void 0!==a&&(t[i]=a);return t}fallbackToSystemFont(A){this.missingFile=!0;const{name:e,type:t}=this;let i=Ba(e);const a=Qa(),s=Ea(),n=!!a[i],g=!(!s[i]||!a[s[i]]);i=a[i]||s[i]||i;const r=Za()[i];r&&(isNaN(this.ascent)&&(this.ascent=r.ascent/ms),isNaN(this.descent)&&(this.descent=r.descent/ms),isNaN(this.capHeight)&&(this.capHeight=r.capHeight/ms)),this.bold=/bold/gi.test(i),this.italic=/oblique|italic/gi.test(i),this.black=/Black/g.test(e);const o=/Narrow/g.test(e);if(this.remeasure=(!n||o)&&Object.keys(this.widths).length>0,(n||g)&&"CIDFontType2"===t&&this.cidEncoding.startsWith("Identity-")){const t=A.cidToGidMap,i=[];if(Us(i,fa()),/Arial-?Black/i.test(e)?Us(i,pa()):/Calibri/i.test(e)&&Us(i,ma()),t){for(const A in i){const e=i[A];void 0!==t[e]&&(i[+A]=t[e])}t.length!==this.toUnicode.length&&A.hasIncludedToUnicodeMap&&this.toUnicode instanceof ba&&this.toUnicode.forEach((function(A,e){const a=i[A];void 0===t[a]&&(i[+A]=e)}))}this.toUnicode instanceof ba||this.toUnicode.forEach((function(A,e){i[+A]=e})),this.toFontChar=i,this.toUnicode=new Da(i)}else if(/Symbol/i.test(i))this.toFontChar=Ms(xi,ea(),this.differences);else if(/Dingbats/i.test(i))this.toFontChar=Ms(Ui,ta(),this.differences);else if(n||g){const A=Ms(this.defaultEncoding,ea(),this.differences);"CIDFontType2"!==t||this.cidEncoding.startsWith("Identity-")||this.toUnicode instanceof ba||this.toUnicode.forEach((function(e,t){A[+e]=t})),this.toFontChar=A}else{const A=ea(),t=[];this.toUnicode.forEach(((e,i)=>{if(!this.composite){const t=aa(this.differences[e]||this.defaultEncoding[e],A);-1!==t&&(i=t)}t[+e]=i})),this.composite&&this.toUnicode instanceof ba&&/Tahoma|Verdana/i.test(e)&&Us(t,fa()),this.toFontChar=t}bs(A),this.loadedName=i.split("-",1)[0]}checkAndRepair(A,e,t){const i=["OS/2","cmap","head","hhea","hmtx","maxp","name","post","loca","glyf","fpgm","prep","cvt ","CFF "];function a(A,e){const t=Object.create(null);t["OS/2"]=null,t.cmap=null,t.head=null,t.hhea=null,t.hmtx=null,t.maxp=null,t.name=null,t.post=null;for(let a=0;a>>0,i=A.getInt32()>>>0,a=A.getInt32()>>>0,s=A.pos;A.pos=A.start||0,A.skip(i);const n=A.getBytes(a);return A.pos=s,"head"===e&&(n[8]=n[9]=n[10]=n[11]=0,n[17]|=32),{tag:e,checksum:t,length:a,offset:i,data:n}}function n(A){return{version:A.getString(4),numTables:A.getUint16(),searchRange:A.getUint16(),entrySelector:A.getUint16(),rangeShift:A.getUint16()}}function g(A,e,t,i,a,s){const n={length:0,sizeOfInstructions:0};if(e<0||e>=A.length||t>A.length||t-e<=12)return n;const g=A.subarray(e,t),r=Rs(g[2],g[3]),o=Rs(g[4],g[5]),I=Rs(g[6],g[7]),c=Rs(g[8],g[9]);r>I&&(Ss(g,2,I),Ss(g,6,r)),o>c&&(Ss(g,4,c),Ss(g,8,o));const C=Rs(g[0],g[1]);if(C<0)return C<-1||(i.set(g,a),n.length=g.length),n;let B,h=10,Q=0;for(B=0;Bg.length?n:!s&&E>0?(i.set(g.subarray(0,l),a),i.set([0,0],a+l),i.set(g.subarray(u,f),a+l+2),f-=E,g.length-f>3&&(f=f+3&-4),n.length=f,n):g.length-f>3?(f=f+3&-4,i.set(g.subarray(0,f),a),n.length=f,n):(i.set(g,a),n.length=g.length,n)}function r(A){const t=(e.start||0)+A.offset;e.pos=t;const i=[[],[]],a=[],s=A.length,n=t+s;if(0!==e.getUint16()||s<6)return[i,a];const g=e.getUint16(),r=e.getUint16();let o,I;for(o=0;on)continue;e.pos=s;const g=A.name;if(A.encoding){let t="";for(let i=0,a=A.length;i0&&(r+=A-1)}}else(l||u)&&(R("TT: nested FDEFs not allowed"),Q=!0),l=!0,c=r,s=C.pop(),e.functionsDefined[s]={data:g,i:r};else if(!l&&!u)if(s=C.at(-1),isNaN(s))S("TT: CALL empty stack (or invalid entry).");else if(e.functionsUsed[s]=!0,s in e.functionsStackDeltas){const A=C.length+e.functionsStackDeltas[s];if(A<0)return R("TT: CALL invalid functions stack delta."),void(e.hintsValid=!1);C.length=A}else if(s in e.functionsDefined&&!h.includes(s)){if(B.push({data:g,i:r,stackTop:C.length-1}),h.push(s),n=e.functionsDefined[s],!n)return R("TT: CALL non-existent function"),void(e.hintsValid=!1);g=n.data,r=n.i}if(!l&&!u){let e=0;for(A<=142?e=o[A]:A>=192&&A<=223?e=-1:A>=224&&(e=-2),A>=113&&A<=117&&(i=C.pop(),isNaN(i)||(e=2*-i));e<0&&C.length>0;)C.pop(),e++;for(;e>0;)C.push(NaN),e--}}e.tooComplexToFollowFunctions=Q;const d=[g];r>g.length&&d.push(new Uint8Array(r-g.length)),c>I&&(R("TT: complementing a missing function tail"),d.push(new Uint8Array([34,45]))),function(A,e){if(e.length>1){let t,i,a=0;for(t=0,i=e.length;t>>0,s=[];for(let e=0;e>>0);const n={ttcTag:e,majorVersion:t,minorVersion:i,numFonts:a,offsetTable:s};switch(t){case 1:return n;case 2:return n.dsigTag=A.getInt32()>>>0,n.dsigLength=A.getInt32()>>>0,n.dsigOffset=A.getInt32()>>>0,n}throw new K(`Invalid TrueType Collection majorVersion: ${t}.`)}(A),s=e.split("+");let g;for(let o=0;o0||!(t.cMap instanceof Ii));if("OTTO"===c.version&&!e||!C.head||!C.hhea||!C.maxp||!C.post)return h=new ae(C["CFF "].data),B=new ka(h,t),Ds(t),this.convert(A,B,t);delete C.glyf,delete C.loca,delete C.fpgm,delete C.prep,delete C["cvt "],this.isOpenType=!0}if(!C.maxp)throw new K('Required "maxp" table is not found');e.pos=(e.start||0)+C.maxp.offset;let l=e.getInt32();const E=e.getUint16();if(65536!==l&&20480!==l){if(6===C.maxp.length)l=20480;else{if(!(C.maxp.length>=32))throw new K('"maxp" table has a wrong version number');l=65536}d=l,(u=C.maxp.data)[3+0]=255&d,u[2]=d>>>8,u[1]=d>>>16,u[0]=d>>>24}var u,d;if(t.scaleFactors?.length===E&&Q){const{scaleFactors:A}=t,e=Fs(C.head.data[50],C.head.data[51]),i=new Oa({glyfTable:C.glyf.data,isGlyphLocationsLong:e,locaTable:C.loca.data,numGlyphs:E});i.scale(A);const{glyf:a,loca:s,isLocationLong:n}=i.write();C.glyf.data=a,C.loca.data=s,n!==!!e&&(C.head.data[50]=0,C.head.data[51]=n?1:0);const g=C.hmtx.data;for(let e=0;e>8&255,g[t+1]=255&i,Ss(g,t+2,Math.round(A[e]*Rs(g[t+2],g[t+3])))}}let f=E+1,p=!0;f>65535&&(p=!1,f=E,R("Not enough space in glyfs to duplicate first glyph."));let m=0,y=0;l>=65536&&C.maxp.length>=32&&(e.pos+=8,e.getUint16()>2&&(C.maxp.data[14]=0,C.maxp.data[15]=2),e.pos+=4,m=e.getUint16(),e.pos+=4,y=e.getUint16()),C.maxp.data[4]=f>>8,C.maxp.data[5]=255&f;const w=function(A,e,t,i){const a={functionsDefined:[],functionsUsed:[],functionsStackDeltas:[],tooComplexToFollowFunctions:!1,hintsValid:!0};if(A&&I(A,a),e&&I(e,a),A&&function(A,e){if(!A.tooComplexToFollowFunctions){if(A.functionsDefined.length>e)return R("TT: more functions defined than expected"),void(A.hintsValid=!1);for(let t=0,i=A.functionsUsed.length;te)return R("TT: invalid function id: "+t),void(A.hintsValid=!1);if(A.functionsUsed[t]&&!A.functionsDefined[t])return R("TT: undefined function: "+t),void(A.hintsValid=!1)}}}(a,i),t&&1&t.length){const A=new Uint8Array(t.length+1);A.set(t.data),t.data=A}return a.hintsValid}(C.fpgm,C.prep,C["cvt "],m);if(w||(delete C.fpgm,delete C.prep,delete C["cvt "]),function(A,e,t,i,a,s){if(!e)return void(t&&(t.data=null));A.pos=(A.start||0)+e.offset,A.pos+=4,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2,A.pos+=2;const n=A.getUint16();A.pos+=8,A.pos+=2;let g=A.getUint16();0!==n&&(2&Fs(i.data[44],i.data[45])||(e.data[22]=0,e.data[23]=0)),g>a&&(S(`The numOfMetrics (${g}) should not be greater than the numGlyphs (${a}).`),g=a,e.data[34]=(65280&g)>>8,e.data[35]=255&g);const r=a-g-(t.length-4*g>>1);if(r>0){const A=new Uint8Array(t.length+2*r);A.set(t.data),s&&(A[t.length]=t.data[2],A[t.length+1]=t.data[3]),t.data=A}}(e,C.hhea,C.hmtx,C.head,f,p),!C.head)throw new K('Required "head" table is not found');!function(A,e,t){const i=A.data,a=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3];a>>16!=1&&(S("Attempting to fix invalid version in head table: "+a),i[0]=0,i[1]=1,i[2]=0,i[3]=0);const s=Fs(i[50],i[51]);if(s<0||s>1){S("Attempting to fix invalid indexToLocFormat in head table: "+s);const A=e+1;if(t===A<<1)i[50]=0,i[51]=0;else{if(t!==A<<2)throw new K("Could not fix indexToLocFormat: "+s);i[50]=0,i[51]=1}}}(C.head,E,Q?C.loca.length:0);let D=Object.create(null);if(Q){const A=Fs(C.head.data[50],C.head.data[51]),e=function(A,e,t,i,a,s,n){let r,o,I;i?(r=4,o=function(A,e){return A[e]<<24|A[e+1]<<16|A[e+2]<<8|A[e+3]},I=function(A,e,t){A[e]=t>>>24&255,A[e+1]=t>>16&255,A[e+2]=t>>8&255,A[e+3]=255&t}):(r=2,o=function(A,e){return A[e]<<9|A[e+1]<<1},I=function(A,e,t){A[e]=t>>9&255,A[e+1]=t>>1&255});const c=s?t+1:t,C=r*(1+c),B=new Uint8Array(C);B.set(A.data.subarray(0,C)),A.data=B;const h=e.data,Q=h.length,l=new Uint8Array(Q);let E,u;const d=[];for(E=0,u=0;EQ&&(A=Q),d.push({index:E,offset:A,endOffset:0})}for(d.sort(((A,e)=>A.offset-e.offset)),E=0;EA.index-e.index)),E=0;En&&(n=A.sizeOfInstructions),m+=e,I(B,u,m)}if(0===m){const A=new Uint8Array([0,1,0,0,0,0,0,0,0,0,0,0,0,0,49,0]);for(E=0,u=r;Et+m?e.data=l.subarray(0,t+m):(e.data=new Uint8Array(t+m),e.data.set(l.subarray(0,m))),e.data.set(l.subarray(0,t),m),I(A.data,B.length-r,m+t)}else e.data=l.subarray(0,m);return{missingGlyphs:p,maxSizeOfInstructions:n}}(C.loca,C.glyf,E,A,w,p,y);D=e.missingGlyphs,l>=65536&&C.maxp.length>=32&&(C.maxp.data[26]=e.maxSizeOfInstructions>>8,C.maxp.data[27]=255&e.maxSizeOfInstructions)}if(!C.hhea)throw new K('Required "hhea" table is not found');0===C.hhea.data[10]&&0===C.hhea.data[11]&&(C.hhea.data[10]=255,C.hhea.data[11]=255);const b={unitsPerEm:Fs(C.head.data[18],C.head.data[19]),yMax:Rs(C.head.data[42],C.head.data[43]),yMin:Rs(C.head.data[38],C.head.data[39]),ascent:Rs(C.hhea.data[4],C.hhea.data[5]),descent:Rs(C.hhea.data[6],C.hhea.data[7]),lineGap:Rs(C.hhea.data[8],C.hhea.data[9])};this.ascent=b.ascent/b.unitsPerEm,this.descent=b.descent/b.unitsPerEm,this.lineGap=b.lineGap/b.unitsPerEm,this.cssFontInfo?.lineHeight?(this.lineHeight=this.cssFontInfo.metrics.lineHeight,this.lineGap=this.cssFontInfo.metrics.lineGap):this.lineHeight=this.ascent-this.descent+this.lineGap,C.post&&function(A,t,i){const a=(e.start||0)+A.offset;e.pos=a;const s=a+A.length,n=e.getInt32();let g;e.skip(28);let r,o=!0;switch(n){case 65536:g=Ia;break;case 131072:const A=e.getUint16();if(A!==i){o=!1;break}const a=[];for(r=0;r=32768){o=!1;break}a.push(A)}if(!o)break;const I=[],c=[];for(;e.pos65535)throw new K("Max size of CID is 65,535");let a=-1;e?a=i:void 0!==A[i]&&(a=A[i]),a>=0&&a>>0;let I=!1;if(g?.platformId!==a||g?.encodingId!==s){if(0!==a||0!==s&&1!==s&&3!==s)if(1===a&&0===s)I=!0;else if(3!==a||1!==s||!i&&g){if(t&&3===a&&0===s){I=!0;let t=!0;if(A>3;A.push(i),t=Math.max(i,t)}const i=[];for(let A=0;A<=t;A++)i.push({firstCode:e.getUint16(),entryCount:e.getUint16(),idDelta:Rs(e.getByte(),e.getByte()),idRangePos:e.pos+e.getUint16()});for(let t=0;t<256;t++)if(0===A[t])e.pos=i[0].idRangePos+2*t,B=e.getUint16(),c.push({charCode:t,glyphId:B});else{const a=i[A[t]];for(C=0;C>1;e.skip(6);const t=[];let i;for(i=0;i>1)-(A-i),a.offsetIndex=n,g=Math.max(g,n+a.end-a.start+1)):a.offsetIndex=-1}const r=[];for(C=0;C>>0;for(C=0;C>>0,t=e.getInt32()>>>0;let i=e.getInt32()>>>0;for(let e=A;e<=t;e++)c.push({charCode:e,glyphId:i++})}}}c.sort((function(A,e){return A.charCode-e.charCode}));for(let A=1;A=61440&&e<=61695&&(e&=255),k[e]=A.glyphId}else for(const A of s)k[A.charCode]=A.glyphId;if(t.glyphNames&&(n.length||this.differences.length))for(let A=0;A<256;++A){if(!g&&void 0!==k[A])continue;const e=this.differences[A]||n[A];if(!e)continue;const i=t.glyphNames.indexOf(e);i>0&&F(i)&&(k[A]=i)}}0===k.length&&(k[0]=0);let G=f-1;if(p||(G=0),!t.cssFontInfo){const A=Ys(k,F,G,this.toUnicode);this.toFontChar=A.toFontChar,C.cmap={tag:"cmap",data:vs(A.charCodeToGlyphId,A.toUnicodeExtraMap,f)},C["OS/2"]&&function(A,e){e.pos=(e.start||0)+A.offset;const t=e.getUint16();e.skip(60);const i=e.getUint16();return!(t<4&&768&i||e.getUint16()>e.getUint16()||(e.skip(6),0===e.getUint16()||(A.data[8]=A.data[9]=0,0)))}(C["OS/2"],e)||(C["OS/2"]={tag:"OS/2",data:Ks(t,A.charCodeToGlyphId,b)})}if(!Q)try{h=new ae(C["CFF "].data),B=new Yi(h,t,oa).parse(),B.duplicateFirstGlyph();const A=new Aa(B);C["CFF "].data=A.compile()}catch{R("Failed to compile font "+t.loadedName)}if(C.name){const[e,i]=r(C.name);C.name.data=Ps(A,e),this.psName=e[0][6]||null,t.composite||function(A,e,t){if(A.isInternalFont)return;if(A.hasIncludedToUnicodeMap)return;if(A.hasEncoding)return;if(A.toUnicode instanceof ba)return;if(!e)return;if(0===t.length)return;if(A.defaultEncoding===Ni)return;for(const A of t)if(!Js(A))return;const i=Ni,a=[],s=ea();for(const A in i){const e=i[A];if(""===e)continue;const t=s[e];void 0!==t&&(a[A]=String.fromCharCode(t))}a.length>0&&A.toUnicode.amend(a)}(t,this.isSymbolicFont,i)}else C.name={tag:"name",data:Ps(this.name)};const x=new ts(c.version);for(const A in C)x.addTable(A,C[A].data);return x.toArray()}convert(A,e,t){t.fixedPitch=!1,t.builtInEncoding&&function(A,e){if(A.isInternalFont)return;if(A.hasIncludedToUnicodeMap)return;if(e===A.defaultEncoding)return;if(A.toUnicode instanceof ba)return;const t=[],i=ea();for(const a in e){if(A.hasEncoding&&(A.baseEncodingName||void 0!==A.differences[a]))continue;const s=aa(e[a],i);-1!==s&&(t[a]=String.fromCharCode(s))}t.length>0&&A.toUnicode.amend(t)}(t,t.builtInEncoding);let i=1;e instanceof ka&&(i=e.numGlyphs-1);const s=e.getGlyphMapping(t);let n=null,g=s,r=null;t.cssFontInfo||(n=Ys(s,e.hasGlyphId.bind(e),i,this.toUnicode),this.toFontChar=n.toFontChar,g=n.charCodeToGlyphId,r=n.toUnicodeExtraMap);const o=e.numGlyphs;function I(A,e){let t=null;for(const i in A)e===A[i]&&(t||=[]).push(0|i);return t}function c(A,e){for(const t in A)if(e===A[t])return 0|t;return n.charCodeToGlyphId[n.nextAvailableFontCharCode]=e,n.nextAvailableFontCharCode++}const C=e.seacs;if(n&&C?.length){const A=t.fontMatrix||a,i=e.getCharset(),g=Object.create(null);for(let e in C){e|=0;const t=C[e],a=Gi[t[2]],r=Gi[t[3]],o=i.indexOf(a),B=i.indexOf(r);if(o<0||B<0)continue;const h={x:t[0]*A[0]+t[1]*A[2]+A[4],y:t[0]*A[1]+t[1]*A[3]+A[5]},Q=I(s,e);if(Q)for(const A of Q){const e=n.charCodeToGlyphId,t=c(e,o),i=c(e,B);g[A]={baseFontCharCode:t,accentFontCharCode:i,accentOffset:h}}}t.seacMap=g}const B=t.fontMatrix?1/Math.max(...t.fontMatrix.slice(0,4).map(Math.abs)):1e3,h=new ts("OTTO");return h.addTable("CFF ",e.data),h.addTable("OS/2",Ks(t,g)),h.addTable("cmap",vs(g,r,o)),h.addTable("head","\0\0\0\0\0\0\0\0\0\0_<õ\0\0"+Ns(B)+"\0\0\0\0ž\v~'\0\0\0\0ž\v~'\0\0"+Ns(t.descent)+"ÿ"+Ns(t.ascent)+Gs(t.italicAngle?2:0)+"\0\0\0\0\0\0\0"),h.addTable("hhea","\0\0\0"+Ns(t.ascent)+Ns(t.descent)+"\0\0ÿÿ\0\0\0\0\0\0"+Ns(t.capHeight)+Ns(Math.tan(t.italicAngle)*t.xHeight)+"\0\0\0\0\0\0\0\0\0\0\0\0"+Gs(o)),h.addTable("hmtx",function(){const A=e.charstrings,t=e.cff?e.cff.widths:null;let i="\0\0\0\0";for(let e=1,a=o;e=65520&&I<=65535?0:I>=62976&&I<=63743?ia()[I]||I:173===I?45:I}var I;this.isType3Font&&(a=t);let c=null;if(this.seacMap?.[A]){o=!0;const e=this.seacMap[A];t=e.baseFontCharCode,c={fontChar:String.fromCodePoint(e.accentFontCharCode),offset:e.accentOffset}}let C="";if("number"==typeof t&&(t<=1114111?C=String.fromCodePoint(t):R(`charToGlyph - invalid fontCharCode: ${t}`)),this.missingFile&&this.vertical&&1===C.length){const A=ha()[C.charCodeAt(0)];A&&(C=r=String.fromCharCode(A))}return s=new ks(A,C,r,c,i,g,a,e,o),this._glyphCache[A]=s}charsToGlyphs(A){let e=this._charsCache[A];if(e)return e;if(e=[],this.cMap){const t=Object.create(null),i=A.length;let a=0;for(;ae.length%2==1,a=this.toUnicode instanceof ba?A=>this.toUnicode.charCodeOf(A):A=>this.toUnicode.charCodeOf(String.fromCodePoint(A));for(let s=0,n=A.length;s55295&&(n<57344||n>65533)&&s++,this.toUnicode){const A=a(n);if(-1!==A){i()&&(e.push(t.join("")),t.length=0);for(let e=(this.cMap?this.cMap.getCharCodeLength(A):1)-1;e>=0;e--)t.push(String.fromCharCode(A>>8*e&255));continue}}i()||(e.push(t.join("")),t.length=0),t.push(String.fromCodePoint(n))}return e.push(t.join("")),e}}class Zs{constructor(A){this.error=A,this.loadedName="g_font_error",this.missingFile=!0}charsToGlyphs(){return[]}encodeString(A){return[A]}exportData(A=!1){return{error:this.error}}}class Os{constructor(){G("Cannot initialize Pattern.")}static parseShading(A,e,t,i,a){const s=A instanceof fA?A.dict:A,n=s.get("ShadingType");try{switch(n){case 2:case 3:return new Vs(s,e,t,i,a);case 4:case 5:case 6:case 7:return new $s(A,e,t,i,a);default:throw new K("Unsupported ShadingType: "+n)}}catch(A){if(A instanceof yA)throw A;return R(A),new An}}}class Xs{static SMALL_NUMBER=1e-6;getIR(){G("Abstract method `getIR` called.")}}class Vs extends Xs{constructor(A,e,t,i,a){super(),this.shadingType=A.get("ShadingType");let s=0;if(2===this.shadingType?s=4:3===this.shadingType&&(s=6),this.coordsArr=A.getArray("Coords"),!LA(this.coordsArr,s))throw new K("RadialAxialShading: Invalid /Coords array.");const n=oe.parse({cs:A.getRaw("CS")||A.getRaw("ColorSpace"),xref:e,resources:t,pdfFunctionFactory:i,localColorSpaceCache:a});this.bbox=YA(A.getArray("BBox"),null);let g=0,r=1;const o=A.getArray("Domain");LA(o,2)&&([g,r]=o);let I=!1,c=!1;const C=A.getArray("Extend");var B;if(B=C,Array.isArray(B)&&2===B.length&&B.every((A=>"boolean"==typeof A))&&([I,c]=C),!(3!==this.shadingType||I&&c)){const[A,e,t,i,a,s]=this.coordsArr,n=Math.hypot(A-i,e-a);t<=s+n&&s<=t+n&&R("Unsupported radial gradient.")}this.extendStart=I,this.extendEnd=c;const h=A.getRaw("Function"),Q=i.createFromArray(h),l=(r-g)/840,E=this.colorStops=[];if(g>=r||l<=0)return void S("Bad shading domain.");const u=new Float32Array(n.numComps),d=new Float32Array(1);let f,p=0;d[0]=g,Q(d,0,u,0);let m=n.getRgb(u,0);const y=V.makeHexColor(m[0],m[1],m[2]);E.push([0,y]);let w=1;d[0]=g+l,Q(d,0,u,0);let D=n.getRgb(u,0),b=D[0]-m[0]+1,k=D[1]-m[1]+1,F=D[2]-m[2]+1,G=D[0]-m[0]-1,N=D[1]-m[1]-1,x=D[2]-m[2]-1;for(let A=2;A<840;A++){d[0]=g+A*l,Q(d,0,u,0),f=n.getRgb(u,0);const e=A-p;if(b=Math.min(b,(f[0]-m[0]+1)/e),k=Math.min(k,(f[1]-m[1]+1)/e),F=Math.min(F,(f[2]-m[2]+1)/e),G=Math.max(G,(f[0]-m[0]-1)/e),N=Math.max(N,(f[1]-m[1]-1)/e),x=Math.max(x,(f[2]-m[2]-1)/e),!(G<=b&&N<=k&&x<=F)){const A=V.makeHexColor(D[0],D[1],D[2]);E.push([w/840,A]),b=f[0]-D[0]+1,k=f[1]-D[1]+1,F=f[2]-D[2]+1,G=f[0]-D[0]-1,N=f[1]-D[1]-1,x=f[2]-D[2]-1,p=w,m=D}w=A,D=f}const U=V.makeHexColor(D[0],D[1],D[2]);E.push([1,U]);let M="transparent";A.has("Background")&&(f=n.getRgb(A.get("Background"),0),M=V.makeHexColor(f[0],f[1],f[2])),I||(E.unshift([0,M]),E[1][0]+=Xs.SMALL_NUMBER),c||(E.at(-1)[0]-=Xs.SMALL_NUMBER,E.push([1,M])),this.colorStops=E}getIR(){const{coordsArr:A,shadingType:e}=this;let t,i,a,s,n;return 2===e?(i=[A[0],A[1]],a=[A[2],A[3]],s=null,n=null,t="axial"):3===e?(i=[A[0],A[1]],a=[A[3],A[4]],s=A[2],n=A[5],t="radial"):G(`getPattern type unknown: ${e}`),["RadialAxial",t,this.bbox,this.colorStops,i,a,s,n]}}class js{constructor(A,e){this.stream=A,this.context=e,this.buffer=0,this.bufferLength=0;const t=e.numComps;this.tmpCompsBuf=new Float32Array(t);const i=e.colorSpace.numComps;this.tmpCsCompsBuf=e.colorFn?new Float32Array(i):this.tmpCompsBuf}get hasData(){if(this.stream.end)return this.stream.pos0)return!0;const A=this.stream.getByte();return!(A<0||(this.buffer=A,this.bufferLength=8,0))}readBits(A){let e=this.buffer,t=this.bufferLength;if(32===A){if(0===t)return(this.stream.getByte()<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte())>>>0;e=e<<24|this.stream.getByte()<<16|this.stream.getByte()<<8|this.stream.getByte();const A=this.stream.getByte();return this.buffer=A&(1<>t)>>>0}if(8===A&&0===t)return this.stream.getByte();for(;t>t}align(){this.buffer=0,this.bufferLength=0}readFlag(){return this.readBits(this.context.bitsPerFlag)}readCoordinate(){const A=this.context.bitsPerCoordinate,e=this.readBits(A),t=this.readBits(A),i=this.context.decode,a=A<32?1/((1<s?s:A,e=e>n?n:e,t=tA*a[e])):t;let n,g=-2;const r=[];for(const[A,e]of i.map(((A,e)=>[A,e])).sort((([A],[e])=>A-e)))-1!==A&&(A===g+1?(n.push(s[e]),g+=1):(g=A,n=[s[e]],r.push(A,n)));return r}(A),t=new CA(null);t.set("BaseFont",oA.get(A)),t.set("Type",oA.get("Font")),t.set("Subtype",oA.get("CIDFontType2")),t.set("Encoding",oA.get("Identity-H")),t.set("CIDToGIDMap",oA.get("Identity")),t.set("W",e),t.set("FirstChar",e[0]),t.set("LastChar",e.at(-2)+e.at(-1).length-1);const i=new CA(null);t.set("FontDescriptor",i);const a=new CA(null);return a.set("Ordering","Identity"),a.set("Registry","Adobe"),a.set("Supplement",0),t.set("CIDSystemInfo",a),t}class Zn{constructor(A){this.lexer=A,this.operators=[],this.token=null,this.prev=null}nextToken(){this.prev=this.token,this.token=this.lexer.getToken()}accept(A){return this.token.type===A&&(this.nextToken(),!0)}expect(A){if(this.accept(A))return!0;throw new K(`Unexpected symbol: found ${this.token.type} expected ${A}.`)}parse(){return this.nextToken(),this.expect(On.LBRACE),this.parseBlock(),this.expect(On.RBRACE),this.operators}parseBlock(){for(;;)if(this.accept(On.NUMBER))this.operators.push(this.prev.value);else if(this.accept(On.OPERATOR))this.operators.push(this.prev.value);else{if(!this.accept(On.LBRACE))return;this.parseCondition()}}parseCondition(){const A=this.operators.length;if(this.operators.push(null,null),this.parseBlock(),this.expect(On.RBRACE),this.accept(On.IF))this.operators[A]=this.operators.length,this.operators[A+1]="jz";else{if(!this.accept(On.LBRACE))throw new K("PS Function: error parsing conditional.");{const e=this.operators.length;this.operators.push(null,null);const t=this.operators.length;this.parseBlock(),this.expect(On.RBRACE),this.expect(On.IFELSE),this.operators[e]=this.operators.length,this.operators[e+1]="j",this.operators[A]=t,this.operators[A+1]="jz"}}}}const On={LBRACE:0,RBRACE:1,NUMBER:2,OPERATOR:3,IF:4,IFELSE:5};class Xn{static get opCache(){return U(this,"opCache",Object.create(null))}constructor(A,e){this.type=A,this.value=e}static getOperator(A){return Xn.opCache[A]||=new Xn(On.OPERATOR,A)}static get LBRACE(){return U(this,"LBRACE",new Xn(On.LBRACE,"{"))}static get RBRACE(){return U(this,"RBRACE",new Xn(On.RBRACE,"}"))}static get IF(){return U(this,"IF",new Xn(On.IF,"IF"))}static get IFELSE(){return U(this,"IFELSE",new Xn(On.IFELSE,"IFELSE"))}}class Vn{constructor(A){this.stream=A,this.nextChar(),this.strBuf=[]}nextChar(){return this.currentChar=this.stream.getByte()}getToken(){let A=!1,e=this.currentChar;for(;;){if(e<0)return sA;if(A)10!==e&&13!==e||(A=!1);else if(37===e)A=!0;else if(!MA(e))break;e=this.nextChar()}switch(0|e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 43:case 45:case 46:return new Xn(On.NUMBER,this.getNumber());case 123:return this.nextChar(),Xn.LBRACE;case 125:return this.nextChar(),Xn.RBRACE}const t=this.strBuf;for(t.length=0,t[0]=String.fromCharCode(e);(e=this.nextChar())>=0&&(e>=65&&e<=90||e>=97&&e<=122);)t.push(String.fromCharCode(e));const i=t.join("");switch(i.toLowerCase()){case"if":return Xn.IF;case"ifelse":return Xn.IFELSE;default:return Xn.getOperator(i)}}getNumber(){let A=this.currentChar;const e=this.strBuf;for(e.length=0,e[0]=String.fromCharCode(A);(A=this.nextChar())>=0&&(A>=48&&A<=57||45===A||46===A);)e.push(String.fromCharCode(A));const t=parseFloat(e.join(""));if(isNaN(t))throw new K(`Invalid floating point number: ${t}`);return t}}class jn{constructor(A){this._onlyRefs=!0===A?.onlyRefs,this._onlyRefs||(this._nameRefMap=new Map,this._imageMap=new Map),this._imageCache=new QA}getByName(A){this._onlyRefs&&G("Should not call `getByName` method.");const e=this._nameRefMap.get(A);return e?this.getByRef(e):this._imageMap.get(A)||null}getByRef(A){return this._imageCache.get(A)||null}set(A,e,t){G("Abstract method `set` called.")}}class zn extends jn{set(A,e=null,t){if("string"!=typeof A)throw new Error('LocalImageCache.set - expected "name" argument.');if(e){if(this._imageCache.has(e))return;return this._nameRefMap.set(A,e),void this._imageCache.put(e,t)}this._imageMap.has(A)||this._imageMap.set(A,t)}}class _n extends jn{set(A=null,e=null,t){if("string"!=typeof A&&!e)throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');if(e){if(this._imageCache.has(e))return;return null!==A&&this._nameRefMap.set(A,e),void this._imageCache.put(e,t)}this._imageMap.has(A)||this._imageMap.set(A,t)}}class $n extends jn{constructor(A){super({onlyRefs:!0})}set(A=null,e,t){if(!e)throw new Error('LocalFunctionCache.set - expected "ref" argument.');this._imageCache.has(e)||this._imageCache.put(e,t)}}class Ag extends jn{set(A,e=null,t){if("string"!=typeof A)throw new Error('LocalGStateCache.set - expected "name" argument.');if(e){if(this._imageCache.has(e))return;return this._nameRefMap.set(A,e),void this._imageCache.put(e,t)}this._imageMap.has(A)||this._imageMap.set(A,t)}}class eg extends jn{constructor(A){super({onlyRefs:!0})}set(A=null,e,t){if(!e)throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');this._imageCache.has(e)||this._imageCache.put(e,t)}}class tg extends jn{constructor(A){super({onlyRefs:!0})}set(A=null,e,t){if(!e)throw new Error('RegionalImageCache.set - expected "ref" argument.');this._imageCache.has(e)||this._imageCache.put(e,t)}}class ig{static NUM_PAGES_THRESHOLD=2;static MIN_IMAGES_TO_CACHE=10;static MAX_BYTE_SIZE=5e7;#D=new hA;constructor(){this._refCache=new QA,this._imageCache=new QA}get#b(){let A=0;for(const e of this._imageCache)A+=e.byteSize;return A}get#k(){return!(this._imageCache.size+A)):null}class ng{static getSampleArray(A,e,t,i){let a,s,n=1;for(a=0,s=A.length;a>r)*I,o&=(1<t?A=t:A0&&(C=s[c-1]);let B=i[1];c>1,o=a.length>>1,I=new og(g),c=Object.create(null);let C=8192;const B=new Float32Array(o);return function(A,e,t,i){let a,n,g="";const h=B;for(a=0;aA&&(n=A)),l[a]=n}C>0&&(C--,c[g]=l),t.set(l,i)}}}function gg(A){let e;if(A instanceof CA)e=A;else{if(!(A instanceof fA))return!1;e=A.dict}return e.has("FunctionType")}class rg{static MAX_STACK_SIZE=100;constructor(A){this.stack=A?Array.from(A):[]}push(A){if(this.stack.length>=rg.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");this.stack.push(A)}pop(){if(this.stack.length<=0)throw new Error("PostScript function stack underflow.");return this.stack.pop()}copy(A){if(this.stack.length+A>=rg.MAX_STACK_SIZE)throw new Error("PostScript function stack overflow.");const e=this.stack;for(let t=e.length-A,i=A-1;i>=0;i--,t++)e.push(e[t])}index(A){this.push(this.stack[this.stack.length-A-1])}roll(A,e){const t=this.stack,i=t.length-A,a=t.length-1,s=i+(e-Math.floor(e/A)*A);for(let A=i,e=a;A0?e.push(n<>g);break;case"ceiling":n=e.pop(),e.push(Math.ceil(n));break;case"copy":n=e.pop(),e.copy(n);break;case"cos":n=e.pop(),e.push(Math.cos(n%360/180*Math.PI));break;case"cvi":n=0|e.pop(),e.push(n);break;case"cvr":break;case"div":g=e.pop(),n=e.pop(),e.push(n/g);break;case"dup":e.copy(1);break;case"eq":g=e.pop(),n=e.pop(),e.push(n===g);break;case"exch":e.roll(2,1);break;case"exp":g=e.pop(),n=e.pop(),e.push(n**g);break;case"false":e.push(!1);break;case"floor":n=e.pop(),e.push(Math.floor(n));break;case"ge":g=e.pop(),n=e.pop(),e.push(n>=g);break;case"gt":g=e.pop(),n=e.pop(),e.push(n>g);break;case"idiv":g=e.pop(),n=e.pop(),e.push(n/g|0);break;case"index":n=e.pop(),e.index(n);break;case"le":g=e.pop(),n=e.pop(),e.push(n<=g);break;case"ln":n=e.pop(),e.push(Math.log(n));break;case"log":n=e.pop(),e.push(Math.log10(n));break;case"lt":g=e.pop(),n=e.pop(),e.push(n=e?new Cg(e):A.max<=e?A:new hg(A,e)}class mg{compile(A,e,t){const i=[],a=[],s=e.length>>1,n=t.length>>1;let g,r,o,I,c,C,B,h,Q=0;for(let A=0;Ae.min&&(g.unshift("Math.max(",s,", "),g.push(")")),n4?(i=!0,e=0):(i=!1,e=1));const r=[];for(s=0;s=0&&"ET"===Ng[A];--A)Ng[A]="EN";for(let A=s+1;A0&&(e=Ng[s-1]);let t=c;A+1h&&Dg(h)&&(l=h);for(h=Q;h>=l;--h){let A=-1;for(s=0,n=r.length;s=0&&(Sg(Gg,A,s),A=-1):A<0&&(A=s);A>=0&&Sg(Gg,A,r.length)}for(s=0,n=Gg.length;s"!==A||(Gg[s]="")}return Rg(Gg.join(""),i)}const Ug={style:"normal",weight:"normal"},Mg={style:"normal",weight:"bold"},Lg={style:"italic",weight:"normal"},Jg={style:"italic",weight:"bold"},Hg=new Map([["Times-Roman",{local:["Times New Roman","Times-Roman","Times","Liberation Serif","Nimbus Roman","Nimbus Roman L","Tinos","Thorndale","TeX Gyre Termes","FreeSerif","Linux Libertine O","Libertinus Serif","DejaVu Serif","Bitstream Vera Serif","Ubuntu"],style:Ug,ultimate:"serif"}],["Times-Bold",{alias:"Times-Roman",style:Mg,ultimate:"serif"}],["Times-Italic",{alias:"Times-Roman",style:Lg,ultimate:"serif"}],["Times-BoldItalic",{alias:"Times-Roman",style:Jg,ultimate:"serif"}],["Helvetica",{local:["Helvetica","Helvetica Neue","Arial","Arial Nova","Liberation Sans","Arimo","Nimbus Sans","Nimbus Sans L","A030","TeX Gyre Heros","FreeSans","DejaVu Sans","Albany","Bitstream Vera Sans","Arial Unicode MS","Microsoft Sans Serif","Apple Symbols","Cantarell"],path:"LiberationSans-Regular.ttf",style:Ug,ultimate:"sans-serif"}],["Helvetica-Bold",{alias:"Helvetica",path:"LiberationSans-Bold.ttf",style:Mg,ultimate:"sans-serif"}],["Helvetica-Oblique",{alias:"Helvetica",path:"LiberationSans-Italic.ttf",style:Lg,ultimate:"sans-serif"}],["Helvetica-BoldOblique",{alias:"Helvetica",path:"LiberationSans-BoldItalic.ttf",style:Jg,ultimate:"sans-serif"}],["Courier",{local:["Courier","Courier New","Liberation Mono","Nimbus Mono","Nimbus Mono L","Cousine","Cumberland","TeX Gyre Cursor","FreeMono","Linux Libertine Mono O","Libertinus Mono"],style:Ug,ultimate:"monospace"}],["Courier-Bold",{alias:"Courier",style:Mg,ultimate:"monospace"}],["Courier-Oblique",{alias:"Courier",style:Lg,ultimate:"monospace"}],["Courier-BoldOblique",{alias:"Courier",style:Jg,ultimate:"monospace"}],["ArialBlack",{local:["Arial Black"],style:{style:"normal",weight:"900"},fallback:"Helvetica-Bold"}],["ArialBlack-Bold",{alias:"ArialBlack"}],["ArialBlack-Italic",{alias:"ArialBlack",style:{style:"italic",weight:"900"},fallback:"Helvetica-BoldOblique"}],["ArialBlack-BoldItalic",{alias:"ArialBlack-Italic"}],["ArialNarrow",{local:["Arial Narrow","Liberation Sans Narrow","Helvetica Condensed","Nimbus Sans Narrow","TeX Gyre Heros Cn"],style:Ug,fallback:"Helvetica"}],["ArialNarrow-Bold",{alias:"ArialNarrow",style:Mg,fallback:"Helvetica-Bold"}],["ArialNarrow-Italic",{alias:"ArialNarrow",style:Lg,fallback:"Helvetica-Oblique"}],["ArialNarrow-BoldItalic",{alias:"ArialNarrow",style:Jg,fallback:"Helvetica-BoldOblique"}],["Calibri",{local:["Calibri","Carlito"],style:Ug,fallback:"Helvetica"}],["Calibri-Bold",{alias:"Calibri",style:Mg,fallback:"Helvetica-Bold"}],["Calibri-Italic",{alias:"Calibri",style:Lg,fallback:"Helvetica-Oblique"}],["Calibri-BoldItalic",{alias:"Calibri",style:Jg,fallback:"Helvetica-BoldOblique"}],["Wingdings",{local:["Wingdings","URW Dingbats"],style:Ug}],["Wingdings-Regular",{alias:"Wingdings"}],["Wingdings-Bold",{alias:"Wingdings"}]]),Yg=new Map([["Arial-Black","ArialBlack"]]);function vg(A){const e=new Set(["thin","extralight","ultralight","demilight","semilight","light","book","regular","normal","medium","demibold","semibold","bold","extrabold","ultrabold","black","heavy","extrablack","ultrablack","roman","italic","oblique","ultracondensed","extracondensed","condensed","semicondensed","normal","semiexpanded","expanded","extraexpanded","ultraexpanded","bolditalic"]);return A.split(/[- ,+]+/g).filter((A=>!e.has(A.toLowerCase()))).join(" ")}function Kg({alias:A,local:e,path:t,fallback:i,style:a,ultimate:s},n,g,r=!0,o=!0,I=""){const c={style:null,ultimate:null};if(e){const A=I?` ${I}`:"";for(const t of e)n.push(`local(${t}${A})`)}if(A){const e=Hg.get(A),s=I||function(A){switch(A){case Mg:return"Bold";case Lg:return"Italic";case Jg:return"Bold Italic";default:if("bold"===A?.weight)return"Bold";if("italic"===A?.style)return"Italic"}return""}(a);Object.assign(c,Kg(e,n,g,r&&!i,o&&!t,s))}if(a&&(c.style=a),s&&(c.ultimate=s),r&&i){const A=Hg.get(i),{ultimate:e}=Kg(A,n,g,r,o&&!t,I);c.ultimate||=e}return o&&t&&g&&n.push(`url(${g}${t})`),c}function qg(A,e,t,i,a,s){if(i.startsWith("InvalidPDFjsFont_"))return null;"TrueType"!==s&&"Type1"!==s||!/^[A-Z]{6}\+/.test(i)||(i=i.slice(7));const n=i=Ba(i);let g=A.get(n);if(g)return g;let r=Hg.get(i);if(!r)for(const[A,e]of Yg)if(i.startsWith(A)){i=`${e}${i.substring(A.length)}`,r=Hg.get(i);break}let o=!1;r||(r=Hg.get(a),o=!0);const I=`${e.getDocId()}_s${e.createFontId()}`;if(!r){if(!XA(i))return R(`Cannot substitute the font because of its name: ${i}`),A.set(n,null),null;const e=/bold/gi.test(i),t=/oblique|italic/gi.test(i),a=e&&t&&Jg||e&&Mg||t&&Lg||Ug;return g={css:`"${vg(i)}",${I}`,guessFallback:!0,loadedName:I,baseFontName:i,src:`local(${i})`,style:a},A.set(n,g),g}const c=[];o&&XA(i)&&c.push(`local(${i})`);const{style:C,ultimate:B}=Kg(r,c,t),h=null===B,Q=h?"":`,${B}`;return g={css:`"${vg(i)}",${I}${Q}`,guessFallback:h,loadedName:I,baseFontName:i,src:c.join(","),style:C},A.set(n,g),g}class Tg{constructor(A,e){this._imgData=A,this._isMask=e}static needsToBeResized(A,e){if(A<=this._goodSquareLength&&e<=this._goodSquareLength)return!1;const{MAX_DIM:t}=this;if(A>t||e>t)return!0;const i=A*e;return this._hasMaxArea?i>this.MAX_AREA:!(i(this.MAX_AREA=this._goodSquareLength**2)))}static get MAX_DIM(){return U(this,"MAX_DIM",this._guessMax(2048,65537,0,1))}static get MAX_AREA(){return this._hasMaxArea=!0,U(this,"MAX_AREA",this._guessMax(Tg._goodSquareLength,this.MAX_DIM,128,0)**2)}static set MAX_AREA(A){A>=0&&(this._hasMaxArea=!0,U(this,"MAX_AREA",A))}static setMaxArea(A){this._hasMaxArea||(this.MAX_AREA=A>>2)}static _areGoodDims(A,e){try{const t=new OffscreenCanvas(A,e),i=t.getContext("2d");i.fillRect(0,0,1,1);const a=i.getImageData(0,0,1,1).data[3];return t.width=t.height=1,0!==a}catch{return!1}}static _guessMax(A,e,t,i){for(;A+t+1>3,n=t+3&-4;if(t!==n){const A=new Uint8Array(n*e);let i=0;for(let s=0,g=e*t;s>>8,e[t++]=255&a)}}else{if(!ArrayBuffer.isView(A))throw new Error("Invalid data format, must be a string or TypedArray.");e=A.slice(),t=e.byteLength}const i=t>>2,a=t-4*i,s=new Uint32Array(e.buffer,0,i);let n=0,g=0,r=this.h1,o=this.h2;const I=3432918353,c=461845907,C=11601,B=13715;for(let A=0;A>>17,n=n*c&Wg|n*B&Zg,r^=n,r=r<<13|r>>>19,r=5*r+3864292196):(g=s[A],g=g*I&Wg|g*C&Zg,g=g<<15|g>>>17,g=g*c&Wg|g*B&Zg,o^=g,o=o<<13|o>>>19,o=5*o+3864292196);switch(n=0,a){case 3:n^=e[4*i+2]<<16;case 2:n^=e[4*i+1]<<8;case 1:n^=e[4*i],n=n*I&Wg|n*C&Zg,n=n<<15|n>>>17,n=n*c&Wg|n*B&Zg,1&i?r^=n:o^=n}this.h1=r,this.h2=o}hexdigest(){let A=this.h1,e=this.h2;return A^=e>>>1,A=3981806797*A&Wg|36045*A&Zg,e=4283543511*e&Wg|(2950163797*(e<<16|A>>>16)&Wg)>>>16,A^=e>>>1,A=444984403*A&Wg|60499*A&Zg,e=3301882366*e&Wg|(3120437893*(e<<16|A>>>16)&Wg)>>>16,A^=e>>>1,(A>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}function Xg(A,e,t,i,a){let s=A;for(let A=0,t=e.length-1;A1e3&&(o=Math.max(o,C),B+=c+2,C=0,c=0),I.push({transform:e,x:C,y:B,w:t.width,h:t.height}),C+=t.width+2,c=Math.max(c,t.height)}const h=Math.max(o,C)+1,Q=B+c+1,l=new Uint8Array(h*Q*4),E=h<<2;for(let A=0;A=0;)e[s-4]=e[s],e[s-3]=e[s+1],e[s-2]=e[s+2],e[s-1]=e[s+3],e[s+t]=e[s+t-4],e[s+t+1]=e[s+t-3],e[s+t+2]=e[s+t-2],e[s+t+3]=e[s+t-1],s-=E}const u={width:h,height:Q};if(A.isOffscreenCanvasSupported){const A=new OffscreenCanvas(h,Q);A.getContext("2d").putImageData(new ImageData(new Uint8ClampedArray(l.buffer),h,Q),0,0),u.bitmap=A.transferToImageBitmap(),u.data=null}else u.kind=3,u.data=l;return t.splice(s,4*r,87),i.splice(s,4*r,[u,I]),s+1})),Xg(Vg,[l,u,D,E],null,(function(A,e){const t=A.fnArray,i=(e-(A.iCurr-3))%4;switch(i){case 0:return t[e]===l;case 1:return t[e]===u;case 2:return t[e]===D;case 3:return t[e]===E}throw new Error(`iterateImageMaskGroup - invalid pos: ${i}`)}),(function(A,e){const t=A.fnArray,i=A.argsArray,a=A.iCurr,s=a-3,n=a-2,g=a-1;let r=Math.floor((e-s)/4);if(r<10)return e-(e-s)%4;let o,I,c=!1;const C=i[g][0],B=i[n][0],h=i[n][1],Q=i[n][2],l=i[n][3];if(h===Q){c=!0,o=n+4;let A=g+4;for(let e=1;e=4&&t[s-4]===t[n]&&t[s-3]===t[g]&&t[s-2]===t[r]&&t[s-1]===t[o]&&i[s-4][0]===I&&i[s-4][1]===c&&(C++,B-=5);let h=B+4;for(let A=1;A=t)break}i=(i||Vg)[A[e]],i&&!Array.isArray(i)?(s.iCurr=e,e++,!i.checkFn||(0,i.checkFn)(s)?(a=i,i=null):i=null):e++}this.state=i,this.match=a,this.lastProcessed=e}flush(){for(;this.match;){const A=this.queue.fnArray.length;this.lastProcessed=(0,this.match.processFn)(this.context,A),this.match=null,this.state=null,this._optimize()}}reset(){this.state=null,this.match=null,this.lastProcessed=0}}class _g{static CHUNK_SIZE=1e3;static CHUNK_SIZE_ABOUT=this.CHUNK_SIZE-5;constructor(A=0,e){this._streamSink=e,this.fnArray=[],this.argsArray=[],this.optimizer=!e||256&A?new jg(this):new zg(this),this.dependencies=new Set,this._totalLength=0,this.weight=0,this._resolved=e?null:Promise.resolve()}set isOffscreenCanvasSupported(A){this.optimizer.isOffscreenCanvasSupported=A}get length(){return this.argsArray.length}get ready(){return this._resolved||this._streamSink.ready}get totalLength(){return this._totalLength+this.length}addOp(A,e){this.optimizer.push(A,e),this.weight++,this._streamSink&&(this.weight>=_g.CHUNK_SIZE||this.weight>=_g.CHUNK_SIZE_ABOUT&&(A===E||32===A))&&this.flush()}addImageOps(A,e,t){void 0!==t&&this.addOp(y,["OC",t]),this.addOp(A,e),void 0!==t&&this.addOp(w,[])}addDependency(A){this.dependencies.has(A)||(this.dependencies.add(A),this.addOp(1,[A]))}addDependencies(A){for(const e of A)this.addDependency(e)}addOpList(A){if(A instanceof _g){for(const e of A.dependencies)this.dependencies.add(e);for(let e=0,t=A.length;ei&&(A=i),A}function Ar(A,e,t,i,a,s){const n=a*s;let g;g=e<=8?new Uint8Array(n):e<=16?new Uint16Array(n):new Uint32Array(n);const r=t/a,o=i/s;let I,c,C,B,h=0;const Q=new Uint16Array(a),l=t;for(I=0;I0&&Number.isInteger(t.height)&&t.height>0&&(t.width!==C||t.height!==B)&&(R("PDFImage - using the Width/Height of the image data, rather than the image dictionary."),C=t.width,B=t.height),C<1||B<1)throw new K(`Invalid image width: ${C} or height: ${B}`);this.width=C,this.height=B,this.interpolate=o.get("I","Interpolate"),this.imageMask=o.get("IM","ImageMask")||!1,this.matte=o.get("Matte")||!1;let h=t.bitsPerComponent;if(!h&&(h=o.get("BPC","BitsPerComponent"),!h)){if(!this.imageMask)throw new K(`Bits per component missing in image: ${this.imageMask}`);h=1}if(this.bpc=h,!this.imageMask){let a=o.getRaw("CS")||o.getRaw("ColorSpace");const s=!!a;if(s)this.jpxDecoderOptions?.smaskInData&&(a=oA.get("DeviceRGBA"));else if(this.jpxDecoderOptions)a=oA.get("DeviceRGBA");else switch(t.numComps){case 1:a=oA.get("DeviceGray");break;case 3:a=oA.get("DeviceRGB");break;case 4:a=oA.get("DeviceCMYK");break;default:throw new Error(`Images with ${t.numComps} color components not supported.`)}this.colorSpace=oe.parse({cs:a,xref:A,resources:i?e:null,pdfFunctionFactory:g,localColorSpaceCache:r}),this.numComps=this.colorSpace.numComps,this.jpxDecoderOptions&&(this.jpxDecoderOptions.numComponents=s?this.numComp:0,this.jpxDecoderOptions.isIndexedColormap="Indexed"===this.colorSpace.name)}if(this.decode=o.getArray("D","Decode"),this.needsDecode=!1,this.decode&&(this.colorSpace&&!this.colorSpace.isDefaultDecode(this.decode,h)||n&&!oe.isDefaultDecode(this.decode,1))){this.needsDecode=!0;const A=(1<>3)*t,g=A.byteLength;let r,o;if(!i||a&&n!==g?a?(r=new Uint8Array(n),r.set(A),r.fill(255,g)):r=new Uint8Array(A):r=A,a)for(o=0;o>7&1,n[C+1]=c>>6&1,n[C+2]=c>>5&1,n[C+3]=c>>4&1,n[C+4]=c>>3&1,n[C+5]=c>>2&1,n[C+6]=c>>1&1,n[C+7]=1&c,C+=8;if(C>=1}}else{let t=0;for(c=0,C=0,I=s;C>i;a<0?a=0:a>o&&(a=o),n[C]=a,c&=(1<n[i+1]){e=255;break}}g[I]=e}}}if(g)for(I=0,C=3,c=e*i;I>3,I=e&&Tg.needsToBeResized(t,i);if("DeviceRGBA"===this.colorSpace.name){a.kind=3;const A=a.data=await this.getImageBytes(g*n*4,{});return e?I?Tg.createImage(a,!1):this.createBitmap(3,t,i,A):a}if(!A){let A;if("DeviceGray"===this.colorSpace.name&&1===r?A=1:"DeviceRGB"!==this.colorSpace.name||8!==r||this.needsDecode||(A=2),A&&!this.smask&&!this.mask&&t===n&&i===g){const s=await this.getImageBytes(g*o,{});if(e)return I?Tg.createImage({data:s,kind:A,width:t,height:i,interpolate:this.interpolate},this.needsDecode):this.createBitmap(A,n,g,s);if(a.kind=A,a.data=s,this.needsDecode){N(1===A,"PDFImage.createImageData: The image must be grayscale.");const e=a.data;for(let A=0,t=e.length;A>3,n=await this.getImageBytes(i*s,{internal:!0}),g=this.getComponents(n);let r,o;if(1===a){if(o=t*i,this.needsDecode)for(r=0;r>2,r=new Uint32Array(A.buffer,e,g);if(O.isLittleEndian){for(;n>>24|e<<8|4278190080,t[i+2]=e>>>16|a<<16|4278190080,t[i+3]=a>>>8|4278190080}for(let e=4*n,a=A.length;e>>8|255,t[i+2]=e<<16|a>>>16|255,t[i+3]=a<<8|255}for(let e=4*n,a=A.length;e0&&e.args[0].count++}class nr{static TIME_SLOT_DURATION_MS=20;static CHECK_TIME_EVERY=100;constructor(){this.reset()}check(){return!(++this.checkedc){const A="Image exceeded maximum allowed size and was removed.";if(this.options.ignoreErrors)return void R(A);throw new Error(A)}let C,B,h;if(g.has("OC")&&(C=await this.parseMarkedContentProps(g.get("OC"),A)),g.get("IM","ImageMask")){const A=g.get("I","Interpolate"),t=o+7>>3,n=e.getBytes(t*I),c=g.getArray("D","Decode");if(this.parsingType3Font){if(B=er.createRawMask({imgArray:n,width:o,height:I,imageIsFromDecodeStream:e instanceof Fe,inverseDecode:c?.[0]>0,interpolate:A}),B.cached=!!a,h=[B],i.addImageOps(D,h,C),a){const A={fn:D,args:h,optionalContent:C};s.set(a,r,A),r&&this._regionalImageCache.set(null,r,A)}return}if(B=await er.createMask({imgArray:n,width:o,height:I,imageIsFromDecodeStream:e instanceof Fe,inverseDecode:c?.[0]>0,interpolate:A,isOffscreenCanvasSupported:this.options.isOffscreenCanvasSupported}),B.isSingleOpaquePixel){if(i.addImageOps(90,[],C),a){const A={fn:90,args:[],optionalContent:C};s.set(a,r,A),r&&this._regionalImageCache.set(null,r,A)}return}const Q=`mask_${this.idFactory.createObjId()}`;if(i.addDependency(Q),B.dataLen=B.bitmap?B.width*B.height*4:B.data.length,this._sendImgData(Q,B),h=[{data:Q,width:B.width,height:B.height,interpolate:B.interpolate,count:1}],i.addImageOps(D,h,C),a){const A={objId:Q,fn:D,args:h,optionalContent:C};s.set(a,r,A),r&&this._regionalImageCache.set(null,r,A)}return}if(t&&o+I<200&&!g.has("SMask")&&!g.has("Mask")){try{const a=new er({xref:this.xref,res:A,image:e,isInline:t,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:n});B=await a.createImageData(!0,!1),i.isOffscreenCanvasSupported=this.options.isOffscreenCanvasSupported,i.addImageOps(86,[B],C)}catch(A){const e=`Unable to decode inline image: "${A}".`;if(!this.options.ignoreErrors)throw new Error(e);R(e)}return}let Q=`img_${this.idFactory.createObjId()}`,l=!1;if(this.parsingType3Font?Q=`${this.idFactory.getDocId()}_type3_${Q}`:a&&r&&(l=this.globalImageCache.shouldCache(r,this.pageIndex),l&&(N(!t,"Cannot cache an inline image globally."),Q=`${this.idFactory.getDocId()}_${Q}`)),i.addDependency(Q),h=[Q,o,I],i.addImageOps(b,h,C),l){if(this.globalImageCache.hasDecodeFailed(r))return this.globalImageCache.setData(r,{objId:Q,fn:b,args:h,optionalContent:C,byteSize:0}),void this._sendImgData(Q,null,l);if(o*I>25e4||g.has("SMask")||g.has("Mask")){const A=await this.handler.sendWithPromise("commonobj",[Q,"CopyLocalImage",{imageRef:r}]);if(A)return this.globalImageCache.setData(r,{objId:Q,fn:b,args:h,optionalContent:C,byteSize:0}),void this.globalImageCache.addByteSize(r,A)}}if(er.buildImage({xref:this.xref,res:A,image:e,isInline:t,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:n}).then((async A=>(B=await A.createImageData(!1,this.options.isOffscreenCanvasSupported),B.dataLen=B.bitmap?B.width*B.height*4:B.data.length,B.ref=r,l&&this.globalImageCache.addByteSize(r,B.dataLen),this._sendImgData(Q,B,l)))).catch((A=>(R(`Unable to decode image "${Q}": "${A}".`),r&&this.globalImageCache.addDecodeFailed(r),this._sendImgData(Q,null,l)))),a){const A={objId:Q,fn:b,args:h,optionalContent:C};s.set(a,r,A),r&&(this._regionalImageCache.set(null,r,A),l&&this.globalImageCache.setData(r,{objId:Q,fn:b,args:h,optionalContent:C,byteSize:0}))}}handleSMask(A,e,t,i,a,s){const n=A.get("G"),g={subtype:A.get("S").name,backdrop:A.get("BC")},r=A.get("TR");if(gg(r)){const A=this._pdfFunctionFactory.create(r),e=new Uint8Array(256),t=new Float32Array(1);for(let i=0;i<256;i++)t[0]=i/255,A(t,0,t,0),e[i]=255*t[0]|0;g.transferMap=e}return this.buildFormXObject(e,n,g,t,i,a.state.clone(),s)}handleTransferFunction(A){let e;if(Array.isArray(A))e=A;else{if(!gg(A))return null;e=[A]}const t=[];let i=0,a=0;for(const A of e){const e=this.xref.fetchIfRef(A);if(i++,lA(e,"Identity")){t.push(null);continue}if(!gg(e))return null;const s=this._pdfFunctionFactory.create(e),n=new Uint8Array(256),g=new Float32Array(1);for(let A=0;A<256;A++)g[0]=A/255,s(g,0,g,0),n[A]=255*g[0]|0;t.push(n),a++}return 1!==i&&4!==i||0===a?null:t}handleTilingType(A,e,t,i,a,s,n,g){const r=new _g,o=CA.merge({xref:this.xref,dictArray:[a.get("Resources"),t]});return this.getOperatorList({stream:i,task:n,resources:o,operatorList:r}).then((function(){const t=r.getIR(),i=en(t,a,e);s.addDependencies(r.dependencies),s.addOp(A,i),a.objId&&g.set(null,a.objId,{operatorListIR:t,dict:a})})).catch((A=>{if(!(A instanceof q)){if(!this.options.ignoreErrors)throw A;R(`handleTilingType - ignoring pattern: "${A}".`)}}))}async handleSetFont(A,e,t,i,a,s,n=null,g=null){const r=e?.[0]instanceof oA?e[0].name:null;let o=await this.loadFont(r,t,A,n,g);if(o.font.isType3Font)try{await o.loadType3Data(this,A,a),i.addDependencies(o.type3Dependencies)}catch(A){o=new rr({loadedName:"g_font_error",font:new Zs(`Type3 font load error: ${A}`),dict:o.font,evaluatorOptions:this.options})}return s.font=o.font,o.send(this.handler),o.loadedName}handleText(A,e){const t=e.font,i=t.charsToGlyphs(A);return t.data&&(4&e.textRenderingMode||"Pattern"===e.fillColorSpace.name||t.disableFontFace||this.options.disableFontFace)&&gr.buildFontPaths(t,i,this.handler,this.options),i}ensureStateFont(A){if(A.font)return;const e=new K("Missing setFont (Tf) operator before text rendering operator.");if(!this.options.ignoreErrors)throw e;R(`ensureStateFont: "${e}".`)}async setGState({resources:A,gState:e,operatorList:t,cacheKey:i,task:a,stateManager:s,localGStateCache:n,localColorSpaceCache:g}){const r=e.objId;let o=!0;const I=[];let c=Promise.resolve();for(const i of e.getKeys()){const n=e.get(i);switch(i){case"Type":break;case"LW":case"LC":case"LJ":case"ML":case"D":case"RI":case"FL":case"CA":case"ca":I.push([i,n]);break;case"Font":o=!1,c=c.then((()=>this.handleSetFont(A,null,n[0],t,a,s.state).then((function(A){t.addDependency(A),I.push([i,[A,n[1]]])}))));break;case"BM":I.push([i,ar(n)]);break;case"SMask":if(lA(n,"None")){I.push([i,!1]);break}n instanceof CA?(o=!1,c=c.then((()=>this.handleSMask(n,A,t,a,s,g))),I.push([i,!0])):R("Unsupported SMask type");break;case"TR":const e=this.handleTransferFunction(n);I.push([i,e]);break;case"OP":case"op":case"OPM":case"BG":case"BG2":case"UCR":case"UCR2":case"TR2":case"HT":case"SM":case"SA":case"AIS":case"TK":S("graphic state operator "+i);break;default:S("Unknown graphic state operator "+i)}}await c,I.length>0&&t.addOp(9,[I]),o&&n.set(i,r,I)}loadFont(A,e,t,i=null,a=null){const s=async()=>new rr({loadedName:"g_font_error",font:new Zs(`Font "${A}" is not available.`),dict:e,evaluatorOptions:this.options});let n;if(e)e instanceof BA&&(n=e);else{const e=t.get("Font");e&&(n=e.getRaw(A))}if(n){if(this.type3FontRefs?.has(n))return s();if(this.fontCache.has(n))return this.fontCache.get(n);try{e=this.xref.fetchIfRef(n)}catch(A){R(`loadFont - lookup failed: "${A}".`)}}if(!(e instanceof CA)){if(!this.options.ignoreErrors&&!this.parsingType3Font)return R(`Font "${A}" is not available.`),s();R(`Font "${A}" is not available -- attempting to fallback to a default font.`),e=i||gr.fallbackFontDict}if(e.cacheKey&&this.fontCache.has(e.cacheKey))return this.fontCache.get(e.cacheKey);const{promise:g,resolve:r}=Promise.withResolvers();let o;try{o=this.preEvaluateFont(e),o.cssFontInfo=a}catch(A){return R(`loadFont - preEvaluateFont failed: "${A}".`),s()}const{descriptor:I,hash:c}=o,C=n instanceof BA;let B;if(c&&I instanceof CA){const A=I.fontAliases||=Object.create(null);if(A[c]){const e=A[c].aliasRef;if(C&&e&&this.fontCache.has(e))return this.fontCache.putAlias(n,e),this.fontCache.get(n)}else A[c]={fontID:this.idFactory.createFontId()};C&&(A[c].aliasRef=n),B=A[c].fontID}else B=this.idFactory.createFontId();return N(B?.startsWith("f"),'The "fontID" must be (correctly) defined.'),C?this.fontCache.put(n,g):(e.cacheKey=`cacheKey_${B}`,this.fontCache.put(e.cacheKey,g)),e.loadedName=`${this.idFactory.getDocId()}_${B}`,this.translateFont(o).then((A=>{r(new rr({loadedName:e.loadedName,font:A,dict:e,evaluatorOptions:this.options}))})).catch((A=>{R(`loadFont - translateFont failed: "${A}".`),r(new rr({loadedName:e.loadedName,font:new Zs(A instanceof Error?A.message:A),dict:e,evaluatorOptions:this.options}))})),g}buildPath(A,e,t,i=!1){const a=A.length-1;if(t||(t=[]),a<0||91!==A.fnArray[a]){let a;switch(i&&(R(`Encountered path operator "${e}" inside of a text object.`),A.addOp(l,null)),e){case 19:const A=t[0]+t[2],e=t[1]+t[3];a=[Math.min(t[0],A),Math.min(t[1],e),Math.max(t[0],A),Math.max(t[1],e)];break;case 13:case 14:a=[t[0],t[1],t[0],t[1]];break;default:a=[1/0,1/0,-1/0,-1/0]}A.addOp(91,[[e],t,a]),i&&A.addOp(E,null)}else{const i=A.argsArray[a];i[0].push(e),i[1].push(...t);const s=i[2];switch(e){case 19:const A=t[0]+t[2],e=t[1]+t[3];s[0]=Math.min(s[0],t[0],A),s[1]=Math.min(s[1],t[1],e),s[2]=Math.max(s[2],t[0],A),s[3]=Math.max(s[3],t[1],e);break;case 13:case 14:s[0]=Math.min(s[0],t[0]),s[1]=Math.min(s[1],t[1]),s[2]=Math.max(s[2],t[0]),s[3]=Math.max(s[3],t[1])}}}parseColorSpace({cs:A,resources:e,localColorSpaceCache:t}){return oe.parseAsync({cs:A,xref:this.xref,resources:e,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:t}).catch((A=>{if(A instanceof q)return null;if(this.options.ignoreErrors)return R(`parseColorSpace - ignoring ColorSpace: "${A}".`),null;throw A}))}parseShading({shading:A,resources:e,localColorSpaceCache:t,localShadingPatternCache:i}){let a,s=i.get(A);if(s)return s;try{a=Os.parseShading(A,this.xref,e,this._pdfFunctionFactory,t).getIR()}catch(e){if(e instanceof q)return null;if(this.options.ignoreErrors)return R(`parseShading - ignoring shading: "${e}".`),i.set(A,null),null;throw e}return s=`pattern_${this.idFactory.createObjId()}`,this.parsingType3Font&&(s=`${this.idFactory.getDocId()}_type3_${s}`),i.set(A,s),this.parsingType3Font?this.handler.send("commonobj",[s,"Pattern",a]):this.handler.send("obj",[s,this.pageIndex,"Pattern",a]),s}handleColorN(A,e,t,i,a,s,n,g,r,o){const I=t.pop();if(I instanceof oA){const c=a.getRaw(I.name),C=c instanceof BA&&r.getByRef(c);if(C)try{const a=i.base?i.base.getRgb(t,0):null,s=en(C.operatorListIR,C.dict,a);return void A.addOp(e,s)}catch{}const B=this.xref.fetchIfRef(c);if(B){const a=B instanceof fA?B.dict:B,I=a.get("PatternType");if(1===I){const g=i.base?i.base.getRgb(t,0):null;return this.handleTilingType(e,g,s,B,a,A,n,r)}if(2===I){const t=a.get("Shading"),i=this.parseShading({shading:t,resources:s,localColorSpaceCache:g,localShadingPatternCache:o});if(i){const t=JA(a.getArray("Matrix"),null);A.addOp(e,["Shading",i,t])}return}throw new K(`Unknown PatternType: ${I}`)}}throw new K(`Unknown PatternName: ${I}`)}_parseVisibilityExpression(A,e,t){if(++e>10)return void R("Visibility expression is too deeply nested");const i=A.length,a=this.xref.fetchIfRef(A[0]);if(!(i<2)&&a instanceof oA){switch(a.name){case"And":case"Or":case"Not":t.push(a.name);break;default:return void R(`Invalid operator ${a.name} in visibility expression`)}for(let a=1;a0)return{type:"OCMD",expression:e}}const e=t.get("OCGs");if(Array.isArray(e)||e instanceof CA){const A=[];if(Array.isArray(e))for(const t of e)A.push(t.toString());else A.push(e.objId);return{type:i,ids:A,policy:t.get("P")instanceof oA?t.get("P").name:null,expression:null}}if(e instanceof BA)return{type:i,id:e.toString()}}return null}getOperatorList({stream:A,task:e,resources:t,operatorList:i,initialState:a=null,fallbackFontDict:s=null}){if(t||=CA.empty,a||=new cr,!i)throw new Error('getOperatorList: missing "operatorList" parameter');const n=this,g=this.xref;let r=!1;const o=new zn,I=new _n,c=new Ag,C=new eg,B=new Map,h=t.get("XObject")||CA.empty,Q=t.get("Pattern")||CA.empty,l=new or(a),u=new Cr(A,g,l),w=new nr;function D(A){for(let A=0,e=u.savedStatesDepth;A0&&i.addOp(9,[e]),A=null;continue}}return void b(new Promise((function(A,a){if(!M)throw new K("GState must be referred to by name.");const s=t.get("ExtGState");if(!(s instanceof CA))throw new K("ExtGState should be a dictionary.");const g=s.get(U);if(!(g instanceof CA))throw new K("GState should be a dictionary.");n.setGState({resources:t,gState:g,operatorList:i,cacheKey:U,task:e,stateManager:l,localGStateCache:c,localColorSpaceCache:I}).then(A,a)})).catch((function(A){if(!(A instanceof q)){if(!n.options.ignoreErrors)throw A;R(`getOperatorList - ignoring ExtGState: "${A}".`)}})));case 13:case 14:case 15:case 16:case 17:case 18:case 19:n.buildPath(i,a,A,r);continue;case 67:case 68:case 72:case 73:continue;case y:if(!(A[0]instanceof oA)){R(`Expected name for beginMarkedContentProps arg0=${A[0]}`),i.addOp(y,["OC",null]);continue}if("OC"===A[0].name)return void b(n.parseMarkedContentProps(A[1],t).then((A=>{i.addOp(y,["OC",A])})).catch((A=>{if(!(A instanceof q)){if(n.options.ignoreErrors)return R(`getOperatorList - ignoring beginMarkedContentProps: "${A}".`),void i.addOp(y,["OC",null]);throw A}})));A=[A[0].name,A[1]instanceof CA?A[1].get("MCID"):null];break;default:if(null!==A){for(G=0,N=A.length;G{if(!(A instanceof q)){if(this.options.ignoreErrors)return R(`getOperatorList - ignoring errors during "${e.name}" task: "${A}".`),void D();throw A}}))}getTextContent({stream:A,task:e,resources:t,stateManager:s=null,includeMarkedContent:n=!1,sink:g,seenStyles:r=new Set,viewBox:o,lang:I=null,markedContentData:c=null,disableNormalization:C=!1,keepWhiteSpace:B=!1}){t||=CA.empty,s||=new or(new Ir),n&&(c||={level:0});const h={items:[],styles:Object.create(null),lang:I},Q={initialized:!1,str:[],totalWidth:0,totalHeight:0,width:0,height:0,vertical:!1,prevTransform:null,textAdvanceScale:0,spaceInFlowMin:0,spaceInFlowMax:0,trackingSpaceMin:1/0,negativeSpaceMax:-1/0,notASpace:-1/0,transform:null,fontName:null,hasEOL:!1},l=[" "," "];let u=0;function p(A){const e=(u+1)%2,t=" "!==l[u]&&" "===l[e];return l[u]=A,u=e,!B&&t}function m(){return!B&&" "!==l[u]&&" "===l[(u+1)%2]}function D(){l[0]=l[1]=" ",u=0}const b=this,k=this.xref,F=[];let S=null;const G=new zn,N=new Ag,x=new Cr(A,k,s);let U;function M({width:A=0,height:e=0,transform:t=Q.prevTransform,fontName:i=Q.fontName}){h.items.push({str:" ",dir:"ltr",width:A,height:e,transform:t,fontName:i,hasEOL:!1})}function L(){const A=U.font,e=[U.fontSize*U.textHScale,0,0,U.fontSize,0,U.textRise];if(A.isType3Font&&(U.fontSize<=1||A.isCharBBox)&&!AA(U.fontMatrix,a)){const t=A.bbox[3]-A.bbox[1];t>0&&(e[3]*=t*U.fontMatrix[3])}return V.transform(U.ctm,V.transform(U.textMatrix,e))}function J(){if(Q.initialized)return Q;const{font:A,loadedName:e}=U;if(!r.has(e)&&(r.add(e),h.styles[e]={fontFamily:A.fallbackName,ascent:A.ascent,descent:A.descent,vertical:A.vertical},b.options.fontExtraProperties&&A.systemFontInfo)){const t=h.styles[e];t.fontSubstitution=A.systemFontInfo.css,t.fontSubstitutionLoadedName=A.systemFontInfo.loadedName}Q.fontName=e;const t=Q.transform=L();A.vertical?(Q.width=Q.totalWidth=Math.hypot(t[0],t[1]),Q.height=Q.totalHeight=0,Q.vertical=!0):(Q.width=Q.totalWidth=0,Q.height=Q.totalHeight=Math.hypot(t[2],t[3]),Q.vertical=!1);const i=Math.hypot(U.textLineMatrix[0],U.textLineMatrix[1]),a=Math.hypot(U.ctm[0],U.ctm[1]);Q.textAdvanceScale=a*i;const{fontSize:s}=U;return Q.trackingSpaceMin=.102*s,Q.notASpace=.03*s,Q.negativeSpaceMax=-.2*s,Q.spaceInFlowMin=.102*s,Q.spaceInFlowMax=.6*s,Q.hasEOL=!1,Q.initialized=!0,Q}function H(){if(!Q.initialized)return;const A=Math.hypot(U.textLineMatrix[0],U.textLineMatrix[1]),e=Math.hypot(U.ctm[0],U.ctm[1])*A;e!==Q.textAdvanceScale&&(Q.vertical?(Q.totalHeight+=Q.height*Q.textAdvanceScale,Q.height=0):(Q.totalWidth+=Q.width*Q.textAdvanceScale,Q.width=0),Q.textAdvanceScale=e)}async function Y(A,i){const s=await b.loadFont(A,i,t);if(s.font.isType3Font)try{await s.loadType3Data(b,t,e)}catch{}U.loadedName=s.loadedName,U.font=s.font,U.fontMatrix=s.font.fontMatrix||a}function v(A,e,t){const i=Math.hypot(t[0],t[1]);return[(t[0]*A+t[1]*e)/i,(t[2]*A+t[3]*e)/i]}function T(A){const e=L();let t=e[4],i=e[5];if(U.font?.vertical){if(to[2]||i+Ao[3])return!1}else if(t+Ao[2]||io[3])return!1;if(!U.font||!Q.prevTransform)return!0;let a=Q.prevTransform[4],s=Q.prevTransform[5];if(a===t&&s===i)return!0;let n=-1;switch(e[0]&&0===e[1]&&0===e[2]?n=e[0]>0?0:180:e[1]&&0===e[0]&&0===e[3]&&(n=e[1]>0?90:270),n){case 0:break;case 90:[t,i]=[i,t],[a,s]=[s,a];break;case 180:[t,i,a,s]=[-t,-i,-a,-s];break;case 270:[t,i]=[-i,-t],[a,s]=[-s,-a];break;default:[t,i]=v(t,i,e),[a,s]=v(a,s,Q.prevTransform)}if(U.font.vertical){const A=(s-i)/Q.textAdvanceScale,e=t-a,n=Math.sign(Q.height);return A.5*Q.width?(W(),!0):(D(),O(),!0):Math.abs(e)>Q.width?(W(),!0):(A<=n*Q.notASpace&&D(),A<=n*Q.trackingSpaceMin?m()?(D(),O(),M({height:Math.abs(A)})):Q.height+=A:Z(A,Q.prevTransform,n)||(0===Q.str.length?(D(),M({height:Math.abs(A)})):Q.height+=A),Math.abs(e)>.25*Q.width&&O(),!0)}const g=(t-a)/Q.textAdvanceScale,r=i-s,I=Math.sign(Q.width);return g.5*Q.height?(W(),!0):(D(),O(),!0):Math.abs(r)>Q.height?(W(),!0):(g<=I*Q.notASpace&&D(),g<=I*Q.trackingSpaceMin?m()?(D(),O(),M({width:Math.abs(g)})):Q.width+=g:Z(g,Q.prevTransform,I)||(0===Q.str.length?(D(),M({width:Math.abs(g)})):Q.width+=g),Math.abs(r)>.25*Q.height&&O(),!0)}function P({chars:A,extraSpacing:e}){const t=U.font;if(!A){const A=U.charSpacing+e;return A&&(t.vertical?U.translateTextMatrix(0,-A):U.translateTextMatrix(A*U.textHScale,0)),void(B&&T(0))}const i=t.charsToGlyphs(A),a=U.fontMatrix[0]*U.fontSize;for(let A=0,s=i.length;Ae?e.normalize("NFKC"):iA.get(t))));const i=xg(e,-1,A.vertical);return{str:i.str,dir:i.dir,width:Math.abs(A.totalWidth),height:Math.abs(A.totalHeight),transform:A.transform,fontName:A.fontName,hasEOL:A.hasEOL}}(Q)),Q.initialized=!1,Q.str.length=0)}function X(A=!1){const e=h.items.length;0!==e&&(A&&e<10||(g.enqueue(h,e),h.items=[],h.styles=Object.create(null)))}const j=new nr;return new Promise((function A(a,Q){const l=function(e){X(!0),Promise.all([e,g.ready]).then((function(){try{A(a,Q)}catch(A){Q(A)}}),Q)};e.ensureNotTerminated(),j.reset();const u={};let p,m=[];for(;!(p=j.check())&&(m.length=0,u.args=m,x.read(u));){const A=U;U=s.state;const a=u.fn;switch(m=u.args,0|a){case d:var D=m[0].name,M=m[1];if(U.font&&D===U.fontName&&M===U.fontSize)break;return O(),U.fontName=D,U.fontSize=M,void l(Y(D,null));case 39:U.textRise=m[0];break;case 35:U.textHScale=m[0]/100;break;case 36:U.leading=m[0];break;case 40:U.translateTextLineMatrix(m[0],m[1]),U.textMatrix=U.textLineMatrix.slice();break;case 41:U.leading=-m[1],U.translateTextLineMatrix(m[0],m[1]),U.textMatrix=U.textLineMatrix.slice();break;case 43:U.carriageReturn();break;case 42:U.setTextMatrix(m[0],m[1],m[2],m[3],m[4],m[5]),U.setTextLineMatrix(m[0],m[1],m[2],m[3],m[4],m[5]),H();break;case 33:U.charSpacing=m[0];break;case 34:U.wordSpacing=m[0];break;case 31:U.textMatrix=i.slice(),U.textLineMatrix=i.slice();break;case 45:if(!s.state.font){b.ensureStateFont(s.state);continue}const a=(U.font.vertical?1:-1)*U.fontSize/1e3,Q=m[0];for(let A=0,e=Q.length;A0){const A=F.join("");F.length=0,P({chars:A,extraSpacing:0})}break;case f:if(!s.state.font){b.ensureStateFont(s.state);continue}P({chars:m[0],extraSpacing:0});break;case 46:if(!s.state.font){b.ensureStateFont(s.state);continue}U.carriageReturn(),P({chars:m[0],extraSpacing:0});break;case 47:if(!s.state.font){b.ensureStateFont(s.state);continue}U.wordSpacing=m[0],U.charSpacing=m[1],U.carriageReturn(),P({chars:m[2],extraSpacing:0});break;case 66:O(),S||(S=t.get("XObject")||CA.empty);var L=m[0]instanceof oA,J=m[0].name;if(L&&G.getByName(J))break;return void l(new Promise((function(A,i){if(!L)throw new K("XObject must be referred to by name.");let a=S.getRaw(J);if(a instanceof BA){if(G.getByRef(a))return void A();if(b.globalImageCache.getData(a,b.pageIndex))return void A();a=k.fetch(a)}if(!(a instanceof fA))throw new K("XObject should be a stream");const h=a.dict.get("Subtype");if(!(h instanceof oA))throw new K("XObject should have a Name subtype");if("Form"!==h.name)return G.set(J,a.dict.objId,!0),void A();const Q=s.state.clone(),l=new or(Q),E=JA(a.dict.getArray("Matrix"),null);E&&l.transform(E),X();const u={enqueueInvoked:!1,enqueue(A,e){this.enqueueInvoked=!0,g.enqueue(A,e)},get desiredSize(){return g.desiredSize},get ready(){return g.ready}};b.getTextContent({stream:a,task:e,resources:a.dict.get("Resources")||t,stateManager:l,includeMarkedContent:n,sink:u,seenStyles:r,viewBox:o,lang:I,markedContentData:c,disableNormalization:C,keepWhiteSpace:B}).then((function(){u.enqueueInvoked||G.set(J,a.dict.objId,!0),A()}),i)})).catch((function(A){if(!(A instanceof q)){if(!b.options.ignoreErrors)throw A;R(`getTextContent - ignoring XObject: "${A}".`)}})));case 9:if(L=m[0]instanceof oA,J=m[0].name,L&&N.getByName(J))break;return void l(new Promise((function(A,e){if(!L)throw new K("GState must be referred to by name.");const i=t.get("ExtGState");if(!(i instanceof CA))throw new K("ExtGState should be a dictionary.");const a=i.get(J);if(!(a instanceof CA))throw new K("GState should be a dictionary.");const s=a.get("Font");if(!s)return N.set(J,a.objId,!0),void A();O(),U.fontName=null,U.fontSize=s[1],Y(null,s[0]).then(A,e)})).catch((function(A){if(!(A instanceof q)){if(!b.options.ignoreErrors)throw A;R(`getTextContent - ignoring ExtGState: "${A}".`)}})));case 69:O(),n&&(c.level++,h.items.push({type:"beginMarkedContent",tag:m[0]instanceof oA?m[0].name:null}));break;case y:if(O(),n){c.level++;let A=null;m[1]instanceof CA&&(A=m[1].get("MCID")),h.items.push({type:"beginMarkedContentProps",id:Number.isInteger(A)?`${b.idFactory.getPageObjId()}_mc${A}`:null,tag:m[0]instanceof oA?m[0].name:null})}break;case w:if(O(),n){if(0===c.level)break;c.level--,h.items.push({type:"endMarkedContent"})}break;case E:!A||A.font===U.font&&A.fontSize===U.fontSize&&A.fontName===U.fontName||O()}if(h.items.length>=g.desiredSize){p=!0;break}}p?l(ir):(O(),X(),a())})).catch((A=>{if(!(A instanceof q)){if(this.options.ignoreErrors)return R(`getTextContent - ignoring errors during "${e.name}" task: "${A}".`),O(),void X();throw A}}))}async extractDataStructures(A,e){const t=this.xref;let i;const a=this.readToUnicode(e.toUnicode);if(e.composite){const t=A.get("CIDSystemInfo");t instanceof CA&&(e.cidSystemInfo={registry:z(t.get("Registry")),ordering:z(t.get("Ordering")),supplement:t.get("Supplement")});try{const e=A.get("CIDToGIDMap");e instanceof fA&&(i=e.getBytes())}catch(A){if(!this.options.ignoreErrors)throw A;R(`extractDataStructures - ignoring CIDToGIDMap data: "${A}".`)}}const s=[];let n,g=null;if(A.has("Encoding")){if(n=A.get("Encoding"),n instanceof CA){if(g=n.get("BaseEncoding"),g=g instanceof oA?g.name:null,n.has("Differences")){const A=n.get("Differences");let e=0;for(const i of A){const A=t.fetchIfRef(i);if("number"==typeof A)e=A;else{if(!(A instanceof oA))throw new K(`Invalid entry in 'Differences' array: ${A}`);s[e++]=A.name}}}}else if(n instanceof oA)g=n.name;else{const A="Encoding is not a Name nor a Dict";if(!this.options.ignoreErrors)throw new K(A);R(A)}"MacRomanEncoding"!==g&&"MacExpertEncoding"!==g&&"WinAnsiEncoding"!==g&&(g=null)}const r=!e.file||e.isInternalFont,o=da()[e.name];if(g&&r&&o&&(g=null),g)e.defaultEncoding=Mi(g);else{const A=!!(4&e.flags),t=!!(32&e.flags);n=Gi,"TrueType"!==e.type||t||(n=Ni),(A||o)&&(n=Ri,r&&(/Symbol/i.test(e.name)?n=xi:/Dingbats/i.test(e.name)?n=Ui:/Wingdings/i.test(e.name)&&(n=Ni))),e.defaultEncoding=n}e.differences=s,e.baseEncodingName=g,e.hasEncoding=!!g||s.length>0,e.dict=A,e.toUnicode=await a;const I=await this.buildToUnicode(e);return e.toUnicode=I,i&&(e.cidToGidMap=this.readCidToGidMap(i,I)),e}_simpleFontToUnicode(A,e=!1){N(!A.composite,"Must be a simple font.");const t=[],i=A.defaultEncoding.slice(),a=A.baseEncodingName,s=A.differences;for(const A in s){const e=s[A];".notdef"!==e&&(i[A]=e)}const n=ea();for(const s in i){let g=i[s];if(""===g)continue;let r=n[g];if(void 0!==r){t[s]=String.fromCharCode(r);continue}let o=0;switch(g[0]){case"G":3===g.length&&(o=parseInt(g.substring(1),16));break;case"g":5===g.length&&(o=parseInt(g.substring(1),16));break;case"C":case"c":if(g.length>=3&&g.length<=4){const t=g.substring(1);if(e){o=parseInt(t,16);break}if(o=+t,Number.isNaN(o)&&Number.isInteger(parseInt(t,16)))return this._simpleFontToUnicode(A,!0)}break;case"u":r=aa(g,n),-1!==r&&(o=r);break;default:switch(g){case"f_h":case"f_t":case"T_h":t[s]=g.replaceAll("_","");continue}}if(o>0&&o<=1114111&&Number.isInteger(o)){if(a&&o===+s){const A=Mi(a);if(A&&(g=A[s])){t[s]=String.fromCharCode(n[g]);continue}}t[s]=String.fromCodePoint(o)}}return t}async buildToUnicode(A){if(A.hasIncludedToUnicodeMap=A.toUnicode?.length>0,A.hasIncludedToUnicodeMap)return!A.composite&&A.hasEncoding&&(A.fallbackToUnicode=this._simpleFontToUnicode(A)),A.toUnicode;if(!A.composite)return new Da(this._simpleFontToUnicode(A));if(A.composite&&(A.cMap.builtInCMap&&!(A.cMap instanceof Ii)||"Adobe"===A.cidSystemInfo?.registry&&("GB1"===A.cidSystemInfo.ordering||"CNS1"===A.cidSystemInfo.ordering||"Japan1"===A.cidSystemInfo.ordering||"Korea1"===A.cidSystemInfo.ordering))){const{registry:e,ordering:t}=A.cidSystemInfo,i=oA.get(`${e}-${t}-UCS2`),a=await wi.create({encoding:i,fetchBuiltInCMap:this._fetchBuiltInCMapBound,useCMap:null}),s=[],n=[];return A.cMap.forEach((function(A,e){if(e>65535)throw new K("Max size of CID is 65,535");const t=a.lookup(e);if(t){n.length=0;for(let A=0,e=t.length;A>1;(0!==a||e.has(s))&&(t[s]=a)}return t}extractWidths(A,e,t){const i=this.xref;let a=[],s=0;const n=[];let g;if(t.composite){const e=A.get("DW");s="number"==typeof e?Math.ceil(e):1e3;const r=A.get("W");if(Array.isArray(r))for(let A=0,e=r.length;A{const e=r.get(A),a=new _g;return i.getOperatorList({stream:e,task:t,resources:o,operatorList:a}).then((()=>{49===a.fnArray[0]&&this._removeType3ColorOperators(a,h),I[A]=a.getIR();for(const A of a.dependencies)n.add(A)})).catch((function(e){R(`Type3 font resource "${A}" is not available.`);const t=new _g;I[A]=t.getIR()}))}));return this.type3Loaded=g.then((()=>{s.charProcOperatorList=I,this._bbox&&(s.isCharBBox=!0,s.bbox=this._bbox)})),this.type3Loaded}_removeType3ColorOperators(A,e=NaN){const t=V.normalizeRect(A.argsArray[0].slice(2)),i=t[2]-t[0],a=t[3]-t[1],s=Math.hypot(i,a);0===i||0===a?(A.fnArray.splice(0,1),A.argsArray.splice(0,1)):(0===e||Math.round(s/e)>=10)&&(this._bbox||(this._bbox=[1/0,1/0,-1/0,-1/0]),this._bbox[0]=Math.min(this._bbox[0],t[0]),this._bbox[1]=Math.min(this._bbox[1],t[1]),this._bbox[2]=Math.max(this._bbox[2],t[2]),this._bbox[3]=Math.max(this._bbox[3],t[3]));let n=0,g=A.length;for(;n=13&&s<=28,a.variableArgs)g>n&&S(`Command ${i}: expected [0, ${n}] args, but received ${g} args.`);else{if(g!==n){const A=this.nonProcessedArgs;for(;g>n;)A.push(e.shift()),g--;for(;gCr.MAX_INVALID_PATH_OPS)throw new K(`Invalid ${A}`);R(`Skipping ${A}`),null!==e&&(e.length=0);continue}}return this.preprocessCommand(s,e),A.fn=s,A.args=e,!0}if(t===sA)return!1;if(null!==t&&(null===e&&(e=[]),e.push(t),e.length>33))throw new K("Too many arguments")}}preprocessCommand(A,e){switch(0|A){case l:this.stateManager.save();break;case E:this.stateManager.restore();break;case u:this.stateManager.transform(e)}}}class Br extends Cr{constructor(A){super(new se(A))}parse(){const A={fn:0,args:[]},e={fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3)};try{for(;A.args.length=0,this.read(A);){if(0!==this.savedStatesDepth)continue;const{fn:t,args:i}=A;switch(0|t){case d:const[A,t]=i;A instanceof oA&&(e.fontName=A.name),"number"==typeof t&&t>0&&(e.fontSize=t);break;case m:oe.singletons.rgb.getRgbItem(i,0,e.fontColor,0);break;case 57:oe.singletons.gray.getRgbItem(i,0,e.fontColor,0);break;case 61:oe.singletons.cmyk.getRgbItem(i,0,e.fontColor,0)}}}catch(A){R(`parseDefaultAppearance - ignoring errors: "${A}".`)}return e}}function hr(A){return new Br(A).parse()}class Qr extends Cr{constructor(A,e,t){super(A),this.stream=A,this.evaluatorOptions=e,this.xref=t,this.resources=A.dict?.get("Resources")}parse(){const A={fn:0,args:[]};let e={scaleFactor:1,fontSize:0,fontName:"",fontColor:new Uint8ClampedArray(3),fillColorSpace:oe.singletons.gray},t=!1;const i=[];try{for(;A.args.length=0,!t&&this.read(A);){const{fn:a,args:s}=A;switch(0|a){case l:i.push({scaleFactor:e.scaleFactor,fontSize:e.fontSize,fontName:e.fontName,fontColor:e.fontColor.slice(),fillColorSpace:e.fillColorSpace});break;case E:e=i.pop()||e;break;case 42:e.scaleFactor*=Math.hypot(s[0],s[1]);break;case d:const[A,a]=s;A instanceof oA&&(e.fontName=A.name),"number"==typeof a&&a>0&&(e.fontSize=a*e.scaleFactor);break;case 51:e.fillColorSpace=oe.parse({cs:s[0],xref:this.xref,resources:this.resources,pdfFunctionFactory:this._pdfFunctionFactory,localColorSpaceCache:this._localColorSpaceCache});break;case 54:e.fillColorSpace.getRgbItem(s,0,e.fontColor,0);break;case m:oe.singletons.rgb.getRgbItem(s,0,e.fontColor,0);break;case 57:oe.singletons.gray.getRgbItem(s,0,e.fontColor,0);break;case 61:oe.singletons.cmyk.getRgbItem(s,0,e.fontColor,0);break;case f:case 45:case 46:case 47:t=!0}}}catch(A){R(`parseAppearanceStream - ignoring errors: "${A}".`)}return this.stream.reset(),delete e.scaleFactor,delete e.fillColorSpace,e}get _localColorSpaceCache(){return U(this,"_localColorSpaceCache",new _n)}get _pdfFunctionFactory(){return U(this,"_pdfFunctionFactory",new ag({xref:this.xref,isEvalSupported:this.evaluatorOptions.isEvalSupported}))}}function lr(A,e){return A[0]===A[1]&&A[1]===A[2]?`${zA(A[0]/255)} ${e?"g":"G"}`:Array.from(A,(A=>zA(A/255))).join(" ")+" "+(e?"rg":"RG")}class Er{constructor(A,e){this.xref=A,this.widths=null,this.firstChar=1/0,this.lastChar=-1/0,this.fontFamily=e;const t=new OffscreenCanvas(1,1);this.ctxMeasure=t.getContext("2d",{willReadFrequently:!0}),Er._fontNameId||(Er._fontNameId=1),this.fontName=oA.get(`InvalidPDFjsFont_${e}_${Er._fontNameId++}`)}get fontDescriptorRef(){if(!Er._fontDescriptorRef){const A=new CA(this.xref);A.set("Type",oA.get("FontDescriptor")),A.set("FontName",this.fontName),A.set("FontFamily","MyriadPro Regular"),A.set("FontBBox",[0,0,0,0]),A.set("FontStretch",oA.get("Normal")),A.set("FontWeight",400),A.set("ItalicAngle",0),Er._fontDescriptorRef=this.xref.getNewPersistentRef(A)}return Er._fontDescriptorRef}get descendantFontRef(){const A=new CA(this.xref);A.set("BaseFont",this.fontName),A.set("Type",oA.get("Font")),A.set("Subtype",oA.get("CIDFontType0")),A.set("CIDToGIDMap",oA.get("Identity")),A.set("FirstChar",this.firstChar),A.set("LastChar",this.lastChar),A.set("FontDescriptor",this.fontDescriptorRef),A.set("DW",1e3);const e=[],t=[...this.widths.entries()].sort();let i=null,a=null;for(const[A,s]of t)i?A===i+a.length?a.push(s):(e.push(i,a),i=A,a=[s]):(i=A,a=[s]);i&&e.push(i,a),A.set("W",e);const s=new CA(this.xref);return s.set("Ordering","Identity"),s.set("Registry","Adobe"),s.set("Supplement",0),A.set("CIDSystemInfo",s),this.xref.getNewPersistentRef(A)}get baseFontRef(){const A=new CA(this.xref);return A.set("BaseFont",this.fontName),A.set("Type",oA.get("Font")),A.set("Subtype",oA.get("Type0")),A.set("Encoding",oA.get("Identity-H")),A.set("DescendantFonts",[this.descendantFontRef]),A.set("ToUnicode",oA.get("Identity-H")),this.xref.getNewPersistentRef(A)}get resources(){const A=new CA(this.xref),e=new CA(this.xref);return e.set(this.fontName.name,this.baseFontRef),A.set("Font",e),A}_createContext(){return this.widths=new Map,this.ctxMeasure.font=`1000px ${this.fontFamily}`,this.ctxMeasure}createFontResources(A){const e=this._createContext();for(const t of A.split(/\r\n?|\n/))for(const A of t.split("")){const t=A.charCodeAt(0);if(this.widths.has(t))continue;const i=e.measureText(A),a=Math.ceil(i.width);this.widths.set(t,a),this.firstChar=Math.min(t,this.firstChar),this.lastChar=Math.max(t,this.lastChar)}return this.resources}static getFirstPositionInfo(A,e,t){const[i,a,n,g]=A;let r=n-i,o=g-a;e%180!=0&&([r,o]=[o,r]);const I=s*t;return{coords:[0,o+.35*t-I],bbox:[0,0,r,o],matrix:0!==e?te(e,o,I):void 0}}createAppearance(A,e,t,i,a,n){const g=this._createContext(),r=[];let o=-1/0;for(const e of A.split(/\r\n?|\n/)){r.push(e);const A=g.measureText(e).width;o=Math.max(o,A);for(const A of ZA(e)){const e=String.fromCodePoint(A);let t=this.widths.get(A);if(void 0===t){const i=g.measureText(e);t=Math.ceil(i.width),this.widths.set(A,t),this.firstChar=Math.min(A,this.firstChar),this.lastChar=Math.max(A,this.lastChar)}}}o*=i/1e3;const[I,c,C,B]=e;let h=C-I,Q=B-c;t%180!=0&&([h,Q]=[Q,h]);let l=1;o>h&&(l=h/o);let E=1;const u=s*i,d=.35*i,f=u*r.length;f>Q&&(E=Q/f);const p=i*Math.min(l,E),m=["q",`0 0 ${zA(h)} ${zA(Q)} re W n`,"BT",`1 0 0 1 0 ${zA(Q+d)} Tm 0 Tc ${lr(a,!0)}`,`/${this.fontName.name} ${zA(p)} Tf`],{resources:y}=this;if(1!==(n="number"==typeof n&&n>=0&&n<=1?n:1)){m.push("/R0 gs");const A=new CA(this.xref),e=new CA(this.xref);e.set("ca",n),e.set("CA",n),e.set("Type",oA.get("ExtGState")),A.set("R0",e),y.set("ExtGState",A)}const w=zA(u);for(const A of r)m.push(`0 -${w} Td <${Ae(A)}> Tj`);m.push("ET","Q");const D=m.join("\n"),b=new CA(this.xref);if(b.set("Subtype",oA.get("Form")),b.set("Type",oA.get("XObject")),b.set("BBox",[0,0,h,Q]),b.set("Length",D.length),b.set("Resources",y),t){const A=te(t,h,Q);b.set("Matrix",A)}const k=new se(D);return k.dict=b,k}}class ur{constructor(A,e,t){this.root=A,this.xref=e,this._type=t}getAll(){const A=new Map;if(!this.root)return A;const e=this.xref,t=new hA;t.put(this.root);const i=[this.root];for(;i.length>0;){const a=e.fetchIfRef(i.shift());if(!(a instanceof CA))continue;if(a.has("Kids")){const A=a.get("Kids");if(!Array.isArray(A))continue;for(const e of A){if(t.has(e))throw new K(`Duplicate entry in "${this._type}" tree.`);i.push(e),t.put(e)}continue}const s=a.get(this._type);if(Array.isArray(s))for(let t=0,i=s.length;t10)return R(`Search depth limit reached for "${this._type}" tree.`),null;const a=t.get("Kids");if(!Array.isArray(a))return null;let s=0,n=a.length-1;for(;s<=n;){const i=s+n>>1,g=e.fetchIfRef(a[i]),r=g.get("Limits");if(Ae.fetchIfRef(r[1]))){t=g;break}s=i+1}}if(s>n)return null}const a=t.get(this._type);if(Array.isArray(a)){let t=0,i=a.length-2;for(;t<=i;){const s=t+i>>1,n=s+(1&s),g=e.fetchIfRef(a[n]);if(Ag))return a[n+1];t=n+2}}}return null}get(A){return this.xref.fetchIfRef(this.getRaw(A))}}class dr extends ur{constructor(A,e){super(A,e,"Names")}}class fr extends ur{constructor(A,e){super(A,e,"Nums")}}function pr(){zs=Object.create(null),nA=Object.create(null),gA=Object.create(null),rA=Object.create(null),ra.clear(),zt.cleanup()}function mr(A){return A instanceof CA?A.has("UF")?A.get("UF"):A.has("F")?A.get("F"):A.has("Unix")?A.get("Unix"):A.has("Mac")?A.get("Mac"):A.has("DOS")?A.get("DOS"):null:null}class yr{#F=!1;constructor(A,e,t=!1){A instanceof CA&&(this.xref=e,this.root=A,A.has("FS")&&(this.fs=A.get("FS")),A.has("RF")&&R("Related file specifications are not supported"),t||(A.has("EF")?this.#F=!0:R("Non-embedded file specifications are not supported")))}get filename(){let A="";const e=mr(this.root);return e&&"string"==typeof e&&(A=z(e).replaceAll("\\\\","\\").replaceAll("\\/","/").replaceAll("\\","/")),U(this,"filename",A||"unnamed")}get content(){if(!this.#F)return null;this._contentRef||=mr(this.root?.get("EF"));let A=null;if(this._contentRef){const e=this.xref.fetchIfRef(this._contentRef);e instanceof fA?A=e.getBytes():R("Embedded file specification points to non-existing/invalid content")}else R("Embedded file specification does not have any content");return A}get description(){let A="";const e=this.root?.get("Desc");return e&&"string"==typeof e&&(A=z(e)),U(this,"description",A)}get serializable(){return{rawFilename:this.filename,filename:(A=this.filename,A.substring(A.lastIndexOf("/")+1)),content:this.content,description:this.description};var A}}function wr(A,e){const t=A[e];return" "===t||"\n"===t||"\r"===t||"\t"===t}class Dr{_resolveEntities(A){return A.replaceAll(/&([^;]+);/g,((A,e)=>{if("#x"===e.substring(0,2))return String.fromCodePoint(parseInt(e.substring(2),16));if("#"===e.substring(0,1))return String.fromCodePoint(parseInt(e.substring(1),10));switch(e){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return'"';case"apos":return"'"}return this.onResolveEntity(e)}))}_parseContent(A,e){const t=[];let i=e;function a(){for(;i"!==A[i]&&"/"!==A[i];)++i;const s=A.substring(e,i);for(a();i"!==A[i]&&"/"!==A[i]&&"?"!==A[i];){a();let e="",s="";for(;i"!==A[t]&&"?"!==A[t]&&"/"!==A[t];)++t;const i=A.substring(e,t);!function(){for(;t"!==A[t+1]);)++t;return{name:i,value:A.substring(a,t),parsed:t-e}}parseXml(A){let e=0;for(;e",t),e<0)return void this.onError(-9);this.onEndElement(A.substring(t,e)),t=e+1;break;case"?":++t;const i=this._parseProcessingInstruction(A,t);if("?>"!==A.substring(t+i.parsed,t+i.parsed+2))return void this.onError(-3);this.onPi(i.name,i.value),t+=i.parsed+2;break;case"!":if("--"===A.substring(t+1,t+3)){if(e=A.indexOf("--\x3e",t+3),e<0)return void this.onError(-5);this.onComment(A.substring(t+3,e)),t=e+3}else if("[CDATA["===A.substring(t+1,t+8)){if(e=A.indexOf("]]>",t+8),e<0)return void this.onError(-2);this.onCdata(A.substring(t+8,e)),t=e+3}else{if("DOCTYPE"!==A.substring(t+1,t+8))return void this.onError(-6);{const i=A.indexOf("[",t+8);let a=!1;if(e=A.indexOf(">",t+8),e<0)return void this.onError(-4);if(i>0&&e>i){if(e=A.indexOf("]>",t+8),e<0)return void this.onError(-4);a=!0}const s=A.substring(t+8,e+(a?1:0));this.onDoctype(s),t=e+(a?2:1)}}break;default:const a=this._parseContent(A,t);if(null===a)return void this.onError(-6);let s=!1;if("/>"===A.substring(t+a.parsed,t+a.parsed+2))s=!0;else if(">"!==A.substring(t+a.parsed,t+a.parsed+1))return void this.onError(-9);this.onBeginElement(a.name,a.attributes,s),t+=a.parsed+(s?2:1)}}else{for(;t0}searchNode(A,e){if(e>=A.length)return this;const t=A[e];if(t.name.startsWith("#")&&e0)i.push([a,0]),a=a.childNodes[0];else{if(0===i.length)return null;for(;0!==i.length;){const[A,e]=i.pop(),t=e+1;if(t");for(const e of this.childNodes)e.dump(A);A.push(``)}else this.nodeValue?A.push(`>${OA(this.nodeValue)}`):A.push("/>")}else A.push(OA(this.nodeValue))}}class kr extends Dr{constructor({hasAttributes:A=!1,lowerCaseName:e=!1}){super(),this._currentFragment=null,this._stack=null,this._errorCode=0,this._hasAttributes=A,this._lowerCaseName=e}parseFromString(A){if(this._currentFragment=[],this._stack=[],this._errorCode=0,this.parseXml(A),0!==this._errorCode)return;const[e]=this._currentFragment;return e?{documentElement:e}:void 0}onText(A){if(function(A){for(let e=0,t=A.length;e\\376\\377([^<]+)/g,(function(A,e){const t=e.replaceAll(/\\([0-3])([0-7])([0-7])/g,(function(A,e,t,i){return String.fromCharCode(64*e+8*t+1*i)})).replaceAll(/&(amp|apos|gt|lt|quot);/g,(function(A,e){switch(e){case"amp":return"&";case"apos":return"'";case"gt":return">";case"lt":return"<";case"quot":return'"'}throw new Error(`_repair: ${e} isn't defined.`)})),i=[">"];for(let A=0,e=t.length;A=32&&e<127&&60!==e&&62!==e&&38!==e?i.push(String.fromCharCode(e)):i.push("&#x"+(65536+e).toString(16).substring(1)+";")}return i.join("")}))}_getSequence(A){const e=A.nodeName;return"rdf:bag"!==e&&"rdf:seq"!==e&&"rdf:alt"!==e?null:A.childNodes.filter((A=>"rdf:li"===A.nodeName))}_parseArray(A){if(!A.hasChildNodes())return;const[e]=A.childNodes,t=this._getSequence(e)||[];this._metadataMap.set(A.nodeName,t.map((A=>A.textContent.trim())))}_parse(A){let e=A.documentElement;if("rdf:rdf"!==e.nodeName)for(e=e.firstChild;e&&"rdf:rdf"!==e.nodeName;)e=e.nextSibling;if(e&&"rdf:rdf"===e.nodeName&&e.hasChildNodes())for(const A of e.childNodes)if("rdf:description"===A.nodeName)for(const e of A.childNodes){const A=e.nodeName;switch(A){case"#text":continue;case"dc:creator":case"dc:subject":this._parseArray(e);continue}this._metadataMap.set(A,e.textContent.trim())}}get serializable(){return{parsedData:this._metadataMap,rawData:this._data}}}class Sr extends Fe{constructor(A,e,t){super(e),this.str=A,this.dict=A.dict,this.decrypt=t,this.nextChunk=null,this.initialized=!1}readBlock(){let A;if(this.initialized?A=this.nextChunk:(A=this.str.getBytes(512),this.initialized=!0),!A||0===A.length)return void(this.eof=!0);this.nextChunk=this.str.getBytes(512);const e=this.nextChunk?.length>0;A=(0,this.decrypt)(A,!e);const t=this.bufferLength,i=t+A.length;this.ensureBuffer(i).set(A,t),this.bufferLength=i}}class Rr{constructor(A){this.a=0,this.b=0;const e=new Uint8Array(256),t=A.length;for(let A=0;A<256;++A)e[A]=A;for(let i=0,a=0;i<256;++i){const s=e[i];a=a+s+A[i%t]&255,e[i]=e[a],e[a]=s}this.s=e}encryptBlock(A){let e=this.a,t=this.b;const i=this.s,a=A.length,s=new Uint8Array(a);for(let n=0;n>5&255,I[c++]=a>>13&255,I[c++]=a>>21&255,I[c++]=a>>>29&255,I[c++]=0,I[c++]=0,I[c++]=0;const h=new Int32Array(16);for(c=0;c>>32-g)|0,a=s}s=s+a|0,n=n+o|0,g=g+B|0,r=r+Q|0}return new Uint8Array([255&s,s>>8&255,s>>16&255,s>>>24&255,255&n,n>>8&255,n>>16&255,n>>>24&255,255&g,g>>8&255,g>>16&255,g>>>24&255,255&r,r>>8&255,r>>16&255,r>>>24&255])}}();class Nr{constructor(A,e){this.high=0|A,this.low=0|e}and(A){this.high&=A.high,this.low&=A.low}xor(A){this.high^=A.high,this.low^=A.low}or(A){this.high|=A.high,this.low|=A.low}shiftRight(A){A>=32?(this.low=this.high>>>A-32|0,this.high=0):(this.low=this.low>>>A|this.high<<32-A,this.high=this.high>>>A|0)}shiftLeft(A){A>=32?(this.high=this.low<>>32-A,this.low<<=A)}rotateRight(A){let e,t;32&A?(t=this.low,e=this.high):(e=this.low,t=this.high),A&=31,this.low=e>>>A|t<<32-A,this.high=t>>>A|e<<32-A}not(){this.high=~this.high,this.low=~this.low}add(A){const e=(this.low>>>0)+(A.low>>>0);let t=(this.high>>>0)+(A.high>>>0);e>4294967295&&(t+=1),this.low=0|e,this.high=0|t}copyTo(A,e){A[e]=this.high>>>24&255,A[e+1]=this.high>>16&255,A[e+2]=this.high>>8&255,A[e+3]=255&this.high,A[e+4]=this.low>>>24&255,A[e+5]=this.low>>16&255,A[e+6]=this.low>>8&255,A[e+7]=255&this.low}assign(A){this.high=A.high,this.low=A.low}}const xr=function(){function A(A,e){return A>>>e|A<<32-e}function e(A,e,t){return A&e^~A&t}function t(A,e,t){return A&e^A&t^e&t}function i(e){return A(e,2)^A(e,13)^A(e,22)}function a(e){return A(e,6)^A(e,11)^A(e,25)}function s(e){return A(e,7)^A(e,18)^e>>>3}const n=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];return function(g,r,o){let I=1779033703,c=3144134277,C=1013904242,B=2773480762,h=1359893119,Q=2600822924,l=528734635,E=1541459225;const u=64*Math.ceil((o+9)/64),d=new Uint8Array(u);let f,p;for(f=0;f>>29&255,d[f++]=o>>21&255,d[f++]=o>>13&255,d[f++]=o>>5&255,d[f++]=o<<3&255;const y=new Uint32Array(64);for(f=0;f>>10)+y[p-7]+s(y[p-15])+y[p-16];let g,r,o=I,u=c,m=C,D=B,b=h,k=Q,F=l,S=E;for(p=0;p<64;++p)g=S+a(b)+e(b,k,F)+n[p]+y[p],r=i(o)+t(o,u,m),S=F,F=k,k=b,b=D+g|0,D=m,m=u,u=o,o=g+r|0;I=I+o|0,c=c+u|0,C=C+m|0,B=B+D|0,h=h+b|0,Q=Q+k|0,l=l+F|0,E=E+S|0}var w;return new Uint8Array([I>>24&255,I>>16&255,I>>8&255,255&I,c>>24&255,c>>16&255,c>>8&255,255&c,C>>24&255,C>>16&255,C>>8&255,255&C,B>>24&255,B>>16&255,B>>8&255,255&B,h>>24&255,h>>16&255,h>>8&255,255&h,Q>>24&255,Q>>16&255,Q>>8&255,255&Q,l>>24&255,l>>16&255,l>>8&255,255&l,E>>24&255,E>>16&255,E>>8&255,255&E])}}(),Ur=function(){function A(A,e,t,i,a){A.assign(e),A.and(t),a.assign(e),a.not(),a.and(i),A.xor(a)}function e(A,e,t,i,a){A.assign(e),A.and(t),a.assign(e),a.and(i),A.xor(a),a.assign(t),a.and(i),A.xor(a)}function t(A,e,t){A.assign(e),A.rotateRight(28),t.assign(e),t.rotateRight(34),A.xor(t),t.assign(e),t.rotateRight(39),A.xor(t)}function i(A,e,t){A.assign(e),A.rotateRight(14),t.assign(e),t.rotateRight(18),A.xor(t),t.assign(e),t.rotateRight(41),A.xor(t)}function a(A,e,t){A.assign(e),A.rotateRight(1),t.assign(e),t.rotateRight(8),A.xor(t),t.assign(e),t.shiftRight(7),A.xor(t)}function s(A,e,t){A.assign(e),A.rotateRight(19),t.assign(e),t.rotateRight(61),A.xor(t),t.assign(e),t.shiftRight(6),A.xor(t)}const n=[new Nr(1116352408,3609767458),new Nr(1899447441,602891725),new Nr(3049323471,3964484399),new Nr(3921009573,2173295548),new Nr(961987163,4081628472),new Nr(1508970993,3053834265),new Nr(2453635748,2937671579),new Nr(2870763221,3664609560),new Nr(3624381080,2734883394),new Nr(310598401,1164996542),new Nr(607225278,1323610764),new Nr(1426881987,3590304994),new Nr(1925078388,4068182383),new Nr(2162078206,991336113),new Nr(2614888103,633803317),new Nr(3248222580,3479774868),new Nr(3835390401,2666613458),new Nr(4022224774,944711139),new Nr(264347078,2341262773),new Nr(604807628,2007800933),new Nr(770255983,1495990901),new Nr(1249150122,1856431235),new Nr(1555081692,3175218132),new Nr(1996064986,2198950837),new Nr(2554220882,3999719339),new Nr(2821834349,766784016),new Nr(2952996808,2566594879),new Nr(3210313671,3203337956),new Nr(3336571891,1034457026),new Nr(3584528711,2466948901),new Nr(113926993,3758326383),new Nr(338241895,168717936),new Nr(666307205,1188179964),new Nr(773529912,1546045734),new Nr(1294757372,1522805485),new Nr(1396182291,2643833823),new Nr(1695183700,2343527390),new Nr(1986661051,1014477480),new Nr(2177026350,1206759142),new Nr(2456956037,344077627),new Nr(2730485921,1290863460),new Nr(2820302411,3158454273),new Nr(3259730800,3505952657),new Nr(3345764771,106217008),new Nr(3516065817,3606008344),new Nr(3600352804,1432725776),new Nr(4094571909,1467031594),new Nr(275423344,851169720),new Nr(430227734,3100823752),new Nr(506948616,1363258195),new Nr(659060556,3750685593),new Nr(883997877,3785050280),new Nr(958139571,3318307427),new Nr(1322822218,3812723403),new Nr(1537002063,2003034995),new Nr(1747873779,3602036899),new Nr(1955562222,1575990012),new Nr(2024104815,1125592928),new Nr(2227730452,2716904306),new Nr(2361852424,442776044),new Nr(2428436474,593698344),new Nr(2756734187,3733110249),new Nr(3204031479,2999351573),new Nr(3329325298,3815920427),new Nr(3391569614,3928383900),new Nr(3515267271,566280711),new Nr(3940187606,3454069534),new Nr(4118630271,4000239992),new Nr(116418474,1914138554),new Nr(174292421,2731055270),new Nr(289380356,3203993006),new Nr(460393269,320620315),new Nr(685471733,587496836),new Nr(852142971,1086792851),new Nr(1017036298,365543100),new Nr(1126000580,2618297676),new Nr(1288033470,3409855158),new Nr(1501505948,4234509866),new Nr(1607167915,987167468),new Nr(1816402316,1246189591)];return function(g,r,o,I=!1){let c,C,B,h,Q,l,E,u;I?(c=new Nr(3418070365,3238371032),C=new Nr(1654270250,914150663),B=new Nr(2438529370,812702999),h=new Nr(355462360,4144912697),Q=new Nr(1731405415,4290775857),l=new Nr(2394180231,1750603025),E=new Nr(3675008525,1694076839),u=new Nr(1203062813,3204075428)):(c=new Nr(1779033703,4089235720),C=new Nr(3144134277,2227873595),B=new Nr(1013904242,4271175723),h=new Nr(2773480762,1595750129),Q=new Nr(1359893119,2917565137),l=new Nr(2600822924,725511199),E=new Nr(528734635,4215389547),u=new Nr(1541459225,327033209));const d=128*Math.ceil((o+17)/128),f=new Uint8Array(d);let p,m;for(p=0;p>>29&255,f[p++]=o>>21&255,f[p++]=o>>13&255,f[p++]=o>>5&255,f[p++]=o<<3&255;const w=new Array(80);for(p=0;p<80;p++)w[p]=new Nr(0,0);let D=new Nr(0,0),b=new Nr(0,0),k=new Nr(0,0),F=new Nr(0,0),S=new Nr(0,0),R=new Nr(0,0),G=new Nr(0,0),N=new Nr(0,0);const x=new Nr(0,0),U=new Nr(0,0),M=new Nr(0,0),L=new Nr(0,0);let J,H;for(p=0;p=1;--A){t=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=t,t=s[14],i=s[10],s[14]=s[6],s[10]=s[2],s[6]=t,s[2]=i,t=s[15],i=s[11],a=s[7],s[15]=s[3],s[11]=t,s[7]=i,s[3]=a;for(let A=0;A<16;++A)s[A]=this._inv_s[s[A]];for(let t=0,i=16*A;t<16;++t,++i)s[t]^=e[i];for(let A=0;A<16;A+=4){const e=this._mix[s[A]],i=this._mix[s[A+1]],a=this._mix[s[A+2]],n=this._mix[s[A+3]];t=e^i>>>8^i<<24^a>>>16^a<<16^n>>>24^n<<8,s[A]=t>>>24&255,s[A+1]=t>>16&255,s[A+2]=t>>8&255,s[A+3]=255&t}}t=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=t,t=s[14],i=s[10],s[14]=s[6],s[10]=s[2],s[6]=t,s[2]=i,t=s[15],i=s[11],a=s[7],s[15]=s[3],s[11]=t,s[7]=i,s[3]=a;for(let A=0;A<16;++A)s[A]=this._inv_s[s[A]],s[A]^=e[A];return s}_encrypt(A,e){const t=this._s;let i,a,s;const n=new Uint8Array(16);n.set(A);for(let A=0;A<16;++A)n[A]^=e[A];for(let A=1;A=i;--t)if(A[t]!==e){e=0;break}g-=e,s[s.length-1]=A.subarray(0,16-e)}}const r=new Uint8Array(g);for(let A=0,e=0,t=s.length;A=256&&(g=255&(27^g)));for(let e=0;e<4;++e)t[A]=i^=t[A-32],A++,t[A]=a^=t[A-32],A++,t[A]=s^=t[A-32],A++,t[A]=n^=t[A-32],A++}return t}}class Yr{checkOwnerPassword(A,e,t,i){const a=new Uint8Array(A.length+56);return a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length),AA(xr(a,0,a.length),i)}checkUserPassword(A,e,t){const i=new Uint8Array(A.length+8);return i.set(A,0),i.set(e,A.length),AA(xr(i,0,i.length),t)}getOwnerKey(A,e,t,i){const a=new Uint8Array(A.length+56);a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length);const s=xr(a,0,a.length);return new Hr(s).decryptBlock(i,!1,new Uint8Array(16))}getUserKey(A,e,t){const i=new Uint8Array(A.length+8);i.set(A,0),i.set(e,A.length);const a=xr(i,0,i.length);return new Hr(a).decryptBlock(t,!1,new Uint8Array(16))}}class vr{_hash(A,e,t){let i=xr(e,0,e.length).subarray(0,32),a=[0],s=0;for(;s<64||a.at(-1)>s-32;){const e=A.length+i.length+t.length,r=new Uint8Array(e);let o=0;r.set(A,o),o+=A.length,r.set(i,o),o+=i.length,r.set(t,o);const I=new Uint8Array(64*e);for(let A=0,t=0;A<64;A++,t+=e)I.set(r,t);a=new Jr(i.subarray(0,16)).encrypt(I,i.subarray(16,32));const c=a.slice(0,16).reduce(((A,e)=>A+e),0)%3;0===c?i=xr(a,0,a.length):1===c?(n=a,g=a.length,i=Ur(n,0,g,!0)):2===c&&(i=Ur(a,0,a.length)),s++}var n,g;return i.subarray(0,32)}checkOwnerPassword(A,e,t,i){const a=new Uint8Array(A.length+56);return a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length),AA(this._hash(A,a,t),i)}checkUserPassword(A,e,t){const i=new Uint8Array(A.length+8);return i.set(A,0),i.set(e,A.length),AA(this._hash(A,i,[]),t)}getOwnerKey(A,e,t,i){const a=new Uint8Array(A.length+56);a.set(A,0),a.set(e,A.length),a.set(t,A.length+e.length);const s=this._hash(A,a,t);return new Hr(s).decryptBlock(i,!1,new Uint8Array(16))}getUserKey(A,e,t){const i=new Uint8Array(A.length+8);i.set(A,0),i.set(e,A.length);const a=this._hash(A,i,[]);return new Hr(a).decryptBlock(t,!1,new Uint8Array(16))}}class Kr{constructor(A,e){this.StringCipherConstructor=A,this.StreamCipherConstructor=e}createStream(A,e){const t=new this.StreamCipherConstructor;return new Sr(A,e,(function(A,e){return t.decryptBlock(A,e)}))}decryptString(A){const e=new this.StringCipherConstructor;let t=P(A);return t=e.decryptBlock(t,!0),T(t)}encryptString(A){const e=new this.StringCipherConstructor;if(e instanceof Lr){const t=16-A.length%16;A+=String.fromCharCode(t).repeat(t);const i=new Uint8Array(16);if("undefined"!=typeof crypto)crypto.getRandomValues(i);else for(let A=0;A<16;A++)i[A]=Math.floor(256*Math.random());let a=P(A);a=e.encrypt(a,i);const s=new Uint8Array(16+a.length);return s.set(i),s.set(a,16),T(s)}let t=P(A);return t=e.encrypt(t),T(t)}}class qr{static#S=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]);#R(A,e,t,i,a,s,n,g,r,o,I,c){if(e){const A=Math.min(127,e.length);e=e.subarray(0,A)}else e=[];const C=6===A?new vr:new Yr;return C.checkUserPassword(e,g,n)?C.getUserKey(e,r,I):e.length&&C.checkOwnerPassword(e,i,s,t)?C.getOwnerKey(e,a,s,o):null}#G(A,e,t,i,a,s,n,g){const r=40+t.length+A.length,o=new Uint8Array(r);let I,c,C=0;if(e)for(c=Math.min(32,e.length);C>8&255,o[C++]=a>>16&255,o[C++]=a>>>24&255,I=0,c=A.length;I=4&&!g&&(o[C++]=255,o[C++]=255,o[C++]=255,o[C++]=255);let B=Gr(o,0,C);const h=n>>3;if(s>=3)for(I=0;I<50;++I)B=Gr(B,0,h);const Q=B.subarray(0,h);let l,E;if(s>=3){for(C=0;C<32;++C)o[C]=qr.#S[C];for(I=0,c=A.length;I>3;if(t>=3)for(g=0;g<50;++g)r=Gr(r,0,r.length);let I,c;if(t>=3){c=e;const A=new Uint8Array(o);for(g=19;g>=0;g--){for(let e=0;e>8&255,a[n++]=A>>16&255,a[n++]=255&e,a[n++]=e>>8&255,i&&(a[n++]=115,a[n++]=65,a[n++]=108,a[n++]=84),Gr(a,0,n).subarray(0,Math.min(t.length+5,16))}#U(A,e,t,i,a){if(!(e instanceof oA))throw new K("Invalid crypt filter name.");const s=this,n=A.get(e.name),g=n?.get("CFM");if(!g||"None"===g.name)return function(){return new Mr};if("V2"===g.name)return function(){return new Rr(s.#x(t,i,a,!1))};if("AESV2"===g.name)return function(){return new Jr(s.#x(t,i,a,!0))};if("AESV3"===g.name)return function(){return new Hr(a)};throw new K("Unknown crypto method")}constructor(A,e,t){const i=A.get("Filter");if(!lA(i,"Standard"))throw new K("unknown encryption method");this.filterName=i.name,this.dict=A;const a=A.get("V");if(!Number.isInteger(a)||1!==a&&2!==a&&4!==a&&5!==a)throw new K("unsupported encryption algorithm");this.algorithm=a;let s=A.get("Length");if(!s)if(a<=3)s=40;else{const e=A.get("CF"),t=A.get("StmF");if(e instanceof CA&&t instanceof oA){e.suppressEncryption=!0;const A=e.get(t.name);s=A?.get("Length")||128,s<40&&(s<<=3)}}if(!Number.isInteger(s)||s<40||s%8!=0)throw new K("invalid key length");const n=P(A.get("O")),g=P(A.get("U")),r=n.subarray(0,32),o=g.subarray(0,32),I=A.get("P"),c=A.get("R"),C=(4===a||5===a)&&!1!==A.get("EncryptMetadata");this.encryptMetadata=C;const B=P(e);let h,Q;if(t){if(6===c)try{t=$(t)}catch{R("CipherTransformFactory: Unable to convert UTF8 encoded password.")}h=P(t)}if(5!==a)Q=this.#G(B,h,r,o,I,c,s,C);else{const e=n.subarray(32,40),t=n.subarray(40,48),i=g.subarray(0,48),a=g.subarray(32,40),s=g.subarray(40,48),I=P(A.get("OE")),C=P(A.get("UE")),B=P(A.get("Perms"));Q=this.#R(c,h,r,e,t,i,o,a,s,I,C,B)}if(!Q&&!t)throw new L("No password given",1);if(!Q&&t){const A=this.#N(h,r,c,s);Q=this.#G(B,A,r,o,I,c,s,C)}if(!Q)throw new L("Incorrect Password",2);if(this.encryptionKey=Q,a>=4){const e=A.get("CF");e instanceof CA&&(e.suppressEncryption=!0),this.cf=e,this.stmf=A.get("StmF")||oA.get("Identity"),this.strf=A.get("StrF")||oA.get("Identity"),this.eff=A.get("EFF")||this.stmf}}createCipherTransform(A,e){if(4===this.algorithm||5===this.algorithm)return new Kr(this.#U(this.cf,this.strf,A,e,this.encryptionKey),this.#U(this.cf,this.stmf,A,e,this.encryptionKey));const t=this.#x(A,e,this.encryptionKey,!1),i=function(){return new Rr(t)};return new Kr(i,i)}}async function Tr(A,e,t,{encrypt:i=null}){const a=i?.createCipherTransform(A.num,A.gen);t.push(`${A.num} ${A.gen} obj\n`),e instanceof CA?await Pr(e,t,a):e instanceof fA?await Wr(e,t,a):(Array.isArray(e)||ArrayBuffer.isView(e))&&await Zr(e,t,a),t.push("\nendobj\n")}async function Pr(A,e,t){e.push("<<");for(const i of A.getKeys())e.push(` /${KA(i)} `),await Or(A.getRaw(i),e,t);e.push(">>")}async function Wr(A,e,t){let i=A.getBytes();const{dict:a}=A,[s,n]=await Promise.all([a.getAsync("Filter"),a.getAsync("DecodeParms")]),g=lA(Array.isArray(s)?await a.xref.fetchIfRefAsync(s[0]):s,"FlateDecode");if(i.length>=256||g)try{const A=new CompressionStream("deflate"),e=A.writable.getWriter();e.write(i),e.close();const t=await new Response(A.readable).arrayBuffer();let r,o;i=new Uint8Array(t),s?g||(r=Array.isArray(s)?[oA.get("FlateDecode"),...s]:[oA.get("FlateDecode"),s],n&&(o=Array.isArray(n)?[null,...n]:[null,n])):r=oA.get("FlateDecode"),r&&a.set("Filter",r),o&&a.set("DecodeParms",o)}catch(A){S(`writeStream - cannot compress data: "${A}".`)}let r=T(i);t&&(r=t.encryptString(r)),a.set("Length",r.length),await Pr(a,e,t),e.push(" stream\n",r,"\nendstream")}async function Zr(A,e,t){e.push("[");let i=!0;for(const a of A)i?i=!1:e.push(" "),await Or(a,e,t);e.push("]")}async function Or(A,e,t){A instanceof oA?e.push(`/${KA(A.name)}`):A instanceof BA?e.push(`${A.num} ${A.gen} R`):Array.isArray(A)||ArrayBuffer.isView(A)?await Zr(A,e,t):"string"==typeof A?(t&&(A=t.encryptString(A)),e.push(`(${qA(A)})`)):"number"==typeof A?e.push(zA(A)):"boolean"==typeof A?e.push(A.toString()):A instanceof CA?await Pr(A,e,t):A instanceof fA?await Wr(A,e,t):null===A?e.push("null"):R(`Unhandled value in writer: ${typeof A}, please file a bug.`)}function Xr(A,e,t,i){for(let a=e+t-1;a>t-1;a--)i[a]=255&A,A>>=8;return t+e}function Vr(A,e,t){for(let i=0,a=A.length;i0){const i=function(A,e){const t=Math.floor(Date.now()/1e3),i=e.filename||"",a=[t.toString(),i,A.toString()];let s=a.reduce(((A,e)=>A+e.length),0);for(const A of Object.values(e.info))a.push(A),s+=A.length;const n=new Uint8Array(s);let g=0;for(const A of a)Vr(A,g,n),g+=A.length;return T(Gr(n))}(A,e);t.set("ID",[e.fileIds[0],i])}}async function _r({originalData:A,xrefInfo:e,newRefs:t,xref:i=null,hasXfa:a=!1,xfaDatasetsRef:s=null,hasXfaDatasetsEntry:n=!1,needAppearances:g,acroFormRef:r=null,acroForm:o=null,xfaData:I=null,useXrefStream:c=!1}){await async function({xref:A,acroForm:e,acroFormRef:t,hasXfa:i,hasXfaDatasetsEntry:a,xfaDatasetsRef:s,needAppearances:n,newRefs:g}){if(!i||a||s||R("XFA - Cannot save it"),!n&&(!i||!s||a))return;const r=e.clone();if(i&&!a){const A=e.get("XFA").slice();A.splice(2,0,"datasets"),A.splice(3,0,s),r.set("XFA",A)}n&&r.set("NeedAppearances",!0);const o=[];await Tr(t,r,o,A),g.push({ref:t,data:o.join("")})}({xref:i,acroForm:o,acroFormRef:r,hasXfa:a,hasXfaDatasetsEntry:n,xfaDatasetsRef:s,needAppearances:g,newRefs:t}),a&&function({xfaData:A,xfaDatasetsRef:e,newRefs:t,xref:i}){null===A&&(A=function(A,e){const t=new kr({hasAttributes:!0}).parseFromString(A);for(const{xfa:A}of e){if(!A)continue;const{path:e,value:i}=A;if(!e)continue;const a=vA(e);let s=t.documentElement.searchNode(a,0);!s&&a.length>1&&(s=t.documentElement.searchNode([a.at(-1)],0)),s?s.childNodes=Array.isArray(i)?i.map((A=>new br("value",A))):[new br("#text",i)]:R(`Node not found for path: ${e}`)}const i=[];return t.documentElement.dump(i),i.join("")}(i.fetchIfRef(e).getString(),t));const a=i.encrypt;a&&(A=a.createCipherTransform(e.num,e.gen).encryptString(A));const s=`${e.num} ${e.gen} obj\n<< /Type /EmbeddedFile /Length ${A.length}>>\nstream\n`+A+"\nendstream\nendobj\n";t.push({ref:e,data:s})}({xfaData:I,xfaDatasetsRef:s,newRefs:t,xref:i});const C=[];let B=A.length;const h=A.at(-1);10!==h&&13!==h&&(C.push("\n"),B+=1);const Q=function(A,e,t){const i=new CA(null);i.set("Prev",A.startXRef);const a=A.newRef;return t?(e.push({ref:a,data:""}),i.set("Size",a.num+1),i.set("Type",oA.get("XRef"))):i.set("Size",a.num),null!==A.rootRef&&i.set("Root",A.rootRef),null!==A.infoRef&&i.set("Info",A.infoRef),null!==A.encryptRef&&i.set("Encrypt",A.encryptRef),i}(e,t,c);t=t.sort(((A,e)=>A.ref.num-e.ref.num));for(const{data:A}of t)null!==A&&C.push(A);await(c?async function(A,e,t,i,a){const s=[];let n=0,g=0;for(const{ref:A,data:i}of t){let t;n=Math.max(n,e),null!==i?(t=Math.min(A.gen,65535),s.push([1,e,t]),e+=i.length):(t=Math.min(A.gen+1,65535),s.push([0,0,t])),g=Math.max(g,t)}i.set("Index",jr(t));const r=[1,ie(n),ie(g)];i.set("W",r),zr(e,A,i);const o=r.reduce(((A,e)=>A+e),0),I=new Uint8Array(o*s.length),c=new ae(I);c.dict=i;let C=0;for(const[A,e,t]of s)C=Xr(A,r[0],C,I),C=Xr(e,r[1],C,I),C=Xr(t,r[2],C,I);await Tr(A.newRef,c,a,{}),a.push("startxref\n",e.toString(),"\n%%EOF\n")}(e,B,t,Q,C):async function(A,e,t,i,a){a.push("xref\n");const s=jr(t);let n=0;for(const{ref:A,data:i}of t)A.num===s[n]&&(a.push(`${s[n]} ${s[n+1]}\n`),n+=2),null!==i?(a.push(`${e.toString().padStart(10,"0")} ${Math.min(A.gen,65535).toString().padStart(5,"0")} n\r\n`),e+=i.length):a.push(`0000000000 ${Math.min(A.gen+1,65535).toString().padStart(5,"0")} f\r\n`);zr(e,A,i),a.push("trailer\n"),await Pr(i,a),a.push("\nstartxref\n",e.toString(),"\n%%EOF\n")}(e,B,t,Q,C));const l=C.reduce(((A,e)=>A+e.length),A.length),E=new Uint8Array(l);E.set(A);let u=A.length;for(const A of C)Vr(A,u,E),u+=A.length;return E}class $r{constructor(A,e){this.dict=A,this.ref=e instanceof BA?e:null,this.roleMap=new Map,this.structParentIds=null}init(){this.readRoleMap()}#M(A,e,t){if(!(A instanceof BA)||e<0)return;this.structParentIds||=new QA;let i=this.structParentIds.get(A);i||(i=[],this.structParentIds.put(A,i)),i.push([e,t])}addAnnotationIdToPage(A,e){this.#M(A,e,4)}readRoleMap(){const A=this.dict.get("RoleMap");A instanceof CA&&A.forEach(((A,e)=>{e instanceof oA&&this.roleMap.set(A,e.name)}))}static async canCreateStructureTree({catalogRef:A,pdfManager:e,newAnnotationsByPage:t}){if(!(A instanceof BA))return R("Cannot save the struct tree: no catalog reference."),!1;let i=0,a=!0;for(const[A,s]of t){const{ref:t}=await e.getPage(A);if(!(t instanceof BA)){R(`Cannot save the struct tree: page ${A} has no ref.`),a=!0;break}for(const A of s)A.accessibilityData?.type&&(A.parentTreeId=i++,a=!1)}if(a){for(const A of t.values())for(const e of A)delete e.parentTreeId;return!1}return!0}static async createStructureTree({newAnnotationsByPage:A,xref:e,catalogRef:t,pdfManager:i,newRefs:a}){const s=i.catalog.cloneDict(),n=new QA;n.put(t,s);const g=e.getNewTemporaryRef();s.set("StructTreeRoot",g);const r=new CA(e);r.set("Type",oA.get("StructTreeRoot"));const o=e.getNewTemporaryRef();r.set("ParentTree",o);const I=[];r.set("K",I),n.put(g,r);const c=new CA(e),C=[];c.set("Nums",C);const B=await this.#L({newAnnotationsByPage:A,structTreeRootRef:g,structTreeRoot:null,kids:I,nums:C,xref:e,pdfManager:i,newRefs:a,cache:n});r.set("ParentTreeNextKey",B),n.put(o,c);const h=[];for(const[A,t]of n.items())h.length=0,await Tr(A,t,h,e),a.push({ref:A,data:h.join("")})}async canUpdateStructTree({pdfManager:A,xref:e,newAnnotationsByPage:t}){if(!this.ref)return R("Cannot update the struct tree: no root reference."),!1;let i=this.dict.get("ParentTreeNextKey");if(!Number.isInteger(i)||i<0)return R("Cannot update the struct tree: invalid next key."),!1;const a=this.dict.get("ParentTree");if(!(a instanceof CA))return R("Cannot update the struct tree: ParentTree isn't a dict."),!1;const s=a.get("Nums");if(!Array.isArray(s))return R("Cannot update the struct tree: nums isn't an array."),!1;const n=new fr(a,e);for(const e of t.keys()){const{pageDict:t}=await A.getPage(e);if(!t.has("StructParents"))continue;const i=t.get("StructParents");if(!Number.isInteger(i)||!Array.isArray(n.get(i)))return R(`Cannot save the struct tree: page ${e} has a wrong id.`),!1}let g=!0;for(const[e,a]of t){const{pageDict:t}=await A.getPage(e);$r.#J({elements:a,xref:this.dict.xref,pageDict:t,numberTree:n});for(const A of a)A.accessibilityData?.type&&(A.accessibilityData.structParent>=0||(A.parentTreeId=i++),g=!1)}if(g){for(const A of t.values())for(const e of A)delete e.parentTreeId,delete e.structTreeParent;return!1}return!0}async updateStructureTree({newAnnotationsByPage:A,pdfManager:e,newRefs:t}){const i=this.dict.xref,a=this.dict.clone(),s=this.ref,n=new QA;n.put(s,a);let g,r=a.getRaw("ParentTree");r instanceof BA?g=i.fetch(r):(g=r,r=i.getNewTemporaryRef(),a.set("ParentTree",r)),g=g.clone(),n.put(r,g);let o=g.getRaw("Nums"),I=null;o instanceof BA&&(I=o,o=i.fetch(I)),o=o.slice(),I||g.set("Nums",o);const c=await $r.#L({newAnnotationsByPage:A,structTreeRootRef:s,structTreeRoot:this,kids:null,nums:o,xref:i,pdfManager:e,newRefs:t,cache:n});if(-1===c)return;a.set("ParentTreeNextKey",c),I&&n.put(I,o);const C=[];for(const[A,e]of n.items())C.length=0,await Tr(A,e,C,i),t.push({ref:A,data:C.join("")})}static async#L({newAnnotationsByPage:A,structTreeRootRef:e,structTreeRoot:t,kids:i,nums:a,xref:s,pdfManager:n,newRefs:g,cache:r}){const o=oA.get("OBJR");let I,c=-1;const C=[];for(const[B,h]of A){const A=await n.getPage(B),{ref:Q}=A,l=Q instanceof BA;for(const{accessibilityData:n,ref:E,parentTreeId:u,structTreeParent:d}of h){if(!n?.type)continue;const{structParent:h}=n;if(t&&Number.isInteger(h)&&h>=0){let e=(I||=new Map).get(B);void 0===e&&(e=new to(t,A.pageDict).collectObjects(Q),I.set(B,e));const i=e?.get(h);if(i){const A=s.fetch(i).clone();$r.#H(A,n),C.length=0,await Tr(i,A,C,s),g.push({ref:i,data:C.join("")});continue}}c=Math.max(c,u);const f=s.getNewTemporaryRef(),p=new CA(s);$r.#H(p,n),await this.#Y({structTreeParent:d,tagDict:p,newTagRef:f,structTreeRootRef:e,fallbackKids:i,xref:s,cache:r});const m=new CA(s);p.set("K",m),m.set("Type",o),l&&m.set("Pg",Q),m.set("Obj",E),r.put(f,p),a.push(u,f)}}return c+1}static#H(A,{type:e,title:t,lang:i,alt:a,expanded:s,actualText:n}){A.set("S",oA.get(e)),t&&A.set("T",$A(t)),i&&A.set("Lang",$A(i)),a&&A.set("Alt",$A(a)),s&&A.set("E",$A(s)),n&&A.set("ActualText",$A(n))}static#J({elements:A,xref:e,pageDict:t,numberTree:i}){const a=new Map;for(const e of A)if(e.structTreeParentId){const A=parseInt(e.structTreeParentId.split("_mc")[1],10);let t=a.get(A);t||(t=[],a.set(A,t)),t.push(e)}const s=t.get("StructParents");if(!Number.isInteger(s))return;const n=i.get(s),g=(A,t,i)=>{const s=a.get(A);if(s){const A=t.getRaw("P"),a=e.fetchIfRef(A);if(A instanceof BA&&a instanceof CA){const A={ref:i,dict:t};for(const e of s)e.structTreeParent=A}return!0}return!1};for(const A of n){if(!(A instanceof BA))continue;const t=e.fetch(A),i=t.get("K");if(Number.isInteger(i))g(i,t,A);else if(Array.isArray(i))for(let a of i){if(a=e.fetchIfRef(a),Number.isInteger(a)&&g(a,t,A))break;if(!(a instanceof CA))continue;if(!lA(a.get("Type"),"MCR"))break;const i=a.get("MCID");if(Number.isInteger(i)&&g(i,t,A))break}}}static async#Y({structTreeParent:A,tagDict:e,newTagRef:t,structTreeRootRef:i,fallbackKids:a,xref:s,cache:n}){let g,r=null;A?(({ref:r}=A),g=A.dict.getRaw("P")||i):g=i,e.set("P",g);const o=s.fetchIfRef(g);if(!o)return void a.push(t);let I=n.get(g);I||(I=o.clone(),n.put(g,I));const c=I.getRaw("K");let C=c instanceof BA?n.get(c):null;if(!C){C=s.fetchIfRef(c),C=Array.isArray(C)?C.slice():[c];const A=s.getNewTemporaryRef();I.set("K",A),n.put(A,C)}const B=C.indexOf(r);C.splice(B>=0?B+1:C.length,0,t)}}class Ao{constructor(A,e){this.tree=A,this.dict=e,this.kids=[],this.parseKids()}get role(){const A=this.dict.get("S"),e=A instanceof oA?A.name:"",{root:t}=this.tree;return t.roleMap.has(e)?t.roleMap.get(e):e}parseKids(){let A=null;const e=this.dict.getRaw("Pg");e instanceof BA&&(A=e.toString());const t=this.dict.get("K");if(Array.isArray(t))for(const e of t){const t=this.parseKid(A,e);t&&this.kids.push(t)}else{const e=this.parseKid(A,t);e&&this.kids.push(e)}}parseKid(A,e){if(Number.isInteger(e))return this.tree.pageDict.objId!==A?null:new eo({type:1,mcid:e,pageObjId:A});let t=null;if(e instanceof BA?t=this.dict.xref.fetch(e):e instanceof CA&&(t=e),!t)return null;const i=t.getRaw("Pg");i instanceof BA&&(A=i.toString());const a=t.get("Type")instanceof oA?t.get("Type").name:null;if("MCR"===a){if(this.tree.pageDict.objId!==A)return null;const e=t.getRaw("Stm");return new eo({type:2,refObjId:e instanceof BA?e.toString():null,pageObjId:A,mcid:t.get("MCID")})}if("OBJR"===a){if(this.tree.pageDict.objId!==A)return null;const e=t.getRaw("Obj");return new eo({type:3,refObjId:e instanceof BA?e.toString():null,pageObjId:A})}return new eo({type:5,dict:t})}}class eo{constructor({type:A,dict:e=null,mcid:t=null,pageObjId:i=null,refObjId:a=null}){this.type=A,this.dict=e,this.mcid=t,this.pageObjId=i,this.refObjId=a,this.parentNode=null}}class to{constructor(A,e){this.root=A,this.rootDict=A?A.dict:null,this.pageDict=e,this.nodes=[]}collectObjects(A){if(!(this.root&&this.rootDict&&A instanceof BA))return null;const e=this.rootDict.get("ParentTree");if(!e)return null;const t=this.root.structParentIds?.get(A);if(!t)return null;const i=new Map,a=new fr(e,this.rootDict.xref);for(const[A]of t){const e=a.getRaw(A);e instanceof BA&&i.set(A,e)}return i}parse(A){if(!(this.root&&this.rootDict&&A instanceof BA))return;const e=this.rootDict.get("ParentTree");if(!e)return;const t=this.pageDict.get("StructParents"),i=this.root.structParentIds?.get(A);if(!Number.isInteger(t)&&!i)return;const a=new Map,s=new fr(e,this.rootDict.xref);if(Number.isInteger(t)){const A=s.get(t);if(Array.isArray(A))for(const e of A)e instanceof BA&&this.addNode(this.rootDict.xref.fetch(e),a)}if(i)for(const[A,e]of i){const t=s.get(A);if(t){const A=this.addNode(this.rootDict.xref.fetchIfRef(t),a);1===A?.kids?.length&&3===A.kids[0].type&&(A.kids[0].type=e)}}}addNode(A,e,t=0){if(t>40)return R("StructTree MAX_DEPTH reached."),null;if(!(A instanceof CA))return null;if(e.has(A))return e.get(A);const i=new Ao(this,A);e.set(A,i);const a=A.get("P");if(!a||lA(a.get("Type"),"StructTreeRoot"))return this.addTopLevelNode(A,i)||e.delete(A),i;const s=this.addNode(a,e,t+1);if(!s)return i;let n=!1;for(const e of s.kids)5===e.type&&e.dict===A&&(e.parentNode=i,n=!0);return n||e.delete(A),i}addTopLevelNode(A,e){const t=this.rootDict.get("K");if(!t)return!1;if(t instanceof CA)return t.objId===A.objId&&(this.nodes[0]=e,!0);if(!Array.isArray(t))return!0;let i=!1;for(let a=0;a40)return void R("StructTree too deep to be fully serialized.");const a=Object.create(null);a.role=e.role,a.children=[],t.children.push(a);let s=e.dict.get("Alt");"string"!=typeof s&&(s=e.dict.get("ActualText")),"string"==typeof s&&(a.alt=z(s));const n=e.dict.get("A");if(n instanceof CA){const A=YA(n.getArray("BBox"),null);if(A)a.bbox=A;else{const A=n.get("Width"),e=n.get("Height");"number"==typeof A&&A>0&&"number"==typeof e&&e>0&&(a.bbox=[0,0,A,e])}}const g=e.dict.get("Lang");"string"==typeof g&&(a.lang=z(g));for(const t of e.kids){const e=5===t.type?t.parentNode:null;e?A(e,a,i+1):1===t.type||2===t.type?a.children.push({type:"content",id:`p${t.pageObjId}_mc${t.mcid}`}):3===t.type?a.children.push({type:"object",id:t.refObjId}):4===t.type&&a.children.push({type:"annotation",id:`pdfjs_internal_id_${t.refObjId}`})}}const e=Object.create(null);e.children=[],e.role="Root";for(const t of this.nodes)t&&A(t,e);return e}}function io(A){if(!Array.isArray(A)||A.length<2)return!1;const[e,t,...i]=A;if(!(e instanceof BA||Number.isInteger(e)))return!1;if(!(t instanceof oA))return!1;const a=i.length;let s=!0;switch(t.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return 0===a;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(4!==a)return!1;s=!1;break;default:return!1}for(const A of i)if(!("number"==typeof A||s&&null===A))return!1;return!0}function ao(A){return A instanceof CA&&(A=A.get("D")),io(A)?A:null}function so(A){let e=A.get("D");if(e){if(e instanceof oA&&(e=e.name),"string"==typeof e)return z(e);if(io(e))return JSON.stringify(e)}return null}class no{constructor(A,e){if(this.pdfManager=A,this.xref=e,this._catDict=e.getCatalogObj(),!(this._catDict instanceof CA))throw new K("Catalog object is not a dictionary.");this.toplevelPagesDict,this._actualNumPages=null,this.fontCache=new QA,this.builtInCMapCache=new Map,this.standardFontDataCache=new Map,this.globalImageCache=new ig,this.pageKidsCountCache=new QA,this.pageIndexCache=new QA,this.pageDictCache=new QA,this.nonBlendModesSet=new hA,this.systemFontCache=new Map}cloneDict(){return this._catDict.clone()}get version(){const A=this._catDict.get("Version");if(A instanceof oA){if(pA.test(A.name))return U(this,"version",A.name);R(`Invalid PDF catalog version: ${A.name}`)}return U(this,"version",null)}get lang(){const A=this._catDict.get("Lang");return U(this,"lang",A&&"string"==typeof A?z(A):null)}get needsRendering(){const A=this._catDict.get("NeedsRendering");return U(this,"needsRendering","boolean"==typeof A&&A)}get collection(){let A=null;try{const e=this._catDict.get("Collection");e instanceof CA&&e.size>0&&(A=e)}catch(A){if(A instanceof yA)throw A;S("Cannot fetch Collection entry; assuming no collection is present.")}return U(this,"collection",A)}get acroForm(){let A=null;try{const e=this._catDict.get("AcroForm");e instanceof CA&&e.size>0&&(A=e)}catch(A){if(A instanceof yA)throw A;S("Cannot fetch AcroForm entry; assuming no forms are present.")}return U(this,"acroForm",A)}get acroFormRef(){const A=this._catDict.getRaw("AcroForm");return U(this,"acroFormRef",A instanceof BA?A:null)}get metadata(){const A=this._catDict.getRaw("Metadata");if(!(A instanceof BA))return U(this,"metadata",null);let e=null;try{const t=this.xref.fetch(A,!this.xref.encrypt?.encryptMetadata);if(t instanceof fA&&t.dict instanceof CA){const A=t.dict.get("Type"),i=t.dict.get("Subtype");if(lA(A,"Metadata")&&lA(i,"XML")){const A=_(t.getString());A&&(e=new Fr(A).serializable)}}}catch(A){if(A instanceof yA)throw A;S(`Skipping invalid Metadata: "${A}".`)}return U(this,"metadata",e)}get markInfo(){let A=null;try{A=this._readMarkInfo()}catch(A){if(A instanceof yA)throw A;R("Unable to read mark info.")}return U(this,"markInfo",A)}_readMarkInfo(){const A=this._catDict.get("MarkInfo");if(!(A instanceof CA))return null;const e={Marked:!1,UserProperties:!1,Suspects:!1};for(const t in e){const i=A.get(t);"boolean"==typeof i&&(e[t]=i)}return e}get structTreeRoot(){let A=null;try{A=this._readStructTreeRoot()}catch(A){if(A instanceof yA)throw A;R("Unable read to structTreeRoot info.")}return U(this,"structTreeRoot",A)}_readStructTreeRoot(){const A=this._catDict.getRaw("StructTreeRoot"),e=this.xref.fetchIfRef(A);if(!(e instanceof CA))return null;const t=new $r(e,A);return t.init(),t}get toplevelPagesDict(){const A=this._catDict.get("Pages");if(!(A instanceof CA))throw new K("Invalid top-level pages dictionary.");return U(this,"toplevelPagesDict",A)}get documentOutline(){let A=null;try{A=this._readDocumentOutline()}catch(A){if(A instanceof yA)throw A;R("Unable to read document outline.")}return U(this,"documentOutline",A)}_readDocumentOutline(){let A=this._catDict.get("Outlines");if(!(A instanceof CA))return null;if(A=A.getRaw("First"),!(A instanceof BA))return null;const e={items:[]},t=[{obj:A,parent:e}],i=new hA;i.put(A);const a=this.xref,s=new Uint8ClampedArray(3);for(;t.length>0;){const e=t.shift(),n=a.fetchIfRef(e.obj);if(null===n)continue;n.has("Title")||R("Invalid outline item encountered.");const g={url:null,dest:null,action:null};no.parseDestDictionary({destDict:n,resultObj:g,docBaseUrl:this.baseUrl,docAttachments:this.attachments});const r=n.get("Title"),o=n.get("F")||0,I=n.getArray("C"),c=n.get("Count");let C=s;!LA(I,3)||0===I[0]&&0===I[1]&&0===I[2]||(C=oe.singletons.rgb.getRgb(I,0));const B={action:g.action,attachment:g.attachment,dest:g.dest,url:g.url,unsafeUrl:g.unsafeUrl,newWindow:g.newWindow,setOCGState:g.setOCGState,title:"string"==typeof r?z(r):"",color:C,count:Number.isInteger(c)?c:void 0,bold:!!(2&o),italic:!!(1&o),items:[]};e.parent.items.push(B),A=n.getRaw("First"),A instanceof BA&&!i.has(A)&&(t.push({obj:A,parent:B}),i.put(A)),A=n.getRaw("Next"),A instanceof BA&&!i.has(A)&&(t.push({obj:A,parent:e.parent}),i.put(A))}return e.items.length>0?e.items:null}get permissions(){let A=null;try{A=this._readPermissions()}catch(A){if(A instanceof yA)throw A;R("Unable to read permissions.")}return U(this,"permissions",A)}_readPermissions(){const A=this.xref.trailer.get("Encrypt");if(!(A instanceof CA))return null;let e=A.get("P");if("number"!=typeof e)return null;e+=2**32;const t=[];for(const A in r){const i=r[A];e&i&&t.push(i)}return t}get optionalContentConfig(){let A=null;try{const e=this._catDict.get("OCProperties");if(!e)return U(this,"optionalContentConfig",null);const t=e.get("D");if(!t)return U(this,"optionalContentConfig",null);const i=e.get("OCGs");if(!Array.isArray(i))return U(this,"optionalContentConfig",null);const a=[],s=new hA;for(const A of i)A instanceof BA&&!s.has(A)&&(s.put(A),a.push(this.#v(A)));A=this.#K(t,s),A.groups=a}catch(A){if(A instanceof yA)throw A;R(`Unable to read optional content config: ${A}`)}return U(this,"optionalContentConfig",A)}#v(A){const e=this.xref.fetch(A),t={id:A.toString(),name:null,intent:null,usage:{print:null,view:null}},i=e.get("Name");"string"==typeof i&&(t.name=z(i));let a=e.getArray("Intent");Array.isArray(a)||(a=[a]),a.every((A=>A instanceof oA))&&(t.intent=a.map((A=>A.name)));const s=e.get("Usage");if(!(s instanceof CA))return t;const n=t.usage,g=s.get("Print");if(g instanceof CA){const A=g.get("PrintState");if(A instanceof oA)switch(A.name){case"ON":case"OFF":n.print={printState:A.name}}}const r=s.get("View");if(r instanceof CA){const A=r.get("ViewState");if(A instanceof oA)switch(A.name){case"ON":case"OFF":n.view={viewState:A.name}}}return t}#K(A,e){function t(A){const t=[];if(Array.isArray(A))for(const i of A)i instanceof BA&&e.has(i)&&t.push(i.toString());return t}function i(A,t=0){if(!Array.isArray(A))return null;const i=[];for(const s of A){if(s instanceof BA&&e.has(s)){n.put(s),i.push(s.toString());continue}const A=a(s,t);A&&i.push(A)}if(t>0)return i;const s=[];for(const A of e)n.has(A)||s.push(A.toString());return s.length&&i.push({name:null,order:s}),i}function a(A,e){if(++e>g)return R("parseNestedOrder - reached MAX_NESTED_LEVELS."),null;const t=s.fetchIfRef(A);if(!Array.isArray(t))return null;const a=s.fetchIfRef(t[0]);if("string"!=typeof a)return null;const n=i(t.slice(1),e);return n&&n.length?{name:z(a),order:n}:null}const s=this.xref,n=new hA,g=10;return{name:"string"==typeof A.get("Name")?z(A.get("Name")):null,creator:"string"==typeof A.get("Creator")?z(A.get("Creator")):null,baseState:A.get("BaseState")instanceof oA?A.get("BaseState").name:null,on:t(A.get("ON")),off:t(A.get("OFF")),order:i(A.get("Order")),groups:null}}setActualNumPages(A=null){this._actualNumPages=A}get hasActualNumPages(){return null!==this._actualNumPages}get _pagesCount(){const A=this.toplevelPagesDict.get("Count");if(!Number.isInteger(A))throw new K("Page count in top-level pages dictionary is not an integer.");return U(this,"_pagesCount",A)}get numPages(){return this.hasActualNumPages?this._actualNumPages:this._pagesCount}get destinations(){const A=this._readDests(),e=Object.create(null);if(A instanceof dr)for(const[t,i]of A.getAll()){const A=ao(i);A&&(e[z(t)]=A)}else A instanceof CA&&A.forEach((function(A,t){const i=ao(t);i&&(e[A]=i)}));return U(this,"destinations",e)}getDestination(A){const e=this._readDests();if(e instanceof dr){const t=ao(e.get(A));if(t)return t;const i=this.destinations[A];if(i)return R(`Found "${A}" at an incorrect position in the NameTree.`),i}else if(e instanceof CA){const t=ao(e.get(A));if(t)return t}return null}_readDests(){const A=this._catDict.get("Names");return A?.has("Dests")?new dr(A.getRaw("Dests"),this.xref):this._catDict.has("Dests")?this._catDict.get("Dests"):void 0}get pageLabels(){let A=null;try{A=this._readPageLabels()}catch(A){if(A instanceof yA)throw A;R("Unable to read page labels.")}return U(this,"pageLabels",A)}_readPageLabels(){const A=this._catDict.getRaw("PageLabels");if(!A)return null;const e=new Array(this.numPages);let t=null,i="";const a=new fr(A,this.xref).getAll();let s="",n=1;for(let A=0,g=this.numPages;A=1))throw new K("Invalid start in PageLabel dictionary.");n=A}else n=1}switch(t){case"D":s=n;break;case"R":case"r":s=RA(n,"r"===t);break;case"A":case"a":const A=26,e="a"===t?97:65,i=n-1;s=String.fromCharCode(e+i%A).repeat(Math.floor(i/A)+1);break;default:if(t)throw new K(`Invalid style "${t}" in PageLabel dictionary.`);s=""}e[A]=i+s,n++}return e}get pageLayout(){const A=this._catDict.get("PageLayout");let e="";if(A instanceof oA)switch(A.name){case"SinglePage":case"OneColumn":case"TwoColumnLeft":case"TwoColumnRight":case"TwoPageLeft":case"TwoPageRight":e=A.name}return U(this,"pageLayout",e)}get pageMode(){const A=this._catDict.get("PageMode");let e="UseNone";if(A instanceof oA)switch(A.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"FullScreen":case"UseOC":case"UseAttachments":e=A.name}return U(this,"pageMode",e)}get viewerPreferences(){const A=this._catDict.get("ViewerPreferences");if(!(A instanceof CA))return U(this,"viewerPreferences",null);let e=null;for(const t of A.getKeys()){const i=A.get(t);let a;switch(t){case"HideToolbar":case"HideMenubar":case"HideWindowUI":case"FitWindow":case"CenterWindow":case"DisplayDocTitle":case"PickTrayByPDFSize":"boolean"==typeof i&&(a=i);break;case"NonFullScreenPageMode":if(i instanceof oA)switch(i.name){case"UseNone":case"UseOutlines":case"UseThumbs":case"UseOC":a=i.name;break;default:a="UseNone"}break;case"Direction":if(i instanceof oA)switch(i.name){case"L2R":case"R2L":a=i.name;break;default:a="L2R"}break;case"ViewArea":case"ViewClip":case"PrintArea":case"PrintClip":if(i instanceof oA)switch(i.name){case"MediaBox":case"CropBox":case"BleedBox":case"TrimBox":case"ArtBox":a=i.name;break;default:a="CropBox"}break;case"PrintScaling":if(i instanceof oA)switch(i.name){case"None":case"AppDefault":a=i.name;break;default:a="AppDefault"}break;case"Duplex":if(i instanceof oA)switch(i.name){case"Simplex":case"DuplexFlipShortEdge":case"DuplexFlipLongEdge":a=i.name;break;default:a="None"}break;case"PrintPageRange":Array.isArray(i)&&i.length%2==0&&i.every(((A,e,t)=>Number.isInteger(A)&&A>0&&(0===e||A>=t[e-1])&&A<=this.numPages))&&(a=i);break;case"NumCopies":Number.isInteger(i)&&i>0&&(a=i);break;default:R(`Ignoring non-standard key in ViewerPreferences: ${t}.`);continue}void 0!==a?(e||(e=Object.create(null)),e[t]=a):R(`Bad value, for key "${t}", in ViewerPreferences: ${i}.`)}return U(this,"viewerPreferences",e)}get openAction(){const A=this._catDict.get("OpenAction"),e=Object.create(null);if(A instanceof CA){const t=new CA(this.xref);t.set("A",A);const i={url:null,dest:null,action:null};no.parseDestDictionary({destDict:t,resultObj:i}),Array.isArray(i.dest)?e.dest=i.dest:i.action&&(e.action=i.action)}else Array.isArray(A)&&(e.dest=A);return U(this,"openAction",Z(e)>0?e:null)}get attachments(){const A=this._catDict.get("Names");let e=null;if(A instanceof CA&&A.has("EmbeddedFiles")){const t=new dr(A.getRaw("EmbeddedFiles"),this.xref);for(const[A,i]of t.getAll()){const t=new yr(i,this.xref);e||(e=Object.create(null)),e[z(A)]=t.serializable}}return U(this,"attachments",e)}get xfaImages(){const A=this._catDict.get("Names");let e=null;if(A instanceof CA&&A.has("XFAImages")){const t=new dr(A.getRaw("XFAImages"),this.xref);for(const[A,i]of t.getAll())e||(e=new CA(this.xref)),e.set(z(A),i)}return U(this,"xfaImages",e)}_collectJavaScript(){const A=this._catDict.get("Names");let e=null;function t(A,t){if(!(t instanceof CA))return;if(!lA(t.get("S"),"JavaScript"))return;let i=t.get("JS");if(i instanceof fA)i=i.getString();else if("string"!=typeof i)return;i=z(i).replaceAll("\0",""),i&&(e||=new Map).set(A,i)}if(A instanceof CA&&A.has("JavaScript")){const e=new dr(A.getRaw("JavaScript"),this.xref);for(const[A,i]of e.getAll())t(z(A),i)}const i=this._catDict.get("OpenAction");return i&&t("OpenAction",i),e}get jsActions(){const A=this._collectJavaScript();let e=PA(this.xref,this._catDict,h);if(A){e||=Object.create(null);for(const[t,i]of A)t in e?e[t].push(i):e[t]=[i]}return U(this,"jsActions",e)}async fontFallback(A,e){const t=await Promise.all(this.fontCache);for(const i of t)if(i.loadedName===A)return void i.fallback(e)}async cleanup(A=!1){pr(),this.globalImageCache.clear(A),this.pageKidsCountCache.clear(),this.pageIndexCache.clear(),this.pageDictCache.clear(),this.nonBlendModesSet.clear();const e=await Promise.all(this.fontCache);for(const{dict:A}of e)delete A.cacheKey;this.fontCache.clear(),this.builtInCMapCache.clear(),this.standardFontDataCache.clear(),this.systemFontCache.clear()}async getPageDict(A){const e=[this.toplevelPagesDict],t=new hA,i=this._catDict.getRaw("Pages");i instanceof BA&&t.put(i);const a=this.xref,s=this.pageKidsCountCache,n=this.pageIndexCache,g=this.pageDictCache;let r=0;for(;e.length;){const i=e.pop();if(i instanceof BA){const o=s.get(i);if(o>=0&&r+o<=A){r+=o;continue}if(t.has(i))throw new K("Pages tree contains circular reference.");t.put(i);const I=await(g.get(i)||a.fetchAsync(i));if(I instanceof CA){let e=I.getRaw("Type");if(e instanceof BA&&(e=await a.fetchAsync(e)),lA(e,"Page")||!I.has("Kids")){if(s.has(i)||s.put(i,1),n.has(i)||n.put(i,r),r===A)return[I,i];r++;continue}}e.push(I);continue}if(!(i instanceof CA))throw new K("Page dictionary kid reference points to wrong type of object.");const{objId:o}=i;let I=i.getRaw("Count");if(I instanceof BA&&(I=await a.fetchAsync(I)),Number.isInteger(I)&&I>=0&&(o&&!s.has(o)&&s.put(o,I),r+I<=A)){r+=I;continue}let c=i.getRaw("Kids");if(c instanceof BA&&(c=await a.fetchAsync(c)),!Array.isArray(c)){let e=i.getRaw("Type");if(e instanceof BA&&(e=await a.fetchAsync(e)),lA(e,"Page")||!i.has("Kids")){if(r===A)return[i,null];r++;continue}throw new K("Page dictionary kids object is not an array.")}for(let A=c.length-1;A>=0;A--){const t=c[A];e.push(t),i===this.toplevelPagesDict&&t instanceof BA&&!g.has(t)&&g.put(t,a.fetchAsync(t))}}throw new Error(`Page index ${A} not found.`)}async getAllPageDicts(A=!1){const{ignoreErrors:e}=this.pdfManager.evaluatorOptions,t=[{currentNode:this.toplevelPagesDict,posInKids:0}],i=new hA,a=this._catDict.getRaw("Pages");a instanceof BA&&i.put(a);const s=new Map,n=this.xref,g=this.pageIndexCache;let r=0;function o(t){if(t instanceof DA&&!A)throw t;A&&e&&0===r&&(R(`getAllPageDicts - Skipping invalid first page: "${t}".`),t=CA.empty),s.set(r++,[t,null])}for(;t.length>0;){const A=t.at(-1),{currentNode:e,posInKids:a}=A;let C=e.getRaw("Kids");if(C instanceof BA)try{C=await n.fetchAsync(C)}catch(A){o(A);break}if(!Array.isArray(C)){o(new K("Page dictionary kids object is not an array."));break}if(a>=C.length){t.pop();continue}const B=C[a];let h;if(B instanceof BA){if(i.has(B)){o(new K("Pages tree contains circular reference."));break}i.put(B);try{h=await n.fetchAsync(B)}catch(A){o(A);break}}else h=B;if(!(h instanceof CA)){o(new K("Page dictionary kid reference points to wrong type of object."));break}let Q=h.getRaw("Type");if(Q instanceof BA)try{Q=await n.fetchAsync(Q)}catch(A){o(A);break}lA(Q,"Page")||!h.has("Kids")?(I=h,(c=B instanceof BA?B:null)&&!g.has(c)&&g.put(c,r),s.set(r++,[I,c])):t.push({currentNode:h,posInKids:0}),A.posInKids++}var I,c;return s}getPageIndex(A){const e=this.pageIndexCache.get(A);if(void 0!==e)return Promise.resolve(e);const t=this.xref;let i=0;const a=e=>function(e){let i,a=0;return t.fetchAsync(e).then((function(t){if(dA(e,A)&&!uA(t,"Page")&&!(t instanceof CA&&!t.has("Type")&&t.has("Contents")))throw new K("The reference does not point to a /Page dictionary.");if(!t)return null;if(!(t instanceof CA))throw new K("Node must be a dictionary.");return i=t.getRaw("Parent"),t.getAsync("Parent")})).then((function(A){if(!A)return null;if(!(A instanceof CA))throw new K("Parent must be a dictionary.");return A.getAsync("Kids")})).then((function(A){if(!A)return null;const s=[];let n=!1;for(const i of A){if(!(i instanceof BA))throw new K("Kid must be a reference.");if(dA(i,e)){n=!0;break}s.push(t.fetchAsync(i).then((function(A){if(!(A instanceof CA))throw new K("Kid node must be a dictionary.");A.has("Count")?a+=A.get("Count"):a++})))}if(!n)throw new K("Kid reference not found in parent's kids.");return Promise.all(s).then((function(){return[a,i]}))}))}(e).then((e=>{if(!e)return this.pageIndexCache.put(A,i),i;const[t,s]=e;return i+=t,a(s)}));return a(A)}get baseUrl(){const A=this._catDict.get("URI");if(A instanceof CA){const e=A.get("Base");if("string"==typeof e){const A=x(e,null,{tryConvertEncoding:!0});if(A)return U(this,"baseUrl",A.href)}}return U(this,"baseUrl",this.pdfManager.docBaseUrl)}static parseDestDictionary({destDict:A,resultObj:e,docBaseUrl:t=null,docAttachments:i=null}){if(!(A instanceof CA))return void R("parseDestDictionary: `destDict` must be a dictionary.");let a,s,n=A.get("A");if(n instanceof CA||(A.has("Dest")?n=A.get("Dest"):(n=A.get("AA"),n instanceof CA&&(n.has("D")?n=n.get("D"):n.has("U")&&(n=n.get("U"))))),n instanceof CA){const A=n.get("S");if(!(A instanceof oA))return void R("parseDestDictionary: Invalid type in Action dictionary.");const t=A.name;switch(t){case"ResetForm":const A=n.get("Flags"),g=!(1&("number"==typeof A?A:0)),r=[],o=[];for(const A of n.get("Fields")||[])A instanceof BA?o.push(A.toString()):"string"==typeof A&&r.push(z(A));e.resetForm={fields:r,refs:o,include:g};break;case"URI":a=n.get("URI"),a instanceof oA&&(a="/"+a.name);break;case"GoTo":s=n.get("D");break;case"Launch":case"GoToR":const I=n.get("F");if(I instanceof CA){const A=new yr(I,null,!0),{rawFilename:e}=A.serializable;a=e}else"string"==typeof I&&(a=I);const c=so(n);c&&"string"==typeof a&&(a=a.split("#",1)[0]+"#"+c);const C=n.get("NewWindow");"boolean"==typeof C&&(e.newWindow=C);break;case"GoToE":const B=n.get("T");let h;if(i&&B instanceof CA){const A=B.get("R"),e=B.get("N");lA(A,"C")&&"string"==typeof e&&(h=i[z(e)])}if(h){e.attachment=h;const A=so(n);A&&(e.attachmentDest=A)}else R('parseDestDictionary - unimplemented "GoToE" action.');break;case"Named":const Q=n.get("N");Q instanceof oA&&(e.action=Q.name);break;case"SetOCGState":const l=n.get("State"),E=n.get("PreserveRB");if(!Array.isArray(l)||0===l.length)break;const u=[];for(const A of l)if(A instanceof oA)switch(A.name){case"ON":case"OFF":case"Toggle":u.push(A.name)}else A instanceof BA&&u.push(A.toString());if(u.length!==l.length)break;e.setOCGState={state:u,preserveRB:"boolean"!=typeof E||E};break;case"JavaScript":const d=n.get("JS");let f;d instanceof fA?f=d.getString():"string"==typeof d&&(f=d);const p=f&&jA(z(f));if(p){a=p.url,e.newWindow=p.newWindow;break}default:if("JavaScript"===t||"SubmitForm"===t)break;R(`parseDestDictionary - unsupported action: "${t}".`)}}else A.has("Dest")&&(s=A.get("Dest"));if("string"==typeof a){const A=x(a,t,{addDefaultProtocol:!0,tryConvertEncoding:!0});A&&(e.url=A.href),e.unsafeUrl=a}s&&(s instanceof oA&&(s=s.name),"string"==typeof s?e.dest=z(s):io(s)&&(e.dest=s))}}function go(A,e){if(A instanceof CA)A=A.getRawValues();else if(A instanceof fA)A=A.dict.getRawValues();else if(!Array.isArray(A))return;for(const i of A)((t=i)instanceof BA||t instanceof CA||t instanceof fA||Array.isArray(t))&&e.push(i);var t}class ro{constructor(A,e,t){this.dict=A,this.keys=e,this.xref=t,this.refSet=null}async load(){if(this.xref.stream.isDataLoaded)return;const{keys:A,dict:e}=this;this.refSet=new hA;const t=[];for(const i of A){const A=e.getRaw(i);void 0!==A&&t.push(A)}return this._walk(t)}async _walk(A){const e=[],t=[];for(;A.length;){let i=A.pop();if(i instanceof BA){if(this.refSet.has(i))continue;try{this.refSet.put(i),i=this.xref.fetch(i)}catch(A){if(!(A instanceof yA)){R(`ObjectLoader._walk - requesting all data: "${A}".`),this.refSet=null;const{manager:e}=this.xref.stream;return e.requestAllChunks()}e.push(i),t.push({begin:A.begin,end:A.end})}}if(i instanceof fA){const A=i.getBaseStreams();if(A){let a=!1;for(const e of A)e.isDataLoaded||(a=!0,t.push({begin:e.start,end:e.end}));a&&e.push(i)}}go(i,A)}if(t.length){await this.xref.stream.manager.requestRanges(t);for(const A of e)A instanceof BA&&this.refSet.remove(A);return this._walk(e)}this.refSet=null}}const oo=Symbol(),Io=Symbol(),co=Symbol(),Co=Symbol(),Bo=Symbol(),ho=Symbol(),Qo=Symbol(),lo=Symbol(),Eo=Symbol(),uo=Symbol("content"),fo=Symbol("data"),po=Symbol(),mo=Symbol("extra"),yo=Symbol(),wo=Symbol(),Do=Symbol(),bo=Symbol(),ko=Symbol(),Fo=Symbol(),So=Symbol(),Ro=Symbol(),Go=Symbol(),No=Symbol(),xo=Symbol(),Uo=Symbol(),Mo=Symbol(),Lo=Symbol(),Jo=Symbol(),Ho=Symbol(),Yo=Symbol(),vo=Symbol(),Ko=Symbol(),qo=Symbol(),To=Symbol(),Po=Symbol(),Wo=Symbol(),Zo=Symbol(),Oo=Symbol(),Xo=Symbol(),Vo=Symbol(),jo=Symbol(),zo=Symbol(),_o=Symbol(),$o=Symbol(),AI=Symbol(),eI=Symbol("namespaceId"),tI=Symbol("nodeName"),iI=Symbol(),aI=Symbol(),sI=Symbol(),nI=Symbol(),gI=Symbol(),rI=Symbol(),oI=Symbol(),II=Symbol(),cI=Symbol("root"),CI=Symbol(),BI=Symbol(),hI=Symbol(),QI=Symbol(),lI=Symbol(),EI=Symbol(),uI=Symbol(),dI=Symbol(),fI=Symbol(),pI=Symbol(),mI=Symbol(),yI=Symbol("uid"),wI=Symbol(),DI={config:{id:0,check:A=>A.startsWith("http://www.xfa.org/schema/xci/")},connectionSet:{id:1,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-connection-set/")},datasets:{id:2,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-data/")},form:{id:3,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-form/")},localeSet:{id:4,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-locale-set/")},pdf:{id:5,check:A=>"http://ns.adobe.com/xdp/pdf/"===A},signature:{id:6,check:A=>"http://www.w3.org/2000/09/xmldsig#"===A},sourceSet:{id:7,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-source-set/")},stylesheet:{id:8,check:A=>"http://www.w3.org/1999/XSL/Transform"===A},template:{id:9,check:A=>A.startsWith("http://www.xfa.org/schema/xfa-template/")},xdc:{id:10,check:A=>A.startsWith("http://www.xfa.org/schema/xdc/")},xdp:{id:11,check:A=>"http://ns.adobe.com/xdp/"===A},xfdf:{id:12,check:A=>"http://ns.adobe.com/xfdf/"===A},xhtml:{id:13,check:A=>"http://www.w3.org/1999/xhtml"===A},xmpmeta:{id:14,check:A=>"http://ns.adobe.com/xmpmeta/"===A}},bI={pt:A=>A,cm:A=>A/2.54*72,mm:A=>A/25.4*72,in:A=>72*A,px:A=>A},kI=/([+-]?\d+\.?\d*)(.*)/;function FI(A){return A.startsWith("'")||A.startsWith('"')?A.slice(1,-1):A}function SI({data:A,defaultValue:e,validate:t}){if(!A)return e;A=A.trim();const i=parseInt(A,10);return!isNaN(i)&&t(i)?i:e}function RI({data:A,defaultValue:e,validate:t}){if(!A)return e;A=A.trim();const i=parseFloat(A);return!isNaN(i)&&t(i)?i:e}function GI({data:A,defaultValue:e,validate:t}){return A&&t(A=A.trim())?A:e}function NI(A,e){return GI({data:A,defaultValue:e[0],validate:A=>e.includes(A)})}function xI(A,e="0"){if(e||="0",!A)return xI(e);const t=A.trim().match(kI);if(!t)return xI(e);const[,i,a]=t,s=parseFloat(i);if(isNaN(s))return xI(e);if(0===s)return 0;const n=bI[a];return n?n(s):s}function UI(A){if(!A)return{num:1,den:1};const e=A.trim().split(/\s*:\s*/).map((A=>parseFloat(A))).filter((A=>!isNaN(A)));if(1===e.length&&e.push(1),0===e.length)return{num:1,den:1};const[t,i]=e;return{num:t,den:i}}function MI(A){return A?A.trim().split(/\s+/).map((A=>({excluded:"-"===A[0],viewname:A.substring(1)}))):[]}class LI{static get FAILURE(){return U(this,"FAILURE",new LI(!1,null,null,null))}static get EMPTY(){return U(this,"EMPTY",new LI(!0,null,null,null))}constructor(A,e,t,i){this.success=A,this.html=e,this.bbox=t,this.breakNode=i}isBreak(){return!!this.breakNode}static breakNode(A){return new LI(!1,null,null,A)}static success(A,e=null){return new LI(!0,A,e,null)}}class JI{constructor(A){this.fonts=new Map,this.cache=new Map,this.warned=new Set,this.defaultFont=null,this.add(A)}add(A,e=null){for(const e of A)this.addPdfFont(e);for(const A of this.fonts.values())A.regular||(A.regular=A.italic||A.bold||A.bolditalic);if(!e||0===e.size)return;const t=this.fonts.get("PdfJS-Fallback-PdfJS-XFA");for(const A of e)this.fonts.set(A,t)}addPdfFont(A){const e=A.cssFontInfo,t=e.fontFamily;let i=this.fonts.get(t);i||(i=Object.create(null),this.fonts.set(t,i),this.defaultFont||(this.defaultFont=i));let a="";const s=parseFloat(e.fontWeight);0!==parseFloat(e.italicAngle)?a=s>=700?"bolditalic":"italic":s>=700&&(a="bold"),a||((A.name.includes("Bold")||A.psName?.includes("Bold"))&&(a="bold"),(A.name.includes("Italic")||A.name.endsWith("It")||A.psName?.includes("Italic")||A.psName?.endsWith("It"))&&(a+="italic")),a||(a="regular"),i[a]=A}getDefault(){return this.defaultFont}find(A,e=!0){let t=this.fonts.get(A)||this.cache.get(A);if(t)return t;const i=/,|-|_| |bolditalic|bold|italic|regular|it/gi;let a=A.replaceAll(i,"");if(t=this.fonts.get(a),t)return this.cache.set(A,t),t;a=a.toLowerCase();const s=[];for(const[A,e]of this.fonts.entries())A.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(e);if(0===s.length)for(const[,A]of this.fonts.entries())A.regular.name?.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(A);if(0===s.length){a=a.replaceAll(/psmt|mt/gi,"");for(const[A,e]of this.fonts.entries())A.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(e)}if(0===s.length)for(const A of this.fonts.values())A.regular.name?.replaceAll(i,"").toLowerCase().startsWith(a)&&s.push(A);return s.length>=1?(1!==s.length&&e&&R(`XFA - Too many choices to guess the correct font: ${A}`),this.cache.set(A,s[0]),s[0]):(e&&!this.warned.has(A)&&(this.warned.add(A),R(`XFA - Cannot find the font: ${A}`)),null)}}function HI(A,e){return"italic"===A.posture?"bold"===A.weight?e.bolditalic:e.italic:"bold"===A.weight?e.bold:e.regular}class YI{constructor(A,e,t,i){if(this.lineHeight=t,this.paraMargin=e||{top:0,bottom:0,left:0,right:0},!A)return void([this.pdfFont,this.xfaFont]=this.defaultFont(i));this.xfaFont={typeface:A.typeface,posture:A.posture,weight:A.weight,size:A.size,letterSpacing:A.letterSpacing};const a=i.find(A.typeface);a?(this.pdfFont=HI(A,a),this.pdfFont||([this.pdfFont,this.xfaFont]=this.defaultFont(i))):[this.pdfFont,this.xfaFont]=this.defaultFont(i)}defaultFont(A){const e=A.find("Helvetica",!1)||A.find("Myriad Pro",!1)||A.find("Arial",!1)||A.getDefault();if(e?.regular){const A=e.regular;return[A,{typeface:A.cssFontInfo.fontFamily,posture:"normal",weight:"normal",size:10,letterSpacing:0}]}return[null,{typeface:"Courier",posture:"normal",weight:"normal",size:10,letterSpacing:0}]}}class vI{constructor(A,e,t,i){this.fontFinder=i,this.stack=[new YI(A,e,t,i)]}pushData(A,e,t){const i=this.stack.at(-1);for(const e of["typeface","posture","weight","size","letterSpacing"])A[e]||(A[e]=i.xfaFont[e]);for(const A of["top","bottom","left","right"])isNaN(e[A])&&(e[A]=i.paraMargin[A]);const a=new YI(A,e,t||i.lineHeight,this.fontFinder);a.pdfFont||(a.pdfFont=i.pdfFont),this.stack.push(a)}popFont(){this.stack.pop()}topFont(){return this.stack.at(-1)}}class KI{constructor(A,e,t,i){this.glyphs=[],this.fontSelector=new vI(A,e,t,i),this.extraHeight=0}pushData(A,e,t){this.fontSelector.pushData(A,e,t)}popFont(A){return this.fontSelector.popFont()}addPara(){const A=this.fontSelector.topFont();this.extraHeight+=A.paraMargin.top+A.paraMargin.bottom}addString(A){if(!A)return;const e=this.fontSelector.topFont(),t=e.xfaFont.size;if(e.pdfFont){const i=e.xfaFont.letterSpacing,a=e.pdfFont,s=a.lineHeight||1.2,n=e.lineHeight||Math.max(1.2,s)*t,g=s-(void 0===a.lineGap?.2:a.lineGap),r=Math.max(1,g)*t,o=t/1e3,I=a.defaultWidth||a.charsToGlyphs(" ")[0].width;for(const e of A.split(/[\u2029\n]/)){const A=a.encodeString(e).join(""),t=a.charsToGlyphs(A);for(const A of t){const e=A.width||I;this.glyphs.push([e*o+i,n,r,A.unicode,!1])}this.glyphs.push([0,0,0,"\n",!0])}this.glyphs.pop()}else{for(const e of A.split(/[\u2029\n]/)){for(const A of e.split(""))this.glyphs.push([t,1.2*t,t,A,!1]);this.glyphs.push([0,0,0,"\n",!0])}this.glyphs.pop()}}compute(A){let e=-1,t=0,i=0,a=0,s=0,n=0,g=!1,r=!0;for(let o=0,I=this.glyphs.length;oA?(i=Math.max(i,s),s=0,a+=n,n=l,e=-1,t=0,g=!0,r=!1):(n=Math.max(l,n),t=s,s+=I,e=o):s+I>A?(a+=n,n=l,-1!==e?(o=e,i=Math.max(i,t),s=0,e=-1,t=0):(i=Math.max(i,s),s=I),g=!0,r=!1):(s+=I,n=Math.max(l,n))}return i=Math.max(i,s),a+=n+this.extraHeight,{width:1.02*i,height:a,isBroken:g}}}const qI=/^[^.[]+/,TI=/^[^\]]+/,PI=new Map([["$data",(A,e)=>A.datasets?A.datasets.data:A],["$record",(A,e)=>(A.datasets?A.datasets.data:A)[Uo]()[0]],["$template",(A,e)=>A.template],["$connectionSet",(A,e)=>A.connectionSet],["$form",(A,e)=>A.form],["$layout",(A,e)=>A.layout],["$host",(A,e)=>A.host],["$dataWindow",(A,e)=>A.dataWindow],["$event",(A,e)=>A.event],["!",(A,e)=>A.datasets],["$xfa",(A,e)=>A],["xfa",(A,e)=>A],["$",(A,e)=>e]]),WI=new WeakMap;function ZI(A,e,t=!0){let i=A.match(qI);if(!i)return null;let[a]=i;const s=[{name:a,cacheName:"."+a,index:0,js:null,formCalc:null,operator:0}];let n=a.length;for(;n0&&I.push(A)}if(0!==I.length||g||0!==r)A=isFinite(o)?I.filter((A=>oA[o])):I.flat();else{const t=e[Ho]();if(!(e=t))return null;r=-1,A=[e]}}return 0===A.length?null:A}function XI(A,e,t){const i=ZI(t);if(!i)return null;if(i.some((A=>1===A.operator)))return null;const a=PI.get(i[0].name);let s=0;a?(A=a(A,e),s=1):A=e||A;for(let e=i.length;sA[uI]())).join("")}get[zI](){const A=Object.getPrototypeOf(this);if(!A._attributes){const e=A._attributes=new Set;for(const A of Object.getOwnPropertyNames(this)){if(null===this[A]||this[A]instanceof hc||this[A]instanceof Qc)break;e.add(A)}}return U(this,zI,A._attributes)}[Xo](A){let e=this;for(;e;){if(e===A)return!0;e=e[Ho]()}return!1}[Ho](){return this[rc]}[Jo](){return this[Ho]()}[Uo](A=null){return A?this[A]:this[_I]}[po](){const A=Object.create(null);this[uo]&&(A.$content=this[uo]);for(const e of Object.getOwnPropertyNames(this)){const t=this[e];null!==t&&(t instanceof hc?A[e]=t[po]():t instanceof Qc?t.isEmpty()||(A[e]=t.dump()):A[e]=t)}return A}[mI](){return null}[fI](){return LI.EMPTY}*[Mo](){for(const A of this[Uo]())yield A}*[tc](A,e){for(const t of this[Mo]())if(!A||e===A.has(t[tI])){const A=this[ko](),e=t[fI](A);e.success||(this[mo].failingNode=t),yield e}}[wo](){return null}[Io](A,e){this[mo].children.push(A)}[ko](){}[Co]({filter:A=null,include:e=!0}){if(this[mo].generator){const A=this[ko](),e=this[mo].failingNode[fI](A);if(!e.success)return e;e.html&&this[Io](e.html,e.bbox),delete this[mo].failingNode}else this[mo].generator=this[tc](A,e);for(;;){const A=this[mo].generator.next();if(A.done)break;const e=A.value;if(!e.success)return e;e.html&&this[Io](e.html,e.bbox)}return this[mo].generator=null,LI.EMPTY}[QI](A){this[Ic]=new Set(Object.keys(A))}[ac](A){const e=this[zI],t=this[Ic];return[...A].filter((A=>e.has(A)&&!t.has(A)))}[CI](A,e=new Set){for(const t of this[_I])t[oc](A,e)}[oc](A,e){const t=this[ic](A,e);t?this[VI](t,A,e):this[CI](A,e)}[ic](A,e){const{use:t,usehref:i}=this;if(!t&&!i)return null;let a=null,s=null,n=null,g=t;if(i?(g=i,i.startsWith("#som(")&&i.endsWith(")")?s=i.slice(5,-1):i.startsWith(".#som(")&&i.endsWith(")")?s=i.slice(6,-1):i.startsWith("#")?n=i.slice(1):i.startsWith(".#")&&(n=i.slice(2))):t.startsWith("#")?n=t.slice(1):s=t,this.use=this.usehref="",n?a=A.get(n):(a=OI(A.get(cI),this,s,!0,!1),a&&(a=a[0])),!a)return R(`XFA - Invalid prototype reference: ${g}.`),null;if(a[tI]!==this[tI])return R(`XFA - Incompatible prototype: ${a[tI]} !== ${this[tI]}.`),null;if(e.has(a))return R("XFA - Cycle detected in prototypes use."),null;e.add(a);const r=a[ic](A,e);return r&&a[VI](r,A,e),a[CI](A,e),e.delete(a),a}[VI](A,e,t){if(t.has(A))R("XFA - Cycle detected in prototypes use.");else{!this[uo]&&A[uo]&&(this[uo]=A[uo]),new Set(t).add(A);for(const e of this[ac](A[Ic]))this[e]=A[e],this[Ic]&&this[Ic].add(e);for(const i of Object.getOwnPropertyNames(this)){if(this[zI].has(i))continue;const a=this[i],s=A[i];if(a instanceof Qc){for(const A of a[_I])A[oc](e,t);for(let i=a[_I].length,n=s[_I].length;ihc[$I](A))):"object"==typeof A&&null!==A?Object.assign({},A):A}[lo](){const A=Object.create(Object.getPrototypeOf(this));for(const e of Object.getOwnPropertySymbols(this))try{A[e]=this[e]}catch{U(A,e,this[e])}A[yI]=`${A[tI]}${Cc++}`,A[_I]=[];for(const e of Object.getOwnPropertyNames(this)){if(this[zI].has(e)){A[e]=hc[$I](this[e]);continue}const t=this[e];A[e]=t instanceof Qc?new Qc(t[nc]):null}for(const e of this[_I]){const t=e[tI],i=e[lo]();A[_I].push(i),i[rc]=A,null===A[t]?A[t]=i:A[t][_I].push(i)}return A}[Uo](A=null){return A?this[_I].filter((e=>e[tI]===A)):this[_I]}[Fo](A){return this[A]}[So](A,e,t=!0){return Array.from(this[Ro](A,e,t))}*[Ro](A,e,t=!0){if("parent"!==A){for(const t of this[_I])t[tI]===A&&(yield t),t.name===A&&(yield t),(e||t[_o]())&&(yield*t[Ro](A,e,!1));t&&this[zI].has(A)&&(yield new lc(this,A,this[A]))}else yield this[rc]}}class Qc{constructor(A=1/0){this[nc]=A,this[_I]=[]}get isXFAObject(){return!1}get isXFAObjectArray(){return!0}push(A){return this[_I].length<=this[nc]?(this[_I].push(A),!0):(R(`XFA - node "${A[tI]}" accepts no more than ${this[nc]} children`),!1)}isEmpty(){return 0===this[_I].length}dump(){return 1===this[_I].length?this[_I][0][po]():this[_I].map((A=>A[po]()))}[lo](){const A=new Qc(this[nc]);return A[_I]=this[_I].map((A=>A[lo]())),A}get children(){return this[_I]}clear(){this[_I].length=0}}class lc{constructor(A,e,t){this[rc]=A,this[tI]=e,this[uo]=t,this[Eo]=!1,this[yI]="attribute"+Cc++}[Ho](){return this[rc]}[Oo](){return!0}[Go](){return this[uo].trim()}[lI](A){A=A.value||"",this[uo]=A.toString()}[uI](){return this[uo]}[Xo](A){return this[rc]===A||this[rc][Xo](A)}}class Ec extends hc{constructor(A,e,t={}){if(super(A,e),this[uo]="",this[Ac]=null,"#text"!==e){const A=new Map;this[jI]=A;for(const[e,i]of Object.entries(t))A.set(e,new lc(this,e,i));if(t.hasOwnProperty(iI)){const A=t[iI].xfa.dataNode;void 0!==A&&("dataGroup"===A?this[Ac]=!1:"dataValue"===A&&(this[Ac]=!0))}}this[Eo]=!1}[pI](A){const e=this[tI];if("#text"===e)return void A.push(OA(this[uo]));const t=$(e),i=this[eI]===Bc?"xfa:":"";A.push(`<${i}${t}`);for(const[e,t]of this[jI].entries()){const i=$(e);A.push(` ${i}="${OA(t[uo])}"`)}if(null!==this[Ac]&&(this[Ac]?A.push(' xfa:dataNode="dataValue"'):A.push(' xfa:dataNode="dataGroup"')),this[uo]||0!==this[_I].length){if(A.push(">"),this[uo])"string"==typeof this[uo]?A.push(OA(this[uo])):this[uo][pI](A);else for(const e of this[_I])e[pI](A);A.push(``)}else A.push("/>")}[aI](A){if(this[uo]){const A=new Ec(this[eI],"#text");this[co](A),A[uo]=this[uo],this[uo]=""}return this[co](A),!0}[nI](A){this[uo]+=A}[yo](){if(this[uo]&&this[_I].length>0){const A=new Ec(this[eI],"#text");this[co](A),A[uo]=this[uo],delete this[uo]}}[fI](){return"#text"===this[tI]?LI.success({name:"#text",value:this[uo]}):LI.EMPTY}[Uo](A=null){return A?this[_I].filter((e=>e[tI]===A)):this[_I]}[bo](){return this[jI]}[Fo](A){const e=this[jI].get(A);return void 0!==e?e:this[Uo](A)}*[Ro](A,e){const t=this[jI].get(A);t&&(yield t);for(const t of this[_I])t[tI]===A&&(yield t),e&&(yield*t[Ro](A,e))}*[Do](A,e){const t=this[jI].get(A);!t||e&&t[Eo]||(yield t);for(const t of this[_I])yield*t[Do](A,e)}*[xo](A,e,t){for(const i of this[_I])i[tI]!==A||t&&i[Eo]||(yield i),e&&(yield*i[xo](A,e,t))}[Oo](){return null===this[Ac]?0===this[_I].length||this[_I][0][eI]===DI.xhtml.id:this[Ac]}[Go](){return null===this[Ac]?0===this[_I].length?this[uo].trim():this[_I][0][eI]===DI.xhtml.id?this[_I][0][uI]().trim():null:this[uo].trim()}[lI](A){A=A.value||"",this[uo]=A.toString()}[po](A=!1){const e=Object.create(null);A&&(e.$ns=this[eI]),this[uo]&&(e.$content=this[uo]),e.$name=this[tI],e.children=[];for(const t of this[_I])e.children.push(t[po](A));e.attributes=Object.create(null);for(const[A,t]of this[jI])e.attributes[A]=t[uo];return e}}class uc extends hc{constructor(A,e){super(A,e),this[uo]=""}[nI](A){this[uo]+=A}[yo](){}}class dc extends uc{constructor(A,e,t){super(A,e),this[gc]=t}[yo](){this[uo]=GI({data:this[uo],defaultValue:this[gc][0],validate:A=>this[gc].includes(A)})}[Bo](A){super[Bo](A),delete this[gc]}}class fc extends uc{[yo](){this[uo]=this[uo].trim()}}class pc extends uc{constructor(A,e,t,i){super(A,e),this[ec]=t,this[cc]=i}[yo](){this[uo]=SI({data:this[uo],defaultValue:this[ec],validate:this[cc]})}[Bo](A){super[Bo](A),delete this[ec],delete this[cc]}}class mc extends pc{constructor(A,e){super(A,e,0,(A=>1===A))}}class yc extends pc{constructor(A,e){super(A,e,1,(A=>0===A))}}function wc(A){return"string"==typeof A?"0px":Number.isInteger(A)?`${A}px`:`${A.toFixed(2)}px`}const Dc={anchorType(A,e){const t=A[Jo]();if(t&&(!t.layout||"position"===t.layout))switch("transform"in e||(e.transform=""),A.anchorType){case"bottomCenter":e.transform+="translate(-50%, -100%)";break;case"bottomLeft":e.transform+="translate(0,-100%)";break;case"bottomRight":e.transform+="translate(-100%,-100%)";break;case"middleCenter":e.transform+="translate(-50%,-50%)";break;case"middleLeft":e.transform+="translate(0,-50%)";break;case"middleRight":e.transform+="translate(-100%,-50%)";break;case"topCenter":e.transform+="translate(-50%,0)";break;case"topRight":e.transform+="translate(-100%,0)"}},dimensions(A,e){const t=A[Jo]();let i=A.w;const a=A.h;if(t.layout?.includes("row")){const e=t[mo],a=A.colSpan;let s;-1===a?(s=e.columnWidths.slice(e.currentColumn).reduce(((A,e)=>A+e),0),e.currentColumn=0):(s=e.columnWidths.slice(e.currentColumn,e.currentColumn+a).reduce(((A,e)=>A+e),0),e.currentColumn=(e.currentColumn+A.colSpan)%e.columnWidths.length),isNaN(s)||(i=A.w=s)}e.width=""!==i?wc(i):"auto",e.height=""!==a?wc(a):"auto"},position(A,e){const t=A[Jo]();t?.layout&&"position"!==t.layout||(e.position="absolute",e.left=wc(A.x),e.top=wc(A.y))},rotate(A,e){A.rotate&&("transform"in e||(e.transform=""),e.transform+=`rotate(-${A.rotate}deg)`,e.transformOrigin="top left")},presence(A,e){switch(A.presence){case"invisible":e.visibility="hidden";break;case"hidden":case"inactive":e.display="none"}},hAlign(A,e){if("para"===A[tI])switch(A.hAlign){case"justifyAll":e.textAlign="justify-all";break;case"radix":e.textAlign="left";break;default:e.textAlign=A.hAlign}else switch(A.hAlign){case"left":e.alignSelf="start";break;case"center":e.alignSelf="center";break;case"right":e.alignSelf="end"}},margin(A,e){A.margin&&(e.margin=A.margin[mI]().margin)}};function bc(A,e){"position"===A[Jo]().layout&&(A.minW>0&&(e.minWidth=wc(A.minW)),A.maxW>0&&(e.maxWidth=wc(A.maxW)),A.minH>0&&(e.minHeight=wc(A.minH)),A.maxH>0&&(e.maxHeight=wc(A.maxH)))}function kc(A,e,t,i,a,s){const n=new KI(e,t,i,a);return"string"==typeof A?n.addString(A):A[gI](n),n.compute(s)}function Fc(A,e){let t=null,i=null,a=!1;if((!A.w||!A.h)&&A.value){let s=0,n=0;A.margin&&(s=A.margin.leftInset+A.margin.rightInset,n=A.margin.topInset+A.margin.bottomInset);let g=null,r=null;A.para&&(r=Object.create(null),g=""===A.para.lineHeight?null:A.para.lineHeight,r.top=""===A.para.spaceAbove?0:A.para.spaceAbove,r.bottom=""===A.para.spaceBelow?0:A.para.spaceBelow,r.left=""===A.para.marginLeft?0:A.para.marginLeft,r.right=""===A.para.marginRight?0:A.para.marginRight);let o=A.font;if(!o){const e=A[Yo]();let t=A[Ho]();for(;t&&t!==e;){if(t.font){o=t.font;break}t=t[Ho]()}}const I=(A.w||e.width)-s,c=A[vo].fontFinder;if(A.value.exData&&A.value.exData[uo]&&"text/html"===A.value.exData.contentType){const e=kc(A.value.exData[uo],o,r,g,c,I);i=e.width,t=e.height,a=e.isBroken}else{const e=A.value[uI]();if(e){const A=kc(e,o,r,g,c,I);i=A.width,t=A.height,a=A.isBroken}}null===i||A.w||(i+=s),null===t||A.h||(t+=n)}return{w:i,h:t,isBroken:a}}function Sc(A,e,t){let i;if(""!==A.w&&""!==A.h)i=[A.x,A.y,A.w,A.h];else{if(!t)return null;let a=A.w;if(""===a){if(0===A.maxW){const e=A[Jo]();a="position"===e.layout&&""!==e.w?0:A.minW}else a=Math.min(A.maxW,t.width);e.attributes.style.width=wc(a)}let s=A.h;if(""===s){if(0===A.maxH){const e=A[Jo]();s="position"===e.layout&&""!==e.h?0:A.minH}else s=Math.min(A.maxH,t.height);e.attributes.style.height=wc(s)}i=[A.x,A.y,a,s]}return i}function Rc(A){const e=A[Jo]();if(e.layout?.includes("row")){const t=e[mo],i=A.colSpan;let a;a=-1===i?t.columnWidths.slice(t.currentColumn).reduce(((A,e)=>A+e),0):t.columnWidths.slice(t.currentColumn,t.currentColumn+i).reduce(((A,e)=>A+e),0),isNaN(a)||(A.w=a)}e.layout&&"position"!==e.layout&&(A.x=A.y=0),"table"===A.layout&&""===A.w&&Array.isArray(A.columnWidths)&&(A.w=A.columnWidths.reduce(((A,e)=>A+e),0))}function Gc(A){switch(A.layout){case"position":default:return"xfaPosition";case"lr-tb":return"xfaLrTb";case"rl-row":return"xfaRlRow";case"rl-tb":return"xfaRlTb";case"row":return"xfaRow";case"table":return"xfaTable";case"tb":return"xfaTb"}}function Nc(A,...e){const t=Object.create(null);for(const i of e){const e=A[i];if(null!==e)if(Dc.hasOwnProperty(i))Dc[i](A,t);else if(e instanceof hc){const A=e[mI]();A?Object.assign(t,A):R(`(DEBUG) - XFA - style for ${i} not implemented yet`)}}return t}function xc(A,e){const{attributes:t}=e,{style:i}=t,a={name:"div",attributes:{class:["xfaWrapper"],style:Object.create(null)},children:[]};if(t.class.push("xfaWrapped"),A.border){const{widths:t,insets:s}=A.border[mo];let n,g,r=s[0],o=s[3];const I=s[0]+s[2],c=s[1]+s[3];switch(A.border.hand){case"even":r-=t[0]/2,o-=t[3]/2,n=`calc(100% + ${(t[1]+t[3])/2-c}px)`,g=`calc(100% + ${(t[0]+t[2])/2-I}px)`;break;case"left":r-=t[0],o-=t[3],n=`calc(100% + ${t[1]+t[3]-c}px)`,g=`calc(100% + ${t[0]+t[2]-I}px)`;break;case"right":n=c?`calc(100% - ${c}px)`:"100%",g=I?`calc(100% - ${I}px)`:"100%"}const C=["xfaBorder"];Lc(A.border)&&C.push("xfaPrintOnly");const B={name:"div",attributes:{class:C,style:{top:`${r}px`,left:`${o}px`,width:n,height:g}},children:[]};for(const A of["border","borderWidth","borderColor","borderRadius","borderStyle"])void 0!==i[A]&&(B.attributes.style[A]=i[A],delete i[A]);a.children.push(B,e)}else a.children.push(e);for(const A of["background","backgroundClip","top","left","width","height","minWidth","minHeight","maxWidth","maxHeight","transform","transformOrigin","visibility"])void 0!==i[A]&&(a.attributes.style[A]=i[A],delete i[A]);return a.attributes.style.position="absolute"===i.position?"absolute":"relative",delete i.position,i.alignSelf&&(a.attributes.style.alignSelf=i.alignSelf,delete i.alignSelf),a}function Uc(A){const e=xI(A.textIndent,"0px");if(e>=0)return;const t="padding"+("left"==("right"===A.textAlign?"right":"left")?"Left":"Right"),i=xI(A[t],"0px");A[t]=i-e+"px"}function Mc(A,e){switch(A.access){case"nonInteractive":e.push("xfaNonInteractive");break;case"readOnly":e.push("xfaReadOnly");break;case"protected":e.push("xfaDisabled")}}function Lc(A){return A.relevant.length>0&&!A.relevant[0].excluded&&"print"===A.relevant[0].viewname}function Jc(A){const e=A[Yo]()[mo].paraStack;return e.length?e.at(-1):null}function Hc(A,e,t){if(t.attributes.class?.includes("xfaRich")){e&&(""===A.h&&(e.height="auto"),""===A.w&&(e.width="auto"));const i=Jc(A);if(i){const A=t.attributes.style;switch(A.display="flex",A.flexDirection="column",i.vAlign){case"top":A.justifyContent="start";break;case"bottom":A.justifyContent="end";break;case"middle":A.justifyContent="center"}const e=i[mI]();for(const[t,i]of Object.entries(e))t in A||(A[t]=i)}}}function Yc(A,e,t,i){if(!t)return void delete i.fontFamily;const a=FI(A.typeface);i.fontFamily=`"${a}"`;const s=t.find(a);if(s){const{fontFamily:t}=s.regular.cssFontInfo;t!==a&&(i.fontFamily=`"${t}"`);const n=Jc(e);if(n&&""!==n.lineHeight)return;if(i.lineHeight)return;const g=HI(A,s);g&&(i.lineHeight=Math.max(1.2,g.lineHeight))}}function vc(A){const e=x(A,null,{addDefaultProtocol:!0,tryConvertEncoding:!0});return e?e.href:null}function Kc(A,e){return{name:"div",attributes:{class:["lr-tb"===A.layout?"xfaLr":"xfaRl"]},children:e}}function qc(A){if(!A[mo])return null;const e={name:"div",attributes:A[mo].attributes,children:A[mo].children};if(A[mo].failingNode){const t=A[mo].failingNode[wo]();t&&(A.layout.endsWith("-tb")?e.children.push(Kc(A,[t])):e.children.push(t))}return 0===e.children.length?null:e}function Tc(A,e,t){const i=A[mo],a=i.availableSpace,[s,n,g,r]=t;switch(A.layout){case"position":i.width=Math.max(i.width,s+g),i.height=Math.max(i.height,n+r),i.children.push(e);break;case"lr-tb":case"rl-tb":i.line&&1!==i.attempt||(i.line=Kc(A,[]),i.children.push(i.line),i.numberInLine=0),i.numberInLine+=1,i.line.children.push(e),0===i.attempt?(i.currentWidth+=g,i.height=Math.max(i.height,i.prevHeight+r)):(i.currentWidth=g,i.prevHeight=i.height,i.height+=r,i.attempt=0),i.width=Math.max(i.width,i.currentWidth);break;case"rl-row":case"row":{i.children.push(e),i.width+=g,i.height=Math.max(i.height,r);const A=wc(i.height);for(const e of i.children)e.attributes.style.height=A;break}case"table":case"tb":i.width=Math.min(a.width,Math.max(i.width,g)),i.height+=r,i.children.push(e)}}function Pc(A){const e=A[mo].availableSpace,t=A.margin?A.margin.topInset+A.margin.bottomInset:0,i=A.margin?A.margin.leftInset+A.margin.rightInset:0;switch(A.layout){case"lr-tb":case"rl-tb":return 0===A[mo].attempt?{width:e.width-i-A[mo].currentWidth,height:e.height-t-A[mo].prevHeight}:{width:e.width-i,height:e.height-t-A[mo].height};case"rl-row":case"row":return{width:A[mo].columnWidths.slice(A[mo].currentColumn).reduce(((A,e)=>A+e)),height:e.height-i};case"table":case"tb":return{width:e.width-i,height:e.height-t-A[mo].height};default:return e}}function Wc(A,e){if(null===A[Yo]()[mo].firstUnsplittable)return!0;if(0===A.w||0===A.h)return!0;const t=A[Jo](),i=t[mo]?.attempt||0,[,a,s,n]=function(A){let e,t,i=""===A.w?NaN:A.w,a=""===A.h?NaN:A.h,[s,n]=[0,0];switch(A.anchorType||""){case"bottomCenter":[s,n]=[i/2,a];break;case"bottomLeft":[s,n]=[0,a];break;case"bottomRight":[s,n]=[i,a];break;case"middleCenter":[s,n]=[i/2,a/2];break;case"middleLeft":[s,n]=[0,a/2];break;case"middleRight":[s,n]=[i,a/2];break;case"topCenter":[s,n]=[i/2,0];break;case"topRight":[s,n]=[i,0]}switch(A.rotate||0){case 0:[e,t]=[-s,-n];break;case 90:[e,t]=[-n,s],[i,a]=[a,-i];break;case 180:[e,t]=[s,n],[i,a]=[-i,-a];break;case 270:[e,t]=[n,-s],[i,a]=[-a,i]}return[A.x+e+Math.min(0,i),A.y+t+Math.min(0,a),Math.abs(i),Math.abs(a)]}(A);switch(t.layout){case"lr-tb":case"rl-tb":return 0===i?A[Yo]()[mo].noLayoutFailure?""!==A.w?Math.round(s-e.width)<=2:e.width>2:!(""!==A.h&&Math.round(n-e.height)>2)&&(""!==A.w?Math.round(s-e.width)<=2||0===t[mo].numberInLine&&e.height>2:e.width>2):!!A[Yo]()[mo].noLayoutFailure||!(""!==A.h&&Math.round(n-e.height)>2)&&(""===A.w||Math.round(s-e.width)<=2||!t[zo]())&&e.height>2;case"table":case"tb":return!!A[Yo]()[mo].noLayoutFailure||(""===A.h||A[jo]()?(""===A.w||Math.round(s-e.width)<=2||!t[zo]())&&e.height>2:Math.round(n-e.height)<=2);case"position":return!!A[Yo]()[mo].noLayoutFailure||(""===A.h||Math.round(n+a-e.height)<=2||n+a>A[Yo]()[mo].currentContentArea.h);case"rl-row":case"row":return!!A[Yo]()[mo].noLayoutFailure||""===A.h||Math.round(n-e.height)<=2;default:return!0}}const Zc=DI.template.id,Oc="http://www.w3.org/2000/svg",Xc=/^H(\d+)$/,Vc=new Set(["image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/apng","image/x-png","image/bmp","image/x-ms-bmp","image/tiff","image/tif","application/octet-stream"]),jc=[[[66,77],"image/bmp"],[[255,216,255],"image/jpeg"],[[73,73,42,0],"image/tiff"],[[77,77,0,42],"image/tiff"],[[71,73,70,56,57,97],"image/gif"],[[137,80,78,71,13,10,26,10],"image/png"]];function zc(A){if(!A||!A.border)return{w:0,h:0};const e=A.border[No]();return e?{w:e.widths[0]+e.widths[2]+e.insets[0]+e.insets[2],h:e.widths[1]+e.widths[3]+e.insets[1]+e.insets[3]}:{w:0,h:0}}function _c(A){return A.margin&&(A.margin.topInset||A.margin.rightInset||A.margin.bottomInset||A.margin.leftInset)}function $c(A,e){if(!A.value){const e=new Bh({});A[co](e),A.value=e}A.value[lI](e)}function*AC(A){for(const e of A[Uo]())e instanceof $B?yield*e[Mo]():yield e}function eC(A){return"error"===A.validate?.nullTest}function tC(A){for(;A;){if(!A.traversal)return void(A[EI]=A[Ho]()[EI]);if(A[EI])return;let e=null;for(const t of A.traversal[Uo]())if("next"===t.operation){e=t;break}if(!e||!e.ref)return void(A[EI]=A[Ho]()[EI]);const t=A[Yo]();A[EI]=++t[EI];const i=t[BI](e.ref,A);if(!i)return;A=i[0]}}function iC(A,e){const t=A.assist;if(t){const A=t[fI]();A&&(e.title=A);const i=t.role.match(Xc);if(i){const A="heading",t=i[1];e.role=A,e["aria-level"]=t}}if("table"===A.layout)e.role="table";else if("row"===A.layout)e.role="row";else{const t=A[Ho]();"row"===t.layout&&(e.role="TH"===t.assist?.role?"columnheader":"cell")}}function aC(A){if(!A.assist)return null;const e=A.assist;return e.speak&&""!==e.speak[uo]?e.speak[uo]:e.toolTip?e.toolTip[uo]:null}function sC(A){return LI.success({name:"div",attributes:{class:["xfaRich"],style:Object.create(null)},children:[{name:"span",attributes:{style:Object.create(null)},value:A}]})}function nC(A){const e=A[Yo]();null===e[mo].firstUnsplittable&&(e[mo].firstUnsplittable=A,e[mo].noLayoutFailure=!0)}function gC(A){const e=A[Yo]();e[mo].firstUnsplittable===A&&(e[mo].noLayoutFailure=!1)}function rC(A){if(A[mo])return!1;if(A[mo]=Object.create(null),"auto"===A.targetType)return!1;const e=A[Yo]();let t=null;if(A.target){if(t=e[BI](A.target,A[Ho]()),!t)return!1;t=t[0]}const{currentPageArea:i,currentContentArea:a}=e[mo];if("pageArea"===A.targetType)return t instanceof NB||(t=null),A.startNew?(A[mo].target=t||i,!0):!(!t||t===i||(A[mo].target=t,0));t instanceof xC||(t=null);const s=t&&t[Ho]();let n,g=s;if(A.startNew)if(t){const A=s.contentArea.children,e=A.indexOf(a),i=A.indexOf(t);-1!==e&&eA,i[mo].noLayoutFailure=!0;const n=e[fI](t);A[Io](n.html,n.bbox),i[mo].noLayoutFailure=a,e[Jo]=s}class IC extends fc{constructor(A){super(Zc,"appearanceFilter"),this.id=A.id||"",this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class cC extends hc{constructor(A){super(Zc,"arc",!0),this.circular=SI({data:A.circular,defaultValue:0,validate:A=>1===A}),this.hand=NI(A.hand,["even","left","right"]),this.id=A.id||"",this.startAngle=RI({data:A.startAngle,defaultValue:0,validate:A=>!0}),this.sweepAngle=RI({data:A.sweepAngle,defaultValue:360,validate:A=>!0}),this.use=A.use||"",this.usehref=A.usehref||"",this.edge=null,this.fill=null}[fI](){const A=this.edge||new PC({}),e=A[mI](),t=Object.create(null);let i;"visible"===this.fill?.presence?Object.assign(t,this.fill[mI]()):t.fill="transparent",t.strokeWidth=wc("visible"===A.presence?A.thickness:0),t.stroke=e.color;const a={xmlns:Oc,style:{width:"100%",height:"100%",overflow:"visible"}};if(360===this.sweepAngle)i={name:"ellipse",attributes:{xmlns:Oc,cx:"50%",cy:"50%",rx:"50%",ry:"50%",style:t}};else{const A=this.startAngle*Math.PI/180,e=this.sweepAngle*Math.PI/180,s=this.sweepAngle>180?1:0,[n,g,r,o]=[50*(1+Math.cos(A)),50*(1-Math.sin(A)),50*(1+Math.cos(A+e)),50*(1-Math.sin(A+e))];i={name:"path",attributes:{xmlns:Oc,d:`M ${n} ${g} A 50 50 0 ${s} 0 ${r} ${o}`,vectorEffect:"non-scaling-stroke",style:t}},Object.assign(a,{viewBox:"0 0 100 100",preserveAspectRatio:"none"})}const s={name:"svg",children:[i],attributes:a};return _c(this[Ho]()[Ho]())?LI.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[s]}):(s.attributes.style.position="absolute",LI.success(s))}}class CC extends hc{constructor(A){super(Zc,"area",!0),this.colSpan=SI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.id=A.id||"",this.name=A.name||"",this.relevant=MI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.x=xI(A.x,"0pt"),this.y=xI(A.y,"0pt"),this.desc=null,this.extras=null,this.area=new Qc,this.draw=new Qc,this.exObject=new Qc,this.exclGroup=new Qc,this.field=new Qc,this.subform=new Qc,this.subformSet=new Qc}*[Mo](){yield*AC(this)}[_o](){return!0}[Zo](){return!0}[Io](A,e){const[t,i,a,s]=e;this[mo].width=Math.max(this[mo].width,t+a),this[mo].height=Math.max(this[mo].height,i+s),this[mo].children.push(A)}[ko](){return this[mo].availableSpace}[fI](A){const e=Nc(this,"position"),t={style:e,id:this[yI],class:["xfaArea"]};Lc(this)&&t.class.push("xfaPrintOnly"),this.name&&(t.xfaName=this.name);const i=[];this[mo]={children:i,width:0,height:0,availableSpace:A};const a=this[Co]({filter:new Set(["area","draw","field","exclGroup","subform","subformSet"]),include:!0});if(!a.success)return a.isBreak()?a:(delete this[mo],LI.FAILURE);e.width=wc(this[mo].width),e.height=wc(this[mo].height);const s={name:"div",attributes:t,children:i},n=[this.x,this.y,this[mo].width,this[mo].height];return delete this[mo],LI.success(s,n)}}class BC extends hc{constructor(A){super(Zc,"assist",!0),this.id=A.id||"",this.role=A.role||"",this.use=A.use||"",this.usehref=A.usehref||"",this.speak=null,this.toolTip=null}[fI](){return this.toolTip?.[uo]||null}}class hC extends hc{constructor(A){super(Zc,"barcode",!0),this.charEncoding=GI({data:A.charEncoding?A.charEncoding.toLowerCase():"",defaultValue:"",validate:A=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(A)||A.match(/iso-8859-\d{2}/)}),this.checksum=NI(A.checksum,["none","1mod10","1mod10_1mod11","2mod10","auto"]),this.dataColumnCount=SI({data:A.dataColumnCount,defaultValue:-1,validate:A=>A>=0}),this.dataLength=SI({data:A.dataLength,defaultValue:-1,validate:A=>A>=0}),this.dataPrep=NI(A.dataPrep,["none","flateCompress"]),this.dataRowCount=SI({data:A.dataRowCount,defaultValue:-1,validate:A=>A>=0}),this.endChar=A.endChar||"",this.errorCorrectionLevel=SI({data:A.errorCorrectionLevel,defaultValue:-1,validate:A=>A>=0&&A<=8}),this.id=A.id||"",this.moduleHeight=xI(A.moduleHeight,"5mm"),this.moduleWidth=xI(A.moduleWidth,"0.25mm"),this.printCheckDigit=SI({data:A.printCheckDigit,defaultValue:0,validate:A=>1===A}),this.rowColumnRatio=UI(A.rowColumnRatio),this.startChar=A.startChar||"",this.textLocation=NI(A.textLocation,["below","above","aboveEmbedded","belowEmbedded","none"]),this.truncate=SI({data:A.truncate,defaultValue:0,validate:A=>1===A}),this.type=NI(A.type?A.type.toLowerCase():"",["aztec","codabar","code2of5industrial","code2of5interleaved","code2of5matrix","code2of5standard","code3of9","code3of9extended","code11","code49","code93","code128","code128a","code128b","code128c","code128sscc","datamatrix","ean8","ean8add2","ean8add5","ean13","ean13add2","ean13add5","ean13pwcd","fim","logmars","maxicode","msi","pdf417","pdf417macro","plessey","postauscust2","postauscust3","postausreplypaid","postausstandard","postukrm4scc","postusdpbc","postusimb","postusstandard","postus5zip","qrcode","rfid","rss14","rss14expanded","rss14limited","rss14stacked","rss14stackedomni","rss14truncated","telepen","ucc128","ucc128random","ucc128sscc","upca","upcaadd2","upcaadd5","upcapwcd","upce","upceadd2","upceadd5","upcean2","upcean5","upsmaxicode"]),this.upsMode=NI(A.upsMode,["usCarrier","internationalCarrier","secureSymbol","standardSymbol"]),this.use=A.use||"",this.usehref=A.usehref||"",this.wideNarrowRatio=UI(A.wideNarrowRatio),this.encrypt=null,this.extras=null}}class QC extends hc{constructor(A){super(Zc,"bind",!0),this.match=NI(A.match,["once","dataRef","global","none"]),this.ref=A.ref||"",this.picture=null}}class lC extends hc{constructor(A){super(Zc,"bindItems"),this.connection=A.connection||"",this.labelRef=A.labelRef||"",this.ref=A.ref||"",this.valueRef=A.valueRef||""}}class EC extends hc{constructor(A){super(Zc,"bookend"),this.id=A.id||"",this.leader=A.leader||"",this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||""}}class uC extends mc{constructor(A){super(Zc,"boolean"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[fI](A){return sC(1===this[uo]?"1":"0")}}class dC extends hc{constructor(A){super(Zc,"border",!0),this.break=NI(A.break,["close","open"]),this.hand=NI(A.hand,["even","left","right"]),this.id=A.id||"",this.presence=NI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=MI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.corner=new Qc(4),this.edge=new Qc(4),this.extras=null,this.fill=null,this.margin=null}[No](){if(!this[mo]){const A=this.edge.children.slice();if(A.length<4){const e=A.at(-1)||new PC({});for(let t=A.length;t<4;t++)A.push(e)}const e=A.map((A=>A.thickness)),t=[0,0,0,0];this.margin&&(t[0]=this.margin.topInset,t[1]=this.margin.rightInset,t[2]=this.margin.bottomInset,t[3]=this.margin.leftInset),this[mo]={widths:e,insets:t,edges:A}}return this[mo]}[mI](){const{edges:A}=this[No](),e=A.map((A=>{const e=A[mI]();return e.color||="#000000",e})),t=Object.create(null);if(this.margin&&Object.assign(t,this.margin[mI]()),"visible"===this.fill?.presence&&Object.assign(t,this.fill[mI]()),this.corner.children.some((A=>0!==A.radius))){const A=this.corner.children.map((A=>A[mI]()));if(2===A.length||3===A.length){const e=A.at(-1);for(let t=A.length;t<4;t++)A.push(e)}t.borderRadius=A.map((A=>A.radius)).join(" ")}switch(this.presence){case"invisible":case"hidden":t.borderStyle="";break;case"inactive":t.borderStyle="none";break;default:t.borderStyle=e.map((A=>A.style)).join(" ")}return t.borderWidth=e.map((A=>A.width)).join(" "),t.borderColor=e.map((A=>A.color)).join(" "),t}}class fC extends hc{constructor(A){super(Zc,"break",!0),this.after=NI(A.after,["auto","contentArea","pageArea","pageEven","pageOdd"]),this.afterTarget=A.afterTarget||"",this.before=NI(A.before,["auto","contentArea","pageArea","pageEven","pageOdd"]),this.beforeTarget=A.beforeTarget||"",this.bookendLeader=A.bookendLeader||"",this.bookendTrailer=A.bookendTrailer||"",this.id=A.id||"",this.overflowLeader=A.overflowLeader||"",this.overflowTarget=A.overflowTarget||"",this.overflowTrailer=A.overflowTrailer||"",this.startNew=SI({data:A.startNew,defaultValue:0,validate:A=>1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}}class pC extends hc{constructor(A){super(Zc,"breakAfter",!0),this.id=A.id||"",this.leader=A.leader||"",this.startNew=SI({data:A.startNew,defaultValue:0,validate:A=>1===A}),this.target=A.target||"",this.targetType=NI(A.targetType,["auto","contentArea","pageArea"]),this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||"",this.script=null}}class mC extends hc{constructor(A){super(Zc,"breakBefore",!0),this.id=A.id||"",this.leader=A.leader||"",this.startNew=SI({data:A.startNew,defaultValue:0,validate:A=>1===A}),this.target=A.target||"",this.targetType=NI(A.targetType,["auto","contentArea","pageArea"]),this.trailer=A.trailer||"",this.use=A.use||"",this.usehref=A.usehref||"",this.script=null}[fI](A){return this[mo]={},LI.FAILURE}}class yC extends hc{constructor(A){super(Zc,"button",!0),this.highlight=NI(A.highlight,["inverted","none","outline","push"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[fI](A){const e=this[Ho]()[Ho](),t={name:"button",attributes:{id:this[yI],class:["xfaButton"],style:{}},children:[]};for(const A of e.event.children){if("click"!==A.activity||!A.script)continue;const e=jA(A.script[uo]);if(!e)continue;const i=vc(e.url);i&&t.children.push({name:"a",attributes:{id:"link"+this[yI],href:i,newWindow:e.newWindow,class:["xfaLink"],style:{}},children:[]})}return LI.success(t)}}class wC extends hc{constructor(A){super(Zc,"calculate",!0),this.id=A.id||"",this.override=NI(A.override,["disabled","error","ignore","warning"]),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.message=null,this.script=null}}class DC extends hc{constructor(A){super(Zc,"caption",!0),this.id=A.id||"",this.placement=NI(A.placement,["left","bottom","inline","right","top"]),this.presence=NI(A.presence,["visible","hidden","inactive","invisible"]),this.reserve=Math.ceil(xI(A.reserve)),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.font=null,this.margin=null,this.para=null,this.value=null}[lI](A){$c(this,A)}[No](A){if(!this[mo]){let{width:e,height:t}=A;switch(this.placement){case"left":case"right":case"inline":e=this.reserve<=0?e:this.reserve;break;case"top":case"bottom":t=this.reserve<=0?t:this.reserve}this[mo]=Fc(this,{width:e,height:t})}return this[mo]}[fI](A){if(!this.value)return LI.EMPTY;this[oI]();const e=this.value[fI](A).html;if(!e)return this[rI](),LI.EMPTY;const t=this.reserve;if(this.reserve<=0){const{w:e,h:t}=this[No](A);switch(this.placement){case"left":case"right":case"inline":this.reserve=e;break;case"top":case"bottom":this.reserve=t}}const i=[];"string"==typeof e?i.push({name:"#text",value:e}):i.push(e);const a=Nc(this,"font","margin","visibility");switch(this.placement){case"left":case"right":this.reserve>0&&(a.width=wc(this.reserve));break;case"top":case"bottom":this.reserve>0&&(a.height=wc(this.reserve))}return Hc(this,null,e),this[rI](),this.reserve=t,LI.success({name:"div",attributes:{style:a,class:["xfaCaption"]},children:i})}}class bC extends fc{constructor(A){super(Zc,"certificate"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class kC extends hc{constructor(A){super(Zc,"certificates",!0),this.credentialServerPolicy=NI(A.credentialServerPolicy,["optional","required"]),this.id=A.id||"",this.url=A.url||"",this.urlPolicy=A.urlPolicy||"",this.use=A.use||"",this.usehref=A.usehref||"",this.encryption=null,this.issuers=null,this.keyUsage=null,this.oids=null,this.signing=null,this.subjectDNs=null}}class FC extends hc{constructor(A){super(Zc,"checkButton",!0),this.id=A.id||"",this.mark=NI(A.mark,["default","check","circle","cross","diamond","square","star"]),this.shape=NI(A.shape,["square","round"]),this.size=xI(A.size,"10pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[fI](A){const e=Nc("margin"),t=wc(this.size);let i,a,s;e.width=e.height=t;const n=this[Ho]()[Ho](),g=n.items.children.length&&n.items.children[0][fI]().html||[],r={on:(void 0!==g[0]?g[0]:"on").toString(),off:(void 0!==g[1]?g[1]:"off").toString()},o=(n.value?.[uI]()||"off")===r.on||void 0,I=n[Jo](),c=n[yI];let C;I instanceof eB?(s=I[yI],i="radio",a="xfaRadio",C=I[fo]?.[yI]||I[yI]):(i="checkbox",a="xfaCheckbox",C=n[fo]?.[yI]||n[yI]);const B={name:"input",attributes:{class:[a],style:e,fieldId:c,dataId:C,type:i,checked:o,xfaOn:r.on,xfaOff:r.off,"aria-label":aC(n),"aria-required":!1}};return s&&(B.attributes.name=s),eC(n)&&(B.attributes["aria-required"]=!0,B.attributes.required=!0),LI.success({name:"label",attributes:{class:["xfaLabel"]},children:[B]})}}class SC extends hc{constructor(A){super(Zc,"choiceList",!0),this.commitOn=NI(A.commitOn,["select","exit"]),this.id=A.id||"",this.open=NI(A.open,["userControl","always","multiSelect","onEntry"]),this.textEntry=SI({data:A.textEntry,defaultValue:0,validate:A=>1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[fI](A){const e=Nc(this,"border","margin"),t=this[Ho]()[Ho](),i={fontSize:`calc(${t.font?.size||10}px * var(--scale-factor))`},a=[];if(t.items.children.length>0){const A=t.items;let e=0,s=0;2===A.children.length&&(e=A.children[0].save,s=1-e);const n=A.children[e][fI]().html,g=A.children[s][fI]().html;let r=!1;const o=t.value?.[uI]()||"";for(let A=0,e=n.length;AMath.min(Math.max(0,parseInt(A.trim(),10)),255))).map((A=>isNaN(A)?0:A));return s.length<3||([t,i,a]=s),{r:t,g:i,b:a}}(A.value):"",this.extras=null}[Ko](){return!1}[mI](){return this.value?V.makeHexColor(this.value.r,this.value.g,this.value.b):null}}class GC extends hc{constructor(A){super(Zc,"comb"),this.id=A.id||"",this.numberOfCells=SI({data:A.numberOfCells,defaultValue:0,validate:A=>A>=0}),this.use=A.use||"",this.usehref=A.usehref||""}}class NC extends hc{constructor(A){super(Zc,"connect",!0),this.connection=A.connection||"",this.id=A.id||"",this.ref=A.ref||"",this.usage=NI(A.usage,["exportAndImport","exportOnly","importOnly"]),this.use=A.use||"",this.usehref=A.usehref||"",this.picture=null}}class xC extends hc{constructor(A){super(Zc,"contentArea",!0),this.h=xI(A.h),this.id=A.id||"",this.name=A.name||"",this.relevant=MI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.w=xI(A.w),this.x=xI(A.x,"0pt"),this.y=xI(A.y,"0pt"),this.desc=null,this.extras=null}[fI](A){const e={left:wc(this.x),top:wc(this.y),width:wc(this.w),height:wc(this.h)},t=["xfaContentarea"];return Lc(this)&&t.push("xfaPrintOnly"),LI.success({name:"div",children:[],attributes:{style:e,class:t,id:this[yI]}})}}class UC extends hc{constructor(A){super(Zc,"corner",!0),this.id=A.id||"",this.inverted=SI({data:A.inverted,defaultValue:0,validate:A=>1===A}),this.join=NI(A.join,["square","round"]),this.presence=NI(A.presence,["visible","hidden","inactive","invisible"]),this.radius=xI(A.radius),this.stroke=NI(A.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]),this.thickness=xI(A.thickness,"0.5pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[mI](){const A=Nc(this,"visibility");return A.radius=wc("square"===this.join?0:this.radius),A}}class MC extends uc{constructor(A){super(Zc,"date"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[yo](){const A=this[uo].trim();this[uo]=A?new Date(A):null}[fI](A){return sC(this[uo]?this[uo].toString():"")}}class LC extends uc{constructor(A){super(Zc,"dateTime"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[yo](){const A=this[uo].trim();this[uo]=A?new Date(A):null}[fI](A){return sC(this[uo]?this[uo].toString():"")}}class JC extends hc{constructor(A){super(Zc,"dateTimeEdit",!0),this.hScrollPolicy=NI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.picker=NI(A.picker,["host","none"]),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.comb=null,this.extras=null,this.margin=null}[fI](A){const e=Nc(this,"border","font","margin"),t=this[Ho]()[Ho](),i={name:"input",attributes:{type:"text",fieldId:t[yI],dataId:t[fo]?.[yI]||t[yI],class:["xfaTextfield"],style:e,"aria-label":aC(t),"aria-required":!1}};return eC(t)&&(i.attributes["aria-required"]=!0,i.attributes.required=!0),LI.success({name:"label",attributes:{class:["xfaLabel"]},children:[i]})}}class HC extends uc{constructor(A){super(Zc,"decimal"),this.fracDigits=SI({data:A.fracDigits,defaultValue:2,validate:A=>!0}),this.id=A.id||"",this.leadDigits=SI({data:A.leadDigits,defaultValue:-1,validate:A=>!0}),this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[yo](){const A=parseFloat(this[uo].trim());this[uo]=isNaN(A)?null:A}[fI](A){return sC(null!==this[uo]?this[uo].toString():"")}}class YC extends hc{constructor(A){super(Zc,"defaultUi",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}}class vC extends hc{constructor(A){super(Zc,"desc",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new Qc,this.date=new Qc,this.dateTime=new Qc,this.decimal=new Qc,this.exData=new Qc,this.float=new Qc,this.image=new Qc,this.integer=new Qc,this.text=new Qc,this.time=new Qc}}class KC extends dc{constructor(A){super(Zc,"digestMethod",["","SHA1","SHA256","SHA512","RIPEMD160"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class qC extends hc{constructor(A){super(Zc,"digestMethods",!0),this.id=A.id||"",this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.digestMethod=new Qc}}class TC extends hc{constructor(A){super(Zc,"draw",!0),this.anchorType=NI(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=SI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.h=A.h?xI(A.h):"",this.hAlign=NI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.locale=A.locale||"",this.maxH=xI(A.maxH,"0pt"),this.maxW=xI(A.maxW,"0pt"),this.minH=xI(A.minH,"0pt"),this.minW=xI(A.minW,"0pt"),this.name=A.name||"",this.presence=NI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=MI(A.relevant),this.rotate=SI({data:A.rotate,defaultValue:0,validate:A=>A%90==0}),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?xI(A.w):"",this.x=xI(A.x,"0pt"),this.y=xI(A.y,"0pt"),this.assist=null,this.border=null,this.caption=null,this.desc=null,this.extras=null,this.font=null,this.keep=null,this.margin=null,this.para=null,this.traversal=null,this.ui=null,this.value=null,this.setProperty=new Qc}[lI](A){$c(this,A)}[fI](A){if(tC(this),"hidden"===this.presence||"inactive"===this.presence)return LI.EMPTY;Rc(this),this[oI]();const e=this.w,t=this.h,{w:i,h:a,isBroken:s}=Fc(this,A);if(i&&""===this.w){if(s&&this[Jo]()[zo]())return this[rI](),LI.FAILURE;this.w=i}if(a&&""===this.h&&(this.h=a),nC(this),!Wc(this,A))return this.w=e,this.h=t,this[rI](),LI.FAILURE;gC(this);const n=Nc(this,"font","hAlign","dimensions","position","presence","rotate","anchorType","border","margin");bc(this,n),n.margin&&(n.padding=n.margin,delete n.margin);const g=["xfaDraw"];this.font&&g.push("xfaFont"),Lc(this)&&g.push("xfaPrintOnly");const r={style:n,id:this[yI],class:g};this.name&&(r.xfaName=this.name);const o={name:"div",attributes:r,children:[]};iC(this,r);const I=Sc(this,o,A),c=this.value?this.value[fI](A).html:null;return null===c?(this.w=e,this.h=t,this[rI](),LI.success(xc(this,o),I)):(o.children.push(c),Hc(this,n,c),this.w=e,this.h=t,this[rI](),LI.success(xc(this,o),I))}}class PC extends hc{constructor(A){super(Zc,"edge",!0),this.cap=NI(A.cap,["square","butt","round"]),this.id=A.id||"",this.presence=NI(A.presence,["visible","hidden","inactive","invisible"]),this.stroke=NI(A.stroke,["solid","dashDot","dashDotDot","dashed","dotted","embossed","etched","lowered","raised"]),this.thickness=xI(A.thickness,"0.5pt"),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[mI](){const A=Nc(this,"visibility");if(Object.assign(A,{linecap:this.cap,width:wc(this.thickness),color:this.color?this.color[mI]():"#000000",style:""}),"visible"!==this.presence)A.style="none";else switch(this.stroke){case"solid":A.style="solid";break;case"dashDot":case"dashDotDot":case"dashed":A.style="dashed";break;case"dotted":A.style="dotted";break;case"embossed":A.style="ridge";break;case"etched":A.style="groove";break;case"lowered":A.style="inset";break;case"raised":A.style="outset"}return A}}class WC extends dc{constructor(A){super(Zc,"encoding",["adbe.x509.rsa_sha1","adbe.pkcs7.detached","adbe.pkcs7.sha1"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class ZC extends hc{constructor(A){super(Zc,"encodings",!0),this.id=A.id||"",this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.encoding=new Qc}}class OC extends hc{constructor(A){super(Zc,"encrypt",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=null}}class XC extends hc{constructor(A){super(Zc,"encryptData",!0),this.id=A.id||"",this.operation=NI(A.operation,["encrypt","decrypt"]),this.target=A.target||"",this.use=A.use||"",this.usehref=A.usehref||"",this.filter=null,this.manifest=null}}class VC extends hc{constructor(A){super(Zc,"encryption",!0),this.id=A.id||"",this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new Qc}}class jC extends dc{constructor(A){super(Zc,"encryptionMethod",["","AES256-CBC","TRIPLEDES-CBC","AES128-CBC","AES192-CBC"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class zC extends hc{constructor(A){super(Zc,"encryptionMethods",!0),this.id=A.id||"",this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.encryptionMethod=new Qc}}class _C extends hc{constructor(A){super(Zc,"event",!0),this.activity=NI(A.activity,["click","change","docClose","docReady","enter","exit","full","indexChange","initialize","mouseDown","mouseEnter","mouseExit","mouseUp","postExecute","postOpen","postPrint","postSave","postSign","postSubmit","preExecute","preOpen","prePrint","preSave","preSign","preSubmit","ready","validationState"]),this.id=A.id||"",this.listen=NI(A.listen,["refOnly","refAndDescendents"]),this.name=A.name||"",this.ref=A.ref||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.encryptData=null,this.execute=null,this.script=null,this.signData=null,this.submit=null}}class $C extends uc{constructor(A){super(Zc,"exData"),this.contentType=A.contentType||"",this.href=A.href||"",this.id=A.id||"",this.maxLength=SI({data:A.maxLength,defaultValue:-1,validate:A=>A>=-1}),this.name=A.name||"",this.rid=A.rid||"",this.transferEncoding=NI(A.transferEncoding,["none","base64","package"]),this.use=A.use||"",this.usehref=A.usehref||""}[Wo](){return"text/html"===this.contentType}[aI](A){return("text/html"===this.contentType&&A[eI]===DI.xhtml.id||"text/xml"===this.contentType)&&(this[uo]=A,!0)}[fI](A){return"text/html"===this.contentType&&this[uo]?this[uo][fI](A):LI.EMPTY}}class AB extends hc{constructor(A){super(Zc,"exObject",!0),this.archive=A.archive||"",this.classId=A.classId||"",this.codeBase=A.codeBase||"",this.codeType=A.codeType||"",this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.boolean=new Qc,this.date=new Qc,this.dateTime=new Qc,this.decimal=new Qc,this.exData=new Qc,this.exObject=new Qc,this.float=new Qc,this.image=new Qc,this.integer=new Qc,this.text=new Qc,this.time=new Qc}}class eB extends hc{constructor(A){super(Zc,"exclGroup",!0),this.access=NI(A.access,["open","nonInteractive","protected","readOnly"]),this.accessKey=A.accessKey||"",this.anchorType=NI(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=SI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.h=A.h?xI(A.h):"",this.hAlign=NI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.layout=NI(A.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]),this.maxH=xI(A.maxH,"0pt"),this.maxW=xI(A.maxW,"0pt"),this.minH=xI(A.minH,"0pt"),this.minW=xI(A.minW,"0pt"),this.name=A.name||"",this.presence=NI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=MI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?xI(A.w):"",this.x=xI(A.x,"0pt"),this.y=xI(A.y,"0pt"),this.assist=null,this.bind=null,this.border=null,this.calculate=null,this.caption=null,this.desc=null,this.extras=null,this.margin=null,this.para=null,this.traversal=null,this.validate=null,this.connect=new Qc,this.event=new Qc,this.field=new Qc,this.setProperty=new Qc}[Zo](){return!0}[Ko](){return!0}[lI](A){for(const e of this.field.children){if(!e.value){const A=new Bh({});e[co](A),e.value=A}e.value[lI](A)}}[zo](){return this.layout.endsWith("-tb")&&0===this[mo].attempt&&this[mo].numberInLine>0||this[Ho]()[zo]()}[jo](){const A=this[Jo]();return!!A[jo]()&&(void 0!==this[mo]._isSplittable?this[mo]._isSplittable:"position"===this.layout||this.layout.includes("row")?(this[mo]._isSplittable=!1,!1):!(A.layout?.endsWith("-tb")&&0!==A[mo].numberInLine||(this[mo]._isSplittable=!0,0)))}[wo](){return qc(this)}[Io](A,e){Tc(this,A,e)}[ko](){return Pc(this)}[fI](A){if(tC(this),"hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return LI.EMPTY;Rc(this);const e=[],t={id:this[yI],class:[]};Mc(this,t.class),this[mo]||(this[mo]=Object.create(null)),Object.assign(this[mo],{children:e,attributes:t,attempt:0,line:null,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,A.width),height:Math.min(this.h||1/0,A.height)},width:0,height:0,prevHeight:0,currentWidth:0});const i=this[jo]();if(i||nC(this),!Wc(this,A))return LI.FAILURE;const a=new Set(["field"]);if(this.layout.includes("row")){const A=this[Jo]().columnWidths;Array.isArray(A)&&A.length>0&&(this[mo].columnWidths=A,this[mo].currentColumn=0)}const s=Nc(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),n=["xfaExclgroup"],g=Gc(this);g&&n.push(g),Lc(this)&&n.push("xfaPrintOnly"),t.style=s,t.class=n,this.name&&(t.xfaName=this.name),this[oI]();const r="lr-tb"===this.layout||"rl-tb"===this.layout,o=r?2:1;for(;this[mo].attemptA>=1||-1===A}),this.h=A.h?xI(A.h):"",this.hAlign=NI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.locale=A.locale||"",this.maxH=xI(A.maxH,"0pt"),this.maxW=xI(A.maxW,"0pt"),this.minH=xI(A.minH,"0pt"),this.minW=xI(A.minW,"0pt"),this.name=A.name||"",this.presence=NI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=MI(A.relevant),this.rotate=SI({data:A.rotate,defaultValue:0,validate:A=>A%90==0}),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?xI(A.w):"",this.x=xI(A.x,"0pt"),this.y=xI(A.y,"0pt"),this.assist=null,this.bind=null,this.border=null,this.calculate=null,this.caption=null,this.desc=null,this.extras=null,this.font=null,this.format=null,this.items=new Qc(2),this.keep=null,this.margin=null,this.para=null,this.traversal=null,this.ui=null,this.validate=null,this.value=null,this.bindItems=new Qc,this.connect=new Qc,this.event=new Qc,this.setProperty=new Qc}[Zo](){return!0}[lI](A){$c(this,A)}[fI](A){if(tC(this),!this.ui){let A;switch(this.ui=new ch({}),this.ui[vo]=this[vo],this[co](this.ui),this.items.children.length){case 0:A=new sh({}),this.ui.textEdit=A;break;case 1:A=new FC({}),this.ui.checkButton=A;break;case 2:A=new SC({}),this.ui.choiceList=A}this.ui[co](A)}if(!this.ui||"hidden"===this.presence||"inactive"===this.presence||0===this.h||0===this.w)return LI.EMPTY;this.caption&&delete this.caption[mo],this[oI]();const e=this.caption?this.caption[fI](A).html:null,t=this.w,i=this.h;let a=0,s=0;this.margin&&(a=this.margin.leftInset+this.margin.rightInset,s=this.margin.topInset+this.margin.bottomInset);let n=null;if(""===this.w||""===this.h){let e=null,t=null,i=0,g=0;if(this.ui.checkButton)i=g=this.ui.checkButton.size;else{const{w:e,h:t}=Fc(this,A);null!==e?(i=e,g=t):g=function(A,e=!1){let t=null;if(A){const e=FI(A.typeface),i=A[vo].fontFinder.find(e);t=HI(A,i)}if(!t)return{lineHeight:12,lineGap:2,lineNoGap:10};const i=A.size||10,a=t.lineHeight?Math.max(e?0:1.2,t.lineHeight):1.2,s=void 0===t.lineGap?.2:t.lineGap;return{lineHeight:a*i,lineGap:s*i,lineNoGap:Math.max(1,a-s)*i}}(this.font,!0).lineNoGap}if(n=zc(this.ui[No]()),i+=n.w,g+=n.h,this.caption){const{w:a,h:s,isBroken:n}=this.caption[No](A);if(n&&this[Jo]()[zo]())return this[rI](),LI.FAILURE;switch(e=a,t=s,this.caption.placement){case"left":case"right":case"inline":e+=i;break;case"top":case"bottom":t+=g}}else e=i,t=g;e&&""===this.w&&(e+=a,this.w=Math.min(this.maxW<=0?1/0:this.maxW,this.minW+1A>=1&&A<=5}),this.appearanceFilter=null,this.certificates=null,this.digestMethods=null,this.encodings=null,this.encryptionMethods=null,this.handler=null,this.lockDocument=null,this.mdp=null,this.reasons=null,this.timeStamp=null}}class gB extends uc{constructor(A){super(Zc,"float"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[yo](){const A=parseFloat(this[uo].trim());this[uo]=isNaN(A)?null:A}[fI](A){return sC(null!==this[uo]?this[uo].toString():"")}}class rB extends hc{constructor(A){super(Zc,"font",!0),this.baselineShift=xI(A.baselineShift),this.fontHorizontalScale=RI({data:A.fontHorizontalScale,defaultValue:100,validate:A=>A>=0}),this.fontVerticalScale=RI({data:A.fontVerticalScale,defaultValue:100,validate:A=>A>=0}),this.id=A.id||"",this.kerningMode=NI(A.kerningMode,["none","pair"]),this.letterSpacing=xI(A.letterSpacing,"0"),this.lineThrough=SI({data:A.lineThrough,defaultValue:0,validate:A=>1===A||2===A}),this.lineThroughPeriod=NI(A.lineThroughPeriod,["all","word"]),this.overline=SI({data:A.overline,defaultValue:0,validate:A=>1===A||2===A}),this.overlinePeriod=NI(A.overlinePeriod,["all","word"]),this.posture=NI(A.posture,["normal","italic"]),this.size=xI(A.size,"10pt"),this.typeface=A.typeface||"Courier",this.underline=SI({data:A.underline,defaultValue:0,validate:A=>1===A||2===A}),this.underlinePeriod=NI(A.underlinePeriod,["all","word"]),this.use=A.use||"",this.usehref=A.usehref||"",this.weight=NI(A.weight,["normal","bold"]),this.extras=null,this.fill=null}[Bo](A){super[Bo](A),this[vo].usedTypefaces.add(this.typeface)}[mI](){const A=Nc(this,"fill"),e=A.color;return e&&("#000000"===e?delete A.color:e.startsWith("#")||(A.background=e,A.backgroundClip="text",A.color="transparent")),this.baselineShift&&(A.verticalAlign=wc(this.baselineShift)),A.fontKerning="none"===this.kerningMode?"none":"normal",A.letterSpacing=wc(this.letterSpacing),0!==this.lineThrough&&(A.textDecoration="line-through",2===this.lineThrough&&(A.textDecorationStyle="double")),0!==this.overline&&(A.textDecoration="overline",2===this.overline&&(A.textDecorationStyle="double")),A.fontStyle=this.posture,A.fontSize=wc(.99*this.size),Yc(this,this,this[vo].fontFinder,A),0!==this.underline&&(A.textDecoration="underline",2===this.underline&&(A.textDecorationStyle="double")),A.fontWeight=this.weight,A}}class oB extends hc{constructor(A){super(Zc,"format",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.picture=null}}class IB extends fc{constructor(A){super(Zc,"handler"),this.id=A.id||"",this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class cB extends hc{constructor(A){super(Zc,"hyphenation"),this.excludeAllCaps=SI({data:A.excludeAllCaps,defaultValue:0,validate:A=>1===A}),this.excludeInitialCap=SI({data:A.excludeInitialCap,defaultValue:0,validate:A=>1===A}),this.hyphenate=SI({data:A.hyphenate,defaultValue:0,validate:A=>1===A}),this.id=A.id||"",this.pushCharacterCount=SI({data:A.pushCharacterCount,defaultValue:3,validate:A=>A>=0}),this.remainCharacterCount=SI({data:A.remainCharacterCount,defaultValue:3,validate:A=>A>=0}),this.use=A.use||"",this.usehref=A.usehref||"",this.wordCharacterCount=SI({data:A.wordCharacterCount,defaultValue:7,validate:A=>A>=0})}}class CB extends fc{constructor(A){super(Zc,"image"),this.aspect=NI(A.aspect,["fit","actual","height","none","width"]),this.contentType=A.contentType||"",this.href=A.href||"",this.id=A.id||"",this.name=A.name||"",this.transferEncoding=NI(A.transferEncoding,["base64","none","package"]),this.use=A.use||"",this.usehref=A.usehref||""}[fI](){if(this.contentType&&!Vc.has(this.contentType.toLowerCase()))return LI.EMPTY;let A=this[vo].images&&this[vo].images.get(this.href);if(!A&&(this.href||!this[uo]))return LI.EMPTY;if(A||"base64"!==this.transferEncoding||(A=P(atob(this[uo]))),!A)return LI.EMPTY;if(!this.contentType){for(const[e,t]of jc)if(A.length>e.length&&e.every(((e,t)=>e===A[t]))){this.contentType=t;break}if(!this.contentType)return LI.EMPTY}const e=new Blob([A],{type:this.contentType});let t;switch(this.aspect){case"fit":case"actual":break;case"height":t={height:"100%",objectFit:"fill"};break;case"none":t={width:"100%",height:"100%",objectFit:"fill"};break;case"width":t={width:"100%",objectFit:"fill"}}const i=this[Ho]();return LI.success({name:"img",attributes:{class:["xfaImage"],style:t,src:URL.createObjectURL(e),alt:i?aC(i[Ho]()):null}})}}class BB extends hc{constructor(A){super(Zc,"imageEdit",!0),this.data=NI(A.data,["link","embed"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}[fI](A){return"embed"===this.data?LI.success({name:"div",children:[],attributes:{}}):LI.EMPTY}}class hB extends uc{constructor(A){super(Zc,"integer"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[yo](){const A=parseInt(this[uo].trim(),10);this[uo]=isNaN(A)?null:A}[fI](A){return sC(null!==this[uo]?this[uo].toString():"")}}class QB extends hc{constructor(A){super(Zc,"issuers",!0),this.id=A.id||"",this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new Qc}}class lB extends hc{constructor(A){super(Zc,"items",!0),this.id=A.id||"",this.name=A.name||"",this.presence=NI(A.presence,["visible","hidden","inactive","invisible"]),this.ref=A.ref||"",this.save=SI({data:A.save,defaultValue:0,validate:A=>1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new Qc,this.date=new Qc,this.dateTime=new Qc,this.decimal=new Qc,this.exData=new Qc,this.float=new Qc,this.image=new Qc,this.integer=new Qc,this.text=new Qc,this.time=new Qc}[fI](){const A=[];for(const e of this[Uo]())A.push(e[uI]());return LI.success(A)}}class EB extends hc{constructor(A){super(Zc,"keep",!0),this.id=A.id||"";const e=["none","contentArea","pageArea"];this.intact=NI(A.intact,e),this.next=NI(A.next,e),this.previous=NI(A.previous,e),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}}class uB extends hc{constructor(A){super(Zc,"keyUsage");const e=["","yes","no"];this.crlSign=NI(A.crlSign,e),this.dataEncipherment=NI(A.dataEncipherment,e),this.decipherOnly=NI(A.decipherOnly,e),this.digitalSignature=NI(A.digitalSignature,e),this.encipherOnly=NI(A.encipherOnly,e),this.id=A.id||"",this.keyAgreement=NI(A.keyAgreement,e),this.keyCertSign=NI(A.keyCertSign,e),this.keyEncipherment=NI(A.keyEncipherment,e),this.nonRepudiation=NI(A.nonRepudiation,e),this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class dB extends hc{constructor(A){super(Zc,"line",!0),this.hand=NI(A.hand,["even","left","right"]),this.id=A.id||"",this.slope=NI(A.slope,["\\","/"]),this.use=A.use||"",this.usehref=A.usehref||"",this.edge=null}[fI](){const A=this[Ho]()[Ho](),e=this.edge||new PC({}),t=e[mI](),i=Object.create(null),a="visible"===e.presence?e.thickness:0;let s,n,g,r;i.strokeWidth=wc(a),i.stroke=t.color;let o="100%",I="100%";A.w<=a?([s,n,g,r]=["50%",0,"50%","100%"],o=i.strokeWidth):A.h<=a?([s,n,g,r]=[0,"50%","100%","50%"],I=i.strokeWidth):"\\"===this.slope?[s,n,g,r]=[0,0,"100%","100%"]:[s,n,g,r]=[0,"100%","100%",0];const c={name:"svg",children:[{name:"line",attributes:{xmlns:Oc,x1:s,y1:n,x2:g,y2:r,style:i}}],attributes:{xmlns:Oc,width:o,height:I,style:{overflow:"visible"}}};return _c(A)?LI.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[c]}):(c.attributes.style.position="absolute",LI.success(c))}}class fB extends hc{constructor(A){super(Zc,"linear",!0),this.id=A.id||"",this.type=NI(A.type,["toRight","toBottom","toLeft","toTop"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[mI](A){return A=A?A[mI]():"#FFFFFF",`linear-gradient(${this.type.replace(/([RBLT])/," $1").toLowerCase()}, ${A}, ${this.color?this.color[mI]():"#000000"})`}}class pB extends uc{constructor(A){super(Zc,"lockDocument"),this.id=A.id||"",this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}[yo](){this[uo]=NI(this[uo],["auto","0","1"])}}class mB extends hc{constructor(A){super(Zc,"manifest",!0),this.action=NI(A.action,["include","all","exclude"]),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.ref=new Qc}}class yB extends hc{constructor(A){super(Zc,"margin",!0),this.bottomInset=xI(A.bottomInset,"0"),this.id=A.id||"",this.leftInset=xI(A.leftInset,"0"),this.rightInset=xI(A.rightInset,"0"),this.topInset=xI(A.topInset,"0"),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[mI](){return{margin:wc(this.topInset)+" "+wc(this.rightInset)+" "+wc(this.bottomInset)+" "+wc(this.leftInset)}}}class wB extends hc{constructor(A){super(Zc,"mdp"),this.id=A.id||"",this.permissions=SI({data:A.permissions,defaultValue:2,validate:A=>1===A||3===A}),this.signatureType=NI(A.signatureType,["filler","author"]),this.use=A.use||"",this.usehref=A.usehref||""}}class DB extends hc{constructor(A){super(Zc,"medium"),this.id=A.id||"",this.imagingBBox=function(A){const e=-1;if(!A)return{x:e,y:e,width:e,height:e};const t=A.trim().split(/\s*,\s*/).map((A=>xI(A,"-1")));if(t.length<4||t[2]<0||t[3]<0)return{x:e,y:e,width:e,height:e};const[i,a,s,n]=t;return{x:i,y:a,width:s,height:n}}(A.imagingBBox),this.long=xI(A.long),this.orientation=NI(A.orientation,["portrait","landscape"]),this.short=xI(A.short),this.stock=A.stock||"",this.trayIn=NI(A.trayIn,["auto","delegate","pageFront"]),this.trayOut=NI(A.trayOut,["auto","delegate"]),this.use=A.use||"",this.usehref=A.usehref||""}}class bB extends hc{constructor(A){super(Zc,"message",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.text=new Qc}}class kB extends hc{constructor(A){super(Zc,"numericEdit",!0),this.hScrollPolicy=NI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.comb=null,this.extras=null,this.margin=null}[fI](A){const e=Nc(this,"border","font","margin"),t=this[Ho]()[Ho](),i={name:"input",attributes:{type:"text",fieldId:t[yI],dataId:t[fo]?.[yI]||t[yI],class:["xfaTextfield"],style:e,"aria-label":aC(t),"aria-required":!1}};return eC(t)&&(i.attributes["aria-required"]=!0,i.attributes.required=!0),LI.success({name:"label",attributes:{class:["xfaLabel"]},children:[i]})}}class FB extends hc{constructor(A){super(Zc,"occur",!0),this.id=A.id||"",this.initial=""!==A.initial?SI({data:A.initial,defaultValue:"",validate:A=>!0}):"",this.max=""!==A.max?SI({data:A.max,defaultValue:1,validate:A=>!0}):"",this.min=""!==A.min?SI({data:A.min,defaultValue:1,validate:A=>!0}):"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[Bo](){const A=this[Ho](),e=this.min;""===this.min&&(this.min=A instanceof NB||A instanceof xB?0:1),""===this.max&&(this.max=""===e?A instanceof NB||A instanceof xB?-1:1:this.min),-1!==this.max&&this.max!0}),this.name=A.name||"",this.numbered=SI({data:A.numbered,defaultValue:1,validate:A=>!0}),this.oddOrEven=NI(A.oddOrEven,["any","even","odd"]),this.pagePosition=NI(A.pagePosition,["any","first","last","only","rest"]),this.relevant=MI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.desc=null,this.extras=null,this.medium=null,this.occur=null,this.area=new Qc,this.contentArea=new Qc,this.draw=new Qc,this.exclGroup=new Qc,this.field=new Qc,this.subform=new Qc}[$o](){return this[mo]?!this.occur||-1===this.occur.max||this[mo].numberOfUseA.oddOrEven===e&&A.pagePosition===t));return i||(i=this.pageArea.children.find((A=>"any"===A.oddOrEven&&A.pagePosition===t)),i||(i=this.pageArea.children.find((A=>"any"===A.oddOrEven&&"any"===A.pagePosition)),i||this.pageArea.children[0]))}}class UB extends hc{constructor(A){super(Zc,"para",!0),this.hAlign=NI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.lineHeight=A.lineHeight?xI(A.lineHeight,"0pt"):"",this.marginLeft=A.marginLeft?xI(A.marginLeft,"0pt"):"",this.marginRight=A.marginRight?xI(A.marginRight,"0pt"):"",this.orphans=SI({data:A.orphans,defaultValue:0,validate:A=>A>=0}),this.preserve=A.preserve||"",this.radixOffset=A.radixOffset?xI(A.radixOffset,"0pt"):"",this.spaceAbove=A.spaceAbove?xI(A.spaceAbove,"0pt"):"",this.spaceBelow=A.spaceBelow?xI(A.spaceBelow,"0pt"):"",this.tabDefault=A.tabDefault?xI(this.tabDefault):"",this.tabStops=(A.tabStops||"").trim().split(/\s+/).map(((A,e)=>e%2==1?xI(A):A)),this.textIndent=A.textIndent?xI(A.textIndent,"0pt"):"",this.use=A.use||"",this.usehref=A.usehref||"",this.vAlign=NI(A.vAlign,["top","bottom","middle"]),this.widows=SI({data:A.widows,defaultValue:0,validate:A=>A>=0}),this.hyphenation=null}[mI](){const A=Nc(this,"hAlign");return""!==this.marginLeft&&(A.paddingLeft=wc(this.marginLeft)),""!==this.marginRight&&(A.paddingight=wc(this.marginRight)),""!==this.spaceAbove&&(A.paddingTop=wc(this.spaceAbove)),""!==this.spaceBelow&&(A.paddingBottom=wc(this.spaceBelow)),""!==this.textIndent&&(A.textIndent=wc(this.textIndent),Uc(A)),this.lineHeight>0&&(A.lineHeight=wc(this.lineHeight)),""!==this.tabDefault&&(A.tabSize=wc(this.tabDefault)),this.tabStops.length,this.hyphenatation&&Object.assign(A,this.hyphenatation[mI]()),A}}class MB extends hc{constructor(A){super(Zc,"passwordEdit",!0),this.hScrollPolicy=NI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.passwordChar=A.passwordChar||"*",this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.margin=null}}class LB extends hc{constructor(A){super(Zc,"pattern",!0),this.id=A.id||"",this.type=NI(A.type,["crossHatch","crossDiagonal","diagonalLeft","diagonalRight","horizontal","vertical"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[mI](A){A=A?A[mI]():"#FFFFFF";const e=this.color?this.color[mI]():"#000000",t="repeating-linear-gradient",i=`${A},${A} 5px,${e} 5px,${e} 10px`;switch(this.type){case"crossHatch":return`${t}(to top,${i}) ${t}(to right,${i})`;case"crossDiagonal":return`${t}(45deg,${i}) ${t}(-45deg,${i})`;case"diagonalLeft":return`${t}(45deg,${i})`;case"diagonalRight":return`${t}(-45deg,${i})`;case"horizontal":return`${t}(to top,${i})`;case"vertical":return`${t}(to right,${i})`}return""}}class JB extends fc{constructor(A){super(Zc,"picture"),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class HB extends hc{constructor(A){super(Zc,"proto",!0),this.appearanceFilter=new Qc,this.arc=new Qc,this.area=new Qc,this.assist=new Qc,this.barcode=new Qc,this.bindItems=new Qc,this.bookend=new Qc,this.boolean=new Qc,this.border=new Qc,this.break=new Qc,this.breakAfter=new Qc,this.breakBefore=new Qc,this.button=new Qc,this.calculate=new Qc,this.caption=new Qc,this.certificate=new Qc,this.certificates=new Qc,this.checkButton=new Qc,this.choiceList=new Qc,this.color=new Qc,this.comb=new Qc,this.connect=new Qc,this.contentArea=new Qc,this.corner=new Qc,this.date=new Qc,this.dateTime=new Qc,this.dateTimeEdit=new Qc,this.decimal=new Qc,this.defaultUi=new Qc,this.desc=new Qc,this.digestMethod=new Qc,this.digestMethods=new Qc,this.draw=new Qc,this.edge=new Qc,this.encoding=new Qc,this.encodings=new Qc,this.encrypt=new Qc,this.encryptData=new Qc,this.encryption=new Qc,this.encryptionMethod=new Qc,this.encryptionMethods=new Qc,this.event=new Qc,this.exData=new Qc,this.exObject=new Qc,this.exclGroup=new Qc,this.execute=new Qc,this.extras=new Qc,this.field=new Qc,this.fill=new Qc,this.filter=new Qc,this.float=new Qc,this.font=new Qc,this.format=new Qc,this.handler=new Qc,this.hyphenation=new Qc,this.image=new Qc,this.imageEdit=new Qc,this.integer=new Qc,this.issuers=new Qc,this.items=new Qc,this.keep=new Qc,this.keyUsage=new Qc,this.line=new Qc,this.linear=new Qc,this.lockDocument=new Qc,this.manifest=new Qc,this.margin=new Qc,this.mdp=new Qc,this.medium=new Qc,this.message=new Qc,this.numericEdit=new Qc,this.occur=new Qc,this.oid=new Qc,this.oids=new Qc,this.overflow=new Qc,this.pageArea=new Qc,this.pageSet=new Qc,this.para=new Qc,this.passwordEdit=new Qc,this.pattern=new Qc,this.picture=new Qc,this.radial=new Qc,this.reason=new Qc,this.reasons=new Qc,this.rectangle=new Qc,this.ref=new Qc,this.script=new Qc,this.setProperty=new Qc,this.signData=new Qc,this.signature=new Qc,this.signing=new Qc,this.solid=new Qc,this.speak=new Qc,this.stipple=new Qc,this.subform=new Qc,this.subformSet=new Qc,this.subjectDN=new Qc,this.subjectDNs=new Qc,this.submit=new Qc,this.text=new Qc,this.textEdit=new Qc,this.time=new Qc,this.timeStamp=new Qc,this.toolTip=new Qc,this.traversal=new Qc,this.traverse=new Qc,this.ui=new Qc,this.validate=new Qc,this.value=new Qc,this.variables=new Qc}}class YB extends hc{constructor(A){super(Zc,"radial",!0),this.id=A.id||"",this.type=NI(A.type,["toEdge","toCenter"]),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[mI](A){A=A?A[mI]():"#FFFFFF";const e=this.color?this.color[mI]():"#000000";return`radial-gradient(circle at center, ${"toEdge"===this.type?`${A},${e}`:`${e},${A}`})`}}class vB extends fc{constructor(A){super(Zc,"reason"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class KB extends hc{constructor(A){super(Zc,"reasons",!0),this.id=A.id||"",this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.reason=new Qc}}class qB extends hc{constructor(A){super(Zc,"rectangle",!0),this.hand=NI(A.hand,["even","left","right"]),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.corner=new Qc(4),this.edge=new Qc(4),this.fill=null}[fI](){const A=this.edge.children.length?this.edge.children[0]:new PC({}),e=A[mI](),t=Object.create(null);"visible"===this.fill?.presence?Object.assign(t,this.fill[mI]()):t.fill="transparent",t.strokeWidth=wc("visible"===A.presence?A.thickness:0),t.stroke=e.color;const i=(this.corner.children.length?this.corner.children[0]:new UC({}))[mI](),a={name:"svg",children:[{name:"rect",attributes:{xmlns:Oc,width:"100%",height:"100%",x:0,y:0,rx:i.radius,ry:i.radius,style:t}}],attributes:{xmlns:Oc,style:{overflow:"visible"},width:"100%",height:"100%"}};return _c(this[Ho]()[Ho]())?LI.success({name:"div",attributes:{style:{display:"inline",width:"100%",height:"100%"}},children:[a]}):(a.attributes.style.position="absolute",LI.success(a))}}class TB extends fc{constructor(A){super(Zc,"ref"),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||""}}class PB extends fc{constructor(A){super(Zc,"script"),this.binding=A.binding||"",this.contentType=A.contentType||"",this.id=A.id||"",this.name=A.name||"",this.runAt=NI(A.runAt,["client","both","server"]),this.use=A.use||"",this.usehref=A.usehref||""}}class WB extends hc{constructor(A){super(Zc,"setProperty"),this.connection=A.connection||"",this.ref=A.ref||"",this.target=A.target||""}}class ZB extends hc{constructor(A){super(Zc,"signData",!0),this.id=A.id||"",this.operation=NI(A.operation,["sign","clear","verify"]),this.ref=A.ref||"",this.target=A.target||"",this.use=A.use||"",this.usehref=A.usehref||"",this.filter=null,this.manifest=null}}class OB extends hc{constructor(A){super(Zc,"signature",!0),this.id=A.id||"",this.type=NI(A.type,["PDF1.3","PDF1.6"]),this.use=A.use||"",this.usehref=A.usehref||"",this.border=null,this.extras=null,this.filter=null,this.manifest=null,this.margin=null}}class XB extends hc{constructor(A){super(Zc,"signing",!0),this.id=A.id||"",this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.certificate=new Qc}}class VB extends hc{constructor(A){super(Zc,"solid",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null}[mI](A){return A?A[mI]():"#FFFFFF"}}class jB extends fc{constructor(A){super(Zc,"speak"),this.disable=SI({data:A.disable,defaultValue:0,validate:A=>1===A}),this.id=A.id||"",this.priority=NI(A.priority,["custom","caption","name","toolTip"]),this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}}class zB extends hc{constructor(A){super(Zc,"stipple",!0),this.id=A.id||"",this.rate=SI({data:A.rate,defaultValue:50,validate:A=>A>=0&&A<=100}),this.use=A.use||"",this.usehref=A.usehref||"",this.color=null,this.extras=null}[mI](A){const e=this.rate/100;return V.makeHexColor(Math.round(A.value.r*(1-e)+this.value.r*e),Math.round(A.value.g*(1-e)+this.value.g*e),Math.round(A.value.b*(1-e)+this.value.b*e))}}class _B extends hc{constructor(A){super(Zc,"subform",!0),this.access=NI(A.access,["open","nonInteractive","protected","readOnly"]),this.allowMacro=SI({data:A.allowMacro,defaultValue:0,validate:A=>1===A}),this.anchorType=NI(A.anchorType,["topLeft","bottomCenter","bottomLeft","bottomRight","middleCenter","middleLeft","middleRight","topCenter","topRight"]),this.colSpan=SI({data:A.colSpan,defaultValue:1,validate:A=>A>=1||-1===A}),this.columnWidths=(A.columnWidths||"").trim().split(/\s+/).map((A=>"-1"===A?-1:xI(A))),this.h=A.h?xI(A.h):"",this.hAlign=NI(A.hAlign,["left","center","justify","justifyAll","radix","right"]),this.id=A.id||"",this.layout=NI(A.layout,["position","lr-tb","rl-row","rl-tb","row","table","tb"]),this.locale=A.locale||"",this.maxH=xI(A.maxH,"0pt"),this.maxW=xI(A.maxW,"0pt"),this.mergeMode=NI(A.mergeMode,["consumeData","matchTemplate"]),this.minH=xI(A.minH,"0pt"),this.minW=xI(A.minW,"0pt"),this.name=A.name||"",this.presence=NI(A.presence,["visible","hidden","inactive","invisible"]),this.relevant=MI(A.relevant),this.restoreState=NI(A.restoreState,["manual","auto"]),this.scope=NI(A.scope,["name","none"]),this.use=A.use||"",this.usehref=A.usehref||"",this.w=A.w?xI(A.w):"",this.x=xI(A.x,"0pt"),this.y=xI(A.y,"0pt"),this.assist=null,this.bind=null,this.bookend=null,this.border=null,this.break=null,this.calculate=null,this.desc=null,this.extras=null,this.keep=null,this.margin=null,this.occur=null,this.overflow=null,this.pageSet=null,this.para=null,this.traversal=null,this.validate=null,this.variables=null,this.area=new Qc,this.breakAfter=new Qc,this.breakBefore=new Qc,this.connect=new Qc,this.draw=new Qc,this.event=new Qc,this.exObject=new Qc,this.exclGroup=new Qc,this.field=new Qc,this.proto=new Qc,this.setProperty=new Qc,this.subform=new Qc,this.subformSet=new Qc}[Jo](){const A=this[Ho]();return A instanceof $B?A[Jo]():A}[Zo](){return!0}[zo](){return this.layout.endsWith("-tb")&&0===this[mo].attempt&&this[mo].numberInLine>0||this[Ho]()[zo]()}*[Mo](){yield*AC(this)}[wo](){return qc(this)}[Io](A,e){Tc(this,A,e)}[ko](){return Pc(this)}[jo](){const A=this[Jo]();return!!A[jo]()&&(void 0!==this[mo]._isSplittable?this[mo]._isSplittable:"position"===this.layout||this.layout.includes("row")||this.keep&&"none"!==this.keep.intact?(this[mo]._isSplittable=!1,!1):!(A.layout?.endsWith("-tb")&&0!==A[mo].numberInLine||(this[mo]._isSplittable=!0,0)))}[fI](A){if(tC(this),this.break){if("auto"!==this.break.after||""!==this.break.afterTarget){const A=new pC({targetType:this.break.after,target:this.break.afterTarget,startNew:this.break.startNew.toString()});A[vo]=this[vo],this[co](A),this.breakAfter.push(A)}if("auto"!==this.break.before||""!==this.break.beforeTarget){const A=new mC({targetType:this.break.before,target:this.break.beforeTarget,startNew:this.break.startNew.toString()});A[vo]=this[vo],this[co](A),this.breakBefore.push(A)}if(""!==this.break.overflowTarget){const A=new GB({target:this.break.overflowTarget,leader:this.break.overflowLeader,trailer:this.break.overflowTrailer});A[vo]=this[vo],this[co](A),this.overflow.push(A)}this[II](this.break),this.break=null}if("hidden"===this.presence||"inactive"===this.presence)return LI.EMPTY;if((this.breakBefore.children.length>1||this.breakAfter.children.length>1)&&R("XFA - Several breakBefore or breakAfter in subforms: please file a bug."),this.breakBefore.children.length>=1){const A=this.breakBefore.children[0];if(rC(A))return LI.breakNode(A)}if(this[mo]?.afterBreakAfter)return LI.EMPTY;Rc(this);const e=[],t={id:this[yI],class:[]};Mc(this,t.class),this[mo]||(this[mo]=Object.create(null)),Object.assign(this[mo],{children:e,line:null,attributes:t,attempt:0,numberInLine:0,availableSpace:{width:Math.min(this.w||1/0,A.width),height:Math.min(this.h||1/0,A.height)},width:0,height:0,prevHeight:0,currentWidth:0});const i=this[Yo](),a=i[mo].noLayoutFailure,s=this[jo]();if(s||nC(this),!Wc(this,A))return LI.FAILURE;const n=new Set(["area","draw","exclGroup","field","subform","subformSet"]);if(this.layout.includes("row")){const A=this[Jo]().columnWidths;Array.isArray(A)&&A.length>0&&(this[mo].columnWidths=A,this[mo].currentColumn=0)}const g=Nc(this,"anchorType","dimensions","position","presence","border","margin","hAlign"),r=["xfaSubform"],o=Gc(this);if(o&&r.push(o),t.style=g,t.class=r,this.name&&(t.xfaName=this.name),this.overflow){const e=this.overflow[No]();e.addLeader&&(e.addLeader=!1,oC(this,e.leader,A))}this[oI]();const I="lr-tb"===this.layout||"rl-tb"===this.layout,c=I?2:1;for(;this[mo].attempt=1){const A=this.breakAfter.children[0];if(rC(A))return this[mo].afterBreakAfter=u,LI.breakNode(A)}return delete this[mo],u}}class $B extends hc{constructor(A){super(Zc,"subformSet",!0),this.id=A.id||"",this.name=A.name||"",this.relation=NI(A.relation,["ordered","choice","unordered"]),this.relevant=MI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.bookend=null,this.break=null,this.desc=null,this.extras=null,this.occur=null,this.overflow=null,this.breakAfter=new Qc,this.breakBefore=new Qc,this.subform=new Qc,this.subformSet=new Qc}*[Mo](){yield*AC(this)}[Jo](){let A=this[Ho]();for(;!(A instanceof _B);)A=A[Ho]();return A}[Zo](){return!0}}class Ah extends uc{constructor(A){super(Zc,"subjectDN"),this.delimiter=A.delimiter||",",this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[yo](){this[uo]=new Map(this[uo].split(this.delimiter).map((A=>((A=A.split("=",2))[0]=A[0].trim(),A))))}}class eh extends hc{constructor(A){super(Zc,"subjectDNs",!0),this.id=A.id||"",this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||"",this.subjectDN=new Qc}}class th extends hc{constructor(A){super(Zc,"submit",!0),this.embedPDF=SI({data:A.embedPDF,defaultValue:0,validate:A=>1===A}),this.format=NI(A.format,["xdp","formdata","pdf","urlencoded","xfd","xml"]),this.id=A.id||"",this.target=A.target||"",this.textEncoding=GI({data:A.textEncoding?A.textEncoding.toLowerCase():"",defaultValue:"",validate:A=>["utf-8","big-five","fontspecific","gbk","gb-18030","gb-2312","ksc-5601","none","shift-jis","ucs-2","utf-16"].includes(A)||A.match(/iso-8859-\d{2}/)}),this.use=A.use||"",this.usehref=A.usehref||"",this.xdpContent=A.xdpContent||"",this.encrypt=null,this.encryptData=new Qc,this.signData=new Qc}}class ih extends hc{constructor(A){super(Zc,"template",!0),this.baseProfile=NI(A.baseProfile,["full","interactiveForms"]),this.extras=null,this.subform=new Qc}[yo](){0===this.subform.children.length&&R("XFA - No subforms in template node."),this.subform.children.length>=2&&R("XFA - Several subforms in template node: please file a bug."),this[EI]=5e3}[jo](){return!0}[BI](A,e){return A.startsWith("#")?[this[qo].get(A.slice(1))]:OI(this,e,A,!0,!0)}*[dI](){if(!this.subform.children.length)return LI.success({name:"div",children:[]});this[mo]={overflowNode:null,firstUnsplittable:null,currentContentArea:null,currentPageArea:null,noLayoutFailure:!1,pageNumber:1,pagePosition:"first",oddOrEven:"odd",blankOrNotBlank:"nonBlank",paraStack:[]};const A=this.subform.children[0];A.pageSet[ho]();const e=A.pageSet.pageArea.children,t={name:"div",children:[]};let i=null,a=null,s=null;if(A.breakBefore.children.length>=1?(a=A.breakBefore.children[0],s=a.target):A.subform.children.length>=1&&A.subform.children[0].breakBefore.children.length>=1?(a=A.subform.children[0].breakBefore.children[0],s=a.target):A.break?.beforeTarget?(a=A.break,s=a.beforeTarget):A.subform.children.length>=1&&A.subform.children[0].break?.beforeTarget&&(a=A.subform.children[0].break,s=a.beforeTarget),a){const A=this[BI](s,a[Ho]());A instanceof NB&&(i=A,a[mo]={})}i||(i=e[0]),i[mo]={numberOfUse:1};const n=i[Ho]();let g;n[mo]={numberOfUse:1,pageIndex:n.pageArea.children.indexOf(i),pageSetIndex:0};let r=null,o=null,I=!0,c=0,C=0;for(;;){if(I)c=0;else if(t.children.pop(),3==++c)return R("XFA - Something goes wrong: please file a bug."),t;g=null,this[mo].currentPageArea=i;const e=i[fI]().html;t.children.push(e),r&&(this[mo].noLayoutFailure=!0,e.children.push(r[fI](i[mo].space).html),r=null),o&&(this[mo].noLayoutFailure=!0,e.children.push(o[fI](i[mo].space).html),o=null);const a=i.contentArea.children,s=e.children.filter((A=>A.attributes.class.includes("xfaContentarea")));I=!1,this[mo].firstUnsplittable=null,this[mo].noLayoutFailure=!1;const n=e=>{const t=A[wo]();t&&(I||=t.children?.length>0,s[e].children.push(t))};for(let e=C,i=a.length;e0,s[e].children.push(B.html)):!I&&t.children.length>1&&t.children.pop(),t;if(B.isBreak()){const A=B.breakNode;if(n(e),"auto"===A.targetType)continue;A.leader&&(r=this[BI](A.leader,A[Ho]()),r=r?r[0]:null),A.trailer&&(o=this[BI](A.trailer,A[Ho]()),o=o?o[0]:null),"pageArea"===A.targetType?(g=A[mo].target,e=1/0):A[mo].target?(g=A[mo].target,C=A[mo].index+1,e=1/0):e=A[mo].index}else if(this[mo].overflowNode){const A=this[mo].overflowNode;this[mo].overflowNode=null;const t=A[No](),i=t.target;t.addLeader=null!==t.leader,t.addTrailer=null!==t.trailer,n(e);const s=e;if(e=1/0,i instanceof NB)g=i;else if(i instanceof xC){const A=a.indexOf(i);-1!==A?A>s?e=A-1:C=A:(g=i[Ho](),C=g.contentArea.children.indexOf(i))}}else n(e)}this[mo].pageNumber+=1,g&&(g[$o]()?g[mo].numberOfUse+=1:g=null),i=g||i[Lo](),yield null}}}class ah extends uc{constructor(A){super(Zc,"text"),this.id=A.id||"",this.maxChars=SI({data:A.maxChars,defaultValue:0,validate:A=>A>=0}),this.name=A.name||"",this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}[oo](){return!0}[aI](A){return A[eI]===DI.xhtml.id?(this[uo]=A,!0):(R(`XFA - Invalid content in Text: ${A[tI]}.`),!1)}[nI](A){this[uo]instanceof hc||super[nI](A)}[yo](){"string"==typeof this[uo]&&(this[uo]=this[uo].replaceAll("\r\n","\n"))}[No](){return"string"==typeof this[uo]?this[uo].split(/[\u2029\u2028\n]/).reduce(((A,e)=>(e&&A.push(e),A)),[]).join("\n"):this[uo][uI]()}[fI](A){if("string"==typeof this[uo]){const A=sC(this[uo]).html;return this[uo].includes("\u2029")?(A.name="div",A.children=[],this[uo].split("\u2029").map((A=>A.split(/[\u2028\n]/).reduce(((A,e)=>(A.push({name:"span",value:e},{name:"br"}),A)),[]))).forEach((e=>{A.children.push({name:"p",children:e})}))):/[\u2028\n]/.test(this[uo])&&(A.name="div",A.children=[],this[uo].split(/[\u2028\n]/).forEach((e=>{A.children.push({name:"span",value:e},{name:"br"})}))),LI.success(A)}return this[uo][fI](A)}}class sh extends hc{constructor(A){super(Zc,"textEdit",!0),this.allowRichText=SI({data:A.allowRichText,defaultValue:0,validate:A=>1===A}),this.hScrollPolicy=NI(A.hScrollPolicy,["auto","off","on"]),this.id=A.id||"",this.multiLine=SI({data:A.multiLine,defaultValue:"",validate:A=>0===A||1===A}),this.use=A.use||"",this.usehref=A.usehref||"",this.vScrollPolicy=NI(A.vScrollPolicy,["auto","off","on"]),this.border=null,this.comb=null,this.extras=null,this.margin=null}[fI](A){const e=Nc(this,"border","font","margin");let t;const i=this[Ho]()[Ho]();return""===this.multiLine&&(this.multiLine=i instanceof TC?1:0),t=1===this.multiLine?{name:"textarea",attributes:{dataId:i[fo]?.[yI]||i[yI],fieldId:i[yI],class:["xfaTextfield"],style:e,"aria-label":aC(i),"aria-required":!1}}:{name:"input",attributes:{type:"text",dataId:i[fo]?.[yI]||i[yI],fieldId:i[yI],class:["xfaTextfield"],style:e,"aria-label":aC(i),"aria-required":!1}},eC(i)&&(t.attributes["aria-required"]=!0,t.attributes.required=!0),LI.success({name:"label",attributes:{class:["xfaLabel"]},children:[t]})}}class nh extends fc{constructor(A){super(Zc,"time"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}[yo](){const A=this[uo].trim();this[uo]=A?new Date(A):null}[fI](A){return sC(this[uo]?this[uo].toString():"")}}class gh extends hc{constructor(A){super(Zc,"timeStamp"),this.id=A.id||"",this.server=A.server||"",this.type=NI(A.type,["optional","required"]),this.use=A.use||"",this.usehref=A.usehref||""}}class rh extends fc{constructor(A){super(Zc,"toolTip"),this.id=A.id||"",this.rid=A.rid||"",this.use=A.use||"",this.usehref=A.usehref||""}}class oh extends hc{constructor(A){super(Zc,"traversal",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.traverse=new Qc}}class Ih extends hc{constructor(A){super(Zc,"traverse",!0),this.id=A.id||"",this.operation=NI(A.operation,["next","back","down","first","left","right","up"]),this.ref=A.ref||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.script=null}get name(){return this.operation}[_o](){return!1}}class ch extends hc{constructor(A){super(Zc,"ui",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.picture=null,this.barcode=null,this.button=null,this.checkButton=null,this.choiceList=null,this.dateTimeEdit=null,this.defaultUi=null,this.imageEdit=null,this.numericEdit=null,this.passwordEdit=null,this.signature=null,this.textEdit=null}[No](){if(void 0===this[mo]){for(const A of Object.getOwnPropertyNames(this)){if("extras"===A||"picture"===A)continue;const e=this[A];if(e instanceof hc)return this[mo]=e,e}this[mo]=null}return this[mo]}[fI](A){const e=this[No]();return e?e[fI](A):LI.EMPTY}}class Ch extends hc{constructor(A){super(Zc,"validate",!0),this.formatTest=NI(A.formatTest,["warning","disabled","error"]),this.id=A.id||"",this.nullTest=NI(A.nullTest,["disabled","error","warning"]),this.scriptTest=NI(A.scriptTest,["error","disabled","warning"]),this.use=A.use||"",this.usehref=A.usehref||"",this.extras=null,this.message=null,this.picture=null,this.script=null}}class Bh extends hc{constructor(A){super(Zc,"value",!0),this.id=A.id||"",this.override=SI({data:A.override,defaultValue:0,validate:A=>1===A}),this.relevant=MI(A.relevant),this.use=A.use||"",this.usehref=A.usehref||"",this.arc=null,this.boolean=null,this.date=null,this.dateTime=null,this.decimal=null,this.exData=null,this.float=null,this.image=null,this.integer=null,this.line=null,this.rectangle=null,this.text=null,this.time=null}[lI](A){const e=this[Ho]();if(e instanceof aB&&e.ui?.imageEdit)return this.image||(this.image=new CB({}),this[co](this.image)),void(this.image[uo]=A[uo]);const t=A[tI];if(null===this[t]){for(const A of Object.getOwnPropertyNames(this)){const e=this[A];e instanceof hc&&(this[A]=null,this[II](e))}this[A[tI]]=A,this[co](A)}else this[t][uo]=A[uo]}[uI](){if(this.exData)return"string"==typeof this.exData[uo]?this.exData[uo].trim():this.exData[uo][uI]().trim();for(const A of Object.getOwnPropertyNames(this)){if("image"===A)continue;const e=this[A];if(e instanceof hc)return(e[uo]||"").toString().trim()}return null}[fI](A){for(const e of Object.getOwnPropertyNames(this)){const t=this[e];if(t instanceof hc)return t[fI](A)}return LI.EMPTY}}class hh extends hc{constructor(A){super(Zc,"variables",!0),this.id=A.id||"",this.use=A.use||"",this.usehref=A.usehref||"",this.boolean=new Qc,this.date=new Qc,this.dateTime=new Qc,this.decimal=new Qc,this.exData=new Qc,this.float=new Qc,this.image=new Qc,this.integer=new Qc,this.manifest=new Qc,this.script=new Qc,this.text=new Qc,this.time=new Qc}[_o](){return!0}}class Qh{static[wI](A,e){if(Qh.hasOwnProperty(A)){const t=Qh[A](e);return t[QI](e),t}}static appearanceFilter(A){return new IC(A)}static arc(A){return new cC(A)}static area(A){return new CC(A)}static assist(A){return new BC(A)}static barcode(A){return new hC(A)}static bind(A){return new QC(A)}static bindItems(A){return new lC(A)}static bookend(A){return new EC(A)}static boolean(A){return new uC(A)}static border(A){return new dC(A)}static break(A){return new fC(A)}static breakAfter(A){return new pC(A)}static breakBefore(A){return new mC(A)}static button(A){return new yC(A)}static calculate(A){return new wC(A)}static caption(A){return new DC(A)}static certificate(A){return new bC(A)}static certificates(A){return new kC(A)}static checkButton(A){return new FC(A)}static choiceList(A){return new SC(A)}static color(A){return new RC(A)}static comb(A){return new GC(A)}static connect(A){return new NC(A)}static contentArea(A){return new xC(A)}static corner(A){return new UC(A)}static date(A){return new MC(A)}static dateTime(A){return new LC(A)}static dateTimeEdit(A){return new JC(A)}static decimal(A){return new HC(A)}static defaultUi(A){return new YC(A)}static desc(A){return new vC(A)}static digestMethod(A){return new KC(A)}static digestMethods(A){return new qC(A)}static draw(A){return new TC(A)}static edge(A){return new PC(A)}static encoding(A){return new WC(A)}static encodings(A){return new ZC(A)}static encrypt(A){return new OC(A)}static encryptData(A){return new XC(A)}static encryption(A){return new VC(A)}static encryptionMethod(A){return new jC(A)}static encryptionMethods(A){return new zC(A)}static event(A){return new _C(A)}static exData(A){return new $C(A)}static exObject(A){return new AB(A)}static exclGroup(A){return new eB(A)}static execute(A){return new tB(A)}static extras(A){return new iB(A)}static field(A){return new aB(A)}static fill(A){return new sB(A)}static filter(A){return new nB(A)}static float(A){return new gB(A)}static font(A){return new rB(A)}static format(A){return new oB(A)}static handler(A){return new IB(A)}static hyphenation(A){return new cB(A)}static image(A){return new CB(A)}static imageEdit(A){return new BB(A)}static integer(A){return new hB(A)}static issuers(A){return new QB(A)}static items(A){return new lB(A)}static keep(A){return new EB(A)}static keyUsage(A){return new uB(A)}static line(A){return new dB(A)}static linear(A){return new fB(A)}static lockDocument(A){return new pB(A)}static manifest(A){return new mB(A)}static margin(A){return new yB(A)}static mdp(A){return new wB(A)}static medium(A){return new DB(A)}static message(A){return new bB(A)}static numericEdit(A){return new kB(A)}static occur(A){return new FB(A)}static oid(A){return new SB(A)}static oids(A){return new RB(A)}static overflow(A){return new GB(A)}static pageArea(A){return new NB(A)}static pageSet(A){return new xB(A)}static para(A){return new UB(A)}static passwordEdit(A){return new MB(A)}static pattern(A){return new LB(A)}static picture(A){return new JB(A)}static proto(A){return new HB(A)}static radial(A){return new YB(A)}static reason(A){return new vB(A)}static reasons(A){return new KB(A)}static rectangle(A){return new qB(A)}static ref(A){return new TB(A)}static script(A){return new PB(A)}static setProperty(A){return new WB(A)}static signData(A){return new ZB(A)}static signature(A){return new OB(A)}static signing(A){return new XB(A)}static solid(A){return new VB(A)}static speak(A){return new jB(A)}static stipple(A){return new zB(A)}static subform(A){return new _B(A)}static subformSet(A){return new $B(A)}static subjectDN(A){return new Ah(A)}static subjectDNs(A){return new eh(A)}static submit(A){return new th(A)}static template(A){return new ih(A)}static text(A){return new ah(A)}static textEdit(A){return new sh(A)}static time(A){return new nh(A)}static timeStamp(A){return new gh(A)}static toolTip(A){return new rh(A)}static traversal(A){return new oh(A)}static traverse(A){return new Ih(A)}static ui(A){return new ch(A)}static validate(A){return new Ch(A)}static value(A){return new Bh(A)}static variables(A){return new hh(A)}}const lh=DI.datasets.id;function Eh(A){const e=new ah({});return e[uo]=A,e}class uh{constructor(A){this.root=A,this.datasets=A.datasets,this.data=A.datasets?.data||new Ec(DI.datasets.id,"data"),this.emptyMerge=0===this.data[Uo]().length,this.root.form=this.form=A.template[lo]()}_isConsumeData(){return!this.emptyMerge&&this._mergeMode}_isMatchTemplate(){return!this._isConsumeData()}bind(){return this._bindElement(this.form,this.data),this.form}getData(){return this.data}_bindValue(A,e,t){if(A[fo]=e,A[Ko]())if(e[Oo]()){const t=e[Go]();A[lI](Eh(t))}else if(A instanceof aB&&"multiSelect"===A.ui?.choiceList?.open){const t=e[Uo]().map((A=>A[uo].trim())).join("\n");A[lI](Eh(t))}else this._isConsumeData()&&R("XFA - Nodes haven't the same type.");else!e[Oo]()||this._isMatchTemplate()?this._bindElement(A,e):R("XFA - Nodes haven't the same type.")}_findDataByNameToConsume(A,e,t,i){if(!A)return null;let a,s;for(let i=0;i<3;i++){for(a=t[xo](A,!1,!0);s=a.next().value,s;)if(e===s[Oo]())return s;if(t[eI]===DI.datasets.id&&"data"===t[tI])break;t=t[Ho]()}return i?(a=this.data[xo](A,!0,!1),s=a.next().value,s||(a=this.data[Do](A,!0),s=a.next().value,s?.[Oo]()?s:null)):null}_setProperties(A,e){if(A.hasOwnProperty("setProperty"))for(const{ref:t,target:i,connection:a}of A.setProperty.children){if(a)continue;if(!t)continue;const s=OI(this.root,e,t,!1,!1);if(!s){R(`XFA - Invalid reference: ${t}.`);continue}const[n]=s;if(!n[Xo](this.data)){R("XFA - Invalid node: must be a data node.");continue}const g=OI(this.root,A,i,!1,!1);if(!g){R(`XFA - Invalid target: ${i}.`);continue}const[r]=g;if(!r[Xo](A)){R("XFA - Invalid target: must be a property or subproperty.");continue}const o=r[Ho]();if(r instanceof WB||o instanceof WB){R("XFA - Invalid target: cannot be a setProperty or one of its properties.");continue}if(r instanceof lC||o instanceof lC){R("XFA - Invalid target: cannot be a bindItems or one of its properties.");continue}const I=n[uI](),c=r[tI];if(r instanceof lc){const A=Object.create(null);A[c]=I;const e=Reflect.construct(Object.getPrototypeOf(o).constructor,[A]);o[c]=e[c]}else r.hasOwnProperty(uo)?(r[fo]=n,r[uo]=I,r[yo]()):R("XFA - Invalid node to use in setProperty")}}_bindItems(A,e){if(!A.hasOwnProperty("items")||!A.hasOwnProperty("bindItems")||A.bindItems.isEmpty())return;for(const e of A.items.children)A[II](e);A.items.clear();const t=new lB({}),i=new lB({});A[co](t),A.items.push(t),A[co](i),A.items.push(i);for(const{ref:a,labelRef:s,valueRef:n,connection:g}of A.bindItems.children){if(g)continue;if(!a)continue;const A=OI(this.root,e,a,!1,!1);if(A)for(const e of A){if(!e[Xo](this.datasets)){R(`XFA - Invalid ref (${a}): must be a datasets child.`);continue}const A=OI(this.root,e,s,!0,!1);if(!A){R(`XFA - Invalid label: ${s}.`);continue}const[g]=A;if(!g[Xo](this.datasets)){R("XFA - Invalid label: must be a datasets child.");continue}const r=OI(this.root,e,n,!0,!1);if(!r){R(`XFA - Invalid value: ${n}.`);continue}const[o]=r;if(!o[Xo](this.datasets)){R("XFA - Invalid value: must be a datasets child.");continue}const I=Eh(g[uI]()),c=Eh(o[uI]());t[co](I),t.text.push(I),i[co](c),i.text.push(c)}else R(`XFA - Invalid reference: ${a}.`)}}_bindOccurrences(A,e,t){let i;if(e.length>1&&(i=A[lo](),i[II](i.occur),i.occur=null),this._bindValue(A,e[0],t),this._setProperties(A,e[0]),this._bindItems(A,e[0]),1===e.length)return;const a=A[Ho](),s=A[tI],n=a[To](A);for(let A=1,g=e.length;Ae.name===A.name)).length:t[i].children.length;const s=t[To](A)+1,n=e.initial-a;if(n){const e=A[lo]();e[II](e.occur),e.occur=null,t[i].push(e),t[Po](s,e);for(let A=1;A0)this._bindOccurrences(i,[A[0]],null);else if(this.emptyMerge){const A=e[eI]===lh?-1:e[eI],t=i[fo]=new Ec(A,i.name||"root");e[co](t),this._bindElement(i,t)}continue}if(!i[Zo]())continue;let A=!1,a=null,s=null,n=null;if(i.bind){switch(i.bind.match){case"none":this._setAndBind(i,e);continue;case"global":A=!0;break;case"dataRef":if(!i.bind.ref){R(`XFA - ref is empty in node ${i[tI]}.`),this._setAndBind(i,e);continue}s=i.bind.ref}i.bind.picture&&(a=i.bind.picture[uo])}const[g,r]=this._getOccurInfo(i);if(s){if(n=OI(this.root,e,s,!0,!1),null===n){if(n=XI(this.data,e,s),!n)continue;this._isConsumeData()&&(n[Eo]=!0),this._setAndBind(i,n);continue}this._isConsumeData()&&(n=n.filter((A=>!A[Eo]))),n.length>r?n=n.slice(0,r):0===n.length&&(n=null),n&&this._isConsumeData()&&n.forEach((A=>{A[Eo]=!0}))}else{if(!i.name){this._setAndBind(i,e);continue}if(this._isConsumeData()){const t=[];for(;t.length0?t:null}else{if(n=e[xo](i.name,!1,this.emptyMerge).next().value,!n){if(0===g){t.push(i);continue}const A=e[eI]===lh?-1:e[eI];n=i[fo]=new Ec(A,i.name),this.emptyMerge&&(n[Eo]=!0),e[co](n),this._setAndBind(i,n);continue}this.emptyMerge&&(n[Eo]=!0),n=[n]}}n?this._bindOccurrences(i,n,a):g>0?this._setAndBind(i,e):t.push(i)}t.forEach((A=>A[Ho]()[II](A)))}}class dh{constructor(A,e){this.data=e,this.dataset=A.datasets||null}serialize(A){const e=[[-1,this.data[Uo]()]];for(;e.length>0;){const t=e.at(-1),[i,a]=t;if(i+1===a.length){e.pop();continue}const s=a[++t[0]],n=A.get(s[yI]);if(n)s[lI](n);else{const e=s[bo]();for(const t of e.values()){const e=A.get(t[yI]);if(e){t[lI](e);break}}}const g=s[Uo]();g.length>0&&e.push([-1,g])}const t=[''];if(this.dataset)for(const A of this.dataset[Uo]())"data"!==A[tI]&&A[pI](t);return this.data[pI](t),t.push(""),t.join("")}}const fh=DI.config.id;class ph extends hc{constructor(A){super(fh,"acrobat",!0),this.acrobat7=null,this.autoSave=null,this.common=null,this.validate=null,this.validateApprovalSignatures=null,this.submitUrl=new Qc}}class mh extends hc{constructor(A){super(fh,"acrobat7",!0),this.dynamicRender=null}}class yh extends dc{constructor(A){super(fh,"ADBE_JSConsole",["delegate","Enable","Disable"])}}class wh extends dc{constructor(A){super(fh,"ADBE_JSDebugger",["delegate","Enable","Disable"])}}class Dh extends mc{constructor(A){super(fh,"addSilentPrint")}}class bh extends mc{constructor(A){super(fh,"addViewerPreferences")}}class kh extends yc{constructor(A){super(fh,"adjustData")}}class Fh extends pc{constructor(A){super(fh,"adobeExtensionLevel",0,(A=>A>=1&&A<=8))}}class Sh extends hc{constructor(A){super(fh,"agent",!0),this.name=A.name?A.name.trim():"",this.common=new Qc}}class Rh extends uc{constructor(A){super(fh,"alwaysEmbed")}}class Gh extends fc{constructor(A){super(fh,"amd")}}class Nh extends hc{constructor(A){super(fh,"area"),this.level=SI({data:A.level,defaultValue:0,validate:A=>A>=1&&A<=3}),this.name=NI(A.name,["","barcode","coreinit","deviceDriver","font","general","layout","merge","script","signature","sourceSet","templateCache"])}}class xh extends dc{constructor(A){super(fh,"attributes",["preserve","delegate","ignore"])}}class Uh extends dc{constructor(A){super(fh,"autoSave",["disabled","enabled"])}}class Mh extends fc{constructor(A){super(fh,"base")}}class Lh extends hc{constructor(A){super(fh,"batchOutput"),this.format=NI(A.format,["none","concat","zip","zipCompress"])}}class Jh extends uc{constructor(A){super(fh,"behaviorOverride")}[yo](){this[uo]=new Map(this[uo].trim().split(/\s+/).filter((A=>A.includes(":"))).map((A=>A.split(":",2))))}}class Hh extends hc{constructor(A){super(fh,"cache",!0),this.templateCache=null}}class Yh extends mc{constructor(A){super(fh,"change")}}class vh extends hc{constructor(A){super(fh,"common",!0),this.data=null,this.locale=null,this.localeSet=null,this.messaging=null,this.suppressBanner=null,this.template=null,this.validationMessaging=null,this.versionControl=null,this.log=new Qc}}class Kh extends hc{constructor(A){super(fh,"compress"),this.scope=NI(A.scope,["imageOnly","document"])}}class qh extends mc{constructor(A){super(fh,"compressLogicalStructure")}}class Th extends yc{constructor(A){super(fh,"compressObjectStream")}}class Ph extends hc{constructor(A){super(fh,"compression",!0),this.compressLogicalStructure=null,this.compressObjectStream=null,this.level=null,this.type=null}}class Wh extends hc{constructor(A){super(fh,"config",!0),this.acrobat=null,this.present=null,this.trace=null,this.agent=new Qc}}class Zh extends dc{constructor(A){super(fh,"conformance",["A","B"])}}class Oh extends mc{constructor(A){super(fh,"contentCopy")}}class Xh extends pc{constructor(A){super(fh,"copies",1,(A=>A>=1))}}class Vh extends fc{constructor(A){super(fh,"creator")}}class jh extends pc{constructor(A){super(fh,"currentPage",0,(A=>A>=0))}}class zh extends hc{constructor(A){super(fh,"data",!0),this.adjustData=null,this.attributes=null,this.incrementalLoad=null,this.outputXSL=null,this.range=null,this.record=null,this.startNode=null,this.uri=null,this.window=null,this.xsl=null,this.excludeNS=new Qc,this.transform=new Qc}}class _h extends hc{constructor(A){super(fh,"debug",!0),this.uri=null}}class $h extends uc{constructor(A){super(fh,"defaultTypeface"),this.writingScript=NI(A.writingScript,["*","Arabic","Cyrillic","EastEuropeanRoman","Greek","Hebrew","Japanese","Korean","Roman","SimplifiedChinese","Thai","TraditionalChinese","Vietnamese"])}}class AQ extends dc{constructor(A){super(fh,"destination",["pdf","pcl","ps","webClient","zpl"])}}class eQ extends mc{constructor(A){super(fh,"documentAssembly")}}class tQ extends hc{constructor(A){super(fh,"driver",!0),this.name=A.name?A.name.trim():"",this.fontInfo=null,this.xdc=null}}class iQ extends dc{constructor(A){super(fh,"duplexOption",["simplex","duplexFlipLongEdge","duplexFlipShortEdge"])}}class aQ extends dc{constructor(A){super(fh,"dynamicRender",["forbidden","required"])}}class sQ extends mc{constructor(A){super(fh,"embed")}}class nQ extends mc{constructor(A){super(fh,"encrypt")}}class gQ extends hc{constructor(A){super(fh,"encryption",!0),this.encrypt=null,this.encryptionLevel=null,this.permissions=null}}class rQ extends dc{constructor(A){super(fh,"encryptionLevel",["40bit","128bit"])}}class oQ extends fc{constructor(A){super(fh,"enforce")}}class IQ extends hc{constructor(A){super(fh,"equate"),this.force=SI({data:A.force,defaultValue:1,validate:A=>0===A}),this.from=A.from||"",this.to=A.to||""}}class cQ extends hc{constructor(A){super(fh,"equateRange"),this.from=A.from||"",this.to=A.to||"",this._unicodeRange=A.unicodeRange||""}get unicodeRange(){const A=[],e=/U\+([0-9a-fA-F]+)/,t=this._unicodeRange;for(let i of t.split(",").map((A=>A.trim())).filter((A=>!!A)))i=i.split("-",2).map((A=>{const t=A.match(e);return t?parseInt(t[1],16):0})),1===i.length&&i.push(i[0]),A.push(i);return U(this,"unicodeRange",A)}}class CQ extends uc{constructor(A){super(fh,"exclude")}[yo](){this[uo]=this[uo].trim().split(/\s+/).filter((A=>A&&["calculate","close","enter","exit","initialize","ready","validate"].includes(A)))}}class BQ extends fc{constructor(A){super(fh,"excludeNS")}}class hQ extends dc{constructor(A){super(fh,"flipLabel",["usePrinterSetting","on","off"])}}class QQ extends hc{constructor(A){super(fh,"fontInfo",!0),this.embed=null,this.map=null,this.subsetBelow=null,this.alwaysEmbed=new Qc,this.defaultTypeface=new Qc,this.neverEmbed=new Qc}}class lQ extends mc{constructor(A){super(fh,"formFieldFilling")}}class EQ extends fc{constructor(A){super(fh,"groupParent")}}class uQ extends dc{constructor(A){super(fh,"ifEmpty",["dataValue","dataGroup","ignore","remove"])}}class dQ extends fc{constructor(A){super(fh,"includeXDPContent")}}class fQ extends dc{constructor(A){super(fh,"incrementalLoad",["none","forwardOnly"])}}class pQ extends mc{constructor(A){super(fh,"incrementalMerge")}}class mQ extends mc{constructor(A){super(fh,"interactive")}}class yQ extends dc{constructor(A){super(fh,"jog",["usePrinterSetting","none","pageSet"])}}class wQ extends hc{constructor(A){super(fh,"labelPrinter",!0),this.name=NI(A.name,["zpl","dpl","ipl","tcpl"]),this.batchOutput=null,this.flipLabel=null,this.fontInfo=null,this.xdc=null}}class DQ extends dc{constructor(A){super(fh,"layout",["paginate","panel"])}}class bQ extends pc{constructor(A){super(fh,"level",0,(A=>A>0))}}class kQ extends mc{constructor(A){super(fh,"linearized")}}class FQ extends fc{constructor(A){super(fh,"locale")}}class SQ extends fc{constructor(A){super(fh,"localeSet")}}class RQ extends hc{constructor(A){super(fh,"log",!0),this.mode=null,this.threshold=null,this.to=null,this.uri=null}}class GQ extends hc{constructor(A){super(fh,"map",!0),this.equate=new Qc,this.equateRange=new Qc}}class NQ extends hc{constructor(A){super(fh,"mediumInfo",!0),this.map=null}}class xQ extends hc{constructor(A){super(fh,"message",!0),this.msgId=null,this.severity=null}}class UQ extends hc{constructor(A){super(fh,"messaging",!0),this.message=new Qc}}class MQ extends dc{constructor(A){super(fh,"mode",["append","overwrite"])}}class LQ extends mc{constructor(A){super(fh,"modifyAnnots")}}class JQ extends pc{constructor(A){super(fh,"msgId",1,(A=>A>=1))}}class HQ extends fc{constructor(A){super(fh,"nameAttr")}}class YQ extends uc{constructor(A){super(fh,"neverEmbed")}}class vQ extends pc{constructor(A){super(fh,"numberOfCopies",null,(A=>A>=2&&A<=5))}}class KQ extends hc{constructor(A){super(fh,"openAction",!0),this.destination=null}}class qQ extends hc{constructor(A){super(fh,"output",!0),this.to=null,this.type=null,this.uri=null}}class TQ extends fc{constructor(A){super(fh,"outputBin")}}class PQ extends hc{constructor(A){super(fh,"outputXSL",!0),this.uri=null}}class WQ extends dc{constructor(A){super(fh,"overprint",["none","both","draw","field"])}}class ZQ extends fc{constructor(A){super(fh,"packets")}[yo](){"*"!==this[uo]&&(this[uo]=this[uo].trim().split(/\s+/).filter((A=>["config","datasets","template","xfdf","xslt"].includes(A))))}}class OQ extends hc{constructor(A){super(fh,"pageOffset"),this.x=SI({data:A.x,defaultValue:"useXDCSetting",validate:A=>!0}),this.y=SI({data:A.y,defaultValue:"useXDCSetting",validate:A=>!0})}}class XQ extends fc{constructor(A){super(fh,"pageRange")}[yo](){const A=this[uo].trim().split(/\s+/).map((A=>parseInt(A,10))),e=[];for(let t=0,i=A.length;t!1))}}class _Q extends hc{constructor(A){super(fh,"pcl",!0),this.name=A.name||"",this.batchOutput=null,this.fontInfo=null,this.jog=null,this.mediumInfo=null,this.outputBin=null,this.pageOffset=null,this.staple=null,this.xdc=null}}class $Q extends hc{constructor(A){super(fh,"pdf",!0),this.name=A.name||"",this.adobeExtensionLevel=null,this.batchOutput=null,this.compression=null,this.creator=null,this.encryption=null,this.fontInfo=null,this.interactive=null,this.linearized=null,this.openAction=null,this.pdfa=null,this.producer=null,this.renderPolicy=null,this.scriptModel=null,this.silentPrint=null,this.submitFormat=null,this.tagged=null,this.version=null,this.viewerPreferences=null,this.xdc=null}}class Al extends hc{constructor(A){super(fh,"pdfa",!0),this.amd=null,this.conformance=null,this.includeXDPContent=null,this.part=null}}class el extends hc{constructor(A){super(fh,"permissions",!0),this.accessibleContent=null,this.change=null,this.contentCopy=null,this.documentAssembly=null,this.formFieldFilling=null,this.modifyAnnots=null,this.plaintextMetadata=null,this.print=null,this.printHighQuality=null}}class tl extends mc{constructor(A){super(fh,"pickTrayByPDFSize")}}class il extends fc{constructor(A){super(fh,"picture")}}class al extends mc{constructor(A){super(fh,"plaintextMetadata")}}class sl extends dc{constructor(A){super(fh,"presence",["preserve","dissolve","dissolveStructure","ignore","remove"])}}class nl extends hc{constructor(A){super(fh,"present",!0),this.behaviorOverride=null,this.cache=null,this.common=null,this.copies=null,this.destination=null,this.incrementalMerge=null,this.layout=null,this.output=null,this.overprint=null,this.pagination=null,this.paginationOverride=null,this.script=null,this.validate=null,this.xdp=null,this.driver=new Qc,this.labelPrinter=new Qc,this.pcl=new Qc,this.pdf=new Qc,this.ps=new Qc,this.submitUrl=new Qc,this.webClient=new Qc,this.zpl=new Qc}}class gl extends mc{constructor(A){super(fh,"print")}}class rl extends mc{constructor(A){super(fh,"printHighQuality")}}class ol extends dc{constructor(A){super(fh,"printScaling",["appdefault","noScaling"])}}class Il extends fc{constructor(A){super(fh,"printerName")}}class cl extends fc{constructor(A){super(fh,"producer")}}class Cl extends hc{constructor(A){super(fh,"ps",!0),this.name=A.name||"",this.batchOutput=null,this.fontInfo=null,this.jog=null,this.mediumInfo=null,this.outputBin=null,this.staple=null,this.xdc=null}}class Bl extends uc{constructor(A){super(fh,"range")}[yo](){this[uo]=this[uo].trim().split(/\s*,\s*/,2).map((A=>A.split("-").map((A=>parseInt(A.trim(),10))))).filter((A=>A.every((A=>!isNaN(A))))).map((A=>(1===A.length&&A.push(A[0]),A)))}}class hl extends uc{constructor(A){super(fh,"record")}[yo](){this[uo]=this[uo].trim();const A=parseInt(this[uo],10);!isNaN(A)&&A>=0&&(this[uo]=A)}}class Ql extends uc{constructor(A){super(fh,"relevant")}[yo](){this[uo]=this[uo].trim().split(/\s+/)}}class ll extends uc{constructor(A){super(fh,"rename")}[yo](){this[uo]=this[uo].trim(),(this[uo].toLowerCase().startsWith("xml")||new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*","u").test(this[uo]))&&R("XFA - Rename: invalid XFA name")}}class El extends dc{constructor(A){super(fh,"renderPolicy",["server","client"])}}class ul extends dc{constructor(A){super(fh,"runScripts",["both","client","none","server"])}}class dl extends hc{constructor(A){super(fh,"script",!0),this.currentPage=null,this.exclude=null,this.runScripts=null}}class fl extends dc{constructor(A){super(fh,"scriptModel",["XFA","none"])}}class pl extends dc{constructor(A){super(fh,"severity",["ignore","error","information","trace","warning"])}}class ml extends hc{constructor(A){super(fh,"silentPrint",!0),this.addSilentPrint=null,this.printerName=null}}class yl extends hc{constructor(A){super(fh,"staple"),this.mode=NI(A.mode,["usePrinterSetting","on","off"])}}class wl extends fc{constructor(A){super(fh,"startNode")}}class Dl extends pc{constructor(A){super(fh,"startPage",0,(A=>!0))}}class bl extends dc{constructor(A){super(fh,"submitFormat",["html","delegate","fdf","xml","pdf"])}}class kl extends fc{constructor(A){super(fh,"submitUrl")}}class Fl extends pc{constructor(A){super(fh,"subsetBelow",100,(A=>A>=0&&A<=100))}}class Sl extends mc{constructor(A){super(fh,"suppressBanner")}}class Rl extends mc{constructor(A){super(fh,"tagged")}}class Gl extends hc{constructor(A){super(fh,"template",!0),this.base=null,this.relevant=null,this.startPage=null,this.uri=null,this.xsl=null}}class Nl extends dc{constructor(A){super(fh,"threshold",["trace","error","information","warning"])}}class xl extends dc{constructor(A){super(fh,"to",["null","memory","stderr","stdout","system","uri"])}}class Ul extends hc{constructor(A){super(fh,"templateCache"),this.maxEntries=SI({data:A.maxEntries,defaultValue:5,validate:A=>A>=0})}}class Ml extends hc{constructor(A){super(fh,"trace",!0),this.area=new Qc}}class Ll extends hc{constructor(A){super(fh,"transform",!0),this.groupParent=null,this.ifEmpty=null,this.nameAttr=null,this.picture=null,this.presence=null,this.rename=null,this.whitespace=null}}class Jl extends dc{constructor(A){super(fh,"type",["none","ascii85","asciiHex","ccittfax","flate","lzw","runLength","native","xdp","mergedXDP"])}}class Hl extends fc{constructor(A){super(fh,"uri")}}class Yl extends dc{constructor(A){super(fh,"validate",["preSubmit","prePrint","preExecute","preSave"])}}class vl extends uc{constructor(A){super(fh,"validateApprovalSignatures")}[yo](){this[uo]=this[uo].trim().split(/\s+/).filter((A=>["docReady","postSign"].includes(A)))}}class Kl extends dc{constructor(A){super(fh,"validationMessaging",["allMessagesIndividually","allMessagesTogether","firstMessageOnly","noMessages"])}}class ql extends dc{constructor(A){super(fh,"version",["1.7","1.6","1.5","1.4","1.3","1.2"])}}class Tl extends hc{constructor(A){super(fh,"VersionControl"),this.outputBelow=NI(A.outputBelow,["warn","error","update"]),this.sourceAbove=NI(A.sourceAbove,["warn","error"]),this.sourceBelow=NI(A.sourceBelow,["update","maintain"])}}class Pl extends hc{constructor(A){super(fh,"viewerPreferences",!0),this.ADBE_JSConsole=null,this.ADBE_JSDebugger=null,this.addViewerPreferences=null,this.duplexOption=null,this.enforce=null,this.numberOfCopies=null,this.pageRange=null,this.pickTrayByPDFSize=null,this.printScaling=null}}class Wl extends hc{constructor(A){super(fh,"webClient",!0),this.name=A.name?A.name.trim():"",this.fontInfo=null,this.xdc=null}}class Zl extends dc{constructor(A){super(fh,"whitespace",["preserve","ltrim","normalize","rtrim","trim"])}}class Ol extends uc{constructor(A){super(fh,"window")}[yo](){const A=this[uo].trim().split(/\s*,\s*/,2).map((A=>parseInt(A,10)));A.some((A=>isNaN(A)))?this[uo]=[0,0]:(1===A.length&&A.push(A[0]),this[uo]=A)}}class Xl extends hc{constructor(A){super(fh,"xdc",!0),this.uri=new Qc,this.xsl=new Qc}}class Vl extends hc{constructor(A){super(fh,"xdp",!0),this.packets=null}}class jl extends hc{constructor(A){super(fh,"xsl",!0),this.debug=null,this.uri=null}}class zl extends hc{constructor(A){super(fh,"zpl",!0),this.name=A.name?A.name.trim():"",this.batchOutput=null,this.flipLabel=null,this.fontInfo=null,this.xdc=null}}class _l{static[wI](A,e){if(_l.hasOwnProperty(A))return _l[A](e)}static acrobat(A){return new ph(A)}static acrobat7(A){return new mh(A)}static ADBE_JSConsole(A){return new yh(A)}static ADBE_JSDebugger(A){return new wh(A)}static addSilentPrint(A){return new Dh(A)}static addViewerPreferences(A){return new bh(A)}static adjustData(A){return new kh(A)}static adobeExtensionLevel(A){return new Fh(A)}static agent(A){return new Sh(A)}static alwaysEmbed(A){return new Rh(A)}static amd(A){return new Gh(A)}static area(A){return new Nh(A)}static attributes(A){return new xh(A)}static autoSave(A){return new Uh(A)}static base(A){return new Mh(A)}static batchOutput(A){return new Lh(A)}static behaviorOverride(A){return new Jh(A)}static cache(A){return new Hh(A)}static change(A){return new Yh(A)}static common(A){return new vh(A)}static compress(A){return new Kh(A)}static compressLogicalStructure(A){return new qh(A)}static compressObjectStream(A){return new Th(A)}static compression(A){return new Ph(A)}static config(A){return new Wh(A)}static conformance(A){return new Zh(A)}static contentCopy(A){return new Oh(A)}static copies(A){return new Xh(A)}static creator(A){return new Vh(A)}static currentPage(A){return new jh(A)}static data(A){return new zh(A)}static debug(A){return new _h(A)}static defaultTypeface(A){return new $h(A)}static destination(A){return new AQ(A)}static documentAssembly(A){return new eQ(A)}static driver(A){return new tQ(A)}static duplexOption(A){return new iQ(A)}static dynamicRender(A){return new aQ(A)}static embed(A){return new sQ(A)}static encrypt(A){return new nQ(A)}static encryption(A){return new gQ(A)}static encryptionLevel(A){return new rQ(A)}static enforce(A){return new oQ(A)}static equate(A){return new IQ(A)}static equateRange(A){return new cQ(A)}static exclude(A){return new CQ(A)}static excludeNS(A){return new BQ(A)}static flipLabel(A){return new hQ(A)}static fontInfo(A){return new QQ(A)}static formFieldFilling(A){return new lQ(A)}static groupParent(A){return new EQ(A)}static ifEmpty(A){return new uQ(A)}static includeXDPContent(A){return new dQ(A)}static incrementalLoad(A){return new fQ(A)}static incrementalMerge(A){return new pQ(A)}static interactive(A){return new mQ(A)}static jog(A){return new yQ(A)}static labelPrinter(A){return new wQ(A)}static layout(A){return new DQ(A)}static level(A){return new bQ(A)}static linearized(A){return new kQ(A)}static locale(A){return new FQ(A)}static localeSet(A){return new SQ(A)}static log(A){return new RQ(A)}static map(A){return new GQ(A)}static mediumInfo(A){return new NQ(A)}static message(A){return new xQ(A)}static messaging(A){return new UQ(A)}static mode(A){return new MQ(A)}static modifyAnnots(A){return new LQ(A)}static msgId(A){return new JQ(A)}static nameAttr(A){return new HQ(A)}static neverEmbed(A){return new YQ(A)}static numberOfCopies(A){return new vQ(A)}static openAction(A){return new KQ(A)}static output(A){return new qQ(A)}static outputBin(A){return new TQ(A)}static outputXSL(A){return new PQ(A)}static overprint(A){return new WQ(A)}static packets(A){return new ZQ(A)}static pageOffset(A){return new OQ(A)}static pageRange(A){return new XQ(A)}static pagination(A){return new VQ(A)}static paginationOverride(A){return new jQ(A)}static part(A){return new zQ(A)}static pcl(A){return new _Q(A)}static pdf(A){return new $Q(A)}static pdfa(A){return new Al(A)}static permissions(A){return new el(A)}static pickTrayByPDFSize(A){return new tl(A)}static picture(A){return new il(A)}static plaintextMetadata(A){return new al(A)}static presence(A){return new sl(A)}static present(A){return new nl(A)}static print(A){return new gl(A)}static printHighQuality(A){return new rl(A)}static printScaling(A){return new ol(A)}static printerName(A){return new Il(A)}static producer(A){return new cl(A)}static ps(A){return new Cl(A)}static range(A){return new Bl(A)}static record(A){return new hl(A)}static relevant(A){return new Ql(A)}static rename(A){return new ll(A)}static renderPolicy(A){return new El(A)}static runScripts(A){return new ul(A)}static script(A){return new dl(A)}static scriptModel(A){return new fl(A)}static severity(A){return new pl(A)}static silentPrint(A){return new ml(A)}static staple(A){return new yl(A)}static startNode(A){return new wl(A)}static startPage(A){return new Dl(A)}static submitFormat(A){return new bl(A)}static submitUrl(A){return new kl(A)}static subsetBelow(A){return new Fl(A)}static suppressBanner(A){return new Sl(A)}static tagged(A){return new Rl(A)}static template(A){return new Gl(A)}static templateCache(A){return new Ul(A)}static threshold(A){return new Nl(A)}static to(A){return new xl(A)}static trace(A){return new Ml(A)}static transform(A){return new Ll(A)}static type(A){return new Jl(A)}static uri(A){return new Hl(A)}static validate(A){return new Yl(A)}static validateApprovalSignatures(A){return new vl(A)}static validationMessaging(A){return new Kl(A)}static version(A){return new ql(A)}static versionControl(A){return new Tl(A)}static viewerPreferences(A){return new Pl(A)}static webClient(A){return new Wl(A)}static whitespace(A){return new Zl(A)}static window(A){return new Ol(A)}static xdc(A){return new Xl(A)}static xdp(A){return new Vl(A)}static xsl(A){return new jl(A)}static zpl(A){return new zl(A)}}const $l=DI.connectionSet.id;class AE extends hc{constructor(A){super($l,"connectionSet",!0),this.wsdlConnection=new Qc,this.xmlConnection=new Qc,this.xsdConnection=new Qc}}class eE extends hc{constructor(A){super($l,"effectiveInputPolicy"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class tE extends hc{constructor(A){super($l,"effectiveOutputPolicy"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class iE extends fc{constructor(A){super($l,"operation"),this.id=A.id||"",this.input=A.input||"",this.name=A.name||"",this.output=A.output||"",this.use=A.use||"",this.usehref=A.usehref||""}}class aE extends fc{constructor(A){super($l,"rootElement"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class sE extends fc{constructor(A){super($l,"soapAction"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class nE extends fc{constructor(A){super($l,"soapAddress"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class gE extends fc{constructor(A){super($l,"uri"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class rE extends fc{constructor(A){super($l,"wsdlAddress"),this.id=A.id||"",this.name=A.name||"",this.use=A.use||"",this.usehref=A.usehref||""}}class oE extends hc{constructor(A){super($l,"wsdlConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.effectiveInputPolicy=null,this.effectiveOutputPolicy=null,this.operation=null,this.soapAction=null,this.soapAddress=null,this.wsdlAddress=null}}class IE extends hc{constructor(A){super($l,"xmlConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.uri=null}}class cE extends hc{constructor(A){super($l,"xsdConnection",!0),this.dataDescription=A.dataDescription||"",this.name=A.name||"",this.rootElement=null,this.uri=null}}class CE{static[wI](A,e){if(CE.hasOwnProperty(A))return CE[A](e)}static connectionSet(A){return new AE(A)}static effectiveInputPolicy(A){return new eE(A)}static effectiveOutputPolicy(A){return new tE(A)}static operation(A){return new iE(A)}static rootElement(A){return new aE(A)}static soapAction(A){return new sE(A)}static soapAddress(A){return new nE(A)}static uri(A){return new gE(A)}static wsdlAddress(A){return new rE(A)}static wsdlConnection(A){return new oE(A)}static xmlConnection(A){return new IE(A)}static xsdConnection(A){return new cE(A)}}const BE=DI.datasets.id;class hE extends Ec{constructor(A){super(BE,"data",A)}[Vo](){return!0}}class QE extends hc{constructor(A){super(BE,"datasets",!0),this.data=null,this.Signature=null}[aI](A){const e=A[tI];("data"===e&&A[eI]===BE||"Signature"===e&&A[eI]===DI.signature.id)&&(this[e]=A),this[co](A)}}class lE{static[wI](A,e){if(lE.hasOwnProperty(A))return lE[A](e)}static datasets(A){return new QE(A)}static data(A){return new hE(A)}}const EE=DI.localeSet.id;class uE extends hc{constructor(A){super(EE,"calendarSymbols",!0),this.name="gregorian",this.dayNames=new Qc(2),this.eraNames=null,this.meridiemNames=null,this.monthNames=new Qc(2)}}class dE extends fc{constructor(A){super(EE,"currencySymbol"),this.name=NI(A.name,["symbol","isoname","decimal"])}}class fE extends hc{constructor(A){super(EE,"currencySymbols",!0),this.currencySymbol=new Qc(3)}}class pE extends fc{constructor(A){super(EE,"datePattern"),this.name=NI(A.name,["full","long","med","short"])}}class mE extends hc{constructor(A){super(EE,"datePatterns",!0),this.datePattern=new Qc(4)}}class yE extends uc{constructor(A){super(EE,"dateTimeSymbols")}}class wE extends fc{constructor(A){super(EE,"day")}}class DE extends hc{constructor(A){super(EE,"dayNames",!0),this.abbr=SI({data:A.abbr,defaultValue:0,validate:A=>1===A}),this.day=new Qc(7)}}class bE extends fc{constructor(A){super(EE,"era")}}class kE extends hc{constructor(A){super(EE,"eraNames",!0),this.era=new Qc(2)}}class FE extends hc{constructor(A){super(EE,"locale",!0),this.desc=A.desc||"",this.name="isoname",this.calendarSymbols=null,this.currencySymbols=null,this.datePatterns=null,this.dateTimeSymbols=null,this.numberPatterns=null,this.numberSymbols=null,this.timePatterns=null,this.typeFaces=null}}class SE extends hc{constructor(A){super(EE,"localeSet",!0),this.locale=new Qc}}class RE extends fc{constructor(A){super(EE,"meridiem")}}class GE extends hc{constructor(A){super(EE,"meridiemNames",!0),this.meridiem=new Qc(2)}}class NE extends fc{constructor(A){super(EE,"month")}}class xE extends hc{constructor(A){super(EE,"monthNames",!0),this.abbr=SI({data:A.abbr,defaultValue:0,validate:A=>1===A}),this.month=new Qc(12)}}class UE extends fc{constructor(A){super(EE,"numberPattern"),this.name=NI(A.name,["full","long","med","short"])}}class ME extends hc{constructor(A){super(EE,"numberPatterns",!0),this.numberPattern=new Qc(4)}}class LE extends fc{constructor(A){super(EE,"numberSymbol"),this.name=NI(A.name,["decimal","grouping","percent","minus","zero"])}}class JE extends hc{constructor(A){super(EE,"numberSymbols",!0),this.numberSymbol=new Qc(5)}}class HE extends fc{constructor(A){super(EE,"timePattern"),this.name=NI(A.name,["full","long","med","short"])}}class YE extends hc{constructor(A){super(EE,"timePatterns",!0),this.timePattern=new Qc(4)}}class vE extends hc{constructor(A){super(EE,"typeFace",!0),this.name=""|A.name}}class KE extends hc{constructor(A){super(EE,"typeFaces",!0),this.typeFace=new Qc}}class qE{static[wI](A,e){if(qE.hasOwnProperty(A))return qE[A](e)}static calendarSymbols(A){return new uE(A)}static currencySymbol(A){return new dE(A)}static currencySymbols(A){return new fE(A)}static datePattern(A){return new pE(A)}static datePatterns(A){return new mE(A)}static dateTimeSymbols(A){return new yE(A)}static day(A){return new wE(A)}static dayNames(A){return new DE(A)}static era(A){return new bE(A)}static eraNames(A){return new kE(A)}static locale(A){return new FE(A)}static localeSet(A){return new SE(A)}static meridiem(A){return new RE(A)}static meridiemNames(A){return new GE(A)}static month(A){return new NE(A)}static monthNames(A){return new xE(A)}static numberPattern(A){return new UE(A)}static numberPatterns(A){return new ME(A)}static numberSymbol(A){return new LE(A)}static numberSymbols(A){return new JE(A)}static timePattern(A){return new HE(A)}static timePatterns(A){return new YE(A)}static typeFace(A){return new vE(A)}static typeFaces(A){return new KE(A)}}const TE=DI.signature.id;class PE extends hc{constructor(A){super(TE,"signature",!0)}}class WE{static[wI](A,e){if(WE.hasOwnProperty(A))return WE[A](e)}static signature(A){return new PE(A)}}const ZE=DI.stylesheet.id;class OE extends hc{constructor(A){super(ZE,"stylesheet",!0)}}class XE{static[wI](A,e){if(XE.hasOwnProperty(A))return XE[A](e)}static stylesheet(A){return new OE(A)}}const VE=DI.xdp.id;class jE extends hc{constructor(A){super(VE,"xdp",!0),this.uuid=A.uuid||"",this.timeStamp=A.timeStamp||"",this.config=null,this.connectionSet=null,this.datasets=null,this.localeSet=null,this.stylesheet=new Qc,this.template=null}[sI](A){const e=DI[A[tI]];return e&&A[eI]===e.id}}class zE{static[wI](A,e){if(zE.hasOwnProperty(A))return zE[A](e)}static xdp(A){return new jE(A)}}const _E=DI.xhtml.id,$E=Symbol(),Au=new Set(["color","font","font-family","font-size","font-stretch","font-style","font-weight","margin","margin-bottom","margin-left","margin-right","margin-top","letter-spacing","line-height","orphans","page-break-after","page-break-before","page-break-inside","tab-interval","tab-stop","text-align","text-decoration","text-indent","vertical-align","widows","kerning-mode","xfa-font-horizontal-scale","xfa-font-vertical-scale","xfa-spacerun","xfa-tab-stops"]),eu=new Map([["page-break-after","breakAfter"],["page-break-before","breakBefore"],["page-break-inside","breakInside"],["kerning-mode",A=>"none"===A?"none":"normal"],["xfa-font-horizontal-scale",A=>`scaleX(${Math.max(0,Math.min(parseInt(A)/100)).toFixed(2)})`],["xfa-font-vertical-scale",A=>`scaleY(${Math.max(0,Math.min(parseInt(A)/100)).toFixed(2)})`],["xfa-spacerun",""],["xfa-tab-stops",""],["font-size",(A,e)=>wc(.99*(A=e.fontSize=xI(A)))],["letter-spacing",A=>wc(xI(A))],["line-height",A=>wc(xI(A))],["margin",A=>wc(xI(A))],["margin-bottom",A=>wc(xI(A))],["margin-left",A=>wc(xI(A))],["margin-right",A=>wc(xI(A))],["margin-top",A=>wc(xI(A))],["text-indent",A=>wc(xI(A))],["font-family",A=>A],["vertical-align",A=>wc(xI(A))]]),tu=/\s+/g,iu=/[\r\n]+/g,au=/\r\n?/g;function su(A,e,t){const i=Object.create(null);if(!A)return i;const a=Object.create(null);for(const[e,t]of A.split(";").map((A=>A.split(":",2)))){const A=eu.get(e);if(""===A)continue;let s=t;A&&(s="string"==typeof A?A:A(t,a)),e.endsWith("scale")?i.transform=i.transform?`${i[e]} ${s}`:s:i[e.replaceAll(/-([a-zA-Z])/g,((A,e)=>e.toUpperCase()))]=s}if(i.fontFamily&&Yc({typeface:i.fontFamily,weight:i.fontWeight||"normal",posture:i.fontStyle||"normal",size:a.fontSize||0},e,e[vo].fontFinder,i),t&&i.verticalAlign&&"0px"!==i.verticalAlign&&i.fontSize){const A=.583,e=.333,t=xI(i.fontSize);i.fontSize=wc(t*A),i.verticalAlign=wc(Math.sign(xI(i.verticalAlign))*t*e)}return t&&i.fontSize&&(i.fontSize=`calc(${i.fontSize} * var(--scale-factor))`),Uc(i),i}const nu=new Set(["body","html"]);class gu extends Ec{constructor(A,e){super(_E,e),this[$E]=!1,this.style=A.style||""}[Bo](A){var e;super[Bo](A),this.style=(e=this).style?e.style.trim().split(/\s*;\s*/).filter((A=>!!A)).map((A=>A.split(/\s*:\s*/,2))).filter((([A,t])=>("font-family"===A&&e[vo].usedTypefaces.add(t),Au.has(A)))).map((A=>A.join(":"))).join(";"):""}[oo](){return!nu.has(this[tI])}[nI](A,e=!1){e?this[$E]=!0:(A=A.replaceAll(iu,""),this.style.includes("xfa-spacerun:yes")||(A=A.replaceAll(tu," "))),A&&(this[uo]+=A)}[gI](A,e=!0){const t=Object.create(null),i={top:NaN,bottom:NaN,left:NaN,right:NaN};let a=null;for(const[A,e]of this.style.split(";").map((A=>A.split(":",2))))switch(A){case"font-family":t.typeface=FI(e);break;case"font-size":t.size=xI(e);break;case"font-weight":t.weight=e;break;case"font-style":t.posture=e;break;case"letter-spacing":t.letterSpacing=xI(e);break;case"margin":const A=e.split(/ \t/).map((A=>xI(A)));switch(A.length){case 1:i.top=i.bottom=i.left=i.right=A[0];break;case 2:i.top=i.bottom=A[0],i.left=i.right=A[1];break;case 3:i.top=A[0],i.bottom=A[2],i.left=i.right=A[1];break;case 4:i.top=A[0],i.left=A[1],i.bottom=A[2],i.right=A[3]}break;case"margin-top":i.top=xI(e);break;case"margin-bottom":i.bottom=xI(e);break;case"margin-left":i.left=xI(e);break;case"margin-right":i.right=xI(e);break;case"line-height":a=xI(e)}if(A.pushData(t,i,a),this[uo])A.addString(this[uo]);else for(const e of this[Uo]())"#text"!==e[tI]?e[gI](A):A.addString(e[uo]);e&&A.popFont()}[fI](A){const e=[];if(this[mo]={children:e},this[Co]({}),0===e.length&&!this[uo])return LI.EMPTY;let t;return t=this[$E]?this[uo]?this[uo].replaceAll(au,"\n"):void 0:this[uo]||void 0,LI.success({name:this[tI],attributes:{href:this.href,style:su(this.style,this,this[$E])},children:e,value:t})}}class ru extends gu{constructor(A){super(A,"a"),this.href=vc(A.href)||""}}class ou extends gu{constructor(A){super(A,"b")}[gI](A){A.pushFont({weight:"bold"}),super[gI](A),A.popFont()}}class Iu extends gu{constructor(A){super(A,"body")}[fI](A){const e=super[fI](A),{html:t}=e;return t?(t.name="div",t.attributes.class=["xfaRich"],e):LI.EMPTY}}class cu extends gu{constructor(A){super(A,"br")}[uI](){return"\n"}[gI](A){A.addString("\n")}[fI](A){return LI.success({name:"br"})}}class Cu extends gu{constructor(A){super(A,"html")}[fI](A){const e=[];if(this[mo]={children:e},this[Co]({}),0===e.length)return LI.success({name:"div",attributes:{class:["xfaRich"],style:{}},value:this[uo]||""});if(1===e.length){const A=e[0];if(A.attributes?.class.includes("xfaRich"))return LI.success(A)}return LI.success({name:"div",attributes:{class:["xfaRich"],style:{}},children:e})}}class Bu extends gu{constructor(A){super(A,"i")}[gI](A){A.pushFont({posture:"italic"}),super[gI](A),A.popFont()}}class hu extends gu{constructor(A){super(A,"li")}}class Qu extends gu{constructor(A){super(A,"ol")}}class lu extends gu{constructor(A){super(A,"p")}[gI](A){super[gI](A,!1),A.addString("\n"),A.addPara(),A.popFont()}[uI](){return this[Ho]()[Uo]().at(-1)===this?super[uI]():super[uI]()+"\n"}}class Eu extends gu{constructor(A){super(A,"span")}}class uu extends gu{constructor(A){super(A,"sub")}}class du extends gu{constructor(A){super(A,"sup")}}class fu extends gu{constructor(A){super(A,"ul")}}class pu{static[wI](A,e){if(pu.hasOwnProperty(A))return pu[A](e)}static a(A){return new ru(A)}static b(A){return new ou(A)}static body(A){return new Iu(A)}static br(A){return new cu(A)}static html(A){return new Cu(A)}static i(A){return new Bu(A)}static li(A){return new hu(A)}static ol(A){return new Qu(A)}static p(A){return new lu(A)}static span(A){return new Eu(A)}static sub(A){return new uu(A)}static sup(A){return new du(A)}static ul(A){return new fu(A)}}const mu={config:_l,connection:CE,datasets:lE,localeSet:qE,signature:WE,stylesheet:XE,template:Qh,xdp:zE,xhtml:pu};class yu{constructor(A){this.namespaceId=A}[wI](A,e){return new Ec(this.namespaceId,A,e)}}class wu extends hc{constructor(A){super(-1,"root",Object.create(null)),this.element=null,this[qo]=A}[aI](A){return this.element=A,!0}[yo](){super[yo](),this.element.template instanceof ih&&(this[qo].set(cI,this.element),this.element.template[CI](this[qo]),this.element.template[qo]=this[qo])}}class Du extends hc{constructor(){super(-1,"",Object.create(null))}[aI](A){return!1}}class bu{constructor(A=null){this._namespaceStack=[],this._nsAgnosticLevel=0,this._namespacePrefixes=new Map,this._namespaces=new Map,this._nextNsId=Math.max(...Object.values(DI).map((({id:A})=>A))),this._currentNamespace=A||new yu(++this._nextNsId)}buildRoot(A){return new wu(A)}build({nsPrefix:A,name:e,attributes:t,namespace:i,prefixes:a}){const s=null!==i;if(s&&(this._namespaceStack.push(this._currentNamespace),this._currentNamespace=this._searchNamespace(i)),a&&this._addNamespacePrefix(a),t.hasOwnProperty(iI)){const A=mu.datasets,e=t[iI];let i=null;for(const[t,a]of Object.entries(e))if(this._getNamespaceToUse(t)===A){i={xfa:a};break}i?t[iI]=i:delete t[iI]}const n=this._getNamespaceToUse(A),g=n?.[wI](e,t)||new Du;return g[Vo]()&&this._nsAgnosticLevel++,(s||a||g[Vo]())&&(g[Qo]={hasNamespace:s,prefixes:a,nsAgnostic:g[Vo]()}),g}isNsAgnostic(){return this._nsAgnosticLevel>0}_searchNamespace(A){let e=this._namespaces.get(A);if(e)return e;for(const[t,{check:i}]of Object.entries(DI))if(i(A)){if(e=mu[t],e)return this._namespaces.set(A,e),e;break}return e=new yu(++this._nextNsId),this._namespaces.set(A,e),e}_addNamespacePrefix(A){for(const{prefix:e,value:t}of A){const A=this._searchNamespace(t);let i=this._namespacePrefixes.get(e);i||(i=[],this._namespacePrefixes.set(e,i)),i.push(A)}}_getNamespaceToUse(A){if(!A)return this._currentNamespace;const e=this._namespacePrefixes.get(A);return e?.length>0?e.at(-1):(R(`Unknown namespace prefix: ${A}.`),null)}clean(A){const{hasNamespace:e,prefixes:t,nsAgnostic:i}=A;e&&(this._currentNamespace=this._namespaceStack.pop()),t&&t.forEach((({prefix:A})=>{this._namespacePrefixes.get(A).pop()})),i&&this._nsAgnosticLevel--}}class ku extends Dr{constructor(A=null,e=!1){super(),this._builder=new bu(A),this._stack=[],this._globalData={usedTypefaces:new Set},this._ids=new Map,this._current=this._builder.buildRoot(this._ids),this._errorCode=0,this._whiteRegex=/^\s+$/,this._nbsps=/\xa0+/g,this._richText=e}parse(A){if(this.parseXml(A),0===this._errorCode)return this._current[yo](),this._current.element}onText(A){A=A.replace(this._nbsps,(A=>A.slice(1)+" ")),this._richText||this._current[oo]()?this._current[nI](A,this._richText):this._whiteRegex.test(A)||this._current[nI](A.trim())}onCdata(A){this._current[nI](A)}_mkAttributes(A,e){let t=null,i=null;const a=Object.create({});for(const{name:s,value:n}of A)if("xmlns"===s)t?R(`XFA - multiple namespace definition in <${e}>`):t=n;else if(s.startsWith("xmlns:")){const A=s.substring(6);i||(i=[]),i.push({prefix:A,value:n})}else{const A=s.indexOf(":");if(-1===A)a[s]=n;else{let e=a[iI];e||(e=a[iI]=Object.create(null));const[t,i]=[s.slice(0,A),s.slice(A+1)];(e[t]||=Object.create(null))[i]=n}}return[t,i,a]}_getNameAndPrefix(A,e){const t=A.indexOf(":");return-1===t?[A,null]:[A.substring(t+1),e?"":A.substring(0,t)]}onBeginElement(A,e,t){const[i,a,s]=this._mkAttributes(e,A),[n,g]=this._getNameAndPrefix(A,this._builder.isNsAgnostic()),r=this._builder.build({nsPrefix:g,name:n,attributes:s,namespace:i,prefixes:a});if(r[vo]=this._globalData,t)return r[yo](),this._current[aI](r)&&r[hI](this._ids),void r[Bo](this._builder);this._stack.push(this._current),this._current=r}onEndElement(A){const e=this._current;if(e[Wo]()&&"string"==typeof e[uo]){const A=new ku;A._globalData=this._globalData;const t=A.parse(e[uo]);e[uo]=null,e[aI](t)}e[yo](),this._current=this._stack.pop(),this._current[aI](e)&&e[hI](this._ids),e[Bo](this._builder)}onError(A){this._errorCode=A}}class Fu{constructor(A){try{this.root=(new ku).parse(Fu._createDocument(A));const e=new uh(this.root);this.form=e.bind(),this.dataHandler=new dh(this.root,e.getData()),this.form[vo].template=this.form}catch(A){R(`XFA - an error occurred during parsing and binding: ${A}`)}}isValid(){return this.root&&this.form}_createPagesHelper(){const A=this.form[dI]();return new Promise(((e,t)=>{const i=()=>{try{const t=A.next();t.done?e(t.value):setTimeout(i,0)}catch(A){t(A)}};setTimeout(i,0)}))}async _createPages(){try{this.pages=await this._createPagesHelper(),this.dims=this.pages.children.map((A=>{const{width:e,height:t}=A.attributes.style;return[0,0,parseInt(e),parseInt(t)]}))}catch(A){R(`XFA - an error occurred during layout: ${A}`)}}getBoundingBox(A){return this.dims[A]}async getNumPages(){return this.pages||await this._createPages(),this.dims.length}setImages(A){this.form[vo].images=A}setFonts(A){this.form[vo].fontFinder=new JI(A);const e=[];for(let A of this.form[vo].usedTypefaces)A=FI(A),this.form[vo].fontFinder.find(A)||e.push(A);return e.length>0?e:null}appendFonts(A,e){this.form[vo].fontFinder.add(A,e)}async getPages(){this.pages||await this._createPages();const A=this.pages;return this.pages=null,A}serializeData(A){return this.dataHandler.serialize(A)}static _createDocument(A){return A["/xdp:xdp"]?Object.values(A).join(""):A["xdp:xdp"]}static getRichTextAsHtml(A){if(!A||"string"!=typeof A)return null;try{let e=new ku(pu,!0).parse(A);if(!["body","xhtml"].includes(e[tI])){const A=pu.body({});A[co](e),e=A}const t=e[fI]();if(!t.success)return null;const{html:i}=t,{attributes:a}=i;return a&&(a.class&&(a.class=a.class.filter((A=>!A.startsWith("xfa")))),a.dir="auto"),{html:i,str:e[uI]()}}catch(A){R(`XFA - an error occurred during parsing of rich text: ${A}`)}return null}}class Su{static createGlobals(A){return Promise.all([A.ensureCatalog("acroForm"),A.ensureDoc("xfaDatasets"),A.ensureCatalog("structTreeRoot"),A.ensureCatalog("baseUrl"),A.ensureCatalog("attachments")]).then((([e,t,i,a,s])=>({pdfManager:A,acroForm:e instanceof CA?e:CA.empty,xfaDatasets:t,structTreeRoot:i,baseUrl:a,attachments:s})),(A=>(R(`createGlobals: "${A}".`),null)))}static async create(A,e,t,i,a,s,n){const g=a?await this._getPageIndex(A,e,t.pdfManager):null;return t.pdfManager.ensure(this,"_create",[A,e,t,i,a,s,g,n])}static _create(A,e,t,i,a=!1,s=null,n=null,g=null){const r=A.fetchIfRef(e);if(!(r instanceof CA))return;const{acroForm:o,pdfManager:I}=t,c=e instanceof BA?e.toString():`annot_${i.createObjId()}`;let C=r.get("Subtype");C=C instanceof oA?C.name:null;const B={xref:A,ref:e,dict:r,subtype:C,id:c,annotationGlobals:t,collectFields:a,orphanFields:s,needAppearances:!a&&!0===o.get("NeedAppearances"),pageIndex:n,evaluatorOptions:I.evaluatorOptions,pageRef:g};switch(C){case"Link":return new Tu(B);case"Text":return new qu(B);case"Widget":let A=FA({dict:r,key:"FT"});switch(A=A instanceof oA?A.name:null,A){case"Tx":return new Hu(B);case"Btn":return new Yu(B);case"Ch":return new vu(B);case"Sig":return new Ku(B)}return R(`Unimplemented widget field type "${A}", falling back to base field type.`),new Ju(B);case"Popup":return new Pu(B);case"FreeText":return new Wu(B);case"Line":return new Zu(B);case"Square":return new Ou(B);case"Circle":return new Xu(B);case"PolyLine":return new Vu(B);case"Polygon":return new ju(B);case"Caret":return new zu(B);case"Ink":return new _u(B);case"Highlight":return new $u(B);case"Underline":return new Ad(B);case"Squiggly":return new ed(B);case"StrikeOut":return new td(B);case"Stamp":return new id(B);case"FileAttachment":return new ad(B);default:return a||R(C?`Unimplemented annotation type "${C}", falling back to base annotation.`:"Annotation is missing the required /Subtype."),new Uu(B)}}static async _getPageIndex(A,e,t){try{const i=await A.fetchIfRefAsync(e);if(!(i instanceof CA))return-1;const a=i.getRaw("P");if(a instanceof BA)try{return await t.ensureCatalog("getPageIndex",[a])}catch(A){S(`_getPageIndex -- not a valid page reference: "${A}".`)}if(i.has("Kids"))return-1;const s=await t.ensureDoc("numPages");for(let A=0;AA/255))}function Nu(A,e){const t=A.getArray("QuadPoints");if(!LA(t,null)||0===t.length||t.length%8>0)return null;const i=new Float32Array(t.length);for(let A=0,a=t.length;Ae[2]||he[3]))return null;i.set([C,Q,B,Q,C,h,B,h],A)}return i}function xu(A,e,t){const[i,a,s,n]=V.getAxialAlignedBoundingBox(e,t);if(i===s||a===n)return[1,0,0,1,A[0],A[1]];const g=(A[2]-A[0])/(s-i),r=(A[3]-A[1])/(n-a);return[g,0,0,r,A[0]-i*g,A[1]-a*r]}class Uu{constructor(A){const{dict:e,xref:t,annotationGlobals:i,ref:a,orphanFields:s}=A,n=s?.get(a);n&&e.set("Parent",n),this.setTitle(e.get("T")),this.setContents(e.get("Contents")),this.setModificationDate(e.get("M")),this.setFlags(e.get("F")),this.setRectangle(e.getArray("Rect")),this.setColor(e.getArray("C")),this.setBorderStyle(e),this.setAppearance(e),this.setOptionalContent(e);const g=e.get("MK");this.setBorderAndBackgroundColors(g),this.setRotation(g,e),this.ref=A.ref instanceof BA?A.ref:null,this._streams=[],this.appearance&&this._streams.push(this.appearance);const r=!!(128&this.flags),o=!!(512&this.flags);if(this.data={annotationFlags:this.flags,borderStyle:this.borderStyle,color:this.color,backgroundColor:this.backgroundColor,borderColor:this.borderColor,rotation:this.rotation,contentsObj:this._contents,hasAppearance:!!this.appearance,id:A.id,modificationDate:this.modificationDate,rect:this.rectangle,subtype:A.subtype,hasOwnCanvas:!1,noRotate:!!(16&this.flags),noHTML:r&&o,isEditable:!1,structParent:-1},i.structTreeRoot){let t=e.get("StructParent");this.data.structParent=t=Number.isInteger(t)&&t>=0?t:-1,i.structTreeRoot.addAnnotationIdToPage(A.pageRef,t)}if(A.collectFields){const i=e.get("Kids");if(Array.isArray(i)){const A=[];for(const e of i)e instanceof BA&&A.push(e.toString());0!==A.length&&(this.data.kidIds=A)}this.data.actions=PA(t,e,B),this.data.fieldName=this._constructFieldName(e),this.data.pageIndex=A.pageIndex}const I=e.get("IT");I instanceof oA&&(this.data.it=I.name),this._isOffscreenCanvasSupported=A.evaluatorOptions.isOffscreenCanvasSupported,this._fallbackFontDict=null,this._needAppearances=!1}_hasFlag(A,e){return!!(A&e)}_buildFlags(A,e){let{flags:t}=this;if(void 0===A){if(void 0===e)return;return e?-5&t:-3&t|4}return A?(t|=4,e?-33&t|2:-3&t|I):(t&=-35,e?-5&t:4|t)}_isViewable(A){return!this._hasFlag(A,1)&&!this._hasFlag(A,I)}_isPrintable(A){return this._hasFlag(A,4)&&!this._hasFlag(A,2)&&!this._hasFlag(A,1)}mustBeViewed(A,e){const t=A?.get(this.data.id)?.noView;return void 0!==t?!t:this.viewable&&!this._hasFlag(this.flags,2)}mustBePrinted(A){const e=A?.get(this.data.id)?.noPrint;return void 0!==e?!e:this.printable}mustBeViewedWhenEditing(A,e=null){return A?!this.data.isEditable:!e?.has(this.data.id)}get viewable(){return null!==this.data.quadPoints&&(0===this.flags||this._isViewable(this.flags))}get printable(){return null!==this.data.quadPoints&&0!==this.flags&&this._isPrintable(this.flags)}_parseStringHelper(A){const e="string"==typeof A?z(A):"";return{str:e,dir:e&&"rtl"===xg(e).dir?"rtl":"ltr"}}setDefaultAppearance(A){const{dict:e,annotationGlobals:t}=A,i=FA({dict:e,key:"DA"})||t.acroForm.get("DA");this._defaultAppearance="string"==typeof i?i:"",this.data.defaultAppearanceData=hr(this._defaultAppearance)}setTitle(A){this._title=this._parseStringHelper(A)}setContents(A){this._contents=this._parseStringHelper(A)}setModificationDate(A){this.modificationDate="string"==typeof A?A:null}setFlags(A){this.flags=Number.isInteger(A)&&A>0?A:0,1&this.flags&&"Annotation"!==this.constructor.name&&(this.flags^=1)}hasFlag(A){return this._hasFlag(this.flags,A)}setRectangle(A){this.rectangle=YA(A,[0,0,0,0])}setColor(A){this.color=Ru(A)}setLineEndings(A){if(this.lineEndings=["None","None"],Array.isArray(A)&&2===A.length)for(let e=0;e<2;e++){const t=A[e];if(t instanceof oA)switch(t.name){case"None":continue;case"Square":case"Circle":case"Diamond":case"OpenArrow":case"ClosedArrow":case"Butt":case"ROpenArrow":case"RClosedArrow":case"Slash":this.lineEndings[e]=t.name;continue}R(`Ignoring invalid lineEnding: ${t}`)}}setRotation(A,e){this.rotation=0;let t=A instanceof CA?A.get("R")||0:e.get("Rotate")||0;Number.isInteger(t)&&0!==t&&(t%=360,t<0&&(t+=360),t%90==0&&(this.rotation=t))}setBorderAndBackgroundColors(A){A instanceof CA?(this.borderColor=Ru(A.getArray("BC"),null),this.backgroundColor=Ru(A.getArray("BG"),null)):this.borderColor=this.backgroundColor=null}setBorderStyle(A){if(this.borderStyle=new Mu,A instanceof CA)if(A.has("BS")){const e=A.get("BS");if(e instanceof CA){const A=e.get("Type");A&&!lA(A,"Border")||(this.borderStyle.setWidth(e.get("W"),this.rectangle),this.borderStyle.setStyle(e.get("S")),this.borderStyle.setDashArray(e.getArray("D")))}}else if(A.has("Border")){const e=A.getArray("Border");Array.isArray(e)&&e.length>=3&&(this.borderStyle.setHorizontalCornerRadius(e[0]),this.borderStyle.setVerticalCornerRadius(e[1]),this.borderStyle.setWidth(e[2],this.rectangle),4===e.length&&this.borderStyle.setDashArray(e[3],!0))}else this.borderStyle.setWidth(0)}setAppearance(A){this.appearance=null;const e=A.get("AP");if(!(e instanceof CA))return;const t=e.get("N");if(t instanceof fA)return void(this.appearance=t);if(!(t instanceof CA))return;const i=A.get("AS");if(!(i instanceof oA&&t.has(i.name)))return;const a=t.get(i.name);a instanceof fA&&(this.appearance=a)}setOptionalContent(A){this.oc=null;const e=A.get("OC");e instanceof oA?R("setOptionalContent: Support for /Name-entry is not implemented."):e instanceof CA&&(this.oc=e)}loadResources(A,e){return e.dict.getAsync("Resources").then((e=>{if(e)return new ro(e,A,e.xref).load().then((function(){return e}))}))}async getOperatorList(A,e,t,a){const{hasOwnCanvas:s,id:n,rect:g}=this.data;let r=this.appearance;const o=!!(s&&2&t);if(o&&(g[0]===g[2]||g[1]===g[3]))return this.data.hasOwnCanvas=!1,{opList:new _g,separateForm:!1,separateCanvas:!1};if(!r){if(!o)return{opList:new _g,separateForm:!1,separateCanvas:!1};r=new se(""),r.dict=new CA}const I=r.dict,c=await this.loadResources(["ExtGState","ColorSpace","Pattern","Shading","XObject","Font"],r),C=HA(I.getArray("BBox"),[0,0,1,1]),B=JA(I.getArray("Matrix"),i),h=xu(g,C,B),Q=new _g;let l;return this.oc&&(l=await A.parseMarkedContentProps(this.oc,null)),void 0!==l&&Q.addOp(y,["OC",l]),Q.addOp(80,[n,g,h,B,o]),await A.getOperatorList({stream:r,task:e,resources:c,operatorList:Q,fallbackFontDict:this._fallbackFontDict}),Q.addOp(81,[]),void 0!==l&&Q.addOp(w,[]),this.reset(),{opList:Q,separateForm:!1,separateCanvas:o}}async save(A,e,t){return null}get hasTextContent(){return!1}async extractTextContent(A,e,t){if(!this.appearance)return;const i=await this.loadResources(["ExtGState","Font","Properties","XObject"],this.appearance),a=[],s=[];let n=null;const g={desiredSize:Math.Infinity,ready:!0,enqueue(A,e){for(const e of A.items)void 0!==e.str&&(n||=e.transform.slice(-2),s.push(e.str),e.hasEOL&&(a.push(s.join("").trimEnd()),s.length=0))}};if(await A.getTextContent({stream:this.appearance,task:e,resources:i,includeMarkedContent:!0,keepWhiteSpace:!0,sink:g,viewBox:t}),this.reset(),s.length&&a.push(s.join("").trimEnd()),a.length>1||a[0]){const A=this.appearance.dict,e=HA(A.getArray("BBox"),null),t=JA(A.getArray("Matrix"),null);this.data.textPosition=this._transformPoint(n,e,t),this.data.textContent=a}}_transformPoint(A,e,t){const{rect:i}=this.data;e||=[0,0,1,1],t||=[1,0,0,1,0,0];const a=xu(i,e,t);return a[4]-=i[0],a[5]-=i[1],A=V.applyTransform(A,a),V.applyTransform(A,t)}getFieldObject(){return this.data.kidIds?{id:this.data.id,actions:this.data.actions,name:this.data.fieldName,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,type:"",kidIds:this.data.kidIds,page:this.data.pageIndex,rotation:this.rotation}:null}reset(){for(const A of this._streams)A.reset()}_constructFieldName(A){if(!A.has("T")&&!A.has("Parent"))return R("Unknown field name, falling back to empty field name."),"";if(!A.has("Parent"))return z(A.get("T"));const e=[];A.has("T")&&e.unshift(z(A.get("T")));let t=A;const i=new hA;for(A.objId&&i.put(A.objId);t.has("Parent")&&(t=t.get("Parent"),t instanceof CA&&(!t.objId||!i.has(t.objId)));)t.objId&&i.put(t.objId),t.has("T")&&e.unshift(z(t.get("T")));return e.join(".")}}class Mu{constructor(){this.width=1,this.rawWidth=1,this.style=1,this.dashArray=[3],this.horizontalCornerRadius=0,this.verticalCornerRadius=0}setWidth(A,e=[0,0,0,0]){if(A instanceof oA)this.width=0;else if("number"==typeof A){if(A>0){this.rawWidth=A;const t=(e[2]-e[0])/2,i=(e[3]-e[1])/2;t>0&&i>0&&(A>t||A>i)&&(R(`AnnotationBorderStyle.setWidth - ignoring width: ${A}`),A=1)}this.width=A}}setStyle(A){if(A instanceof oA)switch(A.name){case"S":this.style=1;break;case"D":this.style=2;break;case"B":this.style=3;break;case"I":this.style=4;break;case"U":this.style=5}}setDashArray(A,e=!1){if(Array.isArray(A)){let t=!0,i=!0;for(const e of A){if(!(+e>=0)){t=!1;break}e>0&&(i=!1)}0===A.length||t&&!i?(this.dashArray=A,e&&this.setStyle(oA.get("D"))):this.width=0}else A&&(this.width=0)}setHorizontalCornerRadius(A){Number.isInteger(A)&&(this.horizontalCornerRadius=A)}setVerticalCornerRadius(A){Number.isInteger(A)&&(this.verticalCornerRadius=A)}}class Lu extends Uu{constructor(A){super(A);const{dict:e}=A;if(e.has("IRT")){const A=e.getRaw("IRT");this.data.inReplyTo=A instanceof BA?A.toString():null;const t=e.get("RT");this.data.replyType=t instanceof oA?t.name:"R"}let t=null;if(this.data.replyType===o){const A=e.get("IRT");this.setTitle(A.get("T")),this.data.titleObj=this._title,this.setContents(A.get("Contents")),this.data.contentsObj=this._contents,A.has("CreationDate")?(this.setCreationDate(A.get("CreationDate")),this.data.creationDate=this.creationDate):this.data.creationDate=null,A.has("M")?(this.setModificationDate(A.get("M")),this.data.modificationDate=this.modificationDate):this.data.modificationDate=null,t=A.getRaw("Popup"),A.has("C")?(this.setColor(A.getArray("C")),this.data.color=this.color):this.data.color=null}else this.data.titleObj=this._title,this.setCreationDate(e.get("CreationDate")),this.data.creationDate=this.creationDate,t=e.getRaw("Popup"),e.has("C")||(this.data.color=null);this.data.popupRef=t instanceof BA?t.toString():null,e.has("RC")&&(this.data.richText=Fu.getRichTextAsHtml(e.get("RC")))}setCreationDate(A){this.creationDate="string"==typeof A?A:null}_setDefaultAppearance({xref:A,extra:e,strokeColor:t,fillColor:i,blendMode:a,strokeAlpha:s,fillAlpha:n,pointsCallback:g}){let r=Number.MAX_VALUE,o=Number.MAX_VALUE,I=Number.MIN_VALUE,c=Number.MIN_VALUE;const C=["q"];e&&C.push(e),t&&C.push(`${t[0]} ${t[1]} ${t[2]} RG`),i&&C.push(`${i[0]} ${i[1]} ${i[2]} rg`);let B=this.data.quadPoints;B||(B=Float32Array.from([this.rectangle[0],this.rectangle[3],this.rectangle[2],this.rectangle[3],this.rectangle[0],this.rectangle[1],this.rectangle[2],this.rectangle[1]]));for(let A=0,e=B.length;A"string"==typeof A)).map((A=>z(A))):A instanceof oA?z(A.name):"string"==typeof A?z(A):null}hasFieldFlag(A){return!!(this.data.fieldFlags&A)}_isViewable(A){return!0}mustBeViewed(A,e){return e?this.viewable:super.mustBeViewed(A,e)&&!this._hasFlag(this.flags,I)}getRotationMatrix(A){let e=A?.get(this.data.id)?.rotation;return void 0===e&&(e=this.rotation),0===e?i:te(e,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1])}getBorderAndBackgroundAppearances(A){let e=A?.get(this.data.id)?.rotation;if(void 0===e&&(e=this.rotation),!this.backgroundColor&&!this.borderColor)return"";const t=this.data.rect[2]-this.data.rect[0],i=this.data.rect[3]-this.data.rect[1],a=0===e||180===e?`0 0 ${t} ${i} re`:`0 0 ${i} ${t} re`;let s="";return this.backgroundColor&&(s=`${lr(this.backgroundColor,!0)} ${a} f `),this.borderColor&&(s+=`${this.borderStyle.width||1} w ${lr(this.borderColor,!1)} ${a} S `),s}async getOperatorList(A,e,t,i){if(16&t&&!(this instanceof Ku)&&!this.data.noHTML&&!this.data.hasOwnCanvas)return{opList:new _g,separateForm:!0,separateCanvas:!1};if(!this._hasText)return super.getOperatorList(A,e,t,i);const a=await this._getAppearance(A,e,t,i);if(this.appearance&&null===a)return super.getOperatorList(A,e,t,i);const s=new _g;if(!this._defaultAppearance||null===a)return{opList:s,separateForm:!1,separateCanvas:!1};const n=!!(this.data.hasOwnCanvas&&2&t),g=[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]],r=xu(this.data.rect,g,[1,0,0,1,0,0]);let o;this.oc&&(o=await A.parseMarkedContentProps(this.oc,null)),void 0!==o&&s.addOp(y,["OC",o]),s.addOp(80,[this.data.id,this.data.rect,r,this.getRotationMatrix(i),n]);const I=new se(a);return await A.getOperatorList({stream:I,task:e,resources:this._fieldResources.mergedResources,operatorList:s}),s.addOp(81,[]),void 0!==o&&s.addOp(w,[]),{opList:s,separateForm:!1,separateCanvas:n}}_getMKDict(A){const e=new CA(null);return A&&e.set("R",A),this.borderColor&&e.set("BC",Gu(this.borderColor)),this.backgroundColor&&e.set("BG",Gu(this.backgroundColor)),e.size>0?e:null}amendSavedDict(A,e){}async save(A,e,t){const a=t?.get(this.data.id),s=this._buildFlags(a?.noView,a?.noPrint);let n=a?.value,g=a?.rotation;if(n===this.data.fieldValue||void 0===n){if(!this._hasValueFromXFA&&void 0===g&&void 0===s)return null;n||=this.data.fieldValue}if(void 0===g&&!this._hasValueFromXFA&&Array.isArray(n)&&Array.isArray(this.data.fieldValue)&&AA(n,this.data.fieldValue)&&void 0===s)return null;void 0===g&&(g=this.rotation);let r=null;if(!this._needAppearances&&(r=await this._getAppearance(A,e,8,t),null===r&&void 0===s))return null;let o=!1;r?.needAppearances&&(o=!0,r=null);const{xref:I}=A,c=I.fetchIfRef(this.ref);if(!(c instanceof CA))return null;const C=new CA(I);for(const A of c.getKeys())"AP"!==A&&C.set(A,c.getRaw(A));if(void 0!==s&&(C.set("F",s),null===r&&!o)){const A=c.getRaw("AP");A&&C.set("AP",A)}const B={path:this.data.fieldName,value:n};C.set("V",Array.isArray(n)?n.map($A):$A(n)),this.amendSavedDict(t,C);const h=this._getMKDict(g);h&&C.set("MK",h);const Q=[],l=[{ref:this.ref,data:"",xfa:B,needAppearances:o}];if(null!==r){const A=I.getNewTemporaryRef(),e=new CA(I);C.set("AP",e),e.set("N",A);const a=this._getSaveFieldResources(I),s=new se(r),n=s.dict=new CA(I);n.set("Subtype",oA.get("Form")),n.set("Resources",a),n.set("BBox",[0,0,this.data.rect[2]-this.data.rect[0],this.data.rect[3]-this.data.rect[1]]);const g=this.getRotationMatrix(t);g!==i&&n.set("Matrix",g),await Tr(A,s,Q,I),l.push({ref:A,data:Q.join(""),xfa:null,needAppearances:!1}),Q.length=0}return C.set("M",`D:${eA()}`),await Tr(this.ref,C,Q,I),l[0].data=Q.join(""),l}async _getAppearance(A,e,t,i){if(this.hasFieldFlag(c))return null;const a=i?.get(this.data.id);let s,g;if(a&&(s=a.formattedValue||a.value,g=a.rotation),void 0===g&&void 0===s&&!this._needAppearances&&(!this._hasValueFromXFA||this.appearance))return null;const r=this.getBorderAndBackgroundAppearances(i);if(void 0===s&&(s=this.data.fieldValue,!s))return`/Tx BMC q ${r}Q EMC`;if(Array.isArray(s)&&1===s.length&&(s=s[0]),N("string"==typeof s,"Expected `value` to be a string."),s=s.trimEnd(),this.data.combo){const A=this.data.options.find((({exportValue:A})=>s===A));s=A?.displayValue||s}if(""===s)return`/Tx BMC q ${r}Q EMC`;void 0===g&&(g=this.rotation);let o,I=-1;this.data.multiLine?(o=s.split(/\r\n?|\n/).map((A=>A.normalize("NFC"))),I=o.length):o=[s.replace(/\r\n?|\n/,"").normalize("NFC")];let C=this.data.rect[3]-this.data.rect[1],B=this.data.rect[2]-this.data.rect[0];90!==g&&270!==g||([B,C]=[C,B]),this._defaultAppearance||(this.data.defaultAppearanceData=hr(this._defaultAppearance="/Helvetica 0 Tf 0 g"));let h,Q,l,E=await Ju._getFontData(A,e,this.data.defaultAppearanceData,this._fieldResources.mergedResources);const u=[];let d=!1;for(const A of o){const e=E.encodeString(A);e.length>1&&(d=!0),u.push(e.join(""))}if(d&&8&t)return{needAppearances:!0};if(d&&this._isOffscreenCanvasSupported){const t=this.data.comb?"monospace":"sans-serif",i=new Er(A.xref,t),a=i.createFontResources(o.join("")),n=a.getRaw("Font");if(this._fieldResources.mergedResources.has("Font")){const A=this._fieldResources.mergedResources.get("Font");for(const e of n.getKeys())A.set(e,n.getRaw(e))}else this._fieldResources.mergedResources.set("Font",n);const g=i.fontName.name;E=await Ju._getFontData(A,e,{fontName:g,fontSize:0},a);for(let A=0,e=u.length;A2?`/Tx BMC q ${r}BT `+h+` 1 0 0 1 ${zA(2)} ${zA(y)} Tm (${qA(u[0])}) Tj ET Q EMC`:`/Tx BMC q ${r}BT `+h+` 1 0 0 1 0 0 Tm ${this._renderText(u[0],E,Q,B,m,{shift:0},2,y)} ET Q EMC`}static async _getFontData(A,e,t,i){const a=new _g,s={font:null,clone(){return this}},{fontName:n,fontSize:g}=t;return await A.handleSetFont(i,[n&&oA.get(n),g],null,a,e,s,null),s.font}_getTextWidth(A,e){return e.charsToGlyphs(A).reduce(((A,e)=>A+e.width),0)/1e3}_computeFontSize(A,e,t,i,a){let{fontSize:n}=this.data.defaultAppearanceData,g=(n||12)*s,r=Math.round(A/g);if(!n){const o=A=>Math.floor(100*A)/100;if(-1===a){const a=this._getTextWidth(t,i);n=o(Math.min(A/s,e/a)),r=1}else{const I=t.split(/\r\n?|\n/),c=[];for(const A of I){const e=i.encodeString(A).join(""),t=i.charsToGlyphs(e),a=i.getCharPositions(e);c.push({line:e,glyphs:t,positions:a})}const C=t=>{let a=0;for(const s of c)if(a+=this._splitLine(null,i,t,e,s).length*t,a>A)return!0;return!1};for(r=Math.max(r,a);g=A/r,n=o(g/s),C(n);)r++}const{fontName:I,fontColor:c}=this.data.defaultAppearanceData;this._defaultAppearance=function({fontSize:A,fontName:e,fontColor:t}){return`/${KA(e)} ${A} Tf ${lr(t,!0)}`}({fontSize:n,fontName:I,fontColor:c})}return[this._defaultAppearance,n,A/r]}_renderText(A,e,t,i,a,s,n,g){let r;r=1===a?(i-this._getTextWidth(A,e)*t)/2:2===a?i-this._getTextWidth(A,e)*t-n:n;const o=zA(r-s.shift);return s.shift=r,`${o} ${g=zA(g)} Td (${qA(A)}) Tj`}_getSaveFieldResources(A){const{localResources:e,appearanceResources:t,acroFormResources:i}=this._fieldResources,a=this.data.defaultAppearanceData?.fontName;if(!a)return e||CA.empty;for(const A of[e,t])if(A instanceof CA){const e=A.get("Font");if(e instanceof CA&&e.has(a))return A}if(i instanceof CA){const t=i.get("Font");if(t instanceof CA&&t.has(a)){const i=new CA(A);i.set(a,t.getRaw(a));const s=new CA(A);return s.set("Font",i),CA.merge({xref:A,dictArray:[s,e],mergeSubDicts:!0})}}return e||CA.empty}getFieldObject(){return null}}class Hu extends Ju{constructor(A){super(A);const{dict:e}=A;e.has("PMD")&&(this.flags|=2,this.data.hidden=!0,R("Barcodes are not supported")),this.data.hasOwnCanvas=this.data.readOnly&&!this.data.noHTML,this._hasText=!0,"string"!=typeof this.data.fieldValue&&(this.data.fieldValue="");let t=FA({dict:e,key:"Q"});(!Number.isInteger(t)||t<0||t>2)&&(t=null),this.data.textAlignment=t;let i=FA({dict:e,key:"MaxLen"});(!Number.isInteger(i)||i<0)&&(i=0),this.data.maxLen=i,this.data.multiLine=this.hasFieldFlag(4096),this.data.comb=this.hasFieldFlag(16777216)&&!this.hasFieldFlag(4096)&&!this.hasFieldFlag(c)&&!this.hasFieldFlag(1048576)&&0!==this.data.maxLen,this.data.doNotScroll=this.hasFieldFlag(8388608)}get hasTextContent(){return!!this.appearance&&!this._needAppearances}_getCombAppearance(A,e,t,i,a,s,n,g,r,o,I){const c=a/this.data.maxLen,C=this.getBorderAndBackgroundAppearances(I),B=[],h=e.getCharPositions(t);for(const[A,e]of h)B.push(`(${qA(t.substring(A,e))}) Tj`);const Q=B.join(` ${zA(c)} 0 Td `);return`/Tx BMC q ${C}BT `+A+` 1 0 0 1 ${zA(n)} ${zA(g+r)} Tm ${Q} ET Q EMC`}_getMultilineAppearance(A,e,t,i,a,s,n,g,r,o,I,c){const C=[],B=a-2*g,h={shift:0};for(let A=0,s=e.length;Ai?(r.push(A.substring(C,t)),C=t,B=Q,o=-1,c=-1):(B+=Q,o=t,I=a,c=e):B+Q>i?-1!==o?(r.push(A.substring(C,I)),C=I,e=c+1,o=-1,B=0):(r.push(A.substring(C,t)),C=t,B=Q):B+=Q}return Ce?`\\${e}`:"\\s+"));new RegExp(`^\\s*${s}\\s*$`).test(this.data.fieldValue)&&(this.data.textContent=this.data.fieldValue.split("\n"))}getFieldObject(){return{id:this.data.id,value:this.data.fieldValue,defaultValue:this.data.defaultFieldValue||"",multiline:this.data.multiLine,password:this.hasFieldFlag(c),charLimit:this.data.maxLen,comb:this.data.comb,editable:!this.data.readOnly,hidden:this.data.hidden,name:this.data.fieldName,rect:this.data.rect,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:"text"}}}class Yu extends Ju{constructor(A){super(A),this.checkedAppearance=null,this.uncheckedAppearance=null,this.data.checkBox=!this.hasFieldFlag(32768)&&!this.hasFieldFlag(C),this.data.radioButton=this.hasFieldFlag(32768)&&!this.hasFieldFlag(C),this.data.pushButton=this.hasFieldFlag(C),this.data.isTooltipOnly=!1,this.data.checkBox?this._processCheckBox(A):this.data.radioButton?this._processRadioButton(A):this.data.pushButton?(this.data.hasOwnCanvas=!0,this.data.noHTML=!1,this._processPushButton(A)):R("Invalid field flags for button widget annotation")}async getOperatorList(A,e,t,a){if(this.data.pushButton)return super.getOperatorList(A,e,t,!1,a);let s=null,n=null;if(a){const A=a.get(this.data.id);s=A?A.value:null,n=A?A.rotation:null}if(null===s&&this.appearance)return super.getOperatorList(A,e,t,a);null==s&&(s=this.data.checkBox?this.data.fieldValue===this.data.exportValue:this.data.fieldValue===this.data.buttonValue);const g=s?this.checkedAppearance:this.uncheckedAppearance;if(g){const s=this.appearance,r=JA(g.dict.getArray("Matrix"),i);n&&g.dict.set("Matrix",this.getRotationMatrix(a)),this.appearance=g;const o=super.getOperatorList(A,e,t,a);return this.appearance=s,g.dict.set("Matrix",r),o}return{opList:new _g,separateForm:!1,separateCanvas:!1}}async save(A,e,t){return this.data.checkBox?this._saveCheckbox(A,e,t):this.data.radioButton?this._saveRadioButton(A,e,t):null}async _saveCheckbox(A,e,t){if(!t)return null;const i=t.get(this.data.id),a=this._buildFlags(i?.noView,i?.noPrint);let s=i?.rotation,n=i?.value;if(void 0===s&&void 0===a){if(void 0===n)return null;if(this.data.fieldValue===this.data.exportValue===n)return null}let g=A.xref.fetchIfRef(this.ref);if(!(g instanceof CA))return null;g=g.clone(),void 0===s&&(s=this.rotation),void 0===n&&(n=this.data.fieldValue===this.data.exportValue);const r={path:this.data.fieldName,value:n?this.data.exportValue:""},o=oA.get(n?this.data.exportValue:"Off");g.set("V",o),g.set("AS",o),g.set("M",`D:${eA()}`),void 0!==a&&g.set("F",a);const I=this._getMKDict(s);I&&g.set("MK",I);const c=[];return await Tr(this.ref,g,c,A.xref),[{ref:this.ref,data:c.join(""),xfa:r}]}async _saveRadioButton(A,e,t){if(!t)return null;const i=t.get(this.data.id),a=this._buildFlags(i?.noView,i?.noPrint);let s=i?.rotation,n=i?.value;if(void 0===s&&void 0===a){if(void 0===n)return null;if(this.data.fieldValue===this.data.buttonValue===n)return null}let g=A.xref.fetchIfRef(this.ref);if(!(g instanceof CA))return null;g=g.clone(),void 0===n&&(n=this.data.fieldValue===this.data.buttonValue),void 0===s&&(s=this.rotation);const r={path:this.data.fieldName,value:n?this.data.buttonValue:""},o=oA.get(n?this.data.buttonValue:"Off"),I=[];let c=null;if(n)if(this.parent instanceof BA){const e=A.xref.fetch(this.parent);e.set("V",o),await Tr(this.parent,e,I,A.xref),c=I.join(""),I.length=0}else this.parent instanceof CA&&this.parent.set("V",o);this.parent||g.set("V",o),g.set("AS",o),g.set("M",`D:${eA()}`),void 0!==a&&g.set("F",a);const C=this._getMKDict(s);C&&g.set("MK",C),await Tr(this.ref,g,I,A.xref);const B=[{ref:this.ref,data:I.join(""),xfa:r}];return c&&B.push({ref:this.parent,data:c,xfa:null}),B}_getDefaultCheckedAppearance(A,e){const t=this.data.rect[2]-this.data.rect[0],i=this.data.rect[3]-this.data.rect[1],a=[0,0,t,i],s=.8*Math.min(t,i);let n,g;"check"===e?(n={width:.755*s,height:.705*s},g="3"):"disc"===e?(n={width:.791*s,height:.705*s},g="l"):G(`_getDefaultCheckedAppearance - unsupported type: ${e}`);const r=`q BT /PdfJsZaDb ${s} Tf 0 g ${zA((t-n.width)/2)} ${zA((i-n.height)/2)} Td (${g}) Tj ET Q`,o=new CA(A.xref);o.set("FormType",1),o.set("Subtype",oA.get("Form")),o.set("Type",oA.get("XObject")),o.set("BBox",a),o.set("Matrix",[1,0,0,1,0,0]),o.set("Length",r.length);const I=new CA(A.xref),c=new CA(A.xref);c.set("PdfJsZaDb",this.fallbackFontDict),I.set("Font",c),o.set("Resources",I),this.checkedAppearance=new se(r),this.checkedAppearance.dict=o,this._streams.push(this.checkedAppearance)}_processCheckBox(A){const e=A.dict.get("AP");if(!(e instanceof CA))return;const t=e.get("N");if(!(t instanceof CA))return;const i=this._decodeFormValue(A.dict.get("AS"));"string"==typeof i&&(this.data.fieldValue=i);const a=null!==this.data.fieldValue&&"Off"!==this.data.fieldValue?this.data.fieldValue:"Yes",s=t.getKeys();if(0===s.length)s.push("Off",a);else if(1===s.length)"Off"===s[0]?s.push(a):s.unshift("Off");else if(s.includes(a))s.length=0,s.push("Off",a);else{const A=s.find((A=>"Off"!==A));s.length=0,s.push("Off",A)}s.includes(this.data.fieldValue)||(this.data.fieldValue="Off"),this.data.exportValue=s[1];const n=t.get(this.data.exportValue);this.checkedAppearance=n instanceof fA?n:null;const g=t.get("Off");this.uncheckedAppearance=g instanceof fA?g:null,this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(A,"check"),this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance),this._fallbackFontDict=this.fallbackFontDict,null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processRadioButton(A){this.data.buttonValue=null;const e=A.dict.get("Parent");if(e instanceof CA){this.parent=A.dict.getRaw("Parent");const t=e.get("V");t instanceof oA&&(this.data.fieldValue=this._decodeFormValue(t))}const t=A.dict.get("AP");if(!(t instanceof CA))return;const i=t.get("N");if(!(i instanceof CA))return;for(const A of i.getKeys())if("Off"!==A){this.data.buttonValue=this._decodeFormValue(A);break}const a=i.get(this.data.buttonValue);this.checkedAppearance=a instanceof fA?a:null;const s=i.get("Off");this.uncheckedAppearance=s instanceof fA?s:null,this.checkedAppearance?this._streams.push(this.checkedAppearance):this._getDefaultCheckedAppearance(A,"disc"),this.uncheckedAppearance&&this._streams.push(this.uncheckedAppearance),this._fallbackFontDict=this.fallbackFontDict,null===this.data.defaultFieldValue&&(this.data.defaultFieldValue="Off")}_processPushButton(A){const{dict:e,annotationGlobals:t}=A;e.has("A")||e.has("AA")||this.data.alternativeText?(this.data.isTooltipOnly=!e.has("A")&&!e.has("AA"),no.parseDestDictionary({destDict:e,resultObj:this.data,docBaseUrl:t.baseUrl,docAttachments:t.attachments})):R("Push buttons without action dictionaries are not supported")}getFieldObject(){let A,e="button";return this.data.checkBox?(e="checkbox",A=this.data.exportValue):this.data.radioButton&&(e="radiobutton",A=this.data.buttonValue),{id:this.data.id,value:this.data.fieldValue||"Off",defaultValue:this.data.defaultFieldValue,exportValues:A,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,hidden:this.data.hidden,actions:this.data.actions,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:e}}get fallbackFontDict(){const A=new CA;return A.set("BaseFont",oA.get("ZapfDingbats")),A.set("Type",oA.get("FallbackType")),A.set("Subtype",oA.get("FallbackType")),A.set("Encoding",oA.get("ZapfDingbatsEncoding")),U(this,"fallbackFontDict",A)}}class vu extends Ju{constructor(A){super(A);const{dict:e,xref:t}=A;this.indices=e.getArray("I"),this.hasIndices=Array.isArray(this.indices)&&this.indices.length>0,this.data.options=[];const i=FA({dict:e,key:"Opt"});if(Array.isArray(i))for(let A=0,e=i.length;A=0&&e0?this.data.fieldValue[0]:null;return{id:this.data.id,value:e,defaultValue:this.data.defaultFieldValue,editable:!this.data.readOnly,name:this.data.fieldName,rect:this.data.rect,numItems:this.data.fieldValue.length,multipleSelection:this.data.multiSelect,hidden:this.data.hidden,actions:this.data.actions,items:this.data.options,page:this.data.pageIndex,strokeColor:this.data.borderColor,fillColor:this.data.backgroundColor,rotation:this.rotation,type:A}}amendSavedDict(A,e){if(!this.hasIndices)return;let t=A?.get(this.data.id)?.value;Array.isArray(t)||(t=[t]);const i=[],{options:a}=this.data;for(let A=0,e=0,s=a.length;At&&(t=i,e=A)}[B,h]=this._computeFontSize(A,o-4,e,C,-1)}const Q=h*s,l=(Q-h)/2,E=Math.floor(r/Q);let u=0;if(c.length>0){const A=Math.min(...c),e=Math.max(...c);u=Math.max(0,e-E+1),u>A&&(u=A)}const d=Math.min(u+E+1,I),f=["/Tx BMC q",`1 1 ${o} ${r} re W n`];if(c.length){f.push("0.600006 0.756866 0.854904 rg");for(const A of c)u<=A&&AA.trimEnd()));const{coords:A,bbox:e,matrix:t}=Er.getFirstPositionInfo(this.rectangle,this.rotation,i);this.data.textPosition=this._transformPoint(A,e,t)}if(this._isOffscreenCanvasSupported){const a=A.dict.get("CA"),s=new Er(t,"sans-serif");this.appearance=s.createAppearance(this._contents.str,this.rectangle,this.rotation,i,e,a),this._streams.push(this.appearance)}else R("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.")}}get hasTextContent(){return this._hasAppearance}static createNewDict(A,e,{apRef:t,ap:i}){const{color:a,fontSize:s,oldAnnotation:n,rect:g,rotation:r,user:o,value:I}=A,c=n||new CA(e);c.set("Type",oA.get("Annot")),c.set("Subtype",oA.get("FreeText")),n?(c.set("M",`D:${eA()}`),c.delete("RC")):c.set("CreationDate",`D:${eA()}`),c.set("Rect",g);const C=`/Helv ${s} Tf ${lr(a,!0)}`;if(c.set("DA",C),c.set("Contents",$A(I)),c.set("F",4),c.set("Border",[0,0,0]),c.set("Rotate",r),o&&c.set("T",$A(o)),t||i){const A=new CA(e);c.set("AP",A),t?A.set("N",t):A.set("N",i)}return c}static async createNewAppearanceStream(A,e,t){const{baseFontRef:i,evaluator:a,task:n}=t,{color:g,fontSize:r,rect:o,rotation:I,value:c}=A,C=new CA(e),B=new CA(e);if(i)B.set("Helv",i);else{const A=new CA(e);A.set("BaseFont",oA.get("Helvetica")),A.set("Type",oA.get("Font")),A.set("Subtype",oA.get("Type1")),A.set("Encoding",oA.get("WinAnsiEncoding")),B.set("Helv",A)}C.set("Font",B);const h=await Ju._getFontData(a,n,{fontName:"Helv",fontSize:r},C),[Q,l,E,u]=o;let d=E-Q,f=u-l;I%180!=0&&([d,f]=[f,d]);const p=c.split("\n"),m=r/1e3;let y=-1/0;const w=[];for(let A of p){const e=h.encodeString(A);if(e.length>1)return null;A=e.join(""),w.push(A);let t=0;const i=h.charsToGlyphs(A);for(const A of i)t+=A.width*m;y=Math.max(y,t)}let D=1;y>d&&(D=d/y);let b=1;const k=s*r,F=1*r,S=k*p.length;S>f&&(b=f/S);const R=r*Math.min(D,b);let G,N,x;switch(I){case 0:x=[1,0,0,1],N=[o[0],o[1],d,f],G=[o[0],o[3]-F];break;case 90:x=[0,1,-1,0],N=[o[1],-o[2],d,f],G=[o[1],-o[0]-F];break;case 180:x=[-1,0,0,-1],N=[-o[2],-o[3],d,f],G=[-o[2],-o[1]-F];break;case 270:x=[0,-1,1,0],N=[-o[3],o[0],d,f],G=[-o[3],o[2]-F]}const U=["q",`${x.join(" ")} 0 0 cm`,`${N.join(" ")} re W n`,"BT",`${lr(g,!0)}`,`0 Tc /Helv ${zA(R)} Tf`];U.push(`${G.join(" ")} Td (${qA(w[0])}) Tj`);const M=zA(k);for(let A=1,e=w.length;A(A.push(`${i[0]} ${i[1]} m`,`${i[2]} ${i[3]} l`,"S"),[e[0]-r,e[2]+r,e[7]-r,e[3]+r])})}}}class Ou extends Lu{constructor(A){super(A);const{dict:e,xref:t}=A;if(this.data.annotationType=5,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,!this.appearance){const A=this.color?Gu(this.color):[0,0,0],i=e.get("CA"),a=Ru(e.getArray("IC"),null),s=a?Gu(a):null,n=s?i:null;if(0===this.borderStyle.width&&!s)return;this._setDefaultAppearance({xref:t,extra:`${this.borderStyle.width} w`,strokeColor:A,fillColor:s,strokeAlpha:i,fillAlpha:n,pointsCallback:(A,e)=>{const t=e[4]+this.borderStyle.width/2,i=e[5]+this.borderStyle.width/2,a=e[6]-e[4]-this.borderStyle.width,n=e[3]-e[7]-this.borderStyle.width;return A.push(`${t} ${i} ${a} ${n} re`),s?A.push("B"):A.push("S"),[e[0],e[2],e[7],e[3]]}})}}}class Xu extends Lu{constructor(A){super(A);const{dict:e,xref:t}=A;if(this.data.annotationType=6,!this.appearance){const A=this.color?Gu(this.color):[0,0,0],i=e.get("CA"),a=Ru(e.getArray("IC"),null),s=a?Gu(a):null,n=s?i:null;if(0===this.borderStyle.width&&!s)return;const g=4/3*Math.tan(Math.PI/8);this._setDefaultAppearance({xref:t,extra:`${this.borderStyle.width} w`,strokeColor:A,fillColor:s,strokeAlpha:i,fillAlpha:n,pointsCallback:(A,e)=>{const t=e[0]+this.borderStyle.width/2,i=e[1]-this.borderStyle.width/2,a=e[6]-this.borderStyle.width/2,n=e[7]+this.borderStyle.width/2,r=t+(a-t)/2,o=i+(n-i)/2,I=(a-t)/2*g,c=(n-i)/2*g;return A.push(`${r} ${n} m`,`${r+I} ${n} ${a} ${o+c} ${a} ${o} c`,`${a} ${o-c} ${r+I} ${i} ${r} ${i} c`,`${r-I} ${i} ${t} ${o-c} ${t} ${o} c`,`${t} ${o+c} ${r-I} ${n} ${r} ${n} c`,"h"),s?A.push("B"):A.push("S"),[e[0],e[2],e[7],e[3]]}})}}}class Vu extends Lu{constructor(A){super(A);const{dict:e,xref:t}=A;this.data.annotationType=8,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,this.data.vertices=null,this instanceof ju||(this.setLineEndings(e.getArray("LE")),this.data.lineEndings=this.lineEndings);const i=e.getArray("Vertices");if(!LA(i,null))return;const a=this.data.vertices=Float32Array.from(i);if(!this.appearance){const A=this.color?Gu(this.color):[0,0,0],i=e.get("CA"),s=this.borderStyle.width||1,n=2*s,g=[1/0,1/0,-1/0,-1/0];for(let A=0,e=a.length;A{for(let e=0,t=a.length;e{for(const e of this.data.inkLists){for(let t=0,i=e.length;tA.points))),c.set("F",4),c.set("Rotate",o),g&&c.set("IT",oA.get("InkHighlight"));const C=new CA(e);c.set("BS",C),C.set("W",I),c.set("C",Array.from(a,(A=>A/255))),c.set("CA",s);const B=new CA(e);return c.set("AP",B),t?B.set("N",t):B.set("N",i),c}static async createNewAppearanceStream(A,e,t){if(A.outlines)return this.createNewAppearanceStreamForHighlight(A,e,t);const{color:i,rect:a,paths:s,thickness:n,opacity:g}=A,r=[`${n} w 1 J 1 j`,`${lr(i,!1)}`];1!==g&&r.push("/R0 gs");const o=[];for(const{bezier:A}of s){if(o.length=0,o.push(`${zA(A[0])} ${zA(A[1])} m`),2===A.length)o.push(`${zA(A[0])} ${zA(A[1])} l S`);else{for(let e=2,t=A.length;e(A.push(`${e[0]} ${e[1]} m`,`${e[2]} ${e[3]} l`,`${e[6]} ${e[7]} l`,`${e[4]} ${e[5]} l`,"f"),[e[0],e[2],e[7],e[3]])})}}else this.data.popupRef=null}static createNewDict(A,e,{apRef:t,ap:i}){const{color:a,oldAnnotation:s,opacity:n,rect:g,rotation:r,user:o,quadPoints:I}=A,c=s||new CA(e);if(c.set("Type",oA.get("Annot")),c.set("Subtype",oA.get("Highlight")),c.set(s?"M":"CreationDate",`D:${eA()}`),c.set("CreationDate",`D:${eA()}`),c.set("Rect",g),c.set("F",4),c.set("Border",[0,0,0]),c.set("Rotate",r),c.set("QuadPoints",I),c.set("C",Array.from(a,(A=>A/255))),c.set("CA",n),o&&c.set("T",$A(o)),t||i){const A=new CA(e);c.set("AP",A),A.set("N",t||i)}return c}static async createNewAppearanceStream(A,e,t){const{color:i,rect:a,outlines:s,opacity:n}=A,g=[`${lr(i,!0)}`,"/R0 gs"],r=[];for(const A of s){r.length=0,r.push(`${zA(A[0])} ${zA(A[1])} m`);for(let e=2,t=A.length;e(A.push(`${e[4]} ${e[5]+1.3} m`,`${e[6]} ${e[7]+1.3} l`,"S"),[e[0],e[2],e[7],e[3]])})}}else this.data.popupRef=null}}class ed extends Lu{constructor(A){super(A);const{dict:e,xref:t}=A;if(this.data.annotationType=11,this.data.quadPoints=Nu(e,null)){if(!this.appearance){const A=this.color?Gu(this.color):[0,0,0],i=e.get("CA");this._setDefaultAppearance({xref:t,extra:"[] 0 d 1 w",strokeColor:A,strokeAlpha:i,pointsCallback:(A,e)=>{const t=(e[1]-e[5])/6;let i=t,a=e[4];const s=e[5],n=e[6];A.push(`${a} ${s+i} m`);do{a+=2,i=0===i?t:0,A.push(`${a} ${s+i} l`)}while(a(A.push((e[0]+e[4])/2+" "+(e[1]+e[5])/2+" m",(e[2]+e[6])/2+" "+(e[3]+e[7])/2+" l","S"),[e[0],e[2],e[7],e[3]])})}}else this.data.popupRef=null}}class id extends Lu{#q;constructor(A){super(A),this.data.annotationType=13,this.#q=this.data.hasOwnCanvas=this.data.noRotate,this.data.isEditable=!this.data.noHTML,this.data.noHTML=!1}mustBeViewedWhenEditing(A,e=null){return A?!!this.data.isEditable&&(this.#q=this.data.hasOwnCanvas,this.data.hasOwnCanvas=!0,!0):(this.data.hasOwnCanvas=this.#q,!e?.has(this.data.id))}static async createImage(A,e){const{width:t,height:i}=A,a=new OffscreenCanvas(t,i),s=a.getContext("2d",{alpha:!0});s.drawImage(A,0,0);const n=s.getImageData(0,0,t,i).data,g=new Uint32Array(n.buffer),r=g.some(O.isLittleEndian?A=>A>>>24!=255:A=>!!(255&~A));r&&(s.fillStyle="white",s.fillRect(0,0,t,i),s.drawImage(A,0,0));const o=a.convertToBlob({type:"image/jpeg",quality:1}).then((A=>A.arrayBuffer())),I=oA.get("XObject"),c=oA.get("Image"),C=new CA(e);C.set("Type",I),C.set("Subtype",c),C.set("BitsPerComponent",8),C.set("ColorSpace",oA.get("DeviceRGB")),C.set("Filter",oA.get("DCTDecode")),C.set("BBox",[0,0,t,i]),C.set("Width",t),C.set("Height",i);let B=null;if(r){const A=new Uint8Array(g.length);if(O.isLittleEndian)for(let e=0,t=g.length;e>>24;else for(let e=0,t=g.length;e=0&&s<=1?s:null}}function sd(A){try{return _(A)}catch(e){return R(`UTF-8 decoding failed: "${e}".`),A}}class nd extends kr{constructor(A){super(A),this.node=null}onEndElement(A){const e=super.onEndElement(A);if(e&&"xfa:datasets"===A)throw this.node=e,new Error("Aborting DatasetXMLParser.")}}class gd{constructor(A){if(A.datasets)this.node=new kr({hasAttributes:!0}).parseFromString(A.datasets).documentElement;else{const e=new nd({hasAttributes:!0});try{e.parseFromString(A["xdp:xdp"])}catch{}this.node=e.node}}getValue(A){if(!this.node||!A)return"";const e=this.node.searchNode(vA(A),0);if(!e)return"";const t=e.firstChild;return"value"===t?.nodeName?e.children.map((A=>sd(A.textContent))):sd(e.textContent)}}class rd{#T=null;constructor(A,e){this.stream=A,this.pdfManager=e,this.entries=[],this._xrefStms=new Set,this._cacheMap=new Map,this._pendingRefs=new hA,this._newPersistentRefNum=null,this._newTemporaryRefNum=null,this._persistentRefsCache=null}getNewPersistentRef(A){null===this._newPersistentRefNum&&(this._newPersistentRefNum=this.entries.length||1);const e=this._newPersistentRefNum++;return this._cacheMap.set(e,A),BA.get(e,0)}getNewTemporaryRef(){if(null===this._newTemporaryRefNum&&(this._newTemporaryRefNum=this.entries.length||1,this._newPersistentRefNum)){this._persistentRefsCache=new Map;for(let A=this._newTemporaryRefNum;A0;){const[n,g]=s;if(!Number.isInteger(n)||!Number.isInteger(g))throw new K(`Invalid XRef range fields: ${n}, ${g}`);if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(a))throw new K(`Invalid XRef entry fields length: ${n}, ${g}`);for(let s=e.entryNum;s=A.length);)t+=String.fromCharCode(i),i=A[e];return t}function e(A,e,t){const i=t.length,a=A.length;let s=0;for(;e=i)break;e++,s++}return s}const t=/\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g,i=/\b(startxref|\d+\s+\d+\s+obj)\b/g,a=/^(\d+)\s+(\d+)\s+obj\b/,s=new Uint8Array([116,114,97,105,108,101,114]),n=new Uint8Array([115,116,97,114,116,120,114,101,102]),g=new Uint8Array([47,88,82,101,102]);this.entries.length=0,this._cacheMap.clear();const r=this.stream;r.pos=0;const o=r.getBytes(),I=T(o),c=o.length;let C=r.start;const B=[],h=[];for(;C=c)break;Q=o[C]}while(10!==Q&&13!==Q);continue}const l=A(o,C);let E;if(l.startsWith("xref")&&(4===l.length||/\s/.test(l[4])))C+=e(o,C,s),B.push(C),C+=e(o,C,n);else if(E=a.exec(l)){const A=0|E[1],i=0|E[2],a=C+l.length;let s,n=!1;if(this.entries[A]){if(this.entries[A].gen===i)try{new ti({lexer:new si(r.makeSubStream(a))}).getObj(),n=!0}catch(A){A instanceof wA?R(`indexObjects -- checking object (${l}): "${A}".`):n=!0}}else n=!0;n&&(this.entries[A]={offset:C-r.start,gen:i,uncompressed:!0}),t.lastIndex=a;const B=t.exec(I);B?(s=t.lastIndex+1-C,"endobj"!==B[1]&&(R(`indexObjects: Found "${B[1]}" inside of another "obj", caused by missing "endobj" -- trying to recover.`),s-=B[1].length+1)):s=c-C;const Q=o.subarray(C,C+s),u=e(Q,0,g);u0?Math.max(...this._xrefStms):null)}getEntry(A){const e=this.entries[A];return e&&!e.free&&e.offset?e:null}fetchIfRef(A,e=!1){return A instanceof BA?this.fetch(A,e):A}fetch(A,e=!1){if(!(A instanceof BA))throw new Error("ref object is not a reference");const t=A.num,i=this._cacheMap.get(t);if(void 0!==i)return i instanceof CA&&!i.objId&&(i.objId=A.toString()),i;let a=this.getEntry(t);if(null===a)return this._cacheMap.set(t,a),a;if(this._pendingRefs.has(A))return this._pendingRefs.remove(A),R(`Ignoring circular reference: ${A}.`),aA;this._pendingRefs.put(A);try{a=a.uncompressed?this.fetchUncompressed(A,a,e):this.fetchCompressed(A,a,e),this._pendingRefs.remove(A)}catch(e){throw this._pendingRefs.remove(A),e}return a instanceof CA?a.objId=A.toString():a instanceof fA&&(a.dict.objId=A.toString()),a}fetchUncompressed(A,e,t=!1){const i=A.gen;let a=A.num;if(e.gen!==i){const s=`Inconsistent generation in XRef: ${A}`;if(this._generationFallback&&e.gen0&&e[3]-e[1]>0)return e;R(`Empty, or invalid, /${A} entry.`)}return null}get mediaBox(){return U(this,"mediaBox",this._getBoundingBox("MediaBox")||od)}get cropBox(){return U(this,"cropBox",this._getBoundingBox("CropBox")||this.mediaBox)}get userUnit(){let A=this.pageDict.get("UserUnit");return("number"!=typeof A||A<=0)&&(A=1),U(this,"userUnit",A)}get view(){const{cropBox:A,mediaBox:e}=this;if(A!==e&&!AA(A,e)){const t=V.intersect(A,e);if(t&&t[2]-t[0]>0&&t[3]-t[1]>0)return U(this,"view",t);R("Empty /CropBox and /MediaBox intersection.")}return U(this,"view",e)}get rotate(){let A=this._getInheritableProperty("Rotate")||0;return A%90!=0?A=0:A>=360?A%=360:A<0&&(A=(A%360+360)%360),U(this,"rotate",A)}_onSubStreamError(A,e){if(!this.evaluatorOptions.ignoreErrors)throw A;R(`getContentStream - ignoring sub-stream (${e}): "${A}".`)}getContentStream(){return this.pdfManager.ensure(this,"content").then((A=>A instanceof fA?A:Array.isArray(A)?new Se(A,this._onSubStreamError.bind(this)):new ne))}get xfaData(){return U(this,"xfaData",this.xfaFactory?{bbox:this.xfaFactory.getBoundingBox(this.pageIndex)}:null)}async#P(A,e,t){const i=[];for(const a of A)if(a.id){const A=BA.fromString(a.id);if(!A){R(`A non-linked annotation cannot be modified: ${a.id}`);continue}if(a.deleted){if(e.put(A,A),a.popupRef){const A=BA.fromString(a.popupRef);A&&e.put(A,A)}continue}t?.put(A),a.ref=A,i.push(this.xref.fetchAsync(A).then((A=>{A instanceof CA&&(a.oldAnnotation=A.clone())}),(()=>{R(`Cannot fetch \`oldAnnotation\` for: ${A}.`)}))),delete a.id}await Promise.all(i)}async saveNewAnnotations(A,e,t,i){if(this.xfaFactory)throw new Error("XFA: Cannot save new annotations.");const a=new gr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),s=new QA,n=new hA;await this.#P(t,s,n);const g=this.pageDict,r=this.annotations.filter((A=>!(A instanceof BA&&s.has(A)))),o=await Su.saveNewAnnotations(a,e,t,i);for(const{ref:A}of o.annotations)A instanceof BA&&!n.has(A)&&r.push(A);const I=g.get("Annots");g.set("Annots",r);const c=[];await Tr(this.ref,g,c,this.xref),I&&g.set("Annots",I);const C=o.dependencies;C.push({ref:this.ref,data:c.join("")},...o.annotations);for(const A of s)C.push({ref:A,data:null});return C}save(A,e,t){const i=new gr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions});return this._parsedAnnotations.then((function(A){const a=[];for(const s of A)a.push(s.save(i,e,t).catch((function(A){return R(`save - ignoring annotation data during "${e.name}" task: "${A}".`),null})));return Promise.all(a).then((function(A){return A.filter((A=>!!A))}))}))}loadResources(A){return this.resourcesPromise||=this.pdfManager.ensure(this,"resources"),this.resourcesPromise.then((()=>new ro(this.resources,A,this.xref).load()))}getOperatorList({handler:A,sink:e,task:t,intent:i,cacheKey:a,annotationStorage:s=null,modifiedIds:n=null}){const r=this.getContentStream(),o=this.loadResources(["ColorSpace","ExtGState","Font","Pattern","Properties","Shading","XObject"]),I=new gr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),c=this.xfaFactory?null:_A(s),C=c?.get(this.pageIndex);let B=Promise.resolve(null),h=null;if(C){const A=this.pdfManager.ensureDoc("annotationGlobals");let e;const i=new Set;for(const{bitmapId:A,bitmap:e}of C)!A||e||i.has(A)||i.add(A);const{isOffscreenCanvasSupported:a}=this.evaluatorOptions;if(i.size>0){const A=C.slice();for(const[e,t]of s)e.startsWith(g)&&t.bitmap&&i.has(t.bitmapId)&&A.push(t);e=Su.generateImages(A,this.xref,a)}else e=Su.generateImages(C,this.xref,a);h=new hA,B=Promise.all([A,this.#P(C,h,null)]).then((([A])=>A?Su.printNewAnnotations(A,I,t,C,e):null))}const Q=Promise.all([r,o]).then((([s])=>{const n=new _g(i,e);return A.send("StartRenderPage",{transparency:I.hasBlendModes(this.resources,this.nonBlendModesSet),pageIndex:this.pageIndex,cacheKey:a}),I.getOperatorList({stream:s,task:t,resources:this.resources,operatorList:n}).then((function(){return n}))}));return Promise.all([Q,this._parsedAnnotations,B]).then((function([A,e,a]){if(a){e=e.filter((A=>!(A.ref&&h.has(A.ref))));for(let A=0,t=a.length;AA.ref&&dA(A.ref,i.refToReplace)));s>=0&&(e.splice(s,1,i),a.splice(A--,1),t--)}}e=e.concat(a)}if(0===e.length||64&i)return A.flush(!0),{length:A.totalLength};const g=!!(16&i),r=!!(128&i),o=!!(1&i),c=!!(2&i),C=!!(4&i),B=[];for(const A of e)(o||c&&A.mustBeViewed(s,g)&&A.mustBeViewedWhenEditing(r,n)||C&&A.mustBePrinted(s))&&B.push(A.getOperatorList(I,t,i,s).catch((function(A){return R(`getOperatorList - ignoring annotation data during "${t.name}" task: "${A}".`),{opList:null,separateForm:!1,separateCanvas:!1}})));return Promise.all(B).then((function(e){let t=!1,i=!1;for(const{opList:a,separateForm:s,separateCanvas:n}of e)A.addOpList(a),t||=s,i||=n;return A.flush(!0,{form:t,canvas:i}),{length:A.totalLength}}))}))}async extractTextContent({handler:A,task:e,includeMarkedContent:t,disableNormalization:i,sink:a}){const s=this.getContentStream(),n=this.loadResources(["ExtGState","Font","Properties","XObject"]),g=this.pdfManager.ensureCatalog("lang"),[r,,o]=await Promise.all([s,n,g]);return new gr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}).getTextContent({stream:r,task:e,resources:this.resources,includeMarkedContent:t,disableNormalization:i,sink:a,viewBox:this.view,lang:o})}async getStructTree(){const A=await this.pdfManager.ensureCatalog("structTreeRoot");return A?(await this._parsedAnnotations,(await this.pdfManager.ensure(this,"_parseStructTree",[A])).serializable):null}_parseStructTree(A){const e=new to(A,this.pageDict);return e.parse(this.ref),e}async getAnnotationsData(A,e,t){const i=await this._parsedAnnotations;if(0===i.length)return i;const a=[],s=[];let n;const g=!!(1&t),r=!!(2&t),o=!!(4&t);for(const t of i){const i=g||r&&t.viewable;(i||o&&t.printable)&&a.push(t.data),t.hasTextContent&&i&&(n||=new gr({xref:this.xref,handler:A,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),s.push(t.extractTextContent(n,e,[-1/0,-1/0,1/0,1/0]).catch((function(A){R(`getAnnotationsData - ignoring textContent during "${e.name}" task: "${A}".`)}))))}return await Promise.all(s),a}get annotations(){const A=this._getInheritableProperty("Annots");return U(this,"annotations",Array.isArray(A)?A:[])}get _parsedAnnotations(){return U(this,"_parsedAnnotations",this.pdfManager.ensure(this,"annotations").then((async A=>{if(0===A.length)return A;const[e,t]=await Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureDoc("fieldObjects")]);if(!e)return[];const i=t?.orphanFields,a=[];for(const t of A)a.push(Su.create(this.xref,t,e,this._localIdFactory,!1,i,this.ref).catch((function(A){return R(`_parsedAnnotations: "${A}".`),null})));const s=[];let n,g;for(const A of await Promise.all(a))A&&(A instanceof Ju?(g||=[]).push(A):A instanceof Pu?(n||=[]).push(A):s.push(A));return g&&s.push(...g),n&&s.push(...n),s})))}get jsActions(){return U(this,"jsActions",PA(this.xref,this.pageDict,Q))}}const cd=new Uint8Array([37,80,68,70,45]),Cd=new Uint8Array([115,116,97,114,116,120,114,101,102]),Bd=new Uint8Array([101,110,100,111,98,106]);function hd(A,e,t=1024,i=!1){const a=e.length,s=A.peekBytes(t),n=s.length-a;if(n<=0)return!1;if(i){const t=a-1;let i=s.length-1;for(;i>=t;){let n=0;for(;n=a)return A.pos+=i-t,!0;i--}}else{let t=0;for(;t<=n;){let i=0;for(;i=a)return A.pos+=t,!0;t++}}return!1}class Qd{constructor(A,e){if(e.length<=0)throw new H("The PDF file is empty, i.e. its size is zero bytes.");this.pdfManager=A,this.stream=e,this.xref=new rd(e,A),this._pagePromises=new Map,this._version=null;const t={font:0};this._globalIdFactory=class{static getDocId(){return`g_${A.docId}`}static createFontId(){return"f"+ ++t.font}static createObjId(){G("Abstract method `createObjId` called.")}static getPageObjId(){G("Abstract method `getPageObjId` called.")}}}parse(A){this.xref.parse(A),this.catalog=new no(this.pdfManager,this.xref)}get linearization(){let A=null;try{A=ni.create(this.stream)}catch(A){if(A instanceof yA)throw A;S(A)}return U(this,"linearization",A)}get startXRef(){const A=this.stream;let e=0;if(this.linearization){if(A.reset(),hd(A,Bd)){A.skip(6);let t=A.peekByte();for(;MA(t);)A.pos++,t=A.peekByte();e=A.pos-A.start}}else{const t=1024,i=Cd.length;let a=!1,s=A.end;for(;!a&&s>0;)s-=t-i,s<0&&(s=0),A.pos=s,a=hd(A,Cd,t,!0);if(a){let t;A.skip(9);do{t=A.getByte()}while(MA(t));let i="";for(;t>=32&&t<=57;)i+=String.fromCharCode(t),t=A.getByte();e=parseInt(i,10),isNaN(e)&&(e=0)}}return U(this,"startXRef",e)}checkHeader(){const A=this.stream;if(A.reset(),!hd(A,cd))return;A.moveStart(),A.skip(cd.length);let e,t="";for(;(e=A.getByte())>32&&t.length<7;)t+=String.fromCharCode(e);pA.test(t)?this._version=t:R(`Invalid PDF header version: ${t}`)}parseStartXRef(){this.xref.setStartXRef(this.startXRef)}get numPages(){let A=0;return A=this.catalog.hasActualNumPages?this.catalog.numPages:this.xfaFactory?this.xfaFactory.getNumPages():this.linearization?this.linearization.numPages:this.catalog.numPages,U(this,"numPages",A)}_hasOnlyDocumentSignatures(A,e=0){return!!Array.isArray(A)&&A.every((A=>{if(!((A=this.xref.fetchIfRef(A))instanceof CA))return!1;if(A.has("Kids"))return++e>10?(R("_hasOnlyDocumentSignatures: maximum recursion depth reached"),!1):this._hasOnlyDocumentSignatures(A.get("Kids"),e);const t=lA(A.get("FT"),"Sig"),i=A.get("Rect"),a=Array.isArray(i)&&i.every((A=>0===A));return t&&a}))}get _xfaStreams(){const A=this.catalog.acroForm;if(!A)return null;const e=A.get("XFA"),t={"xdp:xdp":"",template:"",datasets:"",config:"",connectionSet:"",localeSet:"",stylesheet:"","/xdp:xdp":""};if(e instanceof fA&&!e.isEmpty)return t["xdp:xdp"]=e,t;if(!Array.isArray(e)||0===e.length)return null;for(let A=0,i=e.length;A{c.set(A,e)}));const C=[];for(const[A,t]of c){const a=t.get("FontDescriptor");if(!(a instanceof CA))continue;let s=a.get("FontFamily");s=s.replaceAll(/[ ]+(\d)/g,"$1");const n={fontFamily:s,fontWeight:a.get("FontWeight"),italicAngle:-a.get("ItalicAngle")};VA(n)&&C.push(g.handleSetFont(i,[oA.get(A),1],null,r,e,I,null,n).catch((function(A){return R(`loadXfaFonts: "${A}".`),null})))}await Promise.all(C);const B=this.xfaFactory.setFonts(o);if(!B)return;n.ignoreErrors=!0,C.length=0,o.length=0;const h=new Set;for(const A of B)Pn(`${A}-Regular`)||h.add(A);h.size&&B.push("PdfJS-Fallback");for(const A of B)if(!h.has(A))for(const t of[{name:"Regular",fontWeight:400,italicAngle:0},{name:"Bold",fontWeight:700,italicAngle:0},{name:"Italic",fontWeight:400,italicAngle:12},{name:"BoldItalic",fontWeight:700,italicAngle:12}]){const a=`${A}-${t.name}`,s=Wn(a);C.push(g.handleSetFont(i,[oA.get(a),1],null,r,e,I,s,{fontFamily:A,fontWeight:t.fontWeight,italicAngle:t.italicAngle}).catch((function(A){return R(`loadXfaFonts: "${A}".`),null})))}await Promise.all(C),this.xfaFactory.appendFonts(o,h)}async serializeXfaData(A){return this.xfaFactory?this.xfaFactory.serializeData(A):null}get version(){return this.catalog.version||this._version}get formInfo(){const A={hasFields:!1,hasAcroForm:!1,hasXfa:!1,hasSignatures:!1},e=this.catalog.acroForm;if(!e)return U(this,"formInfo",A);try{const t=e.get("Fields"),i=Array.isArray(t)&&t.length>0;A.hasFields=i;const a=e.get("XFA");A.hasXfa=Array.isArray(a)&&a.length>0||a instanceof fA&&!a.isEmpty;const s=!!(1&e.get("SigFlags")),n=s&&this._hasOnlyDocumentSignatures(t);A.hasAcroForm=i&&!n,A.hasSignatures=s}catch(A){if(A instanceof yA)throw A;R(`Cannot fetch form information: "${A}".`)}return U(this,"formInfo",A)}get documentInfo(){const A={PDFFormatVersion:this.version,Language:this.catalog.lang,EncryptFilterName:this.xref.encrypt?this.xref.encrypt.filterName:null,IsLinearized:!!this.linearization,IsAcroFormPresent:this.formInfo.hasAcroForm,IsXFAPresent:this.formInfo.hasXfa,IsCollectionPresent:!!this.catalog.collection,IsSignaturesPresent:this.formInfo.hasSignatures};let e;try{e=this.xref.trailer.get("Info")}catch(A){if(A instanceof yA)throw A;S("The document information dictionary is invalid.")}if(!(e instanceof CA))return U(this,"documentInfo",A);for(const t of e.getKeys()){const i=e.get(t);switch(t){case"Title":case"Author":case"Subject":case"Keywords":case"Creator":case"Producer":case"CreationDate":case"ModDate":if("string"==typeof i){A[t]=z(i);continue}break;case"Trapped":if(i instanceof oA){A[t]=i;continue}break;default:let e;switch(typeof i){case"string":e=z(i);break;case"number":case"boolean":e=i;break;default:i instanceof oA&&(e=i)}if(void 0===e){R(`Bad value, for custom key "${t}", in Info: ${i}.`);continue}A.Custom||(A.Custom=Object.create(null)),A.Custom[t]=e;continue}R(`Bad value, for key "${t}", in Info: ${i}.`)}return U(this,"documentInfo",A)}get fingerprints(){function A(A){return"string"==typeof A&&A.length>0&&"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"!==A}function e(A){const e=[];for(const t of A){const A=t.toString(16);e.push(A.padStart(2,"0"))}return e.join("")}const t=this.xref.trailer.get("ID");let i,a;return Array.isArray(t)&&A(t[0])?(i=P(t[0]),t[1]!==t[0]&&A(t[1])&&(a=P(t[1]))):i=Gr(this.stream.getByteRange(0,1024),0,1024),U(this,"fingerprints",[e(i),a?e(a):null])}async _getLinearizationPage(A){const{catalog:e,linearization:t,xref:i}=this,a=BA.get(t.objectNumberFirst,0);try{const A=await i.fetchAsync(a);if(A instanceof CA){let t=A.getRaw("Type");if(t instanceof BA&&(t=await i.fetchAsync(t)),lA(t,"Page")||!A.has("Type")&&!A.has("Kids")&&A.has("Contents"))return e.pageKidsCountCache.has(a)||e.pageKidsCountCache.put(a,1),e.pageIndexCache.has(a)||e.pageIndexCache.put(a,0),[A,a]}throw new K("The Linearization dictionary doesn't point to a valid Page dictionary.")}catch(t){return R(`_getLinearizationPage: "${t.message}".`),e.getPageDict(A)}}getPage(A){const e=this._pagePromises.get(A);if(e)return e;const{catalog:t,linearization:i,xfaFactory:a}=this;let s;return s=a?Promise.resolve([CA.empty,null]):i?.pageFirst===A?this._getLinearizationPage(A):t.getPageDict(A),s=s.then((([e,i])=>new Id({pdfManager:this.pdfManager,xref:this.xref,pageIndex:A,pageDict:e,ref:i,globalIdFactory:this._globalIdFactory,fontCache:t.fontCache,builtInCMapCache:t.builtInCMapCache,standardFontDataCache:t.standardFontDataCache,globalImageCache:t.globalImageCache,systemFontCache:t.systemFontCache,nonBlendModesSet:t.nonBlendModesSet,xfaFactory:a}))),this._pagePromises.set(A,s),s}async checkFirstPage(A=!1){if(!A)try{await this.getPage(0)}catch(A){if(A instanceof DA)throw this._pagePromises.delete(0),await this.cleanup(),new bA}}async checkLastPage(A=!1){const{catalog:e,pdfManager:t}=this;let i;e.setActualNumPages();try{if(await Promise.all([t.ensureDoc("xfaFactory"),t.ensureDoc("linearization"),t.ensureCatalog("numPages")]),this.xfaFactory)return;if(i=this.linearization?this.linearization.numPages:e.numPages,!Number.isInteger(i))throw new K("Page count is not an integer.");if(i<=1)return;await this.getPage(i-1)}catch(a){if(this._pagePromises.delete(i-1),await this.cleanup(),a instanceof DA&&!A)throw new bA;let s;R(`checkLastPage - invalid /Pages tree /Count: ${i}.`);try{s=await e.getAllPageDicts(A)}catch(t){if(t instanceof DA&&!A)throw new bA;return void e.setActualNumPages(1)}for(const[A,[i,a]]of s){let s;i instanceof Error?(s=Promise.reject(i),s.catch((()=>{}))):s=Promise.resolve(new Id({pdfManager:t,xref:this.xref,pageIndex:A,pageDict:i,ref:a,globalIdFactory:this._globalIdFactory,fontCache:e.fontCache,builtInCMapCache:e.builtInCMapCache,standardFontDataCache:e.standardFontDataCache,globalImageCache:e.globalImageCache,systemFontCache:e.systemFontCache,nonBlendModesSet:e.nonBlendModesSet,xfaFactory:null})),this._pagePromises.set(A,s)}e.setActualNumPages(s.size)}}fontFallback(A,e){return this.catalog.fontFallback(A,e)}async cleanup(A=!1){return this.catalog?this.catalog.cleanup(A):pr()}async#W(A,e,t,i,a,s,n){const{xref:g}=this;if(!(t instanceof BA)||s.has(t))return;s.put(t);const r=await g.fetchAsync(t);if(!(r instanceof CA))return;if(r.has("T")){const e=z(await r.getAsync("T"));A=""===A?e:`${A}.${e}`}else{let t=r;for(;;){if(t=t.getRaw("Parent")||e,t instanceof BA){if(s.has(t))break;t=await g.fetchAsync(t)}if(!(t instanceof CA))break;if(t.has("T")){const e=z(await t.getAsync("T"));A=""===A?e:`${A}.${e}`;break}}}if(e&&!r.has("Parent")&&lA(r.get("Subtype"),"Widget")&&n.put(t,e),i.has(A)||i.set(A,[]),i.get(A).push(Su.create(g,t,a,null,!0,n,null).then((A=>A?.getFieldObject())).catch((function(A){return R(`#collectFieldObjects: "${A}".`),null}))),!r.has("Kids"))return;const o=await r.getAsync("Kids");if(Array.isArray(o))for(const e of o)await this.#W(A,t,e,i,a,s,n)}get fieldObjects(){return this.formInfo.hasFields?U(this,"fieldObjects",Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureCatalog("acroForm")]).then((async([A,e])=>{if(!A)return null;const t=new hA,i=Object.create(null),a=new Map,s=new QA;for(const i of await e.getAsync("Fields"))await this.#W("",null,i,a,A,t,s);const n=[];for(const[A,e]of a)n.push(Promise.all(e).then((e=>{(e=e.filter((A=>!!A))).length>0&&(i[A]=e)})));return await Promise.all(n),{allFields:i,orphanFields:s}}))):U(this,"fieldObjects",Promise.resolve(null))}get hasJSActions(){return U(this,"hasJSActions",this.pdfManager.ensureDoc("_parseHasJSActions"))}async _parseHasJSActions(){const[A,e]=await Promise.all([this.pdfManager.ensureCatalog("jsActions"),this.pdfManager.ensureDoc("fieldObjects")]);return!!A||!!e&&Object.values(e.allFields).some((A=>A.some((A=>null!==A.actions))))}get calculationOrderIds(){const A=this.catalog.acroForm;if(!A?.has("CO"))return U(this,"calculationOrderIds",null);const e=A.get("CO");if(!Array.isArray(e)||0===e.length)return U(this,"calculationOrderIds",null);const t=[];for(const A of e)A instanceof BA&&t.push(A.toString());return 0===t.length?U(this,"calculationOrderIds",null):U(this,"calculationOrderIds",t)}get annotationGlobals(){return U(this,"annotationGlobals",Su.createGlobals(this.pdfManager))}}class ld{constructor(A){this._docBaseUrl=function(A){if(A){const e=x(A);if(e)return e.href;R(`Invalid absolute docBaseUrl: "${A}".`)}return null}(A.docBaseUrl),this._docId=A.docId,this._password=A.password,this.enableXfa=A.enableXfa,A.evaluatorOptions.isOffscreenCanvasSupported&&=O.isOffscreenCanvasSupported,this.evaluatorOptions=Object.freeze(A.evaluatorOptions)}get docId(){return this._docId}get password(){return this._password}get docBaseUrl(){return this._docBaseUrl}get catalog(){return this.pdfDocument.catalog}ensureDoc(A,e){return this.ensure(this.pdfDocument,A,e)}ensureXRef(A,e){return this.ensure(this.pdfDocument.xref,A,e)}ensureCatalog(A,e){return this.ensure(this.pdfDocument.catalog,A,e)}getPage(A){return this.pdfDocument.getPage(A)}fontFallback(A,e){return this.pdfDocument.fontFallback(A,e)}loadXfaFonts(A,e){return this.pdfDocument.loadXfaFonts(A,e)}loadXfaImages(){return this.pdfDocument.loadXfaImages()}serializeXfaData(A){return this.pdfDocument.serializeXfaData(A)}cleanup(A=!1){return this.pdfDocument.cleanup(A)}async ensure(A,e,t){G("Abstract method `ensure` called")}requestRange(A,e){G("Abstract method `requestRange` called")}requestLoadedStream(A=!1){G("Abstract method `requestLoadedStream` called")}sendProgressiveData(A){G("Abstract method `sendProgressiveData` called")}updatePassword(A){this._password=A}terminate(A){G("Abstract method `terminate` called")}}class Ed extends ld{constructor(A){super(A);const e=new ae(A.source);this.pdfDocument=new Qd(this,e),this._loadedStreamPromise=Promise.resolve(e)}async ensure(A,e,t){const i=A[e];return"function"==typeof i?i.apply(A,t):i}requestRange(A,e){return Promise.resolve()}requestLoadedStream(A=!1){return this._loadedStreamPromise}terminate(A){}}class ud extends ld{constructor(A){super(A),this.streamManager=new re(A.source,{msgHandler:A.handler,length:A.length,disableAutoFetch:A.disableAutoFetch,rangeChunkSize:A.rangeChunkSize}),this.pdfDocument=new Qd(this,this.streamManager.getStream())}async ensure(A,e,t){try{const i=A[e];return"function"==typeof i?i.apply(A,t):i}catch(i){if(!(i instanceof yA))throw i;return await this.requestRange(i.begin,i.end),this.ensure(A,e,t)}}requestRange(A,e){return this.streamManager.requestRange(A,e)}requestLoadedStream(A=!1){return this.streamManager.requestAllChunks(A)}sendProgressiveData(A){this.streamManager.onReceiveData({chunk:A})}terminate(A){this.streamManager.abort(A)}}function dd(A){switch(A instanceof Error||"object"==typeof A&&null!==A||G('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),A.name){case"AbortException":return new q(A.message);case"MissingPDFException":return new Y(A.message);case"PasswordException":return new L(A.message,A.code);case"UnexpectedResponseException":return new v(A.message,A.status);case"UnknownErrorException":return new J(A.message,A.details);default:return new J(A.message,A.toString())}}class fd{constructor(A,e,t){this.sourceName=A,this.targetName=e,this.comObj=t,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=A=>{const e=A.data;if(e.targetName!==this.sourceName)return;if(e.stream)return void this.#Z(e);if(e.callback){const A=e.callbackId,t=this.callbackCapabilities[A];if(!t)throw new Error(`Cannot resolve callback ${A}`);if(delete this.callbackCapabilities[A],1===e.callback)t.resolve(e.data);else{if(2!==e.callback)throw new Error("Unexpected callback case");t.reject(dd(e.reason))}return}const i=this.actionHandler[e.action];if(!i)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const A=this.sourceName,a=e.sourceName;new Promise((function(A){A(i(e.data))})).then((function(i){t.postMessage({sourceName:A,targetName:a,callback:1,callbackId:e.callbackId,data:i})}),(function(i){t.postMessage({sourceName:A,targetName:a,callback:2,callbackId:e.callbackId,reason:dd(i)})}))}else e.streamId?this.#O(e):i(e.data)},t.addEventListener("message",this._onComObjOnMessage)}on(A,e){const t=this.actionHandler;if(t[A])throw new Error(`There is already an actionName called "${A}"`);t[A]=e}send(A,e,t){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:A,data:e},t)}sendWithPromise(A,e,t){const i=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[i]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:A,callbackId:i,data:e},t)}catch(A){a.reject(A)}return a.promise}sendWithStream(A,e,t,i){const a=this.streamId++,s=this.sourceName,n=this.targetName,g=this.comObj;return new ReadableStream({start:t=>{const r=Promise.withResolvers();return this.streamControllers[a]={controller:t,startCall:r,pullCall:null,cancelCall:null,isClosed:!1},g.postMessage({sourceName:s,targetName:n,action:A,streamId:a,data:e,desiredSize:t.desiredSize},i),r.promise},pull:A=>{const e=Promise.withResolvers();return this.streamControllers[a].pullCall=e,g.postMessage({sourceName:s,targetName:n,stream:6,streamId:a,desiredSize:A.desiredSize}),e.promise},cancel:A=>{N(A instanceof Error,"cancel must have a valid reason");const e=Promise.withResolvers();return this.streamControllers[a].cancelCall=e,this.streamControllers[a].isClosed=!0,g.postMessage({sourceName:s,targetName:n,stream:1,streamId:a,reason:dd(A)}),e.promise}},t)}#O(A){const e=A.streamId,t=this.sourceName,i=A.sourceName,a=this.comObj,s=this,n=this.actionHandler[A.action],g={enqueue(A,s=1,n){if(this.isCancelled)return;const g=this.desiredSize;this.desiredSize-=s,g>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),a.postMessage({sourceName:t,targetName:i,stream:4,streamId:e,chunk:A},n)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:t,targetName:i,stream:3,streamId:e}),delete s.streamSinks[e])},error(A){N(A instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:t,targetName:i,stream:5,streamId:e,reason:dd(A)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:A.desiredSize,ready:null};g.sinkCapability.resolve(),g.ready=g.sinkCapability.promise,this.streamSinks[e]=g,new Promise((function(e){e(n(A.data,g))})).then((function(){a.postMessage({sourceName:t,targetName:i,stream:8,streamId:e,success:!0})}),(function(A){a.postMessage({sourceName:t,targetName:i,stream:8,streamId:e,reason:dd(A)})}))}#Z(A){const e=A.streamId,t=this.sourceName,i=A.sourceName,a=this.comObj,s=this.streamControllers[e],n=this.streamSinks[e];switch(A.stream){case 8:A.success?s.startCall.resolve():s.startCall.reject(dd(A.reason));break;case 7:A.success?s.pullCall.resolve():s.pullCall.reject(dd(A.reason));break;case 6:if(!n){a.postMessage({sourceName:t,targetName:i,stream:7,streamId:e,success:!0});break}n.desiredSize<=0&&A.desiredSize>0&&n.sinkCapability.resolve(),n.desiredSize=A.desiredSize,new Promise((function(A){A(n.onPull?.())})).then((function(){a.postMessage({sourceName:t,targetName:i,stream:7,streamId:e,success:!0})}),(function(A){a.postMessage({sourceName:t,targetName:i,stream:7,streamId:e,reason:dd(A)})}));break;case 4:if(N(s,"enqueue should have stream controller"),s.isClosed)break;s.controller.enqueue(A.chunk);break;case 3:if(N(s,"close should have stream controller"),s.isClosed)break;s.isClosed=!0,s.controller.close(),this.#X(s,e);break;case 5:N(s,"error should have stream controller"),s.controller.error(dd(A.reason)),this.#X(s,e);break;case 2:A.success?s.cancelCall.resolve():s.cancelCall.reject(dd(A.reason)),this.#X(s,e);break;case 1:if(!n)break;new Promise((function(e){e(n.onCancel?.(dd(A.reason)))})).then((function(){a.postMessage({sourceName:t,targetName:i,stream:2,streamId:e,success:!0})}),(function(A){a.postMessage({sourceName:t,targetName:i,stream:2,streamId:e,reason:dd(A)})})),n.sinkCapability.reject(dd(A.reason)),n.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#X(A,e){await Promise.allSettled([A.startCall?.promise,A.pullCall?.promise,A.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}class pd{constructor(A){this._msgHandler=A,this._contentLength=null,this._fullRequestReader=null,this._rangeRequestReaders=[]}getFullReader(){return N(!this._fullRequestReader,"PDFWorkerStream.getFullReader can only be called once."),this._fullRequestReader=new md(this._msgHandler),this._fullRequestReader}getRangeReader(A,e){const t=new yd(A,e,this._msgHandler);return this._rangeRequestReaders.push(t),t}cancelAllRequests(A){this._fullRequestReader?.cancel(A);for(const e of this._rangeRequestReaders.slice(0))e.cancel(A)}}class md{constructor(A){this._msgHandler=A,this.onProgress=null,this._contentLength=null,this._isRangeSupported=!1,this._isStreamingSupported=!1;const e=this._msgHandler.sendWithStream("GetReader");this._reader=e.getReader(),this._headersReady=this._msgHandler.sendWithPromise("ReaderHeadersReady").then((A=>{this._isStreamingSupported=A.isStreamingSupported,this._isRangeSupported=A.isRangeSupported,this._contentLength=A.contentLength}))}get headersReady(){return this._headersReady}get contentLength(){return this._contentLength}get isStreamingSupported(){return this._isStreamingSupported}get isRangeSupported(){return this._isRangeSupported}async read(){const{value:A,done:e}=await this._reader.read();return e?{value:void 0,done:!0}:{value:A.buffer,done:!1}}cancel(A){this._reader.cancel(A)}}class yd{constructor(A,e,t){this._msgHandler=t,this.onProgress=null;const i=this._msgHandler.sendWithStream("GetRangeReader",{begin:A,end:e});this._reader=i.getReader()}get isStreamingSupported(){return!1}async read(){const{value:A,done:e}=await this._reader.read();return e?{value:void 0,done:!0}:{value:A.buffer,done:!1}}cancel(A){this._reader.cancel(A)}}class wd{constructor(A){this.name=A,this.terminated=!1,this._capability=Promise.withResolvers()}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}class Dd{static setup(A,e){let t=!1;A.on("test",(function(e){t||(t=!0,A.send("test",e instanceof Uint8Array))})),A.on("configure",(function(A){var e;e=A.verbosity,Number.isInteger(e)&&(k=e)})),A.on("GetDocRequest",(function(A){return Dd.createDocumentHandler(A,e)}))}static createDocumentHandler(A,e){let t,i=!1,a=null;const s=new Set,n=F(),{docId:g,apiVersion:r}=A,o="4.7.76";if(r!==o)throw new Error(`The API version "${r}" does not match the Worker version "${o}".`);const I=[];for(const A in[])I.push(A);if(I.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+I.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");const c=g+"_worker";let C=new fd(c,g,e);function B(){if(i)throw new Error("Worker was terminated")}function h(A){s.add(A)}function Q(A){A.finish(),s.delete(A)}async function l(A){await t.ensureDoc("checkHeader"),await t.ensureDoc("parseStartXRef"),await t.ensureDoc("parse",[A]),await t.ensureDoc("checkFirstPage",[A]),await t.ensureDoc("checkLastPage",[A]);const e=await t.ensureDoc("isPureXfa");if(e){const A=new wd("loadXfaFonts");h(A),await Promise.all([t.loadXfaFonts(C,A).catch((A=>{})).then((()=>Q(A))),t.loadXfaImages()])}const[i,a]=await Promise.all([t.ensureDoc("numPages"),t.ensureDoc("fingerprints")]);return{numPages:i,fingerprints:a,htmlForXfa:e?await t.ensureDoc("htmlForXfa"):null}}return C.on("GetPage",(function(A){return t.getPage(A.pageIndex).then((function(A){return Promise.all([t.ensure(A,"rotate"),t.ensure(A,"ref"),t.ensure(A,"userUnit"),t.ensure(A,"view")]).then((function([A,e,t,i]){return{rotate:A,ref:e,refStr:e?.toString()??null,userUnit:t,view:i}}))}))})),C.on("GetPageIndex",(function(A){const e=BA.get(A.num,A.gen);return t.ensureCatalog("getPageIndex",[e])})),C.on("GetDestinations",(function(A){return t.ensureCatalog("destinations")})),C.on("GetDestination",(function(A){return t.ensureCatalog("getDestination",[A.id])})),C.on("GetPageLabels",(function(A){return t.ensureCatalog("pageLabels")})),C.on("GetPageLayout",(function(A){return t.ensureCatalog("pageLayout")})),C.on("GetPageMode",(function(A){return t.ensureCatalog("pageMode")})),C.on("GetViewerPreferences",(function(A){return t.ensureCatalog("viewerPreferences")})),C.on("GetOpenAction",(function(A){return t.ensureCatalog("openAction")})),C.on("GetAttachments",(function(A){return t.ensureCatalog("attachments")})),C.on("GetDocJSActions",(function(A){return t.ensureCatalog("jsActions")})),C.on("GetPageJSActions",(function({pageIndex:A}){return t.getPage(A).then((function(A){return t.ensure(A,"jsActions")}))})),C.on("GetOutline",(function(A){return t.ensureCatalog("documentOutline")})),C.on("GetOptionalContentConfig",(function(A){return t.ensureCatalog("optionalContentConfig")})),C.on("GetPermissions",(function(A){return t.ensureCatalog("permissions")})),C.on("GetMetadata",(function(A){return Promise.all([t.ensureDoc("documentInfo"),t.ensureCatalog("metadata")])})),C.on("GetMarkInfo",(function(A){return t.ensureCatalog("markInfo")})),C.on("GetData",(function(A){return t.requestLoadedStream().then((function(A){return A.bytes}))})),C.on("GetAnnotations",(function({pageIndex:A,intent:e}){return t.getPage(A).then((function(t){const i=new wd(`GetAnnotations: page ${A}`);return h(i),t.getAnnotationsData(C,i,e).then((A=>(Q(i),A)),(A=>{throw Q(i),A}))}))})),C.on("GetFieldObjects",(function(A){return t.ensureDoc("fieldObjects").then((A=>A?.allFields||null))})),C.on("HasJSActions",(function(A){return t.ensureDoc("hasJSActions")})),C.on("GetCalculationOrderIds",(function(A){return t.ensureDoc("calculationOrderIds")})),C.on("SaveDocument",(async function({isPureXfa:A,numPages:e,annotationStorage:i,filename:a}){const s=[t.requestLoadedStream(),t.ensureCatalog("acroForm"),t.ensureCatalog("acroFormRef"),t.ensureDoc("startXRef"),t.ensureDoc("xref"),t.ensureDoc("linearization"),t.ensureCatalog("structTreeRoot")],n=[],g=A?null:_A(i),[r,o,I,c,B,h,l]=await Promise.all(s),E=B.trailer.getRaw("Root")||null;let u;if(g){l?await l.canUpdateStructTree({pdfManager:t,xref:B,newAnnotationsByPage:g})&&(u=l):await $r.canCreateStructureTree({catalogRef:E,pdfManager:t,newAnnotationsByPage:g})&&(u=null);const A=Su.generateImages(i.values(),B,t.evaluatorOptions.isOffscreenCanvasSupported),e=void 0===u?n:[];for(const[i,a]of g)e.push(t.getPage(i).then((e=>{const t=new wd(`Save (editor): page ${i}`);return e.saveNewAnnotations(C,t,a,A).finally((function(){Q(t)}))})));null===u?n.push(Promise.all(e).then((async A=>(await $r.createStructureTree({newAnnotationsByPage:g,xref:B,catalogRef:E,pdfManager:t,newRefs:A}),A)))):u&&n.push(Promise.all(e).then((async A=>(await u.updateStructureTree({newAnnotationsByPage:g,pdfManager:t,newRefs:A}),A))))}if(A)n.push(t.serializeXfaData(i));else for(let A=0;AA.needAppearances)),y=o instanceof CA&&o.get("XFA")||null;let w=null,D=!1;if(Array.isArray(y)){for(let A=0,e=y.length;A{"string"==typeof t&&(A[e]=z(t))})),b={rootRef:E,encryptRef:B.trailer.getRaw("Encrypt")||null,newRef:B.getNewTemporaryRef(),infoRef:B.trailer.getRaw("Info")||null,info:A,fileIds:B.trailer.get("ID")||null,startXRef:h?c:B.lastXRefStreamPos??c,filename:a}}return _r({originalData:r.bytes,xrefInfo:b,newRefs:f,xref:B,hasXfa:!!y,xfaDatasetsRef:w,hasXfaDatasetsEntry:D,needAppearances:m,acroFormRef:I,acroForm:o,xfaData:p,useXrefStream:uA(B.topDict,"XRef")}).finally((()=>{B.resetNewTemporaryRef()}))})),C.on("GetOperatorList",(function(A,e){const i=A.pageIndex;t.getPage(i).then((function(t){const a=new wd(`GetOperatorList: page ${i}`);h(a);const s=n>=5?Date.now():0;t.getOperatorList({handler:C,sink:e,task:a,intent:A.intent,cacheKey:A.cacheKey,annotationStorage:A.annotationStorage,modifiedIds:A.modifiedIds}).then((function(A){Q(a),s&&S(`page=${i+1} - getOperatorList: time=${Date.now()-s}ms, len=${A.length}`),e.close()}),(function(A){Q(a),a.terminated||e.error(A)}))}))})),C.on("GetTextContent",(function(A,e){const{pageIndex:i,includeMarkedContent:a,disableNormalization:s}=A;t.getPage(i).then((function(A){const t=new wd("GetTextContent: page "+i);h(t);const g=n>=5?Date.now():0;A.extractTextContent({handler:C,task:t,sink:e,includeMarkedContent:a,disableNormalization:s}).then((function(){Q(t),g&&S(`page=${i+1} - getTextContent: time=`+(Date.now()-g)+"ms"),e.close()}),(function(A){Q(t),t.terminated||e.error(A)}))}))})),C.on("GetStructTree",(function(A){return t.getPage(A.pageIndex).then((function(A){return t.ensure(A,"getStructTree")}))})),C.on("FontFallback",(function(A){return t.fontFallback(A.id,C)})),C.on("Cleanup",(function(A){return t.cleanup(!0)})),C.on("Terminate",(function(A){i=!0;const e=[];if(t){t.terminate(new q("Worker was terminated."));const A=t.cleanup();e.push(A),t=null}else pr();a&&a(new q("Worker was terminated."));for(const A of s)e.push(A.finished),A.terminate();return Promise.all(e).then((function(){C.destroy(),C=null}))})),C.on("Ready",(function(e){!function(A){function e(A){B(),C.send("GetDoc",{pdfInfo:A})}function s(A){if(B(),A instanceof L){const e=new wd(`PasswordException: response ${A.code}`);h(e),C.sendWithPromise("PasswordRequest",A).then((function({password:A}){Q(e),t.updatePassword(A),n()})).catch((function(){Q(e),C.send("DocException",A)}))}else A instanceof H||A instanceof Y||A instanceof v||A instanceof J?C.send("DocException",A):C.send("DocException",new J(A.message,A.toString()))}function n(){B(),l(!1).then(e,(function(A){B(),A instanceof bA?t.requestLoadedStream().then((function(){B(),l(!0).then(e,s)})):s(A)}))}B(),function({data:A,password:e,disableAutoFetch:t,rangeChunkSize:i,length:s,docBaseUrl:n,enableXfa:r,evaluatorOptions:o}){const I={source:null,disableAutoFetch:t,docBaseUrl:n,docId:g,enableXfa:r,evaluatorOptions:o,handler:C,length:s,password:e,rangeChunkSize:i},c=Promise.withResolvers();let h;if(A){try{I.source=A,h=new Ed(I),c.resolve(h)}catch(A){c.reject(A)}return c.promise}let Q,l=[];try{Q=new pd(C)}catch(A){return c.reject(A),c.promise}const E=Q.getFullReader();E.headersReady.then((function(){if(E.isRangeSupported){I.source=Q,I.length=E.contentLength,I.disableAutoFetch||=E.isStreamingSupported,h=new ud(I);for(const A of l)h.sendProgressiveData(A);l=[],c.resolve(h),a=null}})).catch((function(A){c.reject(A),a=null}));let u=0;return new Promise((function(A,e){const t=function({value:A,done:i}){try{if(B(),i)return h||function(){const A=kA(l);s&&A.length!==s&&R("reported HTTP length is different from actual");try{I.source=A,h=new Ed(I),c.resolve(h)}catch(A){c.reject(A)}l=[]}(),void(a=null);u+=A.byteLength,E.isStreamingSupported||C.send("DocProgress",{loaded:u,total:Math.max(u,E.contentLength||0)}),h?h.sendProgressiveData(A):l.push(A),E.read().then(t,e)}catch(A){e(A)}};E.read().then(t,e)})).catch((function(A){c.reject(A),a=null})),a=function(A){Q.cancelAllRequests(A)},c.promise}(A).then((function(A){if(i)throw A.terminate(new q("Worker was terminated.")),new Error("Worker was terminated");t=A,t.requestLoadedStream(!0).then((A=>{C.send("DataLoaded",{length:A.bytes.byteLength})}))})).then(n,s)}(A),A=null})),c}static initializeFromPort(A){const e=new fd("worker","main",A);Dd.setup(e,A),e.send("ready",null)}}var bd;"undefined"==typeof window&&!t&&"undefined"!=typeof self&&"function"==typeof(bd=self).postMessage&&"onmessage"in bd&&Dd.initializeFromPort(self);var kd={}.false;export{kd as WorkerMessageHandler}; \ No newline at end of file diff --git a/dist/assessment/index.js b/dist/assessment/index.js index 5b5ed1a..2ae71f1 100644 --- a/dist/assessment/index.js +++ b/dist/assessment/index.js @@ -1,2 +1,2 @@ /*! For license information please see index.js.LICENSE.txt */ -var t={8097:(t,e,i)=>{i.d(e,{LT:()=>g});var n=i(4113),s=i(173),r=i(1433),a=i(7518),o=i(77),l=i(3963),c=i(7028);function d(t){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},d(t)}function h(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function u(t){for(var e=1;e{i.r(e),i.d(e,{activity:()=>a,activityId:()=>o,activitySubTitle:()=>d,activityTags:()=>h,activityTemplateId:()=>l,activityTitle:()=>c,adaptiveType:()=>u,annotationsConfig:()=>p,autoSaveConfig:()=>f,elapsedTime:()=>g,hasActivityTemplate:()=>m,hasAnnotations:()=>v,hasAnswerMasking:()=>b,hasAutoSave:()=>y,hasEvents:()=>w,hasItemPool:()=>A,hasLineReader:()=>x,hasResourceItems:()=>E,hasSections:()=>S,hasShuffledItems:()=>_,hasTryAgain:()=>T,isAdaptive:()=>C,isResuming:()=>k,itemBank:()=>M,itemPool:()=>I,maxTime:()=>L,region:()=>P,resourceItems:()=>R,sessionId:()=>D,state:()=>F,timeRemaining:()=>O,totalItems:()=>N,userId:()=>q});var n=i(4113),s=i(7028),r=i(5059);function a(){return n.appInstance().getActivity()}function o(){return a().activity_id}function l(){return a().activity_template_id}function c(){return a().config.title}function d(){return a().config.subtitle}function h(){return n.appInstance().getTags()}function u(){return C()&&a().adaptive.hasOwnProperty("type")?a().adaptive.type:""}function p(){var t;return v()&&null!==(t=a())&&void 0!==t&&null!==(t=t.config)&&void 0!==t&&t.annotations_api_init_options?a().config.annotations_api_init_options:{}}function f(){var t,e=a();return null!=e&&null!==(t=e.config)&&void 0!==t&&null!==(t=t.navigation)&&void 0!==t&&t.auto_save?e.config.navigation.auto_save:{}}function g(){return n.appInstance().getTime()}function m(){return a().hasOwnProperty("activity_template_id")}function v(){var t,e,i=a();return Boolean(!0===(null==i||null===(t=i.config)||void 0===t?void 0:t.annotations)||(null==i||null===(e=i.config)||void 0===e?void 0:e.annotations_api_init_options))}function b(){return!!document.querySelector(".test-answer-masking")}function y(){var t=a();return t.hasOwnProperty("config")&&t.config.hasOwnProperty("navigation")&&t.config.navigation.hasOwnProperty("auto_save")&&!1!==t.config.navigation.auto_save}function _(){var t;return Boolean(null===(t=a())||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.configuration)||void 0===t?void 0:t.shuffle_items)}function w(){var t=a();return t.hasOwnProperty("events")&&!1!==t.events}function A(){return a().hasOwnProperty("item_pool_id")}function x(){return!!document.querySelector(".lrn_linereader-toggle")}function E(){var t;return Boolean(null===(t=a())||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.navigation)||void 0===t?void 0:t.resource_items)}function S(){return a().hasOwnProperty("sections")}function T(){var t;return null===(t=a())||void 0===t?void 0:t.dynamic_items.hasOwnProperty("try_again")}function C(){return a().hasOwnProperty("adaptive")}function k(){return a().existing_session}function M(){var t;return null===(t=a())||void 0===t?void 0:t.organisation_id}function I(){var t;return null===(t=a())||void 0===t?void 0:t.item_pool_id}function L(){var t;return null!==(t=a())&&void 0!==t&&null!==(t=t.config)&&void 0!==t&&null!==(t=t.time)&&void 0!==t&&t.max_time?a().config.time.max_time:0}function P(){var t;return null===(t=a())||void 0===t||null===(t=t.config)||void 0===t?void 0:t.regions}function R(){var t;return null===(t=a())||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.navigation)||void 0===t?void 0:t.resource_items}function D(){var t;return null===(t=a())||void 0===t?void 0:t.session_id}function F(){var t;return void 0===(null===(t=a())||void 0===t?void 0:t.state)?"initial":a().state}function O(){return 0===L()?null:L()-g()}function N(){if(S()){for(var t=0,e=s.sections(),i=0;i{i.r(e),i.d(e,{annotationsApp:()=>l,appInstance:()=>o,assessApp:()=>c,eventsApp:()=>d,init:()=>a,questionsApp:()=>h});var n=i(1433),s=i(3963),r={};function a(t){r.app=t,r.app.on("all",(function(t){(0,n.handleEvent)(t)})),r.app.on("item:load",(function(t){(0,s.questionResponseIds)().forEach((function(t){r.app.question(t).on("changed",(function(t){(0,n.handleEvent)("changed")})),r.app.question(t).on("beforeValidate",(function(t){(0,n.handleEvent)("beforeValidate")})),r.app.question(t).on("rendered",(function(t){(0,n.handleEvent)("rendered")})),r.app.question(t).on("validated",(function(t){(0,n.handleEvent)("validated")}))}))}))}function o(){return r.app}function l(){return void 0!==o().annotationsApp()?o().annotationsApp():null}function c(){return o().assessApp()}function d(){return o().eventsApp()}function h(){return o().questionsApp()}},1433:(t,e,i)=>{i.r(e),i.d(e,{diagnostics:()=>l,filterEvent:()=>c,handleEvent:()=>d,listen:()=>h});var n=i(4113),s=i(173),r=i(5059),a="2.17.0",o={events:{broadcast:!1,listenFor:"item"}};function l(){var t=window.LearnosityApp?LearnosityApp.versions:{};return{apps:{annotations:{app:n.annotationsApp(),config:s.annotationsConfig(),enabled:s.hasAnnotations()},assess:{app:n.assessApp()},events:{app:n.eventsApp(),enabled:s.hasEvents()},items:{app:n.appInstance(),metadata:s.activity().config.metadata},questions:{app:n.questionsApp()}},activity:{activity:s.activityId(),activityTemplate:s.activityTemplateId(),autoSave:{config:s.autoSaveConfig(),enabled:s.hasAutoSave()},itemBank:s.itemBank(),itemPool:s.itemPool(),session:s.sessionId(),state:s.state(),type:s.activity().type,user:s.userId()},LT:{version:a},versions:t}}function c(t){/^[a-zA-Z:*]*$/.test(t)?o.events.listenFor=t:r.A.warn("Invalid event type")}function d(t){if(o.events.broadcast){var e=o.events.listenFor,i=e.replaceAll("*","");1===e.length&&"*"===e||"all"===e?r.A.info(t):e.startsWith("*")&&!e.endsWith("*")?t.endsWith(i)&&r.A.info(t):e.endsWith("*")&&!e.startsWith("*")?t.startsWith(i)&&r.A.info(t):e.startsWith("*")&&e.endsWith("*")?t.includes(i)&&r.A.info(t):t.startsWith(i)&&r.A.info(t)}}function h(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];o.events.broadcast=Boolean(t),Boolean(t)?r.A.info("👂 listening for '".concat(o.events.listenFor,"'")):r.A.info("🚫👂 not listening")}},7518:(t,e,i)=>{i.r(e),i.d(e,{dynamic:()=>l,flag:()=>c,isDynamicItem:()=>d,isFirstItem:()=>h,isFlagged:()=>p,isItemFullyAttempted:()=>f,isLastItem:()=>u,isMaskingEnabled:()=>g,item:()=>m,itemAttemptStatus:()=>v,itemByResponseId:()=>b,itemElement:()=>y,itemPosition:()=>_,itemReference:()=>w,itemTags:()=>A});var n=i(4113),s=i(173),r=i(3963),a=i(7028);function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function l(){var t=w();return n.assessApp().item(t).dynamic||{}}function c(){var t=w();n.assessApp().item(t).flag()}function d(){var t;return null===(t=m())||void 0===t?void 0:t.source.hasOwnProperty("data_table_seed")}function h(){return s.hasSections()?("object"===o(a.sections()[0].items[0])?a.sections()[0].items[0].reference:a.sections()[0].items[0])===m().reference:("object"===o(s.activity().items[0])?s.activity().items[0].reference:s.activity().items[0])===m().reference}function u(){return m().is_last_item}function p(){return m().user_flagged}function f(t){var e,i,s;if(e=t?n.appInstance().getItems()[t].questions:r.questions(),Array.isArray(e)&&e.length)for(var a=0;a{i.r(e),i.d(e,{answerMasking:()=>o,dialog:()=>l,hideDialog:()=>c,isResponsiveMode:()=>d,isReviewScreen:()=>h,lineReader:()=>u,navigate:()=>p,next:()=>f,previous:()=>g,review:()=>m,submit:()=>v}),i(173);var n=i(4113),s=i(7518),r=i(5059),a={answerMasking:{enabled:null},lineReader:{enabled:null,id:null}};function o(t){if(null===a.answerMasking.enabled){var e=document.querySelector(".test-answer-masking");a.answerMasking.enabled=!!e}a.answerMasking.enabled?void 0!==t&&n.appInstance().questionsApp().masking(t):r.A.warn("Answer masking is not enabled in the Items API configuration.")}function l(t){n.assessApp().dialogs().custom.show(t)}function c(){n.assessApp().dialogs().custom.hide()}function d(){return Boolean(document.querySelector(".has-menu-region"))}function h(){var t=!1;setTimeout((function(){return null===document.getElementsByClassName("review-screen")[0].getAttribute("aria-hidden")&&(t=!0),t}),500)}function u(t){if(null===a.lineReader.enabled){var e=document.querySelector(".lrn_linereader-toggle");if(e){a.lineReader.enabled=!0;var i=e.querySelector("[data-lrn-widget-container]").getAttribute("data-lrn-widget-container").match(/\d+$/);i?a.lineReader.id=i[0]:r.A.warn("Could not find the line reader unique id.")}else a.lineReader.enabled=!1}if(a.lineReader.enabled&&null!==a.lineReader.id){var s=n.appInstance().features()["lrn-assessapp-feature_".concat(a.lineReader.id)];switch(t){case"show":s.show();break;case"hide":s.hide();break;default:s.toggle()}}else r.A.warn("Line reader is not enabled in the Items API configuration.")}function p(t){switch(t){case"previous":n.appInstance().items().previous();break;case"next":s.isLastItem()||n.appInstance().items().next();break;case"review":null===document.getElementsByClassName("review-screen")[0].getAttribute("aria-hidden")?n.appInstance().dialogs().reviewScreen.hide():n.appInstance().dialogs().reviewScreen.show();break;case"submit":var e={show_submit_confirmation:!0,show_submit_ui:!0,success:function(t){alert("Test saved!")},error:function(t){alert("Test submit failed...check browser log"),console.log("Submission failed: ",t)}};n.appInstance().submit(e);break;default:"number"==typeof Number(t)&&Number(t)>=0?n.appInstance().items().goto(Number(t)):r.A.warn("Invalid target (".concat(t,")"))}}function f(){p("next")}function g(){p("previous")}function m(){p("review")}function v(){p("submit")}},3963:(t,e,i)=>{i.r(e),i.d(e,{hasCheckAnswer:()=>o,isAutoScorable:()=>l,question:()=>c,questionInstance:()=>d,questionResponse:()=>u,questionResponseIds:()=>p,questionScore:()=>f,questions:()=>h});var n=i(4113),s=i(7518),r=i(173),a=i(5059);function o(t){var e;if(!l(t))return!1;var i=(null===(e=(0,r.activity)())||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.questions_api_init_options)||void 0===e?void 0:e.attribute_overrides)&&(0,r.activity)().config.questions_api_init_options.attribute_overrides.hasOwnProperty("instant_feedback")&&"boolean"==typeof(0,r.activity)().config.questions_api_init_options.attribute_overrides.instant_feedback,n=c(t);return i?(0,r.activity)().config.questions_api_init_options.attribute_overrides.instant_feedback:!(!n.hasOwnProperty("instant_feedback")||"boolean"!=typeof n.instant_feedback)&&n.instant_feedback}function l(t){return c(t),d(t).checkValidation().has_validation}function c(t){var e=t||p()[0];return e?n.appInstance().question(e).getQuestion():(a.A.error("Question not found (index ".concat(e,")")),{})}function d(t){var e=t||p()[0];return e?n.appInstance().question(e):{}}function h(){return s.item().questions}function u(t){var e=t||p()[0];return e?function(t){return n.appInstance().question(t)?n.appInstance().question(t).getResponse():void a.A.error("Response not found ".concat(t))}(e):{}}function p(){return h().map((function(t){return t.response_id}))}function f(t){var e=t||p()[0];return e&&n.appInstance().getScores()[e]||{}}},7028:(t,e,i)=>{i.r(e),i.d(e,{isFirstItemInSection:()=>r,isLastItemInSection:()=>a,section:()=>o,sectionHasShuffledItems:()=>l,sectionIndex:()=>c,sectionItemPosition:()=>d,sections:()=>h,totalItemsInSection:()=>u});var n=i(173),s=i(7518);function r(){return 1===d()}function a(){return d()===u()}function o(){if(n.hasSections()){for(var t=s.itemReference(),e=h(),i=-1,r=!1,a=0;a{i.d(e,{A:()=>n});const n={debug:function(t,e){"DEBUG"===e&&console.log(t)},error:function(t){console.error("%cError:%c "+t,"display:inline-block;background-color:#e0005a;color:#fff;font-weight:bold;padding:3px 7px;border-radius:3px","")},info:function(t){console.info("%cInfo:%c "+t,"display:inline-block;background-color:#46C0FF;color:#000;font-weight:bold;padding:3px 7px;border-radius:3px","")},log:function(t){console.log(t)},warn:function(t){console.warn("%cWarning:%c "+t,"display:inline-block;background-color:gold;color:#000;font-weight:bold;padding:3px 7px;border-radius:3px","")}}},4196:(t,e,i)=>{var n;!function(){var s=function(){this.init()};s.prototype={init:function(){var t=this||r;return t._counter=1e3,t._html5AudioPool=[],t.html5PoolSize=10,t._codecs={},t._howls=[],t._muted=!1,t._volume=1,t._canPlayEvent="canplaythrough",t._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,t.masterGain=null,t.noAudio=!1,t.usingWebAudio=!0,t.autoSuspend=!0,t.ctx=null,t.autoUnlock=!0,t._setup(),t},volume:function(t){var e=this||r;if(t=parseFloat(t),e.ctx||p(),void 0!==t&&t>=0&&t<=1){if(e._volume=t,e._muted)return e;e.usingWebAudio&&e.masterGain.gain.setValueAtTime(t,r.ctx.currentTime);for(var i=0;i=0;e--)t._howls[e].unload();return t.usingWebAudio&&t.ctx&&void 0!==t.ctx.close&&(t.ctx.close(),t.ctx=null,p()),t},codecs:function(t){return(this||r)._codecs[t.replace(/^x-/,"")]},_setup:function(){var t=this||r;if(t.state=t.ctx&&t.ctx.state||"suspended",t._autoSuspend(),!t.usingWebAudio)if("undefined"!=typeof Audio)try{void 0===(new Audio).oncanplaythrough&&(t._canPlayEvent="canplay")}catch(e){t.noAudio=!0}else t.noAudio=!0;try{(new Audio).muted&&(t.noAudio=!0)}catch(t){}return t.noAudio||t._setupCodecs(),t},_setupCodecs:function(){var t=this||r,e=null;try{e="undefined"!=typeof Audio?new Audio:null}catch(e){return t}if(!e||"function"!=typeof e.canPlayType)return t;var i=e.canPlayType("audio/mpeg;").replace(/^no$/,""),n=t._navigator?t._navigator.userAgent:"",s=n.match(/OPR\/(\d+)/g),a=s&&parseInt(s[0].split("/")[1],10)<33,o=-1!==n.indexOf("Safari")&&-1===n.indexOf("Chrome"),l=n.match(/Version\/(.*?) /),c=o&&l&&parseInt(l[1],10)<15;return t._codecs={mp3:!(a||!i&&!e.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!i,opus:!!e.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(e.canPlayType('audio/wav; codecs="1"')||e.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!e.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!e.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(e.canPlayType("audio/x-m4b;")||e.canPlayType("audio/m4b;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(e.canPlayType("audio/x-mp4;")||e.canPlayType("audio/mp4;")||e.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(c||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(c||!e.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!e.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(e.canPlayType("audio/x-flac;")||e.canPlayType("audio/flac;")).replace(/^no$/,"")},t},_unlockAudio:function(){var t=this||r;if(!t._audioUnlocked&&t.ctx){t._audioUnlocked=!1,t.autoUnlock=!1,t._mobileUnloaded||44100===t.ctx.sampleRate||(t._mobileUnloaded=!0,t.unload()),t._scratchBuffer=t.ctx.createBuffer(1,1,22050);var e=function(i){for(;t._html5AudioPool.length0?o._seek:i._sprite[t][0]/1e3),d=Math.max(0,(i._sprite[t][0]+i._sprite[t][1])/1e3-c),h=1e3*d/Math.abs(o._rate),u=i._sprite[t][0]/1e3,p=(i._sprite[t][0]+i._sprite[t][1])/1e3;o._sprite=t,o._ended=!1;var f=function(){o._paused=!1,o._seek=c,o._start=u,o._stop=p,o._loop=!(!o._loop&&!i._sprite[t][2])};if(!(c>=p)){var g=o._node;if(i._webAudio){var m=function(){i._playLock=!1,f(),i._refreshBuffer(o);var t=o._muted||i._muted?0:o._volume;g.gain.setValueAtTime(t,r.ctx.currentTime),o._playStart=r.ctx.currentTime,void 0===g.bufferSource.start?o._loop?g.bufferSource.noteGrainOn(0,c,86400):g.bufferSource.noteGrainOn(0,c,d):o._loop?g.bufferSource.start(0,c,86400):g.bufferSource.start(0,c,d),h!==1/0&&(i._endTimers[o._id]=setTimeout(i._ended.bind(i,o),h)),e||setTimeout((function(){i._emit("play",o._id),i._loadQueue()}),0)};"running"===r.state&&"interrupted"!==r.ctx.state?m():(i._playLock=!0,i.once("resume",m),i._clearTimer(o._id))}else{var v=function(){g.currentTime=c,g.muted=o._muted||i._muted||r._muted||g.muted,g.volume=o._volume*r.volume(),g.playbackRate=o._rate;try{var n=g.play();if(n&&"undefined"!=typeof Promise&&(n instanceof Promise||"function"==typeof n.then)?(i._playLock=!0,f(),n.then((function(){i._playLock=!1,g._unlocked=!0,e?i._loadQueue():i._emit("play",o._id)})).catch((function(){i._playLock=!1,i._emit("playerror",o._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),o._ended=!0,o._paused=!0}))):e||(i._playLock=!1,f(),i._emit("play",o._id)),g.playbackRate=o._rate,g.paused)return void i._emit("playerror",o._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==t||o._loop?i._endTimers[o._id]=setTimeout(i._ended.bind(i,o),h):(i._endTimers[o._id]=function(){i._ended(o),g.removeEventListener("ended",i._endTimers[o._id],!1)},g.addEventListener("ended",i._endTimers[o._id],!1))}catch(t){i._emit("playerror",o._id,t)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===g.src&&(g.src=i._src,g.load());var b=window&&window.ejecta||!g.readyState&&r._navigator.isCocoonJS;if(g.readyState>=3||b)v();else{i._playLock=!0,i._state="loading";var y=function(){i._state="loaded",v(),g.removeEventListener(r._canPlayEvent,y,!1)};g.addEventListener(r._canPlayEvent,y,!1),i._clearTimer(o._id)}}return o._id}i._ended(o)},pause:function(t){var e=this;if("loaded"!==e._state||e._playLock)return e._queue.push({event:"pause",action:function(){e.pause(t)}}),e;for(var i=e._getSoundIds(t),n=0;n=0?e=parseInt(s[0],10):t=parseFloat(s[0]):s.length>=2&&(t=parseFloat(s[0]),e=parseInt(s[1],10)),!(void 0!==t&&t>=0&&t<=1))return(i=e?n._soundById(e):n._sounds[0])?i._volume:0;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"volume",action:function(){n.volume.apply(n,s)}}),n;void 0===e&&(n._volume=t),e=n._getSoundIds(e);for(var a=0;a0?n/c:n),h=Date.now();t._fadeTo=i,t._interval=setInterval((function(){var s=(Date.now()-h)/n;h=Date.now(),o+=l*s,o=Math.round(100*o)/100,o=l<0?Math.max(i,o):Math.min(i,o),a._webAudio?t._volume=o:a.volume(o,t._id,!0),r&&(a._volume=o),(ie&&o>=i)&&(clearInterval(t._interval),t._interval=null,t._fadeTo=null,a.volume(i,t._id),a._emit("fade",t._id))}),d)},_stopFade:function(t){var e=this,i=e._soundById(t);return i&&i._interval&&(e._webAudio&&i._node.gain.cancelScheduledValues(r.ctx.currentTime),clearInterval(i._interval),i._interval=null,e.volume(i._fadeTo,t),i._fadeTo=null,e._emit("fade",t)),e},loop:function(){var t,e,i,n=this,s=arguments;if(0===s.length)return n._loop;if(1===s.length){if("boolean"!=typeof s[0])return!!(i=n._soundById(parseInt(s[0],10)))&&i._loop;t=s[0],n._loop=t}else 2===s.length&&(t=s[0],e=parseInt(s[1],10));for(var r=n._getSoundIds(e),a=0;a=0?e=parseInt(s[0],10):t=parseFloat(s[0]):2===s.length&&(t=parseFloat(s[0]),e=parseInt(s[1],10)),"number"!=typeof t)return(i=n._soundById(e))?i._rate:n._rate;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"rate",action:function(){n.rate.apply(n,s)}}),n;void 0===e&&(n._rate=t),e=n._getSoundIds(e);for(var a=0;a=0?e=parseInt(n[0],10):i._sounds.length&&(e=i._sounds[0]._id,t=parseFloat(n[0])):2===n.length&&(t=parseFloat(n[0]),e=parseInt(n[1],10)),void 0===e)return 0;if("number"==typeof t&&("loaded"!==i._state||i._playLock))return i._queue.push({event:"seek",action:function(){i.seek.apply(i,n)}}),i;var s=i._soundById(e);if(s){if(!("number"==typeof t&&t>=0)){if(i._webAudio){var a=i.playing(e)?r.ctx.currentTime-s._playStart:0,o=s._rateSeek?s._rateSeek-s._seek:0;return s._seek+(o+a*Math.abs(s._rate))}return s._node.currentTime}var l=i.playing(e);l&&i.pause(e,!0),s._seek=t,s._ended=!1,i._clearTimer(e),i._webAudio||!s._node||isNaN(s._node.duration)||(s._node.currentTime=t);var c=function(){l&&i.play(e,!0),i._emit("seek",e)};if(l&&!i._webAudio){var d=function(){i._playLock?setTimeout(d,0):c()};setTimeout(d,0)}else c()}return i},playing:function(t){var e=this;if("number"==typeof t){var i=e._soundById(t);return!!i&&!i._paused}for(var n=0;n=0&&r._howls.splice(n,1);var s=!0;for(i=0;i=0){s=!1;break}return l&&s&&delete l[t._src],r.noAudio=!1,t._state="unloaded",t._sounds=[],t=null,null},on:function(t,e,i,n){var s=this["_on"+t];return"function"==typeof e&&s.push(n?{id:i,fn:e,once:n}:{id:i,fn:e}),this},off:function(t,e,i){var n=this,s=n["_on"+t],r=0;if("number"==typeof e&&(i=e,e=null),e||i)for(r=0;r=0;r--)s[r].id&&s[r].id!==e&&"load"!==t||(setTimeout(function(t){t.call(this,e,i)}.bind(n,s[r].fn),0),s[r].once&&n.off(t,s[r].fn,s[r].id));return n._loadQueue(t),n},_loadQueue:function(t){var e=this;if(e._queue.length>0){var i=e._queue[0];i.event===t&&(e._queue.shift(),e._loadQueue()),t||i.action()}return e},_ended:function(t){var e=this,i=t._sprite;if(!e._webAudio&&t._node&&!t._node.paused&&!t._node.ended&&t._node.currentTime=0;n--){if(i<=e)return;t._sounds[n]._ended&&(t._webAudio&&t._sounds[n]._node&&t._sounds[n]._node.disconnect(0),t._sounds.splice(n,1),i--)}}},_getSoundIds:function(t){if(void 0===t){for(var e=[],i=0;i=0;if(!t.bufferSource)return this;if(r._scratchBuffer&&t.bufferSource&&(t.bufferSource.onended=null,t.bufferSource.disconnect(0),e))try{t.bufferSource.buffer=r._scratchBuffer}catch(t){}return t.bufferSource=null,this},_clearSound:function(t){/MSIE |Trident\//.test(r._navigator&&r._navigator.userAgent)||(t.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var o=function(t){this._parent=t,this.init()};o.prototype={init:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++r._counter,e._sounds.push(t),t.create(),t},create:function(){var t=this,e=t._parent,i=r._muted||t._muted||t._parent._muted?0:t._volume;return e._webAudio?(t._node=void 0===r.ctx.createGain?r.ctx.createGainNode():r.ctx.createGain(),t._node.gain.setValueAtTime(i,r.ctx.currentTime),t._node.paused=!0,t._node.connect(r.masterGain)):r.noAudio||(t._node=r._obtainHtml5Audio(),t._errorFn=t._errorListener.bind(t),t._node.addEventListener("error",t._errorFn,!1),t._loadFn=t._loadListener.bind(t),t._node.addEventListener(r._canPlayEvent,t._loadFn,!1),t._endFn=t._endListener.bind(t),t._node.addEventListener("ended",t._endFn,!1),t._node.src=e._src,t._node.preload=!0===e._preload?"auto":e._preload,t._node.volume=i*r.volume(),t._node.load()),t},reset:function(){var t=this,e=t._parent;return t._muted=e._muted,t._loop=e._loop,t._volume=e._volume,t._rate=e._rate,t._seek=0,t._rateSeek=0,t._paused=!0,t._ended=!0,t._sprite="__default",t._id=++r._counter,t},_errorListener:function(){var t=this;t._parent._emit("loaderror",t._id,t._node.error?t._node.error.code:0),t._node.removeEventListener("error",t._errorFn,!1)},_loadListener:function(){var t=this,e=t._parent;e._duration=Math.ceil(10*t._node.duration)/10,0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue()),t._node.removeEventListener(r._canPlayEvent,t._loadFn,!1)},_endListener:function(){var t=this,e=t._parent;e._duration===1/0&&(e._duration=Math.ceil(10*t._node.duration)/10,e._sprite.__default[1]===1/0&&(e._sprite.__default[1]=1e3*e._duration),e._ended(t)),t._node.removeEventListener("ended",t._endFn,!1)}};var l={},c=function(t){var e=t._src;if(l[e])return t._duration=l[e].duration,void u(t);if(/^data:[^;]+;base64,/.test(e)){for(var i=atob(e.split(",")[1]),n=new Uint8Array(i.length),s=0;s0?(l[e._src]=t,u(e,t)):i()};"undefined"!=typeof Promise&&1===r.ctx.decodeAudioData.length?r.ctx.decodeAudioData(t).then(n).catch(i):r.ctx.decodeAudioData(t,n,i)},u=function(t,e){e&&!t._duration&&(t._duration=e.duration),0===Object.keys(t._sprite).length&&(t._sprite={__default:[0,1e3*t._duration]}),"loaded"!==t._state&&(t._state="loaded",t._emit("load"),t._loadQueue())},p=function(){if(r.usingWebAudio){try{"undefined"!=typeof AudioContext?r.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?r.ctx=new webkitAudioContext:r.usingWebAudio=!1}catch(t){r.usingWebAudio=!1}r.ctx||(r.usingWebAudio=!1);var t=/iP(hone|od|ad)/.test(r._navigator&&r._navigator.platform),e=r._navigator&&r._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),i=e?parseInt(e[1],10):null;if(t&&i&&i<9){var n=/safari/.test(r._navigator&&r._navigator.userAgent.toLowerCase());r._navigator&&!n&&(r.usingWebAudio=!1)}r.usingWebAudio&&(r.masterGain=void 0===r.ctx.createGain?r.ctx.createGainNode():r.ctx.createGain(),r.masterGain.gain.setValueAtTime(r._muted?0:r._volume,r.ctx.currentTime),r.masterGain.connect(r.ctx.destination)),r._setup()}};void 0===(n=function(){return{Howler:r,Howl:a}}.apply(e,[]))||(t.exports=n),e.Howler=r,e.Howl=a,void 0!==i.g?(i.g.HowlerGlobal=s,i.g.Howler=r,i.g.Howl=a,i.g.Sound=o):"undefined"!=typeof window&&(window.HowlerGlobal=s,window.Howler=r,window.Howl=a,window.Sound=o)}(),function(){var t;HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(t){var e=this;if(!e.ctx||!e.ctx.listener)return e;for(var i=e._howls.length-1;i>=0;i--)e._howls[i].stereo(t);return e},HowlerGlobal.prototype.pos=function(t,e,i){var n=this;return n.ctx&&n.ctx.listener?(e="number"!=typeof e?n._pos[1]:e,i="number"!=typeof i?n._pos[2]:i,"number"!=typeof t?n._pos:(n._pos=[t,e,i],void 0!==n.ctx.listener.positionX?(n.ctx.listener.positionX.setTargetAtTime(n._pos[0],Howler.ctx.currentTime,.1),n.ctx.listener.positionY.setTargetAtTime(n._pos[1],Howler.ctx.currentTime,.1),n.ctx.listener.positionZ.setTargetAtTime(n._pos[2],Howler.ctx.currentTime,.1)):n.ctx.listener.setPosition(n._pos[0],n._pos[1],n._pos[2]),n)):n},HowlerGlobal.prototype.orientation=function(t,e,i,n,s,r){var a=this;if(!a.ctx||!a.ctx.listener)return a;var o=a._orientation;return e="number"!=typeof e?o[1]:e,i="number"!=typeof i?o[2]:i,n="number"!=typeof n?o[3]:n,s="number"!=typeof s?o[4]:s,r="number"!=typeof r?o[5]:r,"number"!=typeof t?o:(a._orientation=[t,e,i,n,s,r],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(i,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(s,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(r,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(t,e,i,n,s,r),a)},Howl.prototype.init=(t=Howl.prototype.init,function(e){var i=this;return i._orientation=e.orientation||[1,0,0],i._stereo=e.stereo||null,i._pos=e.pos||null,i._pannerAttr={coneInnerAngle:void 0!==e.coneInnerAngle?e.coneInnerAngle:360,coneOuterAngle:void 0!==e.coneOuterAngle?e.coneOuterAngle:360,coneOuterGain:void 0!==e.coneOuterGain?e.coneOuterGain:0,distanceModel:void 0!==e.distanceModel?e.distanceModel:"inverse",maxDistance:void 0!==e.maxDistance?e.maxDistance:1e4,panningModel:void 0!==e.panningModel?e.panningModel:"HRTF",refDistance:void 0!==e.refDistance?e.refDistance:1,rolloffFactor:void 0!==e.rolloffFactor?e.rolloffFactor:1},i._onstereo=e.onstereo?[{fn:e.onstereo}]:[],i._onpos=e.onpos?[{fn:e.onpos}]:[],i._onorientation=e.onorientation?[{fn:e.onorientation}]:[],t.call(this,e)}),Howl.prototype.stereo=function(t,i){var n=this;if(!n._webAudio)return n;if("loaded"!==n._state)return n._queue.push({event:"stereo",action:function(){n.stereo(t,i)}}),n;var s=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===i){if("number"!=typeof t)return n._stereo;n._stereo=t,n._pos=[t,0,0]}for(var r=n._getSoundIds(i),a=0;a{var n;!function(s,r){if(s){for(var a,o={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},l={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},c={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},d={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},h=1;h<20;++h)o[111+h]="f"+h;for(h=0;h<=9;++h)o[h+96]=h.toString();b.prototype.bind=function(t,e,i){var n=this;return t=t instanceof Array?t:[t],n._bindMultiple.call(n,t,e,i),n},b.prototype.unbind=function(t,e){return this.bind.call(this,t,(function(){}),e)},b.prototype.trigger=function(t,e){var i=this;return i._directMap[t+":"+e]&&i._directMap[t+":"+e]({},t),i},b.prototype.reset=function(){var t=this;return t._callbacks={},t._directMap={},t},b.prototype.stopCallback=function(t,e){if((" "+e.className+" ").indexOf(" mousetrap ")>-1)return!1;if(v(e,this.target))return!1;if("composedPath"in t&&"function"==typeof t.composedPath){var i=t.composedPath()[0];i!==t.target&&(e=i)}return"INPUT"==e.tagName||"SELECT"==e.tagName||"TEXTAREA"==e.tagName||e.isContentEditable},b.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},b.addKeycodes=function(t){for(var e in t)t.hasOwnProperty(e)&&(o[e]=t[e]);a=null},b.init=function(){var t=b(r);for(var e in t)"_"!==e.charAt(0)&&(b[e]=function(e){return function(){return t[e].apply(t,arguments)}}(e))},b.init(),s.Mousetrap=b,t.exports&&(t.exports=b),void 0===(n=function(){return b}.call(e,i,e,t))||(t.exports=n)}function u(t,e,i){t.addEventListener?t.addEventListener(e,i,!1):t.attachEvent("on"+e,i)}function p(t){if("keypress"==t.type){var e=String.fromCharCode(t.which);return t.shiftKey||(e=e.toLowerCase()),e}return o[t.which]?o[t.which]:l[t.which]?l[t.which]:String.fromCharCode(t.which).toLowerCase()}function f(t){return"shift"==t||"ctrl"==t||"alt"==t||"meta"==t}function g(t,e,i){return i||(i=function(){if(!a)for(var t in a={},o)t>95&&t<112||o.hasOwnProperty(t)&&(a[o[t]]=t);return a}()[t]?"keydown":"keypress"),"keypress"==i&&e.length&&(i="keydown"),i}function m(t,e){var i,n,s,r=[];for(i=function(t){return"+"===t?["+"]:(t=t.replace(/\+{2}/g,"+plus")).split("+")}(t),s=0;s1?function(t,e,r,a){function c(e){return function(){o=e,++n[t],clearTimeout(i),i=setTimeout(l,1e3)}}function h(e){d(r,e,t),"keyup"!==a&&(s=p(e)),setTimeout(l,10)}n[t]=0;for(var u=0;u0,r.tv=s.includes("TV"),l=navigator.getGamepads?Array.from(navigator.getGamepads()).filter((function(t){return null!=t})).length:0,r.gamepad=l>0,t("(orientation: portrait)",(function(t){r.portrait=t,r.landscape=!t,r.orientation=t?"portrait":"landscape",o("portrait",r.portrait),o("landscape",r.landscape),o("orientation",r.orientation)})),t("(any-pointer: coarse)",(function(t){e("touch",t),e("formfactor",d())&&c()})),t("(hover: hover)",(function(t){e("mouse",t),e("input",t?"mouse":"touch"),e("formfactor",d())&&c()}))}}return r.csp=r.uwp||!1,r.nwjs?r.dev="sdk"===process.versions["nw-flavor"]:r.electron?r.dev=process.execPath.replace(/\\/g,"/").includes("node_modules/electron/"):r.uwp?r.dev=Windows.ApplicationModel.Package.current.isDevelopmentMode:r.node?r.dev=!1:r.dev=void 0,r}()},7391:(t,e,i)=>{var n=i(7180),s=i(3181),r=i(3031),a=i(9067),o=i(6833),l=i(3717),c=i(4801);c.alea=n,c.xor128=s,c.xorwow=r,c.xorshift7=a,c.xor4096=o,c.tychei=l,t.exports=c},7180:function(t,e,i){var n;!function(t,s){function r(t){var e,i=this,n=(e=4022871197,function(t){t=String(t);for(var i=0;i>>0,e=(n*=e)>>>0,e+=4294967296*(n-=e)}return 2.3283064365386963e-10*(e>>>0)});i.next=function(){var t=2091639*i.s0+2.3283064365386963e-10*i.c;return i.s0=i.s1,i.s1=i.s2,i.s2=t-(i.c=0|t)},i.c=1,i.s0=n(" "),i.s1=n(" "),i.s2=n(" "),i.s0-=n(t),i.s0<0&&(i.s0+=1),i.s1-=n(t),i.s1<0&&(i.s1+=1),i.s2-=n(t),i.s2<0&&(i.s2+=1),n=null}function a(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function o(t,e){var i=new r(t),n=e&&e.state,s=i.next;return s.int32=function(){return 4294967296*i.next()|0},s.double=function(){return s()+11102230246251565e-32*(2097152*s()|0)},s.quick=s,n&&("object"==typeof n&&a(n,i),s.state=function(){return a(i,{})}),s}s&&s.exports?s.exports=o:i.amdD&&i.amdO?void 0===(n=function(){return o}.call(e,i,e,s))||(s.exports=n):this.alea=o}(0,t=i.nmd(t),i.amdD)},3717:function(t,e,i){var n;!function(t,s){function r(t){var e=this,i="";e.next=function(){var t=e.b,i=e.c,n=e.d,s=e.a;return t=t<<25^t>>>7^i,i=i-n|0,n=n<<24^n>>>8^s,s=s-t|0,e.b=t=t<<20^t>>>12^i,e.c=i=i-n|0,e.d=n<<16^i>>>16^s,e.a=s-t|0},e.a=0,e.b=0,e.c=-1640531527,e.d=1367130551,t===Math.floor(t)?(e.a=t/4294967296|0,e.b=0|t):i+=t;for(var n=0;n>>0)/4294967296};return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,n&&("object"==typeof n&&a(n,i),s.state=function(){return a(i,{})}),s}s&&s.exports?s.exports=o:i.amdD&&i.amdO?void 0===(n=function(){return o}.call(e,i,e,s))||(s.exports=n):this.tychei=o}(0,t=i.nmd(t),i.amdD)},3181:function(t,e,i){var n;!function(t,s){function r(t){var e=this,i="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:i+=t;for(var n=0;n>>0)/4294967296};return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,n&&("object"==typeof n&&a(n,i),s.state=function(){return a(i,{})}),s}s&&s.exports?s.exports=o:i.amdD&&i.amdO?void 0===(n=function(){return o}.call(e,i,e,s))||(s.exports=n):this.xor128=o}(0,t=i.nmd(t),i.amdD)},6833:function(t,e,i){var n;!function(t,s){function r(t){var e=this;e.next=function(){var t,i,n=e.w,s=e.X,r=e.i;return e.w=n=n+1640531527|0,i=s[r+34&127],t=s[r=r+1&127],i^=i<<13,t^=t<<17,i^=i>>>15,t^=t>>>12,i=s[r]=i^t,e.i=r,i+(n^n>>>16)|0},function(t,e){var i,n,s,r,a,o=[],l=128;for(e===(0|e)?(n=e,e=null):(e+="\0",n=0,l=Math.max(l,e.length)),s=0,r=-32;r>>15,n^=n<<4,n^=n>>>13,r>=0&&(a=a+1640531527|0,s=0==(i=o[127&r]^=n+a)?s+1:0);for(s>=128&&(o[127&(e&&e.length||0)]=-1),s=127,r=512;r>0;--r)n=o[s+34&127],i=o[s=s+1&127],n^=n<<13,i^=i<<17,n^=n>>>15,i^=i>>>12,o[s]=n^i;t.w=a,t.X=o,t.i=s}(e,t)}function a(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function o(t,e){null==t&&(t=+new Date);var i=new r(t),n=e&&e.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,n&&(n.X&&a(n,i),s.state=function(){return a(i,{})}),s}s&&s.exports?s.exports=o:i.amdD&&i.amdO?void 0===(n=function(){return o}.call(e,i,e,s))||(s.exports=n):this.xor4096=o}(0,t=i.nmd(t),i.amdD)},9067:function(t,e,i){var n;!function(t,s){function r(t){var e=this;e.next=function(){var t,i,n=e.x,s=e.i;return t=n[s],i=(t^=t>>>7)^t<<24,i^=(t=n[s+1&7])^t>>>10,i^=(t=n[s+3&7])^t>>>3,i^=(t=n[s+4&7])^t<<7,t=n[s+7&7],i^=(t^=t<<13)^t<<9,n[s]=i,e.i=s+1&7,i},function(t,e){var i,n=[];if(e===(0|e))n[0]=e;else for(e=""+e,i=0;i0;--i)t.next()}(e,t)}function a(t,e){return e.x=t.x.slice(),e.i=t.i,e}function o(t,e){null==t&&(t=+new Date);var i=new r(t),n=e&&e.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,n&&(n.x&&a(n,i),s.state=function(){return a(i,{})}),s}s&&s.exports?s.exports=o:i.amdD&&i.amdO?void 0===(n=function(){return o}.call(e,i,e,s))||(s.exports=n):this.xorshift7=o}(0,t=i.nmd(t),i.amdD)},3031:function(t,e,i){var n;!function(t,s){function r(t){var e=this,i="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,e.v=0,t===(0|t)?e.x=t:i+=t;for(var n=0;n>>4),e.next()}function a(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function o(t,e){var i=new r(t),n=e&&e.state,s=function(){return(i.next()>>>0)/4294967296};return s.double=function(){do{var t=((i.next()>>>11)+(i.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},s.int32=i.next,s.quick=s,n&&("object"==typeof n&&a(n,i),s.state=function(){return a(i,{})}),s}s&&s.exports?s.exports=o:i.amdD&&i.amdO?void 0===(n=function(){return o}.call(e,i,e,s))||(s.exports=n):this.xorwow=o}(0,t=i.nmd(t),i.amdD)},4801:function(t,e,i){var n;!function(s,r,a){var o,l=256,c=a.pow(l,6),d=a.pow(2,52),h=2*d,u=255;function p(t,e,i){var n=[],u=v(m((e=1==e?{entropy:!0}:e||{}).entropy?[t,b(r)]:null==t?function(){try{var t;return o&&(t=o.randomBytes)?t=t(l):(t=new Uint8Array(l),(s.crypto||s.msCrypto).getRandomValues(t)),b(t)}catch(t){var e=s.navigator,i=e&&e.plugins;return[+new Date,s,i,s.screen,b(r)]}}():t,3),n),p=new f(n),y=function(){for(var t=p.g(6),e=c,i=0;t=h;)t/=2,e/=2,i>>>=1;return(t+i)/e};return y.int32=function(){return 0|p.g(4)},y.quick=function(){return p.g(4)/4294967296},y.double=y,v(b(p.S),r),(e.pass||i||function(t,e,i,n){return n&&(n.S&&g(n,p),t.state=function(){return g(p,{})}),i?(a.random=t,e):t})(y,u,"global"in e?e.global:this==a,e.state)}function f(t){var e,i=t.length,n=this,s=0,r=n.i=n.j=0,a=n.S=[];for(i||(t=[i++]);s{}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.loaded=!0,r.exports}i.m=t,i.amdD=function(){throw new Error("define cannot be used indirect")},i.amdO={},i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.u=t=>t+".js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t+"../"})(),i.b=document.baseURI||self.location.href;var n={};i.d(n,{LT:()=>Ta});var s={};i.r(s),i.d(s,{run:()=>x});var r={};i.r(r),i.d(r,{run:()=>E});var a={};i.r(a),i.d(a,{run:()=>D});var o={};i.r(o),i.d(o,{run:()=>N});var l={};i.r(l),i.d(l,{run:()=>H});var c={};i.r(c),i.d(c,{run:()=>ct});var d={};i.r(d),i.d(d,{run:()=>ue});var h={};i.r(h),i.d(h,{run:()=>ve});var u={};i.r(u),i.d(u,{run:()=>_e,setupButtons:()=>we,toggle:()=>Ae});var p={};i.r(p),i.d(p,{run:()=>Ce});var f={};i.r(f),i.d(f,{run:()=>Oe});var g={};i.r(g),i.d(g,{halt:()=>Ve,run:()=>Ue});var m={};i.r(m),i.d(m,{run:()=>sa});var v={};i.r(v),i.d(v,{run:()=>la});var b={};i.r(b),i.d(b,{run:()=>ua,toggle:()=>pa});var y={};i.r(y),i.d(y,{launchPlayer:()=>va,run:()=>ma});var _=i(8097),w=i(4113),A=i(173);function x(){w.appInstance().on("item:load",(function(){for(var t=A.totalItems(),e=Array.from(document.getElementsByClassName("item-prev")),i=Array.from(document.getElementsByClassName("item-next")),n=e.concat(i),s=0;s=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,o=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){o=!0,r=t},f:function(){try{a||null==i.return||i.return()}finally{if(o)throw r}}}}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);iBefore moving on, attempt all questions and click the "Check Answer" button.

\n

Note: the "Check Answer" button may not appear on every question.

'}};function D(t){var e,i;t&&null!=t&&t.message&&(null!==(e=R.message)&&void 0!==e&&e.header.length&&(R.message.header=t.message.header),null!==(i=R.message)&&void 0!==i&&i.body.length&&(R.message.body=t.message.body)),w.appInstance().on("item:beforeunload",(function(t){!function(t){(function(){var t,e=!1,i=I(C.questions());try{for(i.s();!(t=i.n()).done;){var n=t.value.response_id;if(C.hasCheckAnswer(n)){e=!0;break}}}catch(t){i.e(t)}finally{i.f()}return e})()&&(function(){var t,e=I(C.questions());try{for(e.s();!(t=e.n()).done;){var i=t.value.response_id;if(C.hasCheckAnswer(i)&&(!C.questionResponse(i)||!C.questionResponse(i).hasOwnProperty("feedbackAttemptsCount")))return!1}}catch(t){e.e(t)}finally{e.f()}return!0}()||(k.A.debug("Disabling navigation.",P),t.preventDefault(),(0,M.dialog)({header:R.message.header,body:R.message.body,buttons:[{button_id:"lt__check_answer_validation",label:"Close",is_primary:!1}]}),w.assessApp().on("button:lt__check_answer_validation:clicked",(function(){(0,M.hideDialog)()}))))}(t)}))}var F=i(7518),O={renderedCss:!1,resize:{triggered:!1}};function N(){var t;O.renderedCss||((t=document.createElement("style")).textContent="\n/* Learnosity column resizer styles */\n.lrn-resizer {\n background-color: #e8e8e8;\n cursor: grab;\n width: 3px;\n padding: 0;\n position: relative;\n}\n.lrn-resizer span {\n position: relative;\n width: 45px;\n height: 30px;\n border: 1px solid #e4e4e4;\n left: -22px;\n border-radius: 3px;\n cursor: grab;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 1.5em;\n z-index: 2;\n padding-bottom: 3px;\n color: #444;\n\n -webkit-user-select: none;\n user-select: none;\n\n background: rgb(233,233,233);\n background: linear-gradient(0deg, rgba(233,233,233,1) 0%, rgba(250,250,250,1) 51%, rgba(238,238,238,1) 100%);\n}\n.row {\n display: flex;\n}\n.col-xs-6.lrn-column-left {\n display: flex;\n min-width: 5em;\n overflow: hidden;\n}\n.col-xs-6.lrn-column-right {\n display: flex;\n\n flex: 1;\n display: flex;\n flex-direction: column;\n min-width: 5em;\n overflow: hidden;\n}\n.lrn-column-left .lrn_widget,\n.lrn-column-right .lrn_widget {\n padding: 1.5em;\n}\n@media (max-width: 650px) {\n .lrn-resizer {\n display: none;\n }\n}\n",document.head.append(t),O.renderedCss=!0),w.appInstance().on("item:load",(function(){q()})),window.addEventListener("resize",function(t){var e,i=this;return O.resize.triggered||(O.resize.triggered=!0,t.apply(this)),function(){for(var n=arguments.length,s=new Array(n),r=0;r=10&&a<=90&&(e.style.width=a+"%")},a=function(){document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a),document.removeEventListener("touchmove",r),document.removeEventListener("touchend",a)};t.addEventListener("mousedown",s),t.addEventListener("touchstart",s)}(e)}(t)}}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,o=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){o=!0,r=t},f:function(){try{a||null==i.return||i.return()}finally{if(o)throw r}}}}((0,C.questionResponseIds)());try{var i=function(){var e=t.value;(0,C.hasCheckAnswer)(e)&&w.appInstance().question(e).on("validated",(function(t){(0,C.questionInstance)(e).disable()}))};for(e.s();!(t=e.n()).done;)i()}catch(t){e.e(t)}finally{e.f()}}()}))}const z=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map((t=>t.charCodeAt(0)))),j=new Uint16Array("Ȁaglq\tɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map((t=>t.charCodeAt(0))));var U;const V=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),G=null!==(U=String.fromCodePoint)&&void 0!==U?U:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|1023&t),e+=String.fromCharCode(t),e};var W,$,X,K,Y;function Q(t){return t>=W.ZERO&&t<=W.NINE}!function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"}(W||(W={})),function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"}($||($={})),function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"}(X||(X={})),(Y=K||(K={}))[Y.Legacy=0]="Legacy",Y[Y.Strict=1]="Strict",Y[Y.Attribute=2]="Attribute";class J{constructor(t,e,i){this.decodeTree=t,this.emitCodePoint=e,this.errors=i,this.state=X.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=K.Strict}startEntity(t){this.decodeMode=t,this.state=X.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,e){switch(this.state){case X.EntityStart:return t.charCodeAt(e)===W.NUM?(this.state=X.NumericStart,this.consumed+=1,this.stateNumericStart(t,e+1)):(this.state=X.NamedEntity,this.stateNamedEntity(t,e));case X.NumericStart:return this.stateNumericStart(t,e);case X.NumericDecimal:return this.stateNumericDecimal(t,e);case X.NumericHex:return this.stateNumericHex(t,e);case X.NamedEntity:return this.stateNamedEntity(t,e)}}stateNumericStart(t,e){return e>=t.length?-1:(32|t.charCodeAt(e))===W.LOWER_X?(this.state=X.NumericHex,this.consumed+=1,this.stateNumericHex(t,e+1)):(this.state=X.NumericDecimal,this.stateNumericDecimal(t,e))}addToNumericResult(t,e,i,n){if(e!==i){const s=i-e;this.result=this.result*Math.pow(n,s)+parseInt(t.substr(e,s),n),this.consumed+=s}}stateNumericHex(t,e){const i=e;for(;e=W.UPPER_A&&n<=W.UPPER_F||n>=W.LOWER_A&&n<=W.LOWER_F)))return this.addToNumericResult(t,i,e,16),this.emitNumericEntity(s,3);e+=1}var n;return this.addToNumericResult(t,i,e,16),-1}stateNumericDecimal(t,e){const i=e;for(;e=55296&&t<=57343||t>1114111?65533:null!==(e=V.get(t))&&void 0!==e?e:t}(this.result),this.consumed),this.errors&&(t!==W.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,e){const{decodeTree:i}=this;let n=i[this.treeIndex],s=(n&$.VALUE_LENGTH)>>14;for(;e=W.UPPER_A&&t<=W.UPPER_Z||t>=W.LOWER_A&&t<=W.LOWER_Z||Q(t)}(r)))?0:this.emitNotTerminatedNamedEntity();if(n=i[this.treeIndex],s=(n&$.VALUE_LENGTH)>>14,0!==s){if(a===W.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==K.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}var r;return-1}emitNotTerminatedNamedEntity(){var t;const{result:e,decodeTree:i}=this,n=(i[e]&$.VALUE_LENGTH)>>14;return this.emitNamedEntityData(e,n,this.consumed),null===(t=this.errors)||void 0===t||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,e,i){const{decodeTree:n}=this;return this.emitCodePoint(1===e?n[t]&~$.VALUE_LENGTH:n[t+1],i),3===e&&this.emitCodePoint(n[t+2],i),i}end(){var t;switch(this.state){case X.NamedEntity:return 0===this.result||this.decodeMode===K.Attribute&&this.result!==this.treeIndex?0:this.emitNotTerminatedNamedEntity();case X.NumericDecimal:return this.emitNumericEntity(0,2);case X.NumericHex:return this.emitNumericEntity(0,3);case X.NumericStart:return null===(t=this.errors)||void 0===t||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case X.EntityStart:return 0}}}function Z(t){let e="";const i=new J(t,(t=>e+=G(t)));return function(t,n){let s=0,r=0;for(;(r=t.indexOf("&",r))>=0;){e+=t.slice(s,r),i.startEntity(n);const a=i.write(t,r+1);if(a<0){s=r+i.end();break}s=r+a,r=0===a?s+1:s}const a=e+t.slice(s);return e="",a}}function tt(t,e,i,n){const s=(e&$.BRANCH_LENGTH)>>7,r=e&$.JUMP_TABLE;if(0===s)return 0!==r&&n===r?i:-1;if(r){const e=n-r;return e<0||e>=s?-1:t[i+e]-1}let a=i,o=a+s-1;for(;a<=o;){const e=a+o>>>1,i=t[e];if(in))return t[e+s];o=e-1}}return-1}const et=Z(z);function it(t){for(let e=1;et.length)&&(e=t.length);for(var i=0,n=Array(e);i'"]/g,nt),st(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),st(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]])),function(t){t[t.XML=0]="XML",t[t.HTML=1]="HTML"}(rt||(rt={})),function(t){t[t.UTF8=0]="UTF8",t[t.ASCII=1]="ASCII",t[t.Extensive=2]="Extensive",t[t.Attribute=3]="Attribute",t[t.Text=4]="Text"}(at||(at={}));var lt={includeSpaces:!1,renderedCss:!1,validTypes:["longtextV2","plaintext"]};function ct(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];lt.includeSpaces=Boolean(e),lt.renderedCss||((t=document.createElement("style")).textContent="\n/* Learnosity essay limit by character styles */\n.lrn_widget .lrn_word_count,\n.lrn_widget .lrn_character_count {\n margin-right: 0px;\n}\n",document.head.append(t),lt.renderedCss=!0),function(){for(var t=w.appInstance().getQuestions(),e=function(){var t,e,s=(t=n[i],e=2,function(t){if(Array.isArray(t))return t}(t)||function(t,e){var i=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=i){var n,s,r,a,o=[],l=!0,c=!1;try{if(r=(i=i.call(t)).next,0===e){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=r.call(i)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){c=!0,s=t}finally{try{if(!l&&null!=i.return&&(a=i.return(),Object(a)!==a))return}finally{if(c)throw s}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ot(t,e);var i={}.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?ot(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),r=(s[0],s[1]);if(lt.validTypes.indexOf(r.type)>=0){var a=w.appInstance().question(r.response_id);w.appInstance().question(r.response_id).on("rendered",(function(){!function(t){var e;if(!(null===(e=A.activity())||void 0===e||null===(e=e.config)||void 0===e||null===(e=e.questions_api_init_options)||void 0===e||null===(e=e.labelBundle)||void 0===e?void 0:e.wordLength)){var i=t.getQuestion().response_id,n=document.getElementById(i).querySelector(".lrn_word_limit"),s=n.textContent.replace("Word","Character");n.textContent=s}}(a),A.isResuming()&&dt(a)})),a.on("changed",(function(){dt(a)}))}},i=0,n=Object.entries(t);i1&&void 0!==arguments[1])||arguments[1],r=t.getQuestion().type,a=t.getQuestion().max_length,o=null!==(e=t.getResponse())&&void 0!==e&&e.value?null===(i=t.getResponse())||void 0===i?void 0:i.value:"",l=!0;return n="plaintext"===r?(lt.includeSpaces?o:pt(o)).length:function(t,e=K.Legacy){return et(t,e)}(lt.includeSpaces?ut(o):pt(ut(o))).length,a&&n>a&&(l=!1),s&&function(t,e,i){var n=t.getQuestion().response_id,s=document.getElementById(n),r=s.querySelector(".lrn_texteditor_editable"),a=s.querySelector(".lrn_word_count"),o=s.querySelector(".lrn_length_indicator"),l="lrn_wordcount_warning_label",c="lrn_wordcount_warning",d=i;function h(){a.textContent=d,e?(r.classList.remove(c),o.classList.remove(l)):(r.classList.add(c),o.classList.add(l))}"plaintext"===t.getQuestion().type?(d=i+" /",setTimeout((function(){h()}),10)):h()}(t,l,n),l}function ht(t){var e=w.appInstance().getQuestions(),i=[];for(var n in e){var s;lt.validTypes.includes(e[n].type)&&(null!==(s=e[n])&&void 0!==s&&s.submit_over_limit||dt(C.questionInstance(n),!1)||i.push(n))}if(i.length){k.A.warn("Invalid essay response length found."),t.preventDefault(),t.stopPropagation();for(var r=[],a=0;a\n
    \n "),o=0;o').concat(r.question,"");a+="
",w.assessApp().on("button:btn_essay_character_limit_cancel:clicked",(function(){M.hideDialog()})),w.appInstance().on("test:panel:show",(function(){setTimeout((function(){var t=document.querySelectorAll(".essay-limit-character-item");t&&t.forEach((function(t){var e=t.getAttribute("data-item-reference");t.addEventListener("click",(function(){w.appInstance().items().goto(e),M.hideDialog()}))}))}),500)})),M.dialog({header:r.submitTest,body:a,buttons:[{button_id:"btn_essay_character_limit_cancel",label:r.decline,is_primary:!0}]})}(r)}else!function(){var t=document.getElementById("lrn_assess_next_btn");if(t)t.click();else{var e={show_submit_confirmation:!0,show_submit_ui:!0,success:function(t){k.A.info("Submit was successful",t)},error:function(t){k.A.error("Submit has failed",t)}};w.appInstance().submit(e)}}()}function ut(t){return t.replace(/<[^>]*>/g,"").trim()}function pt(t){return t.replace(/\s+/g,"")}var ft=i(7391),gt=i.n(ft);var mt=Math.floor,vt=Math.random;const bt=function(t,e){var i,n,s=-1,r=t.length,a=r-1;for(e=void 0===e?r:e;++s-1&&t%1==0&&t-1&&t%1==0&&t<=9007199254740991};var Wt={};Wt["[object Float32Array]"]=Wt["[object Float64Array]"]=Wt["[object Int8Array]"]=Wt["[object Int16Array]"]=Wt["[object Int32Array]"]=Wt["[object Uint8Array]"]=Wt["[object Uint8ClampedArray]"]=Wt["[object Uint16Array]"]=Wt["[object Uint32Array]"]=!0,Wt["[object Arguments]"]=Wt["[object Array]"]=Wt["[object ArrayBuffer]"]=Wt["[object Boolean]"]=Wt["[object DataView]"]=Wt["[object Date]"]=Wt["[object Error]"]=Wt["[object Function]"]=Wt["[object Map]"]=Wt["[object Number]"]=Wt["[object Object]"]=Wt["[object RegExp]"]=Wt["[object Set]"]=Wt["[object String]"]=Wt["[object WeakMap]"]=!1;var $t="object"==typeof exports&&exports&&!exports.nodeType&&exports,Xt=$t&&"object"==typeof module&&module&&!module.nodeType&&module,Kt=Xt&&Xt.exports===$t&&wt.process,Yt=function(){try{return Xt&&Xt.require&&Xt.require("util").types||Kt&&Kt.binding&&Kt.binding("util")}catch(t){}}(),Qt=Yt&&Yt.isTypedArray;const Jt=Qt?(Zt=Qt,function(t){return Zt(t)}):function(t){return Pt(t)&&Gt(t.length)&&!!Wt[Lt(t)]};var Zt,te=Object.prototype.hasOwnProperty;const ee=function(t,e){var i=qt(t),n=!i&&Nt(t),s=!i&&!n&&jt(t),r=!i&&!n&&!s&&Jt(t),a=i||n||s||r,o=a?function(t,e){for(var i=-1,n=Array(t);++i=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:s}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r,a=!0,o=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return a=t.done,t},e:function(t){o=!0,r=t},f:function(){try{a||null==i.return||i.return()}finally{if(o)throw r}}}}function he(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i1}(t,e))if(function(t){return"validation"in t&&t.validation}(t))if(p=t.validation,Boolean(p.valid_response.value&&p.valid_response.value.length)){var n=[],s=function(t){return t.valid_response.value}(t.validation);Object.values(s).forEach((function(e){Object.values(t.options).forEach((function(t){e!==t.value&&n.push(t.value)}))}));for(var r=[],a=0;a0&&void 0!==arguments[0]?arguments[0]:{global:[{bindings:{chromeos:["ctrl+shift+v"],macos:["command+shift+v"],windows:["ctrl+shift+v"]},type:"item.flag"},{bindings:{chromeos:["ctrl+alt+0"],macos:["command+option+0"],windows:["ctrl+alt+0"]},type:"masking.enable"}],item:[{bindings:{chromeos:["ctrl+shift+1","ctrl+shift+2","ctrl+shift+3","ctrl+shift+4","ctrl+shift+5","ctrl+shift+6"],macos:["command+ctrl+1","command+ctrl+2","command+ctrl+3","command+ctrl+4","command+ctrl+5","command+ctrl+6"],windows:["ctrl+shift+1","ctrl+shift+2","ctrl+shift+3","ctrl+shift+4","ctrl+shift+5","ctrl+shift+6"]},restrictTo:["mcq"],type:"response.set"},{bindings:{chromeos:["ctrl+alt+1","ctrl+alt+2","ctrl+alt+3","ctrl+alt+4","ctrl+alt+5","ctrl+alt+6"],macos:["command+option+1","command+option+2","command+option+3","command+option+4","command+option+5","command+option+6"],windows:["ctrl+alt+1","ctrl+alt+2","ctrl+alt+3","ctrl+alt+4","ctrl+alt+5","ctrl+alt+6"]},type:"response.mask"}]},e=function(){var t;return me.supportedPlatforms.forEach((function(e){fe[e]&&(t=e)})),t}();me.bindings=t,e&&(ge.prototype.stopCallback=function(t,e,i){var n=document.activeElement;return"radio"!==n.getAttribute("type")&&"checkbox"!==n.getAttribute("type")&&!((" "+e.className+" ").indexOf(" mousetrap ")>-1)&&("INPUT"==e.tagName||"SELECT"==e.tagName||"TEXTAREA"==e.tagName||e.contentEditable&&"true"==e.contentEditable)},me.bindings.hasOwnProperty("global")&&Array.isArray(me.bindings.global)&&me.bindings.global.forEach((function(t){if(t.hasOwnProperty("type"))switch(t.type){case"item.flag":i=t.bindings[e],ge.bind(i,(function(t,e){F.flag()}));break;case"masking.enable":!function(t){C.questionInstance().isMaskable()&&ge.bind(t,(function(t){w.appInstance().questionsApp().masking(!F.isMaskingEnabled())}))}(t.bindings[e])}var i})),me.bindings.hasOwnProperty("item")&&Array.isArray(me.bindings.item)&&w.appInstance().on("item:load",(function(){me.bindings.item.forEach((function(t){if(t.hasOwnProperty("type"))switch(t.type){case"response.mask":i=t.bindings[e],n=C.questions(),s=0,n.forEach((function(t){"mcq"===t.type&&s++})),1===s&&Object.values(n).forEach((function(t){"mcq"===t.type&&ge.bind(i,(function(e,i){if(F.isMaskingEnabled()){var n,s=Number(i.at(-1));if((null===(n=t.options)||void 0===n?void 0:n.length)>=s){var r=F.itemElement().querySelectorAll(".lrn-mcq-option")[s-1].querySelector(".lrn-mask");r&&r.click()}}}))}));break;case"response.set":!function(t){var e=C.questions(),i=0;e.forEach((function(t){"mcq"===t.type&&i++})),1===i&&Object.values(e).forEach((function(e){"mcq"===e.type&&ge.bind(t,(function(t){var i;(null===(i=e.options)||void 0===i?void 0:i.length)>=t.key&&document.getElementById("".concat(e.response_id)).querySelectorAll(".lrn-input")[t.key-1].click()}))}))}(t.bindings[e])}var i,n,s}))})))}var be="ERROR",ye={_initialised:!1,magnifier:null};function _e(t){ye._initialised?k.A.debug("Magnifier already initialised, ignoring run();",be):(t||(t={zoom:4,shape:"square",width:350,height:350}),ye.magnifier=new xe(t),ye._initialised=!0)}function we(){var t,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lrn__magnifier";document.querySelectorAll(".".concat(e)).forEach((function(t){t.addEventListener("click",(function(){ye.magnifier.toggle()}))})),w.appInstance().on("item:load",void((t=F.itemElement().querySelectorAll("img"))&&t.forEach((function(t){t.addEventListener("click",(function(t){ye.magnifier.isVisible()||ye.magnifier.show(t)}))}))))}function Ae(){ye.magnifier.toggle()}function xe(t){var e=this;e.options=Object.assign({zoom:2,shape:"square",width:200,height:200},t),window.MutationObserver||window.WebKitMutationObserver;var i,n,s,r,a,o,l=!1,c={};function d(t,e,i){t.style.left="".concat(e,"px"),t.style.top="".concat(i,"px")}function h(t,e,i){t.style.width="".concat(e,"px"),t.style.height="".concat(i,"px")}function u(){switch(e.options.shape){case"square":h(i,e.options.width,e.options.height);break;case"circle":h(i,e.options.width,e.options.height),i.style.borderRadius="50%"}n.style.WebkitTransform=n.style.MozTransform=n.style.OTransform=n.style.MsTransform=n.style.transform="scale(".concat(e.options.zoom,")")}function p(t,e){for(var i=e;null!=i;){if(i==t)return!0;i=i.parentNode}return!1}function f(){l&&(_(),b(),A())}function g(){l&&(window.clearTimeout(r),r=window.setTimeout(f,100))}function m(){l&&g()}function v(t,i){var n=c[t];if(n)for(var s=0;s0)for(var n=0;n0&&r.length===o.length)for(var l=0;l0&&e.push(n[s]);for(var r=0;r