1import{F as Ii,p as Js,_ as fe,E as Ur,a as zo,U as Fs,b as No}from"./vendor-pdflib-BC_rCeQu.js";import{c as Ri}from"./vendor-react-C_xdI0Ng.js";const In="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gr=new Uint8Array(256);for(let n=0;n<In.length;n++)gr[In.charCodeAt(n)]=n;const Lo=n=>{let e="";const t=n.length;for(let r=0;r<t;r+=3)e+=In[n[r]>>2],e+=In[(n[r]&3)<<4|n[r+1]>>4],e+=In[(n[r+1]&15)<<2|n[r+2]>>6],e+=In[n[r+2]&63];return t%3===2?e=e.substring(0,e.length-1)+"=":t%3===1&&(e=e.substring(0,e.length-2)+"=="),e},ks=n=>{let e=n.length*.75;const t=n.length;let r,i=0,s,o,c,a;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const d=new Uint8Array(e);for(r=0;r<t;r+=4)s=gr[n.charCodeAt(r)],o=gr[n.charCodeAt(r+1)],c=gr[n.charCodeAt(r+2)],a=gr[n.charCodeAt(r+3)],d[i++]=s<<2|o>>4,d[i++]=(o&15)<<4|c>>2,d[i++]=(c&3)<<6|a&63;return d},Uo=/^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i,Ho=n=>{const e=n.trim(),r=e.substring(0,100).match(Uo);if(!r)return ks(e);const[i]=r,s=e.substring(i.length);return ks(s)},le=n=>n.charCodeAt(0),Ko=n=>n.codePointAt(0),Pr=(n,e)=>Tt(n.toString(16),e,"0").toUpperCase(),Tr=n=>Pr(n,2),Nt=n=>String.fromCharCode(n),$o=n=>Nt(parseInt(n,16)),Tt=(n,e,t)=>{let r="";for(let i=0,s=e-n.length;i<s;i++)r+=t;return r+n},Je=(n,e,t)=>{const r=n.length;for(let i=0;i<r;i++)e[t++]=n.charCodeAt(i);return r},mn=(n,e=4)=>`${n}-${Math.floor(Math.random()*Math.pow(10,e))}`,Vo=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_r=n=>n.replace(/\t|\u0085|\u2028|\u2029/g," ").replace(/[\b\v]/g,""),Go=["\\n","\\f","\\r","\\u000B"],B0=[` 2`,"\f","\r","\v"],Qs=n=>/^[\n\f\r\u000B]$/.test(n),eo=n=>n.split(/[\n\f\r\u000B]/),to=n=>n.replace(/[\n\f\r\u000B]/g," "),no=(n,e)=>{const t=n.charCodeAt(e);let r;const i=e+1;let s=1;return t>=55296&&t<=56319&&n.length>i&&(r=n.charCodeAt(i),r>=56320&&r<=57343&&(s=2)),[n.slice(e,e+s),s]},Xo=n=>{const e=[];for(let t=0,r=n.length;t<r;){const[i,s]=no(n,t);e.push(i),t+=s}return e},qo=n=>{const e=Go.join("|"),t=["$"];for(let i=0,s=n.length;i<s;i++){const o=n[i];if(Qs(o))throw new TypeError(`\`wordBreak\` must not include ${e}`);t.push(o===""?".":Vo(o))}const r=t.join("|");return new RegExp(`(${e})|((.*?)(${r}))`,"gm")},Zo=(n,e,t,r)=>{const i=qo(e),s=_r(n).match(i);let o="",c=0;const a=[],d=()=>{o!==""&&a.push(o),o="",c=0};for(let p=0,C=s.length;p<C;p++){const v=s[p];if(Qs(v))d();else{const T=r(v);c+T>t&&d(),o+=v,c+=T}}return d(),a},Yo=/^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/,ro=n=>{const e=n.match(Yo);if(!e)return;const[,t,r="01",i="01",s="00",o="00",c="00",a="Z",d="00",p="00"]=e,C=a==="Z"?"Z":`${a}${d}:${p}`;return new Date(`${t}-${r}-${i}T${s}:${o}:${c}${C}`)},Yi=(n,e)=>{var t;let r=0,i;for(;r<n.length;){const s=n.substring(r).match(e);if(!s)return{match:i,pos:r};i=s,r+=((t=s.index)!==null&&t!==void 0?t:0)+s[0].length}return{match:i,pos:r}},Qr=n=>n[n.length-1],ji=n=>{if(n instanceof Uint8Array)return n;const e=n.length,t=new Uint8Array(e);for(let r=0;r<e;r++)t[r]=n.charCodeAt(r);return t},Jo=(...n)=>{const e=n.length,t=[];for(let o=0;o<e;o++){const c=n[o];t[o]=c instanceof Uint8Array?c:ji(c)}let r=0;for(let o=0;o<e;o++)r+=n[o].length;const i=new Uint8Array(r);let s=0;for(let o=0;o<e;o++){const c=t[o];for(let a=0,d=c.length;a<d;a++)i[s++]=c[a]}return i},Qo=n=>{let e=0;for(let i=0,s=n.length;i<s;i++)e+=n[i].length;const t=new Uint8Array(e);let r=0;for(let i=0,s=n.length;i<s;i++){const o=n[i];t.set(o,r),r+=o.length}return t},io=n=>{let e="";for(let t=0,r=n.length;t<r;t++)e+=Nt(n[t]);return e},ec=(n,e)=>n.id-e.id,tc=(n,e)=>{const t=[];for(let r=0,i=n.length;r<i;r++){const s=n[r],o=n[r-1];(r===0||e(s)!==e(o))&&t.push(s)}return t},_n=n=>{const e=n.length;for(let t=0,r=Math.floor(e/2);t<r;t++){const i=t,s=e-t-1,o=n[t];n[i]=n[s],n[s]=o}return n},nc=n=>{let e=0;for(let t=0,r=n.length;t<r;t++)e+=n[t];return e},rc=(n,e)=>{const t=new Array(e-n);for(let r=0,i=t.length;r<i;r++)t[r]=n+r;return t},ic=(n,e)=>{const t=new Array(e.length);for(let r=0,i=e.length;r<i;r++)t[r]=n[e[r]];return t},sc=n=>n instanceof Uint8Array||n instanceof ArrayBuffer||typeof n=="string",lr=n=>{if(typeof n=="string")return Ho(n);if(n instanceof ArrayBuffer)return new Uint8Array(n);if(n instanceof Uint8Array)return n;throw new TypeError("`input` must be one of `string | ArrayBuffer | Uint8Array`")},so=[];for(let n=0;n<=255;++n){const e=n.toString(16).padStart(2,"0");so.push(e)}const oc=n=>{const e=new Uint8Array(n),t=new Array(e.length);for(let r=0;r<e.length;++r)t[r]=so[e[r]];return t.join("")},Un=()=>new Promise(n=>{setTimeout(()=>n(),0)}),D0=(n,e=!0)=>{const t=[];e&&t.push(239,187,191);for(let r=0,i=n.length;r<i;){const s=n.codePointAt(r);if(s<128){const o=s&127;t.push(o),r+=1}else if(s<2048){const o=s>>6&31|192,c=s&63|128;t.push(o,c),r+=1}else if(s<65536){const o=s>>12&15|224,c=s>>6&63|128,a=s&63|128;t.push(o,c,a),r+=1}else if(s<1114112){const o=s>>18&7|240,c=s>>12&63|128,a=s>>6&63|128,d=s>>0&63|128;t.push(o,c,a,d),r+=2}else throw new Error(`Invalid code point: 0x${Tr(s)}`)}return new Uint8Array(t)},cc=(n,e=!0)=>{const t=[];e&&t.push(65279);for(let r=0,i=n.length;r<i;){const s=n.codePointAt(r);if(s<65536)t.push(s),r+=1;else if(s<1114112)t.push(oo(s),co(s)),r+=2;else throw new Error(`Invalid code point: 0x${Tr(s)}`)}return new Uint16Array(t)},ac=n=>n>=0&&n<=65535,lc=n=>n>=65536&&n<=1114111,oo=n=>Math.floor((n-65536)/1024)+55296,co=n=>(n-65536)%1024+56320;var Zt;(function(n){n.BigEndian="BigEndian",n.LittleEndian="LittleEndian"})(Zt||(Zt={}));const dr="�".codePointAt(0),ao=(n,e=!0)=>
2{if(n.length<=1)return String.fromCodePoint(dr);const t=e?hc(n):Zt.BigEndian;let r=e?2:0;const i=[];for(;n.length-r>=2;){const s=Ds(n[r++],n[r++],t);if(dc(s))if(n.length-r<2)i.push(dr);else{const o=Ds(n[r++],n[r++],t);Bs(o)?i.push(s,o):i.push(dr)}else Bs(s)?(r+=2,i.push(dr)):i.push(s)}return r<n.length&&i.push(dr),String.fromCodePoint(...i)},dc=n=>n>=55296&&n<=56319,Bs=n=>n>=56320&&n<=57343,Ds=(n,e,t)=>{if(t===Zt.LittleEndian)return e<<8|n;if(t===Zt.BigEndian)return n<<8|e;throw new Error(`Invalid byteOrder: ${t}`)},hc=n=>lo(n)?Zt.BigEndian:ho(n)?Zt.LittleEndian:Zt.BigEndian,lo=n=>n[0]===254&&n[1]===255,ho=n=>n[0]===255&&n[1]===254,uo=n=>lo(n)||ho(n),uc=n=>{let e=String(n);if(Math.abs(n)<1){const t=parseInt(n.toString().split("e-")[1]);if(t){const r=n<0;r&&(n*=-1),n*=Math.pow(10,t-1),e="0."+new Array(t).join("0")+n.toString().substring(2),r&&(e="-"+e)}}else{let t=parseInt(n.toString().split("+")[1]);t>20&&(t-=20,n/=Math.pow(10,t),e=n.toString()+new Array(t+1).join("0"))}return e},Zr=n=>Math.ceil(n.toString(2).length/8),On=n=>{const e=new Uint8Array(Zr(n));for(let t=1;t<=e.length;t++)e[t-1]=n>>(e.length-t)*8;return e},Or=n=>{throw new Error(n)},xi=n=>Object.keys(n).map(e=>n[e]),fc=xi(Ii),Ps=n=>fc.includes(n),Hr=(n,e)=>n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height;var Yr={exports:{}},gc=Yr.exports,Ts;function xc(){return Ts||(Ts=1,(function(n,e){(function(t,r){n.exports=r()})(gc,function(){var t,r,i,s,o,c,a,d,p,C,v,T,j,N,K,G,te,X,q,Be,Ee,Oe,Me,Re,We,at,Se,ze,ht,Te,Ie,lt,pe,xe,oe,ae,Ft,_t,ye,de=de||(function(h){var g;typeof window<"u"&&window.crypto&&(g=window.crypto),typeof self<"u"&&self.crypto&&(g=self.crypto),(g=(g=typeof globalThis<"u"&&globalThis.crypto?globalThis.crypto:g)||(typeof window<"u"&&window.msCrypto?window.msCrypto:g))||typeof Ri<"u"&&Ri.crypto&&Ri.crypto;var x=Object.create||function(b){return w.prototype=b,b=new w,w.prototype=null,b};function w(){}var D={},u=D.lib={},k=u.Base={extend:function(b){var y=x(this);return b&&y.mixIn(b),y.hasOwnProperty("init")&&this.init!==y.init||(y.init=function(){y.$super.init.apply(this,arguments)}),(y.init.prototype=y).$super=this,y},create:function(){var b=this.extend();return b.init.apply(b,arguments),b},init:function(){},mixIn:function(b){for(var y in b)b.hasOwnProperty(y)&&(this[y]=b[y]);b.hasOwnProperty("toString")&&(this.toString=b.toString)},clone:function(){return this.init.prototype.extend(this)}},O=u.WordArray=k.extend({init:function(b,y){b=this.words=b||[],this.sigBytes=y??4*b.length},toString:function(b){return(b||W).stringify(this)},concat:function(b){var y=this.words,m=b.words,P=this.sigBytes,B=b.sigBytes;if(this.clamp(),P%4)for(var R=0;R<B;R++){var V=m[R>>>2]>>>24-R%4*8&255;y[P+R>>>2]|=V<<24-(P+R)%4*8}else for(var $=0;$<B;$+=4)y[P+$>>>2]=m[$>>>2];return this.sigBytes+=B,this},clamp:function(){var b=this.words,y=this.sigBytes;b[y>>>2]&=4294967295<<32-y%4*8,b.length=h.ceil(y/4)},clone:function(){var b=k.clone.call(this);return b.words=this.words.slice(0),b},random:function(b){for(var y=[],m=0;m<b;m+=4)y.push((function(){if(g){if(typeof g.getRandomValues=="function")try{return g.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof g.randomBytes=="function")try{return g.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")})());return new O.init(y,b)}}),_=D.enc={},W=_.Hex={stringify:function(b){for(var y=b.words,m=b.sigBytes,P=[],B=0;B<m;B++){var R=y[B>>>2]>>>24-B%4*8&255;P.push((R>>>4).toString(16)),P.push((15&R).toString(16))}return P.join("")},parse:function(b){for(var y=b.length,m=[],P=0;P<y;P+=2)m[P>>>3]|=parseInt(b.substr(P,2),16)<<24-P%8*4;return new O.init(m,y/2)}},F=_.Latin1={stringify:function(b){for(var y=b.words,m=b.sigBytes,P=[],B=0;B<m;B++){var R=y[B>>>2]>>>24-B%4*8&255;P.push(String.fromCharCode(R))}return P.join("")},parse:function(b){for(var y=b.length,m=[],P=0;P<y;P++)m[P>>>2]|=(255&b.charCodeAt(P))<<24-P%4*8;return new O.init(m,y)}},S=_.Utf8={stringify:function(b){try{return decodeURIComponent(escape(F.stringify(b)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(b){return F.parse(unescape(encodeURIComponent(b)))}},M=u.BufferedBlockAlgorithm=k.extend({reset:function(){this._data=new O.init,this._nDataBytes=0},_append:function(b){typeof b=="string"&&(b=S.parse(b)),this._data.concat(b),this._nDataBytes+=b.sigBytes},_process:function(b){var y,m=this._data,P=m.words,$=m.sigBytes,B=this.blockSize,R=$/(4*B),V=(R=b?h.ceil(R):h.max((0|R)-this._minBufferSize,0))*B,$=h.min(4*V,$);if(V){for(var Y=0;Y<V;Y+=B)this._doProcessBlock(P,Y);y=P.splice(0,V),m.sigBytes-=$}return new O.init(y,$)},clone:function(){var b=k.clone.call(this);return b._data=this._data.clone(),b},_minBufferSize:0}),E=(u.Hasher=M.extend({cfg:k.extend(),init:function(b){this.cfg=this.cfg.extend(b),this.reset()},reset:function(){M.reset.call(this),this._doReset()},update:function(b){return this._append(b),this._process(),this},finalize:function(b){return b&&this._append(b),this._doFinalize()},blockSize:16,_createHelper:function(b){return function(y,m){return new b.init(m).finalize(y)}},_createHmacHelper:function(b){return function(y,m){return new E.HMAC.init(b,m).finalize(y)}}}),D.algo={});return D})(Math);function vs(h,g,x){return h&g|~h&x}function Ss(h,g,x){return h&x|g&~x}function zr(h,g){return h<<g|h>>>32-g}function As(h,g,x,w){var D,u=this._iv;u?(D=u.slice(0),this._iv=void 0):D=this._prevBlock,w.encryptBlock(D,0);for(var k=0;k<x;k++)h[g+k]^=D[k]}function Cs(h){var g,x,w;
2return(h>>24&255)==255?(x=h>>8&255,w=255&h,(g=h>>16&255)===255?(g=0,x===255?(x=0,w===255?w=0:++w):++x):++g,h=0,h+=g<<16,h+=x<<8,h+=w):h+=1<<24,h}function Pi(){for(var h=this._X,g=this._C,x=0;x<8;x++)lt[x]=g[x];for(g[0]=g[0]+1295307597+this._b|0,g[1]=g[1]+3545052371+(g[0]>>>0<lt[0]>>>0?1:0)|0,g[2]=g[2]+886263092+(g[1]>>>0<lt[1]>>>0?1:0)|0,g[3]=g[3]+1295307597+(g[2]>>>0<lt[2]>>>0?1:0)|0,g[4]=g[4]+3545052371+(g[3]>>>0<lt[3]>>>0?1:0)|0,g[5]=g[5]+886263092+(g[4]>>>0<lt[4]>>>0?1:0)|0,g[6]=g[6]+1295307597+(g[5]>>>0<lt[5]>>>0?1:0)|0,g[7]=g[7]+3545052371+(g[6]>>>0<lt[6]>>>0?1:0)|0,this._b=g[7]>>>0<lt[7]>>>0?1:0,x=0;x<8;x++){var w=h[x]+g[x],D=65535&w,u=w>>>16;pe[x]=((D*D>>>17)+D*u>>>15)+u*u^((4294901760&w)*w|0)+((65535&w)*w|0)}h[0]=pe[0]+(pe[7]<<16|pe[7]>>>16)+(pe[6]<<16|pe[6]>>>16)|0,h[1]=pe[1]+(pe[0]<<8|pe[0]>>>24)+pe[7]|0,h[2]=pe[2]+(pe[1]<<16|pe[1]>>>16)+(pe[0]<<16|pe[0]>>>16)|0,h[3]=pe[3]+(pe[2]<<8|pe[2]>>>24)+pe[1]|0,h[4]=pe[4]+(pe[3]<<16|pe[3]>>>16)+(pe[2]<<16|pe[2]>>>16)|0,h[5]=pe[5]+(pe[4]<<8|pe[4]>>>24)+pe[3]|0,h[6]=pe[6]+(pe[5]<<16|pe[5]>>>16)+(pe[4]<<16|pe[4]>>>16)|0,h[7]=pe[7]+(pe[6]<<8|pe[6]>>>24)+pe[5]|0}function Ti(){for(var h=this._X,g=this._C,x=0;x<8;x++)_t[x]=g[x];for(g[0]=g[0]+1295307597+this._b|0,g[1]=g[1]+3545052371+(g[0]>>>0<_t[0]>>>0?1:0)|0,g[2]=g[2]+886263092+(g[1]>>>0<_t[1]>>>0?1:0)|0,g[3]=g[3]+1295307597+(g[2]>>>0<_t[2]>>>0?1:0)|0,g[4]=g[4]+3545052371+(g[3]>>>0<_t[3]>>>0?1:0)|0,g[5]=g[5]+886263092+(g[4]>>>0<_t[4]>>>0?1:0)|0,g[6]=g[6]+1295307597+(g[5]>>>0<_t[5]>>>0?1:0)|0,g[7]=g[7]+3545052371+(g[6]>>>0<_t[6]>>>0?1:0)|0,this._b=g[7]>>>0<_t[7]>>>0?1:0,x=0;x<8;x++){var w=h[x]+g[x],D=65535&w,u=w>>>16;ye[x]=((D*D>>>17)+D*u>>>15)+u*u^((4294901760&w)*w|0)+((65535&w)*w|0)}h[0]=ye[0]+(ye[7]<<16|ye[7]>>>16)+(ye[6]<<16|ye[6]>>>16)|0,h[1]=ye[1]+(ye[0]<<8|ye[0]>>>24)+ye[7]|0,h[2]=ye[2]+(ye[1]<<16|ye[1]>>>16)+(ye[0]<<16|ye[0]>>>16)|0,h[3]=ye[3]+(ye[2]<<8|ye[2]>>>24)+ye[1]|0,h[4]=ye[4]+(ye[3]<<16|ye[3]>>>16)+(ye[2]<<16|ye[2]>>>16)|0,h[5]=ye[5]+(ye[4]<<8|ye[4]>>>24)+ye[3]|0,h[6]=ye[6]+(ye[5]<<16|ye[5]>>>16)+(ye[4]<<16|ye[4]>>>16)|0,h[7]=ye[7]+(ye[6]<<8|ye[6]>>>24)+ye[5]|0}return oe=(xe=de).lib,t=oe.Base,r=oe.WordArray,(xe=xe.x64={}).Word=t.extend({init:function(h,g){this.high=h,this.low=g}}),xe.WordArray=t.extend({init:function(h,g){h=this.words=h||[],this.sigBytes=g??8*h.length},toX32:function(){for(var h=this.words,g=h.length,x=[],w=0;w<g;w++){var D=h[w];x.push(D.high),x.push(D.low)}return r.create(x,this.sigBytes)},clone:function(){for(var h=t.clone.call(this),g=h.words=this.words.slice(0),x=g.length,w=0;w<x;w++)g[w]=g[w].clone();return h}}),typeof ArrayBuffer=="function"&&(ae=de.lib.WordArray,i=ae.init,(ae.init=function(h){if((h=(h=h instanceof ArrayBuffer?new Uint8Array(h):h)instanceof Int8Array||typeof Uint8ClampedArray<"u"&&h instanceof Uint8ClampedArray||h instanceof Int16Array||h instanceof Uint16Array||h instanceof Int32Array||h instanceof Uint32Array||h instanceof Float32Array||h instanceof Float64Array?new Uint8Array(h.buffer,h.byteOffset,h.byteLength):h)instanceof Uint8Array){for(var g=h.byteLength,x=[],w=0;w<g;w++)x[w>>>2]|=h[w]<<24-w%4*8;i.call(this,x,g)}else i.apply(this,arguments)}).prototype=ae),(function(){var g=de,h=g.lib.WordArray,g=g.enc;g.Utf16=g.Utf16BE={stringify:function(w){for(var D=w.words,u=w.sigBytes,k=[],O=0;O<u;O+=2){var _=D[O>>>2]>>>16-O%4*8&65535;k.push(String.fromCharCode(_))}return k.join("")},parse:function(w){for(var D=w.length,u=[],k=0;k<D;k++)u[k>>>1]|=w.charCodeAt(k)<<16-k%2*16;return h.create(u,2*D)}};function x(w){return w<<8&4278255360|w>>>8&16711935}g.Utf16LE={stringify:function(w){for(var D=w.words,u=w.sigBytes,k=[],O=0;O<u;O+=2){var _=x(D[O>>>2]>>>16-O%4*8&65535);k.push(String.fromCharCode(_))}return k.join("")},parse:function(w){for(var D=w.length,u=[],k=0;k<D;k++)u[k>>>1]|=x(w.charCodeAt(k)<<16-k%2*16);return h.create(u,2*D)}}})(),s=(Se=de).lib.WordArray,Se.enc.Base64={stringify:function(h){var g=h.words,x=h.sigBytes,w=this._map;h.clamp();for(var D=[],u=0;u<x;u+=3)for(var k=(g[u>>>2]>>>24-u%4*8&255)<<16|(g[u+1>>>2]>>>24-(u+1)%4*8&255)<<8|g[u+2>>>2]>>>24-(u+2)%4*8&255,O=0;O<4&&u+.75*O<x;O++)D.push(w.charAt(k>>>6*(3-O)&63));var _=w.charAt(64);if(_)for(;D.length%4;)D.push(_);return D.join("")},parse:function(h){var g=h.length,x=this._map;if(!(w=this._reverseMap))for(var w=this._reverseMap=[],D=0;D<x.length;D++)w[x.charCodeAt(D)]=D;var u=x.charAt(64);return!u||(u=h.indexOf(u))!==-1&&(g=u),(function(k,O,_){for(var W=[],F=0,S=0;S<O;S++){var M,E;
2S%4&&(M=_[k.charCodeAt(S-1)]<<S%4*2,E=_[k.charCodeAt(S)]>>>6-S%4*2,E=M|E,W[F>>>2]|=E<<24-F%4*8,F++)}return s.create(W,F)})(h,g,w)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},o=(oe=de).lib.WordArray,oe.enc.Base64url={stringify:function(h,g=!0){var x=h.words,w=h.sigBytes,D=g?this._safe_map:this._map;h.clamp();for(var u=[],k=0;k<w;k+=3)for(var O=(x[k>>>2]>>>24-k%4*8&255)<<16|(x[k+1>>>2]>>>24-(k+1)%4*8&255)<<8|x[k+2>>>2]>>>24-(k+2)%4*8&255,_=0;_<4&&k+.75*_<w;_++)u.push(D.charAt(O>>>6*(3-_)&63));var W=D.charAt(64);if(W)for(;u.length%4;)u.push(W);return u.join("")},parse:function(h,g=!0){var x=h.length,w=g?this._safe_map:this._map;if(!(D=this._reverseMap))for(var D=this._reverseMap=[],u=0;u<w.length;u++)D[w.charCodeAt(u)]=u;return g=w.charAt(64),!g||(g=h.indexOf(g))!==-1&&(x=g),(function(k,O,_){for(var W=[],F=0,S=0;S<O;S++){var M,E;S%4&&(M=_[k.charCodeAt(S-1)]<<S%4*2,E=_[k.charCodeAt(S)]>>>6-S%4*2,E=M|E,W[F>>>2]|=E<<24-F%4*8,F++)}return o.create(W,F)})(h,x,D)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},(function(h){var g=de,D=g.lib,x=D.WordArray,w=D.Hasher,D=g.algo,u=[];(function(){for(var F=0;F<64;F++)u[F]=4294967296*h.abs(h.sin(F+1))|0})(),D=D.MD5=w.extend({_doReset:function(){this._hash=new x.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(F,S){for(var M=0;M<16;M++){var E=S+M,b=F[E];F[E]=16711935&(b<<8|b>>>24)|4278255360&(b<<24|b>>>8)}var y=this._hash.words,m=F[S+0],P=F[S+1],B=F[S+2],R=F[S+3],V=F[S+4],$=F[S+5],Y=F[S+6],je=F[S+7],ut=F[S+8],Ke=F[S+9],$e=F[S+10],Ze=F[S+11],Qe=F[S+12],Ae=F[S+13],Ne=F[S+14],Pe=F[S+15],I=k(I=y[0],U=y[1],L=y[2],z=y[3],m,7,u[0]),z=k(z,I,U,L,P,12,u[1]),L=k(L,z,I,U,B,17,u[2]),U=k(U,L,z,I,R,22,u[3]);I=k(I,U,L,z,V,7,u[4]),z=k(z,I,U,L,$,12,u[5]),L=k(L,z,I,U,Y,17,u[6]),U=k(U,L,z,I,je,22,u[7]),I=k(I,U,L,z,ut,7,u[8]),z=k(z,I,U,L,Ke,12,u[9]),L=k(L,z,I,U,$e,17,u[10]),U=k(U,L,z,I,Ze,22,u[11]),I=k(I,U,L,z,Qe,7,u[12]),z=k(z,I,U,L,Ae,12,u[13]),L=k(L,z,I,U,Ne,17,u[14]),I=O(I,U=k(U,L,z,I,Pe,22,u[15]),L,z,P,5,u[16]),z=O(z,I,U,L,Y,9,u[17]),L=O(L,z,I,U,Ze,14,u[18]),U=O(U,L,z,I,m,20,u[19]),I=O(I,U,L,z,$,5,u[20]),z=O(z,I,U,L,$e,9,u[21]),L=O(L,z,I,U,Pe,14,u[22]),U=O(U,L,z,I,V,20,u[23]),I=O(I,U,L,z,Ke,5,u[24]),z=O(z,I,U,L,Ne,9,u[25]),L=O(L,z,I,U,R,14,u[26]),U=O(U,L,z,I,ut,20,u[27]),I=O(I,U,L,z,Ae,5,u[28]),z=O(z,I,U,L,B,9,u[29]),L=O(L,z,I,U,je,14,u[30]),I=_(I,U=O(U,L,z,I,Qe,20,u[31]),L,z,$,4,u[32]),z=_(z,I,U,L,ut,11,u[33]),L=_(L,z,I,U,Ze,16,u[34]),U=_(U,L,z,I,Ne,23,u[35]),I=_(I,U,L,z,P,4,u[36]),z=_(z,I,U,L,V,11,u[37]),L=_(L,z,I,U,je,16,u[38]),U=_(U,L,z,I,$e,23,u[39]),I=_(I,U,L,z,Ae,4,u[40]),z=_(z,I,U,L,m,11,u[41]),L=_(L,z,I,U,R,16,u[42]),U=_(U,L,z,I,Y,23,u[43]),I=_(I,U,L,z,Ke,4,u[44]),z=_(z,I,U,L,Qe,11,u[45]),L=_(L,z,I,U,Pe,16,u[46]),I=W(I,U=_(U,L,z,I,B,23,u[47]),L,z,m,6,u[48]),z=W(z,I,U,L,je,10,u[49]),L=W(L,z,I,U,Ne,15,u[50]),U=W(U,L,z,I,$,21,u[51]),I=W(I,U,L,z,Qe,6,u[52]),z=W(z,I,U,L,R,10,u[53]),L=W(L,z,I,U,$e,15,u[54]),U=W(U,L,z,I,P,21,u[55]),I=W(I,U,L,z,ut,6,u[56]),z=W(z,I,U,L,Pe,10,u[57]),L=W(L,z,I,U,Y,15,u[58]),U=W(U,L,z,I,Ae,21,u[59]),I=W(I,U,L,z,V,6,u[60]),z=W(z,I,U,L,Ze,10,u[61]),L=W(L,z,I,U,B,15,u[62]),U=W(U,L,z,I,Ke,21,u[63]),y[0]=y[0]+I|0,y[1]=y[1]+U|0,y[2]=y[2]+L|0,y[3]=y[3]+z|0},_doFinalize:function(){var F=this._data,S=F.words,b=8*this._nDataBytes,M=8*F.sigBytes;S[M>>>5]|=128<<24-M%32;var E=h.floor(b/4294967296),b=b;S[15+(64+M>>>9<<4)]=16711935&(E<<8|E>>>24)|4278255360&(E<<24|E>>>8),S[14+(64+M>>>9<<4)]=16711935&(b<<8|b>>>24)|4278255360&(b<<24|b>>>8),F.sigBytes=4*(S.length+1),this._process();for(var S=this._hash,y=S.words,m=0;m<4;m++){var P=y[m];y[m]=16711935&(P<<8|P>>>24)|4278255360&(P<<24|P>>>8)}return S},clone:function(){var F=w.clone.call(this);return F._hash=this._hash.clone(),F}});function k(F,S,M,E,b,y,m){return m=F+(S&M|~S&E)+b+m,(m<<y|m>>>32-y)+S}function O(F,S,M,E,b,y,m){return m=F+(S&E|M&~E)+b+m,(m<<y|m>>>32-y)+S}function _(F,S,M,E,b,y,m){return m=F+(S^M^E)+b+m,(m<<y|m>>>32-y)+S}function W(F,S,M,E,b,y,m){return m=F+(M^(S|~E))+b+m,(m<<y|m>>>32-y)+S}g.MD5=w._createHelper(D),g.HmacMD5=w._createHmacHelper(D)})(Math),ae=(xe=de).lib,c=ae.WordArray,a=ae.Hasher,ae=xe.algo,d=[],ae=ae.SHA1=a.extend({_doReset:function(){this._hash=new c.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,g){for(var x=this._hash.words,w=x[0],D=x[1],u=x[2],k=x[3],O=x[4],_=0;_<80;_++){_<16?d[_]=0|h[g+_]:(W=d[_-3]^d[_-8]^d[_-14]^d[_-16],d[_]=W<<1|W>>>31);var W=(w<<5|w>>>27)+O+d[_];W+=_<20?1518500249+(D&u|~D&k):_<40?1859775393+(D^u^k):_<60?(D&u|D&k|u&k)-1894007588:(D^u^k)-899497514,O=k,k=u,u=D<<30|D>>>2,D=w,w=W}x[0]=x[0]+w|0,x[1]=x[1]+D|0,x[2]=x[2]+u|0,x[3]=x[3]+k|0,x[4]=x[4]+O|0},_doFinalize:function(){var h=this._data,g=h.words,x=8*this._nDataBytes,w=8*h.sigBytes;return g[w>>>5]|=128<<24-w%32,g[14+(64+w>>>9<<4)]=Math.floor(x/4294967296),g[15+(64+w>>>9<<4)]=x,h.sigBytes=4*g.length,this._process(),this._hash},clone:function(){var h=a.clone.call(this);return h._hash=this._hash.clone(),h}}),xe.SHA1=a._createHelper(ae),xe.HmacSHA1=a._createHmacHelper(ae),(function(h){var g=de,O=g.lib,x=O.WordArray,w=O.Hasher,O=g.algo,D=[],u=[];(function(){function _(S){return 4294967296*(S-(0|S))|0}for(var W=2,F=0;F<64;)!(function(S){for(var M=h.sqrt(S),E=2;E<=M;E++)if(!(S%E))return;return 1})(W)||(F<8&&(D[F]=_(h.pow(W,.5))),u[F]=_(h.pow(W,1/3)),F++),W++})();var k=[],O=O.SHA256=w.extend({_doReset:function(){this._hash=new x.init(D.slice(0))},_doProcessBlock:function(_,W){for(var F=this._hash.words,S=F[0],M=F[1],E=F[2],b=F[3],y=F[4],m=F[5],P=F[6],B=F[7],R=0;R<64;R++){R<16?k[R]=0|_[W+R]:(V=k[R-15],$=k[R-2],k[R]=((V<<25|V>>>7)^(V<<14|V>>>18)^V>>>3)+k[R-7]+(($<<15|$>>>17)^($<<13|$>>>19)^$>>>10)+k[R-16]);var V=S&M^S&E^M&E,$=B+((y<<26|y>>>6)^(y<<21|y>>>11)^(y<<7|y>>>25))+(y&m^~y&P)+u[R]+k[R],B=P,P=m,m=y,y=b+$|0,b=E,E=M,M=S,S=$+(((S<<30|S>>>2)^(S<<19|S>>>13)^(S<<10|S>>>22))+V)|0}
2F[0]=F[0]+S|0,F[1]=F[1]+M|0,F[2]=F[2]+E|0,F[3]=F[3]+b|0,F[4]=F[4]+y|0,F[5]=F[5]+m|0,F[6]=F[6]+P|0,F[7]=F[7]+B|0},_doFinalize:function(){var _=this._data,W=_.words,F=8*this._nDataBytes,S=8*_.sigBytes;return W[S>>>5]|=128<<24-S%32,W[14+(64+S>>>9<<4)]=h.floor(F/4294967296),W[15+(64+S>>>9<<4)]=F,_.sigBytes=4*W.length,this._process(),this._hash},clone:function(){var _=w.clone.call(this);return _._hash=this._hash.clone(),_}});g.SHA256=w._createHelper(O),g.HmacSHA256=w._createHmacHelper(O)})(Math),p=(Se=de).lib.WordArray,oe=Se.algo,C=oe.SHA256,oe=oe.SHA224=C.extend({_doReset:function(){this._hash=new p.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var h=C._doFinalize.call(this);return h.sigBytes-=4,h}}),Se.SHA224=C._createHelper(oe),Se.HmacSHA224=C._createHmacHelper(oe),(function(){var h=de,g=h.lib.Hasher,D=h.x64,x=D.Word,w=D.WordArray,D=h.algo;function u(){return x.create.apply(x,arguments)}var k=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],O=[];(function(){for(var _=0;_<80;_++)O[_]=u()})(),D=D.SHA512=g.extend({_doReset:function(){this._hash=new w.init([new x.init(1779033703,4089235720),new x.init(3144134277,2227873595),new x.init(1013904242,4271175723),new x.init(2773480762,1595750129),new x.init(1359893119,2917565137),new x.init(2600822924,725511199),new x.init(528734635,4215389547),new x.init(1541459225,327033209)])},_doProcessBlock:function(_,W){for(var z=this._hash.words,F=z[0],S=z[1],M=z[2],E=z[3],b=z[4],y=z[5],m=z[6],P=z[7],B=F.high,R=F.low,V=S.high,$=S.low,Y=M.high,je=M.low,ut=E.high,Ke=E.low,$e=b.high,Ze=b.low,Qe=y.high,Ae=y.low,Ne=m.high,Pe=m.low,I=P.high,z=P.low,L=B,U=R,tr=V,kn=$,nr=Y,Bn=je,_i=ut,rr=Ke,kt=$e,yt=Ze,Nr=Qe,ir=Ae,Lr=Ne,sr=Pe,Oi=I,or=z,Bt=0;Bt<80;Bt++){var Vt,Dn,Ot=O[Bt];Bt<16?(Dn=Ot.high=0|_[W+2*Bt],Vt=Ot.low=0|_[W+2*Bt+1]):(Ve=(cr=O[Bt-15]).high,ft=cr.low,Wt=(ar=O[Bt-2]).high,xn=ar.low,Pn=(Tn=O[Bt-7]).high,cr=Tn.low,Tn=(ar=O[Bt-16]).high,Dn=(Dn=((Ve>>>1|ft<<31)^(Ve>>>8|ft<<24)^Ve>>>7)+Pn+((Vt=(Pn=(ft>>>1|Ve<<31)^(ft>>>8|Ve<<24)^(ft>>>7|Ve<<25))+cr)>>>0<Pn>>>0?1:0))+((Wt>>>19|xn<<13)^(Wt<<3|xn>>>29)^Wt>>>6)+((Vt+=ft=(xn>>>19|Wt<<13)^(xn<<3|Wt>>>29)^(xn>>>6|Wt<<26))>>>0<ft>>>0?1:0),Vt+=Ve=ar.low,Ot.high=Dn=Dn+Tn+(Vt>>
vendor: 7,443 bytes, line 2
2>0<Ve>>>0?1:0),Ot.low=Vt);var cr=kt&Nr^~kt&Lr,Pn=yt&ir^~yt&sr,xn=L&tr^L&nr^tr&nr,Wt=(U>>>28|L<<4)^(U<<30|L>>>2)^(U<<25|L>>>7),ft=k[Bt],ar=ft.high,Tn=ft.low,Ve=or+((yt>>>14|kt<<18)^(yt>>>18|kt<<14)^(yt<<23|kt>>>9)),Ot=Oi+((kt>>>14|yt<<18)^(kt>>>18|yt<<14)^(kt<<23|yt>>>9))+(Ve>>>0<or>>>0?1:0),ft=Wt+(U&kn^U&Bn^kn&Bn),Oi=Lr,or=sr,Lr=Nr,sr=ir,Nr=kt,ir=yt,kt=_i+(Ot=(Ot=(Ot=Ot+cr+((Ve=Ve+Pn)>>>0<Pn>>>0?1:0))+ar+((Ve=Ve+Tn)>>>0<Tn>>>0?1:0))+Dn+((Ve=Ve+Vt)>>>0<Vt>>>0?1:0))+((yt=rr+Ve|0)>>>0<rr>>>0?1:0)|0,_i=nr,rr=Bn,nr=tr,Bn=kn,tr=L,kn=U,L=Ot+(((L>>>28|U<<4)^(L<<30|U>>>2)^(L<<25|U>>>7))+xn+(ft>>>0<Wt>>>0?1:0))+((U=Ve+ft|0)>>>0<Ve>>>0?1:0)|0}R=F.low=R+U,F.high=B+L+(R>>>0<U>>>0?1:0),$=S.low=$+kn,S.high=V+tr+($>>>0<kn>>>0?1:0),je=M.low=je+Bn,M.high=Y+nr+(je>>>0<Bn>>>0?1:0),Ke=E.low=Ke+rr,E.high=ut+_i+(Ke>>>0<rr>>>0?1:0),Ze=b.low=Ze+yt,b.high=$e+kt+(Ze>>>0<yt>>>0?1:0),Ae=y.low=Ae+ir,y.high=Qe+Nr+(Ae>>>0<ir>>>0?1:0),Pe=m.low=Pe+sr,m.high=Ne+Lr+(Pe>>>0<sr>>>0?1:0),z=P.low=z+or,P.high=I+Oi+(z>>>0<or>>>0?1:0)},_doFinalize:function(){var _=this._data,W=_.words,F=8*this._nDataBytes,S=8*_.sigBytes;return W[S>>>5]|=128<<24-S%32,W[30+(128+S>>>10<<5)]=Math.floor(F/4294967296),W[31+(128+S>>>10<<5)]=F,_.sigBytes=4*W.length,this._process(),this._hash.toX32()},clone:function(){var _=g.clone.call(this);return _._hash=this._hash.clone(),_},blockSize:32}),h.SHA512=g._createHelper(D),h.HmacSHA512=g._createHmacHelper(D)})(),ae=(xe=de).x64,v=ae.Word,T=ae.WordArray,ae=xe.algo,j=ae.SHA512,ae=ae.SHA384=j.extend({_doReset:function(){this._hash=new T.init([new v.init(3418070365,3238371032),new v.init(1654270250,914150663),new v.init(2438529370,812702999),new v.init(355462360,4144912697),new v.init(1731405415,4290775857),new v.init(2394180231,1750603025),new v.init(3675008525,1694076839),new v.init(1203062813,3204075428)])},_doFinalize:function(){var h=j._doFinalize.call(this);return h.sigBytes-=16,h}}),xe.SHA384=j._createHelper(ae),xe.HmacSHA384=j._createHmacHelper(ae),(function(h){var g=de,u=g.lib,x=u.WordArray,w=u.Hasher,D=g.x64.Word,u=g.algo,k=[],O=[],_=[];(function(){for(var F=1,S=0,M=0;M<24;M++){k[F+5*S]=(M+1)*(M+2)/2%64;var E=(2*F+3*S)%5;F=S%5,S=E}for(F=0;F<5;F++)for(S=0;S<5;S++)O[F+5*S]=S+(2*F+3*S)%5*5;for(var b=1,y=0;y<24;y++){for(var m,P=0,B=0,R=0;R<7;R++)1&b&&((m=(1<<R)-1)<32?B^=1<<m:P^=1<<m-32),128&b?b=b<<1^113:b<<=1;_[y]=D.create(P,B)}})();var W=[];(function(){for(var F=0;F<25;F++)W[F]=D.create()})(),u=u.SHA3=w.extend({cfg:w.cfg.extend({outputLength:512}),_doReset:function(){for(var F=this._state=[],S=0;S<25;S++)F[S]=new D.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(F,S){for(var M=this._state,E=this.blockSize/2,b=0;b<E;b++){var m=F[S+2*b],y=F[S+2*b+1],m=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8);(I=M[b]).high^=y=16711935&(y<<8|y>>>24)|4278255360&(y<<24|y>>>8),I.low^=m}for(var P=0;P<24;P++){for(var B=0;B<5;B++){for(var R=0,V=0,$=0;$<5;$++)R^=(I=M[B+5*$]).high,V^=I.low;var Y=W[B];Y.high=R,Y.low=V}for(B=0;B<5;B++)for(var je=W[(B+4)%5],Ke=W[(B+1)%5],ut=Ke.high,Ke=Ke.low,R=je.high^(ut<<1|Ke>>>31),V=je.low^(Ke<<1|ut>>>31),$=0;$<5;$++)(I=M[B+5*$]).high^=R,I.low^=V;for(var $e=1;$e<25;$e++){var Ze=(I=M[$e]).high,Qe=I.low,Ae=k[$e];V=Ae<32?(R=Ze<<Ae|Qe>>>32-Ae,Qe<<Ae|Ze>>>32-Ae):(R=Qe<<Ae-32|Ze>>>64-Ae,Ze<<Ae-32|Qe>>>64-Ae),Ae=W[O[$e]],Ae.high=R,Ae.low=V}var Ne=W[0],Pe=M[0];for(Ne.high=Pe.high,Ne.low=Pe.low,B=0;B<5;B++)for($=0;$<5;$++){var I=M[$e=B+5*$],z=W[$e],L=W[(B+1)%5+5*$],U=W[(B+2)%5+5*$];I.high=z.high^~L.high&U.high,I.low=z.low^~L.low&U.low}I=M[0],Pe=_[P],I.high^=Pe.high,I.low^=Pe.low}},_doFinalize:function(){var F=this._data,S=F.words,M=(this._nDataBytes,8*F.sigBytes),E=32*this.blockSize;S[M>>>5]|=1<<24-M%32,S[(h.ceil((1+M)/E)*E>>>5)-1]|=128,F.sigBytes=4*S.length,this._process();for(var b=this._state,S=this.cfg.outputLength/8,y=S/8,m=[],P=0;P<y;P++){var B=b[P],R=B.high,B=B.low,R=16711935&(R<<8|R>>>24)|4278255360&(R<<24|R>>>8);m.push(B=16711935&(B<<8|B>>>24)|4278255360&(B<<24|B>>>8)),m.push(R)}return new x.init(m,S)},clone:function(){for(var F=w.clone.call(this),S=F._state=this._state.slice(0),M=0;M<25;M++)S[M]=S[M].clone();return F}}),g.SHA3=w._createHelper(u),g.HmacSHA3=w._createHmacHelper(u)})(Math),oe=(Se=de).lib,N=oe.WordArray,K=oe.Hasher,oe=Se.algo,G=N.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),te=N.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),X=N.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),q=N.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),Be=N.create([0,1518500249,1859775393,2400959708,2840853838]),Ee=N.create([1352829926,1548603684,1836072691,2053994217,0]),oe=oe.RIPEMD160=K.extend({_doReset:function(){this._hash=N.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(h,g){for(var x=0;x<16;x++){var w=g+x,D=h[w];h[w]=16711935&(D<<8|D>>>24)|4278255360&(D<<24|D>>>8)}for(var u,k,O,_,W,F,S=this._hash.words,M=Be.words,E=Ee.words,b=G.words,y=te.words,m=X.words,P=q.words,B=u=S[0],R=k=S[1],V=O=S[2],$=_=S[3],Y=W=S[4],x=0;x<80;x+=1)F=u+h[g+b[x]]|0,F+=x<16?(k^O^_)+M[0]:x<32?vs(k,O,_)+M[1]:x<48?((k|~O)^_)+M[2]:x<64?Ss(k,O,_)+M[3]:(k^(O|~_))+M[4],F=(F=zr(F|=0,m[x]))+W|0,u=W,W=_,_=zr(O,10),O=k,k=F,F=B+h[g+y[x]]|0,F+=x<16?(R^(V|~$))+E[0]:x<32?Ss(R,V,$)+E[1]:x<48?((R|~V)^$)+E[2]:x<64?vs(R,V,$)+E[3]:(R^V^$)+E[4],F=(F=zr(F|=0,P[x]))+Y|0,B=Y,Y=$,$=zr(V,10),V=R,R=F;F=S[1]+O+$|0,S[1]=S[2]+_+Y|0,S[2]=S[3]+W+B|0,S[3]=S[4]+u+R|0,S[4]=S[0]+k+V|0,S[0]=F},_doFinalize:function(){var h=this._data,g=h.words,x=8*this._nDataBytes,w=8*h.sigBytes;g[w>>>5]|=128<<24-w%32,g[14+(64+w>>>9<<4)]=16711935&(x<<8|x>>>24)|4278255360&(x<<24|x>>>8),h.sigBytes=4*(g.length+1),this._process();for(var g=this._hash,D=g.words,u=0;u<5;u++){var k=D[u];D[u]=16711935&(k<<8|k>>>24)|4278255360&(k<<24|k>>>8)}return g},clone:function(){var h=K.clone.call(this);return h._hash=this._hash.clone(),h}}),Se.RIPEMD160=K._createHelper(oe),Se.HmacRIPEMD160=K._createHmacHelper(oe),ae=(xe=de).lib.Base,Oe=xe.enc.Utf8,xe.algo.HMAC=ae.extend({init:function(h,g){h=this._hasher=new h.init,typeof g=="string"&&(g=Oe.parse(g));var x=h.blockSize,w=4*x;(g=g.sigBytes>w?h.finalize(g):g).clamp();for(var h=this._oKey=g.clone(),g=this._iKey=g.clone(),D=h.words,u=g.words,k=0;k<x;k++)D[k]^=1549556828,u[k]^=909522486;h.sigBytes=g.sigBytes=w,this.reset()},reset:function(){var h=this._hasher;h.reset(),h.update(this._iKey)},update:function(h){return this._hasher.update(h),this},finalize:function(x){var g=this._hasher,x=g.finalize(x);return g.reset(),g.finalize(this._oKey.clone().concat(x))}}),oe=(Se=de).lib,xe=oe.Base,Me=oe.WordArray,ae=Se.algo,oe=ae.SHA1,Re=ae.HMAC,We=ae.PBKDF2=xe.extend({cfg:xe.extend({keySize:4,hasher:oe,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,g){for(var x=this.cfg,w=Re.create(x.hasher,h),D=Me.create(),u=Me.create([1]),k=D.words,O=u.words,_=x.keySize,W
2=x.iterations;k.length<_;){var F=w.update(g).finalize(u);w.reset();for(var S=F.words,M=S.length,E=F,b=1;b<W;b++){E=w.finalize(E),w.reset();for(var y=E.words,m=0;m<M;m++)S[m]^=y[m]}D.concat(F),O[0]++}return D.sigBytes=4*_,D}}),Se.PBKDF2=function(h,g,x){return We.create(x).compute(h,g)},xe=(ae=de).lib,oe=xe.Base,at=xe.WordArray,Se=ae.algo,xe=Se.MD5,ze=Se.EvpKDF=oe.extend({cfg:oe.extend({keySize:4,hasher:xe,iterations:1}),init:function(h){this.cfg=this.cfg.extend(h)},compute:function(h,g){for(var x,w=this.cfg,D=w.hasher.create(),u=at.create(),k=u.words,O=w.keySize,_=w.iterations;k.length<O;){x&&D.update(x),x=D.update(h).finalize(g),D.reset();for(var W=1;W<_;W++)x=D.finalize(x),D.reset();u.concat(x)}return u.sigBytes=4*O,u}}),ae.EvpKDF=function(h,g,x){return ze.create(x).compute(h,g)},de.lib.Cipher||(function(){var E=de,h=E.lib,g=h.Base,x=h.WordArray,w=h.BufferedBlockAlgorithm,_=E.enc,D=(_.Utf8,_.Base64),u=E.algo.EvpKDF,k=h.Cipher=w.extend({cfg:g.extend(),createEncryptor:function(y,m){return this.create(this._ENC_XFORM_MODE,y,m)},createDecryptor:function(y,m){return this.create(this._DEC_XFORM_MODE,y,m)},init:function(y,m,P){this.cfg=this.cfg.extend(P),this._xformMode=y,this._key=m,this.reset()},reset:function(){w.reset.call(this),this._doReset()},process:function(y){return this._append(y),this._process()},finalize:function(y){return y&&this._append(y),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(y){return{encrypt:function(m,P,B){return O(P).encrypt(y,m,P,B)},decrypt:function(m,P,B){return O(P).decrypt(y,m,P,B)}}}});function O(y){return typeof y=="string"?b:M}h.StreamCipher=k.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var S=E.mode={},_=h.BlockCipherMode=g.extend({createEncryptor:function(y,m){return this.Encryptor.create(y,m)},createDecryptor:function(y,m){return this.Decryptor.create(y,m)},init:function(y,m){this._cipher=y,this._iv=m}}),_=S.CBC=((S=_.extend()).Encryptor=S.extend({processBlock:function(y,m){var P=this._cipher,B=P.blockSize;W.call(this,y,m,B),P.encryptBlock(y,m),this._prevBlock=y.slice(m,m+B)}}),S.Decryptor=S.extend({processBlock:function(y,m){var P=this._cipher,B=P.blockSize,R=y.slice(m,m+B);P.decryptBlock(y,m),W.call(this,y,m,B),this._prevBlock=R}}),S);function W(y,m,P){var B,R=this._iv;R?(B=R,this._iv=void 0):B=this._prevBlock;for(var V=0;V<P;V++)y[m+V]^=B[V]}var S=(E.pad={}).Pkcs7={pad:function(y,m){for(var m=4*m,P=m-y.sigBytes%m,B=P<<24|P<<16|P<<8|P,R=[],V=0;V<P;V+=4)R.push(B);m=x.create(R,P),y.concat(m)},unpad:function(y){var m=255&y.words[y.sigBytes-1>>>2];y.sigBytes-=m}},F=(h.BlockCipher=k.extend({cfg:k.cfg.extend({mode:_,padding:S}),reset:function(){var y;k.reset.call(this);var P=this.cfg,m=P.iv,P=P.mode;this._xformMode==this._ENC_XFORM_MODE?y=P.createEncryptor:(y=P.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==y?this._mode.init(this,m&&m.words):(this._mode=y.call(P,this,m&&m.words),this._mode.__creator=y)},_doProcessBlock:function(y,m){this._mode.processBlock(y,m)},_doFinalize:function(){var y,m=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(m.pad(this._data,this.blockSize),y=this._process(!0)):(y=this._process(!0),m.unpad(y)),y},blockSize:4}),h.CipherParams=g.extend({init:function(y){this.mixIn(y)},toString:function(y){return(y||this.formatter).stringify(this)}})),S=(E.format={}).OpenSSL={stringify:function(m){var P=m.ciphertext,m=m.salt,P=m?x.create([1398893684,1701076831]).concat(m).concat(P):P;return P.toString(D)},parse:function(B){var m,P=D.parse(B),B=P.words;return B[0]==1398893684&&B[1]==1701076831&&(m=x.create(B.slice(2,4)),B.splice(0,4),P.sigBytes-=16),F.create({ciphertext:P,salt:m})}},M=h.SerializableCipher=g.extend({cfg:g.extend({format:S}),encrypt:function(y,R,P,B){B=this.cfg.extend(B);var V=y.createEncryptor(P,B),R=V.finalize(R),V=V.cfg;return F.create({ciphertext:R,key:P,iv:V.iv,algorithm:y,mode:V.mode,padding:V.padding,blockSize:y.blockSize,formatter:B.format})},decrypt:function(y,m,P,B){return B=this.cfg.extend(B),m=this._parse(m,B.format),y.createDecryptor(P,B).finalize(m.ciphertext)},_parse:function(y,m){return typeof y=="string"?m.parse(y,this):y}}),E=(E.kdf={}).OpenSSL={execute:function(y,m,P,B){return B=B||x.random(8),y=u.create({keySize:m+P}).compute(y,B),P=x.create(y.words.slice(m),4*P),y.sigBytes=4*m,F.create({key:y,iv:P,salt:B})}},b=h.PasswordBasedCipher=M.extend({cfg:M.cfg.extend({kdf:E}),encrypt:function(y,m,P,B){return P=(B=this.cfg.extend(B)).kdf.execute(P,y.keySize,y.ivSize),B.iv=P.iv,B=M.encrypt.call(this,y,m,P.key,B),B.mixIn(P),B},decrypt:function(y,m,P,B){return B=this.cfg.extend(B),m=this._parse(m,B.format),P=B.kdf.execute(P,y.keySize,y.ivSize,m.salt),B.iv=P.iv,M.decrypt.call(this,y,m,P.key,B)}})})(),de.mode.CFB=((oe=de.lib.BlockCipherMode.extend()).Encryptor=oe.extend({processBlock:function(h,g){var x=this._cipher,w=x.blockSize;As.call(this,h,g,w,x),this._prevBlock=h.slice(g,g+w)}}),oe.Decryptor=oe.extend({processBlock:function(h,g){var x=this._cipher,w=x.blockSize,D=h.slice(g,g+w);As.call(this,h,g,w,x),this._prevBlock=D}}),oe),de.mode.CTR=(xe=de.lib.BlockCipherMode.extend(),ae=xe.Encryptor=xe.extend({processBlock:function(h,g){var x=this._cipher,w=x.blockSize,D=this._iv,u=this._counter;D&&(u=this._counter=D.slice(0),this._iv=void 0);var k=u.slice(0);x.encryptBlock(k,0),u[w-1]=u[w-1]+1|0;for(var O=0;O<w;O++)h[g+O]^=k[O]}}),xe.Decryptor=ae,xe),de.mode.CTRGladman=(oe=de.lib.BlockCipherMode.extend(),ae=oe.Encryptor=oe.extend({processBlock:function(h,g){var x=this._cipher,w=x.blockSize,D=this._iv,u=this._counter;D&&(u=this._counter=D.slice(0),this._iv=void 0),((D=u)[0]=Cs(D[0]))===0&&(D[1]=Cs(D[1]));var k=u.slice(0);x.encryptBlock(k,0);for(var O=0;O<w;O++)h[g+O]^=k[O]}}),oe.Decryptor=ae,oe),de.mode.OFB=(xe=de.lib.BlockCipherMode.extend(),ae=xe.Encryptor=xe.extend({processBlock:function(h,g){var x=this._cipher,w=x.blockSize,D=this._iv,u=this._keystream;D&&(u=this._keystream=D.slice(0),this._iv=void 0),x.encryptBlock(u,0);for(var k=0;k<w;k++)h[g+k]^=u[k]}}),xe.Decryptor=ae,xe),de.mode.ECB=((oe=de.lib.BlockCipherMode.extend()).Encryptor=oe.extend({processBlock:function(h,g){this._cipher.encryptBlock(h,g)}}),oe.Decryptor=oe.extend({processBlock:function(h,g){this._cipher.decryptBlock(h,g)}}),oe),de.pad.AnsiX923={pad:function(h,x){var w=h.sigBytes,x=4*x,x=x-w%x,w=w+x-1;h.clamp(),h.words[w>>>2]|=x<<24-w%4*8,h.sigBytes+=x},unpad:function(h){var g=255&h.words[h.sigBytes-1>>>2];h.sigBytes-=g}},de.pad.Iso10126={pad:function(h,g){g*=4,g-=h.sigBytes%g,h.concat(de.lib.WordArray.random(g-1)).concat(de.lib.WordArray.create([g<<24],1))},unpad:function(h){var g=255&h.words[h.sigBytes-1>>>2];h.sigBytes-=g}},de.pad.Iso97971={pad:function(h,g){h.concat(de.lib.WordArray.create([2147483648],1)),de.pad.ZeroPadding.pad(h,g)},unpad:function(h){de.pad.ZeroPadding.unpad(h),h.sigBytes--}},de.pad.ZeroPadding={pad:function(h,g){g*=4,h.clamp(),h.sigBytes+=g-(h.sigBytes%g||g)},unpad:function(h){for(var g=h.words,x=h.sigBytes-1,x=h.sigBytes-1;0<=x;x--)if(g[x>>>2]>>>24-x%4*8&255){h.sigBytes=x+1;break}}},de.pad.NoPadding={pad:function(){},unpad:function(){}},ht=(ae=de).lib.CipherParams,Te=ae.enc.Hex,ae.format.Hex={stringify:function(h){return h.ciphertext.toString(Te)},parse:function(h){return h=Te.parse(h),ht.create({ciphertext:h})}},(function(){var h=de,g=h.lib.BlockCipher,E=h.algo,x=[],w=[],D=[],u=[],k=[],O=[],_=[],W=[],F=[],S=[];(function(){for(var b=[],y=0;y<256;y++)b[y]=y<128?y<<1:y<<1^283;for(var m=0,P=0,y=0;y<256;y++){var B=P^P<<1^P<<2^P<<3^P<<4;x[m]=B=B>>>8^255&B^99;var R=b[w[B]=m],V=b[R],$=b[V],Y=257*b[B]^16843008*B;D[m]=Y<<24|Y>>>8,u[m]=Y<<16|Y>>>16,k[m]=Y<<8|Y>>>24,O[m]=Y,_[B]=(Y=16843009*$^65537*V^257*R^16843008*m)<<24|Y>>>8,W[B]=Y<<16|Y>>>16,F[B]=Y<<8|Y>>>24,S[B]=Y,m?(m=R^b[b[b[$^R]]],P^=b[b[P]]):m=P=1}})();var M=[0,1,2,4,8,16,32,64,128,27,54],E=E.AES=g.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var b=this._keyPriorReset=this._key,y=b.words,m=b.sigBytes/4,P=4*(1+(this._nRounds=6+m)),B=this._keySchedule=[],R=0;R<P;R++)R<m?B[R]=y[R]:(Y=B[R-1],R%m?6<m&&R%m==4&&(Y=x[Y>>>24]<<24|x[Y>>>16&255]<<16|x[Y>>>8&255]<<8|x[255&Y]):(Y=x[(Y=Y<<8|Y>>>24)>>>24]<<24|x[Y>>>16&255]<<16|x[Y>>>8&255]<<8|x[255&Y],Y^=M[R/m|0]<<24),B[R]=B[R-m]^Y);for(var V=this._invKeySchedule=[],$=0;$<P;$++){var Y,R=P-$;Y=$%4?B[R]:B[R-4],V[$]=$<4||R<=4?Y:_[x[Y>>>24]]^W[x[Y>>>16&255]]^F[x[Y>>>8&255]]^S[x[255&Y]]}}},encryptBlock:function(b,y){this._doCryptBlock(b,y,this._keySchedule,D,u,k,O,x)},decryptBlock:function(b,y){var m=b[y+1];b[y+1]=b[y+3],b[y+3]=m,this._doCryptBlock(b,y,this._invKeySchedule,_,W,F,S,w),m=b[y+1],b[y+1]=b[y+3],b[y+3]=m},_doCryptBlock:function(b,y,m,P,B,R,V,$){for(var Y=this._nRounds,Ae=b[y]^m[0],Ne=b[y+1]^m[1],Pe=b[y+2]^m[2],I=b[y+3]^m[3],je=4,ut=1;ut<Y;ut++)var Ke=P[Ae>>>24]^B[Ne>>>16&255]^R[Pe>>>8&255]^V[255&I]^m[je++],$e=P[Ne>>>24]^B[Pe>>>16&255]^R[I>>>8&255]^V[255&Ae]^m[je++],Ze=P[Pe>>>24]^B[I>>>16&255]^R[Ae>>
2>8&255]^V[255&Ne]^m[je++],Qe=P[I>>>24]^B[Ae>>>16&255]^R[Ne>>>8&255]^V[255&Pe]^m[je++],Ae=Ke,Ne=$e,Pe=Ze,I=Qe;Ke=($[Ae>>>24]<<24|$[Ne>>>16&255]<<16|$[Pe>>>8&255]<<8|$[255&I])^m[je++],$e=($[Ne>>>24]<<24|$[Pe>>>16&255]<<16|$[I>>>8&255]<<8|$[255&Ae])^m[je++],Ze=($[Pe>>>24]<<24|$[I>>>16&255]<<16|$[Ae>>>8&255]<<8|$[255&Ne])^m[je++],Qe=($[I>>>24]<<24|$[Ae>>>16&255]<<16|$[Ne>>>8&255]<<8|$[255&Pe])^m[je++],b[y]=Ke,b[y+1]=$e,b[y+2]=Ze,b[y+3]=Qe},keySize:8});h.AES=g._createHelper(E)})(),(function(){var h=de,w=h.lib,g=w.WordArray,x=w.BlockCipher,w=h.algo,D=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],u=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],k=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],O
vendor: 7,629 bytes, line 2
2=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],
2_=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],W=w.DES=x.extend({_doReset:function(){for(var M=this._key.words,E=[],b=0;b<56;b++){var y=D[b]-1;E[b]=M[y>>>5]>>>31-y%32&1}for(var m=this._subKeys=[],P=0;P<16;P++){for(var B=m[P]=[],R=k[P],b=0;b<24;b++)B[b/6|0]|=E[(u[b]-1+R)%28]<<31-b%6,B[4+(b/6|0)]|=E[28+(u[b+24]-1+R)%28]<<31-b%6;for(B[0]=B[0]<<1|B[0]>>>31,b=1;b<7;b++)B[b]=B[b]>>>4*(b-1)+3;B[7]=B[7]<<5|B[7]>>>27}for(var V=this._invSubKeys=[],b=0;b<16;b++)V[b]=m[15-b]},encryptBlock:function(M,E){this._doCryptBlock(M,E,this._subKeys)},decryptBlock:function(M,E){this._doCryptBlock(M,E,this._invSubKeys)},_doCryptBlock:function(M,E,b){this._lBlock=M[E],this._rBlock=M[E+1],F.call(this,4,252645135),F.call(this,16,65535),S.call(this,2,858993459),S.call(this,8,16711935),F.call(this,1,1431655765);for(var y=0;y<16;y++){for(var m=b[y],P=this._lBlock,B=this._rBlock,R=0,V=0;V<8;V++)R|=O[V][((B^m[V])&_[V])>>>0];this._lBlock=B,this._rBlock=P^R}var $=this._lBlock;this._lBlock=this._rBlock,this._rBlock=$,F.call(this,1,1431655765),S.call(this,8,16711935),S.call(this,2,858993459),F.call(this,16,65535),F.call(this,4,252645135),M[E]=this._lBlock,M[E+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function F(M,E){E=(this._lBlock>>>M^this._rBlock)&E,this._rBlock^=E,this._lBlock^=E<<M}function S(M,E){E=(this._rBlock>>>M^this._lBlock)&E,this._lBlock^=E,this._rBlock^=E<<M}h.DES=x._createHelper(W),w=w.TripleDES=x.extend({_doReset:function(){var b=this._key.words;if(b.length!==2&&b.length!==4&&b.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var M=b.slice(0,2),E=b.length<4?b.slice(0,2):b.slice(2,4),b=b.length<6?b.slice(0,2):b.slice(4,6);this._des1=W.createEncryptor(g.create(M)),this._des2=W.createEncryptor(g.create(E)),this._des3=W.createEncryptor(g.create(b))},encryptBlock:function(M,E){this._des1.encryptBlock(M,E),this._des2.decryptBlock(M,E),this._des3.encryptBlock(M,E)},decryptBlock:function(M,E){this._des3.decryptBlock(M,E),this._des2.encryptBlock(M,E),this._des1.decryptBlock(M,E)},keySize:6,ivSize:2,blockSize:2}),h.TripleDES=x._createHelper(w)})(),(function(){var h=de,g=h.lib.StreamCipher,x=h.algo,w=x.RC4=g.extend({_doReset:function(){for(var u=this._key,k=u.words,O=u.sigBytes,_=this._S=[],W=0;W<256;W++)_[W]=W;for(var W=0,F=0;W<256;W++){var S=W%O,S=k[S>>>2]>>>24-S%4*8&255,F=(F+_[W]+S)%256,S=_[W];_[W]=_[F],_[F]=S}this._i=this._j=0},_doProcessBlock:function(u,k){u[k]^=D.call(this)},keySize:8,ivSize:0});function D(){for(var u=this._S,k=this._i,O=this._j,_=0,W=0;W<4;W++){var O=(O+u[k=(k+1)%256])%256,F=u[k];u[k]=u[O],u[O]=F,_|=u[(u[k]+u[O])%256]<<24-8*W}return this._i=k,this._j=O,_}
2h.RC4=g._createHelper(w),x=x.RC4Drop=w.extend({cfg:w.cfg.extend({drop:192}),_doReset:function(){w._doReset.call(this);for(var u=this.cfg.drop;0<u;u--)D.call(this)}}),h.RC4Drop=g._createHelper(x)})(),oe=(xe=de).lib.StreamCipher,ae=xe.algo,Ie=[],lt=[],pe=[],ae=ae.Rabbit=oe.extend({_doReset:function(){for(var h=this._key.words,g=this.cfg.iv,x=0;x<4;x++)h[x]=16711935&(h[x]<<8|h[x]>>>24)|4278255360&(h[x]<<24|h[x]>>>8);for(var w=this._X=[h[0],h[3]<<16|h[2]>>>16,h[1],h[0]<<16|h[3]>>>16,h[2],h[1]<<16|h[0]>>>16,h[3],h[2]<<16|h[1]>>>16],D=this._C=[h[2]<<16|h[2]>>>16,4294901760&h[0]|65535&h[1],h[3]<<16|h[3]>>>16,4294901760&h[1]|65535&h[2],h[0]<<16|h[0]>>>16,4294901760&h[2]|65535&h[3],h[1]<<16|h[1]>>>16,4294901760&h[3]|65535&h[0]],x=this._b=0;x<4;x++)Pi.call(this);for(x=0;x<8;x++)D[x]^=w[x+4&7];if(g){var u=g.words,k=u[0],O=u[1],g=16711935&(k<<8|k>>>24)|4278255360&(k<<24|k>>>8),u=16711935&(O<<8|O>>>24)|4278255360&(O<<24|O>>>8),k=g>>>16|4294901760&u,O=u<<16|65535&g;for(D[0]^=g,D[1]^=k,D[2]^=u,D[3]^=O,D[4]^=g,D[5]^=k,D[6]^=u,D[7]^=O,x=0;x<4;x++)Pi.call(this)}},_doProcessBlock:function(h,g){var x=this._X;Pi.call(this),Ie[0]=x[0]^x[5]>>>16^x[3]<<16,Ie[1]=x[2]^x[7]>>>16^x[5]<<16,Ie[2]=x[4]^x[1]>>>16^x[7]<<16,Ie[3]=x[6]^x[3]>>>16^x[1]<<16;for(var w=0;w<4;w++)Ie[w]=16711935&(Ie[w]<<8|Ie[w]>>>24)|4278255360&(Ie[w]<<24|Ie[w]>>>8),h[g+w]^=Ie[w]},blockSize:4,ivSize:2}),xe.Rabbit=oe._createHelper(ae),oe=(xe=de).lib.StreamCipher,ae=xe.algo,Ft=[],_t=[],ye=[],ae=ae.RabbitLegacy=oe.extend({_doReset:function(){for(var h=this._key.words,g=this.cfg.iv,x=this._X=[h[0],h[3]<<16|h[2]>>>16,h[1],h[0]<<16|h[3]>>>16,h[2],h[1]<<16|h[0]>>>16,h[3],h[2]<<16|h[1]>>>16],w=this._C=[h[2]<<16|h[2]>>>16,4294901760&h[0]|65535&h[1],h[3]<<16|h[3]>>>16,4294901760&h[1]|65535&h[2],h[0]<<16|h[0]>>>16,4294901760&h[2]|65535&h[3],h[1]<<16|h[1]>>>16,4294901760&h[3]|65535&h[0]],D=this._b=0;D<4;D++)Ti.call(this);for(D=0;D<8;D++)w[D]^=x[D+4&7];if(g){var u=g.words,k=u[0],h=u[1],g=16711935&(k<<8|k>>>24)|4278255360&(k<<24|k>>>8),u=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),k=g>>>16|4294901760&u,h=u<<16|65535&g;for(w[0]^=g,w[1]^=k,w[2]^=u,w[3]^=h,w[4]^=g,w[5]^=k,w[6]^=u,w[7]^=h,D=0;D<4;D++)Ti.call(this)}},_doProcessBlock:function(h,g){var x=this._X;Ti.call(this),Ft[0]=x[0]^x[5]>>>16^x[3]<<16,Ft[1]=x[2]^x[7]>>>16^x[5]<<16,Ft[2]=x[4]^x[1]>>>16^x[7]<<16,Ft[3]=x[6]^x[3]>>>16^x[1]<<16;for(var w=0;w<4;w++)Ft[w]=16711935&(Ft[w]<<8|Ft[w]>>>24)|4278255360&(Ft[w]<<24|Ft[w]>>>8),h[g+w]^=Ft[w]},blockSize:4,ivSize:2}),xe.RabbitLegacy=oe._createHelper(ae),de})})(Yr)),Yr.exports}var ge=xc();class It{constructor(e,t={}){if(!t.ownerPassword&&!t.userPassword)throw new Error("None of owner password and user password is defined.");this.document=e,this._setupEncryption(t)}static generateFileID(e){return Rt(ge.MD5(e.toString()))}static generateRandomWordArray(e){return ge.lib.WordArray.random(e)}static create(e,t={}){return new It(e,t)}_setupEncryption(e){switch(e.pdfVersion){case"1.4":case"1.5":this.version=2;break;case"1.6":case"1.7":this.version=4;break;case"1.7ext3":this.version=5;break;default:this.version=1;break}switch(this.version){case 1:case 2:case 4:this.dictionary=this._setupEncryptionV1V2V4(this.version,e);break;case 5:this.dictionary=this._setupEncryptionV5(e);break}}_setupEncryptionV1V2V4(e,t){const r={Filter:"Standard"};let i,s;switch(e){case 1:i=2,this.keyBits=40,s=pc(t.permissions);break;case 2:i=3,this.keyBits=128,s=Ei(t.permissions);break;case 4:i=4,this.keyBits=128,s=Ei(t.permissions);break;default:throw new Error("Unknown v value")}const o=ei(t.userPassword),c=t.ownerPassword?ei(t.ownerPassword):o,a=bc(i,this.keyBits,o,c);this.encryptionKey=wc(i,this.keyBits,this.document._id,o,a,s);let d;return i===2?d=yc(this.encryptionKey):d=mc(this.document._id,this.encryptionKey),r.V=e,e>=2&&(r.Length=this.keyBits),e===4&&(r.CF={StdCF:{AuthEvent:"DocOpen",CFM:"AESV2",Length:this.keyBits/8}},r.StmF="StdCF",r.StrF="StdCF"),r.R=i,r.O=Rt(a),r.U=Rt(d),r.P=s,r}_setupEncryptionV5(e){const t={Filter:"Standard"};this.keyBits=256;const r=Ei(e.permissions),i=_s(e.userPassword),s=e.ownerPassword?_s(e.ownerPassword):i;this.encryptionKey=Fc(It.generateRandomWordArray);const o=vc(i,It.generateRandomWordArray),c=ge.lib.WordArray.create(o.words.slice(10,12),8),a=Sc(i,c,this.encryptionKey),d=Ac(s,o,It.generateRandomWordArray),p=ge.lib.WordArray.create(d.words.slice(10,12),8),C=Cc(s,p,o,this.encryptionKey),v=kc(r,this.encryptionKey,It.generateRandomWordArray);return t.V=5,t.Length=this.keyBits,t.CF={StdCF:{AuthEvent:"DocOpen",CFM:"AESV3",Length:this.keyBits/8}},t.StmF="StdCF",t.StrF="StdCF",t.R=5,t.O=Rt(d),t.OE=Rt(C),t.U=Rt(o),t.UE=Rt(a),t.P=r,t.Perms=Rt(v),t}getEncryptFn(e,t){let r,i;if(this.version<5){if(r=this.encryptionKey.clone().concat(ge.lib.WordArray.create([(e&255)<<24|(e&65280)<<8|e>>8&65280|t&255,(t&65280)<<16],5)),this.version===1||this.version===2)return i=ge.MD5(r),i.sigBytes=Math.min(16,this.keyBits/8+5),c=>Rt(ge.RC4.encrypt(ge.lib.WordArray.create(c),i).ciphertext);this.version===4&&(i=ge.MD5(r.concat(ge.lib.WordArray.create([1933667412],4))))}else if(this.version===5)i=this.encryptionKey;else throw new Error("Unknown V value");const s=It.generateRandomWordArray(16),o={mode:ge.mode.CBC,padding:ge.pad.Pkcs7,iv:s};return c=>
2Rt(s.clone().concat(ge.AES.encrypt(ge.lib.WordArray.create(c),i,o).ciphertext))}}const pc=(n={})=>{let e=-64;return n.printing&&(e|=4),n.modifying&&(e|=8),n.copying&&(e|=16),n.annotating&&(e|=32),e},Ei=(n={})=>{let e=-3904;return(n.printing==="lowResolution"||n.printing)&&(e|=4),n.printing==="highResolution"&&(e|=2052),n.modifying&&(e|=8),n.copying&&(e|=16),n.annotating&&(e|=32),n.fillingForms&&(e|=256),n.contentAccessibility&&(e|=512),n.documentAssembly&&(e|=1024),e},yc=n=>ge.RC4.encrypt(ei(),n).ciphertext,mc=(n,e)=>{const t=e.clone();let r=ge.MD5(ei().concat(ge.lib.WordArray.create(n)));for(let i=0;i<20;i++){const s=Math.ceil(t.sigBytes/4);for(let o=0;o<s;o++)t.words[o]=e.words[o]^(i|i<<8|i<<16|i<<24);r=ge.RC4.encrypt(r,t).ciphertext}return r.concat(ge.lib.WordArray.create(null,16))},bc=(n,e,t,r)=>{let i=r,s=n>=3?51:1;for(let a=0;a<s;a++)i=ge.MD5(i);const o=i.clone();o.sigBytes=e/8;let c=t;s=n>=3?20:1;for(let a=0;a<s;a++){const d=Math.ceil(o.sigBytes/4);for(let p=0;p<d;p++)o.words[p]=i.words[p]^(a|a<<8|a<<16|a<<24);c=ge.RC4.encrypt(c,o).ciphertext}return c},wc=(n,e,t,r,i,s)=>{let o=r.clone().concat(i).concat(ge.lib.WordArray.create([fo(s)],4)).concat(ge.lib.WordArray.create(t));const c=n>=3?51:1;for(let a=0;a<c;a++)o=ge.MD5(o),o.sigBytes=e/8;return o},vc=(n,e)=>{const t=e(8),r=e(8);return ge.SHA256(n.clone().concat(t)).concat(t).concat(r)},Sc=(n,e,t)=>{const r=ge.SHA256(n.clone().concat(e)),i={mode:ge.mode.CBC,padding:ge.pad.NoPadding,iv:ge.lib.WordArray.create(null,16)};return ge.AES.encrypt(t,r,i).ciphertext},Ac=(n,e,t)=>{const r=t(8),i=t(8);return ge.SHA256(n.clone().concat(r).concat(e)).concat(r).concat(i)},Cc=(n,e,t,r)=>{const i=ge.SHA256(n.clone().concat(e).concat(t)),s={mode:ge.mode.CBC,padding:ge.pad.NoPadding,iv:ge.lib.WordArray.create(null,16)};return ge.AES.encrypt(r,i,s).ciphertext},Fc=n=>n(32),kc=(n,e,t)=>{const r=ge.lib.WordArray.create([fo(n),4294967295,1415668834],12).concat(t(4)),i={mode:ge.mode.ECB,padding:ge.pad.NoPadding};return ge.AES.encrypt(r,e,i).ciphertext},ei=(n="")=>{const e=new Uint8Array(32),t=n.length;let r=0;for(;r<t&&r<32;){const i=n.charCodeAt(r);if(i>255)throw new Error("Password contains one or more invalid characters.");e[r]=i,r++}for(;r<32;)e[r]=Bc[r-t],r++;return ge.lib.WordArray.create(e)},_s=(n="")=>{n=unescape(encodeURIComponent(n.normalize("NFKC")));const e=Math.min(127,n.length),t=new Uint8Array(e);for(let r=0;r<e;r++)t[r]=n.charCodeAt(r);return ge.lib.WordArray.create(t)},fo=n=>(n&255)<<24|(n&65280)<<8|n>>8&65280|n>>24&255,Rt=n=>{const e=[];for(let t=0;t<n.sigBytes;t++)e.push(n.words[Math.floor(t/4)]>>8*(3-t%4)&255);return Uint8Array.from(e)},Bc=[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],Le=n=>`\`${n}\``,Dc=n=>`'${n}'`,Os=n=>{const e=typeof n;return e==="string"?Dc(n):e==="undefined"?Le(n):n},Pc=(n,e,t)=>{const r=new Array(t.length);for(let s=0,o=t.length;s<o;s++){const c=t[s];r[s]=Os(c)}const i=r.join(" or ");return`${Le(e)} must be one of ${i}, but was actually ${Os(n)}`},qt=(n,e,t)=>{Array.isArray(t)||(t=xi(t));for(let r=0,i=t.length;r<i;r++)if(n===t[r])return;throw new TypeError(Pc(n,e,t))},mt=(n,e,t)=>{Array.isArray(t)||(t=xi(t)),qt(n,e,t.concat(void 0))},Tc=(n,e,t)=>{Array.isArray(t)||(t=xi(t));for(let r=0,i=n.length;r<i;r++)qt(n[r],e,t)},_c=n=>n===null?"null":n===void 0?"undefined":typeof n=="string"?"string":isNaN(n)?"NaN":typeof n=="number"?"number":typeof n=="boolean"?"boolean":typeof n=="symbol"?"symbol":typeof n=="bigint"?"bigint":n.constructor&&n.constructor.name?n.constructor.name:n.name?n.name:n.constructor?String(n.constructor):String(n),Oc=(n,e)=>e==="null"?n===null:e==="undefined"?n===void 0:e==="string"?typeof n=="string":e==="number"?typeof n=="number"&&!isNaN(n):e==="boolean"?typeof n=="boolean":e==="symbol"?typeof n=="symbol":e==="bigint"?typeof n=="bigint":e===Date?n instanceof Date:e===Array?n instanceof Array:e===Uint8Array?n instanceof Uint8Array:e===ArrayBuffer?n instanceof ArrayBuffer:e===Function?n instanceof Function:n instanceof e[0],Rc=(n,e,t)=>{const r=new Array(t.length);for(let s=0,o=t.length;s<o;s++){const c=t[s];c==="null"&&(r[s]=Le("null")),c==="undefined"&&(r[s]=Le("undefined")),c==="str
2ing"?r[s]=Le("string"):c==="number"?r[s]=Le("number"):c==="boolean"?r[s]=Le("boolean"):c==="symbol"?r[s]=Le("symbol"):c==="bigint"?r[s]=Le("bigint"):c===Array?r[s]=Le("Array"):c===Uint8Array?r[s]=Le("Uint8Array"):c===ArrayBuffer?r[s]=Le("ArrayBuffer"):r[s]=Le(c[1])}const i=r.join(" or ");return`${Le(e)} must be of type ${i}, but was actually of type ${Le(_c(n))}`},A=(n,e,t)=>{for(let r=0,i=t.length;r<i;r++)if(Oc(n,t[r]))return;throw new TypeError(Rc(n,e,t))},H=(n,e,t)=>{A(n,e,t.concat("undefined"))},go=(n,e,t)=>{for(let r=0,i=n.length;r<i;r++)A(n[r],e,t)},xt=(n,e,t,r)=>{if(A(n,e,["number"]),A(t,"min",["number"]),A(r,"max",["number"]),r=Math.max(t,r),n<t||n>r)throw new Error(`${Le(e)} must be at least ${t} and at most ${r}, but was actually ${n}`)},Dt=(n,e,t,r)=>{A(n,e,["number","undefined"]),typeof n=="number"&&xt(n,e,t,r)},xo=(n,e,t)=>{if(A(n,e,["number"]),n%t!==0)throw new Error(`${Le(e)} must be a multiple of ${t}, but was actually ${n}`)},Ec=(n,e)=>{if(!Number.isInteger(n))throw new Error(`${Le(e)} must be an integer, but was actually ${n}`)},pi=(n,e)=>{if(![1,0].includes(Math.sign(n)))throw new Error(`${Le(e)} must be a positive number or 0, but was actually ${n}`)},Ic=(n,e)=>{if(!(n instanceof It))throw new Error(`${Le(e)} must be present and is instance of PDFSecurity`)},ue=new Uint16Array(256);for(let n=0;n<256;n++)ue[n]=n;ue[22]=le("�");ue[24]=le("Ë");ue[25]=le("Ë");ue[26]=le("Ë");ue[27]=le("Ë");ue[28]=le("Ë");ue[29]=le("Ë");ue[30]=le("Ë");ue[31]=le("Ë");ue[127]=le("�");ue[128]=le("â¢");ue[129]=le("â ");ue[130]=le("â¡");ue[131]=le("â¦");ue[132]=le("â");ue[133]=le("â");ue[134]=le("Æ");ue[135]=le("â");ue[136]=le("â¹");ue[137]=le("âº");ue[138]=le("â");ue[139]=le("â°");ue[140]=le("â");ue[141]=le("â");ue[142]=le("â");ue[143]=le("â");ue[144]=le("â");ue[145]=le("â");ue[146]=le("â¢");ue[147]=le("ï¬");ue[148]=le("ï¬");ue[149]=le("Å");ue[150]=le("Å");ue[151]=le("Å ");ue[152]=le("Ÿ");ue[153]=le("Ž");ue[154]=le("ı");ue[155]=le("Å");ue[156]=le("Å");ue[157]=le("Å¡");ue[158]=le("ž");ue[159]=le("�");ue[160]=le("â¬");ue[173]=le("�");const po=n=>{const e=new Array(n.length);for(let t=0,r=n.length;t<r;t++)e[t]=ue[n[t]];return String.fromCodePoint(...e)};class vt{constructor(e){this.populate=e,this.value=void 0}getValue(){return this.value}access(){return this.value||(this.value=this.populate()),this.value}invalidate(){this.value=void 0}}vt.populatedBy=n=>new vt(n);class gt extends Error{constructor(e,t){const r=`Method ${e}.${t}() not implemented`;super(r)}}class Ji extends Error{constructor(e){const t=`Cannot construct ${e} - it has a private constructor`;super(t)}}class ti extends Error{constructor(e,t){const r=o=>{var c,a;return(c=o==null?void 0:o.name)!==null&&c!==void 0?c:(a=o==null?void 0:o.constructor)===null||a===void 0?void 0:a.name},s=`Expected instance of ${(Array.isArray(e)?e.map(r):[r(e)]).join(" or ")}, but got instance of ${t&&r(t)}`;super(s)}}class jc extends Error{constructor(e){const t=`${e} stream encoding not supported`;super(t)}}class Qi extends Error{constructor(e,t){const r=`Cannot call ${e}.${t}() more than once`;super(r)}}class P0 extends Error{constructor(e){const t=`Missing catalog (ref=${e})`;super(t)}}class Mc extends Error{constructor(){super("Can't embed page with missing Contents")}}class Wc extends Error{constructor(e){var t,r,i;const o=`Unrecognized stream type: ${(i=(r=(t=e==null?void 0:e.contructor)===null||t===void 0?void 0:t.name)!==null&&r!==void 0?r:e==null?void 0:e.name)!==null&&i!==void 0?i:e}`;super(o)}}class zc extends Error{constructor(){super("Found mismatched contexts while embedding pages. All pages in the array passed to `PDFDocument.embedPages()` must be from the same document.")}}class Nc extends Error{constructor(e){const t=`Attempted to convert PDFArray with ${e} elements to rectangle, but must have exactly 4 elements.`;super(t)}}class yo extends Error{constructor(e){const t=`Attempted to convert "${e}" to a date, but it does not match the PDF date string format.`;super(t)}}class Rs extends Error{constructor(e,t){const r=`Invalid targetIndex specified: targetIndex=${e} must be less than Count=${t}`;super(r)}}
2class Es extends Error{constructor(e,t){const r=`Failed to ${t} at targetIndex=${e} due to corrupt page tree: It is likely that one or more 'Count' entries are invalid`;super(r)}}class ni extends Error{constructor(e,t,r){const i=`index should be at least ${t} and at most ${r}, but was actually ${e}`;super(i)}}class es extends Error{constructor(){super("Attempted to set invalid field value")}}class Lc extends Error{constructor(){super("Attempted to select multiple values for single-select field")}}class Uc extends Error{constructor(e){const t=`No /DA (default appearance) entry found for field: ${e}`;super(t)}}class Hc extends Error{constructor(e){const t=`No Tf operator found for DA of field: ${e}`;super(t)}}class Is extends Error{constructor(e,t){const r=`Failed to parse number (line:${e.line} col:${e.column} offset=${e.offset}): "${t}"`;super(r)}}class hn extends Error{constructor(e,t){const r=`Failed to parse PDF document (line:${e.line} col:${e.column} offset=${e.offset}): ${t}`;super(r)}}class Kc extends hn{constructor(e,t,r){const i=`Expected next byte to be ${t} but it was actually ${r}`;super(e,i)}}class $c extends hn{constructor(e,t){const r=`Failed to parse PDF object starting with the following byte: ${t}`;super(e,r)}}class Vc extends hn{constructor(e){super(e,"Failed to parse invalid PDF object")}}class Gc extends hn{constructor(e){super(e,"Failed to parse PDF stream")}}class Xc extends hn{constructor(e){super(e,"Failed to parse PDF literal string due to unbalanced parenthesis")}}class qc extends hn{constructor(e){super(e,"Parser stalled")}}class Zc extends hn{constructor(e){super(e,"No PDF header found")}}class Yc extends hn{constructor(e,t){const r=`Did not find expected keyword '${io(t)}'`;super(e,r)}}var f;(function(n){n[n.Null=0]="Null",n[n.Backspace=8]="Backspace",n[n.Tab=9]="Tab",n[n.Newline=10]="Newline",n[n.FormFeed=12]="FormFeed",n[n.CarriageReturn=13]="CarriageReturn",n[n.Space=32]="Space",n[n.ExclamationPoint=33]="ExclamationPoint",n[n.Hash=35]="Hash",n[n.Percent=37]="Percent",n[n.LeftParen=40]="LeftParen",n[n.RightParen=41]="RightParen",n[n.Plus=43]="Plus",n[n.Minus=45]="Minus",n[n.Dash=45]="Dash",n[n.Period=46]="Period",n[n.ForwardSlash=47]="ForwardSlash",n[n.Zero=48]="Zero",n[n.One=49]="One",n[n.Two=50]="Two",n[n.Three=51]="Three",n[n.Four=52]="Four",n[n.Five=53]="Five",n[n.Six=54]="Six",n[n.Seven=55]="Seven",n[n.Eight=56]="Eight",n[n.Nine=57]="Nine",n[n.LessThan=60]="LessThan",n[n.GreaterThan=62]="GreaterThan",n[n.A=65]="A",n[n.D=68]="D",n[n.E=69]="E",n[n.F=70]="F",n[n.O=79]="O",n[n.P=80]="P",n[n.R=82]="R",n[n.LeftSquareBracket=91]="LeftSquareBracket",n[n.BackSlash=92]="BackSlash",n[n.RightSquareBracket=93]="RightSquareBracket",n[n.a=97]="a",n[n.b=98]="b",n[n.d=100]="d",n[n.e=101]="e",n[n.f=102]="f",n[n.i=105]="i",n[n.j=106]="j",n[n.l=108]="l",n[n.m=109]="m",n[n.n=110]="n",n[n.o=111]="o",n[n.r=114]="r",n[n.s=115]="s",n[n.t=116]="t",n[n.u=117]="u",n[n.x=120]="x",n[n.LeftCurly=123]="LeftCurly",n[n.RightCurly=125]="RightCurly",n[n.Tilde=126]="Tilde"})(f||(f={}));class ri{constructor(e,t){this.major=String(e),this.minor=String(t)}getVersion(){return`${this.major}.${this.minor}`}toString(){const e=Nt(129);return`%PDF-${this.major}.${this.minor} 3%${e}${e}${e}${e}`}sizeInBytes(){return 12+this.major.length+this.minor.length}copyBytesInto(e,t){const r=t;return e[t++]=f.Percent,e[t++]=f.P,e[t++]=f.D,e[t++]=f.F,e[t++]=f.Dash,t+=Je(this.major,e,t),e[t++]=f.Period,t+=Je(this.minor,e,t),e[t++]=f.Newline,e[t++]=f.Percent,e[t++]=129,e[t++]=129,e[t++]=129,e[t++]=129,t-r}}ri.forVersion=(n,e)=>new ri(n,e);class it{clone(e){throw new gt(this.constructor.name,"clone")}toString(){throw new gt(this.constructor.name,"toString")}sizeInBytes(){throw new gt(this.constructor.name,"sizeInBytes")}copyBytesInto(e,t){throw new gt(this.constructor.name,"copyBytesInto")}}class ne extends it{constructor(e){super(),this.numberValue=e,this.stringValue=uc(e)}asNumber(){return this.numberValue}value(){return this.numberValue}clone(){return ne.of(this.numberValue)}toString(){return this.stringValue}sizeInBytes(){return this.stringValue.length}copyBytesInto(e,t){return t+=Je(this.stringValue,e,t),this.stringValue.length}}ne.of=n=>new ne(n);class ve extends it{constructor(e){super(),this.array=[],this.context=e}size(){return this.array.length}push(e){this.array.push(e)}insert(e,t){this.array.splice(e,0,t)}indexOf(e){const t=this.array.indexOf(e);return t===-1?void 0:t}remove(e){this.array.splice(e,1)}set(e,t){this.array[e]=t}get(e){return this.array[e]}lookupMaybe(e,...t){return this.context.lookupMaybe(this.get(e),...t)}lookup(e,...t){return this.context.lookup(this.get(e),...t)}asRectangle(){if(this.size()!==4)throw new Nc(this.size());const e=this.lookup(0,ne).asNumber(),t=this.lookup(1,ne).asNumber(),r=this.lookup(2,ne).asNumber(),i=this.lookup(3,ne).asNumber(),s=e,o=t,c=r-e,a=i-t;return{x:s,y:o,width:c,height:a}}asArray(){return this.array.slice()}clone(e){const t=ve.withContext(e||this.context);for(let r=0,i=this.size();r<i;r++)t.push(this.array[r]);return t}toString(){let e="[ ";for(let t=0,r=this.size();t<r;t++)e+=this.get(t).toString(),e+=" ";return e+="]",e}sizeInBytes(){let e=3;for(let t=0,r=this.size();t<r;t++)e+=this.get(t).sizeInBytes()+1;return e}copyBytesInto(e,t){const r=t;e[t++]=f.LeftSquareBracket,e[t++]=f.Space;for(let i=0,s=this.size();i<s;i++)t+=this.get(i).copyBytesInto(e,t),e[t++]=f.Space;return e[t++]=f.RightSquareBracket,t-r}}ve.withContext=n=>new ve(n);const ts={};class Ut extends it{constructor(e,t){if(e!==ts)throw new Ji("PDFBool");super(),this.value=t}asBoolean(){return this.value}clone(){return this}toString(){return String(this.value)}sizeInBytes(){return this.value?4:5}copyBytesInto(e,t){return this.value?(e[t++]=f.t,e[t++]=f.r,e[t++]=f.u,e[t++]=f.e,4):(e[t++]=f.f,e[t++]=f.a,e[t++]=f.l,e[t++]=f.s,e[t++]=f.e,5)}}Ut.True=new Ut(ts,!0);Ut.False=new Ut(ts,!1);class Jc extends it{asNull(){return null}clone(){return this}toString(){return"null"}sizeInBytes(){return 4}copyBytesInto(e,t){return e[t++]=f.n,e[t++]=f.u,e[t++]=f.l,e[t++]=f.l,4}}const dt=new Jc;class ie extends it{constructor(e,t){super(),this.dict=e,this.context=t}keys(){return Array.from(this.dict.keys())}values(){return Array.from(this.dict.values())}entries(){return Array.from(this.dict.entries())}set(e,t){this.dict.set(e,t)}get(e,t=!1){const r=this.dict.get(e);if(!(r===dt&&!t))return r}has(e){const t=this.dict.get(e);return t!==void 0&&t!==dt}lookupMaybe(e,...t){const r=t.includes(dt),i=this.context.lookupMaybe(this.get(e,r),...t);if(!(i===dt&&!r))return i}lookup(e,...t){const r=t.includes(dt),i=this.context.lookup(this.get(e,r),...t);if(!(i===dt&&!r))return i}delete(e){return this.dict.delete(e)}asMap(){return new Map(this.dict)}clone(e){const t=ie.withContext(e||this.context),r=this.entries();for(let i=0,s=r.length;i<s;i++){const[o,c]=r[i];t.set(o,c)}return t}toString(){let e=`<< 4`;const t=this.entries();for(let r=0,i=t.length;r<i;r++){const[s,o]=t[r];e+=s.toString()+" "+o.toString()+` 5`}return e+=">>",e}sizeInBytes(){let e=5;const t=this.entries();for(let r=0,i=t.length;r<i;r++){const[s,o]=t[r];e+=s.sizeInBytes()+o.sizeInBytes()+2}return e}copyBytesInto(e,t){const r=t;e[t++]=f.LessThan,e[t++]=f.LessThan,e[t++]=f.Newline;const i=this.entries();for(let s=0,o=i.length;s<o;s++){const[c,a]=i[s];t+=c.copyBytesInto(e,t),e[t++]=f.Space,t+=a.copyBytesInto(e,t),e[t++]=f.Newline}return e[t++]=f.GreaterThan,e[t++]=f.GreaterThan,t-r}}ie.withContext=n=>
5new ie(new Map,n);ie.fromMapWithContext=(n,e)=>new ie(n,e);class ee extends it{constructor(e){super(),this.value=e}asBytes(){const e=this.value+(this.value.length%2===1?"0":""),t=e.length,r=new Uint8Array(e.length/2);let i=0,s=0;for(;i<t;){const o=parseInt(e.substring(i,i+2),16);r[s]=o,i+=2,s+=1}return r}decodeText(){const e=this.asBytes();return uo(e)?ao(e):po(e)}decodeDate(){const e=this.decodeText(),t=ro(e);if(!t)throw new yo(e);return t}asString(){return this.value}clone(){return ee.of(this.value)}toString(){return`<${this.value}>`}sizeInBytes(){return this.value.length+2}copyBytesInto(e,t){return e[t++]=f.LessThan,t+=Je(this.value,e,t),e[t++]=f.GreaterThan,this.value.length+2}}ee.of=n=>new ee(n);ee.fromText=n=>{const e=cc(n);let t="";for(let r=0,i=e.length;r<i;r++)t+=Pr(e[r],4);return new ee(t)};const Ct=new Uint8Array(256);Ct[f.LeftParen]=1;Ct[f.RightParen]=1;Ct[f.LessThan]=1;Ct[f.GreaterThan]=1;Ct[f.LeftSquareBracket]=1;Ct[f.RightSquareBracket]=1;Ct[f.LeftCurly]=1;Ct[f.RightCurly]=1;Ct[f.ForwardSlash]=1;Ct[f.Percent]=1;const Kt=new Uint8Array(256);Kt[f.Null]=1;Kt[f.Tab]=1;Kt[f.Newline]=1;Kt[f.FormFeed]=1;Kt[f.CarriageReturn]=1;Kt[f.Space]=1;const ns=new Uint8Array(256);for(let n=0,e=256;n<e;n++)ns[n]=Kt[n]||Ct[n]?1:0;ns[f.Hash]=1;const Qc=n=>n.replace(/#([\dABCDEF]{2})/g,(e,t)=>$o(t)),ea=n=>n>=f.ExclamationPoint&&n<=f.Tilde&&!ns[n],mo={},js=new Map;class l extends it{constructor(e,t){if(e!==mo)throw new Ji("PDFName");super();let r="/";for(let i=0,s=t.length;i<s;i++){const o=t[i],c=le(o);r+=ea(c)?o:`#${Tr(c)}`}this.encodedName=r}asBytes(){const e=[];let t="",r=!1;const i=s=>{s!==void 0&&e.push(s),r=!1};for(let s=1,o=this.encodedName.length;s<o;s++){const c=this.encodedName[s],a=le(c),d=this.encodedName[s+1];r?a>=f.Zero&&a<=f.Nine||a>=f.a&&a<=f.f||a>=f.A&&a<=f.F?(t+=c,(t.length===2||!(d>="0"&&d<="9"||d>="a"&&d<="f"||d>="A"&&d<="F"))&&(i(parseInt(t,16)),t="")):i(a):a===f.Hash?r=!0:i(a)}return new Uint8Array(e)}decodeText(){const e=this.asBytes();return String.fromCharCode(...Array.from(e))}asString(){return this.encodedName}value(){return this.encodedName}clone(){return this}toString(){return this.encodedName}sizeInBytes(){return this.encodedName.length}copyBytesInto(e,t){return t+=Je(this.encodedName,e,t),this.encodedName.length}}l.of=n=>{const e=Qc(n);let t=js.get(e);return t||(t=new l(mo,e),js.set(e,t)),t};l.Length=l.of("Length");l.FlateDecode=l.of("FlateDecode");l.Resources=l.of("Resources");l.Font=l.of("Font");l.XObject=l.of("XObject");l.ExtGState=l.of("ExtGState");l.Contents=l.of("Contents");l.Type=l.of("Type");l.Parent=l.of("Parent");l.MediaBox=l.of("MediaBox");l.Page=l.of("Page");l.Annots=l.of("Annots");l.TrimBox=l.of("TrimBox");l.ArtBox=l.of("ArtBox");l.BleedBox=l.of("BleedBox");l.CropBox=l.of("CropBox");l.Rotate=l.of("Rotate");l.Title=l.of("Title");l.Author=l.of("Author");l.Subject=l.of("Subject");l.Creator=l.of("Creator");l.Keywords=l.of("Keywords");l.Producer=l.of("Producer");l.CreationDate=l.of("CreationDate");l.ModDate=l.of("ModDate");class st extends it{constructor(e){super(),this.dict=e}clone(e){throw new gt(this.constructor.name,"clone")}getContentsString(){throw new gt(this.constructor.name,"getContentsString")}getContents(){throw new gt(this.constructor.name,"getContents")}getContentsSize(){throw new gt(this.constructor.name,"getContentsSize")}updateContent(e){throw new gt(this.constructor.name,e.toString())}updateDict(){const e=this.getContentsSize();this.dict.set(l.Length,ne.of(e))}sizeInBytes(){return this.updateDict(),this.dict.sizeInBytes()+this.getContentsSize()+18}toString(){this.updateDict();let e=this.dict.toString();return e+=` 6stream 7`,e+=this.getContentsString(),e+=` 8endstream`,e}copyBytesInto(e,t){this.updateDict();const r=t;t+=this.dict.copyBytesInto(e,t),e[t++]=f.Newline,e[t++]=f.s,e[t++]=f.t,e[t++]=f.r,e[t++]=f.e,e[t++]=f.a,e[t++]=f.m,e[t++]=f.Newline;const i=this.getContents();for(let s=0,o=i.length;s<o;s++)e[t++]=i[s];return e[t++]=f.Newline,e[t++]=f.e,e[t++]=f.n,e[t++]=f.d,e[t++]=f.s,e[t++]=f.t,e[t++]=f.r,e[t++]=f.e,e[t++]=f.a,e[t++]=f.m,t-r}}class Ht extends st{constructor(e,t){super(e),this.contents=t}asUint8Array(){return this.contents.slice()}clone(e){return Ht.of(this.dict.clone(e),this.contents.slice())}getContentsString(){return io(this.contents)}updateContent(e){this.contents=e}getContents(){return this.contents}getContentsSize(){return this.contents.length}}Ht.of=(n,e)=>new Ht(n,e);const bo={},Ms=new Map;class Ce extends it{constructor(e,t,r){if(e!==bo)throw new Ji("PDFRef");super(),this.objectNumber=t,this.generationNumber=r,this.tag=`${t} ${r} R`}clone(){return this}toString(){return this.tag}sizeInBytes(){return this.tag.length}copyBytesInto(e,t){return t+=Je(this.tag,e,t),this.tag.length}}Ce.of=(n,e=0)=>{const t=`${n} ${e} R`;let r=Ms.get(t);return r||(r=new Ce(bo,n,e),Ms.set(t,r)),r};class se{constructor(e,t){this.name=e,this.args=t||[]}clone(e){const t=new Array(this.args.length);for(let r=0,i=t.length;r<i;r++){const s=this.args[r];t[r]=s instanceof it?s.clone(e):s}return se.of(this.name,t)}toString(){let e="";for(let t=0,r=this.args.length;t<r;t++)e+=String(this.args[t])+" ";return e+=this.name,e}sizeInBytes(){let e=0;for(let t=0,r=this.args.length;t<r;t++){const i=this.args[t];e+=(i instanceof it?i.sizeInBytes():i.length)+1}return e+=this.name.length,e}copyBytesInto(e,t){const r=t;for(let i=0,s=this.args.length;i<s;i++){const o=this.args[i];o instanceof it?t+=o.copyBytesInto(e,t):t+=Je(o,e,t),e[t++]=f.Space}return t+=Je(this.name,e,t),t-r}}se.of=(n,e)=>new se(n,e);var he;(function(n){n.NonStrokingColor="sc",n.NonStrokingColorN="scn",n.NonStrokingColorRgb="rg",n.NonStrokingColorGray="g",n.NonStrokingColorCmyk="k",n.NonStrokingColorspace="cs",n.StrokingColor="SC",n.StrokingColorN="SCN",n.StrokingColorRgb="RG",n.StrokingColorGray="G",n.StrokingColorCmyk="K",n.StrokingColorspace="CS",n.BeginMarkedContentSequence="BDC",n.BeginMarkedContent="BMC",n.EndMarkedContent="EMC",n.MarkedContentPointWithProps="DP",n.MarkedContentPoint="MP",n.DrawObject="Do",n.ConcatTransformationMatrix="cm",n.PopGra
8phicsState="Q",n.PushGraphicsState="q",n.SetFlatness="i",n.SetGraphicsStateParams="gs",n.SetLineCapStyle="J",n.SetLineDashPattern="d",n.SetLineJoinStyle="j",n.SetLineMiterLimit="M",n.SetLineWidth="w",n.SetTextMatrix="Tm",n.SetRenderingIntent="ri",n.AppendRectangle="re",n.BeginInlineImage="BI",n.BeginInlineImageData="ID",n.EndInlineImage="EI",n.ClipEvenOdd="W*",n.ClipNonZero="W",n.CloseAndStroke="s",n.CloseFillEvenOddAndStroke="b*",n.CloseFillNonZeroAndStroke="b",n.ClosePath="h",n.AppendBezierCurve="c",n.CurveToReplicateFinalPoint="y",n.CurveToReplicateInitialPoint="v",n.EndPath="n",n.FillEvenOddAndStroke="B*",n.FillEvenOdd="f*",n.FillNonZeroAndStroke="B",n.FillNonZero="f",n.LegacyFillNonZero="F",n.LineTo="l",n.MoveTo="m",n.ShadingFill="sh",n.StrokePath="S",n.BeginText="BT",n.EndText="ET",n.MoveText="Td",n.MoveTextSetLeading="TD",n.NextLine="T*",n.SetCharacterSpacing="Tc",n.SetFontAndSize="Tf",n.SetTextHorizontalScaling="Tz",n.SetTextLineHeight="TL",n.SetTextRenderingMode="Tr",n.SetTextRise="Ts",n.SetWordSpacing="Tw",n.ShowText="Tj",n.ShowTextAdjusted="TJ",n.ShowTextLine="'",n.ShowTextLineAndSpace='"',n.Type3D0="d0",n.Type3D1="d1",n.BeginCompatibilitySection="BX",n.EndCompatibilitySection="EX"})(he||(he={}));class rs extends st{constructor(e,t){super(e),this.computeContents=()=>{const r=this.getUnencodedContents();return this.encode?Js.deflate(r):r},this.encode=t,t&&e.set(l.of("Filter"),l.of("FlateDecode")),this.contentsCache=vt.populatedBy(this.computeContents)}getContents(){return this.contentsCache.access()}getContentsSize(){return this.contentsCache.access().length}updateContent(e){this.contentsCache=vt.populatedBy(()=>e)}getUnencodedContents(){throw new gt(this.constructor.name,"getUnencodedContents")}}class Lt extends rs{constructor(e,t,r=!0){super(e,r),this.operators=t}push(...e){this.operators.push(...e)}clone(e){const t=new Array(this.operators.length);for(let s=0,o=this.operators.length;s<o;s++)t[s]=this.operators[s].clone(e);const{dict:r,encode:i}=this;return Lt.of(r.clone(e),t,i)}getContentsString(){let e="";for(let t=0,r=this.operators.length;t<r;t++)e+=`${this.operators[t]} 9`;return e}getUnencodedContents(){const e=new Uint8Array(this.getUnencodedContentsSize());let t=0;for(let r=0,i=this.operators.length;r<i;r++)t+=this.operators[r].copyBytesInto(e,t),e[t++]=f.Newline;return e}getUnencodedContentsSize(){let e=0;for(let t=0,r=this.operators.length;t<r;t++)e+=this.operators[t].sizeInBytes()+1;return e}}Lt.of=(n,e,t=!0)=>new Lt(n,e,t);const ta=([n],[e])=>n.objectNumber-e.objectNumber;class Ar{constructor(){this.largestObjectNumber=0,this.header=ri.forVersion(1,7),this.trailerInfo={},this.indirectObjects=new Map}getSecurity(){return this._security}setSecurity(e){Ic(e,"PDFSecurity Instance"),this._security=e}assign(e,t){this.indirectObjects.set(e,t),e.objectNumber>this.largestObjectNumber&&(this.largestObjectNumber=e.objectNumber)}nextRef(){return this.largestObjectNumber+=1,Ce.of(this.largestObjectNumber)}register(e){const t=this.nextRef();return this.assign(t,e),t}delete(e){return this.indirectObjects.delete(e)}lookupMaybe(e,...t){const r=t.includes(dt),i=e instanceof Ce?this.indirectObjects.get(e):e;if(!(!i||i===dt&&!r)){for(let s=0,o=t.length;s<o;s++){const c=t[s];if(c===dt){if(i===dt)return i}else if(i instanceof c)return i}throw new ti(t,i)}}lookup(e,...t){const r=e instanceof Ce?this.indirectObjects.get(e):e;if(t.length===0)return r;for(let i=0,s=t.length;i<s;i++){const o=t[i];if(o===dt){if(r===dt)return r}else if(r instanceof o)return r}throw new ti(t,r)}getObjectRef(e){const t=Array.from(this.indirectObjects.entries());for(let r=0,i=t.length;r<i;r++){const[s,o]=t[r];if(o===e)return s}}enumerateIndirectObjects(){return Array.from(this.indirectObjects.entries()).sort(ta)}obj(e){if(e instanceof it)return e;if(e==null)return dt;if(typeof e=="string")return l.of(e);if(typeof e=="number")return ne.of(e);if(typeof e=="boolean")return e?Ut.True:Ut.False;if(e instanceof Uint8Array)return ee.of(oc(e));if(Array.isArray(e)){const t=ve.withContext(this);for(let r=0,i=e.length;r<i;r++)t.push(this.obj(e[r]));return t}else{const t=ie.withContext(this),r=Object.keys(e);for(let i=0,s=r.length;i<s;i++){const o=r[i],c=e[o];c!==void 0&&t.set(l.of(o),this.obj(c))}return t}}stream(e,t={}){return Ht.of(this.obj(t),ji(e))}flateStream(e,t={}
9){return this.stream(Js.deflate(ji(e)),Object.assign(Object.assign({},t),{Filter:"FlateDecode"}))}contentStream(e,t={}){return Lt.of(this.obj(t),e)}formXObject(e,t={}){return this.contentStream(e,Object.assign(Object.assign({BBox:this.obj([0,0,0,0]),Matrix:this.obj([1,0,0,1,0,0])},t),{Type:"XObject",Subtype:"Form"}))}getPushGraphicsStateContentStream(){if(this.pushGraphicsStateContentStreamRef)return this.pushGraphicsStateContentStreamRef;const e=this.obj({}),t=se.of(he.PushGraphicsState),r=Lt.of(e,[t]);return this.pushGraphicsStateContentStreamRef=this.register(r),this.pushGraphicsStateContentStreamRef}getPopGraphicsStateContentStream(){if(this.popGraphicsStateContentStreamRef)return this.popGraphicsStateContentStreamRef;const e=this.obj({}),t=se.of(he.PopGraphicsState),r=Lt.of(e,[t]);return this.popGraphicsStateContentStreamRef=this.register(r),this.popGraphicsStateContentStreamRef}}Ar.create=()=>new Ar;class tt extends ie{constructor(e,t,r=!0){super(e,t),this.normalized=!1,this.autoNormalizeCTM=r}clone(e){const t=tt.fromMapWithContext(new Map,e||this.context,this.autoNormalizeCTM),r=this.entries();for(let i=0,s=r.length;i<s;i++){const[o,c]=r[i];t.set(o,c)}return t}Parent(){return this.lookupMaybe(l.Parent,ie)}Contents(){return this.lookup(l.of("Contents"))}Annots(){return this.lookupMaybe(l.Annots,ve)}BleedBox(){return this.lookupMaybe(l.BleedBox,ve)}TrimBox(){return this.lookupMaybe(l.TrimBox,ve)}ArtBox(){return this.lookupMaybe(l.ArtBox,ve)}Resources(){const e=this.getInheritableAttribute(l.Resources);return this.context.lookupMaybe(e,ie)}MediaBox(){const e=this.getInheritableAttribute(l.MediaBox);return this.context.lookup(e,ve)}CropBox(){const e=this.getInheritableAttribute(l.CropBox);return this.context.lookupMaybe(e,ve)}Rotate(){const e=this.getInheritableAttribute(l.Rotate);return this.context.lookupMaybe(e,ne)}getInheritableAttribute(e){let t;return this.ascend(r=>{t||(t=r.get(e))}),t}setParent(e){this.set(l.Parent,e)}addContentStream(e){const t=this.normalizedEntries().Contents||this.context.obj([]);this.set(l.Contents,t),t.push(e)}wrapContentStreams(e,t){const r=this.Contents();return r instanceof ve?(r.insert(0,e),r.push(t),!0):!1}addAnnot(e){const{Annots:t}=this.normalizedEntries();t.push(e)}removeAnnot(e){const{Annots:t}=this.normalizedEntries(),r=t.indexOf(e);r!==void 0&&t.remove(r)}setFontDictionary(e,t){const{Font:r}=this.normalizedEntries();r.set(e,t)}setXObject(e,t){const{XObject:r}=this.normalizedEntries();r.set(e,t)}setExtGState(e,t){const{ExtGState:r}=this.normalizedEntries();r.set(e,t)}ascend(e){e(this);const t=this.Parent();t&&t.ascend(e)}normalize(){if(this.normalized)return;const{context:e}=this,t=this.get(l.Contents);this.context.lookup(t)instanceof st&&this.set(l.Contents,e.obj([t])),this.autoNormalizeCTM&&this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(),this.context.getPopGraphicsStateContentStream());const i=this.getInheritableAttribute(l.Resources),s=e.lookupMaybe(i,ie)||e.obj({});this.set(l.Resources,s);const o=s.lookupMaybe(l.Font,ie)||e.obj({});s.set(l.Font,o);const c=s.lookupMaybe(l.XObject,ie)||e.obj({});s.set(l.XObject,c);const a=s.lookupMaybe(l.ExtGState,ie)||e.obj({});s.set(l.ExtGState,a);const d=this.Annots()||e.obj([]);this.set(l.Annots,d),this.normalized=!0}normalizedEntries(){this.normalize();const e=this.Annots(),t=this.Resources(),r=this.Contents();return{Annots:e,Resources:t,Contents:r,Font:t.lookup(l.Font,ie),XObject:t.lookup(l.XObject,ie),ExtGState:t.lookup(l.ExtGState,ie)}}}tt.InheritableEntries=["Resources","MediaBox","CropBox","Rotate"];tt.withContextAndParent=(n,e)=>{const t=new Map;return t.set(l.Type,l.Page),t.set(l.Parent,e),t.set(l.Resources,n.obj({})),t.set(l.MediaBox,n.obj([0,0,612,792])),new tt(t,n,!1)};tt.fromMapWithContext=(n,e,t=!0)=>new tt(n,e,t);class ii{constructor(e,t){this.traversedObjects=new Map,this.copy=r=>r instanceof tt?this.copyPDFPage(r):r instanceof ie?this.copyPDFDict(r):r instanceof ve?this.copyPDFArray(r):r instanceof st?this.copyPDFStream(r):r instanceof Ce?this.copyPDFIndirectObject(r):r.clone(),this.copyPDFPage=r=>{const i=r.clone(),{InheritableEntries:s}=tt;for(let o=0,c=s.length;o<c;o++){const a=l.of(s[o]),d=i.getInheritableAttribute(a);!i.get(a)&&d&&i.set(a,d)}return i.delete(l.of("Parent")),this.copyPDFDict(i)},this.copyPDFDict=r=>{if(this.traversedObjects.has(r))return this.traversedObjects.get(r);const i=r.clone(this.dest);this.traversedObjects.set(r,i);const s=r.entries();for(let o=0,c=s.length;o<c;o++){const[a,d]=s[o];i.set(a,this.copy(d))}return i},this.copyPDFArray=r=>{if(this.traversedObjects.has(r))return this.traversedObjects.get(r);const i=r.clone(this.dest);this.traversedObjects.set(r,i);for(let s=0,o=r.size();s<o;s++){const c=r.get(s);i.set(s,this.copy(c))}return i},this.copyPDFStream=r=>{if(this.traversedObjects.has(r))return this.traversedObjects.get(r);const i=r.clone(this.dest);this.traversedObjects.set(r,i);const s=r.dict.entries();for(let o=0,c=s.length;o<c;o++){const[a,d]=s[o];i.dict.set(a,this.copy(d))}return i},this.copyPDFIndirectObject=r=>{if(!this.traversedObjects.has(r)){const s=this.dest.nextRef();this.traversedObjects.set(r,s);const o=this.src.lookup(r);if(o){const c=this.copy(o);this.dest.assign(s,c)}}return this.traversedObjects.get(r)},this.src=e,this.dest=t}}ii.for=(n,e)=>new ii(n,e);class Hn{constructor(e){this.subsections=e?[[e]]:[],this.chunkIdx=0,this.chunkLe
9ngth=e?1:0}addEntry(e,t){this.append({ref:e,offset:t,deleted:!1})}addDeletedEntry(e,t){this.append({ref:e,offset:t,deleted:!0})}toString(){let e=`xref 10`;for(let t=0,r=this.subsections.length;t<r;t++){const i=this.subsections[t];e+=`${i[0].ref.objectNumber} ${i.length} 11`;for(let s=0,o=i.length;s<o;s++){const c=i[s];e+=Tt(String(c.offset),10,"0"),e+=" ",e+=Tt(String(c.ref.generationNumber),5,"0"),e+=" ",e+=c.deleted?"f":"n",e+=` 12`}}return e}sizeInBytes(){let e=5;for(let t=0,r=this.subsections.length;t<r;t++){const i=this.subsections[t],s=i.length,[o]=i;e+=2,e+=String(o.ref.objectNumber).length,e+=String(s).length,e+=20*s}return e}copyBytesInto(e,t){const r=t;return e[t++]=f.x,e[t++]=f.r,e[t++]=f.e,e[t++]=f.f,e[t++]=f.Newline,t+=this.copySubsectionsIntoBuffer(this.subsections,e,t),t-r}copySubsectionsIntoBuffer(e,t,r){const i=r,s=e.length;for(let o=0;o<s;o++){const c=this.subsections[o],a=String(c[0].ref.objectNumber);r+=Je(a,t,r),t[r++]=f.Space;const d=String(c.length);r+=Je(d,t,r),t[r++]=f.Newline,r+=this.copyEntriesIntoBuffer(c,t,r)}return r-i}copyEntriesIntoBuffer(e,t,r){const i=e.length;for(let s=0;s<i;s++){const o=e[s],c=Tt(String(o.offset),10,"0");r+=Je(c,t,r),t[r++]=f.Space;const a=Tt(String(o.ref.generationNumber),5,"0");r+=Je(a,t,r),t[r++]=f.Space,t[r++]=o.deleted?f.f:f.n,t[r++]=f.Space,t[r++]=f.Newline}return 20*i}append(e){if(this.chunkLength===0){this.subsections.push([e]),this.chunkIdx=0,this.chunkLength=1;return}const t=this.subsections[this.chunkIdx],r=t[this.chunkLength-1];e.ref.objectNumber-r.ref.objectNumber>1?(this.subsections.push([e]),this.chunkIdx+=1,this.chunkLength=1):(t.push(e),this.chunkLength+=1)}}Hn.create=()=>new Hn({ref:Ce.of(0,65535),offset:0,deleted:!0});Hn.createEmpty=()=>new Hn;class Cr{constructor(e){this.lastXRefOffset=String(e)}toString(){return`startxref 13${this.lastXRefOffset} 14%%EOF`}sizeInBytes(){return 16+this.lastXRefOffset.length}copyBytesInto(e,t){const r=t;return e[t++]=f.s,e[t++]=f.t,e[t++]=f.a,e[t++]=f.r,e[t++]=f.t,e[t++]=f.x,e[t++]=f.r,e[t++]=f.e,e[t++]=f.f,e[t++]=f.Newline,t+=Je(this.lastXRefOffset,e,t),e[t++]=f.Newline,e[t++]=f.Percent,e[t++]=f.Percent,e[t++]=f.E,e[t++]=f.O,e[t++]=f.F,t-r}}Cr.forLastCrossRefSectionOffset=n=>new Cr(n);class Mi{constructor(e){this.dict=e}toString(){return`trailer 15${this.dict.toString()}`}sizeInBytes(){return 8+this.dict.sizeInBytes()}copyBytesInto(e,t){const r=t;return e[t++]=f.t,e[t++]=f.r,e[t++]=f.a,e[t++]=f.i,e[t++]=f.l,e[t++]=f.e,e[t++]=f.r,e[t++]=f.Newline,t+=this.dict.copyBytesInto(e,t),t-r}}Mi.of=n=>new Mi(n);class Kn extends rs{constructor(e,t,r=!0){super(e.obj({}),r),this.objects=t,this.offsets=this.computeObjectOffsets(),this.offsetsString=this.computeOffsetsString(),this.dict.set(l.of("Type"),l.of("ObjStm")),this.dict.set(l.of("N"),ne.of(this.objects.length)),this.dict.set(l.of("First"),ne.of(this.offsetsString.length))}getObjectsCount(){return this.objects.length}clone(e){return Kn.withContextAndObjects(e||this.dict.context,this.objects.slice(),this.encode)}getContentsString(){let e=this.offsetsString;for(let t=0,r=this.objects.length;t<r;t++){const[,i]=this.objects[t];e+=`${i} 16`}return e}getUnencodedContents(){const e=new Uint8Array(this.getUnencodedContentsSize());let t=Je(this.offsetsString,e,0);for(let r=0,i=this.objects.length;r<i;r++){const[,s]=this.objects[r];t+=s.copyBytesInto(e,t),e[t++]=f.Newline}return e}getUnencodedContentsSize(){return this.offsetsString.length+Qr(this.offsets)[1]+Qr(this.objects)[1].sizeInBytes()+1}computeOffsetsString(){let e="";for(let t=0,r=this.offsets.length;t<r;t++){const[i,s]=this.offsets[t];e+=`${i} ${s} `}return e}computeObjectOffsets(){let e=0;const t=new Array(this.objects.length);for(let r=0,i=this.objects.length;r<i;r++){const[s,o]=this.objects[r];t[r]=[s.objectNumber,e],e+=o.sizeInBytes()+1}return t}}Kn.withContextAndObjects=(n,e,t=!0)=>new Kn(n,e,t);class si{constructor(e,t){this.parsedObjects=0,this.shouldWaitForTick=r=>(this.parsedObjects+=r,this.parsedObjects%this.objectsPerTick===0),this.context=e,this.objectsPerTick=t}serializeToBuffer(){return fe(this,void 0,void 0,function*(){const{size:e,header:t,indirectObjects:r,xref:i,trailerDict:s,trailer:o}=yield this.computeBufferSize();let c=0;const a=new Uint8Array(e);c+=t.copyBytesInto(a,c),a[c++]=f.Newline,a[c++]=f.Newline;for(let d=0,p=r.length;d<p;d++){const[C,v]=r[d],T=String(C.objectNumber);c+=Je(T,a,c),a[c++]=f.Space;const j=String(C.generationNumber);c+=Je(j,a,c),a[c++]=f.Space,a[c++]=f.o,a[c++]=f.b,a[c++]=f.j,a[c++]=f.Newline,c+=v.copyBytesInto(a,c),a[c++]=f.Newline,a[c++]=f.e,a[c++]=f.n,a[c++]=f.d,a[c++]=f.o,a[c++]=f.b,a[c++]=f.j,a[c++]=f.Newline,a[c++]=f.Newline;const N=v instanceof Kn?v.getObjectsCount():1;this.shouldWaitForTick(N)&&(yield Un())}return i&&(c+=i.copyBytesInto(a,c),a[c++]=f.Newline),s&&(c+=s.copyBytesInto(a,c),a[c++]=f.Newline,a[c++]=f.Newline),c+=o.copyBytesInto(a,c),a})}computeIndirectObjectSize([e,t]){const r=e.sizeInBytes()+3,i=t.sizeInBytes()+9;return r+i}createTrailerDict(){return this.context.obj({Size:this.context.largestObjectNumber+1,Root:this.context.trailerInfo.Root,Encrypt:this.context.trailerInfo.Encrypt,Info:this.context.trailerInfo.Info,ID:this.context.trailerInfo.ID})}computeBufferSize(){return fe(this,void 0,void 0,function*(){const e=this.context.header;let t=e.sizeInBytes()+2;const r=Hn.create(),i=this.context.getSecurity(),s=this.context.enumerateIndirectObjects();for(let d=0,p=s.length;d<p;d++){const C=s[d],[v,T]=C;
16r.addEntry(v,t),i&&T instanceof st&&this.encrypt(v,T,i),t+=this.computeIndirectObjectSize(C),this.shouldWaitForTick(1)&&(yield Un())}const o=t;t+=r.sizeInBytes()+1;const c=Mi.of(this.createTrailerDict());t+=c.sizeInBytes()+2;const a=Cr.forLastCrossRefSectionOffset(o);return t+=a.sizeInBytes(),{size:t,header:e,indirectObjects:s,xref:r,trailerDict:c,trailer:a}})}encrypt(e,t,r){const i=r.getEncryptFn(e.objectNumber,e.generationNumber);let s=t.getContents();i&&(s=new Uint8Array(i(s)),t.updateContent(s))}}si.forContext=(n,e)=>new si(n,e);class $n extends it{constructor(e){super(),this.data=e}clone(){return $n.of(this.data.slice())}toString(){return`PDFInvalidObject(${this.data.length} bytes)`}sizeInBytes(){return this.data.length}copyBytesInto(e,t){const r=this.data.length;for(let i=0;i<r;i++)e[t++]=this.data[i];return r}}$n.of=n=>new $n(n);var Xt;(function(n){n[n.Deleted=0]="Deleted",n[n.Uncompressed=1]="Uncompressed",n[n.Compressed=2]="Compressed"})(Xt||(Xt={}));class Sn extends rs{constructor(e,t,r=!0){super(e,r),this.computeIndex=()=>{const i=[];let s=0;for(let o=0,c=this.entries.length;o<c;o++){const a=this.entries[o],d=this.entries[o-1];o===0?i.push(a.ref.objectNumber):a.ref.objectNumber-d.ref.objectNumber>1&&(i.push(s),i.push(a.ref.objectNumber),s=0),s+=1}return i.push(s),i},this.computeEntryTuples=()=>{const i=new Array(this.entries.length);for(let s=0,o=this.entries.length;s<o;s++){const c=this.entries[s];if(c.type===Xt.Deleted){const{type:a,nextFreeObjectNumber:d,ref:p}=c;i[s]=[a,d,p.generationNumber]}if(c.type===Xt.Uncompressed){const{type:a,offset:d,ref:p}=c;i[s]=[a,d,p.generationNumber]}if(c.type===Xt.Compressed){const{type:a,objectStreamRef:d,index:p}=c;i[s]=[a,d.objectNumber,p]}}return i},this.computeMaxEntryByteWidths=()=>{const i=this.entryTuplesCache.access(),s=[0,0,0];for(let o=0,c=i.length;o<c;o++){const[a,d,p]=i[o],C=Zr(a),v=Zr(d),T=Zr(p);C>s[0]&&(s[0]=C),v>s[1]&&(s[1]=v),T>s[2]&&(s[2]=T)}return s},this.entries=t||[],this.entryTuplesCache=vt.populatedBy(this.computeEntryTuples),this.maxByteWidthsCache=vt.populatedBy(this.computeMaxEntryByteWidths),this.indexCache=vt.populatedBy(this.computeIndex),e.set(l.of("Type"),l.of("XRef"))}addDeletedEntry(e,t){const r=Xt.Deleted;this.entries.push({type:r,ref:e,nextFreeObjectNumber:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}addUncompressedEntry(e,t){const r=Xt.Uncompressed;this.entries.push({type:r,ref:e,offset:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}addCompressedEntry(e,t,r){const i=Xt.Compressed;this.entries.push({type:i,ref:e,objectStreamRef:t,index:r}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}clone(e){const{dict:t,entries:r,encode:i}=this;return Sn.of(t.clone(e),r.slice(),i)}getContentsString(){const e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access();let r="";for(let i=0,s=e.length;i<s;i++){const[o,c,a]=e[i],d=_n(On(o)),p=_n(On(c)),C=_n(On(a));for(let v=t[0]-1;v>=0;v--)r+=(d[v]||0).toString(2);for(let v=t[1]-1;v>=0;v--)r+=(p[v]||0).toString(2);for(let v=t[2]-1;v>=0;v--)r+=(C[v]||0).toString(2)}return r}getUnencodedContents(){const e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access(),r=new Uint8Array(this.getUnencodedContentsSize());let i=0;for(let s=0,o=e.length;s<o;s++){const[c,a,d]=e[s],p=_n(On(c)),C=_n(On(a)),v=_n(On(d));for(let T=t[0]-1;T>=0;T--)r[i++]=p[T]||0;for(let T=t[1]-1;T>=0;T--)r[i++]=C[T]||0;for(let T=t[2]-1;T>=0;T--)r[i++]=v[T]||0}return r}getUnencodedContentsSize(){const e=this.maxByteWidthsCache.access();return nc(e)*this.entries.length}updateDict(){super.updateDict();const e=this.maxByteWidthsCache.access(),t=this.indexCache.access(),{context:r}=this.dict;this.dict.set(l.of("W"),r.obj(e)),this.dict.set(l.of("Index"),r.obj(t))}}Sn.create=(n,e=!0)=>{const t=new Sn(n,[],e);return t.addDeletedEntry(Ce.of(0,65535),0),t};Sn.of=(n,e,t=!0)=>new Sn(n,e,t);
16class Wi extends si{constructor(e,t,r,i){super(e,t),this.encodeStreams=r,this.objectsPerStream=i}computeBufferSize(){return fe(this,void 0,void 0,function*(){let e=this.context.largestObjectNumber+1;const t=this.context.header;let r=t.sizeInBytes()+2;const i=Sn.create(this.createTrailerDict(),this.encodeStreams),s=[],o=[],c=[],a=this.context.getSecurity(),d=this.context.enumerateIndirectObjects();for(let T=0,j=d.length;T<j;T++){const N=d[T],[K,G]=N;if(K===this.context.trailerInfo.Encrypt||G instanceof st||G instanceof $n||K.generationNumber!==0)s.push(N),a&&G instanceof st&&this.encrypt(K,G,a),i.addUncompressedEntry(K,r),r+=this.computeIndirectObjectSize(N),this.shouldWaitForTick(1)&&(yield Un());else{let X=Qr(o),q=Qr(c);(!X||X.length%this.objectsPerStream===0)&&(X=[],o.push(X),q=Ce.of(e++),c.push(q)),i.addCompressedEntry(K,q,X.length),X.push(N)}}for(let T=0,j=o.length;T<j;T++){const N=o[T],K=c[T],G=Kn.withContextAndObjects(this.context,N,this.encodeStreams);a&&this.encrypt(K,G,a),i.addUncompressedEntry(K,r),r+=this.computeIndirectObjectSize([K,G]),s.push([K,G]),this.shouldWaitForTick(N.length)&&(yield Un())}const p=Ce.of(e++);i.dict.set(l.of("Size"),ne.of(e)),i.addUncompressedEntry(p,r);const C=r;r+=this.computeIndirectObjectSize([p,i]),s.push([p,i]);const v=Cr.forLastCrossRefSectionOffset(C);return r+=v.sizeInBytes(),{size:r,header:t,indirectObjects:s,trailer:v}})}}Wi.forContext=(n,e,t=!0,r=50)=>new Wi(n,e,t,r);class Vn{constructor(e,t){this.encoding=e===Ii.ZapfDingbats?Ur.ZapfDingbats:e===Ii.Symbol?Ur.Symbol:Ur.WinAnsi,this.font=zo.load(e),this.fontName=this.font.FontName,this.customName=t}encodeText(e){const t=this.encodeTextAsGlyphs(e),r=new Array(t.length);for(let i=0,s=t.length;i<s;i++)r[i]=Tr(t[i].code);return ee.of(r.join(""))}widthOfTextAtSize(e,t){const r=this.encodeTextAsGlyphs(e);let i=0;for(let o=0,c=r.length;o<c;o++){const a=r[o].name,d=(r[o+1]||{}).name,p=this.font.getXAxisKerningForPair(a,d)||0;i+=this.widthOfGlyph(a)+p}const s=t/1e3;return i*s}heightOfFontAtSize(e,t={}){const{descender:r=!0}=t,{Ascender:i,Descender:s,FontBBox:o}=this.font,c=i||o[3],a=s||o[1];let d=c-a;return r||(d+=s||0),d/1e3*e}sizeOfFontAtHeight(e){const{Ascender:t,Descender:r,FontBBox:i}=this.font,s=t||i[3],o=r||i[1];return 1e3*e/(s-o)}embedIntoContext(e,t){const r=e.obj({Type:"Font",Subtype:"Type1",BaseFont:this.customName||this.fontName,Encoding:this.encoding===Ur.WinAnsi?"WinAnsiEncoding":void 0});return t?(e.assign(t,r),t):e.register(r)}widthOfGlyph(e){return this.font.getWidthOfGlyph(e)||250}encodeTextAsGlyphs(e){const t=Array.from(e),r=new Array(t.length);for(let i=0,s=t.length;i<s;i++){const o=Ko(t[i]);r[i]=this.encoding.encodeUnicodeCodePoint(o)}return r}}Vn.for=(n,e)=>new Vn(n,e);const na=(n,e)=>{const t=new Array(n.length);for(let r=0,i=n.length;r<i;r++){const s=n[r],o=Ws(Jr(e(s))),c=Ws(...s.codePoints.map(ia));t[r]=[o,c]}return ra(t)},ra=n=>`/CIDInit /ProcSet findresource begin 1712 dict begin 18begincmap 19/CIDSystemInfo << 20 /Registry (Adobe) 21 /Ordering (UCS) 22 /Supplement 0 23>> def 24/CMapName /Adobe-Identity-UCS def 25/CMapType 2 def 261 begincodespacerange 27<0000><ffff> 28endcodespacerange 29${n.length} beginbfchar 30${n.map(([e,t])=>`${e} ${t}`).join(` 31`)} 32endbfchar 33endcmap 34CMapName currentdict /CMap defineresource pop 35end 36end`,Ws=(...n)=>`<${n.join("")}>`,Jr=n=>Pr(n,4),ia=n=>{if(ac(n))return Jr(n);if(lc(n)){const r=oo(n),i=co(n);return`${Jr(r)}${Jr(i)}`}const t=`0x${Tr(n)} is not a valid UTF-8 or UTF-16 codepoint.`;throw new Error(t)},sa=n=>{let e=0;const t=r=>{e|=1<<r-1};return n.fixedPitch&&t(1),n.serif&&t(2),t(3),n.script&&t(4),n.nonsymbolic&&t(6),n.italic&&t(7),n.allCap&&t(17),n.smallCap&&t(18),n.forceBold&&t(19),e},oa=n=>{const e=n["OS/2"]?n["OS/2"].sFamilyClass:0;return sa({fixedPitch:n.post.isFixedPitch,serif:1<=e&&e<=7,script:e===10,italic:n.head.macStyle.italic})};class me extends it{constructor(e){super(),this.value=e}asBytes(){const e=[];let t="",r=!1;const i=s=>{s!==void 0&&e.push(s),r=!1};for(let s=0,o=this.value.length;s<o;s++){const c=this.value[s],a=le(c),d=this.value[s+1];r?a===f.Newline||a===f.CarriageReturn?i():a===f.n?i(f.Newline):a===f.r?i(f.CarriageReturn):a===f.t?i(f.Tab):a===f.b?i(f.Backspace):a===f.f?i(f.FormFeed):a===f.LeftParen?i(f.LeftParen):a===f.RightParen?i(f.RightParen):a===f.Backspace?i(f.BackSlash):a>=f.Zero&&a<=f.Seven?(t+=c,(t.length===3||!(d>="0"&&d<="7"))&&(i(parseInt(t,8)),t="")):i(a):a===f.BackSlash?r=!0:i(a)}return new Uint8Array(e)}decodeText(){const e=this.asBytes();return uo(e)?ao(e):po(e)}decodeDate(){const e=this.decodeText(),t=ro(e);if(!t)throw new yo(e);return t}asString(){return this.value}clone(){return me.of(this.value)}toString(){return`(${this.value})`}sizeInBytes(){return this.value.length+2}copyBytesInto(e,t){return e[t++]=f.LeftParen,t+=Je(this.value,e,t),e[t++]=f.RightParen,this.value.length+2}}me.of=n=>new me(n);me.fromDate=n=>{const e=Tt(String(n.getUTCFullYear()),4,"0"),t=Tt(String(n.getUTCMonth()+1),2,"0"),r=Tt(String(n.getUTCDate()),2,"0"),i=Tt(String(n.getUTCHours()),2,"0"),s=Tt(String(n.getUTCMinutes()),2,"0"),o=Tt(String(n.getUTCSeconds()),2,"0");return new me(`D:${e}${t}${r}${i}${s}${o}Z`)};
36class Rr{constructor(e,t,r,i){this.allGlyphsInFontSortedById=()=>{const s=new Array(this.font.characterSet.length);for(let o=0,c=s.length;o<c;o++){const a=this.font.characterSet[o];s[o]=this.font.glyphForCodePoint(a)}return tc(s.sort(ec),o=>o.id)},this.font=e,this.scale=1e3/this.font.unitsPerEm,this.fontData=t,this.fontName=this.font.postscriptName||"Font",this.customName=r,this.fontFeatures=i,this.baseFontName="",this.glyphCache=vt.populatedBy(this.allGlyphsInFontSortedById)}static for(e,t,r,i){return fe(this,void 0,void 0,function*(){const s=yield e.create(t);return new Rr(s,t,r,i)})}encodeText(e){const{glyphs:t}=this.font.layout(e,this.fontFeatures),r=new Array(t.length);for(let i=0,s=t.length;i<s;i++)r[i]=Pr(t[i].id,4);return ee.of(r.join(""))}widthOfTextAtSize(e,t){const{glyphs:r}=this.font.layout(e,this.fontFeatures);let i=0;for(let o=0,c=r.length;o<c;o++)i+=r[o].advanceWidth*this.scale;const s=t/1e3;return i*s}heightOfFontAtSize(e,t={}){const{descender:r=!0}=t,{ascent:i,descent:s,bbox:o}=this.font,c=(i||o.maxY)*this.scale,a=(s||o.minY)*this.scale;let d=c-a;return r||(d-=Math.abs(s)||0),d/1e3*e}sizeOfFontAtHeight(e){const{ascent:t,descent:r,bbox:i}=this.font,s=(t||i.maxY)*this.scale,o=(r||i.minY)*this.scale;return 1e3*e/(s-o)}embedIntoContext(e,t){return this.baseFontName=this.customName||mn(this.fontName),this.embedFontDict(e,t)}embedFontDict(e,t){return fe(this,void 0,void 0,function*(){const r=yield this.embedCIDFontDict(e),i=this.embedUnicodeCmap(e),s=e.obj({Type:"Font",Subtype:"Type0",BaseFont:this.baseFontName,Encoding:"Identity-H",DescendantFonts:[r],ToUnicode:i});return t?(e.assign(t,s),t):e.register(s)})}isCFF(){return this.font.cff}embedCIDFontDict(e){return fe(this,void 0,void 0,function*(){const t=yield this.embedFontDescriptor(e),r=e.obj({Type:"Font",Subtype:this.isCFF()?"CIDFontType0":"CIDFontType2",CIDToGIDMap:"Identity",BaseFont:this.baseFontName,CIDSystemInfo:{Registry:me.of("Adobe"),Ordering:me.of("Identity"),Supplement:0},FontDescriptor:t,W:this.computeWidths()});return e.register(r)})}embedFontDescriptor(e){return fe(this,void 0,void 0,function*(){const t=yield this.embedFontStream(e),{scale:r}=this,{italicAngle:i,ascent:s,descent:o,capHeight:c,xHeight:a}=this.font,{minX:d,minY:p,maxX:C,maxY:v}=this.font.bbox,T=e.obj({Type:"FontDescriptor",FontName:this.baseFontName,Flags:oa(this.font),FontBBox:[d*r,p*r,C*r,v*r],ItalicAngle:i,Ascent:s*r,Descent:o*r,CapHeight:(c||s)*r,XHeight:(a||0)*r,StemV:0,[this.isCFF()?"FontFile3":"FontFile2"]:t});return e.register(T)})}serializeFont(){return fe(this,void 0,void 0,function*(){return this.fontData})}embedFontStream(e){return fe(this,void 0,void 0,function*(){const t=e.flateStream(yield this.serializeFont(),{Subtype:this.isCFF()?"CIDFontType0C":void 0});return e.register(t)})}embedUnicodeCmap(e){const t=na(this.glyphCache.access(),this.glyphId.bind(this)),r=e.flateStream(t);return e.register(r)}glyphId(e){return e?e.id:-1}computeWidths(){const e=this.glyphCache.access(),t=[];let r=[];for(let i=0,s=e.length;i<s;i++){const o=e[i],c=e[i-1],a=this.glyphId(o),d=this.glyphId(c);i===0?t.push(a):a-d!==1&&(t.push(r),t.push(a),r=[]),r.push(o.advanceWidth*this.scale)}return t.push(r),t}}
36class is extends Rr{constructor(e,t,r,i){super(e,t,r,i),this.subset=this.font.createSubset(),this.glyphs=[],this.glyphCache=vt.populatedBy(()=>this.glyphs),this.glyphIdMap=new Map}static for(e,t,r,i){return fe(this,void 0,void 0,function*(){const s=yield e.create(t);return new is(s,t,r,i)})}encodeText(e){const{glyphs:t}=this.font.layout(e,this.fontFeatures),r=new Array(t.length);for(let i=0,s=t.length;i<s;i++){const o=t[i],c=this.subset.includeGlyph(o);this.glyphs[c-1]=o,this.glyphIdMap.set(o.id,c),r[i]=Pr(c,4)}return this.glyphCache.invalidate(),ee.of(r.join(""))}isCFF(){return this.subset.cff}glyphId(e){return e?this.glyphIdMap.get(e.id):-1}serializeFont(){return new Promise((e,t)=>{const r=[];this.subset.encodeStream().on("data",i=>r.push(i)).on("end",()=>e(Qo(r))).on("error",i=>t(i))})}}var zi;(function(n){n.Source="Source",n.Data="Data",n.Alternative="Alternative",n.Supplement="Supplement",n.EncryptedPayload="EncryptedPayload",n.FormData="EncryptedPayload",n.Schema="Schema",n.Unspecified="Unspecified"})(zi||(zi={}));class ss{constructor(e,t,r={}){this.fileData=e,this.fileName=t,this.options=r}static for(e,t,r={}){return new ss(e,t,r)}embedIntoContext(e,t){return fe(this,void 0,void 0,function*(){const{mimeType:r,description:i,creationDate:s,modificationDate:o,afRelationship:c}=this.options,a=e.flateStream(this.fileData,{Type:"EmbeddedFile",Subtype:r??void 0,Params:{Size:this.fileData.length,CreationDate:s?me.fromDate(s):void 0,ModDate:o?me.fromDate(o):void 0}}),d=e.register(a),p=e.obj({Type:"Filespec",F:me.of(this.fileName),UF:ee.fromText(this.fileName),EF:{F:d},Desc:i?ee.fromText(i):void 0,AFRelationship:c??void 0});return t?(e.assign(t,p),t):e.register(p)})}}const zs=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487];var Mn;(function(n){n.DeviceGray="DeviceGray",n.DeviceRGB="DeviceRGB",n.DeviceCMYK="DeviceCMYK"})(Mn||(Mn={}));const ca={1:Mn.DeviceGray,3:Mn.DeviceRGB,4:Mn.DeviceCMYK};class yi{constructor(e,t,r,i,s){this.imageData=e,this.bitsPerComponent=t,this.width=r,this.height=i,this.colorSpace=s}static for(e){return fe(this,void 0,void 0,function*(){const t=new DataView(e.buffer);if(t.getUint16(0)!==65496)throw new Error("SOI not found in JPEG");let i=2,s;for(;i<t.byteLength&&(s=t.getUint16(i),i+=2,!zs.includes(s));)i+=t.getUint16(i);if(!zs.includes(s))throw new Error("Invalid JPEG");i+=2;const o=t.getUint8(i++),c=t.getUint16(i);i+=2;const a=t.getUint16(i);i+=2;const d=t.getUint8(i++),p=ca[d];if(!p)throw new Error("Unknown JPEG channel.");const C=p;return new yi(e,o,a,c,C)})}embedIntoContext(e,t){return fe(this,void 0,void 0,function*(){const r=e.stream(this.imageData,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.bitsPerComponent,Width:this.width,Height:this.height,ColorSpace:this.colorSpace,Filter:"DCTDecode",Decode:this.colorSpace===Mn.DeviceCMYK?[1,0,1,0,1,0,1,0]:void 0});return t?(e.assign(t,r),t):e.register(r)})}}const aa=n=>{if(n===0)return yn.Greyscale;if(n===2)return yn.Truecolour;if(n===3)return yn.IndexedColour;if(n===4)return yn.GreyscaleWithAlpha;if(n===6)return yn.TruecolourWithAlpha;throw new Error(`Unknown color type: ${n}`)},la=n=>{const e=Math.floor(n.length/4),t=new Uint8Array(e*3),r=new Uint8Array(e*1);let i=0,s=0,o=0;for(;i<n.length;)t[s++]=n[i++],t[s++]=n[i++],t[s++]=n[i++],r[o++]=n[i++];return{rgbChannel:t,alphaChannel:r}};var yn;(function(n){n.Greyscale="Greyscale",n.Truecolour="Truecolour",n.IndexedColour="IndexedColour",n.GreyscaleWithAlpha="GreyscaleWithAlpha",n.TruecolourWithAlpha="TruecolourWithAlpha"})(yn||(yn={}));class Ni{constructor(e){const t=Fs.decode(e),r=Fs.toRGBA8(t);if(r.length>1)throw new Error("Animated PNGs are not supported");const i=new Uint8Array(r[0]),{rgbChannel:s,alphaChannel:o}=la(i);this.rgbChannel=s,o.some(a=>a<255)&&(this.alphaChannel=o),this.type=aa(t.ctype),this.width=t.width,this.height=t.height,this.bitsPerComponent=8}}Ni.load=n=>new Ni(n);class mi{constructor(e){this.image=e,this.bitsPerComponent=e.bitsPerComponent,this.width=e.width,this.height=e.height,this.colorSpace="DeviceRGB"}static for(e){return fe(this,void 0,void 0,function*(){const t=Ni.load(e);return new mi(t)})}embedIntoContext(e,t){return fe(this,void 0,void 0,function*(){const r=this.embedAlphaChannel(e),i=e.flateStream(this.image.rgbChannel,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.image.bitsPerComponent,Width:this.image.width,Height:this.image.height,ColorSpace:this.colorSpace,SMask:r});return t?(e.assign(t,i),t):e.register(i)})}embedAlphaChannel(e){if(!this.image.alphaChannel)return;const t=e.flateStream(this.image.alphaChannel,{Type:"XObject",Subtype:"Image",Height:this.image.height,Width:this.image.width,BitsPerComponent:this.image.bitsPerComponent,ColorSpace:"DeviceGray",Decode:[0,1]});return e.register(t)}}class bi{constructor(e,t,r){this.bytes=e,this.start=t||0,this.pos=this.start,this.end=t&&r?t+r:this.bytes.length}get length(){return this.end-this.start}get isEmpty(){return this.length===0}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getUint16(){const e=this.getByte(),t=this.getByte();return e===-1||t===-1?-1:(e<<8)+t}getInt32(){const e=this.getByte(),t=this.getByte(),r=this.getByte(),i=this.getByte();return(e<<24)+(t<<16)+(r<<8)+i}getBytes(e,t=!1){const r=this.bytes,i=this.pos,s=this.end;if(e){let o=i+e;o>s&&(o=s),this.pos=o;const c=r.subarray(i,o);return t?new Uint8ClampedArray(c):c}else{const o=r.subarray(i,s);return t?new Uint8ClampedArray(o):o}}peekByte(){const e=this.getByte();return this.pos--,e}peekBytes(e,t=!1){const r=this.getBytes(e,t);return this.pos-=r.length,r}skip(e){e||(e=1),this.pos+=e}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(e,t){return new bi(this.bytes,e,t)}decode(){return this.bytes}}const da=new Uint8Array(0);class Er{constructor(e){if(this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=da,this.minBufferLength=512,e)for(;this.minBufferLength<e;)this.minBufferLength*=2}get isEmpty(){for(;!this.eof&&this.bufferLength===0;)this.readBlock();return this.bufferLength===0}getByte(){const e=this.pos;for(;this.bufferLength<=e;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.pos++]}getUint16(){const e=this.getByte(),t=this.getByte();return e===-1||t===-1?-1:(e<<8)+t}getInt32(){const e=this.getByte(),t=this.getByte(),r=this.getByte(),i=this.getByte();return(e<<24)+(t<<16)+(r<<8)+i}getBytes(e,t=!1){let r;const i=this.pos;if(e){for(this.ensureBuffer(i+e),r=i+e;!this.eof&&this.bufferLength<r;)this.readBlock();const o=this.bufferLength;r>o&&(r=o)}else{for(;!this.eof;)this.readBlock();r=this.bufferLength}this.pos=r;const s=this.buffer.subarray(i,r);return t&&!(s instanceof Uint8ClampedArray)?new Uint8ClampedArray(s):s}peekByte(){const e=this.getByte();return this.pos--,e}peekBytes(e,t=!1){const r=this.getBytes(e,t);return this.pos-=r.length,r}skip(e){e||(e=1),this.pos+=e}reset(){this.pos=0}makeSubStream(e,t){const r=e+t;for(;this.bufferLength<=r&&!this.eof;)this.readBlock();return new bi(this.buffer,e,t)}decode(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)}readBlock(){throw new gt(this.constructor.name,"readBlock")}ensureBuffer(e){const t=this.buffer;if(e<=t.byteLength)return t;let r=this.minBufferLength;for(;r<e;)r*=2;const i=new Uint8Array(r);return i.set(t),this.buffer=i}}const Ns=n=>n===32||n===9||n===13||n===10;
36class ha extends Er{constructor(e,t){super(t),this.stream=e,this.input=new Uint8Array(5),t&&(t=.8*t)}readBlock(){const i=this.stream;let s=i.getByte();for(;Ns(s);)s=i.getByte();if(s===-1||s===126){this.eof=!0;return}const o=this.bufferLength;let c,a;if(s===122){for(c=this.ensureBuffer(o+4),a=0;a<4;++a)c[o+a]=0;this.bufferLength+=4}else{const d=this.input;for(d[0]=s,a=1;a<5;++a){for(s=i.getByte();Ns(s);)s=i.getByte();if(d[a]=s,s===-1||s===126)break}if(c=this.ensureBuffer(o+a-1),this.bufferLength+=a-1,a<5){for(;a<5;++a)d[a]=117;this.eof=!0}let p=0;for(a=0;a<5;++a)p=p*85+(d[a]-33);for(a=3;a>=0;--a)c[o+a]=p&255,p>>=8}}}class ua extends Er{constructor(e,t){super(t),this.stream=e,this.firstDigit=-1,t&&(t=.5*t)}readBlock(){const t=this.stream.getBytes(8e3);if(!t.length){this.eof=!0;return}const r=t.length+1>>1,i=this.ensureBuffer(this.bufferLength+r);let s=this.bufferLength,o=this.firstDigit;for(let c=0,a=t.length;c<a;c++){const d=t[c];let p;if(d>=48&&d<=57)p=d&15;else if(d>=65&&d<=70||d>=97&&d<=102)p=(d&15)+9;else if(d===62){this.eof=!0;break}else continue;o<0?o=p:(i[s++]=o<<4|p,o=-1)}o>=0&&this.eof&&(i[s++]=o<<4,o=-1),this.firstDigit=o,this.bufferLength=s}}const Ls=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fa=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]),ga=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]),xa=[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,5243
3669,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],pa=[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 ya extends Er{constructor(e,t){super(t),this.stream=e;const r=e.getByte(),i=e.getByte();if(r===-1||i===-1)throw new Error(`Invalid header in flate stream: ${r}, ${i}`);if((r&15)!==8)throw new Error(`Unknown compression method in flate stream: ${r}, ${i}`);if(((r<<8)+i)%31!==0)throw new Error(`Bad FCHECK in flate stream: ${r}, ${i}`);if(i&32)throw new Error(`FDICT bit set in flate stream: ${r}, ${i}`);this.codeSize=0,this.codeBuf=0}readBlock(){let e,t;const r=this.stream;let i=this.getBits(3);if(i&1&&(this.eof=!0),i>>=1,i===0){let d;if((d=r.getByte())===-1)throw new Error("Bad block header in flate stream");let p=d;if((d=r.getByte())===-1)throw new Error("Bad block header in flate stream");if(p|=d<<8,(d=r.getByte())===-1)throw new Error("Bad block header in flate stream");let C=d;if((d=r.getByte())===-1)throw new Error("Bad block header in flate stream");if(C|=d<<8,C!==(~p&65535)&&(p!==0||C!==0))throw new Error("Bad uncompressed block length in flate stream");
36this.codeBuf=0,this.codeSize=0;const v=this.bufferLength;e=this.ensureBuffer(v+p);const T=v+p;if(this.bufferLength=T,p===0)r.peekByte()===-1&&(this.eof=!0);else for(let j=v;j<T;++j){if((d=r.getByte())===-1){this.eof=!0;break}e[j]=d}return}let s,o;if(i===1)s=xa,o=pa;else if(i===2){const d=this.getBits(5)+257,p=this.getBits(5)+1,C=this.getBits(4)+4,v=new Uint8Array(Ls.length);let T;for(T=0;T<C;++T)v[Ls[T]]=this.getBits(3);const j=this.generateHuffmanTable(v);t=0,T=0;const N=d+p,K=new Uint8Array(N);let G,te,X;for(;T<N;){const q=this.getCode(j);if(q===16)G=2,te=3,X=t;else if(q===17)G=3,te=3,X=t=0;else if(q===18)G=7,te=11,X=t=0;else{K[T++]=t=q;continue}let Be=this.getBits(G)+te;for(;Be-- >0;)K[T++]=X}s=this.generateHuffmanTable(K.subarray(0,d)),o=this.generateHuffmanTable(K.subarray(d,N))}else throw new Error("Unknown block type in flate stream");e=this.buffer;let c=e?e.length:0,a=this.bufferLength;for(;;){let d=this.getCode(s);if(d<256){a+1>=c&&(e=this.ensureBuffer(a+1),c=e.length),e[a++]=d;continue}if(d===256){this.bufferLength=a;return}d-=257,d=fa[d];let p=d>>16;p>0&&(p=this.getBits(p)),t=(d&65535)+p,d=this.getCode(o),d=ga[d],p=d>>16,p>0&&(p=this.getBits(p));const C=(d&65535)+p;a+t>=c&&(e=this.ensureBuffer(a+t),c=e.length);for(let v=0;v<t;++v,++a)e[a]=e[a-C]}}getBits(e){const t=this.stream;let r=this.codeSize,i=this.codeBuf,s;for(;r<e;){if((s=t.getByte())===-1)throw new Error("Bad encoding in flate stream");i|=s<<r,r+=8}return s=i&(1<<e)-1,this.codeBuf=i>>e,this.codeSize=r-=e,s}getCode(e){const t=this.stream,r=e[0],i=e[1];let s=this.codeSize,o=this.codeBuf,c;for(;s<i&&(c=t.getByte())!==-1;)o|=c<<s,s+=8;const a=r[o&(1<<i)-1];typeof r=="number"&&console.log("FLATE:",a);const d=a>>16,p=a&65535;if(d<1||s<d)throw new Error("Bad encoding in flate stream");return this.codeBuf=o>>d,this.codeSize=s-d,p}generateHuffmanTable(e){const t=e.length;let r=0,i;for(i=0;i<t;++i)e[i]>r&&(r=e[i]);const s=1<<r,o=new Int32Array(s);for(let c=1,a=0,d=2;c<=r;++c,a<<=1,d<<=1)for(let p=0;p<t;++p)if(e[p]===c){let C=0,v=a;for(i=0;i<c;++i)C=C<<1|v&1,v>>=1;for(i=C;i<s;i+=d)o[i]=c<<16|p;++a}return[o,r]}}
36class ma extends Er{constructor(e,t,r){super(t),this.stream=e,this.cachedData=0,this.bitsCached=0;const i=4096,s={earlyChange:r,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(i),dictionaryLengths:new Uint16Array(i),dictionaryPrevCodes:new Uint16Array(i),currentSequence:new Uint8Array(i),currentSequenceLength:0};for(let o=0;o<256;++o)s.dictionaryValues[o]=o,s.dictionaryLengths[o]=1;this.lzwState=s}readBlock(){let t=1024;const r=512;let i,s,o;const c=this.lzwState;if(!c)return;const a=c.earlyChange;let d=c.nextCode;const p=c.dictionaryValues,C=c.dictionaryLengths,v=c.dictionaryPrevCodes;let T=c.codeLength,j=c.prevCode;const N=c.currentSequence;let K=c.currentSequenceLength,G=0,te=this.bufferLength,X=this.ensureBuffer(this.bufferLength+t);for(i=0;i<512;i++){const q=this.readBits(T),Be=K>0;if(!q||q<256)N[0]=q,K=1;else if(q>=258)if(q<d)for(K=C[q],s=K-1,o=q;s>=0;s--)N[s]=p[o],o=v[o];else N[K++]=N[0];else if(q===256){T=9,d=258,K=0;continue}else{this.eof=!0,delete this.lzwState;break}if(Be&&(v[d]=j,C[d]=C[j]+1,p[d]=N[0],d++,T=d+a&d+a-1?T:Math.min(Math.log(d+a)/.6931471805599453+1,12)|0),j=q,G+=K,t<G){do t+=r;while(t<G);X=this.ensureBuffer(this.bufferLength+t)}for(s=0;s<K;s++)X[te++]=N[s]}c.nextCode=d,c.codeLength=T,c.prevCode=j,c.currentSequenceLength=K,this.bufferLength=te}readBits(e){let t=this.bitsCached,r=this.cachedData;for(;t<e;){const i=this.stream.getByte();if(i===-1)return this.eof=!0,null;r=r<<8|i,t+=8}return this.bitsCached=t-=e,this.cachedData=r,r>>>t&(1<<e)-1}}class ba extends Er{constructor(e,t){super(t),this.stream=e}readBlock(){const e=this.stream.getBytes(2);if(!e||e.length<2||e[0]===128){this.eof=!0;return}let t,r=this.bufferLength,i=e[0];if(i<128){if(t=this.ensureBuffer(r+i+1),t[r++]=e[1],i>0){const s=this.stream.getBytes(i);t.set(s,r),r+=i}}else{i=257-i;const s=e[1];t=this.ensureBuffer(r+i+1);for(let o=0;o<i;o++)t[r++]=s}this.bufferLength=r}}const Us=(n,e,t)=>{if(e===l.of("FlateDecode"))return new ya(n);if(e===l.of("LZWDecode")){let r=1;if(t instanceof ie){const i=t.lookup(l.of("EarlyChange"));i instanceof ne&&(r=i.asNumber())}return new ma(n,void 0,r)}if(e===l.of("ASCII85Decode"))return new ha(n);if(e===l.of("ASCIIHexDecode"))return new ua(n);if(e===l.of("RunLengthDecode"))return new ba(n);throw new jc(e.asString())},wo=({dict:n,contents:e})=>{let t=new bi(e);const r=n.lookup(l.of("Filter")),i=n.lookup(l.of("DecodeParms"));if(r instanceof l)t=Us(t,r,i);else if(r instanceof ve)for(let s=0,o=r.size();s<o;s++)t=Us(t,r.lookup(s,l),i&&i.lookupMaybe(s,ie));else if(r)throw new ti([l,ve],r);return t},wa=n=>{const e=n.MediaBox(),t=e.lookup(2,ne).asNumber()-e.lookup(0,ne).asNumber(),r=e.lookup(3,ne).asNumber()-e.lookup(1,ne).asNumber();return{left:0,bottom:0,right:t,top:r}},va=n=>[1,0,0,1,-n.left,-n.bottom];class wi{constructor(e,t,r){this.page=e;const i=t??wa(e);this.width=i.right-i.left,this.height=i.top-i.bottom,this.boundingBox=i,this.transformationMatrix=r??va(i)}static for(e,t,r){return fe(this,void 0,void 0,function*(){return new wi(e,t,r)})}embedIntoContext(e,t){return fe(this,void 0,void 0,function*(){const{Contents:r,Resources:i}=this.page.normalizedEntries();if(!r)throw new Mc;const s=this.decodeContents(r),{left:o,bottom:c,right:a,top:d}=this.boundingBox,p=e.flateStream(s,{Type:"XObject",Subtype:"Form",FormType:1,BBox:[o,c,a,d],Matrix:this.transformationMatrix,Resources:i});return t?(e.assign(t,p),t):e.register(p)})}decodeContents(e){const t=Uint8Array.of(f.Newline),r=[];for(let i=0,s=e.size();i<s;i++){const o=e.lookup(i,st);let c;if(o instanceof Ht)c=wo(o).decode();else if(o instanceof Lt)c=o.getUnencodedContents();else throw new Wc(o);r.push(c,t)}return Jo(...r)}}const Kr=(n,e)=>{if(n!==void 0)return e[n]};var yr;(function(n){n.UseNone="UseNone",n.UseOutlines="UseOutlines",n.UseThumbs="UseThumbs",n.UseOC="UseOC"})(yr||(yr={}));var mr;(function(n){n.L2R="L2R",n.R2L="R2L"})(mr||(mr={}));var br;(function(n){n.None="None",n.AppDefault="AppDefault"})(br||(br={}));var oi;(function(n){n.Simplex="Simplex",n.DuplexFlipShortEdge="DuplexFlipShortEdge",n.DuplexFlipLongEdge="DuplexFlipLongEdge"})(oi||(oi={}));class Gn{constructor(e){this.dict=e}lookupBool(e){const t=this.dict.lookup(l.of(e));if(t instanceof Ut)return t}lookupName(e){const t=this.dict.lookup(l.of(e));if(t instanceof l)return t}HideToolbar(){return this.lookupBool("HideToolbar")}HideMenubar(){return this.lookupBool("HideMenubar")}HideWindowUI(){return this.lookupBool("HideWindowUI")}FitWindow(){return this.lookupBool("FitWindow")}CenterWindow(){return this.lookupBool("CenterWindow")}DisplayDocTitle(){return this.lookupBool("DisplayDocTitle")}NonFullScreenPageMode(){return this.lookupName("NonFullScreenPageMode")}Direction(){return this.lookupName("Direction")}PrintScaling(){return this.lookupName("PrintScaling")}Duplex(){return this.lookupName("Duplex")}PickTrayByPDFSize(){return this.lookupBool("PickTrayByPDFSize")}PrintPageRange(){const e=this.dict.lookup(l.of("PrintPageRange"));if(e instanceof ve)return e}NumCopies(){const e=this.dict.lookup(l.of("NumCopies"));if(e instanceof ne)return e}getHideToolbar(){var e,t;return(t=(e=this.HideToolbar())===null||e===void 0?void 0:e.asBoolean())!==null&&t!==void 0?t:!1}getHideMenubar(){var e,t;return(t=(e=this.HideMenubar())===null||e===void 0?void 0:e.asBoolean())!==null&&t!==void 0?t:!1}getHideWindowUI(){var e,t;return(t=(e=this.HideWindowUI())===null||e===void 0?void 0:e.asBoolean())!==null&&t!==void 0?t:!1}getFitWindow(){var e,t;return(t=(e=this.FitWindow())===null||e===void 0?void 0:e.asBoolean())!==null&&t!==void 0?t:!1}getCenterWindow(){var e,t;return(t=(e=this.CenterWindow())===null||e===void 0?void 0:e.asBoolean())!==null&&t!==void 0?t:!1}getDisplayDocTitle(){var e,t;return(t=(e=this.DisplayDocTitle())===null||e===void 0?void 0:e.asBoolean())!==null&&t!==void 0?t:!1}getNonFullScreenPageMode(){var e,t;const r=(e=this.NonFullScreenPageMode())===null||e===void 0?void 0:e.decodeText();return(t=Kr(r,yr))!==null&&t!==void 0?t:yr.UseNone}getReadingDirection(){var e,t;const r=(e=this.Direction())===null||e===void 0?void 0:e.decodeText();return(t=Kr(r,mr))!==null&&t!==void 0?t:mr.L2R}getPrintScaling(){var e,t;const r=(e=this.PrintScaling())===null||e===void 0?void 0:e.decodeText();return(t=Kr(r,br))!==null&&t!==void 0?t:br.AppDefault}getDuplex(){var e;const t=(e=this.Duplex())===null||e===void 0?void 0:e.decodeText();return Kr(t,oi)}getPickTrayByPDFSize(){var e;return(e=this.PickTrayByPDFSize())===null||e===void 0?void 0:e.asBoolean()}getPrintPageRange(){const e=this.PrintPageRange();if(!e)return[];const t=[];for(let r=0;r<e.size();r+=2){const i=e.lookup(r,ne).asNumber(),s=e.lookup(r+1,ne).asNumber();t.push({start:i,end:s})}return t}getNumCopies(){var e,t;return(t=(e=this.NumCopies())===null||e===void 0?void 0:e.asNumber())!==null&&t!==void 0?t:1}setHideToolbar(e){const t=this.dict.context.obj(e);this.dict.set(l.of("HideToolbar"),t)}setHideMenubar(e){const t=this.dict.context.obj(e);this.dict.set(l.of("HideMenubar"),t)}setHideWindowUI(e){const t=this.dict.context.obj(e);this.dict.set(l.of("HideWindowUI"),t)}setFitWindow(e){const t=this.dict.context.obj(e);this.dict.set(l.of("FitWindow"),t)}setCenterWindow(e){const t=this.dict.context.obj(e);this.dict.set(l.of("CenterWindow"),t)}setDisplayDocTitle(e){const t=this.dict.context.obj(e);this.dict.set(l.of("DisplayDocTitle"),t)}setNonFullScreenPageMode(e){qt(e,"nonFullScreenPageMode",yr);const t=l.of(e);this.dict.set(l.of("NonFullScreenPageMode"),t)}setReadingDirection(e){qt(e,"readingDirection",mr);const t=l.of(e);this.dict.set(l.of("Direction"),t)}setPrintScaling(e){qt(e,"printScaling",br);const t=l.of(e);this.dict.set(l.of("PrintScaling"),t)}setDuplex(e){qt(e,"duplex",oi);const t=l.of(e);this.dict.set(l.of("Duplex"),t)}setPickTrayByPDFSize(e){const t=this.dict.context.obj(e);this.dict.set(l.of("PickTrayByPDFSize"),t)}setPrintPageRange(e){Array.isArray(e)||(e=[e]);const t=[];for(let i=0,s=e.length;i<s;
36i++)t.push(e[i].start),t.push(e[i].end);go(t,"printPageRange",["number"]);const r=this.dict.context.obj(t);this.dict.set(l.of("PrintPageRange"),r)}setNumCopies(e){xt(e,"numCopies",1,Number.MAX_VALUE),Ec(e,"numCopies");const t=this.dict.context.obj(e);this.dict.set(l.of("NumCopies"),t)}}Gn.fromDict=n=>new Gn(n);Gn.create=n=>{const e=n.obj({});return new Gn(e)};const Sa=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/;class vi{constructor(e,t){this.dict=e,this.ref=t}T(){return this.dict.lookupMaybe(l.of("T"),me,ee)}Ff(){const e=this.getInheritableAttribute(l.of("Ff"));return this.dict.context.lookupMaybe(e,ne)}V(){const e=this.getInheritableAttribute(l.of("V"));return this.dict.context.lookup(e)}Kids(){return this.dict.lookupMaybe(l.of("Kids"),ve)}DA(){const e=this.dict.lookup(l.of("DA"));if(e instanceof me||e instanceof ee)return e}setKids(e){this.dict.set(l.of("Kids"),this.dict.context.obj(e))}getParent(){const e=this.dict.get(l.of("Parent"));if(e instanceof Ce){const t=this.dict.lookup(l.of("Parent"),ie);return new vi(t,e)}}setParent(e){e?this.dict.set(l.of("Parent"),e):this.dict.delete(l.of("Parent"))}getFullyQualifiedName(){const e=this.getParent();return e?`${e.getFullyQualifiedName()}.${this.getPartialName()}`:this.getPartialName()}getPartialName(){var e;return(e=this.T())===null||e===void 0?void 0:e.decodeText()}setPartialName(e){e?this.dict.set(l.of("T"),ee.fromText(e)):this.dict.delete(l.of("T"))}setDefaultAppearance(e){this.dict.set(l.of("DA"),me.of(e))}getDefaultAppearance(){const e=this.DA();return e instanceof ee?e.decodeText():e==null?void 0:e.asString()}setFontSize(e){var t;const r=(t=this.getFullyQualifiedName())!==null&&t!==void 0?t:"",i=this.getDefaultAppearance();if(!i)throw new Uc(r);const s=Yi(i,Sa);if(!s.match)throw new Hc(r);const o=i.slice(0,s.pos-s.match[0].length),c=s.pos<=i.length?i.slice(s.pos):"",a=s.match[1],d=`${o} /${a} ${e} Tf ${c}`;this.setDefaultAppearance(d)}getFlags(){var e,t;return(t=(e=this.Ff())===null||e===void 0?void 0:e.asNumber())!==null&&t!==void 0?t:0}setFlags(e){this.dict.set(l.of("Ff"),ne.of(e))}hasFlag(e){return(this.getFlags()&e)!==0}setFlag(e){const t=this.getFlags();this.setFlags(t|e)}clearFlag(e){const t=this.getFlags();this.setFlags(t&~e)}setFlagTo(e,t){t?this.setFlag(e):this.clearFlag(e)}getInheritableAttribute(e){let t;return this.ascend(r=>{t||(t=r.dict.get(e))}),t}ascend(e){e(this);const t=this.getParent();t&&t.ascend(e)}}class wr{constructor(e){this.dict=e}W(){const e=this.dict.lookup(l.of("W"));if(e instanceof ne)return e}getWidth(){var e,t;return(t=(e=this.W())===null||e===void 0?void 0:e.asNumber())!==null&&t!==void 0?t:1}setWidth(e){const t=this.dict.context.obj(e);this.dict.set(l.of("W"),t)}}wr.fromDict=n=>new wr(n);class Li{constructor(e){this.dict=e}Rect(){return this.dict.lookup(l.of("Rect"),ve)}AP(){return this.dict.lookupMaybe(l.of("AP"),ie)}F(){const e=this.dict.lookup(l.of("F"));return this.dict.context.lookupMaybe(e,ne)}getRectangle(){var e;const t=this.Rect();return(e=t==null?void 0:t.asRectangle())!==null&&e!==void 0?e:{x:0,y:0,width:0,height:0}}setRectangle(e){const{x:t,y:r,width:i,height:s}=e,o=this.dict.context.obj([t,r,t+i,r+s]);this.dict.set(l.of("Rect"),o)}getAppearanceState(){const e=this.dict.lookup(l.of("AS"));if(e instanceof l)return e}setAppearanceState(e){this.dict.set(l.of("AS"),e)}setAppearances(e){this.dict.set(l.of("AP"),e)}ensureAP(){let e=this.AP();return e||(e=this.dict.context.obj({}),this.dict.set(l.of("AP"),e)),e}getNormalAppearance(){const t=this.ensureAP().get(l.of("N"));if(t instanceof Ce||t instanceof ie)return t;throw new Error(`Unexpected N type: ${t==null?void 0:t.constructor.name}`)}setNormalAppearance(e){this.ensureAP().set(l.of("N"),e)}setRolloverAppearance(e){this.ensureAP().set(l.of("R"),e)}setDownAppearance(e){this.ensureAP().set(l.of("D"),e)}removeRolloverAppearance(){const e=this.AP();e==null||e.delete(l.of("R"))}removeDownAppearance(){const e=this.AP();e==null||e.delete(l.of("D"))}getAppearances(){const e=this.AP();if(!e)return;const t=e.lookup(l.of("N"),ie,st),r=e.lookupMaybe(l.of("R"),ie,st),i=e.lookupMaybe(l.of("D"),ie,st);return{normal:t,rollover:r,down:i}}getFlags(){var e,t;return(t=(e=this.F())===null||e===void 0?void 0:e.asNumber())!==null&&t!==void 0?t:0}setFlags(e){this.dict.set(l.of("F"),ne.of(e))}hasFlag(e){return(this.getFlags()&e)!==0}setFlag(e){const t=this.getFlags();this.setFlags(t|e)}clearFlag(e){const t=this.getFlags();this.setFlags(t&~e)}setFlagTo(e,t){t?this.setFlag(e):this.clearFlag(e)}}Li.fromDict=n=>new Li(n);class vr{constructor(e){this.dict=e}R(){const e=this.dict.lookup(l.of("R"));if(e instanceof ne)return e}BC(){const e=this.dict.lookup(l.of("BC"));if(e instanceof ve)return e}BG(){const e=this.dict.lookup(l.of("BG"));if(e instanceof ve)return e}CA(){const e=this.dict.lookup(l.of("CA"));if(e instanceof ee||e instanceof me)return e}RC(){const e=this.dict.lookup(l.of("RC"));if(e instanceof ee||e instanceof me)return e}AC(){const e=this.dict.lookup(l.of("AC"));if(e instanceof ee||e instanceof me)return e}getRotation(){var e;return(e=this.R())===null||e===void 0?void 0:e.asNumber()}getBorderColor(){const e=this.BC();if(!e)return;const t=[];for(let r=0,i=e==null?void 0:e.size();r<i;r++){const s=e.get(r);s instanceof ne&&t.push(s.asNumber())}return t}
36getBackgroundColor(){const e=this.BG();if(!e)return;const t=[];for(let r=0,i=e==null?void 0:e.size();r<i;r++){const s=e.get(r);s instanceof ne&&t.push(s.asNumber())}return t}getCaptions(){const e=this.CA(),t=this.RC(),r=this.AC();return{normal:e==null?void 0:e.decodeText(),rollover:t==null?void 0:t.decodeText(),down:r==null?void 0:r.decodeText()}}setRotation(e){const t=this.dict.context.obj(e);this.dict.set(l.of("R"),t)}setBorderColor(e){const t=this.dict.context.obj(e);this.dict.set(l.of("BC"),t)}setBackgroundColor(e){const t=this.dict.context.obj(e);this.dict.set(l.of("BG"),t)}setCaptions(e){const t=ee.fromText(e.normal);if(this.dict.set(l.of("CA"),t),e.rollover){const r=ee.fromText(e.rollover);this.dict.set(l.of("RC"),r)}else this.dict.delete(l.of("RC"));if(e.down){const r=ee.fromText(e.down);this.dict.set(l.of("AC"),r)}else this.dict.delete(l.of("AC"))}}vr.fromDict=n=>new vr(n);class An extends Li{MK(){const e=this.dict.lookup(l.of("MK"));if(e instanceof ie)return e}BS(){const e=this.dict.lookup(l.of("BS"));if(e instanceof ie)return e}DA(){const e=this.dict.lookup(l.of("DA"));if(e instanceof me||e instanceof ee)return e}P(){const e=this.dict.get(l.of("P"));if(e instanceof Ce)return e}setDefaultAppearance(e){this.dict.set(l.of("DA"),me.of(e))}getDefaultAppearance(){const e=this.DA();return e instanceof ee?e.decodeText():e==null?void 0:e.asString()}getAppearanceCharacteristics(){const e=this.MK();if(e)return vr.fromDict(e)}getOrCreateAppearanceCharacteristics(){const e=this.MK();if(e)return vr.fromDict(e);const t=vr.fromDict(this.dict.context.obj({}));return this.dict.set(l.of("MK"),t.dict),t}getBorderStyle(){const e=this.BS();if(e)return wr.fromDict(e)}getOrCreateBorderStyle(){const e=this.BS();if(e)return wr.fromDict(e);const t=wr.fromDict(this.dict.context.obj({}));return this.dict.set(l.of("BS"),t.dict),t}getOnValue(){var e;const t=(e=this.getAppearances())===null||e===void 0?void 0:e.normal;if(t instanceof ie){const r=t.keys();for(let i=0,s=r.length;i<s;i++){const o=r[i];if(o!==l.of("Off"))return o}}}}An.fromDict=n=>new An(n);An.create=(n,e)=>{const t=n.obj({Type:"Annot",Subtype:"Widget",Rect:[0,0,0,0],Parent:e});return new An(t)};class Jt extends vi{FT(){const e=this.getInheritableAttribute(l.of("FT"));return this.dict.context.lookup(e,l)}getWidgets(){const e=this.Kids();if(!e)return[An.fromDict(this.dict)];const t=new Array(e.size());for(let r=0,i=e.size();r<i;r++){const s=e.lookup(r,ie);t[r]=An.fromDict(s)}return t}addWidget(e){const{Kids:t}=this.normalizedEntries();t.push(e)}removeWidget(e){const t=this.Kids();if(t){if(e<0||e>t.size())throw new ni(e,0,t.size());t.remove(e)}else{if(e!==0)throw new ni(e,0,0);this.setKids([])}}normalizedEntries(){let e=this.Kids();return e||(e=this.dict.context.obj([this.ref]),this.dict.set(l.of("Kids"),e)),{Kids:e}}}Jt.fromDict=(n,e)=>new Jt(n,e);class os extends Jt{Opt(){return this.dict.lookupMaybe(l.of("Opt"),me,ee,ve)}setOpt(e){this.dict.set(l.of("Opt"),this.dict.context.obj(e))}getExportValues(){const e=this.Opt();if(!e)return;if(e instanceof me||e instanceof ee)return[e];const t=[];for(let r=0,i=e.size();r<i;r++){const s=e.lookup(r);(s instanceof me||s instanceof ee)&&t.push(s)}return t}removeExportValue(e){const t=this.Opt();if(t)if(t instanceof me||t instanceof ee){if(e!==0)throw new ni(e,0,0);this.setOpt([])}else{if(e<0||e>t.size())throw new ni(e,0,t.size());t.remove(e)}}normalizeExportValues(){var e,t,r,i;const s=(e=this.getExportValues())!==null&&e!==void 0?e:[],o=[],c=this.getWidgets();for(let a=0,d=c.length;a<d;a++){const p=c[a],C=(t=s[a])!==null&&t!==void 0?t:ee.fromText((i=(r=p.getOnValue())===null||r===void 0?void 0:r.decodeText())!==null&&i!==void 0?i:"");o.push(C)}this.setOpt(o)}addOpt(e,t){var r;this.normalizeExportValues();const i=e.decodeText();let s;if(t){const c=(r=this.getExportValues())!==null&&r!==void 0?r:[];for(let a=0,d=c.length;a<d;a++)c[a].decodeText()===i&&(s=a)}const o=this.Opt();return o.push(e),s??o.size()-1}addWidgetWithOpt(e,t,r){const i=this.addOpt(t,r),s=l.of(String(i));return this.addWidget(e),s}}class Qt extends os{setValue(e){var t;const r=(t=this.getOnValue())!==null&&t!==void 0?t:l.of("Yes");if(e!==r&&e!==l.of("Off"))throw new es;this.dict.set(l.of("V"),e);const i=this.getWidgets();for(let s=0,o=i.length;s<o;s++){const c=i[s],a=c.getOnValue()===e?e:l.of("Off");c.setAppearanceState(a)}}getValue(){const e=this.V();return e instanceof l?e:l.of("Off")}getOnValue(){const[e]=this.getWidgets();return e==null?void 0:e.getOnValue()}}Qt.fromDict=(n,e)=>new Qt(n,e);Qt.create=n=>{const e=n.obj({FT:"Btn",Kids:[]}),t=n.register(e);return new Qt(e,t)};const Ue=n=>1<<n;var Pt;
36(function(n){n[n.ReadOnly=Ue(0)]="ReadOnly",n[n.Required=Ue(1)]="Required",n[n.NoExport=Ue(2)]="NoExport"})(Pt||(Pt={}));var bt;(function(n){n[n.NoToggleToOff=Ue(14)]="NoToggleToOff",n[n.Radio=Ue(15)]="Radio",n[n.PushButton=Ue(16)]="PushButton",n[n.RadiosInUnison=Ue(25)]="RadiosInUnison"})(bt||(bt={}));var _e;(function(n){n[n.Multiline=Ue(12)]="Multiline",n[n.Password=Ue(13)]="Password",n[n.FileSelect=Ue(20)]="FileSelect",n[n.DoNotSpellCheck=Ue(22)]="DoNotSpellCheck",n[n.DoNotScroll=Ue(23)]="DoNotScroll",n[n.Comb=Ue(24)]="Comb",n[n.RichText=Ue(25)]="RichText"})(_e||(_e={}));var Fe;(function(n){n[n.Combo=Ue(17)]="Combo",n[n.Edit=Ue(18)]="Edit",n[n.Sort=Ue(19)]="Sort",n[n.MultiSelect=Ue(21)]="MultiSelect",n[n.DoNotSpellCheck=Ue(22)]="DoNotSpellCheck",n[n.CommitOnSelChange=Ue(26)]="CommitOnSelChange"})(Fe||(Fe={}));class vo extends Jt{setValues(e){if(this.hasFlag(Fe.Combo)&&!this.hasFlag(Fe.Edit)&&!this.valuesAreValid(e))throw new es;if(e.length===0&&this.dict.delete(l.of("V")),e.length===1&&this.dict.set(l.of("V"),e[0]),e.length>1){if(!this.hasFlag(Fe.MultiSelect))throw new Lc;this.dict.set(l.of("V"),this.dict.context.obj(e))}this.updateSelectedIndices(e)}valuesAreValid(e){const t=this.getOptions();for(let r=0,i=e.length;r<i;r++){const s=e[r].decodeText();if(!t.find(o=>s===(o.display||o.value).decodeText()))return!1}return!0}updateSelectedIndices(e){if(e.length>1){const t=new Array(e.length),r=this.getOptions();for(let i=0,s=e.length;i<s;i++){const o=e[i].decodeText();t[i]=r.findIndex(c=>o===(c.display||c.value).decodeText())}this.dict.set(l.of("I"),this.dict.context.obj(t.sort()))}else this.dict.delete(l.of("I"))}getValues(){const e=this.V();if(e instanceof me||e instanceof ee)return[e];if(e instanceof ve){const t=[];for(let r=0,i=e.size();r<i;r++){const s=e.lookup(r);(s instanceof me||s instanceof ee)&&t.push(s)}return t}return[]}Opt(){return this.dict.lookupMaybe(l.of("Opt"),me,ee,ve)}setOptions(e){const t=new Array(e.length);for(let r=0,i=e.length;r<i;r++){const{value:s,display:o}=e[r];t[r]=this.dict.context.obj([s,o||s])}this.dict.set(l.of("Opt"),this.dict.context.obj(t))}getOptions(){const e=this.Opt();if(e instanceof me||e instanceof ee)return[{value:e,display:e}];if(e instanceof ve){const t=[];for(let r=0,i=e.size();r<i;r++){const s=e.lookup(r);if((s instanceof me||s instanceof ee)&&t.push({value:s,display:s}),s instanceof ve&&s.size()>0){const o=s.lookup(0,me,ee),c=s.lookupMaybe(1,me,ee);t.push({value:o,display:c||o})}}return t}return[]}}class en extends vo{}en.fromDict=(n,e)=>new en(n,e);en.create=n=>{const e=n.obj({FT:"Ch",Ff:Fe.Combo,Kids:[]}),t=n.register(e);return new en(e,t)};class tn extends vi{addField(e){const{Kids:t}=this.normalizedEntries();t==null||t.push(e)}normalizedEntries(){let e=this.Kids();return e||(e=this.dict.context.obj([]),this.dict.set(l.of("Kids"),e)),{Kids:e}}}tn.fromDict=(n,e)=>new tn(n,e);tn.create=n=>{const e=n.obj({}),t=n.register(e);return new tn(e,t)};class Fr extends Jt{}Fr.fromDict=(n,e)=>new Fr(n,e);class nn extends Jt{MaxLen(){const e=this.dict.lookup(l.of("MaxLen"));if(e instanceof ne)return e}Q(){const e=this.dict.lookup(l.of("Q"));if(e instanceof ne)return e}setMaxLength(e){this.dict.set(l.of("MaxLen"),ne.of(e))}removeMaxLength(){this.dict.delete(l.of("MaxLen"))}getMaxLength(){var e;return(e=this.MaxLen())===null||e===void 0?void 0:e.asNumber()}setQuadding(e){this.dict.set(l.of("Q"),ne.of(e))}getQuadding(){var e;return(e=this.Q())===null||e===void 0?void 0:e.asNumber()}setValue(e){this.dict.set(l.of("V"),e)}removeValue(){this.dict.delete(l.of("V"))}getValue(){const e=this.V();if(e instanceof me||e instanceof ee)return e}}nn.fromDict=(n,e)=>new nn(n,e);nn.create=n=>{const e=n.obj({FT:"Tx",Kids:[]}),t=n.register(e);return new nn(e,t)};class rn extends os{}rn.fromDict=(n,e)=>new rn(n,e);rn.create=n=>{const e=n.obj({FT:"Btn",Ff:bt.PushButton,Kids:[]}),t=n.register(e);return new rn(e,t)};class sn extends os{setValue(e){if(!this.getOnValues().includes(e)&&e!==l.of("Off"))throw new es;this.dict.set(l.of("V"),e);const r=this.getWidgets();for(let i=0,s=r.length;i<s;i++){const o=r[i],c=o.getOnValue()===e?e:l.of("Off");o.setAppearanceState(c)}}getValue(){const e=this.V();return e instanceof l?e:l.of("Off")}getOnValues(){const e=this.getWidgets(),t=[];for(let r=0,i=e.length;r<i;r++){const s=e[r].getOnValue();
36s&&t.push(s)}return t}}sn.fromDict=(n,e)=>new sn(n,e);sn.create=n=>{const e=n.obj({FT:"Btn",Ff:bt.Radio,Kids:[]}),t=n.register(e);return new sn(e,t)};class on extends vo{}on.fromDict=(n,e)=>new on(n,e);on.create=n=>{const e=n.obj({FT:"Ch",Kids:[]}),t=n.register(e);return new on(e,t)};const cs=n=>{if(!n)return[];const e=[];for(let t=0,r=n.size();t<r;t++){const i=n.get(t),s=n.lookup(t);i instanceof Ce&&s instanceof ie&&e.push([So(s,i),i])}return e},So=(n,e)=>Aa(n)?tn.fromDict(n,e):Ca(n,e),Aa=n=>{const e=n.lookup(l.of("Kids"));if(e instanceof ve)for(let t=0,r=e.size();t<r;t++){const i=e.lookup(t);if(i instanceof ie&&i.has(l.of("T")))return!0}return!1},Ca=(n,e)=>{const t=as(n,l.of("FT")),r=n.context.lookup(t,l);return r===l.of("Btn")?Fa(n,e):r===l.of("Ch")?ka(n,e):r===l.of("Tx")?nn.fromDict(n,e):r===l.of("Sig")?Fr.fromDict(n,e):Jt.fromDict(n,e)},Fa=(n,e)=>{var t;const r=as(n,l.of("Ff")),i=n.context.lookupMaybe(r,ne),s=(t=i==null?void 0:i.asNumber())!==null&&t!==void 0?t:0;return Ui(s,bt.PushButton)?rn.fromDict(n,e):Ui(s,bt.Radio)?sn.fromDict(n,e):Qt.fromDict(n,e)},ka=(n,e)=>{var t;const r=as(n,l.of("Ff")),i=n.context.lookupMaybe(r,ne),s=(t=i==null?void 0:i.asNumber())!==null&&t!==void 0?t:0;return Ui(s,Fe.Combo)?en.fromDict(n,e):on.fromDict(n,e)},Ui=(n,e)=>(n&e)!==0,as=(n,e)=>{let t;return Ao(n,r=>{t||(t=r.get(e))}),t},Ao=(n,e)=>{e(n);const t=n.lookupMaybe(l.of("Parent"),ie);t&&Ao(t,e)};class cn{constructor(e){this.dict=e}Fields(){const e=this.dict.lookup(l.of("Fields"));if(e instanceof ve)return e}getFields(){const{Fields:e}=this.normalizedEntries(),t=new Array(e.size());for(let r=0,i=e.size();r<i;r++){const s=e.get(r),o=e.lookup(r,ie);t[r]=[So(o,s),s]}return t}getAllFields(){const e=[],t=r=>{if(r)for(let i=0,s=r.length;i<s;i++){const o=r[i];e.push(o);const[c]=o;c instanceof tn&&t(cs(c.Kids()))}};return t(this.getFields()),e}addField(e){const{Fields:t}=this.normalizedEntries();t==null||t.push(e)}removeField(e){const t=e.getParent(),r=t===void 0?this.normalizedEntries().Fields:t.Kids(),i=r==null?void 0:r.indexOf(e.ref);if(r===void 0||i===void 0)throw new Error(`Tried to remove inexistent field ${e.getFullyQualifiedName()}`);r.remove(i),t!==void 0&&r.size()===0&&this.removeField(t)}normalizedEntries(){let e=this.Fields();return e||(e=this.dict.context.obj([]),this.dict.set(l.of("Fields"),e)),{Fields:e}}}cn.fromDict=n=>new cn(n);cn.create=n=>{const e=n.obj({Fields:[]});return new cn(e)};class Xn extends ie{Pages(){return this.lookup(l.of("Pages"),ie)}AcroForm(){return this.lookupMaybe(l.of("AcroForm"),ie)}getAcroForm(){const e=this.AcroForm();if(e)return cn.fromDict(e)}getOrCreateAcroForm(){let e=this.getAcroForm();if(!e){e=cn.create(this.context);const t=this.context.register(e.dict);this.set(l.of("AcroForm"),t)}return e}ViewerPreferences(){return this.lookupMaybe(l.of("ViewerPreferences"),ie)}getViewerPreferences(){const e=this.ViewerPreferences();if(e)return Gn.fromDict(e)}getOrCreateViewerPreferences(){let e=this.getViewerPreferences();if(!e){e=Gn.create(this.context);const t=this.context.register(e.dict);this.set(l.of("ViewerPreferences"),t)}return e}insertLeafNode(e,t){const r=this.get(l.of("Pages"));return this.Pages().insertLeafNode(e,t)||r}removeLeafNode(e){this.Pages().removeLeafNode(e)}}Xn.withContextAndPages=(n,e)=>{const t=new Map;return t.set(l.of("Type"),l.of("Catalog")),t.set(l.of("Pages"),e),new Xn(t,n)};Xn.fromMapWithContext=(n,e)=>new Xn(n,e);class jt extends ie{Parent(){return this.lookup(l.of("Parent"))}Kids(){return this.lookup(l.of("Kids"),ve)}Count(){return this.lookup(l.of("Count"),ne)}pushTreeNode(e){this.Kids().push(e)}pushLeafNode(e){const t=this.Kids();this.insertLeafKid(t.size(),e)}insertLeafNode(e,t){const r=this.Kids(),i=this.Count().asNumber();if(t>i)throw new Rs(t,i);let s=t;for(let o=0,c=r.size();o<c;o++){if(s===0){this.insertLeafKid(o,e);return}const a=r.get(o),d=this.context.lookup(a);if(d instanceof jt){if(d.Count().asNumber()>s)return d.insertLeafNode(e,s)||a;s-=d.Count().asNumber()}d instanceof tt&&(s-=1)}if(s===0){this.insertLeafKid(r.size(),e);return}throw new Es(t,"insertLeafNode")}removeLeafNode(e,t=!0){const r=this.Kids(),i=this.Count().asNumber();if(e>=i)throw new Rs(e,i);let s=e;for(let o=0,c=r.size();o<c;o++){const a=r.get(o),d=this.context.lookup(a);if(d instanceof jt)if(d.Count().asNumber()>s){d.removeLeafNode(s,t),t&&d.Kids().size()===0&&r.remove(o);return}else s-=d.Count().asNumber();if(d instanceof tt)if(s===0){this.removeKid(o);return}else s-=1}throw new Es(e,"removeLeafNode")}ascend(e){e(this);const t=this.Parent();t&&t.ascend(e)}traverse(e){const t=this.Kids();for(let r=0,i=t.size();r<i;r++){const s=t.get(r),o=this.context.lookup(s);o instanceof jt&&o.traverse(e),e(o,s)}}insertLeafKid(e,t){const r=this.Kids();this.ascend(i=>
36{const s=i.Count().asNumber()+1;i.set(l.of("Count"),ne.of(s))}),r.insert(e,t)}removeKid(e){const t=this.Kids();t.lookup(e)instanceof tt&&this.ascend(i=>{const s=i.Count().asNumber()-1;i.set(l.of("Count"),ne.of(s))}),t.remove(e)}}jt.withContext=(n,e)=>{const t=new Map;return t.set(l.of("Type"),l.of("Pages")),t.set(l.of("Kids"),n.obj([])),t.set(l.of("Count"),n.obj(0)),e&&t.set(l.of("Parent"),e),new jt(t,n)};jt.fromMapWithContext=(n,e)=>new jt(n,e);const nt=new Uint8Array(256);nt[f.Zero]=1;nt[f.One]=1;nt[f.Two]=1;nt[f.Three]=1;nt[f.Four]=1;nt[f.Five]=1;nt[f.Six]=1;nt[f.Seven]=1;nt[f.Eight]=1;nt[f.Nine]=1;const Si=new Uint8Array(256);Si[f.Period]=1;Si[f.Plus]=1;Si[f.Minus]=1;const ls=new Uint8Array(256);for(let n=0,e=256;n<e;n++)ls[n]=nt[n]||Si[n]?1:0;const{Newline:Hs,CarriageReturn:Ks}=f;class Ba{constructor(e,t=!1){this.bytes=e,this.capNumbers=t}parseRawInt(){let e="";for(;!this.bytes.done();){const r=this.bytes.peek();if(!nt[r])break;e+=Nt(this.bytes.next())}const t=Number(e);if(!e||!isFinite(t))throw new Is(this.bytes.position(),e);return t}parseRawNumber(){let e="";for(;!this.bytes.done();){const r=this.bytes.peek();if(!ls[r]||(e+=Nt(this.bytes.next()),r===f.Period))break}for(;!this.bytes.done();){const r=this.bytes.peek();if(!nt[r])break;e+=Nt(this.bytes.next())}const t=Number(e);if(!e||!isFinite(t))throw new Is(this.bytes.position(),e);if(t>Number.MAX_SAFE_INTEGER)if(this.capNumbers){const r=`Parsed number that is too large for some PDF readers: ${e}, using Number.MAX_SAFE_INTEGER instead.`;return console.warn(r),Number.MAX_SAFE_INTEGER}else{const r=`Parsed number that is too large for some PDF readers: ${e}, not capping.`;console.warn(r)}return t}skipWhitespace(){for(;!this.bytes.done()&&Kt[this.bytes.peek()];)this.bytes.next()}skipLine(){for(;!this.bytes.done();){const e=this.bytes.peek();if(e===Hs||e===Ks)return;this.bytes.next()}}skipComment(){if(this.bytes.peek()!==f.Percent)return!1;for(;!this.bytes.done();){const e=this.bytes.peek();if(e===Hs||e===Ks)return!0;this.bytes.next()}return!0}skipWhitespaceAndComments(){for(this.skipWhitespace();this.skipComment();)this.skipWhitespace()}matchKeyword(e){const t=this.bytes.offset();for(let r=0,i=e.length;r<i;r++)if(this.bytes.done()||this.bytes.next()!==e[r])return this.bytes.moveTo(t),!1;return!0}}class an{constructor(e){this.idx=0,this.line=0,this.column=0,this.bytes=e,this.length=this.bytes.length}moveTo(e){this.idx=e}next(){const e=this.bytes[this.idx++];return e===f.Newline?(this.line+=1,this.column=0):this.column+=1,e}assertNext(e){if(this.peek()!==e)throw new Kc(this.position(),e,this.peek());return this.next()}peek(){return this.bytes[this.idx]}peekAhead(e){return this.bytes[this.idx+e]}peekAt(e){return this.bytes[e]}done(){return this.idx>=this.length}offset(){return this.idx}slice(e,t){return this.bytes.slice(e,t)}position(){return{line:this.line,column:this.column,offset:this.idx}}}an.of=n=>new an(n);an.fromPDFRawStream=n=>an.of(wo(n).decode());const{Space:Da,CarriageReturn:hr,Newline:ur}=f,fr=[f.s,f.t,f.r,f.e,f.a,f.m],$r=[f.e,f.n,f.d,f.s,f.t,f.r,f.e,f.a,f.m],De={header:[f.Percent,f.P,f.D,f.F,f.Dash],eof:[f.Percent,f.Percent,f.E,f.O,f.F],obj:[f.o,f.b,f.j],endobj:[f.e,f.n,f.d,f.o,f.b,f.j],xref:[f.x,f.r,f.e,f.f],trailer:[f.t,f.r,f.a,f.i,f.l,f.e,f.r],startxref:[f.s,f.t,f.a,f.r,f.t,f.x,f.r,f.e,f.f],true:[f.t,f.r,f.u,f.e],false:[f.f,f.a,f.l,f.s,f.e],null:[f.n,f.u,f.l,f.l],stream:fr,streamEOF1:[...fr,Da,hr,ur],streamEOF2:[...fr,hr,ur],streamEOF3:[...fr,hr],streamEOF4:[...fr,ur],endstream:$r,EOF1endstream:[hr,ur,...$r],EOF2endstream:[hr,...$r],EOF3endstream:[ur,...$r]};class qn extends Ba{constructor(e,t,r=!1){super(e,r),this.context=t}parseObject(){if(this.skipWhitespaceAndComments(),this.matchKeyword(De.true))return Ut.True;if(this.matchKeyword(De.false))return Ut.False;if(this.matchKeyword(De.null))return dt;const e=this.bytes.peek();if(e===f.LessThan&&this.bytes.peekAhead(1)===f.LessThan)return this.parseDictOrStream();if(e===f.LessThan)return this.parseHexString();if(e===f.LeftParen)return this.parseString();if(e===f.ForwardSlash)return this.parseName();if(e===f.LeftSquareBracket)return this.parseArray();if(ls[e])return this.parseNumberOrRef();throw new $c(this.bytes.position(),e)}parseNumberOrRef(){const e=this.parseRawNumber();this.skipWhitespaceAndComments();const t=this.bytes.offset();if(nt[this.bytes.peek()]){const r=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===f.R)return this.bytes.assertNext(f.R),Ce.of(e,r)}return this.bytes.moveTo(t),ne.of(e)}parseHexString(){let e="";for(this.bytes.assertNext(f.LessThan);!this.bytes.done()&&this.bytes.peek()!==f.GreaterThan;)e+=Nt(this.bytes.next());return this.bytes.assertNext(f.GreaterThan),ee.of(e)}parseString(){let e=0,t=!1,r="";for(;!this.bytes.done();){const i=this.bytes.next();if(r+=Nt(i),t||(i===f.LeftParen&&(e+=1),i===f.RightParen&&(e-=1)),i===f.BackSlash?t=!t:t&&(t=!1),e===0)return me.of(r.substring(1,r.length-1))}throw new Xc(this.bytes.position())}parseName(){this.bytes.assertNext(f.ForwardSlash);let e="";for(;!this.bytes.done();){const t=this.bytes.peek();if(Kt[t]||Ct[t])break;e+=Nt(t),this.bytes.next()}return l.of(e)}parseArray(){this.bytes.assertNext(f.LeftSquareBracket),this.skipWhitespaceAndComments();const e=ve.withContext(this.context);for(;this.bytes.peek()!==f.RightSquareBracket;){const t=this.parseObject();e.push(t),this.skipWhitespaceAndComments()}return this.bytes.assertNext(f.RightSquareBracket),e}parseDict(){this.bytes.assertNext(f.LessThan),this.bytes.assertNext(f.LessThan),this.skipWhitespaceAndComments();const e=new Map;for(;!this.bytes.done()&&this.bytes.peek()!==f.GreaterThan&&this.bytes.peekAhead(1)!==f.GreaterThan;){const r=this.parseName(),i=this.parseObject();e.set(r,i),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(f.GreaterThan),this.bytes.assertNext(f.GreaterThan);const t=e.get(l.of("Type"));return t===l.of("Catalog")?Xn.fromMapWithContext(e,this.context):t===l.of("Pages")?jt.fromMapWithContext(e,this.context):t===l.of("Page")?tt.fromMapWithContext(e,this.context):ie.fromMapWithContext(e,this.context)}parseDictOrStream(){const e=this.bytes.position(),t=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(De.streamEOF1)&&!this.matchKeyword(De.streamEOF2)&&!this.matchKeyword(De.streamEOF3)&&!this.matchKeyword(De.streamEOF4)&&!this.matchKeyword(De.stream))return t;const r=this.bytes.offset();let i;const s=t.get(l.of("Length"));s instanceof ne?(i=r+s.asNumber(),this.bytes.moveTo(i),this.skipWhitespaceAndComments(),this.matchKeyword(De.endstream)||(this.bytes.moveTo(r),i=this.findEndOfStreamFallback(e))):i=this.findEndOfStreamFallback(e);const o=this.bytes.slice(r,i);return Ht.of(t,o)}findEndOfStreamFallback(e){let t=1,r=this.bytes.offset();for(;!this.bytes.done()&&(r=this.bytes.offset(),this.matchKeyword(De.stream)?t+=1:this.matchKeyword(De.EOF1endstream)||this.matchKeyword(De.EOF2endstream)||this.matchKeyword(De.EOF3endstream)||this.matchKeyword(De.endstream)?t-=1:this.bytes.next(),t!==0););if(t!==0)throw new Gc(e);return r}}qn.forBytes=(n,e,t)=>new qn(an.of(n),e,t);qn.forByteStream=(n,e,t=!1)=>new qn(n,e,t);class Hi extends qn{constructor(e,t){super(an.fromPDFRawStream(e),e.dict.context);const{dict:r}=e;this.alreadyParsed=!1,this.shouldWaitForTick=t||(()=>!1),this.firstOffset=r.lookup(l.of("First"),ne).asNumber(),this.objectCount=r.lookup(l.of("N"),ne).asNumber()}parseIntoContext(){return fe(this,void 0,void 0,function*(){if(this.alreadyParsed)throw new Qi("PDFObjectStreamParser","parseIntoContext");this.alreadyParsed=!0;const e=this.parseOffsetsAndObjectNumbers();for(let t=0,r=e.length;t<r;t++){const{objectNumber:i,offset:s}=e[t];this.bytes.moveTo(this.firstOffset+s);const o=this.parseObject(),c=Ce.of(i,0);this.context.assign(c,o),this.shouldWaitForTick()&&(yield Un())}})}parseOffsetsAndObjectNumbers(){const e=[];for(let t=0,r=this.objectCount;t<r;t++){this.skipWhitespaceAndComments();const i=this.parseRawInt();this.skipWhitespaceAndComments();const s=this.parseRawInt();e.push({objectNumber:i,offset:s})}return e}}Hi.forStream=(n,e)=>new Hi(n,e);class Ki{constructor(e){this.alreadyParsed=!1,this.dict=e.dict,this.bytes=an.fromPDFRawStream(e),this.context=this.dict.context;const t=this.dict.lookup(l.of("Size"),ne),r=this.dict.lookup(l.of("Index"));if(r instanceof ve){this.subsections=[];for(let s=0,o=r.size();s<o;s+=2){const c=r.lookup(s+0,ne).asNumber(),a=r.lookup(s+1,ne).asNumber();
36this.subsections.push({firstObjectNumber:c,length:a})}}else this.subsections=[{firstObjectNumber:0,length:t.asNumber()}];const i=this.dict.lookup(l.of("W"),ve);this.byteWidths=[-1,-1,-1];for(let s=0,o=i.size();s<o;s++)this.byteWidths[s]=i.lookup(s,ne).asNumber()}parseIntoContext(){if(this.alreadyParsed)throw new Qi("PDFXRefStreamParser","parseIntoContext");return this.alreadyParsed=!0,this.context.trailerInfo={Root:this.dict.get(l.of("Root")),Encrypt:this.dict.get(l.of("Encrypt")),Info:this.dict.get(l.of("Info")),ID:this.dict.get(l.of("ID"))},this.parseEntries()}parseEntries(){const e=[],[t,r,i]=this.byteWidths;for(let s=0,o=this.subsections.length;s<o;s++){const{firstObjectNumber:c,length:a}=this.subsections[s];for(let d=0;d<a;d++){let p=0;for(let N=0,K=t;N<K;N++)p=p<<8|this.bytes.next();let C=0;for(let N=0,K=r;N<K;N++)C=C<<8|this.bytes.next();let v=0;for(let N=0,K=i;N<K;N++)v=v<<8|this.bytes.next();t===0&&(p=1);const T=c+d,j={ref:Ce.of(T,v),offset:C,deleted:p===0,inObjectStream:p===2};e.push(j)}}return e}}Ki.forStream=n=>new Ki(n);class $i extends qn{constructor(e,t=1/0,r=!1,i=!1){super(an.of(e),Ar.create(),i),this.alreadyParsed=!1,this.parsedObjects=0,this.shouldWaitForTick=()=>(this.parsedObjects+=1,this.parsedObjects%this.objectsPerTick===0),this.objectsPerTick=t,this.throwOnInvalidObject=r}parseDocument(){return fe(this,void 0,void 0,function*(){if(this.alreadyParsed)throw new Qi("PDFParser","parseDocument");this.alreadyParsed=!0,this.context.header=this.parseHeader();let e;for(;!this.bytes.done();){yield this.parseDocumentSection();const t=this.bytes.offset();if(t===e)throw new qc(this.bytes.position());e=t}return this.maybeRecoverRoot(),this.context.lookup(Ce.of(0))&&(console.warn("Removing parsed object: 0 0 R"),this.context.delete(Ce.of(0))),this.context})}maybeRecoverRoot(){const e=r=>r instanceof ie&&r.lookup(l.of("Type"))===l.of("Catalog"),t=this.context.lookup(this.context.trailerInfo.Root);if(!e(t)){const r=this.context.enumerateIndirectObjects();for(let i=0,s=r.length;i<s;i++){const[o,c]=r[i];e(c)&&(this.context.trailerInfo.Root=o)}}}parseHeader(){for(;!this.bytes.done();){if(this.matchKeyword(De.header)){const e=this.parseRawInt();this.bytes.assertNext(f.Period);const t=this.parseRawInt(),r=ri.forVersion(e,t);return this.skipBinaryHeaderComment(),r}this.bytes.next()}throw new Zc(this.bytes.position())}parseIndirectObjectHeader(){this.skipWhitespaceAndComments();const e=this.parseRawInt();this.skipWhitespaceAndComments();const t=this.parseRawInt();if(this.skipWhitespaceAndComments(),!this.matchKeyword(De.obj))throw new Yc(this.bytes.position(),De.obj);return Ce.of(e,t)}matchIndirectObjectHeader(){const e=this.bytes.offset();try{return this.parseIndirectObjectHeader(),!0}catch{return this.bytes.moveTo(e),!1}}parseIndirectObject(){return fe(this,void 0,void 0,function*(){const e=this.parseIndirectObjectHeader();this.skipWhitespaceAndComments();const t=this.parseObject();return this.skipWhitespaceAndComments(),this.matchKeyword(De.endobj),t instanceof Ht&&t.dict.lookup(l.of("Type"))===l.of("ObjStm")?yield Hi.forStream(t,this.shouldWaitForTick).parseIntoContext():t instanceof Ht&&t.dict.lookup(l.of("Type"))===l.of("XRef")?Ki.forStream(t).parseIntoContext():this.context.assign(e,t),e})}tryToParseInvalidIndirectObject(){const e=this.bytes.position(),t=`Trying to parse invalid object: ${JSON.stringify(e)})`;if(this.throwOnInvalidObject)throw new Error(t);console.warn(t);const r=this.parseIndirectObjectHeader();console.warn(`Invalid object ref: ${r}`),this.skipWhitespaceAndComments();const i=this.bytes.offset();let s=!0;for(;!this.bytes.done()&&(this.matchKeyword(De.endobj)&&(s=!1),!!s);)this.bytes.next();if(s)throw new Vc(e);const o=this.bytes.offset()-De.endobj.length,c=$n.of(this.bytes.slice(i,o));return this.context.assign(r,c),r}parseIndirectObjects(){return fe(this,void 0,void 0,function*(){for(this.skipWhitespaceAndComments();!this.bytes.done()&&nt[this.bytes.peek()];){const e=this.bytes.offset();try{yield this.parseIndirectObject()}catch{this.bytes.moveTo(e),this.tryToParseInvalidIndirectObject()}this.skipWhitespaceAndComments(),this.skipJibberish(),this.shouldWaitForTick()&&(yield Un())}})}maybeParseCrossRefSection(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(De.xref))return;this.skipWhitespaceAndComments();let e=-1;const t=Hn.createEmpty();for(;!this.bytes.done()&&nt[this.bytes.peek()];){const r=this.parseRawInt();this.skipWhitespaceAndComments();const i=this.parseRawInt();this.skipWhitespaceAndComments();const s=this.bytes.peek();if(s===f.n||s===f.f){const o=Ce.of(e,i);this.bytes.next()===f.n?t.addEntry(o,r):t.addDeletedEntry(o,r),e+=1}else e=r;this.skipWhitespaceAndComments()}return t}maybeParseTrailerDict(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(De.trailer))return;this.skipWhitespaceAndComments();const e=this.parseDict(),{context:t}=this;t.trailerInfo={Root:e.get(l.of("Root"))||t.trailerInfo.Root,Encrypt:e.get(l.of("Encrypt"))||t.trailerInfo.Encrypt,Info:e.get(l.of("Info"))||t.trailerInfo.Info,ID:e.get(l.of("ID"))||t.trailerInfo.ID}}maybeParseTrailer(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(De.startxref))return;this.skipWhitespaceAndComments();const e=this.parseRawInt();return this.skipWhitespace(),this.matchKeyword(De.eof),this.skipWhitespaceAndComments(),this.matchKeyword(De.eof),this.skipWhitespaceAndComments(),Cr.forLastCrossRefSectionOffset(e)}parseDocumentSection(){return fe(this,void 0,void 0,function*(){yield this.parseIndirectObjects(),this.maybeParseCrossRefSection(),this.maybeParseTrailerDict(),this.maybeParseTrailer(),this.skipJibberish()})}skipJibberish(){for(this.skipWhitespaceAndComments();!this.bytes.done();){const e=this.bytes.offset(),t=this.bytes.peek();if(t>=f.Space&&t<=f.Tilde&&(this.matchKeyword(De.xref)||this.matchKeyword(De.trailer)||this.matchKeyword(De.startxref)||this.matchIndirectObjectHeader())){this.bytes.moveTo(e);break}this.bytes.next()}}skipBinaryHeaderComment(){this.skipWhitespaceAndComments();try{const e=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(e)}catch{this.bytes.next(),this.skipWhitespaceAndComments()}}}$i.forBytesWithOptions=(n,e,t,r)=>new $i(n,e,t,r);const Et=n=>1<<n;var Sr;(function(n){n[n.Invisible=Et(0)]="Invisible",n[n.Hidden=Et(1)]="Hidden",n[n.Print=Et(2)]="Print",n[n.NoZoom=Et(3)]="NoZoom",n[n.NoRotate=Et(4)]="NoRotate",n[n.NoView=Et(5)]="NoView",n[n.ReadOnly=Et(6)]="ReadOnly",n[n.Locked=Et(7)]="Locked",n[n.ToggleNoView=Et(8)]="ToggleNoView",n[n.LockedContents=Et(9)]="LockedContents"})(Sr||(Sr={}));const Ai=n=>n instanceof l?n:l.of(n),Z=n=>n instanceof ne?n:ne.of(n),ce=n=>n instanceof ne?n.asNumber():n;var kr;(function(n){n.Degrees="degrees",n.Radians="radians"})(kr||(kr={}));const T0=n=>
36(A(n,"radianAngle",["number"]),{type:kr.Radians,angle:n}),re=n=>(A(n,"degreeAngle",["number"]),{type:kr.Degrees,angle:n}),{Radians:Co,Degrees:Fo}=kr,vn=n=>n*Math.PI/180,Pa=n=>n*180/Math.PI,He=n=>n.type===Co?n.angle:n.type===Fo?vn(n.angle):Or(`Invalid rotation: ${JSON.stringify(n)}`),ko=n=>n.type===Co?Pa(n.angle):n.type===Fo?n.angle:Or(`Invalid rotation: ${JSON.stringify(n)}`),$t=(n=0)=>{const e=n/90%4;return e===0?0:e===1?90:e===2?180:e===3?270:0},Cn=(n,e=0)=>{const t=$t(e);return t===90||t===270?{width:n.height,height:n.width}:{width:n.width,height:n.height}},Ta=(n,e=0,t=0)=>{const{x:r,y:i,width:s,height:o}=n,c=$t(t),a=e/2;return c===0?{x:r-a,y:i-a,width:s,height:o}:c===90?{x:r-o+a,y:i-a,width:o,height:s}:c===180?{x:r-s+a,y:i-o+a,width:s,height:o}:c===270?{x:r-a,y:i-s+a,width:o,height:s}:{x:r-a,y:i-a,width:s,height:o}},Bo=()=>se.of(he.ClipNonZero),_0=()=>se.of(he.ClipEvenOdd),{cos:ci,sin:ai,tan:li}=Math,Ci=(n,e,t,r,i,s)=>se.of(he.ConcatTransformationMatrix,[Z(n),Z(e),Z(t),Z(r),Z(i),Z(s)]),wt=(n,e)=>Ci(1,0,0,1,n,e),di=(n,e)=>Ci(n,0,0,e,0,0),Jn=n=>Ci(ci(ce(n)),ai(ce(n)),-ai(ce(n)),ci(ce(n)),0,0),Vr=n=>Jn(vn(ce(n))),Fi=(n,e)=>Ci(1,li(ce(n)),li(ce(e)),1,0,0),O0=(n,e)=>Fi(vn(ce(n)),vn(ce(e))),Ir=(n,e)=>se.of(he.SetLineDashPattern,[`[${n.map(Z).join(" ")}]`,Z(e)]),R0=()=>Ir([],0);var jn;(function(n){n[n.Butt=0]="Butt",n[n.Round=1]="Round",n[n.Projecting=2]="Projecting"})(jn||(jn={}));const ki=n=>se.of(he.SetLineCapStyle,[Z(n)]);var $s;(function(n){n[n.Miter=0]="Miter",n[n.Round=1]="Round",n[n.Bevel=2]="Bevel"})($s||($s={}));const E0=n=>se.of(he.SetLineJoinStyle,[Z(n)]),un=n=>se.of(he.SetGraphicsStateParams,[Ai(n)]),Xe=()=>se.of(he.PushGraphicsState),qe=()=>se.of(he.PopGraphicsState),jr=n=>se.of(he.SetLineWidth,[Z(n)]),pt=(n,e,t,r,i,s)=>se.of(he.AppendBezierCurve,[Z(n),Z(e),Z(t),Z(r),Z(i),Z(s)]),Gr=(n,e,t,r)=>se.of(he.CurveToReplicateInitialPoint,[Z(n),Z(e),Z(t),Z(r)]),ln=()=>se.of(he.ClosePath),Mt=(n,e)=>se.of(he.MoveTo,[Z(n),Z(e)]),Ye=(n,e)=>se.of(he.LineTo,[Z(n),Z(e)]),_a=(n,e,t,r)=>se.of(he.AppendRectangle,[Z(n),Z(e),Z(t),Z(r)]),I0=(n,e,t)=>_a(n,e,t,t),Mr=()=>se.of(he.StrokePath),ds=()=>se.of(he.FillNonZero),hs=()=>se.of(he.FillNonZeroAndStroke),Do=()=>se.of(he.EndPath),Oa=()=>se.of(he.NextLine),j0=(n,e)=>se.of(he.MoveText,[Z(n),Z(e)]),us=n=>se.of(he.ShowText,[n]),fs=()=>se.of(he.BeginText),gs=()=>se.of(he.EndText),Bi=(n,e)=>se.of(he.SetFontAndSize,[Ai(n),Z(e)]),M0=n=>se.of(he.SetCharacterSpacing,[Z(n)]),W0=n=>se.of(he.SetWordSpacing,[Z(n)]),z0=n=>se.of(he.SetTextHorizontalScaling,[Z(n)]),Ra=n=>se.of(he.SetTextLineHeight,[Z(n)]),N0=n=>se.of(he.SetTextRise,[Z(n)]);var Vs;(function(n){n[n.Fill=0]="Fill",n[n.Outline=1]="Outline",n[n.FillAndOutline=2]="FillAndOutline",n[n.Invisible=3]="Invisible",n[n.FillAndClip=4]="FillAndClip",n[n.OutlineAndClip=5]="OutlineAndClip",n[n.FillAndOutlineAndClip=6]="FillAndOutlineAndClip",n[n.Clip=7]="Clip"})(Vs||(Vs={}));const L0=n=>se.of(he.SetTextRenderingMode,[Z(n)]),Ea=(n,e,t,r,i,s)=>se.of(he.SetTextMatrix,[Z(n),Z(e),Z(t),Z(r),Z(i),Z(s)]),Di=(n,e,t,r,i)=>Ea(ci(ce(n)),ai(ce(n))+li(ce(e)),-ai(ce(n))+li(ce(t)),ci(ce(n)),r,i),U0=(n,e,t,r,i)=>Di(vn(ce(n)),vn(ce(e)),vn(ce(t)),r,i),xs=n=>se.of(he.DrawObject,[Ai(n)]),Ia=n=>se.of(he.NonStrokingColorGray,[Z(n)]),ja=n=>se.of(he.StrokingColorGray,[Z(n)]),Ma=(n,e,t)=>se.of(he.NonStrokingColorRgb,[Z(n),Z(e),Z(t)]),Wa=(n,e,t)=>se.of(he.StrokingColorRgb,[Z(n),Z(e),Z(t)]),za=(n,e,t,r)=>se.of(he.NonStrokingColorCmyk,[Z(n),Z(e),Z(t),Z(r)]),Na=(n,e,t,r)=>se.of(he.StrokingColorCmyk,[Z(n),Z(e),Z(t),Z(r)]),Po=n=>se.of(he.BeginMarkedContent,[Ai(n)]),To=()=>se.of(he.EndMarkedContent);var Zn;(function(n){n.Grayscale="Grayscale",n.RGB="RGB",n.CMYK="CMYK"})(Zn||(Zn={}));const _o=n=>(xt(n,"gray",0,1),{type:Zn.Grayscale,gray:n}),ke=(n,e,t)=>(xt(n,"red",0,1),xt(e,"green",0,1),xt(t,"blue",0,1),{type:Zn.RGB,red:n,green:e,blue:t}),Oo=(n,e,t,r)=>(xt(n,"cyan",0,1),xt(e,"magenta",0,1),xt(t,"yellow",0,1),xt(r,"key",0,1),{type:Zn.CMYK,cyan:n,magenta:e,yellow:t,key:r}),{Grayscale:ps,RGB:ys,CMYK:ms}=Zn,fn=n=>n.type===ps?Ia(n.gray):n.type===ys?Ma(n.red,n.green,n.blue):n.type===ms?za(n.cyan,n.magenta,n.yellow,n.key):Or(`Invalid color: ${JSON.stringify(n)}`),Wr=n=>n.type===ps?ja(n.gray):n.type===ys?Wa(n.red,n.green,n.blue):n.type===ms?Na(n.cyan,n.magenta,n.yellow,n.key):Or(`Invalid color: ${JSON.stringify(n)}`),ot=(n,e=1)=>(n==null?void 0:n.length)===1?_o(n[0]*e):(n==null?void 0:n.length)===3?ke(n[0]*e,n[1]*e,n[2]*e):(n==null?void 0:n.length)===4?Oo(n[0]*e,n[1]*e,n[2]*e,n[3]*e):void 0,Gs=n=>
36n.type===ps?[n.gray]:n.type===ys?[n.red,n.green,n.blue]:n.type===ms?[n.cyan,n.magenta,n.yellow,n.key]:Or(`Invalid color: ${JSON.stringify(n)}`);let J=0,Q=0,be=0,we=0,xr=0,pr=0;const Xs=new Map([["A",7],["a",7],["C",6],["c",6],["H",1],["h",1],["L",2],["l",2],["M",2],["m",2],["Q",4],["q",4],["S",4],["s",4],["T",2],["t",2],["V",1],["v",1],["Z",0],["z",0]]),La=n=>{let e;const t=[];let r=[],i="",s=!1,o=0;for(const c of n)if(Xs.has(c))o=Xs.get(c),e&&(i.length>0&&(r[r.length]=+i),t[t.length]={cmd:e,args:r},r=[],i="",s=!1),e=c;else if([" ",","].includes(c)||c==="-"&&i.length>0&&i[i.length-1]!=="e"||c==="."&&s){if(i.length===0)continue;r.length===o?(t[t.length]={cmd:e,args:r},r=[+i],e==="M"&&(e="L"),e==="m"&&(e="l")):r[r.length]=+i,s=c===".",i=["-","."].includes(c)?c:""}else i+=c,c==="."&&(s=!0);return i.length>0&&(r.length===o?(t[t.length]={cmd:e,args:r},r=[+i],e==="M"&&(e="L"),e==="m"&&(e="l")):r[r.length]=+i),t[t.length]={cmd:e,args:r},t},Ua=n=>{J=Q=be=we=xr=pr=0;let e=[];for(let t=0;t<n.length;t++){const r=n[t];if(r.cmd&&typeof qs[r.cmd]=="function"){const i=qs[r.cmd](r.args);Array.isArray(i)?e=e.concat(i):e.push(i)}}return e},qs={M(n){return J=n[0],Q=n[1],be=we=null,xr=J,pr=Q,Mt(J,Q)},m(n){return J+=n[0],Q+=n[1],be=we=null,xr=J,pr=Q,Mt(J,Q)},C(n){return J=n[4],Q=n[5],be=n[2],we=n[3],pt(n[0],n[1],n[2],n[3],n[4],n[5])},c(n){const e=pt(n[0]+J,n[1]+Q,n[2]+J,n[3]+Q,n[4]+J,n[5]+Q);return be=J+n[2],we=Q+n[3],J+=n[4],Q+=n[5],e},S(n){(be===null||we===null)&&(be=J,we=Q);const e=pt(J-(be-J),Q-(we-Q),n[0],n[1],n[2],n[3]);return be=n[0],we=n[1],J=n[2],Q=n[3],e},s(n){(be===null||we===null)&&(be=J,we=Q);const e=pt(J-(be-J),Q-(we-Q),J+n[0],Q+n[1],J+n[2],Q+n[3]);return be=J+n[0],we=Q+n[1],J+=n[2],Q+=n[3],e},Q(n){return be=n[0],we=n[1],J=n[2],Q=n[3],Gr(n[0],n[1],J,Q)},q(n){const e=Gr(n[0]+J,n[1]+Q,n[2]+J,n[3]+Q);return be=J+n[0],we=Q+n[1],J+=n[2],Q+=n[3],e},T(n){be===null||we===null?(be=J,we=Q):(be=J-(be-J),we=Q-(we-Q));const e=Gr(be,we,n[0],n[1]);return be=J-(be-J),we=Q-(we-Q),J=n[0],Q=n[1],e},t(n){be===null||we===null?(be=J,we=Q):(be=J-(be-J),we=Q-(we-Q));const e=Gr(be,we,J+n[0],Q+n[1]);return J+=n[0],Q+=n[1],e},A(n){const e=Zs(J,Q,n);return J=n[5],Q=n[6],e},a(n){n[5]+=J,n[6]+=Q;const e=Zs(J,Q,n);return J=n[5],Q=n[6],e},L(n){return J=n[0],Q=n[1],be=we=null,Ye(J,Q)},l(n){return J+=n[0],Q+=n[1],be=we=null,Ye(J,Q)},H(n){return J=n[0],be=we=null,Ye(J,Q)},h(n){return J+=n[0],be=we=null,Ye(J,Q)},V(n){return Q=n[0],be=we=null,Ye(J,Q)},v(n){return Q+=n[0],be=we=null,Ye(J,Q)},Z(){const n=ln();return J=xr,Q=pr,n},z(){const n=ln();return J=xr,Q=pr,n}},Zs=(n,e,t)=>{const[r,i,s,o,c,a,d]=t,p=Ha(a,d,r,i,o,c,s,n,e),C=[];for(const v of p){const T=Ka(...v);C.push(pt(...T))}return C},Ha=(n,e,t,r,i,s,o,c,a)=>{const d=o*(Math.PI/180),p=Math.sin(d),C=Math.cos(d);t=Math.abs(t),r=Math.abs(r),be=C*(c-n)*.5+p*(a-e)*.5,we=C*(a-e)*.5-p*(c-n)*.5;let v=be*be/(t*t)+we*we/(r*r);v>1&&(v=Math.sqrt(v),t*=v,r*=v);const T=C/t,j=p/t,N=-p/r,K=C/r,G=T*c+j*a,te=N*c+K*a,X=T*n+j*e,q=N*n+K*e;let Ee=1/((X-G)*(X-G)+(q-te)*(q-te))-.25;Ee<0&&(Ee=0);let Oe=Math.sqrt(Ee);s===i&&(Oe=-Oe);const Me=.5*(G+X)-Oe*(q-te),Re=.5*(te+q)+Oe*(X-G),We=Math.atan2(te-Re,G-Me);let Se=Math.atan2(q-Re,X-Me)-We;Se<0&&s===1?Se+=2*Math.PI:Se>0&&s===0&&(Se-=2*Math.PI);const ze=Math.ceil(Math.abs(Se/(Math.PI*.5+.001))),ht=[];for(let Te=0;Te<ze;Te++){const Ie=We+Te*Se/ze,lt=We+(Te+1)*Se/ze;ht[Te]=[Me,Re,Ie,lt,t,r,p,C]}return ht},Ka=(n,e,t,r,i,s,o,c)=>{const a=c*i,d=-o*s,p=o*i,C=c*s,v=.5*(r-t),T=8/3*Math.sin(v*.5)*Math.sin(v*.5)/Math.sin(v),j=n+Math.cos(t)-T*Math.sin(t),N=e+Math.sin(t)+T*Math.cos(t),K=n+Math.cos(r),G=e+Math.sin(r),te=K+T*Math.sin(r),X=G-T*Math.cos(r);return[a*j+d*N,p*j+C*N,a*te+d*X,p*te+C*X,a*K+d*G,p*K+C*G]},$a=n=>Ua(La(n)),H0=(n,e)=>[Xe(),e.graphicsState&&un(e.graphicsState),fs(),fn(e.color),Bi(e.font,e.size),Di(He(e.rotate),He(e.xSkew),He(e.ySkew),e.x,e.y),us(n),gs(),qe()].filter(Boolean),Va=(n,e)=>{const t=[Xe(),e.graphicsState&&un(e.graphicsState),fs(),fn(e.color),Bi(e.font,e.size),Ra(e.lineHeight),Di(He(e.rotate),He(e.xSkew),He(e.ySkew),e.x,e.y)].filter(Boolean);for(let r=0,i=n.length;r<i;r++)t.push(us(n[r]),Oa());return t.push(gs(),qe()),t},Ro=(n,e)=>[Xe(),e.graphicsState&&un(e.graphicsState),wt(e.x,e.y),Jn(He(e.rotate)),di(e.width,e.height),Fi(He(e.xSkew),He(e.ySkew)),xs(n),qe()].filter(
36Boolean),Ga=(n,e)=>[Xe(),e.graphicsState&&un(e.graphicsState),wt(e.x,e.y),Jn(He(e.rotate)),di(e.xScale,e.yScale),Fi(He(e.xSkew),He(e.ySkew)),xs(n),qe()].filter(Boolean),Xa=n=>{var e,t;return[Xe(),n.graphicsState&&un(n.graphicsState),n.color&&Wr(n.color),jr(n.thickness),Ir((e=n.dashArray)!==null&&e!==void 0?e:[],(t=n.dashPhase)!==null&&t!==void 0?t:0),Mt(n.start.x,n.start.y),n.lineCap&&ki(n.lineCap),Mt(n.start.x,n.start.y),Ye(n.end.x,n.end.y),Mr(),qe()].filter(Boolean)},Yn=n=>{var e,t;return[Xe(),n.graphicsState&&un(n.graphicsState),n.color&&fn(n.color),n.borderColor&&Wr(n.borderColor),jr(n.borderWidth),n.borderLineCap&&ki(n.borderLineCap),Ir((e=n.borderDashArray)!==null&&e!==void 0?e:[],(t=n.borderDashPhase)!==null&&t!==void 0?t:0),wt(n.x,n.y),Jn(He(n.rotate)),Fi(He(n.xSkew),He(n.ySkew)),Mt(0,0),Ye(0,n.height),Ye(n.width,n.height),Ye(n.width,0),ln(),n.color&&n.borderWidth?hs():n.color?ds():n.borderColor?Mr():ln(),qe()].filter(Boolean)},hi=4*((Math.sqrt(2)-1)/3),qa=n=>{let e=ce(n.x),t=ce(n.y);const r=ce(n.xScale),i=ce(n.yScale);e-=r,t-=i;const s=r*hi,o=i*hi,c=e+r*2,a=t+i*2,d=e+r,p=t+i;return[Xe(),Mt(e,p),pt(e,p-o,d-s,t,d,t),pt(d+s,t,c,p-o,c,p),pt(c,p+o,d+s,a,d,a),pt(d-s,a,e,p+o,e,p),qe()]},Za=n=>{const e=ce(n.x),t=ce(n.y),r=ce(n.xScale),i=ce(n.yScale),s=-r,o=-i,c=r*hi,a=i*hi,d=s+r*2,p=o+i*2,C=s+r,v=o+i;return[wt(e,t),Jn(He(n.rotate)),Mt(s,v),pt(s,v-a,C-c,o,C,o),pt(C+c,o,d,v-a,d,v),pt(d,v+a,C+c,p,C,p),pt(C-c,p,s,v+a,s,v)]},Vi=n=>{var e,t,r;return[Xe(),n.graphicsState&&un(n.graphicsState),n.color&&fn(n.color),n.borderColor&&Wr(n.borderColor),jr(n.borderWidth),n.borderLineCap&&ki(n.borderLineCap),Ir((e=n.borderDashArray)!==null&&e!==void 0?e:[],(t=n.borderDashPhase)!==null&&t!==void 0?t:0),...n.rotate===void 0?qa({x:n.x,y:n.y,xScale:n.xScale,yScale:n.yScale}):Za({x:n.x,y:n.y,xScale:n.xScale,yScale:n.yScale,rotate:(r=n.rotate)!==null&&r!==void 0?r:re(0)}),n.color&&n.borderWidth?hs():n.color?ds():n.borderColor?Mr():ln(),qe()].filter(Boolean)},Ya=(n,e)=>{var t,r,i;
36return[Xe(),e.graphicsState&&un(e.graphicsState),wt(e.x,e.y),Jn(He((t=e.rotate)!==null&&t!==void 0?t:re(0))),e.scale?di(e.scale,-e.scale):di(1,-1),e.color&&fn(e.color),e.borderColor&&Wr(e.borderColor),e.borderWidth&&jr(e.borderWidth),e.borderLineCap&&ki(e.borderLineCap),Ir((r=e.borderDashArray)!==null&&r!==void 0?r:[],(i=e.borderDashPhase)!==null&&i!==void 0?i:0),...$a(n),e.color&&e.borderWidth?hs():e.color?ds():e.borderColor?Mr():ln(),qe()].filter(Boolean)},Ja=n=>{const e=ce(n.size),t=-1+.75,r=-1+.51,i=1-.525,s=1-.31,o=-1+.325,c=.3995/(i-r)+r;return[Xe(),n.color&&Wr(n.color),jr(n.thickness),wt(n.x,n.y),Mt(o*e,c*e),Ye(t*e,r*e),Ye(s*e,i*e),Mr(),qe()].filter(Boolean)},gn=n=>n.rotation===0?[wt(0,0),Vr(0)]:n.rotation===90?[wt(n.width,0),Vr(90)]:n.rotation===180?[wt(n.width,n.height),Vr(180)]:n.rotation===270?[wt(0,n.height),Vr(270)]:[],Xr=n=>{const e=Yn({x:n.x,y:n.y,width:n.width,height:n.height,borderWidth:n.borderWidth,color:n.color,borderColor:n.borderColor,rotate:re(0),xSkew:re(0),ySkew:re(0)});if(!n.filled)return e;const t=ce(n.width),r=ce(n.height),i=Math.min(t,r)/2,s=Ja({x:t/2,y:r/2,size:i,thickness:n.thickness,color:n.markColor});return[Xe(),...e,...s,qe()]},qr=n=>{const e=ce(n.width),t=ce(n.height),r=Math.min(e,t)/2,i=Vi({x:n.x,y:n.y,xScale:r,yScale:r,color:n.color,borderColor:n.borderColor,borderWidth:n.borderWidth});if(!n.filled)return i;const s=Vi({x:n.x,y:n.y,xScale:r*.45,yScale:r*.45,color:n.dotColor,borderColor:void 0,borderWidth:0});return[Xe(),...i,...s,qe()]},Ys=n=>{const e=ce(n.x),t=ce(n.y),r=ce(n.width),i=ce(n.height),s=Yn({x:e,y:t,width:r,height:i,borderWidth:n.borderWidth,color:n.color,borderColor:n.borderColor,rotate:re(0),xSkew:re(0),ySkew:re(0)}),o=bs(n.textLines,{color:n.textColor,font:n.font,size:n.fontSize,rotate:re(0),xSkew:re(0),ySkew:re(0)});return[Xe(),...s,...o,qe()]},bs=(n,e)=>{const t=[fs(),fn(e.color),Bi(e.font,e.size)];for(let r=0,i=n.length;r<i;r++){const{encoded:s,x:o,y:c}=n[r];t.push(Di(He(e.rotate),He(e.xSkew),He(e.ySkew),o,c),us(s))}return t.push(gs()),t},Eo=n=>{const e=ce(n.x),t=ce(n.y),r=ce(n.width),i=ce(n.height),s=ce(n.borderWidth),o=ce(n.padding),c=e+s/2+o,a=t+s/2+o,d=r-(s/2+o)*2,p=i-(s/2+o)*2,C=[Mt(c,a),Ye(c,a+p),Ye(c+d,a+p),Ye(c+d,a),ln(),Bo(),Do()],v=Yn({x:e,y:t,width:r,height:i,borderWidth:n.borderWidth,color:n.color,borderColor:n.borderColor,rotate:re(0),xSkew:re(0),ySkew:re(0)}),T=bs(n.textLines,{color:n.textColor,font:n.font,size:n.fontSize,rotate:re(0),xSkew:re(0),ySkew:re(0)}),j=[Po("Tx"),Xe(),...T,qe(),To()];return[Xe(),...v,...C,...j,qe()]},Qa=n=>{const e=ce(n.x),t=ce(n.y),r=ce(n.width),i=ce(n.height),s=ce(n.lineHeight),o=ce(n.borderWidth),c=ce(n.padding),a=e+o/2+c,d=t+o/2+c,p=r-(o/2+c)*2,C=i-(o/2+c)*2,v=[Mt(a,d),Ye(a,d+C),Ye(a+p,d+C),Ye(a+p,d),ln(),Bo(),Do()],T=Yn({x:e,y:t,width:r,height:i,borderWidth:n.borderWidth,color:n.color,borderColor:n.borderColor,rotate:re(0),xSkew:re(0),ySkew:re(0)}),j=[];for(let G=0,te=n.selectedLines.length;G<te;G++){const X=n.textLines[n.selectedLines[G]];j.push(...Yn({x:X.x-c,y:X.y-(s-X.height)/2,width:r-o,height:X.height+(s-X.height)/2,borderWidth:0,color:n.selectedColor,borderColor:void 0,rotate:re(0),xSkew:re(0),ySkew:re(0)}))}const N=bs(n.textLines,{color:n.textColor,font:n.font,size:n.fontSize,rotate:re(0),xSkew:re(0),ySkew:re(0)}),K=[Po("Tx"),Xe(),...N,qe(),To()];return[Xe(),...T,...j,...v,...K,qe()]};class e0 extends Error{constructor(){super("Input document to `PDFDocument.load` is encrypted. You can use `PDFDocument.load(..., { ignoreEncryption: true })` if you wish to load the document anyways.")}}class t0 extends Error{constructor(){super("Input to `PDFDocument.embedFont` was a custom font, but no `fontkit` instance was found. You must register a `fontkit` instance with `PDFDocument.registerFontkit(...)` before embedding custom fonts.")}}class n0 extends Error{constructor(){super("A `page` passed to `PDFDocument.addPage` or `PDFDocument.insertPage` was from a different (foreign) PDF document. If you want to copy pages from one PDFDocument to another, you must use `PDFDocument.copyPages(...)` to copy the pages before adding or inserting them.")}}
36class r0 extends Error{constructor(){super("PDFDocument has no pages so `PDFDocument.removePage` cannot be called")}}class i0 extends Error{constructor(e){const t=`PDFDocument has no form field with the name "${e}"`;super(t)}}class pn extends Error{constructor(e,t,r){var i,s;const o=t==null?void 0:t.name,c=(s=(i=r==null?void 0:r.constructor)===null||i===void 0?void 0:i.name)!==null&&s!==void 0?s:r,a=`Expected field "${e}" to be of type ${o}, but it is actually of type ${c}`;super(a)}}class K0 extends Error{constructor(e){const t=`Failed to select check box due to missing onValue: "${e}"`;super(t)}}class Io extends Error{constructor(e){const t=`A field already exists with the specified name: "${e}"`;super(t)}}class s0 extends Error{constructor(e){const t=`Field name contains invalid component: "${e}"`;super(t)}}class $0 extends Error{constructor(e){const t=`A non-terminal field already exists with the specified name: "${e}"`;super(t)}}class o0 extends Error{constructor(e){const t=`Reading rich text fields is not supported: Attempted to read rich text field: ${e}`;super(t)}}class c0 extends Error{constructor(e,t){const r=`Failed to layout combed text as lineLength=${e} is greater than cellCount=${t}`;super(r)}}class a0 extends Error{constructor(e,t,r){const i=`Attempted to set text with length=${e} for TextField with maxLength=${t} and name=${r}`;super(i)}}class l0 extends Error{constructor(e,t,r){const i=`Attempted to set maxLength=${t}, which is less than ${e}, the length of this field's current value (name=${r})`;super(i)}}var Ge;(function(n){n[n.Left=0]="Left",n[n.Center=1]="Center",n[n.Right=2]="Right"})(Ge||(Ge={}));const jo=4,Mo=500,d0=(n,e,t)=>{let r=jo;for(;r<Mo;){for(let c=0,a=n.length;c<a;c++){const d=n[c];if(e.widthOfTextAtSize(d,r)>t.width)return r-1}const i=e.heightAtSize(r),s=i+i*.2;if(n.length*s>Math.abs(t.height))return r-1;r+=1}return r},h0=(n,e,t,r)=>{const i=t.width/r,s=t.height;let o=jo;const c=Xo(n);for(;o<Mo;){for(let d=0,p=c.length;d<p;d++){const C=c[d];if(e.widthOfTextAtSize(C,o)>i*.75)return o-1}if(e.heightAtSize(o,{descender:!1})>s)return o-1;o+=1}return o},u0=n=>{for(let e=n.length;e>0;e--)if(/\s/.test(n[e]))return e},f0=(n,e,t,r)=>{var i;let s=n.length;for(;s>0;){const o=n.substring(0,s),c=t.encodeText(o),a=t.widthOfTextAtSize(o,r);if(a<e){const d=n.substring(s)||void 0;return{line:o,encoded:c,width:a,remainder:d}}s=(i=u0(o))!==null&&i!==void 0?i:0}return{line:n,encoded:t.encodeText(n),width:t.widthOfTextAtSize(n,r),remainder:void 0}},Wo=(n,{alignment:e,fontSize:t,font:r,bounds:i})=>{const s=eo(_r(n));(t===void 0||t===0)&&(t=12);const o=r.heightAtSize(t),c=o+o*.2,a=[];let d=i.x,p=i.y,C=i.x+i.width,v=i.y+i.height,T=i.y+i.height;for(let j=0,N=s.length;j<N;j++){let K=s[j];for(;K!==void 0;){const{line:G,encoded:te,width:X,remainder:q}=f0(K,i.width,r,t),Be=e===Ge.Left?i.x:e===Ge.Center?i.x+i.width/2-X/2:e===Ge.Right?i.x+i.width-X:i.x;T-=c,Be<d&&(d=Be),T<p&&(p=T),Be+X>C&&(C=Be+X),T+o>v&&(v=T+o),a.push({text:G,encoded:te,width:X,height:o,x:Be,y:T}),K=q==null?void 0:q.trim()}}return{fontSize:t,lineHeight:c,lines:a,bounds:{x:d,y:p,width:C-d,height:v-p}}},g0=(n,{fontSize:e,font:t,bounds:r,cellCount:i})=>{const s=to(_r(n));if(s.length>i)throw new c0(s.length,i);(e===void 0||e===0)&&(e=h0(s,t,r,i));const o=r.width/i,c=t.heightAtSize(e,{descender:!1}),a=r.y+(r.height/2-c/2),d=[];let p=r.x,C=r.y,v=r.x+r.width,T=r.y+r.height,j=0,N=0;for(;j<i;){const[K,G]=no(s,N),te=t.encodeText(K),X=t.widthOfTextAtSize(K,e),Be=r.x+(o*j+o/2)-X/2;Be<p&&(p=Be),a<C&&(C=a),Be+X>v&&(v=Be+X),a+c>T&&(T=a+c),d.push({text:s,encoded:te,width:X,height:c,x:Be,y:a}),j+=1,N+=G}return{fontSize:e,cells:d,bounds:{x:p,y:C,width:v-p,height:T-C}}},ui=(n,{alignment:e,fontSize:t,font:r,bounds:i})=>{const s=to(_r(n));(t===void 0||t===0)&&(t=d0([s],r,i));const o=r.encodeText(s),c=r.widthOfTextAtSize(s,t),a=r.heightAtSize(t,{descender:!1}),d=e===Ge.Left?i.x:e===Ge.Center?i.x+i.width/2-c/2:e===Ge.Right?i.x+i.width-c:i.x,p=i.y+(i.height/2-a/2);return{fontSize:t,line:{text:s,encoded:o,width:c,height:a,x:d,y:p},bounds:{x:d,y:p,width:c,height:a}}},Qn=n=>"normal"in n?n:{normal:n},x0=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]+(\d*\.\d+|\d+)[\0\t\n\f\r\ ]+Tf/,dn=n=>{var e,t;const r=(e=n.getDefaultAppearance())!==null&&e!==void 0?e:"",i=(t=Yi(r,x0).match)!==null&&t!==void 0?t:[],s=Number(i[2]);return isFinite(s)?s:void 0},p0=/(\d*\.\d+|\d+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+(g|rg|k)/,St=n=>{var e;const t=(e=n.getDefaultAppearance())!==null&&e!==void 0?e:"",r=Yi(t,p0).match,[,i,s,o,c,a]=r??[];if(a==="g"&&i)return _o(Number(i));if(a==="rg"&&i&&s&&o)return ke(Number(i),Number(s),Number(o));if(a==="k"&&i&&s&&o&&c)return Oo(Number(i),Number(s),Number(o),Number(c))},At=(n,e,t,r=0)=>{var i;const s=[fn(e).toString(),Bi((i=t==null?void 0:t.name)!==null&&i!==void 0?i:"dummy__noop",r).toString()].join(` 37`);n.setDefaultAppearance(s)},y0=(n,e)=>{var t,r,i;const s=St(e),o=St(n.acroField),c=e.getRectangle(),a=e.getAppearanceCharacteristics(),d=e.getBorderStyle(),p=(t=d==null?void 0:d.getWidth())!==null&&t!==void 0?t:0,C=$t(a==null?void 0:a.getRotation()),{width:v,height:T}=Cn(c,C),j=gn(Object.assign(Object.assign({},c),{rotation:C})),N=ke(0,0,0),K=(r=ot(a==null?void 0:a.getBorderColor()))!==null&&r!==void 0?r:N,G=
37ot(a==null?void 0:a.getBackgroundColor()),te=ot(a==null?void 0:a.getBackgroundColor(),.8),X=(i=s??o)!==null&&i!==void 0?i:N;At(s?e:n.acroField,X);const q={x:0+p/2,y:0+p/2,width:v-p,height:T-p,thickness:1.5,borderWidth:p,borderColor:K,markColor:X};return{normal:{on:[...j,...Xr(Object.assign(Object.assign({},q),{color:G,filled:!0}))],off:[...j,...Xr(Object.assign(Object.assign({},q),{color:G,filled:!1}))]},down:{on:[...j,...Xr(Object.assign(Object.assign({},q),{color:te,filled:!0}))],off:[...j,...Xr(Object.assign(Object.assign({},q),{color:te,filled:!1}))]}}},m0=(n,e)=>{var t,r,i;const s=St(e),o=St(n.acroField),c=e.getRectangle(),a=e.getAppearanceCharacteristics(),d=e.getBorderStyle(),p=(t=d==null?void 0:d.getWidth())!==null&&t!==void 0?t:0,C=$t(a==null?void 0:a.getRotation()),{width:v,height:T}=Cn(c,C),j=gn(Object.assign(Object.assign({},c),{rotation:C})),N=ke(0,0,0),K=(r=ot(a==null?void 0:a.getBorderColor()))!==null&&r!==void 0?r:N,G=ot(a==null?void 0:a.getBackgroundColor()),te=ot(a==null?void 0:a.getBackgroundColor(),.8),X=(i=s??o)!==null&&i!==void 0?i:N;At(s?e:n.acroField,X);const q={x:v/2,y:T/2,width:v-p,height:T-p,borderWidth:p,borderColor:K,dotColor:X};return{normal:{on:[...j,...qr(Object.assign(Object.assign({},q),{color:G,filled:!0}))],off:[...j,...qr(Object.assign(Object.assign({},q),{color:G,filled:!1}))]},down:{on:[...j,...qr(Object.assign(Object.assign({},q),{color:te,filled:!0}))],off:[...j,...qr(Object.assign(Object.assign({},q),{color:te,filled:!1}))]}}},b0=(n,e,t)=>{var r,i,s,o,c;const a=St(e),d=St(n.acroField),p=dn(e),C=dn(n.acroField),v=e.getRectangle(),T=e.getAppearanceCharacteristics(),j=e.getBorderStyle(),N=T==null?void 0:T.getCaptions(),K=(r=N==null?void 0:N.normal)!==null&&r!==void 0?r:"",G=(s=(i=N==null?void 0:N.down)!==null&&i!==void 0?i:K)!==null&&s!==void 0?s:"",te=(o=j==null?void 0:j.getWidth())!==null&&o!==void 0?o:0,X=$t(T==null?void 0:T.getRotation()),{width:q,height:Be}=Cn(v,X),Ee=gn(Object.assign(Object.assign({},v),{rotation:X})),Oe=ke(0,0,0),Me=ot(T==null?void 0:T.getBorderColor()),Re=ot(T==null?void 0:T.getBackgroundColor()),We=ot(T==null?void 0:T.getBackgroundColor(),.8),at={x:te,y:te,width:q-te*2,height:Be-te*2},Se=ui(K,{alignment:Ge.Center,fontSize:p??C,font:t,bounds:at}),ze=ui(G,{alignment:Ge.Center,fontSize:p??C,font:t,bounds:at}),ht=Math.min(Se.fontSize,ze.fontSize),Te=(c=a??d)!==null&&c!==void 0?c:Oe;At(a||p!==void 0?e:n.acroField,Te,t,ht);const Ie={x:0+te/2,y:0+te/2,width:q-te,height:Be-te,borderWidth:te,borderColor:Me,textColor:Te,font:t.name,fontSize:ht};return{normal:[...Ee,...Ys(Object.assign(Object.assign({},Ie),{color:Re,textLines:[Se.line]}))],down:[...Ee,...Ys(Object.assign(Object.assign({},Ie),{color:We,textLines:[ze.line]}))]}},w0=(n,e,t)=>{var r,i,s,o;const c=St(e),a=St(n.acroField),d=dn(e),p=dn(n.acroField),C=e.getRectangle(),v=e.getAppearanceCharacteristics(),T=e.getBorderStyle(),j=(r=n.getText())!==null&&r!==void 0?r:"",N=(i=T==null?void 0:T.getWidth())!==null&&i!==void 0?i:0,K=$t(v==null?void 0:v.getRotation()),{width:G,height:te}=Cn(C,K),X=gn(Object.assign(Object.assign({},C),{rotation:K})),q=ke(0,0,0),Be=ot(v==null?void 0:v.getBorderColor()),Ee=ot(v==null?void 0:v.getBackgroundColor());let Oe,Me;const Re=n.isCombed()?0:1,We={x:N+Re,y:N+Re,width:G-(N+Re)*2,height:te-(N+Re)*2};if(n.isMultiline()){const ze=Wo(j,{alignment:n.getAlignment(),fontSize:d??p,font:t,bounds:We});Oe=ze.lines,Me=ze.fontSize}else if(n.isCombed()){const ze=g0(j,{fontSize:d??p,font:t,bounds:We,cellCount:(s=n.getMaxLength())!==null&&s!==void 0?s:0});Oe=ze.cells,Me=ze.fontSize}else{const ze=ui(j,{alignment:n.getAlignment(),fontSize:d??p,font:t,bounds:We});Oe=[ze.line],Me=ze.fontSize}const at=(o=c??a)!==null&&o!==void 0?o:q;At(c||d!==void 0?e:n.acroField,at,t,Me);const Se={x:0+N/2,y:0+N/2,width:G-N,height:te-N,borderWidth:N??0,borderColor:Be,textColor:at,font:t.name,fontSize:Me,color:Ee,textLines:Oe,padding:Re};return[...X,...Eo(Se)]},v0=(n,e,t)=>{var r,i,s;const o=St(e),c=St(n.acroField),a=dn(e),d=dn(n.acroField),p=e.getRectangle(),C=e.getAppearanceCharacteristics(),v=e.getBorderStyle(),T=(r=n.getSelected()[0])!==null&&r!==void 0?r:"",j=(i=v==null?void 0:v.getWidth())!==null&&i!==void 0?i:0,N=$t(C==null?void 0:C.getRotation()),{width:K,height:G}=Cn(p,N),te=gn(Object.assign(Object.assign({},p),{rotation:N})),X=ke(0,0,0),q=ot(C==null?void 0:C.getBorderColor()),Be=ot(C==null?void 0:C.getBackgroun
37dColor()),Ee=1,Oe={x:j+Ee,y:j+Ee,width:K-(j+Ee)*2,height:G-(j+Ee)*2},{line:Me,fontSize:Re}=ui(T,{alignment:Ge.Left,fontSize:a??d,font:t,bounds:Oe}),We=(s=o??c)!==null&&s!==void 0?s:X;At(o||a!==void 0?e:n.acroField,We,t,Re);const at={x:0+j/2,y:0+j/2,width:K-j,height:G-j,borderWidth:j??0,borderColor:q,textColor:We,font:t.name,fontSize:Re,color:Be,textLines:[Me],padding:Ee};return[...te,...Eo(at)]},S0=(n,e,t)=>{var r,i;const s=St(e),o=St(n.acroField),c=dn(e),a=dn(n.acroField),d=e.getRectangle(),p=e.getAppearanceCharacteristics(),C=e.getBorderStyle(),v=(r=C==null?void 0:C.getWidth())!==null&&r!==void 0?r:0,T=$t(p==null?void 0:p.getRotation()),{width:j,height:N}=Cn(d,T),K=gn(Object.assign(Object.assign({},d),{rotation:T})),G=ke(0,0,0),te=ot(p==null?void 0:p.getBorderColor()),X=ot(p==null?void 0:p.getBackgroundColor()),q=n.getOptions(),Be=n.getSelected();n.isSorted()&&q.sort();let Ee="";for(let Te=0,Ie=q.length;Te<Ie;Te++)Ee+=q[Te],Te<Ie-1&&(Ee+=` 38`);const Oe=1,Me={x:v+Oe,y:v+Oe,width:j-(v+Oe)*2,height:N-(v+Oe)*2},{lines:Re,fontSize:We,lineHeight:at}=Wo(Ee,{alignment:Ge.Left,fontSize:c??a,font:t,bounds:Me}),Se=[];for(let Te=0,Ie=Re.length;Te<Ie;Te++){const lt=Re[Te];Be.includes(lt.text)&&Se.push(Te)}const ze=ke(153/255,193/255,218/255),ht=(i=s??o)!==null&&i!==void 0?i:G;return At(s||c!==void 0?e:n.acroField,ht,t,We),[...K,...Qa({x:0+v/2,y:0+v/2,width:j-v,height:N-v,borderWidth:v??0,borderColor:te,textColor:ht,font:t.name,fontSize:We,color:X,textLines:Re,lineHeight:at,selectedColor:ze,selectedLines:Se,padding:Oe})]};class fi{constructor(e,t,r){this.alreadyEmbedded=!1,A(e,"ref",[[Ce,"PDFRef"]]),A(t,"doc",[[rt,"PDFDocument"]]),A(r,"embedder",[[wi,"PDFPageEmbedder"]]),this.ref=e,this.doc=t,this.width=r.width,this.height=r.height,this.embedder=r}scale(e){return A(e,"factor",["number"]),{width:this.width*e,height:this.height*e}}size(){return this.scale(1)}embed(){return fe(this,void 0,void 0,function*(){this.alreadyEmbedded||(yield this.embedder.embedIntoContext(this.doc.context,this.ref),this.alreadyEmbedded=!0)})}}fi.of=(n,e,t)=>new fi(n,e,t);class ct{constructor(e,t,r){this.modified=!0,A(e,"ref",[[Ce,"PDFRef"]]),A(t,"doc",[[rt,"PDFDocument"]]),A(r,"embedder",[[Rr,"CustomFontEmbedder"],[Vn,"StandardFontEmbedder"]]),this.ref=e,this.doc=t,this.name=r.fontName,this.embedder=r}encodeText(e){return A(e,"text",["string"]),this.modified=!0,this.embedder.encodeText(e)}widthOfTextAtSize(e,t){return A(e,"text",["string"]),A(t,"size",["number"]),this.embedder.widthOfTextAtSize(e,t)}heightAtSize(e,t){var r;return A(e,"size",["number"]),H(t==null?void 0:t.descender,"options.descender",["boolean"]),this.embedder.heightOfFontAtSize(e,{descender:(r=t==null?void 0:t.descender)!==null&&r!==void 0?r:!0})}sizeAtHeight(e){return A(e,"height",["number"]),this.embedder.sizeOfFontAtHeight(e)}getCharacterSet(){return this.embedder instanceof Vn?this.embedder.encoding.supportedCodePoints:this.embedder.font.characterSet}embed(){return fe(this,void 0,void 0,function*(){this.modified&&(yield this.embedder.embedIntoContext(this.doc.context,this.ref),this.modified=!1)})}}ct.of=(n,e,t)=>new ct(n,e,t);class Br{constructor(e,t,r){this.alreadyEmbedded=!1,A(e,"ref",[[Ce,"PDFRef"]]),A(t,"doc",[[rt,"PDFDocument"]]),A(r,"embedder",[[yi,"JpegEmbedder"],[mi,"PngEmbedder"]]),this.ref=e,this.doc=t,this.width=r.width,this.height=r.height,this.embedder=r}scale(e){return A(e,"factor",["number"]),{width:this.width*e,height:this.height*e}}scaleToFit(e,t){A(e,"width",["number"]),A(t,"height",["number"]);const r=e/this.width,i=t/this.height,s=Math.min(r,i);return this.scale(s)}size(){return this.scale(1)}embed(){return fe(this,void 0,void 0,function*(){this.alreadyEmbedded||(yield this.embedder.embedIntoContext(this.doc.context,this.ref),this.alreadyEmbedded=!0)})}}Br.of=(n,e,t)=>new Br(n,e,t);var Yt;(function(n){n[n.Left=0]="Left",n[n.Center=1]="Center",n[n.Right=2]="Right"})(Yt||(Yt={}));const er=n=>{H(n==null?void 0:n.x,"options.x",["number"]),H(n==null?void 0:n.y,"options.y",["number"]),H(n==null?void 0:n.width,"options.width",["number"]),H(n==null?void 0:n.height,"options.height",["number"]),H(n==null?void 0:n.textColor,"options.textColor",[[Object,"Color"]]),H(n==null?void 0:n.backgroundColor,"options.backgroundColor",[[Object,"Color"]]),H(n==null?void 0:n.borderColor,"options.borderColor",[[Object,"Color"]]),H(n==null?void 0:n.borderWidth,"options.borderWidth",["number"]),H(n==null?void 0:n.rotate,"options.rotate",[[Object,"Rotation"]])};class Fn{constructor(e,t,r){A(e,"acroField",[[Jt,"PDFAcroTerminal"]]),A(t,"ref",[[Ce,"PDFRef"]]),A(r,"doc",[[rt,"PDFDocument"]]),this.acroField=e,this.ref=t,this.doc=r}getName(){var e;return(e=this.acroField.getFullyQualifiedName())!==null&&e!==void 0?e:""}isReadOnly(){return this.acroField.hasFlag(Pt.ReadOnly)}enableReadOnly(){this.acroField.setFlagTo(Pt.ReadOnly,!0)}disableReadOnly(){this.acroField.setFlagTo(Pt.ReadOnly,!1)}isRequired(){return this.acroField.hasFlag(Pt.Required)}enableRequired(){this.acroField.setFlagTo(Pt.Required,!0)}disableRequired(){this.acroField.setFlagTo(Pt.Required,!1)}isExported(){return!this.acroField.hasFlag(Pt.NoExport)}enableExporting(){this.acroField.setFlagTo(Pt.NoExport,!1)}disableExporting(){this.acroField.setFlagTo(Pt.NoExport,!0)}needsAppearancesUpdate(){throw new gt(this.constructor.name,"needsAppearancesUpdate")}defaultUpdateAppearances(e){throw new gt(this.constructor.name,"defaultUpdateAppearances")}markAsDirty(){this.doc.getForm().markFieldAsDirty(this.ref)}markAsClean(){this.doc.getForm().markFieldAsClean(this.ref)}isDirty(){return this.doc.getForm().fieldIsDirty(this.ref)}createWidget(e){var t;const r=e.textColor,i=e.backgroundColor,s=e.borderColor,o=e.borderWidth,c=ko(e.rotate),a=e.caption,d=e.x,p=e.y,C=e.width+o,v=e.height+o,T=!!e.hidden;xo(c,"degreesAngle",90);const j=An.create(this.doc.context,this.ref),N=Ta({x:d,y:p,width:C,height:v},o,c);j.setRectangle(N);const K=j.getOrCreateAppearanceCharacteristics();
38i&&K.setBackgroundColor(Gs(i)),K.setRotation(c),a&&K.setCaptions({normal:a}),s&&K.setBorderColor(Gs(s));const G=j.getOrCreateBorderStyle();if(o!==void 0&&G.setWidth(o),j.setFlagTo(Sr.Print,!0),j.setFlagTo(Sr.Hidden,T),j.setFlagTo(Sr.Invisible,!1),r){const X=((t=this.acroField.getDefaultAppearance())!==null&&t!==void 0?t:"")+` 39`+fn(r).toString();this.acroField.setDefaultAppearance(X)}return j}updateWidgetAppearanceWithFont(e,t,{normal:r,rollover:i,down:s}){this.updateWidgetAppearances(e,{normal:this.createAppearanceStream(e,r,t),rollover:i&&this.createAppearanceStream(e,i,t),down:s&&this.createAppearanceStream(e,s,t)})}updateOnOffWidgetAppearance(e,t,{normal:r,rollover:i,down:s}){this.updateWidgetAppearances(e,{normal:this.createAppearanceDict(e,r,t),rollover:i&&this.createAppearanceDict(e,i,t),down:s&&this.createAppearanceDict(e,s,t)})}updateWidgetAppearances(e,{normal:t,rollover:r,down:i}){e.setNormalAppearance(t),r?e.setRolloverAppearance(r):e.removeRolloverAppearance(),i?e.setDownAppearance(i):e.removeDownAppearance()}createAppearanceStream(e,t,r){const{context:i}=this.acroField.dict,{width:s,height:o}=e.getRectangle(),c=r&&{Font:{[r.name]:r.ref}},a=i.formXObject(t,{Resources:c,BBox:i.obj([0,0,s,o]),Matrix:i.obj([1,0,0,1,0,0])});return i.register(a)}createImageAppearanceStream(e,t,r){var i;const{context:s}=this.acroField.dict,o=e.getRectangle(),c=e.getAppearanceCharacteristics(),a=e.getBorderStyle(),d=(i=a==null?void 0:a.getWidth())!==null&&i!==void 0?i:0,p=$t(c==null?void 0:c.getRotation()),C=gn(Object.assign(Object.assign({},o),{rotation:p})),v=Cn(o,p),T=t.scaleToFit(v.width-d*2,v.height-d*2),j={x:d,y:d,width:T.width,height:T.height,rotate:re(0),xSkew:re(0),ySkew:re(0)};r===Yt.Center?(j.x+=(v.width-d*2)/2-T.width/2,j.y+=(v.height-d*2)/2-T.height/2):r===Yt.Right&&(j.x=v.width-d-T.width,j.y=v.height-d-T.height);const N=mn("Image",10),K=[...C,...Ro(N,j)],G={XObject:{[N]:t.ref}},te=s.formXObject(K,{Resources:G,BBox:s.obj([0,0,o.width,o.height]),Matrix:s.obj([1,0,0,1,0,0])});return s.register(te)}createAppearanceDict(e,t,r){const{context:i}=this.acroField.dict,s=this.createAppearanceStream(e,t.on),o=this.createAppearanceStream(e,t.off),c=i.obj({});return c.set(r,s),c.set(l.of("Off"),o),c}}class bn extends Fn{constructor(e,t,r){super(e,t,r),A(e,"acroCheckBox",[[Qt,"PDFAcroCheckBox"]]),this.acroField=e}check(){var e;const t=(e=this.acroField.getOnValue())!==null&&e!==void 0?e:l.of("Yes");this.markAsDirty(),this.acroField.setValue(t)}uncheck(){this.markAsDirty(),this.acroField.setValue(l.of("Off"))}isChecked(){const e=this.acroField.getOnValue();return!!e&&e===this.acroField.getValue()}addToPage(e,t){var r,i,s,o,c,a;A(e,"page",[[et,"PDFPage"]]),er(t),t||(t={}),"textColor"in t||(t.textColor=ke(0,0,0)),"backgroundColor"in t||(t.backgroundColor=ke(1,1,1)),"borderColor"in t||(t.borderColor=ke(0,0,0)),"borderWidth"in t||(t.borderWidth=1);const d=this.createWidget({x:(r=t.x)!==null&&r!==void 0?r:0,y:(i=t.y)!==null&&i!==void 0?i:0,width:(s=t.width)!==null&&s!==void 0?s:50,height:(o=t.height)!==null&&o!==void 0?o:50,textColor:t.textColor,backgroundColor:t.backgroundColor,borderColor:t.borderColor,borderWidth:(c=t.borderWidth)!==null&&c!==void 0?c:0,rotate:(a=t.rotate)!==null&&a!==void 0?a:re(0),hidden:t.hidden}),p=this.doc.context.register(d.dict);this.acroField.addWidget(p),d.setAppearanceState(l.of("Off")),this.updateWidgetAppearance(d,l.of("Yes")),e.node.addAnnot(p)}needsAppearancesUpdate(){var e;const t=this.acroField.getWidgets();for(let r=0,i=t.length;r<i;r++){const s=t[r],o=s.getAppearanceState(),c=(e=s.getAppearances())===null||e===void 0?void 0:e.normal;if(!(c instanceof ie)||o&&!c.has(o))return!0}return!1}defaultUpdateAppearances(){this.updateAppearances()}updateAppearances(e){var t;H(e,"provider",[Function]);const r=this.acroField.getWidgets();for(let i=0,s=r.length;i<s;i++){const o=r[i],c=(t=o.getOnValue())!==null&&t!==void 0?t:l.of("Yes");c&&this.updateWidgetAppearance(o,c,e)}this.markAsClean()}updateWidgetAppearance(e,t,r){const s=Qn((r??y0)(this,e));this.updateOnOffWidgetAppearance(e,t,s)}}bn.of=(n,e,t)=>new bn(n,e,t);class Wn extends Fn{constructor(e,t,r){super(e,t,r),A(e,"acroComboBox",[[en,"PDFAcroComboBox"]]),this.acroField=e}getOptions(){const e=this.acroField.getOptions(),t=new Array(e.length);for(let r=0,i=t.length;r<i;r++){const{display:s,value:o}=e[r];t[r]=(s??o).decodeText()}return t}getSelected(){const e=this.acroField.getValues(),t=new Array(e.length);for(let r=0,i=e.length;r<i;r++)t[r]=e[r].decodeText();return t}setOptions(e){A(e,"options",[Array]);const t=new Array(e.length);for(let r=0,i=e.length;r<i;r++)t[r]={value:ee.fromText(e[r])};this.acroField.setOptions(t)}
39addOptions(e){A(e,"options",["string",Array]);const t=Array.isArray(e)?e:[e],r=this.acroField.getOptions(),i=new Array(t.length);for(let s=0,o=t.length;s<o;s++)i[s]={value:ee.fromText(t[s])};this.acroField.setOptions(r.concat(i))}select(e,t=!1){A(e,"options",["string",Array]),A(t,"merge",["boolean"]);const r=Array.isArray(e)?e:[e],i=this.getOptions();r.find(c=>!i.includes(c))&&this.enableEditing(),this.markAsDirty(),(r.length>1||r.length===1&&t)&&this.enableMultiselect();const o=new Array(r.length);for(let c=0,a=r.length;c<a;c++)o[c]=ee.fromText(r[c]);if(t){const c=this.acroField.getValues();this.acroField.setValues(c.concat(o))}else this.acroField.setValues(o)}clear(){this.markAsDirty(),this.acroField.setValues([])}setFontSize(e){pi(e,"fontSize"),this.acroField.setFontSize(e),this.markAsDirty()}isEditable(){return this.acroField.hasFlag(Fe.Edit)}enableEditing(){this.acroField.setFlagTo(Fe.Edit,!0)}disableEditing(){this.acroField.setFlagTo(Fe.Edit,!1)}isSorted(){return this.acroField.hasFlag(Fe.Sort)}enableSorting(){this.acroField.setFlagTo(Fe.Sort,!0)}disableSorting(){this.acroField.setFlagTo(Fe.Sort,!1)}isMultiselect(){return this.acroField.hasFlag(Fe.MultiSelect)}enableMultiselect(){this.acroField.setFlagTo(Fe.MultiSelect,!0)}disableMultiselect(){this.acroField.setFlagTo(Fe.MultiSelect,!1)}isSpellChecked(){return!this.acroField.hasFlag(Fe.DoNotSpellCheck)}enableSpellChecking(){this.acroField.setFlagTo(Fe.DoNotSpellCheck,!1)}disableSpellChecking(){this.acroField.setFlagTo(Fe.DoNotSpellCheck,!0)}isSelectOnClick(){return this.acroField.hasFlag(Fe.CommitOnSelChange)}enableSelectOnClick(){this.acroField.setFlagTo(Fe.CommitOnSelChange,!0)}disableSelectOnClick(){this.acroField.setFlagTo(Fe.CommitOnSelChange,!1)}addToPage(e,t){var r,i,s,o,c,a,d;A(e,"page",[[et,"PDFPage"]]),er(t),t||(t={}),"textColor"in t||(t.textColor=ke(0,0,0)),"backgroundColor"in t||(t.backgroundColor=ke(1,1,1)),"borderColor"in t||(t.borderColor=ke(0,0,0)),"borderWidth"in t||(t.borderWidth=1);const p=this.createWidget({x:(r=t.x)!==null&&r!==void 0?r:0,y:(i=t.y)!==null&&i!==void 0?i:0,width:(s=t.width)!==null&&s!==void 0?s:200,height:(o=t.height)!==null&&o!==void 0?o:50,textColor:t.textColor,backgroundColor:t.backgroundColor,borderColor:t.borderColor,borderWidth:(c=t.borderWidth)!==null&&c!==void 0?c:0,rotate:(a=t.rotate)!==null&&a!==void 0?a:re(0),hidden:t.hidden}),C=this.doc.context.register(p.dict);this.acroField.addWidget(C);const v=(d=t.font)!==null&&d!==void 0?d:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(p,v),e.node.addAnnot(C)}needsAppearancesUpdate(){var e;if(this.isDirty())return!0;const t=this.acroField.getWidgets();for(let r=0,i=t.length;r<i;r++)if(!(((e=t[r].getAppearances())===null||e===void 0?void 0:e.normal)instanceof st))return!0;return!1}defaultUpdateAppearances(e){A(e,"font",[[ct,"PDFFont"]]),this.updateAppearances(e)}updateAppearances(e,t){A(e,"font",[[ct,"PDFFont"]]),H(t,"provider",[Function]);const r=this.acroField.getWidgets();for(let i=0,s=r.length;i<s;i++){const o=r[i];this.updateWidgetAppearance(o,e,t)}this.markAsClean()}updateWidgetAppearance(e,t,r){const s=Qn((r??v0)(this,e,t));this.updateWidgetAppearanceWithFont(e,t,s)}}Wn.of=(n,e,t)=>new Wn(n,e,t);class zn extends Fn{constructor(e,t,r){super(e,t,r),A(e,"acroListBox",[[on,"PDFAcroListBox"]]),this.acroField=e}getOptions(){const e=this.acroField.getOptions(),t=new Array(e.length);for(let r=0,i=t.length;r<i;r++){const{display:s,value:o}=e[r];t[r]=(s??o).decodeText()}return t}getSelected(){const e=this.acroField.getValues(),t=new Array(e.length);for(let r=0,i=e.length;r<i;r++)t[r]=e[r].decodeText();return t}setOptions(e){A(e,"options",[Array]),this.markAsDirty();const t=new Array(e.length);for(let r=0,i=e.length;r<i;r++)t[r]={value:ee.fromText(e[r])};this.acroField.setOptions(t)}addOptions(e){A(e,"options",["string",Array]),this.markAsDirty();const t=Array.isArray(e)?e:[e],r=this.acroField.getOptions(),i=new Array(t.length);for(let s=0,o=t.length;s<o;s++)i[s]={value:ee.fromText(t[s])};this.acroField.setOptions(r.concat(i))}select(e,t=!1){A(e,"options",["string",Array]),A(t,"merge",["boolean"]);const r=Array.isArray(e)?e:[e],i=this.getOptions();Tc(r,"option",i),this.markAsDirty(),(r.length>1||r.length===1&&t)&&this.enableMultiselect();const s=new Array(r.length);for(let o=0,c=r.length;o<c;o++)s[o]=ee.fromText(r[o]);if(t){const o=this.acroField.getValues();this.acroField.setValues(o.concat(s))}else this.acroField.setValues(s)}clear(){this.markAsDirty(),this.acroField.setValues([])}setFontSize(e){pi(e,"fontSize"),this.acroField.setFontSize(e),this.markAsDirty()}isSorted(){return this.acroField.hasFlag(Fe.Sort)}enableSorting(){this.acroField.setFlagTo(Fe.Sort,!0)}disableSorting(){this.acroField.setFlagTo(Fe.Sort,!1)}isMultiselect(){return this.acroField.hasFlag(Fe.MultiSelect)}enableMultiselect(){this.acroField.setFlagTo(Fe.MultiSelect,!0)}disableMultiselect(){this.acroField.setFlagTo(Fe.MultiSelect,!1)}isSelectOnClick(){return this.acroField.hasFlag(Fe.CommitOnSelChange)}enableSelectOnClick(){this.acroField.setFlagTo(Fe.CommitOnSelChange,!0)}disableSelectOnClick(){this.acroField.setFlagTo(Fe.CommitOnSelChange,!1)}addToPage(e,t){var r,i,s,o,c,a,d;A(e,"page",[[et,"PDFPage"]]),er(t),t||(t={}),"textColor"in t||(t.textColor=ke(0,0,0)),"backgroundColor"in t||(t.backgroundColor=ke(1,1,1)),"borderColor"in t||(t.borderColor=ke(0,0,0)),"borderWidth"in t||(t.borderWidth=1);const p=this.createWidget({x:(r=t.x)!==null&&r!==void 0?r:0,y:(i=t.y)!==null&&i!==void 0?i:0,width:(s=t.width)!==null&&s!==void 0?s:200,height:(o=t.height)!==null&&o!==void 0?o:100,textColor:t.textColor,backgroundColor:t.backgroundColor,borderColor:t.borderColor,borderWidth:(c=t.borderWidth)!==null&&c!==void 0?c:0,rotate:(a=t.rotate)!==null&&a!==void 0?a:re(0),hidden:t.hidden}),C=this.doc.context.register(p.dict);this.acroField.addWidget(C);const v=(d=t.font)!==null&&d!==void 0?d:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(p,v),e.node.addAnnot(C)}needsAppearancesUpdate(){var e;if(this.isDirty())return!0;const t=this.acroField.getWidgets();for(let r=0,i=t.length;r<i;r++)if(!(((e=t[r].getAppearances())===null||e===void 0?void 0:e.normal)instanceof st))return!0;return!1}defaultUpdateAppearances(e){A(e,"font",[[ct,"PDFFont"]]),this.updateAppearances(e)}updateAppearances(e,t){A(e,"font",[[ct,"PDFFont"]]),H(t,"provider",[Function]);const r=this.acroField.getWidgets();for(let i=0,s=r.length;i<s;i++){const o=r[i];this.updateWidgetAppearance(o,e,t)}this.markAsClean()}updateWidgetAppearance(e,t,r){const s=Qn((r??S0)(this,e,t));
39this.updateWidgetAppearanceWithFont(e,t,s)}}zn.of=(n,e,t)=>new zn(n,e,t);class wn extends Fn{constructor(e,t,r){super(e,t,r),A(e,"acroRadioButton",[[sn,"PDFAcroRadioButton"]]),this.acroField=e}getOptions(){const e=this.acroField.getExportValues();if(e){const i=new Array(e.length);for(let s=0,o=e.length;s<o;s++)i[s]=e[s].decodeText();return i}const t=this.acroField.getOnValues(),r=new Array(t.length);for(let i=0,s=r.length;i<s;i++)r[i]=t[i].decodeText();return r}getSelected(){const e=this.acroField.getValue();if(e===l.of("Off"))return;const t=this.acroField.getExportValues();if(t){const r=this.acroField.getOnValues();for(let i=0,s=r.length;i<s;i++)if(r[i]===e)return t[i].decodeText()}return e.decodeText()}select(e){A(e,"option",["string"]);const t=this.getOptions();qt(e,"option",t),this.markAsDirty();const r=this.acroField.getOnValues(),i=this.acroField.getExportValues();if(i)for(let s=0,o=i.length;s<o;s++)i[s].decodeText()===e&&this.acroField.setValue(r[s]);else for(let s=0,o=r.length;s<o;s++){const c=r[s];c.decodeText()===e&&this.acroField.setValue(c)}}clear(){this.markAsDirty(),this.acroField.setValue(l.of("Off"))}isOffToggleable(){return!this.acroField.hasFlag(bt.NoToggleToOff)}enableOffToggling(){this.acroField.setFlagTo(bt.NoToggleToOff,!1)}disableOffToggling(){this.acroField.setFlagTo(bt.NoToggleToOff,!0)}isMutuallyExclusive(){return!this.acroField.hasFlag(bt.RadiosInUnison)}enableMutualExclusion(){this.acroField.setFlagTo(bt.RadiosInUnison,!1)}disableMutualExclusion(){this.acroField.setFlagTo(bt.RadiosInUnison,!0)}addOptionToPage(e,t,r){var i,s,o,c,a,d,p,C,v;A(e,"option",["string"]),A(t,"page",[[et,"PDFPage"]]),er(r);const T=this.createWidget({x:(i=r==null?void 0:r.x)!==null&&i!==void 0?i:0,y:(s=r==null?void 0:r.y)!==null&&s!==void 0?s:0,width:(o=r==null?void 0:r.width)!==null&&o!==void 0?o:50,height:(c=r==null?void 0:r.height)!==null&&c!==void 0?c:50,textColor:(a=r==null?void 0:r.textColor)!==null&&a!==void 0?a:ke(0,0,0),backgroundColor:(d=r==null?void 0:r.backgroundColor)!==null&&d!==void 0?d:ke(1,1,1),borderColor:(p=r==null?void 0:r.borderColor)!==null&&p!==void 0?p:ke(0,0,0),borderWidth:(C=r==null?void 0:r.borderWidth)!==null&&C!==void 0?C:1,rotate:(v=r==null?void 0:r.rotate)!==null&&v!==void 0?v:re(0),hidden:r==null?void 0:r.hidden}),j=this.doc.context.register(T.dict),N=this.acroField.addWidgetWithOpt(j,ee.fromText(e),!this.isMutuallyExclusive());T.setAppearanceState(l.of("Off")),this.updateWidgetAppearance(T,N),t.node.addAnnot(j)}needsAppearancesUpdate(){var e;const t=this.acroField.getWidgets();for(let r=0,i=t.length;r<i;r++){const s=t[r],o=s.getAppearanceState(),c=(e=s.getAppearances())===null||e===void 0?void 0:e.normal;if(!(c instanceof ie)||o&&!c.has(o))return!0}return!1}defaultUpdateAppearances(){this.updateAppearances()}updateAppearances(e){H(e,"provider",[Function]);const t=this.acroField.getWidgets();for(let r=0,i=t.length;r<i;r++){const s=t[r],o=s.getOnValue();o&&this.updateWidgetAppearance(s,o,e)}}updateWidgetAppearance(e,t,r){const s=Qn((r??m0)(this,e));this.updateOnOffWidgetAppearance(e,t,s)}}wn.of=(n,e,t)=>new wn(n,e,t);class Dr extends Fn{constructor(e,t,r){super(e,t,r),A(e,"acroSignature",[[Fr,"PDFAcroSignature"]]),this.acroField=e}needsAppearancesUpdate(){return!1}}Dr.of=(n,e,t)=>new Dr(n,e,t);class Nn extends Fn{constructor(e,t,r){super(e,t,r),A(e,"acroText",[[nn,"PDFAcroText"]]),this.acroField=e}getText(){const e=this.acroField.getValue();if(!e&&this.isRichFormatted())throw new o0(this.getName());return e==null?void 0:e.decodeText()}setText(e){H(e,"text",["string"]);const t=this.getMaxLength();if(t!==void 0&&e&&e.length>t)throw new a0(e.length,t,this.getName());this.markAsDirty(),this.disableRichFormatting(),e?this.acroField.setValue(ee.fromText(e)):this.acroField.removeValue()}getAlignment(){const e=this.acroField.getQuadding();return e===0?Ge.Left:e===1?Ge.Center:e===2?Ge.Right:Ge.Left}setAlignment(e){qt(e,"alignment",Ge),this.markAsDirty(),this.acroField.setQuadding(e)}getMaxLength(){return this.acroField.getMaxLength()}setMaxLength(e){if(Dt(e,"maxLength",0,Number.MAX_SAFE_INTEGER),this.markAsDirty(),e===void 0)this.acroField.removeMaxLength();else{const t=this.getText();if(t&&t.length>e)throw new l0(t.length,e,this.getName());this.acroField.setMaxLength(e)}}removeMaxLength(){this.markAsDirty(),this.acroField.removeMaxLength()}setImage(e){const t=this.getAlignment(),r=t===Ge.Center?Yt.Center:t===Ge.Right?Yt.Right:Yt.Left,i=this.acroField.getWidgets();for(let s=0,o=i.length;s<o;s++){const c=i[s],a=this.createImageAppearanceStream(c,e,r);this.updateWidgetAppearances(c,{normal:a})}this.markAsClean()}setFontSize(e){pi(e,"fontSize"),this.acroField.setFontSize(e),this.markAsDirty()}isMultiline(){return this.acroField.hasFlag(_e.Multiline)}enableMultiline(){this.markAsDirty(),this.acroField.setFlagTo(_e.Multiline,!0)}disableMultiline(){this.markAsDirty(),this.acroField.setFlagTo(_e.Multiline,!1)}isPassword(){return this.acroField.hasFlag(_e.Password)}enablePassword(){this.acroField.setFlagTo(_e.Password,!0)}disablePassword(){this.acroField.setFlagTo(_e.Password,!1)}isFileSelector(){return this.acroField.hasFlag(_e.FileSelect)}
39enableFileSelection(){this.acroField.setFlagTo(_e.FileSelect,!0)}disableFileSelection(){this.acroField.setFlagTo(_e.FileSelect,!1)}isSpellChecked(){return!this.acroField.hasFlag(_e.DoNotSpellCheck)}enableSpellChecking(){this.acroField.setFlagTo(_e.DoNotSpellCheck,!1)}disableSpellChecking(){this.acroField.setFlagTo(_e.DoNotSpellCheck,!0)}isScrollable(){return!this.acroField.hasFlag(_e.DoNotScroll)}enableScrolling(){this.acroField.setFlagTo(_e.DoNotScroll,!1)}disableScrolling(){this.acroField.setFlagTo(_e.DoNotScroll,!0)}isCombed(){return this.acroField.hasFlag(_e.Comb)&&!this.isMultiline()&&!this.isPassword()&&!this.isFileSelector()&&this.getMaxLength()!==void 0}enableCombing(){this.getMaxLength()===void 0&&console.warn("PDFTextFields must have a max length in order to be combed"),this.markAsDirty(),this.disableMultiline(),this.disablePassword(),this.disableFileSelection(),this.acroField.setFlagTo(_e.Comb,!0)}disableCombing(){this.markAsDirty(),this.acroField.setFlagTo(_e.Comb,!1)}isRichFormatted(){return this.acroField.hasFlag(_e.RichText)}enableRichFormatting(){this.acroField.setFlagTo(_e.RichText,!0)}disableRichFormatting(){this.acroField.setFlagTo(_e.RichText,!1)}addToPage(e,t){var r,i,s,o,c,a,d;A(e,"page",[[et,"PDFPage"]]),er(t),t||(t={}),"textColor"in t||(t.textColor=ke(0,0,0)),"backgroundColor"in t||(t.backgroundColor=ke(1,1,1)),"borderColor"in t||(t.borderColor=ke(0,0,0)),"borderWidth"in t||(t.borderWidth=1);const p=this.createWidget({x:(r=t.x)!==null&&r!==void 0?r:0,y:(i=t.y)!==null&&i!==void 0?i:0,width:(s=t.width)!==null&&s!==void 0?s:200,height:(o=t.height)!==null&&o!==void 0?o:50,textColor:t.textColor,backgroundColor:t.backgroundColor,borderColor:t.borderColor,borderWidth:(c=t.borderWidth)!==null&&c!==void 0?c:0,rotate:(a=t.rotate)!==null&&a!==void 0?a:re(0),hidden:t.hidden}),C=this.doc.context.register(p.dict);this.acroField.addWidget(C);const v=(d=t.font)!==null&&d!==void 0?d:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(p,v),e.node.addAnnot(C)}needsAppearancesUpdate(){var e;if(this.isDirty())return!0;const t=this.acroField.getWidgets();for(let r=0,i=t.length;r<i;r++)if(!(((e=t[r].getAppearances())===null||e===void 0?void 0:e.normal)instanceof st))return!0;return!1}defaultUpdateAppearances(e){A(e,"font",[[ct,"PDFFont"]]),this.updateAppearances(e)}updateAppearances(e,t){A(e,"font",[[ct,"PDFFont"]]),H(t,"provider",[Function]);const r=this.acroField.getWidgets();for(let i=0,s=r.length;i<s;i++){const o=r[i];this.updateWidgetAppearance(o,e,t)}this.markAsClean()}updateWidgetAppearance(e,t,r){const s=Qn((r??w0)(this,e,t));this.updateWidgetAppearanceWithFont(e,t,s)}}Nn.of=(n,e,t)=>new Nn(n,e,t);var gi;(function(n){n.Courier="Courier",n.CourierBold="Courier-Bold",n.CourierOblique="Courier-Oblique",n.CourierBoldOblique="Courier-BoldOblique",n.Helvetica="Helvetica",n.HelveticaBold="Helvetica-Bold",n.HelveticaOblique="Helvetica-Oblique",n.HelveticaBoldOblique="Helvetica-BoldOblique",n.TimesRoman="Times-Roman",n.TimesRomanBold="Times-Bold",n.TimesRomanItalic="Times-Italic",n.TimesRomanBoldItalic="Times-BoldItalic",n.Symbol="Symbol",n.ZapfDingbats="ZapfDingbats"})(gi||(gi={}));class Gi{constructor(e,t){this.embedDefaultFont=()=>this.doc.embedStandardFont(gi.Helvetica),A(e,"acroForm",[[cn,"PDFAcroForm"]]),A(t,"doc",[[rt,"PDFDocument"]]),this.acroForm=e,this.doc=t,this.dirtyFields=new Set,this.defaultFontCache=vt.populatedBy(this.embedDefaultFont)}hasXFA(){return this.acroForm.dict.has(l.of("XFA"))}deleteXFA(){this.acroForm.dict.delete(l.of("XFA"))}getFields(){const e=this.acroForm.getAllFields(),t=[];for(let r=0,i=e.length;r<i;r++){const[s,o]=e[r],c=A0(s,o,this.doc);c&&t.push(c)}return t}getFieldMaybe(e){A(e,"name",["string"]);const t=this.getFields();for(let r=0,i=t.length;r<i;r++){const s=t[r];if(s.getName()===e)return s}}getField(e){A(e,"name",["string"]);const t=this.getFieldMaybe(e);if(t)return t;throw new i0(e)}getButton(e){A(e,"name",["string"]);const t=this.getField(e);if(t instanceof Ln)return t;throw new pn(e,Ln,t)}getCheckBox(e){A(e,"name",["string"]);const t=this.getField(e);if(t instanceof bn)return t;throw new pn(e,bn,t)}getDropdown(e){A(e,"name",["string"]);const t=this.getField(e);if(t instanceof Wn)return t;throw new pn(e,Wn,t)}getOptionList(e){A(e,"name",["string"]);const t=this.getField(e);if(t instanceof zn)return t;throw new pn(e,zn,t)}getRadioGroup(e){A(e,"name",["string"]);const t=this.getField(e);if(t instanceof wn)return t;throw new pn(e,wn,t)}getSignature(e){A(e,"name",["string"]);const t=this.getField(e);if(t instanceof Dr)return t;throw new pn(e,Dr,t)}getTextField(e){A(e,"name",["string"]);const t=this.getField(e);if(t instanceof Nn)return t;throw new pn(e,Nn,t)}createButton(e){A(e,"name",["string"]);const t=Rn(e),r=this.findOrCreateNonTerminals(t.nonTerminal),i=rn.create(this.doc.context);return i.setPartialName(t.terminal),En(r,[i,i.ref],t.terminal),Ln.of(i,i.ref,this.doc)}createCheckBox(e){A(e,"name",["string"]);const t=Rn(e),r=this.findOrCreateNonTerminals(t.nonTerminal),i=Qt.create(this.doc.context);return i.setPartialName(t.terminal),En(r,[i,i.ref],t.terminal),bn.of(i,i.ref,this.doc)}createDropdown(e){A(e,"name",["string"]);const t=Rn(e),r=this.findOrCreateNonTerminals(t.nonTerminal),i=en.create(this.doc.context);return i.setPartialName(t.terminal),En(r,[i,i.ref],t.terminal),Wn.of(i,i.ref,this.doc)}createOptionList(e){A(e,"name",["string"]);const t=Rn(e),r=this.findOrCreateNonTerminals(t.nonTerminal),i=on.create(this.doc.context);return i.setPartialName(t.terminal),En(r,[i,i.ref],t.terminal),zn.of(i,i.ref,this.doc)}createRadioGroup(e){A(e,"name",["string"]);const t=Rn(e),r=this.findOrCreateNonTerminals(t.nonTerminal),i=sn.create(this.doc.context);return i.setPartialName(t.terminal),En(r,[i,i.ref],t.terminal),wn.of(i,i.ref,this.doc)}createTextField(e){A(e,"name",["string"]);const t=Rn(e),r=this.findOrCreateNonTerminals(t.nonTerminal),i=nn.create(this.doc.context);return i.setPartialName(t.terminal),En(r,[i,i.ref],t.terminal),Nn.of(i,i.ref,this.doc)}flatten(e={updateFieldAppearances:!0}){e.updateFieldAppearances&&this.updateFieldAppearances();const t=this.getFields();for(let r=0,i=t.length;r<i;r++){const s=t[r],o=s.acroField.getWidgets();for(let c=0,a=o.length;c<a;c++){const d=o[c],p=this.findWidgetPage(d),C=this.findWidgetAppearanceRef(s,d),v=mn("FlatWidget",10);p.node.setXObject(l.of(v),C);
39const T=d.getRectangle(),j=[Xe(),wt(T.x,T.y),...gn(Object.assign(Object.assign({},T),{rotation:0})),xs(v),qe()].filter(Boolean);p.pushOperators(...j)}this.removeField(s)}}removeField(e){const t=e.acroField.getWidgets(),r=new Set;for(let i=0,s=t.length;i<s;i++){const o=t[i],c=this.findWidgetAppearanceRef(e,o),a=this.findWidgetPage(o);r.add(a),a.node.removeAnnot(c)}r.forEach(i=>i.node.removeAnnot(e.ref)),this.acroForm.removeField(e.acroField),this.doc.context.delete(e.ref)}updateFieldAppearances(e){H(e,"font",[[ct,"PDFFont"]]),e=e??this.getDefaultFont();const t=this.getFields();for(let r=0,i=t.length;r<i;r++){const s=t[r];s.needsAppearancesUpdate()&&s.defaultUpdateAppearances(e)}}markFieldAsDirty(e){H(e,"fieldRef",[[Ce,"PDFRef"]]),this.dirtyFields.add(e)}markFieldAsClean(e){H(e,"fieldRef",[[Ce,"PDFRef"]]),this.dirtyFields.delete(e)}fieldIsDirty(e){return H(e,"fieldRef",[[Ce,"PDFRef"]]),this.dirtyFields.has(e)}getDefaultFont(){return this.defaultFontCache.access()}findWidgetPage(e){const t=e.P();let r=this.doc.getPages().find(i=>i.ref===t);if(r===void 0){const i=this.doc.context.getObjectRef(e.dict);if(i===void 0)throw new Error("Could not find PDFRef for PDFObject");if(r=this.doc.findPageForAnnotationRef(i),r===void 0)throw new Error(`Could not find page for PDFRef ${i}`)}return r}findWidgetAppearanceRef(e,t){var r;let i=t.getNormalAppearance();if(i instanceof ie&&(e instanceof bn||e instanceof wn)){const s=e.acroField.getValue(),o=(r=i.get(s))!==null&&r!==void 0?r:i.get(l.of("Off"));o instanceof Ce&&(i=o)}if(!(i instanceof Ce)){const s=e.getName();throw new Error(`Failed to extract appearance ref for: ${s}`)}return i}findOrCreateNonTerminals(e){let t=[this.acroForm];for(let r=0,i=e.length;r<i;r++){const s=e[r];if(!s)throw new s0(s);const[o,c]=t,a=this.findNonTerminal(s,o);if(a)t=a;else{const d=tn.create(this.doc.context);d.setPartialName(s),d.setParent(c);const p=this.doc.context.register(d.dict);o.addField(p),t=[d,p]}}return t}findNonTerminal(e,t){const r=t instanceof cn?this.acroForm.getFields():cs(t.Kids());for(let i=0,s=r.length;i<s;i++){const[o,c]=r[i];if(o.getPartialName()===e){if(o instanceof tn)return[o,c];throw new Io(e)}}}}Gi.of=(n,e)=>new Gi(n,e);const A0=(n,e,t)=>{if(n instanceof rn)return Ln.of(n,e,t);if(n instanceof Qt)return bn.of(n,e,t);if(n instanceof en)return Wn.of(n,e,t);if(n instanceof on)return zn.of(n,e,t);if(n instanceof nn)return Nn.of(n,e,t);if(n instanceof sn)return wn.of(n,e,t);if(n instanceof Fr)return Dr.of(n,e,t)},Rn=n=>{if(n.length===0)throw new Error("PDF field names must not be empty strings");const e=n.split(".");for(let t=0,r=e.length;t<r;t++)if(e[t]==="")throw new Error(`Periods in PDF field names must be separated by at least one character: "${n}"`);return e.length===1?{nonTerminal:[],terminal:e[0]}:{nonTerminal:e.slice(0,e.length-1),terminal:e[e.length-1]}},En=([n,e],[t,r],i)=>{const s=n.normalizedEntries(),o=cs("Kids"in s?s.Kids:s.Fields);for(let c=0,a=o.length;c<a;c++)if(o[c][0].getPartialName()===i)throw new Io(i);n.addField(r),t.setParent(e)},C0={"4A0":[4767.87,6740.79],"2A0":[3370.39,4767.87],A0:[2383.94,3370.39],A1:[1683.78,2383.94],A2:[1190.55,1683.78],A3:[841.89,1190.55],A4:[595.28,841.89],A5:[419.53,595.28],A6:[297.64,419.53],A7:[209.76,297.64],A8:[147.4,209.76],A9:[104.88,147.4],A10:[73.7,104.88],B0:[2834.65,4008.19],B1:[2004.09,2834.65],B2:[1417.32,2004.09],B3:[1000.63,1417.32],B4:[708.66,1000.63],B5:[498.9,708.66],B6:[354.33,498.9],B7:[249.45,354.33],B8:[175.75,249.45],B9:[124.72,175.75],B10:[87.87,124.72],C0:[2599.37,3676.54],C1:[1836.85,2599.37],C2:[1298.27,1836.85],C3:[918.43,1298.27],C4:[649.13,918.43],C5:[459.21,649.13],C6:[323.15,459.21],C7:[229.61,323.15],C8:[161.57,229.61],C9:[113.39,161.57],C10:[79.37,113.39],RA0:[2437.8,3458.27],RA1:[1729.13,2437.8],RA2:[1218.9,1729.13],RA3:[864.57,1218.9],RA4:[609.45,864.57],SRA0:[2551.18,3628.35],SRA1:[1814.17,2551.18],SRA2:[1275.59,1814.17],SRA3:[907.09,1275.59],SRA4:[637.8,907.09],Executive:[521.86,756],Folio:[612,936],Legal:[612,1008],Letter:[612,792],Tabloid:[792,1224]};var Xi;(function(n){n[n.Fastest=1/0]="Fastest",n[n.Fast=1500]="Fast",n[n.Medium=500]="Medium",n[n.Slow=100]="Slow"})(Xi||(Xi={}));class qi{constructor(e,t,r){this.alreadyEmbedded=!1,this.ref=e,this.doc=t,this.embedder=r}embed(){return fe(this,void 0,void 0,function*(){if(!this.alreadyEmbedded){const e=yield this.embedder.embedIntoContext(this.doc.context,this.ref);this.doc.catalog.has(l.of("Names"))||this.doc.catalog.set(l.of("Names"),this.doc.context.obj({}));const t=this.doc.catalog.lookup(l.of("Names"),ie);t.has(l.of("EmbeddedFiles"))||t.set(l.of("EmbeddedFiles"),this.doc.context.obj({}));const r=t.lookup(l.of("EmbeddedFiles"),ie);r.has(l.of("Names"))||r.set(l.of("Names"),this.doc.context.obj([]));const i=r.lookup(l.of("Names"),ve);i.push(ee.fromText(this.embedder.fileName)),i.push(e),this.doc.catalog.has(l.of("AF"))||this.doc.catalog.set(l.of("AF"),this.doc.context.obj([])),this.doc.catalog.lookup(l.of("AF"),ve).push(e),this.alreadyEmbedded=!0}})}}qi.of=(n,e,t)=>new qi(n,e,t);class Zi{constructor(e,t,r){this.alreadyEmbedded=!1,this.ref=e,this.doc=t,this.embedder=r}embed(){return fe(this,void 0,void 0,function*(){if(!this.alreadyEmbedded){const{catalog:e,context:t}=this.doc,r=yield this.embedder.embedIntoContext(this.doc.context,this.ref);e.has(l.of("Names"))||e.set(l.of("Names"),t.obj({}));const i=e.lookup(l.of("Names"),ie);i.has(l.of("JavaScript"))||i.set(l.of("JavaScript"),t.obj({}));const s=i.lookup(l.of("JavaScript"),ie);s.has(l.of("Names"))||s.set(l.of("Names"),t.obj([]));const o=s.lookup(l.of("Names"),ve);o.push(ee.fromText(this.embedder.scriptName)),o.push(r),this.alreadyEmbedded=!0}})}}Zi.of=(n,e,t)=>new Zi(n,e,t);class ws{constructor(e,t){this.script=e,this.scriptName=t}static for(e,t){return new ws(e,t)}embedIntoContext(e,t){return fe(this,void 0,void 0,function*(){const r=e.obj({Type:"Action",S:"JavaScript",JS:ee.fromText(this.script)});return t?(e.assign(t,r),t):e.register(r)})}}class rt{constructor(e,t,r){if(this.defaultWordBreaks=[" "],this.computePages=()=>{const i=[];return this.catalog.Pages().traverse((s,o)=>
39{if(s instanceof tt){let c=this.pageMap.get(s);c||(c=et.of(s,o,this),this.pageMap.set(s,c)),i.push(c)}}),i},this.getOrCreateForm=()=>{const i=this.catalog.getOrCreateAcroForm();return Gi.of(i,this)},A(e,"context",[[Ar,"PDFContext"]]),A(t,"ignoreEncryption",["boolean"]),this.context=e,this.catalog=e.lookup(e.trailerInfo.Root),this.isEncrypted=!!e.lookup(e.trailerInfo.Encrypt),this.pageCache=vt.populatedBy(this.computePages),this.pageMap=new Map,this.formCache=vt.populatedBy(this.getOrCreateForm),this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!t&&this.isEncrypted)throw new e0;r&&this.updateInfoDict()}static load(e,t={}){return fe(this,void 0,void 0,function*(){const{ignoreEncryption:r=!1,parseSpeed:i=Xi.Slow,throwOnInvalidObject:s=!1,updateMetadata:o=!0,capNumbers:c=!1}=t;A(e,"pdf",["string",Uint8Array,ArrayBuffer]),A(r,"ignoreEncryption",["boolean"]),A(i,"parseSpeed",["number"]),A(s,"throwOnInvalidObject",["boolean"]);const a=lr(e),d=yield $i.forBytesWithOptions(a,i,s,c).parseDocument();return new rt(d,r,o)})}static create(e={}){return fe(this,void 0,void 0,function*(){const{updateMetadata:t=!0}=e,r=Ar.create(),i=jt.withContext(r),s=r.register(i),o=Xn.withContextAndPages(r,s);return r.trailerInfo.Root=r.register(o),new rt(r,!1,t)})}encrypt(e){return fe(this,void 0,void 0,function*(){e.pdfVersion=this.context.header.getVersion(),this._id=It.generateFileID(this.getInfoDict());const t=this.context.obj([this._id,this._id]);this.context.trailerInfo.ID=t,this._security=It.create(this,e),this.context.setSecurity(this._security);const r=this.context.obj(this._security.dictionary);this.context.trailerInfo.Encrypt=this.context.register(r)})}registerFontkit(e){this.fontkit=e}getForm(){const e=this.formCache.access();return e.hasXFA()&&(console.warn("Removing XFA form data as pdf-lib-plus-encrypt does not support reading or writing XFA"),e.deleteXFA()),e}getTitle(){const e=this.getInfoDict().lookup(l.Title);if(e)return Gt(e),e.decodeText()}getAuthor(){const e=this.getInfoDict().lookup(l.Author);if(e)return Gt(e),e.decodeText()}getSubject(){const e=this.getInfoDict().lookup(l.Subject);if(e)return Gt(e),e.decodeText()}getKeywords(){const e=this.getInfoDict().lookup(l.Keywords);if(e)return Gt(e),e.decodeText()}getCreator(){const e=this.getInfoDict().lookup(l.Creator);if(e)return Gt(e),e.decodeText()}getProducer(){const e=this.getInfoDict().lookup(l.Producer);if(e)return Gt(e),e.decodeText()}getCreationDate(){const e=this.getInfoDict().lookup(l.CreationDate);if(e)return Gt(e),e.decodeDate()}getModificationDate(){const e=this.getInfoDict().lookup(l.ModDate);if(e)return Gt(e),e.decodeDate()}setTitle(e,t){A(e,"title",["string"]);const r=l.of("Title");this.getInfoDict().set(r,ee.fromText(e)),t!=null&&t.showInWindowTitleBar&&this.catalog.getOrCreateViewerPreferences().setDisplayDocTitle(!0)}setAuthor(e){A(e,"author",["string"]);const t=l.of("Author");this.getInfoDict().set(t,ee.fromText(e))}setSubject(e){A(e,"author",["string"]);const t=l.of("Subject");this.getInfoDict().set(t,ee.fromText(e))}setKeywords(e){A(e,"keywords",[Array]);const t=l.of("Keywords");this.getInfoDict().set(t,ee.fromText(e.join(" ")))}setCreator(e){A(e,"creator",["string"]);const t=l.of("Creator");this.getInfoDict().set(t,ee.fromText(e))}setProducer(e){A(e,"creator",["string"]);const t=l.of("Producer");this.getInfoDict().set(t,ee.fromText(e))}setLanguage(e){A(e,"language",["string"]);const t=l.of("Lang");this.catalog.set(t,me.of(e))}setCreationDate(e){A(e,"creationDate",[[Date,"Date"]]);const t=l.of("CreationDate");this.getInfoDict().set(t,me.fromDate(e))}setModificationDate(e){A(e,"modificationDate",[[Date,"Date"]]);const t=l.of("ModDate");this.getInfoDict().set(t,me.fromDate(e))}getPageCount(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount}getPages(){return this.pageCache.access()}getPage(e){const t=this.getPages();return xt(e,"index",0,t.length-1),t[e]}getPageIndices(){return rc(0,this.getPageCount())}removePage(e){const t=this.getPageCount();if(this.pageCount===0)throw new r0;xt(e,"index",0,t-1),this.catalog.removeLeafNode(e),this.pageCount=t-1}addPage(e){return A(e,"page",["undefined",[et,"PDFPage"],Array]),this.insertPage(this.getPageCount(),e)}insertPage(e,t){const r=this.getPageCount();if(xt(e,"index",0,r),A(t,"page",["undefined",[et,"PDFPage"],Array]),!t||Array.isArray(t)){const s=Array.isArray(t)?t:C0.A4;t=et.create(this),t.setSize(...s)}else if(t.doc!==this)throw new n0;const i=this.catalog.insertLeafNode(t.ref,e);return t.node.setParent(i),this.pageMap.set(t.node,t),this.pageCache.invalidate(),this.pageCount=r+1,t}copyPages(e,t){return fe(this,void 0,void 0,function*(){A(e,"srcDoc",[[rt,"PDFDocument"]]),A(t,"indices",[Array]),yield e.flush();const r=ii.for(e.context,this.context),i=e.getPages(),s=new Array(t.length);for(let o=0,c=t.length;o<c;o++){const a=i[t[o]],d=r.copy(a.node),p=this.context.register(d);s[o]=et.of(d,p,this)}return s})}copy(){return fe(this,void 0,void 0,function*(){const e=yield rt.create(),t=yield e.copyPages(this,this.getPageIndices());for(let r=0,i=t.length;r<i;r++)e.addPage(t[r]);return this.getAuthor()!==void 0&&e.setAuthor(this.getAuthor()),this.getCreationDate()!==void 0&&e.setCreationDate(this.getCreationDate()),this.getCreator()!==void 0&&e.setCreator(this.getCreator()),this.getModificationDate()!==void 0&&e.setModificationDate(this.getModificationDate()),this.getProducer()!==void 0&&e.setProducer(this.getProducer()),this.get
39Subject()!==void 0&&e.setSubject(this.getSubject()),this.getTitle()!==void 0&&e.setTitle(this.getTitle()),e.defaultWordBreaks=this.defaultWordBreaks,e})}addJavaScript(e,t){A(e,"name",["string"]),A(t,"script",["string"]);const r=ws.for(t,e),i=this.context.nextRef(),s=Zi.of(i,this,r);this.javaScripts.push(s)}attach(e,t,r={}){return fe(this,void 0,void 0,function*(){A(e,"attachment",["string",Uint8Array,ArrayBuffer]),A(t,"name",["string"]),H(r.mimeType,"mimeType",["string"]),H(r.description,"description",["string"]),H(r.creationDate,"options.creationDate",[Date]),H(r.modificationDate,"options.modificationDate",[Date]),mt(r.afRelationship,"options.afRelationship",zi);const i=lr(e),s=ss.for(i,t,r),o=this.context.nextRef(),c=qi.of(o,this,s);this.embeddedFiles.push(c)})}embedFont(e,t={}){return fe(this,void 0,void 0,function*(){const{subset:r=!1,customName:i,features:s}=t;A(e,"font",["string",Uint8Array,ArrayBuffer]),A(r,"subset",["boolean"]);let o;if(Ps(e))o=Vn.for(e,i);else if(sc(e)){const d=lr(e),p=this.assertFontkit();o=r?yield is.for(p,d,i,s):yield Rr.for(p,d,i,s)}else throw new TypeError("`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`");const c=this.context.nextRef(),a=ct.of(c,this,o);return this.fonts.push(a),a})}embedStandardFont(e,t){if(A(e,"font",["string"]),!Ps(e))throw new TypeError("`font` must be one of type `StandardFonts`");const r=Vn.for(e,t),i=this.context.nextRef(),s=ct.of(i,this,r);return this.fonts.push(s),s}embedJpg(e){return fe(this,void 0,void 0,function*(){A(e,"jpg",["string",Uint8Array,ArrayBuffer]);const t=lr(e),r=yield yi.for(t),i=this.context.nextRef(),s=Br.of(i,this,r);return this.images.push(s),s})}embedPng(e){return fe(this,void 0,void 0,function*(){A(e,"png",["string",Uint8Array,ArrayBuffer]);const t=lr(e),r=yield mi.for(t),i=this.context.nextRef(),s=Br.of(i,this,r);return this.images.push(s),s})}embedPdf(e,t=[0]){return fe(this,void 0,void 0,function*(){A(e,"pdf",["string",Uint8Array,ArrayBuffer,[rt,"PDFDocument"]]),A(t,"indices",[Array]);const r=e instanceof rt?e:yield rt.load(e),i=ic(r.getPages(),t);return this.embedPages(i)})}embedPage(e,t,r){return fe(this,void 0,void 0,function*(){A(e,"page",[[et,"PDFPage"]]);const[i]=yield this.embedPages([e],[t],[r]);return i})}embedPages(e,t=[],r=[]){return fe(this,void 0,void 0,function*(){if(e.length===0)return[];for(let c=0,a=e.length-1;c<a;c++){const d=e[c],p=e[c+1];if(d.node.context!==p.node.context)throw new zc}const i=e[0].node.context,s=i===this.context?c=>c:ii.for(i,this.context).copy,o=new Array(e.length);for(let c=0,a=e.length;c<a;c++){const d=s(e[c].node),p=t[c],C=r[c],v=yield wi.for(d,p,C),T=this.context.nextRef();o[c]=fi.of(T,this,v)}return this.embeddedPages.push(...o),o})}flush(){return fe(this,void 0,void 0,function*(){yield this.embedAll(this.fonts),yield this.embedAll(this.images),yield this.embedAll(this.embeddedPages),yield this.embedAll(this.embeddedFiles),yield this.embedAll(this.javaScripts)})}save(e={}){return fe(this,void 0,void 0,function*(){const{useObjectStreams:t=!0,addDefaultPage:r=!0,objectsPerTick:i=50,updateFieldAppearances:s=!0}=e;if(A(t,"useObjectStreams",["boolean"]),A(r,"addDefaultPage",["boolean"]),A(i,"objectsPerTick",["number"]),A(s,"updateFieldAppearances",["boolean"]),r&&this.getPageCount()===0&&this.addPage(),s){const c=this.formCache.getValue();c&&c.updateFieldAppearances()}return yield this.flush(),(t?Wi:si).forContext(this.context,i).serializeToBuffer()})}saveAsBase64(e={}){return fe(this,void 0,void 0,function*(){const{dataUri:t=!1}=e,r=No(e,["dataUri"]);A(t,"dataUri",["boolean"]);const i=yield this.save(r),s=Lo(i);return t?`data:application/pdf;base64,${s}`:s})}findPageForAnnotationRef(e){const t=this.getPages();for(let r=0,i=t.length;r<i;r++){const s=t[r],o=s.node.Annots();if((o==null?void 0:o.indexOf(e))!==void 0)return s}}embedAll(e){return fe(this,void 0,void 0,function*(){for(let t=0,r=e.length;t<r;t++)yield e[t].embed()})}updateInfoDict(){const e="pdf-lib-plus-encrypt (https://github.com/brennanmcquerry/pdf-lib-plus-encrypt)",t=new Date,r=this.getInfoDict();this.setProducer(e),this.setModificationDate(t),r.get(l.of("Creator"))||this.setCreator(e),r.get(l.of("CreationDate"))||this.setCreationDate(t)}getInfoDict(){const e=this.context.lookup(this.context.trailerInfo.Info);if(e instanceof ie)return e;const t=this.context.obj({});return this.context.trailerInfo.Info=this.context.register(t),t}assertFontkit(){if(!this.fontkit)throw new t0;return this.fontkit}}function Gt(n){if(!(n instanceof ee)&&!(n instanceof me))throw new ti([ee,me],n)}var zt;(function(n){n.Normal="Normal",n.Multiply="Multiply",n.Screen="Screen",n.Overlay="Overlay",n.Darken="Darken",n.Lighten="Lighten",n.ColorDodge="ColorDodge",n.ColorBurn="ColorBurn",n.HardLight="HardLight",n.SoftLight="SoftLight",n.Difference="Difference",n.Exclusion="Exclusion"})(zt||(zt={}));class et{constructor(e,t,r){this.fontSize=24,this.fontColor=ke(0,0,0),this.lineHeight=24,this.x=0,this.y=0,A(e,"leafNode",[[tt,"PDFPageLeaf"]]),A(t,"ref",[[Ce,"PDFRef"]]),A(r,"doc",[[rt,"PDFDocument"]]),this.node=e,this.ref=t,this.doc=r}setRotation(e){const t=ko(e);xo(t,"degreesAngle",90),this.node.set(l.of("Rotate"),this.doc.context.obj(t))}getRotation(){const e=this.node.Rotate();return re(e?e.asNumber():0)}setSize(e,t){A(e,"width",["number"]),A(t,"height",["number"]);const r=this.getMediaBox();this.setMediaBox(r.x,r.y,e,t);const i=this.getCropBox(),s=this.getBleedBox(),o=this.getTrimBox(),c=this.getArtBox(),a=this.node.CropBox(),d=this.node.BleedBox(),p=this.node.TrimBox(),C=this.node.ArtBox();
39a&&Hr(i,r)&&this.setCropBox(r.x,r.y,e,t),d&&Hr(s,r)&&this.setBleedBox(r.x,r.y,e,t),p&&Hr(o,r)&&this.setTrimBox(r.x,r.y,e,t),C&&Hr(c,r)&&this.setArtBox(r.x,r.y,e,t)}setWidth(e){A(e,"width",["number"]),this.setSize(e,this.getSize().height)}setHeight(e){A(e,"height",["number"]),this.setSize(this.getSize().width,e)}setMediaBox(e,t,r,i){A(e,"x",["number"]),A(t,"y",["number"]),A(r,"width",["number"]),A(i,"height",["number"]);const s=this.doc.context.obj([e,t,e+r,t+i]);this.node.set(l.MediaBox,s)}setCropBox(e,t,r,i){A(e,"x",["number"]),A(t,"y",["number"]),A(r,"width",["number"]),A(i,"height",["number"]);const s=this.doc.context.obj([e,t,e+r,t+i]);this.node.set(l.CropBox,s)}setBleedBox(e,t,r,i){A(e,"x",["number"]),A(t,"y",["number"]),A(r,"width",["number"]),A(i,"height",["number"]);const s=this.doc.context.obj([e,t,e+r,t+i]);this.node.set(l.BleedBox,s)}setTrimBox(e,t,r,i){A(e,"x",["number"]),A(t,"y",["number"]),A(r,"width",["number"]),A(i,"height",["number"]);const s=this.doc.context.obj([e,t,e+r,t+i]);this.node.set(l.TrimBox,s)}setArtBox(e,t,r,i){A(e,"x",["number"]),A(t,"y",["number"]),A(r,"width",["number"]),A(i,"height",["number"]);const s=this.doc.context.obj([e,t,e+r,t+i]);this.node.set(l.ArtBox,s)}getSize(){const{width:e,height:t}=this.getMediaBox();return{width:e,height:t}}getWidth(){return this.getSize().width}getHeight(){return this.getSize().height}getMediaBox(){return this.node.MediaBox().asRectangle()}getCropBox(){var e;const t=this.node.CropBox();return(e=t==null?void 0:t.asRectangle())!==null&&e!==void 0?e:this.getMediaBox()}getBleedBox(){var e;const t=this.node.BleedBox();return(e=t==null?void 0:t.asRectangle())!==null&&e!==void 0?e:this.getCropBox()}getTrimBox(){var e;const t=this.node.TrimBox();return(e=t==null?void 0:t.asRectangle())!==null&&e!==void 0?e:this.getCropBox()}getArtBox(){var e;const t=this.node.ArtBox();return(e=t==null?void 0:t.asRectangle())!==null&&e!==void 0?e:this.getCropBox()}translateContent(e,t){A(e,"x",["number"]),A(t,"y",["number"]),this.node.normalize(),this.getContentStream();const r=this.createContentStream(Xe(),wt(e,t)),i=this.doc.context.register(r),s=this.createContentStream(qe()),o=this.doc.context.register(s);this.node.wrapContentStreams(i,o)}resetPosition(){this.getContentStream(!1),this.x=0,this.y=0}setFont(e){A(e,"font",[[ct,"PDFFont"]]),this.font=e,this.fontKey=mn(this.font.name),this.node.setFontDictionary(l.of(this.fontKey),this.font.ref)}setFontSize(e){A(e,"fontSize",["number"]),this.fontSize=e}setFontColor(e){A(e,"fontColor",[[Object,"Color"]]),this.fontColor=e}setLineHeight(e){A(e,"lineHeight",["number"]),this.lineHeight=e}getPosition(){return{x:this.x,y:this.y}}getX(){return this.x}getY(){return this.y}moveTo(e,t){A(e,"x",["number"]),A(t,"y",["number"]),this.x=e,this.y=t}moveDown(e){A(e,"yDecrease",["number"]),this.y-=e}moveUp(e){A(e,"yIncrease",["number"]),this.y+=e}moveLeft(e){A(e,"xDecrease",["number"]),this.x-=e}moveRight(e){A(e,"xIncrease",["number"]),this.x+=e}pushOperators(...e){go(e,"operator",[[se,"PDFOperator"]]),this.getContentStream().push(...e)}drawText(e,t={}){var r,i,s,o,c,a,d;A(e,"text",["string"]),H(t.color,"options.color",[[Object,"Color"]]),Dt(t.opacity,"opacity.opacity",0,1),H(t.font,"options.font",[[ct,"PDFFont"]]),H(t.size,"options.size",["number"]),H(t.rotate,"options.rotate",[[Object,"Rotation"]]),H(t.xSkew,"options.xSkew",[[Object,"Rotation"]]),H(t.ySkew,"options.ySkew",[[Object,"Rotation"]]),H(t.x,"options.x",["number"]),H(t.y,"options.y",["number"]),H(t.lineHeight,"options.lineHeight",["number"]),H(t.maxWidth,"options.maxWidth",["number"]),H(t.wordBreaks,"options.wordBreaks",[Array]),mt(t.blendMode,"options.blendMode",zt);const[p]=this.getFont();t.font&&this.setFont(t.font);const[C,v]=this.getFont(),T=t.size||this.fontSize,j=t.wordBreaks||this.doc.defaultWordBreaks,N=q=>C.widthOfTextAtSize(q,T),K=t.maxWidth===void 0?eo(_r(e)):Zo(e,j,t.maxWidth,N),G=new Array(K.length);for(let q=0,Be=K.length;q<Be;q++)G[q]=C.encodeText(K[q]);const te=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode});this.getContentStream().push(...Va(G,{color:(r=t.color)!==null&&r!==void 0?r:this.fontColor,font:v,size:T,rotate:(i=t.rotate)!==null&&i!==void 0?i:re(0),xSkew:(s=t.xSkew)!==null&&s!==void 0?s:re(0),ySkew:(o=t.ySkew)!==null&&o!==void 0?o:re(0),x:(c=t.x)!==null&&c!==void 0?c:this.x,y:(a=t.y)!==null&&a!==void 0?a:this.y,lineHeight:(d=t.lineHeight)!==null&&d!==void 0?d:this.lineHeight,graphicsState:te})),t.font&&this.setFont(p)}drawImage(e,t={}){var r,i,s,o,c,a,d;A(e,"image",[[Br,"PDFImage"]]),H(t.x,"options.x",["number"]),H(t.y,"options.y",["number"]),H(t.
39width,"options.width",["number"]),H(t.height,"options.height",["number"]),H(t.rotate,"options.rotate",[[Object,"Rotation"]]),H(t.xSkew,"options.xSkew",[[Object,"Rotation"]]),H(t.ySkew,"options.ySkew",[[Object,"Rotation"]]),Dt(t.opacity,"opacity.opacity",0,1),mt(t.blendMode,"options.blendMode",zt);const p=mn("Image",10);this.node.setXObject(l.of(p),e.ref);const C=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode});this.getContentStream().push(...Ro(p,{x:(r=t.x)!==null&&r!==void 0?r:this.x,y:(i=t.y)!==null&&i!==void 0?i:this.y,width:(s=t.width)!==null&&s!==void 0?s:e.size().width,height:(o=t.height)!==null&&o!==void 0?o:e.size().height,rotate:(c=t.rotate)!==null&&c!==void 0?c:re(0),xSkew:(a=t.xSkew)!==null&&a!==void 0?a:re(0),ySkew:(d=t.ySkew)!==null&&d!==void 0?d:re(0),graphicsState:C}))}drawPage(e,t={}){var r,i,s,o,c;A(e,"embeddedPage",[[fi,"PDFEmbeddedPage"]]),H(t.x,"options.x",["number"]),H(t.y,"options.y",["number"]),H(t.xScale,"options.xScale",["number"]),H(t.yScale,"options.yScale",["number"]),H(t.width,"options.width",["number"]),H(t.height,"options.height",["number"]),H(t.rotate,"options.rotate",[[Object,"Rotation"]]),H(t.xSkew,"options.xSkew",[[Object,"Rotation"]]),H(t.ySkew,"options.ySkew",[[Object,"Rotation"]]),Dt(t.opacity,"opacity.opacity",0,1),mt(t.blendMode,"options.blendMode",zt);const a=mn("EmbeddedPdfPage",10);this.node.setXObject(l.of(a),e.ref);const d=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode}),p=t.width!==void 0?t.width/e.width:t.xScale!==void 0?t.xScale:1,C=t.height!==void 0?t.height/e.height:t.yScale!==void 0?t.yScale:1;this.getContentStream().push(...Ga(a,{x:(r=t.x)!==null&&r!==void 0?r:this.x,y:(i=t.y)!==null&&i!==void 0?i:this.y,xScale:p,yScale:C,rotate:(s=t.rotate)!==null&&s!==void 0?s:re(0),xSkew:(o=t.xSkew)!==null&&o!==void 0?o:re(0),ySkew:(c=t.ySkew)!==null&&c!==void 0?c:re(0),graphicsState:d}))}drawSvgPath(e,t={}){var r,i,s,o,c,a,d,p,C;A(e,"path",["string"]),H(t.x,"options.x",["number"]),H(t.y,"options.y",["number"]),H(t.scale,"options.scale",["number"]),H(t.rotate,"options.rotate",[[Object,"Rotation"]]),H(t.borderWidth,"options.borderWidth",["number"]),H(t.color,"options.color",[[Object,"Color"]]),Dt(t.opacity,"opacity.opacity",0,1),H(t.borderColor,"options.borderColor",[[Object,"Color"]]),H(t.borderDashArray,"options.borderDashArray",[Array]),H(t.borderDashPhase,"options.borderDashPhase",["number"]),mt(t.borderLineCap,"options.borderLineCap",jn),Dt(t.borderOpacity,"options.borderOpacity",0,1),mt(t.blendMode,"options.blendMode",zt);const v=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.borderColor=ke(0,0,0)),this.getContentStream().push(...Ya(e,{x:(r=t.x)!==null&&r!==void 0?r:this.x,y:(i=t.y)!==null&&i!==void 0?i:this.y,scale:t.scale,rotate:(s=t.rotate)!==null&&s!==void 0?s:re(0),color:(o=t.color)!==null&&o!==void 0?o:void 0,borderColor:(c=t.borderColor)!==null&&c!==void 0?c:void 0,borderWidth:(a=t.borderWidth)!==null&&a!==void 0?a:0,borderDashArray:(d=t.borderDashArray)!==null&&d!==void 0?d:void 0,borderDashPhase:(p=t.borderDashPhase)!==null&&p!==void 0?p:void 0,borderLineCap:(C=t.borderLineCap)!==null&&C!==void 0?C:void 0,graphicsState:v}))}drawLine(e){var t,r,i,s,o;A(e.start,"options.start",[[Object,"{ x: number, y: number }"]]),A(e.end,"options.end",[[Object,"{ x: number, y: number }"]]),A(e.start.x,"options.start.x",["number"]),A(e.start.y,"options.start.y",["number"]),A(e.end.x,"options.end.x",["number"]),A(e.end.y,"options.end.y",["number"]),H(e.thickness,"options.thickness",["number"]),H(e.color,"options.color",[[Object,"Color"]]),H(e.dashArray,"options.dashArray",[Array]),H(e.dashPhase,"options.dashPhase",["number"]),mt(e.lineCap,"options.lineCap",jn),Dt(e.opacity,"opacity.opacity",0,1),mt(e.blendMode,"options.blendMode",zt);const c=this.maybeEmbedGraphicsState({borderOpacity:e.opacity,blendMode:e.blendMode});"color"in e||(e.color=ke(0,0,0)),this.getContentStream().push(...Xa({start:e.start,end:e.end,thickness:(t=e.thickness)!==null&&t!==void 0?t:1,color:(r=e.color)!==null&&r!==void 0?r:void 0,dashArray:(i=e.dashArray)!==null&&i!==void 0?i:void 0,dashPhase:(s=e.dashPhase)!==null&&s!==void 0?s:void 0,lineCap:(o=e.lineCap)!==null&&o!==void 0?o:void 0,graphicsState:c}))}drawRectangle(e={}){var t,r,i,s,o,c,a,d,p,C,v,T,j;H(e.x,"options.x",["number"]),H(e.y,"options.y",["number"]),H(e.width,"options.width",["number"]),H(e.height,"options.height",["number"]),H(e.rotate,"options.rotate",[[Object,"Rotation"]]),H(e.xSkew,"options.xSkew",[[Object,"Rotation"]]),H(e.ySkew,"options.ySkew",[[Object,"Rotation"]]),H(e.borderWidth,"options.borderWidth",["number"]),H(e.color,"options.color",[[Object,"Color"]]),Dt(e.opacity,"opacity.opacity",0,1),H(e.borderColor,"options.borderColor",[[Object,"Color"]]),H(e.borderDashArray,"options.borderDashArray",[Array]),H(e.borderDashPhase,"options.borderDashPhase",["number"]),mt(e.borderLineCap,"options.borderLineCap",jn),Dt(e.borderOpacity,"options.borderOpacity",0,1),mt(e.blendMode,"options.blendMode",zt);const N=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=ke(0,0,0)),this.getContentStream().push(...Yn({x:(t=e.x)!==null&&t!==void 0?t:this.x,y:(r=e.y)!==null&&r!==void 0?r:this.y,width:(i=e.width)!==null&&i!==void 0?i:150,height:(s=e.height)!==null&&s!==void 0?s:100,rotate:(o=e.rotate)!==null&&o!==void 0?o:re(0),xSkew:(c=e.xSkew)!==null&&c!==void 0?c:re(0),ySkew:(a=e.ySkew)!==null&&a!==void 0?a:re(0),borderWidth:(d=e.borderWidth)!==null&&d!==void 0?d:0,color:(p=e.color)!==null&&p!==void 0?p:void 0,borderColor:(C=e.borderColor)!==null&&C!==void 0?C:void 0,borderDashArray:(v=e.borderDashArray)!==null&&v!==void 0?v:void 0,borderDashPhase:(T=e.borderDashPhase)!==null&&T!==void 0?T:void 0,graphicsState:N,borderLineCap:(j=e.borderLineCap)!==null&&j!==void 0?j:void 0}))}drawSquare(e={}){const{size:t}=e;H(t,"size",["number"]),this.drawRectangle(Object.assign(Object.assign({},e),{width:t,height:t}))}drawEllipse(e={}){var t,r,i,s,o,c,a,d,p,C,v;H(e.x,"options.x",["number"]),H(e.y,"options.y",["number"]),H(e.xScale,"options.xScale",["
39number"]),H(e.yScale,"options.yScale",["number"]),H(e.rotate,"options.rotate",[[Object,"Rotation"]]),H(e.color,"options.color",[[Object,"Color"]]),Dt(e.opacity,"opacity.opacity",0,1),H(e.borderColor,"options.borderColor",[[Object,"Color"]]),Dt(e.borderOpacity,"options.borderOpacity",0,1),H(e.borderWidth,"options.borderWidth",["number"]),H(e.borderDashArray,"options.borderDashArray",[Array]),H(e.borderDashPhase,"options.borderDashPhase",["number"]),mt(e.borderLineCap,"options.borderLineCap",jn),mt(e.blendMode,"options.blendMode",zt);const T=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=ke(0,0,0)),this.getContentStream().push(...Vi({x:(t=e.x)!==null&&t!==void 0?t:this.x,y:(r=e.y)!==null&&r!==void 0?r:this.y,xScale:(i=e.xScale)!==null&&i!==void 0?i:100,yScale:(s=e.yScale)!==null&&s!==void 0?s:100,rotate:(o=e.rotate)!==null&&o!==void 0?o:void 0,color:(c=e.color)!==null&&c!==void 0?c:void 0,borderColor:(a=e.borderColor)!==null&&a!==void 0?a:void 0,borderWidth:(d=e.borderWidth)!==null&&d!==void 0?d:0,borderDashArray:(p=e.borderDashArray)!==null&&p!==void 0?p:void 0,borderDashPhase:(C=e.borderDashPhase)!==null&&C!==void 0?C:void 0,borderLineCap:(v=e.borderLineCap)!==null&&v!==void 0?v:void 0,graphicsState:T}))}drawCircle(e={}){const{size:t=100}=e;H(t,"size",["number"]),this.drawEllipse(Object.assign(Object.assign({},e),{xScale:t,yScale:t}))}getFont(){if(!this.font||!this.fontKey){const e=this.doc.embedStandardFont(gi.Helvetica);this.setFont(e)}return[this.font,this.fontKey]}getContentStream(e=!0){return e&&this.contentStream?this.contentStream:(this.contentStream=this.createContentStream(),this.contentStreamRef=this.doc.context.register(this.contentStream),this.node.addContentStream(this.contentStreamRef),this.contentStream)}createContentStream(...e){const t=this.doc.context.obj({});return Lt.of(t,e)}maybeEmbedGraphicsState(e){const{opacity:t,borderOpacity:r,blendMode:i}=e;if(t===void 0&&r===void 0&&i===void 0)return;const s=mn("GS",10),o=this.doc.context.obj({Type:"ExtGState",ca:t,CA:r,BM:i});return this.node.setExtGState(l.of(s),o),s}}et.of=(n,e,t)=>new et(n,e,t);et.create=n=>{A(n,"doc",[[rt,"PDFDocument"]]);const e=Ce.of(-1),t=tt.withContextAndParent(n.context,e),r=n.context.register(t);return new et(t,r,n)};class Ln extends Fn{constructor(e,t,r){super(e,t,r),A(e,"acroButton",[[rn,"PDFAcroPushButton"]]),this.acroField=e}setImage(e,t=Yt.Center){const r=this.acroField.getWidgets();for(let i=0,s=r.length;i<s;i++){const o=r[i],c=this.createImageAppearanceStream(o,e,t);this.updateWidgetAppearances(o,{normal:c})}this.markAsClean()}setFontSize(e){pi(e,"fontSize"),this.acroField.setFontSize(e),this.markAsDirty()}addToPage(e,t,r){var i,s,o,c,a,d,p,C,v,T,j;H(e,"text",["string"]),H(t,"page",[[et,"PDFPage"]]),er(r);const N=this.createWidget({x:((i=r==null?void 0:r.x)!==null&&i!==void 0?i:0)-((s=r==null?void 0:r.borderWidth)!==null&&s!==void 0?s:0)/2,y:((o=r==null?void 0:r.y)!==null&&o!==void 0?o:0)-((c=r==null?void 0:r.borderWidth)!==null&&c!==void 0?c:0)/2,width:(a=r==null?void 0:r.width)!==null&&a!==void 0?a:100,height:(d=r==null?void 0:r.height)!==null&&d!==void 0?d:50,textColor:(p=r==null?void 0:r.textColor)!==null&&p!==void 0?p:ke(0,0,0),backgroundColor:(C=r==null?void 0:r.backgroundColor)!==null&&C!==void 0?C:ke(.75,.75,.75),borderColor:r==null?void 0:r.borderColor,borderWidth:(v=r==null?void 0:r.borderWidth)!==null&&v!==void 0?v:0,rotate:(T=r==null?void 0:r.rotate)!==null&&T!==void 0?T:re(0),caption:e,hidden:r==null?void 0:r.hidden}),K=this.doc.context.register(N.dict);this.acroField.addWidget(K);const G=(j=r==null?void 0:r.font)!==null&&j!==void 0?j:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(N,G),t.node.addAnnot(K)}needsAppearancesUpdate(){var e;if(this.isDirty())return!0;const t=this.acroField.getWidgets();for(let r=0,i=t.length;r<i;r++)if(!(((e=t[r].getAppearances())===null||e===void 0?void 0:e.normal)instanceof st))return!0;return!1}defaultUpdateAppearances(e){A(e,"font",[[ct,"PDFFont"]]),this.updateAppearances(e)}updateAppearances(e,t){A(e,"font",[[ct,"PDFFont"]]),H(t,"provider",[Function]);const r=this.acroField.getWidgets();for(let i=0,s=r.length;i<s;i++){const o=r[i];this.updateWidgetAppearance(o,e,t)}}updateWidgetAppearance(e,t,r){const s=Qn((r??b0)(this,e,t));
39this.updateWidgetAppearanceWithFont(e,t,s)}}Ln.of=(n,e,t)=>new Ln(n,e,t);export{zi as AFRelationship,bt as AcroButtonFlags,Fe as AcroChoiceFlags,Pt as AcroFieldFlags,_e as AcroTextFlags,Sr as AnnotationFlags,vr as AppearanceCharacteristics,zt as BlendMode,vt as Cache,f as CharCodes,Zn as ColorTypes,c0 as CombedTextLayoutError,Es as CorruptPageTreeError,Rr as CustomFontEmbedder,is as CustomFontSubsetEmbedder,oi as Duplex,e0 as EncryptedPDFError,a0 as ExceededMaxLengthError,Io as FieldAlreadyExistsError,$0 as FieldExistsAsNonTerminalError,ss as FileEmbedder,t0 as FontkitNotRegisteredError,n0 as ForeignPageError,Yt as ImageAlignment,ni as IndexOutOfBoundsError,es as InvalidAcroFieldValueError,s0 as InvalidFieldNamePartError,l0 as InvalidMaxLengthError,yo as InvalidPDFDateStringError,Rs as InvalidTargetIndexError,yi as JpegEmbedder,jn as LineCapStyle,$s as LineJoinStyle,gt as MethodNotImplementedError,P0 as MissingCatalogError,Uc as MissingDAEntryError,Yc as MissingKeywordError,K0 as MissingOnValueCheckError,Zc as MissingPDFHeaderError,Mc as MissingPageContentsEmbeddingError,Hc as MissingTfOperatorError,Lc as MultiSelectValueError,Kc as NextByteAssertionError,i0 as NoSuchFieldError,yr as NonFullScreenPageMode,Is as NumberParsingError,os as PDFAcroButton,Qt as PDFAcroCheckBox,vo as PDFAcroChoice,en as PDFAcroComboBox,vi as PDFAcroField,cn as PDFAcroForm,on as PDFAcroListBox,tn as PDFAcroNonTerminal,rn as PDFAcroPushButton,sn as PDFAcroRadioButton,Fr as PDFAcroSignature,Jt as PDFAcroTerminal,nn as PDFAcroText,Li as PDFAnnotation,ve as PDFArray,Nc as PDFArrayIsNotRectangleError,Ut as PDFBool,Ln as PDFButton,Xn as PDFCatalog,bn as PDFCheckBox,Lt as PDFContentStream,Ar as PDFContext,Hn as PDFCrossRefSection,Sn as PDFCrossRefStream,ie as PDFDict,rt as PDFDocument,Wn as PDFDropdown,fi as PDFEmbeddedPage,Fn as PDFField,rs as PDFFlateStream,ct as PDFFont,Gi as PDFForm,ri as PDFHeader,ee as PDFHexString,Br as PDFImage,$n as PDFInvalidObject,Vc as PDFInvalidObjectParsingError,Zi as PDFJavaScript,l as PDFName,dt as PDFNull,ne as PDFNumber,it as PDFObject,ii as PDFObjectCopier,qn as PDFObjectParser,$c as PDFObjectParsingError,Kn as PDFObjectStream,Hi as PDFObjectStreamParser,se as PDFOperator,he as PDFOperatorNames,zn as PDFOptionList,et as PDFPage,wi as PDFPageEmbedder,tt as PDFPageLeaf,jt as PDFPageTree,$i as PDFParser,hn as PDFParsingError,wn as PDFRadioGroup,Ht as PDFRawStream,Ce as PDFRef,Dr as PDFSignature,st as PDFStream,Gc as PDFStreamParsingError,Wi as PDFStreamWriter,me as PDFString,Nn as PDFTextField,Cr as PDFTrailer,Mi as PDFTrailerDict,An as PDFWidgetAnnotation,si as PDFWriter,Ki as PDFXRefStreamParser,zc as PageEmbeddingMismatchedContextError,C0 as PageSizes,Xi as ParseSpeeds,mi as PngEmbedder,br as PrintScaling,Ji as PrivateConstructorError,mr as ReadingDirection,r0 as RemovePageFromEmptyDocumentError,Qi as ReparseError,o0 as RichTextFieldReadError,kr as RotationTypes,qc as StalledParserError,Vn as StandardFontEmbedder,fc as StandardFontValues,gi as StandardFonts,Ge as TextAlignment,Vs as TextRenderingMode,oc as Uint8ArrToHex,Xc as UnbalancedParenthesisError,pn as UnexpectedFieldTypeError,ti as UnexpectedObjectTypeError,Wc as UnrecognizedStreamTypeError,jc as UnsupportedEncodingError,Gn as ViewerPreferences,mn as addRandomSuffix,Cn as adjustDimsForRotation,pt as appendBezierCurve,Gr as appendQuadraticCurve,io as arrayAsString,ce as asNumber,Ai as asPDFName,Z as asPDFNumber,go as assertEachIs,Ec as assertInteger,A as assertIs,qt as assertIsOneOf,mt as assertIsOneOfOrUndefined,Tc as assertIsSubset,xo as assertMultiple,H as assertOrUndefined,pi as assertPositive,xt as assertRange,Dt as assertRangeOrUndefined,Ic as assertSecurity,Le as backtick,Po as beginMarkedContent,fs as beginText,Zo as breakTextIntoLines,ec as byAscendingId,On as bytesFor,sc as canBeConvertedToUint8Array,no as charAtIndex,Nt as charFromCode,$o as charFromHexCode,Xo as charSplit,_r as cleanText,Bo as clip,_0 as clipEvenOdd,ln as closePath,Oo as cmyk,Gs as colorToComponents,ot as componentsToColor,Ci as concatTransformationMatrix,Je as copyStringIntoBuffer,So as createPDFAcroField,cs as createPDFAcroFields,Rc as createTypeErrorMsg,Pc as createValueErrorMsg,ks as decodeFromBase64,Ho as decodeFromBase64DataUri,wo as decodePDFRawStream,b0 as defaultButtonAppearanceProvider,y0 as defaultCheckBoxAppearanceProvider,v0 as defaultDropdownAppearanceProvider,S0 as defaultOptionListAppearanceProvider,m0 as defaultRadioGroupAppearanceProvider,w0 as defaultTextFieldAppearanceProvider,re as degrees,vn as degreesToRadians,Ys as drawButton,Xr as drawCheckBox,Ja as drawCheckMark,Vi as drawEllipse,qa as drawEllipsePath,Ro as drawImage,Xa as drawLine,Va as drawLinesOfText,xs as drawObject,Qa as drawOptionList,Ga as drawPage,qr as drawRadioButton,Yn as drawRectangle,Ya as drawSvgPath,H0 as drawText,Eo as drawTextField,bs as drawTextLines,Lo as encodeToBase64,To as endMarkedContent,Do as endPath,gs as endText,Or as error,Vo as escapeRegExp,Go as escapedNewlineChars,ds as fill,hs as fillAndStroke,Yi as findLastMatch,_c as getType,_o as grayscale,lc as hasSurrogates,uo as hasUtf16BOM,oo as highSurrogate,Qs as isNewlineChar,Ps as isStandardFont,Oc as isType,ac as isWithinBMP,Qr as last,g0 as layoutCombedText,Wo as layoutMultilineText,ui as layoutSinglelineText,eo as lineSplit,Ye as lineTo,co as lowSurrogate,Jo as mergeIntoTypedArray,to as mergeLines,Qo as mergeUint8Arrays,j0 as moveText,Mt as moveTo,B0 as newlineChars,Oa as nextLine,Qn as
39normalizeAppearance,uc as numberToString,Tt as padStart,ro as parseDate,po as pdfDocEncodingDecode,ic as pluckIndices,qe as popGraphicsState,Xe as pushGraphicsState,T0 as radians,Pa as radiansToDegrees,rc as range,_a as rectangle,Hr as rectanglesAreEqual,$t as reduceRotation,R0 as restoreDashPattern,_n as reverseArray,ke as rgb,U0 as rotateAndSkewTextDegreesAndTranslate,Di as rotateAndSkewTextRadiansAndTranslate,Vr as rotateDegrees,gn as rotateInPlace,Jn as rotateRadians,Ta as rotateRectangle,di as scale,M0 as setCharacterSpacing,z0 as setCharacterSqueeze,Ir as setDashPattern,za as setFillingCmykColor,fn as setFillingColor,Ia as setFillingGrayscaleColor,Ma as setFillingRgbColor,Bi as setFontAndSize,un as setGraphicsState,ki as setLineCap,Ra as setLineHeight,E0 as setLineJoin,jr as setLineWidth,Na as setStrokingCmykColor,Wr as setStrokingColor,ja as setStrokingGrayscaleColor,Wa as setStrokingRgbColor,Ea as setTextMatrix,L0 as setTextRenderingMode,N0 as setTextRise,W0 as setWordSpacing,us as showText,Dc as singleQuote,Zr as sizeInBytes,O0 as skewDegrees,Fi as skewRadians,tc as sortedUniq,I0 as square,Mr as stroke,nc as sum,le as toCharCode,Ko as toCodePoint,ko as toDegrees,Tr as toHexString,Pr as toHexStringOfMinLength,He as toRadians,lr as toUint8Array,wt as translate,ji as typedArrayFor,ao as utf16Decode,cc as utf16Encode,D0 as utf8Encode,xi as values,Un as waitForTick};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.