n8n-nodes-docuparse 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -538,7 +538,7 @@ end
|
|
|
538
538
|
end`},n1e=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return"<"+e.join("")+">"},bT=function(e){return i1e.toHexStringOfMinLength(e,4)},snt=function(e){if(ET.isWithinBMP(e))return bT(e);if(ET.hasSurrogates(e)){var t=ET.highSurrogate(e),r=ET.lowSurrogate(e);return""+bT(t)+bT(r)}var n=i1e.toHexString(e),i="0x"+n+" is not a valid UTF-8 or UTF-16 codepoint.";throw new Error(i)}});var s1e=U(yT=>{"use strict";Object.defineProperty(yT,"__esModule",{value:!0});yT.deriveFontFlags=void 0;var ont=function(e){var t=0,r=function(n){t|=1<<n-1};return e.fixedPitch&&r(1),e.serif&&r(2),e.symbolic&&r(3),e.script&&r(4),e.nonsymbolic&&r(6),e.italic&&r(7),e.allCap&&r(17),e.smallCap&&r(18),e.forceBold&&r(19),t};yT.deriveFontFlags=function(e){var t=e["OS/2"]?e["OS/2"].sFamilyClass:0,r=ont({fixedPitch:e.post.isFixedPitch,serif:1<=t&&t<=7,symbolic:!0,script:t===10,italic:e.head.macStyle.italic});return r}});var Fc=U(nL=>{"use strict";Object.defineProperty(nL,"__esModule",{value:!0});var rL=(ct(),ze(ut)),unt=rL.__importDefault(_s()),di=rL.__importDefault(kn()),Wu=fr(),cnt=Nn(),fnt=(function(e){rL.__extends(t,e);function t(r){var n=e.call(this)||this;return n.value=r,n}return t.prototype.asBytes=function(){for(var r=[],n="",i=!1,s=function(C){C!==void 0&&r.push(C),i=!1},u=0,f=this.value.length;u<f;u++){var h=this.value[u],g=Wu.toCharCode(h),p=this.value[u+1];i?g===di.default.Newline||g===di.default.CarriageReturn?s():g===di.default.n?s(di.default.Newline):g===di.default.r?s(di.default.CarriageReturn):g===di.default.t?s(di.default.Tab):g===di.default.b?s(di.default.Backspace):g===di.default.f?s(di.default.FormFeed):g===di.default.LeftParen?s(di.default.LeftParen):g===di.default.RightParen?s(di.default.RightParen):g===di.default.Backspace?s(di.default.BackSlash):g>=di.default.Zero&&g<=di.default.Seven?(n+=h,(n.length===3||!(p>="0"&&p<="7"))&&(s(parseInt(n,8)),n="")):s(g):g===di.default.BackSlash?i=!0:s(g)}return new Uint8Array(r)},t.prototype.decodeText=function(){var r=this.asBytes();return Wu.hasUtf16BOM(r)?Wu.utf16Decode(r):Wu.pdfDocEncodingDecode(r)},t.prototype.decodeDate=function(){var r=this.decodeText(),n=Wu.parseDate(r);if(!n)throw new cnt.InvalidPDFDateStringError(r);return n},t.prototype.asString=function(){return this.value},t.prototype.clone=function(){return t.of(this.value)},t.prototype.toString=function(){return"("+this.value+")"},t.prototype.sizeInBytes=function(){return this.value.length+2},t.prototype.copyBytesInto=function(r,n){return r[n++]=di.default.LeftParen,n+=Wu.copyStringIntoBuffer(this.value,r,n),r[n++]=di.default.RightParen,this.value.length+2},t.of=function(r){return new t(r)},t.fromDate=function(r){var n=Wu.padStart(String(r.getUTCFullYear()),4,"0"),i=Wu.padStart(String(r.getUTCMonth()+1),2,"0"),s=Wu.padStart(String(r.getUTCDate()),2,"0"),u=Wu.padStart(String(r.getUTCHours()),2,"0"),f=Wu.padStart(String(r.getUTCMinutes()),2,"0"),h=Wu.padStart(String(r.getUTCSeconds()),2,"0");return new t("D:"+n+i+s+u+f+h+"Z")},t})(unt.default);nL.default=fnt});var aL=U(iL=>{"use strict";Object.defineProperty(iL,"__esModule",{value:!0});var fo=(ct(),ze(ut)),lnt=a1e(),Ant=s1e(),dnt=fo.__importDefault(co()),o1e=fo.__importDefault(Fc()),xT=fr(),hnt=(function(){function e(t,r,n,i){var s=this;this.allGlyphsInFontSortedById=function(){for(var u=new Array(s.font.characterSet.length),f=0,h=u.length;f<h;f++){var g=s.font.characterSet[f];u[f]=s.font.glyphForCodePoint(g)}return xT.sortedUniq(u.sort(xT.byAscendingId),function(p){return p.id})},this.font=t,this.scale=1e3/this.font.unitsPerEm,this.fontData=r,this.fontName=this.font.postscriptName||"Font",this.customName=n,this.fontFeatures=i,this.baseFontName="",this.glyphCache=xT.Cache.populatedBy(this.allGlyphsInFontSortedById)}return e.for=function(t,r,n,i){return fo.__awaiter(this,void 0,void 0,function(){var s;return fo.__generator(this,function(u){switch(u.label){case 0:return[4,t.create(r)];case 1:return s=u.sent(),[2,new e(s,r,n,i)]}})})},e.prototype.encodeText=function(t){for(var r=this.font.layout(t,this.fontFeatures).glyphs,n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=xT.toHexStringOfMinLength(r[i].id,4);return dnt.default.of(n.join(""))},e.prototype.widthOfTextAtSize=function(t,r){for(var n=this.font.layout(t,this.fontFeatures).glyphs,i=0,s=0,u=n.length;s<u;s++)i+=n[s].advanceWidth*this.scale;var f=r/1e3;return i*f},e.prototype.heightOfFontAtSize=function(t,r){r===void 0&&(r={});var n=r.descender,i=n===void 0?!0:n,s=this.font,u=s.ascent,f=s.descent,h=s.bbox,g=(u||h.maxY)*this.scale,p=(f||h.minY)*this.scale,C=g-p;return i||(C-=Math.abs(f)||0),C/1e3*t},e.prototype.sizeOfFontAtHeight=function(t){var r=this.font,n=r.ascent,i=r.descent,s=r.bbox,u=(n||s.maxY)*this.scale,f=(i||s.minY)*this.scale;return 1e3*t/(u-f)},e.prototype.embedIntoContext=function(t,r){return this.baseFontName=this.customName||t.addRandomSuffix(this.fontName),this.embedFontDict(t,r)},e.prototype.embedFontDict=function(t,r){return fo.__awaiter(this,void 0,void 0,function(){var n,i,s;return fo.__generator(this,function(u){switch(u.label){case 0:return[4,this.embedCIDFontDict(t)];case 1:return n=u.sent(),i=this.embedUnicodeCmap(t),s=t.obj({Type:"Font",Subtype:"Type0",BaseFont:this.baseFontName,Encoding:"Identity-H",DescendantFonts:[n],ToUnicode:i}),r?(t.assign(r,s),[2,r]):[2,t.register(s)]}})})},e.prototype.isCFF=function(){return this.font.cff},e.prototype.embedCIDFontDict=function(t){return fo.__awaiter(this,void 0,void 0,function(){var r,n;return fo.__generator(this,function(i){switch(i.label){case 0:return[4,this.embedFontDescriptor(t)];case 1:return r=i.sent(),n=t.obj({Type:"Font",Subtype:this.isCFF()?"CIDFontType0":"CIDFontType2",CIDToGIDMap:"Identity",BaseFont:this.baseFontName,CIDSystemInfo:{Registry:o1e.default.of("Adobe"),Ordering:o1e.default.of("Identity"),Supplement:0},FontDescriptor:r,W:this.computeWidths()}),[2,t.register(n)]}})})},e.prototype.embedFontDescriptor=function(t){return fo.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f,h,g,p,C,y,x,v,F,Q;return fo.__generator(this,function(T){switch(T.label){case 0:return[4,this.embedFontStream(t)];case 1:return r=T.sent(),n=this.scale,i=this.font,s=i.italicAngle,u=i.ascent,f=i.descent,h=i.capHeight,g=i.xHeight,p=this.font.bbox,C=p.minX,y=p.minY,x=p.maxX,v=p.maxY,F=t.obj((Q={Type:"FontDescriptor",FontName:this.baseFontName,Flags:Ant.deriveFontFlags(this.font),FontBBox:[C*n,y*n,x*n,v*n],ItalicAngle:s,Ascent:u*n,Descent:f*n,CapHeight:(h||u)*n,XHeight:(g||0)*n,StemV:0},Q[this.isCFF()?"FontFile3":"FontFile2"]=r,Q)),[2,t.register(F)]}})})},e.prototype.serializeFont=function(){return fo.__awaiter(this,void 0,void 0,function(){return fo.__generator(this,function(t){return[2,this.fontData]})})},e.prototype.embedFontStream=function(t){return fo.__awaiter(this,void 0,void 0,function(){var r,n,i;return fo.__generator(this,function(s){switch(s.label){case 0:return i=(n=t).flateStream,[4,this.serializeFont()];case 1:return r=i.apply(n,[s.sent(),{Subtype:this.isCFF()?"CIDFontType0C":void 0}]),[2,t.register(r)]}})})},e.prototype.embedUnicodeCmap=function(t){var r=lnt.createCmap(this.glyphCache.access(),this.glyphId.bind(this)),n=t.flateStream(r);return t.register(n)},e.prototype.glyphId=function(t){return t?t.id:-1},e.prototype.computeWidths=function(){for(var t=this.glyphCache.access(),r=[],n=[],i=0,s=t.length;i<s;i++){var u=t[i],f=t[i-1],h=this.glyphId(u),g=this.glyphId(f);i===0?r.push(h):h-g!==1&&(r.push(n),r.push(h),n=[]),n.push(u.advanceWidth*this.scale)}return r.push(n),r},e})();iL.default=hnt});var u1e=U(oL=>{"use strict";Object.defineProperty(oL,"__esModule",{value:!0});var wy=(ct(),ze(ut)),gnt=wy.__importDefault(aL()),pnt=wy.__importDefault(co()),sL=fr(),mnt=(function(e){wy.__extends(t,e);function t(r,n,i,s){var u=e.call(this,r,n,i,s)||this;return u.subset=u.font.createSubset(),u.glyphs=[],u.glyphCache=sL.Cache.populatedBy(function(){return u.glyphs}),u.glyphIdMap=new Map,u}return t.for=function(r,n,i,s){return wy.__awaiter(this,void 0,void 0,function(){var u;return wy.__generator(this,function(f){switch(f.label){case 0:return[4,r.create(n)];case 1:return u=f.sent(),[2,new t(u,n,i,s)]}})})},t.prototype.encodeText=function(r){for(var n=this.font.layout(r,this.fontFeatures).glyphs,i=new Array(n.length),s=0,u=n.length;s<u;s++){var f=n[s],h=this.subset.includeGlyph(f);this.glyphs[h-1]=f,this.glyphIdMap.set(f.id,h),i[s]=sL.toHexStringOfMinLength(h,4)}return this.glyphCache.invalidate(),pnt.default.of(i.join(""))},t.prototype.isCFF=function(){return this.subset.cff},t.prototype.glyphId=function(r){return r?this.glyphIdMap.get(r.id):-1},t.prototype.serializeFont=function(){var r=this;return new Promise(function(n,i){var s=[];r.subset.encodeStream().on("data",function(u){return s.push(u)}).on("end",function(){return n(sL.mergeUint8Arrays(s))}).on("error",function(u){return i(u)})})},t})(gnt.default);oL.default=mnt});var cL=U(xm=>{"use strict";Object.defineProperty(xm,"__esModule",{value:!0});xm.AFRelationship=void 0;var vT=(ct(),ze(ut)),uL=vT.__importDefault(Fc()),c1e=vT.__importDefault(co()),Ent;(function(e){e.Source="Source",e.Data="Data",e.Alternative="Alternative",e.Supplement="Supplement",e.EncryptedPayload="EncryptedPayload",e.FormData="EncryptedPayload",e.Schema="Schema",e.Unspecified="Unspecified"})(Ent=xm.AFRelationship||(xm.AFRelationship={}));var bnt=(function(){function e(t,r,n){n===void 0&&(n={}),this.fileData=t,this.fileName=r,this.options=n}return e.for=function(t,r,n){return n===void 0&&(n={}),new e(t,r,n)},e.prototype.embedIntoContext=function(t,r){return vT.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p,C;return vT.__generator(this,function(y){return n=this.options,i=n.mimeType,s=n.description,u=n.creationDate,f=n.modificationDate,h=n.afRelationship,g=t.flateStream(this.fileData,{Type:"EmbeddedFile",Subtype:i??void 0,Params:{Size:this.fileData.length,CreationDate:u?uL.default.fromDate(u):void 0,ModDate:f?uL.default.fromDate(f):void 0}}),p=t.register(g),C=t.obj({Type:"Filespec",F:uL.default.of(this.fileName),UF:c1e.default.fromText(this.fileName),EF:{F:p},Desc:s?c1e.default.fromText(s):void 0,AFRelationship:h??void 0}),r?(t.assign(r,C),[2,r]):[2,t.register(C)]})})},e})();xm.default=bnt});var l1e=U(fL=>{"use strict";Object.defineProperty(fL,"__esModule",{value:!0});var IT=(ct(),ze(ut)),f1e=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],vm;(function(e){e.DeviceGray="DeviceGray",e.DeviceRGB="DeviceRGB",e.DeviceCMYK="DeviceCMYK"})(vm||(vm={}));var Cnt={1:vm.DeviceGray,3:vm.DeviceRGB,4:vm.DeviceCMYK},ynt=(function(){function e(t,r,n,i,s){this.imageData=t,this.bitsPerComponent=r,this.width=n,this.height=i,this.colorSpace=s}return e.for=function(t){return IT.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f,h,g,p,C;return IT.__generator(this,function(y){if(r=new DataView(t.buffer),n=r.getUint16(0),n!==65496)throw new Error("SOI not found in JPEG");for(i=2;i<r.byteLength&&(s=r.getUint16(i),i+=2,!f1e.includes(s));)i+=r.getUint16(i);if(!f1e.includes(s))throw new Error("Invalid JPEG");if(i+=2,u=r.getUint8(i++),f=r.getUint16(i),i+=2,h=r.getUint16(i),i+=2,g=r.getUint8(i++),p=Cnt[g],!p)throw new Error("Unknown JPEG channel.");return C=p,[2,new e(t,u,h,f,C)]})})},e.prototype.embedIntoContext=function(t,r){return IT.__awaiter(this,void 0,void 0,function(){var n;return IT.__generator(this,function(i){return n=t.stream(this.imageData,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.bitsPerComponent,Width:this.width,Height:this.height,ColorSpace:this.colorSpace,Filter:"DCTDecode",Decode:this.colorSpace===vm.DeviceCMYK?[1,0,1,0,1,0,1,0]:void 0}),r?(t.assign(r,n),[2,r]):[2,t.register(n)]})})},e})();fL.default=ynt});var A1e=U(DT=>{"use strict";Object.defineProperty(DT,"__esModule",{value:!0});DT.default=void 0;var xnt=vnt(B1());function vnt(e){return e&&e.__esModule?e:{default:e}}var lt={};lt.toRGBA8=function(e){var t=e.width,r=e.height;if(e.tabs.acTL==null)return[lt.toRGBA8.decodeImage(e.data,t,r,e).buffer];var n=[];e.frames[0].data==null&&(e.frames[0].data=e.data);for(var i=t*r*4,s=new Uint8Array(i),u=new Uint8Array(i),f=new Uint8Array(i),h=0;h<e.frames.length;h++){var g=e.frames[h],p=g.rect.x,C=g.rect.y,y=g.rect.width,x=g.rect.height,v=lt.toRGBA8.decodeImage(g.data,y,x,e);if(h!=0)for(var F=0;F<i;F++)f[F]=s[F];if(g.blend==0?lt._copyTile(v,y,x,s,t,r,p,C,0):g.blend==1&<._copyTile(v,y,x,s,t,r,p,C,1),n.push(s.buffer.slice(0)),g.dispose!=0){if(g.dispose==1)lt._copyTile(u,y,x,s,t,r,p,C,0);else if(g.dispose==2)for(var F=0;F<i;F++)s[F]=f[F]}}return n};lt.toRGBA8.decodeImage=function(e,t,r,n){var i=t*r,s=lt.decode._getBPP(n),u=Math.ceil(t*s/8),f=new Uint8Array(i*4),h=new Uint32Array(f.buffer),g=n.ctype,p=n.depth,C=lt._bin.readUshort,y=Date.now();if(g==6){var x=i<<2;if(p==8)for(var v=0;v<x;v+=4)f[v]=e[v],f[v+1]=e[v+1],f[v+2]=e[v+2],f[v+3]=e[v+3];if(p==16)for(var v=0;v<x;v++)f[v]=e[v<<1]}else if(g==2){var F=n.tabs.tRNS;if(F==null){if(p==8)for(var v=0;v<i;v++){var Q=v*3;h[v]=255<<24|e[Q+2]<<16|e[Q+1]<<8|e[Q]}if(p==16)for(var v=0;v<i;v++){var Q=v*6;h[v]=255<<24|e[Q+4]<<16|e[Q+2]<<8|e[Q]}}else{var T=F[0],_=F[1],S=F[2];if(p==8)for(var v=0;v<i;v++){var N=v<<2,Q=v*3;h[v]=255<<24|e[Q+2]<<16|e[Q+1]<<8|e[Q],e[Q]==T&&e[Q+1]==_&&e[Q+2]==S&&(f[N+3]=0)}if(p==16)for(var v=0;v<i;v++){var N=v<<2,Q=v*6;h[v]=255<<24|e[Q+4]<<16|e[Q+2]<<8|e[Q],C(e,Q)==T&&C(e,Q+2)==_&&C(e,Q+4)==S&&(f[N+3]=0)}}}else if(g==3){var O=n.tabs.PLTE,H=n.tabs.tRNS,q=H?H.length:0;if(p==1)for(var G=0;G<r;G++)for(var J=G*u,Ie=G*t,v=0;v<t;v++){var N=Ie+v<<2,fe=e[J+(v>>3)]>>7-((v&7)<<0)&1,z=3*fe;f[N]=O[z],f[N+1]=O[z+1],f[N+2]=O[z+2],f[N+3]=fe<q?H[fe]:255}if(p==2)for(var G=0;G<r;G++)for(var J=G*u,Ie=G*t,v=0;v<t;v++){var N=Ie+v<<2,fe=e[J+(v>>2)]>>6-((v&3)<<1)&3,z=3*fe;f[N]=O[z],f[N+1]=O[z+1],f[N+2]=O[z+2],f[N+3]=fe<q?H[fe]:255}if(p==4)for(var G=0;G<r;G++)for(var J=G*u,Ie=G*t,v=0;v<t;v++){var N=Ie+v<<2,fe=e[J+(v>>1)]>>4-((v&1)<<2)&15,z=3*fe;f[N]=O[z],f[N+1]=O[z+1],f[N+2]=O[z+2],f[N+3]=fe<q?H[fe]:255}if(p==8)for(var v=0;v<i;v++){var N=v<<2,fe=e[v],z=3*fe;f[N]=O[z],f[N+1]=O[z+1],f[N+2]=O[z+2],f[N+3]=fe<q?H[fe]:255}}else if(g==4){if(p==8)for(var v=0;v<i;v++){var N=v<<2,ge=v<<1,ne=e[ge];f[N]=ne,f[N+1]=ne,f[N+2]=ne,f[N+3]=e[ge+1]}if(p==16)for(var v=0;v<i;v++){var N=v<<2,ge=v<<2,ne=e[ge];f[N]=ne,f[N+1]=ne,f[N+2]=ne,f[N+3]=e[ge+2]}}else if(g==0)for(var T=n.tabs.tRNS?n.tabs.tRNS:-1,G=0;G<r;G++){var Le=G*u,X=G*t;if(p==1)for(var se=0;se<t;se++){var ne=255*(e[Le+(se>>>3)]>>>7-(se&7)&1),j=ne==T*255?0:255;h[X+se]=j<<24|ne<<16|ne<<8|ne}else if(p==2)for(var se=0;se<t;se++){var ne=85*(e[Le+(se>>>2)]>>>6-((se&3)<<1)&3),j=ne==T*85?0:255;h[X+se]=j<<24|ne<<16|ne<<8|ne}else if(p==4)for(var se=0;se<t;se++){var ne=17*(e[Le+(se>>>1)]>>>4-((se&1)<<2)&15),j=ne==T*17?0:255;h[X+se]=j<<24|ne<<16|ne<<8|ne}else if(p==8)for(var se=0;se<t;se++){var ne=e[Le+se],j=ne==T?0:255;h[X+se]=j<<24|ne<<16|ne<<8|ne}else if(p==16)for(var se=0;se<t;se++){var ne=e[Le+(se<<1)],j=C(e,Le+(se<<v))==T?0:255;h[X+se]=j<<24|ne<<16|ne<<8|ne}}return f};lt.decode=function(e){for(var t=new Uint8Array(e),r=8,n=lt._bin,i=n.readUshort,s=n.readUint,u={tabs:{},frames:[]},f=new Uint8Array(t.length),h=0,g,p=0,C=[137,80,78,71,13,10,26,10],y=0;y<8;y++)if(t[y]!=C[y])throw"The input is not a PNG file!";for(;r<t.length;){var x=n.readUint(t,r);r+=4;var v=n.readASCII(t,r,4);if(r+=4,v=="IHDR")lt.decode._IHDR(t,r,u);else if(v=="IDAT"){for(var y=0;y<x;y++)f[h+y]=t[r+y];h+=x}else if(v=="acTL")u.tabs[v]={num_frames:s(t,r),num_plays:s(t,r+4)},g=new Uint8Array(t.length);else if(v=="fcTL"){if(p!=0){var F=u.frames[u.frames.length-1];F.data=lt.decode._decompress(u,g.slice(0,p),F.rect.width,F.rect.height),p=0}var Q={x:s(t,r+12),y:s(t,r+16),width:s(t,r+4),height:s(t,r+8)},T=i(t,r+22);T=i(t,r+20)/(T==0?100:T);var _={rect:Q,delay:Math.round(T*1e3),dispose:t[r+24],blend:t[r+25]};u.frames.push(_)}else if(v=="fdAT"){for(var y=0;y<x-4;y++)g[p+y]=t[r+y+4];p+=x-4}else if(v=="pHYs")u.tabs[v]=[n.readUint(t,r),n.readUint(t,r+4),t[r+8]];else if(v=="cHRM"){u.tabs[v]=[];for(var y=0;y<8;y++)u.tabs[v].push(n.readUint(t,r+y*4))}else if(v=="tEXt"){u.tabs[v]==null&&(u.tabs[v]={});var S=n.nextZero(t,r),N=n.readASCII(t,r,S-r),O=n.readASCII(t,S+1,r+x-S-1);u.tabs[v][N]=O}else if(v=="iTXt"){u.tabs[v]==null&&(u.tabs[v]={});var S=0,H=r;S=n.nextZero(t,H);var N=n.readASCII(t,H,S-H);H=S+1;var q=t[H],G=t[H+1];H+=2,S=n.nextZero(t,H);var J=n.readASCII(t,H,S-H);H=S+1,S=n.nextZero(t,H);var Ie=n.readUTF8(t,H,S-H);H=S+1;var O=n.readUTF8(t,H,x-(H-r));u.tabs[v][N]=O}else if(v=="PLTE")u.tabs[v]=n.readBytes(t,r,x);else if(v=="hIST"){var fe=u.tabs.PLTE.length/3;u.tabs[v]=[];for(var y=0;y<fe;y++)u.tabs[v].push(i(t,r+y*2))}else if(v=="tRNS")u.ctype==3?u.tabs[v]=n.readBytes(t,r,x):u.ctype==0?u.tabs[v]=i(t,r):u.ctype==2&&(u.tabs[v]=[i(t,r),i(t,r+2),i(t,r+4)]);else if(v=="gAMA")u.tabs[v]=n.readUint(t,r)/1e5;else if(v=="sRGB")u.tabs[v]=t[r];else if(v=="bKGD")u.ctype==0||u.ctype==4?u.tabs[v]=[i(t,r)]:u.ctype==2||u.ctype==6?u.tabs[v]=[i(t,r),i(t,r+2),i(t,r+4)]:u.ctype==3&&(u.tabs[v]=t[r]);else if(v=="IEND")break;r+=x;var z=n.readUint(t,r);r+=4}if(p!=0){var F=u.frames[u.frames.length-1];F.data=lt.decode._decompress(u,g.slice(0,p),F.rect.width,F.rect.height),p=0}return u.data=lt.decode._decompress(u,f,u.width,u.height),delete u.compress,delete u.interlace,delete u.filter,u};lt.decode._decompress=function(e,t,r,n){var f=Date.now(),i=lt.decode._getBPP(e),s=Math.ceil(r*i/8),u=new Uint8Array((s+1+e.interlace)*n);t=lt.decode._inflate(t,u);var f=Date.now();return e.interlace==0?t=lt.decode._filterZero(t,e,0,r,n):e.interlace==1&&(t=lt.decode._readInterlace(t,e)),t};lt.decode._inflate=function(e,t){var r=lt.inflateRaw(new Uint8Array(e.buffer,2,e.length-6),t);return r};lt.inflateRaw=(function(){var e={};return e.H={},e.H.N=function(t,r){var n=Uint8Array,i=0,s=0,u=0,f=0,h=0,g=0,p=0,C=0,y=0,x,v;if(t[0]==3&&t[1]==0)return r||new n(0);var F=e.H,Q=F.b,T=F.e,_=F.R,S=F.n,N=F.A,O=F.Z,H=F.m,q=r==null;for(q&&(r=new n(t.length>>>2<<3));i==0;){if(i=Q(t,y,1),s=Q(t,y+1,2),y+=3,s==0){(y&7)!=0&&(y+=8-(y&7));var G=(y>>>3)+4,J=t[G-4]|t[G-3]<<8;q&&(r=e.H.W(r,C+J)),r.set(new n(t.buffer,t.byteOffset+G,J),C),y=G+J<<3,C+=J;continue}if(q&&(r=e.H.W(r,C+(1<<17))),s==1&&(x=H.J,v=H.h,g=511,p=31),s==2){u=T(t,y,5)+257,f=T(t,y+5,5)+1,h=T(t,y+10,4)+4,y+=14;for(var Ie=y,fe=1,z=0;z<38;z+=2)H.Q[z]=0,H.Q[z+1]=0;for(var z=0;z<h;z++){var ge=T(t,y+z*3,3);H.Q[(H.X[z]<<1)+1]=ge,ge>fe&&(fe=ge)}y+=3*h,S(H.Q,fe),N(H.Q,fe,H.u),x=H.w,v=H.d,y=_(H.u,(1<<fe)-1,u+f,t,y,H.v);var ne=F.V(H.v,0,u,H.C);g=(1<<ne)-1;var Le=F.V(H.v,u,f,H.D);p=(1<<Le)-1,S(H.C,ne),N(H.C,ne,x),S(H.D,Le),N(H.D,Le,v)}for(;;){var X=x[O(t,y)&g];y+=X&15;var se=X>>>4;if(!(se>>>8))r[C++]=se;else{if(se==256)break;var j=C+se-254;if(se>264){var Y=H.q[se-257];j=C+(Y>>>3)+T(t,y,Y&7),y+=Y&7}var me=v[O(t,y)&p];y+=me&15;var xe=me>>>4,Be=H.c[xe],Te=(Be>>>4)+Q(t,y,Be&15);for(y+=Be&15;C<j;)r[C]=r[C++-Te],r[C]=r[C++-Te],r[C]=r[C++-Te],r[C]=r[C++-Te];C=j}}}return r.length==C?r:r.slice(0,C)},e.H.W=function(t,r){var n=t.length;if(r<=n)return t;var i=new Uint8Array(n<<1);return i.set(t,0),i},e.H.R=function(t,r,n,i,s,u){for(var f=e.H.e,h=e.H.Z,g=0;g<n;){var p=t[h(i,s)&r];s+=p&15;var C=p>>>4;if(C<=15)u[g]=C,g++;else{var y=0,x=0;C==16?(x=3+f(i,s,2),s+=2,y=u[g-1]):C==17?(x=3+f(i,s,3),s+=3):C==18&&(x=11+f(i,s,7),s+=7);for(var v=g+x;g<v;)u[g]=y,g++}}return s},e.H.V=function(t,r,n,i){for(var s=0,u=0,f=i.length>>>1;u<n;){var h=t[u+r];i[u<<1]=0,i[(u<<1)+1]=h,h>s&&(s=h),u++}for(;u<f;)i[u<<1]=0,i[(u<<1)+1]=0,u++;return s},e.H.n=function(t,r){for(var n=e.H.m,i=t.length,s,u,f,h,g,p=n.j,h=0;h<=r;h++)p[h]=0;for(h=1;h<i;h+=2)p[t[h]]++;var C=n.K;for(s=0,p[0]=0,u=1;u<=r;u++)s=s+p[u-1]<<1,C[u]=s;for(f=0;f<i;f+=2)g=t[f+1],g!=0&&(t[f]=C[g],C[g]++)},e.H.A=function(t,r,n){for(var i=t.length,s=e.H.m,u=s.r,f=0;f<i;f+=2)if(t[f+1]!=0)for(var h=f>>1,g=t[f+1],p=h<<4|g,C=r-g,y=t[f]<<C,x=y+(1<<C);y!=x;){var v=u[y]>>>15-r;n[v]=p,y++}},e.H.l=function(t,r){for(var n=e.H.m.r,i=15-r,s=0;s<t.length;s+=2){var u=t[s]<<r-t[s+1];t[s]=n[u]>>>i}},e.H.M=function(t,r,n){n=n<<(r&7);var i=r>>>3;t[i]|=n,t[i+1]|=n>>>8},e.H.I=function(t,r,n){n=n<<(r&7);var i=r>>>3;t[i]|=n,t[i+1]|=n>>>8,t[i+2]|=n>>>16},e.H.e=function(t,r,n){return(t[r>>>3]|t[(r>>>3)+1]<<8)>>>(r&7)&(1<<n)-1},e.H.b=function(t,r,n){return(t[r>>>3]|t[(r>>>3)+1]<<8|t[(r>>>3)+2]<<16)>>>(r&7)&(1<<n)-1},e.H.Z=function(t,r){return(t[r>>>3]|t[(r>>>3)+1]<<8|t[(r>>>3)+2]<<16)>>>(r&7)},e.H.i=function(t,r){return(t[r>>>3]|t[(r>>>3)+1]<<8|t[(r>>>3)+2]<<16|t[(r>>>3)+3]<<24)>>>(r&7)},e.H.m=(function(){var t=Uint16Array,r=Uint32Array;return{K:new t(16),j:new t(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new t(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new r(32),J:new t(512),_:[],h:new t(32),$:[],w:new t(32768),C:[],v:[],d:new t(32768),D:[],u:new t(512),Q:[],r:new t(32768),s:new r(286),Y:new r(30),a:new r(19),t:new r(15e3),k:new t(65536),g:new t(32768)}})(),(function(){for(var t=e.H.m,r=32768,n=0;n<r;n++){var i=n;i=(i&2863311530)>>>1|(i&1431655765)<<1,i=(i&3435973836)>>>2|(i&858993459)<<2,i=(i&4042322160)>>>4|(i&252645135)<<4,i=(i&4278255360)>>>8|(i&16711935)<<8,t.r[n]=(i>>>16|i<<16)>>>17}function s(u,f,h){for(;f--!=0;)u.push(0,h)}for(var n=0;n<32;n++)t.q[n]=t.S[n]<<3|t.T[n],t.c[n]=t.p[n]<<4|t.z[n];s(t._,144,8),s(t._,112,9),s(t._,24,7),s(t._,8,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),s(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),s(t.Q,19,0),s(t.C,286,0),s(t.D,30,0),s(t.v,320,0)})(),e.H.N})();lt.decode._readInterlace=function(e,t){for(var r=t.width,n=t.height,i=lt.decode._getBPP(t),s=i>>3,u=Math.ceil(r*i/8),f=new Uint8Array(n*u),h=0,g=[0,0,4,0,2,0,1],p=[0,4,0,2,0,1,0],C=[8,8,8,4,4,2,2],y=[8,8,4,4,2,2,1],x=0;x<7;){for(var v=C[x],F=y[x],Q=0,T=0,_=g[x];_<n;)_+=v,T++;for(var S=p[x];S<r;)S+=F,Q++;var N=Math.ceil(Q*i/8);lt.decode._filterZero(e,t,h,Q,T);for(var O=0,H=g[x];H<n;){for(var q=p[x],G=h+O*N<<3;q<r;){if(i==1){var J=e[G>>3];J=J>>7-(G&7)&1,f[H*u+(q>>3)]|=J<<7-((q&7)<<0)}if(i==2){var J=e[G>>3];J=J>>6-(G&7)&3,f[H*u+(q>>2)]|=J<<6-((q&3)<<1)}if(i==4){var J=e[G>>3];J=J>>4-(G&7)&15,f[H*u+(q>>1)]|=J<<4-((q&1)<<2)}if(i>=8)for(var Ie=H*u+q*s,fe=0;fe<s;fe++)f[Ie+fe]=e[(G>>3)+fe];G+=i,q+=F}O++,H+=v}Q*T!=0&&(h+=T*(1+N)),x=x+1}return f};lt.decode._getBPP=function(e){var t=[1,null,3,1,2,null,4][e.ctype];return t*e.depth};lt.decode._filterZero=function(e,t,r,n,i){var s=lt.decode._getBPP(t),u=Math.ceil(n*s/8),f=lt.decode._paeth;s=Math.ceil(s/8);var h=0,g=1,p=e[r],C=0;if(p>1&&(e[r]=[0,0,1][p-2]),p==3)for(C=s;C<u;C++)e[C+1]=e[C+1]+(e[C+1-s]>>>1)&255;for(var y=0;y<i;y++)if(h=r+y*u,g=h+y+1,p=e[g-1],C=0,p==0)for(;C<u;C++)e[h+C]=e[g+C];else if(p==1){for(;C<s;C++)e[h+C]=e[g+C];for(;C<u;C++)e[h+C]=e[g+C]+e[h+C-s]}else if(p==2)for(;C<u;C++)e[h+C]=e[g+C]+e[h+C-u];else if(p==3){for(;C<s;C++)e[h+C]=e[g+C]+(e[h+C-u]>>>1);for(;C<u;C++)e[h+C]=e[g+C]+(e[h+C-u]+e[h+C-s]>>>1)}else{for(;C<s;C++)e[h+C]=e[g+C]+f(0,e[h+C-u],0);for(;C<u;C++)e[h+C]=e[g+C]+f(e[h+C-s],e[h+C-u],e[h+C-s-u])}return e};lt.decode._paeth=function(e,t,r){var n=e+t-r,i=n-e,s=n-t,u=n-r;return i*i<=s*s&&i*i<=u*u?e:s*s<=u*u?t:r};lt.decode._IHDR=function(e,t,r){var n=lt._bin;r.width=n.readUint(e,t),t+=4,r.height=n.readUint(e,t),t+=4,r.depth=e[t],t++,r.ctype=e[t],t++,r.compress=e[t],t++,r.filter=e[t],t++,r.interlace=e[t],t++};lt._bin={nextZero:function(e,t){for(;e[t]!=0;)t++;return t},readUshort:function(e,t){return e[t]<<8|e[t+1]},writeUshort:function(e,t,r){e[t]=r>>8&255,e[t+1]=r&255},readUint:function(e,t){return e[t]*(256*256*256)+(e[t+1]<<16|e[t+2]<<8|e[t+3])},writeUint:function(e,t,r){e[t]=r>>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=r&255},readASCII:function(e,t,r){for(var n="",i=0;i<r;i++)n+=String.fromCharCode(e[t+i]);return n},writeASCII:function(e,t,r){for(var n=0;n<r.length;n++)e[t+n]=r.charCodeAt(n)},readBytes:function(e,t,r){for(var n=[],i=0;i<r;i++)n.push(e[t+i]);return n},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,t,r){for(var n="",i,s=0;s<r;s++)n+="%"+lt._bin.pad(e[t+s].toString(16));try{i=decodeURIComponent(n)}catch{return lt._bin.readASCII(e,t,r)}return i}};lt._copyTile=function(e,t,r,n,i,s,u,f,h){for(var g=Math.min(t,i),p=Math.min(r,s),C=0,y=0,x=0;x<p;x++)for(var v=0;v<g;v++)if(u>=0&&f>=0?(C=x*t+v<<2,y=(f+x)*i+u+v<<2):(C=(-f+x)*t-u+v<<2,y=x*i+v<<2),h==0)n[y]=e[C],n[y+1]=e[C+1],n[y+2]=e[C+2],n[y+3]=e[C+3];else if(h==1){var F=e[C+3]*.00392156862745098,Q=e[C]*F,T=e[C+1]*F,_=e[C+2]*F,S=n[y+3]*(1/255),N=n[y]*S,O=n[y+1]*S,H=n[y+2]*S,q=1-F,G=F+S*q,J=G==0?0:1/G;n[y+3]=255*G,n[y+0]=(Q+N*q)*J,n[y+1]=(T+O*q)*J,n[y+2]=(_+H*q)*J}else if(h==2){var F=e[C+3],Q=e[C],T=e[C+1],_=e[C+2],S=n[y+3],N=n[y],O=n[y+1],H=n[y+2];F==S&&Q==N&&T==O&&_==H?(n[y]=0,n[y+1]=0,n[y+2]=0,n[y+3]=0):(n[y]=Q,n[y+1]=T,n[y+2]=_,n[y+3]=F)}else if(h==3){var F=e[C+3],Q=e[C],T=e[C+1],_=e[C+2],S=n[y+3],N=n[y],O=n[y+1],H=n[y+2];if(F==S&&Q==N&&T==O&&_==H)continue;if(F<220&&S>20)return!1}return!0};lt.encode=function(e,t,r,n,i,s,u){n==null&&(n=0),u==null&&(u=!1);var f=lt.encode.compress(e,t,r,n,[!1,!1,!1,0,u]);return lt.encode.compressPNG(f,-1),lt.encode._main(f,t,r,i,s)};lt.encodeLL=function(e,t,r,n,i,s,u,f){for(var h={ctype:0+(n==1?0:2)+(i==0?0:4),depth:s,frames:[]},g=Date.now(),p=(n+i)*s,C=p*t,y=0;y<e.length;y++)h.frames.push({rect:{x:0,y:0,width:t,height:r},img:new Uint8Array(e[y]),blend:0,dispose:1,bpp:Math.ceil(p/8),bpl:Math.ceil(C/8)});lt.encode.compressPNG(h,0,!0);var x=lt.encode._main(h,t,r,u,f);return x};lt.encode._main=function(e,t,r,n,i){i==null&&(i={});var s=lt.crc.crc,u=lt._bin.writeUint,f=lt._bin.writeUshort,h=lt._bin.writeASCII,g=8,p=e.frames.length>1,C=!1,y=33+(p?20:0);if(i.sRGB!=null&&(y+=13),i.pHYs!=null&&(y+=21),e.ctype==3){for(var x=e.plte.length,v=0;v<x;v++)e.plte[v]>>>24!=255&&(C=!0);y+=8+x*3+4+(C?8+x*1+4:0)}for(var F=0;F<e.frames.length;F++){var Q=e.frames[F];p&&(y+=38),y+=Q.cimg.length+12,F!=0&&(y+=4)}y+=12;for(var T=new Uint8Array(y),_=[137,80,78,71,13,10,26,10],v=0;v<8;v++)T[v]=_[v];if(u(T,g,13),g+=4,h(T,g,"IHDR"),g+=4,u(T,g,t),g+=4,u(T,g,r),g+=4,T[g]=e.depth,g++,T[g]=e.ctype,g++,T[g]=0,g++,T[g]=0,g++,T[g]=0,g++,u(T,g,s(T,g-17,17)),g+=4,i.sRGB!=null&&(u(T,g,1),g+=4,h(T,g,"sRGB"),g+=4,T[g]=i.sRGB,g++,u(T,g,s(T,g-5,5)),g+=4),i.pHYs!=null&&(u(T,g,9),g+=4,h(T,g,"pHYs"),g+=4,u(T,g,i.pHYs[0]),g+=4,u(T,g,i.pHYs[1]),g+=4,T[g]=i.pHYs[2],g++,u(T,g,s(T,g-13,13)),g+=4),p&&(u(T,g,8),g+=4,h(T,g,"acTL"),g+=4,u(T,g,e.frames.length),g+=4,u(T,g,i.loop!=null?i.loop:0),g+=4,u(T,g,s(T,g-12,12)),g+=4),e.ctype==3){var x=e.plte.length;u(T,g,x*3),g+=4,h(T,g,"PLTE"),g+=4;for(var v=0;v<x;v++){var S=v*3,N=e.plte[v],O=N&255,H=N>>>8&255,q=N>>>16&255;T[g+S+0]=O,T[g+S+1]=H,T[g+S+2]=q}if(g+=x*3,u(T,g,s(T,g-x*3-4,x*3+4)),g+=4,C){u(T,g,x),g+=4,h(T,g,"tRNS"),g+=4;for(var v=0;v<x;v++)T[g+v]=e.plte[v]>>>24&255;g+=x,u(T,g,s(T,g-x-4,x+4)),g+=4}}for(var G=0,F=0;F<e.frames.length;F++){var Q=e.frames[F];p&&(u(T,g,26),g+=4,h(T,g,"fcTL"),g+=4,u(T,g,G++),g+=4,u(T,g,Q.rect.width),g+=4,u(T,g,Q.rect.height),g+=4,u(T,g,Q.rect.x),g+=4,u(T,g,Q.rect.y),g+=4,f(T,g,n[F]),g+=2,f(T,g,1e3),g+=2,T[g]=Q.dispose,g++,T[g]=Q.blend,g++,u(T,g,s(T,g-30,30)),g+=4);var J=Q.cimg,x=J.length;u(T,g,x+(F==0?0:4)),g+=4;var Ie=g;h(T,g,F==0?"IDAT":"fdAT"),g+=4,F!=0&&(u(T,g,G++),g+=4),T.set(J,g),g+=x,u(T,g,s(T,Ie,g-Ie)),g+=4}return u(T,g,0),g+=4,h(T,g,"IEND"),g+=4,u(T,g,s(T,g-4,4)),g+=4,T.buffer};lt.encode.compressPNG=function(e,t,r){for(var n=0;n<e.frames.length;n++){var i=e.frames[n],s=i.rect.width,u=i.rect.height,f=new Uint8Array(u*i.bpl+u);i.cimg=lt.encode._filterZero(i.img,u,i.bpp,i.bpl,f,t,r)}};lt.encode.compress=function(e,t,r,n,i){for(var s=i[0],u=i[1],f=i[2],h=i[3],g=i[4],p=6,C=8,y=255,x=0;x<e.length;x++)for(var v=new Uint8Array(e[x]),F=v.length,Q=0;Q<F;Q+=4)y&=v[Q+3];var T=y!=255,_=lt.encode.framize(e,t,r,s,u,f),S={},N=[],O=[];if(n!=0){for(var H=[],Q=0;Q<_.length;Q++)H.push(_[Q].img.buffer);for(var q=lt.encode.concatRGBA(H),G=lt.quantize(q,n),J=0,Ie=new Uint8Array(G.abuf),Q=0;Q<_.length;Q++){var fe=_[Q].img,z=fe.length;O.push(new Uint8Array(G.inds.buffer,J>>2,z>>2));for(var x=0;x<z;x+=4)fe[x]=Ie[J+x],fe[x+1]=Ie[J+x+1],fe[x+2]=Ie[J+x+2],fe[x+3]=Ie[J+x+3];J+=z}for(var Q=0;Q<G.plte.length;Q++)N.push(G.plte[Q].est.rgba)}else for(var x=0;x<_.length;x++){var ge=_[x],ne=new Uint32Array(ge.img.buffer),Le=ge.rect.width,F=ne.length,X=new Uint8Array(F);O.push(X);for(var Q=0;Q<F;Q++){var se=ne[Q];if(Q!=0&&se==ne[Q-1])X[Q]=X[Q-1];else if(Q>Le&&se==ne[Q-Le])X[Q]=X[Q-Le];else{var j=S[se];if(j==null&&(S[se]=j=N.length,N.push(se),N.length>=300))break;X[Q]=j}}}var Y=N.length;Y<=256&&g==!1&&(Y<=2?C=1:Y<=4?C=2:Y<=16?C=4:C=8,C=Math.max(C,h));for(var x=0;x<_.length;x++){var ge=_[x],me=ge.rect.x,xe=ge.rect.y,Le=ge.rect.width,Be=ge.rect.height,Te=ge.img,Ge=new Uint32Array(Te.buffer),ye=4*Le,mt=4;if(Y<=256&&g==!1){ye=Math.ceil(C*Le/8);for(var ot=new Uint8Array(ye*Be),sr=O[x],Qr=0;Qr<Be;Qr++){var Q=Qr*ye,tt=Qr*Le;if(C==8)for(var Tt=0;Tt<Le;Tt++)ot[Q+Tt]=sr[tt+Tt];else if(C==4)for(var Tt=0;Tt<Le;Tt++)ot[Q+(Tt>>1)]|=sr[tt+Tt]<<4-(Tt&1)*4;else if(C==2)for(var Tt=0;Tt<Le;Tt++)ot[Q+(Tt>>2)]|=sr[tt+Tt]<<6-(Tt&3)*2;else if(C==1)for(var Tt=0;Tt<Le;Tt++)ot[Q+(Tt>>3)]|=sr[tt+Tt]<<7-(Tt&7)*1}Te=ot,p=3,mt=1}else if(T==!1&&_.length==1){for(var ot=new Uint8Array(Le*Be*3),ve=Le*Be,Q=0;Q<ve;Q++){var fe=Q*3,at=Q*4;ot[fe]=Te[at],ot[fe+1]=Te[at+1],ot[fe+2]=Te[at+2]}Te=ot,p=2,mt=3,ye=3*Le}ge.img=Te,ge.bpl=ye,ge.bpp=mt}return{ctype:p,depth:C,plte:N,frames:_}};lt.encode.framize=function(e,t,r,n,i,s){for(var u=[],f=0;f<e.length;f++){var h=new Uint8Array(e[f]),g=new Uint32Array(h.buffer),p,C=0,y=0,x=t,v=r,F=n?1:0;if(f!=0){for(var Q=s||n||f==1||u[f-2].dispose!=0?1:2,T=0,_=1e9,S=0;S<Q;S++){for(var ge=new Uint8Array(e[f-1-S]),N=new Uint32Array(e[f-1-S]),O=t,H=r,q=-1,G=-1,J=0;J<r;J++)for(var Ie=0;Ie<t;Ie++){var fe=J*t+Ie;g[fe]!=N[fe]&&(Ie<O&&(O=Ie),Ie>q&&(q=Ie),J<H&&(H=J),J>G&&(G=J))}q==-1&&(O=H=q=G=0),i&&((O&1)==1&&O--,(H&1)==1&&H--);var z=(q-O+1)*(G-H+1);z<_&&(_=z,T=S,C=O,y=H,x=q-O+1,v=G-H+1)}var ge=new Uint8Array(e[f-1-T]);T==1&&(u[f-1].dispose=2),p=new Uint8Array(x*v*4),lt._copyTile(ge,t,r,p,x,v,-C,-y,0),F=lt._copyTile(h,t,r,p,x,v,-C,-y,3)?1:0,F==1?lt.encode._prepareDiff(h,t,r,p,{x:C,y,width:x,height:v}):lt._copyTile(h,t,r,p,x,v,-C,-y,0)}else p=h.slice(0);u.push({rect:{x:C,y,width:x,height:v},img:p,blend:F,dispose:0})}if(n)for(var f=0;f<u.length;f++){var ne=u[f];if(ne.blend!=1){var Le=ne.rect,X=u[f-1].rect,se=Math.min(Le.x,X.x),j=Math.min(Le.y,X.y),Y=Math.max(Le.x+Le.width,X.x+X.width),me=Math.max(Le.y+Le.height,X.y+X.height),xe={x:se,y:j,width:Y-se,height:me-j};u[f-1].dispose=1,f-1!=0&<.encode._updateFrame(e,t,r,u,f-1,xe,i),lt.encode._updateFrame(e,t,r,u,f,xe,i)}}var Be=0;if(e.length!=1)for(var fe=0;fe<u.length;fe++){var ne=u[fe];Be+=ne.rect.width*ne.rect.height}return u};lt.encode._updateFrame=function(e,t,r,n,i,s,u){for(var f=Uint8Array,h=Uint32Array,g=new f(e[i-1]),p=new h(e[i-1]),C=i+1<e.length?new f(e[i+1]):null,y=new f(e[i]),x=new h(y.buffer),v=t,F=r,Q=-1,T=-1,_=0;_<s.height;_++)for(var S=0;S<s.width;S++){var N=s.x+S,O=s.y+_,H=O*t+N,q=x[H];q==0||n[i-1].dispose==0&&p[H]==q&&(C==null||C[H*4+3]!=0)||(N<v&&(v=N),N>Q&&(Q=N),O<F&&(F=O),O>T&&(T=O))}Q==-1&&(v=F=Q=T=0),u&&((v&1)==1&&v--,(F&1)==1&&F--),s={x:v,y:F,width:Q-v+1,height:T-F+1};var G=n[i];G.rect=s,G.blend=1,G.img=new Uint8Array(s.width*s.height*4),n[i-1].dispose==0?(lt._copyTile(g,t,r,G.img,s.width,s.height,-s.x,-s.y,0),lt.encode._prepareDiff(y,t,r,G.img,s)):lt._copyTile(y,t,r,G.img,s.width,s.height,-s.x,-s.y,0)};lt.encode._prepareDiff=function(e,t,r,n,i){lt._copyTile(e,t,r,n,i.width,i.height,-i.x,-i.y,2)};lt.encode._filterZero=function(e,t,r,n,i,s,u){var f=[],h=[0,1,2,3,4];s!=-1?h=[s]:(t*n>5e5||r==1)&&(h=[0]);var g;u&&(g={level:0});for(var p=u&&UZIP!=null?UZIP:xnt.default,C=0;C<h.length;C++){for(var y=0;y<t;y++)lt.encode._filterLine(i,e,y,n,r,h[C]);f.push(p.deflate(i,g))}for(var x,v=1e9,C=0;C<f.length;C++)f[C].length<v&&(x=C,v=f[C].length);return f[x]};lt.encode._filterLine=function(e,t,r,n,i,s){var u=r*n,f=u+r,h=lt.decode._paeth;if(e[f]=s,f++,s==0)if(n<500)for(var g=0;g<n;g++)e[f+g]=t[u+g];else e.set(new Uint8Array(t.buffer,u,n),f);else if(s==1){for(var g=0;g<i;g++)e[f+g]=t[u+g];for(var g=i;g<n;g++)e[f+g]=t[u+g]-t[u+g-i]+256&255}else if(r==0){for(var g=0;g<i;g++)e[f+g]=t[u+g];if(s==2)for(var g=i;g<n;g++)e[f+g]=t[u+g];if(s==3)for(var g=i;g<n;g++)e[f+g]=t[u+g]-(t[u+g-i]>>1)+256&255;if(s==4)for(var g=i;g<n;g++)e[f+g]=t[u+g]-h(t[u+g-i],0,0)+256&255}else{if(s==2)for(var g=0;g<n;g++)e[f+g]=t[u+g]+256-t[u+g-n]&255;if(s==3){for(var g=0;g<i;g++)e[f+g]=t[u+g]+256-(t[u+g-n]>>1)&255;for(var g=i;g<n;g++)e[f+g]=t[u+g]+256-(t[u+g-n]+t[u+g-i]>>1)&255}if(s==4){for(var g=0;g<i;g++)e[f+g]=t[u+g]+256-h(0,t[u+g-n],0)&255;for(var g=i;g<n;g++)e[f+g]=t[u+g]+256-h(t[u+g-i],t[u+g-n],t[u+g-i-n])&255}}};lt.crc={table:(function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var r=t,n=0;n<8;n++)r&1?r=3988292384^r>>>1:r=r>>>1;e[t]=r}return e})(),update:function(e,t,r,n){for(var i=0;i<n;i++)e=lt.crc.table[(e^t[r+i])&255]^e>>>8;return e},crc:function(e,t,r){return lt.crc.update(4294967295,e,t,r)^4294967295}};lt.quantize=function(e,t){for(var r=new Uint8Array(e),n=r.slice(0),i=new Uint32Array(n.buffer),s=lt.quantize.getKDtree(n,t),u=s[0],f=s[1],h=lt.quantize.planeDst,g=r,p=i,C=g.length,y=new Uint8Array(r.length>>2),x=0;x<C;x+=4){var v=g[x]*.00392156862745098,F=g[x+1]*(1/255),Q=g[x+2]*(1/255),T=g[x+3]*(1/255),_=lt.quantize.getNearest(u,v,F,Q,T);y[x>>2]=_.ind,p[x>>2]=_.est.rgba}return{abuf:n.buffer,inds:y,plte:f}};lt.quantize.getKDtree=function(e,t,r){r==null&&(r=1e-4);var n=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=lt.quantize.stats(e,i.i0,i.i1),i.est=lt.quantize.estats(i.bst);for(var s=[i];s.length<t;){for(var u=0,f=0,h=0;h<s.length;h++)s[h].est.L>u&&(u=s[h].est.L,f=h);if(u<r)break;var g=s[f],p=lt.quantize.splitPixels(e,n,g.i0,g.i1,g.est.e,g.est.eMq255),C=g.i0>=p||g.i1<=p;if(C){g.est.L=0;continue}var y={i0:g.i0,i1:p,bst:null,est:null,tdst:0,left:null,right:null};y.bst=lt.quantize.stats(e,y.i0,y.i1),y.est=lt.quantize.estats(y.bst);var x={i0:p,i1:g.i1,bst:null,est:null,tdst:0,left:null,right:null};x.bst={R:[],m:[],N:g.bst.N-y.bst.N};for(var h=0;h<16;h++)x.bst.R[h]=g.bst.R[h]-y.bst.R[h];for(var h=0;h<4;h++)x.bst.m[h]=g.bst.m[h]-y.bst.m[h];x.est=lt.quantize.estats(x.bst),g.left=y,g.right=x,s[f]=y,s.push(x)}s.sort(function(v,F){return F.bst.N-v.bst.N});for(var h=0;h<s.length;h++)s[h].ind=h;return[i,s]};lt.quantize.getNearest=function(e,t,r,n,i){if(e.left==null)return e.tdst=lt.quantize.dist(e.est.q,t,r,n,i),e;var s=lt.quantize.planeDst(e.est,t,r,n,i),u=e.left,f=e.right;s>0&&(u=e.right,f=e.left);var h=lt.quantize.getNearest(u,t,r,n,i);if(h.tdst<=s*s)return h;var g=lt.quantize.getNearest(f,t,r,n,i);return g.tdst<h.tdst?g:h};lt.quantize.planeDst=function(e,t,r,n,i){var s=e.e;return s[0]*t+s[1]*r+s[2]*n+s[3]*i-e.eMq};lt.quantize.dist=function(e,t,r,n,i){var s=t-e[0],u=r-e[1],f=n-e[2],h=i-e[3];return s*s+u*u+f*f+h*h};lt.quantize.splitPixels=function(e,t,r,n,i,s){var u=lt.quantize.vecDot;n-=4;for(var f=0;r<n;){for(;u(e,r,i)<=s;)r+=4;for(;u(e,n,i)>s;)n-=4;if(r>=n)break;var h=t[r>>2];t[r>>2]=t[n>>2],t[n>>2]=h,r+=4,n-=4}for(;u(e,r,i)>s;)r-=4;return r+4};lt.quantize.vecDot=function(e,t,r){return e[t]*r[0]+e[t+1]*r[1]+e[t+2]*r[2]+e[t+3]*r[3]};lt.quantize.stats=function(e,t,r){for(var n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],s=r-t>>2,u=t;u<r;u+=4){var f=e[u]*.00392156862745098,h=e[u+1]*(1/255),g=e[u+2]*(1/255),p=e[u+3]*(1/255);i[0]+=f,i[1]+=h,i[2]+=g,i[3]+=p,n[0]+=f*f,n[1]+=f*h,n[2]+=f*g,n[3]+=f*p,n[5]+=h*h,n[6]+=h*g,n[7]+=h*p,n[10]+=g*g,n[11]+=g*p,n[15]+=p*p}return n[4]=n[1],n[8]=n[2],n[9]=n[6],n[12]=n[3],n[13]=n[7],n[14]=n[11],{R:n,m:i,N:s}};lt.quantize.estats=function(e){var t=e.R,r=e.m,n=e.N,i=r[0],s=r[1],u=r[2],f=r[3],h=n==0?0:1/n,g=[t[0]-i*i*h,t[1]-i*s*h,t[2]-i*u*h,t[3]-i*f*h,t[4]-s*i*h,t[5]-s*s*h,t[6]-s*u*h,t[7]-s*f*h,t[8]-u*i*h,t[9]-u*s*h,t[10]-u*u*h,t[11]-u*f*h,t[12]-f*i*h,t[13]-f*s*h,t[14]-f*u*h,t[15]-f*f*h],p=g,C=lt.M4,y=[.5,.5,.5,.5],x=0,v=0;if(n!=0)for(var F=0;F<10&&(y=C.multVec(p,y),v=Math.sqrt(C.dot(y,y)),y=C.sml(1/v,y),!(Math.abs(v-x)<1e-9));F++)x=v;var Q=[i*h,s*h,u*h,f*h],T=C.dot(C.sml(255,Q),y);return{Cov:g,q:Q,e:y,L:x,eMq255:T,eMq:C.dot(y,Q),rgba:(Math.round(255*Q[3])<<24|Math.round(255*Q[2])<<16|Math.round(255*Q[1])<<8|Math.round(255*Q[0])<<0)>>>0}};lt.M4={multVec:function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]]},dot:function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},sml:function(e,t){return[e*t[0],e*t[1],e*t[2],e*t[3]]}};lt.encode.concatRGBA=function(e){for(var t=0,r=0;r<e.length;r++)t+=e[r].byteLength;for(var n=new Uint8Array(t),i=0,r=0;r<e.length;r++){for(var s=new Uint8Array(e[r]),u=s.length,f=0;f<u;f+=4){var h=s[f],g=s[f+1],p=s[f+2],C=s[f+3];C==0&&(h=g=p=0),n[i+f]=h,n[i+f+1]=g,n[i+f+2]=p,n[i+f+3]=C}i+=u}return n.buffer};var Int=lt;DT.default=Int});var h1e=U(Xh=>{"use strict";Object.defineProperty(Xh,"__esModule",{value:!0});Xh.PNG=Xh.PngType=void 0;var Dnt=(ct(),ze(ut)),d1e=Dnt.__importDefault(A1e()),Bnt=function(e){if(e===0)return Im.Greyscale;if(e===2)return Im.Truecolour;if(e===3)return Im.IndexedColour;if(e===4)return Im.GreyscaleWithAlpha;if(e===6)return Im.TruecolourWithAlpha;throw new Error("Unknown color type: "+e)},wnt=function(e){for(var t=Math.floor(e.length/4),r=new Uint8Array(t*3),n=new Uint8Array(t*1),i=0,s=0,u=0;i<e.length;)r[s++]=e[i++],r[s++]=e[i++],r[s++]=e[i++],n[u++]=e[i++];return{rgbChannel:r,alphaChannel:n}},Im;(function(e){e.Greyscale="Greyscale",e.Truecolour="Truecolour",e.IndexedColour="IndexedColour",e.GreyscaleWithAlpha="GreyscaleWithAlpha",e.TruecolourWithAlpha="TruecolourWithAlpha"})(Im=Xh.PngType||(Xh.PngType={}));var Fnt=(function(){function e(t){var r=d1e.default.decode(t),n=d1e.default.toRGBA8(r);if(n.length>1)throw new Error("Animated PNGs are not supported");var i=new Uint8Array(n[0]),s=wnt(i),u=s.rgbChannel,f=s.alphaChannel;this.rgbChannel=u;var h=f.some(function(g){return g<255});h&&(this.alphaChannel=f),this.type=Bnt(r.ctype),this.width=r.width,this.height=r.height,this.bitsPerComponent=8}return e.load=function(t){return new e(t)},e})();Xh.PNG=Fnt});var g1e=U(lL=>{"use strict";Object.defineProperty(lL,"__esModule",{value:!0});var BT=(ct(),ze(ut)),Tnt=h1e(),Snt=(function(){function e(t){this.image=t,this.bitsPerComponent=t.bitsPerComponent,this.width=t.width,this.height=t.height,this.colorSpace="DeviceRGB"}return e.for=function(t){return BT.__awaiter(this,void 0,void 0,function(){var r;return BT.__generator(this,function(n){return r=Tnt.PNG.load(t),[2,new e(r)]})})},e.prototype.embedIntoContext=function(t,r){return BT.__awaiter(this,void 0,void 0,function(){var n,i;return BT.__generator(this,function(s){return n=this.embedAlphaChannel(t),i=t.flateStream(this.image.rgbChannel,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.image.bitsPerComponent,Width:this.image.width,Height:this.image.height,ColorSpace:this.colorSpace,SMask:n}),r?(t.assign(r,i),[2,r]):[2,t.register(i)]})})},e.prototype.embedAlphaChannel=function(t){if(this.image.alphaChannel){var r=t.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 t.register(r)}},e})();lL.default=Snt});var dL=U(AL=>{"use strict";Object.defineProperty(AL,"__esModule",{value:!0});var Qnt=(function(){function e(t,r,n){this.bytes=t,this.start=r||0,this.pos=this.start,this.end=r&&n?r+n:this.bytes.length}return Object.defineProperty(e.prototype,"length",{get:function(){return this.end-this.start},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.length===0},enumerable:!1,configurable:!0}),e.prototype.getByte=function(){return this.pos>=this.end?-1:this.bytes[this.pos++]},e.prototype.getUint16=function(){var t=this.getByte(),r=this.getByte();return t===-1||r===-1?-1:(t<<8)+r},e.prototype.getInt32=function(){var t=this.getByte(),r=this.getByte(),n=this.getByte(),i=this.getByte();return(t<<24)+(r<<16)+(n<<8)+i},e.prototype.getBytes=function(t,r){r===void 0&&(r=!1);var n=this.bytes,i=this.pos,s=this.end;if(t){var f=i+t;f>s&&(f=s),this.pos=f;var u=n.subarray(i,f);return r?new Uint8ClampedArray(u):u}else{var u=n.subarray(i,s);return r?new Uint8ClampedArray(u):u}},e.prototype.peekByte=function(){var t=this.getByte();return this.pos--,t},e.prototype.peekBytes=function(t,r){r===void 0&&(r=!1);var n=this.getBytes(t,r);return this.pos-=n.length,n},e.prototype.skip=function(t){t||(t=1),this.pos+=t},e.prototype.reset=function(){this.pos=this.start},e.prototype.moveStart=function(){this.start=this.pos},e.prototype.makeSubStream=function(t,r){return new e(this.bytes,t,r)},e.prototype.decode=function(){return this.bytes},e})();AL.default=Qnt});var Dm=U(hL=>{"use strict";Object.defineProperty(hL,"__esModule",{value:!0});var _nt=(ct(),ze(ut)),Nnt=Nn(),knt=_nt.__importDefault(dL()),Rnt=new Uint8Array(0),Unt=(function(){function e(t){if(this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=Rnt,this.minBufferLength=512,t)for(;this.minBufferLength<t;)this.minBufferLength*=2}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){for(;!this.eof&&this.bufferLength===0;)this.readBlock();return this.bufferLength===0},enumerable:!1,configurable:!0}),e.prototype.getByte=function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.pos++]},e.prototype.getUint16=function(){var t=this.getByte(),r=this.getByte();return t===-1||r===-1?-1:(t<<8)+r},e.prototype.getInt32=function(){var t=this.getByte(),r=this.getByte(),n=this.getByte(),i=this.getByte();return(t<<24)+(r<<16)+(n<<8)+i},e.prototype.getBytes=function(t,r){r===void 0&&(r=!1);var n,i=this.pos;if(t){for(this.ensureBuffer(i+t),n=i+t;!this.eof&&this.bufferLength<n;)this.readBlock();var s=this.bufferLength;n>s&&(n=s)}else{for(;!this.eof;)this.readBlock();n=this.bufferLength}this.pos=n;var u=this.buffer.subarray(i,n);return r&&!(u instanceof Uint8ClampedArray)?new Uint8ClampedArray(u):u},e.prototype.peekByte=function(){var t=this.getByte();return this.pos--,t},e.prototype.peekBytes=function(t,r){r===void 0&&(r=!1);var n=this.getBytes(t,r);return this.pos-=n.length,n},e.prototype.skip=function(t){t||(t=1),this.pos+=t},e.prototype.reset=function(){this.pos=0},e.prototype.makeSubStream=function(t,r){for(var n=t+r;this.bufferLength<=n&&!this.eof;)this.readBlock();return new knt.default(this.buffer,t,r)},e.prototype.decode=function(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)},e.prototype.readBlock=function(){throw new Nnt.MethodNotImplementedError(this.constructor.name,"readBlock")},e.prototype.ensureBuffer=function(t){var r=this.buffer;if(t<=r.byteLength)return r;for(var n=this.minBufferLength;n<t;)n*=2;var i=new Uint8Array(n);return i.set(r),this.buffer=i},e})();hL.default=Unt});var E1e=U(gL=>{"use strict";Object.defineProperty(gL,"__esModule",{value:!0});var m1e=(ct(),ze(ut)),Mnt=m1e.__importDefault(Dm()),p1e=function(e){return e===32||e===9||e===13||e===10},Ont=(function(e){m1e.__extends(t,e);function t(r,n){var i=e.call(this,n)||this;return i.stream=r,i.input=new Uint8Array(5),n&&(n=.8*n),i}return t.prototype.readBlock=function(){for(var r=126,n=122,i=-1,s=this.stream,u=s.getByte();p1e(u);)u=s.getByte();if(u===i||u===r){this.eof=!0;return}var f=this.bufferLength,h,g;if(u===n){for(h=this.ensureBuffer(f+4),g=0;g<4;++g)h[f+g]=0;this.bufferLength+=4}else{var p=this.input;for(p[0]=u,g=1;g<5;++g){for(u=s.getByte();p1e(u);)u=s.getByte();if(p[g]=u,u===i||u===r)break}if(h=this.ensureBuffer(f+g-1),this.bufferLength+=g-1,g<5){for(;g<5;++g)p[g]=117;this.eof=!0}var C=0;for(g=0;g<5;++g)C=C*85+(p[g]-33);for(g=3;g>=0;--g)h[f+g]=C&255,C>>=8}},t})(Mnt.default);gL.default=Ont});var C1e=U(pL=>{"use strict";Object.defineProperty(pL,"__esModule",{value:!0});var b1e=(ct(),ze(ut)),Lnt=b1e.__importDefault(Dm()),Pnt=(function(e){b1e.__extends(t,e);function t(r,n){var i=e.call(this,n)||this;return i.stream=r,i.firstDigit=-1,n&&(n=.5*n),i}return t.prototype.readBlock=function(){var r=8e3,n=this.stream.getBytes(r);if(!n.length){this.eof=!0;return}for(var i=n.length+1>>1,s=this.ensureBuffer(this.bufferLength+i),u=this.bufferLength,f=this.firstDigit,h=0,g=n.length;h<g;h++){var p=n[h],C=void 0;if(p>=48&&p<=57)C=p&15;else if(p>=65&&p<=70||p>=97&&p<=102)C=(p&15)+9;else if(p===62){this.eof=!0;break}else continue;f<0?f=C:(s[u++]=f<<4|C,f=-1)}f>=0&&this.eof&&(s[u++]=f<<4,f=-1),this.firstDigit=f,this.bufferLength=u},t})(Lnt.default);pL.default=Pnt});var v1e=U(mL=>{"use strict";Object.defineProperty(mL,"__esModule",{value:!0});var x1e=(ct(),ze(ut)),Hnt=x1e.__importDefault(Dm()),y1e=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qnt=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]),Wnt=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]),Gnt=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],Vnt=[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],Ynt=(function(e){x1e.__extends(t,e);function t(r,n){var i=e.call(this,n)||this;i.stream=r;var s=r.getByte(),u=r.getByte();if(s===-1||u===-1)throw new Error("Invalid header in flate stream: "+s+", "+u);if((s&15)!==8)throw new Error("Unknown compression method in flate stream: "+s+", "+u);if(((s<<8)+u)%31!==0)throw new Error("Bad FCHECK in flate stream: "+s+", "+u);if(u&32)throw new Error("FDICT bit set in flate stream: "+s+", "+u);return i.codeSize=0,i.codeBuf=0,i}return t.prototype.readBlock=function(){var r,n,i=this.stream,s=this.getBits(3);if(s&1&&(this.eof=!0),s>>=1,s===0){var u=void 0;if((u=i.getByte())===-1)throw new Error("Bad block header in flate stream");var f=u;if((u=i.getByte())===-1)throw new Error("Bad block header in flate stream");if(f|=u<<8,(u=i.getByte())===-1)throw new Error("Bad block header in flate stream");var h=u;if((u=i.getByte())===-1)throw new Error("Bad block header in flate stream");if(h|=u<<8,h!==(~f&65535)&&(f!==0||h!==0))throw new Error("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;var g=this.bufferLength;r=this.ensureBuffer(g+f);var p=g+f;if(this.bufferLength=p,f===0)i.peekByte()===-1&&(this.eof=!0);else for(var C=g;C<p;++C){if((u=i.getByte())===-1){this.eof=!0;break}r[C]=u}return}var y,x;if(s===1)y=Gnt,x=Vnt;else if(s===2){var v=this.getBits(5)+257,F=this.getBits(5)+1,Q=this.getBits(4)+4,T=new Uint8Array(y1e.length),_=void 0;for(_=0;_<Q;++_)T[y1e[_]]=this.getBits(3);var S=this.generateHuffmanTable(T);n=0,_=0;for(var N=v+F,O=new Uint8Array(N),H=void 0,q=void 0,G=void 0;_<N;){var J=this.getCode(S);if(J===16)H=2,q=3,G=n;else if(J===17)H=3,q=3,G=n=0;else if(J===18)H=7,q=11,G=n=0;else{O[_++]=n=J;continue}for(var Ie=this.getBits(H)+q;Ie-- >0;)O[_++]=G}y=this.generateHuffmanTable(O.subarray(0,v)),x=this.generateHuffmanTable(O.subarray(v,N))}else throw new Error("Unknown block type in flate stream");r=this.buffer;for(var fe=r?r.length:0,z=this.bufferLength;;){var ge=this.getCode(y);if(ge<256){z+1>=fe&&(r=this.ensureBuffer(z+1),fe=r.length),r[z++]=ge;continue}if(ge===256){this.bufferLength=z;return}ge-=257,ge=qnt[ge];var ne=ge>>16;ne>0&&(ne=this.getBits(ne)),n=(ge&65535)+ne,ge=this.getCode(x),ge=Wnt[ge],ne=ge>>16,ne>0&&(ne=this.getBits(ne));var Le=(ge&65535)+ne;z+n>=fe&&(r=this.ensureBuffer(z+n),fe=r.length);for(var X=0;X<n;++X,++z)r[z]=r[z-Le]}},t.prototype.getBits=function(r){for(var n=this.stream,i=this.codeSize,s=this.codeBuf,u;i<r;){if((u=n.getByte())===-1)throw new Error("Bad encoding in flate stream");s|=u<<i,i+=8}return u=s&(1<<r)-1,this.codeBuf=s>>r,this.codeSize=i-=r,u},t.prototype.getCode=function(r){for(var n=this.stream,i=r[0],s=r[1],u=this.codeSize,f=this.codeBuf,h;u<s&&(h=n.getByte())!==-1;)f|=h<<u,u+=8;var g=i[f&(1<<s)-1];typeof i=="number"&&console.log("FLATE:",g);var p=g>>16,C=g&65535;if(p<1||u<p)throw new Error("Bad encoding in flate stream");return this.codeBuf=f>>p,this.codeSize=u-p,C},t.prototype.generateHuffmanTable=function(r){var n=r.length,i=0,s;for(s=0;s<n;++s)r[s]>i&&(i=r[s]);for(var u=1<<i,f=new Int32Array(u),h=1,g=0,p=2;h<=i;++h,g<<=1,p<<=1)for(var C=0;C<n;++C)if(r[C]===h){var y=0,x=g;for(s=0;s<h;++s)y=y<<1|x&1,x>>=1;for(s=y;s<u;s+=p)f[s]=h<<16|C;++g}return[f,i]},t})(Hnt.default);mL.default=Ynt});var D1e=U(EL=>{"use strict";Object.defineProperty(EL,"__esModule",{value:!0});var I1e=(ct(),ze(ut)),jnt=I1e.__importDefault(Dm()),Jnt=(function(e){I1e.__extends(t,e);function t(r,n,i){var s=e.call(this,n)||this;s.stream=r,s.cachedData=0,s.bitsCached=0;for(var u=4096,f={earlyChange:i,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(u),dictionaryLengths:new Uint16Array(u),dictionaryPrevCodes:new Uint16Array(u),currentSequence:new Uint8Array(u),currentSequenceLength:0},h=0;h<256;++h)f.dictionaryValues[h]=h,f.dictionaryLengths[h]=1;return s.lzwState=f,s}return t.prototype.readBlock=function(){var r=512,n=r*2,i=r,s,u,f,h=this.lzwState;if(h){var g=h.earlyChange,p=h.nextCode,C=h.dictionaryValues,y=h.dictionaryLengths,x=h.dictionaryPrevCodes,v=h.codeLength,F=h.prevCode,Q=h.currentSequence,T=h.currentSequenceLength,_=0,S=this.bufferLength,N=this.ensureBuffer(this.bufferLength+n);for(s=0;s<r;s++){var O=this.readBits(v),H=T>0;if(!O||O<256)Q[0]=O,T=1;else if(O>=258)if(O<p)for(T=y[O],u=T-1,f=O;u>=0;u--)Q[u]=C[f],f=x[f];else Q[T++]=Q[0];else if(O===256){v=9,p=258,T=0;continue}else{this.eof=!0,delete this.lzwState;break}if(H&&(x[p]=F,y[p]=y[F]+1,C[p]=Q[0],p++,v=p+g&p+g-1?v:Math.min(Math.log(p+g)/.6931471805599453+1,12)|0),F=O,_+=T,n<_){do n+=i;while(n<_);N=this.ensureBuffer(this.bufferLength+n)}for(u=0;u<T;u++)N[S++]=Q[u]}h.nextCode=p,h.codeLength=v,h.prevCode=F,h.currentSequenceLength=T,this.bufferLength=S}},t.prototype.readBits=function(r){for(var n=this.bitsCached,i=this.cachedData;n<r;){var s=this.stream.getByte();if(s===-1)return this.eof=!0,null;i=i<<8|s,n+=8}return this.bitsCached=n-=r,this.cachedData=i,i>>>n&(1<<r)-1},t})(jnt.default);EL.default=Jnt});var w1e=U(bL=>{"use strict";Object.defineProperty(bL,"__esModule",{value:!0});var B1e=(ct(),ze(ut)),Xnt=B1e.__importDefault(Dm()),Knt=(function(e){B1e.__extends(t,e);function t(r,n){var i=e.call(this,n)||this;return i.stream=r,i}return t.prototype.readBlock=function(){var r=this.stream.getBytes(2);if(!r||r.length<2||r[0]===128){this.eof=!0;return}var n,i=this.bufferLength,s=r[0];if(s<128){if(n=this.ensureBuffer(i+s+1),n[i++]=r[1],s>0){var u=this.stream.getBytes(s);n.set(u,i),i+=s}}else{s=257-s;var f=r[1];n=this.ensureBuffer(i+s+1);for(var h=0;h<s;h++)n[i++]=f}this.bufferLength=i},t})(Xnt.default);bL.default=Knt});var FT=U(wT=>{"use strict";Object.defineProperty(wT,"__esModule",{value:!0});wT.decodePDFRawStream=void 0;var Q0=(ct(),ze(ut)),S1e=Nn(),F1e=Q0.__importDefault(Oa()),Q1e=Q0.__importDefault(ls()),Tc=Q0.__importDefault(zr()),znt=Q0.__importDefault(ki()),Znt=Q0.__importDefault(E1e()),$nt=Q0.__importDefault(C1e()),eit=Q0.__importDefault(v1e()),tit=Q0.__importDefault(D1e()),rit=Q0.__importDefault(w1e()),nit=Q0.__importDefault(dL()),T1e=function(e,t,r){if(t===Tc.default.of("FlateDecode"))return new eit.default(e);if(t===Tc.default.of("LZWDecode")){var n=1;if(r instanceof Q1e.default){var i=r.lookup(Tc.default.of("EarlyChange"));i instanceof znt.default&&(n=i.asNumber())}return new tit.default(e,void 0,n)}if(t===Tc.default.of("ASCII85Decode"))return new Znt.default(e);if(t===Tc.default.of("ASCIIHexDecode"))return new $nt.default(e);if(t===Tc.default.of("RunLengthDecode"))return new rit.default(e);throw new S1e.UnsupportedEncodingError(t.asString())};wT.decodePDFRawStream=function(e){var t=e.dict,r=e.contents,n=new nit.default(r),i=t.lookup(Tc.default.of("Filter")),s=t.lookup(Tc.default.of("DecodeParms"));if(i instanceof Tc.default)n=T1e(n,i,s);else if(i instanceof F1e.default)for(var u=0,f=i.size();u<f;u++)n=T1e(n,i.lookup(u,Tc.default),s&&s.lookupMaybe(u,Q1e.default));else if(i)throw new S1e.UnexpectedObjectTypeError([Tc.default,F1e.default],i);return n}});var N1e=U(CL=>{"use strict";Object.defineProperty(CL,"__esModule",{value:!0});var jf=(ct(),ze(ut)),_1e=Nn(),TT=jf.__importDefault(ki()),iit=jf.__importDefault(Em()),ait=jf.__importDefault(Yf()),sit=FT(),oit=jf.__importDefault(uT()),uit=jf.__importDefault(kn()),cit=fr(),fit=function(e){var t=e.MediaBox(),r=t.lookup(2,TT.default).asNumber()-t.lookup(0,TT.default).asNumber(),n=t.lookup(3,TT.default).asNumber()-t.lookup(1,TT.default).asNumber();return{left:0,bottom:0,right:r,top:n}},lit=function(e){return[1,0,0,1,-e.left,-e.bottom]},Ait=(function(){function e(t,r,n){this.page=t;var i=r??fit(t);this.width=i.right-i.left,this.height=i.top-i.bottom,this.boundingBox=i,this.transformationMatrix=n??lit(i)}return e.for=function(t,r,n){return jf.__awaiter(this,void 0,void 0,function(){return jf.__generator(this,function(i){return[2,new e(t,r,n)]})})},e.prototype.embedIntoContext=function(t,r){return jf.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p,C,y;return jf.__generator(this,function(x){if(n=this.page.normalizedEntries(),i=n.Contents,s=n.Resources,!i)throw new _1e.MissingPageContentsEmbeddingError;return u=this.decodeContents(i),f=this.boundingBox,h=f.left,g=f.bottom,p=f.right,C=f.top,y=t.flateStream(u,{Type:"XObject",Subtype:"Form",FormType:1,BBox:[h,g,p,C],Matrix:this.transformationMatrix,Resources:s}),r?(t.assign(r,y),[2,r]):[2,t.register(y)]})})},e.prototype.decodeContents=function(t){for(var r=Uint8Array.of(uit.default.Newline),n=[],i=0,s=t.size();i<s;i++){var u=t.lookup(i,ait.default),f=void 0;if(u instanceof iit.default)f=sit.decodePDFRawStream(u).decode();else if(u instanceof oit.default)f=u.getUnencodedContents();else throw new _1e.UnrecognizedStreamTypeError(u);n.push(f,r)}return cit.mergeIntoTypedArray.apply(void 0,n)},e})();CL.default=Ait});var vL=U(ks=>{"use strict";Object.defineProperty(ks,"__esModule",{value:!0});ks.Duplex=ks.PrintScaling=ks.ReadingDirection=ks.NonFullScreenPageMode=void 0;var kT=(ct(),ze(ut)),dit=kT.__importDefault(Oa()),hit=kT.__importDefault(by()),Bi=kT.__importDefault(zr()),yL=kT.__importDefault(ki()),Kh=fr(),ST=function(e,t){if(e!==void 0)return t[e]},QT;(function(e){e.UseNone="UseNone",e.UseOutlines="UseOutlines",e.UseThumbs="UseThumbs",e.UseOC="UseOC"})(QT=ks.NonFullScreenPageMode||(ks.NonFullScreenPageMode={}));var _T;(function(e){e.L2R="L2R",e.R2L="R2L"})(_T=ks.ReadingDirection||(ks.ReadingDirection={}));var NT;(function(e){e.None="None",e.AppDefault="AppDefault"})(NT=ks.PrintScaling||(ks.PrintScaling={}));var xL;(function(e){e.Simplex="Simplex",e.DuplexFlipShortEdge="DuplexFlipShortEdge",e.DuplexFlipLongEdge="DuplexFlipLongEdge"})(xL=ks.Duplex||(ks.Duplex={}));var git=(function(){function e(t){this.dict=t}return e.prototype.lookupBool=function(t){var r=this.dict.lookup(Bi.default.of(t));if(r instanceof hit.default)return r},e.prototype.lookupName=function(t){var r=this.dict.lookup(Bi.default.of(t));if(r instanceof Bi.default)return r},e.prototype.HideToolbar=function(){return this.lookupBool("HideToolbar")},e.prototype.HideMenubar=function(){return this.lookupBool("HideMenubar")},e.prototype.HideWindowUI=function(){return this.lookupBool("HideWindowUI")},e.prototype.FitWindow=function(){return this.lookupBool("FitWindow")},e.prototype.CenterWindow=function(){return this.lookupBool("CenterWindow")},e.prototype.DisplayDocTitle=function(){return this.lookupBool("DisplayDocTitle")},e.prototype.NonFullScreenPageMode=function(){return this.lookupName("NonFullScreenPageMode")},e.prototype.Direction=function(){return this.lookupName("Direction")},e.prototype.PrintScaling=function(){return this.lookupName("PrintScaling")},e.prototype.Duplex=function(){return this.lookupName("Duplex")},e.prototype.PickTrayByPDFSize=function(){return this.lookupBool("PickTrayByPDFSize")},e.prototype.PrintPageRange=function(){var t=this.dict.lookup(Bi.default.of("PrintPageRange"));if(t instanceof dit.default)return t},e.prototype.NumCopies=function(){var t=this.dict.lookup(Bi.default.of("NumCopies"));if(t instanceof yL.default)return t},e.prototype.getHideToolbar=function(){var t,r;return(r=(t=this.HideToolbar())===null||t===void 0?void 0:t.asBoolean())!==null&&r!==void 0?r:!1},e.prototype.getHideMenubar=function(){var t,r;return(r=(t=this.HideMenubar())===null||t===void 0?void 0:t.asBoolean())!==null&&r!==void 0?r:!1},e.prototype.getHideWindowUI=function(){var t,r;return(r=(t=this.HideWindowUI())===null||t===void 0?void 0:t.asBoolean())!==null&&r!==void 0?r:!1},e.prototype.getFitWindow=function(){var t,r;return(r=(t=this.FitWindow())===null||t===void 0?void 0:t.asBoolean())!==null&&r!==void 0?r:!1},e.prototype.getCenterWindow=function(){var t,r;return(r=(t=this.CenterWindow())===null||t===void 0?void 0:t.asBoolean())!==null&&r!==void 0?r:!1},e.prototype.getDisplayDocTitle=function(){var t,r;return(r=(t=this.DisplayDocTitle())===null||t===void 0?void 0:t.asBoolean())!==null&&r!==void 0?r:!1},e.prototype.getNonFullScreenPageMode=function(){var t,r,n=(t=this.NonFullScreenPageMode())===null||t===void 0?void 0:t.decodeText();return(r=ST(n,QT))!==null&&r!==void 0?r:QT.UseNone},e.prototype.getReadingDirection=function(){var t,r,n=(t=this.Direction())===null||t===void 0?void 0:t.decodeText();return(r=ST(n,_T))!==null&&r!==void 0?r:_T.L2R},e.prototype.getPrintScaling=function(){var t,r,n=(t=this.PrintScaling())===null||t===void 0?void 0:t.decodeText();return(r=ST(n,NT))!==null&&r!==void 0?r:NT.AppDefault},e.prototype.getDuplex=function(){var t,r=(t=this.Duplex())===null||t===void 0?void 0:t.decodeText();return ST(r,xL)},e.prototype.getPickTrayByPDFSize=function(){var t;return(t=this.PickTrayByPDFSize())===null||t===void 0?void 0:t.asBoolean()},e.prototype.getPrintPageRange=function(){var t=this.PrintPageRange();if(!t)return[];for(var r=[],n=0;n<t.size();n+=2){var i=t.lookup(n,yL.default).asNumber(),s=t.lookup(n+1,yL.default).asNumber();r.push({start:i,end:s})}return r},e.prototype.getNumCopies=function(){var t,r;return(r=(t=this.NumCopies())===null||t===void 0?void 0:t.asNumber())!==null&&r!==void 0?r:1},e.prototype.setHideToolbar=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("HideToolbar"),r)},e.prototype.setHideMenubar=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("HideMenubar"),r)},e.prototype.setHideWindowUI=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("HideWindowUI"),r)},e.prototype.setFitWindow=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("FitWindow"),r)},e.prototype.setCenterWindow=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("CenterWindow"),r)},e.prototype.setDisplayDocTitle=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("DisplayDocTitle"),r)},e.prototype.setNonFullScreenPageMode=function(t){Kh.assertIsOneOf(t,"nonFullScreenPageMode",QT);var r=Bi.default.of(t);this.dict.set(Bi.default.of("NonFullScreenPageMode"),r)},e.prototype.setReadingDirection=function(t){Kh.assertIsOneOf(t,"readingDirection",_T);var r=Bi.default.of(t);this.dict.set(Bi.default.of("Direction"),r)},e.prototype.setPrintScaling=function(t){Kh.assertIsOneOf(t,"printScaling",NT);var r=Bi.default.of(t);this.dict.set(Bi.default.of("PrintScaling"),r)},e.prototype.setDuplex=function(t){Kh.assertIsOneOf(t,"duplex",xL);var r=Bi.default.of(t);this.dict.set(Bi.default.of("Duplex"),r)},e.prototype.setPickTrayByPDFSize=function(t){var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("PickTrayByPDFSize"),r)},e.prototype.setPrintPageRange=function(t){Array.isArray(t)||(t=[t]);for(var r=[],n=0,i=t.length;n<i;n++)r.push(t[n].start),r.push(t[n].end);Kh.assertEachIs(r,"printPageRange",["number"]);var s=this.dict.context.obj(r);this.dict.set(Bi.default.of("PrintPageRange"),s)},e.prototype.setNumCopies=function(t){Kh.assertRange(t,"numCopies",1,Number.MAX_VALUE),Kh.assertInteger(t,"numCopies");var r=this.dict.context.obj(t);this.dict.set(Bi.default.of("NumCopies"),r)},e.fromDict=function(t){return new e(t)},e.create=function(t){var r=t.obj({});return new e(r)},e})();ks.default=git});var UT=U(DL=>{"use strict";Object.defineProperty(DL,"__esModule",{value:!0});var zh=(ct(),ze(ut)),pit=zh.__importDefault(ls()),IL=zh.__importDefault(Fc()),RT=zh.__importDefault(co()),lo=zh.__importDefault(zr()),k1e=zh.__importDefault(ki()),mit=zh.__importDefault(Oa()),Eit=zh.__importDefault(Ns()),bit=fr(),R1e=Nn(),Cit=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/,yit=(function(){function e(t,r){this.dict=t,this.ref=r}return e.prototype.T=function(){return this.dict.lookupMaybe(lo.default.of("T"),IL.default,RT.default)},e.prototype.Ff=function(){var t=this.getInheritableAttribute(lo.default.of("Ff"));return this.dict.context.lookupMaybe(t,k1e.default)},e.prototype.V=function(){var t=this.getInheritableAttribute(lo.default.of("V"));return this.dict.context.lookup(t)},e.prototype.Kids=function(){return this.dict.lookupMaybe(lo.default.of("Kids"),mit.default)},e.prototype.DA=function(){var t=this.dict.lookup(lo.default.of("DA"));if(t instanceof IL.default||t instanceof RT.default)return t},e.prototype.setKids=function(t){this.dict.set(lo.default.of("Kids"),this.dict.context.obj(t))},e.prototype.getParent=function(){var t=this.dict.get(lo.default.of("Parent"));if(t instanceof Eit.default){var r=this.dict.lookup(lo.default.of("Parent"),pit.default);return new e(r,t)}},e.prototype.setParent=function(t){t?this.dict.set(lo.default.of("Parent"),t):this.dict.delete(lo.default.of("Parent"))},e.prototype.getFullyQualifiedName=function(){var t=this.getParent();return t?t.getFullyQualifiedName()+"."+this.getPartialName():this.getPartialName()},e.prototype.getPartialName=function(){var t;return(t=this.T())===null||t===void 0?void 0:t.decodeText()},e.prototype.setPartialName=function(t){t?this.dict.set(lo.default.of("T"),RT.default.fromText(t)):this.dict.delete(lo.default.of("T"))},e.prototype.setDefaultAppearance=function(t){this.dict.set(lo.default.of("DA"),IL.default.of(t))},e.prototype.getDefaultAppearance=function(){var t=this.DA();return t instanceof RT.default?t.decodeText():t?.asString()},e.prototype.setFontSize=function(t){var r,n=(r=this.getFullyQualifiedName())!==null&&r!==void 0?r:"",i=this.getDefaultAppearance();if(!i)throw new R1e.MissingDAEntryError(n);var s=bit.findLastMatch(i,Cit);if(!s.match)throw new R1e.MissingTfOperatorError(n);var u=i.slice(0,s.pos-s.match[0].length),f=s.pos<=i.length?i.slice(s.pos):"",h=s.match[1],g=u+" /"+h+" "+t+" Tf "+f;this.setDefaultAppearance(g)},e.prototype.getFlags=function(){var t,r;return(r=(t=this.Ff())===null||t===void 0?void 0:t.asNumber())!==null&&r!==void 0?r:0},e.prototype.setFlags=function(t){this.dict.set(lo.default.of("Ff"),k1e.default.of(t))},e.prototype.hasFlag=function(t){var r=this.getFlags();return(r&t)!==0},e.prototype.setFlag=function(t){var r=this.getFlags();this.setFlags(r|t)},e.prototype.clearFlag=function(t){var r=this.getFlags();this.setFlags(r&~t)},e.prototype.setFlagTo=function(t,r){r?this.setFlag(t):this.clearFlag(t)},e.prototype.getInheritableAttribute=function(t){var r;return this.ascend(function(n){r||(r=n.dict.get(t))}),r},e.prototype.ascend=function(t){t(this);var r=this.getParent();r&&r.ascend(t)},e})();DL.default=yit});var O1e=U(BL=>{"use strict";Object.defineProperty(BL,"__esModule",{value:!0});var M1e=(ct(),ze(ut)),U1e=M1e.__importDefault(zr()),xit=M1e.__importDefault(ki()),vit=(function(){function e(t){this.dict=t}return e.prototype.W=function(){var t=this.dict.lookup(U1e.default.of("W"));if(t instanceof xit.default)return t},e.prototype.getWidth=function(){var t,r;return(r=(t=this.W())===null||t===void 0?void 0:t.asNumber())!==null&&r!==void 0?r:1},e.prototype.setWidth=function(t){var r=this.dict.context.obj(t);this.dict.set(U1e.default.of("W"),r)},e.fromDict=function(t){return new e(t)},e})();BL.default=vit});var TL=U(FL=>{"use strict";Object.defineProperty(FL,"__esModule",{value:!0});var Bm=(ct(),ze(ut)),Fy=Bm.__importDefault(ls()),ra=Bm.__importDefault(zr()),wL=Bm.__importDefault(Yf()),Iit=Bm.__importDefault(Oa()),Dit=Bm.__importDefault(Ns()),L1e=Bm.__importDefault(ki()),Bit=(function(){function e(t){this.dict=t}return e.prototype.Rect=function(){return this.dict.lookup(ra.default.of("Rect"),Iit.default)},e.prototype.AP=function(){return this.dict.lookupMaybe(ra.default.of("AP"),Fy.default)},e.prototype.F=function(){var t=this.dict.lookup(ra.default.of("F"));return this.dict.context.lookupMaybe(t,L1e.default)},e.prototype.getRectangle=function(){var t,r=this.Rect();return(t=r?.asRectangle())!==null&&t!==void 0?t:{x:0,y:0,width:0,height:0}},e.prototype.setRectangle=function(t){var r=t.x,n=t.y,i=t.width,s=t.height,u=this.dict.context.obj([r,n,r+i,n+s]);this.dict.set(ra.default.of("Rect"),u)},e.prototype.getAppearanceState=function(){var t=this.dict.lookup(ra.default.of("AS"));if(t instanceof ra.default)return t},e.prototype.setAppearanceState=function(t){this.dict.set(ra.default.of("AS"),t)},e.prototype.setAppearances=function(t){this.dict.set(ra.default.of("AP"),t)},e.prototype.ensureAP=function(){var t=this.AP();return t||(t=this.dict.context.obj({}),this.dict.set(ra.default.of("AP"),t)),t},e.prototype.getNormalAppearance=function(){var t=this.ensureAP(),r=t.get(ra.default.of("N"));if(r instanceof Dit.default||r instanceof Fy.default)return r;throw new Error("Unexpected N type: "+r?.constructor.name)},e.prototype.setNormalAppearance=function(t){var r=this.ensureAP();r.set(ra.default.of("N"),t)},e.prototype.setRolloverAppearance=function(t){var r=this.ensureAP();r.set(ra.default.of("R"),t)},e.prototype.setDownAppearance=function(t){var r=this.ensureAP();r.set(ra.default.of("D"),t)},e.prototype.removeRolloverAppearance=function(){var t=this.AP();t?.delete(ra.default.of("R"))},e.prototype.removeDownAppearance=function(){var t=this.AP();t?.delete(ra.default.of("D"))},e.prototype.getAppearances=function(){var t=this.AP();if(t){var r=t.lookup(ra.default.of("N"),Fy.default,wL.default),n=t.lookupMaybe(ra.default.of("R"),Fy.default,wL.default),i=t.lookupMaybe(ra.default.of("D"),Fy.default,wL.default);return{normal:r,rollover:n,down:i}}},e.prototype.getFlags=function(){var t,r;return(r=(t=this.F())===null||t===void 0?void 0:t.asNumber())!==null&&r!==void 0?r:0},e.prototype.setFlags=function(t){this.dict.set(ra.default.of("F"),L1e.default.of(t))},e.prototype.hasFlag=function(t){var r=this.getFlags();return(r&t)!==0},e.prototype.setFlag=function(t){var r=this.getFlags();this.setFlags(r|t)},e.prototype.clearFlag=function(t){var r=this.getFlags();this.setFlags(r&~t)},e.prototype.setFlagTo=function(t,r){r?this.setFlag(t):this.clearFlag(t)},e.fromDict=function(t){return new e(t)},e})();FL.default=Bit});var NL=U(_L=>{"use strict";Object.defineProperty(_L,"__esModule",{value:!0});var Ty=(ct(),ze(ut)),Ao=Ty.__importDefault(zr()),SL=Ty.__importDefault(ki()),P1e=Ty.__importDefault(Oa()),wm=Ty.__importDefault(co()),QL=Ty.__importDefault(Fc()),wit=(function(){function e(t){this.dict=t}return e.prototype.R=function(){var t=this.dict.lookup(Ao.default.of("R"));if(t instanceof SL.default)return t},e.prototype.BC=function(){var t=this.dict.lookup(Ao.default.of("BC"));if(t instanceof P1e.default)return t},e.prototype.BG=function(){var t=this.dict.lookup(Ao.default.of("BG"));if(t instanceof P1e.default)return t},e.prototype.CA=function(){var t=this.dict.lookup(Ao.default.of("CA"));if(t instanceof wm.default||t instanceof QL.default)return t},e.prototype.RC=function(){var t=this.dict.lookup(Ao.default.of("RC"));if(t instanceof wm.default||t instanceof QL.default)return t},e.prototype.AC=function(){var t=this.dict.lookup(Ao.default.of("AC"));if(t instanceof wm.default||t instanceof QL.default)return t},e.prototype.getRotation=function(){var t;return(t=this.R())===null||t===void 0?void 0:t.asNumber()},e.prototype.getBorderColor=function(){var t=this.BC();if(t){for(var r=[],n=0,i=t?.size();n<i;n++){var s=t.get(n);s instanceof SL.default&&r.push(s.asNumber())}return r}},e.prototype.getBackgroundColor=function(){var t=this.BG();if(t){for(var r=[],n=0,i=t?.size();n<i;n++){var s=t.get(n);s instanceof SL.default&&r.push(s.asNumber())}return r}},e.prototype.getCaptions=function(){var t=this.CA(),r=this.RC(),n=this.AC();return{normal:t?.decodeText(),rollover:r?.decodeText(),down:n?.decodeText()}},e.prototype.setRotation=function(t){var r=this.dict.context.obj(t);this.dict.set(Ao.default.of("R"),r)},e.prototype.setBorderColor=function(t){var r=this.dict.context.obj(t);this.dict.set(Ao.default.of("BC"),r)},e.prototype.setBackgroundColor=function(t){var r=this.dict.context.obj(t);this.dict.set(Ao.default.of("BG"),r)},e.prototype.setCaptions=function(t){var r=wm.default.fromText(t.normal);if(this.dict.set(Ao.default.of("CA"),r),t.rollover){var n=wm.default.fromText(t.rollover);this.dict.set(Ao.default.of("RC"),n)}else this.dict.delete(Ao.default.of("RC"));if(t.down){var i=wm.default.fromText(t.down);this.dict.set(Ao.default.of("AC"),i)}else this.dict.delete(Ao.default.of("AC"))},e.fromDict=function(t){return new e(t)},e})();_L.default=wit});var OL=U(ML=>{"use strict";Object.defineProperty(ML,"__esModule",{value:!0});var Xf=(ct(),ze(ut)),kL=Xf.__importDefault(ls()),Jf=Xf.__importDefault(zr()),Fit=Xf.__importDefault(Ns()),H1e=Xf.__importDefault(Fc()),q1e=Xf.__importDefault(co()),RL=Xf.__importDefault(O1e()),Tit=Xf.__importDefault(TL()),UL=Xf.__importDefault(NL()),Sit=(function(e){Xf.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.MK=function(){var r=this.dict.lookup(Jf.default.of("MK"));if(r instanceof kL.default)return r},t.prototype.BS=function(){var r=this.dict.lookup(Jf.default.of("BS"));if(r instanceof kL.default)return r},t.prototype.DA=function(){var r=this.dict.lookup(Jf.default.of("DA"));if(r instanceof H1e.default||r instanceof q1e.default)return r},t.prototype.P=function(){var r=this.dict.get(Jf.default.of("P"));if(r instanceof Fit.default)return r},t.prototype.setP=function(r){this.dict.set(Jf.default.of("P"),r)},t.prototype.setDefaultAppearance=function(r){this.dict.set(Jf.default.of("DA"),H1e.default.of(r))},t.prototype.getDefaultAppearance=function(){var r=this.DA();return r instanceof q1e.default?r.decodeText():r?.asString()},t.prototype.getAppearanceCharacteristics=function(){var r=this.MK();if(r)return UL.default.fromDict(r)},t.prototype.getOrCreateAppearanceCharacteristics=function(){var r=this.MK();if(r)return UL.default.fromDict(r);var n=UL.default.fromDict(this.dict.context.obj({}));return this.dict.set(Jf.default.of("MK"),n.dict),n},t.prototype.getBorderStyle=function(){var r=this.BS();if(r)return RL.default.fromDict(r)},t.prototype.getOrCreateBorderStyle=function(){var r=this.BS();if(r)return RL.default.fromDict(r);var n=RL.default.fromDict(this.dict.context.obj({}));return this.dict.set(Jf.default.of("BS"),n.dict),n},t.prototype.getOnValue=function(){var r,n=(r=this.getAppearances())===null||r===void 0?void 0:r.normal;if(n instanceof kL.default)for(var i=n.keys(),s=0,u=i.length;s<u;s++){var f=i[s];if(f!==Jf.default.of("Off"))return f}},t.fromDict=function(r){return new t(r)},t.create=function(r,n){var i=r.obj({Type:"Annot",Subtype:"Widget",Rect:[0,0,0,0],Parent:n});return new t(i)},t})(Tit.default);ML.default=Sit});var Zh=U(PL=>{"use strict";Object.defineProperty(PL,"__esModule",{value:!0});var Sy=(ct(),ze(ut)),Qit=Sy.__importDefault(ls()),LL=Sy.__importDefault(zr()),_it=Sy.__importDefault(UT()),W1e=Sy.__importDefault(OL()),G1e=Nn(),Nit=(function(e){Sy.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.FT=function(){var r=this.getInheritableAttribute(LL.default.of("FT"));return this.dict.context.lookup(r,LL.default)},t.prototype.getWidgets=function(){var r=this.Kids();if(!r)return[W1e.default.fromDict(this.dict)];for(var n=new Array(r.size()),i=0,s=r.size();i<s;i++){var u=r.lookup(i,Qit.default);n[i]=W1e.default.fromDict(u)}return n},t.prototype.addWidget=function(r){var n=this.normalizedEntries().Kids;n.push(r)},t.prototype.removeWidget=function(r){var n=this.Kids();if(n){if(r<0||r>n.size())throw new G1e.IndexOutOfBoundsError(r,0,n.size());n.remove(r)}else{if(r!==0)throw new G1e.IndexOutOfBoundsError(r,0,0);this.setKids([])}},t.prototype.normalizedEntries=function(){var r=this.Kids();return r||(r=this.dict.context.obj([this.ref]),this.dict.set(LL.default.of("Kids"),r)),{Kids:r}},t.fromDict=function(r,n){return new t(r,n)},t})(_it.default);PL.default=Nit});var _y=U(qL=>{"use strict";Object.defineProperty(qL,"__esModule",{value:!0});var Fm=(ct(),ze(ut)),MT=Fm.__importDefault(Fc()),Qy=Fm.__importDefault(co()),kit=Fm.__importDefault(Oa()),HL=Fm.__importDefault(zr()),Rit=Fm.__importDefault(Zh()),V1e=Nn(),Uit=(function(e){Fm.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.Opt=function(){return this.dict.lookupMaybe(HL.default.of("Opt"),MT.default,Qy.default,kit.default)},t.prototype.setOpt=function(r){this.dict.set(HL.default.of("Opt"),this.dict.context.obj(r))},t.prototype.getExportValues=function(){var r=this.Opt();if(r){if(r instanceof MT.default||r instanceof Qy.default)return[r];for(var n=[],i=0,s=r.size();i<s;i++){var u=r.lookup(i);(u instanceof MT.default||u instanceof Qy.default)&&n.push(u)}return n}},t.prototype.removeExportValue=function(r){var n=this.Opt();if(n)if(n instanceof MT.default||n instanceof Qy.default){if(r!==0)throw new V1e.IndexOutOfBoundsError(r,0,0);this.setOpt([])}else{if(r<0||r>n.size())throw new V1e.IndexOutOfBoundsError(r,0,n.size());n.remove(r)}},t.prototype.normalizeExportValues=function(){for(var r,n,i,s,u=(r=this.getExportValues())!==null&&r!==void 0?r:[],f=[],h=this.getWidgets(),g=0,p=h.length;g<p;g++){var C=h[g],y=(n=u[g])!==null&&n!==void 0?n:Qy.default.fromText((s=(i=C.getOnValue())===null||i===void 0?void 0:i.decodeText())!==null&&s!==void 0?s:"");f.push(y)}this.setOpt(f)},t.prototype.addOpt=function(r,n){var i;this.normalizeExportValues();var s=r.decodeText(),u;if(n)for(var f=(i=this.getExportValues())!==null&&i!==void 0?i:[],h=0,g=f.length;h<g;h++){var p=f[h];p.decodeText()===s&&(u=h)}var C=this.Opt();return C.push(r),u??C.size()-1},t.prototype.addWidgetWithOpt=function(r,n,i){var s=this.addOpt(n,i),u=HL.default.of(String(s));return this.addWidget(r),u},t})(Rit.default);qL.default=Uit});var VL=U(GL=>{"use strict";Object.defineProperty(GL,"__esModule",{value:!0});var WL=(ct(),ze(ut)),Tm=WL.__importDefault(zr()),Mit=WL.__importDefault(_y()),Oit=Nn(),Lit=(function(e){WL.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setValue=function(r){var n,i=(n=this.getOnValue())!==null&&n!==void 0?n:Tm.default.of("Yes");if(r!==i&&r!==Tm.default.of("Off"))throw new Oit.InvalidAcroFieldValueError;this.dict.set(Tm.default.of("V"),r);for(var s=this.getWidgets(),u=0,f=s.length;u<f;u++){var h=s[u],g=h.getOnValue()===r?r:Tm.default.of("Off");h.setAppearanceState(g)}},t.prototype.getValue=function(){var r=this.V();return r instanceof Tm.default?r:Tm.default.of("Off")},t.prototype.getOnValue=function(){var r=this.getWidgets()[0];return r?.getOnValue()},t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({FT:"Btn",Kids:[]}),i=r.register(n);return new t(n,i)},t})(Mit.default);GL.default=Lit});var $h=U(ho=>{"use strict";Object.defineProperty(ho,"__esModule",{value:!0});ho.AcroChoiceFlags=ho.AcroTextFlags=ho.AcroButtonFlags=ho.AcroFieldFlags=void 0;var Ji=function(e){return 1<<e},Pit;(function(e){e[e.ReadOnly=Ji(0)]="ReadOnly",e[e.Required=Ji(1)]="Required",e[e.NoExport=Ji(2)]="NoExport"})(Pit=ho.AcroFieldFlags||(ho.AcroFieldFlags={}));var Hit;(function(e){e[e.NoToggleToOff=Ji(14)]="NoToggleToOff",e[e.Radio=Ji(15)]="Radio",e[e.PushButton=Ji(16)]="PushButton",e[e.RadiosInUnison=Ji(25)]="RadiosInUnison"})(Hit=ho.AcroButtonFlags||(ho.AcroButtonFlags={}));var qit;(function(e){e[e.Multiline=Ji(12)]="Multiline",e[e.Password=Ji(13)]="Password",e[e.FileSelect=Ji(20)]="FileSelect",e[e.DoNotSpellCheck=Ji(22)]="DoNotSpellCheck",e[e.DoNotScroll=Ji(23)]="DoNotScroll",e[e.Comb=Ji(24)]="Comb",e[e.RichText=Ji(25)]="RichText"})(qit=ho.AcroTextFlags||(ho.AcroTextFlags={}));var Wit;(function(e){e[e.Combo=Ji(17)]="Combo",e[e.Edit=Ji(18)]="Edit",e[e.Sort=Ji(19)]="Sort",e[e.MultiSelect=Ji(21)]="MultiSelect",e[e.DoNotSpellCheck=Ji(22)]="DoNotSpellCheck",e[e.CommitOnSelChange=Ji(26)]="CommitOnSelChange"})(Wit=ho.AcroChoiceFlags||(ho.AcroChoiceFlags={}))});var LT=U(jL=>{"use strict";Object.defineProperty(jL,"__esModule",{value:!0});var Sm=(ct(),ze(ut)),Git=Sm.__importDefault(Zh()),eg=Sm.__importDefault(co()),tg=Sm.__importDefault(Fc()),OT=Sm.__importDefault(Oa()),rg=Sm.__importDefault(zr()),YL=$h(),Y1e=Nn(),Vit=(function(e){Sm.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setValues=function(r){if(this.hasFlag(YL.AcroChoiceFlags.Combo)&&!this.hasFlag(YL.AcroChoiceFlags.Edit)&&!this.valuesAreValid(r))throw new Y1e.InvalidAcroFieldValueError;if(r.length===0&&this.dict.delete(rg.default.of("V")),r.length===1&&this.dict.set(rg.default.of("V"),r[0]),r.length>1){if(!this.hasFlag(YL.AcroChoiceFlags.MultiSelect))throw new Y1e.MultiSelectValueError;this.dict.set(rg.default.of("V"),this.dict.context.obj(r))}this.updateSelectedIndices(r)},t.prototype.valuesAreValid=function(r){for(var n=this.getOptions(),i=function(h,g){var p=r[h].decodeText();if(!n.find(function(C){return p===(C.display||C.value).decodeText()}))return{value:!1}},s=0,u=r.length;s<u;s++){var f=i(s,u);if(typeof f=="object")return f.value}return!0},t.prototype.updateSelectedIndices=function(r){if(r.length>1){for(var n=new Array(r.length),i=this.getOptions(),s=function(h,g){var p=r[h].decodeText();n[h]=i.findIndex(function(C){return p===(C.display||C.value).decodeText()})},u=0,f=r.length;u<f;u++)s(u,f);this.dict.set(rg.default.of("I"),this.dict.context.obj(n.sort()))}else this.dict.delete(rg.default.of("I"))},t.prototype.getValues=function(){var r=this.V();if(r instanceof tg.default||r instanceof eg.default)return[r];if(r instanceof OT.default){for(var n=[],i=0,s=r.size();i<s;i++){var u=r.lookup(i);(u instanceof tg.default||u instanceof eg.default)&&n.push(u)}return n}return[]},t.prototype.Opt=function(){return this.dict.lookupMaybe(rg.default.of("Opt"),tg.default,eg.default,OT.default)},t.prototype.setOptions=function(r){for(var n=new Array(r.length),i=0,s=r.length;i<s;i++){var u=r[i],f=u.value,h=u.display;n[i]=this.dict.context.obj([f,h||f])}this.dict.set(rg.default.of("Opt"),this.dict.context.obj(n))},t.prototype.getOptions=function(){var r=this.Opt();if(r instanceof tg.default||r instanceof eg.default)return[{value:r,display:r}];if(r instanceof OT.default){for(var n=[],i=0,s=r.size();i<s;i++){var u=r.lookup(i);if((u instanceof tg.default||u instanceof eg.default)&&n.push({value:u,display:u}),u instanceof OT.default&&u.size()>0){var f=u.lookup(0,tg.default,eg.default),h=u.lookupMaybe(1,tg.default,eg.default);n.push({value:f,display:h||f})}}return n}return[]},t})(Git.default);jL.default=Vit});var XL=U(JL=>{"use strict";Object.defineProperty(JL,"__esModule",{value:!0});var j1e=(ct(),ze(ut)),Yit=j1e.__importDefault(LT()),jit=$h(),Jit=(function(e){j1e.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({FT:"Ch",Ff:jit.AcroChoiceFlags.Combo,Kids:[]}),i=r.register(n);return new t(n,i)},t})(Yit.default);JL.default=Jit});var PT=U(zL=>{"use strict";Object.defineProperty(zL,"__esModule",{value:!0});var KL=(ct(),ze(ut)),Xit=KL.__importDefault(zr()),Kit=KL.__importDefault(UT()),zit=(function(e){KL.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.addField=function(r){var n=this.normalizedEntries().Kids;n?.push(r)},t.prototype.normalizedEntries=function(){var r=this.Kids();return r||(r=this.dict.context.obj([]),this.dict.set(Xit.default.of("Kids"),r)),{Kids:r}},t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({}),i=r.register(n);return new t(n,i)},t})(Kit.default);zL.default=zit});var $L=U(ZL=>{"use strict";Object.defineProperty(ZL,"__esModule",{value:!0});var J1e=(ct(),ze(ut)),Zit=J1e.__importDefault(Zh()),$it=(function(e){J1e.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(r,n){return new t(r,n)},t})(Zit.default);ZL.default=$it});var t7=U(e7=>{"use strict";Object.defineProperty(e7,"__esModule",{value:!0});var Qm=(ct(),ze(ut)),HT=Qm.__importDefault(ki()),eat=Qm.__importDefault(Fc()),tat=Qm.__importDefault(co()),ng=Qm.__importDefault(zr()),rat=Qm.__importDefault(Zh()),nat=(function(e){Qm.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.MaxLen=function(){var r=this.dict.lookup(ng.default.of("MaxLen"));if(r instanceof HT.default)return r},t.prototype.Q=function(){var r=this.dict.lookup(ng.default.of("Q"));if(r instanceof HT.default)return r},t.prototype.setMaxLength=function(r){this.dict.set(ng.default.of("MaxLen"),HT.default.of(r))},t.prototype.removeMaxLength=function(){this.dict.delete(ng.default.of("MaxLen"))},t.prototype.getMaxLength=function(){var r;return(r=this.MaxLen())===null||r===void 0?void 0:r.asNumber()},t.prototype.setQuadding=function(r){this.dict.set(ng.default.of("Q"),HT.default.of(r))},t.prototype.getQuadding=function(){var r;return(r=this.Q())===null||r===void 0?void 0:r.asNumber()},t.prototype.setValue=function(r){this.dict.set(ng.default.of("V"),r)},t.prototype.removeValue=function(){this.dict.delete(ng.default.of("V"))},t.prototype.getValue=function(){var r=this.V();if(r instanceof eat.default||r instanceof tat.default)return r},t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({FT:"Tx",Kids:[]}),i=r.register(n);return new t(n,i)},t})(rat.default);e7.default=nat});var n7=U(r7=>{"use strict";Object.defineProperty(r7,"__esModule",{value:!0});var X1e=(ct(),ze(ut)),iat=X1e.__importDefault(_y()),aat=$h(),sat=(function(e){X1e.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({FT:"Btn",Ff:aat.AcroButtonFlags.PushButton,Kids:[]}),i=r.register(n);return new t(n,i)},t})(iat.default);r7.default=sat});var s7=U(a7=>{"use strict";Object.defineProperty(a7,"__esModule",{value:!0});var i7=(ct(),ze(ut)),Ny=i7.__importDefault(zr()),oat=i7.__importDefault(_y()),uat=$h(),cat=Nn(),fat=(function(e){i7.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setValue=function(r){var n=this.getOnValues();if(!n.includes(r)&&r!==Ny.default.of("Off"))throw new cat.InvalidAcroFieldValueError;this.dict.set(Ny.default.of("V"),r);for(var i=this.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s],h=f.getOnValue()===r?r:Ny.default.of("Off");f.setAppearanceState(h)}},t.prototype.getValue=function(){var r=this.V();return r instanceof Ny.default?r:Ny.default.of("Off")},t.prototype.getOnValues=function(){for(var r=this.getWidgets(),n=[],i=0,s=r.length;i<s;i++){var u=r[i].getOnValue();u&&n.push(u)}return n},t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({FT:"Btn",Ff:uat.AcroButtonFlags.Radio,Kids:[]}),i=r.register(n);return new t(n,i)},t})(oat.default);a7.default=fat});var u7=U(o7=>{"use strict";Object.defineProperty(o7,"__esModule",{value:!0});var K1e=(ct(),ze(ut)),lat=K1e.__importDefault(LT()),Aat=(function(e){K1e.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(r,n){return new t(r,n)},t.create=function(r){var n=r.obj({FT:"Ch",Kids:[]}),i=r.register(n);return new t(n,i)},t})(lat.default);o7.default=Aat});var d7=U(ig=>{"use strict";Object.defineProperty(ig,"__esModule",{value:!0});ig.createPDFAcroField=ig.createPDFAcroFields=void 0;var go=(ct(),ze(ut)),z1e=go.__importDefault(ki()),l7=go.__importDefault(ls()),Sc=go.__importDefault(zr()),dat=go.__importDefault(Oa()),hat=go.__importDefault(Ns()),gat=go.__importDefault(Zh()),pat=go.__importDefault(PT()),mat=go.__importDefault($L()),Eat=go.__importDefault(t7()),bat=go.__importDefault(n7()),Cat=go.__importDefault(s7()),yat=go.__importDefault(VL()),xat=go.__importDefault(XL()),vat=go.__importDefault(u7()),c7=$h();ig.createPDFAcroFields=function(e){if(!e)return[];for(var t=[],r=0,n=e.size();r<n;r++){var i=e.get(r),s=e.lookup(r);i instanceof hat.default&&s instanceof l7.default&&t.push([ig.createPDFAcroField(s,i),i])}return t};ig.createPDFAcroField=function(e,t){var r=Iat(e);return r?pat.default.fromDict(e,t):Dat(e,t)};var Iat=function(e){var t=e.lookup(Sc.default.of("Kids"));if(t instanceof dat.default)for(var r=0,n=t.size();r<n;r++){var i=t.lookup(r),s=i instanceof l7.default&&i.has(Sc.default.of("T"));if(s)return!0}return!1},Dat=function(e,t){var r=A7(e,Sc.default.of("FT")),n=e.context.lookup(r,Sc.default);return n===Sc.default.of("Btn")?Bat(e,t):n===Sc.default.of("Ch")?wat(e,t):n===Sc.default.of("Tx")?Eat.default.fromDict(e,t):n===Sc.default.of("Sig")?mat.default.fromDict(e,t):gat.default.fromDict(e,t)},Bat=function(e,t){var r,n=A7(e,Sc.default.of("Ff")),i=e.context.lookupMaybe(n,z1e.default),s=(r=i?.asNumber())!==null&&r!==void 0?r:0;return f7(s,c7.AcroButtonFlags.PushButton)?bat.default.fromDict(e,t):f7(s,c7.AcroButtonFlags.Radio)?Cat.default.fromDict(e,t):yat.default.fromDict(e,t)},wat=function(e,t){var r,n=A7(e,Sc.default.of("Ff")),i=e.context.lookupMaybe(n,z1e.default),s=(r=i?.asNumber())!==null&&r!==void 0?r:0;return f7(s,c7.AcroChoiceFlags.Combo)?xat.default.fromDict(e,t):vat.default.fromDict(e,t)},f7=function(e,t){return(e&t)!==0},A7=function(e,t){var r;return Z1e(e,function(n){r||(r=n.get(t))}),r},Z1e=function(e,t){t(e);var r=e.lookupMaybe(Sc.default.of("Parent"),l7.default);r&&Z1e(r,t)}});var tpe=U(h7=>{"use strict";Object.defineProperty(h7,"__esModule",{value:!0});var qT=(ct(),ze(ut)),Fat=qT.__importDefault(ls()),Tat=qT.__importDefault(Oa()),$1e=qT.__importDefault(zr()),Sat=qT.__importDefault(PT()),epe=d7(),Qat=(function(){function e(t){this.dict=t}return e.prototype.Fields=function(){var t=this.dict.lookup($1e.default.of("Fields"));if(t instanceof Tat.default)return t},e.prototype.getFields=function(){for(var t=this.normalizedEntries().Fields,r=new Array(t.size()),n=0,i=t.size();n<i;n++){var s=t.get(n),u=t.lookup(n,Fat.default);r[n]=[epe.createPDFAcroField(u,s),s]}return r},e.prototype.getAllFields=function(){var t=[],r=function(n){if(n)for(var i=0,s=n.length;i<s;i++){var u=n[i];t.push(u);var f=u[0];f instanceof Sat.default&&r(epe.createPDFAcroFields(f.Kids()))}};return r(this.getFields()),t},e.prototype.addField=function(t){var r=this.normalizedEntries().Fields;r?.push(t)},e.prototype.removeField=function(t){var r=t.getParent(),n=r===void 0?this.normalizedEntries().Fields:r.Kids(),i=n?.indexOf(t.ref);if(n===void 0||i===void 0)throw new Error("Tried to remove inexistent field "+t.getFullyQualifiedName());n.remove(i),r!==void 0&&n.size()===0&&this.removeField(r)},e.prototype.normalizedEntries=function(){var t=this.Fields();return t||(t=this.dict.context.obj([]),this.dict.set($1e.default.of("Fields"),t)),{Fields:t}},e.fromDict=function(t){return new e(t)},e.create=function(t){var r=t.obj({Fields:[]});return new e(r)},e})();h7.default=Qat});var g7=U(La=>{"use strict";Object.defineProperty(La,"__esModule",{value:!0});var rpe=(ct(),ze(ut)),_at=_y();Object.defineProperty(La,"PDFAcroButton",{enumerable:!0,get:function(){return _at.default}});var Nat=VL();Object.defineProperty(La,"PDFAcroCheckBox",{enumerable:!0,get:function(){return Nat.default}});var kat=LT();Object.defineProperty(La,"PDFAcroChoice",{enumerable:!0,get:function(){return kat.default}});var Rat=XL();Object.defineProperty(La,"PDFAcroComboBox",{enumerable:!0,get:function(){return Rat.default}});var Uat=UT();Object.defineProperty(La,"PDFAcroField",{enumerable:!0,get:function(){return Uat.default}});var Mat=tpe();Object.defineProperty(La,"PDFAcroForm",{enumerable:!0,get:function(){return Mat.default}});var Oat=u7();Object.defineProperty(La,"PDFAcroListBox",{enumerable:!0,get:function(){return Oat.default}});var Lat=PT();Object.defineProperty(La,"PDFAcroNonTerminal",{enumerable:!0,get:function(){return Lat.default}});var Pat=n7();Object.defineProperty(La,"PDFAcroPushButton",{enumerable:!0,get:function(){return Pat.default}});var Hat=s7();Object.defineProperty(La,"PDFAcroRadioButton",{enumerable:!0,get:function(){return Hat.default}});var qat=$L();Object.defineProperty(La,"PDFAcroSignature",{enumerable:!0,get:function(){return qat.default}});var Wat=Zh();Object.defineProperty(La,"PDFAcroTerminal",{enumerable:!0,get:function(){return Wat.default}});var Gat=t7();Object.defineProperty(La,"PDFAcroText",{enumerable:!0,get:function(){return Gat.default}});rpe.__exportStar($h(),La);rpe.__exportStar(d7(),La)});var m7=U(p7=>{"use strict";Object.defineProperty(p7,"__esModule",{value:!0});var GT=(ct(),ze(ut)),WT=GT.__importDefault(ls()),Kf=GT.__importDefault(zr()),npe=g7(),ipe=GT.__importDefault(vL()),Vat=(function(e){GT.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.Pages=function(){return this.lookup(Kf.default.of("Pages"),WT.default)},t.prototype.AcroForm=function(){return this.lookupMaybe(Kf.default.of("AcroForm"),WT.default)},t.prototype.getAcroForm=function(){var r=this.AcroForm();if(r)return npe.PDFAcroForm.fromDict(r)},t.prototype.getOrCreateAcroForm=function(){var r=this.getAcroForm();if(!r){r=npe.PDFAcroForm.create(this.context);var n=this.context.register(r.dict);this.set(Kf.default.of("AcroForm"),n)}return r},t.prototype.ViewerPreferences=function(){return this.lookupMaybe(Kf.default.of("ViewerPreferences"),WT.default)},t.prototype.getViewerPreferences=function(){var r=this.ViewerPreferences();if(r)return ipe.default.fromDict(r)},t.prototype.getOrCreateViewerPreferences=function(){var r=this.getViewerPreferences();if(!r){r=ipe.default.create(this.context);var n=this.context.register(r.dict);this.set(Kf.default.of("ViewerPreferences"),n)}return r},t.prototype.insertLeafNode=function(r,n){var i=this.get(Kf.default.of("Pages")),s=this.Pages().insertLeafNode(r,n);return s||i},t.prototype.removeLeafNode=function(r){this.Pages().removeLeafNode(r)},t.withContextAndPages=function(r,n){var i=new Map;return i.set(Kf.default.of("Type"),Kf.default.of("Catalog")),i.set(Kf.default.of("Pages"),n),new t(i,r)},t.fromMapWithContext=function(r,n){return new t(r,n)},t})(WT.default);p7.default=Vat});var y7=U(C7=>{"use strict";Object.defineProperty(C7,"__esModule",{value:!0});var _m=(ct(),ze(ut)),Yat=_m.__importDefault(Oa()),jat=_m.__importDefault(ls()),_0=_m.__importDefault(zr()),E7=_m.__importDefault(ki()),b7=_m.__importDefault(Iy()),VT=Nn(),Jat=(function(e){_m.__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.Parent=function(){return this.lookup(_0.default.of("Parent"))},t.prototype.Kids=function(){return this.lookup(_0.default.of("Kids"),Yat.default)},t.prototype.Count=function(){return this.lookup(_0.default.of("Count"),E7.default)},t.prototype.pushTreeNode=function(r){var n=this.Kids();n.push(r)},t.prototype.pushLeafNode=function(r){var n=this.Kids();this.insertLeafKid(n.size(),r)},t.prototype.insertLeafNode=function(r,n){var i=this.Kids(),s=this.Count().asNumber();if(n>s)throw new VT.InvalidTargetIndexError(n,s);for(var u=n,f=0,h=i.size();f<h;f++){if(u===0){this.insertLeafKid(f,r);return}var g=i.get(f),p=this.context.lookup(g);if(p instanceof t){if(p.Count().asNumber()>u)return p.insertLeafNode(r,u)||g;u-=p.Count().asNumber()}p instanceof b7.default&&(u-=1)}if(u===0){this.insertLeafKid(i.size(),r);return}throw new VT.CorruptPageTreeError(n,"insertLeafNode")},t.prototype.removeLeafNode=function(r,n){n===void 0&&(n=!0);var i=this.Kids(),s=this.Count().asNumber();if(r>=s)throw new VT.InvalidTargetIndexError(r,s);for(var u=r,f=0,h=i.size();f<h;f++){var g=i.get(f),p=this.context.lookup(g);if(p instanceof t)if(p.Count().asNumber()>u){p.removeLeafNode(u,n),n&&p.Kids().size()===0&&i.remove(f);return}else u-=p.Count().asNumber();if(p instanceof b7.default)if(u===0){this.removeKid(f);return}else u-=1}throw new VT.CorruptPageTreeError(r,"removeLeafNode")},t.prototype.ascend=function(r){r(this);var n=this.Parent();n&&n.ascend(r)},t.prototype.traverse=function(r){for(var n=this.Kids(),i=0,s=n.size();i<s;i++){var u=n.get(i),f=this.context.lookup(u);f instanceof t&&f.traverse(r),r(f,u)}},t.prototype.insertLeafKid=function(r,n){var i=this.Kids();this.ascend(function(s){var u=s.Count().asNumber()+1;s.set(_0.default.of("Count"),E7.default.of(u))}),i.insert(r,n)},t.prototype.removeKid=function(r){var n=this.Kids(),i=n.lookup(r);i instanceof b7.default&&this.ascend(function(s){var u=s.Count().asNumber()-1;s.set(_0.default.of("Count"),E7.default.of(u))}),n.remove(r)},t.withContext=function(r,n){var i=new Map;return i.set(_0.default.of("Type"),_0.default.of("Pages")),i.set(_0.default.of("Kids"),r.obj([])),i.set(_0.default.of("Count"),r.obj(0)),n&&i.set(_0.default.of("Parent"),n),new t(i,r)},t.fromMapWithContext=function(r,n){return new t(r,n)},t})(jat.default);C7.default=Jat});var YT=U(ii=>{"use strict";Object.defineProperty(ii,"__esModule",{value:!0});ii.IsNumeric=ii.IsNumericPrefix=ii.IsDigit=void 0;var Xat=(ct(),ze(ut)),Ko=Xat.__importDefault(kn());ii.IsDigit=new Uint8Array(256);ii.IsDigit[Ko.default.Zero]=1;ii.IsDigit[Ko.default.One]=1;ii.IsDigit[Ko.default.Two]=1;ii.IsDigit[Ko.default.Three]=1;ii.IsDigit[Ko.default.Four]=1;ii.IsDigit[Ko.default.Five]=1;ii.IsDigit[Ko.default.Six]=1;ii.IsDigit[Ko.default.Seven]=1;ii.IsDigit[Ko.default.Eight]=1;ii.IsDigit[Ko.default.Nine]=1;ii.IsNumericPrefix=new Uint8Array(256);ii.IsNumericPrefix[Ko.default.Period]=1;ii.IsNumericPrefix[Ko.default.Plus]=1;ii.IsNumericPrefix[Ko.default.Minus]=1;ii.IsNumeric=new Uint8Array(256);for(Nm=0,ape=256;Nm<ape;Nm++)ii.IsNumeric[Nm]=ii.IsDigit[Nm]||ii.IsNumericPrefix[Nm]?1:0;var Nm,ape});var cpe=U(I7=>{"use strict";Object.defineProperty(I7,"__esModule",{value:!0});var Kat=(ct(),ze(ut)),spe=Nn(),jT=Kat.__importDefault(kn()),x7=YT(),zat=iT(),v7=fr(),ope=jT.default.Newline,upe=jT.default.CarriageReturn,Zat=(function(){function e(t,r){r===void 0&&(r=!1),this.bytes=t,this.capNumbers=r}return e.prototype.parseRawInt=function(){for(var t="";!this.bytes.done();){var r=this.bytes.peek();if(!x7.IsDigit[r])break;t+=v7.charFromCode(this.bytes.next())}var n=Number(t);if(!t||!isFinite(n))throw new spe.NumberParsingError(this.bytes.position(),t);return n},e.prototype.parseRawNumber=function(){for(var t="";!this.bytes.done();){var r=this.bytes.peek();if(!x7.IsNumeric[r]||(t+=v7.charFromCode(this.bytes.next()),r===jT.default.Period))break}for(;!this.bytes.done();){var r=this.bytes.peek();if(!x7.IsDigit[r])break;t+=v7.charFromCode(this.bytes.next())}var n=Number(t);if(!t||!isFinite(n))throw new spe.NumberParsingError(this.bytes.position(),t);if(n>Number.MAX_SAFE_INTEGER)if(this.capNumbers){var i="Parsed number that is too large for some PDF readers: "+t+", using Number.MAX_SAFE_INTEGER instead.";return console.warn(i),Number.MAX_SAFE_INTEGER}else{var i="Parsed number that is too large for some PDF readers: "+t+", not capping.";console.warn(i)}return n},e.prototype.skipWhitespace=function(){for(;!this.bytes.done()&&zat.IsWhitespace[this.bytes.peek()];)this.bytes.next()},e.prototype.skipLine=function(){for(;!this.bytes.done();){var t=this.bytes.peek();if(t===ope||t===upe)return;this.bytes.next()}},e.prototype.skipComment=function(){if(this.bytes.peek()!==jT.default.Percent)return!1;for(;!this.bytes.done();){var t=this.bytes.peek();if(t===ope||t===upe)return!0;this.bytes.next()}return!0},e.prototype.skipWhitespaceAndComments=function(){for(this.skipWhitespace();this.skipComment();)this.skipWhitespace()},e.prototype.matchKeyword=function(t){for(var r=this.bytes.offset(),n=0,i=t.length;n<i;n++)if(this.bytes.done()||this.bytes.next()!==t[n])return this.bytes.moveTo(r),!1;return!0},e})();I7.default=Zat});var ky=U(D7=>{"use strict";Object.defineProperty(D7,"__esModule",{value:!0});var $at=(ct(),ze(ut)),est=Nn(),tst=FT(),rst=$at.__importDefault(kn()),nst=(function(){function e(t){this.idx=0,this.line=0,this.column=0,this.bytes=t,this.length=this.bytes.length}return e.prototype.moveTo=function(t){this.idx=t},e.prototype.next=function(){var t=this.bytes[this.idx++];return t===rst.default.Newline?(this.line+=1,this.column=0):this.column+=1,t},e.prototype.assertNext=function(t){if(this.peek()!==t)throw new est.NextByteAssertionError(this.position(),t,this.peek());return this.next()},e.prototype.peek=function(){return this.bytes[this.idx]},e.prototype.peekAhead=function(t){return this.bytes[this.idx+t]},e.prototype.peekAt=function(t){return this.bytes[t]},e.prototype.done=function(){return this.idx>=this.length},e.prototype.offset=function(){return this.idx},e.prototype.slice=function(t,r){return this.bytes.slice(t,r)},e.prototype.position=function(){return{line:this.line,column:this.column,offset:this.idx}},e.of=function(t){return new e(t)},e.fromPDFRawStream=function(t){return e.of(tst.decodePDFRawStream(t).decode())},e})();D7.default=nst});var B7=U(XT=>{"use strict";Object.defineProperty(XT,"__esModule",{value:!0});XT.Keywords=void 0;var FA=(ct(),ze(ut)),Mt=FA.__importDefault(kn()),ist=Mt.default.Space,Ry=Mt.default.CarriageReturn,Uy=Mt.default.Newline,My=[Mt.default.s,Mt.default.t,Mt.default.r,Mt.default.e,Mt.default.a,Mt.default.m],JT=[Mt.default.e,Mt.default.n,Mt.default.d,Mt.default.s,Mt.default.t,Mt.default.r,Mt.default.e,Mt.default.a,Mt.default.m];XT.Keywords={header:[Mt.default.Percent,Mt.default.P,Mt.default.D,Mt.default.F,Mt.default.Dash],eof:[Mt.default.Percent,Mt.default.Percent,Mt.default.E,Mt.default.O,Mt.default.F],obj:[Mt.default.o,Mt.default.b,Mt.default.j],endobj:[Mt.default.e,Mt.default.n,Mt.default.d,Mt.default.o,Mt.default.b,Mt.default.j],xref:[Mt.default.x,Mt.default.r,Mt.default.e,Mt.default.f],trailer:[Mt.default.t,Mt.default.r,Mt.default.a,Mt.default.i,Mt.default.l,Mt.default.e,Mt.default.r],startxref:[Mt.default.s,Mt.default.t,Mt.default.a,Mt.default.r,Mt.default.t,Mt.default.x,Mt.default.r,Mt.default.e,Mt.default.f],true:[Mt.default.t,Mt.default.r,Mt.default.u,Mt.default.e],false:[Mt.default.f,Mt.default.a,Mt.default.l,Mt.default.s,Mt.default.e],null:[Mt.default.n,Mt.default.u,Mt.default.l,Mt.default.l],stream:My,streamEOF1:FA.__spreadArrays(My,[ist,Ry,Uy]),streamEOF2:FA.__spreadArrays(My,[Ry,Uy]),streamEOF3:FA.__spreadArrays(My,[Ry]),streamEOF4:FA.__spreadArrays(My,[Uy]),endstream:JT,EOF1endstream:FA.__spreadArrays([Ry,Uy],JT),EOF2endstream:FA.__spreadArrays([Ry],JT),EOF3endstream:FA.__spreadArrays([Uy],JT)}});var KT=U(T7=>{"use strict";Object.defineProperty(T7,"__esModule",{value:!0});var Pa=(ct(),ze(ut)),w7=Nn(),ast=Pa.__importDefault(Oa()),fpe=Pa.__importDefault(by()),sst=Pa.__importDefault(ls()),ost=Pa.__importDefault(co()),km=Pa.__importDefault(zr()),ust=Pa.__importDefault(yy()),lpe=Pa.__importDefault(ki()),cst=Pa.__importDefault(Em()),fst=Pa.__importDefault(Ns()),lst=Pa.__importDefault(Fc()),Ast=Pa.__importDefault(cpe()),dst=Pa.__importDefault(ky()),hst=Pa.__importDefault(m7()),gst=Pa.__importDefault(Iy()),pst=Pa.__importDefault(y7()),ai=Pa.__importDefault(kn()),mst=EO(),po=B7(),Ape=YT(),Est=iT(),F7=fr(),bst=(function(e){Pa.__extends(t,e);function t(r,n,i){i===void 0&&(i=!1);var s=e.call(this,r,i)||this;return s.context=n,s}return t.prototype.parseObject=function(){if(this.skipWhitespaceAndComments(),this.matchKeyword(po.Keywords.true))return fpe.default.True;if(this.matchKeyword(po.Keywords.false))return fpe.default.False;if(this.matchKeyword(po.Keywords.null))return ust.default;var r=this.bytes.peek();if(r===ai.default.LessThan&&this.bytes.peekAhead(1)===ai.default.LessThan)return this.parseDictOrStream();if(r===ai.default.LessThan)return this.parseHexString();if(r===ai.default.LeftParen)return this.parseString();if(r===ai.default.ForwardSlash)return this.parseName();if(r===ai.default.LeftSquareBracket)return this.parseArray();if(Ape.IsNumeric[r])return this.parseNumberOrRef();throw new w7.PDFObjectParsingError(this.bytes.position(),r)},t.prototype.parseNumberOrRef=function(){var r=this.parseRawNumber();this.skipWhitespaceAndComments();var n=this.bytes.offset();if(Ape.IsDigit[this.bytes.peek()]){var i=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===ai.default.R)return this.bytes.assertNext(ai.default.R),fst.default.of(r,i)}return this.bytes.moveTo(n),lpe.default.of(r)},t.prototype.parseHexString=function(){var r="";for(this.bytes.assertNext(ai.default.LessThan);!this.bytes.done()&&this.bytes.peek()!==ai.default.GreaterThan;)r+=F7.charFromCode(this.bytes.next());return this.bytes.assertNext(ai.default.GreaterThan),ost.default.of(r)},t.prototype.parseString=function(){for(var r=0,n=!1,i="";!this.bytes.done();){var s=this.bytes.next();if(i+=F7.charFromCode(s),n||(s===ai.default.LeftParen&&(r+=1),s===ai.default.RightParen&&(r-=1)),s===ai.default.BackSlash?n=!n:n&&(n=!1),r===0)return lst.default.of(i.substring(1,i.length-1))}throw new w7.UnbalancedParenthesisError(this.bytes.position())},t.prototype.parseName=function(){this.bytes.assertNext(ai.default.ForwardSlash);for(var r="";!this.bytes.done();){var n=this.bytes.peek();if(Est.IsWhitespace[n]||mst.IsDelimiter[n])break;r+=F7.charFromCode(n),this.bytes.next()}return km.default.of(r)},t.prototype.parseArray=function(){this.bytes.assertNext(ai.default.LeftSquareBracket),this.skipWhitespaceAndComments();for(var r=ast.default.withContext(this.context);this.bytes.peek()!==ai.default.RightSquareBracket;){var n=this.parseObject();r.push(n),this.skipWhitespaceAndComments()}return this.bytes.assertNext(ai.default.RightSquareBracket),r},t.prototype.parseDict=function(){this.bytes.assertNext(ai.default.LessThan),this.bytes.assertNext(ai.default.LessThan),this.skipWhitespaceAndComments();for(var r=new Map;!this.bytes.done()&&this.bytes.peek()!==ai.default.GreaterThan&&this.bytes.peekAhead(1)!==ai.default.GreaterThan;){var n=this.parseName(),i=this.parseObject();r.set(n,i),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(ai.default.GreaterThan),this.bytes.assertNext(ai.default.GreaterThan);var s=r.get(km.default.of("Type"));return s===km.default.of("Catalog")?hst.default.fromMapWithContext(r,this.context):s===km.default.of("Pages")?pst.default.fromMapWithContext(r,this.context):s===km.default.of("Page")?gst.default.fromMapWithContext(r,this.context):sst.default.fromMapWithContext(r,this.context)},t.prototype.parseDictOrStream=function(){var r=this.bytes.position(),n=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(po.Keywords.streamEOF1)&&!this.matchKeyword(po.Keywords.streamEOF2)&&!this.matchKeyword(po.Keywords.streamEOF3)&&!this.matchKeyword(po.Keywords.streamEOF4)&&!this.matchKeyword(po.Keywords.stream))return n;var i=this.bytes.offset(),s,u=n.get(km.default.of("Length"));u instanceof lpe.default?(s=i+u.asNumber(),this.bytes.moveTo(s),this.skipWhitespaceAndComments(),this.matchKeyword(po.Keywords.endstream)||(this.bytes.moveTo(i),s=this.findEndOfStreamFallback(r))):s=this.findEndOfStreamFallback(r);var f=this.bytes.slice(i,s);return cst.default.of(n,f)},t.prototype.findEndOfStreamFallback=function(r){for(var n=1,i=this.bytes.offset();!this.bytes.done()&&(i=this.bytes.offset(),this.matchKeyword(po.Keywords.stream)?n+=1:this.matchKeyword(po.Keywords.EOF1endstream)||this.matchKeyword(po.Keywords.EOF2endstream)||this.matchKeyword(po.Keywords.EOF3endstream)||this.matchKeyword(po.Keywords.endstream)?n-=1:this.bytes.next(),n!==0););if(n!==0)throw new w7.PDFStreamParsingError(r);return i},t.forBytes=function(r,n,i){return new t(dst.default.of(r),n,i)},t.forByteStream=function(r,n,i){return i===void 0&&(i=!1),new t(r,n,i)},t})(Ast.default);T7.default=bst});var Q7=U(S7=>{"use strict";Object.defineProperty(S7,"__esModule",{value:!0});var TA=(ct(),ze(ut)),Cst=Nn(),dpe=TA.__importDefault(zr()),hpe=TA.__importDefault(ki()),yst=TA.__importDefault(Ns()),xst=TA.__importDefault(ky()),vst=TA.__importDefault(KT()),Ist=fr(),Dst=(function(e){TA.__extends(t,e);function t(r,n){var i=e.call(this,xst.default.fromPDFRawStream(r),r.dict.context)||this,s=r.dict;return i.alreadyParsed=!1,i.shouldWaitForTick=n||(function(){return!1}),i.firstOffset=s.lookup(dpe.default.of("First"),hpe.default).asNumber(),i.objectCount=s.lookup(dpe.default.of("N"),hpe.default).asNumber(),i}return t.prototype.parseIntoContext=function(){return TA.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f,h,g;return TA.__generator(this,function(p){switch(p.label){case 0:if(this.alreadyParsed)throw new Cst.ReparseError("PDFObjectStreamParser","parseIntoContext");this.alreadyParsed=!0,r=this.parseOffsetsAndObjectNumbers(),n=0,i=r.length,p.label=1;case 1:return n<i?(s=r[n],u=s.objectNumber,f=s.offset,this.bytes.moveTo(this.firstOffset+f),h=this.parseObject(),g=yst.default.of(u,0),this.context.assign(g,h),this.shouldWaitForTick()?[4,Ist.waitForTick()]:[3,3]):[3,4];case 2:p.sent(),p.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},t.prototype.parseOffsetsAndObjectNumbers=function(){for(var r=[],n=0,i=this.objectCount;n<i;n++){this.skipWhitespaceAndComments();var s=this.parseRawInt();this.skipWhitespaceAndComments();var u=this.parseRawInt();r.push({objectNumber:s,offset:u})}return r},t.forStream=function(r,n){return new t(r,n)},t})(vst.default);S7.default=Dst});var N7=U(_7=>{"use strict";Object.defineProperty(_7,"__esModule",{value:!0});var Oy=(ct(),ze(ut)),Bst=Nn(),gpe=Oy.__importDefault(Oa()),ag=Oy.__importDefault(zr()),zT=Oy.__importDefault(ki()),wst=Oy.__importDefault(Ns()),Fst=Oy.__importDefault(ky()),Tst=(function(){function e(t){this.alreadyParsed=!1,this.dict=t.dict,this.bytes=Fst.default.fromPDFRawStream(t),this.context=this.dict.context;var r=this.dict.lookup(ag.default.of("Size"),zT.default),n=this.dict.lookup(ag.default.of("Index"));if(n instanceof gpe.default){this.subsections=[];for(var i=0,s=n.size();i<s;i+=2){var u=n.lookup(i+0,zT.default).asNumber(),f=n.lookup(i+1,zT.default).asNumber();this.subsections.push({firstObjectNumber:u,length:f})}}else this.subsections=[{firstObjectNumber:0,length:r.asNumber()}];var h=this.dict.lookup(ag.default.of("W"),gpe.default);this.byteWidths=[-1,-1,-1];for(var i=0,s=h.size();i<s;i++)this.byteWidths[i]=h.lookup(i,zT.default).asNumber()}return e.prototype.parseIntoContext=function(){if(this.alreadyParsed)throw new Bst.ReparseError("PDFXRefStreamParser","parseIntoContext");this.alreadyParsed=!0,this.context.trailerInfo={Root:this.dict.get(ag.default.of("Root")),Encrypt:this.dict.get(ag.default.of("Encrypt")),Info:this.dict.get(ag.default.of("Info")),ID:this.dict.get(ag.default.of("ID"))};var t=this.parseEntries();return t},e.prototype.parseEntries=function(){for(var t=[],r=this.byteWidths,n=r[0],i=r[1],s=r[2],u=0,f=this.subsections.length;u<f;u++)for(var h=this.subsections[u],g=h.firstObjectNumber,p=h.length,C=0;C<p;C++){for(var y=0,x=0,v=n;x<v;x++)y=y<<8|this.bytes.next();for(var F=0,x=0,v=i;x<v;x++)F=F<<8|this.bytes.next();for(var Q=0,x=0,v=s;x<v;x++)Q=Q<<8|this.bytes.next();n===0&&(y=1);var T=g+C,_={ref:wst.default.of(T,Q),offset:F,deleted:y===0,inObjectStream:y===2};t.push(_)}return t},e.forStream=function(t){return new e(t)},e})();_7.default=Tst});var Epe=U(k7=>{"use strict";Object.defineProperty(k7,"__esModule",{value:!0});var hi=(ct(),ze(ut)),Sst=hi.__importDefault(fT()),Qst=hi.__importDefault(lm()),_st=hi.__importDefault(Dy()),Ly=Nn(),Nst=hi.__importDefault(ls()),kst=hi.__importDefault(hT()),N0=hi.__importDefault(zr()),ppe=hi.__importDefault(Em()),ZT=hi.__importDefault(Ns()),Rst=hi.__importDefault(ky()),Ust=hi.__importDefault(KT()),Mst=hi.__importDefault(Q7()),Ost=hi.__importDefault(N7()),Lst=hi.__importDefault(LO()),Rm=hi.__importDefault(kn()),mo=B7(),mpe=YT(),Pst=fr(),Hst=(function(e){hi.__extends(t,e);function t(r,n,i,s){n===void 0&&(n=1/0),i===void 0&&(i=!1),s===void 0&&(s=!1);var u=e.call(this,Rst.default.of(r),Lst.default.create(),s)||this;return u.alreadyParsed=!1,u.parsedObjects=0,u.shouldWaitForTick=function(){return u.parsedObjects+=1,u.parsedObjects%u.objectsPerTick===0},u.objectsPerTick=n,u.throwOnInvalidObject=i,u}return t.prototype.parseDocument=function(){return hi.__awaiter(this,void 0,void 0,function(){var r,n;return hi.__generator(this,function(i){switch(i.label){case 0:if(this.alreadyParsed)throw new Ly.ReparseError("PDFParser","parseDocument");this.alreadyParsed=!0,this.context.header=this.parseHeader(),i.label=1;case 1:return this.bytes.done()?[3,3]:[4,this.parseDocumentSection()];case 2:if(i.sent(),n=this.bytes.offset(),n===r)throw new Ly.StalledParserError(this.bytes.position());return r=n,[3,1];case 3:return this.maybeRecoverRoot(),this.context.lookup(ZT.default.of(0))&&(console.warn("Removing parsed object: 0 0 R"),this.context.delete(ZT.default.of(0))),[2,this.context]}})})},t.prototype.maybeRecoverRoot=function(){var r=function(p){return p instanceof Nst.default&&p.lookup(N0.default.of("Type"))===N0.default.of("Catalog")},n=this.context.lookup(this.context.trailerInfo.Root);if(!r(n))for(var i=this.context.enumerateIndirectObjects(),s=0,u=i.length;s<u;s++){var f=i[s],h=f[0],g=f[1];r(g)&&(this.context.trailerInfo.Root=h)}},t.prototype.parseHeader=function(){for(;!this.bytes.done();){if(this.matchKeyword(mo.Keywords.header)){var r=this.parseRawInt();this.bytes.assertNext(Rm.default.Period);var n=this.parseRawInt(),i=Qst.default.forVersion(r,n);return this.skipBinaryHeaderComment(),i}this.bytes.next()}throw new Ly.MissingPDFHeaderError(this.bytes.position())},t.prototype.parseIndirectObjectHeader=function(){this.skipWhitespaceAndComments();var r=this.parseRawInt();this.skipWhitespaceAndComments();var n=this.parseRawInt();if(this.skipWhitespaceAndComments(),!this.matchKeyword(mo.Keywords.obj))throw new Ly.MissingKeywordError(this.bytes.position(),mo.Keywords.obj);return ZT.default.of(r,n)},t.prototype.matchIndirectObjectHeader=function(){var r=this.bytes.offset();try{return this.parseIndirectObjectHeader(),!0}catch{return this.bytes.moveTo(r),!1}},t.prototype.parseIndirectObject=function(){return hi.__awaiter(this,void 0,void 0,function(){var r,n;return hi.__generator(this,function(i){switch(i.label){case 0:return r=this.parseIndirectObjectHeader(),this.skipWhitespaceAndComments(),n=this.parseObject(),this.skipWhitespaceAndComments(),this.matchKeyword(mo.Keywords.endobj),n instanceof ppe.default&&n.dict.lookup(N0.default.of("Type"))===N0.default.of("ObjStm")?[4,Mst.default.forStream(n,this.shouldWaitForTick).parseIntoContext()]:[3,2];case 1:return i.sent(),[3,3];case 2:n instanceof ppe.default&&n.dict.lookup(N0.default.of("Type"))===N0.default.of("XRef")?Ost.default.forStream(n).parseIntoContext():this.context.assign(r,n),i.label=3;case 3:return[2,r]}})})},t.prototype.tryToParseInvalidIndirectObject=function(){var r=this.bytes.position(),n="Trying to parse invalid object: "+JSON.stringify(r)+")";if(this.throwOnInvalidObject)throw new Error(n);console.warn(n);var i=this.parseIndirectObjectHeader();console.warn("Invalid object ref: "+i),this.skipWhitespaceAndComments();for(var s=this.bytes.offset(),u=!0;!this.bytes.done()&&(this.matchKeyword(mo.Keywords.endobj)&&(u=!1),!!u);)this.bytes.next();if(u)throw new Ly.PDFInvalidObjectParsingError(r);var f=this.bytes.offset()-mo.Keywords.endobj.length,h=kst.default.of(this.bytes.slice(s,f));return this.context.assign(i,h),i},t.prototype.parseIndirectObjects=function(){return hi.__awaiter(this,void 0,void 0,function(){var r,n;return hi.__generator(this,function(i){switch(i.label){case 0:this.skipWhitespaceAndComments(),i.label=1;case 1:if(!(!this.bytes.done()&&mpe.IsDigit[this.bytes.peek()]))return[3,8];r=this.bytes.offset(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,this.parseIndirectObject()];case 3:return i.sent(),[3,5];case 4:return n=i.sent(),this.bytes.moveTo(r),this.tryToParseInvalidIndirectObject(),[3,5];case 5:return this.skipWhitespaceAndComments(),this.skipJibberish(),this.shouldWaitForTick()?[4,Pst.waitForTick()]:[3,7];case 6:i.sent(),i.label=7;case 7:return[3,1];case 8:return[2]}})})},t.prototype.maybeParseCrossRefSection=function(){if(this.skipWhitespaceAndComments(),!!this.matchKeyword(mo.Keywords.xref)){this.skipWhitespaceAndComments();for(var r=-1,n=Sst.default.createEmpty();!this.bytes.done()&&mpe.IsDigit[this.bytes.peek()];){var i=this.parseRawInt();this.skipWhitespaceAndComments();var s=this.parseRawInt();this.skipWhitespaceAndComments();var u=this.bytes.peek();if(u===Rm.default.n||u===Rm.default.f){var f=ZT.default.of(r,s);this.bytes.next()===Rm.default.n?n.addEntry(f,i):n.addDeletedEntry(f,i),r+=1}else r=i;this.skipWhitespaceAndComments()}return n}},t.prototype.maybeParseTrailerDict=function(){if(this.skipWhitespaceAndComments(),!!this.matchKeyword(mo.Keywords.trailer)){this.skipWhitespaceAndComments();var r=this.parseDict(),n=this.context;n.trailerInfo={Root:r.get(N0.default.of("Root"))||n.trailerInfo.Root,Encrypt:r.get(N0.default.of("Encrypt"))||n.trailerInfo.Encrypt,Info:r.get(N0.default.of("Info"))||n.trailerInfo.Info,ID:r.get(N0.default.of("ID"))||n.trailerInfo.ID}}},t.prototype.maybeParseTrailer=function(){if(this.skipWhitespaceAndComments(),!!this.matchKeyword(mo.Keywords.startxref)){this.skipWhitespaceAndComments();var r=this.parseRawInt();return this.skipWhitespace(),this.matchKeyword(mo.Keywords.eof),this.skipWhitespaceAndComments(),this.matchKeyword(mo.Keywords.eof),this.skipWhitespaceAndComments(),_st.default.forLastCrossRefSectionOffset(r)}},t.prototype.parseDocumentSection=function(){return hi.__awaiter(this,void 0,void 0,function(){return hi.__generator(this,function(r){switch(r.label){case 0:return[4,this.parseIndirectObjects()];case 1:return r.sent(),this.maybeParseCrossRefSection(),this.maybeParseTrailerDict(),this.maybeParseTrailer(),this.skipJibberish(),[2]}})})},t.prototype.skipJibberish=function(){for(this.skipWhitespaceAndComments();!this.bytes.done();){var r=this.bytes.offset(),n=this.bytes.peek(),i=n>=Rm.default.Space&&n<=Rm.default.Tilde;if(i&&(this.matchKeyword(mo.Keywords.xref)||this.matchKeyword(mo.Keywords.trailer)||this.matchKeyword(mo.Keywords.startxref)||this.matchIndirectObjectHeader())){this.bytes.moveTo(r);break}this.bytes.next()}},t.prototype.skipBinaryHeaderComment=function(){this.skipWhitespaceAndComments();try{var r=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(r)}catch{this.bytes.next(),this.skipWhitespaceAndComments()}},t.forBytesWithOptions=function(r,n,i,s){return new t(r,n,i,s)},t})(Ust.default);k7.default=Hst});var bpe=U(Py=>{"use strict";Object.defineProperty(Py,"__esModule",{value:!0});Py.AnnotationFlags=void 0;var k0=function(e){return 1<<e},qst;(function(e){e[e.Invisible=k0(0)]="Invisible",e[e.Hidden=k0(1)]="Hidden",e[e.Print=k0(2)]="Print",e[e.NoZoom=k0(3)]="NoZoom",e[e.NoRotate=k0(4)]="NoRotate",e[e.NoView=k0(5)]="NoView",e[e.ReadOnly=k0(6)]="ReadOnly",e[e.Locked=k0(7)]="Locked",e[e.ToggleNoView=k0(8)]="ToggleNoView",e[e.LockedContents=k0(9)]="LockedContents"})(qst=Py.AnnotationFlags||(Py.AnnotationFlags={}))});var Cpe=U(Um=>{"use strict";Object.defineProperty(Um,"__esModule",{value:!0});var Wst=(ct(),ze(ut)),Gst=TL();Object.defineProperty(Um,"PDFAnnotation",{enumerable:!0,get:function(){return Gst.default}});var Vst=OL();Object.defineProperty(Um,"PDFWidgetAnnotation",{enumerable:!0,get:function(){return Vst.default}});var Yst=NL();Object.defineProperty(Um,"AppearanceCharacteristics",{enumerable:!0,get:function(){return Yst.default}});Wst.__exportStar(bpe(),Um)});var Xi=U($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});var R7=(ct(),ze(ut));R7.__exportStar(Nn(),$t);var jst=kn();Object.defineProperty($t,"CharCodes",{enumerable:!0,get:function(){return jst.default}});var Jst=LO();Object.defineProperty($t,"PDFContext",{enumerable:!0,get:function(){return Jst.default}});var Xst=Jge();Object.defineProperty($t,"PDFObjectCopier",{enumerable:!0,get:function(){return Xst.default}});var Kst=XO();Object.defineProperty($t,"PDFWriter",{enumerable:!0,get:function(){return Kst.default}});var zst=$ge();Object.defineProperty($t,"PDFStreamWriter",{enumerable:!0,get:function(){return zst.default}});var Zst=lm();Object.defineProperty($t,"PDFHeader",{enumerable:!0,get:function(){return Zst.default}});var $st=Dy();Object.defineProperty($t,"PDFTrailer",{enumerable:!0,get:function(){return $st.default}});var eot=VO();Object.defineProperty($t,"PDFTrailerDict",{enumerable:!0,get:function(){return eot.default}});var tot=fT();Object.defineProperty($t,"PDFCrossRefSection",{enumerable:!0,get:function(){return tot.default}});var rot=r1e();Object.defineProperty($t,"StandardFontEmbedder",{enumerable:!0,get:function(){return rot.default}});var not=aL();Object.defineProperty($t,"CustomFontEmbedder",{enumerable:!0,get:function(){return not.default}});var iot=u1e();Object.defineProperty($t,"CustomFontSubsetEmbedder",{enumerable:!0,get:function(){return iot.default}});var ype=cL();Object.defineProperty($t,"FileEmbedder",{enumerable:!0,get:function(){return ype.default}});Object.defineProperty($t,"AFRelationship",{enumerable:!0,get:function(){return ype.AFRelationship}});var aot=l1e();Object.defineProperty($t,"JpegEmbedder",{enumerable:!0,get:function(){return aot.default}});var sot=g1e();Object.defineProperty($t,"PngEmbedder",{enumerable:!0,get:function(){return sot.default}});var oot=N1e();Object.defineProperty($t,"PDFPageEmbedder",{enumerable:!0,get:function(){return oot.default}});var Hy=vL();Object.defineProperty($t,"ViewerPreferences",{enumerable:!0,get:function(){return Hy.default}});Object.defineProperty($t,"NonFullScreenPageMode",{enumerable:!0,get:function(){return Hy.NonFullScreenPageMode}});Object.defineProperty($t,"ReadingDirection",{enumerable:!0,get:function(){return Hy.ReadingDirection}});Object.defineProperty($t,"PrintScaling",{enumerable:!0,get:function(){return Hy.PrintScaling}});Object.defineProperty($t,"Duplex",{enumerable:!0,get:function(){return Hy.Duplex}});var uot=_s();Object.defineProperty($t,"PDFObject",{enumerable:!0,get:function(){return uot.default}});var cot=by();Object.defineProperty($t,"PDFBool",{enumerable:!0,get:function(){return cot.default}});var fot=ki();Object.defineProperty($t,"PDFNumber",{enumerable:!0,get:function(){return fot.default}});var lot=Fc();Object.defineProperty($t,"PDFString",{enumerable:!0,get:function(){return lot.default}});var Aot=co();Object.defineProperty($t,"PDFHexString",{enumerable:!0,get:function(){return Aot.default}});var dot=zr();Object.defineProperty($t,"PDFName",{enumerable:!0,get:function(){return dot.default}});var hot=yy();Object.defineProperty($t,"PDFNull",{enumerable:!0,get:function(){return hot.default}});var got=Oa();Object.defineProperty($t,"PDFArray",{enumerable:!0,get:function(){return got.default}});var pot=ls();Object.defineProperty($t,"PDFDict",{enumerable:!0,get:function(){return pot.default}});var mot=Ns();Object.defineProperty($t,"PDFRef",{enumerable:!0,get:function(){return mot.default}});var Eot=hT();Object.defineProperty($t,"PDFInvalidObject",{enumerable:!0,get:function(){return Eot.default}});var bot=Yf();Object.defineProperty($t,"PDFStream",{enumerable:!0,get:function(){return bot.default}});var Cot=Em();Object.defineProperty($t,"PDFRawStream",{enumerable:!0,get:function(){return Cot.default}});var yot=m7();Object.defineProperty($t,"PDFCatalog",{enumerable:!0,get:function(){return yot.default}});var xot=uT();Object.defineProperty($t,"PDFContentStream",{enumerable:!0,get:function(){return xot.default}});var vot=zO();Object.defineProperty($t,"PDFCrossRefStream",{enumerable:!0,get:function(){return vot.default}});var Iot=AT();Object.defineProperty($t,"PDFObjectStream",{enumerable:!0,get:function(){return Iot.default}});var Dot=y7();Object.defineProperty($t,"PDFPageTree",{enumerable:!0,get:function(){return Dot.default}});var Bot=Iy();Object.defineProperty($t,"PDFPageLeaf",{enumerable:!0,get:function(){return Bot.default}});var wot=vy();Object.defineProperty($t,"PDFFlateStream",{enumerable:!0,get:function(){return wot.default}});var Fot=TO();Object.defineProperty($t,"PDFOperator",{enumerable:!0,get:function(){return Fot.default}});var Tot=_O();Object.defineProperty($t,"PDFOperatorNames",{enumerable:!0,get:function(){return Tot.default}});var Sot=KT();Object.defineProperty($t,"PDFObjectParser",{enumerable:!0,get:function(){return Sot.default}});var Qot=Q7();Object.defineProperty($t,"PDFObjectStreamParser",{enumerable:!0,get:function(){return Qot.default}});var _ot=Epe();Object.defineProperty($t,"PDFParser",{enumerable:!0,get:function(){return _ot.default}});var Not=N7();Object.defineProperty($t,"PDFXRefStreamParser",{enumerable:!0,get:function(){return Not.default}});var kot=FT();Object.defineProperty($t,"decodePDFRawStream",{enumerable:!0,get:function(){return kot.decodePDFRawStream}});R7.__exportStar(Cpe(),$t);R7.__exportStar(g7(),$t)});var $T=U(SA=>{"use strict";Object.defineProperty(SA,"__esModule",{value:!0});SA.asNumber=SA.asPDFNumber=SA.asPDFName=void 0;var qy=Xi();SA.asPDFName=function(e){return e instanceof qy.PDFName?e:qy.PDFName.of(e)};SA.asPDFNumber=function(e){return e instanceof qy.PDFNumber?e:qy.PDFNumber.of(e)};SA.asNumber=function(e){return e instanceof qy.PDFNumber?e.asNumber():e}});var zo=U(Ln=>{"use strict";Object.defineProperty(Ln,"__esModule",{value:!0});Ln.rotateRectangle=Ln.adjustDimsForRotation=Ln.reduceRotation=Ln.toDegrees=Ln.toRadians=Ln.radiansToDegrees=Ln.degreesToRadians=Ln.degrees=Ln.radians=Ln.RotationTypes=void 0;var e3=fr(),Wy;(function(e){e.Degrees="degrees",e.Radians="radians"})(Wy=Ln.RotationTypes||(Ln.RotationTypes={}));Ln.radians=function(e){return e3.assertIs(e,"radianAngle",["number"]),{type:Wy.Radians,angle:e}};Ln.degrees=function(e){return e3.assertIs(e,"degreeAngle",["number"]),{type:Wy.Degrees,angle:e}};var xpe=Wy.Radians,vpe=Wy.Degrees;Ln.degreesToRadians=function(e){return e*Math.PI/180};Ln.radiansToDegrees=function(e){return e*180/Math.PI};Ln.toRadians=function(e){return e.type===xpe?e.angle:e.type===vpe?Ln.degreesToRadians(e.angle):e3.error("Invalid rotation: "+JSON.stringify(e))};Ln.toDegrees=function(e){return e.type===xpe?Ln.radiansToDegrees(e.angle):e.type===vpe?e.angle:e3.error("Invalid rotation: "+JSON.stringify(e))};Ln.reduceRotation=function(e){e===void 0&&(e=0);var t=e/90%4;return t===0?0:t===1?90:t===2?180:t===3?270:0};Ln.adjustDimsForRotation=function(e,t){t===void 0&&(t=0);var r=Ln.reduceRotation(t);return r===90||r===270?{width:e.height,height:e.width}:{width:e.width,height:e.height}};Ln.rotateRectangle=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=0);var n=e.x,i=e.y,s=e.width,u=e.height,f=Ln.reduceRotation(r),h=t/2;return f===0?{x:n-h,y:i-h,width:s,height:u}:f===90?{x:n-u+h,y:i-h,width:u,height:s}:f===180?{x:n-s+h,y:i-u+h,width:s,height:u}:f===270?{x:n-h,y:i-s+h,width:u,height:s}:{x:n-h,y:i-h,width:s,height:u}}});var QA=U($e=>{"use strict";Object.defineProperty($e,"__esModule",{value:!0});$e.endMarkedContent=$e.beginMarkedContent=$e.setStrokingCmykColor=$e.setFillingCmykColor=$e.setStrokingRgbColor=$e.setFillingRgbColor=$e.setStrokingGrayscaleColor=$e.setFillingGrayscaleColor=$e.drawObject=$e.rotateAndSkewTextDegreesAndTranslate=$e.rotateAndSkewTextRadiansAndTranslate=$e.setTextMatrix=$e.setTextRenderingMode=$e.TextRenderingMode=$e.setTextRise=$e.setLineHeight=$e.setCharacterSqueeze=$e.setWordSpacing=$e.setCharacterSpacing=$e.setFontAndSize=$e.endText=$e.beginText=$e.showText=$e.moveText=$e.nextLine=$e.endPath=$e.fillAndStroke=$e.fill=$e.stroke=$e.square=$e.rectangle=$e.lineTo=$e.moveTo=$e.closePath=$e.appendQuadraticCurve=$e.appendBezierCurve=$e.setLineWidth=$e.popGraphicsState=$e.pushGraphicsState=$e.setGraphicsState=$e.setLineJoin=$e.LineJoinStyle=$e.setLineCap=$e.LineCapStyle=$e.restoreDashPattern=$e.setDashPattern=$e.skewDegrees=$e.skewRadians=$e.rotateDegrees=$e.rotateRadians=$e.scale=$e.translate=$e.concatTransformationMatrix=$e.clipEvenOdd=$e.clip=void 0;var Ft=$T(),Mm=zo(),Dt=Xi();$e.clip=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.ClipNonZero)};$e.clipEvenOdd=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.ClipEvenOdd)};var t3=Math.cos,r3=Math.sin,n3=Math.tan;$e.concatTransformationMatrix=function(e,t,r,n,i,s){return Dt.PDFOperator.of(Dt.PDFOperatorNames.ConcatTransformationMatrix,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n),Ft.asPDFNumber(i),Ft.asPDFNumber(s)])};$e.translate=function(e,t){return $e.concatTransformationMatrix(1,0,0,1,e,t)};$e.scale=function(e,t){return $e.concatTransformationMatrix(e,0,0,t,0,0)};$e.rotateRadians=function(e){return $e.concatTransformationMatrix(t3(Ft.asNumber(e)),r3(Ft.asNumber(e)),-r3(Ft.asNumber(e)),t3(Ft.asNumber(e)),0,0)};$e.rotateDegrees=function(e){return $e.rotateRadians(Mm.degreesToRadians(Ft.asNumber(e)))};$e.skewRadians=function(e,t){return $e.concatTransformationMatrix(1,n3(Ft.asNumber(e)),n3(Ft.asNumber(t)),1,0,0)};$e.skewDegrees=function(e,t){return $e.skewRadians(Mm.degreesToRadians(Ft.asNumber(e)),Mm.degreesToRadians(Ft.asNumber(t)))};$e.setDashPattern=function(e,t){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetLineDashPattern,["["+e.map(Ft.asPDFNumber).join(" ")+"]",Ft.asPDFNumber(t)])};$e.restoreDashPattern=function(){return $e.setDashPattern([],0)};var Rot;(function(e){e[e.Butt=0]="Butt",e[e.Round=1]="Round",e[e.Projecting=2]="Projecting"})(Rot=$e.LineCapStyle||($e.LineCapStyle={}));$e.setLineCap=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetLineCapStyle,[Ft.asPDFNumber(e)])};var Uot;(function(e){e[e.Miter=0]="Miter",e[e.Round=1]="Round",e[e.Bevel=2]="Bevel"})(Uot=$e.LineJoinStyle||($e.LineJoinStyle={}));$e.setLineJoin=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetLineJoinStyle,[Ft.asPDFNumber(e)])};$e.setGraphicsState=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetGraphicsStateParams,[Ft.asPDFName(e)])};$e.pushGraphicsState=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.PushGraphicsState)};$e.popGraphicsState=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.PopGraphicsState)};$e.setLineWidth=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetLineWidth,[Ft.asPDFNumber(e)])};$e.appendBezierCurve=function(e,t,r,n,i,s){return Dt.PDFOperator.of(Dt.PDFOperatorNames.AppendBezierCurve,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n),Ft.asPDFNumber(i),Ft.asPDFNumber(s)])};$e.appendQuadraticCurve=function(e,t,r,n){return Dt.PDFOperator.of(Dt.PDFOperatorNames.CurveToReplicateInitialPoint,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n)])};$e.closePath=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.ClosePath)};$e.moveTo=function(e,t){return Dt.PDFOperator.of(Dt.PDFOperatorNames.MoveTo,[Ft.asPDFNumber(e),Ft.asPDFNumber(t)])};$e.lineTo=function(e,t){return Dt.PDFOperator.of(Dt.PDFOperatorNames.LineTo,[Ft.asPDFNumber(e),Ft.asPDFNumber(t)])};$e.rectangle=function(e,t,r,n){return Dt.PDFOperator.of(Dt.PDFOperatorNames.AppendRectangle,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n)])};$e.square=function(e,t,r){return $e.rectangle(e,t,r,r)};$e.stroke=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.StrokePath)};$e.fill=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.FillNonZero)};$e.fillAndStroke=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.FillNonZeroAndStroke)};$e.endPath=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.EndPath)};$e.nextLine=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.NextLine)};$e.moveText=function(e,t){return Dt.PDFOperator.of(Dt.PDFOperatorNames.MoveText,[Ft.asPDFNumber(e),Ft.asPDFNumber(t)])};$e.showText=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.ShowText,[e])};$e.beginText=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.BeginText)};$e.endText=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.EndText)};$e.setFontAndSize=function(e,t){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetFontAndSize,[Ft.asPDFName(e),Ft.asPDFNumber(t)])};$e.setCharacterSpacing=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetCharacterSpacing,[Ft.asPDFNumber(e)])};$e.setWordSpacing=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetWordSpacing,[Ft.asPDFNumber(e)])};$e.setCharacterSqueeze=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetTextHorizontalScaling,[Ft.asPDFNumber(e)])};$e.setLineHeight=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetTextLineHeight,[Ft.asPDFNumber(e)])};$e.setTextRise=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetTextRise,[Ft.asPDFNumber(e)])};var Mot;(function(e){e[e.Fill=0]="Fill",e[e.Outline=1]="Outline",e[e.FillAndOutline=2]="FillAndOutline",e[e.Invisible=3]="Invisible",e[e.FillAndClip=4]="FillAndClip",e[e.OutlineAndClip=5]="OutlineAndClip",e[e.FillAndOutlineAndClip=6]="FillAndOutlineAndClip",e[e.Clip=7]="Clip"})(Mot=$e.TextRenderingMode||($e.TextRenderingMode={}));$e.setTextRenderingMode=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetTextRenderingMode,[Ft.asPDFNumber(e)])};$e.setTextMatrix=function(e,t,r,n,i,s){return Dt.PDFOperator.of(Dt.PDFOperatorNames.SetTextMatrix,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n),Ft.asPDFNumber(i),Ft.asPDFNumber(s)])};$e.rotateAndSkewTextRadiansAndTranslate=function(e,t,r,n,i){return $e.setTextMatrix(t3(Ft.asNumber(e)),r3(Ft.asNumber(e))+n3(Ft.asNumber(t)),-r3(Ft.asNumber(e))+n3(Ft.asNumber(r)),t3(Ft.asNumber(e)),n,i)};$e.rotateAndSkewTextDegreesAndTranslate=function(e,t,r,n,i){return $e.rotateAndSkewTextRadiansAndTranslate(Mm.degreesToRadians(Ft.asNumber(e)),Mm.degreesToRadians(Ft.asNumber(t)),Mm.degreesToRadians(Ft.asNumber(r)),n,i)};$e.drawObject=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.DrawObject,[Ft.asPDFName(e)])};$e.setFillingGrayscaleColor=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.NonStrokingColorGray,[Ft.asPDFNumber(e)])};$e.setStrokingGrayscaleColor=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.StrokingColorGray,[Ft.asPDFNumber(e)])};$e.setFillingRgbColor=function(e,t,r){return Dt.PDFOperator.of(Dt.PDFOperatorNames.NonStrokingColorRgb,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r)])};$e.setStrokingRgbColor=function(e,t,r){return Dt.PDFOperator.of(Dt.PDFOperatorNames.StrokingColorRgb,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r)])};$e.setFillingCmykColor=function(e,t,r,n){return Dt.PDFOperator.of(Dt.PDFOperatorNames.NonStrokingColorCmyk,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n)])};$e.setStrokingCmykColor=function(e,t,r,n){return Dt.PDFOperator.of(Dt.PDFOperatorNames.StrokingColorCmyk,[Ft.asPDFNumber(e),Ft.asPDFNumber(t),Ft.asPDFNumber(r),Ft.asPDFNumber(n)])};$e.beginMarkedContent=function(e){return Dt.PDFOperator.of(Dt.PDFOperatorNames.BeginMarkedContent,[Ft.asPDFName(e)])};$e.endMarkedContent=function(){return Dt.PDFOperator.of(Dt.PDFOperatorNames.EndMarkedContent)}});var Gu=U(wi=>{"use strict";Object.defineProperty(wi,"__esModule",{value:!0});wi.colorToComponents=wi.componentsToColor=wi.setStrokingColor=wi.setFillingColor=wi.cmyk=wi.rgb=wi.grayscale=wi.ColorTypes=void 0;var Om=QA(),Qc=fr(),sg;(function(e){e.Grayscale="Grayscale",e.RGB="RGB",e.CMYK="CMYK"})(sg=wi.ColorTypes||(wi.ColorTypes={}));wi.grayscale=function(e){return Qc.assertRange(e,"gray",0,1),{type:sg.Grayscale,gray:e}};wi.rgb=function(e,t,r){return Qc.assertRange(e,"red",0,1),Qc.assertRange(t,"green",0,1),Qc.assertRange(r,"blue",0,1),{type:sg.RGB,red:e,green:t,blue:r}};wi.cmyk=function(e,t,r,n){return Qc.assertRange(e,"cyan",0,1),Qc.assertRange(t,"magenta",0,1),Qc.assertRange(r,"yellow",0,1),Qc.assertRange(n,"key",0,1),{type:sg.CMYK,cyan:e,magenta:t,yellow:r,key:n}};var U7=sg.Grayscale,M7=sg.RGB,O7=sg.CMYK;wi.setFillingColor=function(e){return e.type===U7?Om.setFillingGrayscaleColor(e.gray):e.type===M7?Om.setFillingRgbColor(e.red,e.green,e.blue):e.type===O7?Om.setFillingCmykColor(e.cyan,e.magenta,e.yellow,e.key):Qc.error("Invalid color: "+JSON.stringify(e))};wi.setStrokingColor=function(e){return e.type===U7?Om.setStrokingGrayscaleColor(e.gray):e.type===M7?Om.setStrokingRgbColor(e.red,e.green,e.blue):e.type===O7?Om.setStrokingCmykColor(e.cyan,e.magenta,e.yellow,e.key):Qc.error("Invalid color: "+JSON.stringify(e))};wi.componentsToColor=function(e,t){return t===void 0&&(t=1),e?.length===1?wi.grayscale(e[0]*t):e?.length===3?wi.rgb(e[0]*t,e[1]*t,e[2]*t):e?.length===4?wi.cmyk(e[0]*t,e[1]*t,e[2]*t,e[3]*t):void 0};wi.colorToComponents=function(e){return e.type===U7?[e.gray]:e.type===M7?[e.red,e.green,e.blue]:e.type===O7?[e.cyan,e.magenta,e.yellow,e.key]:Qc.error("Invalid color: "+JSON.stringify(e))}});var wpe=U(i3=>{"use strict";Object.defineProperty(i3,"__esModule",{value:!0});i3.svgPathToOperators=void 0;var na=QA(),Yt=0,jt=0,Pr=0,Hr=0,Gy=0,Vy=0,Ipe=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]]),Oot=function(e){for(var t,r=[],n=[],i="",s=!1,u=0,f=0,h=e;f<h.length;f++){var g=h[f];if(Ipe.has(g))u=Ipe.get(g),t&&(i.length>0&&(n[n.length]=+i),r[r.length]={cmd:t,args:n},n=[],i="",s=!1),t=g;else if([" ",","].includes(g)||g==="-"&&i.length>0&&i[i.length-1]!=="e"||g==="."&&s){if(i.length===0)continue;n.length===u?(r[r.length]={cmd:t,args:n},n=[+i],t==="M"&&(t="L"),t==="m"&&(t="l")):n[n.length]=+i,s=g===".",i=["-","."].includes(g)?g:""}else i+=g,g==="."&&(s=!0)}return i.length>0&&(n.length===u?(r[r.length]={cmd:t,args:n},n=[+i],t==="M"&&(t="L"),t==="m"&&(t="l")):n[n.length]=+i),r[r.length]={cmd:t,args:n},r},Lot=function(e){Yt=jt=Pr=Hr=Gy=Vy=0;for(var t=[],r=0;r<e.length;r++){var n=e[r];if(n.cmd&&typeof Dpe[n.cmd]=="function"){var i=Dpe[n.cmd](n.args);Array.isArray(i)?t=t.concat(i):t.push(i)}}return t},Dpe={M:function(e){return Yt=e[0],jt=e[1],Pr=Hr=null,Gy=Yt,Vy=jt,na.moveTo(Yt,jt)},m:function(e){return Yt+=e[0],jt+=e[1],Pr=Hr=null,Gy=Yt,Vy=jt,na.moveTo(Yt,jt)},C:function(e){return Yt=e[4],jt=e[5],Pr=e[2],Hr=e[3],na.appendBezierCurve(e[0],e[1],e[2],e[3],e[4],e[5])},c:function(e){var t=na.appendBezierCurve(e[0]+Yt,e[1]+jt,e[2]+Yt,e[3]+jt,e[4]+Yt,e[5]+jt);return Pr=Yt+e[2],Hr=jt+e[3],Yt+=e[4],jt+=e[5],t},S:function(e){(Pr===null||Hr===null)&&(Pr=Yt,Hr=jt);var t=na.appendBezierCurve(Yt-(Pr-Yt),jt-(Hr-jt),e[0],e[1],e[2],e[3]);return Pr=e[0],Hr=e[1],Yt=e[2],jt=e[3],t},s:function(e){(Pr===null||Hr===null)&&(Pr=Yt,Hr=jt);var t=na.appendBezierCurve(Yt-(Pr-Yt),jt-(Hr-jt),Yt+e[0],jt+e[1],Yt+e[2],jt+e[3]);return Pr=Yt+e[0],Hr=jt+e[1],Yt+=e[2],jt+=e[3],t},Q:function(e){return Pr=e[0],Hr=e[1],Yt=e[2],jt=e[3],na.appendQuadraticCurve(e[0],e[1],Yt,jt)},q:function(e){var t=na.appendQuadraticCurve(e[0]+Yt,e[1]+jt,e[2]+Yt,e[3]+jt);return Pr=Yt+e[0],Hr=jt+e[1],Yt+=e[2],jt+=e[3],t},T:function(e){Pr===null||Hr===null?(Pr=Yt,Hr=jt):(Pr=Yt-(Pr-Yt),Hr=jt-(Hr-jt));var t=na.appendQuadraticCurve(Pr,Hr,e[0],e[1]);return Pr=Yt-(Pr-Yt),Hr=jt-(Hr-jt),Yt=e[0],jt=e[1],t},t:function(e){Pr===null||Hr===null?(Pr=Yt,Hr=jt):(Pr=Yt-(Pr-Yt),Hr=jt-(Hr-jt));var t=na.appendQuadraticCurve(Pr,Hr,Yt+e[0],jt+e[1]);return Yt+=e[0],jt+=e[1],t},A:function(e){var t=Bpe(Yt,jt,e);return Yt=e[5],jt=e[6],t},a:function(e){e[5]+=Yt,e[6]+=jt;var t=Bpe(Yt,jt,e);return Yt=e[5],jt=e[6],t},L:function(e){return Yt=e[0],jt=e[1],Pr=Hr=null,na.lineTo(Yt,jt)},l:function(e){return Yt+=e[0],jt+=e[1],Pr=Hr=null,na.lineTo(Yt,jt)},H:function(e){return Yt=e[0],Pr=Hr=null,na.lineTo(Yt,jt)},h:function(e){return Yt+=e[0],Pr=Hr=null,na.lineTo(Yt,jt)},V:function(e){return jt=e[0],Pr=Hr=null,na.lineTo(Yt,jt)},v:function(e){return jt+=e[0],Pr=Hr=null,na.lineTo(Yt,jt)},Z:function(){var e=na.closePath();return Yt=Gy,jt=Vy,e},z:function(){var e=na.closePath();return Yt=Gy,jt=Vy,e}},Bpe=function(e,t,r){for(var n=r[0],i=r[1],s=r[2],u=r[3],f=r[4],h=r[5],g=r[6],p=Pot(h,g,n,i,u,f,s,e,t),C=[],y=0,x=p;y<x.length;y++){var v=x[y],F=Hot.apply(void 0,v);C.push(na.appendBezierCurve.apply(void 0,F))}return C},Pot=function(e,t,r,n,i,s,u,f,h){var g=u*(Math.PI/180),p=Math.sin(g),C=Math.cos(g);r=Math.abs(r),n=Math.abs(n),Pr=C*(f-e)*.5+p*(h-t)*.5,Hr=C*(h-t)*.5-p*(f-e)*.5;var y=Pr*Pr/(r*r)+Hr*Hr/(n*n);y>1&&(y=Math.sqrt(y),r*=y,n*=y);var x=C/r,v=p/r,F=-p/n,Q=C/n,T=x*f+v*h,_=F*f+Q*h,S=x*e+v*t,N=F*e+Q*t,O=(S-T)*(S-T)+(N-_)*(N-_),H=1/O-.25;H<0&&(H=0);var q=Math.sqrt(H);s===i&&(q=-q);var G=.5*(T+S)-q*(N-_),J=.5*(_+N)+q*(S-T),Ie=Math.atan2(_-J,T-G),fe=Math.atan2(N-J,S-G),z=fe-Ie;z<0&&s===1?z+=2*Math.PI:z>0&&s===0&&(z-=2*Math.PI);for(var ge=Math.ceil(Math.abs(z/(Math.PI*.5+.001))),ne=[],Le=0;Le<ge;Le++){var X=Ie+Le*z/ge,se=Ie+(Le+1)*z/ge;ne[Le]=[G,J,X,se,r,n,p,C]}return ne},Hot=function(e,t,r,n,i,s,u,f){var h=f*i,g=-u*s,p=u*i,C=f*s,y=.5*(n-r),x=8/3*Math.sin(y*.5)*Math.sin(y*.5)/Math.sin(y),v=e+Math.cos(r)-x*Math.sin(r),F=t+Math.sin(r)+x*Math.cos(r),Q=e+Math.cos(n),T=t+Math.sin(n),_=Q+x*Math.sin(n),S=T-x*Math.cos(n),N=[h*v+g*F,p*v+C*F,h*_+g*S,p*_+C*S,h*Q+g*T,p*Q+C*T];return N};i3.svgPathToOperators=function(e){return Lot(Oot(e))}});var Lm=U(lr=>{"use strict";Object.defineProperty(lr,"__esModule",{value:!0});lr.drawOptionList=lr.drawTextField=lr.drawTextLines=lr.drawButton=lr.drawRadioButton=lr.drawCheckBox=lr.rotateInPlace=lr.drawCheckMark=lr.drawSvgPath=lr.drawEllipse=lr.drawEllipsePath=lr.drawRectangle=lr.drawLine=lr.drawPage=lr.drawImage=lr.drawLinesOfText=lr.drawText=void 0;var zf=(ct(),ze(ut)),_c=Gu(),Ue=QA(),hr=zo(),qot=wpe(),An=$T();lr.drawText=function(e,t){return[Ue.pushGraphicsState(),t.graphicsState&&Ue.setGraphicsState(t.graphicsState),Ue.beginText(),_c.setFillingColor(t.color),Ue.setFontAndSize(t.font,t.size),Ue.rotateAndSkewTextRadiansAndTranslate(hr.toRadians(t.rotate),hr.toRadians(t.xSkew),hr.toRadians(t.ySkew),t.x,t.y),Ue.showText(e),Ue.endText(),Ue.popGraphicsState()].filter(Boolean)};lr.drawLinesOfText=function(e,t){for(var r=[Ue.pushGraphicsState(),t.graphicsState&&Ue.setGraphicsState(t.graphicsState),Ue.beginText(),_c.setFillingColor(t.color),Ue.setFontAndSize(t.font,t.size),Ue.setLineHeight(t.lineHeight),Ue.rotateAndSkewTextRadiansAndTranslate(hr.toRadians(t.rotate),hr.toRadians(t.xSkew),hr.toRadians(t.ySkew),t.x,t.y)].filter(Boolean),n=0,i=e.length;n<i;n++)r.push(Ue.showText(e[n]),Ue.nextLine());return r.push(Ue.endText(),Ue.popGraphicsState()),r};lr.drawImage=function(e,t){return[Ue.pushGraphicsState(),t.graphicsState&&Ue.setGraphicsState(t.graphicsState),Ue.translate(t.x,t.y),Ue.rotateRadians(hr.toRadians(t.rotate)),Ue.scale(t.width,t.height),Ue.skewRadians(hr.toRadians(t.xSkew),hr.toRadians(t.ySkew)),Ue.drawObject(e),Ue.popGraphicsState()].filter(Boolean)};lr.drawPage=function(e,t){return[Ue.pushGraphicsState(),t.graphicsState&&Ue.setGraphicsState(t.graphicsState),Ue.translate(t.x,t.y),Ue.rotateRadians(hr.toRadians(t.rotate)),Ue.scale(t.xScale,t.yScale),Ue.skewRadians(hr.toRadians(t.xSkew),hr.toRadians(t.ySkew)),Ue.drawObject(e),Ue.popGraphicsState()].filter(Boolean)};lr.drawLine=function(e){var t,r;return[Ue.pushGraphicsState(),e.graphicsState&&Ue.setGraphicsState(e.graphicsState),e.color&&_c.setStrokingColor(e.color),Ue.setLineWidth(e.thickness),Ue.setDashPattern((t=e.dashArray)!==null&&t!==void 0?t:[],(r=e.dashPhase)!==null&&r!==void 0?r:0),Ue.moveTo(e.start.x,e.start.y),e.lineCap&&Ue.setLineCap(e.lineCap),Ue.moveTo(e.start.x,e.start.y),Ue.lineTo(e.end.x,e.end.y),Ue.stroke(),Ue.popGraphicsState()].filter(Boolean)};lr.drawRectangle=function(e){var t,r;return[Ue.pushGraphicsState(),e.graphicsState&&Ue.setGraphicsState(e.graphicsState),e.color&&_c.setFillingColor(e.color),e.borderColor&&_c.setStrokingColor(e.borderColor),Ue.setLineWidth(e.borderWidth),e.borderLineCap&&Ue.setLineCap(e.borderLineCap),Ue.setDashPattern((t=e.borderDashArray)!==null&&t!==void 0?t:[],(r=e.borderDashPhase)!==null&&r!==void 0?r:0),Ue.translate(e.x,e.y),Ue.rotateRadians(hr.toRadians(e.rotate)),Ue.skewRadians(hr.toRadians(e.xSkew),hr.toRadians(e.ySkew)),Ue.moveTo(0,0),Ue.lineTo(0,e.height),Ue.lineTo(e.width,e.height),Ue.lineTo(e.width,0),Ue.closePath(),e.color&&e.borderWidth?Ue.fillAndStroke():e.color?Ue.fill():e.borderColor?Ue.stroke():Ue.closePath(),Ue.popGraphicsState()].filter(Boolean)};var a3=4*((Math.sqrt(2)-1)/3);lr.drawEllipsePath=function(e){var t=An.asNumber(e.x),r=An.asNumber(e.y),n=An.asNumber(e.xScale),i=An.asNumber(e.yScale);t-=n,r-=i;var s=n*a3,u=i*a3,f=t+n*2,h=r+i*2,g=t+n,p=r+i;return[Ue.pushGraphicsState(),Ue.moveTo(t,p),Ue.appendBezierCurve(t,p-u,g-s,r,g,r),Ue.appendBezierCurve(g+s,r,f,p-u,f,p),Ue.appendBezierCurve(f,p+u,g+s,h,g,h),Ue.appendBezierCurve(g-s,h,t,p+u,t,p),Ue.popGraphicsState()]};var Wot=function(e){var t=An.asNumber(e.x),r=An.asNumber(e.y),n=An.asNumber(e.xScale),i=An.asNumber(e.yScale),s=-n,u=-i,f=n*a3,h=i*a3,g=s+n*2,p=u+i*2,C=s+n,y=u+i;return[Ue.translate(t,r),Ue.rotateRadians(hr.toRadians(e.rotate)),Ue.moveTo(s,y),Ue.appendBezierCurve(s,y-h,C-f,u,C,u),Ue.appendBezierCurve(C+f,u,g,y-h,g,y),Ue.appendBezierCurve(g,y+h,C+f,p,C,p),Ue.appendBezierCurve(C-f,p,s,y+h,s,y)]};lr.drawEllipse=function(e){var t,r,n;return zf.__spreadArrays([Ue.pushGraphicsState(),e.graphicsState&&Ue.setGraphicsState(e.graphicsState),e.color&&_c.setFillingColor(e.color),e.borderColor&&_c.setStrokingColor(e.borderColor),Ue.setLineWidth(e.borderWidth),e.borderLineCap&&Ue.setLineCap(e.borderLineCap),Ue.setDashPattern((t=e.borderDashArray)!==null&&t!==void 0?t:[],(r=e.borderDashPhase)!==null&&r!==void 0?r:0)],e.rotate===void 0?lr.drawEllipsePath({x:e.x,y:e.y,xScale:e.xScale,yScale:e.yScale}):Wot({x:e.x,y:e.y,xScale:e.xScale,yScale:e.yScale,rotate:(n=e.rotate)!==null&&n!==void 0?n:hr.degrees(0)}),[e.color&&e.borderWidth?Ue.fillAndStroke():e.color?Ue.fill():e.borderColor?Ue.stroke():Ue.closePath(),Ue.popGraphicsState()]).filter(Boolean)};lr.drawSvgPath=function(e,t){var r,n,i;return zf.__spreadArrays([Ue.pushGraphicsState(),t.graphicsState&&Ue.setGraphicsState(t.graphicsState),Ue.translate(t.x,t.y),Ue.rotateRadians(hr.toRadians((r=t.rotate)!==null&&r!==void 0?r:hr.degrees(0))),t.scale?Ue.scale(t.scale,-t.scale):Ue.scale(1,-1),t.color&&_c.setFillingColor(t.color),t.borderColor&&_c.setStrokingColor(t.borderColor),t.borderWidth&&Ue.setLineWidth(t.borderWidth),t.borderLineCap&&Ue.setLineCap(t.borderLineCap),Ue.setDashPattern((n=t.borderDashArray)!==null&&n!==void 0?n:[],(i=t.borderDashPhase)!==null&&i!==void 0?i:0)],qot.svgPathToOperators(e),[t.color&&t.borderWidth?Ue.fillAndStroke():t.color?Ue.fill():t.borderColor?Ue.stroke():Ue.closePath(),Ue.popGraphicsState()]).filter(Boolean)};lr.drawCheckMark=function(e){var t=An.asNumber(e.size),r=-1+.75,n=-1+.51,i=1-.525,s=1-.31,u=-1+.325,f=-((u-r)*(s-r))/(i-n)+n;return[Ue.pushGraphicsState(),e.color&&_c.setStrokingColor(e.color),Ue.setLineWidth(e.thickness),Ue.translate(e.x,e.y),Ue.moveTo(u*t,f*t),Ue.lineTo(r*t,n*t),Ue.lineTo(s*t,i*t),Ue.stroke(),Ue.popGraphicsState()].filter(Boolean)};lr.rotateInPlace=function(e){return e.rotation===0?[Ue.translate(0,0),Ue.rotateDegrees(0)]:e.rotation===90?[Ue.translate(e.width,0),Ue.rotateDegrees(90)]:e.rotation===180?[Ue.translate(e.width,e.height),Ue.rotateDegrees(180)]:e.rotation===270?[Ue.translate(0,e.height),Ue.rotateDegrees(270)]:[]};lr.drawCheckBox=function(e){var t=lr.drawRectangle({x:e.x,y:e.y,width:e.width,height:e.height,borderWidth:e.borderWidth,color:e.color,borderColor:e.borderColor,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)});if(!e.filled)return t;var r=An.asNumber(e.width),n=An.asNumber(e.height),i=Math.min(r,n)/2,s=lr.drawCheckMark({x:r/2,y:n/2,size:i,thickness:e.thickness,color:e.markColor});return zf.__spreadArrays([Ue.pushGraphicsState()],t,s,[Ue.popGraphicsState()])};lr.drawRadioButton=function(e){var t=An.asNumber(e.width),r=An.asNumber(e.height),n=Math.min(t,r)/2,i=lr.drawEllipse({x:e.x,y:e.y,xScale:n,yScale:n,color:e.color,borderColor:e.borderColor,borderWidth:e.borderWidth});if(!e.filled)return i;var s=lr.drawEllipse({x:e.x,y:e.y,xScale:n*.45,yScale:n*.45,color:e.dotColor,borderColor:void 0,borderWidth:0});return zf.__spreadArrays([Ue.pushGraphicsState()],i,s,[Ue.popGraphicsState()])};lr.drawButton=function(e){var t=An.asNumber(e.x),r=An.asNumber(e.y),n=An.asNumber(e.width),i=An.asNumber(e.height),s=lr.drawRectangle({x:t,y:r,width:n,height:i,borderWidth:e.borderWidth,color:e.color,borderColor:e.borderColor,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)}),u=lr.drawTextLines(e.textLines,{color:e.textColor,font:e.font,size:e.fontSize,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)});return zf.__spreadArrays([Ue.pushGraphicsState()],s,u,[Ue.popGraphicsState()])};lr.drawTextLines=function(e,t){for(var r=[Ue.beginText(),_c.setFillingColor(t.color),Ue.setFontAndSize(t.font,t.size)],n=0,i=e.length;n<i;n++){var s=e[n],u=s.encoded,f=s.x,h=s.y;r.push(Ue.rotateAndSkewTextRadiansAndTranslate(hr.toRadians(t.rotate),hr.toRadians(t.xSkew),hr.toRadians(t.ySkew),f,h),Ue.showText(u))}return r.push(Ue.endText()),r};lr.drawTextField=function(e){var t=An.asNumber(e.x),r=An.asNumber(e.y),n=An.asNumber(e.width),i=An.asNumber(e.height),s=An.asNumber(e.borderWidth),u=An.asNumber(e.padding),f=t+s/2+u,h=r+s/2+u,g=n-(s/2+u)*2,p=i-(s/2+u)*2,C=[Ue.moveTo(f,h),Ue.lineTo(f,h+p),Ue.lineTo(f+g,h+p),Ue.lineTo(f+g,h),Ue.closePath(),Ue.clip(),Ue.endPath()],y=lr.drawRectangle({x:t,y:r,width:n,height:i,borderWidth:e.borderWidth,color:e.color,borderColor:e.borderColor,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)}),x=lr.drawTextLines(e.textLines,{color:e.textColor,font:e.font,size:e.fontSize,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)}),v=zf.__spreadArrays([Ue.beginMarkedContent("Tx"),Ue.pushGraphicsState()],x,[Ue.popGraphicsState(),Ue.endMarkedContent()]);return zf.__spreadArrays([Ue.pushGraphicsState()],y,C,v,[Ue.popGraphicsState()])};lr.drawOptionList=function(e){for(var t=An.asNumber(e.x),r=An.asNumber(e.y),n=An.asNumber(e.width),i=An.asNumber(e.height),s=An.asNumber(e.lineHeight),u=An.asNumber(e.borderWidth),f=An.asNumber(e.padding),h=t+u/2+f,g=r+u/2+f,p=n-(u/2+f)*2,C=i-(u/2+f)*2,y=[Ue.moveTo(h,g),Ue.lineTo(h,g+C),Ue.lineTo(h+p,g+C),Ue.lineTo(h+p,g),Ue.closePath(),Ue.clip(),Ue.endPath()],x=lr.drawRectangle({x:t,y:r,width:n,height:i,borderWidth:e.borderWidth,color:e.color,borderColor:e.borderColor,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)}),v=[],F=0,Q=e.selectedLines.length;F<Q;F++){var T=e.textLines[e.selectedLines[F]];v.push.apply(v,lr.drawRectangle({x:T.x-f,y:T.y-(s-T.height)/2,width:n-u,height:T.height+(s-T.height)/2,borderWidth:0,color:e.selectedColor,borderColor:void 0,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)}))}var _=lr.drawTextLines(e.textLines,{color:e.textColor,font:e.font,size:e.fontSize,rotate:hr.degrees(0),xSkew:hr.degrees(0),ySkew:hr.degrees(0)}),S=zf.__spreadArrays([Ue.beginMarkedContent("Tx"),Ue.pushGraphicsState()],_,[Ue.popGraphicsState(),Ue.endMarkedContent()]);return zf.__spreadArrays([Ue.pushGraphicsState()],x,v,y,S,[Ue.popGraphicsState()])}});var Pm=U(dn=>{"use strict";Object.defineProperty(dn,"__esModule",{value:!0});dn.InvalidMaxLengthError=dn.ExceededMaxLengthError=dn.CombedTextLayoutError=dn.RichTextFieldReadError=dn.FieldExistsAsNonTerminalError=dn.InvalidFieldNamePartError=dn.FieldAlreadyExistsError=dn.MissingOnValueCheckError=dn.UnexpectedFieldTypeError=dn.NoSuchFieldError=dn.RemovePageFromEmptyDocumentError=dn.ForeignPageError=dn.FontkitNotRegisteredError=dn.EncryptedPDFError=void 0;var Eo=(ct(),ze(ut)),Got=(function(e){Eo.__extends(t,e);function t(){var r=this,n="Input document to `PDFDocument.load` is encrypted. You can use `PDFDocument.load(..., { ignoreEncryption: true })` if you wish to load the document anyways.";return r=e.call(this,n)||this,r}return t})(Error);dn.EncryptedPDFError=Got;var Vot=(function(e){Eo.__extends(t,e);function t(){var r=this,n="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.";return r=e.call(this,n)||this,r}return t})(Error);dn.FontkitNotRegisteredError=Vot;var Yot=(function(e){Eo.__extends(t,e);function t(){var r=this,n="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.";return r=e.call(this,n)||this,r}return t})(Error);dn.ForeignPageError=Yot;var jot=(function(e){Eo.__extends(t,e);function t(){var r=this,n="PDFDocument has no pages so `PDFDocument.removePage` cannot be called";return r=e.call(this,n)||this,r}return t})(Error);dn.RemovePageFromEmptyDocumentError=jot;var Jot=(function(e){Eo.__extends(t,e);function t(r){var n=this,i='PDFDocument has no form field with the name "'+r+'"';return n=e.call(this,i)||this,n}return t})(Error);dn.NoSuchFieldError=Jot;var Xot=(function(e){Eo.__extends(t,e);function t(r,n,i){var s,u,f=this,h=n?.name,g=(u=(s=i?.constructor)===null||s===void 0?void 0:s.name)!==null&&u!==void 0?u:i,p='Expected field "'+r+'" to be of type '+h+", "+("but it is actually of type "+g);return f=e.call(this,p)||this,f}return t})(Error);dn.UnexpectedFieldTypeError=Xot;var Kot=(function(e){Eo.__extends(t,e);function t(r){var n=this,i='Failed to select check box due to missing onValue: "'+r+'"';return n=e.call(this,i)||this,n}return t})(Error);dn.MissingOnValueCheckError=Kot;var zot=(function(e){Eo.__extends(t,e);function t(r){var n=this,i='A field already exists with the specified name: "'+r+'"';return n=e.call(this,i)||this,n}return t})(Error);dn.FieldAlreadyExistsError=zot;var Zot=(function(e){Eo.__extends(t,e);function t(r){var n=this,i='Field name contains invalid component: "'+r+'"';return n=e.call(this,i)||this,n}return t})(Error);dn.InvalidFieldNamePartError=Zot;var $ot=(function(e){Eo.__extends(t,e);function t(r){var n=this,i='A non-terminal field already exists with the specified name: "'+r+'"';return n=e.call(this,i)||this,n}return t})(Error);dn.FieldExistsAsNonTerminalError=$ot;var eut=(function(e){Eo.__extends(t,e);function t(r){var n=this,i="Reading rich text fields is not supported: Attempted to read rich text field: "+r;return n=e.call(this,i)||this,n}return t})(Error);dn.RichTextFieldReadError=eut;var tut=(function(e){Eo.__extends(t,e);function t(r,n){var i=this,s="Failed to layout combed text as lineLength="+r+" is greater than cellCount="+n;return i=e.call(this,s)||this,i}return t})(Error);dn.CombedTextLayoutError=tut;var rut=(function(e){Eo.__extends(t,e);function t(r,n,i){var s=this,u="Attempted to set text with length="+r+" for TextField with maxLength="+n+" and name="+i;return s=e.call(this,u)||this,s}return t})(Error);dn.ExceededMaxLengthError=rut;var nut=(function(e){Eo.__extends(t,e);function t(r,n,i){var s=this,u="Attempted to set maxLength="+n+", which is less than "+r+", the length of this field's current value (name="+i+")";return s=e.call(this,u)||this,s}return t})(Error);dn.InvalidMaxLengthError=nut});var jy=U(Yy=>{"use strict";Object.defineProperty(Yy,"__esModule",{value:!0});Yy.TextAlignment=void 0;var iut;(function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"})(iut=Yy.TextAlignment||(Yy.TextAlignment={}))});var L7=U(NA=>{"use strict";Object.defineProperty(NA,"__esModule",{value:!0});NA.layoutSinglelineText=NA.layoutCombedText=NA.layoutMultilineText=void 0;var aut=Pm(),Hm=jy(),_A=fr(),Fpe=4,Tpe=500,Spe=function(e,t,r,n){n===void 0&&(n=!1);for(var i=Fpe;i<Tpe;){for(var s=0,u=0,f=e.length;u<f;u++){s+=1;for(var h=e[u],g=h.split(" "),p=r.width,C=0,y=g.length;C<y;C++){var x=C===y-1,v=x?g[C]:g[C]+" ",F=t.widthOfTextAtSize(v,i);p-=F,p<=0&&(s+=1,p=r.width-F)}}if(!n&&s>e.length)return i-1;var Q=t.heightAtSize(i),T=Q+Q*.2,_=T*s;if(_>Math.abs(r.height))return i-1;i+=1}return i},sut=function(e,t,r,n){for(var i=r.width/n,s=r.height,u=Fpe,f=_A.charSplit(e);u<Tpe;){for(var h=0,g=f.length;h<g;h++){var p=f[h],C=t.widthOfTextAtSize(p,u)>i*.75;if(C)return u-1}var y=t.heightAtSize(u,{descender:!1});if(y>s)return u-1;u+=1}return u},out=function(e){for(var t=e.length;t>0;t--)if(/\s/.test(e[t]))return t},uut=function(e,t,r,n){for(var i,s=e.length;s>0;){var u=e.substring(0,s),f=r.encodeText(u),h=r.widthOfTextAtSize(u,n);if(h<t){var g=e.substring(s)||void 0;return{line:u,encoded:f,width:h,remainder:g}}s=(i=out(u))!==null&&i!==void 0?i:0}return{line:e,encoded:r.encodeText(e),width:r.widthOfTextAtSize(e,n),remainder:void 0}};NA.layoutMultilineText=function(e,t){var r=t.alignment,n=t.fontSize,i=t.font,s=t.bounds,u=_A.lineSplit(_A.cleanText(e));(n===void 0||n===0)&&(n=Spe(u,i,s,!0));for(var f=i.heightAtSize(n),h=f+f*.2,g=[],p=s.x,C=s.y,y=s.x+s.width,x=s.y+s.height,v=s.y+s.height,F=0,Q=u.length;F<Q;F++)for(var T=u[F];T!==void 0;){var _=uut(T,s.width,i,n),S=_.line,N=_.encoded,O=_.width,H=_.remainder,q=r===Hm.TextAlignment.Left?s.x:r===Hm.TextAlignment.Center?s.x+s.width/2-O/2:r===Hm.TextAlignment.Right?s.x+s.width-O:s.x;v-=h,q<p&&(p=q),v<C&&(C=v),q+O>y&&(y=q+O),v+f>x&&(x=v+f),g.push({text:S,encoded:N,width:O,height:f,x:q,y:v}),T=H?.trim()}return{fontSize:n,lineHeight:h,lines:g,bounds:{x:p,y:C,width:y-p,height:x-C}}};NA.layoutCombedText=function(e,t){var r=t.fontSize,n=t.font,i=t.bounds,s=t.cellCount,u=_A.mergeLines(_A.cleanText(e));if(u.length>s)throw new aut.CombedTextLayoutError(u.length,s);(r===void 0||r===0)&&(r=sut(u,n,i,s));for(var f=i.width/s,h=n.heightAtSize(r,{descender:!1}),g=i.y+(i.height/2-h/2),p=[],C=i.x,y=i.y,x=i.x+i.width,v=i.y+i.height,F=0,Q=0;F<s;){var T=_A.charAtIndex(u,Q),_=T[0],S=T[1],N=n.encodeText(_),O=n.widthOfTextAtSize(_,r),H=i.x+(f*F+f/2),q=H-O/2;q<C&&(C=q),g<y&&(y=g),q+O>x&&(x=q+O),g+h>v&&(v=g+h),p.push({text:u,encoded:N,width:O,height:h,x:q,y:g}),F+=1,Q+=S}return{fontSize:r,cells:p,bounds:{x:C,y,width:x-C,height:v-y}}};NA.layoutSinglelineText=function(e,t){var r=t.alignment,n=t.fontSize,i=t.font,s=t.bounds,u=_A.mergeLines(_A.cleanText(e));(n===void 0||n===0)&&(n=Spe([u],i,s));var f=i.encodeText(u),h=i.widthOfTextAtSize(u,n),g=i.heightAtSize(n,{descender:!1}),p=r===Hm.TextAlignment.Left?s.x:r===Hm.TextAlignment.Center?s.x+s.width/2-h/2:r===Hm.TextAlignment.Right?s.x+s.width-h:s.x,C=s.y+(s.height/2-g/2);return{fontSize:n,line:{text:u,encoded:f,width:h,height:g,x:p,y:C},bounds:{x:p,y:C,width:h,height:g}}}});var RA=U(ds=>{"use strict";Object.defineProperty(ds,"__esModule",{value:!0});ds.defaultOptionListAppearanceProvider=ds.defaultDropdownAppearanceProvider=ds.defaultTextFieldAppearanceProvider=ds.defaultButtonAppearanceProvider=ds.defaultRadioGroupAppearanceProvider=ds.defaultCheckBoxAppearanceProvider=ds.normalizeAppearance=void 0;var pr=(ct(),ze(ut)),ia=Lm(),Gn=Gu(),Vu=zo(),og=L7(),s3=jy(),cut=QA(),Qpe=fr();ds.normalizeAppearance=function(e){return"normal"in e?e:{normal:e}};var fut=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]+(\d*\.\d+|\d+)[\0\t\n\f\r\ ]+Tf/,kA=function(e){var t,r,n=(t=e.getDefaultAppearance())!==null&&t!==void 0?t:"",i=(r=Qpe.findLastMatch(n,fut).match)!==null&&r!==void 0?r:[],s=Number(i[2]);return isFinite(s)?s:void 0},lut=/(\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)/,Yu=function(e){var t,r=(t=e.getDefaultAppearance())!==null&&t!==void 0?t:"",n=Qpe.findLastMatch(r,lut).match,i=n??[],s=i[1],u=i[2],f=i[3],h=i[4],g=i[5];if(g==="g"&&s)return Gn.grayscale(Number(s));if(g==="rg"&&s&&u&&f)return Gn.rgb(Number(s),Number(u),Number(f));if(g==="k"&&s&&u&&f&&h)return Gn.cmyk(Number(s),Number(u),Number(f),Number(h))},ju=function(e,t,r,n){var i;n===void 0&&(n=0);var s=[Gn.setFillingColor(t).toString(),cut.setFontAndSize((i=r?.name)!==null&&i!==void 0?i:"dummy__noop",n).toString()].join(`
|
|
539
539
|
`);e.setDefaultAppearance(s)};ds.defaultCheckBoxAppearanceProvider=function(e,t){var r,n,i,s=Yu(t),u=Yu(e.acroField),f=t.getRectangle(),h=t.getAppearanceCharacteristics(),g=t.getBorderStyle(),p=(r=g?.getWidth())!==null&&r!==void 0?r:0,C=Vu.reduceRotation(h?.getRotation()),y=Vu.adjustDimsForRotation(f,C),x=y.width,v=y.height,F=ia.rotateInPlace(pr.__assign(pr.__assign({},f),{rotation:C})),Q=Gn.rgb(0,0,0),T=(n=Gn.componentsToColor(h?.getBorderColor()))!==null&&n!==void 0?n:Q,_=Gn.componentsToColor(h?.getBackgroundColor()),S=Gn.componentsToColor(h?.getBackgroundColor(),.8),N=(i=s??u)!==null&&i!==void 0?i:Q;ju(s?t:e.acroField,N);var O={x:0+p/2,y:0+p/2,width:x-p,height:v-p,thickness:1.5,borderWidth:p,borderColor:T,markColor:N};return{normal:{on:pr.__spreadArrays(F,ia.drawCheckBox(pr.__assign(pr.__assign({},O),{color:_,filled:!0}))),off:pr.__spreadArrays(F,ia.drawCheckBox(pr.__assign(pr.__assign({},O),{color:_,filled:!1})))},down:{on:pr.__spreadArrays(F,ia.drawCheckBox(pr.__assign(pr.__assign({},O),{color:S,filled:!0}))),off:pr.__spreadArrays(F,ia.drawCheckBox(pr.__assign(pr.__assign({},O),{color:S,filled:!1})))}}};ds.defaultRadioGroupAppearanceProvider=function(e,t){var r,n,i,s=Yu(t),u=Yu(e.acroField),f=t.getRectangle(),h=t.getAppearanceCharacteristics(),g=t.getBorderStyle(),p=(r=g?.getWidth())!==null&&r!==void 0?r:0,C=Vu.reduceRotation(h?.getRotation()),y=Vu.adjustDimsForRotation(f,C),x=y.width,v=y.height,F=ia.rotateInPlace(pr.__assign(pr.__assign({},f),{rotation:C})),Q=Gn.rgb(0,0,0),T=(n=Gn.componentsToColor(h?.getBorderColor()))!==null&&n!==void 0?n:Q,_=Gn.componentsToColor(h?.getBackgroundColor()),S=Gn.componentsToColor(h?.getBackgroundColor(),.8),N=(i=s??u)!==null&&i!==void 0?i:Q;ju(s?t:e.acroField,N);var O={x:x/2,y:v/2,width:x-p,height:v-p,borderWidth:p,borderColor:T,dotColor:N};return{normal:{on:pr.__spreadArrays(F,ia.drawRadioButton(pr.__assign(pr.__assign({},O),{color:_,filled:!0}))),off:pr.__spreadArrays(F,ia.drawRadioButton(pr.__assign(pr.__assign({},O),{color:_,filled:!1})))},down:{on:pr.__spreadArrays(F,ia.drawRadioButton(pr.__assign(pr.__assign({},O),{color:S,filled:!0}))),off:pr.__spreadArrays(F,ia.drawRadioButton(pr.__assign(pr.__assign({},O),{color:S,filled:!1})))}}};ds.defaultButtonAppearanceProvider=function(e,t,r){var n,i,s,u,f,h=Yu(t),g=Yu(e.acroField),p=kA(t),C=kA(e.acroField),y=t.getRectangle(),x=t.getAppearanceCharacteristics(),v=t.getBorderStyle(),F=x?.getCaptions(),Q=(n=F?.normal)!==null&&n!==void 0?n:"",T=(s=(i=F?.down)!==null&&i!==void 0?i:Q)!==null&&s!==void 0?s:"",_=(u=v?.getWidth())!==null&&u!==void 0?u:0,S=Vu.reduceRotation(x?.getRotation()),N=Vu.adjustDimsForRotation(y,S),O=N.width,H=N.height,q=ia.rotateInPlace(pr.__assign(pr.__assign({},y),{rotation:S})),G=Gn.rgb(0,0,0),J=Gn.componentsToColor(x?.getBorderColor()),Ie=Gn.componentsToColor(x?.getBackgroundColor()),fe=Gn.componentsToColor(x?.getBackgroundColor(),.8),z={x:_,y:_,width:O-_*2,height:H-_*2},ge=og.layoutSinglelineText(Q,{alignment:s3.TextAlignment.Center,fontSize:p??C,font:r,bounds:z}),ne=og.layoutSinglelineText(T,{alignment:s3.TextAlignment.Center,fontSize:p??C,font:r,bounds:z}),Le=Math.min(ge.fontSize,ne.fontSize),X=(f=h??g)!==null&&f!==void 0?f:G;ju(h||p!==void 0?t:e.acroField,X,r,Le);var se={x:0+_/2,y:0+_/2,width:O-_,height:H-_,borderWidth:_,borderColor:J,textColor:X,font:r.name,fontSize:Le};return{normal:pr.__spreadArrays(q,ia.drawButton(pr.__assign(pr.__assign({},se),{color:Ie,textLines:[ge.line]}))),down:pr.__spreadArrays(q,ia.drawButton(pr.__assign(pr.__assign({},se),{color:fe,textLines:[ne.line]})))}};ds.defaultTextFieldAppearanceProvider=function(e,t,r){var n,i,s,u,f=Yu(t),h=Yu(e.acroField),g=kA(t),p=kA(e.acroField),C=t.getRectangle(),y=t.getAppearanceCharacteristics(),x=t.getBorderStyle(),v=(n=e.getText())!==null&&n!==void 0?n:"",F=(i=x?.getWidth())!==null&&i!==void 0?i:0,Q=Vu.reduceRotation(y?.getRotation()),T=Vu.adjustDimsForRotation(C,Q),_=T.width,S=T.height,N=ia.rotateInPlace(pr.__assign(pr.__assign({},C),{rotation:Q})),O=Gn.rgb(0,0,0),H=Gn.componentsToColor(y?.getBorderColor()),q=Gn.componentsToColor(y?.getBackgroundColor()),G,J,Ie=e.isCombed()?0:1,fe={x:F+Ie,y:F+Ie,width:_-(F+Ie)*2,height:S-(F+Ie)*2};if(e.isMultiline()){var z=og.layoutMultilineText(v,{alignment:e.getAlignment(),fontSize:g??p,font:r,bounds:fe});G=z.lines,J=z.fontSize}else if(e.isCombed()){var z=og.layoutCombedText(v,{fontSize:g??p,font:r,bounds:fe,cellCount:(s=e.getMaxLength())!==null&&s!==void 0?s:0});G=z.cells,J=z.fontSize}else{var z=og.layoutSinglelineText(v,{alignment:e.getAlignment(),fontSize:g??p,font:r,bounds:fe});G=[z.line],J=z.fontSize}var ge=(u=f??h)!==null&&u!==void 0?u:O;ju(f||g!==void 0?t:e.acroField,ge,r,J);var ne={x:0+F/2,y:0+F/2,width:_-F,height:S-F,borderWidth:F??0,borderColor:H,textColor:ge,font:r.name,fontSize:J,color:q,textLines:G,padding:Ie};return pr.__spreadArrays(N,ia.drawTextField(ne))};ds.defaultDropdownAppearanceProvider=function(e,t,r){var n,i,s,u=Yu(t),f=Yu(e.acroField),h=kA(t),g=kA(e.acroField),p=t.getRectangle(),C=t.getAppearanceCharacteristics(),y=t.getBorderStyle(),x=(n=e.getSelected()[0])!==null&&n!==void 0?n:"",v=(i=y?.getWidth())!==null&&i!==void 0?i:0,F=Vu.reduceRotation(C?.getRotation()),Q=Vu.adjustDimsForRotation(p,F),T=Q.width,_=Q.height,S=ia.rotateInPlace(pr.__assign(pr.__assign({},p),{rotation:F})),N=Gn.rgb(0,0,0),O=Gn.componentsToColor(C?.getBorderColor()),H=Gn.componentsToColor(C?.getBackgroundColor()),q=1,G={x:v+q,y:v+q,width:T-(v+q)*2,height:_-(v+q)*2},J=og.layoutSinglelineText(x,{alignment:s3.TextAlignment.Left,fontSize:h??g,font:r,bounds:G}),Ie=J.line,fe=J.fontSize,z=(s=u??f)!==null&&s!==void 0?s:N;ju(u||h!==void 0?t:e.acroField,z,r,fe);var ge={x:0+v/2,y:0+v/2,width:T-v,height:_-v,borderWidth:v??0,borderColor:O,textColor:z,font:r.name,fontSize:fe,color:H,textLines:[Ie],padding:q};return pr.__spreadArrays(S,ia.drawTextField(ge))};ds.defaultOptionListAppearanceProvider=function(e,t,r){var n,i,s=Yu(t),u=Yu(e.acroField),f=kA(t),h=kA(e.acroField),g=t.getRectangle(),p=t.getAppearanceCharacteristics(),C=t.getBorderStyle(),y=(n=C?.getWidth())!==null&&n!==void 0?n:0,x=Vu.reduceRotation(p?.getRotation()),v=Vu.adjustDimsForRotation(g,x),F=v.width,Q=v.height,T=ia.rotateInPlace(pr.__assign(pr.__assign({},g),{rotation:x})),_=Gn.rgb(0,0,0),S=Gn.componentsToColor(p?.getBorderColor()),N=Gn.componentsToColor(p?.getBackgroundColor()),O=e.getOptions(),H=e.getSelected();e.isSorted()&&O.sort();for(var q="",G=0,J=O.length;G<J;G++)q+=O[G],G<J-1&&(q+=`
|
|
540
540
|
`);for(var Ie=1,fe={x:y+Ie,y:y+Ie,width:F-(y+Ie)*2,height:Q-(y+Ie)*2},z=og.layoutMultilineText(q,{alignment:s3.TextAlignment.Left,fontSize:f??h,font:r,bounds:fe}),ge=z.lines,ne=z.fontSize,Le=z.lineHeight,X=[],G=0,J=ge.length;G<J;G++){var se=ge[G];H.includes(se.text)&&X.push(G)}var j=Gn.rgb(153/255,193/255,218/255),Y=(i=s??u)!==null&&i!==void 0?i:_;return ju(s||f!==void 0?t:e.acroField,Y,r,ne),pr.__spreadArrays(T,ia.drawOptionList({x:0+y/2,y:0+y/2,width:F-y,height:Q-y,borderWidth:y??0,borderColor:S,textColor:Y,font:r.name,fontSize:ne,color:N,textLines:ge,lineHeight:Le,selectedColor:j,selectedLines:X,padding:Ie}))}});var u3=U(H7=>{"use strict";Object.defineProperty(H7,"__esModule",{value:!0});var P7=(ct(),ze(ut)),Aut=P7.__importDefault(UA()),_pe=Xi(),o3=fr(),dut=(function(){function e(t,r,n){this.alreadyEmbedded=!1,o3.assertIs(t,"ref",[[_pe.PDFRef,"PDFRef"]]),o3.assertIs(r,"doc",[[Aut.default,"PDFDocument"]]),o3.assertIs(n,"embedder",[[_pe.PDFPageEmbedder,"PDFPageEmbedder"]]),this.ref=t,this.doc=r,this.width=n.width,this.height=n.height,this.embedder=n}return e.prototype.scale=function(t){return o3.assertIs(t,"factor",["number"]),{width:this.width*t,height:this.height*t}},e.prototype.size=function(){return this.scale(1)},e.prototype.embed=function(){return P7.__awaiter(this,void 0,void 0,function(){return P7.__generator(this,function(t){switch(t.label){case 0:return this.alreadyEmbedded?[3,2]:[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:t.sent(),this.alreadyEmbedded=!0,t.label=2;case 2:return[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();H7.default=dut});var $f=U(W7=>{"use strict";Object.defineProperty(W7,"__esModule",{value:!0});var q7=(ct(),ze(ut)),hut=q7.__importDefault(UA()),c3=Xi(),Zf=fr(),gut=(function(){function e(t,r,n){this.modified=!0,Zf.assertIs(t,"ref",[[c3.PDFRef,"PDFRef"]]),Zf.assertIs(r,"doc",[[hut.default,"PDFDocument"]]),Zf.assertIs(n,"embedder",[[c3.CustomFontEmbedder,"CustomFontEmbedder"],[c3.StandardFontEmbedder,"StandardFontEmbedder"]]),this.ref=t,this.doc=r,this.name=n.fontName,this.embedder=n}return e.prototype.encodeText=function(t){return Zf.assertIs(t,"text",["string"]),this.modified=!0,this.embedder.encodeText(t)},e.prototype.widthOfTextAtSize=function(t,r){return Zf.assertIs(t,"text",["string"]),Zf.assertIs(r,"size",["number"]),this.embedder.widthOfTextAtSize(t,r)},e.prototype.heightAtSize=function(t,r){var n;return Zf.assertIs(t,"size",["number"]),Zf.assertOrUndefined(r?.descender,"options.descender",["boolean"]),this.embedder.heightOfFontAtSize(t,{descender:(n=r?.descender)!==null&&n!==void 0?n:!0})},e.prototype.sizeAtHeight=function(t){return Zf.assertIs(t,"height",["number"]),this.embedder.sizeOfFontAtHeight(t)},e.prototype.getCharacterSet=function(){return this.embedder instanceof c3.StandardFontEmbedder?this.embedder.encoding.supportedCodePoints:this.embedder.font.characterSet},e.prototype.embed=function(){return q7.__awaiter(this,void 0,void 0,function(){return q7.__generator(this,function(t){switch(t.label){case 0:return this.modified?[4,this.embedder.embedIntoContext(this.doc.context,this.ref)]:[3,2];case 1:t.sent(),this.modified=!1,t.label=2;case 2:return[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();W7.default=gut});var f3=U(Y7=>{"use strict";Object.defineProperty(Y7,"__esModule",{value:!0});var V7=(ct(),ze(ut)),put=V7.__importDefault(UA()),G7=Xi(),qm=fr(),mut=(function(){function e(t,r,n){qm.assertIs(t,"ref",[[G7.PDFRef,"PDFRef"]]),qm.assertIs(r,"doc",[[put.default,"PDFDocument"]]),qm.assertIs(n,"embedder",[[G7.JpegEmbedder,"JpegEmbedder"],[G7.PngEmbedder,"PngEmbedder"]]),this.ref=t,this.doc=r,this.width=n.width,this.height=n.height,this.embedder=n}return e.prototype.scale=function(t){return qm.assertIs(t,"factor",["number"]),{width:this.width*t,height:this.height*t}},e.prototype.scaleToFit=function(t,r){qm.assertIs(t,"width",["number"]),qm.assertIs(r,"height",["number"]);var n=t/this.width,i=r/this.height,s=Math.min(n,i);return this.scale(s)},e.prototype.size=function(){return this.scale(1)},e.prototype.embed=function(){return V7.__awaiter(this,void 0,void 0,function(){var t,r,n;return V7.__generator(this,function(i){switch(i.label){case 0:return this.embedder?(this.embedTask||(t=this,r=t.doc,n=t.ref,this.embedTask=this.embedder.embedIntoContext(r.context,n)),[4,this.embedTask]):[2];case 1:return i.sent(),this.embedder=void 0,[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();Y7.default=mut});var l3=U(Jy=>{"use strict";Object.defineProperty(Jy,"__esModule",{value:!0});Jy.ImageAlignment=void 0;var Eut;(function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"})(Eut=Jy.ImageAlignment||(Jy.ImageAlignment={}))});var J7=U(j7=>{"use strict";Object.defineProperty(j7,"__esModule",{value:!0});var but=(ct(),ze(ut));but.__exportStar(l3(),j7)});var el=U(Xy=>{"use strict";Object.defineProperty(Xy,"__esModule",{value:!0});Xy.assertFieldAppearanceOptions=void 0;var A3=(ct(),ze(ut)),Cut=A3.__importDefault(UA()),X7=Gu(),ug=zo(),va=Xi(),Zo=fr(),Npe=J7(),kpe=Lm();Xy.assertFieldAppearanceOptions=function(e){Zo.assertOrUndefined(e?.x,"options.x",["number"]),Zo.assertOrUndefined(e?.y,"options.y",["number"]),Zo.assertOrUndefined(e?.width,"options.width",["number"]),Zo.assertOrUndefined(e?.height,"options.height",["number"]),Zo.assertOrUndefined(e?.textColor,"options.textColor",[[Object,"Color"]]),Zo.assertOrUndefined(e?.backgroundColor,"options.backgroundColor",[[Object,"Color"]]),Zo.assertOrUndefined(e?.borderColor,"options.borderColor",[[Object,"Color"]]),Zo.assertOrUndefined(e?.borderWidth,"options.borderWidth",["number"]),Zo.assertOrUndefined(e?.rotate,"options.rotate",[[Object,"Rotation"]])};var yut=(function(){function e(t,r,n){Zo.assertIs(t,"acroField",[[va.PDFAcroTerminal,"PDFAcroTerminal"]]),Zo.assertIs(r,"ref",[[va.PDFRef,"PDFRef"]]),Zo.assertIs(n,"doc",[[Cut.default,"PDFDocument"]]),this.acroField=t,this.ref=r,this.doc=n}return e.prototype.getName=function(){var t;return(t=this.acroField.getFullyQualifiedName())!==null&&t!==void 0?t:""},e.prototype.isReadOnly=function(){return this.acroField.hasFlag(va.AcroFieldFlags.ReadOnly)},e.prototype.enableReadOnly=function(){this.acroField.setFlagTo(va.AcroFieldFlags.ReadOnly,!0)},e.prototype.disableReadOnly=function(){this.acroField.setFlagTo(va.AcroFieldFlags.ReadOnly,!1)},e.prototype.isRequired=function(){return this.acroField.hasFlag(va.AcroFieldFlags.Required)},e.prototype.enableRequired=function(){this.acroField.setFlagTo(va.AcroFieldFlags.Required,!0)},e.prototype.disableRequired=function(){this.acroField.setFlagTo(va.AcroFieldFlags.Required,!1)},e.prototype.isExported=function(){return!this.acroField.hasFlag(va.AcroFieldFlags.NoExport)},e.prototype.enableExporting=function(){this.acroField.setFlagTo(va.AcroFieldFlags.NoExport,!1)},e.prototype.disableExporting=function(){this.acroField.setFlagTo(va.AcroFieldFlags.NoExport,!0)},e.prototype.needsAppearancesUpdate=function(){throw new va.MethodNotImplementedError(this.constructor.name,"needsAppearancesUpdate")},e.prototype.defaultUpdateAppearances=function(t){throw new va.MethodNotImplementedError(this.constructor.name,"defaultUpdateAppearances")},e.prototype.markAsDirty=function(){this.doc.getForm().markFieldAsDirty(this.ref)},e.prototype.markAsClean=function(){this.doc.getForm().markFieldAsClean(this.ref)},e.prototype.isDirty=function(){return this.doc.getForm().fieldIsDirty(this.ref)},e.prototype.createWidget=function(t){var r,n=t.textColor,i=t.backgroundColor,s=t.borderColor,u=t.borderWidth,f=ug.toDegrees(t.rotate),h=t.caption,g=t.x,p=t.y,C=t.width+u,y=t.height+u,x=!!t.hidden,v=t.page;Zo.assertMultiple(f,"degreesAngle",90);var F=va.PDFWidgetAnnotation.create(this.doc.context,this.ref),Q=ug.rotateRectangle({x:g,y:p,width:C,height:y},u,f);F.setRectangle(Q),v&&F.setP(v);var T=F.getOrCreateAppearanceCharacteristics();i&&T.setBackgroundColor(X7.colorToComponents(i)),T.setRotation(f),h&&T.setCaptions({normal:h}),s&&T.setBorderColor(X7.colorToComponents(s));var _=F.getOrCreateBorderStyle();if(u!==void 0&&_.setWidth(u),F.setFlagTo(va.AnnotationFlags.Print,!0),F.setFlagTo(va.AnnotationFlags.Hidden,x),F.setFlagTo(va.AnnotationFlags.Invisible,!1),n){var S=(r=this.acroField.getDefaultAppearance())!==null&&r!==void 0?r:"",N=S+`
|
|
541
|
-
`+X7.setFillingColor(n).toString();this.acroField.setDefaultAppearance(N)}return F},e.prototype.updateWidgetAppearanceWithFont=function(t,r,n){var i=n.normal,s=n.rollover,u=n.down;this.updateWidgetAppearances(t,{normal:this.createAppearanceStream(t,i,r),rollover:s&&this.createAppearanceStream(t,s,r),down:u&&this.createAppearanceStream(t,u,r)})},e.prototype.updateOnOffWidgetAppearance=function(t,r,n){var i=n.normal,s=n.rollover,u=n.down;this.updateWidgetAppearances(t,{normal:this.createAppearanceDict(t,i,r),rollover:s&&this.createAppearanceDict(t,s,r),down:u&&this.createAppearanceDict(t,u,r)})},e.prototype.updateWidgetAppearances=function(t,r){var n=r.normal,i=r.rollover,s=r.down;t.setNormalAppearance(n),i?t.setRolloverAppearance(i):t.removeRolloverAppearance(),s?t.setDownAppearance(s):t.removeDownAppearance()},e.prototype.createAppearanceStream=function(t,r,n){var i,s=this.acroField.dict.context,u=t.getRectangle(),f=u.width,h=u.height,g=n&&{Font:(i={},i[n.name]=n.ref,i)},p=s.formXObject(r,{Resources:g,BBox:s.obj([0,0,f,h]),Matrix:s.obj([1,0,0,1,0,0])}),C=s.register(p);return C},e.prototype.createImageAppearanceStream=function(t,r,n){var i,s,u=this.acroField.dict.context,f=t.getRectangle(),h=t.getAppearanceCharacteristics(),g=t.getBorderStyle(),p=(s=g?.getWidth())!==null&&s!==void 0?s:0,C=ug.reduceRotation(h?.getRotation()),y=kpe.rotateInPlace(A3.__assign(A3.__assign({},f),{rotation:C})),x=ug.adjustDimsForRotation(f,C),v=r.scaleToFit(x.width-p*2,x.height-p*2),F={x:p,y:p,width:v.width,height:v.height,rotate:ug.degrees(0),xSkew:ug.degrees(0),ySkew:ug.degrees(0)};n===Npe.ImageAlignment.Center?(F.x+=(x.width-p*2)/2-v.width/2,F.y+=(x.height-p*2)/2-v.height/2):n===Npe.ImageAlignment.Right&&(F.x=x.width-p-v.width,F.y=x.height-p-v.height);var Q=this.doc.context.addRandomSuffix("Image",10),T=A3.__spreadArrays(y,kpe.drawImage(Q,F)),_={XObject:(i={},i[Q]=r.ref,i)},S=u.formXObject(T,{Resources:_,BBox:u.obj([0,0,f.width,f.height]),Matrix:u.obj([1,0,0,1,0,0])});return u.register(S)},e.prototype.createAppearanceDict=function(t,r,n){var i=this.acroField.dict.context,s=this.createAppearanceStream(t,r.on),u=this.createAppearanceStream(t,r.off),f=i.obj({});return f.set(n,s),f.set(va.PDFName.of("Off"),u),f},e})();Xy.default=yut});var eP=U($7=>{"use strict";Object.defineProperty($7,"__esModule",{value:!0});var Z7=(ct(),ze(ut)),xut=Z7.__importDefault(tl()),Rpe=RA(),K7=Gu(),vut=zo(),Upe=Z7.__importStar(el()),cg=Xi(),z7=fr(),Iut=(function(e){Z7.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return z7.assertIs(r,"acroCheckBox",[[cg.PDFAcroCheckBox,"PDFAcroCheckBox"]]),s.acroField=r,s}return t.prototype.check=function(){var r,n=(r=this.acroField.getOnValue())!==null&&r!==void 0?r:cg.PDFName.of("Yes");this.markAsDirty(),this.acroField.setValue(n)},t.prototype.uncheck=function(){this.markAsDirty(),this.acroField.setValue(cg.PDFName.of("Off"))},t.prototype.isChecked=function(){var r=this.acroField.getOnValue();return!!r&&r===this.acroField.getValue()},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g;z7.assertIs(r,"page",[[xut.default,"PDFPage"]]),Upe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=K7.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=K7.rgb(1,1,1)),"borderColor"in n||(n.borderColor=K7.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var p=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:50,height:(f=n.height)!==null&&f!==void 0?f:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:vut.degrees(0),hidden:n.hidden,page:r.ref}),C=this.doc.context.register(p.dict);this.acroField.addWidget(C),p.setAppearanceState(cg.PDFName.of("Off")),this.updateWidgetAppearance(p,cg.PDFName.of("Yes")),r.node.addAnnot(C)},t.prototype.needsAppearancesUpdate=function(){for(var r,n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=u.getAppearanceState(),h=(r=u.getAppearances())===null||r===void 0?void 0:r.normal;if(!(h instanceof cg.PDFDict)||f&&!h.has(f))return!0}return!1},t.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},t.prototype.updateAppearances=function(r){var n;z7.assertOrUndefined(r,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s],h=(n=f.getOnValue())!==null&&n!==void 0?n:cg.PDFName.of("Yes");h&&this.updateWidgetAppearance(f,h,r)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Rpe.defaultCheckBoxAppearanceProvider,u=Rpe.normalizeAppearance(s(this,r));this.updateOnOffWidgetAppearance(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Upe.default);$7.default=Iut});var nP=U(rP=>{"use strict";Object.defineProperty(rP,"__esModule",{value:!0});var d3=(ct(),ze(ut)),Dut=d3.__importDefault(tl()),Mpe=d3.__importDefault($f()),Ope=d3.__importStar(el()),Lpe=RA(),tP=Gu(),But=zo(),Ki=Xi(),R0=fr(),wut=(function(e){d3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return R0.assertIs(r,"acroComboBox",[[Ki.PDFAcroComboBox,"PDFAcroComboBox"]]),s.acroField=r,s}return t.prototype.getOptions=function(){for(var r=this.acroField.getOptions(),n=new Array(r.length),i=0,s=n.length;i<s;i++){var u=r[i],f=u.display,h=u.value;n[i]=(f??h).decodeText()}return n},t.prototype.getSelected=function(){for(var r=this.acroField.getValues(),n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=r[i].decodeText();return n},t.prototype.setOptions=function(r){R0.assertIs(r,"options",[Array]);for(var n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]={value:Ki.PDFHexString.fromText(r[i])};this.acroField.setOptions(n)},t.prototype.addOptions=function(r){R0.assertIs(r,"options",["string",Array]);for(var n=Array.isArray(r)?r:[r],i=this.acroField.getOptions(),s=new Array(n.length),u=0,f=n.length;u<f;u++)s[u]={value:Ki.PDFHexString.fromText(n[u])};this.acroField.setOptions(i.concat(s))},t.prototype.select=function(r,n){n===void 0&&(n=!1),R0.assertIs(r,"options",["string",Array]),R0.assertIs(n,"merge",["boolean"]);var i=Array.isArray(r)?r:[r],s=this.getOptions(),u=i.find(function(C){return!s.includes(C)});u&&this.enableEditing(),this.markAsDirty(),(i.length>1||i.length===1&&n)&&this.enableMultiselect();for(var f=new Array(i.length),h=0,g=i.length;h<g;h++)f[h]=Ki.PDFHexString.fromText(i[h]);if(n){var p=this.acroField.getValues();this.acroField.setValues(p.concat(f))}else this.acroField.setValues(f)},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},t.prototype.setFontSize=function(r){R0.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.isEditable=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.Edit)},t.prototype.enableEditing=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Edit,!0)},t.prototype.disableEditing=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Edit,!1)},t.prototype.isSorted=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.Sort)},t.prototype.enableSorting=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Sort,!0)},t.prototype.disableSorting=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Sort,!1)},t.prototype.isMultiselect=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.MultiSelect)},t.prototype.enableMultiselect=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.MultiSelect,!0)},t.prototype.disableMultiselect=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.MultiSelect,!1)},t.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(Ki.AcroChoiceFlags.DoNotSpellCheck)},t.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.DoNotSpellCheck,!1)},t.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.DoNotSpellCheck,!0)},t.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.CommitOnSelChange)},t.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.CommitOnSelChange,!0)},t.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.CommitOnSelChange,!1)},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g,p;R0.assertIs(r,"page",[[Dut.default,"PDFPage"]]),Ope.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=tP.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=tP.rgb(1,1,1)),"borderColor"in n||(n.borderColor=tP.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var C=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:200,height:(f=n.height)!==null&&f!==void 0?f:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:But.degrees(0),hidden:n.hidden,page:r.ref}),y=this.doc.context.register(C.dict);this.acroField.addWidget(y);var x=(p=n.font)!==null&&p!==void 0?p:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(C,x),r.node.addAnnot(y)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof Ki.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){R0.assertIs(r,"font",[[Mpe.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){R0.assertIs(r,"font",[[Mpe.default,"PDFFont"]]),R0.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Lpe.defaultDropdownAppearanceProvider,u=Lpe.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Ope.default);rP.default=wut});var sP=U(aP=>{"use strict";Object.defineProperty(aP,"__esModule",{value:!0});var h3=(ct(),ze(ut)),Fut=h3.__importDefault(tl()),Ppe=h3.__importDefault($f()),Hpe=h3.__importStar(el()),qpe=RA(),iP=Gu(),Tut=zo(),bo=Xi(),Nc=fr(),Sut=(function(e){h3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Nc.assertIs(r,"acroListBox",[[bo.PDFAcroListBox,"PDFAcroListBox"]]),s.acroField=r,s}return t.prototype.getOptions=function(){for(var r=this.acroField.getOptions(),n=new Array(r.length),i=0,s=n.length;i<s;i++){var u=r[i],f=u.display,h=u.value;n[i]=(f??h).decodeText()}return n},t.prototype.getSelected=function(){for(var r=this.acroField.getValues(),n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=r[i].decodeText();return n},t.prototype.setOptions=function(r){Nc.assertIs(r,"options",[Array]),this.markAsDirty();for(var n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]={value:bo.PDFHexString.fromText(r[i])};this.acroField.setOptions(n)},t.prototype.addOptions=function(r){Nc.assertIs(r,"options",["string",Array]),this.markAsDirty();for(var n=Array.isArray(r)?r:[r],i=this.acroField.getOptions(),s=new Array(n.length),u=0,f=n.length;u<f;u++)s[u]={value:bo.PDFHexString.fromText(n[u])};this.acroField.setOptions(i.concat(s))},t.prototype.select=function(r,n){n===void 0&&(n=!1),Nc.assertIs(r,"options",["string",Array]),Nc.assertIs(n,"merge",["boolean"]);var i=Array.isArray(r)?r:[r],s=this.getOptions();Nc.assertIsSubset(i,"option",s),this.markAsDirty(),(i.length>1||i.length===1&&n)&&this.enableMultiselect();for(var u=new Array(i.length),f=0,h=i.length;f<h;f++)u[f]=bo.PDFHexString.fromText(i[f]);if(n){var g=this.acroField.getValues();this.acroField.setValues(g.concat(u))}else this.acroField.setValues(u)},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},t.prototype.setFontSize=function(r){Nc.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.isSorted=function(){return this.acroField.hasFlag(bo.AcroChoiceFlags.Sort)},t.prototype.enableSorting=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.Sort,!0)},t.prototype.disableSorting=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.Sort,!1)},t.prototype.isMultiselect=function(){return this.acroField.hasFlag(bo.AcroChoiceFlags.MultiSelect)},t.prototype.enableMultiselect=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.MultiSelect,!0)},t.prototype.disableMultiselect=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.MultiSelect,!1)},t.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(bo.AcroChoiceFlags.CommitOnSelChange)},t.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.CommitOnSelChange,!0)},t.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.CommitOnSelChange,!1)},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g,p;Nc.assertIs(r,"page",[[Fut.default,"PDFPage"]]),Hpe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=iP.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=iP.rgb(1,1,1)),"borderColor"in n||(n.borderColor=iP.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var C=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:200,height:(f=n.height)!==null&&f!==void 0?f:100,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:Tut.degrees(0),hidden:n.hidden,page:r.ref}),y=this.doc.context.register(C.dict);this.acroField.addWidget(y);var x=(p=n.font)!==null&&p!==void 0?p:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(C,x),r.node.addAnnot(y)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof bo.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){Nc.assertIs(r,"font",[[Ppe.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){Nc.assertIs(r,"font",[[Ppe.default,"PDFFont"]]),Nc.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??qpe.defaultOptionListAppearanceProvider,u=qpe.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Hpe.default);aP.default=Sut});var fP=U(cP=>{"use strict";Object.defineProperty(cP,"__esModule",{value:!0});var uP=(ct(),ze(ut)),Qut=uP.__importDefault(tl()),Wpe=uP.__importStar(el()),Gpe=RA(),oP=Gu(),_ut=zo(),Ju=Xi(),Wm=fr(),Nut=(function(e){uP.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Wm.assertIs(r,"acroRadioButton",[[Ju.PDFAcroRadioButton,"PDFAcroRadioButton"]]),s.acroField=r,s}return t.prototype.getOptions=function(){var r=this.acroField.getExportValues();if(r){for(var n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=r[i].decodeText();return n}for(var u=this.acroField.getOnValues(),f=new Array(u.length),i=0,s=f.length;i<s;i++)f[i]=u[i].decodeText();return f},t.prototype.getSelected=function(){var r=this.acroField.getValue();if(r!==Ju.PDFName.of("Off")){var n=this.acroField.getExportValues();if(n){for(var i=this.acroField.getOnValues(),s=0,u=i.length;s<u;s++)if(i[s]===r)return n[s].decodeText()}return r.decodeText()}},t.prototype.select=function(r){Wm.assertIs(r,"option",["string"]);var n=this.getOptions();Wm.assertIsOneOf(r,"option",n),this.markAsDirty();var i=this.acroField.getOnValues(),s=this.acroField.getExportValues();if(s)for(var u=0,f=s.length;u<f;u++)s[u].decodeText()===r&&this.acroField.setValue(i[u]);else for(var u=0,f=i.length;u<f;u++){var h=i[u];h.decodeText()===r&&this.acroField.setValue(h)}},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValue(Ju.PDFName.of("Off"))},t.prototype.isOffToggleable=function(){return!this.acroField.hasFlag(Ju.AcroButtonFlags.NoToggleToOff)},t.prototype.enableOffToggling=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.NoToggleToOff,!1)},t.prototype.disableOffToggling=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.NoToggleToOff,!0)},t.prototype.isMutuallyExclusive=function(){return!this.acroField.hasFlag(Ju.AcroButtonFlags.RadiosInUnison)},t.prototype.enableMutualExclusion=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.RadiosInUnison,!1)},t.prototype.disableMutualExclusion=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.RadiosInUnison,!0)},t.prototype.addOptionToPage=function(r,n,i){var s,u,f,h,g,p,C,y,x;Wm.assertIs(r,"option",["string"]),Wm.assertIs(n,"page",[[Qut.default,"PDFPage"]]),Wpe.assertFieldAppearanceOptions(i);var v=this.createWidget({x:(s=i?.x)!==null&&s!==void 0?s:0,y:(u=i?.y)!==null&&u!==void 0?u:0,width:(f=i?.width)!==null&&f!==void 0?f:50,height:(h=i?.height)!==null&&h!==void 0?h:50,textColor:(g=i?.textColor)!==null&&g!==void 0?g:oP.rgb(0,0,0),backgroundColor:(p=i?.backgroundColor)!==null&&p!==void 0?p:oP.rgb(1,1,1),borderColor:(C=i?.borderColor)!==null&&C!==void 0?C:oP.rgb(0,0,0),borderWidth:(y=i?.borderWidth)!==null&&y!==void 0?y:1,rotate:(x=i?.rotate)!==null&&x!==void 0?x:_ut.degrees(0),hidden:i?.hidden,page:n.ref}),F=this.doc.context.register(v.dict),Q=this.acroField.addWidgetWithOpt(F,Ju.PDFHexString.fromText(r),!this.isMutuallyExclusive());v.setAppearanceState(Ju.PDFName.of("Off")),this.updateWidgetAppearance(v,Q),n.node.addAnnot(F)},t.prototype.needsAppearancesUpdate=function(){for(var r,n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=u.getAppearanceState(),h=(r=u.getAppearances())===null||r===void 0?void 0:r.normal;if(!(h instanceof Ju.PDFDict)||f&&!h.has(f))return!0}return!1},t.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},t.prototype.updateAppearances=function(r){Wm.assertOrUndefined(r,"provider",[Function]);for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=u.getOnValue();f&&this.updateWidgetAppearance(u,f,r)}},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Gpe.defaultRadioGroupAppearanceProvider,u=Gpe.normalizeAppearance(s(this,r));this.updateOnOffWidgetAppearance(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Wpe.default);cP.default=Nut});var AP=U(lP=>{"use strict";Object.defineProperty(lP,"__esModule",{value:!0});var Vpe=(ct(),ze(ut)),kut=Vpe.__importDefault(el()),Rut=Xi(),Uut=fr(),Mut=(function(e){Vpe.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Uut.assertIs(r,"acroSignature",[[Rut.PDFAcroSignature,"PDFAcroSignature"]]),s.acroField=r,s}return t.prototype.needsAppearancesUpdate=function(){return!1},t.of=function(r,n,i){return new t(r,n,i)},t})(kut.default);lP.default=Mut});var mP=U(pP=>{"use strict";Object.defineProperty(pP,"__esModule",{value:!0});var g3=(ct(),ze(ut)),Out=g3.__importDefault(tl()),Ype=g3.__importDefault($f()),jpe=g3.__importStar(el()),Jpe=RA(),dP=Gu(),Lut=zo(),hP=Pm(),gP=l3(),fg=jy(),si=Xi(),rl=fr(),Put=(function(e){g3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return rl.assertIs(r,"acroText",[[si.PDFAcroText,"PDFAcroText"]]),s.acroField=r,s}return t.prototype.getText=function(){var r=this.acroField.getValue();if(!r&&this.isRichFormatted())throw new hP.RichTextFieldReadError(this.getName());return r?.decodeText()},t.prototype.setText=function(r){rl.assertOrUndefined(r,"text",["string"]);var n=this.getMaxLength();if(n!==void 0&&r&&r.length>n)throw new hP.ExceededMaxLengthError(r.length,n,this.getName());this.markAsDirty(),this.disableRichFormatting(),r?this.acroField.setValue(si.PDFHexString.fromText(r)):this.acroField.removeValue()},t.prototype.getAlignment=function(){var r=this.acroField.getQuadding();return r===0?fg.TextAlignment.Left:r===1?fg.TextAlignment.Center:r===2?fg.TextAlignment.Right:fg.TextAlignment.Left},t.prototype.setAlignment=function(r){rl.assertIsOneOf(r,"alignment",fg.TextAlignment),this.markAsDirty(),this.acroField.setQuadding(r)},t.prototype.getMaxLength=function(){return this.acroField.getMaxLength()},t.prototype.setMaxLength=function(r){if(rl.assertRangeOrUndefined(r,"maxLength",0,Number.MAX_SAFE_INTEGER),this.markAsDirty(),r===void 0)this.acroField.removeMaxLength();else{var n=this.getText();if(n&&n.length>r)throw new hP.InvalidMaxLengthError(n.length,r,this.getName());this.acroField.setMaxLength(r)}},t.prototype.removeMaxLength=function(){this.markAsDirty(),this.acroField.removeMaxLength()},t.prototype.setImage=function(r){for(var n=this.getAlignment(),i=n===fg.TextAlignment.Center?gP.ImageAlignment.Center:n===fg.TextAlignment.Right?gP.ImageAlignment.Right:gP.ImageAlignment.Left,s=this.acroField.getWidgets(),u=0,f=s.length;u<f;u++){var h=s[u],g=this.createImageAppearanceStream(h,r,i);this.updateWidgetAppearances(h,{normal:g})}this.markAsClean()},t.prototype.setFontSize=function(r){rl.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.isMultiline=function(){return this.acroField.hasFlag(si.AcroTextFlags.Multiline)},t.prototype.enableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(si.AcroTextFlags.Multiline,!0)},t.prototype.disableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(si.AcroTextFlags.Multiline,!1)},t.prototype.isPassword=function(){return this.acroField.hasFlag(si.AcroTextFlags.Password)},t.prototype.enablePassword=function(){this.acroField.setFlagTo(si.AcroTextFlags.Password,!0)},t.prototype.disablePassword=function(){this.acroField.setFlagTo(si.AcroTextFlags.Password,!1)},t.prototype.isFileSelector=function(){return this.acroField.hasFlag(si.AcroTextFlags.FileSelect)},t.prototype.enableFileSelection=function(){this.acroField.setFlagTo(si.AcroTextFlags.FileSelect,!0)},t.prototype.disableFileSelection=function(){this.acroField.setFlagTo(si.AcroTextFlags.FileSelect,!1)},t.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(si.AcroTextFlags.DoNotSpellCheck)},t.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotSpellCheck,!1)},t.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotSpellCheck,!0)},t.prototype.isScrollable=function(){return!this.acroField.hasFlag(si.AcroTextFlags.DoNotScroll)},t.prototype.enableScrolling=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotScroll,!1)},t.prototype.disableScrolling=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotScroll,!0)},t.prototype.isCombed=function(){return this.acroField.hasFlag(si.AcroTextFlags.Comb)&&!this.isMultiline()&&!this.isPassword()&&!this.isFileSelector()&&this.getMaxLength()!==void 0},t.prototype.enableCombing=function(){if(this.getMaxLength()===void 0){var r="PDFTextFields must have a max length in order to be combed";console.warn(r)}this.markAsDirty(),this.disableMultiline(),this.disablePassword(),this.disableFileSelection(),this.acroField.setFlagTo(si.AcroTextFlags.Comb,!0)},t.prototype.disableCombing=function(){this.markAsDirty(),this.acroField.setFlagTo(si.AcroTextFlags.Comb,!1)},t.prototype.isRichFormatted=function(){return this.acroField.hasFlag(si.AcroTextFlags.RichText)},t.prototype.enableRichFormatting=function(){this.acroField.setFlagTo(si.AcroTextFlags.RichText,!0)},t.prototype.disableRichFormatting=function(){this.acroField.setFlagTo(si.AcroTextFlags.RichText,!1)},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g,p;rl.assertIs(r,"page",[[Out.default,"PDFPage"]]),jpe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=dP.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=dP.rgb(1,1,1)),"borderColor"in n||(n.borderColor=dP.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var C=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:200,height:(f=n.height)!==null&&f!==void 0?f:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:Lut.degrees(0),hidden:n.hidden,page:r.ref}),y=this.doc.context.register(C.dict);this.acroField.addWidget(y);var x=(p=n.font)!==null&&p!==void 0?p:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(C,x),r.node.addAnnot(y)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof si.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){rl.assertIs(r,"font",[[Ype.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){rl.assertIs(r,"font",[[Ype.default,"PDFFont"]]),rl.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Jpe.defaultTextFieldAppearanceProvider,u=Jpe.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(jpe.default);pP.default=Put});var p3=U(Ky=>{"use strict";Object.defineProperty(Ky,"__esModule",{value:!0});Ky.StandardFonts=void 0;var Hut;(function(e){e.Courier="Courier",e.CourierBold="Courier-Bold",e.CourierOblique="Courier-Oblique",e.CourierBoldOblique="Courier-BoldOblique",e.Helvetica="Helvetica",e.HelveticaBold="Helvetica-Bold",e.HelveticaOblique="Helvetica-Oblique",e.HelveticaBoldOblique="Helvetica-BoldOblique",e.TimesRoman="Times-Roman",e.TimesRomanBold="Times-Bold",e.TimesRomanItalic="Times-Italic",e.TimesRomanBoldItalic="Times-BoldItalic",e.Symbol="Symbol",e.ZapfDingbats="ZapfDingbats"})(Hut=Ky.StandardFonts||(Ky.StandardFonts={}))});var CP=U(bP=>{"use strict";Object.defineProperty(bP,"__esModule",{value:!0});var Xu=(ct(),ze(ut)),qut=Xu.__importDefault(UA()),E3=Xu.__importDefault(yP()),zy=Xu.__importDefault(eP()),b3=Xu.__importDefault(nP()),C3=Xu.__importDefault(sP()),Zy=Xu.__importDefault(fP()),EP=Xu.__importDefault(AP()),y3=Xu.__importDefault(mP()),kc=Pm(),Wut=Xu.__importDefault($f()),Gut=p3(),Vut=Lm(),m3=QA(),In=Xi(),Fi=fr(),Yut=(function(){function e(t,r){var n=this;this.embedDefaultFont=function(){return n.doc.embedStandardFont(Gut.StandardFonts.Helvetica)},Fi.assertIs(t,"acroForm",[[In.PDFAcroForm,"PDFAcroForm"]]),Fi.assertIs(r,"doc",[[qut.default,"PDFDocument"]]),this.acroForm=t,this.doc=r,this.dirtyFields=new Set,this.defaultFontCache=Fi.Cache.populatedBy(this.embedDefaultFont)}return e.prototype.hasXFA=function(){return this.acroForm.dict.has(In.PDFName.of("XFA"))},e.prototype.deleteXFA=function(){this.acroForm.dict.delete(In.PDFName.of("XFA"))},e.prototype.getFields=function(){for(var t=this.acroForm.getAllFields(),r=[],n=0,i=t.length;n<i;n++){var s=t[n],u=s[0],f=s[1],h=jut(u,f,this.doc);h&&r.push(h)}return r},e.prototype.getFieldMaybe=function(t){Fi.assertIs(t,"name",["string"]);for(var r=this.getFields(),n=0,i=r.length;n<i;n++){var s=r[n];if(s.getName()===t)return s}},e.prototype.getField=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getFieldMaybe(t);if(r)return r;throw new kc.NoSuchFieldError(t)},e.prototype.getButton=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof E3.default)return r;throw new kc.UnexpectedFieldTypeError(t,E3.default,r)},e.prototype.getCheckBox=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof zy.default)return r;throw new kc.UnexpectedFieldTypeError(t,zy.default,r)},e.prototype.getDropdown=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof b3.default)return r;throw new kc.UnexpectedFieldTypeError(t,b3.default,r)},e.prototype.getOptionList=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof C3.default)return r;throw new kc.UnexpectedFieldTypeError(t,C3.default,r)},e.prototype.getRadioGroup=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof Zy.default)return r;throw new kc.UnexpectedFieldTypeError(t,Zy.default,r)},e.prototype.getSignature=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof EP.default)return r;throw new kc.UnexpectedFieldTypeError(t,EP.default,r)},e.prototype.getTextField=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof y3.default)return r;throw new kc.UnexpectedFieldTypeError(t,y3.default,r)},e.prototype.createButton=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroPushButton.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),E3.default.of(i,i.ref,this.doc)},e.prototype.createCheckBox=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroCheckBox.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),zy.default.of(i,i.ref,this.doc)},e.prototype.createDropdown=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroComboBox.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),b3.default.of(i,i.ref,this.doc)},e.prototype.createOptionList=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroListBox.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),C3.default.of(i,i.ref,this.doc)},e.prototype.createRadioGroup=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroRadioButton.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),Zy.default.of(i,i.ref,this.doc)},e.prototype.createTextField=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroText.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),y3.default.of(i,i.ref,this.doc)},e.prototype.flatten=function(t){t===void 0&&(t={updateFieldAppearances:!0}),t.updateFieldAppearances&&this.updateFieldAppearances();for(var r=this.getFields(),n=0,i=r.length;n<i;n++){for(var s=r[n],u=s.acroField.getWidgets(),f=0,h=u.length;f<h;f++){var g=u[f],p=this.findWidgetPage(g),C=this.findWidgetAppearanceRef(s,g),y=p.node.newXObject("FlatWidget",C),x=g.getRectangle(),v=Xu.__spreadArrays([m3.pushGraphicsState(),m3.translate(x.x,x.y)],Vut.rotateInPlace(Xu.__assign(Xu.__assign({},x),{rotation:0})),[m3.drawObject(y),m3.popGraphicsState()]).filter(Boolean);p.pushOperators.apply(p,v)}this.removeField(s)}},e.prototype.removeField=function(t){for(var r=t.acroField.getWidgets(),n=new Set,i=0,s=r.length;i<s;i++){var u=r[i],f=this.findWidgetAppearanceRef(t,u),h=this.findWidgetPage(u);n.add(h),h.node.removeAnnot(f)}n.forEach(function(x){return x.node.removeAnnot(t.ref)}),this.acroForm.removeField(t.acroField);for(var g=t.acroField.normalizedEntries().Kids,p=g.size(),C=0;C<p;C++){var y=g.get(C);y instanceof In.PDFRef&&this.doc.context.delete(y)}this.doc.context.delete(t.ref)},e.prototype.updateFieldAppearances=function(t){Fi.assertOrUndefined(t,"font",[[Wut.default,"PDFFont"]]),t=t??this.getDefaultFont();for(var r=this.getFields(),n=0,i=r.length;n<i;n++){var s=r[n];s.needsAppearancesUpdate()&&s.defaultUpdateAppearances(t)}},e.prototype.markFieldAsDirty=function(t){Fi.assertOrUndefined(t,"fieldRef",[[In.PDFRef,"PDFRef"]]),this.dirtyFields.add(t)},e.prototype.markFieldAsClean=function(t){Fi.assertOrUndefined(t,"fieldRef",[[In.PDFRef,"PDFRef"]]),this.dirtyFields.delete(t)},e.prototype.fieldIsDirty=function(t){return Fi.assertOrUndefined(t,"fieldRef",[[In.PDFRef,"PDFRef"]]),this.dirtyFields.has(t)},e.prototype.getDefaultFont=function(){return this.defaultFontCache.access()},e.prototype.findWidgetPage=function(t){var r=t.P(),n=this.doc.getPages().find(function(s){return s.ref===r});if(n===void 0){var i=this.doc.context.getObjectRef(t.dict);if(i===void 0)throw new Error("Could not find PDFRef for PDFObject");if(n=this.doc.findPageForAnnotationRef(i),n===void 0)throw new Error("Could not find page for PDFRef "+i)}return n},e.prototype.findWidgetAppearanceRef=function(t,r){var n,i=r.getNormalAppearance();if(i instanceof In.PDFDict&&(t instanceof zy.default||t instanceof Zy.default)){var s=t.acroField.getValue(),u=(n=i.get(s))!==null&&n!==void 0?n:i.get(In.PDFName.of("Off"));u instanceof In.PDFRef&&(i=u)}if(!(i instanceof In.PDFRef)){var f=t.getName();throw new Error("Failed to extract appearance ref for: "+f)}return i},e.prototype.findOrCreateNonTerminals=function(t){for(var r=[this.acroForm],n=0,i=t.length;n<i;n++){var s=t[n];if(!s)throw new kc.InvalidFieldNamePartError(s);var u=r[0],f=r[1],h=this.findNonTerminal(s,u);if(h)r=h;else{var g=In.PDFAcroNonTerminal.create(this.doc.context);g.setPartialName(s),g.setParent(f);var p=this.doc.context.register(g.dict);u.addField(p),r=[g,p]}}return r},e.prototype.findNonTerminal=function(t,r){for(var n=r instanceof In.PDFAcroForm?this.acroForm.getFields():In.createPDFAcroFields(r.Kids()),i=0,s=n.length;i<s;i++){var u=n[i],f=u[0],h=u[1];if(f.getPartialName()===t){if(f instanceof In.PDFAcroNonTerminal)return[f,h];throw new kc.FieldAlreadyExistsError(t)}}},e.of=function(t,r){return new e(t,r)},e})();bP.default=Yut;var jut=function(e,t,r){if(e instanceof In.PDFAcroPushButton)return E3.default.of(e,t,r);if(e instanceof In.PDFAcroCheckBox)return zy.default.of(e,t,r);if(e instanceof In.PDFAcroComboBox)return b3.default.of(e,t,r);if(e instanceof In.PDFAcroListBox)return C3.default.of(e,t,r);if(e instanceof In.PDFAcroText)return y3.default.of(e,t,r);if(e instanceof In.PDFAcroRadioButton)return Zy.default.of(e,t,r);if(e instanceof In.PDFAcroSignature)return EP.default.of(e,t,r)},Gm=function(e){if(e.length===0)throw new Error("PDF field names must not be empty strings");for(var t=e.split("."),r=0,n=t.length;r<n;r++)if(t[r]==="")throw new Error('Periods in PDF field names must be separated by at least one character: "'+e+'"');return t.length===1?{nonTerminal:[],terminal:t[0]}:{nonTerminal:t.slice(0,t.length-1),terminal:t[t.length-1]}},Vm=function(e,t,r){for(var n=e[0],i=e[1],s=t[0],u=t[1],f=n.normalizedEntries(),h=In.createPDFAcroFields("Kids"in f?f.Kids:f.Fields),g=0,p=h.length;g<p;g++)if(h[g][0].getPartialName()===r)throw new kc.FieldAlreadyExistsError(r);n.addField(u),s.setParent(i)}});var xP=U(x3=>{"use strict";Object.defineProperty(x3,"__esModule",{value:!0});x3.PageSizes=void 0;x3.PageSizes={"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 vP=U($y=>{"use strict";Object.defineProperty($y,"__esModule",{value:!0});$y.ParseSpeeds=void 0;var Jut;(function(e){e[e.Fastest=1/0]="Fastest",e[e.Fast=1500]="Fast",e[e.Medium=500]="Medium",e[e.Slow=100]="Slow"})(Jut=$y.ParseSpeeds||($y.ParseSpeeds={}))});var Kpe=U(IP=>{"use strict";Object.defineProperty(IP,"__esModule",{value:!0});var Xpe=(ct(),ze(ut)),Ha=Xi(),Xut=(function(){function e(t,r,n){this.alreadyEmbedded=!1,this.ref=t,this.doc=r,this.embedder=n}return e.prototype.embed=function(){return Xpe.__awaiter(this,void 0,void 0,function(){var t,r,n,i,s;return Xpe.__generator(this,function(u){switch(u.label){case 0:return this.alreadyEmbedded?[3,2]:[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:t=u.sent(),this.doc.catalog.has(Ha.PDFName.of("Names"))||this.doc.catalog.set(Ha.PDFName.of("Names"),this.doc.context.obj({})),r=this.doc.catalog.lookup(Ha.PDFName.of("Names"),Ha.PDFDict),r.has(Ha.PDFName.of("EmbeddedFiles"))||r.set(Ha.PDFName.of("EmbeddedFiles"),this.doc.context.obj({})),n=r.lookup(Ha.PDFName.of("EmbeddedFiles"),Ha.PDFDict),n.has(Ha.PDFName.of("Names"))||n.set(Ha.PDFName.of("Names"),this.doc.context.obj([])),i=n.lookup(Ha.PDFName.of("Names"),Ha.PDFArray),i.push(Ha.PDFHexString.fromText(this.embedder.fileName)),i.push(t),this.doc.catalog.has(Ha.PDFName.of("AF"))||this.doc.catalog.set(Ha.PDFName.of("AF"),this.doc.context.obj([])),s=this.doc.catalog.lookup(Ha.PDFName.of("AF"),Ha.PDFArray),s.push(t),this.alreadyEmbedded=!0,u.label=2;case 2:return[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();IP.default=Xut});var BP=U(DP=>{"use strict";Object.defineProperty(DP,"__esModule",{value:!0});var zpe=(ct(),ze(ut)),$o=Xi(),Kut=(function(){function e(t,r,n){this.alreadyEmbedded=!1,this.ref=t,this.doc=r,this.embedder=n}return e.prototype.embed=function(){return zpe.__awaiter(this,void 0,void 0,function(){var t,r,n,i,s,u,f;return zpe.__generator(this,function(h){switch(h.label){case 0:return this.alreadyEmbedded?[3,2]:(t=this.doc,r=t.catalog,n=t.context,[4,this.embedder.embedIntoContext(this.doc.context,this.ref)]);case 1:i=h.sent(),r.has($o.PDFName.of("Names"))||r.set($o.PDFName.of("Names"),n.obj({})),s=r.lookup($o.PDFName.of("Names"),$o.PDFDict),s.has($o.PDFName.of("JavaScript"))||s.set($o.PDFName.of("JavaScript"),n.obj({})),u=s.lookup($o.PDFName.of("JavaScript"),$o.PDFDict),u.has($o.PDFName.of("Names"))||u.set($o.PDFName.of("Names"),n.obj([])),f=u.lookup($o.PDFName.of("Names"),$o.PDFArray),f.push($o.PDFHexString.fromText(this.embedder.scriptName)),f.push(i),this.alreadyEmbedded=!0,h.label=2;case 2:return[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();DP.default=Kut});var Zpe=U(FP=>{"use strict";Object.defineProperty(FP,"__esModule",{value:!0});var wP=(ct(),ze(ut)),zut=wP.__importDefault(co()),Zut=(function(){function e(t,r){this.script=t,this.scriptName=r}return e.for=function(t,r){return new e(t,r)},e.prototype.embedIntoContext=function(t,r){return wP.__awaiter(this,void 0,void 0,function(){var n;return wP.__generator(this,function(i){return n=t.obj({Type:"Action",S:"JavaScript",JS:zut.default.fromText(this.script)}),r?(t.assign(r,n),[2,r]):[2,t.register(n)]})})},e})();FP.default=Zut});var UA=U(TP=>{"use strict";Object.defineProperty(TP,"__esModule",{value:!0});var Fr=(ct(),ze(ut)),v3=Pm(),$ut=Fr.__importDefault(u3()),$pe=Fr.__importDefault($f()),eme=Fr.__importDefault(f3()),Ym=Fr.__importDefault(tl()),ect=Fr.__importDefault(CP()),tct=xP(),ar=Xi(),rct=vP(),zt=fr(),tme=Fr.__importStar(cL()),nct=Fr.__importDefault(Kpe()),ict=Fr.__importDefault(BP()),act=Fr.__importDefault(Zpe()),sct=(function(){function e(t,r,n){var i=this;if(this.defaultWordBreaks=[" "],this.computePages=function(){var s=[];return i.catalog.Pages().traverse(function(u,f){if(u instanceof ar.PDFPageLeaf){var h=i.pageMap.get(u);h||(h=Ym.default.of(u,f,i),i.pageMap.set(u,h)),s.push(h)}}),s},this.getOrCreateForm=function(){var s=i.catalog.getOrCreateAcroForm();return ect.default.of(s,i)},zt.assertIs(t,"context",[[ar.PDFContext,"PDFContext"]]),zt.assertIs(r,"ignoreEncryption",["boolean"]),this.context=t,this.catalog=t.lookup(t.trailerInfo.Root),this.isEncrypted=!!t.lookup(t.trailerInfo.Encrypt),this.pageCache=zt.Cache.populatedBy(this.computePages),this.pageMap=new Map,this.formCache=zt.Cache.populatedBy(this.getOrCreateForm),this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!r&&this.isEncrypted)throw new v3.EncryptedPDFError;n&&this.updateInfoDict()}return e.load=function(t,r){return r===void 0&&(r={}),Fr.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p,C,y,x,v;return Fr.__generator(this,function(F){switch(F.label){case 0:return n=r.ignoreEncryption,i=n===void 0?!1:n,s=r.parseSpeed,u=s===void 0?rct.ParseSpeeds.Slow:s,f=r.throwOnInvalidObject,h=f===void 0?!1:f,g=r.updateMetadata,p=g===void 0?!0:g,C=r.capNumbers,y=C===void 0?!1:C,zt.assertIs(t,"pdf",["string",Uint8Array,ArrayBuffer]),zt.assertIs(i,"ignoreEncryption",["boolean"]),zt.assertIs(u,"parseSpeed",["number"]),zt.assertIs(h,"throwOnInvalidObject",["boolean"]),x=zt.toUint8Array(t),[4,ar.PDFParser.forBytesWithOptions(x,u,h,y).parseDocument()];case 1:return v=F.sent(),[2,new e(v,i,p)]}})})},e.create=function(t){return t===void 0&&(t={}),Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f;return Fr.__generator(this,function(h){return r=t.updateMetadata,n=r===void 0?!0:r,i=ar.PDFContext.create(),s=ar.PDFPageTree.withContext(i),u=i.register(s),f=ar.PDFCatalog.withContextAndPages(i,u),i.trailerInfo.Root=i.register(f),[2,new e(i,!1,n)]})})},e.prototype.registerFontkit=function(t){this.fontkit=t},e.prototype.getForm=function(){var t=this.formCache.access();return t.hasXFA()&&(console.warn("Removing XFA form data as pdf-lib does not support reading or writing XFA"),t.deleteXFA()),t},e.prototype.getTitle=function(){var t=this.getInfoDict().lookup(ar.PDFName.Title);if(t)return MA(t),t.decodeText()},e.prototype.getAuthor=function(){var t=this.getInfoDict().lookup(ar.PDFName.Author);if(t)return MA(t),t.decodeText()},e.prototype.getSubject=function(){var t=this.getInfoDict().lookup(ar.PDFName.Subject);if(t)return MA(t),t.decodeText()},e.prototype.getKeywords=function(){var t=this.getInfoDict().lookup(ar.PDFName.Keywords);if(t)return MA(t),t.decodeText()},e.prototype.getCreator=function(){var t=this.getInfoDict().lookup(ar.PDFName.Creator);if(t)return MA(t),t.decodeText()},e.prototype.getProducer=function(){var t=this.getInfoDict().lookup(ar.PDFName.Producer);if(t)return MA(t),t.decodeText()},e.prototype.getCreationDate=function(){var t=this.getInfoDict().lookup(ar.PDFName.CreationDate);if(t)return MA(t),t.decodeDate()},e.prototype.getModificationDate=function(){var t=this.getInfoDict().lookup(ar.PDFName.ModDate);if(t)return MA(t),t.decodeDate()},e.prototype.setTitle=function(t,r){zt.assertIs(t,"title",["string"]);var n=ar.PDFName.of("Title");if(this.getInfoDict().set(n,ar.PDFHexString.fromText(t)),r?.showInWindowTitleBar){var i=this.catalog.getOrCreateViewerPreferences();i.setDisplayDocTitle(!0)}},e.prototype.setAuthor=function(t){zt.assertIs(t,"author",["string"]);var r=ar.PDFName.of("Author");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setSubject=function(t){zt.assertIs(t,"author",["string"]);var r=ar.PDFName.of("Subject");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setKeywords=function(t){zt.assertIs(t,"keywords",[Array]);var r=ar.PDFName.of("Keywords");this.getInfoDict().set(r,ar.PDFHexString.fromText(t.join(" ")))},e.prototype.setCreator=function(t){zt.assertIs(t,"creator",["string"]);var r=ar.PDFName.of("Creator");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setProducer=function(t){zt.assertIs(t,"creator",["string"]);var r=ar.PDFName.of("Producer");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setLanguage=function(t){zt.assertIs(t,"language",["string"]);var r=ar.PDFName.of("Lang");this.catalog.set(r,ar.PDFString.of(t))},e.prototype.setCreationDate=function(t){zt.assertIs(t,"creationDate",[[Date,"Date"]]);var r=ar.PDFName.of("CreationDate");this.getInfoDict().set(r,ar.PDFString.fromDate(t))},e.prototype.setModificationDate=function(t){zt.assertIs(t,"modificationDate",[[Date,"Date"]]);var r=ar.PDFName.of("ModDate");this.getInfoDict().set(r,ar.PDFString.fromDate(t))},e.prototype.getPageCount=function(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount},e.prototype.getPages=function(){return this.pageCache.access()},e.prototype.getPage=function(t){var r=this.getPages();return zt.assertRange(t,"index",0,r.length-1),r[t]},e.prototype.getPageIndices=function(){return zt.range(0,this.getPageCount())},e.prototype.removePage=function(t){var r=this.getPageCount();if(this.pageCount===0)throw new v3.RemovePageFromEmptyDocumentError;zt.assertRange(t,"index",0,r-1),this.catalog.removeLeafNode(t),this.pageCount=r-1},e.prototype.addPage=function(t){return zt.assertIs(t,"page",["undefined",[Ym.default,"PDFPage"],Array]),this.insertPage(this.getPageCount(),t)},e.prototype.insertPage=function(t,r){var n=this.getPageCount();if(zt.assertRange(t,"index",0,n),zt.assertIs(r,"page",["undefined",[Ym.default,"PDFPage"],Array]),!r||Array.isArray(r)){var i=Array.isArray(r)?r:tct.PageSizes.A4;r=Ym.default.create(this),r.setSize.apply(r,i)}else if(r.doc!==this)throw new v3.ForeignPageError;var s=this.catalog.insertLeafNode(r.ref,t);return r.node.setParent(s),this.pageMap.set(r.node,r),this.pageCache.invalidate(),this.pageCount=n+1,r},e.prototype.copyPages=function(t,r){return Fr.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p;return Fr.__generator(this,function(C){switch(C.label){case 0:return zt.assertIs(t,"srcDoc",[[e,"PDFDocument"]]),zt.assertIs(r,"indices",[Array]),[4,t.flush()];case 1:for(C.sent(),n=ar.PDFObjectCopier.for(t.context,this.context),i=t.getPages(),s=new Array(r.length),u=0,f=r.length;u<f;u++)h=i[r[u]],g=n.copy(h.node),p=this.context.register(g),s[u]=Ym.default.of(g,p,this);return[2,s]}})})},e.prototype.copy=function(){return Fr.__awaiter(this,void 0,void 0,function(){var t,r,n,i;return Fr.__generator(this,function(s){switch(s.label){case 0:return[4,e.create()];case 1:return t=s.sent(),[4,t.copyPages(this,this.getPageIndices())];case 2:for(r=s.sent(),n=0,i=r.length;n<i;n++)t.addPage(r[n]);return this.getAuthor()!==void 0&&t.setAuthor(this.getAuthor()),this.getCreationDate()!==void 0&&t.setCreationDate(this.getCreationDate()),this.getCreator()!==void 0&&t.setCreator(this.getCreator()),this.getModificationDate()!==void 0&&t.setModificationDate(this.getModificationDate()),this.getProducer()!==void 0&&t.setProducer(this.getProducer()),this.getSubject()!==void 0&&t.setSubject(this.getSubject()),this.getTitle()!==void 0&&t.setTitle(this.getTitle()),t.defaultWordBreaks=this.defaultWordBreaks,[2,t]}})})},e.prototype.addJavaScript=function(t,r){zt.assertIs(t,"name",["string"]),zt.assertIs(r,"script",["string"]);var n=act.default.for(r,t),i=this.context.nextRef(),s=ict.default.of(i,this,n);this.javaScripts.push(s)},e.prototype.attach=function(t,r,n){return n===void 0&&(n={}),Fr.__awaiter(this,void 0,void 0,function(){var i,s,u,f;return Fr.__generator(this,function(h){return zt.assertIs(t,"attachment",["string",Uint8Array,ArrayBuffer]),zt.assertIs(r,"name",["string"]),zt.assertOrUndefined(n.mimeType,"mimeType",["string"]),zt.assertOrUndefined(n.description,"description",["string"]),zt.assertOrUndefined(n.creationDate,"options.creationDate",[Date]),zt.assertOrUndefined(n.modificationDate,"options.modificationDate",[Date]),zt.assertIsOneOfOrUndefined(n.afRelationship,"options.afRelationship",tme.AFRelationship),i=zt.toUint8Array(t),s=tme.default.for(i,r,n),u=this.context.nextRef(),f=nct.default.of(u,this,s),this.embeddedFiles.push(f),[2]})})},e.prototype.embedFont=function(t,r){return r===void 0&&(r={}),Fr.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p,C,y;return Fr.__generator(this,function(x){switch(x.label){case 0:return n=r.subset,i=n===void 0?!1:n,s=r.customName,u=r.features,zt.assertIs(t,"font",["string",Uint8Array,ArrayBuffer]),zt.assertIs(i,"subset",["boolean"]),zt.isStandardFont(t)?(f=ar.StandardFontEmbedder.for(t,s),[3,7]):[3,1];case 1:return zt.canBeConvertedToUint8Array(t)?(h=zt.toUint8Array(t),g=this.assertFontkit(),i?[4,ar.CustomFontSubsetEmbedder.for(g,h,s,u)]:[3,3]):[3,6];case 2:return p=x.sent(),[3,5];case 3:return[4,ar.CustomFontEmbedder.for(g,h,s,u)];case 4:p=x.sent(),x.label=5;case 5:return f=p,[3,7];case 6:throw new TypeError("`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`");case 7:return C=this.context.nextRef(),y=$pe.default.of(C,this,f),this.fonts.push(y),[2,y]}})})},e.prototype.embedStandardFont=function(t,r){if(zt.assertIs(t,"font",["string"]),!zt.isStandardFont(t))throw new TypeError("`font` must be one of type `StandardFonts`");var n=ar.StandardFontEmbedder.for(t,r),i=this.context.nextRef(),s=$pe.default.of(i,this,n);return this.fonts.push(s),s},e.prototype.embedJpg=function(t){return Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s;return Fr.__generator(this,function(u){switch(u.label){case 0:return zt.assertIs(t,"jpg",["string",Uint8Array,ArrayBuffer]),r=zt.toUint8Array(t),[4,ar.JpegEmbedder.for(r)];case 1:return n=u.sent(),i=this.context.nextRef(),s=eme.default.of(i,this,n),this.images.push(s),[2,s]}})})},e.prototype.embedPng=function(t){return Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s;return Fr.__generator(this,function(u){switch(u.label){case 0:return zt.assertIs(t,"png",["string",Uint8Array,ArrayBuffer]),r=zt.toUint8Array(t),[4,ar.PngEmbedder.for(r)];case 1:return n=u.sent(),i=this.context.nextRef(),s=eme.default.of(i,this,n),this.images.push(s),[2,s]}})})},e.prototype.embedPdf=function(t,r){return r===void 0&&(r=[0]),Fr.__awaiter(this,void 0,void 0,function(){var n,i,s;return Fr.__generator(this,function(u){switch(u.label){case 0:return zt.assertIs(t,"pdf",["string",Uint8Array,ArrayBuffer,[e,"PDFDocument"]]),zt.assertIs(r,"indices",[Array]),t instanceof e?(i=t,[3,3]):[3,1];case 1:return[4,e.load(t)];case 2:i=u.sent(),u.label=3;case 3:return n=i,s=zt.pluckIndices(n.getPages(),r),[2,this.embedPages(s)]}})})},e.prototype.embedPage=function(t,r,n){return Fr.__awaiter(this,void 0,void 0,function(){var i;return Fr.__generator(this,function(s){switch(s.label){case 0:return zt.assertIs(t,"page",[[Ym.default,"PDFPage"]]),[4,this.embedPages([t],[r],[n])];case 1:return i=s.sent()[0],[2,i]}})})},e.prototype.embedPages=function(t,r,n){return r===void 0&&(r=[]),n===void 0&&(n=[]),Fr.__awaiter(this,void 0,void 0,function(){var g,p,i,s,u,f,h,g,p,C,y,x,v,F,Q;return Fr.__generator(this,function(T){switch(T.label){case 0:if(t.length===0)return[2,[]];for(g=0,p=t.length-1;g<p;g++)if(i=t[g],s=t[g+1],i.node.context!==s.node.context)throw new ar.PageEmbeddingMismatchedContextError;u=t[0].node.context,f=u===this.context?function(_){return _}:ar.PDFObjectCopier.for(u,this.context).copy,h=new Array(t.length),g=0,p=t.length,T.label=1;case 1:return g<p?(C=f(t[g].node),y=r[g],x=n[g],[4,ar.PDFPageEmbedder.for(C,y,x)]):[3,4];case 2:v=T.sent(),F=this.context.nextRef(),h[g]=$ut.default.of(F,this,v),T.label=3;case 3:return g++,[3,1];case 4:return(Q=this.embeddedPages).push.apply(Q,h),[2,h]}})})},e.prototype.flush=function(){return Fr.__awaiter(this,void 0,void 0,function(){return Fr.__generator(this,function(t){switch(t.label){case 0:return[4,this.embedAll(this.fonts)];case 1:return t.sent(),[4,this.embedAll(this.images)];case 2:return t.sent(),[4,this.embedAll(this.embeddedPages)];case 3:return t.sent(),[4,this.embedAll(this.embeddedFiles)];case 4:return t.sent(),[4,this.embedAll(this.javaScripts)];case 5:return t.sent(),[2]}})})},e.prototype.save=function(t){return t===void 0&&(t={}),Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f,h,g,p,C;return Fr.__generator(this,function(y){switch(y.label){case 0:return r=t.useObjectStreams,n=r===void 0?!0:r,i=t.addDefaultPage,s=i===void 0?!0:i,u=t.objectsPerTick,f=u===void 0?50:u,h=t.updateFieldAppearances,g=h===void 0?!0:h,zt.assertIs(n,"useObjectStreams",["boolean"]),zt.assertIs(s,"addDefaultPage",["boolean"]),zt.assertIs(f,"objectsPerTick",["number"]),zt.assertIs(g,"updateFieldAppearances",["boolean"]),s&&this.getPageCount()===0&&this.addPage(),g&&(p=this.formCache.getValue(),p&&p.updateFieldAppearances()),[4,this.flush()];case 1:return y.sent(),C=n?ar.PDFStreamWriter:ar.PDFWriter,[2,C.forContext(this.context,f).serializeToBuffer()]}})})},e.prototype.saveAsBase64=function(t){return t===void 0&&(t={}),Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u;return Fr.__generator(this,function(f){switch(f.label){case 0:return r=t.dataUri,n=r===void 0?!1:r,i=Fr.__rest(t,["dataUri"]),zt.assertIs(n,"dataUri",["boolean"]),[4,this.save(i)];case 1:return s=f.sent(),u=zt.encodeToBase64(s),[2,n?"data:application/pdf;base64,"+u:u]}})})},e.prototype.findPageForAnnotationRef=function(t){for(var r=this.getPages(),n=0,i=r.length;n<i;n++){var s=r[n],u=s.node.Annots();if(u?.indexOf(t)!==void 0)return s}},e.prototype.embedAll=function(t){return Fr.__awaiter(this,void 0,void 0,function(){var r,n;return Fr.__generator(this,function(i){switch(i.label){case 0:r=0,n=t.length,i.label=1;case 1:return r<n?[4,t[r].embed()]:[3,4];case 2:i.sent(),i.label=3;case 3:return r++,[3,1];case 4:return[2]}})})},e.prototype.updateInfoDict=function(){var t="pdf-lib (https://github.com/Hopding/pdf-lib)",r=new Date,n=this.getInfoDict();this.setProducer(t),this.setModificationDate(r),n.get(ar.PDFName.of("Creator"))||this.setCreator(t),n.get(ar.PDFName.of("CreationDate"))||this.setCreationDate(r)},e.prototype.getInfoDict=function(){var t=this.context.lookup(this.context.trailerInfo.Info);if(t instanceof ar.PDFDict)return t;var r=this.context.obj({});return this.context.trailerInfo.Info=this.context.register(r),r},e.prototype.assertFontkit=function(){if(!this.fontkit)throw new v3.FontkitNotRegisteredError;return this.fontkit},e})();TP.default=sct;function MA(e){if(!(e instanceof ar.PDFHexString)&&!(e instanceof ar.PDFString))throw new ar.UnexpectedObjectTypeError([ar.PDFHexString,ar.PDFString],e)}});var SP=U(ex=>{"use strict";Object.defineProperty(ex,"__esModule",{value:!0});ex.BlendMode=void 0;var oct;(function(e){e.Normal="Normal",e.Multiply="Multiply",e.Screen="Screen",e.Overlay="Overlay",e.Darken="Darken",e.Lighten="Lighten",e.ColorDodge="ColorDodge",e.ColorBurn="ColorBurn",e.HardLight="HardLight",e.SoftLight="SoftLight",e.Difference="Difference",e.Exclusion="Exclusion"})(oct=ex.BlendMode||(ex.BlendMode={}))});var tl=U(QP=>{"use strict";Object.defineProperty(QP,"__esModule",{value:!0});var OA=(ct(),ze(ut)),tx=Gu(),lg=Lm(),U0=QA(),rme=OA.__importDefault(UA()),uct=OA.__importDefault(u3()),nme=OA.__importDefault($f()),cct=OA.__importDefault(f3()),Ag=SP(),Rs=zo(),fct=p3(),Ia=Xi(),He=fr(),lct=(function(){function e(t,r,n){this.fontSize=24,this.fontColor=tx.rgb(0,0,0),this.lineHeight=24,this.x=0,this.y=0,He.assertIs(t,"leafNode",[[Ia.PDFPageLeaf,"PDFPageLeaf"]]),He.assertIs(r,"ref",[[Ia.PDFRef,"PDFRef"]]),He.assertIs(n,"doc",[[rme.default,"PDFDocument"]]),this.node=t,this.ref=r,this.doc=n}return e.prototype.setRotation=function(t){var r=Rs.toDegrees(t);He.assertMultiple(r,"degreesAngle",90),this.node.set(Ia.PDFName.of("Rotate"),this.doc.context.obj(r))},e.prototype.getRotation=function(){var t=this.node.Rotate();return Rs.degrees(t?t.asNumber():0)},e.prototype.setSize=function(t,r){He.assertIs(t,"width",["number"]),He.assertIs(r,"height",["number"]);var n=this.getMediaBox();this.setMediaBox(n.x,n.y,t,r);var i=this.getCropBox(),s=this.getBleedBox(),u=this.getTrimBox(),f=this.getArtBox(),h=this.node.CropBox(),g=this.node.BleedBox(),p=this.node.TrimBox(),C=this.node.ArtBox();h&&He.rectanglesAreEqual(i,n)&&this.setCropBox(n.x,n.y,t,r),g&&He.rectanglesAreEqual(s,n)&&this.setBleedBox(n.x,n.y,t,r),p&&He.rectanglesAreEqual(u,n)&&this.setTrimBox(n.x,n.y,t,r),C&&He.rectanglesAreEqual(f,n)&&this.setArtBox(n.x,n.y,t,r)},e.prototype.setWidth=function(t){He.assertIs(t,"width",["number"]),this.setSize(t,this.getSize().height)},e.prototype.setHeight=function(t){He.assertIs(t,"height",["number"]),this.setSize(this.getSize().width,t)},e.prototype.setMediaBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.MediaBox,s)},e.prototype.setCropBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.CropBox,s)},e.prototype.setBleedBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.BleedBox,s)},e.prototype.setTrimBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.TrimBox,s)},e.prototype.setArtBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.ArtBox,s)},e.prototype.getSize=function(){var t=this.getMediaBox(),r=t.width,n=t.height;return{width:r,height:n}},e.prototype.getWidth=function(){return this.getSize().width},e.prototype.getHeight=function(){return this.getSize().height},e.prototype.getMediaBox=function(){var t=this.node.MediaBox();return t.asRectangle()},e.prototype.getCropBox=function(){var t,r=this.node.CropBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getMediaBox()},e.prototype.getBleedBox=function(){var t,r=this.node.BleedBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getCropBox()},e.prototype.getTrimBox=function(){var t,r=this.node.TrimBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getCropBox()},e.prototype.getArtBox=function(){var t,r=this.node.ArtBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getCropBox()},e.prototype.translateContent=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(U0.pushGraphicsState(),U0.translate(t,r)),i=this.doc.context.register(n),s=this.createContentStream(U0.popGraphicsState()),u=this.doc.context.register(s);this.node.wrapContentStreams(i,u)},e.prototype.scale=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.setSize(this.getWidth()*t,this.getHeight()*r),this.scaleContent(t,r),this.scaleAnnotations(t,r)},e.prototype.scaleContent=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(U0.pushGraphicsState(),U0.scale(t,r)),i=this.doc.context.register(n),s=this.createContentStream(U0.popGraphicsState()),u=this.doc.context.register(s);this.node.wrapContentStreams(i,u)},e.prototype.scaleAnnotations=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]);var n=this.node.Annots();if(n)for(var i=0;i<n.size();i++){var s=n.lookup(i);s instanceof Ia.PDFDict&&this.scaleAnnot(s,t,r)}},e.prototype.resetPosition=function(){this.getContentStream(!1),this.x=0,this.y=0},e.prototype.setFont=function(t){He.assertIs(t,"font",[[nme.default,"PDFFont"]]),this.font=t,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)},e.prototype.setFontSize=function(t){He.assertIs(t,"fontSize",["number"]),this.fontSize=t},e.prototype.setFontColor=function(t){He.assertIs(t,"fontColor",[[Object,"Color"]]),this.fontColor=t},e.prototype.setLineHeight=function(t){He.assertIs(t,"lineHeight",["number"]),this.lineHeight=t},e.prototype.getPosition=function(){return{x:this.x,y:this.y}},e.prototype.getX=function(){return this.x},e.prototype.getY=function(){return this.y},e.prototype.moveTo=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.x=t,this.y=r},e.prototype.moveDown=function(t){He.assertIs(t,"yDecrease",["number"]),this.y-=t},e.prototype.moveUp=function(t){He.assertIs(t,"yIncrease",["number"]),this.y+=t},e.prototype.moveLeft=function(t){He.assertIs(t,"xDecrease",["number"]),this.x-=t},e.prototype.moveRight=function(t){He.assertIs(t,"xIncrease",["number"]),this.x+=t},e.prototype.pushOperators=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];He.assertEachIs(t,"operator",[[Ia.PDFOperator,"PDFOperator"]]);var n=this.getContentStream();n.push.apply(n,t)},e.prototype.drawText=function(t,r){var n,i,s,u,f,h,g;r===void 0&&(r={}),He.assertIs(t,"text",["string"]),He.assertOrUndefined(r.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertOrUndefined(r.font,"options.font",[[nme.default,"PDFFont"]]),He.assertOrUndefined(r.size,"options.size",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.lineHeight,"options.lineHeight",["number"]),He.assertOrUndefined(r.maxWidth,"options.maxWidth",["number"]),He.assertOrUndefined(r.wordBreaks,"options.wordBreaks",[Array]),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);for(var p=this.setOrEmbedFont(r.font),C=p.oldFont,y=p.newFont,x=p.newFontKey,v=r.size||this.fontSize,F=r.wordBreaks||this.doc.defaultWordBreaks,Q=function(q){return y.widthOfTextAtSize(q,v)},T=r.maxWidth===void 0?He.lineSplit(He.cleanText(t)):He.breakTextIntoLines(t,F,r.maxWidth,Q),_=new Array(T.length),S=0,N=T.length;S<N;S++)_[S]=y.encodeText(T[S]);var O=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),H=this.getContentStream();H.push.apply(H,lg.drawLinesOfText(_,{color:(n=r.color)!==null&&n!==void 0?n:this.fontColor,font:x,size:v,rotate:(i=r.rotate)!==null&&i!==void 0?i:Rs.degrees(0),xSkew:(s=r.xSkew)!==null&&s!==void 0?s:Rs.degrees(0),ySkew:(u=r.ySkew)!==null&&u!==void 0?u:Rs.degrees(0),x:(f=r.x)!==null&&f!==void 0?f:this.x,y:(h=r.y)!==null&&h!==void 0?h:this.y,lineHeight:(g=r.lineHeight)!==null&&g!==void 0?g:this.lineHeight,graphicsState:O})),r.font&&(C?this.setFont(C):this.resetFont())},e.prototype.drawImage=function(t,r){var n,i,s,u,f,h,g;r===void 0&&(r={}),He.assertIs(t,"image",[[cct.default,"PDFImage"]]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.width,"options.width",["number"]),He.assertOrUndefined(r.height,"options.height",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);var p=this.node.newXObject("Image",t.ref),C=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),y=this.getContentStream();y.push.apply(y,lg.drawImage(p,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,width:(s=r.width)!==null&&s!==void 0?s:t.size().width,height:(u=r.height)!==null&&u!==void 0?u:t.size().height,rotate:(f=r.rotate)!==null&&f!==void 0?f:Rs.degrees(0),xSkew:(h=r.xSkew)!==null&&h!==void 0?h:Rs.degrees(0),ySkew:(g=r.ySkew)!==null&&g!==void 0?g:Rs.degrees(0),graphicsState:C}))},e.prototype.drawPage=function(t,r){var n,i,s,u,f;r===void 0&&(r={}),He.assertIs(t,"embeddedPage",[[uct.default,"PDFEmbeddedPage"]]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.xScale,"options.xScale",["number"]),He.assertOrUndefined(r.yScale,"options.yScale",["number"]),He.assertOrUndefined(r.width,"options.width",["number"]),He.assertOrUndefined(r.height,"options.height",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);var h=this.node.newXObject("EmbeddedPdfPage",t.ref),g=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),p=r.width!==void 0?r.width/t.width:r.xScale!==void 0?r.xScale:1,C=r.height!==void 0?r.height/t.height:r.yScale!==void 0?r.yScale:1,y=this.getContentStream();y.push.apply(y,lg.drawPage(h,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,xScale:p,yScale:C,rotate:(s=r.rotate)!==null&&s!==void 0?s:Rs.degrees(0),xSkew:(u=r.xSkew)!==null&&u!==void 0?u:Rs.degrees(0),ySkew:(f=r.ySkew)!==null&&f!==void 0?f:Rs.degrees(0),graphicsState:g}))},e.prototype.drawSvgPath=function(t,r){var n,i,s,u,f,h,g,p,C;r===void 0&&(r={}),He.assertIs(t,"path",["string"]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.scale,"options.scale",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.borderWidth,"options.borderWidth",["number"]),He.assertOrUndefined(r.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertOrUndefined(r.borderColor,"options.borderColor",[[Object,"Color"]]),He.assertOrUndefined(r.borderDashArray,"options.borderDashArray",[Array]),He.assertOrUndefined(r.borderDashPhase,"options.borderDashPhase",["number"]),He.assertIsOneOfOrUndefined(r.borderLineCap,"options.borderLineCap",U0.LineCapStyle),He.assertRangeOrUndefined(r.borderOpacity,"options.borderOpacity",0,1),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);var y=this.maybeEmbedGraphicsState({opacity:r.opacity,borderOpacity:r.borderOpacity,blendMode:r.blendMode});!("color"in r)&&!("borderColor"in r)&&(r.borderColor=tx.rgb(0,0,0));var x=this.getContentStream();x.push.apply(x,lg.drawSvgPath(t,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,scale:r.scale,rotate:(s=r.rotate)!==null&&s!==void 0?s:Rs.degrees(0),color:(u=r.color)!==null&&u!==void 0?u:void 0,borderColor:(f=r.borderColor)!==null&&f!==void 0?f:void 0,borderWidth:(h=r.borderWidth)!==null&&h!==void 0?h:0,borderDashArray:(g=r.borderDashArray)!==null&&g!==void 0?g:void 0,borderDashPhase:(p=r.borderDashPhase)!==null&&p!==void 0?p:void 0,borderLineCap:(C=r.borderLineCap)!==null&&C!==void 0?C:void 0,graphicsState:y}))},e.prototype.drawLine=function(t){var r,n,i,s,u;He.assertIs(t.start,"options.start",[[Object,"{ x: number, y: number }"]]),He.assertIs(t.end,"options.end",[[Object,"{ x: number, y: number }"]]),He.assertIs(t.start.x,"options.start.x",["number"]),He.assertIs(t.start.y,"options.start.y",["number"]),He.assertIs(t.end.x,"options.end.x",["number"]),He.assertIs(t.end.y,"options.end.y",["number"]),He.assertOrUndefined(t.thickness,"options.thickness",["number"]),He.assertOrUndefined(t.color,"options.color",[[Object,"Color"]]),He.assertOrUndefined(t.dashArray,"options.dashArray",[Array]),He.assertOrUndefined(t.dashPhase,"options.dashPhase",["number"]),He.assertIsOneOfOrUndefined(t.lineCap,"options.lineCap",U0.LineCapStyle),He.assertRangeOrUndefined(t.opacity,"opacity.opacity",0,1),He.assertIsOneOfOrUndefined(t.blendMode,"options.blendMode",Ag.BlendMode);var f=this.maybeEmbedGraphicsState({borderOpacity:t.opacity,blendMode:t.blendMode});"color"in t||(t.color=tx.rgb(0,0,0));var h=this.getContentStream();h.push.apply(h,lg.drawLine({start:t.start,end:t.end,thickness:(r=t.thickness)!==null&&r!==void 0?r:1,color:(n=t.color)!==null&&n!==void 0?n:void 0,dashArray:(i=t.dashArray)!==null&&i!==void 0?i:void 0,dashPhase:(s=t.dashPhase)!==null&&s!==void 0?s:void 0,lineCap:(u=t.lineCap)!==null&&u!==void 0?u:void 0,graphicsState:f}))},e.prototype.drawRectangle=function(t){var r,n,i,s,u,f,h,g,p,C,y,x,v;t===void 0&&(t={}),He.assertOrUndefined(t.x,"options.x",["number"]),He.assertOrUndefined(t.y,"options.y",["number"]),He.assertOrUndefined(t.width,"options.width",["number"]),He.assertOrUndefined(t.height,"options.height",["number"]),He.assertOrUndefined(t.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(t.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(t.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertOrUndefined(t.borderWidth,"options.borderWidth",["number"]),He.assertOrUndefined(t.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(t.opacity,"opacity.opacity",0,1),He.assertOrUndefined(t.borderColor,"options.borderColor",[[Object,"Color"]]),He.assertOrUndefined(t.borderDashArray,"options.borderDashArray",[Array]),He.assertOrUndefined(t.borderDashPhase,"options.borderDashPhase",["number"]),He.assertIsOneOfOrUndefined(t.borderLineCap,"options.borderLineCap",U0.LineCapStyle),He.assertRangeOrUndefined(t.borderOpacity,"options.borderOpacity",0,1),He.assertIsOneOfOrUndefined(t.blendMode,"options.blendMode",Ag.BlendMode);var F=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.color=tx.rgb(0,0,0));var Q=this.getContentStream();Q.push.apply(Q,lg.drawRectangle({x:(r=t.x)!==null&&r!==void 0?r:this.x,y:(n=t.y)!==null&&n!==void 0?n:this.y,width:(i=t.width)!==null&&i!==void 0?i:150,height:(s=t.height)!==null&&s!==void 0?s:100,rotate:(u=t.rotate)!==null&&u!==void 0?u:Rs.degrees(0),xSkew:(f=t.xSkew)!==null&&f!==void 0?f:Rs.degrees(0),ySkew:(h=t.ySkew)!==null&&h!==void 0?h:Rs.degrees(0),borderWidth:(g=t.borderWidth)!==null&&g!==void 0?g:0,color:(p=t.color)!==null&&p!==void 0?p:void 0,borderColor:(C=t.borderColor)!==null&&C!==void 0?C:void 0,borderDashArray:(y=t.borderDashArray)!==null&&y!==void 0?y:void 0,borderDashPhase:(x=t.borderDashPhase)!==null&&x!==void 0?x:void 0,graphicsState:F,borderLineCap:(v=t.borderLineCap)!==null&&v!==void 0?v:void 0}))},e.prototype.drawSquare=function(t){t===void 0&&(t={});var r=t.size;He.assertOrUndefined(r,"size",["number"]),this.drawRectangle(OA.__assign(OA.__assign({},t),{width:r,height:r}))},e.prototype.drawEllipse=function(t){var r,n,i,s,u,f,h,g,p,C,y;t===void 0&&(t={}),He.assertOrUndefined(t.x,"options.x",["number"]),He.assertOrUndefined(t.y,"options.y",["number"]),He.assertOrUndefined(t.xScale,"options.xScale",["number"]),He.assertOrUndefined(t.yScale,"options.yScale",["number"]),He.assertOrUndefined(t.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(t.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(t.opacity,"opacity.opacity",0,1),He.assertOrUndefined(t.borderColor,"options.borderColor",[[Object,"Color"]]),He.assertRangeOrUndefined(t.borderOpacity,"options.borderOpacity",0,1),He.assertOrUndefined(t.borderWidth,"options.borderWidth",["number"]),He.assertOrUndefined(t.borderDashArray,"options.borderDashArray",[Array]),He.assertOrUndefined(t.borderDashPhase,"options.borderDashPhase",["number"]),He.assertIsOneOfOrUndefined(t.borderLineCap,"options.borderLineCap",U0.LineCapStyle),He.assertIsOneOfOrUndefined(t.blendMode,"options.blendMode",Ag.BlendMode);var x=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.color=tx.rgb(0,0,0));var v=this.getContentStream();v.push.apply(v,lg.drawEllipse({x:(r=t.x)!==null&&r!==void 0?r:this.x,y:(n=t.y)!==null&&n!==void 0?n:this.y,xScale:(i=t.xScale)!==null&&i!==void 0?i:100,yScale:(s=t.yScale)!==null&&s!==void 0?s:100,rotate:(u=t.rotate)!==null&&u!==void 0?u:void 0,color:(f=t.color)!==null&&f!==void 0?f:void 0,borderColor:(h=t.borderColor)!==null&&h!==void 0?h:void 0,borderWidth:(g=t.borderWidth)!==null&&g!==void 0?g:0,borderDashArray:(p=t.borderDashArray)!==null&&p!==void 0?p:void 0,borderDashPhase:(C=t.borderDashPhase)!==null&&C!==void 0?C:void 0,borderLineCap:(y=t.borderLineCap)!==null&&y!==void 0?y:void 0,graphicsState:x}))},e.prototype.drawCircle=function(t){t===void 0&&(t={});var r=t.size,n=r===void 0?100:r;He.assertOrUndefined(n,"size",["number"]),this.drawEllipse(OA.__assign(OA.__assign({},t),{xScale:n,yScale:n}))},e.prototype.setOrEmbedFont=function(t){var r=this.font,n=this.fontKey;t?this.setFont(t):this.getFont();var i=this.font,s=this.fontKey;return{oldFont:r,oldFontKey:n,newFont:i,newFontKey:s}},e.prototype.getFont=function(){if(!this.font||!this.fontKey){var t=this.doc.embedStandardFont(fct.StandardFonts.Helvetica);this.setFont(t)}return[this.font,this.fontKey]},e.prototype.resetFont=function(){this.font=void 0,this.fontKey=void 0},e.prototype.getContentStream=function(t){return t===void 0&&(t=!0),t&&this.contentStream?this.contentStream:(this.contentStream=this.createContentStream(),this.contentStreamRef=this.doc.context.register(this.contentStream),this.node.addContentStream(this.contentStreamRef),this.contentStream)},e.prototype.createContentStream=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.doc.context.obj({}),i=Ia.PDFContentStream.of(n,t);return i},e.prototype.maybeEmbedGraphicsState=function(t){var r=t.opacity,n=t.borderOpacity,i=t.blendMode;if(!(r===void 0&&n===void 0&&i===void 0)){var s=this.doc.context.obj({Type:"ExtGState",ca:r,CA:n,BM:i}),u=this.node.newExtGState("GS",s);return u}},e.prototype.scaleAnnot=function(t,r,n){for(var i=["RD","CL","Vertices","QuadPoints","L","Rect"],s=0,u=i.length;s<u;s++){var f=t.lookup(Ia.PDFName.of(i[s]));f instanceof Ia.PDFArray&&f.scalePDFNumbers(r,n)}var h=t.lookup(Ia.PDFName.of("InkList"));if(h instanceof Ia.PDFArray)for(var s=0,u=h.size();s<u;s++){var g=h.lookup(s);g instanceof Ia.PDFArray&&g.scalePDFNumbers(r,n)}},e.of=function(t,r,n){return new e(t,r,n)},e.create=function(t){He.assertIs(t,"doc",[[rme.default,"PDFDocument"]]);var r=Ia.PDFRef.of(-1),n=Ia.PDFPageLeaf.withContextAndParent(t.context,r),i=t.context.register(n);return new e(n,i,t)},e})();QP.default=lct});var yP=U(_P=>{"use strict";Object.defineProperty(_P,"__esModule",{value:!0});var I3=(ct(),ze(ut)),Act=I3.__importDefault(tl()),ime=I3.__importDefault($f()),dct=l3(),ame=RA(),sme=I3.__importStar(el()),ome=Gu(),hct=zo(),ume=Xi(),dg=fr(),gct=(function(e){I3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return dg.assertIs(r,"acroButton",[[ume.PDFAcroPushButton,"PDFAcroPushButton"]]),s.acroField=r,s}return t.prototype.setImage=function(r,n){n===void 0&&(n=dct.ImageAlignment.Center);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s],h=this.createImageAppearanceStream(f,r,n);this.updateWidgetAppearances(f,{normal:h})}this.markAsClean()},t.prototype.setFontSize=function(r){dg.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.addToPage=function(r,n,i){var s,u,f,h,g,p,C,y,x,v,F;dg.assertOrUndefined(r,"text",["string"]),dg.assertOrUndefined(n,"page",[[Act.default,"PDFPage"]]),sme.assertFieldAppearanceOptions(i);var Q=this.createWidget({x:((s=i?.x)!==null&&s!==void 0?s:0)-((u=i?.borderWidth)!==null&&u!==void 0?u:0)/2,y:((f=i?.y)!==null&&f!==void 0?f:0)-((h=i?.borderWidth)!==null&&h!==void 0?h:0)/2,width:(g=i?.width)!==null&&g!==void 0?g:100,height:(p=i?.height)!==null&&p!==void 0?p:50,textColor:(C=i?.textColor)!==null&&C!==void 0?C:ome.rgb(0,0,0),backgroundColor:(y=i?.backgroundColor)!==null&&y!==void 0?y:ome.rgb(.75,.75,.75),borderColor:i?.borderColor,borderWidth:(x=i?.borderWidth)!==null&&x!==void 0?x:0,rotate:(v=i?.rotate)!==null&&v!==void 0?v:hct.degrees(0),caption:r,hidden:i?.hidden,page:n.ref}),T=this.doc.context.register(Q.dict);this.acroField.addWidget(T);var _=(F=i?.font)!==null&&F!==void 0?F:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(Q,_),n.node.addAnnot(T)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof ume.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){dg.assertIs(r,"font",[[ime.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){dg.assertIs(r,"font",[[ime.default,"PDFFont"]]),dg.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??ame.defaultButtonAppearanceProvider,u=ame.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(sme.default);_P.default=gct});var cme=U(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});var pct=(ct(),ze(ut));pct.__exportStar(RA(),Ku);var mct=yP();Object.defineProperty(Ku,"PDFButton",{enumerable:!0,get:function(){return mct.default}});var Ect=eP();Object.defineProperty(Ku,"PDFCheckBox",{enumerable:!0,get:function(){return Ect.default}});var bct=nP();Object.defineProperty(Ku,"PDFDropdown",{enumerable:!0,get:function(){return bct.default}});var Cct=el();Object.defineProperty(Ku,"PDFField",{enumerable:!0,get:function(){return Cct.default}});var yct=CP();Object.defineProperty(Ku,"PDFForm",{enumerable:!0,get:function(){return yct.default}});var xct=sP();Object.defineProperty(Ku,"PDFOptionList",{enumerable:!0,get:function(){return xct.default}});var vct=fP();Object.defineProperty(Ku,"PDFRadioGroup",{enumerable:!0,get:function(){return vct.default}});var Ict=AP();Object.defineProperty(Ku,"PDFSignature",{enumerable:!0,get:function(){return Ict.default}});var Dct=mP();Object.defineProperty(Ku,"PDFTextField",{enumerable:!0,get:function(){return Dct.default}})});var lme=U(D3=>{"use strict";Object.defineProperty(D3,"__esModule",{value:!0});var fme=(ct(),ze(ut));fme.__exportStar(jy(),D3);fme.__exportStar(L7(),D3)});var Ame=U(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var eu=(ct(),ze(ut));eu.__exportStar(cme(),Ri);eu.__exportStar(lme(),Ri);eu.__exportStar(Gu(),Ri);eu.__exportStar(Pm(),Ri);eu.__exportStar(J7(),Ri);eu.__exportStar($T(),Ri);eu.__exportStar(Lm(),Ri);eu.__exportStar(QA(),Ri);eu.__exportStar(zo(),Ri);eu.__exportStar(xP(),Ri);eu.__exportStar(SP(),Ri);eu.__exportStar(vP(),Ri);eu.__exportStar(p3(),Ri);var Bct=UA();Object.defineProperty(Ri,"PDFDocument",{enumerable:!0,get:function(){return Bct.default}});var wct=$f();Object.defineProperty(Ri,"PDFFont",{enumerable:!0,get:function(){return wct.default}});var Fct=f3();Object.defineProperty(Ri,"PDFImage",{enumerable:!0,get:function(){return Fct.default}});var Tct=tl();Object.defineProperty(Ri,"PDFPage",{enumerable:!0,get:function(){return Tct.default}});var Sct=u3();Object.defineProperty(Ri,"PDFEmbeddedPage",{enumerable:!0,get:function(){return Sct.default}});var Qct=BP();Object.defineProperty(Ri,"PDFJavaScript",{enumerable:!0,get:function(){return Qct.default}})});var hme=U(dme=>{"use strict";Object.defineProperty(dme,"__esModule",{value:!0})});var NP=U(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});var B3=(ct(),ze(ut));B3.__exportStar(Ame(),jm);B3.__exportStar(Xi(),jm);B3.__exportStar(hme(),jm);B3.__exportStar(fr(),jm)});var Wct={};Ka(Wct,{DocuParse:()=>MP});module.exports=ze(Wct);var nl=require("n8n-workflow"),MP=class{constructor(){this.description={displayName:"DocuParse",name:"docuParse",icon:"file:ener.png",group:["transform"],version:1,subtitle:'={{ $parameter["operation"] }}',description:"Full-featured document parsing \u2014 PDF, DOCX, XLSX, PPTX, images, OCR, markdown output. No native dependencies.",defaults:{name:"DocuParse"},inputs:["main"],outputs:["main"],properties:[{displayName:"Operation",name:"operation",type:"options",noDataExpression:!0,options:[{name:"Parse Document",value:"parse",description:"Extract text, tables, and structure from documents",action:"Parse a document"},{name:"OCR Image",value:"ocr",description:"Extract text from images using OCR",action:"OCR an image"},{name:"Extract Tables",value:"tables",description:"Extract tables as structured JSON",action:"Extract tables from document"},{name:"Convert to Markdown",value:"markdown",description:"Convert document to clean markdown",action:"Convert to markdown"},{name:"Merge PDFs",value:"merge",description:"Merge multiple PDF files into one",action:"Merge PDF files"},{name:"Split PDF",value:"split",description:"Split PDF into separate pages",action:"Split PDF into pages"},{name:"Extract Entities",value:"entities",description:"Extract emails, phones, URLs, dates from text",action:"Extract entities from document"}],default:"parse"},{displayName:"Input Binary Field",name:"binaryPropertyName",type:"string",default:"data",required:!0,description:"The name of the binary property containing the document file"},{displayName:"Output Format",name:"outputFormat",type:"options",options:[{name:"Markdown",value:"markdown",description:"Structured markdown with headings, tables, lists"},{name:"JSON",value:"json",description:"Structured JSON with text items and positions"},{name:"Text",value:"text",description:"Plain text with layout preserved"}],default:"markdown",description:"Output format for the parsed document",displayOptions:{show:{operation:["parse"]}}},{displayName:"OCR Language",name:"ocrLanguage",type:"options",options:[{name:"English",value:"eng"},{name:"Arabic",value:"ara"},{name:"Chinese (Simplified)",value:"chi_sim"},{name:"Chinese (Traditional)",value:"chi_tra"},{name:"French",value:"fra"},{name:"German",value:"deu"},{name:"Hindi",value:"hin"},{name:"Japanese",value:"jpn"},{name:"Korean",value:"kor"},{name:"Portuguese",value:"por"},{name:"Russian",value:"rus"},{name:"Spanish",value:"spa"},{name:"Urdu",value:"urd"}],default:"eng",description:"Language for OCR recognition",displayOptions:{show:{operation:["ocr","parse"]}}},{displayName:"Enable OCR for Scanned Pages",name:"enableOcr",type:"boolean",default:!1,description:"Whether to run OCR on pages with little or no text (scanned documents)",displayOptions:{show:{operation:["parse"]}}},{displayName:"Target Pages",name:"targetPages",type:"string",default:"",placeholder:"1-5,10,15-20",description:'Specific pages to process (e.g. "1-5,10,15-20"). Leave empty for all pages.',displayOptions:{show:{operation:["parse","markdown","tables","split"]}}},{displayName:"Entity Types",name:"entityTypes",type:"multiOptions",options:[{name:"Emails",value:"emails"},{name:"Phone Numbers",value:"phones"},{name:"URLs",value:"urls"},{name:"Dates",value:"dates"},{name:"IP Addresses",value:"ips"},{name:"Currency Amounts",value:"currency"}],default:["emails","phones","urls","dates"],description:"Types of entities to extract",displayOptions:{show:{operation:["entities"]}}},{displayName:"Additional PDF Fields",name:"additionalPdfFields",type:"string",default:"data1",placeholder:"data1,data2,data3",description:"Comma-separated binary field names for additional PDFs to merge",displayOptions:{show:{operation:["merge"]}}},{displayName:"Password",name:"password",type:"string",typeOptions:{password:!0},default:"",description:"Password for encrypted/protected documents",displayOptions:{show:{operation:["parse","markdown","tables","split"]}}},{displayName:"Extract Images",name:"extractImages",type:"boolean",default:!1,description:"Whether to extract images from the document as binary data",displayOptions:{show:{operation:["parse"]}}}]}}async execute(){let t=this.getInputData(),r=[],n=this.getNodeParameter("operation",0),i=this.getNodeParameter("binaryPropertyName",0);if(n==="parse"){let s=this.getNodeParameter("outputFormat",0),u=this.getNodeParameter("enableOcr",0),f=this.getNodeParameter("ocrLanguage",0,"eng"),h=this.getNodeParameter("targetPages",0,""),g=this.getNodeParameter("password",0,"")||void 0;for(let p=0;p<t.length;p++)try{let C=await this.helpers.getBinaryDataBuffer(p,i),y=t[p].binary?.[i];if(!y)throw new nl.NodeOperationError(this.getNode(),`Binary property "${i}" not found on item ${p}`,{itemIndex:p});let x=y.mimeType||"",v=y.fileName||"document",F=v.split(".").pop()?.toLowerCase()||"",Q={};if(x==="application/pdf"||F==="pdf")Q=await kP(C,s,h,u,f,g);else if(x.includes("wordprocessingml")||F==="docx"||F==="doc")Q=await RP(C,s);else if(x.includes("spreadsheetml")||F==="xlsx"||F==="xls")Q=await _ct(C,s);else if(x.includes("presentationml")||F==="pptx"||F==="ppt")Q=await Nct(C,s);else if(x.includes("text/html")||F==="html"||F==="htm")Q=await gme(C,s);else if(x.includes("text/csv")||F==="csv")Q=await kct(C,s);else if(x.startsWith("image/")||["png","jpg","jpeg","tiff","bmp","webp"].includes(F))Q=await OP(C,f);else if(x.startsWith("text/")||["txt","md","json","xml"].includes(F))Q={text:C.toString("utf-8"),format:"text"};else throw new Error(`Unsupported file type: ${x} (.${F})`);r.push({json:{...Q,fileName:v,mimeType:x,format:s},binary:t[p].binary})}catch(C){if(this.continueOnFail()){r.push({json:{error:C.message},pairedItem:{item:p}});continue}throw new nl.NodeOperationError(this.getNode(),C,{itemIndex:p})}}else if(n==="ocr"){let s=this.getNodeParameter("ocrLanguage",0,"eng");for(let u=0;u<t.length;u++)try{let f=await this.helpers.getBinaryDataBuffer(u,i),h=await OP(f,s);r.push({json:{...h,format:"ocr"},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new nl.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="tables"){let s=this.getNodeParameter("targetPages",0,"");for(let u=0;u<t.length;u++)try{let f=await this.helpers.getBinaryDataBuffer(u,i),h=t[u].binary?.[i],g=h?.fileName?.split(".").pop()?.toLowerCase()||"",p=[];if(h?.mimeType==="application/pdf"||g==="pdf")p=await Rct(f,s);else if(h?.mimeType?.includes("spreadsheetml")||g==="xlsx"||g==="xls")p=await Uct(f);else throw new Error("Table extraction supports PDF and XLSX files only");r.push({json:{tables:p,tableCount:p.length},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new nl.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="markdown"){let s=this.getNodeParameter("targetPages",0,"");for(let u=0;u<t.length;u++)try{let f=await this.helpers.getBinaryDataBuffer(u,i),h=t[u].binary?.[i],g=h?.fileName?.split(".").pop()?.toLowerCase()||"",p="";if(h?.mimeType==="application/pdf"||g==="pdf")p=(await kP(f,"markdown",s,!1,"eng")).text;else if(h?.mimeType?.includes("wordprocessingml")||g==="docx")p=(await RP(f,"markdown")).text;else if(h?.mimeType?.includes("text/html")||g==="html")p=(await gme(f,"markdown")).text;else throw new Error("Markdown conversion supports PDF, DOCX, and HTML files");r.push({json:{markdown:p,format:"markdown"},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new nl.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="merge"){let s=this.getNodeParameter("additionalPdfFields",0,"").split(",").map(p=>p.trim()).filter(Boolean),u=[i,...s],f=[];for(let p=0;p<t.length;p++)for(let C of u)try{let y=await this.helpers.getBinaryDataBuffer(p,C);f.push(y)}catch{}if(f.length<2)throw new nl.NodeOperationError(this.getNode(),"Need at least 2 PDFs to merge");let h=await Mct(f),g=await this.helpers.prepareBinaryData(h,"merged.pdf","application/pdf");r.push({json:{pageCount:f.length,status:"merged"},binary:{...t[0].binary,merged_pdf:g}})}else if(n==="split"){let s=this.getNodeParameter("targetPages",0,"");for(let u=0;u<t.length;u++)try{let f=await this.helpers.getBinaryDataBuffer(u,i),h=await Oct(f,s);for(let g of h){let p=await this.helpers.prepareBinaryData(g.buffer,`page_${g.pageNum}.pdf`,"application/pdf");r.push({json:{pageNum:g.pageNum},binary:{...t[u].binary,[`page_${g.pageNum}`]:p},pairedItem:{item:u}})}}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new nl.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="entities"){let s=this.getNodeParameter("entityTypes",0);for(let u=0;u<t.length;u++)try{let f=await this.helpers.getBinaryDataBuffer(u,i),h=t[u].binary?.[i],g=h?.mimeType||"",p=h?.fileName?.split(".").pop()?.toLowerCase()||"",C="";g==="application/pdf"||p==="pdf"?C=(await kP(f,"text","",!1,"eng")).text:g.includes("wordprocessingml")||p==="docx"?C=(await RP(f,"text")).text:C=f.toString("utf-8");let y=Lct(C,s);r.push({json:{entities:y,entityCounts:Object.fromEntries(s.map(x=>[x,y[x]?.length||0]))},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new nl.NodeOperationError(this.getNode(),f,{itemIndex:u})}}return[r]}};async function kP(e,t,r,n,i,s){let h=await(await import("pdfjs-dist")).getDocument({data:new Uint8Array(e),password:s}).promise,g=h.numPages,p=r?LP(r,g):Array.from({length:g},(x,v)=>v+1),C=[];for(let x of p)try{let v=await h.getPage(x),F=await v.getTextContent(),Q=v.getViewport({scale:1}),T=F.items.map(ne=>({text:ne.str,x:Math.round(ne.transform[4]*10)/10,y:Math.round(ne.transform[5]*10)/10,width:ne.width||0,height:Math.abs(ne.transform[3])||12,fontName:ne.fontName||""})).filter(ne=>ne.text.trim().length>0),_=Q.height,S=_*.95,N=_*.05,O=T.filter(ne=>ne.y<S&&ne.y>N),H=3,q=[],G=[...O].sort((ne,Le)=>Le.y-ne.y);for(let ne of G){let Le=q.find(X=>Math.abs(X.y-ne.y)<H);Le?Le.items.push(ne):q.push({y:ne.y,items:[ne]})}for(let ne of q)ne.items.sort((Le,X)=>Le.x-X.x);let J=50,Ie=[];for(let ne of q){if(ne.items.length===0)continue;let Le=ne.items[0].text;for(let X=1;X<ne.items.length;X++)ne.items[X].x-(ne.items[X-1].x+ne.items[X-1].width)>J?Le+=" ":Le+=" ",Le+=ne.items[X].text;Ie.push(Le.trim())}let fe=Ie.join(`
|
|
541
|
+
`+X7.setFillingColor(n).toString();this.acroField.setDefaultAppearance(N)}return F},e.prototype.updateWidgetAppearanceWithFont=function(t,r,n){var i=n.normal,s=n.rollover,u=n.down;this.updateWidgetAppearances(t,{normal:this.createAppearanceStream(t,i,r),rollover:s&&this.createAppearanceStream(t,s,r),down:u&&this.createAppearanceStream(t,u,r)})},e.prototype.updateOnOffWidgetAppearance=function(t,r,n){var i=n.normal,s=n.rollover,u=n.down;this.updateWidgetAppearances(t,{normal:this.createAppearanceDict(t,i,r),rollover:s&&this.createAppearanceDict(t,s,r),down:u&&this.createAppearanceDict(t,u,r)})},e.prototype.updateWidgetAppearances=function(t,r){var n=r.normal,i=r.rollover,s=r.down;t.setNormalAppearance(n),i?t.setRolloverAppearance(i):t.removeRolloverAppearance(),s?t.setDownAppearance(s):t.removeDownAppearance()},e.prototype.createAppearanceStream=function(t,r,n){var i,s=this.acroField.dict.context,u=t.getRectangle(),f=u.width,h=u.height,g=n&&{Font:(i={},i[n.name]=n.ref,i)},p=s.formXObject(r,{Resources:g,BBox:s.obj([0,0,f,h]),Matrix:s.obj([1,0,0,1,0,0])}),C=s.register(p);return C},e.prototype.createImageAppearanceStream=function(t,r,n){var i,s,u=this.acroField.dict.context,f=t.getRectangle(),h=t.getAppearanceCharacteristics(),g=t.getBorderStyle(),p=(s=g?.getWidth())!==null&&s!==void 0?s:0,C=ug.reduceRotation(h?.getRotation()),y=kpe.rotateInPlace(A3.__assign(A3.__assign({},f),{rotation:C})),x=ug.adjustDimsForRotation(f,C),v=r.scaleToFit(x.width-p*2,x.height-p*2),F={x:p,y:p,width:v.width,height:v.height,rotate:ug.degrees(0),xSkew:ug.degrees(0),ySkew:ug.degrees(0)};n===Npe.ImageAlignment.Center?(F.x+=(x.width-p*2)/2-v.width/2,F.y+=(x.height-p*2)/2-v.height/2):n===Npe.ImageAlignment.Right&&(F.x=x.width-p-v.width,F.y=x.height-p-v.height);var Q=this.doc.context.addRandomSuffix("Image",10),T=A3.__spreadArrays(y,kpe.drawImage(Q,F)),_={XObject:(i={},i[Q]=r.ref,i)},S=u.formXObject(T,{Resources:_,BBox:u.obj([0,0,f.width,f.height]),Matrix:u.obj([1,0,0,1,0,0])});return u.register(S)},e.prototype.createAppearanceDict=function(t,r,n){var i=this.acroField.dict.context,s=this.createAppearanceStream(t,r.on),u=this.createAppearanceStream(t,r.off),f=i.obj({});return f.set(n,s),f.set(va.PDFName.of("Off"),u),f},e})();Xy.default=yut});var eP=U($7=>{"use strict";Object.defineProperty($7,"__esModule",{value:!0});var Z7=(ct(),ze(ut)),xut=Z7.__importDefault(tl()),Rpe=RA(),K7=Gu(),vut=zo(),Upe=Z7.__importStar(el()),cg=Xi(),z7=fr(),Iut=(function(e){Z7.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return z7.assertIs(r,"acroCheckBox",[[cg.PDFAcroCheckBox,"PDFAcroCheckBox"]]),s.acroField=r,s}return t.prototype.check=function(){var r,n=(r=this.acroField.getOnValue())!==null&&r!==void 0?r:cg.PDFName.of("Yes");this.markAsDirty(),this.acroField.setValue(n)},t.prototype.uncheck=function(){this.markAsDirty(),this.acroField.setValue(cg.PDFName.of("Off"))},t.prototype.isChecked=function(){var r=this.acroField.getOnValue();return!!r&&r===this.acroField.getValue()},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g;z7.assertIs(r,"page",[[xut.default,"PDFPage"]]),Upe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=K7.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=K7.rgb(1,1,1)),"borderColor"in n||(n.borderColor=K7.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var p=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:50,height:(f=n.height)!==null&&f!==void 0?f:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:vut.degrees(0),hidden:n.hidden,page:r.ref}),C=this.doc.context.register(p.dict);this.acroField.addWidget(C),p.setAppearanceState(cg.PDFName.of("Off")),this.updateWidgetAppearance(p,cg.PDFName.of("Yes")),r.node.addAnnot(C)},t.prototype.needsAppearancesUpdate=function(){for(var r,n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=u.getAppearanceState(),h=(r=u.getAppearances())===null||r===void 0?void 0:r.normal;if(!(h instanceof cg.PDFDict)||f&&!h.has(f))return!0}return!1},t.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},t.prototype.updateAppearances=function(r){var n;z7.assertOrUndefined(r,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s],h=(n=f.getOnValue())!==null&&n!==void 0?n:cg.PDFName.of("Yes");h&&this.updateWidgetAppearance(f,h,r)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Rpe.defaultCheckBoxAppearanceProvider,u=Rpe.normalizeAppearance(s(this,r));this.updateOnOffWidgetAppearance(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Upe.default);$7.default=Iut});var nP=U(rP=>{"use strict";Object.defineProperty(rP,"__esModule",{value:!0});var d3=(ct(),ze(ut)),Dut=d3.__importDefault(tl()),Mpe=d3.__importDefault($f()),Ope=d3.__importStar(el()),Lpe=RA(),tP=Gu(),But=zo(),Ki=Xi(),R0=fr(),wut=(function(e){d3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return R0.assertIs(r,"acroComboBox",[[Ki.PDFAcroComboBox,"PDFAcroComboBox"]]),s.acroField=r,s}return t.prototype.getOptions=function(){for(var r=this.acroField.getOptions(),n=new Array(r.length),i=0,s=n.length;i<s;i++){var u=r[i],f=u.display,h=u.value;n[i]=(f??h).decodeText()}return n},t.prototype.getSelected=function(){for(var r=this.acroField.getValues(),n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=r[i].decodeText();return n},t.prototype.setOptions=function(r){R0.assertIs(r,"options",[Array]);for(var n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]={value:Ki.PDFHexString.fromText(r[i])};this.acroField.setOptions(n)},t.prototype.addOptions=function(r){R0.assertIs(r,"options",["string",Array]);for(var n=Array.isArray(r)?r:[r],i=this.acroField.getOptions(),s=new Array(n.length),u=0,f=n.length;u<f;u++)s[u]={value:Ki.PDFHexString.fromText(n[u])};this.acroField.setOptions(i.concat(s))},t.prototype.select=function(r,n){n===void 0&&(n=!1),R0.assertIs(r,"options",["string",Array]),R0.assertIs(n,"merge",["boolean"]);var i=Array.isArray(r)?r:[r],s=this.getOptions(),u=i.find(function(C){return!s.includes(C)});u&&this.enableEditing(),this.markAsDirty(),(i.length>1||i.length===1&&n)&&this.enableMultiselect();for(var f=new Array(i.length),h=0,g=i.length;h<g;h++)f[h]=Ki.PDFHexString.fromText(i[h]);if(n){var p=this.acroField.getValues();this.acroField.setValues(p.concat(f))}else this.acroField.setValues(f)},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},t.prototype.setFontSize=function(r){R0.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.isEditable=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.Edit)},t.prototype.enableEditing=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Edit,!0)},t.prototype.disableEditing=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Edit,!1)},t.prototype.isSorted=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.Sort)},t.prototype.enableSorting=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Sort,!0)},t.prototype.disableSorting=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.Sort,!1)},t.prototype.isMultiselect=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.MultiSelect)},t.prototype.enableMultiselect=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.MultiSelect,!0)},t.prototype.disableMultiselect=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.MultiSelect,!1)},t.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(Ki.AcroChoiceFlags.DoNotSpellCheck)},t.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.DoNotSpellCheck,!1)},t.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.DoNotSpellCheck,!0)},t.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(Ki.AcroChoiceFlags.CommitOnSelChange)},t.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.CommitOnSelChange,!0)},t.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(Ki.AcroChoiceFlags.CommitOnSelChange,!1)},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g,p;R0.assertIs(r,"page",[[Dut.default,"PDFPage"]]),Ope.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=tP.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=tP.rgb(1,1,1)),"borderColor"in n||(n.borderColor=tP.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var C=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:200,height:(f=n.height)!==null&&f!==void 0?f:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:But.degrees(0),hidden:n.hidden,page:r.ref}),y=this.doc.context.register(C.dict);this.acroField.addWidget(y);var x=(p=n.font)!==null&&p!==void 0?p:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(C,x),r.node.addAnnot(y)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof Ki.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){R0.assertIs(r,"font",[[Mpe.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){R0.assertIs(r,"font",[[Mpe.default,"PDFFont"]]),R0.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Lpe.defaultDropdownAppearanceProvider,u=Lpe.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Ope.default);rP.default=wut});var sP=U(aP=>{"use strict";Object.defineProperty(aP,"__esModule",{value:!0});var h3=(ct(),ze(ut)),Fut=h3.__importDefault(tl()),Ppe=h3.__importDefault($f()),Hpe=h3.__importStar(el()),qpe=RA(),iP=Gu(),Tut=zo(),bo=Xi(),Nc=fr(),Sut=(function(e){h3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Nc.assertIs(r,"acroListBox",[[bo.PDFAcroListBox,"PDFAcroListBox"]]),s.acroField=r,s}return t.prototype.getOptions=function(){for(var r=this.acroField.getOptions(),n=new Array(r.length),i=0,s=n.length;i<s;i++){var u=r[i],f=u.display,h=u.value;n[i]=(f??h).decodeText()}return n},t.prototype.getSelected=function(){for(var r=this.acroField.getValues(),n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=r[i].decodeText();return n},t.prototype.setOptions=function(r){Nc.assertIs(r,"options",[Array]),this.markAsDirty();for(var n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]={value:bo.PDFHexString.fromText(r[i])};this.acroField.setOptions(n)},t.prototype.addOptions=function(r){Nc.assertIs(r,"options",["string",Array]),this.markAsDirty();for(var n=Array.isArray(r)?r:[r],i=this.acroField.getOptions(),s=new Array(n.length),u=0,f=n.length;u<f;u++)s[u]={value:bo.PDFHexString.fromText(n[u])};this.acroField.setOptions(i.concat(s))},t.prototype.select=function(r,n){n===void 0&&(n=!1),Nc.assertIs(r,"options",["string",Array]),Nc.assertIs(n,"merge",["boolean"]);var i=Array.isArray(r)?r:[r],s=this.getOptions();Nc.assertIsSubset(i,"option",s),this.markAsDirty(),(i.length>1||i.length===1&&n)&&this.enableMultiselect();for(var u=new Array(i.length),f=0,h=i.length;f<h;f++)u[f]=bo.PDFHexString.fromText(i[f]);if(n){var g=this.acroField.getValues();this.acroField.setValues(g.concat(u))}else this.acroField.setValues(u)},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},t.prototype.setFontSize=function(r){Nc.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.isSorted=function(){return this.acroField.hasFlag(bo.AcroChoiceFlags.Sort)},t.prototype.enableSorting=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.Sort,!0)},t.prototype.disableSorting=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.Sort,!1)},t.prototype.isMultiselect=function(){return this.acroField.hasFlag(bo.AcroChoiceFlags.MultiSelect)},t.prototype.enableMultiselect=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.MultiSelect,!0)},t.prototype.disableMultiselect=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.MultiSelect,!1)},t.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(bo.AcroChoiceFlags.CommitOnSelChange)},t.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.CommitOnSelChange,!0)},t.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(bo.AcroChoiceFlags.CommitOnSelChange,!1)},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g,p;Nc.assertIs(r,"page",[[Fut.default,"PDFPage"]]),Hpe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=iP.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=iP.rgb(1,1,1)),"borderColor"in n||(n.borderColor=iP.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var C=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:200,height:(f=n.height)!==null&&f!==void 0?f:100,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:Tut.degrees(0),hidden:n.hidden,page:r.ref}),y=this.doc.context.register(C.dict);this.acroField.addWidget(y);var x=(p=n.font)!==null&&p!==void 0?p:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(C,x),r.node.addAnnot(y)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof bo.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){Nc.assertIs(r,"font",[[Ppe.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){Nc.assertIs(r,"font",[[Ppe.default,"PDFFont"]]),Nc.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??qpe.defaultOptionListAppearanceProvider,u=qpe.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Hpe.default);aP.default=Sut});var fP=U(cP=>{"use strict";Object.defineProperty(cP,"__esModule",{value:!0});var uP=(ct(),ze(ut)),Qut=uP.__importDefault(tl()),Wpe=uP.__importStar(el()),Gpe=RA(),oP=Gu(),_ut=zo(),Ju=Xi(),Wm=fr(),Nut=(function(e){uP.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Wm.assertIs(r,"acroRadioButton",[[Ju.PDFAcroRadioButton,"PDFAcroRadioButton"]]),s.acroField=r,s}return t.prototype.getOptions=function(){var r=this.acroField.getExportValues();if(r){for(var n=new Array(r.length),i=0,s=r.length;i<s;i++)n[i]=r[i].decodeText();return n}for(var u=this.acroField.getOnValues(),f=new Array(u.length),i=0,s=f.length;i<s;i++)f[i]=u[i].decodeText();return f},t.prototype.getSelected=function(){var r=this.acroField.getValue();if(r!==Ju.PDFName.of("Off")){var n=this.acroField.getExportValues();if(n){for(var i=this.acroField.getOnValues(),s=0,u=i.length;s<u;s++)if(i[s]===r)return n[s].decodeText()}return r.decodeText()}},t.prototype.select=function(r){Wm.assertIs(r,"option",["string"]);var n=this.getOptions();Wm.assertIsOneOf(r,"option",n),this.markAsDirty();var i=this.acroField.getOnValues(),s=this.acroField.getExportValues();if(s)for(var u=0,f=s.length;u<f;u++)s[u].decodeText()===r&&this.acroField.setValue(i[u]);else for(var u=0,f=i.length;u<f;u++){var h=i[u];h.decodeText()===r&&this.acroField.setValue(h)}},t.prototype.clear=function(){this.markAsDirty(),this.acroField.setValue(Ju.PDFName.of("Off"))},t.prototype.isOffToggleable=function(){return!this.acroField.hasFlag(Ju.AcroButtonFlags.NoToggleToOff)},t.prototype.enableOffToggling=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.NoToggleToOff,!1)},t.prototype.disableOffToggling=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.NoToggleToOff,!0)},t.prototype.isMutuallyExclusive=function(){return!this.acroField.hasFlag(Ju.AcroButtonFlags.RadiosInUnison)},t.prototype.enableMutualExclusion=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.RadiosInUnison,!1)},t.prototype.disableMutualExclusion=function(){this.acroField.setFlagTo(Ju.AcroButtonFlags.RadiosInUnison,!0)},t.prototype.addOptionToPage=function(r,n,i){var s,u,f,h,g,p,C,y,x;Wm.assertIs(r,"option",["string"]),Wm.assertIs(n,"page",[[Qut.default,"PDFPage"]]),Wpe.assertFieldAppearanceOptions(i);var v=this.createWidget({x:(s=i?.x)!==null&&s!==void 0?s:0,y:(u=i?.y)!==null&&u!==void 0?u:0,width:(f=i?.width)!==null&&f!==void 0?f:50,height:(h=i?.height)!==null&&h!==void 0?h:50,textColor:(g=i?.textColor)!==null&&g!==void 0?g:oP.rgb(0,0,0),backgroundColor:(p=i?.backgroundColor)!==null&&p!==void 0?p:oP.rgb(1,1,1),borderColor:(C=i?.borderColor)!==null&&C!==void 0?C:oP.rgb(0,0,0),borderWidth:(y=i?.borderWidth)!==null&&y!==void 0?y:1,rotate:(x=i?.rotate)!==null&&x!==void 0?x:_ut.degrees(0),hidden:i?.hidden,page:n.ref}),F=this.doc.context.register(v.dict),Q=this.acroField.addWidgetWithOpt(F,Ju.PDFHexString.fromText(r),!this.isMutuallyExclusive());v.setAppearanceState(Ju.PDFName.of("Off")),this.updateWidgetAppearance(v,Q),n.node.addAnnot(F)},t.prototype.needsAppearancesUpdate=function(){for(var r,n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=u.getAppearanceState(),h=(r=u.getAppearances())===null||r===void 0?void 0:r.normal;if(!(h instanceof Ju.PDFDict)||f&&!h.has(f))return!0}return!1},t.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},t.prototype.updateAppearances=function(r){Wm.assertOrUndefined(r,"provider",[Function]);for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=u.getOnValue();f&&this.updateWidgetAppearance(u,f,r)}},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Gpe.defaultRadioGroupAppearanceProvider,u=Gpe.normalizeAppearance(s(this,r));this.updateOnOffWidgetAppearance(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(Wpe.default);cP.default=Nut});var AP=U(lP=>{"use strict";Object.defineProperty(lP,"__esModule",{value:!0});var Vpe=(ct(),ze(ut)),kut=Vpe.__importDefault(el()),Rut=Xi(),Uut=fr(),Mut=(function(e){Vpe.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return Uut.assertIs(r,"acroSignature",[[Rut.PDFAcroSignature,"PDFAcroSignature"]]),s.acroField=r,s}return t.prototype.needsAppearancesUpdate=function(){return!1},t.of=function(r,n,i){return new t(r,n,i)},t})(kut.default);lP.default=Mut});var mP=U(pP=>{"use strict";Object.defineProperty(pP,"__esModule",{value:!0});var g3=(ct(),ze(ut)),Out=g3.__importDefault(tl()),Ype=g3.__importDefault($f()),jpe=g3.__importStar(el()),Jpe=RA(),dP=Gu(),Lut=zo(),hP=Pm(),gP=l3(),fg=jy(),si=Xi(),rl=fr(),Put=(function(e){g3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return rl.assertIs(r,"acroText",[[si.PDFAcroText,"PDFAcroText"]]),s.acroField=r,s}return t.prototype.getText=function(){var r=this.acroField.getValue();if(!r&&this.isRichFormatted())throw new hP.RichTextFieldReadError(this.getName());return r?.decodeText()},t.prototype.setText=function(r){rl.assertOrUndefined(r,"text",["string"]);var n=this.getMaxLength();if(n!==void 0&&r&&r.length>n)throw new hP.ExceededMaxLengthError(r.length,n,this.getName());this.markAsDirty(),this.disableRichFormatting(),r?this.acroField.setValue(si.PDFHexString.fromText(r)):this.acroField.removeValue()},t.prototype.getAlignment=function(){var r=this.acroField.getQuadding();return r===0?fg.TextAlignment.Left:r===1?fg.TextAlignment.Center:r===2?fg.TextAlignment.Right:fg.TextAlignment.Left},t.prototype.setAlignment=function(r){rl.assertIsOneOf(r,"alignment",fg.TextAlignment),this.markAsDirty(),this.acroField.setQuadding(r)},t.prototype.getMaxLength=function(){return this.acroField.getMaxLength()},t.prototype.setMaxLength=function(r){if(rl.assertRangeOrUndefined(r,"maxLength",0,Number.MAX_SAFE_INTEGER),this.markAsDirty(),r===void 0)this.acroField.removeMaxLength();else{var n=this.getText();if(n&&n.length>r)throw new hP.InvalidMaxLengthError(n.length,r,this.getName());this.acroField.setMaxLength(r)}},t.prototype.removeMaxLength=function(){this.markAsDirty(),this.acroField.removeMaxLength()},t.prototype.setImage=function(r){for(var n=this.getAlignment(),i=n===fg.TextAlignment.Center?gP.ImageAlignment.Center:n===fg.TextAlignment.Right?gP.ImageAlignment.Right:gP.ImageAlignment.Left,s=this.acroField.getWidgets(),u=0,f=s.length;u<f;u++){var h=s[u],g=this.createImageAppearanceStream(h,r,i);this.updateWidgetAppearances(h,{normal:g})}this.markAsClean()},t.prototype.setFontSize=function(r){rl.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.isMultiline=function(){return this.acroField.hasFlag(si.AcroTextFlags.Multiline)},t.prototype.enableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(si.AcroTextFlags.Multiline,!0)},t.prototype.disableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(si.AcroTextFlags.Multiline,!1)},t.prototype.isPassword=function(){return this.acroField.hasFlag(si.AcroTextFlags.Password)},t.prototype.enablePassword=function(){this.acroField.setFlagTo(si.AcroTextFlags.Password,!0)},t.prototype.disablePassword=function(){this.acroField.setFlagTo(si.AcroTextFlags.Password,!1)},t.prototype.isFileSelector=function(){return this.acroField.hasFlag(si.AcroTextFlags.FileSelect)},t.prototype.enableFileSelection=function(){this.acroField.setFlagTo(si.AcroTextFlags.FileSelect,!0)},t.prototype.disableFileSelection=function(){this.acroField.setFlagTo(si.AcroTextFlags.FileSelect,!1)},t.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(si.AcroTextFlags.DoNotSpellCheck)},t.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotSpellCheck,!1)},t.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotSpellCheck,!0)},t.prototype.isScrollable=function(){return!this.acroField.hasFlag(si.AcroTextFlags.DoNotScroll)},t.prototype.enableScrolling=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotScroll,!1)},t.prototype.disableScrolling=function(){this.acroField.setFlagTo(si.AcroTextFlags.DoNotScroll,!0)},t.prototype.isCombed=function(){return this.acroField.hasFlag(si.AcroTextFlags.Comb)&&!this.isMultiline()&&!this.isPassword()&&!this.isFileSelector()&&this.getMaxLength()!==void 0},t.prototype.enableCombing=function(){if(this.getMaxLength()===void 0){var r="PDFTextFields must have a max length in order to be combed";console.warn(r)}this.markAsDirty(),this.disableMultiline(),this.disablePassword(),this.disableFileSelection(),this.acroField.setFlagTo(si.AcroTextFlags.Comb,!0)},t.prototype.disableCombing=function(){this.markAsDirty(),this.acroField.setFlagTo(si.AcroTextFlags.Comb,!1)},t.prototype.isRichFormatted=function(){return this.acroField.hasFlag(si.AcroTextFlags.RichText)},t.prototype.enableRichFormatting=function(){this.acroField.setFlagTo(si.AcroTextFlags.RichText,!0)},t.prototype.disableRichFormatting=function(){this.acroField.setFlagTo(si.AcroTextFlags.RichText,!1)},t.prototype.addToPage=function(r,n){var i,s,u,f,h,g,p;rl.assertIs(r,"page",[[Out.default,"PDFPage"]]),jpe.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=dP.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=dP.rgb(1,1,1)),"borderColor"in n||(n.borderColor=dP.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var C=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(s=n.y)!==null&&s!==void 0?s:0,width:(u=n.width)!==null&&u!==void 0?u:200,height:(f=n.height)!==null&&f!==void 0?f:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(h=n.borderWidth)!==null&&h!==void 0?h:0,rotate:(g=n.rotate)!==null&&g!==void 0?g:Lut.degrees(0),hidden:n.hidden,page:r.ref}),y=this.doc.context.register(C.dict);this.acroField.addWidget(y);var x=(p=n.font)!==null&&p!==void 0?p:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(C,x),r.node.addAnnot(y)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof si.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){rl.assertIs(r,"font",[[Ype.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){rl.assertIs(r,"font",[[Ype.default,"PDFFont"]]),rl.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}this.markAsClean()},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??Jpe.defaultTextFieldAppearanceProvider,u=Jpe.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(jpe.default);pP.default=Put});var p3=U(Ky=>{"use strict";Object.defineProperty(Ky,"__esModule",{value:!0});Ky.StandardFonts=void 0;var Hut;(function(e){e.Courier="Courier",e.CourierBold="Courier-Bold",e.CourierOblique="Courier-Oblique",e.CourierBoldOblique="Courier-BoldOblique",e.Helvetica="Helvetica",e.HelveticaBold="Helvetica-Bold",e.HelveticaOblique="Helvetica-Oblique",e.HelveticaBoldOblique="Helvetica-BoldOblique",e.TimesRoman="Times-Roman",e.TimesRomanBold="Times-Bold",e.TimesRomanItalic="Times-Italic",e.TimesRomanBoldItalic="Times-BoldItalic",e.Symbol="Symbol",e.ZapfDingbats="ZapfDingbats"})(Hut=Ky.StandardFonts||(Ky.StandardFonts={}))});var CP=U(bP=>{"use strict";Object.defineProperty(bP,"__esModule",{value:!0});var Xu=(ct(),ze(ut)),qut=Xu.__importDefault(UA()),E3=Xu.__importDefault(yP()),zy=Xu.__importDefault(eP()),b3=Xu.__importDefault(nP()),C3=Xu.__importDefault(sP()),Zy=Xu.__importDefault(fP()),EP=Xu.__importDefault(AP()),y3=Xu.__importDefault(mP()),kc=Pm(),Wut=Xu.__importDefault($f()),Gut=p3(),Vut=Lm(),m3=QA(),In=Xi(),Fi=fr(),Yut=(function(){function e(t,r){var n=this;this.embedDefaultFont=function(){return n.doc.embedStandardFont(Gut.StandardFonts.Helvetica)},Fi.assertIs(t,"acroForm",[[In.PDFAcroForm,"PDFAcroForm"]]),Fi.assertIs(r,"doc",[[qut.default,"PDFDocument"]]),this.acroForm=t,this.doc=r,this.dirtyFields=new Set,this.defaultFontCache=Fi.Cache.populatedBy(this.embedDefaultFont)}return e.prototype.hasXFA=function(){return this.acroForm.dict.has(In.PDFName.of("XFA"))},e.prototype.deleteXFA=function(){this.acroForm.dict.delete(In.PDFName.of("XFA"))},e.prototype.getFields=function(){for(var t=this.acroForm.getAllFields(),r=[],n=0,i=t.length;n<i;n++){var s=t[n],u=s[0],f=s[1],h=jut(u,f,this.doc);h&&r.push(h)}return r},e.prototype.getFieldMaybe=function(t){Fi.assertIs(t,"name",["string"]);for(var r=this.getFields(),n=0,i=r.length;n<i;n++){var s=r[n];if(s.getName()===t)return s}},e.prototype.getField=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getFieldMaybe(t);if(r)return r;throw new kc.NoSuchFieldError(t)},e.prototype.getButton=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof E3.default)return r;throw new kc.UnexpectedFieldTypeError(t,E3.default,r)},e.prototype.getCheckBox=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof zy.default)return r;throw new kc.UnexpectedFieldTypeError(t,zy.default,r)},e.prototype.getDropdown=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof b3.default)return r;throw new kc.UnexpectedFieldTypeError(t,b3.default,r)},e.prototype.getOptionList=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof C3.default)return r;throw new kc.UnexpectedFieldTypeError(t,C3.default,r)},e.prototype.getRadioGroup=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof Zy.default)return r;throw new kc.UnexpectedFieldTypeError(t,Zy.default,r)},e.prototype.getSignature=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof EP.default)return r;throw new kc.UnexpectedFieldTypeError(t,EP.default,r)},e.prototype.getTextField=function(t){Fi.assertIs(t,"name",["string"]);var r=this.getField(t);if(r instanceof y3.default)return r;throw new kc.UnexpectedFieldTypeError(t,y3.default,r)},e.prototype.createButton=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroPushButton.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),E3.default.of(i,i.ref,this.doc)},e.prototype.createCheckBox=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroCheckBox.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),zy.default.of(i,i.ref,this.doc)},e.prototype.createDropdown=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroComboBox.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),b3.default.of(i,i.ref,this.doc)},e.prototype.createOptionList=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroListBox.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),C3.default.of(i,i.ref,this.doc)},e.prototype.createRadioGroup=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroRadioButton.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),Zy.default.of(i,i.ref,this.doc)},e.prototype.createTextField=function(t){Fi.assertIs(t,"name",["string"]);var r=Gm(t),n=this.findOrCreateNonTerminals(r.nonTerminal),i=In.PDFAcroText.create(this.doc.context);return i.setPartialName(r.terminal),Vm(n,[i,i.ref],r.terminal),y3.default.of(i,i.ref,this.doc)},e.prototype.flatten=function(t){t===void 0&&(t={updateFieldAppearances:!0}),t.updateFieldAppearances&&this.updateFieldAppearances();for(var r=this.getFields(),n=0,i=r.length;n<i;n++){for(var s=r[n],u=s.acroField.getWidgets(),f=0,h=u.length;f<h;f++){var g=u[f],p=this.findWidgetPage(g),C=this.findWidgetAppearanceRef(s,g),y=p.node.newXObject("FlatWidget",C),x=g.getRectangle(),v=Xu.__spreadArrays([m3.pushGraphicsState(),m3.translate(x.x,x.y)],Vut.rotateInPlace(Xu.__assign(Xu.__assign({},x),{rotation:0})),[m3.drawObject(y),m3.popGraphicsState()]).filter(Boolean);p.pushOperators.apply(p,v)}this.removeField(s)}},e.prototype.removeField=function(t){for(var r=t.acroField.getWidgets(),n=new Set,i=0,s=r.length;i<s;i++){var u=r[i],f=this.findWidgetAppearanceRef(t,u),h=this.findWidgetPage(u);n.add(h),h.node.removeAnnot(f)}n.forEach(function(x){return x.node.removeAnnot(t.ref)}),this.acroForm.removeField(t.acroField);for(var g=t.acroField.normalizedEntries().Kids,p=g.size(),C=0;C<p;C++){var y=g.get(C);y instanceof In.PDFRef&&this.doc.context.delete(y)}this.doc.context.delete(t.ref)},e.prototype.updateFieldAppearances=function(t){Fi.assertOrUndefined(t,"font",[[Wut.default,"PDFFont"]]),t=t??this.getDefaultFont();for(var r=this.getFields(),n=0,i=r.length;n<i;n++){var s=r[n];s.needsAppearancesUpdate()&&s.defaultUpdateAppearances(t)}},e.prototype.markFieldAsDirty=function(t){Fi.assertOrUndefined(t,"fieldRef",[[In.PDFRef,"PDFRef"]]),this.dirtyFields.add(t)},e.prototype.markFieldAsClean=function(t){Fi.assertOrUndefined(t,"fieldRef",[[In.PDFRef,"PDFRef"]]),this.dirtyFields.delete(t)},e.prototype.fieldIsDirty=function(t){return Fi.assertOrUndefined(t,"fieldRef",[[In.PDFRef,"PDFRef"]]),this.dirtyFields.has(t)},e.prototype.getDefaultFont=function(){return this.defaultFontCache.access()},e.prototype.findWidgetPage=function(t){var r=t.P(),n=this.doc.getPages().find(function(s){return s.ref===r});if(n===void 0){var i=this.doc.context.getObjectRef(t.dict);if(i===void 0)throw new Error("Could not find PDFRef for PDFObject");if(n=this.doc.findPageForAnnotationRef(i),n===void 0)throw new Error("Could not find page for PDFRef "+i)}return n},e.prototype.findWidgetAppearanceRef=function(t,r){var n,i=r.getNormalAppearance();if(i instanceof In.PDFDict&&(t instanceof zy.default||t instanceof Zy.default)){var s=t.acroField.getValue(),u=(n=i.get(s))!==null&&n!==void 0?n:i.get(In.PDFName.of("Off"));u instanceof In.PDFRef&&(i=u)}if(!(i instanceof In.PDFRef)){var f=t.getName();throw new Error("Failed to extract appearance ref for: "+f)}return i},e.prototype.findOrCreateNonTerminals=function(t){for(var r=[this.acroForm],n=0,i=t.length;n<i;n++){var s=t[n];if(!s)throw new kc.InvalidFieldNamePartError(s);var u=r[0],f=r[1],h=this.findNonTerminal(s,u);if(h)r=h;else{var g=In.PDFAcroNonTerminal.create(this.doc.context);g.setPartialName(s),g.setParent(f);var p=this.doc.context.register(g.dict);u.addField(p),r=[g,p]}}return r},e.prototype.findNonTerminal=function(t,r){for(var n=r instanceof In.PDFAcroForm?this.acroForm.getFields():In.createPDFAcroFields(r.Kids()),i=0,s=n.length;i<s;i++){var u=n[i],f=u[0],h=u[1];if(f.getPartialName()===t){if(f instanceof In.PDFAcroNonTerminal)return[f,h];throw new kc.FieldAlreadyExistsError(t)}}},e.of=function(t,r){return new e(t,r)},e})();bP.default=Yut;var jut=function(e,t,r){if(e instanceof In.PDFAcroPushButton)return E3.default.of(e,t,r);if(e instanceof In.PDFAcroCheckBox)return zy.default.of(e,t,r);if(e instanceof In.PDFAcroComboBox)return b3.default.of(e,t,r);if(e instanceof In.PDFAcroListBox)return C3.default.of(e,t,r);if(e instanceof In.PDFAcroText)return y3.default.of(e,t,r);if(e instanceof In.PDFAcroRadioButton)return Zy.default.of(e,t,r);if(e instanceof In.PDFAcroSignature)return EP.default.of(e,t,r)},Gm=function(e){if(e.length===0)throw new Error("PDF field names must not be empty strings");for(var t=e.split("."),r=0,n=t.length;r<n;r++)if(t[r]==="")throw new Error('Periods in PDF field names must be separated by at least one character: "'+e+'"');return t.length===1?{nonTerminal:[],terminal:t[0]}:{nonTerminal:t.slice(0,t.length-1),terminal:t[t.length-1]}},Vm=function(e,t,r){for(var n=e[0],i=e[1],s=t[0],u=t[1],f=n.normalizedEntries(),h=In.createPDFAcroFields("Kids"in f?f.Kids:f.Fields),g=0,p=h.length;g<p;g++)if(h[g][0].getPartialName()===r)throw new kc.FieldAlreadyExistsError(r);n.addField(u),s.setParent(i)}});var xP=U(x3=>{"use strict";Object.defineProperty(x3,"__esModule",{value:!0});x3.PageSizes=void 0;x3.PageSizes={"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 vP=U($y=>{"use strict";Object.defineProperty($y,"__esModule",{value:!0});$y.ParseSpeeds=void 0;var Jut;(function(e){e[e.Fastest=1/0]="Fastest",e[e.Fast=1500]="Fast",e[e.Medium=500]="Medium",e[e.Slow=100]="Slow"})(Jut=$y.ParseSpeeds||($y.ParseSpeeds={}))});var Kpe=U(IP=>{"use strict";Object.defineProperty(IP,"__esModule",{value:!0});var Xpe=(ct(),ze(ut)),Ha=Xi(),Xut=(function(){function e(t,r,n){this.alreadyEmbedded=!1,this.ref=t,this.doc=r,this.embedder=n}return e.prototype.embed=function(){return Xpe.__awaiter(this,void 0,void 0,function(){var t,r,n,i,s;return Xpe.__generator(this,function(u){switch(u.label){case 0:return this.alreadyEmbedded?[3,2]:[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:t=u.sent(),this.doc.catalog.has(Ha.PDFName.of("Names"))||this.doc.catalog.set(Ha.PDFName.of("Names"),this.doc.context.obj({})),r=this.doc.catalog.lookup(Ha.PDFName.of("Names"),Ha.PDFDict),r.has(Ha.PDFName.of("EmbeddedFiles"))||r.set(Ha.PDFName.of("EmbeddedFiles"),this.doc.context.obj({})),n=r.lookup(Ha.PDFName.of("EmbeddedFiles"),Ha.PDFDict),n.has(Ha.PDFName.of("Names"))||n.set(Ha.PDFName.of("Names"),this.doc.context.obj([])),i=n.lookup(Ha.PDFName.of("Names"),Ha.PDFArray),i.push(Ha.PDFHexString.fromText(this.embedder.fileName)),i.push(t),this.doc.catalog.has(Ha.PDFName.of("AF"))||this.doc.catalog.set(Ha.PDFName.of("AF"),this.doc.context.obj([])),s=this.doc.catalog.lookup(Ha.PDFName.of("AF"),Ha.PDFArray),s.push(t),this.alreadyEmbedded=!0,u.label=2;case 2:return[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();IP.default=Xut});var BP=U(DP=>{"use strict";Object.defineProperty(DP,"__esModule",{value:!0});var zpe=(ct(),ze(ut)),$o=Xi(),Kut=(function(){function e(t,r,n){this.alreadyEmbedded=!1,this.ref=t,this.doc=r,this.embedder=n}return e.prototype.embed=function(){return zpe.__awaiter(this,void 0,void 0,function(){var t,r,n,i,s,u,f;return zpe.__generator(this,function(h){switch(h.label){case 0:return this.alreadyEmbedded?[3,2]:(t=this.doc,r=t.catalog,n=t.context,[4,this.embedder.embedIntoContext(this.doc.context,this.ref)]);case 1:i=h.sent(),r.has($o.PDFName.of("Names"))||r.set($o.PDFName.of("Names"),n.obj({})),s=r.lookup($o.PDFName.of("Names"),$o.PDFDict),s.has($o.PDFName.of("JavaScript"))||s.set($o.PDFName.of("JavaScript"),n.obj({})),u=s.lookup($o.PDFName.of("JavaScript"),$o.PDFDict),u.has($o.PDFName.of("Names"))||u.set($o.PDFName.of("Names"),n.obj([])),f=u.lookup($o.PDFName.of("Names"),$o.PDFArray),f.push($o.PDFHexString.fromText(this.embedder.scriptName)),f.push(i),this.alreadyEmbedded=!0,h.label=2;case 2:return[2]}})})},e.of=function(t,r,n){return new e(t,r,n)},e})();DP.default=Kut});var Zpe=U(FP=>{"use strict";Object.defineProperty(FP,"__esModule",{value:!0});var wP=(ct(),ze(ut)),zut=wP.__importDefault(co()),Zut=(function(){function e(t,r){this.script=t,this.scriptName=r}return e.for=function(t,r){return new e(t,r)},e.prototype.embedIntoContext=function(t,r){return wP.__awaiter(this,void 0,void 0,function(){var n;return wP.__generator(this,function(i){return n=t.obj({Type:"Action",S:"JavaScript",JS:zut.default.fromText(this.script)}),r?(t.assign(r,n),[2,r]):[2,t.register(n)]})})},e})();FP.default=Zut});var UA=U(TP=>{"use strict";Object.defineProperty(TP,"__esModule",{value:!0});var Fr=(ct(),ze(ut)),v3=Pm(),$ut=Fr.__importDefault(u3()),$pe=Fr.__importDefault($f()),eme=Fr.__importDefault(f3()),Ym=Fr.__importDefault(tl()),ect=Fr.__importDefault(CP()),tct=xP(),ar=Xi(),rct=vP(),zt=fr(),tme=Fr.__importStar(cL()),nct=Fr.__importDefault(Kpe()),ict=Fr.__importDefault(BP()),act=Fr.__importDefault(Zpe()),sct=(function(){function e(t,r,n){var i=this;if(this.defaultWordBreaks=[" "],this.computePages=function(){var s=[];return i.catalog.Pages().traverse(function(u,f){if(u instanceof ar.PDFPageLeaf){var h=i.pageMap.get(u);h||(h=Ym.default.of(u,f,i),i.pageMap.set(u,h)),s.push(h)}}),s},this.getOrCreateForm=function(){var s=i.catalog.getOrCreateAcroForm();return ect.default.of(s,i)},zt.assertIs(t,"context",[[ar.PDFContext,"PDFContext"]]),zt.assertIs(r,"ignoreEncryption",["boolean"]),this.context=t,this.catalog=t.lookup(t.trailerInfo.Root),this.isEncrypted=!!t.lookup(t.trailerInfo.Encrypt),this.pageCache=zt.Cache.populatedBy(this.computePages),this.pageMap=new Map,this.formCache=zt.Cache.populatedBy(this.getOrCreateForm),this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!r&&this.isEncrypted)throw new v3.EncryptedPDFError;n&&this.updateInfoDict()}return e.load=function(t,r){return r===void 0&&(r={}),Fr.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p,C,y,x,v;return Fr.__generator(this,function(F){switch(F.label){case 0:return n=r.ignoreEncryption,i=n===void 0?!1:n,s=r.parseSpeed,u=s===void 0?rct.ParseSpeeds.Slow:s,f=r.throwOnInvalidObject,h=f===void 0?!1:f,g=r.updateMetadata,p=g===void 0?!0:g,C=r.capNumbers,y=C===void 0?!1:C,zt.assertIs(t,"pdf",["string",Uint8Array,ArrayBuffer]),zt.assertIs(i,"ignoreEncryption",["boolean"]),zt.assertIs(u,"parseSpeed",["number"]),zt.assertIs(h,"throwOnInvalidObject",["boolean"]),x=zt.toUint8Array(t),[4,ar.PDFParser.forBytesWithOptions(x,u,h,y).parseDocument()];case 1:return v=F.sent(),[2,new e(v,i,p)]}})})},e.create=function(t){return t===void 0&&(t={}),Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f;return Fr.__generator(this,function(h){return r=t.updateMetadata,n=r===void 0?!0:r,i=ar.PDFContext.create(),s=ar.PDFPageTree.withContext(i),u=i.register(s),f=ar.PDFCatalog.withContextAndPages(i,u),i.trailerInfo.Root=i.register(f),[2,new e(i,!1,n)]})})},e.prototype.registerFontkit=function(t){this.fontkit=t},e.prototype.getForm=function(){var t=this.formCache.access();return t.hasXFA()&&(console.warn("Removing XFA form data as pdf-lib does not support reading or writing XFA"),t.deleteXFA()),t},e.prototype.getTitle=function(){var t=this.getInfoDict().lookup(ar.PDFName.Title);if(t)return MA(t),t.decodeText()},e.prototype.getAuthor=function(){var t=this.getInfoDict().lookup(ar.PDFName.Author);if(t)return MA(t),t.decodeText()},e.prototype.getSubject=function(){var t=this.getInfoDict().lookup(ar.PDFName.Subject);if(t)return MA(t),t.decodeText()},e.prototype.getKeywords=function(){var t=this.getInfoDict().lookup(ar.PDFName.Keywords);if(t)return MA(t),t.decodeText()},e.prototype.getCreator=function(){var t=this.getInfoDict().lookup(ar.PDFName.Creator);if(t)return MA(t),t.decodeText()},e.prototype.getProducer=function(){var t=this.getInfoDict().lookup(ar.PDFName.Producer);if(t)return MA(t),t.decodeText()},e.prototype.getCreationDate=function(){var t=this.getInfoDict().lookup(ar.PDFName.CreationDate);if(t)return MA(t),t.decodeDate()},e.prototype.getModificationDate=function(){var t=this.getInfoDict().lookup(ar.PDFName.ModDate);if(t)return MA(t),t.decodeDate()},e.prototype.setTitle=function(t,r){zt.assertIs(t,"title",["string"]);var n=ar.PDFName.of("Title");if(this.getInfoDict().set(n,ar.PDFHexString.fromText(t)),r?.showInWindowTitleBar){var i=this.catalog.getOrCreateViewerPreferences();i.setDisplayDocTitle(!0)}},e.prototype.setAuthor=function(t){zt.assertIs(t,"author",["string"]);var r=ar.PDFName.of("Author");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setSubject=function(t){zt.assertIs(t,"author",["string"]);var r=ar.PDFName.of("Subject");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setKeywords=function(t){zt.assertIs(t,"keywords",[Array]);var r=ar.PDFName.of("Keywords");this.getInfoDict().set(r,ar.PDFHexString.fromText(t.join(" ")))},e.prototype.setCreator=function(t){zt.assertIs(t,"creator",["string"]);var r=ar.PDFName.of("Creator");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setProducer=function(t){zt.assertIs(t,"creator",["string"]);var r=ar.PDFName.of("Producer");this.getInfoDict().set(r,ar.PDFHexString.fromText(t))},e.prototype.setLanguage=function(t){zt.assertIs(t,"language",["string"]);var r=ar.PDFName.of("Lang");this.catalog.set(r,ar.PDFString.of(t))},e.prototype.setCreationDate=function(t){zt.assertIs(t,"creationDate",[[Date,"Date"]]);var r=ar.PDFName.of("CreationDate");this.getInfoDict().set(r,ar.PDFString.fromDate(t))},e.prototype.setModificationDate=function(t){zt.assertIs(t,"modificationDate",[[Date,"Date"]]);var r=ar.PDFName.of("ModDate");this.getInfoDict().set(r,ar.PDFString.fromDate(t))},e.prototype.getPageCount=function(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount},e.prototype.getPages=function(){return this.pageCache.access()},e.prototype.getPage=function(t){var r=this.getPages();return zt.assertRange(t,"index",0,r.length-1),r[t]},e.prototype.getPageIndices=function(){return zt.range(0,this.getPageCount())},e.prototype.removePage=function(t){var r=this.getPageCount();if(this.pageCount===0)throw new v3.RemovePageFromEmptyDocumentError;zt.assertRange(t,"index",0,r-1),this.catalog.removeLeafNode(t),this.pageCount=r-1},e.prototype.addPage=function(t){return zt.assertIs(t,"page",["undefined",[Ym.default,"PDFPage"],Array]),this.insertPage(this.getPageCount(),t)},e.prototype.insertPage=function(t,r){var n=this.getPageCount();if(zt.assertRange(t,"index",0,n),zt.assertIs(r,"page",["undefined",[Ym.default,"PDFPage"],Array]),!r||Array.isArray(r)){var i=Array.isArray(r)?r:tct.PageSizes.A4;r=Ym.default.create(this),r.setSize.apply(r,i)}else if(r.doc!==this)throw new v3.ForeignPageError;var s=this.catalog.insertLeafNode(r.ref,t);return r.node.setParent(s),this.pageMap.set(r.node,r),this.pageCache.invalidate(),this.pageCount=n+1,r},e.prototype.copyPages=function(t,r){return Fr.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p;return Fr.__generator(this,function(C){switch(C.label){case 0:return zt.assertIs(t,"srcDoc",[[e,"PDFDocument"]]),zt.assertIs(r,"indices",[Array]),[4,t.flush()];case 1:for(C.sent(),n=ar.PDFObjectCopier.for(t.context,this.context),i=t.getPages(),s=new Array(r.length),u=0,f=r.length;u<f;u++)h=i[r[u]],g=n.copy(h.node),p=this.context.register(g),s[u]=Ym.default.of(g,p,this);return[2,s]}})})},e.prototype.copy=function(){return Fr.__awaiter(this,void 0,void 0,function(){var t,r,n,i;return Fr.__generator(this,function(s){switch(s.label){case 0:return[4,e.create()];case 1:return t=s.sent(),[4,t.copyPages(this,this.getPageIndices())];case 2:for(r=s.sent(),n=0,i=r.length;n<i;n++)t.addPage(r[n]);return this.getAuthor()!==void 0&&t.setAuthor(this.getAuthor()),this.getCreationDate()!==void 0&&t.setCreationDate(this.getCreationDate()),this.getCreator()!==void 0&&t.setCreator(this.getCreator()),this.getModificationDate()!==void 0&&t.setModificationDate(this.getModificationDate()),this.getProducer()!==void 0&&t.setProducer(this.getProducer()),this.getSubject()!==void 0&&t.setSubject(this.getSubject()),this.getTitle()!==void 0&&t.setTitle(this.getTitle()),t.defaultWordBreaks=this.defaultWordBreaks,[2,t]}})})},e.prototype.addJavaScript=function(t,r){zt.assertIs(t,"name",["string"]),zt.assertIs(r,"script",["string"]);var n=act.default.for(r,t),i=this.context.nextRef(),s=ict.default.of(i,this,n);this.javaScripts.push(s)},e.prototype.attach=function(t,r,n){return n===void 0&&(n={}),Fr.__awaiter(this,void 0,void 0,function(){var i,s,u,f;return Fr.__generator(this,function(h){return zt.assertIs(t,"attachment",["string",Uint8Array,ArrayBuffer]),zt.assertIs(r,"name",["string"]),zt.assertOrUndefined(n.mimeType,"mimeType",["string"]),zt.assertOrUndefined(n.description,"description",["string"]),zt.assertOrUndefined(n.creationDate,"options.creationDate",[Date]),zt.assertOrUndefined(n.modificationDate,"options.modificationDate",[Date]),zt.assertIsOneOfOrUndefined(n.afRelationship,"options.afRelationship",tme.AFRelationship),i=zt.toUint8Array(t),s=tme.default.for(i,r,n),u=this.context.nextRef(),f=nct.default.of(u,this,s),this.embeddedFiles.push(f),[2]})})},e.prototype.embedFont=function(t,r){return r===void 0&&(r={}),Fr.__awaiter(this,void 0,void 0,function(){var n,i,s,u,f,h,g,p,C,y;return Fr.__generator(this,function(x){switch(x.label){case 0:return n=r.subset,i=n===void 0?!1:n,s=r.customName,u=r.features,zt.assertIs(t,"font",["string",Uint8Array,ArrayBuffer]),zt.assertIs(i,"subset",["boolean"]),zt.isStandardFont(t)?(f=ar.StandardFontEmbedder.for(t,s),[3,7]):[3,1];case 1:return zt.canBeConvertedToUint8Array(t)?(h=zt.toUint8Array(t),g=this.assertFontkit(),i?[4,ar.CustomFontSubsetEmbedder.for(g,h,s,u)]:[3,3]):[3,6];case 2:return p=x.sent(),[3,5];case 3:return[4,ar.CustomFontEmbedder.for(g,h,s,u)];case 4:p=x.sent(),x.label=5;case 5:return f=p,[3,7];case 6:throw new TypeError("`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`");case 7:return C=this.context.nextRef(),y=$pe.default.of(C,this,f),this.fonts.push(y),[2,y]}})})},e.prototype.embedStandardFont=function(t,r){if(zt.assertIs(t,"font",["string"]),!zt.isStandardFont(t))throw new TypeError("`font` must be one of type `StandardFonts`");var n=ar.StandardFontEmbedder.for(t,r),i=this.context.nextRef(),s=$pe.default.of(i,this,n);return this.fonts.push(s),s},e.prototype.embedJpg=function(t){return Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s;return Fr.__generator(this,function(u){switch(u.label){case 0:return zt.assertIs(t,"jpg",["string",Uint8Array,ArrayBuffer]),r=zt.toUint8Array(t),[4,ar.JpegEmbedder.for(r)];case 1:return n=u.sent(),i=this.context.nextRef(),s=eme.default.of(i,this,n),this.images.push(s),[2,s]}})})},e.prototype.embedPng=function(t){return Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s;return Fr.__generator(this,function(u){switch(u.label){case 0:return zt.assertIs(t,"png",["string",Uint8Array,ArrayBuffer]),r=zt.toUint8Array(t),[4,ar.PngEmbedder.for(r)];case 1:return n=u.sent(),i=this.context.nextRef(),s=eme.default.of(i,this,n),this.images.push(s),[2,s]}})})},e.prototype.embedPdf=function(t,r){return r===void 0&&(r=[0]),Fr.__awaiter(this,void 0,void 0,function(){var n,i,s;return Fr.__generator(this,function(u){switch(u.label){case 0:return zt.assertIs(t,"pdf",["string",Uint8Array,ArrayBuffer,[e,"PDFDocument"]]),zt.assertIs(r,"indices",[Array]),t instanceof e?(i=t,[3,3]):[3,1];case 1:return[4,e.load(t)];case 2:i=u.sent(),u.label=3;case 3:return n=i,s=zt.pluckIndices(n.getPages(),r),[2,this.embedPages(s)]}})})},e.prototype.embedPage=function(t,r,n){return Fr.__awaiter(this,void 0,void 0,function(){var i;return Fr.__generator(this,function(s){switch(s.label){case 0:return zt.assertIs(t,"page",[[Ym.default,"PDFPage"]]),[4,this.embedPages([t],[r],[n])];case 1:return i=s.sent()[0],[2,i]}})})},e.prototype.embedPages=function(t,r,n){return r===void 0&&(r=[]),n===void 0&&(n=[]),Fr.__awaiter(this,void 0,void 0,function(){var g,p,i,s,u,f,h,g,p,C,y,x,v,F,Q;return Fr.__generator(this,function(T){switch(T.label){case 0:if(t.length===0)return[2,[]];for(g=0,p=t.length-1;g<p;g++)if(i=t[g],s=t[g+1],i.node.context!==s.node.context)throw new ar.PageEmbeddingMismatchedContextError;u=t[0].node.context,f=u===this.context?function(_){return _}:ar.PDFObjectCopier.for(u,this.context).copy,h=new Array(t.length),g=0,p=t.length,T.label=1;case 1:return g<p?(C=f(t[g].node),y=r[g],x=n[g],[4,ar.PDFPageEmbedder.for(C,y,x)]):[3,4];case 2:v=T.sent(),F=this.context.nextRef(),h[g]=$ut.default.of(F,this,v),T.label=3;case 3:return g++,[3,1];case 4:return(Q=this.embeddedPages).push.apply(Q,h),[2,h]}})})},e.prototype.flush=function(){return Fr.__awaiter(this,void 0,void 0,function(){return Fr.__generator(this,function(t){switch(t.label){case 0:return[4,this.embedAll(this.fonts)];case 1:return t.sent(),[4,this.embedAll(this.images)];case 2:return t.sent(),[4,this.embedAll(this.embeddedPages)];case 3:return t.sent(),[4,this.embedAll(this.embeddedFiles)];case 4:return t.sent(),[4,this.embedAll(this.javaScripts)];case 5:return t.sent(),[2]}})})},e.prototype.save=function(t){return t===void 0&&(t={}),Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u,f,h,g,p,C;return Fr.__generator(this,function(y){switch(y.label){case 0:return r=t.useObjectStreams,n=r===void 0?!0:r,i=t.addDefaultPage,s=i===void 0?!0:i,u=t.objectsPerTick,f=u===void 0?50:u,h=t.updateFieldAppearances,g=h===void 0?!0:h,zt.assertIs(n,"useObjectStreams",["boolean"]),zt.assertIs(s,"addDefaultPage",["boolean"]),zt.assertIs(f,"objectsPerTick",["number"]),zt.assertIs(g,"updateFieldAppearances",["boolean"]),s&&this.getPageCount()===0&&this.addPage(),g&&(p=this.formCache.getValue(),p&&p.updateFieldAppearances()),[4,this.flush()];case 1:return y.sent(),C=n?ar.PDFStreamWriter:ar.PDFWriter,[2,C.forContext(this.context,f).serializeToBuffer()]}})})},e.prototype.saveAsBase64=function(t){return t===void 0&&(t={}),Fr.__awaiter(this,void 0,void 0,function(){var r,n,i,s,u;return Fr.__generator(this,function(f){switch(f.label){case 0:return r=t.dataUri,n=r===void 0?!1:r,i=Fr.__rest(t,["dataUri"]),zt.assertIs(n,"dataUri",["boolean"]),[4,this.save(i)];case 1:return s=f.sent(),u=zt.encodeToBase64(s),[2,n?"data:application/pdf;base64,"+u:u]}})})},e.prototype.findPageForAnnotationRef=function(t){for(var r=this.getPages(),n=0,i=r.length;n<i;n++){var s=r[n],u=s.node.Annots();if(u?.indexOf(t)!==void 0)return s}},e.prototype.embedAll=function(t){return Fr.__awaiter(this,void 0,void 0,function(){var r,n;return Fr.__generator(this,function(i){switch(i.label){case 0:r=0,n=t.length,i.label=1;case 1:return r<n?[4,t[r].embed()]:[3,4];case 2:i.sent(),i.label=3;case 3:return r++,[3,1];case 4:return[2]}})})},e.prototype.updateInfoDict=function(){var t="pdf-lib (https://github.com/Hopding/pdf-lib)",r=new Date,n=this.getInfoDict();this.setProducer(t),this.setModificationDate(r),n.get(ar.PDFName.of("Creator"))||this.setCreator(t),n.get(ar.PDFName.of("CreationDate"))||this.setCreationDate(r)},e.prototype.getInfoDict=function(){var t=this.context.lookup(this.context.trailerInfo.Info);if(t instanceof ar.PDFDict)return t;var r=this.context.obj({});return this.context.trailerInfo.Info=this.context.register(r),r},e.prototype.assertFontkit=function(){if(!this.fontkit)throw new v3.FontkitNotRegisteredError;return this.fontkit},e})();TP.default=sct;function MA(e){if(!(e instanceof ar.PDFHexString)&&!(e instanceof ar.PDFString))throw new ar.UnexpectedObjectTypeError([ar.PDFHexString,ar.PDFString],e)}});var SP=U(ex=>{"use strict";Object.defineProperty(ex,"__esModule",{value:!0});ex.BlendMode=void 0;var oct;(function(e){e.Normal="Normal",e.Multiply="Multiply",e.Screen="Screen",e.Overlay="Overlay",e.Darken="Darken",e.Lighten="Lighten",e.ColorDodge="ColorDodge",e.ColorBurn="ColorBurn",e.HardLight="HardLight",e.SoftLight="SoftLight",e.Difference="Difference",e.Exclusion="Exclusion"})(oct=ex.BlendMode||(ex.BlendMode={}))});var tl=U(QP=>{"use strict";Object.defineProperty(QP,"__esModule",{value:!0});var OA=(ct(),ze(ut)),tx=Gu(),lg=Lm(),U0=QA(),rme=OA.__importDefault(UA()),uct=OA.__importDefault(u3()),nme=OA.__importDefault($f()),cct=OA.__importDefault(f3()),Ag=SP(),Rs=zo(),fct=p3(),Ia=Xi(),He=fr(),lct=(function(){function e(t,r,n){this.fontSize=24,this.fontColor=tx.rgb(0,0,0),this.lineHeight=24,this.x=0,this.y=0,He.assertIs(t,"leafNode",[[Ia.PDFPageLeaf,"PDFPageLeaf"]]),He.assertIs(r,"ref",[[Ia.PDFRef,"PDFRef"]]),He.assertIs(n,"doc",[[rme.default,"PDFDocument"]]),this.node=t,this.ref=r,this.doc=n}return e.prototype.setRotation=function(t){var r=Rs.toDegrees(t);He.assertMultiple(r,"degreesAngle",90),this.node.set(Ia.PDFName.of("Rotate"),this.doc.context.obj(r))},e.prototype.getRotation=function(){var t=this.node.Rotate();return Rs.degrees(t?t.asNumber():0)},e.prototype.setSize=function(t,r){He.assertIs(t,"width",["number"]),He.assertIs(r,"height",["number"]);var n=this.getMediaBox();this.setMediaBox(n.x,n.y,t,r);var i=this.getCropBox(),s=this.getBleedBox(),u=this.getTrimBox(),f=this.getArtBox(),h=this.node.CropBox(),g=this.node.BleedBox(),p=this.node.TrimBox(),C=this.node.ArtBox();h&&He.rectanglesAreEqual(i,n)&&this.setCropBox(n.x,n.y,t,r),g&&He.rectanglesAreEqual(s,n)&&this.setBleedBox(n.x,n.y,t,r),p&&He.rectanglesAreEqual(u,n)&&this.setTrimBox(n.x,n.y,t,r),C&&He.rectanglesAreEqual(f,n)&&this.setArtBox(n.x,n.y,t,r)},e.prototype.setWidth=function(t){He.assertIs(t,"width",["number"]),this.setSize(t,this.getSize().height)},e.prototype.setHeight=function(t){He.assertIs(t,"height",["number"]),this.setSize(this.getSize().width,t)},e.prototype.setMediaBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.MediaBox,s)},e.prototype.setCropBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.CropBox,s)},e.prototype.setBleedBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.BleedBox,s)},e.prototype.setTrimBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.TrimBox,s)},e.prototype.setArtBox=function(t,r,n,i){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),He.assertIs(n,"width",["number"]),He.assertIs(i,"height",["number"]);var s=this.doc.context.obj([t,r,t+n,r+i]);this.node.set(Ia.PDFName.ArtBox,s)},e.prototype.getSize=function(){var t=this.getMediaBox(),r=t.width,n=t.height;return{width:r,height:n}},e.prototype.getWidth=function(){return this.getSize().width},e.prototype.getHeight=function(){return this.getSize().height},e.prototype.getMediaBox=function(){var t=this.node.MediaBox();return t.asRectangle()},e.prototype.getCropBox=function(){var t,r=this.node.CropBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getMediaBox()},e.prototype.getBleedBox=function(){var t,r=this.node.BleedBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getCropBox()},e.prototype.getTrimBox=function(){var t,r=this.node.TrimBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getCropBox()},e.prototype.getArtBox=function(){var t,r=this.node.ArtBox();return(t=r?.asRectangle())!==null&&t!==void 0?t:this.getCropBox()},e.prototype.translateContent=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(U0.pushGraphicsState(),U0.translate(t,r)),i=this.doc.context.register(n),s=this.createContentStream(U0.popGraphicsState()),u=this.doc.context.register(s);this.node.wrapContentStreams(i,u)},e.prototype.scale=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.setSize(this.getWidth()*t,this.getHeight()*r),this.scaleContent(t,r),this.scaleAnnotations(t,r)},e.prototype.scaleContent=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(U0.pushGraphicsState(),U0.scale(t,r)),i=this.doc.context.register(n),s=this.createContentStream(U0.popGraphicsState()),u=this.doc.context.register(s);this.node.wrapContentStreams(i,u)},e.prototype.scaleAnnotations=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]);var n=this.node.Annots();if(n)for(var i=0;i<n.size();i++){var s=n.lookup(i);s instanceof Ia.PDFDict&&this.scaleAnnot(s,t,r)}},e.prototype.resetPosition=function(){this.getContentStream(!1),this.x=0,this.y=0},e.prototype.setFont=function(t){He.assertIs(t,"font",[[nme.default,"PDFFont"]]),this.font=t,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)},e.prototype.setFontSize=function(t){He.assertIs(t,"fontSize",["number"]),this.fontSize=t},e.prototype.setFontColor=function(t){He.assertIs(t,"fontColor",[[Object,"Color"]]),this.fontColor=t},e.prototype.setLineHeight=function(t){He.assertIs(t,"lineHeight",["number"]),this.lineHeight=t},e.prototype.getPosition=function(){return{x:this.x,y:this.y}},e.prototype.getX=function(){return this.x},e.prototype.getY=function(){return this.y},e.prototype.moveTo=function(t,r){He.assertIs(t,"x",["number"]),He.assertIs(r,"y",["number"]),this.x=t,this.y=r},e.prototype.moveDown=function(t){He.assertIs(t,"yDecrease",["number"]),this.y-=t},e.prototype.moveUp=function(t){He.assertIs(t,"yIncrease",["number"]),this.y+=t},e.prototype.moveLeft=function(t){He.assertIs(t,"xDecrease",["number"]),this.x-=t},e.prototype.moveRight=function(t){He.assertIs(t,"xIncrease",["number"]),this.x+=t},e.prototype.pushOperators=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];He.assertEachIs(t,"operator",[[Ia.PDFOperator,"PDFOperator"]]);var n=this.getContentStream();n.push.apply(n,t)},e.prototype.drawText=function(t,r){var n,i,s,u,f,h,g;r===void 0&&(r={}),He.assertIs(t,"text",["string"]),He.assertOrUndefined(r.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertOrUndefined(r.font,"options.font",[[nme.default,"PDFFont"]]),He.assertOrUndefined(r.size,"options.size",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.lineHeight,"options.lineHeight",["number"]),He.assertOrUndefined(r.maxWidth,"options.maxWidth",["number"]),He.assertOrUndefined(r.wordBreaks,"options.wordBreaks",[Array]),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);for(var p=this.setOrEmbedFont(r.font),C=p.oldFont,y=p.newFont,x=p.newFontKey,v=r.size||this.fontSize,F=r.wordBreaks||this.doc.defaultWordBreaks,Q=function(q){return y.widthOfTextAtSize(q,v)},T=r.maxWidth===void 0?He.lineSplit(He.cleanText(t)):He.breakTextIntoLines(t,F,r.maxWidth,Q),_=new Array(T.length),S=0,N=T.length;S<N;S++)_[S]=y.encodeText(T[S]);var O=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),H=this.getContentStream();H.push.apply(H,lg.drawLinesOfText(_,{color:(n=r.color)!==null&&n!==void 0?n:this.fontColor,font:x,size:v,rotate:(i=r.rotate)!==null&&i!==void 0?i:Rs.degrees(0),xSkew:(s=r.xSkew)!==null&&s!==void 0?s:Rs.degrees(0),ySkew:(u=r.ySkew)!==null&&u!==void 0?u:Rs.degrees(0),x:(f=r.x)!==null&&f!==void 0?f:this.x,y:(h=r.y)!==null&&h!==void 0?h:this.y,lineHeight:(g=r.lineHeight)!==null&&g!==void 0?g:this.lineHeight,graphicsState:O})),r.font&&(C?this.setFont(C):this.resetFont())},e.prototype.drawImage=function(t,r){var n,i,s,u,f,h,g;r===void 0&&(r={}),He.assertIs(t,"image",[[cct.default,"PDFImage"]]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.width,"options.width",["number"]),He.assertOrUndefined(r.height,"options.height",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);var p=this.node.newXObject("Image",t.ref),C=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),y=this.getContentStream();y.push.apply(y,lg.drawImage(p,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,width:(s=r.width)!==null&&s!==void 0?s:t.size().width,height:(u=r.height)!==null&&u!==void 0?u:t.size().height,rotate:(f=r.rotate)!==null&&f!==void 0?f:Rs.degrees(0),xSkew:(h=r.xSkew)!==null&&h!==void 0?h:Rs.degrees(0),ySkew:(g=r.ySkew)!==null&&g!==void 0?g:Rs.degrees(0),graphicsState:C}))},e.prototype.drawPage=function(t,r){var n,i,s,u,f;r===void 0&&(r={}),He.assertIs(t,"embeddedPage",[[uct.default,"PDFEmbeddedPage"]]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.xScale,"options.xScale",["number"]),He.assertOrUndefined(r.yScale,"options.yScale",["number"]),He.assertOrUndefined(r.width,"options.width",["number"]),He.assertOrUndefined(r.height,"options.height",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);var h=this.node.newXObject("EmbeddedPdfPage",t.ref),g=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),p=r.width!==void 0?r.width/t.width:r.xScale!==void 0?r.xScale:1,C=r.height!==void 0?r.height/t.height:r.yScale!==void 0?r.yScale:1,y=this.getContentStream();y.push.apply(y,lg.drawPage(h,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,xScale:p,yScale:C,rotate:(s=r.rotate)!==null&&s!==void 0?s:Rs.degrees(0),xSkew:(u=r.xSkew)!==null&&u!==void 0?u:Rs.degrees(0),ySkew:(f=r.ySkew)!==null&&f!==void 0?f:Rs.degrees(0),graphicsState:g}))},e.prototype.drawSvgPath=function(t,r){var n,i,s,u,f,h,g,p,C;r===void 0&&(r={}),He.assertIs(t,"path",["string"]),He.assertOrUndefined(r.x,"options.x",["number"]),He.assertOrUndefined(r.y,"options.y",["number"]),He.assertOrUndefined(r.scale,"options.scale",["number"]),He.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(r.borderWidth,"options.borderWidth",["number"]),He.assertOrUndefined(r.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),He.assertOrUndefined(r.borderColor,"options.borderColor",[[Object,"Color"]]),He.assertOrUndefined(r.borderDashArray,"options.borderDashArray",[Array]),He.assertOrUndefined(r.borderDashPhase,"options.borderDashPhase",["number"]),He.assertIsOneOfOrUndefined(r.borderLineCap,"options.borderLineCap",U0.LineCapStyle),He.assertRangeOrUndefined(r.borderOpacity,"options.borderOpacity",0,1),He.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ag.BlendMode);var y=this.maybeEmbedGraphicsState({opacity:r.opacity,borderOpacity:r.borderOpacity,blendMode:r.blendMode});!("color"in r)&&!("borderColor"in r)&&(r.borderColor=tx.rgb(0,0,0));var x=this.getContentStream();x.push.apply(x,lg.drawSvgPath(t,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,scale:r.scale,rotate:(s=r.rotate)!==null&&s!==void 0?s:Rs.degrees(0),color:(u=r.color)!==null&&u!==void 0?u:void 0,borderColor:(f=r.borderColor)!==null&&f!==void 0?f:void 0,borderWidth:(h=r.borderWidth)!==null&&h!==void 0?h:0,borderDashArray:(g=r.borderDashArray)!==null&&g!==void 0?g:void 0,borderDashPhase:(p=r.borderDashPhase)!==null&&p!==void 0?p:void 0,borderLineCap:(C=r.borderLineCap)!==null&&C!==void 0?C:void 0,graphicsState:y}))},e.prototype.drawLine=function(t){var r,n,i,s,u;He.assertIs(t.start,"options.start",[[Object,"{ x: number, y: number }"]]),He.assertIs(t.end,"options.end",[[Object,"{ x: number, y: number }"]]),He.assertIs(t.start.x,"options.start.x",["number"]),He.assertIs(t.start.y,"options.start.y",["number"]),He.assertIs(t.end.x,"options.end.x",["number"]),He.assertIs(t.end.y,"options.end.y",["number"]),He.assertOrUndefined(t.thickness,"options.thickness",["number"]),He.assertOrUndefined(t.color,"options.color",[[Object,"Color"]]),He.assertOrUndefined(t.dashArray,"options.dashArray",[Array]),He.assertOrUndefined(t.dashPhase,"options.dashPhase",["number"]),He.assertIsOneOfOrUndefined(t.lineCap,"options.lineCap",U0.LineCapStyle),He.assertRangeOrUndefined(t.opacity,"opacity.opacity",0,1),He.assertIsOneOfOrUndefined(t.blendMode,"options.blendMode",Ag.BlendMode);var f=this.maybeEmbedGraphicsState({borderOpacity:t.opacity,blendMode:t.blendMode});"color"in t||(t.color=tx.rgb(0,0,0));var h=this.getContentStream();h.push.apply(h,lg.drawLine({start:t.start,end:t.end,thickness:(r=t.thickness)!==null&&r!==void 0?r:1,color:(n=t.color)!==null&&n!==void 0?n:void 0,dashArray:(i=t.dashArray)!==null&&i!==void 0?i:void 0,dashPhase:(s=t.dashPhase)!==null&&s!==void 0?s:void 0,lineCap:(u=t.lineCap)!==null&&u!==void 0?u:void 0,graphicsState:f}))},e.prototype.drawRectangle=function(t){var r,n,i,s,u,f,h,g,p,C,y,x,v;t===void 0&&(t={}),He.assertOrUndefined(t.x,"options.x",["number"]),He.assertOrUndefined(t.y,"options.y",["number"]),He.assertOrUndefined(t.width,"options.width",["number"]),He.assertOrUndefined(t.height,"options.height",["number"]),He.assertOrUndefined(t.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(t.xSkew,"options.xSkew",[[Object,"Rotation"]]),He.assertOrUndefined(t.ySkew,"options.ySkew",[[Object,"Rotation"]]),He.assertOrUndefined(t.borderWidth,"options.borderWidth",["number"]),He.assertOrUndefined(t.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(t.opacity,"opacity.opacity",0,1),He.assertOrUndefined(t.borderColor,"options.borderColor",[[Object,"Color"]]),He.assertOrUndefined(t.borderDashArray,"options.borderDashArray",[Array]),He.assertOrUndefined(t.borderDashPhase,"options.borderDashPhase",["number"]),He.assertIsOneOfOrUndefined(t.borderLineCap,"options.borderLineCap",U0.LineCapStyle),He.assertRangeOrUndefined(t.borderOpacity,"options.borderOpacity",0,1),He.assertIsOneOfOrUndefined(t.blendMode,"options.blendMode",Ag.BlendMode);var F=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.color=tx.rgb(0,0,0));var Q=this.getContentStream();Q.push.apply(Q,lg.drawRectangle({x:(r=t.x)!==null&&r!==void 0?r:this.x,y:(n=t.y)!==null&&n!==void 0?n:this.y,width:(i=t.width)!==null&&i!==void 0?i:150,height:(s=t.height)!==null&&s!==void 0?s:100,rotate:(u=t.rotate)!==null&&u!==void 0?u:Rs.degrees(0),xSkew:(f=t.xSkew)!==null&&f!==void 0?f:Rs.degrees(0),ySkew:(h=t.ySkew)!==null&&h!==void 0?h:Rs.degrees(0),borderWidth:(g=t.borderWidth)!==null&&g!==void 0?g:0,color:(p=t.color)!==null&&p!==void 0?p:void 0,borderColor:(C=t.borderColor)!==null&&C!==void 0?C:void 0,borderDashArray:(y=t.borderDashArray)!==null&&y!==void 0?y:void 0,borderDashPhase:(x=t.borderDashPhase)!==null&&x!==void 0?x:void 0,graphicsState:F,borderLineCap:(v=t.borderLineCap)!==null&&v!==void 0?v:void 0}))},e.prototype.drawSquare=function(t){t===void 0&&(t={});var r=t.size;He.assertOrUndefined(r,"size",["number"]),this.drawRectangle(OA.__assign(OA.__assign({},t),{width:r,height:r}))},e.prototype.drawEllipse=function(t){var r,n,i,s,u,f,h,g,p,C,y;t===void 0&&(t={}),He.assertOrUndefined(t.x,"options.x",["number"]),He.assertOrUndefined(t.y,"options.y",["number"]),He.assertOrUndefined(t.xScale,"options.xScale",["number"]),He.assertOrUndefined(t.yScale,"options.yScale",["number"]),He.assertOrUndefined(t.rotate,"options.rotate",[[Object,"Rotation"]]),He.assertOrUndefined(t.color,"options.color",[[Object,"Color"]]),He.assertRangeOrUndefined(t.opacity,"opacity.opacity",0,1),He.assertOrUndefined(t.borderColor,"options.borderColor",[[Object,"Color"]]),He.assertRangeOrUndefined(t.borderOpacity,"options.borderOpacity",0,1),He.assertOrUndefined(t.borderWidth,"options.borderWidth",["number"]),He.assertOrUndefined(t.borderDashArray,"options.borderDashArray",[Array]),He.assertOrUndefined(t.borderDashPhase,"options.borderDashPhase",["number"]),He.assertIsOneOfOrUndefined(t.borderLineCap,"options.borderLineCap",U0.LineCapStyle),He.assertIsOneOfOrUndefined(t.blendMode,"options.blendMode",Ag.BlendMode);var x=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.color=tx.rgb(0,0,0));var v=this.getContentStream();v.push.apply(v,lg.drawEllipse({x:(r=t.x)!==null&&r!==void 0?r:this.x,y:(n=t.y)!==null&&n!==void 0?n:this.y,xScale:(i=t.xScale)!==null&&i!==void 0?i:100,yScale:(s=t.yScale)!==null&&s!==void 0?s:100,rotate:(u=t.rotate)!==null&&u!==void 0?u:void 0,color:(f=t.color)!==null&&f!==void 0?f:void 0,borderColor:(h=t.borderColor)!==null&&h!==void 0?h:void 0,borderWidth:(g=t.borderWidth)!==null&&g!==void 0?g:0,borderDashArray:(p=t.borderDashArray)!==null&&p!==void 0?p:void 0,borderDashPhase:(C=t.borderDashPhase)!==null&&C!==void 0?C:void 0,borderLineCap:(y=t.borderLineCap)!==null&&y!==void 0?y:void 0,graphicsState:x}))},e.prototype.drawCircle=function(t){t===void 0&&(t={});var r=t.size,n=r===void 0?100:r;He.assertOrUndefined(n,"size",["number"]),this.drawEllipse(OA.__assign(OA.__assign({},t),{xScale:n,yScale:n}))},e.prototype.setOrEmbedFont=function(t){var r=this.font,n=this.fontKey;t?this.setFont(t):this.getFont();var i=this.font,s=this.fontKey;return{oldFont:r,oldFontKey:n,newFont:i,newFontKey:s}},e.prototype.getFont=function(){if(!this.font||!this.fontKey){var t=this.doc.embedStandardFont(fct.StandardFonts.Helvetica);this.setFont(t)}return[this.font,this.fontKey]},e.prototype.resetFont=function(){this.font=void 0,this.fontKey=void 0},e.prototype.getContentStream=function(t){return t===void 0&&(t=!0),t&&this.contentStream?this.contentStream:(this.contentStream=this.createContentStream(),this.contentStreamRef=this.doc.context.register(this.contentStream),this.node.addContentStream(this.contentStreamRef),this.contentStream)},e.prototype.createContentStream=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=this.doc.context.obj({}),i=Ia.PDFContentStream.of(n,t);return i},e.prototype.maybeEmbedGraphicsState=function(t){var r=t.opacity,n=t.borderOpacity,i=t.blendMode;if(!(r===void 0&&n===void 0&&i===void 0)){var s=this.doc.context.obj({Type:"ExtGState",ca:r,CA:n,BM:i}),u=this.node.newExtGState("GS",s);return u}},e.prototype.scaleAnnot=function(t,r,n){for(var i=["RD","CL","Vertices","QuadPoints","L","Rect"],s=0,u=i.length;s<u;s++){var f=t.lookup(Ia.PDFName.of(i[s]));f instanceof Ia.PDFArray&&f.scalePDFNumbers(r,n)}var h=t.lookup(Ia.PDFName.of("InkList"));if(h instanceof Ia.PDFArray)for(var s=0,u=h.size();s<u;s++){var g=h.lookup(s);g instanceof Ia.PDFArray&&g.scalePDFNumbers(r,n)}},e.of=function(t,r,n){return new e(t,r,n)},e.create=function(t){He.assertIs(t,"doc",[[rme.default,"PDFDocument"]]);var r=Ia.PDFRef.of(-1),n=Ia.PDFPageLeaf.withContextAndParent(t.context,r),i=t.context.register(n);return new e(n,i,t)},e})();QP.default=lct});var yP=U(_P=>{"use strict";Object.defineProperty(_P,"__esModule",{value:!0});var I3=(ct(),ze(ut)),Act=I3.__importDefault(tl()),ime=I3.__importDefault($f()),dct=l3(),ame=RA(),sme=I3.__importStar(el()),ome=Gu(),hct=zo(),ume=Xi(),dg=fr(),gct=(function(e){I3.__extends(t,e);function t(r,n,i){var s=e.call(this,r,n,i)||this;return dg.assertIs(r,"acroButton",[[ume.PDFAcroPushButton,"PDFAcroPushButton"]]),s.acroField=r,s}return t.prototype.setImage=function(r,n){n===void 0&&(n=dct.ImageAlignment.Center);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s],h=this.createImageAppearanceStream(f,r,n);this.updateWidgetAppearances(f,{normal:h})}this.markAsClean()},t.prototype.setFontSize=function(r){dg.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},t.prototype.addToPage=function(r,n,i){var s,u,f,h,g,p,C,y,x,v,F;dg.assertOrUndefined(r,"text",["string"]),dg.assertOrUndefined(n,"page",[[Act.default,"PDFPage"]]),sme.assertFieldAppearanceOptions(i);var Q=this.createWidget({x:((s=i?.x)!==null&&s!==void 0?s:0)-((u=i?.borderWidth)!==null&&u!==void 0?u:0)/2,y:((f=i?.y)!==null&&f!==void 0?f:0)-((h=i?.borderWidth)!==null&&h!==void 0?h:0)/2,width:(g=i?.width)!==null&&g!==void 0?g:100,height:(p=i?.height)!==null&&p!==void 0?p:50,textColor:(C=i?.textColor)!==null&&C!==void 0?C:ome.rgb(0,0,0),backgroundColor:(y=i?.backgroundColor)!==null&&y!==void 0?y:ome.rgb(.75,.75,.75),borderColor:i?.borderColor,borderWidth:(x=i?.borderWidth)!==null&&x!==void 0?x:0,rotate:(v=i?.rotate)!==null&&v!==void 0?v:hct.degrees(0),caption:r,hidden:i?.hidden,page:n.ref}),T=this.doc.context.register(Q.dict);this.acroField.addWidget(T);var _=(F=i?.font)!==null&&F!==void 0?F:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(Q,_),n.node.addAnnot(T)},t.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,s=n.length;i<s;i++){var u=n[i],f=((r=u.getAppearances())===null||r===void 0?void 0:r.normal)instanceof ume.PDFStream;if(!f)return!0}return!1},t.prototype.defaultUpdateAppearances=function(r){dg.assertIs(r,"font",[[ime.default,"PDFFont"]]),this.updateAppearances(r)},t.prototype.updateAppearances=function(r,n){dg.assertIs(r,"font",[[ime.default,"PDFFont"]]),dg.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),s=0,u=i.length;s<u;s++){var f=i[s];this.updateWidgetAppearance(f,r,n)}},t.prototype.updateWidgetAppearance=function(r,n,i){var s=i??ame.defaultButtonAppearanceProvider,u=ame.normalizeAppearance(s(this,r,n));this.updateWidgetAppearanceWithFont(r,n,u)},t.of=function(r,n,i){return new t(r,n,i)},t})(sme.default);_P.default=gct});var cme=U(Ku=>{"use strict";Object.defineProperty(Ku,"__esModule",{value:!0});var pct=(ct(),ze(ut));pct.__exportStar(RA(),Ku);var mct=yP();Object.defineProperty(Ku,"PDFButton",{enumerable:!0,get:function(){return mct.default}});var Ect=eP();Object.defineProperty(Ku,"PDFCheckBox",{enumerable:!0,get:function(){return Ect.default}});var bct=nP();Object.defineProperty(Ku,"PDFDropdown",{enumerable:!0,get:function(){return bct.default}});var Cct=el();Object.defineProperty(Ku,"PDFField",{enumerable:!0,get:function(){return Cct.default}});var yct=CP();Object.defineProperty(Ku,"PDFForm",{enumerable:!0,get:function(){return yct.default}});var xct=sP();Object.defineProperty(Ku,"PDFOptionList",{enumerable:!0,get:function(){return xct.default}});var vct=fP();Object.defineProperty(Ku,"PDFRadioGroup",{enumerable:!0,get:function(){return vct.default}});var Ict=AP();Object.defineProperty(Ku,"PDFSignature",{enumerable:!0,get:function(){return Ict.default}});var Dct=mP();Object.defineProperty(Ku,"PDFTextField",{enumerable:!0,get:function(){return Dct.default}})});var lme=U(D3=>{"use strict";Object.defineProperty(D3,"__esModule",{value:!0});var fme=(ct(),ze(ut));fme.__exportStar(jy(),D3);fme.__exportStar(L7(),D3)});var Ame=U(Ri=>{"use strict";Object.defineProperty(Ri,"__esModule",{value:!0});var eu=(ct(),ze(ut));eu.__exportStar(cme(),Ri);eu.__exportStar(lme(),Ri);eu.__exportStar(Gu(),Ri);eu.__exportStar(Pm(),Ri);eu.__exportStar(J7(),Ri);eu.__exportStar($T(),Ri);eu.__exportStar(Lm(),Ri);eu.__exportStar(QA(),Ri);eu.__exportStar(zo(),Ri);eu.__exportStar(xP(),Ri);eu.__exportStar(SP(),Ri);eu.__exportStar(vP(),Ri);eu.__exportStar(p3(),Ri);var Bct=UA();Object.defineProperty(Ri,"PDFDocument",{enumerable:!0,get:function(){return Bct.default}});var wct=$f();Object.defineProperty(Ri,"PDFFont",{enumerable:!0,get:function(){return wct.default}});var Fct=f3();Object.defineProperty(Ri,"PDFImage",{enumerable:!0,get:function(){return Fct.default}});var Tct=tl();Object.defineProperty(Ri,"PDFPage",{enumerable:!0,get:function(){return Tct.default}});var Sct=u3();Object.defineProperty(Ri,"PDFEmbeddedPage",{enumerable:!0,get:function(){return Sct.default}});var Qct=BP();Object.defineProperty(Ri,"PDFJavaScript",{enumerable:!0,get:function(){return Qct.default}})});var hme=U(dme=>{"use strict";Object.defineProperty(dme,"__esModule",{value:!0})});var NP=U(jm=>{"use strict";Object.defineProperty(jm,"__esModule",{value:!0});var B3=(ct(),ze(ut));B3.__exportStar(Ame(),jm);B3.__exportStar(Xi(),jm);B3.__exportStar(hme(),jm);B3.__exportStar(fr(),jm)});var Wct={};Ka(Wct,{DocuParse:()=>MP});module.exports=ze(Wct);var nl=require("n8n-workflow"),MP=class{constructor(){this.description={displayName:"DocuParse",name:"docuParse",icon:"file:icons/ener.png",group:["transform"],version:1,subtitle:'={{ $parameter["operation"] }}',description:"Full-featured document parsing \u2014 PDF, DOCX, XLSX, PPTX, images, OCR, markdown output. No native dependencies.",defaults:{name:"DocuParse"},inputs:["main"],outputs:["main"],properties:[{displayName:"Operation",name:"operation",type:"options",noDataExpression:!0,options:[{name:"Parse Document",value:"parse",description:"Extract text, tables, and structure from documents",action:"Parse a document"},{name:"OCR Image",value:"ocr",description:"Extract text from images using OCR",action:"OCR an image"},{name:"Extract Tables",value:"tables",description:"Extract tables as structured JSON",action:"Extract tables from document"},{name:"Convert to Markdown",value:"markdown",description:"Convert document to clean markdown",action:"Convert to markdown"},{name:"Merge PDFs",value:"merge",description:"Merge multiple PDF files into one",action:"Merge PDF files"},{name:"Split PDF",value:"split",description:"Split PDF into separate pages",action:"Split PDF into pages"},{name:"Extract Entities",value:"entities",description:"Extract emails, phones, URLs, dates from text",action:"Extract entities from document"}],default:"parse"},{displayName:"Input Binary Field",name:"binaryPropertyName",type:"string",default:"data",required:!0,description:"The name of the binary property containing the document file"},{displayName:"Output Format",name:"outputFormat",type:"options",options:[{name:"Markdown",value:"markdown",description:"Structured markdown with headings, tables, lists"},{name:"JSON",value:"json",description:"Structured JSON with text items and positions"},{name:"Text",value:"text",description:"Plain text with layout preserved"}],default:"markdown",description:"Output format for the parsed document",displayOptions:{show:{operation:["parse"]}}},{displayName:"OCR Language",name:"ocrLanguage",type:"options",options:[{name:"English",value:"eng"},{name:"Arabic",value:"ara"},{name:"Chinese (Simplified)",value:"chi_sim"},{name:"Chinese (Traditional)",value:"chi_tra"},{name:"French",value:"fra"},{name:"German",value:"deu"},{name:"Hindi",value:"hin"},{name:"Japanese",value:"jpn"},{name:"Korean",value:"kor"},{name:"Portuguese",value:"por"},{name:"Russian",value:"rus"},{name:"Spanish",value:"spa"},{name:"Urdu",value:"urd"}],default:"eng",description:"Language for OCR recognition",displayOptions:{show:{operation:["ocr","parse"]}}},{displayName:"Enable OCR for Scanned Pages",name:"enableOcr",type:"boolean",default:!1,description:"Whether to run OCR on pages with little or no text (scanned documents)",displayOptions:{show:{operation:["parse"]}}},{displayName:"Target Pages",name:"targetPages",type:"string",default:"",placeholder:"1-5,10,15-20",description:'Specific pages to process (e.g. "1-5,10,15-20"). Leave empty for all pages.',displayOptions:{show:{operation:["parse","markdown","tables","split"]}}},{displayName:"Entity Types",name:"entityTypes",type:"multiOptions",options:[{name:"Emails",value:"emails"},{name:"Phone Numbers",value:"phones"},{name:"URLs",value:"urls"},{name:"Dates",value:"dates"},{name:"IP Addresses",value:"ips"},{name:"Currency Amounts",value:"currency"}],default:["emails","phones","urls","dates"],description:"Types of entities to extract",displayOptions:{show:{operation:["entities"]}}},{displayName:"Additional PDF Fields",name:"additionalPdfFields",type:"string",default:"data1",placeholder:"data1,data2,data3",description:"Comma-separated binary field names for additional PDFs to merge",displayOptions:{show:{operation:["merge"]}}},{displayName:"Password",name:"password",type:"string",typeOptions:{password:!0},default:"",description:"Password for encrypted/protected documents",displayOptions:{show:{operation:["parse","markdown","tables","split"]}}},{displayName:"Extract Images",name:"extractImages",type:"boolean",default:!1,description:"Whether to extract images from the document as binary data",displayOptions:{show:{operation:["parse"]}}}]}}async execute(){let t=this.getInputData(),r=[],n=this.getNodeParameter("operation",0),i=this.getNodeParameter("binaryPropertyName",0);if(n==="parse"){let s=this.getNodeParameter("outputFormat",0),u=this.getNodeParameter("enableOcr",0),f=this.getNodeParameter("ocrLanguage",0,"eng"),h=this.getNodeParameter("targetPages",0,""),g=this.getNodeParameter("password",0,"")||void 0;for(let p=0;p<t.length;p++)try{let C=await this.helpers.getBinaryDataBuffer(p,i),y=t[p].binary?.[i];if(!y)throw new nl.NodeOperationError(this.getNode(),`Binary property "${i}" not found on item ${p}`,{itemIndex:p});let x=y.mimeType||"",v=y.fileName||"document",F=v.split(".").pop()?.toLowerCase()||"",Q={};if(x==="application/pdf"||F==="pdf")Q=await kP(C,s,h,u,f,g);else if(x.includes("wordprocessingml")||F==="docx"||F==="doc")Q=await RP(C,s);else if(x.includes("spreadsheetml")||F==="xlsx"||F==="xls")Q=await _ct(C,s);else if(x.includes("presentationml")||F==="pptx"||F==="ppt")Q=await Nct(C,s);else if(x.includes("text/html")||F==="html"||F==="htm")Q=await gme(C,s);else if(x.includes("text/csv")||F==="csv")Q=await kct(C,s);else if(x.startsWith("image/")||["png","jpg","jpeg","tiff","bmp","webp"].includes(F))Q=await OP(C,f);else if(x.startsWith("text/")||["txt","md","json","xml"].includes(F))Q={text:C.toString("utf-8"),format:"text"};else throw new Error(`Unsupported file type: ${x} (.${F})`);r.push({json:{...Q,fileName:v,mimeType:x,format:s},binary:t[p].binary})}catch(C){if(this.continueOnFail()){r.push({json:{error:C.message},pairedItem:{item:p}});continue}throw new nl.NodeOperationError(this.getNode(),C,{itemIndex:p})}}else if(n==="ocr"){let s=this.getNodeParameter("ocrLanguage",0,"eng");for(let u=0;u<t.length;u++)try{let f=await this.helpers.getBinaryDataBuffer(u,i),h=await OP(f,s);r.push({json:{...h,format:"ocr"},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new nl.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="tables"){let s=this.getNodeParameter("targetPages",0,"");for(let u=0;u<t.length;u++)try{let f=await this.helpers.getBinaryDataBuffer(u,i),h=t[u].binary?.[i],g=h?.fileName?.split(".").pop()?.toLowerCase()||"",p=[];if(h?.mimeType==="application/pdf"||g==="pdf")p=await Rct(f,s);else if(h?.mimeType?.includes("spreadsheetml")||g==="xlsx"||g==="xls")p=await Uct(f);else throw new Error("Table extraction supports PDF and XLSX files only");r.push({json:{tables:p,tableCount:p.length},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new nl.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="markdown"){let s=this.getNodeParameter("targetPages",0,"");for(let u=0;u<t.length;u++)try{let f=await this.helpers.getBinaryDataBuffer(u,i),h=t[u].binary?.[i],g=h?.fileName?.split(".").pop()?.toLowerCase()||"",p="";if(h?.mimeType==="application/pdf"||g==="pdf")p=(await kP(f,"markdown",s,!1,"eng")).text;else if(h?.mimeType?.includes("wordprocessingml")||g==="docx")p=(await RP(f,"markdown")).text;else if(h?.mimeType?.includes("text/html")||g==="html")p=(await gme(f,"markdown")).text;else throw new Error("Markdown conversion supports PDF, DOCX, and HTML files");r.push({json:{markdown:p,format:"markdown"},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new nl.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="merge"){let s=this.getNodeParameter("additionalPdfFields",0,"").split(",").map(p=>p.trim()).filter(Boolean),u=[i,...s],f=[];for(let p=0;p<t.length;p++)for(let C of u)try{let y=await this.helpers.getBinaryDataBuffer(p,C);f.push(y)}catch{}if(f.length<2)throw new nl.NodeOperationError(this.getNode(),"Need at least 2 PDFs to merge");let h=await Mct(f),g=await this.helpers.prepareBinaryData(h,"merged.pdf","application/pdf");r.push({json:{pageCount:f.length,status:"merged"},binary:{...t[0].binary,merged_pdf:g}})}else if(n==="split"){let s=this.getNodeParameter("targetPages",0,"");for(let u=0;u<t.length;u++)try{let f=await this.helpers.getBinaryDataBuffer(u,i),h=await Oct(f,s);for(let g of h){let p=await this.helpers.prepareBinaryData(g.buffer,`page_${g.pageNum}.pdf`,"application/pdf");r.push({json:{pageNum:g.pageNum},binary:{...t[u].binary,[`page_${g.pageNum}`]:p},pairedItem:{item:u}})}}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new nl.NodeOperationError(this.getNode(),f,{itemIndex:u})}}else if(n==="entities"){let s=this.getNodeParameter("entityTypes",0);for(let u=0;u<t.length;u++)try{let f=await this.helpers.getBinaryDataBuffer(u,i),h=t[u].binary?.[i],g=h?.mimeType||"",p=h?.fileName?.split(".").pop()?.toLowerCase()||"",C="";g==="application/pdf"||p==="pdf"?C=(await kP(f,"text","",!1,"eng")).text:g.includes("wordprocessingml")||p==="docx"?C=(await RP(f,"text")).text:C=f.toString("utf-8");let y=Lct(C,s);r.push({json:{entities:y,entityCounts:Object.fromEntries(s.map(x=>[x,y[x]?.length||0]))},binary:t[u].binary})}catch(f){if(this.continueOnFail()){r.push({json:{error:f.message},pairedItem:{item:u}});continue}throw new nl.NodeOperationError(this.getNode(),f,{itemIndex:u})}}return[r]}};async function kP(e,t,r,n,i,s){let h=await(await import("pdfjs-dist")).getDocument({data:new Uint8Array(e),password:s}).promise,g=h.numPages,p=r?LP(r,g):Array.from({length:g},(x,v)=>v+1),C=[];for(let x of p)try{let v=await h.getPage(x),F=await v.getTextContent(),Q=v.getViewport({scale:1}),T=F.items.map(ne=>({text:ne.str,x:Math.round(ne.transform[4]*10)/10,y:Math.round(ne.transform[5]*10)/10,width:ne.width||0,height:Math.abs(ne.transform[3])||12,fontName:ne.fontName||""})).filter(ne=>ne.text.trim().length>0),_=Q.height,S=_*.95,N=_*.05,O=T.filter(ne=>ne.y<S&&ne.y>N),H=3,q=[],G=[...O].sort((ne,Le)=>Le.y-ne.y);for(let ne of G){let Le=q.find(X=>Math.abs(X.y-ne.y)<H);Le?Le.items.push(ne):q.push({y:ne.y,items:[ne]})}for(let ne of q)ne.items.sort((Le,X)=>Le.x-X.x);let J=50,Ie=[];for(let ne of q){if(ne.items.length===0)continue;let Le=ne.items[0].text;for(let X=1;X<ne.items.length;X++)ne.items[X].x-(ne.items[X-1].x+ne.items[X-1].width)>J?Le+=" ":Le+=" ",Le+=ne.items[X].text;Ie.push(Le.trim())}let fe=Ie.join(`
|
|
542
542
|
`),z=!1;if(n)try{let ne=await Pct(v,Q),X=(await qct(ne,i)).text?.trim()||"";if(X.length>0)if(fe.length>50){let se=new Set(fe.toLowerCase().split(/\s+/));X.toLowerCase().split(/\s+/).filter(me=>!se.has(me)&&me.length>2).length>10&&(fe=fe+`
|
|
543
543
|
|
|
544
544
|
[OCR Content from page images]
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-docuparse",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Full-featured document parsing node for n8n — PDF, DOCX, XLSX, PPTX, images, OCR, markdown output. No native dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "esbuild nodes/DocuParse/DocuParse.node.ts --bundle --platform=node --format=cjs --outfile=dist/nodes/DocuParse/DocuParse.node.js --external:n8n-workflow --external:tesseract.js --external:pdfjs-dist --external:canvas --minify --target=node18 && cp nodes/DocuParse/
|
|
26
|
+
"build": "esbuild nodes/DocuParse/DocuParse.node.ts --bundle --platform=node --format=cjs --outfile=dist/nodes/DocuParse/DocuParse.node.js --external:n8n-workflow --external:tesseract.js --external:pdfjs-dist --external:canvas --minify --target=node18 && cp -r nodes/DocuParse/icons dist/nodes/DocuParse/icons",
|
|
27
27
|
"dev": "npm run build -- --watch",
|
|
28
28
|
"prepublishOnly": "npm run build"
|
|
29
29
|
},
|