filex-cli 0.1.2 → 0.1.4
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.
- package/dist/filex.cjs +2 -2
- package/package.json +5 -2
package/dist/filex.cjs
CHANGED
|
@@ -68,9 +68,9 @@ end
|
|
|
68
68
|
end`},TD=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return"<"+t.join("")+">"},Bu=function(t){return kD.toHexStringOfMinLength(t,4)},sP=function(t){if(Ru.isWithinBMP(t))return Bu(t);if(Ru.hasSurrogates(t)){var e=Ru.highSurrogate(t),r=Ru.lowSurrogate(t);return""+Bu(e)+Bu(r)}var n=kD.toHexString(t),i="0x"+n+" is not a valid UTF-8 or UTF-16 codepoint.";throw new Error(i)}});var BD=D(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.deriveFontFlags=void 0;var uP=function(t){var e=0,r=function(n){e|=1<<n-1};return t.fixedPitch&&r(1),t.serif&&r(2),t.symbolic&&r(3),t.script&&r(4),t.nonsymbolic&&r(6),t.italic&&r(7),t.allCap&&r(17),t.smallCap&&r(18),t.forceBold&&r(19),e};Iu.deriveFontFlags=function(t){var e=t["OS/2"]?t["OS/2"].sFamilyClass:0,r=uP({fixedPitch:t.post.isFixedPitch,serif:1<=e&&e<=7,symbolic:!0,script:e===10,italic:t.head.macStyle.italic});return r}});var xr=D(Od=>{"use strict";Object.defineProperty(Od,"__esModule",{value:!0});var Sd=(k(),R(T)),lP=Sd.__importDefault(wt()),Me=Sd.__importDefault(Se()),sr=ae(),cP=Ee(),fP=(function(t){Sd.__extends(e,t);function e(r){var n=t.call(this)||this;return n.value=r,n}return e.prototype.asBytes=function(){for(var r=[],n="",i=!1,a=function(f){f!==void 0&&r.push(f),i=!1},o=0,s=this.value.length;o<s;o++){var l=this.value[o],u=sr.toCharCode(l),c=this.value[o+1];i?u===Me.default.Newline||u===Me.default.CarriageReturn?a():u===Me.default.n?a(Me.default.Newline):u===Me.default.r?a(Me.default.CarriageReturn):u===Me.default.t?a(Me.default.Tab):u===Me.default.b?a(Me.default.Backspace):u===Me.default.f?a(Me.default.FormFeed):u===Me.default.LeftParen?a(Me.default.LeftParen):u===Me.default.RightParen?a(Me.default.RightParen):u===Me.default.Backspace?a(Me.default.BackSlash):u>=Me.default.Zero&&u<=Me.default.Seven?(n+=l,(n.length===3||!(c>="0"&&c<="7"))&&(a(parseInt(n,8)),n="")):a(u):u===Me.default.BackSlash?i=!0:a(u)}return new Uint8Array(r)},e.prototype.decodeText=function(){var r=this.asBytes();return sr.hasUtf16BOM(r)?sr.utf16Decode(r):sr.pdfDocEncodingDecode(r)},e.prototype.decodeDate=function(){var r=this.decodeText(),n=sr.parseDate(r);if(!n)throw new cP.InvalidPDFDateStringError(r);return n},e.prototype.asString=function(){return this.value},e.prototype.clone=function(){return e.of(this.value)},e.prototype.toString=function(){return"("+this.value+")"},e.prototype.sizeInBytes=function(){return this.value.length+2},e.prototype.copyBytesInto=function(r,n){return r[n++]=Me.default.LeftParen,n+=sr.copyStringIntoBuffer(this.value,r,n),r[n++]=Me.default.RightParen,this.value.length+2},e.of=function(r){return new e(r)},e.fromDate=function(r){var n=sr.padStart(String(r.getUTCFullYear()),4,"0"),i=sr.padStart(String(r.getUTCMonth()+1),2,"0"),a=sr.padStart(String(r.getUTCDate()),2,"0"),o=sr.padStart(String(r.getUTCHours()),2,"0"),s=sr.padStart(String(r.getUTCMinutes()),2,"0"),l=sr.padStart(String(r.getUTCSeconds()),2,"0");return new e("D:"+n+i+a+o+s+l+"Z")},e})(lP.default);Od.default=fP});var Td=D(Ad=>{"use strict";Object.defineProperty(Ad,"__esModule",{value:!0});var Rt=(k(),R(T)),dP=RD(),hP=BD(),pP=Rt.__importDefault(kt()),ND=Rt.__importDefault(xr()),qu=ae(),vP=(function(){function t(e,r,n,i){var a=this;this.allGlyphsInFontSortedById=function(){for(var o=new Array(a.font.characterSet.length),s=0,l=o.length;s<l;s++){var u=a.font.characterSet[s];o[s]=a.font.glyphForCodePoint(u)}return qu.sortedUniq(o.sort(qu.byAscendingId),function(c){return c.id})},this.font=e,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=qu.Cache.populatedBy(this.allGlyphsInFontSortedById)}return t.for=function(e,r,n,i){return Rt.__awaiter(this,void 0,void 0,function(){var a;return Rt.__generator(this,function(o){switch(o.label){case 0:return[4,e.create(r)];case 1:return a=o.sent(),[2,new t(a,r,n,i)]}})})},t.prototype.encodeText=function(e){for(var r=this.font.layout(e,this.fontFeatures).glyphs,n=new Array(r.length),i=0,a=r.length;i<a;i++)n[i]=qu.toHexStringOfMinLength(r[i].id,4);return pP.default.of(n.join(""))},t.prototype.widthOfTextAtSize=function(e,r){for(var n=this.font.layout(e,this.fontFeatures).glyphs,i=0,a=0,o=n.length;a<o;a++)i+=n[a].advanceWidth*this.scale;var s=r/1e3;return i*s},t.prototype.heightOfFontAtSize=function(e,r){r===void 0&&(r={});var n=r.descender,i=n===void 0?!0:n,a=this.font,o=a.ascent,s=a.descent,l=a.bbox,u=(o||l.maxY)*this.scale,c=(s||l.minY)*this.scale,f=u-c;return i||(f-=Math.abs(s)||0),f/1e3*e},t.prototype.sizeOfFontAtHeight=function(e){var r=this.font,n=r.ascent,i=r.descent,a=r.bbox,o=(n||a.maxY)*this.scale,s=(i||a.minY)*this.scale;return 1e3*e/(o-s)},t.prototype.embedIntoContext=function(e,r){return this.baseFontName=this.customName||e.addRandomSuffix(this.fontName),this.embedFontDict(e,r)},t.prototype.embedFontDict=function(e,r){return Rt.__awaiter(this,void 0,void 0,function(){var n,i,a;return Rt.__generator(this,function(o){switch(o.label){case 0:return[4,this.embedCIDFontDict(e)];case 1:return n=o.sent(),i=this.embedUnicodeCmap(e),a=e.obj({Type:"Font",Subtype:"Type0",BaseFont:this.baseFontName,Encoding:"Identity-H",DescendantFonts:[n],ToUnicode:i}),r?(e.assign(r,a),[2,r]):[2,e.register(a)]}})})},t.prototype.isCFF=function(){return this.font.cff},t.prototype.embedCIDFontDict=function(e){return Rt.__awaiter(this,void 0,void 0,function(){var r,n;return Rt.__generator(this,function(i){switch(i.label){case 0:return[4,this.embedFontDescriptor(e)];case 1:return r=i.sent(),n=e.obj({Type:"Font",Subtype:this.isCFF()?"CIDFontType0":"CIDFontType2",CIDToGIDMap:"Identity",BaseFont:this.baseFontName,CIDSystemInfo:{Registry:ND.default.of("Adobe"),Ordering:ND.default.of("Identity"),Supplement:0},FontDescriptor:r,W:this.computeWidths()}),[2,e.register(n)]}})})},t.prototype.embedFontDescriptor=function(e){return Rt.__awaiter(this,void 0,void 0,function(){var r,n,i,a,o,s,l,u,c,f,d,p,h,v,g;return Rt.__generator(this,function(m){switch(m.label){case 0:return[4,this.embedFontStream(e)];case 1:return r=m.sent(),n=this.scale,i=this.font,a=i.italicAngle,o=i.ascent,s=i.descent,l=i.capHeight,u=i.xHeight,c=this.font.bbox,f=c.minX,d=c.minY,p=c.maxX,h=c.maxY,v=e.obj((g={Type:"FontDescriptor",FontName:this.baseFontName,Flags:hP.deriveFontFlags(this.font),FontBBox:[f*n,d*n,p*n,h*n],ItalicAngle:a,Ascent:o*n,Descent:s*n,CapHeight:(l||o)*n,XHeight:(u||0)*n,StemV:0},g[this.isCFF()?"FontFile3":"FontFile2"]=r,g)),[2,e.register(v)]}})})},t.prototype.serializeFont=function(){return Rt.__awaiter(this,void 0,void 0,function(){return Rt.__generator(this,function(e){return[2,this.fontData]})})},t.prototype.embedFontStream=function(e){return Rt.__awaiter(this,void 0,void 0,function(){var r,n,i;return Rt.__generator(this,function(a){switch(a.label){case 0:return i=(n=e).flateStream,[4,this.serializeFont()];case 1:return r=i.apply(n,[a.sent(),{Subtype:this.isCFF()?"CIDFontType0C":void 0}]),[2,e.register(r)]}})})},t.prototype.embedUnicodeCmap=function(e){var r=dP.createCmap(this.glyphCache.access(),this.glyphId.bind(this)),n=e.flateStream(r);return e.register(n)},t.prototype.glyphId=function(e){return e?e.id:-1},t.prototype.computeWidths=function(){for(var e=this.glyphCache.access(),r=[],n=[],i=0,a=e.length;i<a;i++){var o=e[i],s=e[i-1],l=this.glyphId(o),u=this.glyphId(s);i===0?r.push(l):l-u!==1&&(r.push(n),r.push(l),n=[]),n.push(o.advanceWidth*this.scale)}return r.push(n),r},t})();Ad.default=vP});var ID=D(Rd=>{"use strict";Object.defineProperty(Rd,"__esModule",{value:!0});var ns=(k(),R(T)),mP=ns.__importDefault(Td()),gP=ns.__importDefault(kt()),kd=ae(),DP=(function(t){ns.__extends(e,t);function e(r,n,i,a){var o=t.call(this,r,n,i,a)||this;return o.subset=o.font.createSubset(),o.glyphs=[],o.glyphCache=kd.Cache.populatedBy(function(){return o.glyphs}),o.glyphIdMap=new Map,o}return e.for=function(r,n,i,a){return ns.__awaiter(this,void 0,void 0,function(){var o;return ns.__generator(this,function(s){switch(s.label){case 0:return[4,r.create(n)];case 1:return o=s.sent(),[2,new e(o,n,i,a)]}})})},e.prototype.encodeText=function(r){for(var n=this.font.layout(r,this.fontFeatures).glyphs,i=new Array(n.length),a=0,o=n.length;a<o;a++){var s=n[a],l=this.subset.includeGlyph(s);this.glyphs[l-1]=s,this.glyphIdMap.set(s.id,l),i[a]=kd.toHexStringOfMinLength(l,4)}return this.glyphCache.invalidate(),gP.default.of(i.join(""))},e.prototype.isCFF=function(){return this.subset.cff},e.prototype.glyphId=function(r){return r?this.glyphIdMap.get(r.id):-1},e.prototype.serializeFont=function(){var r=this;return new Promise(function(n,i){var a=[];r.subset.encodeStream().on("data",function(o){return a.push(o)}).on("end",function(){return n(kd.mergeUint8Arrays(a))}).on("error",function(o){return i(o)})})},e})(mP.default);Rd.default=DP});var Nd=D(Sa=>{"use strict";Object.defineProperty(Sa,"__esModule",{value:!0});Sa.AFRelationship=void 0;var ju=(k(),R(T)),Bd=ju.__importDefault(xr()),qD=ju.__importDefault(kt()),yP;(function(t){t.Source="Source",t.Data="Data",t.Alternative="Alternative",t.Supplement="Supplement",t.EncryptedPayload="EncryptedPayload",t.FormData="EncryptedPayload",t.Schema="Schema",t.Unspecified="Unspecified"})(yP=Sa.AFRelationship||(Sa.AFRelationship={}));var FP=(function(){function t(e,r,n){n===void 0&&(n={}),this.fileData=e,this.fileName=r,this.options=n}return t.for=function(e,r,n){return n===void 0&&(n={}),new t(e,r,n)},t.prototype.embedIntoContext=function(e,r){return ju.__awaiter(this,void 0,void 0,function(){var n,i,a,o,s,l,u,c,f;return ju.__generator(this,function(d){return n=this.options,i=n.mimeType,a=n.description,o=n.creationDate,s=n.modificationDate,l=n.afRelationship,u=e.flateStream(this.fileData,{Type:"EmbeddedFile",Subtype:i??void 0,Params:{Size:this.fileData.length,CreationDate:o?Bd.default.fromDate(o):void 0,ModDate:s?Bd.default.fromDate(s):void 0}}),c=e.register(u),f=e.obj({Type:"Filespec",F:Bd.default.of(this.fileName),UF:qD.default.fromText(this.fileName),EF:{F:c},Desc:a?qD.default.fromText(a):void 0,AFRelationship:l??void 0}),r?(e.assign(r,f),[2,r]):[2,e.register(f)]})})},t})();Sa.default=FP});var MD=D(Id=>{"use strict";Object.defineProperty(Id,"__esModule",{value:!0});var Mu=(k(),R(T)),jD=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],Oa;(function(t){t.DeviceGray="DeviceGray",t.DeviceRGB="DeviceRGB",t.DeviceCMYK="DeviceCMYK"})(Oa||(Oa={}));var bP={1:Oa.DeviceGray,3:Oa.DeviceRGB,4:Oa.DeviceCMYK},xP=(function(){function t(e,r,n,i,a){this.imageData=e,this.bitsPerComponent=r,this.width=n,this.height=i,this.colorSpace=a}return t.for=function(e){return Mu.__awaiter(this,void 0,void 0,function(){var r,n,i,a,o,s,l,u,c,f;return Mu.__generator(this,function(d){if(r=new DataView(e.buffer),n=r.getUint16(0),n!==65496)throw new Error("SOI not found in JPEG");for(i=2;i<r.byteLength&&(a=r.getUint16(i),i+=2,!jD.includes(a));)i+=r.getUint16(i);if(!jD.includes(a))throw new Error("Invalid JPEG");if(i+=2,o=r.getUint8(i++),s=r.getUint16(i),i+=2,l=r.getUint16(i),i+=2,u=r.getUint8(i++),c=bP[u],!c)throw new Error("Unknown JPEG channel.");return f=c,[2,new t(e,o,l,s,f)]})})},t.prototype.embedIntoContext=function(e,r){return Mu.__awaiter(this,void 0,void 0,function(){var n;return Mu.__generator(this,function(i){return n=e.stream(this.imageData,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.bitsPerComponent,Width:this.width,Height:this.height,ColorSpace:this.colorSpace,Filter:"DCTDecode",Decode:this.colorSpace===Oa.DeviceCMYK?[1,0,1,0,1,0,1,0]:void 0}),r?(e.assign(r,n),[2,r]):[2,e.register(n)]})})},t})();Id.default=xP});var UD=D(Uu=>{"use strict";Object.defineProperty(Uu,"__esModule",{value:!0});Uu.default=void 0;var _P=CP(Lo());function CP(t){return t&&t.__esModule?t:{default:t}}var B={};B.toRGBA8=function(t){var e=t.width,r=t.height;if(t.tabs.acTL==null)return[B.toRGBA8.decodeImage(t.data,e,r,t).buffer];var n=[];t.frames[0].data==null&&(t.frames[0].data=t.data);for(var i=e*r*4,a=new Uint8Array(i),o=new Uint8Array(i),s=new Uint8Array(i),l=0;l<t.frames.length;l++){var u=t.frames[l],c=u.rect.x,f=u.rect.y,d=u.rect.width,p=u.rect.height,h=B.toRGBA8.decodeImage(u.data,d,p,t);if(l!=0)for(var v=0;v<i;v++)s[v]=a[v];if(u.blend==0?B._copyTile(h,d,p,a,e,r,c,f,0):u.blend==1&&B._copyTile(h,d,p,a,e,r,c,f,1),n.push(a.buffer.slice(0)),u.dispose!=0){if(u.dispose==1)B._copyTile(o,d,p,a,e,r,c,f,0);else if(u.dispose==2)for(var v=0;v<i;v++)a[v]=s[v]}}return n};B.toRGBA8.decodeImage=function(t,e,r,n){var i=e*r,a=B.decode._getBPP(n),o=Math.ceil(e*a/8),s=new Uint8Array(i*4),l=new Uint32Array(s.buffer),u=n.ctype,c=n.depth,f=B._bin.readUshort,d=Date.now();if(u==6){var p=i<<2;if(c==8)for(var h=0;h<p;h+=4)s[h]=t[h],s[h+1]=t[h+1],s[h+2]=t[h+2],s[h+3]=t[h+3];if(c==16)for(var h=0;h<p;h++)s[h]=t[h<<1]}else if(u==2){var v=n.tabs.tRNS;if(v==null){if(c==8)for(var h=0;h<i;h++){var g=h*3;l[h]=255<<24|t[g+2]<<16|t[g+1]<<8|t[g]}if(c==16)for(var h=0;h<i;h++){var g=h*6;l[h]=255<<24|t[g+4]<<16|t[g+2]<<8|t[g]}}else{var m=v[0],b=v[1],w=v[2];if(c==8)for(var h=0;h<i;h++){var F=h<<2,g=h*3;l[h]=255<<24|t[g+2]<<16|t[g+1]<<8|t[g],t[g]==m&&t[g+1]==b&&t[g+2]==w&&(s[F+3]=0)}if(c==16)for(var h=0;h<i;h++){var F=h<<2,g=h*6;l[h]=255<<24|t[g+4]<<16|t[g+2]<<8|t[g],f(t,g)==m&&f(t,g+2)==b&&f(t,g+4)==w&&(s[F+3]=0)}}}else if(u==3){var y=n.tabs.PLTE,C=n.tabs.tRNS,S=C?C.length:0;if(c==1)for(var P=0;P<r;P++)for(var A=P*o,L=P*e,h=0;h<e;h++){var F=L+h<<2,O=t[A+(h>>3)]>>7-((h&7)<<0)&1,q=3*O;s[F]=y[q],s[F+1]=y[q+1],s[F+2]=y[q+2],s[F+3]=O<S?C[O]:255}if(c==2)for(var P=0;P<r;P++)for(var A=P*o,L=P*e,h=0;h<e;h++){var F=L+h<<2,O=t[A+(h>>2)]>>6-((h&3)<<1)&3,q=3*O;s[F]=y[q],s[F+1]=y[q+1],s[F+2]=y[q+2],s[F+3]=O<S?C[O]:255}if(c==4)for(var P=0;P<r;P++)for(var A=P*o,L=P*e,h=0;h<e;h++){var F=L+h<<2,O=t[A+(h>>1)]>>4-((h&1)<<2)&15,q=3*O;s[F]=y[q],s[F+1]=y[q+1],s[F+2]=y[q+2],s[F+3]=O<S?C[O]:255}if(c==8)for(var h=0;h<i;h++){var F=h<<2,O=t[h],q=3*O;s[F]=y[q],s[F+1]=y[q+1],s[F+2]=y[q+2],s[F+3]=O<S?C[O]:255}}else if(u==4){if(c==8)for(var h=0;h<i;h++){var F=h<<2,H=h<<1,U=t[H];s[F]=U,s[F+1]=U,s[F+2]=U,s[F+3]=t[H+1]}if(c==16)for(var h=0;h<i;h++){var F=h<<2,H=h<<2,U=t[H];s[F]=U,s[F+1]=U,s[F+2]=U,s[F+3]=t[H+2]}}else if(u==0)for(var m=n.tabs.tRNS?n.tabs.tRNS:-1,P=0;P<r;P++){var ne=P*o,pe=P*e;if(c==1)for(var J=0;J<e;J++){var U=255*(t[ne+(J>>>3)]>>>7-(J&7)&1),Oe=U==m*255?0:255;l[pe+J]=Oe<<24|U<<16|U<<8|U}else if(c==2)for(var J=0;J<e;J++){var U=85*(t[ne+(J>>>2)]>>>6-((J&3)<<1)&3),Oe=U==m*85?0:255;l[pe+J]=Oe<<24|U<<16|U<<8|U}else if(c==4)for(var J=0;J<e;J++){var U=17*(t[ne+(J>>>1)]>>>4-((J&1)<<2)&15),Oe=U==m*17?0:255;l[pe+J]=Oe<<24|U<<16|U<<8|U}else if(c==8)for(var J=0;J<e;J++){var U=t[ne+J],Oe=U==m?0:255;l[pe+J]=Oe<<24|U<<16|U<<8|U}else if(c==16)for(var J=0;J<e;J++){var U=t[ne+(J<<1)],Oe=f(t,ne+(J<<h))==m?0:255;l[pe+J]=Oe<<24|U<<16|U<<8|U}}return s};B.decode=function(t){for(var e=new Uint8Array(t),r=8,n=B._bin,i=n.readUshort,a=n.readUint,o={tabs:{},frames:[]},s=new Uint8Array(e.length),l=0,u,c=0,f=[137,80,78,71,13,10,26,10],d=0;d<8;d++)if(e[d]!=f[d])throw"The input is not a PNG file!";for(;r<e.length;){var p=n.readUint(e,r);r+=4;var h=n.readASCII(e,r,4);if(r+=4,h=="IHDR")B.decode._IHDR(e,r,o);else if(h=="IDAT"){for(var d=0;d<p;d++)s[l+d]=e[r+d];l+=p}else if(h=="acTL")o.tabs[h]={num_frames:a(e,r),num_plays:a(e,r+4)},u=new Uint8Array(e.length);else if(h=="fcTL"){if(c!=0){var v=o.frames[o.frames.length-1];v.data=B.decode._decompress(o,u.slice(0,c),v.rect.width,v.rect.height),c=0}var g={x:a(e,r+12),y:a(e,r+16),width:a(e,r+4),height:a(e,r+8)},m=i(e,r+22);m=i(e,r+20)/(m==0?100:m);var b={rect:g,delay:Math.round(m*1e3),dispose:e[r+24],blend:e[r+25]};o.frames.push(b)}else if(h=="fdAT"){for(var d=0;d<p-4;d++)u[c+d]=e[r+d+4];c+=p-4}else if(h=="pHYs")o.tabs[h]=[n.readUint(e,r),n.readUint(e,r+4),e[r+8]];else if(h=="cHRM"){o.tabs[h]=[];for(var d=0;d<8;d++)o.tabs[h].push(n.readUint(e,r+d*4))}else if(h=="tEXt"){o.tabs[h]==null&&(o.tabs[h]={});var w=n.nextZero(e,r),F=n.readASCII(e,r,w-r),y=n.readASCII(e,w+1,r+p-w-1);o.tabs[h][F]=y}else if(h=="iTXt"){o.tabs[h]==null&&(o.tabs[h]={});var w=0,C=r;w=n.nextZero(e,C);var F=n.readASCII(e,C,w-C);C=w+1;var S=e[C],P=e[C+1];C+=2,w=n.nextZero(e,C);var A=n.readASCII(e,C,w-C);C=w+1,w=n.nextZero(e,C);var L=n.readUTF8(e,C,w-C);C=w+1;var y=n.readUTF8(e,C,p-(C-r));o.tabs[h][F]=y}else if(h=="PLTE")o.tabs[h]=n.readBytes(e,r,p);else if(h=="hIST"){var O=o.tabs.PLTE.length/3;o.tabs[h]=[];for(var d=0;d<O;d++)o.tabs[h].push(i(e,r+d*2))}else if(h=="tRNS")o.ctype==3?o.tabs[h]=n.readBytes(e,r,p):o.ctype==0?o.tabs[h]=i(e,r):o.ctype==2&&(o.tabs[h]=[i(e,r),i(e,r+2),i(e,r+4)]);else if(h=="gAMA")o.tabs[h]=n.readUint(e,r)/1e5;else if(h=="sRGB")o.tabs[h]=e[r];else if(h=="bKGD")o.ctype==0||o.ctype==4?o.tabs[h]=[i(e,r)]:o.ctype==2||o.ctype==6?o.tabs[h]=[i(e,r),i(e,r+2),i(e,r+4)]:o.ctype==3&&(o.tabs[h]=e[r]);else if(h=="IEND")break;r+=p;var q=n.readUint(e,r);r+=4}if(c!=0){var v=o.frames[o.frames.length-1];v.data=B.decode._decompress(o,u.slice(0,c),v.rect.width,v.rect.height),c=0}return o.data=B.decode._decompress(o,s,o.width,o.height),delete o.compress,delete o.interlace,delete o.filter,o};B.decode._decompress=function(t,e,r,n){var s=Date.now(),i=B.decode._getBPP(t),a=Math.ceil(r*i/8),o=new Uint8Array((a+1+t.interlace)*n);e=B.decode._inflate(e,o);var s=Date.now();return t.interlace==0?e=B.decode._filterZero(e,t,0,r,n):t.interlace==1&&(e=B.decode._readInterlace(e,t)),e};B.decode._inflate=function(t,e){var r=B.inflateRaw(new Uint8Array(t.buffer,2,t.length-6),e);return r};B.inflateRaw=(function(){var t={};return t.H={},t.H.N=function(e,r){var n=Uint8Array,i=0,a=0,o=0,s=0,l=0,u=0,c=0,f=0,d=0,p,h;if(e[0]==3&&e[1]==0)return r||new n(0);var v=t.H,g=v.b,m=v.e,b=v.R,w=v.n,F=v.A,y=v.Z,C=v.m,S=r==null;for(S&&(r=new n(e.length>>>2<<3));i==0;){if(i=g(e,d,1),a=g(e,d+1,2),d+=3,a==0){(d&7)!=0&&(d+=8-(d&7));var P=(d>>>3)+4,A=e[P-4]|e[P-3]<<8;S&&(r=t.H.W(r,f+A)),r.set(new n(e.buffer,e.byteOffset+P,A),f),d=P+A<<3,f+=A;continue}if(S&&(r=t.H.W(r,f+(1<<17))),a==1&&(p=C.J,h=C.h,u=511,c=31),a==2){o=m(e,d,5)+257,s=m(e,d+5,5)+1,l=m(e,d+10,4)+4,d+=14;for(var L=d,O=1,q=0;q<38;q+=2)C.Q[q]=0,C.Q[q+1]=0;for(var q=0;q<l;q++){var H=m(e,d+q*3,3);C.Q[(C.X[q]<<1)+1]=H,H>O&&(O=H)}d+=3*l,w(C.Q,O),F(C.Q,O,C.u),p=C.w,h=C.d,d=b(C.u,(1<<O)-1,o+s,e,d,C.v);var U=v.V(C.v,0,o,C.C);u=(1<<U)-1;var ne=v.V(C.v,o,s,C.D);c=(1<<ne)-1,w(C.C,U),F(C.C,U,p),w(C.D,ne),F(C.D,ne,h)}for(;;){var pe=p[y(e,d)&u];d+=pe&15;var J=pe>>>4;if(!(J>>>8))r[f++]=J;else{if(J==256)break;var Oe=f+J-254;if(J>264){var xt=C.q[J-257];Oe=f+(xt>>>3)+m(e,d,xt&7),d+=xt&7}var lo=h[y(e,d)&c];d+=lo&15;var co=lo>>>4,Ar=C.c[co],$t=(Ar>>>4)+g(e,d,Ar&15);for(d+=Ar&15;f<Oe;)r[f]=r[f++-$t],r[f]=r[f++-$t],r[f]=r[f++-$t],r[f]=r[f++-$t];f=Oe}}}return r.length==f?r:r.slice(0,f)},t.H.W=function(e,r){var n=e.length;if(r<=n)return e;var i=new Uint8Array(n<<1);return i.set(e,0),i},t.H.R=function(e,r,n,i,a,o){for(var s=t.H.e,l=t.H.Z,u=0;u<n;){var c=e[l(i,a)&r];a+=c&15;var f=c>>>4;if(f<=15)o[u]=f,u++;else{var d=0,p=0;f==16?(p=3+s(i,a,2),a+=2,d=o[u-1]):f==17?(p=3+s(i,a,3),a+=3):f==18&&(p=11+s(i,a,7),a+=7);for(var h=u+p;u<h;)o[u]=d,u++}}return a},t.H.V=function(e,r,n,i){for(var a=0,o=0,s=i.length>>>1;o<n;){var l=e[o+r];i[o<<1]=0,i[(o<<1)+1]=l,l>a&&(a=l),o++}for(;o<s;)i[o<<1]=0,i[(o<<1)+1]=0,o++;return a},t.H.n=function(e,r){for(var n=t.H.m,i=e.length,a,o,s,l,u,c=n.j,l=0;l<=r;l++)c[l]=0;for(l=1;l<i;l+=2)c[e[l]]++;var f=n.K;for(a=0,c[0]=0,o=1;o<=r;o++)a=a+c[o-1]<<1,f[o]=a;for(s=0;s<i;s+=2)u=e[s+1],u!=0&&(e[s]=f[u],f[u]++)},t.H.A=function(e,r,n){for(var i=e.length,a=t.H.m,o=a.r,s=0;s<i;s+=2)if(e[s+1]!=0)for(var l=s>>1,u=e[s+1],c=l<<4|u,f=r-u,d=e[s]<<f,p=d+(1<<f);d!=p;){var h=o[d]>>>15-r;n[h]=c,d++}},t.H.l=function(e,r){for(var n=t.H.m.r,i=15-r,a=0;a<e.length;a+=2){var o=e[a]<<r-e[a+1];e[a]=n[o]>>>i}},t.H.M=function(e,r,n){n=n<<(r&7);var i=r>>>3;e[i]|=n,e[i+1]|=n>>>8},t.H.I=function(e,r,n){n=n<<(r&7);var i=r>>>3;e[i]|=n,e[i+1]|=n>>>8,e[i+2]|=n>>>16},t.H.e=function(e,r,n){return(e[r>>>3]|e[(r>>>3)+1]<<8)>>>(r&7)&(1<<n)-1},t.H.b=function(e,r,n){return(e[r>>>3]|e[(r>>>3)+1]<<8|e[(r>>>3)+2]<<16)>>>(r&7)&(1<<n)-1},t.H.Z=function(e,r){return(e[r>>>3]|e[(r>>>3)+1]<<8|e[(r>>>3)+2]<<16)>>>(r&7)},t.H.i=function(e,r){return(e[r>>>3]|e[(r>>>3)+1]<<8|e[(r>>>3)+2]<<16|e[(r>>>3)+3]<<24)>>>(r&7)},t.H.m=(function(){var e=Uint16Array,r=Uint32Array;return{K:new e(16),j:new e(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 e(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 e(512),_:[],h:new e(32),$:[],w:new e(32768),C:[],v:[],d:new e(32768),D:[],u:new e(512),Q:[],r:new e(32768),s:new r(286),Y:new r(30),a:new r(19),t:new r(15e3),k:new e(65536),g:new e(32768)}})(),(function(){for(var e=t.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,e.r[n]=(i>>>16|i<<16)>>>17}function a(o,s,l){for(;s--!=0;)o.push(0,l)}for(var n=0;n<32;n++)e.q[n]=e.S[n]<<3|e.T[n],e.c[n]=e.p[n]<<4|e.z[n];a(e._,144,8),a(e._,112,9),a(e._,24,7),a(e._,8,8),t.H.n(e._,9),t.H.A(e._,9,e.J),t.H.l(e._,9),a(e.$,32,5),t.H.n(e.$,5),t.H.A(e.$,5,e.h),t.H.l(e.$,5),a(e.Q,19,0),a(e.C,286,0),a(e.D,30,0),a(e.v,320,0)})(),t.H.N})();B.decode._readInterlace=function(t,e){for(var r=e.width,n=e.height,i=B.decode._getBPP(e),a=i>>3,o=Math.ceil(r*i/8),s=new Uint8Array(n*o),l=0,u=[0,0,4,0,2,0,1],c=[0,4,0,2,0,1,0],f=[8,8,8,4,4,2,2],d=[8,8,4,4,2,2,1],p=0;p<7;){for(var h=f[p],v=d[p],g=0,m=0,b=u[p];b<n;)b+=h,m++;for(var w=c[p];w<r;)w+=v,g++;var F=Math.ceil(g*i/8);B.decode._filterZero(t,e,l,g,m);for(var y=0,C=u[p];C<n;){for(var S=c[p],P=l+y*F<<3;S<r;){if(i==1){var A=t[P>>3];A=A>>7-(P&7)&1,s[C*o+(S>>3)]|=A<<7-((S&7)<<0)}if(i==2){var A=t[P>>3];A=A>>6-(P&7)&3,s[C*o+(S>>2)]|=A<<6-((S&3)<<1)}if(i==4){var A=t[P>>3];A=A>>4-(P&7)&15,s[C*o+(S>>1)]|=A<<4-((S&1)<<2)}if(i>=8)for(var L=C*o+S*a,O=0;O<a;O++)s[L+O]=t[(P>>3)+O];P+=i,S+=v}y++,C+=h}g*m!=0&&(l+=m*(1+F)),p=p+1}return s};B.decode._getBPP=function(t){var e=[1,null,3,1,2,null,4][t.ctype];return e*t.depth};B.decode._filterZero=function(t,e,r,n,i){var a=B.decode._getBPP(e),o=Math.ceil(n*a/8),s=B.decode._paeth;a=Math.ceil(a/8);var l=0,u=1,c=t[r],f=0;if(c>1&&(t[r]=[0,0,1][c-2]),c==3)for(f=a;f<o;f++)t[f+1]=t[f+1]+(t[f+1-a]>>>1)&255;for(var d=0;d<i;d++)if(l=r+d*o,u=l+d+1,c=t[u-1],f=0,c==0)for(;f<o;f++)t[l+f]=t[u+f];else if(c==1){for(;f<a;f++)t[l+f]=t[u+f];for(;f<o;f++)t[l+f]=t[u+f]+t[l+f-a]}else if(c==2)for(;f<o;f++)t[l+f]=t[u+f]+t[l+f-o];else if(c==3){for(;f<a;f++)t[l+f]=t[u+f]+(t[l+f-o]>>>1);for(;f<o;f++)t[l+f]=t[u+f]+(t[l+f-o]+t[l+f-a]>>>1)}else{for(;f<a;f++)t[l+f]=t[u+f]+s(0,t[l+f-o],0);for(;f<o;f++)t[l+f]=t[u+f]+s(t[l+f-a],t[l+f-o],t[l+f-a-o])}return t};B.decode._paeth=function(t,e,r){var n=t+e-r,i=n-t,a=n-e,o=n-r;return i*i<=a*a&&i*i<=o*o?t:a*a<=o*o?e:r};B.decode._IHDR=function(t,e,r){var n=B._bin;r.width=n.readUint(t,e),e+=4,r.height=n.readUint(t,e),e+=4,r.depth=t[e],e++,r.ctype=t[e],e++,r.compress=t[e],e++,r.filter=t[e],e++,r.interlace=t[e],e++};B._bin={nextZero:function(t,e){for(;t[e]!=0;)e++;return e},readUshort:function(t,e){return t[e]<<8|t[e+1]},writeUshort:function(t,e,r){t[e]=r>>8&255,t[e+1]=r&255},readUint:function(t,e){return t[e]*(256*256*256)+(t[e+1]<<16|t[e+2]<<8|t[e+3])},writeUint:function(t,e,r){t[e]=r>>24&255,t[e+1]=r>>16&255,t[e+2]=r>>8&255,t[e+3]=r&255},readASCII:function(t,e,r){for(var n="",i=0;i<r;i++)n+=String.fromCharCode(t[e+i]);return n},writeASCII:function(t,e,r){for(var n=0;n<r.length;n++)t[e+n]=r.charCodeAt(n)},readBytes:function(t,e,r){for(var n=[],i=0;i<r;i++)n.push(t[e+i]);return n},pad:function(t){return t.length<2?"0"+t:t},readUTF8:function(t,e,r){for(var n="",i,a=0;a<r;a++)n+="%"+B._bin.pad(t[e+a].toString(16));try{i=decodeURIComponent(n)}catch{return B._bin.readASCII(t,e,r)}return i}};B._copyTile=function(t,e,r,n,i,a,o,s,l){for(var u=Math.min(e,i),c=Math.min(r,a),f=0,d=0,p=0;p<c;p++)for(var h=0;h<u;h++)if(o>=0&&s>=0?(f=p*e+h<<2,d=(s+p)*i+o+h<<2):(f=(-s+p)*e-o+h<<2,d=p*i+h<<2),l==0)n[d]=t[f],n[d+1]=t[f+1],n[d+2]=t[f+2],n[d+3]=t[f+3];else if(l==1){var v=t[f+3]*.00392156862745098,g=t[f]*v,m=t[f+1]*v,b=t[f+2]*v,w=n[d+3]*(1/255),F=n[d]*w,y=n[d+1]*w,C=n[d+2]*w,S=1-v,P=v+w*S,A=P==0?0:1/P;n[d+3]=255*P,n[d+0]=(g+F*S)*A,n[d+1]=(m+y*S)*A,n[d+2]=(b+C*S)*A}else if(l==2){var v=t[f+3],g=t[f],m=t[f+1],b=t[f+2],w=n[d+3],F=n[d],y=n[d+1],C=n[d+2];v==w&&g==F&&m==y&&b==C?(n[d]=0,n[d+1]=0,n[d+2]=0,n[d+3]=0):(n[d]=g,n[d+1]=m,n[d+2]=b,n[d+3]=v)}else if(l==3){var v=t[f+3],g=t[f],m=t[f+1],b=t[f+2],w=n[d+3],F=n[d],y=n[d+1],C=n[d+2];if(v==w&&g==F&&m==y&&b==C)continue;if(v<220&&w>20)return!1}return!0};B.encode=function(t,e,r,n,i,a,o){n==null&&(n=0),o==null&&(o=!1);var s=B.encode.compress(t,e,r,n,[!1,!1,!1,0,o]);return B.encode.compressPNG(s,-1),B.encode._main(s,e,r,i,a)};B.encodeLL=function(t,e,r,n,i,a,o,s){for(var l={ctype:0+(n==1?0:2)+(i==0?0:4),depth:a,frames:[]},u=Date.now(),c=(n+i)*a,f=c*e,d=0;d<t.length;d++)l.frames.push({rect:{x:0,y:0,width:e,height:r},img:new Uint8Array(t[d]),blend:0,dispose:1,bpp:Math.ceil(c/8),bpl:Math.ceil(f/8)});B.encode.compressPNG(l,0,!0);var p=B.encode._main(l,e,r,o,s);return p};B.encode._main=function(t,e,r,n,i){i==null&&(i={});var a=B.crc.crc,o=B._bin.writeUint,s=B._bin.writeUshort,l=B._bin.writeASCII,u=8,c=t.frames.length>1,f=!1,d=33+(c?20:0);if(i.sRGB!=null&&(d+=13),i.pHYs!=null&&(d+=21),t.ctype==3){for(var p=t.plte.length,h=0;h<p;h++)t.plte[h]>>>24!=255&&(f=!0);d+=8+p*3+4+(f?8+p*1+4:0)}for(var v=0;v<t.frames.length;v++){var g=t.frames[v];c&&(d+=38),d+=g.cimg.length+12,v!=0&&(d+=4)}d+=12;for(var m=new Uint8Array(d),b=[137,80,78,71,13,10,26,10],h=0;h<8;h++)m[h]=b[h];if(o(m,u,13),u+=4,l(m,u,"IHDR"),u+=4,o(m,u,e),u+=4,o(m,u,r),u+=4,m[u]=t.depth,u++,m[u]=t.ctype,u++,m[u]=0,u++,m[u]=0,u++,m[u]=0,u++,o(m,u,a(m,u-17,17)),u+=4,i.sRGB!=null&&(o(m,u,1),u+=4,l(m,u,"sRGB"),u+=4,m[u]=i.sRGB,u++,o(m,u,a(m,u-5,5)),u+=4),i.pHYs!=null&&(o(m,u,9),u+=4,l(m,u,"pHYs"),u+=4,o(m,u,i.pHYs[0]),u+=4,o(m,u,i.pHYs[1]),u+=4,m[u]=i.pHYs[2],u++,o(m,u,a(m,u-13,13)),u+=4),c&&(o(m,u,8),u+=4,l(m,u,"acTL"),u+=4,o(m,u,t.frames.length),u+=4,o(m,u,i.loop!=null?i.loop:0),u+=4,o(m,u,a(m,u-12,12)),u+=4),t.ctype==3){var p=t.plte.length;o(m,u,p*3),u+=4,l(m,u,"PLTE"),u+=4;for(var h=0;h<p;h++){var w=h*3,F=t.plte[h],y=F&255,C=F>>>8&255,S=F>>>16&255;m[u+w+0]=y,m[u+w+1]=C,m[u+w+2]=S}if(u+=p*3,o(m,u,a(m,u-p*3-4,p*3+4)),u+=4,f){o(m,u,p),u+=4,l(m,u,"tRNS"),u+=4;for(var h=0;h<p;h++)m[u+h]=t.plte[h]>>>24&255;u+=p,o(m,u,a(m,u-p-4,p+4)),u+=4}}for(var P=0,v=0;v<t.frames.length;v++){var g=t.frames[v];c&&(o(m,u,26),u+=4,l(m,u,"fcTL"),u+=4,o(m,u,P++),u+=4,o(m,u,g.rect.width),u+=4,o(m,u,g.rect.height),u+=4,o(m,u,g.rect.x),u+=4,o(m,u,g.rect.y),u+=4,s(m,u,n[v]),u+=2,s(m,u,1e3),u+=2,m[u]=g.dispose,u++,m[u]=g.blend,u++,o(m,u,a(m,u-30,30)),u+=4);var A=g.cimg,p=A.length;o(m,u,p+(v==0?0:4)),u+=4;var L=u;l(m,u,v==0?"IDAT":"fdAT"),u+=4,v!=0&&(o(m,u,P++),u+=4),m.set(A,u),u+=p,o(m,u,a(m,L,u-L)),u+=4}return o(m,u,0),u+=4,l(m,u,"IEND"),u+=4,o(m,u,a(m,u-4,4)),u+=4,m.buffer};B.encode.compressPNG=function(t,e,r){for(var n=0;n<t.frames.length;n++){var i=t.frames[n],a=i.rect.width,o=i.rect.height,s=new Uint8Array(o*i.bpl+o);i.cimg=B.encode._filterZero(i.img,o,i.bpp,i.bpl,s,e,r)}};B.encode.compress=function(t,e,r,n,i){for(var a=i[0],o=i[1],s=i[2],l=i[3],u=i[4],c=6,f=8,d=255,p=0;p<t.length;p++)for(var h=new Uint8Array(t[p]),v=h.length,g=0;g<v;g+=4)d&=h[g+3];var m=d!=255,b=B.encode.framize(t,e,r,a,o,s),w={},F=[],y=[];if(n!=0){for(var C=[],g=0;g<b.length;g++)C.push(b[g].img.buffer);for(var S=B.encode.concatRGBA(C),P=B.quantize(S,n),A=0,L=new Uint8Array(P.abuf),g=0;g<b.length;g++){var O=b[g].img,q=O.length;y.push(new Uint8Array(P.inds.buffer,A>>2,q>>2));for(var p=0;p<q;p+=4)O[p]=L[A+p],O[p+1]=L[A+p+1],O[p+2]=L[A+p+2],O[p+3]=L[A+p+3];A+=q}for(var g=0;g<P.plte.length;g++)F.push(P.plte[g].est.rgba)}else for(var p=0;p<b.length;p++){var H=b[p],U=new Uint32Array(H.img.buffer),ne=H.rect.width,v=U.length,pe=new Uint8Array(v);y.push(pe);for(var g=0;g<v;g++){var J=U[g];if(g!=0&&J==U[g-1])pe[g]=pe[g-1];else if(g>ne&&J==U[g-ne])pe[g]=pe[g-ne];else{var Oe=w[J];if(Oe==null&&(w[J]=Oe=F.length,F.push(J),F.length>=300))break;pe[g]=Oe}}}var xt=F.length;xt<=256&&u==!1&&(xt<=2?f=1:xt<=4?f=2:xt<=16?f=4:f=8,f=Math.max(f,l));for(var p=0;p<b.length;p++){var H=b[p],lo=H.rect.x,co=H.rect.y,ne=H.rect.width,Ar=H.rect.height,$t=H.img,ik=new Uint32Array($t.buffer),fo=4*ne,Xl=4;if(xt<=256&&u==!1){fo=Math.ceil(f*ne/8);for(var Tr=new Uint8Array(fo*Ar),Ns=y[p],Is=0;Is<Ar;Is++){var g=Is*fo,qs=Is*ne;if(f==8)for(var Ve=0;Ve<ne;Ve++)Tr[g+Ve]=Ns[qs+Ve];else if(f==4)for(var Ve=0;Ve<ne;Ve++)Tr[g+(Ve>>1)]|=Ns[qs+Ve]<<4-(Ve&1)*4;else if(f==2)for(var Ve=0;Ve<ne;Ve++)Tr[g+(Ve>>2)]|=Ns[qs+Ve]<<6-(Ve&3)*2;else if(f==1)for(var Ve=0;Ve<ne;Ve++)Tr[g+(Ve>>3)]|=Ns[qs+Ve]<<7-(Ve&7)*1}$t=Tr,c=3,Xl=1}else if(m==!1&&b.length==1){for(var Tr=new Uint8Array(ne*Ar*3),sb=ne*Ar,g=0;g<sb;g++){var O=g*3,Zl=g*4;Tr[O]=$t[Zl],Tr[O+1]=$t[Zl+1],Tr[O+2]=$t[Zl+2]}$t=Tr,c=2,Xl=3,fo=3*ne}H.img=$t,H.bpl=fo,H.bpp=Xl}return{ctype:c,depth:f,plte:F,frames:b}};B.encode.framize=function(t,e,r,n,i,a){for(var o=[],s=0;s<t.length;s++){var l=new Uint8Array(t[s]),u=new Uint32Array(l.buffer),c,f=0,d=0,p=e,h=r,v=n?1:0;if(s!=0){for(var g=a||n||s==1||o[s-2].dispose!=0?1:2,m=0,b=1e9,w=0;w<g;w++){for(var H=new Uint8Array(t[s-1-w]),F=new Uint32Array(t[s-1-w]),y=e,C=r,S=-1,P=-1,A=0;A<r;A++)for(var L=0;L<e;L++){var O=A*e+L;u[O]!=F[O]&&(L<y&&(y=L),L>S&&(S=L),A<C&&(C=A),A>P&&(P=A))}S==-1&&(y=C=S=P=0),i&&((y&1)==1&&y--,(C&1)==1&&C--);var q=(S-y+1)*(P-C+1);q<b&&(b=q,m=w,f=y,d=C,p=S-y+1,h=P-C+1)}var H=new Uint8Array(t[s-1-m]);m==1&&(o[s-1].dispose=2),c=new Uint8Array(p*h*4),B._copyTile(H,e,r,c,p,h,-f,-d,0),v=B._copyTile(l,e,r,c,p,h,-f,-d,3)?1:0,v==1?B.encode._prepareDiff(l,e,r,c,{x:f,y:d,width:p,height:h}):B._copyTile(l,e,r,c,p,h,-f,-d,0)}else c=l.slice(0);o.push({rect:{x:f,y:d,width:p,height:h},img:c,blend:v,dispose:0})}if(n)for(var s=0;s<o.length;s++){var U=o[s];if(U.blend!=1){var ne=U.rect,pe=o[s-1].rect,J=Math.min(ne.x,pe.x),Oe=Math.min(ne.y,pe.y),xt=Math.max(ne.x+ne.width,pe.x+pe.width),lo=Math.max(ne.y+ne.height,pe.y+pe.height),co={x:J,y:Oe,width:xt-J,height:lo-Oe};o[s-1].dispose=1,s-1!=0&&B.encode._updateFrame(t,e,r,o,s-1,co,i),B.encode._updateFrame(t,e,r,o,s,co,i)}}var Ar=0;if(t.length!=1)for(var O=0;O<o.length;O++){var U=o[O];Ar+=U.rect.width*U.rect.height}return o};B.encode._updateFrame=function(t,e,r,n,i,a,o){for(var s=Uint8Array,l=Uint32Array,u=new s(t[i-1]),c=new l(t[i-1]),f=i+1<t.length?new s(t[i+1]):null,d=new s(t[i]),p=new l(d.buffer),h=e,v=r,g=-1,m=-1,b=0;b<a.height;b++)for(var w=0;w<a.width;w++){var F=a.x+w,y=a.y+b,C=y*e+F,S=p[C];S==0||n[i-1].dispose==0&&c[C]==S&&(f==null||f[C*4+3]!=0)||(F<h&&(h=F),F>g&&(g=F),y<v&&(v=y),y>m&&(m=y))}g==-1&&(h=v=g=m=0),o&&((h&1)==1&&h--,(v&1)==1&&v--),a={x:h,y:v,width:g-h+1,height:m-v+1};var P=n[i];P.rect=a,P.blend=1,P.img=new Uint8Array(a.width*a.height*4),n[i-1].dispose==0?(B._copyTile(u,e,r,P.img,a.width,a.height,-a.x,-a.y,0),B.encode._prepareDiff(d,e,r,P.img,a)):B._copyTile(d,e,r,P.img,a.width,a.height,-a.x,-a.y,0)};B.encode._prepareDiff=function(t,e,r,n,i){B._copyTile(t,e,r,n,i.width,i.height,-i.x,-i.y,2)};B.encode._filterZero=function(t,e,r,n,i,a,o){var s=[],l=[0,1,2,3,4];a!=-1?l=[a]:(e*n>5e5||r==1)&&(l=[0]);var u;o&&(u={level:0});for(var c=o&&UZIP!=null?UZIP:_P.default,f=0;f<l.length;f++){for(var d=0;d<e;d++)B.encode._filterLine(i,t,d,n,r,l[f]);s.push(c.deflate(i,u))}for(var p,h=1e9,f=0;f<s.length;f++)s[f].length<h&&(p=f,h=s[f].length);return s[p]};B.encode._filterLine=function(t,e,r,n,i,a){var o=r*n,s=o+r,l=B.decode._paeth;if(t[s]=a,s++,a==0)if(n<500)for(var u=0;u<n;u++)t[s+u]=e[o+u];else t.set(new Uint8Array(e.buffer,o,n),s);else if(a==1){for(var u=0;u<i;u++)t[s+u]=e[o+u];for(var u=i;u<n;u++)t[s+u]=e[o+u]-e[o+u-i]+256&255}else if(r==0){for(var u=0;u<i;u++)t[s+u]=e[o+u];if(a==2)for(var u=i;u<n;u++)t[s+u]=e[o+u];if(a==3)for(var u=i;u<n;u++)t[s+u]=e[o+u]-(e[o+u-i]>>1)+256&255;if(a==4)for(var u=i;u<n;u++)t[s+u]=e[o+u]-l(e[o+u-i],0,0)+256&255}else{if(a==2)for(var u=0;u<n;u++)t[s+u]=e[o+u]+256-e[o+u-n]&255;if(a==3){for(var u=0;u<i;u++)t[s+u]=e[o+u]+256-(e[o+u-n]>>1)&255;for(var u=i;u<n;u++)t[s+u]=e[o+u]+256-(e[o+u-n]+e[o+u-i]>>1)&255}if(a==4){for(var u=0;u<i;u++)t[s+u]=e[o+u]+256-l(0,e[o+u-n],0)&255;for(var u=i;u<n;u++)t[s+u]=e[o+u]+256-l(e[o+u-i],e[o+u-n],e[o+u-i-n])&255}}};B.crc={table:(function(){for(var t=new Uint32Array(256),e=0;e<256;e++){for(var r=e,n=0;n<8;n++)r&1?r=3988292384^r>>>1:r=r>>>1;t[e]=r}return t})(),update:function(t,e,r,n){for(var i=0;i<n;i++)t=B.crc.table[(t^e[r+i])&255]^t>>>8;return t},crc:function(t,e,r){return B.crc.update(4294967295,t,e,r)^4294967295}};B.quantize=function(t,e){for(var r=new Uint8Array(t),n=r.slice(0),i=new Uint32Array(n.buffer),a=B.quantize.getKDtree(n,e),o=a[0],s=a[1],l=B.quantize.planeDst,u=r,c=i,f=u.length,d=new Uint8Array(r.length>>2),p=0;p<f;p+=4){var h=u[p]*.00392156862745098,v=u[p+1]*(1/255),g=u[p+2]*(1/255),m=u[p+3]*(1/255),b=B.quantize.getNearest(o,h,v,g,m);d[p>>2]=b.ind,c[p>>2]=b.est.rgba}return{abuf:n.buffer,inds:d,plte:s}};B.quantize.getKDtree=function(t,e,r){r==null&&(r=1e-4);var n=new Uint32Array(t.buffer),i={i0:0,i1:t.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=B.quantize.stats(t,i.i0,i.i1),i.est=B.quantize.estats(i.bst);for(var a=[i];a.length<e;){for(var o=0,s=0,l=0;l<a.length;l++)a[l].est.L>o&&(o=a[l].est.L,s=l);if(o<r)break;var u=a[s],c=B.quantize.splitPixels(t,n,u.i0,u.i1,u.est.e,u.est.eMq255),f=u.i0>=c||u.i1<=c;if(f){u.est.L=0;continue}var d={i0:u.i0,i1:c,bst:null,est:null,tdst:0,left:null,right:null};d.bst=B.quantize.stats(t,d.i0,d.i1),d.est=B.quantize.estats(d.bst);var p={i0:c,i1:u.i1,bst:null,est:null,tdst:0,left:null,right:null};p.bst={R:[],m:[],N:u.bst.N-d.bst.N};for(var l=0;l<16;l++)p.bst.R[l]=u.bst.R[l]-d.bst.R[l];for(var l=0;l<4;l++)p.bst.m[l]=u.bst.m[l]-d.bst.m[l];p.est=B.quantize.estats(p.bst),u.left=d,u.right=p,a[s]=d,a.push(p)}a.sort(function(h,v){return v.bst.N-h.bst.N});for(var l=0;l<a.length;l++)a[l].ind=l;return[i,a]};B.quantize.getNearest=function(t,e,r,n,i){if(t.left==null)return t.tdst=B.quantize.dist(t.est.q,e,r,n,i),t;var a=B.quantize.planeDst(t.est,e,r,n,i),o=t.left,s=t.right;a>0&&(o=t.right,s=t.left);var l=B.quantize.getNearest(o,e,r,n,i);if(l.tdst<=a*a)return l;var u=B.quantize.getNearest(s,e,r,n,i);return u.tdst<l.tdst?u:l};B.quantize.planeDst=function(t,e,r,n,i){var a=t.e;return a[0]*e+a[1]*r+a[2]*n+a[3]*i-t.eMq};B.quantize.dist=function(t,e,r,n,i){var a=e-t[0],o=r-t[1],s=n-t[2],l=i-t[3];return a*a+o*o+s*s+l*l};B.quantize.splitPixels=function(t,e,r,n,i,a){var o=B.quantize.vecDot;n-=4;for(var s=0;r<n;){for(;o(t,r,i)<=a;)r+=4;for(;o(t,n,i)>a;)n-=4;if(r>=n)break;var l=e[r>>2];e[r>>2]=e[n>>2],e[n>>2]=l,r+=4,n-=4}for(;o(t,r,i)>a;)r-=4;return r+4};B.quantize.vecDot=function(t,e,r){return t[e]*r[0]+t[e+1]*r[1]+t[e+2]*r[2]+t[e+3]*r[3]};B.quantize.stats=function(t,e,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],a=r-e>>2,o=e;o<r;o+=4){var s=t[o]*.00392156862745098,l=t[o+1]*(1/255),u=t[o+2]*(1/255),c=t[o+3]*(1/255);i[0]+=s,i[1]+=l,i[2]+=u,i[3]+=c,n[0]+=s*s,n[1]+=s*l,n[2]+=s*u,n[3]+=s*c,n[5]+=l*l,n[6]+=l*u,n[7]+=l*c,n[10]+=u*u,n[11]+=u*c,n[15]+=c*c}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:a}};B.quantize.estats=function(t){var e=t.R,r=t.m,n=t.N,i=r[0],a=r[1],o=r[2],s=r[3],l=n==0?0:1/n,u=[e[0]-i*i*l,e[1]-i*a*l,e[2]-i*o*l,e[3]-i*s*l,e[4]-a*i*l,e[5]-a*a*l,e[6]-a*o*l,e[7]-a*s*l,e[8]-o*i*l,e[9]-o*a*l,e[10]-o*o*l,e[11]-o*s*l,e[12]-s*i*l,e[13]-s*a*l,e[14]-s*o*l,e[15]-s*s*l],c=u,f=B.M4,d=[.5,.5,.5,.5],p=0,h=0;if(n!=0)for(var v=0;v<10&&(d=f.multVec(c,d),h=Math.sqrt(f.dot(d,d)),d=f.sml(1/h,d),!(Math.abs(h-p)<1e-9));v++)p=h;var g=[i*l,a*l,o*l,s*l],m=f.dot(f.sml(255,g),d);return{Cov:u,q:g,e:d,L:p,eMq255:m,eMq:f.dot(d,g),rgba:(Math.round(255*g[3])<<24|Math.round(255*g[2])<<16|Math.round(255*g[1])<<8|Math.round(255*g[0])<<0)>>>0}};B.M4={multVec:function(t,e){return[t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3],t[4]*e[0]+t[5]*e[1]+t[6]*e[2]+t[7]*e[3],t[8]*e[0]+t[9]*e[1]+t[10]*e[2]+t[11]*e[3],t[12]*e[0]+t[13]*e[1]+t[14]*e[2]+t[15]*e[3]]},dot:function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},sml:function(t,e){return[t*e[0],t*e[1],t*e[2],t*e[3]]}};B.encode.concatRGBA=function(t){for(var e=0,r=0;r<t.length;r++)e+=t[r].byteLength;for(var n=new Uint8Array(e),i=0,r=0;r<t.length;r++){for(var a=new Uint8Array(t[r]),o=a.length,s=0;s<o;s+=4){var l=a[s],u=a[s+1],c=a[s+2],f=a[s+3];f==0&&(l=u=c=0),n[i+s]=l,n[i+s+1]=u,n[i+s+2]=c,n[i+s+3]=f}i+=o}return n.buffer};var wP=B;Uu.default=wP});var zD=D(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.PNG=yi.PngType=void 0;var PP=(k(),R(T)),VD=PP.__importDefault(UD()),EP=function(t){if(t===0)return Aa.Greyscale;if(t===2)return Aa.Truecolour;if(t===3)return Aa.IndexedColour;if(t===4)return Aa.GreyscaleWithAlpha;if(t===6)return Aa.TruecolourWithAlpha;throw new Error("Unknown color type: "+t)},SP=function(t){for(var e=Math.floor(t.length/4),r=new Uint8Array(e*3),n=new Uint8Array(e*1),i=0,a=0,o=0;i<t.length;)r[a++]=t[i++],r[a++]=t[i++],r[a++]=t[i++],n[o++]=t[i++];return{rgbChannel:r,alphaChannel:n}},Aa;(function(t){t.Greyscale="Greyscale",t.Truecolour="Truecolour",t.IndexedColour="IndexedColour",t.GreyscaleWithAlpha="GreyscaleWithAlpha",t.TruecolourWithAlpha="TruecolourWithAlpha"})(Aa=yi.PngType||(yi.PngType={}));var OP=(function(){function t(e){var r=VD.default.decode(e),n=VD.default.toRGBA8(r);if(n.length>1)throw new Error("Animated PNGs are not supported");var i=new Uint8Array(n[0]),a=SP(i),o=a.rgbChannel,s=a.alphaChannel;this.rgbChannel=o;var l=s.some(function(u){return u<255});l&&(this.alphaChannel=s),this.type=EP(r.ctype),this.width=r.width,this.height=r.height,this.bitsPerComponent=8}return t.load=function(e){return new t(e)},t})();yi.PNG=OP});var WD=D(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});var Vu=(k(),R(T)),AP=zD(),TP=(function(){function t(e){this.image=e,this.bitsPerComponent=e.bitsPerComponent,this.width=e.width,this.height=e.height,this.colorSpace="DeviceRGB"}return t.for=function(e){return Vu.__awaiter(this,void 0,void 0,function(){var r;return Vu.__generator(this,function(n){return r=AP.PNG.load(e),[2,new t(r)]})})},t.prototype.embedIntoContext=function(e,r){return Vu.__awaiter(this,void 0,void 0,function(){var n,i;return Vu.__generator(this,function(a){return n=this.embedAlphaChannel(e),i=e.flateStream(this.image.rgbChannel,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.image.bitsPerComponent,Width:this.image.width,Height:this.image.height,ColorSpace:this.colorSpace,SMask:n}),r?(e.assign(r,i),[2,r]):[2,e.register(i)]})})},t.prototype.embedAlphaChannel=function(e){if(this.image.alphaChannel){var r=e.flateStream(this.image.alphaChannel,{Type:"XObject",Subtype:"Image",Height:this.image.height,Width:this.image.width,BitsPerComponent:this.image.bitsPerComponent,ColorSpace:"DeviceGray",Decode:[0,1]});return e.register(r)}},t})();qd.default=TP});var Md=D(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});var kP=(function(){function t(e,r,n){this.bytes=e,this.start=r||0,this.pos=this.start,this.end=r&&n?r+n:this.bytes.length}return Object.defineProperty(t.prototype,"length",{get:function(){return this.end-this.start},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEmpty",{get:function(){return this.length===0},enumerable:!1,configurable:!0}),t.prototype.getByte=function(){return this.pos>=this.end?-1:this.bytes[this.pos++]},t.prototype.getUint16=function(){var e=this.getByte(),r=this.getByte();return e===-1||r===-1?-1:(e<<8)+r},t.prototype.getInt32=function(){var e=this.getByte(),r=this.getByte(),n=this.getByte(),i=this.getByte();return(e<<24)+(r<<16)+(n<<8)+i},t.prototype.getBytes=function(e,r){r===void 0&&(r=!1);var n=this.bytes,i=this.pos,a=this.end;if(e){var s=i+e;s>a&&(s=a),this.pos=s;var o=n.subarray(i,s);return r?new Uint8ClampedArray(o):o}else{var o=n.subarray(i,a);return r?new Uint8ClampedArray(o):o}},t.prototype.peekByte=function(){var e=this.getByte();return this.pos--,e},t.prototype.peekBytes=function(e,r){r===void 0&&(r=!1);var n=this.getBytes(e,r);return this.pos-=n.length,n},t.prototype.skip=function(e){e||(e=1),this.pos+=e},t.prototype.reset=function(){this.pos=this.start},t.prototype.moveStart=function(){this.start=this.pos},t.prototype.makeSubStream=function(e,r){return new t(this.bytes,e,r)},t.prototype.decode=function(){return this.bytes},t})();jd.default=kP});var Ta=D(Ud=>{"use strict";Object.defineProperty(Ud,"__esModule",{value:!0});var RP=(k(),R(T)),BP=Ee(),NP=RP.__importDefault(Md()),IP=new Uint8Array(0),qP=(function(){function t(e){if(this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=IP,this.minBufferLength=512,e)for(;this.minBufferLength<e;)this.minBufferLength*=2}return Object.defineProperty(t.prototype,"isEmpty",{get:function(){for(;!this.eof&&this.bufferLength===0;)this.readBlock();return this.bufferLength===0},enumerable:!1,configurable:!0}),t.prototype.getByte=function(){for(var e=this.pos;this.bufferLength<=e;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.pos++]},t.prototype.getUint16=function(){var e=this.getByte(),r=this.getByte();return e===-1||r===-1?-1:(e<<8)+r},t.prototype.getInt32=function(){var e=this.getByte(),r=this.getByte(),n=this.getByte(),i=this.getByte();return(e<<24)+(r<<16)+(n<<8)+i},t.prototype.getBytes=function(e,r){r===void 0&&(r=!1);var n,i=this.pos;if(e){for(this.ensureBuffer(i+e),n=i+e;!this.eof&&this.bufferLength<n;)this.readBlock();var a=this.bufferLength;n>a&&(n=a)}else{for(;!this.eof;)this.readBlock();n=this.bufferLength}this.pos=n;var o=this.buffer.subarray(i,n);return r&&!(o instanceof Uint8ClampedArray)?new Uint8ClampedArray(o):o},t.prototype.peekByte=function(){var e=this.getByte();return this.pos--,e},t.prototype.peekBytes=function(e,r){r===void 0&&(r=!1);var n=this.getBytes(e,r);return this.pos-=n.length,n},t.prototype.skip=function(e){e||(e=1),this.pos+=e},t.prototype.reset=function(){this.pos=0},t.prototype.makeSubStream=function(e,r){for(var n=e+r;this.bufferLength<=n&&!this.eof;)this.readBlock();return new NP.default(this.buffer,e,r)},t.prototype.decode=function(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)},t.prototype.readBlock=function(){throw new BP.MethodNotImplementedError(this.constructor.name,"readBlock")},t.prototype.ensureBuffer=function(e){var r=this.buffer;if(e<=r.byteLength)return r;for(var n=this.minBufferLength;n<e;)n*=2;var i=new Uint8Array(n);return i.set(r),this.buffer=i},t})();Ud.default=qP});var HD=D(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});var GD=(k(),R(T)),jP=GD.__importDefault(Ta()),LD=function(t){return t===32||t===9||t===13||t===10},MP=(function(t){GD.__extends(e,t);function e(r,n){var i=t.call(this,n)||this;return i.stream=r,i.input=new Uint8Array(5),n&&(n=.8*n),i}return e.prototype.readBlock=function(){for(var r=126,n=122,i=-1,a=this.stream,o=a.getByte();LD(o);)o=a.getByte();if(o===i||o===r){this.eof=!0;return}var s=this.bufferLength,l,u;if(o===n){for(l=this.ensureBuffer(s+4),u=0;u<4;++u)l[s+u]=0;this.bufferLength+=4}else{var c=this.input;for(c[0]=o,u=1;u<5;++u){for(o=a.getByte();LD(o);)o=a.getByte();if(c[u]=o,o===i||o===r)break}if(l=this.ensureBuffer(s+u-1),this.bufferLength+=u-1,u<5){for(;u<5;++u)c[u]=117;this.eof=!0}var f=0;for(u=0;u<5;++u)f=f*85+(c[u]-33);for(u=3;u>=0;--u)l[s+u]=f&255,f>>=8}},e})(jP.default);Vd.default=MP});var XD=D(zd=>{"use strict";Object.defineProperty(zd,"__esModule",{value:!0});var KD=(k(),R(T)),UP=KD.__importDefault(Ta()),VP=(function(t){KD.__extends(e,t);function e(r,n){var i=t.call(this,n)||this;return i.stream=r,i.firstDigit=-1,n&&(n=.5*n),i}return e.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,a=this.ensureBuffer(this.bufferLength+i),o=this.bufferLength,s=this.firstDigit,l=0,u=n.length;l<u;l++){var c=n[l],f=void 0;if(c>=48&&c<=57)f=c&15;else if(c>=65&&c<=70||c>=97&&c<=102)f=(c&15)+9;else if(c===62){this.eof=!0;break}else continue;s<0?s=f:(a[o++]=s<<4|f,s=-1)}s>=0&&this.eof&&(a[o++]=s<<4,s=-1),this.firstDigit=s,this.bufferLength=o},e})(UP.default);zd.default=VP});var JD=D(Wd=>{"use strict";Object.defineProperty(Wd,"__esModule",{value:!0});var YD=(k(),R(T)),zP=YD.__importDefault(Ta()),ZD=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),WP=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]),LP=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]),GP=[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],HP=[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],KP=(function(t){YD.__extends(e,t);function e(r,n){var i=t.call(this,n)||this;i.stream=r;var a=r.getByte(),o=r.getByte();if(a===-1||o===-1)throw new Error("Invalid header in flate stream: "+a+", "+o);if((a&15)!==8)throw new Error("Unknown compression method in flate stream: "+a+", "+o);if(((a<<8)+o)%31!==0)throw new Error("Bad FCHECK in flate stream: "+a+", "+o);if(o&32)throw new Error("FDICT bit set in flate stream: "+a+", "+o);return i.codeSize=0,i.codeBuf=0,i}return e.prototype.readBlock=function(){var r,n,i=this.stream,a=this.getBits(3);if(a&1&&(this.eof=!0),a>>=1,a===0){var o=void 0;if((o=i.getByte())===-1)throw new Error("Bad block header in flate stream");var s=o;if((o=i.getByte())===-1)throw new Error("Bad block header in flate stream");if(s|=o<<8,(o=i.getByte())===-1)throw new Error("Bad block header in flate stream");var l=o;if((o=i.getByte())===-1)throw new Error("Bad block header in flate stream");if(l|=o<<8,l!==(~s&65535)&&(s!==0||l!==0))throw new Error("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;var u=this.bufferLength;r=this.ensureBuffer(u+s);var c=u+s;if(this.bufferLength=c,s===0)i.peekByte()===-1&&(this.eof=!0);else for(var f=u;f<c;++f){if((o=i.getByte())===-1){this.eof=!0;break}r[f]=o}return}var d,p;if(a===1)d=GP,p=HP;else if(a===2){var h=this.getBits(5)+257,v=this.getBits(5)+1,g=this.getBits(4)+4,m=new Uint8Array(ZD.length),b=void 0;for(b=0;b<g;++b)m[ZD[b]]=this.getBits(3);var w=this.generateHuffmanTable(m);n=0,b=0;for(var F=h+v,y=new Uint8Array(F),C=void 0,S=void 0,P=void 0;b<F;){var A=this.getCode(w);if(A===16)C=2,S=3,P=n;else if(A===17)C=3,S=3,P=n=0;else if(A===18)C=7,S=11,P=n=0;else{y[b++]=n=A;continue}for(var L=this.getBits(C)+S;L-- >0;)y[b++]=P}d=this.generateHuffmanTable(y.subarray(0,h)),p=this.generateHuffmanTable(y.subarray(h,F))}else throw new Error("Unknown block type in flate stream");r=this.buffer;for(var O=r?r.length:0,q=this.bufferLength;;){var H=this.getCode(d);if(H<256){q+1>=O&&(r=this.ensureBuffer(q+1),O=r.length),r[q++]=H;continue}if(H===256){this.bufferLength=q;return}H-=257,H=WP[H];var U=H>>16;U>0&&(U=this.getBits(U)),n=(H&65535)+U,H=this.getCode(p),H=LP[H],U=H>>16,U>0&&(U=this.getBits(U));var ne=(H&65535)+U;q+n>=O&&(r=this.ensureBuffer(q+n),O=r.length);for(var pe=0;pe<n;++pe,++q)r[q]=r[q-ne]}},e.prototype.getBits=function(r){for(var n=this.stream,i=this.codeSize,a=this.codeBuf,o;i<r;){if((o=n.getByte())===-1)throw new Error("Bad encoding in flate stream");a|=o<<i,i+=8}return o=a&(1<<r)-1,this.codeBuf=a>>r,this.codeSize=i-=r,o},e.prototype.getCode=function(r){for(var n=this.stream,i=r[0],a=r[1],o=this.codeSize,s=this.codeBuf,l;o<a&&(l=n.getByte())!==-1;)s|=l<<o,o+=8;var u=i[s&(1<<a)-1];typeof i=="number"&&console.log("FLATE:",u);var c=u>>16,f=u&65535;if(c<1||o<c)throw new Error("Bad encoding in flate stream");return this.codeBuf=s>>c,this.codeSize=o-c,f},e.prototype.generateHuffmanTable=function(r){var n=r.length,i=0,a;for(a=0;a<n;++a)r[a]>i&&(i=r[a]);for(var o=1<<i,s=new Int32Array(o),l=1,u=0,c=2;l<=i;++l,u<<=1,c<<=1)for(var f=0;f<n;++f)if(r[f]===l){var d=0,p=u;for(a=0;a<l;++a)d=d<<1|p&1,p>>=1;for(a=d;a<o;a+=c)s[a]=l<<16|f;++u}return[s,i]},e})(zP.default);Wd.default=KP});var $D=D(Ld=>{"use strict";Object.defineProperty(Ld,"__esModule",{value:!0});var QD=(k(),R(T)),XP=QD.__importDefault(Ta()),ZP=(function(t){QD.__extends(e,t);function e(r,n,i){var a=t.call(this,n)||this;a.stream=r,a.cachedData=0,a.bitsCached=0;for(var o=4096,s={earlyChange:i,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(o),dictionaryLengths:new Uint16Array(o),dictionaryPrevCodes:new Uint16Array(o),currentSequence:new Uint8Array(o),currentSequenceLength:0},l=0;l<256;++l)s.dictionaryValues[l]=l,s.dictionaryLengths[l]=1;return a.lzwState=s,a}return e.prototype.readBlock=function(){var r=512,n=r*2,i=r,a,o,s,l=this.lzwState;if(l){var u=l.earlyChange,c=l.nextCode,f=l.dictionaryValues,d=l.dictionaryLengths,p=l.dictionaryPrevCodes,h=l.codeLength,v=l.prevCode,g=l.currentSequence,m=l.currentSequenceLength,b=0,w=this.bufferLength,F=this.ensureBuffer(this.bufferLength+n);for(a=0;a<r;a++){var y=this.readBits(h),C=m>0;if(!y||y<256)g[0]=y,m=1;else if(y>=258)if(y<c)for(m=d[y],o=m-1,s=y;o>=0;o--)g[o]=f[s],s=p[s];else g[m++]=g[0];else if(y===256){h=9,c=258,m=0;continue}else{this.eof=!0,delete this.lzwState;break}if(C&&(p[c]=v,d[c]=d[v]+1,f[c]=g[0],c++,h=c+u&c+u-1?h:Math.min(Math.log(c+u)/.6931471805599453+1,12)|0),v=y,b+=m,n<b){do n+=i;while(n<b);F=this.ensureBuffer(this.bufferLength+n)}for(o=0;o<m;o++)F[w++]=g[o]}l.nextCode=c,l.codeLength=h,l.prevCode=v,l.currentSequenceLength=m,this.bufferLength=w}},e.prototype.readBits=function(r){for(var n=this.bitsCached,i=this.cachedData;n<r;){var a=this.stream.getByte();if(a===-1)return this.eof=!0,null;i=i<<8|a,n+=8}return this.bitsCached=n-=r,this.cachedData=i,i>>>n&(1<<r)-1},e})(XP.default);Ld.default=ZP});var ty=D(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});var ey=(k(),R(T)),YP=ey.__importDefault(Ta()),JP=(function(t){ey.__extends(e,t);function e(r,n){var i=t.call(this,n)||this;return i.stream=r,i}return e.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,a=r[0];if(a<128){if(n=this.ensureBuffer(i+a+1),n[i++]=r[1],a>0){var o=this.stream.getBytes(a);n.set(o,i),i+=a}}else{a=257-a;var s=r[1];n=this.ensureBuffer(i+a+1);for(var l=0;l<a;l++)n[i++]=s}this.bufferLength=i},e})(YP.default);Gd.default=JP});var Wu=D(zu=>{"use strict";Object.defineProperty(zu,"__esModule",{value:!0});zu.decodePDFRawStream=void 0;var Gr=(k(),R(T)),iy=Ee(),ry=Gr.__importDefault(ht()),ay=Gr.__importDefault(Dt()),_r=Gr.__importDefault(ye()),QP=Gr.__importDefault(Xe()),$P=Gr.__importDefault(HD()),eE=Gr.__importDefault(XD()),tE=Gr.__importDefault(JD()),rE=Gr.__importDefault($D()),nE=Gr.__importDefault(ty()),iE=Gr.__importDefault(Md()),ny=function(t,e,r){if(e===_r.default.of("FlateDecode"))return new tE.default(t);if(e===_r.default.of("LZWDecode")){var n=1;if(r instanceof ay.default){var i=r.lookup(_r.default.of("EarlyChange"));i instanceof QP.default&&(n=i.asNumber())}return new rE.default(t,void 0,n)}if(e===_r.default.of("ASCII85Decode"))return new $P.default(t);if(e===_r.default.of("ASCIIHexDecode"))return new eE.default(t);if(e===_r.default.of("RunLengthDecode"))return new nE.default(t);throw new iy.UnsupportedEncodingError(e.asString())};zu.decodePDFRawStream=function(t){var e=t.dict,r=t.contents,n=new iE.default(r),i=e.lookup(_r.default.of("Filter")),a=e.lookup(_r.default.of("DecodeParms"));if(i instanceof _r.default)n=ny(n,i,a);else if(i instanceof ry.default)for(var o=0,s=i.size();o<s;o++)n=ny(n,i.lookup(o,_r.default),a&&a.lookupMaybe(o,ay.default));else if(i)throw new iy.UnexpectedObjectTypeError([_r.default,ry.default],i);return n}});var sy=D(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});var vn=(k(),R(T)),oy=Ee(),Lu=vn.__importDefault(Xe()),aE=vn.__importDefault(Ca()),oE=vn.__importDefault(pn()),sE=Wu(),uE=vn.__importDefault(_u()),lE=vn.__importDefault(Se()),cE=ae(),fE=function(t){var e=t.MediaBox(),r=e.lookup(2,Lu.default).asNumber()-e.lookup(0,Lu.default).asNumber(),n=e.lookup(3,Lu.default).asNumber()-e.lookup(1,Lu.default).asNumber();return{left:0,bottom:0,right:r,top:n}},dE=function(t){return[1,0,0,1,-t.left,-t.bottom]},hE=(function(){function t(e,r,n){this.page=e;var i=r??fE(e);this.width=i.right-i.left,this.height=i.top-i.bottom,this.boundingBox=i,this.transformationMatrix=n??dE(i)}return t.for=function(e,r,n){return vn.__awaiter(this,void 0,void 0,function(){return vn.__generator(this,function(i){return[2,new t(e,r,n)]})})},t.prototype.embedIntoContext=function(e,r){return vn.__awaiter(this,void 0,void 0,function(){var n,i,a,o,s,l,u,c,f,d;return vn.__generator(this,function(p){if(n=this.page.normalizedEntries(),i=n.Contents,a=n.Resources,!i)throw new oy.MissingPageContentsEmbeddingError;return o=this.decodeContents(i),s=this.boundingBox,l=s.left,u=s.bottom,c=s.right,f=s.top,d=e.flateStream(o,{Type:"XObject",Subtype:"Form",FormType:1,BBox:[l,u,c,f],Matrix:this.transformationMatrix,Resources:a}),r?(e.assign(r,d),[2,r]):[2,e.register(d)]})})},t.prototype.decodeContents=function(e){for(var r=Uint8Array.of(lE.default.Newline),n=[],i=0,a=e.size();i<a;i++){var o=e.lookup(i,oE.default),s=void 0;if(o instanceof aE.default)s=sE.decodePDFRawStream(o).decode();else if(o instanceof uE.default)s=o.getUnencodedContents();else throw new oy.UnrecognizedStreamTypeError(o);n.push(s,r)}return cE.mergeIntoTypedArray.apply(void 0,n)},t})();Hd.default=hE});var Zd=D(Et=>{"use strict";Object.defineProperty(Et,"__esModule",{value:!0});Et.Duplex=Et.PrintScaling=Et.ReadingDirection=Et.NonFullScreenPageMode=void 0;var Zu=(k(),R(T)),pE=Zu.__importDefault(ht()),vE=Zu.__importDefault(Zo()),Le=Zu.__importDefault(ye()),Kd=Zu.__importDefault(Xe()),Fi=ae(),Gu=function(t,e){if(t!==void 0)return e[t]},Hu;(function(t){t.UseNone="UseNone",t.UseOutlines="UseOutlines",t.UseThumbs="UseThumbs",t.UseOC="UseOC"})(Hu=Et.NonFullScreenPageMode||(Et.NonFullScreenPageMode={}));var Ku;(function(t){t.L2R="L2R",t.R2L="R2L"})(Ku=Et.ReadingDirection||(Et.ReadingDirection={}));var Xu;(function(t){t.None="None",t.AppDefault="AppDefault"})(Xu=Et.PrintScaling||(Et.PrintScaling={}));var Xd;(function(t){t.Simplex="Simplex",t.DuplexFlipShortEdge="DuplexFlipShortEdge",t.DuplexFlipLongEdge="DuplexFlipLongEdge"})(Xd=Et.Duplex||(Et.Duplex={}));var mE=(function(){function t(e){this.dict=e}return t.prototype.lookupBool=function(e){var r=this.dict.lookup(Le.default.of(e));if(r instanceof vE.default)return r},t.prototype.lookupName=function(e){var r=this.dict.lookup(Le.default.of(e));if(r instanceof Le.default)return r},t.prototype.HideToolbar=function(){return this.lookupBool("HideToolbar")},t.prototype.HideMenubar=function(){return this.lookupBool("HideMenubar")},t.prototype.HideWindowUI=function(){return this.lookupBool("HideWindowUI")},t.prototype.FitWindow=function(){return this.lookupBool("FitWindow")},t.prototype.CenterWindow=function(){return this.lookupBool("CenterWindow")},t.prototype.DisplayDocTitle=function(){return this.lookupBool("DisplayDocTitle")},t.prototype.NonFullScreenPageMode=function(){return this.lookupName("NonFullScreenPageMode")},t.prototype.Direction=function(){return this.lookupName("Direction")},t.prototype.PrintScaling=function(){return this.lookupName("PrintScaling")},t.prototype.Duplex=function(){return this.lookupName("Duplex")},t.prototype.PickTrayByPDFSize=function(){return this.lookupBool("PickTrayByPDFSize")},t.prototype.PrintPageRange=function(){var e=this.dict.lookup(Le.default.of("PrintPageRange"));if(e instanceof pE.default)return e},t.prototype.NumCopies=function(){var e=this.dict.lookup(Le.default.of("NumCopies"));if(e instanceof Kd.default)return e},t.prototype.getHideToolbar=function(){var e,r;return(r=(e=this.HideToolbar())===null||e===void 0?void 0:e.asBoolean())!==null&&r!==void 0?r:!1},t.prototype.getHideMenubar=function(){var e,r;return(r=(e=this.HideMenubar())===null||e===void 0?void 0:e.asBoolean())!==null&&r!==void 0?r:!1},t.prototype.getHideWindowUI=function(){var e,r;return(r=(e=this.HideWindowUI())===null||e===void 0?void 0:e.asBoolean())!==null&&r!==void 0?r:!1},t.prototype.getFitWindow=function(){var e,r;return(r=(e=this.FitWindow())===null||e===void 0?void 0:e.asBoolean())!==null&&r!==void 0?r:!1},t.prototype.getCenterWindow=function(){var e,r;return(r=(e=this.CenterWindow())===null||e===void 0?void 0:e.asBoolean())!==null&&r!==void 0?r:!1},t.prototype.getDisplayDocTitle=function(){var e,r;return(r=(e=this.DisplayDocTitle())===null||e===void 0?void 0:e.asBoolean())!==null&&r!==void 0?r:!1},t.prototype.getNonFullScreenPageMode=function(){var e,r,n=(e=this.NonFullScreenPageMode())===null||e===void 0?void 0:e.decodeText();return(r=Gu(n,Hu))!==null&&r!==void 0?r:Hu.UseNone},t.prototype.getReadingDirection=function(){var e,r,n=(e=this.Direction())===null||e===void 0?void 0:e.decodeText();return(r=Gu(n,Ku))!==null&&r!==void 0?r:Ku.L2R},t.prototype.getPrintScaling=function(){var e,r,n=(e=this.PrintScaling())===null||e===void 0?void 0:e.decodeText();return(r=Gu(n,Xu))!==null&&r!==void 0?r:Xu.AppDefault},t.prototype.getDuplex=function(){var e,r=(e=this.Duplex())===null||e===void 0?void 0:e.decodeText();return Gu(r,Xd)},t.prototype.getPickTrayByPDFSize=function(){var e;return(e=this.PickTrayByPDFSize())===null||e===void 0?void 0:e.asBoolean()},t.prototype.getPrintPageRange=function(){var e=this.PrintPageRange();if(!e)return[];for(var r=[],n=0;n<e.size();n+=2){var i=e.lookup(n,Kd.default).asNumber(),a=e.lookup(n+1,Kd.default).asNumber();r.push({start:i,end:a})}return r},t.prototype.getNumCopies=function(){var e,r;return(r=(e=this.NumCopies())===null||e===void 0?void 0:e.asNumber())!==null&&r!==void 0?r:1},t.prototype.setHideToolbar=function(e){var r=this.dict.context.obj(e);this.dict.set(Le.default.of("HideToolbar"),r)},t.prototype.setHideMenubar=function(e){var r=this.dict.context.obj(e);this.dict.set(Le.default.of("HideMenubar"),r)},t.prototype.setHideWindowUI=function(e){var r=this.dict.context.obj(e);this.dict.set(Le.default.of("HideWindowUI"),r)},t.prototype.setFitWindow=function(e){var r=this.dict.context.obj(e);this.dict.set(Le.default.of("FitWindow"),r)},t.prototype.setCenterWindow=function(e){var r=this.dict.context.obj(e);this.dict.set(Le.default.of("CenterWindow"),r)},t.prototype.setDisplayDocTitle=function(e){var r=this.dict.context.obj(e);this.dict.set(Le.default.of("DisplayDocTitle"),r)},t.prototype.setNonFullScreenPageMode=function(e){Fi.assertIsOneOf(e,"nonFullScreenPageMode",Hu);var r=Le.default.of(e);this.dict.set(Le.default.of("NonFullScreenPageMode"),r)},t.prototype.setReadingDirection=function(e){Fi.assertIsOneOf(e,"readingDirection",Ku);var r=Le.default.of(e);this.dict.set(Le.default.of("Direction"),r)},t.prototype.setPrintScaling=function(e){Fi.assertIsOneOf(e,"printScaling",Xu);var r=Le.default.of(e);this.dict.set(Le.default.of("PrintScaling"),r)},t.prototype.setDuplex=function(e){Fi.assertIsOneOf(e,"duplex",Xd);var r=Le.default.of(e);this.dict.set(Le.default.of("Duplex"),r)},t.prototype.setPickTrayByPDFSize=function(e){var r=this.dict.context.obj(e);this.dict.set(Le.default.of("PickTrayByPDFSize"),r)},t.prototype.setPrintPageRange=function(e){Array.isArray(e)||(e=[e]);for(var r=[],n=0,i=e.length;n<i;n++)r.push(e[n].start),r.push(e[n].end);Fi.assertEachIs(r,"printPageRange",["number"]);var a=this.dict.context.obj(r);this.dict.set(Le.default.of("PrintPageRange"),a)},t.prototype.setNumCopies=function(e){Fi.assertRange(e,"numCopies",1,Number.MAX_VALUE),Fi.assertInteger(e,"numCopies");var r=this.dict.context.obj(e);this.dict.set(Le.default.of("NumCopies"),r)},t.fromDict=function(e){return new t(e)},t.create=function(e){var r=e.obj({});return new t(r)},t})();Et.default=mE});var Ju=D(Jd=>{"use strict";Object.defineProperty(Jd,"__esModule",{value:!0});var bi=(k(),R(T)),gE=bi.__importDefault(Dt()),Yd=bi.__importDefault(xr()),Yu=bi.__importDefault(kt()),Bt=bi.__importDefault(ye()),uy=bi.__importDefault(Xe()),DE=bi.__importDefault(ht()),yE=bi.__importDefault(Pt()),FE=ae(),ly=Ee(),bE=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/,xE=(function(){function t(e,r){this.dict=e,this.ref=r}return t.prototype.T=function(){return this.dict.lookupMaybe(Bt.default.of("T"),Yd.default,Yu.default)},t.prototype.Ff=function(){var e=this.getInheritableAttribute(Bt.default.of("Ff"));return this.dict.context.lookupMaybe(e,uy.default)},t.prototype.V=function(){var e=this.getInheritableAttribute(Bt.default.of("V"));return this.dict.context.lookup(e)},t.prototype.Kids=function(){return this.dict.lookupMaybe(Bt.default.of("Kids"),DE.default)},t.prototype.DA=function(){var e=this.dict.lookup(Bt.default.of("DA"));if(e instanceof Yd.default||e instanceof Yu.default)return e},t.prototype.setKids=function(e){this.dict.set(Bt.default.of("Kids"),this.dict.context.obj(e))},t.prototype.getParent=function(){var e=this.dict.get(Bt.default.of("Parent"));if(e instanceof yE.default){var r=this.dict.lookup(Bt.default.of("Parent"),gE.default);return new t(r,e)}},t.prototype.setParent=function(e){e?this.dict.set(Bt.default.of("Parent"),e):this.dict.delete(Bt.default.of("Parent"))},t.prototype.getFullyQualifiedName=function(){var e=this.getParent();return e?e.getFullyQualifiedName()+"."+this.getPartialName():this.getPartialName()},t.prototype.getPartialName=function(){var e;return(e=this.T())===null||e===void 0?void 0:e.decodeText()},t.prototype.setPartialName=function(e){e?this.dict.set(Bt.default.of("T"),Yu.default.fromText(e)):this.dict.delete(Bt.default.of("T"))},t.prototype.setDefaultAppearance=function(e){this.dict.set(Bt.default.of("DA"),Yd.default.of(e))},t.prototype.getDefaultAppearance=function(){var e=this.DA();return e instanceof Yu.default?e.decodeText():e?.asString()},t.prototype.setFontSize=function(e){var r,n=(r=this.getFullyQualifiedName())!==null&&r!==void 0?r:"",i=this.getDefaultAppearance();if(!i)throw new ly.MissingDAEntryError(n);var a=FE.findLastMatch(i,bE);if(!a.match)throw new ly.MissingTfOperatorError(n);var o=i.slice(0,a.pos-a.match[0].length),s=a.pos<=i.length?i.slice(a.pos):"",l=a.match[1],u=o+" /"+l+" "+e+" Tf "+s;this.setDefaultAppearance(u)},t.prototype.getFlags=function(){var e,r;return(r=(e=this.Ff())===null||e===void 0?void 0:e.asNumber())!==null&&r!==void 0?r:0},t.prototype.setFlags=function(e){this.dict.set(Bt.default.of("Ff"),uy.default.of(e))},t.prototype.hasFlag=function(e){var r=this.getFlags();return(r&e)!==0},t.prototype.setFlag=function(e){var r=this.getFlags();this.setFlags(r|e)},t.prototype.clearFlag=function(e){var r=this.getFlags();this.setFlags(r&~e)},t.prototype.setFlagTo=function(e,r){r?this.setFlag(e):this.clearFlag(e)},t.prototype.getInheritableAttribute=function(e){var r;return this.ascend(function(n){r||(r=n.dict.get(e))}),r},t.prototype.ascend=function(e){e(this);var r=this.getParent();r&&r.ascend(e)},t})();Jd.default=xE});var dy=D(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});var fy=(k(),R(T)),cy=fy.__importDefault(ye()),_E=fy.__importDefault(Xe()),CE=(function(){function t(e){this.dict=e}return t.prototype.W=function(){var e=this.dict.lookup(cy.default.of("W"));if(e instanceof _E.default)return e},t.prototype.getWidth=function(){var e,r;return(r=(e=this.W())===null||e===void 0?void 0:e.asNumber())!==null&&r!==void 0?r:1},t.prototype.setWidth=function(e){var r=this.dict.context.obj(e);this.dict.set(cy.default.of("W"),r)},t.fromDict=function(e){return new t(e)},t})();Qd.default=CE});var th=D(eh=>{"use strict";Object.defineProperty(eh,"__esModule",{value:!0});var ka=(k(),R(T)),is=ka.__importDefault(Dt()),at=ka.__importDefault(ye()),$d=ka.__importDefault(pn()),wE=ka.__importDefault(ht()),PE=ka.__importDefault(Pt()),hy=ka.__importDefault(Xe()),EE=(function(){function t(e){this.dict=e}return t.prototype.Rect=function(){return this.dict.lookup(at.default.of("Rect"),wE.default)},t.prototype.AP=function(){return this.dict.lookupMaybe(at.default.of("AP"),is.default)},t.prototype.F=function(){var e=this.dict.lookup(at.default.of("F"));return this.dict.context.lookupMaybe(e,hy.default)},t.prototype.getRectangle=function(){var e,r=this.Rect();return(e=r?.asRectangle())!==null&&e!==void 0?e:{x:0,y:0,width:0,height:0}},t.prototype.setRectangle=function(e){var r=e.x,n=e.y,i=e.width,a=e.height,o=this.dict.context.obj([r,n,r+i,n+a]);this.dict.set(at.default.of("Rect"),o)},t.prototype.getAppearanceState=function(){var e=this.dict.lookup(at.default.of("AS"));if(e instanceof at.default)return e},t.prototype.setAppearanceState=function(e){this.dict.set(at.default.of("AS"),e)},t.prototype.setAppearances=function(e){this.dict.set(at.default.of("AP"),e)},t.prototype.ensureAP=function(){var e=this.AP();return e||(e=this.dict.context.obj({}),this.dict.set(at.default.of("AP"),e)),e},t.prototype.getNormalAppearance=function(){var e=this.ensureAP(),r=e.get(at.default.of("N"));if(r instanceof PE.default||r instanceof is.default)return r;throw new Error("Unexpected N type: "+r?.constructor.name)},t.prototype.setNormalAppearance=function(e){var r=this.ensureAP();r.set(at.default.of("N"),e)},t.prototype.setRolloverAppearance=function(e){var r=this.ensureAP();r.set(at.default.of("R"),e)},t.prototype.setDownAppearance=function(e){var r=this.ensureAP();r.set(at.default.of("D"),e)},t.prototype.removeRolloverAppearance=function(){var e=this.AP();e?.delete(at.default.of("R"))},t.prototype.removeDownAppearance=function(){var e=this.AP();e?.delete(at.default.of("D"))},t.prototype.getAppearances=function(){var e=this.AP();if(e){var r=e.lookup(at.default.of("N"),is.default,$d.default),n=e.lookupMaybe(at.default.of("R"),is.default,$d.default),i=e.lookupMaybe(at.default.of("D"),is.default,$d.default);return{normal:r,rollover:n,down:i}}},t.prototype.getFlags=function(){var e,r;return(r=(e=this.F())===null||e===void 0?void 0:e.asNumber())!==null&&r!==void 0?r:0},t.prototype.setFlags=function(e){this.dict.set(at.default.of("F"),hy.default.of(e))},t.prototype.hasFlag=function(e){var r=this.getFlags();return(r&e)!==0},t.prototype.setFlag=function(e){var r=this.getFlags();this.setFlags(r|e)},t.prototype.clearFlag=function(e){var r=this.getFlags();this.setFlags(r&~e)},t.prototype.setFlagTo=function(e,r){r?this.setFlag(e):this.clearFlag(e)},t.fromDict=function(e){return new t(e)},t})();eh.default=EE});var ah=D(ih=>{"use strict";Object.defineProperty(ih,"__esModule",{value:!0});var as=(k(),R(T)),Nt=as.__importDefault(ye()),rh=as.__importDefault(Xe()),py=as.__importDefault(ht()),Ra=as.__importDefault(kt()),nh=as.__importDefault(xr()),SE=(function(){function t(e){this.dict=e}return t.prototype.R=function(){var e=this.dict.lookup(Nt.default.of("R"));if(e instanceof rh.default)return e},t.prototype.BC=function(){var e=this.dict.lookup(Nt.default.of("BC"));if(e instanceof py.default)return e},t.prototype.BG=function(){var e=this.dict.lookup(Nt.default.of("BG"));if(e instanceof py.default)return e},t.prototype.CA=function(){var e=this.dict.lookup(Nt.default.of("CA"));if(e instanceof Ra.default||e instanceof nh.default)return e},t.prototype.RC=function(){var e=this.dict.lookup(Nt.default.of("RC"));if(e instanceof Ra.default||e instanceof nh.default)return e},t.prototype.AC=function(){var e=this.dict.lookup(Nt.default.of("AC"));if(e instanceof Ra.default||e instanceof nh.default)return e},t.prototype.getRotation=function(){var e;return(e=this.R())===null||e===void 0?void 0:e.asNumber()},t.prototype.getBorderColor=function(){var e=this.BC();if(e){for(var r=[],n=0,i=e?.size();n<i;n++){var a=e.get(n);a instanceof rh.default&&r.push(a.asNumber())}return r}},t.prototype.getBackgroundColor=function(){var e=this.BG();if(e){for(var r=[],n=0,i=e?.size();n<i;n++){var a=e.get(n);a instanceof rh.default&&r.push(a.asNumber())}return r}},t.prototype.getCaptions=function(){var e=this.CA(),r=this.RC(),n=this.AC();return{normal:e?.decodeText(),rollover:r?.decodeText(),down:n?.decodeText()}},t.prototype.setRotation=function(e){var r=this.dict.context.obj(e);this.dict.set(Nt.default.of("R"),r)},t.prototype.setBorderColor=function(e){var r=this.dict.context.obj(e);this.dict.set(Nt.default.of("BC"),r)},t.prototype.setBackgroundColor=function(e){var r=this.dict.context.obj(e);this.dict.set(Nt.default.of("BG"),r)},t.prototype.setCaptions=function(e){var r=Ra.default.fromText(e.normal);if(this.dict.set(Nt.default.of("CA"),r),e.rollover){var n=Ra.default.fromText(e.rollover);this.dict.set(Nt.default.of("RC"),n)}else this.dict.delete(Nt.default.of("RC"));if(e.down){var i=Ra.default.fromText(e.down);this.dict.set(Nt.default.of("AC"),i)}else this.dict.delete(Nt.default.of("AC"))},t.fromDict=function(e){return new t(e)},t})();ih.default=SE});var ch=D(lh=>{"use strict";Object.defineProperty(lh,"__esModule",{value:!0});var gn=(k(),R(T)),oh=gn.__importDefault(Dt()),mn=gn.__importDefault(ye()),OE=gn.__importDefault(Pt()),vy=gn.__importDefault(xr()),my=gn.__importDefault(kt()),sh=gn.__importDefault(dy()),AE=gn.__importDefault(th()),uh=gn.__importDefault(ah()),TE=(function(t){gn.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.MK=function(){var r=this.dict.lookup(mn.default.of("MK"));if(r instanceof oh.default)return r},e.prototype.BS=function(){var r=this.dict.lookup(mn.default.of("BS"));if(r instanceof oh.default)return r},e.prototype.DA=function(){var r=this.dict.lookup(mn.default.of("DA"));if(r instanceof vy.default||r instanceof my.default)return r},e.prototype.P=function(){var r=this.dict.get(mn.default.of("P"));if(r instanceof OE.default)return r},e.prototype.setP=function(r){this.dict.set(mn.default.of("P"),r)},e.prototype.setDefaultAppearance=function(r){this.dict.set(mn.default.of("DA"),vy.default.of(r))},e.prototype.getDefaultAppearance=function(){var r=this.DA();return r instanceof my.default?r.decodeText():r?.asString()},e.prototype.getAppearanceCharacteristics=function(){var r=this.MK();if(r)return uh.default.fromDict(r)},e.prototype.getOrCreateAppearanceCharacteristics=function(){var r=this.MK();if(r)return uh.default.fromDict(r);var n=uh.default.fromDict(this.dict.context.obj({}));return this.dict.set(mn.default.of("MK"),n.dict),n},e.prototype.getBorderStyle=function(){var r=this.BS();if(r)return sh.default.fromDict(r)},e.prototype.getOrCreateBorderStyle=function(){var r=this.BS();if(r)return sh.default.fromDict(r);var n=sh.default.fromDict(this.dict.context.obj({}));return this.dict.set(mn.default.of("BS"),n.dict),n},e.prototype.getOnValue=function(){var r,n=(r=this.getAppearances())===null||r===void 0?void 0:r.normal;if(n instanceof oh.default)for(var i=n.keys(),a=0,o=i.length;a<o;a++){var s=i[a];if(s!==mn.default.of("Off"))return s}},e.fromDict=function(r){return new e(r)},e.create=function(r,n){var i=r.obj({Type:"Annot",Subtype:"Widget",Rect:[0,0,0,0],Parent:n});return new e(i)},e})(AE.default);lh.default=TE});var xi=D(dh=>{"use strict";Object.defineProperty(dh,"__esModule",{value:!0});var os=(k(),R(T)),kE=os.__importDefault(Dt()),fh=os.__importDefault(ye()),RE=os.__importDefault(Ju()),gy=os.__importDefault(ch()),Dy=Ee(),BE=(function(t){os.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.FT=function(){var r=this.getInheritableAttribute(fh.default.of("FT"));return this.dict.context.lookup(r,fh.default)},e.prototype.getWidgets=function(){var r=this.Kids();if(!r)return[gy.default.fromDict(this.dict)];for(var n=new Array(r.size()),i=0,a=r.size();i<a;i++){var o=r.lookup(i,kE.default);n[i]=gy.default.fromDict(o)}return n},e.prototype.addWidget=function(r){var n=this.normalizedEntries().Kids;n.push(r)},e.prototype.removeWidget=function(r){var n=this.Kids();if(n){if(r<0||r>n.size())throw new Dy.IndexOutOfBoundsError(r,0,n.size());n.remove(r)}else{if(r!==0)throw new Dy.IndexOutOfBoundsError(r,0,0);this.setKids([])}},e.prototype.normalizedEntries=function(){var r=this.Kids();return r||(r=this.dict.context.obj([this.ref]),this.dict.set(fh.default.of("Kids"),r)),{Kids:r}},e.fromDict=function(r,n){return new e(r,n)},e})(RE.default);dh.default=BE});var us=D(ph=>{"use strict";Object.defineProperty(ph,"__esModule",{value:!0});var Ba=(k(),R(T)),Qu=Ba.__importDefault(xr()),ss=Ba.__importDefault(kt()),NE=Ba.__importDefault(ht()),hh=Ba.__importDefault(ye()),IE=Ba.__importDefault(xi()),yy=Ee(),qE=(function(t){Ba.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.Opt=function(){return this.dict.lookupMaybe(hh.default.of("Opt"),Qu.default,ss.default,NE.default)},e.prototype.setOpt=function(r){this.dict.set(hh.default.of("Opt"),this.dict.context.obj(r))},e.prototype.getExportValues=function(){var r=this.Opt();if(r){if(r instanceof Qu.default||r instanceof ss.default)return[r];for(var n=[],i=0,a=r.size();i<a;i++){var o=r.lookup(i);(o instanceof Qu.default||o instanceof ss.default)&&n.push(o)}return n}},e.prototype.removeExportValue=function(r){var n=this.Opt();if(n)if(n instanceof Qu.default||n instanceof ss.default){if(r!==0)throw new yy.IndexOutOfBoundsError(r,0,0);this.setOpt([])}else{if(r<0||r>n.size())throw new yy.IndexOutOfBoundsError(r,0,n.size());n.remove(r)}},e.prototype.normalizeExportValues=function(){for(var r,n,i,a,o=(r=this.getExportValues())!==null&&r!==void 0?r:[],s=[],l=this.getWidgets(),u=0,c=l.length;u<c;u++){var f=l[u],d=(n=o[u])!==null&&n!==void 0?n:ss.default.fromText((a=(i=f.getOnValue())===null||i===void 0?void 0:i.decodeText())!==null&&a!==void 0?a:"");s.push(d)}this.setOpt(s)},e.prototype.addOpt=function(r,n){var i;this.normalizeExportValues();var a=r.decodeText(),o;if(n)for(var s=(i=this.getExportValues())!==null&&i!==void 0?i:[],l=0,u=s.length;l<u;l++){var c=s[l];c.decodeText()===a&&(o=l)}var f=this.Opt();return f.push(r),o??f.size()-1},e.prototype.addWidgetWithOpt=function(r,n,i){var a=this.addOpt(n,i),o=hh.default.of(String(a));return this.addWidget(r),o},e})(IE.default);ph.default=qE});var gh=D(mh=>{"use strict";Object.defineProperty(mh,"__esModule",{value:!0});var vh=(k(),R(T)),Na=vh.__importDefault(ye()),jE=vh.__importDefault(us()),ME=Ee(),UE=(function(t){vh.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.setValue=function(r){var n,i=(n=this.getOnValue())!==null&&n!==void 0?n:Na.default.of("Yes");if(r!==i&&r!==Na.default.of("Off"))throw new ME.InvalidAcroFieldValueError;this.dict.set(Na.default.of("V"),r);for(var a=this.getWidgets(),o=0,s=a.length;o<s;o++){var l=a[o],u=l.getOnValue()===r?r:Na.default.of("Off");l.setAppearanceState(u)}},e.prototype.getValue=function(){var r=this.V();return r instanceof Na.default?r:Na.default.of("Off")},e.prototype.getOnValue=function(){var r=this.getWidgets()[0];return r?.getOnValue()},e.fromDict=function(r,n){return new e(r,n)},e.create=function(r){var n=r.obj({FT:"Btn",Kids:[]}),i=r.register(n);return new e(n,i)},e})(jE.default);mh.default=UE});var _i=D(It=>{"use strict";Object.defineProperty(It,"__esModule",{value:!0});It.AcroChoiceFlags=It.AcroTextFlags=It.AcroButtonFlags=It.AcroFieldFlags=void 0;var $e=function(t){return 1<<t},VE;(function(t){t[t.ReadOnly=$e(0)]="ReadOnly",t[t.Required=$e(1)]="Required",t[t.NoExport=$e(2)]="NoExport"})(VE=It.AcroFieldFlags||(It.AcroFieldFlags={}));var zE;(function(t){t[t.NoToggleToOff=$e(14)]="NoToggleToOff",t[t.Radio=$e(15)]="Radio",t[t.PushButton=$e(16)]="PushButton",t[t.RadiosInUnison=$e(25)]="RadiosInUnison"})(zE=It.AcroButtonFlags||(It.AcroButtonFlags={}));var WE;(function(t){t[t.Multiline=$e(12)]="Multiline",t[t.Password=$e(13)]="Password",t[t.FileSelect=$e(20)]="FileSelect",t[t.DoNotSpellCheck=$e(22)]="DoNotSpellCheck",t[t.DoNotScroll=$e(23)]="DoNotScroll",t[t.Comb=$e(24)]="Comb",t[t.RichText=$e(25)]="RichText"})(WE=It.AcroTextFlags||(It.AcroTextFlags={}));var LE;(function(t){t[t.Combo=$e(17)]="Combo",t[t.Edit=$e(18)]="Edit",t[t.Sort=$e(19)]="Sort",t[t.MultiSelect=$e(21)]="MultiSelect",t[t.DoNotSpellCheck=$e(22)]="DoNotSpellCheck",t[t.CommitOnSelChange=$e(26)]="CommitOnSelChange"})(LE=It.AcroChoiceFlags||(It.AcroChoiceFlags={}))});var el=D(yh=>{"use strict";Object.defineProperty(yh,"__esModule",{value:!0});var Ia=(k(),R(T)),GE=Ia.__importDefault(xi()),Ci=Ia.__importDefault(kt()),wi=Ia.__importDefault(xr()),$u=Ia.__importDefault(ht()),Pi=Ia.__importDefault(ye()),Dh=_i(),Fy=Ee(),HE=(function(t){Ia.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.setValues=function(r){if(this.hasFlag(Dh.AcroChoiceFlags.Combo)&&!this.hasFlag(Dh.AcroChoiceFlags.Edit)&&!this.valuesAreValid(r))throw new Fy.InvalidAcroFieldValueError;if(r.length===0&&this.dict.delete(Pi.default.of("V")),r.length===1&&this.dict.set(Pi.default.of("V"),r[0]),r.length>1){if(!this.hasFlag(Dh.AcroChoiceFlags.MultiSelect))throw new Fy.MultiSelectValueError;this.dict.set(Pi.default.of("V"),this.dict.context.obj(r))}this.updateSelectedIndices(r)},e.prototype.valuesAreValid=function(r){for(var n=this.getOptions(),i=function(l,u){var c=r[l].decodeText();if(!n.find(function(f){return c===(f.display||f.value).decodeText()}))return{value:!1}},a=0,o=r.length;a<o;a++){var s=i(a,o);if(typeof s=="object")return s.value}return!0},e.prototype.updateSelectedIndices=function(r){if(r.length>1){for(var n=new Array(r.length),i=this.getOptions(),a=function(l,u){var c=r[l].decodeText();n[l]=i.findIndex(function(f){return c===(f.display||f.value).decodeText()})},o=0,s=r.length;o<s;o++)a(o,s);this.dict.set(Pi.default.of("I"),this.dict.context.obj(n.sort()))}else this.dict.delete(Pi.default.of("I"))},e.prototype.getValues=function(){var r=this.V();if(r instanceof wi.default||r instanceof Ci.default)return[r];if(r instanceof $u.default){for(var n=[],i=0,a=r.size();i<a;i++){var o=r.lookup(i);(o instanceof wi.default||o instanceof Ci.default)&&n.push(o)}return n}return[]},e.prototype.Opt=function(){return this.dict.lookupMaybe(Pi.default.of("Opt"),wi.default,Ci.default,$u.default)},e.prototype.setOptions=function(r){for(var n=new Array(r.length),i=0,a=r.length;i<a;i++){var o=r[i],s=o.value,l=o.display;n[i]=this.dict.context.obj([s,l||s])}this.dict.set(Pi.default.of("Opt"),this.dict.context.obj(n))},e.prototype.getOptions=function(){var r=this.Opt();if(r instanceof wi.default||r instanceof Ci.default)return[{value:r,display:r}];if(r instanceof $u.default){for(var n=[],i=0,a=r.size();i<a;i++){var o=r.lookup(i);if((o instanceof wi.default||o instanceof Ci.default)&&n.push({value:o,display:o}),o instanceof $u.default&&o.size()>0){var s=o.lookup(0,wi.default,Ci.default),l=o.lookupMaybe(1,wi.default,Ci.default);n.push({value:s,display:l||s})}}return n}return[]},e})(GE.default);yh.default=HE});var bh=D(Fh=>{"use strict";Object.defineProperty(Fh,"__esModule",{value:!0});var by=(k(),R(T)),KE=by.__importDefault(el()),XE=_i(),ZE=(function(t){by.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.fromDict=function(r,n){return new e(r,n)},e.create=function(r){var n=r.obj({FT:"Ch",Ff:XE.AcroChoiceFlags.Combo,Kids:[]}),i=r.register(n);return new e(n,i)},e})(KE.default);Fh.default=ZE});var tl=D(_h=>{"use strict";Object.defineProperty(_h,"__esModule",{value:!0});var xh=(k(),R(T)),YE=xh.__importDefault(ye()),JE=xh.__importDefault(Ju()),QE=(function(t){xh.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.addField=function(r){var n=this.normalizedEntries().Kids;n?.push(r)},e.prototype.normalizedEntries=function(){var r=this.Kids();return r||(r=this.dict.context.obj([]),this.dict.set(YE.default.of("Kids"),r)),{Kids:r}},e.fromDict=function(r,n){return new e(r,n)},e.create=function(r){var n=r.obj({}),i=r.register(n);return new e(n,i)},e})(JE.default);_h.default=QE});var wh=D(Ch=>{"use strict";Object.defineProperty(Ch,"__esModule",{value:!0});var xy=(k(),R(T)),$E=xy.__importDefault(xi()),eS=(function(t){xy.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.fromDict=function(r,n){return new e(r,n)},e})($E.default);Ch.default=eS});var Eh=D(Ph=>{"use strict";Object.defineProperty(Ph,"__esModule",{value:!0});var qa=(k(),R(T)),rl=qa.__importDefault(Xe()),tS=qa.__importDefault(xr()),rS=qa.__importDefault(kt()),Ei=qa.__importDefault(ye()),nS=qa.__importDefault(xi()),iS=(function(t){qa.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.MaxLen=function(){var r=this.dict.lookup(Ei.default.of("MaxLen"));if(r instanceof rl.default)return r},e.prototype.Q=function(){var r=this.dict.lookup(Ei.default.of("Q"));if(r instanceof rl.default)return r},e.prototype.setMaxLength=function(r){this.dict.set(Ei.default.of("MaxLen"),rl.default.of(r))},e.prototype.removeMaxLength=function(){this.dict.delete(Ei.default.of("MaxLen"))},e.prototype.getMaxLength=function(){var r;return(r=this.MaxLen())===null||r===void 0?void 0:r.asNumber()},e.prototype.setQuadding=function(r){this.dict.set(Ei.default.of("Q"),rl.default.of(r))},e.prototype.getQuadding=function(){var r;return(r=this.Q())===null||r===void 0?void 0:r.asNumber()},e.prototype.setValue=function(r){this.dict.set(Ei.default.of("V"),r)},e.prototype.removeValue=function(){this.dict.delete(Ei.default.of("V"))},e.prototype.getValue=function(){var r=this.V();if(r instanceof tS.default||r instanceof rS.default)return r},e.fromDict=function(r,n){return new e(r,n)},e.create=function(r){var n=r.obj({FT:"Tx",Kids:[]}),i=r.register(n);return new e(n,i)},e})(nS.default);Ph.default=iS});var Oh=D(Sh=>{"use strict";Object.defineProperty(Sh,"__esModule",{value:!0});var _y=(k(),R(T)),aS=_y.__importDefault(us()),oS=_i(),sS=(function(t){_y.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.fromDict=function(r,n){return new e(r,n)},e.create=function(r){var n=r.obj({FT:"Btn",Ff:oS.AcroButtonFlags.PushButton,Kids:[]}),i=r.register(n);return new e(n,i)},e})(aS.default);Sh.default=sS});var kh=D(Th=>{"use strict";Object.defineProperty(Th,"__esModule",{value:!0});var Ah=(k(),R(T)),ls=Ah.__importDefault(ye()),uS=Ah.__importDefault(us()),lS=_i(),cS=Ee(),fS=(function(t){Ah.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.setValue=function(r){var n=this.getOnValues();if(!n.includes(r)&&r!==ls.default.of("Off"))throw new cS.InvalidAcroFieldValueError;this.dict.set(ls.default.of("V"),r);for(var i=this.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a],l=s.getOnValue()===r?r:ls.default.of("Off");s.setAppearanceState(l)}},e.prototype.getValue=function(){var r=this.V();return r instanceof ls.default?r:ls.default.of("Off")},e.prototype.getOnValues=function(){for(var r=this.getWidgets(),n=[],i=0,a=r.length;i<a;i++){var o=r[i].getOnValue();o&&n.push(o)}return n},e.fromDict=function(r,n){return new e(r,n)},e.create=function(r){var n=r.obj({FT:"Btn",Ff:lS.AcroButtonFlags.Radio,Kids:[]}),i=r.register(n);return new e(n,i)},e})(uS.default);Th.default=fS});var Bh=D(Rh=>{"use strict";Object.defineProperty(Rh,"__esModule",{value:!0});var Cy=(k(),R(T)),dS=Cy.__importDefault(el()),hS=(function(t){Cy.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.fromDict=function(r,n){return new e(r,n)},e.create=function(r){var n=r.obj({FT:"Ch",Kids:[]}),i=r.register(n);return new e(n,i)},e})(dS.default);Rh.default=hS});var Mh=D(Si=>{"use strict";Object.defineProperty(Si,"__esModule",{value:!0});Si.createPDFAcroField=Si.createPDFAcroFields=void 0;var qt=(k(),R(T)),wy=qt.__importDefault(Xe()),qh=qt.__importDefault(Dt()),Cr=qt.__importDefault(ye()),pS=qt.__importDefault(ht()),vS=qt.__importDefault(Pt()),mS=qt.__importDefault(xi()),gS=qt.__importDefault(tl()),DS=qt.__importDefault(wh()),yS=qt.__importDefault(Eh()),FS=qt.__importDefault(Oh()),bS=qt.__importDefault(kh()),xS=qt.__importDefault(gh()),_S=qt.__importDefault(bh()),CS=qt.__importDefault(Bh()),Nh=_i();Si.createPDFAcroFields=function(t){if(!t)return[];for(var e=[],r=0,n=t.size();r<n;r++){var i=t.get(r),a=t.lookup(r);i instanceof vS.default&&a instanceof qh.default&&e.push([Si.createPDFAcroField(a,i),i])}return e};Si.createPDFAcroField=function(t,e){var r=wS(t);return r?gS.default.fromDict(t,e):PS(t,e)};var wS=function(t){var e=t.lookup(Cr.default.of("Kids"));if(e instanceof pS.default)for(var r=0,n=e.size();r<n;r++){var i=e.lookup(r),a=i instanceof qh.default&&i.has(Cr.default.of("T"));if(a)return!0}return!1},PS=function(t,e){var r=jh(t,Cr.default.of("FT")),n=t.context.lookup(r,Cr.default);return n===Cr.default.of("Btn")?ES(t,e):n===Cr.default.of("Ch")?SS(t,e):n===Cr.default.of("Tx")?yS.default.fromDict(t,e):n===Cr.default.of("Sig")?DS.default.fromDict(t,e):mS.default.fromDict(t,e)},ES=function(t,e){var r,n=jh(t,Cr.default.of("Ff")),i=t.context.lookupMaybe(n,wy.default),a=(r=i?.asNumber())!==null&&r!==void 0?r:0;return Ih(a,Nh.AcroButtonFlags.PushButton)?FS.default.fromDict(t,e):Ih(a,Nh.AcroButtonFlags.Radio)?bS.default.fromDict(t,e):xS.default.fromDict(t,e)},SS=function(t,e){var r,n=jh(t,Cr.default.of("Ff")),i=t.context.lookupMaybe(n,wy.default),a=(r=i?.asNumber())!==null&&r!==void 0?r:0;return Ih(a,Nh.AcroChoiceFlags.Combo)?_S.default.fromDict(t,e):CS.default.fromDict(t,e)},Ih=function(t,e){return(t&e)!==0},jh=function(t,e){var r;return Py(t,function(n){r||(r=n.get(e))}),r},Py=function(t,e){e(t);var r=t.lookupMaybe(Cr.default.of("Parent"),qh.default);r&&Py(r,e)}});var Oy=D(Uh=>{"use strict";Object.defineProperty(Uh,"__esModule",{value:!0});var nl=(k(),R(T)),OS=nl.__importDefault(Dt()),AS=nl.__importDefault(ht()),Ey=nl.__importDefault(ye()),TS=nl.__importDefault(tl()),Sy=Mh(),kS=(function(){function t(e){this.dict=e}return t.prototype.Fields=function(){var e=this.dict.lookup(Ey.default.of("Fields"));if(e instanceof AS.default)return e},t.prototype.getFields=function(){for(var e=this.normalizedEntries().Fields,r=new Array(e.size()),n=0,i=e.size();n<i;n++){var a=e.get(n),o=e.lookup(n,OS.default);r[n]=[Sy.createPDFAcroField(o,a),a]}return r},t.prototype.getAllFields=function(){var e=[],r=function(n){if(n)for(var i=0,a=n.length;i<a;i++){var o=n[i];e.push(o);var s=o[0];s instanceof TS.default&&r(Sy.createPDFAcroFields(s.Kids()))}};return r(this.getFields()),e},t.prototype.addField=function(e){var r=this.normalizedEntries().Fields;r?.push(e)},t.prototype.removeField=function(e){var r=e.getParent(),n=r===void 0?this.normalizedEntries().Fields:r.Kids(),i=n?.indexOf(e.ref);if(n===void 0||i===void 0)throw new Error("Tried to remove inexistent field "+e.getFullyQualifiedName());n.remove(i),r!==void 0&&n.size()===0&&this.removeField(r)},t.prototype.normalizedEntries=function(){var e=this.Fields();return e||(e=this.dict.context.obj([]),this.dict.set(Ey.default.of("Fields"),e)),{Fields:e}},t.fromDict=function(e){return new t(e)},t.create=function(e){var r=e.obj({Fields:[]});return new t(r)},t})();Uh.default=kS});var Vh=D(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});var Ay=(k(),R(T)),RS=us();Object.defineProperty(pt,"PDFAcroButton",{enumerable:!0,get:function(){return RS.default}});var BS=gh();Object.defineProperty(pt,"PDFAcroCheckBox",{enumerable:!0,get:function(){return BS.default}});var NS=el();Object.defineProperty(pt,"PDFAcroChoice",{enumerable:!0,get:function(){return NS.default}});var IS=bh();Object.defineProperty(pt,"PDFAcroComboBox",{enumerable:!0,get:function(){return IS.default}});var qS=Ju();Object.defineProperty(pt,"PDFAcroField",{enumerable:!0,get:function(){return qS.default}});var jS=Oy();Object.defineProperty(pt,"PDFAcroForm",{enumerable:!0,get:function(){return jS.default}});var MS=Bh();Object.defineProperty(pt,"PDFAcroListBox",{enumerable:!0,get:function(){return MS.default}});var US=tl();Object.defineProperty(pt,"PDFAcroNonTerminal",{enumerable:!0,get:function(){return US.default}});var VS=Oh();Object.defineProperty(pt,"PDFAcroPushButton",{enumerable:!0,get:function(){return VS.default}});var zS=kh();Object.defineProperty(pt,"PDFAcroRadioButton",{enumerable:!0,get:function(){return zS.default}});var WS=wh();Object.defineProperty(pt,"PDFAcroSignature",{enumerable:!0,get:function(){return WS.default}});var LS=xi();Object.defineProperty(pt,"PDFAcroTerminal",{enumerable:!0,get:function(){return LS.default}});var GS=Eh();Object.defineProperty(pt,"PDFAcroText",{enumerable:!0,get:function(){return GS.default}});Ay.__exportStar(_i(),pt);Ay.__exportStar(Mh(),pt)});var Wh=D(zh=>{"use strict";Object.defineProperty(zh,"__esModule",{value:!0});var al=(k(),R(T)),il=al.__importDefault(Dt()),Dn=al.__importDefault(ye()),Ty=Vh(),ky=al.__importDefault(Zd()),HS=(function(t){al.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.Pages=function(){return this.lookup(Dn.default.of("Pages"),il.default)},e.prototype.AcroForm=function(){return this.lookupMaybe(Dn.default.of("AcroForm"),il.default)},e.prototype.getAcroForm=function(){var r=this.AcroForm();if(r)return Ty.PDFAcroForm.fromDict(r)},e.prototype.getOrCreateAcroForm=function(){var r=this.getAcroForm();if(!r){r=Ty.PDFAcroForm.create(this.context);var n=this.context.register(r.dict);this.set(Dn.default.of("AcroForm"),n)}return r},e.prototype.ViewerPreferences=function(){return this.lookupMaybe(Dn.default.of("ViewerPreferences"),il.default)},e.prototype.getViewerPreferences=function(){var r=this.ViewerPreferences();if(r)return ky.default.fromDict(r)},e.prototype.getOrCreateViewerPreferences=function(){var r=this.getViewerPreferences();if(!r){r=ky.default.create(this.context);var n=this.context.register(r.dict);this.set(Dn.default.of("ViewerPreferences"),n)}return r},e.prototype.insertLeafNode=function(r,n){var i=this.get(Dn.default.of("Pages")),a=this.Pages().insertLeafNode(r,n);return a||i},e.prototype.removeLeafNode=function(r){this.Pages().removeLeafNode(r)},e.withContextAndPages=function(r,n){var i=new Map;return i.set(Dn.default.of("Type"),Dn.default.of("Catalog")),i.set(Dn.default.of("Pages"),n),new e(i,r)},e.fromMapWithContext=function(r,n){return new e(r,n)},e})(il.default);zh.default=HS});var Kh=D(Hh=>{"use strict";Object.defineProperty(Hh,"__esModule",{value:!0});var ja=(k(),R(T)),KS=ja.__importDefault(ht()),XS=ja.__importDefault(Dt()),Hr=ja.__importDefault(ye()),Lh=ja.__importDefault(Xe()),Gh=ja.__importDefault(es()),ol=Ee(),ZS=(function(t){ja.__extends(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.Parent=function(){return this.lookup(Hr.default.of("Parent"))},e.prototype.Kids=function(){return this.lookup(Hr.default.of("Kids"),KS.default)},e.prototype.Count=function(){return this.lookup(Hr.default.of("Count"),Lh.default)},e.prototype.pushTreeNode=function(r){var n=this.Kids();n.push(r)},e.prototype.pushLeafNode=function(r){var n=this.Kids();this.insertLeafKid(n.size(),r)},e.prototype.insertLeafNode=function(r,n){var i=this.Kids(),a=this.Count().asNumber();if(n>a)throw new ol.InvalidTargetIndexError(n,a);for(var o=n,s=0,l=i.size();s<l;s++){if(o===0){this.insertLeafKid(s,r);return}var u=i.get(s),c=this.context.lookup(u);if(c instanceof e){if(c.Count().asNumber()>o)return c.insertLeafNode(r,o)||u;o-=c.Count().asNumber()}c instanceof Gh.default&&(o-=1)}if(o===0){this.insertLeafKid(i.size(),r);return}throw new ol.CorruptPageTreeError(n,"insertLeafNode")},e.prototype.removeLeafNode=function(r,n){n===void 0&&(n=!0);var i=this.Kids(),a=this.Count().asNumber();if(r>=a)throw new ol.InvalidTargetIndexError(r,a);for(var o=r,s=0,l=i.size();s<l;s++){var u=i.get(s),c=this.context.lookup(u);if(c instanceof e)if(c.Count().asNumber()>o){c.removeLeafNode(o,n),n&&c.Kids().size()===0&&i.remove(s);return}else o-=c.Count().asNumber();if(c instanceof Gh.default)if(o===0){this.removeKid(s);return}else o-=1}throw new ol.CorruptPageTreeError(r,"removeLeafNode")},e.prototype.ascend=function(r){r(this);var n=this.Parent();n&&n.ascend(r)},e.prototype.traverse=function(r){for(var n=this.Kids(),i=0,a=n.size();i<a;i++){var o=n.get(i),s=this.context.lookup(o);s instanceof e&&s.traverse(r),r(s,o)}},e.prototype.insertLeafKid=function(r,n){var i=this.Kids();this.ascend(function(a){var o=a.Count().asNumber()+1;a.set(Hr.default.of("Count"),Lh.default.of(o))}),i.insert(r,n)},e.prototype.removeKid=function(r){var n=this.Kids(),i=n.lookup(r);i instanceof Gh.default&&this.ascend(function(a){var o=a.Count().asNumber()-1;a.set(Hr.default.of("Count"),Lh.default.of(o))}),n.remove(r)},e.withContext=function(r,n){var i=new Map;return i.set(Hr.default.of("Type"),Hr.default.of("Pages")),i.set(Hr.default.of("Kids"),r.obj([])),i.set(Hr.default.of("Count"),r.obj(0)),n&&i.set(Hr.default.of("Parent"),n),new e(i,r)},e.fromMapWithContext=function(r,n){return new e(r,n)},e})(XS.default);Hh.default=ZS});var sl=D(Ne=>{"use strict";Object.defineProperty(Ne,"__esModule",{value:!0});Ne.IsNumeric=Ne.IsNumericPrefix=Ne.IsDigit=void 0;var YS=(k(),R(T)),Xt=YS.__importDefault(Se());Ne.IsDigit=new Uint8Array(256);Ne.IsDigit[Xt.default.Zero]=1;Ne.IsDigit[Xt.default.One]=1;Ne.IsDigit[Xt.default.Two]=1;Ne.IsDigit[Xt.default.Three]=1;Ne.IsDigit[Xt.default.Four]=1;Ne.IsDigit[Xt.default.Five]=1;Ne.IsDigit[Xt.default.Six]=1;Ne.IsDigit[Xt.default.Seven]=1;Ne.IsDigit[Xt.default.Eight]=1;Ne.IsDigit[Xt.default.Nine]=1;Ne.IsNumericPrefix=new Uint8Array(256);Ne.IsNumericPrefix[Xt.default.Period]=1;Ne.IsNumericPrefix[Xt.default.Plus]=1;Ne.IsNumericPrefix[Xt.default.Minus]=1;Ne.IsNumeric=new Uint8Array(256);for(Ma=0,Ry=256;Ma<Ry;Ma++)Ne.IsNumeric[Ma]=Ne.IsDigit[Ma]||Ne.IsNumericPrefix[Ma]?1:0;var Ma,Ry});var qy=D(Yh=>{"use strict";Object.defineProperty(Yh,"__esModule",{value:!0});var JS=(k(),R(T)),By=Ee(),ul=JS.__importDefault(Se()),Xh=sl(),QS=yu(),Zh=ae(),Ny=ul.default.Newline,Iy=ul.default.CarriageReturn,$S=(function(){function t(e,r){r===void 0&&(r=!1),this.bytes=e,this.capNumbers=r}return t.prototype.parseRawInt=function(){for(var e="";!this.bytes.done();){var r=this.bytes.peek();if(!Xh.IsDigit[r])break;e+=Zh.charFromCode(this.bytes.next())}var n=Number(e);if(!e||!isFinite(n))throw new By.NumberParsingError(this.bytes.position(),e);return n},t.prototype.parseRawNumber=function(){for(var e="";!this.bytes.done();){var r=this.bytes.peek();if(!Xh.IsNumeric[r]||(e+=Zh.charFromCode(this.bytes.next()),r===ul.default.Period))break}for(;!this.bytes.done();){var r=this.bytes.peek();if(!Xh.IsDigit[r])break;e+=Zh.charFromCode(this.bytes.next())}var n=Number(e);if(!e||!isFinite(n))throw new By.NumberParsingError(this.bytes.position(),e);if(n>Number.MAX_SAFE_INTEGER)if(this.capNumbers){var i="Parsed number that is too large for some PDF readers: "+e+", 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: "+e+", not capping.";console.warn(i)}return n},t.prototype.skipWhitespace=function(){for(;!this.bytes.done()&&QS.IsWhitespace[this.bytes.peek()];)this.bytes.next()},t.prototype.skipLine=function(){for(;!this.bytes.done();){var e=this.bytes.peek();if(e===Ny||e===Iy)return;this.bytes.next()}},t.prototype.skipComment=function(){if(this.bytes.peek()!==ul.default.Percent)return!1;for(;!this.bytes.done();){var e=this.bytes.peek();if(e===Ny||e===Iy)return!0;this.bytes.next()}return!0},t.prototype.skipWhitespaceAndComments=function(){for(this.skipWhitespace();this.skipComment();)this.skipWhitespace()},t.prototype.matchKeyword=function(e){for(var r=this.bytes.offset(),n=0,i=e.length;n<i;n++)if(this.bytes.done()||this.bytes.next()!==e[n])return this.bytes.moveTo(r),!1;return!0},t})();Yh.default=$S});var cs=D(Jh=>{"use strict";Object.defineProperty(Jh,"__esModule",{value:!0});var eO=(k(),R(T)),tO=Ee(),rO=Wu(),nO=eO.__importDefault(Se()),iO=(function(){function t(e){this.idx=0,this.line=0,this.column=0,this.bytes=e,this.length=this.bytes.length}return t.prototype.moveTo=function(e){this.idx=e},t.prototype.next=function(){var e=this.bytes[this.idx++];return e===nO.default.Newline?(this.line+=1,this.column=0):this.column+=1,e},t.prototype.assertNext=function(e){if(this.peek()!==e)throw new tO.NextByteAssertionError(this.position(),e,this.peek());return this.next()},t.prototype.peek=function(){return this.bytes[this.idx]},t.prototype.peekAhead=function(e){return this.bytes[this.idx+e]},t.prototype.peekAt=function(e){return this.bytes[e]},t.prototype.done=function(){return this.idx>=this.length},t.prototype.offset=function(){return this.idx},t.prototype.slice=function(e,r){return this.bytes.slice(e,r)},t.prototype.position=function(){return{line:this.line,column:this.column,offset:this.idx}},t.of=function(e){return new t(e)},t.fromPDFRawStream=function(e){return t.of(rO.decodePDFRawStream(e).decode())},t})();Jh.default=iO});var Qh=D(cl=>{"use strict";Object.defineProperty(cl,"__esModule",{value:!0});cl.Keywords=void 0;var Un=(k(),R(T)),W=Un.__importDefault(Se()),aO=W.default.Space,fs=W.default.CarriageReturn,ds=W.default.Newline,hs=[W.default.s,W.default.t,W.default.r,W.default.e,W.default.a,W.default.m],ll=[W.default.e,W.default.n,W.default.d,W.default.s,W.default.t,W.default.r,W.default.e,W.default.a,W.default.m];cl.Keywords={header:[W.default.Percent,W.default.P,W.default.D,W.default.F,W.default.Dash],eof:[W.default.Percent,W.default.Percent,W.default.E,W.default.O,W.default.F],obj:[W.default.o,W.default.b,W.default.j],endobj:[W.default.e,W.default.n,W.default.d,W.default.o,W.default.b,W.default.j],xref:[W.default.x,W.default.r,W.default.e,W.default.f],trailer:[W.default.t,W.default.r,W.default.a,W.default.i,W.default.l,W.default.e,W.default.r],startxref:[W.default.s,W.default.t,W.default.a,W.default.r,W.default.t,W.default.x,W.default.r,W.default.e,W.default.f],true:[W.default.t,W.default.r,W.default.u,W.default.e],false:[W.default.f,W.default.a,W.default.l,W.default.s,W.default.e],null:[W.default.n,W.default.u,W.default.l,W.default.l],stream:hs,streamEOF1:Un.__spreadArrays(hs,[aO,fs,ds]),streamEOF2:Un.__spreadArrays(hs,[fs,ds]),streamEOF3:Un.__spreadArrays(hs,[fs]),streamEOF4:Un.__spreadArrays(hs,[ds]),endstream:ll,EOF1endstream:Un.__spreadArrays([fs,ds],ll),EOF2endstream:Un.__spreadArrays([fs],ll),EOF3endstream:Un.__spreadArrays([ds],ll)}});var fl=D(t0=>{"use strict";Object.defineProperty(t0,"__esModule",{value:!0});var vt=(k(),R(T)),$h=Ee(),oO=vt.__importDefault(ht()),jy=vt.__importDefault(Zo()),sO=vt.__importDefault(Dt()),uO=vt.__importDefault(kt()),Ua=vt.__importDefault(ye()),lO=vt.__importDefault(Jo()),My=vt.__importDefault(Xe()),cO=vt.__importDefault(Ca()),fO=vt.__importDefault(Pt()),dO=vt.__importDefault(xr()),hO=vt.__importDefault(qy()),pO=vt.__importDefault(cs()),vO=vt.__importDefault(Wh()),mO=vt.__importDefault(es()),gO=vt.__importDefault(Kh()),Ie=vt.__importDefault(Se()),DO=Lf(),jt=Qh(),Uy=sl(),yO=yu(),e0=ae(),FO=(function(t){vt.__extends(e,t);function e(r,n,i){i===void 0&&(i=!1);var a=t.call(this,r,i)||this;return a.context=n,a}return e.prototype.parseObject=function(){if(this.skipWhitespaceAndComments(),this.matchKeyword(jt.Keywords.true))return jy.default.True;if(this.matchKeyword(jt.Keywords.false))return jy.default.False;if(this.matchKeyword(jt.Keywords.null))return lO.default;var r=this.bytes.peek();if(r===Ie.default.LessThan&&this.bytes.peekAhead(1)===Ie.default.LessThan)return this.parseDictOrStream();if(r===Ie.default.LessThan)return this.parseHexString();if(r===Ie.default.LeftParen)return this.parseString();if(r===Ie.default.ForwardSlash)return this.parseName();if(r===Ie.default.LeftSquareBracket)return this.parseArray();if(Uy.IsNumeric[r])return this.parseNumberOrRef();throw new $h.PDFObjectParsingError(this.bytes.position(),r)},e.prototype.parseNumberOrRef=function(){var r=this.parseRawNumber();this.skipWhitespaceAndComments();var n=this.bytes.offset();if(Uy.IsDigit[this.bytes.peek()]){var i=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===Ie.default.R)return this.bytes.assertNext(Ie.default.R),fO.default.of(r,i)}return this.bytes.moveTo(n),My.default.of(r)},e.prototype.parseHexString=function(){var r="";for(this.bytes.assertNext(Ie.default.LessThan);!this.bytes.done()&&this.bytes.peek()!==Ie.default.GreaterThan;)r+=e0.charFromCode(this.bytes.next());return this.bytes.assertNext(Ie.default.GreaterThan),uO.default.of(r)},e.prototype.parseString=function(){for(var r=0,n=!1,i="";!this.bytes.done();){var a=this.bytes.next();if(i+=e0.charFromCode(a),n||(a===Ie.default.LeftParen&&(r+=1),a===Ie.default.RightParen&&(r-=1)),a===Ie.default.BackSlash?n=!n:n&&(n=!1),r===0)return dO.default.of(i.substring(1,i.length-1))}throw new $h.UnbalancedParenthesisError(this.bytes.position())},e.prototype.parseName=function(){this.bytes.assertNext(Ie.default.ForwardSlash);for(var r="";!this.bytes.done();){var n=this.bytes.peek();if(yO.IsWhitespace[n]||DO.IsDelimiter[n])break;r+=e0.charFromCode(n),this.bytes.next()}return Ua.default.of(r)},e.prototype.parseArray=function(){this.bytes.assertNext(Ie.default.LeftSquareBracket),this.skipWhitespaceAndComments();for(var r=oO.default.withContext(this.context);this.bytes.peek()!==Ie.default.RightSquareBracket;){var n=this.parseObject();r.push(n),this.skipWhitespaceAndComments()}return this.bytes.assertNext(Ie.default.RightSquareBracket),r},e.prototype.parseDict=function(){this.bytes.assertNext(Ie.default.LessThan),this.bytes.assertNext(Ie.default.LessThan),this.skipWhitespaceAndComments();for(var r=new Map;!this.bytes.done()&&this.bytes.peek()!==Ie.default.GreaterThan&&this.bytes.peekAhead(1)!==Ie.default.GreaterThan;){var n=this.parseName(),i=this.parseObject();r.set(n,i),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(Ie.default.GreaterThan),this.bytes.assertNext(Ie.default.GreaterThan);var a=r.get(Ua.default.of("Type"));return a===Ua.default.of("Catalog")?vO.default.fromMapWithContext(r,this.context):a===Ua.default.of("Pages")?gO.default.fromMapWithContext(r,this.context):a===Ua.default.of("Page")?mO.default.fromMapWithContext(r,this.context):sO.default.fromMapWithContext(r,this.context)},e.prototype.parseDictOrStream=function(){var r=this.bytes.position(),n=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(jt.Keywords.streamEOF1)&&!this.matchKeyword(jt.Keywords.streamEOF2)&&!this.matchKeyword(jt.Keywords.streamEOF3)&&!this.matchKeyword(jt.Keywords.streamEOF4)&&!this.matchKeyword(jt.Keywords.stream))return n;var i=this.bytes.offset(),a,o=n.get(Ua.default.of("Length"));o instanceof My.default?(a=i+o.asNumber(),this.bytes.moveTo(a),this.skipWhitespaceAndComments(),this.matchKeyword(jt.Keywords.endstream)||(this.bytes.moveTo(i),a=this.findEndOfStreamFallback(r))):a=this.findEndOfStreamFallback(r);var s=this.bytes.slice(i,a);return cO.default.of(n,s)},e.prototype.findEndOfStreamFallback=function(r){for(var n=1,i=this.bytes.offset();!this.bytes.done()&&(i=this.bytes.offset(),this.matchKeyword(jt.Keywords.stream)?n+=1:this.matchKeyword(jt.Keywords.EOF1endstream)||this.matchKeyword(jt.Keywords.EOF2endstream)||this.matchKeyword(jt.Keywords.EOF3endstream)||this.matchKeyword(jt.Keywords.endstream)?n-=1:this.bytes.next(),n!==0););if(n!==0)throw new $h.PDFStreamParsingError(r);return i},e.forBytes=function(r,n,i){return new e(pO.default.of(r),n,i)},e.forByteStream=function(r,n,i){return i===void 0&&(i=!1),new e(r,n,i)},e})(hO.default);t0.default=FO});var n0=D(r0=>{"use strict";Object.defineProperty(r0,"__esModule",{value:!0});var Vn=(k(),R(T)),bO=Ee(),Vy=Vn.__importDefault(ye()),zy=Vn.__importDefault(Xe()),xO=Vn.__importDefault(Pt()),_O=Vn.__importDefault(cs()),CO=Vn.__importDefault(fl()),wO=ae(),PO=(function(t){Vn.__extends(e,t);function e(r,n){var i=t.call(this,_O.default.fromPDFRawStream(r),r.dict.context)||this,a=r.dict;return i.alreadyParsed=!1,i.shouldWaitForTick=n||(function(){return!1}),i.firstOffset=a.lookup(Vy.default.of("First"),zy.default).asNumber(),i.objectCount=a.lookup(Vy.default.of("N"),zy.default).asNumber(),i}return e.prototype.parseIntoContext=function(){return Vn.__awaiter(this,void 0,void 0,function(){var r,n,i,a,o,s,l,u;return Vn.__generator(this,function(c){switch(c.label){case 0:if(this.alreadyParsed)throw new bO.ReparseError("PDFObjectStreamParser","parseIntoContext");this.alreadyParsed=!0,r=this.parseOffsetsAndObjectNumbers(),n=0,i=r.length,c.label=1;case 1:return n<i?(a=r[n],o=a.objectNumber,s=a.offset,this.bytes.moveTo(this.firstOffset+s),l=this.parseObject(),u=xO.default.of(o,0),this.context.assign(u,l),this.shouldWaitForTick()?[4,wO.waitForTick()]:[3,3]):[3,4];case 2:c.sent(),c.label=3;case 3:return n++,[3,1];case 4:return[2]}})})},e.prototype.parseOffsetsAndObjectNumbers=function(){for(var r=[],n=0,i=this.objectCount;n<i;n++){this.skipWhitespaceAndComments();var a=this.parseRawInt();this.skipWhitespaceAndComments();var o=this.parseRawInt();r.push({objectNumber:a,offset:o})}return r},e.forStream=function(r,n){return new e(r,n)},e})(CO.default);r0.default=PO});var a0=D(i0=>{"use strict";Object.defineProperty(i0,"__esModule",{value:!0});var ps=(k(),R(T)),EO=Ee(),Wy=ps.__importDefault(ht()),Oi=ps.__importDefault(ye()),dl=ps.__importDefault(Xe()),SO=ps.__importDefault(Pt()),OO=ps.__importDefault(cs()),AO=(function(){function t(e){this.alreadyParsed=!1,this.dict=e.dict,this.bytes=OO.default.fromPDFRawStream(e),this.context=this.dict.context;var r=this.dict.lookup(Oi.default.of("Size"),dl.default),n=this.dict.lookup(Oi.default.of("Index"));if(n instanceof Wy.default){this.subsections=[];for(var i=0,a=n.size();i<a;i+=2){var o=n.lookup(i+0,dl.default).asNumber(),s=n.lookup(i+1,dl.default).asNumber();this.subsections.push({firstObjectNumber:o,length:s})}}else this.subsections=[{firstObjectNumber:0,length:r.asNumber()}];var l=this.dict.lookup(Oi.default.of("W"),Wy.default);this.byteWidths=[-1,-1,-1];for(var i=0,a=l.size();i<a;i++)this.byteWidths[i]=l.lookup(i,dl.default).asNumber()}return t.prototype.parseIntoContext=function(){if(this.alreadyParsed)throw new EO.ReparseError("PDFXRefStreamParser","parseIntoContext");this.alreadyParsed=!0,this.context.trailerInfo={Root:this.dict.get(Oi.default.of("Root")),Encrypt:this.dict.get(Oi.default.of("Encrypt")),Info:this.dict.get(Oi.default.of("Info")),ID:this.dict.get(Oi.default.of("ID"))};var e=this.parseEntries();return e},t.prototype.parseEntries=function(){for(var e=[],r=this.byteWidths,n=r[0],i=r[1],a=r[2],o=0,s=this.subsections.length;o<s;o++)for(var l=this.subsections[o],u=l.firstObjectNumber,c=l.length,f=0;f<c;f++){for(var d=0,p=0,h=n;p<h;p++)d=d<<8|this.bytes.next();for(var v=0,p=0,h=i;p<h;p++)v=v<<8|this.bytes.next();for(var g=0,p=0,h=a;p<h;p++)g=g<<8|this.bytes.next();n===0&&(d=1);var m=u+f,b={ref:SO.default.of(m,g),offset:v,deleted:d===0,inObjectStream:d===2};e.push(b)}return e},t.forStream=function(e){return new t(e)},t})();i0.default=AO});var Hy=D(o0=>{"use strict";Object.defineProperty(o0,"__esModule",{value:!0});var Ue=(k(),R(T)),TO=Ue.__importDefault(wu()),kO=Ue.__importDefault(ga()),RO=Ue.__importDefault(ts()),vs=Ee(),BO=Ue.__importDefault(Dt()),NO=Ue.__importDefault(Ou()),Kr=Ue.__importDefault(ye()),Ly=Ue.__importDefault(Ca()),hl=Ue.__importDefault(Pt()),IO=Ue.__importDefault(cs()),qO=Ue.__importDefault(fl()),jO=Ue.__importDefault(n0()),MO=Ue.__importDefault(a0()),UO=Ue.__importDefault(fd()),Va=Ue.__importDefault(Se()),Mt=Qh(),Gy=sl(),VO=ae(),zO=(function(t){Ue.__extends(e,t);function e(r,n,i,a){n===void 0&&(n=1/0),i===void 0&&(i=!1),a===void 0&&(a=!1);var o=t.call(this,IO.default.of(r),UO.default.create(),a)||this;return o.alreadyParsed=!1,o.parsedObjects=0,o.shouldWaitForTick=function(){return o.parsedObjects+=1,o.parsedObjects%o.objectsPerTick===0},o.objectsPerTick=n,o.throwOnInvalidObject=i,o}return e.prototype.parseDocument=function(){return Ue.__awaiter(this,void 0,void 0,function(){var r,n;return Ue.__generator(this,function(i){switch(i.label){case 0:if(this.alreadyParsed)throw new vs.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 vs.StalledParserError(this.bytes.position());return r=n,[3,1];case 3:return this.maybeRecoverRoot(),this.context.lookup(hl.default.of(0))&&(console.warn("Removing parsed object: 0 0 R"),this.context.delete(hl.default.of(0))),[2,this.context]}})})},e.prototype.maybeRecoverRoot=function(){var r=function(c){return c instanceof BO.default&&c.lookup(Kr.default.of("Type"))===Kr.default.of("Catalog")},n=this.context.lookup(this.context.trailerInfo.Root);if(!r(n))for(var i=this.context.enumerateIndirectObjects(),a=0,o=i.length;a<o;a++){var s=i[a],l=s[0],u=s[1];r(u)&&(this.context.trailerInfo.Root=l)}},e.prototype.parseHeader=function(){for(;!this.bytes.done();){if(this.matchKeyword(Mt.Keywords.header)){var r=this.parseRawInt();this.bytes.assertNext(Va.default.Period);var n=this.parseRawInt(),i=kO.default.forVersion(r,n);return this.skipBinaryHeaderComment(),i}this.bytes.next()}throw new vs.MissingPDFHeaderError(this.bytes.position())},e.prototype.parseIndirectObjectHeader=function(){this.skipWhitespaceAndComments();var r=this.parseRawInt();this.skipWhitespaceAndComments();var n=this.parseRawInt();if(this.skipWhitespaceAndComments(),!this.matchKeyword(Mt.Keywords.obj))throw new vs.MissingKeywordError(this.bytes.position(),Mt.Keywords.obj);return hl.default.of(r,n)},e.prototype.matchIndirectObjectHeader=function(){var r=this.bytes.offset();try{return this.parseIndirectObjectHeader(),!0}catch{return this.bytes.moveTo(r),!1}},e.prototype.parseIndirectObject=function(){return Ue.__awaiter(this,void 0,void 0,function(){var r,n;return Ue.__generator(this,function(i){switch(i.label){case 0:return r=this.parseIndirectObjectHeader(),this.skipWhitespaceAndComments(),n=this.parseObject(),this.skipWhitespaceAndComments(),this.matchKeyword(Mt.Keywords.endobj),n instanceof Ly.default&&n.dict.lookup(Kr.default.of("Type"))===Kr.default.of("ObjStm")?[4,jO.default.forStream(n,this.shouldWaitForTick).parseIntoContext()]:[3,2];case 1:return i.sent(),[3,3];case 2:n instanceof Ly.default&&n.dict.lookup(Kr.default.of("Type"))===Kr.default.of("XRef")?MO.default.forStream(n).parseIntoContext():this.context.assign(r,n),i.label=3;case 3:return[2,r]}})})},e.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 a=this.bytes.offset(),o=!0;!this.bytes.done()&&(this.matchKeyword(Mt.Keywords.endobj)&&(o=!1),!!o);)this.bytes.next();if(o)throw new vs.PDFInvalidObjectParsingError(r);var s=this.bytes.offset()-Mt.Keywords.endobj.length,l=NO.default.of(this.bytes.slice(a,s));return this.context.assign(i,l),i},e.prototype.parseIndirectObjects=function(){return Ue.__awaiter(this,void 0,void 0,function(){var r,n;return Ue.__generator(this,function(i){switch(i.label){case 0:this.skipWhitespaceAndComments(),i.label=1;case 1:if(!(!this.bytes.done()&&Gy.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,VO.waitForTick()]:[3,7];case 6:i.sent(),i.label=7;case 7:return[3,1];case 8:return[2]}})})},e.prototype.maybeParseCrossRefSection=function(){if(this.skipWhitespaceAndComments(),!!this.matchKeyword(Mt.Keywords.xref)){this.skipWhitespaceAndComments();for(var r=-1,n=TO.default.createEmpty();!this.bytes.done()&&Gy.IsDigit[this.bytes.peek()];){var i=this.parseRawInt();this.skipWhitespaceAndComments();var a=this.parseRawInt();this.skipWhitespaceAndComments();var o=this.bytes.peek();if(o===Va.default.n||o===Va.default.f){var s=hl.default.of(r,a);this.bytes.next()===Va.default.n?n.addEntry(s,i):n.addDeletedEntry(s,i),r+=1}else r=i;this.skipWhitespaceAndComments()}return n}},e.prototype.maybeParseTrailerDict=function(){if(this.skipWhitespaceAndComments(),!!this.matchKeyword(Mt.Keywords.trailer)){this.skipWhitespaceAndComments();var r=this.parseDict(),n=this.context;n.trailerInfo={Root:r.get(Kr.default.of("Root"))||n.trailerInfo.Root,Encrypt:r.get(Kr.default.of("Encrypt"))||n.trailerInfo.Encrypt,Info:r.get(Kr.default.of("Info"))||n.trailerInfo.Info,ID:r.get(Kr.default.of("ID"))||n.trailerInfo.ID}}},e.prototype.maybeParseTrailer=function(){if(this.skipWhitespaceAndComments(),!!this.matchKeyword(Mt.Keywords.startxref)){this.skipWhitespaceAndComments();var r=this.parseRawInt();return this.skipWhitespace(),this.matchKeyword(Mt.Keywords.eof),this.skipWhitespaceAndComments(),this.matchKeyword(Mt.Keywords.eof),this.skipWhitespaceAndComments(),RO.default.forLastCrossRefSectionOffset(r)}},e.prototype.parseDocumentSection=function(){return Ue.__awaiter(this,void 0,void 0,function(){return Ue.__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]}})})},e.prototype.skipJibberish=function(){for(this.skipWhitespaceAndComments();!this.bytes.done();){var r=this.bytes.offset(),n=this.bytes.peek(),i=n>=Va.default.Space&&n<=Va.default.Tilde;if(i&&(this.matchKeyword(Mt.Keywords.xref)||this.matchKeyword(Mt.Keywords.trailer)||this.matchKeyword(Mt.Keywords.startxref)||this.matchIndirectObjectHeader())){this.bytes.moveTo(r);break}this.bytes.next()}},e.prototype.skipBinaryHeaderComment=function(){this.skipWhitespaceAndComments();try{var r=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(r)}catch{this.bytes.next(),this.skipWhitespaceAndComments()}},e.forBytesWithOptions=function(r,n,i,a){return new e(r,n,i,a)},e})(qO.default);o0.default=zO});var Ky=D(ms=>{"use strict";Object.defineProperty(ms,"__esModule",{value:!0});ms.AnnotationFlags=void 0;var Xr=function(t){return 1<<t},WO;(function(t){t[t.Invisible=Xr(0)]="Invisible",t[t.Hidden=Xr(1)]="Hidden",t[t.Print=Xr(2)]="Print",t[t.NoZoom=Xr(3)]="NoZoom",t[t.NoRotate=Xr(4)]="NoRotate",t[t.NoView=Xr(5)]="NoView",t[t.ReadOnly=Xr(6)]="ReadOnly",t[t.Locked=Xr(7)]="Locked",t[t.ToggleNoView=Xr(8)]="ToggleNoView",t[t.LockedContents=Xr(9)]="LockedContents"})(WO=ms.AnnotationFlags||(ms.AnnotationFlags={}))});var Xy=D(za=>{"use strict";Object.defineProperty(za,"__esModule",{value:!0});var LO=(k(),R(T)),GO=th();Object.defineProperty(za,"PDFAnnotation",{enumerable:!0,get:function(){return GO.default}});var HO=ch();Object.defineProperty(za,"PDFWidgetAnnotation",{enumerable:!0,get:function(){return HO.default}});var KO=ah();Object.defineProperty(za,"AppearanceCharacteristics",{enumerable:!0,get:function(){return KO.default}});LO.__exportStar(Ky(),za)});var et=D($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});var s0=(k(),R(T));s0.__exportStar(Ee(),$);var XO=Se();Object.defineProperty($,"CharCodes",{enumerable:!0,get:function(){return XO.default}});var ZO=fd();Object.defineProperty($,"PDFContext",{enumerable:!0,get:function(){return ZO.default}});var YO=xD();Object.defineProperty($,"PDFObjectCopier",{enumerable:!0,get:function(){return YO.default}});var JO=bd();Object.defineProperty($,"PDFWriter",{enumerable:!0,get:function(){return JO.default}});var QO=ED();Object.defineProperty($,"PDFStreamWriter",{enumerable:!0,get:function(){return QO.default}});var $O=ga();Object.defineProperty($,"PDFHeader",{enumerable:!0,get:function(){return $O.default}});var eA=ts();Object.defineProperty($,"PDFTrailer",{enumerable:!0,get:function(){return eA.default}});var tA=gd();Object.defineProperty($,"PDFTrailerDict",{enumerable:!0,get:function(){return tA.default}});var rA=wu();Object.defineProperty($,"PDFCrossRefSection",{enumerable:!0,get:function(){return rA.default}});var nA=AD();Object.defineProperty($,"StandardFontEmbedder",{enumerable:!0,get:function(){return nA.default}});var iA=Td();Object.defineProperty($,"CustomFontEmbedder",{enumerable:!0,get:function(){return iA.default}});var aA=ID();Object.defineProperty($,"CustomFontSubsetEmbedder",{enumerable:!0,get:function(){return aA.default}});var Zy=Nd();Object.defineProperty($,"FileEmbedder",{enumerable:!0,get:function(){return Zy.default}});Object.defineProperty($,"AFRelationship",{enumerable:!0,get:function(){return Zy.AFRelationship}});var oA=MD();Object.defineProperty($,"JpegEmbedder",{enumerable:!0,get:function(){return oA.default}});var sA=WD();Object.defineProperty($,"PngEmbedder",{enumerable:!0,get:function(){return sA.default}});var uA=sy();Object.defineProperty($,"PDFPageEmbedder",{enumerable:!0,get:function(){return uA.default}});var gs=Zd();Object.defineProperty($,"ViewerPreferences",{enumerable:!0,get:function(){return gs.default}});Object.defineProperty($,"NonFullScreenPageMode",{enumerable:!0,get:function(){return gs.NonFullScreenPageMode}});Object.defineProperty($,"ReadingDirection",{enumerable:!0,get:function(){return gs.ReadingDirection}});Object.defineProperty($,"PrintScaling",{enumerable:!0,get:function(){return gs.PrintScaling}});Object.defineProperty($,"Duplex",{enumerable:!0,get:function(){return gs.Duplex}});var lA=wt();Object.defineProperty($,"PDFObject",{enumerable:!0,get:function(){return lA.default}});var cA=Zo();Object.defineProperty($,"PDFBool",{enumerable:!0,get:function(){return cA.default}});var fA=Xe();Object.defineProperty($,"PDFNumber",{enumerable:!0,get:function(){return fA.default}});var dA=xr();Object.defineProperty($,"PDFString",{enumerable:!0,get:function(){return dA.default}});var hA=kt();Object.defineProperty($,"PDFHexString",{enumerable:!0,get:function(){return hA.default}});var pA=ye();Object.defineProperty($,"PDFName",{enumerable:!0,get:function(){return pA.default}});var vA=Jo();Object.defineProperty($,"PDFNull",{enumerable:!0,get:function(){return vA.default}});var mA=ht();Object.defineProperty($,"PDFArray",{enumerable:!0,get:function(){return mA.default}});var gA=Dt();Object.defineProperty($,"PDFDict",{enumerable:!0,get:function(){return gA.default}});var DA=Pt();Object.defineProperty($,"PDFRef",{enumerable:!0,get:function(){return DA.default}});var yA=Ou();Object.defineProperty($,"PDFInvalidObject",{enumerable:!0,get:function(){return yA.default}});var FA=pn();Object.defineProperty($,"PDFStream",{enumerable:!0,get:function(){return FA.default}});var bA=Ca();Object.defineProperty($,"PDFRawStream",{enumerable:!0,get:function(){return bA.default}});var xA=Wh();Object.defineProperty($,"PDFCatalog",{enumerable:!0,get:function(){return xA.default}});var _A=_u();Object.defineProperty($,"PDFContentStream",{enumerable:!0,get:function(){return _A.default}});var CA=_d();Object.defineProperty($,"PDFCrossRefStream",{enumerable:!0,get:function(){return CA.default}});var wA=Eu();Object.defineProperty($,"PDFObjectStream",{enumerable:!0,get:function(){return wA.default}});var PA=Kh();Object.defineProperty($,"PDFPageTree",{enumerable:!0,get:function(){return PA.default}});var EA=es();Object.defineProperty($,"PDFPageLeaf",{enumerable:!0,get:function(){return EA.default}});var SA=$o();Object.defineProperty($,"PDFFlateStream",{enumerable:!0,get:function(){return SA.default}});var OA=td();Object.defineProperty($,"PDFOperator",{enumerable:!0,get:function(){return OA.default}});var AA=id();Object.defineProperty($,"PDFOperatorNames",{enumerable:!0,get:function(){return AA.default}});var TA=fl();Object.defineProperty($,"PDFObjectParser",{enumerable:!0,get:function(){return TA.default}});var kA=n0();Object.defineProperty($,"PDFObjectStreamParser",{enumerable:!0,get:function(){return kA.default}});var RA=Hy();Object.defineProperty($,"PDFParser",{enumerable:!0,get:function(){return RA.default}});var BA=a0();Object.defineProperty($,"PDFXRefStreamParser",{enumerable:!0,get:function(){return BA.default}});var NA=Wu();Object.defineProperty($,"decodePDFRawStream",{enumerable:!0,get:function(){return NA.decodePDFRawStream}});s0.__exportStar(Xy(),$);s0.__exportStar(Vh(),$)});var pl=D(zn=>{"use strict";Object.defineProperty(zn,"__esModule",{value:!0});zn.asNumber=zn.asPDFNumber=zn.asPDFName=void 0;var Ds=et();zn.asPDFName=function(t){return t instanceof Ds.PDFName?t:Ds.PDFName.of(t)};zn.asPDFNumber=function(t){return t instanceof Ds.PDFNumber?t:Ds.PDFNumber.of(t)};zn.asNumber=function(t){return t instanceof Ds.PDFNumber?t.asNumber():t}});var Zt=D(Ae=>{"use strict";Object.defineProperty(Ae,"__esModule",{value:!0});Ae.rotateRectangle=Ae.adjustDimsForRotation=Ae.reduceRotation=Ae.toDegrees=Ae.toRadians=Ae.radiansToDegrees=Ae.degreesToRadians=Ae.degrees=Ae.radians=Ae.RotationTypes=void 0;var vl=ae(),ys;(function(t){t.Degrees="degrees",t.Radians="radians"})(ys=Ae.RotationTypes||(Ae.RotationTypes={}));Ae.radians=function(t){return vl.assertIs(t,"radianAngle",["number"]),{type:ys.Radians,angle:t}};Ae.degrees=function(t){return vl.assertIs(t,"degreeAngle",["number"]),{type:ys.Degrees,angle:t}};var Yy=ys.Radians,Jy=ys.Degrees;Ae.degreesToRadians=function(t){return t*Math.PI/180};Ae.radiansToDegrees=function(t){return t*180/Math.PI};Ae.toRadians=function(t){return t.type===Yy?t.angle:t.type===Jy?Ae.degreesToRadians(t.angle):vl.error("Invalid rotation: "+JSON.stringify(t))};Ae.toDegrees=function(t){return t.type===Yy?Ae.radiansToDegrees(t.angle):t.type===Jy?t.angle:vl.error("Invalid rotation: "+JSON.stringify(t))};Ae.reduceRotation=function(t){t===void 0&&(t=0);var e=t/90%4;return e===0?0:e===1?90:e===2?180:e===3?270:0};Ae.adjustDimsForRotation=function(t,e){e===void 0&&(e=0);var r=Ae.reduceRotation(e);return r===90||r===270?{width:t.height,height:t.width}:{width:t.width,height:t.height}};Ae.rotateRectangle=function(t,e,r){e===void 0&&(e=0),r===void 0&&(r=0);var n=t.x,i=t.y,a=t.width,o=t.height,s=Ae.reduceRotation(r),l=e/2;return s===0?{x:n-l,y:i-l,width:a,height:o}:s===90?{x:n-o+l,y:i-l,width:o,height:a}:s===180?{x:n-a+l,y:i-o+l,width:a,height:o}:s===270?{x:n-l,y:i-a+l,width:o,height:a}:{x:n-l,y:i-l,width:a,height:o}}});var Wn=D(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 j=pl(),Wa=Zt(),I=et();E.clip=function(){return I.PDFOperator.of(I.PDFOperatorNames.ClipNonZero)};E.clipEvenOdd=function(){return I.PDFOperator.of(I.PDFOperatorNames.ClipEvenOdd)};var ml=Math.cos,gl=Math.sin,Dl=Math.tan;E.concatTransformationMatrix=function(t,e,r,n,i,a){return I.PDFOperator.of(I.PDFOperatorNames.ConcatTransformationMatrix,[j.asPDFNumber(t),j.asPDFNumber(e),j.asPDFNumber(r),j.asPDFNumber(n),j.asPDFNumber(i),j.asPDFNumber(a)])};E.translate=function(t,e){return E.concatTransformationMatrix(1,0,0,1,t,e)};E.scale=function(t,e){return E.concatTransformationMatrix(t,0,0,e,0,0)};E.rotateRadians=function(t){return E.concatTransformationMatrix(ml(j.asNumber(t)),gl(j.asNumber(t)),-gl(j.asNumber(t)),ml(j.asNumber(t)),0,0)};E.rotateDegrees=function(t){return E.rotateRadians(Wa.degreesToRadians(j.asNumber(t)))};E.skewRadians=function(t,e){return E.concatTransformationMatrix(1,Dl(j.asNumber(t)),Dl(j.asNumber(e)),1,0,0)};E.skewDegrees=function(t,e){return E.skewRadians(Wa.degreesToRadians(j.asNumber(t)),Wa.degreesToRadians(j.asNumber(e)))};E.setDashPattern=function(t,e){return I.PDFOperator.of(I.PDFOperatorNames.SetLineDashPattern,["["+t.map(j.asPDFNumber).join(" ")+"]",j.asPDFNumber(e)])};E.restoreDashPattern=function(){return E.setDashPattern([],0)};var IA;(function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Projecting=2]="Projecting"})(IA=E.LineCapStyle||(E.LineCapStyle={}));E.setLineCap=function(t){return I.PDFOperator.of(I.PDFOperatorNames.SetLineCapStyle,[j.asPDFNumber(t)])};var qA;(function(t){t[t.Miter=0]="Miter",t[t.Round=1]="Round",t[t.Bevel=2]="Bevel"})(qA=E.LineJoinStyle||(E.LineJoinStyle={}));E.setLineJoin=function(t){return I.PDFOperator.of(I.PDFOperatorNames.SetLineJoinStyle,[j.asPDFNumber(t)])};E.setGraphicsState=function(t){return I.PDFOperator.of(I.PDFOperatorNames.SetGraphicsStateParams,[j.asPDFName(t)])};E.pushGraphicsState=function(){return I.PDFOperator.of(I.PDFOperatorNames.PushGraphicsState)};E.popGraphicsState=function(){return I.PDFOperator.of(I.PDFOperatorNames.PopGraphicsState)};E.setLineWidth=function(t){return I.PDFOperator.of(I.PDFOperatorNames.SetLineWidth,[j.asPDFNumber(t)])};E.appendBezierCurve=function(t,e,r,n,i,a){return I.PDFOperator.of(I.PDFOperatorNames.AppendBezierCurve,[j.asPDFNumber(t),j.asPDFNumber(e),j.asPDFNumber(r),j.asPDFNumber(n),j.asPDFNumber(i),j.asPDFNumber(a)])};E.appendQuadraticCurve=function(t,e,r,n){return I.PDFOperator.of(I.PDFOperatorNames.CurveToReplicateInitialPoint,[j.asPDFNumber(t),j.asPDFNumber(e),j.asPDFNumber(r),j.asPDFNumber(n)])};E.closePath=function(){return I.PDFOperator.of(I.PDFOperatorNames.ClosePath)};E.moveTo=function(t,e){return I.PDFOperator.of(I.PDFOperatorNames.MoveTo,[j.asPDFNumber(t),j.asPDFNumber(e)])};E.lineTo=function(t,e){return I.PDFOperator.of(I.PDFOperatorNames.LineTo,[j.asPDFNumber(t),j.asPDFNumber(e)])};E.rectangle=function(t,e,r,n){return I.PDFOperator.of(I.PDFOperatorNames.AppendRectangle,[j.asPDFNumber(t),j.asPDFNumber(e),j.asPDFNumber(r),j.asPDFNumber(n)])};E.square=function(t,e,r){return E.rectangle(t,e,r,r)};E.stroke=function(){return I.PDFOperator.of(I.PDFOperatorNames.StrokePath)};E.fill=function(){return I.PDFOperator.of(I.PDFOperatorNames.FillNonZero)};E.fillAndStroke=function(){return I.PDFOperator.of(I.PDFOperatorNames.FillNonZeroAndStroke)};E.endPath=function(){return I.PDFOperator.of(I.PDFOperatorNames.EndPath)};E.nextLine=function(){return I.PDFOperator.of(I.PDFOperatorNames.NextLine)};E.moveText=function(t,e){return I.PDFOperator.of(I.PDFOperatorNames.MoveText,[j.asPDFNumber(t),j.asPDFNumber(e)])};E.showText=function(t){return I.PDFOperator.of(I.PDFOperatorNames.ShowText,[t])};E.beginText=function(){return I.PDFOperator.of(I.PDFOperatorNames.BeginText)};E.endText=function(){return I.PDFOperator.of(I.PDFOperatorNames.EndText)};E.setFontAndSize=function(t,e){return I.PDFOperator.of(I.PDFOperatorNames.SetFontAndSize,[j.asPDFName(t),j.asPDFNumber(e)])};E.setCharacterSpacing=function(t){return I.PDFOperator.of(I.PDFOperatorNames.SetCharacterSpacing,[j.asPDFNumber(t)])};E.setWordSpacing=function(t){return I.PDFOperator.of(I.PDFOperatorNames.SetWordSpacing,[j.asPDFNumber(t)])};E.setCharacterSqueeze=function(t){return I.PDFOperator.of(I.PDFOperatorNames.SetTextHorizontalScaling,[j.asPDFNumber(t)])};E.setLineHeight=function(t){return I.PDFOperator.of(I.PDFOperatorNames.SetTextLineHeight,[j.asPDFNumber(t)])};E.setTextRise=function(t){return I.PDFOperator.of(I.PDFOperatorNames.SetTextRise,[j.asPDFNumber(t)])};var jA;(function(t){t[t.Fill=0]="Fill",t[t.Outline=1]="Outline",t[t.FillAndOutline=2]="FillAndOutline",t[t.Invisible=3]="Invisible",t[t.FillAndClip=4]="FillAndClip",t[t.OutlineAndClip=5]="OutlineAndClip",t[t.FillAndOutlineAndClip=6]="FillAndOutlineAndClip",t[t.Clip=7]="Clip"})(jA=E.TextRenderingMode||(E.TextRenderingMode={}));E.setTextRenderingMode=function(t){return I.PDFOperator.of(I.PDFOperatorNames.SetTextRenderingMode,[j.asPDFNumber(t)])};E.setTextMatrix=function(t,e,r,n,i,a){return I.PDFOperator.of(I.PDFOperatorNames.SetTextMatrix,[j.asPDFNumber(t),j.asPDFNumber(e),j.asPDFNumber(r),j.asPDFNumber(n),j.asPDFNumber(i),j.asPDFNumber(a)])};E.rotateAndSkewTextRadiansAndTranslate=function(t,e,r,n,i){return E.setTextMatrix(ml(j.asNumber(t)),gl(j.asNumber(t))+Dl(j.asNumber(e)),-gl(j.asNumber(t))+Dl(j.asNumber(r)),ml(j.asNumber(t)),n,i)};E.rotateAndSkewTextDegreesAndTranslate=function(t,e,r,n,i){return E.rotateAndSkewTextRadiansAndTranslate(Wa.degreesToRadians(j.asNumber(t)),Wa.degreesToRadians(j.asNumber(e)),Wa.degreesToRadians(j.asNumber(r)),n,i)};E.drawObject=function(t){return I.PDFOperator.of(I.PDFOperatorNames.DrawObject,[j.asPDFName(t)])};E.setFillingGrayscaleColor=function(t){return I.PDFOperator.of(I.PDFOperatorNames.NonStrokingColorGray,[j.asPDFNumber(t)])};E.setStrokingGrayscaleColor=function(t){return I.PDFOperator.of(I.PDFOperatorNames.StrokingColorGray,[j.asPDFNumber(t)])};E.setFillingRgbColor=function(t,e,r){return I.PDFOperator.of(I.PDFOperatorNames.NonStrokingColorRgb,[j.asPDFNumber(t),j.asPDFNumber(e),j.asPDFNumber(r)])};E.setStrokingRgbColor=function(t,e,r){return I.PDFOperator.of(I.PDFOperatorNames.StrokingColorRgb,[j.asPDFNumber(t),j.asPDFNumber(e),j.asPDFNumber(r)])};E.setFillingCmykColor=function(t,e,r,n){return I.PDFOperator.of(I.PDFOperatorNames.NonStrokingColorCmyk,[j.asPDFNumber(t),j.asPDFNumber(e),j.asPDFNumber(r),j.asPDFNumber(n)])};E.setStrokingCmykColor=function(t,e,r,n){return I.PDFOperator.of(I.PDFOperatorNames.StrokingColorCmyk,[j.asPDFNumber(t),j.asPDFNumber(e),j.asPDFNumber(r),j.asPDFNumber(n)])};E.beginMarkedContent=function(t){return I.PDFOperator.of(I.PDFOperatorNames.BeginMarkedContent,[j.asPDFName(t)])};E.endMarkedContent=function(){return I.PDFOperator.of(I.PDFOperatorNames.EndMarkedContent)}});var ur=D(Ge=>{"use strict";Object.defineProperty(Ge,"__esModule",{value:!0});Ge.colorToComponents=Ge.componentsToColor=Ge.setStrokingColor=Ge.setFillingColor=Ge.cmyk=Ge.rgb=Ge.grayscale=Ge.ColorTypes=void 0;var La=Wn(),wr=ae(),Ai;(function(t){t.Grayscale="Grayscale",t.RGB="RGB",t.CMYK="CMYK"})(Ai=Ge.ColorTypes||(Ge.ColorTypes={}));Ge.grayscale=function(t){return wr.assertRange(t,"gray",0,1),{type:Ai.Grayscale,gray:t}};Ge.rgb=function(t,e,r){return wr.assertRange(t,"red",0,1),wr.assertRange(e,"green",0,1),wr.assertRange(r,"blue",0,1),{type:Ai.RGB,red:t,green:e,blue:r}};Ge.cmyk=function(t,e,r,n){return wr.assertRange(t,"cyan",0,1),wr.assertRange(e,"magenta",0,1),wr.assertRange(r,"yellow",0,1),wr.assertRange(n,"key",0,1),{type:Ai.CMYK,cyan:t,magenta:e,yellow:r,key:n}};var u0=Ai.Grayscale,l0=Ai.RGB,c0=Ai.CMYK;Ge.setFillingColor=function(t){return t.type===u0?La.setFillingGrayscaleColor(t.gray):t.type===l0?La.setFillingRgbColor(t.red,t.green,t.blue):t.type===c0?La.setFillingCmykColor(t.cyan,t.magenta,t.yellow,t.key):wr.error("Invalid color: "+JSON.stringify(t))};Ge.setStrokingColor=function(t){return t.type===u0?La.setStrokingGrayscaleColor(t.gray):t.type===l0?La.setStrokingRgbColor(t.red,t.green,t.blue):t.type===c0?La.setStrokingCmykColor(t.cyan,t.magenta,t.yellow,t.key):wr.error("Invalid color: "+JSON.stringify(t))};Ge.componentsToColor=function(t,e){return e===void 0&&(e=1),t?.length===1?Ge.grayscale(t[0]*e):t?.length===3?Ge.rgb(t[0]*e,t[1]*e,t[2]*e):t?.length===4?Ge.cmyk(t[0]*e,t[1]*e,t[2]*e,t[3]*e):void 0};Ge.colorToComponents=function(t){return t.type===u0?[t.gray]:t.type===l0?[t.red,t.green,t.blue]:t.type===c0?[t.cyan,t.magenta,t.yellow,t.key]:wr.error("Invalid color: "+JSON.stringify(t))}});var tF=D(yl=>{"use strict";Object.defineProperty(yl,"__esModule",{value:!0});yl.svgPathToOperators=void 0;var ot=Wn(),X=0,Z=0,me=0,ge=0,Fs=0,bs=0,Qy=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]]),MA=function(t){for(var e,r=[],n=[],i="",a=!1,o=0,s=0,l=t;s<l.length;s++){var u=l[s];if(Qy.has(u))o=Qy.get(u),e&&(i.length>0&&(n[n.length]=+i),r[r.length]={cmd:e,args:n},n=[],i="",a=!1),e=u;else if([" ",","].includes(u)||u==="-"&&i.length>0&&i[i.length-1]!=="e"||u==="."&&a){if(i.length===0)continue;n.length===o?(r[r.length]={cmd:e,args:n},n=[+i],e==="M"&&(e="L"),e==="m"&&(e="l")):n[n.length]=+i,a=u===".",i=["-","."].includes(u)?u:""}else i+=u,u==="."&&(a=!0)}return i.length>0&&(n.length===o?(r[r.length]={cmd:e,args:n},n=[+i],e==="M"&&(e="L"),e==="m"&&(e="l")):n[n.length]=+i),r[r.length]={cmd:e,args:n},r},UA=function(t){X=Z=me=ge=Fs=bs=0;for(var e=[],r=0;r<t.length;r++){var n=t[r];if(n.cmd&&typeof $y[n.cmd]=="function"){var i=$y[n.cmd](n.args);Array.isArray(i)?e=e.concat(i):e.push(i)}}return e},$y={M:function(t){return X=t[0],Z=t[1],me=ge=null,Fs=X,bs=Z,ot.moveTo(X,Z)},m:function(t){return X+=t[0],Z+=t[1],me=ge=null,Fs=X,bs=Z,ot.moveTo(X,Z)},C:function(t){return X=t[4],Z=t[5],me=t[2],ge=t[3],ot.appendBezierCurve(t[0],t[1],t[2],t[3],t[4],t[5])},c:function(t){var e=ot.appendBezierCurve(t[0]+X,t[1]+Z,t[2]+X,t[3]+Z,t[4]+X,t[5]+Z);return me=X+t[2],ge=Z+t[3],X+=t[4],Z+=t[5],e},S:function(t){(me===null||ge===null)&&(me=X,ge=Z);var e=ot.appendBezierCurve(X-(me-X),Z-(ge-Z),t[0],t[1],t[2],t[3]);return me=t[0],ge=t[1],X=t[2],Z=t[3],e},s:function(t){(me===null||ge===null)&&(me=X,ge=Z);var e=ot.appendBezierCurve(X-(me-X),Z-(ge-Z),X+t[0],Z+t[1],X+t[2],Z+t[3]);return me=X+t[0],ge=Z+t[1],X+=t[2],Z+=t[3],e},Q:function(t){return me=t[0],ge=t[1],X=t[2],Z=t[3],ot.appendQuadraticCurve(t[0],t[1],X,Z)},q:function(t){var e=ot.appendQuadraticCurve(t[0]+X,t[1]+Z,t[2]+X,t[3]+Z);return me=X+t[0],ge=Z+t[1],X+=t[2],Z+=t[3],e},T:function(t){me===null||ge===null?(me=X,ge=Z):(me=X-(me-X),ge=Z-(ge-Z));var e=ot.appendQuadraticCurve(me,ge,t[0],t[1]);return me=X-(me-X),ge=Z-(ge-Z),X=t[0],Z=t[1],e},t:function(t){me===null||ge===null?(me=X,ge=Z):(me=X-(me-X),ge=Z-(ge-Z));var e=ot.appendQuadraticCurve(me,ge,X+t[0],Z+t[1]);return X+=t[0],Z+=t[1],e},A:function(t){var e=eF(X,Z,t);return X=t[5],Z=t[6],e},a:function(t){t[5]+=X,t[6]+=Z;var e=eF(X,Z,t);return X=t[5],Z=t[6],e},L:function(t){return X=t[0],Z=t[1],me=ge=null,ot.lineTo(X,Z)},l:function(t){return X+=t[0],Z+=t[1],me=ge=null,ot.lineTo(X,Z)},H:function(t){return X=t[0],me=ge=null,ot.lineTo(X,Z)},h:function(t){return X+=t[0],me=ge=null,ot.lineTo(X,Z)},V:function(t){return Z=t[0],me=ge=null,ot.lineTo(X,Z)},v:function(t){return Z+=t[0],me=ge=null,ot.lineTo(X,Z)},Z:function(){var t=ot.closePath();return X=Fs,Z=bs,t},z:function(){var t=ot.closePath();return X=Fs,Z=bs,t}},eF=function(t,e,r){for(var n=r[0],i=r[1],a=r[2],o=r[3],s=r[4],l=r[5],u=r[6],c=VA(l,u,n,i,o,s,a,t,e),f=[],d=0,p=c;d<p.length;d++){var h=p[d],v=zA.apply(void 0,h);f.push(ot.appendBezierCurve.apply(void 0,v))}return f},VA=function(t,e,r,n,i,a,o,s,l){var u=o*(Math.PI/180),c=Math.sin(u),f=Math.cos(u);r=Math.abs(r),n=Math.abs(n),me=f*(s-t)*.5+c*(l-e)*.5,ge=f*(l-e)*.5-c*(s-t)*.5;var d=me*me/(r*r)+ge*ge/(n*n);d>1&&(d=Math.sqrt(d),r*=d,n*=d);var p=f/r,h=c/r,v=-c/n,g=f/n,m=p*s+h*l,b=v*s+g*l,w=p*t+h*e,F=v*t+g*e,y=(w-m)*(w-m)+(F-b)*(F-b),C=1/y-.25;C<0&&(C=0);var S=Math.sqrt(C);a===i&&(S=-S);var P=.5*(m+w)-S*(F-b),A=.5*(b+F)+S*(w-m),L=Math.atan2(b-A,m-P),O=Math.atan2(F-A,w-P),q=O-L;q<0&&a===1?q+=2*Math.PI:q>0&&a===0&&(q-=2*Math.PI);for(var H=Math.ceil(Math.abs(q/(Math.PI*.5+.001))),U=[],ne=0;ne<H;ne++){var pe=L+ne*q/H,J=L+(ne+1)*q/H;U[ne]=[P,A,pe,J,r,n,c,f]}return U},zA=function(t,e,r,n,i,a,o,s){var l=s*i,u=-o*a,c=o*i,f=s*a,d=.5*(n-r),p=8/3*Math.sin(d*.5)*Math.sin(d*.5)/Math.sin(d),h=t+Math.cos(r)-p*Math.sin(r),v=e+Math.sin(r)+p*Math.cos(r),g=t+Math.cos(n),m=e+Math.sin(n),b=g+p*Math.sin(n),w=m-p*Math.cos(n),F=[l*h+u*v,c*h+f*v,l*b+u*w,c*b+f*w,l*g+u*m,c*g+f*m];return F};yl.svgPathToOperators=function(t){return UA(MA(t))}});var Ga=D(oe=>{"use strict";Object.defineProperty(oe,"__esModule",{value:!0});oe.drawOptionList=oe.drawTextField=oe.drawTextLines=oe.drawButton=oe.drawRadioButton=oe.drawCheckBox=oe.rotateInPlace=oe.drawCheckMark=oe.drawSvgPath=oe.drawEllipse=oe.drawEllipsePath=oe.drawRectangle=oe.drawLine=oe.drawPage=oe.drawImage=oe.drawLinesOfText=oe.drawText=void 0;var yn=(k(),R(T)),Pr=ur(),x=Wn(),ue=Zt(),WA=tF(),xe=pl();oe.drawText=function(t,e){return[x.pushGraphicsState(),e.graphicsState&&x.setGraphicsState(e.graphicsState),x.beginText(),Pr.setFillingColor(e.color),x.setFontAndSize(e.font,e.size),x.rotateAndSkewTextRadiansAndTranslate(ue.toRadians(e.rotate),ue.toRadians(e.xSkew),ue.toRadians(e.ySkew),e.x,e.y),x.showText(t),x.endText(),x.popGraphicsState()].filter(Boolean)};oe.drawLinesOfText=function(t,e){for(var r=[x.pushGraphicsState(),e.graphicsState&&x.setGraphicsState(e.graphicsState),x.beginText(),Pr.setFillingColor(e.color),x.setFontAndSize(e.font,e.size),x.setLineHeight(e.lineHeight),x.rotateAndSkewTextRadiansAndTranslate(ue.toRadians(e.rotate),ue.toRadians(e.xSkew),ue.toRadians(e.ySkew),e.x,e.y)].filter(Boolean),n=0,i=t.length;n<i;n++)r.push(x.showText(t[n]),x.nextLine());return r.push(x.endText(),x.popGraphicsState()),r};oe.drawImage=function(t,e){return[x.pushGraphicsState(),e.graphicsState&&x.setGraphicsState(e.graphicsState),x.translate(e.x,e.y),x.rotateRadians(ue.toRadians(e.rotate)),x.scale(e.width,e.height),x.skewRadians(ue.toRadians(e.xSkew),ue.toRadians(e.ySkew)),x.drawObject(t),x.popGraphicsState()].filter(Boolean)};oe.drawPage=function(t,e){return[x.pushGraphicsState(),e.graphicsState&&x.setGraphicsState(e.graphicsState),x.translate(e.x,e.y),x.rotateRadians(ue.toRadians(e.rotate)),x.scale(e.xScale,e.yScale),x.skewRadians(ue.toRadians(e.xSkew),ue.toRadians(e.ySkew)),x.drawObject(t),x.popGraphicsState()].filter(Boolean)};oe.drawLine=function(t){var e,r;return[x.pushGraphicsState(),t.graphicsState&&x.setGraphicsState(t.graphicsState),t.color&&Pr.setStrokingColor(t.color),x.setLineWidth(t.thickness),x.setDashPattern((e=t.dashArray)!==null&&e!==void 0?e:[],(r=t.dashPhase)!==null&&r!==void 0?r:0),x.moveTo(t.start.x,t.start.y),t.lineCap&&x.setLineCap(t.lineCap),x.moveTo(t.start.x,t.start.y),x.lineTo(t.end.x,t.end.y),x.stroke(),x.popGraphicsState()].filter(Boolean)};oe.drawRectangle=function(t){var e,r;return[x.pushGraphicsState(),t.graphicsState&&x.setGraphicsState(t.graphicsState),t.color&&Pr.setFillingColor(t.color),t.borderColor&&Pr.setStrokingColor(t.borderColor),x.setLineWidth(t.borderWidth),t.borderLineCap&&x.setLineCap(t.borderLineCap),x.setDashPattern((e=t.borderDashArray)!==null&&e!==void 0?e:[],(r=t.borderDashPhase)!==null&&r!==void 0?r:0),x.translate(t.x,t.y),x.rotateRadians(ue.toRadians(t.rotate)),x.skewRadians(ue.toRadians(t.xSkew),ue.toRadians(t.ySkew)),x.moveTo(0,0),x.lineTo(0,t.height),x.lineTo(t.width,t.height),x.lineTo(t.width,0),x.closePath(),t.color&&t.borderWidth?x.fillAndStroke():t.color?x.fill():t.borderColor?x.stroke():x.closePath(),x.popGraphicsState()].filter(Boolean)};var Fl=4*((Math.sqrt(2)-1)/3);oe.drawEllipsePath=function(t){var e=xe.asNumber(t.x),r=xe.asNumber(t.y),n=xe.asNumber(t.xScale),i=xe.asNumber(t.yScale);e-=n,r-=i;var a=n*Fl,o=i*Fl,s=e+n*2,l=r+i*2,u=e+n,c=r+i;return[x.pushGraphicsState(),x.moveTo(e,c),x.appendBezierCurve(e,c-o,u-a,r,u,r),x.appendBezierCurve(u+a,r,s,c-o,s,c),x.appendBezierCurve(s,c+o,u+a,l,u,l),x.appendBezierCurve(u-a,l,e,c+o,e,c),x.popGraphicsState()]};var LA=function(t){var e=xe.asNumber(t.x),r=xe.asNumber(t.y),n=xe.asNumber(t.xScale),i=xe.asNumber(t.yScale),a=-n,o=-i,s=n*Fl,l=i*Fl,u=a+n*2,c=o+i*2,f=a+n,d=o+i;return[x.translate(e,r),x.rotateRadians(ue.toRadians(t.rotate)),x.moveTo(a,d),x.appendBezierCurve(a,d-l,f-s,o,f,o),x.appendBezierCurve(f+s,o,u,d-l,u,d),x.appendBezierCurve(u,d+l,f+s,c,f,c),x.appendBezierCurve(f-s,c,a,d+l,a,d)]};oe.drawEllipse=function(t){var e,r,n;return yn.__spreadArrays([x.pushGraphicsState(),t.graphicsState&&x.setGraphicsState(t.graphicsState),t.color&&Pr.setFillingColor(t.color),t.borderColor&&Pr.setStrokingColor(t.borderColor),x.setLineWidth(t.borderWidth),t.borderLineCap&&x.setLineCap(t.borderLineCap),x.setDashPattern((e=t.borderDashArray)!==null&&e!==void 0?e:[],(r=t.borderDashPhase)!==null&&r!==void 0?r:0)],t.rotate===void 0?oe.drawEllipsePath({x:t.x,y:t.y,xScale:t.xScale,yScale:t.yScale}):LA({x:t.x,y:t.y,xScale:t.xScale,yScale:t.yScale,rotate:(n=t.rotate)!==null&&n!==void 0?n:ue.degrees(0)}),[t.color&&t.borderWidth?x.fillAndStroke():t.color?x.fill():t.borderColor?x.stroke():x.closePath(),x.popGraphicsState()]).filter(Boolean)};oe.drawSvgPath=function(t,e){var r,n,i;return yn.__spreadArrays([x.pushGraphicsState(),e.graphicsState&&x.setGraphicsState(e.graphicsState),x.translate(e.x,e.y),x.rotateRadians(ue.toRadians((r=e.rotate)!==null&&r!==void 0?r:ue.degrees(0))),e.scale?x.scale(e.scale,-e.scale):x.scale(1,-1),e.color&&Pr.setFillingColor(e.color),e.borderColor&&Pr.setStrokingColor(e.borderColor),e.borderWidth&&x.setLineWidth(e.borderWidth),e.borderLineCap&&x.setLineCap(e.borderLineCap),x.setDashPattern((n=e.borderDashArray)!==null&&n!==void 0?n:[],(i=e.borderDashPhase)!==null&&i!==void 0?i:0)],WA.svgPathToOperators(t),[e.color&&e.borderWidth?x.fillAndStroke():e.color?x.fill():e.borderColor?x.stroke():x.closePath(),x.popGraphicsState()]).filter(Boolean)};oe.drawCheckMark=function(t){var e=xe.asNumber(t.size),r=-1+.75,n=-1+.51,i=1-.525,a=1-.31,o=-1+.325,s=-((o-r)*(a-r))/(i-n)+n;return[x.pushGraphicsState(),t.color&&Pr.setStrokingColor(t.color),x.setLineWidth(t.thickness),x.translate(t.x,t.y),x.moveTo(o*e,s*e),x.lineTo(r*e,n*e),x.lineTo(a*e,i*e),x.stroke(),x.popGraphicsState()].filter(Boolean)};oe.rotateInPlace=function(t){return t.rotation===0?[x.translate(0,0),x.rotateDegrees(0)]:t.rotation===90?[x.translate(t.width,0),x.rotateDegrees(90)]:t.rotation===180?[x.translate(t.width,t.height),x.rotateDegrees(180)]:t.rotation===270?[x.translate(0,t.height),x.rotateDegrees(270)]:[]};oe.drawCheckBox=function(t){var e=oe.drawRectangle({x:t.x,y:t.y,width:t.width,height:t.height,borderWidth:t.borderWidth,color:t.color,borderColor:t.borderColor,rotate:ue.degrees(0),xSkew:ue.degrees(0),ySkew:ue.degrees(0)});if(!t.filled)return e;var r=xe.asNumber(t.width),n=xe.asNumber(t.height),i=Math.min(r,n)/2,a=oe.drawCheckMark({x:r/2,y:n/2,size:i,thickness:t.thickness,color:t.markColor});return yn.__spreadArrays([x.pushGraphicsState()],e,a,[x.popGraphicsState()])};oe.drawRadioButton=function(t){var e=xe.asNumber(t.width),r=xe.asNumber(t.height),n=Math.min(e,r)/2,i=oe.drawEllipse({x:t.x,y:t.y,xScale:n,yScale:n,color:t.color,borderColor:t.borderColor,borderWidth:t.borderWidth});if(!t.filled)return i;var a=oe.drawEllipse({x:t.x,y:t.y,xScale:n*.45,yScale:n*.45,color:t.dotColor,borderColor:void 0,borderWidth:0});return yn.__spreadArrays([x.pushGraphicsState()],i,a,[x.popGraphicsState()])};oe.drawButton=function(t){var e=xe.asNumber(t.x),r=xe.asNumber(t.y),n=xe.asNumber(t.width),i=xe.asNumber(t.height),a=oe.drawRectangle({x:e,y:r,width:n,height:i,borderWidth:t.borderWidth,color:t.color,borderColor:t.borderColor,rotate:ue.degrees(0),xSkew:ue.degrees(0),ySkew:ue.degrees(0)}),o=oe.drawTextLines(t.textLines,{color:t.textColor,font:t.font,size:t.fontSize,rotate:ue.degrees(0),xSkew:ue.degrees(0),ySkew:ue.degrees(0)});return yn.__spreadArrays([x.pushGraphicsState()],a,o,[x.popGraphicsState()])};oe.drawTextLines=function(t,e){for(var r=[x.beginText(),Pr.setFillingColor(e.color),x.setFontAndSize(e.font,e.size)],n=0,i=t.length;n<i;n++){var a=t[n],o=a.encoded,s=a.x,l=a.y;r.push(x.rotateAndSkewTextRadiansAndTranslate(ue.toRadians(e.rotate),ue.toRadians(e.xSkew),ue.toRadians(e.ySkew),s,l),x.showText(o))}return r.push(x.endText()),r};oe.drawTextField=function(t){var e=xe.asNumber(t.x),r=xe.asNumber(t.y),n=xe.asNumber(t.width),i=xe.asNumber(t.height),a=xe.asNumber(t.borderWidth),o=xe.asNumber(t.padding),s=e+a/2+o,l=r+a/2+o,u=n-(a/2+o)*2,c=i-(a/2+o)*2,f=[x.moveTo(s,l),x.lineTo(s,l+c),x.lineTo(s+u,l+c),x.lineTo(s+u,l),x.closePath(),x.clip(),x.endPath()],d=oe.drawRectangle({x:e,y:r,width:n,height:i,borderWidth:t.borderWidth,color:t.color,borderColor:t.borderColor,rotate:ue.degrees(0),xSkew:ue.degrees(0),ySkew:ue.degrees(0)}),p=oe.drawTextLines(t.textLines,{color:t.textColor,font:t.font,size:t.fontSize,rotate:ue.degrees(0),xSkew:ue.degrees(0),ySkew:ue.degrees(0)}),h=yn.__spreadArrays([x.beginMarkedContent("Tx"),x.pushGraphicsState()],p,[x.popGraphicsState(),x.endMarkedContent()]);return yn.__spreadArrays([x.pushGraphicsState()],d,f,h,[x.popGraphicsState()])};oe.drawOptionList=function(t){for(var e=xe.asNumber(t.x),r=xe.asNumber(t.y),n=xe.asNumber(t.width),i=xe.asNumber(t.height),a=xe.asNumber(t.lineHeight),o=xe.asNumber(t.borderWidth),s=xe.asNumber(t.padding),l=e+o/2+s,u=r+o/2+s,c=n-(o/2+s)*2,f=i-(o/2+s)*2,d=[x.moveTo(l,u),x.lineTo(l,u+f),x.lineTo(l+c,u+f),x.lineTo(l+c,u),x.closePath(),x.clip(),x.endPath()],p=oe.drawRectangle({x:e,y:r,width:n,height:i,borderWidth:t.borderWidth,color:t.color,borderColor:t.borderColor,rotate:ue.degrees(0),xSkew:ue.degrees(0),ySkew:ue.degrees(0)}),h=[],v=0,g=t.selectedLines.length;v<g;v++){var m=t.textLines[t.selectedLines[v]];h.push.apply(h,oe.drawRectangle({x:m.x-s,y:m.y-(a-m.height)/2,width:n-o,height:m.height+(a-m.height)/2,borderWidth:0,color:t.selectedColor,borderColor:void 0,rotate:ue.degrees(0),xSkew:ue.degrees(0),ySkew:ue.degrees(0)}))}var b=oe.drawTextLines(t.textLines,{color:t.textColor,font:t.font,size:t.fontSize,rotate:ue.degrees(0),xSkew:ue.degrees(0),ySkew:ue.degrees(0)}),w=yn.__spreadArrays([x.beginMarkedContent("Tx"),x.pushGraphicsState()],b,[x.popGraphicsState(),x.endMarkedContent()]);return yn.__spreadArrays([x.pushGraphicsState()],p,h,d,w,[x.popGraphicsState()])}});var Ha=D(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.InvalidMaxLengthError=_e.ExceededMaxLengthError=_e.CombedTextLayoutError=_e.RichTextFieldReadError=_e.FieldExistsAsNonTerminalError=_e.InvalidFieldNamePartError=_e.FieldAlreadyExistsError=_e.MissingOnValueCheckError=_e.UnexpectedFieldTypeError=_e.NoSuchFieldError=_e.RemovePageFromEmptyDocumentError=_e.ForeignPageError=_e.FontkitNotRegisteredError=_e.EncryptedPDFError=void 0;var Ut=(k(),R(T)),GA=(function(t){Ut.__extends(e,t);function e(){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=t.call(this,n)||this,r}return e})(Error);_e.EncryptedPDFError=GA;var HA=(function(t){Ut.__extends(e,t);function e(){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=t.call(this,n)||this,r}return e})(Error);_e.FontkitNotRegisteredError=HA;var KA=(function(t){Ut.__extends(e,t);function e(){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=t.call(this,n)||this,r}return e})(Error);_e.ForeignPageError=KA;var XA=(function(t){Ut.__extends(e,t);function e(){var r=this,n="PDFDocument has no pages so `PDFDocument.removePage` cannot be called";return r=t.call(this,n)||this,r}return e})(Error);_e.RemovePageFromEmptyDocumentError=XA;var ZA=(function(t){Ut.__extends(e,t);function e(r){var n=this,i='PDFDocument has no form field with the name "'+r+'"';return n=t.call(this,i)||this,n}return e})(Error);_e.NoSuchFieldError=ZA;var YA=(function(t){Ut.__extends(e,t);function e(r,n,i){var a,o,s=this,l=n?.name,u=(o=(a=i?.constructor)===null||a===void 0?void 0:a.name)!==null&&o!==void 0?o:i,c='Expected field "'+r+'" to be of type '+l+", "+("but it is actually of type "+u);return s=t.call(this,c)||this,s}return e})(Error);_e.UnexpectedFieldTypeError=YA;var JA=(function(t){Ut.__extends(e,t);function e(r){var n=this,i='Failed to select check box due to missing onValue: "'+r+'"';return n=t.call(this,i)||this,n}return e})(Error);_e.MissingOnValueCheckError=JA;var QA=(function(t){Ut.__extends(e,t);function e(r){var n=this,i='A field already exists with the specified name: "'+r+'"';return n=t.call(this,i)||this,n}return e})(Error);_e.FieldAlreadyExistsError=QA;var $A=(function(t){Ut.__extends(e,t);function e(r){var n=this,i='Field name contains invalid component: "'+r+'"';return n=t.call(this,i)||this,n}return e})(Error);_e.InvalidFieldNamePartError=$A;var e3=(function(t){Ut.__extends(e,t);function e(r){var n=this,i='A non-terminal field already exists with the specified name: "'+r+'"';return n=t.call(this,i)||this,n}return e})(Error);_e.FieldExistsAsNonTerminalError=e3;var t3=(function(t){Ut.__extends(e,t);function e(r){var n=this,i="Reading rich text fields is not supported: Attempted to read rich text field: "+r;return n=t.call(this,i)||this,n}return e})(Error);_e.RichTextFieldReadError=t3;var r3=(function(t){Ut.__extends(e,t);function e(r,n){var i=this,a="Failed to layout combed text as lineLength="+r+" is greater than cellCount="+n;return i=t.call(this,a)||this,i}return e})(Error);_e.CombedTextLayoutError=r3;var n3=(function(t){Ut.__extends(e,t);function e(r,n,i){var a=this,o="Attempted to set text with length="+r+" for TextField with maxLength="+n+" and name="+i;return a=t.call(this,o)||this,a}return e})(Error);_e.ExceededMaxLengthError=n3;var i3=(function(t){Ut.__extends(e,t);function e(r,n,i){var a=this,o="Attempted to set maxLength="+n+", which is less than "+r+", the length of this field's current value (name="+i+")";return a=t.call(this,o)||this,a}return e})(Error);_e.InvalidMaxLengthError=i3});var _s=D(xs=>{"use strict";Object.defineProperty(xs,"__esModule",{value:!0});xs.TextAlignment=void 0;var a3;(function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right"})(a3=xs.TextAlignment||(xs.TextAlignment={}))});var f0=D(Gn=>{"use strict";Object.defineProperty(Gn,"__esModule",{value:!0});Gn.layoutSinglelineText=Gn.layoutCombedText=Gn.layoutMultilineText=void 0;var o3=Ha(),Ka=_s(),Ln=ae(),rF=4,nF=500,iF=function(t,e,r,n){n===void 0&&(n=!1);for(var i=rF;i<nF;){for(var a=0,o=0,s=t.length;o<s;o++){a+=1;for(var l=t[o],u=l.split(" "),c=r.width,f=0,d=u.length;f<d;f++){var p=f===d-1,h=p?u[f]:u[f]+" ",v=e.widthOfTextAtSize(h,i);c-=v,c<=0&&(a+=1,c=r.width-v)}}if(!n&&a>t.length)return i-1;var g=e.heightAtSize(i),m=g+g*.2,b=m*a;if(b>Math.abs(r.height))return i-1;i+=1}return i},s3=function(t,e,r,n){for(var i=r.width/n,a=r.height,o=rF,s=Ln.charSplit(t);o<nF;){for(var l=0,u=s.length;l<u;l++){var c=s[l],f=e.widthOfTextAtSize(c,o)>i*.75;if(f)return o-1}var d=e.heightAtSize(o,{descender:!1});if(d>a)return o-1;o+=1}return o},u3=function(t){for(var e=t.length;e>0;e--)if(/\s/.test(t[e]))return e},l3=function(t,e,r,n){for(var i,a=t.length;a>0;){var o=t.substring(0,a),s=r.encodeText(o),l=r.widthOfTextAtSize(o,n);if(l<e){var u=t.substring(a)||void 0;return{line:o,encoded:s,width:l,remainder:u}}a=(i=u3(o))!==null&&i!==void 0?i:0}return{line:t,encoded:r.encodeText(t),width:r.widthOfTextAtSize(t,n),remainder:void 0}};Gn.layoutMultilineText=function(t,e){var r=e.alignment,n=e.fontSize,i=e.font,a=e.bounds,o=Ln.lineSplit(Ln.cleanText(t));(n===void 0||n===0)&&(n=iF(o,i,a,!0));for(var s=i.heightAtSize(n),l=s+s*.2,u=[],c=a.x,f=a.y,d=a.x+a.width,p=a.y+a.height,h=a.y+a.height,v=0,g=o.length;v<g;v++)for(var m=o[v];m!==void 0;){var b=l3(m,a.width,i,n),w=b.line,F=b.encoded,y=b.width,C=b.remainder,S=r===Ka.TextAlignment.Left?a.x:r===Ka.TextAlignment.Center?a.x+a.width/2-y/2:r===Ka.TextAlignment.Right?a.x+a.width-y:a.x;h-=l,S<c&&(c=S),h<f&&(f=h),S+y>d&&(d=S+y),h+s>p&&(p=h+s),u.push({text:w,encoded:F,width:y,height:s,x:S,y:h}),m=C?.trim()}return{fontSize:n,lineHeight:l,lines:u,bounds:{x:c,y:f,width:d-c,height:p-f}}};Gn.layoutCombedText=function(t,e){var r=e.fontSize,n=e.font,i=e.bounds,a=e.cellCount,o=Ln.mergeLines(Ln.cleanText(t));if(o.length>a)throw new o3.CombedTextLayoutError(o.length,a);(r===void 0||r===0)&&(r=s3(o,n,i,a));for(var s=i.width/a,l=n.heightAtSize(r,{descender:!1}),u=i.y+(i.height/2-l/2),c=[],f=i.x,d=i.y,p=i.x+i.width,h=i.y+i.height,v=0,g=0;v<a;){var m=Ln.charAtIndex(o,g),b=m[0],w=m[1],F=n.encodeText(b),y=n.widthOfTextAtSize(b,r),C=i.x+(s*v+s/2),S=C-y/2;S<f&&(f=S),u<d&&(d=u),S+y>p&&(p=S+y),u+l>h&&(h=u+l),c.push({text:o,encoded:F,width:y,height:l,x:S,y:u}),v+=1,g+=w}return{fontSize:r,cells:c,bounds:{x:f,y:d,width:p-f,height:h-d}}};Gn.layoutSinglelineText=function(t,e){var r=e.alignment,n=e.fontSize,i=e.font,a=e.bounds,o=Ln.mergeLines(Ln.cleanText(t));(n===void 0||n===0)&&(n=iF([o],i,a));var s=i.encodeText(o),l=i.widthOfTextAtSize(o,n),u=i.heightAtSize(n,{descender:!1}),c=r===Ka.TextAlignment.Left?a.x:r===Ka.TextAlignment.Center?a.x+a.width/2-l/2:r===Ka.TextAlignment.Right?a.x+a.width-l:a.x,f=a.y+(a.height/2-u/2);return{fontSize:n,line:{text:o,encoded:s,width:l,height:u,x:c,y:f},bounds:{x:c,y:f,width:l,height:u}}}});var Kn=D(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});Ft.defaultOptionListAppearanceProvider=Ft.defaultDropdownAppearanceProvider=Ft.defaultTextFieldAppearanceProvider=Ft.defaultButtonAppearanceProvider=Ft.defaultRadioGroupAppearanceProvider=Ft.defaultCheckBoxAppearanceProvider=Ft.normalizeAppearance=void 0;var le=(k(),R(T)),st=Ga(),Te=ur(),lr=Zt(),Ti=f0(),bl=_s(),c3=Wn(),aF=ae();Ft.normalizeAppearance=function(t){return"normal"in t?t:{normal:t}};var f3=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]+(\d*\.\d+|\d+)[\0\t\n\f\r\ ]+Tf/,Hn=function(t){var e,r,n=(e=t.getDefaultAppearance())!==null&&e!==void 0?e:"",i=(r=aF.findLastMatch(n,f3).match)!==null&&r!==void 0?r:[],a=Number(i[2]);return isFinite(a)?a:void 0},d3=/(\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)/,cr=function(t){var e,r=(e=t.getDefaultAppearance())!==null&&e!==void 0?e:"",n=aF.findLastMatch(r,d3).match,i=n??[],a=i[1],o=i[2],s=i[3],l=i[4],u=i[5];if(u==="g"&&a)return Te.grayscale(Number(a));if(u==="rg"&&a&&o&&s)return Te.rgb(Number(a),Number(o),Number(s));if(u==="k"&&a&&o&&s&&l)return Te.cmyk(Number(a),Number(o),Number(s),Number(l))},fr=function(t,e,r,n){var i;n===void 0&&(n=0);var a=[Te.setFillingColor(e).toString(),c3.setFontAndSize((i=r?.name)!==null&&i!==void 0?i:"dummy__noop",n).toString()].join(`
|
|
69
69
|
`);t.setDefaultAppearance(a)};Ft.defaultCheckBoxAppearanceProvider=function(t,e){var r,n,i,a=cr(e),o=cr(t.acroField),s=e.getRectangle(),l=e.getAppearanceCharacteristics(),u=e.getBorderStyle(),c=(r=u?.getWidth())!==null&&r!==void 0?r:0,f=lr.reduceRotation(l?.getRotation()),d=lr.adjustDimsForRotation(s,f),p=d.width,h=d.height,v=st.rotateInPlace(le.__assign(le.__assign({},s),{rotation:f})),g=Te.rgb(0,0,0),m=(n=Te.componentsToColor(l?.getBorderColor()))!==null&&n!==void 0?n:g,b=Te.componentsToColor(l?.getBackgroundColor()),w=Te.componentsToColor(l?.getBackgroundColor(),.8),F=(i=a??o)!==null&&i!==void 0?i:g;fr(a?e:t.acroField,F);var y={x:0+c/2,y:0+c/2,width:p-c,height:h-c,thickness:1.5,borderWidth:c,borderColor:m,markColor:F};return{normal:{on:le.__spreadArrays(v,st.drawCheckBox(le.__assign(le.__assign({},y),{color:b,filled:!0}))),off:le.__spreadArrays(v,st.drawCheckBox(le.__assign(le.__assign({},y),{color:b,filled:!1})))},down:{on:le.__spreadArrays(v,st.drawCheckBox(le.__assign(le.__assign({},y),{color:w,filled:!0}))),off:le.__spreadArrays(v,st.drawCheckBox(le.__assign(le.__assign({},y),{color:w,filled:!1})))}}};Ft.defaultRadioGroupAppearanceProvider=function(t,e){var r,n,i,a=cr(e),o=cr(t.acroField),s=e.getRectangle(),l=e.getAppearanceCharacteristics(),u=e.getBorderStyle(),c=(r=u?.getWidth())!==null&&r!==void 0?r:0,f=lr.reduceRotation(l?.getRotation()),d=lr.adjustDimsForRotation(s,f),p=d.width,h=d.height,v=st.rotateInPlace(le.__assign(le.__assign({},s),{rotation:f})),g=Te.rgb(0,0,0),m=(n=Te.componentsToColor(l?.getBorderColor()))!==null&&n!==void 0?n:g,b=Te.componentsToColor(l?.getBackgroundColor()),w=Te.componentsToColor(l?.getBackgroundColor(),.8),F=(i=a??o)!==null&&i!==void 0?i:g;fr(a?e:t.acroField,F);var y={x:p/2,y:h/2,width:p-c,height:h-c,borderWidth:c,borderColor:m,dotColor:F};return{normal:{on:le.__spreadArrays(v,st.drawRadioButton(le.__assign(le.__assign({},y),{color:b,filled:!0}))),off:le.__spreadArrays(v,st.drawRadioButton(le.__assign(le.__assign({},y),{color:b,filled:!1})))},down:{on:le.__spreadArrays(v,st.drawRadioButton(le.__assign(le.__assign({},y),{color:w,filled:!0}))),off:le.__spreadArrays(v,st.drawRadioButton(le.__assign(le.__assign({},y),{color:w,filled:!1})))}}};Ft.defaultButtonAppearanceProvider=function(t,e,r){var n,i,a,o,s,l=cr(e),u=cr(t.acroField),c=Hn(e),f=Hn(t.acroField),d=e.getRectangle(),p=e.getAppearanceCharacteristics(),h=e.getBorderStyle(),v=p?.getCaptions(),g=(n=v?.normal)!==null&&n!==void 0?n:"",m=(a=(i=v?.down)!==null&&i!==void 0?i:g)!==null&&a!==void 0?a:"",b=(o=h?.getWidth())!==null&&o!==void 0?o:0,w=lr.reduceRotation(p?.getRotation()),F=lr.adjustDimsForRotation(d,w),y=F.width,C=F.height,S=st.rotateInPlace(le.__assign(le.__assign({},d),{rotation:w})),P=Te.rgb(0,0,0),A=Te.componentsToColor(p?.getBorderColor()),L=Te.componentsToColor(p?.getBackgroundColor()),O=Te.componentsToColor(p?.getBackgroundColor(),.8),q={x:b,y:b,width:y-b*2,height:C-b*2},H=Ti.layoutSinglelineText(g,{alignment:bl.TextAlignment.Center,fontSize:c??f,font:r,bounds:q}),U=Ti.layoutSinglelineText(m,{alignment:bl.TextAlignment.Center,fontSize:c??f,font:r,bounds:q}),ne=Math.min(H.fontSize,U.fontSize),pe=(s=l??u)!==null&&s!==void 0?s:P;fr(l||c!==void 0?e:t.acroField,pe,r,ne);var J={x:0+b/2,y:0+b/2,width:y-b,height:C-b,borderWidth:b,borderColor:A,textColor:pe,font:r.name,fontSize:ne};return{normal:le.__spreadArrays(S,st.drawButton(le.__assign(le.__assign({},J),{color:L,textLines:[H.line]}))),down:le.__spreadArrays(S,st.drawButton(le.__assign(le.__assign({},J),{color:O,textLines:[U.line]})))}};Ft.defaultTextFieldAppearanceProvider=function(t,e,r){var n,i,a,o,s=cr(e),l=cr(t.acroField),u=Hn(e),c=Hn(t.acroField),f=e.getRectangle(),d=e.getAppearanceCharacteristics(),p=e.getBorderStyle(),h=(n=t.getText())!==null&&n!==void 0?n:"",v=(i=p?.getWidth())!==null&&i!==void 0?i:0,g=lr.reduceRotation(d?.getRotation()),m=lr.adjustDimsForRotation(f,g),b=m.width,w=m.height,F=st.rotateInPlace(le.__assign(le.__assign({},f),{rotation:g})),y=Te.rgb(0,0,0),C=Te.componentsToColor(d?.getBorderColor()),S=Te.componentsToColor(d?.getBackgroundColor()),P,A,L=t.isCombed()?0:1,O={x:v+L,y:v+L,width:b-(v+L)*2,height:w-(v+L)*2};if(t.isMultiline()){var q=Ti.layoutMultilineText(h,{alignment:t.getAlignment(),fontSize:u??c,font:r,bounds:O});P=q.lines,A=q.fontSize}else if(t.isCombed()){var q=Ti.layoutCombedText(h,{fontSize:u??c,font:r,bounds:O,cellCount:(a=t.getMaxLength())!==null&&a!==void 0?a:0});P=q.cells,A=q.fontSize}else{var q=Ti.layoutSinglelineText(h,{alignment:t.getAlignment(),fontSize:u??c,font:r,bounds:O});P=[q.line],A=q.fontSize}var H=(o=s??l)!==null&&o!==void 0?o:y;fr(s||u!==void 0?e:t.acroField,H,r,A);var U={x:0+v/2,y:0+v/2,width:b-v,height:w-v,borderWidth:v??0,borderColor:C,textColor:H,font:r.name,fontSize:A,color:S,textLines:P,padding:L};return le.__spreadArrays(F,st.drawTextField(U))};Ft.defaultDropdownAppearanceProvider=function(t,e,r){var n,i,a,o=cr(e),s=cr(t.acroField),l=Hn(e),u=Hn(t.acroField),c=e.getRectangle(),f=e.getAppearanceCharacteristics(),d=e.getBorderStyle(),p=(n=t.getSelected()[0])!==null&&n!==void 0?n:"",h=(i=d?.getWidth())!==null&&i!==void 0?i:0,v=lr.reduceRotation(f?.getRotation()),g=lr.adjustDimsForRotation(c,v),m=g.width,b=g.height,w=st.rotateInPlace(le.__assign(le.__assign({},c),{rotation:v})),F=Te.rgb(0,0,0),y=Te.componentsToColor(f?.getBorderColor()),C=Te.componentsToColor(f?.getBackgroundColor()),S=1,P={x:h+S,y:h+S,width:m-(h+S)*2,height:b-(h+S)*2},A=Ti.layoutSinglelineText(p,{alignment:bl.TextAlignment.Left,fontSize:l??u,font:r,bounds:P}),L=A.line,O=A.fontSize,q=(a=o??s)!==null&&a!==void 0?a:F;fr(o||l!==void 0?e:t.acroField,q,r,O);var H={x:0+h/2,y:0+h/2,width:m-h,height:b-h,borderWidth:h??0,borderColor:y,textColor:q,font:r.name,fontSize:O,color:C,textLines:[L],padding:S};return le.__spreadArrays(w,st.drawTextField(H))};Ft.defaultOptionListAppearanceProvider=function(t,e,r){var n,i,a=cr(e),o=cr(t.acroField),s=Hn(e),l=Hn(t.acroField),u=e.getRectangle(),c=e.getAppearanceCharacteristics(),f=e.getBorderStyle(),d=(n=f?.getWidth())!==null&&n!==void 0?n:0,p=lr.reduceRotation(c?.getRotation()),h=lr.adjustDimsForRotation(u,p),v=h.width,g=h.height,m=st.rotateInPlace(le.__assign(le.__assign({},u),{rotation:p})),b=Te.rgb(0,0,0),w=Te.componentsToColor(c?.getBorderColor()),F=Te.componentsToColor(c?.getBackgroundColor()),y=t.getOptions(),C=t.getSelected();t.isSorted()&&y.sort();for(var S="",P=0,A=y.length;P<A;P++)S+=y[P],P<A-1&&(S+=`
|
|
70
70
|
`);for(var L=1,O={x:d+L,y:d+L,width:v-(d+L)*2,height:g-(d+L)*2},q=Ti.layoutMultilineText(S,{alignment:bl.TextAlignment.Left,fontSize:s??l,font:r,bounds:O}),H=q.lines,U=q.fontSize,ne=q.lineHeight,pe=[],P=0,A=H.length;P<A;P++){var J=H[P];C.includes(J.text)&&pe.push(P)}var Oe=Te.rgb(153/255,193/255,218/255),xt=(i=a??o)!==null&&i!==void 0?i:b;return fr(a||s!==void 0?e:t.acroField,xt,r,U),le.__spreadArrays(m,st.drawOptionList({x:0+d/2,y:0+d/2,width:v-d,height:g-d,borderWidth:d??0,borderColor:w,textColor:xt,font:r.name,fontSize:U,color:F,textLines:H,lineHeight:ne,selectedColor:Oe,selectedLines:pe,padding:L}))}});var _l=D(h0=>{"use strict";Object.defineProperty(h0,"__esModule",{value:!0});var d0=(k(),R(T)),h3=d0.__importDefault(Xn()),oF=et(),xl=ae(),p3=(function(){function t(e,r,n){this.alreadyEmbedded=!1,xl.assertIs(e,"ref",[[oF.PDFRef,"PDFRef"]]),xl.assertIs(r,"doc",[[h3.default,"PDFDocument"]]),xl.assertIs(n,"embedder",[[oF.PDFPageEmbedder,"PDFPageEmbedder"]]),this.ref=e,this.doc=r,this.width=n.width,this.height=n.height,this.embedder=n}return t.prototype.scale=function(e){return xl.assertIs(e,"factor",["number"]),{width:this.width*e,height:this.height*e}},t.prototype.size=function(){return this.scale(1)},t.prototype.embed=function(){return d0.__awaiter(this,void 0,void 0,function(){return d0.__generator(this,function(e){switch(e.label){case 0:return this.alreadyEmbedded?[3,2]:[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:e.sent(),this.alreadyEmbedded=!0,e.label=2;case 2:return[2]}})})},t.of=function(e,r,n){return new t(e,r,n)},t})();h0.default=p3});var bn=D(v0=>{"use strict";Object.defineProperty(v0,"__esModule",{value:!0});var p0=(k(),R(T)),v3=p0.__importDefault(Xn()),Cl=et(),Fn=ae(),m3=(function(){function t(e,r,n){this.modified=!0,Fn.assertIs(e,"ref",[[Cl.PDFRef,"PDFRef"]]),Fn.assertIs(r,"doc",[[v3.default,"PDFDocument"]]),Fn.assertIs(n,"embedder",[[Cl.CustomFontEmbedder,"CustomFontEmbedder"],[Cl.StandardFontEmbedder,"StandardFontEmbedder"]]),this.ref=e,this.doc=r,this.name=n.fontName,this.embedder=n}return t.prototype.encodeText=function(e){return Fn.assertIs(e,"text",["string"]),this.modified=!0,this.embedder.encodeText(e)},t.prototype.widthOfTextAtSize=function(e,r){return Fn.assertIs(e,"text",["string"]),Fn.assertIs(r,"size",["number"]),this.embedder.widthOfTextAtSize(e,r)},t.prototype.heightAtSize=function(e,r){var n;return Fn.assertIs(e,"size",["number"]),Fn.assertOrUndefined(r?.descender,"options.descender",["boolean"]),this.embedder.heightOfFontAtSize(e,{descender:(n=r?.descender)!==null&&n!==void 0?n:!0})},t.prototype.sizeAtHeight=function(e){return Fn.assertIs(e,"height",["number"]),this.embedder.sizeOfFontAtHeight(e)},t.prototype.getCharacterSet=function(){return this.embedder instanceof Cl.StandardFontEmbedder?this.embedder.encoding.supportedCodePoints:this.embedder.font.characterSet},t.prototype.embed=function(){return p0.__awaiter(this,void 0,void 0,function(){return p0.__generator(this,function(e){switch(e.label){case 0:return this.modified?[4,this.embedder.embedIntoContext(this.doc.context,this.ref)]:[3,2];case 1:e.sent(),this.modified=!1,e.label=2;case 2:return[2]}})})},t.of=function(e,r,n){return new t(e,r,n)},t})();v0.default=m3});var wl=D(D0=>{"use strict";Object.defineProperty(D0,"__esModule",{value:!0});var g0=(k(),R(T)),g3=g0.__importDefault(Xn()),m0=et(),Xa=ae(),D3=(function(){function t(e,r,n){Xa.assertIs(e,"ref",[[m0.PDFRef,"PDFRef"]]),Xa.assertIs(r,"doc",[[g3.default,"PDFDocument"]]),Xa.assertIs(n,"embedder",[[m0.JpegEmbedder,"JpegEmbedder"],[m0.PngEmbedder,"PngEmbedder"]]),this.ref=e,this.doc=r,this.width=n.width,this.height=n.height,this.embedder=n}return t.prototype.scale=function(e){return Xa.assertIs(e,"factor",["number"]),{width:this.width*e,height:this.height*e}},t.prototype.scaleToFit=function(e,r){Xa.assertIs(e,"width",["number"]),Xa.assertIs(r,"height",["number"]);var n=e/this.width,i=r/this.height,a=Math.min(n,i);return this.scale(a)},t.prototype.size=function(){return this.scale(1)},t.prototype.embed=function(){return g0.__awaiter(this,void 0,void 0,function(){var e,r,n;return g0.__generator(this,function(i){switch(i.label){case 0:return this.embedder?(this.embedTask||(e=this,r=e.doc,n=e.ref,this.embedTask=this.embedder.embedIntoContext(r.context,n)),[4,this.embedTask]):[2];case 1:return i.sent(),this.embedder=void 0,[2]}})})},t.of=function(e,r,n){return new t(e,r,n)},t})();D0.default=D3});var Pl=D(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.ImageAlignment=void 0;var y3;(function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right"})(y3=Cs.ImageAlignment||(Cs.ImageAlignment={}))});var F0=D(y0=>{"use strict";Object.defineProperty(y0,"__esModule",{value:!0});var F3=(k(),R(T));F3.__exportStar(Pl(),y0)});var xn=D(ws=>{"use strict";Object.defineProperty(ws,"__esModule",{value:!0});ws.assertFieldAppearanceOptions=void 0;var El=(k(),R(T)),b3=El.__importDefault(Xn()),b0=ur(),ki=Zt(),ct=et(),Yt=ae(),sF=F0(),uF=Ga();ws.assertFieldAppearanceOptions=function(t){Yt.assertOrUndefined(t?.x,"options.x",["number"]),Yt.assertOrUndefined(t?.y,"options.y",["number"]),Yt.assertOrUndefined(t?.width,"options.width",["number"]),Yt.assertOrUndefined(t?.height,"options.height",["number"]),Yt.assertOrUndefined(t?.textColor,"options.textColor",[[Object,"Color"]]),Yt.assertOrUndefined(t?.backgroundColor,"options.backgroundColor",[[Object,"Color"]]),Yt.assertOrUndefined(t?.borderColor,"options.borderColor",[[Object,"Color"]]),Yt.assertOrUndefined(t?.borderWidth,"options.borderWidth",["number"]),Yt.assertOrUndefined(t?.rotate,"options.rotate",[[Object,"Rotation"]])};var x3=(function(){function t(e,r,n){Yt.assertIs(e,"acroField",[[ct.PDFAcroTerminal,"PDFAcroTerminal"]]),Yt.assertIs(r,"ref",[[ct.PDFRef,"PDFRef"]]),Yt.assertIs(n,"doc",[[b3.default,"PDFDocument"]]),this.acroField=e,this.ref=r,this.doc=n}return t.prototype.getName=function(){var e;return(e=this.acroField.getFullyQualifiedName())!==null&&e!==void 0?e:""},t.prototype.isReadOnly=function(){return this.acroField.hasFlag(ct.AcroFieldFlags.ReadOnly)},t.prototype.enableReadOnly=function(){this.acroField.setFlagTo(ct.AcroFieldFlags.ReadOnly,!0)},t.prototype.disableReadOnly=function(){this.acroField.setFlagTo(ct.AcroFieldFlags.ReadOnly,!1)},t.prototype.isRequired=function(){return this.acroField.hasFlag(ct.AcroFieldFlags.Required)},t.prototype.enableRequired=function(){this.acroField.setFlagTo(ct.AcroFieldFlags.Required,!0)},t.prototype.disableRequired=function(){this.acroField.setFlagTo(ct.AcroFieldFlags.Required,!1)},t.prototype.isExported=function(){return!this.acroField.hasFlag(ct.AcroFieldFlags.NoExport)},t.prototype.enableExporting=function(){this.acroField.setFlagTo(ct.AcroFieldFlags.NoExport,!1)},t.prototype.disableExporting=function(){this.acroField.setFlagTo(ct.AcroFieldFlags.NoExport,!0)},t.prototype.needsAppearancesUpdate=function(){throw new ct.MethodNotImplementedError(this.constructor.name,"needsAppearancesUpdate")},t.prototype.defaultUpdateAppearances=function(e){throw new ct.MethodNotImplementedError(this.constructor.name,"defaultUpdateAppearances")},t.prototype.markAsDirty=function(){this.doc.getForm().markFieldAsDirty(this.ref)},t.prototype.markAsClean=function(){this.doc.getForm().markFieldAsClean(this.ref)},t.prototype.isDirty=function(){return this.doc.getForm().fieldIsDirty(this.ref)},t.prototype.createWidget=function(e){var r,n=e.textColor,i=e.backgroundColor,a=e.borderColor,o=e.borderWidth,s=ki.toDegrees(e.rotate),l=e.caption,u=e.x,c=e.y,f=e.width+o,d=e.height+o,p=!!e.hidden,h=e.page;Yt.assertMultiple(s,"degreesAngle",90);var v=ct.PDFWidgetAnnotation.create(this.doc.context,this.ref),g=ki.rotateRectangle({x:u,y:c,width:f,height:d},o,s);v.setRectangle(g),h&&v.setP(h);var m=v.getOrCreateAppearanceCharacteristics();i&&m.setBackgroundColor(b0.colorToComponents(i)),m.setRotation(s),l&&m.setCaptions({normal:l}),a&&m.setBorderColor(b0.colorToComponents(a));var b=v.getOrCreateBorderStyle();if(o!==void 0&&b.setWidth(o),v.setFlagTo(ct.AnnotationFlags.Print,!0),v.setFlagTo(ct.AnnotationFlags.Hidden,p),v.setFlagTo(ct.AnnotationFlags.Invisible,!1),n){var w=(r=this.acroField.getDefaultAppearance())!==null&&r!==void 0?r:"",F=w+`
|
|
71
|
-
`+b0.setFillingColor(n).toString();this.acroField.setDefaultAppearance(F)}return v},t.prototype.updateWidgetAppearanceWithFont=function(e,r,n){var i=n.normal,a=n.rollover,o=n.down;this.updateWidgetAppearances(e,{normal:this.createAppearanceStream(e,i,r),rollover:a&&this.createAppearanceStream(e,a,r),down:o&&this.createAppearanceStream(e,o,r)})},t.prototype.updateOnOffWidgetAppearance=function(e,r,n){var i=n.normal,a=n.rollover,o=n.down;this.updateWidgetAppearances(e,{normal:this.createAppearanceDict(e,i,r),rollover:a&&this.createAppearanceDict(e,a,r),down:o&&this.createAppearanceDict(e,o,r)})},t.prototype.updateWidgetAppearances=function(e,r){var n=r.normal,i=r.rollover,a=r.down;e.setNormalAppearance(n),i?e.setRolloverAppearance(i):e.removeRolloverAppearance(),a?e.setDownAppearance(a):e.removeDownAppearance()},t.prototype.createAppearanceStream=function(e,r,n){var i,a=this.acroField.dict.context,o=e.getRectangle(),s=o.width,l=o.height,u=n&&{Font:(i={},i[n.name]=n.ref,i)},c=a.formXObject(r,{Resources:u,BBox:a.obj([0,0,s,l]),Matrix:a.obj([1,0,0,1,0,0])}),f=a.register(c);return f},t.prototype.createImageAppearanceStream=function(e,r,n){var i,a,o=this.acroField.dict.context,s=e.getRectangle(),l=e.getAppearanceCharacteristics(),u=e.getBorderStyle(),c=(a=u?.getWidth())!==null&&a!==void 0?a:0,f=ki.reduceRotation(l?.getRotation()),d=uF.rotateInPlace(El.__assign(El.__assign({},s),{rotation:f})),p=ki.adjustDimsForRotation(s,f),h=r.scaleToFit(p.width-c*2,p.height-c*2),v={x:c,y:c,width:h.width,height:h.height,rotate:ki.degrees(0),xSkew:ki.degrees(0),ySkew:ki.degrees(0)};n===sF.ImageAlignment.Center?(v.x+=(p.width-c*2)/2-h.width/2,v.y+=(p.height-c*2)/2-h.height/2):n===sF.ImageAlignment.Right&&(v.x=p.width-c-h.width,v.y=p.height-c-h.height);var g=this.doc.context.addRandomSuffix("Image",10),m=El.__spreadArrays(d,uF.drawImage(g,v)),b={XObject:(i={},i[g]=r.ref,i)},w=o.formXObject(m,{Resources:b,BBox:o.obj([0,0,s.width,s.height]),Matrix:o.obj([1,0,0,1,0,0])});return o.register(w)},t.prototype.createAppearanceDict=function(e,r,n){var i=this.acroField.dict.context,a=this.createAppearanceStream(e,r.on),o=this.createAppearanceStream(e,r.off),s=i.obj({});return s.set(n,a),s.set(ct.PDFName.of("Off"),o),s},t})();ws.default=x3});var P0=D(w0=>{"use strict";Object.defineProperty(w0,"__esModule",{value:!0});var C0=(k(),R(T)),_3=C0.__importDefault(_n()),lF=Kn(),x0=ur(),C3=Zt(),cF=C0.__importStar(xn()),Ri=et(),_0=ae(),w3=(function(t){C0.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return _0.assertIs(r,"acroCheckBox",[[Ri.PDFAcroCheckBox,"PDFAcroCheckBox"]]),a.acroField=r,a}return e.prototype.check=function(){var r,n=(r=this.acroField.getOnValue())!==null&&r!==void 0?r:Ri.PDFName.of("Yes");this.markAsDirty(),this.acroField.setValue(n)},e.prototype.uncheck=function(){this.markAsDirty(),this.acroField.setValue(Ri.PDFName.of("Off"))},e.prototype.isChecked=function(){var r=this.acroField.getOnValue();return!!r&&r===this.acroField.getValue()},e.prototype.addToPage=function(r,n){var i,a,o,s,l,u;_0.assertIs(r,"page",[[_3.default,"PDFPage"]]),cF.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=x0.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=x0.rgb(1,1,1)),"borderColor"in n||(n.borderColor=x0.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:(a=n.y)!==null&&a!==void 0?a:0,width:(o=n.width)!==null&&o!==void 0?o:50,height:(s=n.height)!==null&&s!==void 0?s:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(l=n.borderWidth)!==null&&l!==void 0?l:0,rotate:(u=n.rotate)!==null&&u!==void 0?u:C3.degrees(0),hidden:n.hidden,page:r.ref}),f=this.doc.context.register(c.dict);this.acroField.addWidget(f),c.setAppearanceState(Ri.PDFName.of("Off")),this.updateWidgetAppearance(c,Ri.PDFName.of("Yes")),r.node.addAnnot(f)},e.prototype.needsAppearancesUpdate=function(){for(var r,n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=o.getAppearanceState(),l=(r=o.getAppearances())===null||r===void 0?void 0:r.normal;if(!(l instanceof Ri.PDFDict)||s&&!l.has(s))return!0}return!1},e.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},e.prototype.updateAppearances=function(r){var n;_0.assertOrUndefined(r,"provider",[Function]);for(var i=this.acroField.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a],l=(n=s.getOnValue())!==null&&n!==void 0?n:Ri.PDFName.of("Yes");l&&this.updateWidgetAppearance(s,l,r)}this.markAsClean()},e.prototype.updateWidgetAppearance=function(r,n,i){var a=i??lF.defaultCheckBoxAppearanceProvider,o=lF.normalizeAppearance(a(this,r));this.updateOnOffWidgetAppearance(r,n,o)},e.of=function(r,n,i){return new e(r,n,i)},e})(cF.default);w0.default=w3});var O0=D(S0=>{"use strict";Object.defineProperty(S0,"__esModule",{value:!0});var Sl=(k(),R(T)),P3=Sl.__importDefault(_n()),fF=Sl.__importDefault(bn()),dF=Sl.__importStar(xn()),hF=Kn(),E0=ur(),E3=Zt(),tt=et(),Zr=ae(),S3=(function(t){Sl.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return Zr.assertIs(r,"acroComboBox",[[tt.PDFAcroComboBox,"PDFAcroComboBox"]]),a.acroField=r,a}return e.prototype.getOptions=function(){for(var r=this.acroField.getOptions(),n=new Array(r.length),i=0,a=n.length;i<a;i++){var o=r[i],s=o.display,l=o.value;n[i]=(s??l).decodeText()}return n},e.prototype.getSelected=function(){for(var r=this.acroField.getValues(),n=new Array(r.length),i=0,a=r.length;i<a;i++)n[i]=r[i].decodeText();return n},e.prototype.setOptions=function(r){Zr.assertIs(r,"options",[Array]);for(var n=new Array(r.length),i=0,a=r.length;i<a;i++)n[i]={value:tt.PDFHexString.fromText(r[i])};this.acroField.setOptions(n)},e.prototype.addOptions=function(r){Zr.assertIs(r,"options",["string",Array]);for(var n=Array.isArray(r)?r:[r],i=this.acroField.getOptions(),a=new Array(n.length),o=0,s=n.length;o<s;o++)a[o]={value:tt.PDFHexString.fromText(n[o])};this.acroField.setOptions(i.concat(a))},e.prototype.select=function(r,n){n===void 0&&(n=!1),Zr.assertIs(r,"options",["string",Array]),Zr.assertIs(n,"merge",["boolean"]);var i=Array.isArray(r)?r:[r],a=this.getOptions(),o=i.find(function(f){return!a.includes(f)});o&&this.enableEditing(),this.markAsDirty(),(i.length>1||i.length===1&&n)&&this.enableMultiselect();for(var s=new Array(i.length),l=0,u=i.length;l<u;l++)s[l]=tt.PDFHexString.fromText(i[l]);if(n){var c=this.acroField.getValues();this.acroField.setValues(c.concat(s))}else this.acroField.setValues(s)},e.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},e.prototype.setFontSize=function(r){Zr.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},e.prototype.isEditable=function(){return this.acroField.hasFlag(tt.AcroChoiceFlags.Edit)},e.prototype.enableEditing=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.Edit,!0)},e.prototype.disableEditing=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.Edit,!1)},e.prototype.isSorted=function(){return this.acroField.hasFlag(tt.AcroChoiceFlags.Sort)},e.prototype.enableSorting=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.Sort,!0)},e.prototype.disableSorting=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.Sort,!1)},e.prototype.isMultiselect=function(){return this.acroField.hasFlag(tt.AcroChoiceFlags.MultiSelect)},e.prototype.enableMultiselect=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.MultiSelect,!0)},e.prototype.disableMultiselect=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.MultiSelect,!1)},e.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(tt.AcroChoiceFlags.DoNotSpellCheck)},e.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.DoNotSpellCheck,!1)},e.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.DoNotSpellCheck,!0)},e.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(tt.AcroChoiceFlags.CommitOnSelChange)},e.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.CommitOnSelChange,!0)},e.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.CommitOnSelChange,!1)},e.prototype.addToPage=function(r,n){var i,a,o,s,l,u,c;Zr.assertIs(r,"page",[[P3.default,"PDFPage"]]),dF.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=E0.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=E0.rgb(1,1,1)),"borderColor"in n||(n.borderColor=E0.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var f=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(a=n.y)!==null&&a!==void 0?a:0,width:(o=n.width)!==null&&o!==void 0?o:200,height:(s=n.height)!==null&&s!==void 0?s:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(l=n.borderWidth)!==null&&l!==void 0?l:0,rotate:(u=n.rotate)!==null&&u!==void 0?u:E3.degrees(0),hidden:n.hidden,page:r.ref}),d=this.doc.context.register(f.dict);this.acroField.addWidget(d);var p=(c=n.font)!==null&&c!==void 0?c:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(f,p),r.node.addAnnot(d)},e.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=((r=o.getAppearances())===null||r===void 0?void 0:r.normal)instanceof tt.PDFStream;if(!s)return!0}return!1},e.prototype.defaultUpdateAppearances=function(r){Zr.assertIs(r,"font",[[fF.default,"PDFFont"]]),this.updateAppearances(r)},e.prototype.updateAppearances=function(r,n){Zr.assertIs(r,"font",[[fF.default,"PDFFont"]]),Zr.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a];this.updateWidgetAppearance(s,r,n)}this.markAsClean()},e.prototype.updateWidgetAppearance=function(r,n,i){var a=i??hF.defaultDropdownAppearanceProvider,o=hF.normalizeAppearance(a(this,r,n));this.updateWidgetAppearanceWithFont(r,n,o)},e.of=function(r,n,i){return new e(r,n,i)},e})(dF.default);S0.default=S3});var k0=D(T0=>{"use strict";Object.defineProperty(T0,"__esModule",{value:!0});var Ol=(k(),R(T)),O3=Ol.__importDefault(_n()),pF=Ol.__importDefault(bn()),vF=Ol.__importStar(xn()),mF=Kn(),A0=ur(),A3=Zt(),Vt=et(),Er=ae(),T3=(function(t){Ol.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return Er.assertIs(r,"acroListBox",[[Vt.PDFAcroListBox,"PDFAcroListBox"]]),a.acroField=r,a}return e.prototype.getOptions=function(){for(var r=this.acroField.getOptions(),n=new Array(r.length),i=0,a=n.length;i<a;i++){var o=r[i],s=o.display,l=o.value;n[i]=(s??l).decodeText()}return n},e.prototype.getSelected=function(){for(var r=this.acroField.getValues(),n=new Array(r.length),i=0,a=r.length;i<a;i++)n[i]=r[i].decodeText();return n},e.prototype.setOptions=function(r){Er.assertIs(r,"options",[Array]),this.markAsDirty();for(var n=new Array(r.length),i=0,a=r.length;i<a;i++)n[i]={value:Vt.PDFHexString.fromText(r[i])};this.acroField.setOptions(n)},e.prototype.addOptions=function(r){Er.assertIs(r,"options",["string",Array]),this.markAsDirty();for(var n=Array.isArray(r)?r:[r],i=this.acroField.getOptions(),a=new Array(n.length),o=0,s=n.length;o<s;o++)a[o]={value:Vt.PDFHexString.fromText(n[o])};this.acroField.setOptions(i.concat(a))},e.prototype.select=function(r,n){n===void 0&&(n=!1),Er.assertIs(r,"options",["string",Array]),Er.assertIs(n,"merge",["boolean"]);var i=Array.isArray(r)?r:[r],a=this.getOptions();Er.assertIsSubset(i,"option",a),this.markAsDirty(),(i.length>1||i.length===1&&n)&&this.enableMultiselect();for(var o=new Array(i.length),s=0,l=i.length;s<l;s++)o[s]=Vt.PDFHexString.fromText(i[s]);if(n){var u=this.acroField.getValues();this.acroField.setValues(u.concat(o))}else this.acroField.setValues(o)},e.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},e.prototype.setFontSize=function(r){Er.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},e.prototype.isSorted=function(){return this.acroField.hasFlag(Vt.AcroChoiceFlags.Sort)},e.prototype.enableSorting=function(){this.acroField.setFlagTo(Vt.AcroChoiceFlags.Sort,!0)},e.prototype.disableSorting=function(){this.acroField.setFlagTo(Vt.AcroChoiceFlags.Sort,!1)},e.prototype.isMultiselect=function(){return this.acroField.hasFlag(Vt.AcroChoiceFlags.MultiSelect)},e.prototype.enableMultiselect=function(){this.acroField.setFlagTo(Vt.AcroChoiceFlags.MultiSelect,!0)},e.prototype.disableMultiselect=function(){this.acroField.setFlagTo(Vt.AcroChoiceFlags.MultiSelect,!1)},e.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(Vt.AcroChoiceFlags.CommitOnSelChange)},e.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(Vt.AcroChoiceFlags.CommitOnSelChange,!0)},e.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(Vt.AcroChoiceFlags.CommitOnSelChange,!1)},e.prototype.addToPage=function(r,n){var i,a,o,s,l,u,c;Er.assertIs(r,"page",[[O3.default,"PDFPage"]]),vF.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=A0.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=A0.rgb(1,1,1)),"borderColor"in n||(n.borderColor=A0.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var f=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(a=n.y)!==null&&a!==void 0?a:0,width:(o=n.width)!==null&&o!==void 0?o:200,height:(s=n.height)!==null&&s!==void 0?s:100,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(l=n.borderWidth)!==null&&l!==void 0?l:0,rotate:(u=n.rotate)!==null&&u!==void 0?u:A3.degrees(0),hidden:n.hidden,page:r.ref}),d=this.doc.context.register(f.dict);this.acroField.addWidget(d);var p=(c=n.font)!==null&&c!==void 0?c:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(f,p),r.node.addAnnot(d)},e.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=((r=o.getAppearances())===null||r===void 0?void 0:r.normal)instanceof Vt.PDFStream;if(!s)return!0}return!1},e.prototype.defaultUpdateAppearances=function(r){Er.assertIs(r,"font",[[pF.default,"PDFFont"]]),this.updateAppearances(r)},e.prototype.updateAppearances=function(r,n){Er.assertIs(r,"font",[[pF.default,"PDFFont"]]),Er.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a];this.updateWidgetAppearance(s,r,n)}this.markAsClean()},e.prototype.updateWidgetAppearance=function(r,n,i){var a=i??mF.defaultOptionListAppearanceProvider,o=mF.normalizeAppearance(a(this,r,n));this.updateWidgetAppearanceWithFont(r,n,o)},e.of=function(r,n,i){return new e(r,n,i)},e})(vF.default);T0.default=T3});var I0=D(N0=>{"use strict";Object.defineProperty(N0,"__esModule",{value:!0});var B0=(k(),R(T)),k3=B0.__importDefault(_n()),gF=B0.__importStar(xn()),DF=Kn(),R0=ur(),R3=Zt(),dr=et(),Za=ae(),B3=(function(t){B0.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return Za.assertIs(r,"acroRadioButton",[[dr.PDFAcroRadioButton,"PDFAcroRadioButton"]]),a.acroField=r,a}return e.prototype.getOptions=function(){var r=this.acroField.getExportValues();if(r){for(var n=new Array(r.length),i=0,a=r.length;i<a;i++)n[i]=r[i].decodeText();return n}for(var o=this.acroField.getOnValues(),s=new Array(o.length),i=0,a=s.length;i<a;i++)s[i]=o[i].decodeText();return s},e.prototype.getSelected=function(){var r=this.acroField.getValue();if(r!==dr.PDFName.of("Off")){var n=this.acroField.getExportValues();if(n){for(var i=this.acroField.getOnValues(),a=0,o=i.length;a<o;a++)if(i[a]===r)return n[a].decodeText()}return r.decodeText()}},e.prototype.select=function(r){Za.assertIs(r,"option",["string"]);var n=this.getOptions();Za.assertIsOneOf(r,"option",n),this.markAsDirty();var i=this.acroField.getOnValues(),a=this.acroField.getExportValues();if(a)for(var o=0,s=a.length;o<s;o++)a[o].decodeText()===r&&this.acroField.setValue(i[o]);else for(var o=0,s=i.length;o<s;o++){var l=i[o];l.decodeText()===r&&this.acroField.setValue(l)}},e.prototype.clear=function(){this.markAsDirty(),this.acroField.setValue(dr.PDFName.of("Off"))},e.prototype.isOffToggleable=function(){return!this.acroField.hasFlag(dr.AcroButtonFlags.NoToggleToOff)},e.prototype.enableOffToggling=function(){this.acroField.setFlagTo(dr.AcroButtonFlags.NoToggleToOff,!1)},e.prototype.disableOffToggling=function(){this.acroField.setFlagTo(dr.AcroButtonFlags.NoToggleToOff,!0)},e.prototype.isMutuallyExclusive=function(){return!this.acroField.hasFlag(dr.AcroButtonFlags.RadiosInUnison)},e.prototype.enableMutualExclusion=function(){this.acroField.setFlagTo(dr.AcroButtonFlags.RadiosInUnison,!1)},e.prototype.disableMutualExclusion=function(){this.acroField.setFlagTo(dr.AcroButtonFlags.RadiosInUnison,!0)},e.prototype.addOptionToPage=function(r,n,i){var a,o,s,l,u,c,f,d,p;Za.assertIs(r,"option",["string"]),Za.assertIs(n,"page",[[k3.default,"PDFPage"]]),gF.assertFieldAppearanceOptions(i);var h=this.createWidget({x:(a=i?.x)!==null&&a!==void 0?a:0,y:(o=i?.y)!==null&&o!==void 0?o:0,width:(s=i?.width)!==null&&s!==void 0?s:50,height:(l=i?.height)!==null&&l!==void 0?l:50,textColor:(u=i?.textColor)!==null&&u!==void 0?u:R0.rgb(0,0,0),backgroundColor:(c=i?.backgroundColor)!==null&&c!==void 0?c:R0.rgb(1,1,1),borderColor:(f=i?.borderColor)!==null&&f!==void 0?f:R0.rgb(0,0,0),borderWidth:(d=i?.borderWidth)!==null&&d!==void 0?d:1,rotate:(p=i?.rotate)!==null&&p!==void 0?p:R3.degrees(0),hidden:i?.hidden,page:n.ref}),v=this.doc.context.register(h.dict),g=this.acroField.addWidgetWithOpt(v,dr.PDFHexString.fromText(r),!this.isMutuallyExclusive());h.setAppearanceState(dr.PDFName.of("Off")),this.updateWidgetAppearance(h,g),n.node.addAnnot(v)},e.prototype.needsAppearancesUpdate=function(){for(var r,n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=o.getAppearanceState(),l=(r=o.getAppearances())===null||r===void 0?void 0:r.normal;if(!(l instanceof dr.PDFDict)||s&&!l.has(s))return!0}return!1},e.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},e.prototype.updateAppearances=function(r){Za.assertOrUndefined(r,"provider",[Function]);for(var n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=o.getOnValue();s&&this.updateWidgetAppearance(o,s,r)}},e.prototype.updateWidgetAppearance=function(r,n,i){var a=i??DF.defaultRadioGroupAppearanceProvider,o=DF.normalizeAppearance(a(this,r));this.updateOnOffWidgetAppearance(r,n,o)},e.of=function(r,n,i){return new e(r,n,i)},e})(gF.default);N0.default=B3});var j0=D(q0=>{"use strict";Object.defineProperty(q0,"__esModule",{value:!0});var yF=(k(),R(T)),N3=yF.__importDefault(xn()),I3=et(),q3=ae(),j3=(function(t){yF.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return q3.assertIs(r,"acroSignature",[[I3.PDFAcroSignature,"PDFAcroSignature"]]),a.acroField=r,a}return e.prototype.needsAppearancesUpdate=function(){return!1},e.of=function(r,n,i){return new e(r,n,i)},e})(N3.default);q0.default=j3});var W0=D(z0=>{"use strict";Object.defineProperty(z0,"__esModule",{value:!0});var Al=(k(),R(T)),M3=Al.__importDefault(_n()),FF=Al.__importDefault(bn()),bF=Al.__importStar(xn()),xF=Kn(),M0=ur(),U3=Zt(),U0=Ha(),V0=Pl(),Bi=_s(),qe=et(),Cn=ae(),V3=(function(t){Al.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return Cn.assertIs(r,"acroText",[[qe.PDFAcroText,"PDFAcroText"]]),a.acroField=r,a}return e.prototype.getText=function(){var r=this.acroField.getValue();if(!r&&this.isRichFormatted())throw new U0.RichTextFieldReadError(this.getName());return r?.decodeText()},e.prototype.setText=function(r){Cn.assertOrUndefined(r,"text",["string"]);var n=this.getMaxLength();if(n!==void 0&&r&&r.length>n)throw new U0.ExceededMaxLengthError(r.length,n,this.getName());this.markAsDirty(),this.disableRichFormatting(),r?this.acroField.setValue(qe.PDFHexString.fromText(r)):this.acroField.removeValue()},e.prototype.getAlignment=function(){var r=this.acroField.getQuadding();return r===0?Bi.TextAlignment.Left:r===1?Bi.TextAlignment.Center:r===2?Bi.TextAlignment.Right:Bi.TextAlignment.Left},e.prototype.setAlignment=function(r){Cn.assertIsOneOf(r,"alignment",Bi.TextAlignment),this.markAsDirty(),this.acroField.setQuadding(r)},e.prototype.getMaxLength=function(){return this.acroField.getMaxLength()},e.prototype.setMaxLength=function(r){if(Cn.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 U0.InvalidMaxLengthError(n.length,r,this.getName());this.acroField.setMaxLength(r)}},e.prototype.removeMaxLength=function(){this.markAsDirty(),this.acroField.removeMaxLength()},e.prototype.setImage=function(r){for(var n=this.getAlignment(),i=n===Bi.TextAlignment.Center?V0.ImageAlignment.Center:n===Bi.TextAlignment.Right?V0.ImageAlignment.Right:V0.ImageAlignment.Left,a=this.acroField.getWidgets(),o=0,s=a.length;o<s;o++){var l=a[o],u=this.createImageAppearanceStream(l,r,i);this.updateWidgetAppearances(l,{normal:u})}this.markAsClean()},e.prototype.setFontSize=function(r){Cn.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},e.prototype.isMultiline=function(){return this.acroField.hasFlag(qe.AcroTextFlags.Multiline)},e.prototype.enableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(qe.AcroTextFlags.Multiline,!0)},e.prototype.disableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(qe.AcroTextFlags.Multiline,!1)},e.prototype.isPassword=function(){return this.acroField.hasFlag(qe.AcroTextFlags.Password)},e.prototype.enablePassword=function(){this.acroField.setFlagTo(qe.AcroTextFlags.Password,!0)},e.prototype.disablePassword=function(){this.acroField.setFlagTo(qe.AcroTextFlags.Password,!1)},e.prototype.isFileSelector=function(){return this.acroField.hasFlag(qe.AcroTextFlags.FileSelect)},e.prototype.enableFileSelection=function(){this.acroField.setFlagTo(qe.AcroTextFlags.FileSelect,!0)},e.prototype.disableFileSelection=function(){this.acroField.setFlagTo(qe.AcroTextFlags.FileSelect,!1)},e.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(qe.AcroTextFlags.DoNotSpellCheck)},e.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(qe.AcroTextFlags.DoNotSpellCheck,!1)},e.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(qe.AcroTextFlags.DoNotSpellCheck,!0)},e.prototype.isScrollable=function(){return!this.acroField.hasFlag(qe.AcroTextFlags.DoNotScroll)},e.prototype.enableScrolling=function(){this.acroField.setFlagTo(qe.AcroTextFlags.DoNotScroll,!1)},e.prototype.disableScrolling=function(){this.acroField.setFlagTo(qe.AcroTextFlags.DoNotScroll,!0)},e.prototype.isCombed=function(){return this.acroField.hasFlag(qe.AcroTextFlags.Comb)&&!this.isMultiline()&&!this.isPassword()&&!this.isFileSelector()&&this.getMaxLength()!==void 0},e.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(qe.AcroTextFlags.Comb,!0)},e.prototype.disableCombing=function(){this.markAsDirty(),this.acroField.setFlagTo(qe.AcroTextFlags.Comb,!1)},e.prototype.isRichFormatted=function(){return this.acroField.hasFlag(qe.AcroTextFlags.RichText)},e.prototype.enableRichFormatting=function(){this.acroField.setFlagTo(qe.AcroTextFlags.RichText,!0)},e.prototype.disableRichFormatting=function(){this.acroField.setFlagTo(qe.AcroTextFlags.RichText,!1)},e.prototype.addToPage=function(r,n){var i,a,o,s,l,u,c;Cn.assertIs(r,"page",[[M3.default,"PDFPage"]]),bF.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=M0.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=M0.rgb(1,1,1)),"borderColor"in n||(n.borderColor=M0.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var f=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(a=n.y)!==null&&a!==void 0?a:0,width:(o=n.width)!==null&&o!==void 0?o:200,height:(s=n.height)!==null&&s!==void 0?s:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(l=n.borderWidth)!==null&&l!==void 0?l:0,rotate:(u=n.rotate)!==null&&u!==void 0?u:U3.degrees(0),hidden:n.hidden,page:r.ref}),d=this.doc.context.register(f.dict);this.acroField.addWidget(d);var p=(c=n.font)!==null&&c!==void 0?c:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(f,p),r.node.addAnnot(d)},e.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=((r=o.getAppearances())===null||r===void 0?void 0:r.normal)instanceof qe.PDFStream;if(!s)return!0}return!1},e.prototype.defaultUpdateAppearances=function(r){Cn.assertIs(r,"font",[[FF.default,"PDFFont"]]),this.updateAppearances(r)},e.prototype.updateAppearances=function(r,n){Cn.assertIs(r,"font",[[FF.default,"PDFFont"]]),Cn.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a];this.updateWidgetAppearance(s,r,n)}this.markAsClean()},e.prototype.updateWidgetAppearance=function(r,n,i){var a=i??xF.defaultTextFieldAppearanceProvider,o=xF.normalizeAppearance(a(this,r,n));this.updateWidgetAppearanceWithFont(r,n,o)},e.of=function(r,n,i){return new e(r,n,i)},e})(bF.default);z0.default=V3});var Tl=D(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.StandardFonts=void 0;var z3;(function(t){t.Courier="Courier",t.CourierBold="Courier-Bold",t.CourierOblique="Courier-Oblique",t.CourierBoldOblique="Courier-BoldOblique",t.Helvetica="Helvetica",t.HelveticaBold="Helvetica-Bold",t.HelveticaOblique="Helvetica-Oblique",t.HelveticaBoldOblique="Helvetica-BoldOblique",t.TimesRoman="Times-Roman",t.TimesRomanBold="Times-Bold",t.TimesRomanItalic="Times-Italic",t.TimesRomanBoldItalic="Times-BoldItalic",t.Symbol="Symbol",t.ZapfDingbats="ZapfDingbats"})(z3=Ps.StandardFonts||(Ps.StandardFonts={}))});var H0=D(G0=>{"use strict";Object.defineProperty(G0,"__esModule",{value:!0});var hr=(k(),R(T)),W3=hr.__importDefault(Xn()),Rl=hr.__importDefault(K0()),Es=hr.__importDefault(P0()),Bl=hr.__importDefault(O0()),Nl=hr.__importDefault(k0()),Ss=hr.__importDefault(I0()),L0=hr.__importDefault(j0()),Il=hr.__importDefault(W0()),Sr=Ha(),L3=hr.__importDefault(bn()),G3=Tl(),H3=Ga(),kl=Wn(),we=et(),He=ae(),K3=(function(){function t(e,r){var n=this;this.embedDefaultFont=function(){return n.doc.embedStandardFont(G3.StandardFonts.Helvetica)},He.assertIs(e,"acroForm",[[we.PDFAcroForm,"PDFAcroForm"]]),He.assertIs(r,"doc",[[W3.default,"PDFDocument"]]),this.acroForm=e,this.doc=r,this.dirtyFields=new Set,this.defaultFontCache=He.Cache.populatedBy(this.embedDefaultFont)}return t.prototype.hasXFA=function(){return this.acroForm.dict.has(we.PDFName.of("XFA"))},t.prototype.deleteXFA=function(){this.acroForm.dict.delete(we.PDFName.of("XFA"))},t.prototype.getFields=function(){for(var e=this.acroForm.getAllFields(),r=[],n=0,i=e.length;n<i;n++){var a=e[n],o=a[0],s=a[1],l=X3(o,s,this.doc);l&&r.push(l)}return r},t.prototype.getFieldMaybe=function(e){He.assertIs(e,"name",["string"]);for(var r=this.getFields(),n=0,i=r.length;n<i;n++){var a=r[n];if(a.getName()===e)return a}},t.prototype.getField=function(e){He.assertIs(e,"name",["string"]);var r=this.getFieldMaybe(e);if(r)return r;throw new Sr.NoSuchFieldError(e)},t.prototype.getButton=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof Rl.default)return r;throw new Sr.UnexpectedFieldTypeError(e,Rl.default,r)},t.prototype.getCheckBox=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof Es.default)return r;throw new Sr.UnexpectedFieldTypeError(e,Es.default,r)},t.prototype.getDropdown=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof Bl.default)return r;throw new Sr.UnexpectedFieldTypeError(e,Bl.default,r)},t.prototype.getOptionList=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof Nl.default)return r;throw new Sr.UnexpectedFieldTypeError(e,Nl.default,r)},t.prototype.getRadioGroup=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof Ss.default)return r;throw new Sr.UnexpectedFieldTypeError(e,Ss.default,r)},t.prototype.getSignature=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof L0.default)return r;throw new Sr.UnexpectedFieldTypeError(e,L0.default,r)},t.prototype.getTextField=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof Il.default)return r;throw new Sr.UnexpectedFieldTypeError(e,Il.default,r)},t.prototype.createButton=function(e){He.assertIs(e,"name",["string"]);var r=Ya(e),n=this.findOrCreateNonTerminals(r.nonTerminal),i=we.PDFAcroPushButton.create(this.doc.context);return i.setPartialName(r.terminal),Ja(n,[i,i.ref],r.terminal),Rl.default.of(i,i.ref,this.doc)},t.prototype.createCheckBox=function(e){He.assertIs(e,"name",["string"]);var r=Ya(e),n=this.findOrCreateNonTerminals(r.nonTerminal),i=we.PDFAcroCheckBox.create(this.doc.context);return i.setPartialName(r.terminal),Ja(n,[i,i.ref],r.terminal),Es.default.of(i,i.ref,this.doc)},t.prototype.createDropdown=function(e){He.assertIs(e,"name",["string"]);var r=Ya(e),n=this.findOrCreateNonTerminals(r.nonTerminal),i=we.PDFAcroComboBox.create(this.doc.context);return i.setPartialName(r.terminal),Ja(n,[i,i.ref],r.terminal),Bl.default.of(i,i.ref,this.doc)},t.prototype.createOptionList=function(e){He.assertIs(e,"name",["string"]);var r=Ya(e),n=this.findOrCreateNonTerminals(r.nonTerminal),i=we.PDFAcroListBox.create(this.doc.context);return i.setPartialName(r.terminal),Ja(n,[i,i.ref],r.terminal),Nl.default.of(i,i.ref,this.doc)},t.prototype.createRadioGroup=function(e){He.assertIs(e,"name",["string"]);var r=Ya(e),n=this.findOrCreateNonTerminals(r.nonTerminal),i=we.PDFAcroRadioButton.create(this.doc.context);return i.setPartialName(r.terminal),Ja(n,[i,i.ref],r.terminal),Ss.default.of(i,i.ref,this.doc)},t.prototype.createTextField=function(e){He.assertIs(e,"name",["string"]);var r=Ya(e),n=this.findOrCreateNonTerminals(r.nonTerminal),i=we.PDFAcroText.create(this.doc.context);return i.setPartialName(r.terminal),Ja(n,[i,i.ref],r.terminal),Il.default.of(i,i.ref,this.doc)},t.prototype.flatten=function(e){e===void 0&&(e={updateFieldAppearances:!0}),e.updateFieldAppearances&&this.updateFieldAppearances();for(var r=this.getFields(),n=0,i=r.length;n<i;n++){for(var a=r[n],o=a.acroField.getWidgets(),s=0,l=o.length;s<l;s++){var u=o[s],c=this.findWidgetPage(u),f=this.findWidgetAppearanceRef(a,u),d=c.node.newXObject("FlatWidget",f),p=u.getRectangle(),h=hr.__spreadArrays([kl.pushGraphicsState(),kl.translate(p.x,p.y)],H3.rotateInPlace(hr.__assign(hr.__assign({},p),{rotation:0})),[kl.drawObject(d),kl.popGraphicsState()]).filter(Boolean);c.pushOperators.apply(c,h)}this.removeField(a)}},t.prototype.removeField=function(e){for(var r=e.acroField.getWidgets(),n=new Set,i=0,a=r.length;i<a;i++){var o=r[i],s=this.findWidgetAppearanceRef(e,o),l=this.findWidgetPage(o);n.add(l),l.node.removeAnnot(s)}n.forEach(function(p){return p.node.removeAnnot(e.ref)}),this.acroForm.removeField(e.acroField);for(var u=e.acroField.normalizedEntries().Kids,c=u.size(),f=0;f<c;f++){var d=u.get(f);d instanceof we.PDFRef&&this.doc.context.delete(d)}this.doc.context.delete(e.ref)},t.prototype.updateFieldAppearances=function(e){He.assertOrUndefined(e,"font",[[L3.default,"PDFFont"]]),e=e??this.getDefaultFont();for(var r=this.getFields(),n=0,i=r.length;n<i;n++){var a=r[n];a.needsAppearancesUpdate()&&a.defaultUpdateAppearances(e)}},t.prototype.markFieldAsDirty=function(e){He.assertOrUndefined(e,"fieldRef",[[we.PDFRef,"PDFRef"]]),this.dirtyFields.add(e)},t.prototype.markFieldAsClean=function(e){He.assertOrUndefined(e,"fieldRef",[[we.PDFRef,"PDFRef"]]),this.dirtyFields.delete(e)},t.prototype.fieldIsDirty=function(e){return He.assertOrUndefined(e,"fieldRef",[[we.PDFRef,"PDFRef"]]),this.dirtyFields.has(e)},t.prototype.getDefaultFont=function(){return this.defaultFontCache.access()},t.prototype.findWidgetPage=function(e){var r=e.P(),n=this.doc.getPages().find(function(a){return a.ref===r});if(n===void 0){var i=this.doc.context.getObjectRef(e.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},t.prototype.findWidgetAppearanceRef=function(e,r){var n,i=r.getNormalAppearance();if(i instanceof we.PDFDict&&(e instanceof Es.default||e instanceof Ss.default)){var a=e.acroField.getValue(),o=(n=i.get(a))!==null&&n!==void 0?n:i.get(we.PDFName.of("Off"));o instanceof we.PDFRef&&(i=o)}if(!(i instanceof we.PDFRef)){var s=e.getName();throw new Error("Failed to extract appearance ref for: "+s)}return i},t.prototype.findOrCreateNonTerminals=function(e){for(var r=[this.acroForm],n=0,i=e.length;n<i;n++){var a=e[n];if(!a)throw new Sr.InvalidFieldNamePartError(a);var o=r[0],s=r[1],l=this.findNonTerminal(a,o);if(l)r=l;else{var u=we.PDFAcroNonTerminal.create(this.doc.context);u.setPartialName(a),u.setParent(s);var c=this.doc.context.register(u.dict);o.addField(c),r=[u,c]}}return r},t.prototype.findNonTerminal=function(e,r){for(var n=r instanceof we.PDFAcroForm?this.acroForm.getFields():we.createPDFAcroFields(r.Kids()),i=0,a=n.length;i<a;i++){var o=n[i],s=o[0],l=o[1];if(s.getPartialName()===e){if(s instanceof we.PDFAcroNonTerminal)return[s,l];throw new Sr.FieldAlreadyExistsError(e)}}},t.of=function(e,r){return new t(e,r)},t})();G0.default=K3;var X3=function(t,e,r){if(t instanceof we.PDFAcroPushButton)return Rl.default.of(t,e,r);if(t instanceof we.PDFAcroCheckBox)return Es.default.of(t,e,r);if(t instanceof we.PDFAcroComboBox)return Bl.default.of(t,e,r);if(t instanceof we.PDFAcroListBox)return Nl.default.of(t,e,r);if(t instanceof we.PDFAcroText)return Il.default.of(t,e,r);if(t instanceof we.PDFAcroRadioButton)return Ss.default.of(t,e,r);if(t instanceof we.PDFAcroSignature)return L0.default.of(t,e,r)},Ya=function(t){if(t.length===0)throw new Error("PDF field names must not be empty strings");for(var e=t.split("."),r=0,n=e.length;r<n;r++)if(e[r]==="")throw new Error('Periods in PDF field names must be separated by at least one character: "'+t+'"');return e.length===1?{nonTerminal:[],terminal:e[0]}:{nonTerminal:e.slice(0,e.length-1),terminal:e[e.length-1]}},Ja=function(t,e,r){for(var n=t[0],i=t[1],a=e[0],o=e[1],s=n.normalizedEntries(),l=we.createPDFAcroFields("Kids"in s?s.Kids:s.Fields),u=0,c=l.length;u<c;u++)if(l[u][0].getPartialName()===r)throw new Sr.FieldAlreadyExistsError(r);n.addField(o),a.setParent(i)}});var X0=D(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.PageSizes=void 0;ql.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 Z0=D(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.ParseSpeeds=void 0;var Z3;(function(t){t[t.Fastest=1/0]="Fastest",t[t.Fast=1500]="Fast",t[t.Medium=500]="Medium",t[t.Slow=100]="Slow"})(Z3=Os.ParseSpeeds||(Os.ParseSpeeds={}))});var CF=D(Y0=>{"use strict";Object.defineProperty(Y0,"__esModule",{value:!0});var _F=(k(),R(T)),mt=et(),Y3=(function(){function t(e,r,n){this.alreadyEmbedded=!1,this.ref=e,this.doc=r,this.embedder=n}return t.prototype.embed=function(){return _F.__awaiter(this,void 0,void 0,function(){var e,r,n,i,a;return _F.__generator(this,function(o){switch(o.label){case 0:return this.alreadyEmbedded?[3,2]:[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:e=o.sent(),this.doc.catalog.has(mt.PDFName.of("Names"))||this.doc.catalog.set(mt.PDFName.of("Names"),this.doc.context.obj({})),r=this.doc.catalog.lookup(mt.PDFName.of("Names"),mt.PDFDict),r.has(mt.PDFName.of("EmbeddedFiles"))||r.set(mt.PDFName.of("EmbeddedFiles"),this.doc.context.obj({})),n=r.lookup(mt.PDFName.of("EmbeddedFiles"),mt.PDFDict),n.has(mt.PDFName.of("Names"))||n.set(mt.PDFName.of("Names"),this.doc.context.obj([])),i=n.lookup(mt.PDFName.of("Names"),mt.PDFArray),i.push(mt.PDFHexString.fromText(this.embedder.fileName)),i.push(e),this.doc.catalog.has(mt.PDFName.of("AF"))||this.doc.catalog.set(mt.PDFName.of("AF"),this.doc.context.obj([])),a=this.doc.catalog.lookup(mt.PDFName.of("AF"),mt.PDFArray),a.push(e),this.alreadyEmbedded=!0,o.label=2;case 2:return[2]}})})},t.of=function(e,r,n){return new t(e,r,n)},t})();Y0.default=Y3});var Q0=D(J0=>{"use strict";Object.defineProperty(J0,"__esModule",{value:!0});var wF=(k(),R(T)),Jt=et(),J3=(function(){function t(e,r,n){this.alreadyEmbedded=!1,this.ref=e,this.doc=r,this.embedder=n}return t.prototype.embed=function(){return wF.__awaiter(this,void 0,void 0,function(){var e,r,n,i,a,o,s;return wF.__generator(this,function(l){switch(l.label){case 0:return this.alreadyEmbedded?[3,2]:(e=this.doc,r=e.catalog,n=e.context,[4,this.embedder.embedIntoContext(this.doc.context,this.ref)]);case 1:i=l.sent(),r.has(Jt.PDFName.of("Names"))||r.set(Jt.PDFName.of("Names"),n.obj({})),a=r.lookup(Jt.PDFName.of("Names"),Jt.PDFDict),a.has(Jt.PDFName.of("JavaScript"))||a.set(Jt.PDFName.of("JavaScript"),n.obj({})),o=a.lookup(Jt.PDFName.of("JavaScript"),Jt.PDFDict),o.has(Jt.PDFName.of("Names"))||o.set(Jt.PDFName.of("Names"),n.obj([])),s=o.lookup(Jt.PDFName.of("Names"),Jt.PDFArray),s.push(Jt.PDFHexString.fromText(this.embedder.scriptName)),s.push(i),this.alreadyEmbedded=!0,l.label=2;case 2:return[2]}})})},t.of=function(e,r,n){return new t(e,r,n)},t})();J0.default=J3});var PF=D(ep=>{"use strict";Object.defineProperty(ep,"__esModule",{value:!0});var $0=(k(),R(T)),Q3=$0.__importDefault(kt()),$3=(function(){function t(e,r){this.script=e,this.scriptName=r}return t.for=function(e,r){return new t(e,r)},t.prototype.embedIntoContext=function(e,r){return $0.__awaiter(this,void 0,void 0,function(){var n;return $0.__generator(this,function(i){return n=e.obj({Type:"Action",S:"JavaScript",JS:Q3.default.fromText(this.script)}),r?(e.assign(r,n),[2,r]):[2,e.register(n)]})})},t})();ep.default=$3});var Xn=D(tp=>{"use strict";Object.defineProperty(tp,"__esModule",{value:!0});var de=(k(),R(T)),jl=Ha(),eT=de.__importDefault(_l()),EF=de.__importDefault(bn()),SF=de.__importDefault(wl()),Qa=de.__importDefault(_n()),tT=de.__importDefault(H0()),rT=X0(),te=et(),nT=Z0(),Y=ae(),OF=de.__importStar(Nd()),iT=de.__importDefault(CF()),aT=de.__importDefault(Q0()),oT=de.__importDefault(PF()),sT=(function(){function t(e,r,n){var i=this;if(this.defaultWordBreaks=[" "],this.computePages=function(){var a=[];return i.catalog.Pages().traverse(function(o,s){if(o instanceof te.PDFPageLeaf){var l=i.pageMap.get(o);l||(l=Qa.default.of(o,s,i),i.pageMap.set(o,l)),a.push(l)}}),a},this.getOrCreateForm=function(){var a=i.catalog.getOrCreateAcroForm();return tT.default.of(a,i)},Y.assertIs(e,"context",[[te.PDFContext,"PDFContext"]]),Y.assertIs(r,"ignoreEncryption",["boolean"]),this.context=e,this.catalog=e.lookup(e.trailerInfo.Root),this.isEncrypted=!!e.lookup(e.trailerInfo.Encrypt),this.pageCache=Y.Cache.populatedBy(this.computePages),this.pageMap=new Map,this.formCache=Y.Cache.populatedBy(this.getOrCreateForm),this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!r&&this.isEncrypted)throw new jl.EncryptedPDFError;n&&this.updateInfoDict()}return t.load=function(e,r){return r===void 0&&(r={}),de.__awaiter(this,void 0,void 0,function(){var n,i,a,o,s,l,u,c,f,d,p,h;return de.__generator(this,function(v){switch(v.label){case 0:return n=r.ignoreEncryption,i=n===void 0?!1:n,a=r.parseSpeed,o=a===void 0?nT.ParseSpeeds.Slow:a,s=r.throwOnInvalidObject,l=s===void 0?!1:s,u=r.updateMetadata,c=u===void 0?!0:u,f=r.capNumbers,d=f===void 0?!1:f,Y.assertIs(e,"pdf",["string",Uint8Array,ArrayBuffer]),Y.assertIs(i,"ignoreEncryption",["boolean"]),Y.assertIs(o,"parseSpeed",["number"]),Y.assertIs(l,"throwOnInvalidObject",["boolean"]),p=Y.toUint8Array(e),[4,te.PDFParser.forBytesWithOptions(p,o,l,d).parseDocument()];case 1:return h=v.sent(),[2,new t(h,i,c)]}})})},t.create=function(e){return e===void 0&&(e={}),de.__awaiter(this,void 0,void 0,function(){var r,n,i,a,o,s;return de.__generator(this,function(l){return r=e.updateMetadata,n=r===void 0?!0:r,i=te.PDFContext.create(),a=te.PDFPageTree.withContext(i),o=i.register(a),s=te.PDFCatalog.withContextAndPages(i,o),i.trailerInfo.Root=i.register(s),[2,new t(i,!1,n)]})})},t.prototype.registerFontkit=function(e){this.fontkit=e},t.prototype.getForm=function(){var e=this.formCache.access();return e.hasXFA()&&(console.warn("Removing XFA form data as pdf-lib does not support reading or writing XFA"),e.deleteXFA()),e},t.prototype.getTitle=function(){var e=this.getInfoDict().lookup(te.PDFName.Title);if(e)return Zn(e),e.decodeText()},t.prototype.getAuthor=function(){var e=this.getInfoDict().lookup(te.PDFName.Author);if(e)return Zn(e),e.decodeText()},t.prototype.getSubject=function(){var e=this.getInfoDict().lookup(te.PDFName.Subject);if(e)return Zn(e),e.decodeText()},t.prototype.getKeywords=function(){var e=this.getInfoDict().lookup(te.PDFName.Keywords);if(e)return Zn(e),e.decodeText()},t.prototype.getCreator=function(){var e=this.getInfoDict().lookup(te.PDFName.Creator);if(e)return Zn(e),e.decodeText()},t.prototype.getProducer=function(){var e=this.getInfoDict().lookup(te.PDFName.Producer);if(e)return Zn(e),e.decodeText()},t.prototype.getCreationDate=function(){var e=this.getInfoDict().lookup(te.PDFName.CreationDate);if(e)return Zn(e),e.decodeDate()},t.prototype.getModificationDate=function(){var e=this.getInfoDict().lookup(te.PDFName.ModDate);if(e)return Zn(e),e.decodeDate()},t.prototype.setTitle=function(e,r){Y.assertIs(e,"title",["string"]);var n=te.PDFName.of("Title");if(this.getInfoDict().set(n,te.PDFHexString.fromText(e)),r?.showInWindowTitleBar){var i=this.catalog.getOrCreateViewerPreferences();i.setDisplayDocTitle(!0)}},t.prototype.setAuthor=function(e){Y.assertIs(e,"author",["string"]);var r=te.PDFName.of("Author");this.getInfoDict().set(r,te.PDFHexString.fromText(e))},t.prototype.setSubject=function(e){Y.assertIs(e,"author",["string"]);var r=te.PDFName.of("Subject");this.getInfoDict().set(r,te.PDFHexString.fromText(e))},t.prototype.setKeywords=function(e){Y.assertIs(e,"keywords",[Array]);var r=te.PDFName.of("Keywords");this.getInfoDict().set(r,te.PDFHexString.fromText(e.join(" ")))},t.prototype.setCreator=function(e){Y.assertIs(e,"creator",["string"]);var r=te.PDFName.of("Creator");this.getInfoDict().set(r,te.PDFHexString.fromText(e))},t.prototype.setProducer=function(e){Y.assertIs(e,"creator",["string"]);var r=te.PDFName.of("Producer");this.getInfoDict().set(r,te.PDFHexString.fromText(e))},t.prototype.setLanguage=function(e){Y.assertIs(e,"language",["string"]);var r=te.PDFName.of("Lang");this.catalog.set(r,te.PDFString.of(e))},t.prototype.setCreationDate=function(e){Y.assertIs(e,"creationDate",[[Date,"Date"]]);var r=te.PDFName.of("CreationDate");this.getInfoDict().set(r,te.PDFString.fromDate(e))},t.prototype.setModificationDate=function(e){Y.assertIs(e,"modificationDate",[[Date,"Date"]]);var r=te.PDFName.of("ModDate");this.getInfoDict().set(r,te.PDFString.fromDate(e))},t.prototype.getPageCount=function(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount},t.prototype.getPages=function(){return this.pageCache.access()},t.prototype.getPage=function(e){var r=this.getPages();return Y.assertRange(e,"index",0,r.length-1),r[e]},t.prototype.getPageIndices=function(){return Y.range(0,this.getPageCount())},t.prototype.removePage=function(e){var r=this.getPageCount();if(this.pageCount===0)throw new jl.RemovePageFromEmptyDocumentError;Y.assertRange(e,"index",0,r-1),this.catalog.removeLeafNode(e),this.pageCount=r-1},t.prototype.addPage=function(e){return Y.assertIs(e,"page",["undefined",[Qa.default,"PDFPage"],Array]),this.insertPage(this.getPageCount(),e)},t.prototype.insertPage=function(e,r){var n=this.getPageCount();if(Y.assertRange(e,"index",0,n),Y.assertIs(r,"page",["undefined",[Qa.default,"PDFPage"],Array]),!r||Array.isArray(r)){var i=Array.isArray(r)?r:rT.PageSizes.A4;r=Qa.default.create(this),r.setSize.apply(r,i)}else if(r.doc!==this)throw new jl.ForeignPageError;var a=this.catalog.insertLeafNode(r.ref,e);return r.node.setParent(a),this.pageMap.set(r.node,r),this.pageCache.invalidate(),this.pageCount=n+1,r},t.prototype.copyPages=function(e,r){return de.__awaiter(this,void 0,void 0,function(){var n,i,a,o,s,l,u,c;return de.__generator(this,function(f){switch(f.label){case 0:return Y.assertIs(e,"srcDoc",[[t,"PDFDocument"]]),Y.assertIs(r,"indices",[Array]),[4,e.flush()];case 1:for(f.sent(),n=te.PDFObjectCopier.for(e.context,this.context),i=e.getPages(),a=new Array(r.length),o=0,s=r.length;o<s;o++)l=i[r[o]],u=n.copy(l.node),c=this.context.register(u),a[o]=Qa.default.of(u,c,this);return[2,a]}})})},t.prototype.copy=function(){return de.__awaiter(this,void 0,void 0,function(){var e,r,n,i;return de.__generator(this,function(a){switch(a.label){case 0:return[4,t.create()];case 1:return e=a.sent(),[4,e.copyPages(this,this.getPageIndices())];case 2:for(r=a.sent(),n=0,i=r.length;n<i;n++)e.addPage(r[n]);return this.getAuthor()!==void 0&&e.setAuthor(this.getAuthor()),this.getCreationDate()!==void 0&&e.setCreationDate(this.getCreationDate()),this.getCreator()!==void 0&&e.setCreator(this.getCreator()),this.getModificationDate()!==void 0&&e.setModificationDate(this.getModificationDate()),this.getProducer()!==void 0&&e.setProducer(this.getProducer()),this.getSubject()!==void 0&&e.setSubject(this.getSubject()),this.getTitle()!==void 0&&e.setTitle(this.getTitle()),e.defaultWordBreaks=this.defaultWordBreaks,[2,e]}})})},t.prototype.addJavaScript=function(e,r){Y.assertIs(e,"name",["string"]),Y.assertIs(r,"script",["string"]);var n=oT.default.for(r,e),i=this.context.nextRef(),a=aT.default.of(i,this,n);this.javaScripts.push(a)},t.prototype.attach=function(e,r,n){return n===void 0&&(n={}),de.__awaiter(this,void 0,void 0,function(){var i,a,o,s;return de.__generator(this,function(l){return Y.assertIs(e,"attachment",["string",Uint8Array,ArrayBuffer]),Y.assertIs(r,"name",["string"]),Y.assertOrUndefined(n.mimeType,"mimeType",["string"]),Y.assertOrUndefined(n.description,"description",["string"]),Y.assertOrUndefined(n.creationDate,"options.creationDate",[Date]),Y.assertOrUndefined(n.modificationDate,"options.modificationDate",[Date]),Y.assertIsOneOfOrUndefined(n.afRelationship,"options.afRelationship",OF.AFRelationship),i=Y.toUint8Array(e),a=OF.default.for(i,r,n),o=this.context.nextRef(),s=iT.default.of(o,this,a),this.embeddedFiles.push(s),[2]})})},t.prototype.embedFont=function(e,r){return r===void 0&&(r={}),de.__awaiter(this,void 0,void 0,function(){var n,i,a,o,s,l,u,c,f,d;return de.__generator(this,function(p){switch(p.label){case 0:return n=r.subset,i=n===void 0?!1:n,a=r.customName,o=r.features,Y.assertIs(e,"font",["string",Uint8Array,ArrayBuffer]),Y.assertIs(i,"subset",["boolean"]),Y.isStandardFont(e)?(s=te.StandardFontEmbedder.for(e,a),[3,7]):[3,1];case 1:return Y.canBeConvertedToUint8Array(e)?(l=Y.toUint8Array(e),u=this.assertFontkit(),i?[4,te.CustomFontSubsetEmbedder.for(u,l,a,o)]:[3,3]):[3,6];case 2:return c=p.sent(),[3,5];case 3:return[4,te.CustomFontEmbedder.for(u,l,a,o)];case 4:c=p.sent(),p.label=5;case 5:return s=c,[3,7];case 6:throw new TypeError("`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`");case 7:return f=this.context.nextRef(),d=EF.default.of(f,this,s),this.fonts.push(d),[2,d]}})})},t.prototype.embedStandardFont=function(e,r){if(Y.assertIs(e,"font",["string"]),!Y.isStandardFont(e))throw new TypeError("`font` must be one of type `StandardFonts`");var n=te.StandardFontEmbedder.for(e,r),i=this.context.nextRef(),a=EF.default.of(i,this,n);return this.fonts.push(a),a},t.prototype.embedJpg=function(e){return de.__awaiter(this,void 0,void 0,function(){var r,n,i,a;return de.__generator(this,function(o){switch(o.label){case 0:return Y.assertIs(e,"jpg",["string",Uint8Array,ArrayBuffer]),r=Y.toUint8Array(e),[4,te.JpegEmbedder.for(r)];case 1:return n=o.sent(),i=this.context.nextRef(),a=SF.default.of(i,this,n),this.images.push(a),[2,a]}})})},t.prototype.embedPng=function(e){return de.__awaiter(this,void 0,void 0,function(){var r,n,i,a;return de.__generator(this,function(o){switch(o.label){case 0:return Y.assertIs(e,"png",["string",Uint8Array,ArrayBuffer]),r=Y.toUint8Array(e),[4,te.PngEmbedder.for(r)];case 1:return n=o.sent(),i=this.context.nextRef(),a=SF.default.of(i,this,n),this.images.push(a),[2,a]}})})},t.prototype.embedPdf=function(e,r){return r===void 0&&(r=[0]),de.__awaiter(this,void 0,void 0,function(){var n,i,a;return de.__generator(this,function(o){switch(o.label){case 0:return Y.assertIs(e,"pdf",["string",Uint8Array,ArrayBuffer,[t,"PDFDocument"]]),Y.assertIs(r,"indices",[Array]),e instanceof t?(i=e,[3,3]):[3,1];case 1:return[4,t.load(e)];case 2:i=o.sent(),o.label=3;case 3:return n=i,a=Y.pluckIndices(n.getPages(),r),[2,this.embedPages(a)]}})})},t.prototype.embedPage=function(e,r,n){return de.__awaiter(this,void 0,void 0,function(){var i;return de.__generator(this,function(a){switch(a.label){case 0:return Y.assertIs(e,"page",[[Qa.default,"PDFPage"]]),[4,this.embedPages([e],[r],[n])];case 1:return i=a.sent()[0],[2,i]}})})},t.prototype.embedPages=function(e,r,n){return r===void 0&&(r=[]),n===void 0&&(n=[]),de.__awaiter(this,void 0,void 0,function(){var u,c,i,a,o,s,l,u,c,f,d,p,h,v,g;return de.__generator(this,function(m){switch(m.label){case 0:if(e.length===0)return[2,[]];for(u=0,c=e.length-1;u<c;u++)if(i=e[u],a=e[u+1],i.node.context!==a.node.context)throw new te.PageEmbeddingMismatchedContextError;o=e[0].node.context,s=o===this.context?function(b){return b}:te.PDFObjectCopier.for(o,this.context).copy,l=new Array(e.length),u=0,c=e.length,m.label=1;case 1:return u<c?(f=s(e[u].node),d=r[u],p=n[u],[4,te.PDFPageEmbedder.for(f,d,p)]):[3,4];case 2:h=m.sent(),v=this.context.nextRef(),l[u]=eT.default.of(v,this,h),m.label=3;case 3:return u++,[3,1];case 4:return(g=this.embeddedPages).push.apply(g,l),[2,l]}})})},t.prototype.flush=function(){return de.__awaiter(this,void 0,void 0,function(){return de.__generator(this,function(e){switch(e.label){case 0:return[4,this.embedAll(this.fonts)];case 1:return e.sent(),[4,this.embedAll(this.images)];case 2:return e.sent(),[4,this.embedAll(this.embeddedPages)];case 3:return e.sent(),[4,this.embedAll(this.embeddedFiles)];case 4:return e.sent(),[4,this.embedAll(this.javaScripts)];case 5:return e.sent(),[2]}})})},t.prototype.save=function(e){return e===void 0&&(e={}),de.__awaiter(this,void 0,void 0,function(){var r,n,i,a,o,s,l,u,c,f;return de.__generator(this,function(d){switch(d.label){case 0:return r=e.useObjectStreams,n=r===void 0?!0:r,i=e.addDefaultPage,a=i===void 0?!0:i,o=e.objectsPerTick,s=o===void 0?50:o,l=e.updateFieldAppearances,u=l===void 0?!0:l,Y.assertIs(n,"useObjectStreams",["boolean"]),Y.assertIs(a,"addDefaultPage",["boolean"]),Y.assertIs(s,"objectsPerTick",["number"]),Y.assertIs(u,"updateFieldAppearances",["boolean"]),a&&this.getPageCount()===0&&this.addPage(),u&&(c=this.formCache.getValue(),c&&c.updateFieldAppearances()),[4,this.flush()];case 1:return d.sent(),f=n?te.PDFStreamWriter:te.PDFWriter,[2,f.forContext(this.context,s).serializeToBuffer()]}})})},t.prototype.saveAsBase64=function(e){return e===void 0&&(e={}),de.__awaiter(this,void 0,void 0,function(){var r,n,i,a,o;return de.__generator(this,function(s){switch(s.label){case 0:return r=e.dataUri,n=r===void 0?!1:r,i=de.__rest(e,["dataUri"]),Y.assertIs(n,"dataUri",["boolean"]),[4,this.save(i)];case 1:return a=s.sent(),o=Y.encodeToBase64(a),[2,n?"data:application/pdf;base64,"+o:o]}})})},t.prototype.findPageForAnnotationRef=function(e){for(var r=this.getPages(),n=0,i=r.length;n<i;n++){var a=r[n],o=a.node.Annots();if(o?.indexOf(e)!==void 0)return a}},t.prototype.embedAll=function(e){return de.__awaiter(this,void 0,void 0,function(){var r,n;return de.__generator(this,function(i){switch(i.label){case 0:r=0,n=e.length,i.label=1;case 1:return r<n?[4,e[r].embed()]:[3,4];case 2:i.sent(),i.label=3;case 3:return r++,[3,1];case 4:return[2]}})})},t.prototype.updateInfoDict=function(){var e="pdf-lib (https://github.com/Hopding/pdf-lib)",r=new Date,n=this.getInfoDict();this.setProducer(e),this.setModificationDate(r),n.get(te.PDFName.of("Creator"))||this.setCreator(e),n.get(te.PDFName.of("CreationDate"))||this.setCreationDate(r)},t.prototype.getInfoDict=function(){var e=this.context.lookup(this.context.trailerInfo.Info);if(e instanceof te.PDFDict)return e;var r=this.context.obj({});return this.context.trailerInfo.Info=this.context.register(r),r},t.prototype.assertFontkit=function(){if(!this.fontkit)throw new jl.FontkitNotRegisteredError;return this.fontkit},t})();tp.default=sT;function Zn(t){if(!(t instanceof te.PDFHexString)&&!(t instanceof te.PDFString))throw new te.UnexpectedObjectTypeError([te.PDFHexString,te.PDFString],t)}});var rp=D(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.BlendMode=void 0;var uT;(function(t){t.Normal="Normal",t.Multiply="Multiply",t.Screen="Screen",t.Overlay="Overlay",t.Darken="Darken",t.Lighten="Lighten",t.ColorDodge="ColorDodge",t.ColorBurn="ColorBurn",t.HardLight="HardLight",t.SoftLight="SoftLight",t.Difference="Difference",t.Exclusion="Exclusion"})(uT=As.BlendMode||(As.BlendMode={}))});var _n=D(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});var Yn=(k(),R(T)),Ts=ur(),Ni=Ga(),Yr=Wn(),AF=Yn.__importDefault(Xn()),lT=Yn.__importDefault(_l()),TF=Yn.__importDefault(bn()),cT=Yn.__importDefault(wl()),Ii=rp(),St=Zt(),fT=Tl(),ft=et(),_=ae(),dT=(function(){function t(e,r,n){this.fontSize=24,this.fontColor=Ts.rgb(0,0,0),this.lineHeight=24,this.x=0,this.y=0,_.assertIs(e,"leafNode",[[ft.PDFPageLeaf,"PDFPageLeaf"]]),_.assertIs(r,"ref",[[ft.PDFRef,"PDFRef"]]),_.assertIs(n,"doc",[[AF.default,"PDFDocument"]]),this.node=e,this.ref=r,this.doc=n}return t.prototype.setRotation=function(e){var r=St.toDegrees(e);_.assertMultiple(r,"degreesAngle",90),this.node.set(ft.PDFName.of("Rotate"),this.doc.context.obj(r))},t.prototype.getRotation=function(){var e=this.node.Rotate();return St.degrees(e?e.asNumber():0)},t.prototype.setSize=function(e,r){_.assertIs(e,"width",["number"]),_.assertIs(r,"height",["number"]);var n=this.getMediaBox();this.setMediaBox(n.x,n.y,e,r);var i=this.getCropBox(),a=this.getBleedBox(),o=this.getTrimBox(),s=this.getArtBox(),l=this.node.CropBox(),u=this.node.BleedBox(),c=this.node.TrimBox(),f=this.node.ArtBox();l&&_.rectanglesAreEqual(i,n)&&this.setCropBox(n.x,n.y,e,r),u&&_.rectanglesAreEqual(a,n)&&this.setBleedBox(n.x,n.y,e,r),c&&_.rectanglesAreEqual(o,n)&&this.setTrimBox(n.x,n.y,e,r),f&&_.rectanglesAreEqual(s,n)&&this.setArtBox(n.x,n.y,e,r)},t.prototype.setWidth=function(e){_.assertIs(e,"width",["number"]),this.setSize(e,this.getSize().height)},t.prototype.setHeight=function(e){_.assertIs(e,"height",["number"]),this.setSize(this.getSize().width,e)},t.prototype.setMediaBox=function(e,r,n,i){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),_.assertIs(n,"width",["number"]),_.assertIs(i,"height",["number"]);var a=this.doc.context.obj([e,r,e+n,r+i]);this.node.set(ft.PDFName.MediaBox,a)},t.prototype.setCropBox=function(e,r,n,i){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),_.assertIs(n,"width",["number"]),_.assertIs(i,"height",["number"]);var a=this.doc.context.obj([e,r,e+n,r+i]);this.node.set(ft.PDFName.CropBox,a)},t.prototype.setBleedBox=function(e,r,n,i){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),_.assertIs(n,"width",["number"]),_.assertIs(i,"height",["number"]);var a=this.doc.context.obj([e,r,e+n,r+i]);this.node.set(ft.PDFName.BleedBox,a)},t.prototype.setTrimBox=function(e,r,n,i){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),_.assertIs(n,"width",["number"]),_.assertIs(i,"height",["number"]);var a=this.doc.context.obj([e,r,e+n,r+i]);this.node.set(ft.PDFName.TrimBox,a)},t.prototype.setArtBox=function(e,r,n,i){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),_.assertIs(n,"width",["number"]),_.assertIs(i,"height",["number"]);var a=this.doc.context.obj([e,r,e+n,r+i]);this.node.set(ft.PDFName.ArtBox,a)},t.prototype.getSize=function(){var e=this.getMediaBox(),r=e.width,n=e.height;return{width:r,height:n}},t.prototype.getWidth=function(){return this.getSize().width},t.prototype.getHeight=function(){return this.getSize().height},t.prototype.getMediaBox=function(){var e=this.node.MediaBox();return e.asRectangle()},t.prototype.getCropBox=function(){var e,r=this.node.CropBox();return(e=r?.asRectangle())!==null&&e!==void 0?e:this.getMediaBox()},t.prototype.getBleedBox=function(){var e,r=this.node.BleedBox();return(e=r?.asRectangle())!==null&&e!==void 0?e:this.getCropBox()},t.prototype.getTrimBox=function(){var e,r=this.node.TrimBox();return(e=r?.asRectangle())!==null&&e!==void 0?e:this.getCropBox()},t.prototype.getArtBox=function(){var e,r=this.node.ArtBox();return(e=r?.asRectangle())!==null&&e!==void 0?e:this.getCropBox()},t.prototype.translateContent=function(e,r){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(Yr.pushGraphicsState(),Yr.translate(e,r)),i=this.doc.context.register(n),a=this.createContentStream(Yr.popGraphicsState()),o=this.doc.context.register(a);this.node.wrapContentStreams(i,o)},t.prototype.scale=function(e,r){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),this.setSize(this.getWidth()*e,this.getHeight()*r),this.scaleContent(e,r),this.scaleAnnotations(e,r)},t.prototype.scaleContent=function(e,r){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(Yr.pushGraphicsState(),Yr.scale(e,r)),i=this.doc.context.register(n),a=this.createContentStream(Yr.popGraphicsState()),o=this.doc.context.register(a);this.node.wrapContentStreams(i,o)},t.prototype.scaleAnnotations=function(e,r){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]);var n=this.node.Annots();if(n)for(var i=0;i<n.size();i++){var a=n.lookup(i);a instanceof ft.PDFDict&&this.scaleAnnot(a,e,r)}},t.prototype.resetPosition=function(){this.getContentStream(!1),this.x=0,this.y=0},t.prototype.setFont=function(e){_.assertIs(e,"font",[[TF.default,"PDFFont"]]),this.font=e,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)},t.prototype.setFontSize=function(e){_.assertIs(e,"fontSize",["number"]),this.fontSize=e},t.prototype.setFontColor=function(e){_.assertIs(e,"fontColor",[[Object,"Color"]]),this.fontColor=e},t.prototype.setLineHeight=function(e){_.assertIs(e,"lineHeight",["number"]),this.lineHeight=e},t.prototype.getPosition=function(){return{x:this.x,y:this.y}},t.prototype.getX=function(){return this.x},t.prototype.getY=function(){return this.y},t.prototype.moveTo=function(e,r){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),this.x=e,this.y=r},t.prototype.moveDown=function(e){_.assertIs(e,"yDecrease",["number"]),this.y-=e},t.prototype.moveUp=function(e){_.assertIs(e,"yIncrease",["number"]),this.y+=e},t.prototype.moveLeft=function(e){_.assertIs(e,"xDecrease",["number"]),this.x-=e},t.prototype.moveRight=function(e){_.assertIs(e,"xIncrease",["number"]),this.x+=e},t.prototype.pushOperators=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];_.assertEachIs(e,"operator",[[ft.PDFOperator,"PDFOperator"]]);var n=this.getContentStream();n.push.apply(n,e)},t.prototype.drawText=function(e,r){var n,i,a,o,s,l,u;r===void 0&&(r={}),_.assertIs(e,"text",["string"]),_.assertOrUndefined(r.color,"options.color",[[Object,"Color"]]),_.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),_.assertOrUndefined(r.font,"options.font",[[TF.default,"PDFFont"]]),_.assertOrUndefined(r.size,"options.size",["number"]),_.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),_.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),_.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),_.assertOrUndefined(r.x,"options.x",["number"]),_.assertOrUndefined(r.y,"options.y",["number"]),_.assertOrUndefined(r.lineHeight,"options.lineHeight",["number"]),_.assertOrUndefined(r.maxWidth,"options.maxWidth",["number"]),_.assertOrUndefined(r.wordBreaks,"options.wordBreaks",[Array]),_.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ii.BlendMode);for(var c=this.setOrEmbedFont(r.font),f=c.oldFont,d=c.newFont,p=c.newFontKey,h=r.size||this.fontSize,v=r.wordBreaks||this.doc.defaultWordBreaks,g=function(S){return d.widthOfTextAtSize(S,h)},m=r.maxWidth===void 0?_.lineSplit(_.cleanText(e)):_.breakTextIntoLines(e,v,r.maxWidth,g),b=new Array(m.length),w=0,F=m.length;w<F;w++)b[w]=d.encodeText(m[w]);var y=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),C=this.getContentStream();C.push.apply(C,Ni.drawLinesOfText(b,{color:(n=r.color)!==null&&n!==void 0?n:this.fontColor,font:p,size:h,rotate:(i=r.rotate)!==null&&i!==void 0?i:St.degrees(0),xSkew:(a=r.xSkew)!==null&&a!==void 0?a:St.degrees(0),ySkew:(o=r.ySkew)!==null&&o!==void 0?o:St.degrees(0),x:(s=r.x)!==null&&s!==void 0?s:this.x,y:(l=r.y)!==null&&l!==void 0?l:this.y,lineHeight:(u=r.lineHeight)!==null&&u!==void 0?u:this.lineHeight,graphicsState:y})),r.font&&(f?this.setFont(f):this.resetFont())},t.prototype.drawImage=function(e,r){var n,i,a,o,s,l,u;r===void 0&&(r={}),_.assertIs(e,"image",[[cT.default,"PDFImage"]]),_.assertOrUndefined(r.x,"options.x",["number"]),_.assertOrUndefined(r.y,"options.y",["number"]),_.assertOrUndefined(r.width,"options.width",["number"]),_.assertOrUndefined(r.height,"options.height",["number"]),_.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),_.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),_.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),_.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),_.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ii.BlendMode);var c=this.node.newXObject("Image",e.ref),f=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),d=this.getContentStream();d.push.apply(d,Ni.drawImage(c,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,width:(a=r.width)!==null&&a!==void 0?a:e.size().width,height:(o=r.height)!==null&&o!==void 0?o:e.size().height,rotate:(s=r.rotate)!==null&&s!==void 0?s:St.degrees(0),xSkew:(l=r.xSkew)!==null&&l!==void 0?l:St.degrees(0),ySkew:(u=r.ySkew)!==null&&u!==void 0?u:St.degrees(0),graphicsState:f}))},t.prototype.drawPage=function(e,r){var n,i,a,o,s;r===void 0&&(r={}),_.assertIs(e,"embeddedPage",[[lT.default,"PDFEmbeddedPage"]]),_.assertOrUndefined(r.x,"options.x",["number"]),_.assertOrUndefined(r.y,"options.y",["number"]),_.assertOrUndefined(r.xScale,"options.xScale",["number"]),_.assertOrUndefined(r.yScale,"options.yScale",["number"]),_.assertOrUndefined(r.width,"options.width",["number"]),_.assertOrUndefined(r.height,"options.height",["number"]),_.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),_.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),_.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),_.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),_.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ii.BlendMode);var l=this.node.newXObject("EmbeddedPdfPage",e.ref),u=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),c=r.width!==void 0?r.width/e.width:r.xScale!==void 0?r.xScale:1,f=r.height!==void 0?r.height/e.height:r.yScale!==void 0?r.yScale:1,d=this.getContentStream();d.push.apply(d,Ni.drawPage(l,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,xScale:c,yScale:f,rotate:(a=r.rotate)!==null&&a!==void 0?a:St.degrees(0),xSkew:(o=r.xSkew)!==null&&o!==void 0?o:St.degrees(0),ySkew:(s=r.ySkew)!==null&&s!==void 0?s:St.degrees(0),graphicsState:u}))},t.prototype.drawSvgPath=function(e,r){var n,i,a,o,s,l,u,c,f;r===void 0&&(r={}),_.assertIs(e,"path",["string"]),_.assertOrUndefined(r.x,"options.x",["number"]),_.assertOrUndefined(r.y,"options.y",["number"]),_.assertOrUndefined(r.scale,"options.scale",["number"]),_.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),_.assertOrUndefined(r.borderWidth,"options.borderWidth",["number"]),_.assertOrUndefined(r.color,"options.color",[[Object,"Color"]]),_.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),_.assertOrUndefined(r.borderColor,"options.borderColor",[[Object,"Color"]]),_.assertOrUndefined(r.borderDashArray,"options.borderDashArray",[Array]),_.assertOrUndefined(r.borderDashPhase,"options.borderDashPhase",["number"]),_.assertIsOneOfOrUndefined(r.borderLineCap,"options.borderLineCap",Yr.LineCapStyle),_.assertRangeOrUndefined(r.borderOpacity,"options.borderOpacity",0,1),_.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ii.BlendMode);var d=this.maybeEmbedGraphicsState({opacity:r.opacity,borderOpacity:r.borderOpacity,blendMode:r.blendMode});!("color"in r)&&!("borderColor"in r)&&(r.borderColor=Ts.rgb(0,0,0));var p=this.getContentStream();p.push.apply(p,Ni.drawSvgPath(e,{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:(a=r.rotate)!==null&&a!==void 0?a:St.degrees(0),color:(o=r.color)!==null&&o!==void 0?o:void 0,borderColor:(s=r.borderColor)!==null&&s!==void 0?s:void 0,borderWidth:(l=r.borderWidth)!==null&&l!==void 0?l:0,borderDashArray:(u=r.borderDashArray)!==null&&u!==void 0?u:void 0,borderDashPhase:(c=r.borderDashPhase)!==null&&c!==void 0?c:void 0,borderLineCap:(f=r.borderLineCap)!==null&&f!==void 0?f:void 0,graphicsState:d}))},t.prototype.drawLine=function(e){var r,n,i,a,o;_.assertIs(e.start,"options.start",[[Object,"{ x: number, y: number }"]]),_.assertIs(e.end,"options.end",[[Object,"{ x: number, y: number }"]]),_.assertIs(e.start.x,"options.start.x",["number"]),_.assertIs(e.start.y,"options.start.y",["number"]),_.assertIs(e.end.x,"options.end.x",["number"]),_.assertIs(e.end.y,"options.end.y",["number"]),_.assertOrUndefined(e.thickness,"options.thickness",["number"]),_.assertOrUndefined(e.color,"options.color",[[Object,"Color"]]),_.assertOrUndefined(e.dashArray,"options.dashArray",[Array]),_.assertOrUndefined(e.dashPhase,"options.dashPhase",["number"]),_.assertIsOneOfOrUndefined(e.lineCap,"options.lineCap",Yr.LineCapStyle),_.assertRangeOrUndefined(e.opacity,"opacity.opacity",0,1),_.assertIsOneOfOrUndefined(e.blendMode,"options.blendMode",Ii.BlendMode);var s=this.maybeEmbedGraphicsState({borderOpacity:e.opacity,blendMode:e.blendMode});"color"in e||(e.color=Ts.rgb(0,0,0));var l=this.getContentStream();l.push.apply(l,Ni.drawLine({start:e.start,end:e.end,thickness:(r=e.thickness)!==null&&r!==void 0?r:1,color:(n=e.color)!==null&&n!==void 0?n:void 0,dashArray:(i=e.dashArray)!==null&&i!==void 0?i:void 0,dashPhase:(a=e.dashPhase)!==null&&a!==void 0?a:void 0,lineCap:(o=e.lineCap)!==null&&o!==void 0?o:void 0,graphicsState:s}))},t.prototype.drawRectangle=function(e){var r,n,i,a,o,s,l,u,c,f,d,p,h;e===void 0&&(e={}),_.assertOrUndefined(e.x,"options.x",["number"]),_.assertOrUndefined(e.y,"options.y",["number"]),_.assertOrUndefined(e.width,"options.width",["number"]),_.assertOrUndefined(e.height,"options.height",["number"]),_.assertOrUndefined(e.rotate,"options.rotate",[[Object,"Rotation"]]),_.assertOrUndefined(e.xSkew,"options.xSkew",[[Object,"Rotation"]]),_.assertOrUndefined(e.ySkew,"options.ySkew",[[Object,"Rotation"]]),_.assertOrUndefined(e.borderWidth,"options.borderWidth",["number"]),_.assertOrUndefined(e.color,"options.color",[[Object,"Color"]]),_.assertRangeOrUndefined(e.opacity,"opacity.opacity",0,1),_.assertOrUndefined(e.borderColor,"options.borderColor",[[Object,"Color"]]),_.assertOrUndefined(e.borderDashArray,"options.borderDashArray",[Array]),_.assertOrUndefined(e.borderDashPhase,"options.borderDashPhase",["number"]),_.assertIsOneOfOrUndefined(e.borderLineCap,"options.borderLineCap",Yr.LineCapStyle),_.assertRangeOrUndefined(e.borderOpacity,"options.borderOpacity",0,1),_.assertIsOneOfOrUndefined(e.blendMode,"options.blendMode",Ii.BlendMode);var v=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=Ts.rgb(0,0,0));var g=this.getContentStream();g.push.apply(g,Ni.drawRectangle({x:(r=e.x)!==null&&r!==void 0?r:this.x,y:(n=e.y)!==null&&n!==void 0?n:this.y,width:(i=e.width)!==null&&i!==void 0?i:150,height:(a=e.height)!==null&&a!==void 0?a:100,rotate:(o=e.rotate)!==null&&o!==void 0?o:St.degrees(0),xSkew:(s=e.xSkew)!==null&&s!==void 0?s:St.degrees(0),ySkew:(l=e.ySkew)!==null&&l!==void 0?l:St.degrees(0),borderWidth:(u=e.borderWidth)!==null&&u!==void 0?u:0,color:(c=e.color)!==null&&c!==void 0?c:void 0,borderColor:(f=e.borderColor)!==null&&f!==void 0?f:void 0,borderDashArray:(d=e.borderDashArray)!==null&&d!==void 0?d:void 0,borderDashPhase:(p=e.borderDashPhase)!==null&&p!==void 0?p:void 0,graphicsState:v,borderLineCap:(h=e.borderLineCap)!==null&&h!==void 0?h:void 0}))},t.prototype.drawSquare=function(e){e===void 0&&(e={});var r=e.size;_.assertOrUndefined(r,"size",["number"]),this.drawRectangle(Yn.__assign(Yn.__assign({},e),{width:r,height:r}))},t.prototype.drawEllipse=function(e){var r,n,i,a,o,s,l,u,c,f,d;e===void 0&&(e={}),_.assertOrUndefined(e.x,"options.x",["number"]),_.assertOrUndefined(e.y,"options.y",["number"]),_.assertOrUndefined(e.xScale,"options.xScale",["number"]),_.assertOrUndefined(e.yScale,"options.yScale",["number"]),_.assertOrUndefined(e.rotate,"options.rotate",[[Object,"Rotation"]]),_.assertOrUndefined(e.color,"options.color",[[Object,"Color"]]),_.assertRangeOrUndefined(e.opacity,"opacity.opacity",0,1),_.assertOrUndefined(e.borderColor,"options.borderColor",[[Object,"Color"]]),_.assertRangeOrUndefined(e.borderOpacity,"options.borderOpacity",0,1),_.assertOrUndefined(e.borderWidth,"options.borderWidth",["number"]),_.assertOrUndefined(e.borderDashArray,"options.borderDashArray",[Array]),_.assertOrUndefined(e.borderDashPhase,"options.borderDashPhase",["number"]),_.assertIsOneOfOrUndefined(e.borderLineCap,"options.borderLineCap",Yr.LineCapStyle),_.assertIsOneOfOrUndefined(e.blendMode,"options.blendMode",Ii.BlendMode);var p=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=Ts.rgb(0,0,0));var h=this.getContentStream();h.push.apply(h,Ni.drawEllipse({x:(r=e.x)!==null&&r!==void 0?r:this.x,y:(n=e.y)!==null&&n!==void 0?n:this.y,xScale:(i=e.xScale)!==null&&i!==void 0?i:100,yScale:(a=e.yScale)!==null&&a!==void 0?a:100,rotate:(o=e.rotate)!==null&&o!==void 0?o:void 0,color:(s=e.color)!==null&&s!==void 0?s:void 0,borderColor:(l=e.borderColor)!==null&&l!==void 0?l:void 0,borderWidth:(u=e.borderWidth)!==null&&u!==void 0?u:0,borderDashArray:(c=e.borderDashArray)!==null&&c!==void 0?c:void 0,borderDashPhase:(f=e.borderDashPhase)!==null&&f!==void 0?f:void 0,borderLineCap:(d=e.borderLineCap)!==null&&d!==void 0?d:void 0,graphicsState:p}))},t.prototype.drawCircle=function(e){e===void 0&&(e={});var r=e.size,n=r===void 0?100:r;_.assertOrUndefined(n,"size",["number"]),this.drawEllipse(Yn.__assign(Yn.__assign({},e),{xScale:n,yScale:n}))},t.prototype.setOrEmbedFont=function(e){var r=this.font,n=this.fontKey;e?this.setFont(e):this.getFont();var i=this.font,a=this.fontKey;return{oldFont:r,oldFontKey:n,newFont:i,newFontKey:a}},t.prototype.getFont=function(){if(!this.font||!this.fontKey){var e=this.doc.embedStandardFont(fT.StandardFonts.Helvetica);this.setFont(e)}return[this.font,this.fontKey]},t.prototype.resetFont=function(){this.font=void 0,this.fontKey=void 0},t.prototype.getContentStream=function(e){return e===void 0&&(e=!0),e&&this.contentStream?this.contentStream:(this.contentStream=this.createContentStream(),this.contentStreamRef=this.doc.context.register(this.contentStream),this.node.addContentStream(this.contentStreamRef),this.contentStream)},t.prototype.createContentStream=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=this.doc.context.obj({}),i=ft.PDFContentStream.of(n,e);return i},t.prototype.maybeEmbedGraphicsState=function(e){var r=e.opacity,n=e.borderOpacity,i=e.blendMode;if(!(r===void 0&&n===void 0&&i===void 0)){var a=this.doc.context.obj({Type:"ExtGState",ca:r,CA:n,BM:i}),o=this.node.newExtGState("GS",a);return o}},t.prototype.scaleAnnot=function(e,r,n){for(var i=["RD","CL","Vertices","QuadPoints","L","Rect"],a=0,o=i.length;a<o;a++){var s=e.lookup(ft.PDFName.of(i[a]));s instanceof ft.PDFArray&&s.scalePDFNumbers(r,n)}var l=e.lookup(ft.PDFName.of("InkList"));if(l instanceof ft.PDFArray)for(var a=0,o=l.size();a<o;a++){var u=l.lookup(a);u instanceof ft.PDFArray&&u.scalePDFNumbers(r,n)}},t.of=function(e,r,n){return new t(e,r,n)},t.create=function(e){_.assertIs(e,"doc",[[AF.default,"PDFDocument"]]);var r=ft.PDFRef.of(-1),n=ft.PDFPageLeaf.withContextAndParent(e.context,r),i=e.context.register(n);return new t(n,i,e)},t})();np.default=dT});var K0=D(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});var Ml=(k(),R(T)),hT=Ml.__importDefault(_n()),kF=Ml.__importDefault(bn()),pT=Pl(),RF=Kn(),BF=Ml.__importStar(xn()),NF=ur(),vT=Zt(),IF=et(),qi=ae(),mT=(function(t){Ml.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return qi.assertIs(r,"acroButton",[[IF.PDFAcroPushButton,"PDFAcroPushButton"]]),a.acroField=r,a}return e.prototype.setImage=function(r,n){n===void 0&&(n=pT.ImageAlignment.Center);for(var i=this.acroField.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a],l=this.createImageAppearanceStream(s,r,n);this.updateWidgetAppearances(s,{normal:l})}this.markAsClean()},e.prototype.setFontSize=function(r){qi.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},e.prototype.addToPage=function(r,n,i){var a,o,s,l,u,c,f,d,p,h,v;qi.assertOrUndefined(r,"text",["string"]),qi.assertOrUndefined(n,"page",[[hT.default,"PDFPage"]]),BF.assertFieldAppearanceOptions(i);var g=this.createWidget({x:((a=i?.x)!==null&&a!==void 0?a:0)-((o=i?.borderWidth)!==null&&o!==void 0?o:0)/2,y:((s=i?.y)!==null&&s!==void 0?s:0)-((l=i?.borderWidth)!==null&&l!==void 0?l:0)/2,width:(u=i?.width)!==null&&u!==void 0?u:100,height:(c=i?.height)!==null&&c!==void 0?c:50,textColor:(f=i?.textColor)!==null&&f!==void 0?f:NF.rgb(0,0,0),backgroundColor:(d=i?.backgroundColor)!==null&&d!==void 0?d:NF.rgb(.75,.75,.75),borderColor:i?.borderColor,borderWidth:(p=i?.borderWidth)!==null&&p!==void 0?p:0,rotate:(h=i?.rotate)!==null&&h!==void 0?h:vT.degrees(0),caption:r,hidden:i?.hidden,page:n.ref}),m=this.doc.context.register(g.dict);this.acroField.addWidget(m);var b=(v=i?.font)!==null&&v!==void 0?v:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(g,b),n.node.addAnnot(m)},e.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=((r=o.getAppearances())===null||r===void 0?void 0:r.normal)instanceof IF.PDFStream;if(!s)return!0}return!1},e.prototype.defaultUpdateAppearances=function(r){qi.assertIs(r,"font",[[kF.default,"PDFFont"]]),this.updateAppearances(r)},e.prototype.updateAppearances=function(r,n){qi.assertIs(r,"font",[[kF.default,"PDFFont"]]),qi.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a];this.updateWidgetAppearance(s,r,n)}},e.prototype.updateWidgetAppearance=function(r,n,i){var a=i??RF.defaultButtonAppearanceProvider,o=RF.normalizeAppearance(a(this,r,n));this.updateWidgetAppearanceWithFont(r,n,o)},e.of=function(r,n,i){return new e(r,n,i)},e})(BF.default);ip.default=mT});var qF=D(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});var gT=(k(),R(T));gT.__exportStar(Kn(),pr);var DT=K0();Object.defineProperty(pr,"PDFButton",{enumerable:!0,get:function(){return DT.default}});var yT=P0();Object.defineProperty(pr,"PDFCheckBox",{enumerable:!0,get:function(){return yT.default}});var FT=O0();Object.defineProperty(pr,"PDFDropdown",{enumerable:!0,get:function(){return FT.default}});var bT=xn();Object.defineProperty(pr,"PDFField",{enumerable:!0,get:function(){return bT.default}});var xT=H0();Object.defineProperty(pr,"PDFForm",{enumerable:!0,get:function(){return xT.default}});var _T=k0();Object.defineProperty(pr,"PDFOptionList",{enumerable:!0,get:function(){return _T.default}});var CT=I0();Object.defineProperty(pr,"PDFRadioGroup",{enumerable:!0,get:function(){return CT.default}});var wT=j0();Object.defineProperty(pr,"PDFSignature",{enumerable:!0,get:function(){return wT.default}});var PT=W0();Object.defineProperty(pr,"PDFTextField",{enumerable:!0,get:function(){return PT.default}})});var MF=D(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});var jF=(k(),R(T));jF.__exportStar(_s(),Ul);jF.__exportStar(f0(),Ul)});var UF=D(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});var Qt=(k(),R(T));Qt.__exportStar(qF(),Ze);Qt.__exportStar(MF(),Ze);Qt.__exportStar(ur(),Ze);Qt.__exportStar(Ha(),Ze);Qt.__exportStar(F0(),Ze);Qt.__exportStar(pl(),Ze);Qt.__exportStar(Ga(),Ze);Qt.__exportStar(Wn(),Ze);Qt.__exportStar(Zt(),Ze);Qt.__exportStar(X0(),Ze);Qt.__exportStar(rp(),Ze);Qt.__exportStar(Z0(),Ze);Qt.__exportStar(Tl(),Ze);var ET=Xn();Object.defineProperty(Ze,"PDFDocument",{enumerable:!0,get:function(){return ET.default}});var ST=bn();Object.defineProperty(Ze,"PDFFont",{enumerable:!0,get:function(){return ST.default}});var OT=wl();Object.defineProperty(Ze,"PDFImage",{enumerable:!0,get:function(){return OT.default}});var AT=_n();Object.defineProperty(Ze,"PDFPage",{enumerable:!0,get:function(){return AT.default}});var TT=_l();Object.defineProperty(Ze,"PDFEmbeddedPage",{enumerable:!0,get:function(){return TT.default}});var kT=Q0();Object.defineProperty(Ze,"PDFJavaScript",{enumerable:!0,get:function(){return kT.default}})});var zF=D(VF=>{"use strict";Object.defineProperty(VF,"__esModule",{value:!0})});var WF=D($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var Vl=(k(),R(T));Vl.__exportStar(UF(),$a);Vl.__exportStar(et(),$a);Vl.__exportStar(zF(),$a);Vl.__exportStar(ae(),$a)});(function(){gp().config(Object.assign({},yp(),bp()(process.argv)))})();var Bp=je(Rp(),1),{program:gk,createCommand:Dk,createArgument:yk,createOption:Fk,CommanderError:bk,InvalidArgumentError:xk,InvalidOptionArgumentError:_k,Command:Np,Argument:Ck,Option:wk,Help:Pk}=Bp.default;kr();var an=je(require("node:path"),1),Tv=je(require("sharp"),1);xo();kr();var ia=je(require("node:fs/promises"),1),nn=je(require("node:path"),1),E1=[".png",".jpg",".jpeg"],S1=[".pdf"];async function Ys(t,e){let r=nn.resolve(t);try{if(!(await ia.stat(r)).isDirectory())throw new Error(`Not a directory: ${r}`)}catch(o){throw o.code==="ENOENT"?new Error(`Directory not found: ${r}`):o}let n=await ia.readdir(r,{withFileTypes:!0}),i=e.map(o=>o.startsWith(".")?o.toLowerCase():`.${o.toLowerCase()}`),a=[];for(let o of n)if(o.isFile()){let s=nn.extname(o.name).toLowerCase();i.includes(s)&&a.push(nn.join(r,o.name))}return a.sort((o,s)=>nn.basename(o).localeCompare(nn.basename(s))),{directory:r,files:a,count:a.length}}async function Sv(t){return Ys(t,E1)}async function Ov(t){return Ys(t,S1)}var Av=je(require("node:readline"),1);kr();async function aa(t){let{fileCount:e,fileType:r,actions:n,preserveOriginals:i=!0}=t;console.log(),console.log(Q.cyan(`Found ${Q.bold(e)} ${r}`)),console.log(),console.log(Q.yellow("Planned actions:"));for(let a of n)console.log(Q.white(` \u2022 ${a}`));return i&&console.log(Q.white(" \u2022 Originals will remain unchanged")),console.log(),new Promise(a=>{let o=Av.createInterface({input:process.stdin,output:process.stdout}),s=!1;o.on("close",()=>{s||(s=!0,console.log(),console.log(Q.red("Aborted.")),a(!1))}),o.question(Q.green("Continue? (y/N) "),l=>{s=!0,o.close();let u=l.trim().toLowerCase();u==="y"||u==="yes"?a(!0):(console.log(Q.red("Aborted.")),a(!1))})})}var O1=["png","jpg","jpeg","webp","gif","tiff","avif"];async function jc(t,e={}){let{from:r,to:n="webp",quality:i=80,maxWidth:a}=e,s=(r?Array.isArray(r)?r:[r]:[...O1]).filter(v=>n==="jpg"&&(v==="jpg"||v==="jpeg")?!1:v!==n);if(s.length===0){console.log(Q.yellow("No valid source formats to convert."));return}let l=await Ys(t,s);if(l.count===0){let v=s.map(g=>g.toUpperCase()).join(", ");console.log(Q.yellow(`No ${v} images found in directory.`));return}let u=r?(Array.isArray(r)?r.join(", "):r).toUpperCase():"all supported formats",c=[`Convert ${u} \u2192 ${n.toUpperCase()}`];if(a&&c.push(`Resize to max width ${a}px`),c.push(`Quality: ${i}%`),!await aa({fileCount:l.count,fileType:`${u} images`,actions:c,preserveOriginals:!0}))return;let d=rn("Converting images...").start(),p=0,h=0;for(let v of l.files)try{let g=an.dirname(v),m=an.basename(v,an.extname(v)),w=an.join(g,`${m}.${n==="jpg"?"jpg":n}`),F=(0,Tv.default)(v);switch(a&&(F=F.resize({width:a,withoutEnlargement:!0})),n){case"webp":await F.webp({quality:i}).toFile(w);break;case"png":await F.png({quality:i}).toFile(w);break;case"jpg":await F.jpeg({quality:i}).toFile(w);break}p++,d.text=`Converting images... (${p}/${l.count})`}catch{h++,d.warn(`Failed to convert: ${an.basename(v)}`),d.start()}d.stop(),console.log(),console.log(Q.green(`\u2713 Converted ${p} images to ${n.toUpperCase()}`)),h>0&&console.log(Q.red(`\u2717 Failed to convert ${h} images`))}var Rr=je(require("node:path"),1),Mc=je(require("sharp"),1);xo();kr();async function Uc(t,e){let{maxWidth:r,quality:n=80}=e,i=await Sv(t);if(i.count===0){console.log(Q.yellow("No images found in directory."));return}let a=[`Resize to max width ${r}px`,"Preserve aspect ratio"];if(!await aa({fileCount:i.count,fileType:"images",actions:a,preserveOriginals:!0}))return;let s=rn("Resizing images...").start(),l=0,u=0;for(let c of i.files)try{let f=Rr.dirname(c),d=Rr.extname(c),p=Rr.basename(c,d),h=Rr.join(f,`${p}_resized${d}`),v=await(0,Mc.default)(c).metadata();if(v.width&&v.width<=r){s.text=`Skipping ${Rr.basename(c)} (already ${v.width}px wide)`,l++;continue}await(0,Mc.default)(c).resize({width:r,withoutEnlargement:!0}).toFile(h),l++,s.text=`Resizing images... (${l}/${i.count})`}catch{u++,s.warn(`Failed to resize: ${Rr.basename(c)}`),s.start()}s.stop(),console.log(),console.log(Q.green(`\u2713 Resized ${l} images successfully`)),u>0&&console.log(Q.red(`\u2717 Failed to resize ${u} images`))}var eo=je(require("node:fs/promises"),1),zl=je(require("node:path"),1),ap=je(WF(),1);xo();kr();async function LF(t){return(await eo.stat(t)).mtimeMs}async function RT(t,e){let r=[...t];switch(e){case"name":return r;case"name-desc":return r.reverse();case"date":{let n=await Promise.all(r.map(async i=>({path:i,mtime:await LF(i)})));return n.sort((i,a)=>i.mtime-a.mtime),n.map(i=>i.path)}case"date-desc":{let n=await Promise.all(r.map(async i=>({path:i,mtime:await LF(i)})));return n.sort((i,a)=>a.mtime-i.mtime),n.map(i=>i.path)}case"random":for(let n=r.length-1;n>0;n--){let i=Math.floor(Math.random()*(n+1));[r[n],r[i]]=[r[i],r[n]]}return r;default:return r}}function BT(t){switch(t){case"name":return"alphabetical (A\u2192Z)";case"name-desc":return"reverse alphabetical (Z\u2192A)";case"date":return"oldest first";case"date-desc":return"newest first";case"random":return"random";default:return"alphabetical"}}async function op(t,e={}){let{outputFile:r="merged.pdf",order:n="name"}=e,i=await Ov(t);if(i.count===0){console.log(Q.yellow("No PDF files found in directory."));return}if(i.count===1){console.log(Q.yellow("Only one PDF found. Nothing to merge."));return}let a=await RT(i.files,n),o=zl.join(i.directory,r),s=BT(n),l=[`Merge ${i.count} PDFs (${s})`,`Output: ${r}`];if(!await aa({fileCount:i.count,fileType:"PDF files",actions:l,preserveOriginals:!0}))return;let c=rn("Merging PDFs...").start();try{let f=await ap.PDFDocument.create();for(let p=0;p<a.length;p++){let h=a[p];c.text=`Merging PDFs... (${p+1}/${i.count})`;try{let v=await eo.readFile(h),g=await ap.PDFDocument.load(v),m=await f.copyPages(g,g.getPageIndices());for(let b of m)f.addPage(b)}catch{c.warn(`Failed to read: ${zl.basename(h)}`),c.start()}}let d=await f.save();await eo.writeFile(o,d),c.stop(),console.log(),console.log(Q.green(`\u2713 Created ${r} with ${f.getPageCount()} pages`))}catch(f){c.stop(),console.log(Q.red(`\u2717 Failed to merge PDFs: ${f.message}`))}}kr();var Ye={};Yl(Ye,{BRAND:()=>o8,DIRTY:()=>ji,EMPTY_PATH:()=>jT,INVALID:()=>re,NEVER:()=>L8,OK:()=>bt,ParseStatus:()=>gt,Schema:()=>he,ZodAny:()=>$n,ZodArray:()=>Sn,ZodBigInt:()=>Ui,ZodBoolean:()=>Vi,ZodBranded:()=>Rs,ZodCatch:()=>Qi,ZodDate:()=>zi,ZodDefault:()=>Ji,ZodDiscriminatedUnion:()=>Gl,ZodEffects:()=>gr,ZodEnum:()=>Zi,ZodError:()=>zt,ZodFirstPartyTypeKind:()=>ie,ZodFunction:()=>Kl,ZodIntersection:()=>Hi,ZodIssueCode:()=>N,ZodLazy:()=>Ki,ZodLiteral:()=>Xi,ZodMap:()=>oo,ZodNaN:()=>uo,ZodNativeEnum:()=>Yi,ZodNever:()=>Or,ZodNull:()=>Li,ZodNullable:()=>$r,ZodNumber:()=>Mi,ZodObject:()=>Wt,ZodOptional:()=>vr,ZodParsedType:()=>V,ZodPipeline:()=>Bs,ZodPromise:()=>ei,ZodReadonly:()=>$i,ZodRecord:()=>Hl,ZodSchema:()=>he,ZodSet:()=>so,ZodString:()=>Qn,ZodSymbol:()=>io,ZodTransformer:()=>gr,ZodTuple:()=>Qr,ZodType:()=>he,ZodUndefined:()=>Wi,ZodUnion:()=>Gi,ZodUnknown:()=>En,ZodVoid:()=>ao,addIssueToContext:()=>M,any:()=>v8,array:()=>y8,bigint:()=>c8,boolean:()=>tb,coerce:()=>W8,custom:()=>QF,date:()=>f8,datetimeRegex:()=>YF,defaultErrorMap:()=>wn,discriminatedUnion:()=>_8,effect:()=>N8,enum:()=>k8,function:()=>O8,getErrorMap:()=>to,getParsedType:()=>Jr,instanceof:()=>u8,intersection:()=>C8,isAborted:()=>Wl,isAsync:()=>ro,isDirty:()=>Ll,isValid:()=>Jn,late:()=>s8,lazy:()=>A8,literal:()=>T8,makeIssue:()=>ks,map:()=>E8,nan:()=>l8,nativeEnum:()=>R8,never:()=>g8,null:()=>p8,nullable:()=>q8,number:()=>eb,object:()=>F8,objectUtil:()=>sp,oboolean:()=>z8,onumber:()=>V8,optional:()=>I8,ostring:()=>U8,pipeline:()=>M8,preprocess:()=>j8,promise:()=>B8,quotelessJson:()=>NT,record:()=>P8,set:()=>S8,setErrorMap:()=>qT,strictObject:()=>b8,string:()=>$F,symbol:()=>d8,transformer:()=>N8,tuple:()=>w8,undefined:()=>h8,union:()=>x8,unknown:()=>m8,util:()=>ve,void:()=>D8});var ve;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(ve||(ve={}));var sp;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(sp||(sp={}));var V=ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Jr=t=>{switch(typeof t){case"undefined":return V.undefined;case"string":return V.string;case"number":return Number.isNaN(t)?V.nan:V.number;case"boolean":return V.boolean;case"function":return V.function;case"bigint":return V.bigint;case"symbol":return V.symbol;case"object":return Array.isArray(t)?V.array:t===null?V.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?V.promise:typeof Map<"u"&&t instanceof Map?V.map:typeof Set<"u"&&t instanceof Set?V.set:typeof Date<"u"&&t instanceof Date?V.date:V.object;default:return V.unknown}};var N=ve.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),NT=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),zt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,l=0;for(;l<o.path.length;){let u=o.path[l];l===o.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(o))):s[u]=s[u]||{_errors:[]},s=s[u],l++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ve.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};zt.create=t=>new zt(t);var IT=(t,e)=>{let r;switch(t.code){case N.invalid_type:t.received===V.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case N.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ve.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:r=`Unrecognized key(s) in object: ${ve.joinValues(t.keys,", ")}`;break;case N.invalid_union:r="Invalid input";break;case N.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ve.joinValues(t.options)}`;break;case N.invalid_enum_value:r=`Invalid enum value. Expected ${ve.joinValues(t.options)}, received '${t.received}'`;break;case N.invalid_arguments:r="Invalid function arguments";break;case N.invalid_return_type:r="Invalid function return type";break;case N.invalid_date:r="Invalid date";break;case N.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ve.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case N.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case N.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case N.custom:r="Invalid input";break;case N.invalid_intersection_types:r="Intersection results could not be merged";break;case N.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case N.not_finite:r="Number must be finite";break;default:r=e.defaultError,ve.assertNever(t)}return{message:r}},wn=IT;var GF=wn;function qT(t){GF=t}function to(){return GF}var ks=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",l=n.filter(u=>!!u).slice().reverse();for(let u of l)s=u(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}},jT=[];function M(t,e){let r=to(),n=ks({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===wn?void 0:wn].filter(i=>!!i)});t.common.issues.push(n)}var gt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return re;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return re;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},re=Object.freeze({status:"aborted"}),ji=t=>({status:"dirty",value:t}),bt=t=>({status:"valid",value:t}),Wl=t=>t.status==="aborted",Ll=t=>t.status==="dirty",Jn=t=>t.status==="valid",ro=t=>typeof Promise<"u"&&t instanceof Promise;var G;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(G||(G={}));var mr=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},HF=(t,e)=>{if(Jn(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new zt(t.common.issues);return this._error=r,this._error}}};function fe(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{let{message:l}=t;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??r??s.defaultError}},description:i}}var he=class{get description(){return this._def.description}_getType(e){return Jr(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Jr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new gt,ctx:{common:e.parent.common,data:e.data,parsedType:Jr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(ro(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Jr(e)},i=this._parseSync({data:e,path:n.path,parent:n});return HF(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Jr(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Jn(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Jn(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Jr(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(ro(i)?i:Promise.resolve(i));return HF(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:N.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new gr({schema:this,typeName:ie.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return vr.create(this,this._def)}nullable(){return $r.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Sn.create(this)}promise(){return ei.create(this,this._def)}or(e){return Gi.create([this,e],this._def)}and(e){return Hi.create(this,e,this._def)}transform(e){return new gr({...fe(this._def),schema:this,typeName:ie.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ji({...fe(this._def),innerType:this,defaultValue:r,typeName:ie.ZodDefault})}brand(){return new Rs({typeName:ie.ZodBranded,type:this,...fe(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Qi({...fe(this._def),innerType:this,catchValue:r,typeName:ie.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Bs.create(this,e)}readonly(){return $i.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},MT=/^c[^\s-]{8,}$/i,UT=/^[0-9a-z]+$/,VT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zT=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,WT=/^[a-z0-9_-]{21}$/i,LT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,GT=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,HT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,KT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",up,XT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ZT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,YT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,JT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,QT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$T=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,XF="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",e8=new RegExp(`^${XF}$`);function ZF(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function t8(t){return new RegExp(`^${ZF(t)}$`)}function YF(t){let e=`${XF}T${ZF(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function r8(t,e){return!!((e==="v4"||!e)&&XT.test(t)||(e==="v6"||!e)&&YT.test(t))}function n8(t,e){if(!LT.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function i8(t,e){return!!((e==="v4"||!e)&&ZT.test(t)||(e==="v6"||!e)&&JT.test(t))}var Qn=class t extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==V.string){let a=this._getOrReturnCtx(e);return M(a,{code:N.invalid_type,expected:V.string,received:a.parsedType}),re}let n=new gt,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),M(i,{code:N.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),M(i,{code:N.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?M(i,{code:N.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&M(i,{code:N.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")HT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"email",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")up||(up=new RegExp(KT,"u")),up.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"emoji",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")zT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"uuid",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")WT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"nanoid",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")MT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"cuid",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")UT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"cuid2",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")VT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"ulid",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),M(i,{validation:"url",code:N.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"regex",code:N.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),M(i,{code:N.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),M(i,{code:N.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),M(i,{code:N.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?YF(a).test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{code:N.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?e8.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{code:N.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?t8(a).test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{code:N.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?GT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"duration",code:N.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?r8(e.data,a.version)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"ip",code:N.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?n8(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"jwt",code:N.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?i8(e.data,a.version)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"cidr",code:N.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?QT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"base64",code:N.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?$T.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"base64url",code:N.invalid_string,message:a.message}),n.dirty()):ve.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:N.invalid_string,...G.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...G.errToObj(e)})}url(e){return this._addCheck({kind:"url",...G.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...G.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...G.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...G.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...G.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...G.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...G.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...G.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...G.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...G.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...G.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...G.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...G.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...G.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...G.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...G.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...G.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...G.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...G.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...G.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...G.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...G.errToObj(r)})}nonempty(e){return this.min(1,G.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Qn.create=t=>new Qn({checks:[],typeName:ie.ZodString,coerce:t?.coerce??!1,...fe(t)});function a8(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var Mi=class t extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==V.number){let a=this._getOrReturnCtx(e);return M(a,{code:N.invalid_type,expected:V.number,received:a.parsedType}),re}let n,i=new gt;for(let a of this._def.checks)a.kind==="int"?ve.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),M(n,{code:N.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),M(n,{code:N.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),M(n,{code:N.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?a8(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),M(n,{code:N.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),M(n,{code:N.not_finite,message:a.message}),i.dirty()):ve.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,G.toString(r))}gt(e,r){return this.setLimit("min",e,!1,G.toString(r))}lte(e,r){return this.setLimit("max",e,!0,G.toString(r))}lt(e,r){return this.setLimit("max",e,!1,G.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:G.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:G.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:G.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:G.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:G.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:G.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ve.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Mi.create=t=>new Mi({checks:[],typeName:ie.ZodNumber,coerce:t?.coerce||!1,...fe(t)});var Ui=class t extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==V.bigint)return this._getInvalidInput(e);let n,i=new gt;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),M(n,{code:N.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),M(n,{code:N.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),M(n,{code:N.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):ve.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:V.bigint,received:r.parsedType}),re}gte(e,r){return this.setLimit("min",e,!0,G.toString(r))}gt(e,r){return this.setLimit("min",e,!1,G.toString(r))}lte(e,r){return this.setLimit("max",e,!0,G.toString(r))}lt(e,r){return this.setLimit("max",e,!1,G.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:G.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:G.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Ui.create=t=>new Ui({checks:[],typeName:ie.ZodBigInt,coerce:t?.coerce??!1,...fe(t)});var Vi=class extends he{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==V.boolean){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:V.boolean,received:n.parsedType}),re}return bt(e.data)}};Vi.create=t=>new Vi({typeName:ie.ZodBoolean,coerce:t?.coerce||!1,...fe(t)});var zi=class t extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==V.date){let a=this._getOrReturnCtx(e);return M(a,{code:N.invalid_type,expected:V.date,received:a.parsedType}),re}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return M(a,{code:N.invalid_date}),re}let n=new gt,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),M(i,{code:N.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),M(i,{code:N.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):ve.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:G.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:G.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};zi.create=t=>new zi({checks:[],coerce:t?.coerce||!1,typeName:ie.ZodDate,...fe(t)});var io=class extends he{_parse(e){if(this._getType(e)!==V.symbol){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:V.symbol,received:n.parsedType}),re}return bt(e.data)}};io.create=t=>new io({typeName:ie.ZodSymbol,...fe(t)});var Wi=class extends he{_parse(e){if(this._getType(e)!==V.undefined){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:V.undefined,received:n.parsedType}),re}return bt(e.data)}};Wi.create=t=>new Wi({typeName:ie.ZodUndefined,...fe(t)});var Li=class extends he{_parse(e){if(this._getType(e)!==V.null){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:V.null,received:n.parsedType}),re}return bt(e.data)}};Li.create=t=>new Li({typeName:ie.ZodNull,...fe(t)});var $n=class extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return bt(e.data)}};$n.create=t=>new $n({typeName:ie.ZodAny,...fe(t)});var En=class extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return bt(e.data)}};En.create=t=>new En({typeName:ie.ZodUnknown,...fe(t)});var Or=class extends he{_parse(e){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:V.never,received:r.parsedType}),re}};Or.create=t=>new Or({typeName:ie.ZodNever,...fe(t)});var ao=class extends he{_parse(e){if(this._getType(e)!==V.undefined){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:V.void,received:n.parsedType}),re}return bt(e.data)}};ao.create=t=>new ao({typeName:ie.ZodVoid,...fe(t)});var Sn=class t extends he{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==V.array)return M(r,{code:N.invalid_type,expected:V.array,received:r.parsedType}),re;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(M(r,{code:o?N.too_big:N.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(M(r,{code:N.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(M(r,{code:N.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new mr(r,o,r.path,s)))).then(o=>gt.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new mr(r,o,r.path,s)));return gt.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:G.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:G.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:G.toString(r)}})}nonempty(e){return this.min(1,e)}};Sn.create=(t,e)=>new Sn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ie.ZodArray,...fe(e)});function no(t){if(t instanceof Wt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=vr.create(no(n))}return new Wt({...t._def,shape:()=>e})}else return t instanceof Sn?new Sn({...t._def,type:no(t.element)}):t instanceof vr?vr.create(no(t.unwrap())):t instanceof $r?$r.create(no(t.unwrap())):t instanceof Qr?Qr.create(t.items.map(e=>no(e))):t}var Wt=class t extends he{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ve.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==V.object){let u=this._getOrReturnCtx(e);return M(u,{code:N.invalid_type,expected:V.object,received:u.parsedType}),re}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Or&&this._def.unknownKeys==="strip"))for(let u in i.data)o.includes(u)||s.push(u);let l=[];for(let u of o){let c=a[u],f=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new mr(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Or){let u=this._def.unknownKeys;if(u==="passthrough")for(let c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(M(i,{code:N.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let c of s){let f=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new mr(i,f,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let c of l){let f=await c.key,d=await c.value;u.push({key:f,value:d,alwaysSet:c.alwaysSet})}return u}).then(u=>gt.mergeObjectSync(n,u)):gt.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return G.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:G.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ie.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ve.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ve.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return no(this)}partial(e){let r={};for(let n of ve.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ve.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof vr;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return JF(ve.objectKeys(this.shape))}};Wt.create=(t,e)=>new Wt({shape:()=>t,unknownKeys:"strip",catchall:Or.create(),typeName:ie.ZodObject,...fe(e)});Wt.strictCreate=(t,e)=>new Wt({shape:()=>t,unknownKeys:"strict",catchall:Or.create(),typeName:ie.ZodObject,...fe(e)});Wt.lazycreate=(t,e)=>new Wt({shape:t,unknownKeys:"strip",catchall:Or.create(),typeName:ie.ZodObject,...fe(e)});var Gi=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new zt(s.ctx.common.issues));return M(r,{code:N.invalid_union,unionErrors:o}),re}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let l of n){let u={...r,common:{...r.common,issues:[]},parent:null},c=l._parseSync({data:r.data,path:r.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(l=>new zt(l));return M(r,{code:N.invalid_union,unionErrors:s}),re}}get options(){return this._def.options}};Gi.create=(t,e)=>new Gi({options:t,typeName:ie.ZodUnion,...fe(e)});var Pn=t=>t instanceof Ki?Pn(t.schema):t instanceof gr?Pn(t.innerType()):t instanceof Xi?[t.value]:t instanceof Zi?t.options:t instanceof Yi?ve.objectValues(t.enum):t instanceof Ji?Pn(t._def.innerType):t instanceof Wi?[void 0]:t instanceof Li?[null]:t instanceof vr?[void 0,...Pn(t.unwrap())]:t instanceof $r?[null,...Pn(t.unwrap())]:t instanceof Rs||t instanceof $i?Pn(t.unwrap()):t instanceof Qi?Pn(t._def.innerType):[],Gl=class t extends he{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==V.object)return M(r,{code:N.invalid_type,expected:V.object,received:r.parsedType}),re;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(M(r,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),re)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let o=Pn(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:ie.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...fe(n)})}};function lp(t,e){let r=Jr(t),n=Jr(e);if(t===e)return{valid:!0,data:t};if(r===V.object&&n===V.object){let i=ve.objectKeys(e),a=ve.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let l=lp(t[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(r===V.array&&n===V.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],l=lp(o,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===V.date&&n===V.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Hi=class extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(Wl(a)||Wl(o))return re;let s=lp(a.value,o.value);return s.valid?((Ll(a)||Ll(o))&&r.dirty(),{status:r.value,value:s.data}):(M(n,{code:N.invalid_intersection_types}),re)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Hi.create=(t,e,r)=>new Hi({left:t,right:e,typeName:ie.ZodIntersection,...fe(r)});var Qr=class t extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==V.array)return M(n,{code:N.invalid_type,expected:V.array,received:n.parsedType}),re;if(n.data.length<this._def.items.length)return M(n,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),re;!this._def.rest&&n.data.length>this._def.items.length&&(M(n,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new mr(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>gt.mergeArray(r,o)):gt.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Qr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qr({items:t,typeName:ie.ZodTuple,rest:null,...fe(e)})};var Hl=class t extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==V.object)return M(n,{code:N.invalid_type,expected:V.object,received:n.parsedType}),re;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new mr(n,s,n.path,s)),value:o._parse(new mr(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?gt.mergeObjectAsync(r,i):gt.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof he?new t({keyType:e,valueType:r,typeName:ie.ZodRecord,...fe(n)}):new t({keyType:Qn.create(),valueType:e,typeName:ie.ZodRecord,...fe(r)})}},oo=class extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==V.map)return M(n,{code:N.invalid_type,expected:V.map,received:n.parsedType}),re;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,l],u)=>({key:i._parse(new mr(n,s,n.path,[u,"key"])),value:a._parse(new mr(n,l,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of o){let u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return re;(u.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(u.value,c.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of o){let u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return re;(u.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(u.value,c.value)}return{status:r.value,value:s}}}};oo.create=(t,e,r)=>new oo({valueType:e,keyType:t,typeName:ie.ZodMap,...fe(r)});var so=class t extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==V.set)return M(n,{code:N.invalid_type,expected:V.set,received:n.parsedType}),re;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(M(n,{code:N.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(M(n,{code:N.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(l){let u=new Set;for(let c of l){if(c.status==="aborted")return re;c.status==="dirty"&&r.dirty(),u.add(c.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((l,u)=>a._parse(new mr(n,l,n.path,u)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:G.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:G.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};so.create=(t,e)=>new so({valueType:t,minSize:null,maxSize:null,typeName:ie.ZodSet,...fe(e)});var Kl=class t extends he{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==V.function)return M(r,{code:N.invalid_type,expected:V.function,received:r.parsedType}),re;function n(s,l){return ks({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,to(),wn].filter(u=>!!u),issueData:{code:N.invalid_arguments,argumentsError:l}})}function i(s,l){return ks({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,to(),wn].filter(u=>!!u),issueData:{code:N.invalid_return_type,returnTypeError:l}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof ei){let s=this;return bt(async function(...l){let u=new zt([]),c=await s._def.args.parseAsync(l,a).catch(p=>{throw u.addIssue(n(l,p)),u}),f=await Reflect.apply(o,this,c);return await s._def.returns._def.type.parseAsync(f,a).catch(p=>{throw u.addIssue(i(f,p)),u})})}else{let s=this;return bt(function(...l){let u=s._def.args.safeParse(l,a);if(!u.success)throw new zt([n(l,u.error)]);let c=Reflect.apply(o,this,u.data),f=s._def.returns.safeParse(c,a);if(!f.success)throw new zt([i(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Qr.create(e).rest(En.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Qr.create([]).rest(En.create()),returns:r||En.create(),typeName:ie.ZodFunction,...fe(n)})}},Ki=class extends he{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ki.create=(t,e)=>new Ki({getter:t,typeName:ie.ZodLazy,...fe(e)});var Xi=class extends he{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return M(r,{received:r.data,code:N.invalid_literal,expected:this._def.value}),re}return{status:"valid",value:e.data}}get value(){return this._def.value}};Xi.create=(t,e)=>new Xi({value:t,typeName:ie.ZodLiteral,...fe(e)});function JF(t,e){return new Zi({values:t,typeName:ie.ZodEnum,...fe(e)})}var Zi=class t extends he{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return M(r,{expected:ve.joinValues(n),received:r.parsedType,code:N.invalid_type}),re}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return M(r,{received:r.data,code:N.invalid_enum_value,options:n}),re}return bt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Zi.create=JF;var Yi=class extends he{_parse(e){let r=ve.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==V.string&&n.parsedType!==V.number){let i=ve.objectValues(r);return M(n,{expected:ve.joinValues(i),received:n.parsedType,code:N.invalid_type}),re}if(this._cache||(this._cache=new Set(ve.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ve.objectValues(r);return M(n,{received:n.data,code:N.invalid_enum_value,options:i}),re}return bt(e.data)}get enum(){return this._def.values}};Yi.create=(t,e)=>new Yi({values:t,typeName:ie.ZodNativeEnum,...fe(e)});var ei=class extends he{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==V.promise&&r.common.async===!1)return M(r,{code:N.invalid_type,expected:V.promise,received:r.parsedType}),re;let n=r.parsedType===V.promise?r.data:Promise.resolve(r.data);return bt(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ei.create=(t,e)=>new ei({type:t,typeName:ie.ZodPromise,...fe(e)});var gr=class extends he{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ie.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{M(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return re;let l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?re:l.status==="dirty"?ji(l.value):r.value==="dirty"?ji(l.value):l});{if(r.value==="aborted")return re;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?re:s.status==="dirty"?ji(s.value):r.value==="dirty"?ji(s.value):s}}if(i.type==="refinement"){let o=s=>{let l=i.refinement(s,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?re:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?re:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Jn(o))return re;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Jn(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):re);ve.assertNever(i)}};gr.create=(t,e,r)=>new gr({schema:t,typeName:ie.ZodEffects,effect:e,...fe(r)});gr.createWithPreprocess=(t,e,r)=>new gr({schema:e,effect:{type:"preprocess",transform:t},typeName:ie.ZodEffects,...fe(r)});var vr=class extends he{_parse(e){return this._getType(e)===V.undefined?bt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};vr.create=(t,e)=>new vr({innerType:t,typeName:ie.ZodOptional,...fe(e)});var $r=class extends he{_parse(e){return this._getType(e)===V.null?bt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$r.create=(t,e)=>new $r({innerType:t,typeName:ie.ZodNullable,...fe(e)});var Ji=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===V.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ji.create=(t,e)=>new Ji({innerType:t,typeName:ie.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...fe(e)});var Qi=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ro(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new zt(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new zt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Qi.create=(t,e)=>new Qi({innerType:t,typeName:ie.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...fe(e)});var uo=class extends he{_parse(e){if(this._getType(e)!==V.nan){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:V.nan,received:n.parsedType}),re}return{status:"valid",value:e.data}}};uo.create=t=>new uo({typeName:ie.ZodNaN,...fe(t)});var o8=Symbol("zod_brand"),Rs=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Bs=class t extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?re:a.status==="dirty"?(r.dirty(),ji(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?re:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ie.ZodPipeline})}},$i=class extends he{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Jn(i)&&(i.value=Object.freeze(i.value)),i);return ro(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};$i.create=(t,e)=>new $i({innerType:t,typeName:ie.ZodReadonly,...fe(e)});function KF(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function QF(t,e={},r){return t?$n.create().superRefine((n,i)=>{let a=t(n);if(a instanceof Promise)return a.then(o=>{if(!o){let s=KF(e,n),l=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:l})}});if(!a){let o=KF(e,n),s=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:s})}}):$n.create()}var s8={object:Wt.lazycreate},ie;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ie||(ie={}));var u8=(t,e={message:`Input not instance of ${t.name}`})=>QF(r=>r instanceof t,e),$F=Qn.create,eb=Mi.create,l8=uo.create,c8=Ui.create,tb=Vi.create,f8=zi.create,d8=io.create,h8=Wi.create,p8=Li.create,v8=$n.create,m8=En.create,g8=Or.create,D8=ao.create,y8=Sn.create,F8=Wt.create,b8=Wt.strictCreate,x8=Gi.create,_8=Gl.create,C8=Hi.create,w8=Qr.create,P8=Hl.create,E8=oo.create,S8=so.create,O8=Kl.create,A8=Ki.create,T8=Xi.create,k8=Zi.create,R8=Yi.create,B8=ei.create,N8=gr.create,I8=vr.create,q8=$r.create,j8=gr.createWithPreprocess,M8=Bs.create,U8=()=>$F().optional(),V8=()=>eb().optional(),z8=()=>tb().optional(),W8={string:(t=>Qn.create({...t,coerce:!0})),number:(t=>Mi.create({...t,coerce:!0})),boolean:(t=>Vi.create({...t,coerce:!0})),bigint:(t=>Ui.create({...t,coerce:!0})),date:(t=>zi.create({...t,coerce:!0}))};var L8=re;var G8=Ye.object({from:Ye.enum(["png","jpg","jpeg","webp","gif","tiff","avif"]).optional(),to:Ye.enum(["webp","png","jpg"]).optional(),format:Ye.literal("webp").optional(),maxWidth:Ye.number().positive().optional(),quality:Ye.number().min(1).max(100).optional()}).strict().optional(),H8=Ye.object({maxWidth:Ye.number().positive()}).strict(),K8=Ye.object({outputFile:Ye.string().optional(),order:Ye.enum(["name","name-desc","date","date-desc","random"]).optional()}).strict().optional(),X8=Ye.object({action:Ye.literal("convert_images"),options:G8}).strict(),Z8=Ye.object({action:Ye.literal("resize_images"),options:H8}).strict(),Y8=Ye.object({action:Ye.literal("merge_pdfs"),options:K8}).strict(),J8=Ye.discriminatedUnion("action",[X8,Z8,Y8]);function rb(t){let e=J8.safeParse(t);return e.success?e.data:null}var Q8=process.env.FILEX_API_URL||"https://filex-xi.vercel.app/api/parse-intent";async function nb(t){try{let e=await fetch(Q8,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:t})});if(!e.ok)return{success:!1,error:(await e.json().catch(()=>({}))).error||`API error: ${e.status}`};let r=await e.json();if(typeof r=="object"&&r!==null&&"error"in r){let i=r;return i.error==="unsupported"?{success:!1,error:"This feature is not supported yet. Let us know and we'll add it!"}:i.error==="unclear"?{success:!1,error:"Could not understand your request. Please use a manual command."}:{success:!1,error:i.error}}let n=rb(r);return n?{success:!0,action:n}:{success:!1,error:"Response did not match expected schema. Please use a manual command."}}catch(e){return{success:!1,error:`Request failed: ${e.message}`}}}function ib(t){console.log(),console.log(Q.red("Error:"),t),console.log(),console.log(Q.yellow("Manual commands:")),console.log(),console.log(Q.cyan(" Convert images:")),console.log(Q.gray(" filex convert ./photos --to webp")),console.log(Q.gray(" filex convert ./photos --from png --to jpg")),console.log(),console.log(Q.cyan(" Resize images:")),console.log(Q.gray(" filex resize ./photos --max-width 1200")),console.log(),console.log(Q.cyan(" Merge PDFs:")),console.log(Q.gray(" filex merge-pdfs ./docs")),console.log(Q.gray(" filex merge-pdfs ./docs --order date --output combined.pdf")),console.log()}kr();function $8(t){switch(t.action){case"convert_images":return"Image Conversion";case"resize_images":return"Image Resize";case"merge_pdfs":return"PDF Merge";default:return"Unknown"}}function ek(t){switch(t.action){case"convert_images":{let e=[],r=t.options?.from,n=t.options?.to??t.options?.format??"webp";return r?e.push(`Convert: ${r.toUpperCase()} \u2192 ${n.toUpperCase()}`):e.push(`Convert to: ${n.toUpperCase()}`),t.options?.maxWidth&&e.push(`Max width: ${t.options.maxWidth}px`),t.options?.quality&&e.push(`Quality: ${t.options.quality}%`),e}case"resize_images":return[`Max width: ${t.options.maxWidth}px`,"Aspect ratio preserved"];case"merge_pdfs":{let e=t.options?.outputFile??"merged.pdf",r=t.options?.order??"name";return[`Order: ${{name:"Alphabetical (A\u2192Z)","name-desc":"Reverse (Z\u2192A)",date:"Oldest first","date-desc":"Newest first",random:"Random"}[r]??"Alphabetical"}`,`Output: ${e}`]}default:return["Unknown action"]}}function ab(t){let e=$8(t),n=ek(t).map(i=>` ${Q.gray("\u203A")} ${Q.white(i)}`).join(`
|
|
71
|
+
`+b0.setFillingColor(n).toString();this.acroField.setDefaultAppearance(F)}return v},t.prototype.updateWidgetAppearanceWithFont=function(e,r,n){var i=n.normal,a=n.rollover,o=n.down;this.updateWidgetAppearances(e,{normal:this.createAppearanceStream(e,i,r),rollover:a&&this.createAppearanceStream(e,a,r),down:o&&this.createAppearanceStream(e,o,r)})},t.prototype.updateOnOffWidgetAppearance=function(e,r,n){var i=n.normal,a=n.rollover,o=n.down;this.updateWidgetAppearances(e,{normal:this.createAppearanceDict(e,i,r),rollover:a&&this.createAppearanceDict(e,a,r),down:o&&this.createAppearanceDict(e,o,r)})},t.prototype.updateWidgetAppearances=function(e,r){var n=r.normal,i=r.rollover,a=r.down;e.setNormalAppearance(n),i?e.setRolloverAppearance(i):e.removeRolloverAppearance(),a?e.setDownAppearance(a):e.removeDownAppearance()},t.prototype.createAppearanceStream=function(e,r,n){var i,a=this.acroField.dict.context,o=e.getRectangle(),s=o.width,l=o.height,u=n&&{Font:(i={},i[n.name]=n.ref,i)},c=a.formXObject(r,{Resources:u,BBox:a.obj([0,0,s,l]),Matrix:a.obj([1,0,0,1,0,0])}),f=a.register(c);return f},t.prototype.createImageAppearanceStream=function(e,r,n){var i,a,o=this.acroField.dict.context,s=e.getRectangle(),l=e.getAppearanceCharacteristics(),u=e.getBorderStyle(),c=(a=u?.getWidth())!==null&&a!==void 0?a:0,f=ki.reduceRotation(l?.getRotation()),d=uF.rotateInPlace(El.__assign(El.__assign({},s),{rotation:f})),p=ki.adjustDimsForRotation(s,f),h=r.scaleToFit(p.width-c*2,p.height-c*2),v={x:c,y:c,width:h.width,height:h.height,rotate:ki.degrees(0),xSkew:ki.degrees(0),ySkew:ki.degrees(0)};n===sF.ImageAlignment.Center?(v.x+=(p.width-c*2)/2-h.width/2,v.y+=(p.height-c*2)/2-h.height/2):n===sF.ImageAlignment.Right&&(v.x=p.width-c-h.width,v.y=p.height-c-h.height);var g=this.doc.context.addRandomSuffix("Image",10),m=El.__spreadArrays(d,uF.drawImage(g,v)),b={XObject:(i={},i[g]=r.ref,i)},w=o.formXObject(m,{Resources:b,BBox:o.obj([0,0,s.width,s.height]),Matrix:o.obj([1,0,0,1,0,0])});return o.register(w)},t.prototype.createAppearanceDict=function(e,r,n){var i=this.acroField.dict.context,a=this.createAppearanceStream(e,r.on),o=this.createAppearanceStream(e,r.off),s=i.obj({});return s.set(n,a),s.set(ct.PDFName.of("Off"),o),s},t})();ws.default=x3});var P0=D(w0=>{"use strict";Object.defineProperty(w0,"__esModule",{value:!0});var C0=(k(),R(T)),_3=C0.__importDefault(_n()),lF=Kn(),x0=ur(),C3=Zt(),cF=C0.__importStar(xn()),Ri=et(),_0=ae(),w3=(function(t){C0.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return _0.assertIs(r,"acroCheckBox",[[Ri.PDFAcroCheckBox,"PDFAcroCheckBox"]]),a.acroField=r,a}return e.prototype.check=function(){var r,n=(r=this.acroField.getOnValue())!==null&&r!==void 0?r:Ri.PDFName.of("Yes");this.markAsDirty(),this.acroField.setValue(n)},e.prototype.uncheck=function(){this.markAsDirty(),this.acroField.setValue(Ri.PDFName.of("Off"))},e.prototype.isChecked=function(){var r=this.acroField.getOnValue();return!!r&&r===this.acroField.getValue()},e.prototype.addToPage=function(r,n){var i,a,o,s,l,u;_0.assertIs(r,"page",[[_3.default,"PDFPage"]]),cF.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=x0.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=x0.rgb(1,1,1)),"borderColor"in n||(n.borderColor=x0.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:(a=n.y)!==null&&a!==void 0?a:0,width:(o=n.width)!==null&&o!==void 0?o:50,height:(s=n.height)!==null&&s!==void 0?s:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(l=n.borderWidth)!==null&&l!==void 0?l:0,rotate:(u=n.rotate)!==null&&u!==void 0?u:C3.degrees(0),hidden:n.hidden,page:r.ref}),f=this.doc.context.register(c.dict);this.acroField.addWidget(f),c.setAppearanceState(Ri.PDFName.of("Off")),this.updateWidgetAppearance(c,Ri.PDFName.of("Yes")),r.node.addAnnot(f)},e.prototype.needsAppearancesUpdate=function(){for(var r,n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=o.getAppearanceState(),l=(r=o.getAppearances())===null||r===void 0?void 0:r.normal;if(!(l instanceof Ri.PDFDict)||s&&!l.has(s))return!0}return!1},e.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},e.prototype.updateAppearances=function(r){var n;_0.assertOrUndefined(r,"provider",[Function]);for(var i=this.acroField.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a],l=(n=s.getOnValue())!==null&&n!==void 0?n:Ri.PDFName.of("Yes");l&&this.updateWidgetAppearance(s,l,r)}this.markAsClean()},e.prototype.updateWidgetAppearance=function(r,n,i){var a=i??lF.defaultCheckBoxAppearanceProvider,o=lF.normalizeAppearance(a(this,r));this.updateOnOffWidgetAppearance(r,n,o)},e.of=function(r,n,i){return new e(r,n,i)},e})(cF.default);w0.default=w3});var O0=D(S0=>{"use strict";Object.defineProperty(S0,"__esModule",{value:!0});var Sl=(k(),R(T)),P3=Sl.__importDefault(_n()),fF=Sl.__importDefault(bn()),dF=Sl.__importStar(xn()),hF=Kn(),E0=ur(),E3=Zt(),tt=et(),Zr=ae(),S3=(function(t){Sl.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return Zr.assertIs(r,"acroComboBox",[[tt.PDFAcroComboBox,"PDFAcroComboBox"]]),a.acroField=r,a}return e.prototype.getOptions=function(){for(var r=this.acroField.getOptions(),n=new Array(r.length),i=0,a=n.length;i<a;i++){var o=r[i],s=o.display,l=o.value;n[i]=(s??l).decodeText()}return n},e.prototype.getSelected=function(){for(var r=this.acroField.getValues(),n=new Array(r.length),i=0,a=r.length;i<a;i++)n[i]=r[i].decodeText();return n},e.prototype.setOptions=function(r){Zr.assertIs(r,"options",[Array]);for(var n=new Array(r.length),i=0,a=r.length;i<a;i++)n[i]={value:tt.PDFHexString.fromText(r[i])};this.acroField.setOptions(n)},e.prototype.addOptions=function(r){Zr.assertIs(r,"options",["string",Array]);for(var n=Array.isArray(r)?r:[r],i=this.acroField.getOptions(),a=new Array(n.length),o=0,s=n.length;o<s;o++)a[o]={value:tt.PDFHexString.fromText(n[o])};this.acroField.setOptions(i.concat(a))},e.prototype.select=function(r,n){n===void 0&&(n=!1),Zr.assertIs(r,"options",["string",Array]),Zr.assertIs(n,"merge",["boolean"]);var i=Array.isArray(r)?r:[r],a=this.getOptions(),o=i.find(function(f){return!a.includes(f)});o&&this.enableEditing(),this.markAsDirty(),(i.length>1||i.length===1&&n)&&this.enableMultiselect();for(var s=new Array(i.length),l=0,u=i.length;l<u;l++)s[l]=tt.PDFHexString.fromText(i[l]);if(n){var c=this.acroField.getValues();this.acroField.setValues(c.concat(s))}else this.acroField.setValues(s)},e.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},e.prototype.setFontSize=function(r){Zr.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},e.prototype.isEditable=function(){return this.acroField.hasFlag(tt.AcroChoiceFlags.Edit)},e.prototype.enableEditing=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.Edit,!0)},e.prototype.disableEditing=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.Edit,!1)},e.prototype.isSorted=function(){return this.acroField.hasFlag(tt.AcroChoiceFlags.Sort)},e.prototype.enableSorting=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.Sort,!0)},e.prototype.disableSorting=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.Sort,!1)},e.prototype.isMultiselect=function(){return this.acroField.hasFlag(tt.AcroChoiceFlags.MultiSelect)},e.prototype.enableMultiselect=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.MultiSelect,!0)},e.prototype.disableMultiselect=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.MultiSelect,!1)},e.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(tt.AcroChoiceFlags.DoNotSpellCheck)},e.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.DoNotSpellCheck,!1)},e.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.DoNotSpellCheck,!0)},e.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(tt.AcroChoiceFlags.CommitOnSelChange)},e.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.CommitOnSelChange,!0)},e.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(tt.AcroChoiceFlags.CommitOnSelChange,!1)},e.prototype.addToPage=function(r,n){var i,a,o,s,l,u,c;Zr.assertIs(r,"page",[[P3.default,"PDFPage"]]),dF.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=E0.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=E0.rgb(1,1,1)),"borderColor"in n||(n.borderColor=E0.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var f=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(a=n.y)!==null&&a!==void 0?a:0,width:(o=n.width)!==null&&o!==void 0?o:200,height:(s=n.height)!==null&&s!==void 0?s:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(l=n.borderWidth)!==null&&l!==void 0?l:0,rotate:(u=n.rotate)!==null&&u!==void 0?u:E3.degrees(0),hidden:n.hidden,page:r.ref}),d=this.doc.context.register(f.dict);this.acroField.addWidget(d);var p=(c=n.font)!==null&&c!==void 0?c:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(f,p),r.node.addAnnot(d)},e.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=((r=o.getAppearances())===null||r===void 0?void 0:r.normal)instanceof tt.PDFStream;if(!s)return!0}return!1},e.prototype.defaultUpdateAppearances=function(r){Zr.assertIs(r,"font",[[fF.default,"PDFFont"]]),this.updateAppearances(r)},e.prototype.updateAppearances=function(r,n){Zr.assertIs(r,"font",[[fF.default,"PDFFont"]]),Zr.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a];this.updateWidgetAppearance(s,r,n)}this.markAsClean()},e.prototype.updateWidgetAppearance=function(r,n,i){var a=i??hF.defaultDropdownAppearanceProvider,o=hF.normalizeAppearance(a(this,r,n));this.updateWidgetAppearanceWithFont(r,n,o)},e.of=function(r,n,i){return new e(r,n,i)},e})(dF.default);S0.default=S3});var k0=D(T0=>{"use strict";Object.defineProperty(T0,"__esModule",{value:!0});var Ol=(k(),R(T)),O3=Ol.__importDefault(_n()),pF=Ol.__importDefault(bn()),vF=Ol.__importStar(xn()),mF=Kn(),A0=ur(),A3=Zt(),Vt=et(),Er=ae(),T3=(function(t){Ol.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return Er.assertIs(r,"acroListBox",[[Vt.PDFAcroListBox,"PDFAcroListBox"]]),a.acroField=r,a}return e.prototype.getOptions=function(){for(var r=this.acroField.getOptions(),n=new Array(r.length),i=0,a=n.length;i<a;i++){var o=r[i],s=o.display,l=o.value;n[i]=(s??l).decodeText()}return n},e.prototype.getSelected=function(){for(var r=this.acroField.getValues(),n=new Array(r.length),i=0,a=r.length;i<a;i++)n[i]=r[i].decodeText();return n},e.prototype.setOptions=function(r){Er.assertIs(r,"options",[Array]),this.markAsDirty();for(var n=new Array(r.length),i=0,a=r.length;i<a;i++)n[i]={value:Vt.PDFHexString.fromText(r[i])};this.acroField.setOptions(n)},e.prototype.addOptions=function(r){Er.assertIs(r,"options",["string",Array]),this.markAsDirty();for(var n=Array.isArray(r)?r:[r],i=this.acroField.getOptions(),a=new Array(n.length),o=0,s=n.length;o<s;o++)a[o]={value:Vt.PDFHexString.fromText(n[o])};this.acroField.setOptions(i.concat(a))},e.prototype.select=function(r,n){n===void 0&&(n=!1),Er.assertIs(r,"options",["string",Array]),Er.assertIs(n,"merge",["boolean"]);var i=Array.isArray(r)?r:[r],a=this.getOptions();Er.assertIsSubset(i,"option",a),this.markAsDirty(),(i.length>1||i.length===1&&n)&&this.enableMultiselect();for(var o=new Array(i.length),s=0,l=i.length;s<l;s++)o[s]=Vt.PDFHexString.fromText(i[s]);if(n){var u=this.acroField.getValues();this.acroField.setValues(u.concat(o))}else this.acroField.setValues(o)},e.prototype.clear=function(){this.markAsDirty(),this.acroField.setValues([])},e.prototype.setFontSize=function(r){Er.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},e.prototype.isSorted=function(){return this.acroField.hasFlag(Vt.AcroChoiceFlags.Sort)},e.prototype.enableSorting=function(){this.acroField.setFlagTo(Vt.AcroChoiceFlags.Sort,!0)},e.prototype.disableSorting=function(){this.acroField.setFlagTo(Vt.AcroChoiceFlags.Sort,!1)},e.prototype.isMultiselect=function(){return this.acroField.hasFlag(Vt.AcroChoiceFlags.MultiSelect)},e.prototype.enableMultiselect=function(){this.acroField.setFlagTo(Vt.AcroChoiceFlags.MultiSelect,!0)},e.prototype.disableMultiselect=function(){this.acroField.setFlagTo(Vt.AcroChoiceFlags.MultiSelect,!1)},e.prototype.isSelectOnClick=function(){return this.acroField.hasFlag(Vt.AcroChoiceFlags.CommitOnSelChange)},e.prototype.enableSelectOnClick=function(){this.acroField.setFlagTo(Vt.AcroChoiceFlags.CommitOnSelChange,!0)},e.prototype.disableSelectOnClick=function(){this.acroField.setFlagTo(Vt.AcroChoiceFlags.CommitOnSelChange,!1)},e.prototype.addToPage=function(r,n){var i,a,o,s,l,u,c;Er.assertIs(r,"page",[[O3.default,"PDFPage"]]),vF.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=A0.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=A0.rgb(1,1,1)),"borderColor"in n||(n.borderColor=A0.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var f=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(a=n.y)!==null&&a!==void 0?a:0,width:(o=n.width)!==null&&o!==void 0?o:200,height:(s=n.height)!==null&&s!==void 0?s:100,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(l=n.borderWidth)!==null&&l!==void 0?l:0,rotate:(u=n.rotate)!==null&&u!==void 0?u:A3.degrees(0),hidden:n.hidden,page:r.ref}),d=this.doc.context.register(f.dict);this.acroField.addWidget(d);var p=(c=n.font)!==null&&c!==void 0?c:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(f,p),r.node.addAnnot(d)},e.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=((r=o.getAppearances())===null||r===void 0?void 0:r.normal)instanceof Vt.PDFStream;if(!s)return!0}return!1},e.prototype.defaultUpdateAppearances=function(r){Er.assertIs(r,"font",[[pF.default,"PDFFont"]]),this.updateAppearances(r)},e.prototype.updateAppearances=function(r,n){Er.assertIs(r,"font",[[pF.default,"PDFFont"]]),Er.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a];this.updateWidgetAppearance(s,r,n)}this.markAsClean()},e.prototype.updateWidgetAppearance=function(r,n,i){var a=i??mF.defaultOptionListAppearanceProvider,o=mF.normalizeAppearance(a(this,r,n));this.updateWidgetAppearanceWithFont(r,n,o)},e.of=function(r,n,i){return new e(r,n,i)},e})(vF.default);T0.default=T3});var I0=D(N0=>{"use strict";Object.defineProperty(N0,"__esModule",{value:!0});var B0=(k(),R(T)),k3=B0.__importDefault(_n()),gF=B0.__importStar(xn()),DF=Kn(),R0=ur(),R3=Zt(),dr=et(),Za=ae(),B3=(function(t){B0.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return Za.assertIs(r,"acroRadioButton",[[dr.PDFAcroRadioButton,"PDFAcroRadioButton"]]),a.acroField=r,a}return e.prototype.getOptions=function(){var r=this.acroField.getExportValues();if(r){for(var n=new Array(r.length),i=0,a=r.length;i<a;i++)n[i]=r[i].decodeText();return n}for(var o=this.acroField.getOnValues(),s=new Array(o.length),i=0,a=s.length;i<a;i++)s[i]=o[i].decodeText();return s},e.prototype.getSelected=function(){var r=this.acroField.getValue();if(r!==dr.PDFName.of("Off")){var n=this.acroField.getExportValues();if(n){for(var i=this.acroField.getOnValues(),a=0,o=i.length;a<o;a++)if(i[a]===r)return n[a].decodeText()}return r.decodeText()}},e.prototype.select=function(r){Za.assertIs(r,"option",["string"]);var n=this.getOptions();Za.assertIsOneOf(r,"option",n),this.markAsDirty();var i=this.acroField.getOnValues(),a=this.acroField.getExportValues();if(a)for(var o=0,s=a.length;o<s;o++)a[o].decodeText()===r&&this.acroField.setValue(i[o]);else for(var o=0,s=i.length;o<s;o++){var l=i[o];l.decodeText()===r&&this.acroField.setValue(l)}},e.prototype.clear=function(){this.markAsDirty(),this.acroField.setValue(dr.PDFName.of("Off"))},e.prototype.isOffToggleable=function(){return!this.acroField.hasFlag(dr.AcroButtonFlags.NoToggleToOff)},e.prototype.enableOffToggling=function(){this.acroField.setFlagTo(dr.AcroButtonFlags.NoToggleToOff,!1)},e.prototype.disableOffToggling=function(){this.acroField.setFlagTo(dr.AcroButtonFlags.NoToggleToOff,!0)},e.prototype.isMutuallyExclusive=function(){return!this.acroField.hasFlag(dr.AcroButtonFlags.RadiosInUnison)},e.prototype.enableMutualExclusion=function(){this.acroField.setFlagTo(dr.AcroButtonFlags.RadiosInUnison,!1)},e.prototype.disableMutualExclusion=function(){this.acroField.setFlagTo(dr.AcroButtonFlags.RadiosInUnison,!0)},e.prototype.addOptionToPage=function(r,n,i){var a,o,s,l,u,c,f,d,p;Za.assertIs(r,"option",["string"]),Za.assertIs(n,"page",[[k3.default,"PDFPage"]]),gF.assertFieldAppearanceOptions(i);var h=this.createWidget({x:(a=i?.x)!==null&&a!==void 0?a:0,y:(o=i?.y)!==null&&o!==void 0?o:0,width:(s=i?.width)!==null&&s!==void 0?s:50,height:(l=i?.height)!==null&&l!==void 0?l:50,textColor:(u=i?.textColor)!==null&&u!==void 0?u:R0.rgb(0,0,0),backgroundColor:(c=i?.backgroundColor)!==null&&c!==void 0?c:R0.rgb(1,1,1),borderColor:(f=i?.borderColor)!==null&&f!==void 0?f:R0.rgb(0,0,0),borderWidth:(d=i?.borderWidth)!==null&&d!==void 0?d:1,rotate:(p=i?.rotate)!==null&&p!==void 0?p:R3.degrees(0),hidden:i?.hidden,page:n.ref}),v=this.doc.context.register(h.dict),g=this.acroField.addWidgetWithOpt(v,dr.PDFHexString.fromText(r),!this.isMutuallyExclusive());h.setAppearanceState(dr.PDFName.of("Off")),this.updateWidgetAppearance(h,g),n.node.addAnnot(v)},e.prototype.needsAppearancesUpdate=function(){for(var r,n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=o.getAppearanceState(),l=(r=o.getAppearances())===null||r===void 0?void 0:r.normal;if(!(l instanceof dr.PDFDict)||s&&!l.has(s))return!0}return!1},e.prototype.defaultUpdateAppearances=function(){this.updateAppearances()},e.prototype.updateAppearances=function(r){Za.assertOrUndefined(r,"provider",[Function]);for(var n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=o.getOnValue();s&&this.updateWidgetAppearance(o,s,r)}},e.prototype.updateWidgetAppearance=function(r,n,i){var a=i??DF.defaultRadioGroupAppearanceProvider,o=DF.normalizeAppearance(a(this,r));this.updateOnOffWidgetAppearance(r,n,o)},e.of=function(r,n,i){return new e(r,n,i)},e})(gF.default);N0.default=B3});var j0=D(q0=>{"use strict";Object.defineProperty(q0,"__esModule",{value:!0});var yF=(k(),R(T)),N3=yF.__importDefault(xn()),I3=et(),q3=ae(),j3=(function(t){yF.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return q3.assertIs(r,"acroSignature",[[I3.PDFAcroSignature,"PDFAcroSignature"]]),a.acroField=r,a}return e.prototype.needsAppearancesUpdate=function(){return!1},e.of=function(r,n,i){return new e(r,n,i)},e})(N3.default);q0.default=j3});var W0=D(z0=>{"use strict";Object.defineProperty(z0,"__esModule",{value:!0});var Al=(k(),R(T)),M3=Al.__importDefault(_n()),FF=Al.__importDefault(bn()),bF=Al.__importStar(xn()),xF=Kn(),M0=ur(),U3=Zt(),U0=Ha(),V0=Pl(),Bi=_s(),qe=et(),Cn=ae(),V3=(function(t){Al.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return Cn.assertIs(r,"acroText",[[qe.PDFAcroText,"PDFAcroText"]]),a.acroField=r,a}return e.prototype.getText=function(){var r=this.acroField.getValue();if(!r&&this.isRichFormatted())throw new U0.RichTextFieldReadError(this.getName());return r?.decodeText()},e.prototype.setText=function(r){Cn.assertOrUndefined(r,"text",["string"]);var n=this.getMaxLength();if(n!==void 0&&r&&r.length>n)throw new U0.ExceededMaxLengthError(r.length,n,this.getName());this.markAsDirty(),this.disableRichFormatting(),r?this.acroField.setValue(qe.PDFHexString.fromText(r)):this.acroField.removeValue()},e.prototype.getAlignment=function(){var r=this.acroField.getQuadding();return r===0?Bi.TextAlignment.Left:r===1?Bi.TextAlignment.Center:r===2?Bi.TextAlignment.Right:Bi.TextAlignment.Left},e.prototype.setAlignment=function(r){Cn.assertIsOneOf(r,"alignment",Bi.TextAlignment),this.markAsDirty(),this.acroField.setQuadding(r)},e.prototype.getMaxLength=function(){return this.acroField.getMaxLength()},e.prototype.setMaxLength=function(r){if(Cn.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 U0.InvalidMaxLengthError(n.length,r,this.getName());this.acroField.setMaxLength(r)}},e.prototype.removeMaxLength=function(){this.markAsDirty(),this.acroField.removeMaxLength()},e.prototype.setImage=function(r){for(var n=this.getAlignment(),i=n===Bi.TextAlignment.Center?V0.ImageAlignment.Center:n===Bi.TextAlignment.Right?V0.ImageAlignment.Right:V0.ImageAlignment.Left,a=this.acroField.getWidgets(),o=0,s=a.length;o<s;o++){var l=a[o],u=this.createImageAppearanceStream(l,r,i);this.updateWidgetAppearances(l,{normal:u})}this.markAsClean()},e.prototype.setFontSize=function(r){Cn.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},e.prototype.isMultiline=function(){return this.acroField.hasFlag(qe.AcroTextFlags.Multiline)},e.prototype.enableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(qe.AcroTextFlags.Multiline,!0)},e.prototype.disableMultiline=function(){this.markAsDirty(),this.acroField.setFlagTo(qe.AcroTextFlags.Multiline,!1)},e.prototype.isPassword=function(){return this.acroField.hasFlag(qe.AcroTextFlags.Password)},e.prototype.enablePassword=function(){this.acroField.setFlagTo(qe.AcroTextFlags.Password,!0)},e.prototype.disablePassword=function(){this.acroField.setFlagTo(qe.AcroTextFlags.Password,!1)},e.prototype.isFileSelector=function(){return this.acroField.hasFlag(qe.AcroTextFlags.FileSelect)},e.prototype.enableFileSelection=function(){this.acroField.setFlagTo(qe.AcroTextFlags.FileSelect,!0)},e.prototype.disableFileSelection=function(){this.acroField.setFlagTo(qe.AcroTextFlags.FileSelect,!1)},e.prototype.isSpellChecked=function(){return!this.acroField.hasFlag(qe.AcroTextFlags.DoNotSpellCheck)},e.prototype.enableSpellChecking=function(){this.acroField.setFlagTo(qe.AcroTextFlags.DoNotSpellCheck,!1)},e.prototype.disableSpellChecking=function(){this.acroField.setFlagTo(qe.AcroTextFlags.DoNotSpellCheck,!0)},e.prototype.isScrollable=function(){return!this.acroField.hasFlag(qe.AcroTextFlags.DoNotScroll)},e.prototype.enableScrolling=function(){this.acroField.setFlagTo(qe.AcroTextFlags.DoNotScroll,!1)},e.prototype.disableScrolling=function(){this.acroField.setFlagTo(qe.AcroTextFlags.DoNotScroll,!0)},e.prototype.isCombed=function(){return this.acroField.hasFlag(qe.AcroTextFlags.Comb)&&!this.isMultiline()&&!this.isPassword()&&!this.isFileSelector()&&this.getMaxLength()!==void 0},e.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(qe.AcroTextFlags.Comb,!0)},e.prototype.disableCombing=function(){this.markAsDirty(),this.acroField.setFlagTo(qe.AcroTextFlags.Comb,!1)},e.prototype.isRichFormatted=function(){return this.acroField.hasFlag(qe.AcroTextFlags.RichText)},e.prototype.enableRichFormatting=function(){this.acroField.setFlagTo(qe.AcroTextFlags.RichText,!0)},e.prototype.disableRichFormatting=function(){this.acroField.setFlagTo(qe.AcroTextFlags.RichText,!1)},e.prototype.addToPage=function(r,n){var i,a,o,s,l,u,c;Cn.assertIs(r,"page",[[M3.default,"PDFPage"]]),bF.assertFieldAppearanceOptions(n),n||(n={}),"textColor"in n||(n.textColor=M0.rgb(0,0,0)),"backgroundColor"in n||(n.backgroundColor=M0.rgb(1,1,1)),"borderColor"in n||(n.borderColor=M0.rgb(0,0,0)),"borderWidth"in n||(n.borderWidth=1);var f=this.createWidget({x:(i=n.x)!==null&&i!==void 0?i:0,y:(a=n.y)!==null&&a!==void 0?a:0,width:(o=n.width)!==null&&o!==void 0?o:200,height:(s=n.height)!==null&&s!==void 0?s:50,textColor:n.textColor,backgroundColor:n.backgroundColor,borderColor:n.borderColor,borderWidth:(l=n.borderWidth)!==null&&l!==void 0?l:0,rotate:(u=n.rotate)!==null&&u!==void 0?u:U3.degrees(0),hidden:n.hidden,page:r.ref}),d=this.doc.context.register(f.dict);this.acroField.addWidget(d);var p=(c=n.font)!==null&&c!==void 0?c:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(f,p),r.node.addAnnot(d)},e.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=((r=o.getAppearances())===null||r===void 0?void 0:r.normal)instanceof qe.PDFStream;if(!s)return!0}return!1},e.prototype.defaultUpdateAppearances=function(r){Cn.assertIs(r,"font",[[FF.default,"PDFFont"]]),this.updateAppearances(r)},e.prototype.updateAppearances=function(r,n){Cn.assertIs(r,"font",[[FF.default,"PDFFont"]]),Cn.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a];this.updateWidgetAppearance(s,r,n)}this.markAsClean()},e.prototype.updateWidgetAppearance=function(r,n,i){var a=i??xF.defaultTextFieldAppearanceProvider,o=xF.normalizeAppearance(a(this,r,n));this.updateWidgetAppearanceWithFont(r,n,o)},e.of=function(r,n,i){return new e(r,n,i)},e})(bF.default);z0.default=V3});var Tl=D(Ps=>{"use strict";Object.defineProperty(Ps,"__esModule",{value:!0});Ps.StandardFonts=void 0;var z3;(function(t){t.Courier="Courier",t.CourierBold="Courier-Bold",t.CourierOblique="Courier-Oblique",t.CourierBoldOblique="Courier-BoldOblique",t.Helvetica="Helvetica",t.HelveticaBold="Helvetica-Bold",t.HelveticaOblique="Helvetica-Oblique",t.HelveticaBoldOblique="Helvetica-BoldOblique",t.TimesRoman="Times-Roman",t.TimesRomanBold="Times-Bold",t.TimesRomanItalic="Times-Italic",t.TimesRomanBoldItalic="Times-BoldItalic",t.Symbol="Symbol",t.ZapfDingbats="ZapfDingbats"})(z3=Ps.StandardFonts||(Ps.StandardFonts={}))});var H0=D(G0=>{"use strict";Object.defineProperty(G0,"__esModule",{value:!0});var hr=(k(),R(T)),W3=hr.__importDefault(Xn()),Rl=hr.__importDefault(K0()),Es=hr.__importDefault(P0()),Bl=hr.__importDefault(O0()),Nl=hr.__importDefault(k0()),Ss=hr.__importDefault(I0()),L0=hr.__importDefault(j0()),Il=hr.__importDefault(W0()),Sr=Ha(),L3=hr.__importDefault(bn()),G3=Tl(),H3=Ga(),kl=Wn(),we=et(),He=ae(),K3=(function(){function t(e,r){var n=this;this.embedDefaultFont=function(){return n.doc.embedStandardFont(G3.StandardFonts.Helvetica)},He.assertIs(e,"acroForm",[[we.PDFAcroForm,"PDFAcroForm"]]),He.assertIs(r,"doc",[[W3.default,"PDFDocument"]]),this.acroForm=e,this.doc=r,this.dirtyFields=new Set,this.defaultFontCache=He.Cache.populatedBy(this.embedDefaultFont)}return t.prototype.hasXFA=function(){return this.acroForm.dict.has(we.PDFName.of("XFA"))},t.prototype.deleteXFA=function(){this.acroForm.dict.delete(we.PDFName.of("XFA"))},t.prototype.getFields=function(){for(var e=this.acroForm.getAllFields(),r=[],n=0,i=e.length;n<i;n++){var a=e[n],o=a[0],s=a[1],l=X3(o,s,this.doc);l&&r.push(l)}return r},t.prototype.getFieldMaybe=function(e){He.assertIs(e,"name",["string"]);for(var r=this.getFields(),n=0,i=r.length;n<i;n++){var a=r[n];if(a.getName()===e)return a}},t.prototype.getField=function(e){He.assertIs(e,"name",["string"]);var r=this.getFieldMaybe(e);if(r)return r;throw new Sr.NoSuchFieldError(e)},t.prototype.getButton=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof Rl.default)return r;throw new Sr.UnexpectedFieldTypeError(e,Rl.default,r)},t.prototype.getCheckBox=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof Es.default)return r;throw new Sr.UnexpectedFieldTypeError(e,Es.default,r)},t.prototype.getDropdown=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof Bl.default)return r;throw new Sr.UnexpectedFieldTypeError(e,Bl.default,r)},t.prototype.getOptionList=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof Nl.default)return r;throw new Sr.UnexpectedFieldTypeError(e,Nl.default,r)},t.prototype.getRadioGroup=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof Ss.default)return r;throw new Sr.UnexpectedFieldTypeError(e,Ss.default,r)},t.prototype.getSignature=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof L0.default)return r;throw new Sr.UnexpectedFieldTypeError(e,L0.default,r)},t.prototype.getTextField=function(e){He.assertIs(e,"name",["string"]);var r=this.getField(e);if(r instanceof Il.default)return r;throw new Sr.UnexpectedFieldTypeError(e,Il.default,r)},t.prototype.createButton=function(e){He.assertIs(e,"name",["string"]);var r=Ya(e),n=this.findOrCreateNonTerminals(r.nonTerminal),i=we.PDFAcroPushButton.create(this.doc.context);return i.setPartialName(r.terminal),Ja(n,[i,i.ref],r.terminal),Rl.default.of(i,i.ref,this.doc)},t.prototype.createCheckBox=function(e){He.assertIs(e,"name",["string"]);var r=Ya(e),n=this.findOrCreateNonTerminals(r.nonTerminal),i=we.PDFAcroCheckBox.create(this.doc.context);return i.setPartialName(r.terminal),Ja(n,[i,i.ref],r.terminal),Es.default.of(i,i.ref,this.doc)},t.prototype.createDropdown=function(e){He.assertIs(e,"name",["string"]);var r=Ya(e),n=this.findOrCreateNonTerminals(r.nonTerminal),i=we.PDFAcroComboBox.create(this.doc.context);return i.setPartialName(r.terminal),Ja(n,[i,i.ref],r.terminal),Bl.default.of(i,i.ref,this.doc)},t.prototype.createOptionList=function(e){He.assertIs(e,"name",["string"]);var r=Ya(e),n=this.findOrCreateNonTerminals(r.nonTerminal),i=we.PDFAcroListBox.create(this.doc.context);return i.setPartialName(r.terminal),Ja(n,[i,i.ref],r.terminal),Nl.default.of(i,i.ref,this.doc)},t.prototype.createRadioGroup=function(e){He.assertIs(e,"name",["string"]);var r=Ya(e),n=this.findOrCreateNonTerminals(r.nonTerminal),i=we.PDFAcroRadioButton.create(this.doc.context);return i.setPartialName(r.terminal),Ja(n,[i,i.ref],r.terminal),Ss.default.of(i,i.ref,this.doc)},t.prototype.createTextField=function(e){He.assertIs(e,"name",["string"]);var r=Ya(e),n=this.findOrCreateNonTerminals(r.nonTerminal),i=we.PDFAcroText.create(this.doc.context);return i.setPartialName(r.terminal),Ja(n,[i,i.ref],r.terminal),Il.default.of(i,i.ref,this.doc)},t.prototype.flatten=function(e){e===void 0&&(e={updateFieldAppearances:!0}),e.updateFieldAppearances&&this.updateFieldAppearances();for(var r=this.getFields(),n=0,i=r.length;n<i;n++){for(var a=r[n],o=a.acroField.getWidgets(),s=0,l=o.length;s<l;s++){var u=o[s],c=this.findWidgetPage(u),f=this.findWidgetAppearanceRef(a,u),d=c.node.newXObject("FlatWidget",f),p=u.getRectangle(),h=hr.__spreadArrays([kl.pushGraphicsState(),kl.translate(p.x,p.y)],H3.rotateInPlace(hr.__assign(hr.__assign({},p),{rotation:0})),[kl.drawObject(d),kl.popGraphicsState()]).filter(Boolean);c.pushOperators.apply(c,h)}this.removeField(a)}},t.prototype.removeField=function(e){for(var r=e.acroField.getWidgets(),n=new Set,i=0,a=r.length;i<a;i++){var o=r[i],s=this.findWidgetAppearanceRef(e,o),l=this.findWidgetPage(o);n.add(l),l.node.removeAnnot(s)}n.forEach(function(p){return p.node.removeAnnot(e.ref)}),this.acroForm.removeField(e.acroField);for(var u=e.acroField.normalizedEntries().Kids,c=u.size(),f=0;f<c;f++){var d=u.get(f);d instanceof we.PDFRef&&this.doc.context.delete(d)}this.doc.context.delete(e.ref)},t.prototype.updateFieldAppearances=function(e){He.assertOrUndefined(e,"font",[[L3.default,"PDFFont"]]),e=e??this.getDefaultFont();for(var r=this.getFields(),n=0,i=r.length;n<i;n++){var a=r[n];a.needsAppearancesUpdate()&&a.defaultUpdateAppearances(e)}},t.prototype.markFieldAsDirty=function(e){He.assertOrUndefined(e,"fieldRef",[[we.PDFRef,"PDFRef"]]),this.dirtyFields.add(e)},t.prototype.markFieldAsClean=function(e){He.assertOrUndefined(e,"fieldRef",[[we.PDFRef,"PDFRef"]]),this.dirtyFields.delete(e)},t.prototype.fieldIsDirty=function(e){return He.assertOrUndefined(e,"fieldRef",[[we.PDFRef,"PDFRef"]]),this.dirtyFields.has(e)},t.prototype.getDefaultFont=function(){return this.defaultFontCache.access()},t.prototype.findWidgetPage=function(e){var r=e.P(),n=this.doc.getPages().find(function(a){return a.ref===r});if(n===void 0){var i=this.doc.context.getObjectRef(e.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},t.prototype.findWidgetAppearanceRef=function(e,r){var n,i=r.getNormalAppearance();if(i instanceof we.PDFDict&&(e instanceof Es.default||e instanceof Ss.default)){var a=e.acroField.getValue(),o=(n=i.get(a))!==null&&n!==void 0?n:i.get(we.PDFName.of("Off"));o instanceof we.PDFRef&&(i=o)}if(!(i instanceof we.PDFRef)){var s=e.getName();throw new Error("Failed to extract appearance ref for: "+s)}return i},t.prototype.findOrCreateNonTerminals=function(e){for(var r=[this.acroForm],n=0,i=e.length;n<i;n++){var a=e[n];if(!a)throw new Sr.InvalidFieldNamePartError(a);var o=r[0],s=r[1],l=this.findNonTerminal(a,o);if(l)r=l;else{var u=we.PDFAcroNonTerminal.create(this.doc.context);u.setPartialName(a),u.setParent(s);var c=this.doc.context.register(u.dict);o.addField(c),r=[u,c]}}return r},t.prototype.findNonTerminal=function(e,r){for(var n=r instanceof we.PDFAcroForm?this.acroForm.getFields():we.createPDFAcroFields(r.Kids()),i=0,a=n.length;i<a;i++){var o=n[i],s=o[0],l=o[1];if(s.getPartialName()===e){if(s instanceof we.PDFAcroNonTerminal)return[s,l];throw new Sr.FieldAlreadyExistsError(e)}}},t.of=function(e,r){return new t(e,r)},t})();G0.default=K3;var X3=function(t,e,r){if(t instanceof we.PDFAcroPushButton)return Rl.default.of(t,e,r);if(t instanceof we.PDFAcroCheckBox)return Es.default.of(t,e,r);if(t instanceof we.PDFAcroComboBox)return Bl.default.of(t,e,r);if(t instanceof we.PDFAcroListBox)return Nl.default.of(t,e,r);if(t instanceof we.PDFAcroText)return Il.default.of(t,e,r);if(t instanceof we.PDFAcroRadioButton)return Ss.default.of(t,e,r);if(t instanceof we.PDFAcroSignature)return L0.default.of(t,e,r)},Ya=function(t){if(t.length===0)throw new Error("PDF field names must not be empty strings");for(var e=t.split("."),r=0,n=e.length;r<n;r++)if(e[r]==="")throw new Error('Periods in PDF field names must be separated by at least one character: "'+t+'"');return e.length===1?{nonTerminal:[],terminal:e[0]}:{nonTerminal:e.slice(0,e.length-1),terminal:e[e.length-1]}},Ja=function(t,e,r){for(var n=t[0],i=t[1],a=e[0],o=e[1],s=n.normalizedEntries(),l=we.createPDFAcroFields("Kids"in s?s.Kids:s.Fields),u=0,c=l.length;u<c;u++)if(l[u][0].getPartialName()===r)throw new Sr.FieldAlreadyExistsError(r);n.addField(o),a.setParent(i)}});var X0=D(ql=>{"use strict";Object.defineProperty(ql,"__esModule",{value:!0});ql.PageSizes=void 0;ql.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 Z0=D(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.ParseSpeeds=void 0;var Z3;(function(t){t[t.Fastest=1/0]="Fastest",t[t.Fast=1500]="Fast",t[t.Medium=500]="Medium",t[t.Slow=100]="Slow"})(Z3=Os.ParseSpeeds||(Os.ParseSpeeds={}))});var CF=D(Y0=>{"use strict";Object.defineProperty(Y0,"__esModule",{value:!0});var _F=(k(),R(T)),mt=et(),Y3=(function(){function t(e,r,n){this.alreadyEmbedded=!1,this.ref=e,this.doc=r,this.embedder=n}return t.prototype.embed=function(){return _F.__awaiter(this,void 0,void 0,function(){var e,r,n,i,a;return _F.__generator(this,function(o){switch(o.label){case 0:return this.alreadyEmbedded?[3,2]:[4,this.embedder.embedIntoContext(this.doc.context,this.ref)];case 1:e=o.sent(),this.doc.catalog.has(mt.PDFName.of("Names"))||this.doc.catalog.set(mt.PDFName.of("Names"),this.doc.context.obj({})),r=this.doc.catalog.lookup(mt.PDFName.of("Names"),mt.PDFDict),r.has(mt.PDFName.of("EmbeddedFiles"))||r.set(mt.PDFName.of("EmbeddedFiles"),this.doc.context.obj({})),n=r.lookup(mt.PDFName.of("EmbeddedFiles"),mt.PDFDict),n.has(mt.PDFName.of("Names"))||n.set(mt.PDFName.of("Names"),this.doc.context.obj([])),i=n.lookup(mt.PDFName.of("Names"),mt.PDFArray),i.push(mt.PDFHexString.fromText(this.embedder.fileName)),i.push(e),this.doc.catalog.has(mt.PDFName.of("AF"))||this.doc.catalog.set(mt.PDFName.of("AF"),this.doc.context.obj([])),a=this.doc.catalog.lookup(mt.PDFName.of("AF"),mt.PDFArray),a.push(e),this.alreadyEmbedded=!0,o.label=2;case 2:return[2]}})})},t.of=function(e,r,n){return new t(e,r,n)},t})();Y0.default=Y3});var Q0=D(J0=>{"use strict";Object.defineProperty(J0,"__esModule",{value:!0});var wF=(k(),R(T)),Jt=et(),J3=(function(){function t(e,r,n){this.alreadyEmbedded=!1,this.ref=e,this.doc=r,this.embedder=n}return t.prototype.embed=function(){return wF.__awaiter(this,void 0,void 0,function(){var e,r,n,i,a,o,s;return wF.__generator(this,function(l){switch(l.label){case 0:return this.alreadyEmbedded?[3,2]:(e=this.doc,r=e.catalog,n=e.context,[4,this.embedder.embedIntoContext(this.doc.context,this.ref)]);case 1:i=l.sent(),r.has(Jt.PDFName.of("Names"))||r.set(Jt.PDFName.of("Names"),n.obj({})),a=r.lookup(Jt.PDFName.of("Names"),Jt.PDFDict),a.has(Jt.PDFName.of("JavaScript"))||a.set(Jt.PDFName.of("JavaScript"),n.obj({})),o=a.lookup(Jt.PDFName.of("JavaScript"),Jt.PDFDict),o.has(Jt.PDFName.of("Names"))||o.set(Jt.PDFName.of("Names"),n.obj([])),s=o.lookup(Jt.PDFName.of("Names"),Jt.PDFArray),s.push(Jt.PDFHexString.fromText(this.embedder.scriptName)),s.push(i),this.alreadyEmbedded=!0,l.label=2;case 2:return[2]}})})},t.of=function(e,r,n){return new t(e,r,n)},t})();J0.default=J3});var PF=D(ep=>{"use strict";Object.defineProperty(ep,"__esModule",{value:!0});var $0=(k(),R(T)),Q3=$0.__importDefault(kt()),$3=(function(){function t(e,r){this.script=e,this.scriptName=r}return t.for=function(e,r){return new t(e,r)},t.prototype.embedIntoContext=function(e,r){return $0.__awaiter(this,void 0,void 0,function(){var n;return $0.__generator(this,function(i){return n=e.obj({Type:"Action",S:"JavaScript",JS:Q3.default.fromText(this.script)}),r?(e.assign(r,n),[2,r]):[2,e.register(n)]})})},t})();ep.default=$3});var Xn=D(tp=>{"use strict";Object.defineProperty(tp,"__esModule",{value:!0});var de=(k(),R(T)),jl=Ha(),eT=de.__importDefault(_l()),EF=de.__importDefault(bn()),SF=de.__importDefault(wl()),Qa=de.__importDefault(_n()),tT=de.__importDefault(H0()),rT=X0(),te=et(),nT=Z0(),Y=ae(),OF=de.__importStar(Nd()),iT=de.__importDefault(CF()),aT=de.__importDefault(Q0()),oT=de.__importDefault(PF()),sT=(function(){function t(e,r,n){var i=this;if(this.defaultWordBreaks=[" "],this.computePages=function(){var a=[];return i.catalog.Pages().traverse(function(o,s){if(o instanceof te.PDFPageLeaf){var l=i.pageMap.get(o);l||(l=Qa.default.of(o,s,i),i.pageMap.set(o,l)),a.push(l)}}),a},this.getOrCreateForm=function(){var a=i.catalog.getOrCreateAcroForm();return tT.default.of(a,i)},Y.assertIs(e,"context",[[te.PDFContext,"PDFContext"]]),Y.assertIs(r,"ignoreEncryption",["boolean"]),this.context=e,this.catalog=e.lookup(e.trailerInfo.Root),this.isEncrypted=!!e.lookup(e.trailerInfo.Encrypt),this.pageCache=Y.Cache.populatedBy(this.computePages),this.pageMap=new Map,this.formCache=Y.Cache.populatedBy(this.getOrCreateForm),this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!r&&this.isEncrypted)throw new jl.EncryptedPDFError;n&&this.updateInfoDict()}return t.load=function(e,r){return r===void 0&&(r={}),de.__awaiter(this,void 0,void 0,function(){var n,i,a,o,s,l,u,c,f,d,p,h;return de.__generator(this,function(v){switch(v.label){case 0:return n=r.ignoreEncryption,i=n===void 0?!1:n,a=r.parseSpeed,o=a===void 0?nT.ParseSpeeds.Slow:a,s=r.throwOnInvalidObject,l=s===void 0?!1:s,u=r.updateMetadata,c=u===void 0?!0:u,f=r.capNumbers,d=f===void 0?!1:f,Y.assertIs(e,"pdf",["string",Uint8Array,ArrayBuffer]),Y.assertIs(i,"ignoreEncryption",["boolean"]),Y.assertIs(o,"parseSpeed",["number"]),Y.assertIs(l,"throwOnInvalidObject",["boolean"]),p=Y.toUint8Array(e),[4,te.PDFParser.forBytesWithOptions(p,o,l,d).parseDocument()];case 1:return h=v.sent(),[2,new t(h,i,c)]}})})},t.create=function(e){return e===void 0&&(e={}),de.__awaiter(this,void 0,void 0,function(){var r,n,i,a,o,s;return de.__generator(this,function(l){return r=e.updateMetadata,n=r===void 0?!0:r,i=te.PDFContext.create(),a=te.PDFPageTree.withContext(i),o=i.register(a),s=te.PDFCatalog.withContextAndPages(i,o),i.trailerInfo.Root=i.register(s),[2,new t(i,!1,n)]})})},t.prototype.registerFontkit=function(e){this.fontkit=e},t.prototype.getForm=function(){var e=this.formCache.access();return e.hasXFA()&&(console.warn("Removing XFA form data as pdf-lib does not support reading or writing XFA"),e.deleteXFA()),e},t.prototype.getTitle=function(){var e=this.getInfoDict().lookup(te.PDFName.Title);if(e)return Zn(e),e.decodeText()},t.prototype.getAuthor=function(){var e=this.getInfoDict().lookup(te.PDFName.Author);if(e)return Zn(e),e.decodeText()},t.prototype.getSubject=function(){var e=this.getInfoDict().lookup(te.PDFName.Subject);if(e)return Zn(e),e.decodeText()},t.prototype.getKeywords=function(){var e=this.getInfoDict().lookup(te.PDFName.Keywords);if(e)return Zn(e),e.decodeText()},t.prototype.getCreator=function(){var e=this.getInfoDict().lookup(te.PDFName.Creator);if(e)return Zn(e),e.decodeText()},t.prototype.getProducer=function(){var e=this.getInfoDict().lookup(te.PDFName.Producer);if(e)return Zn(e),e.decodeText()},t.prototype.getCreationDate=function(){var e=this.getInfoDict().lookup(te.PDFName.CreationDate);if(e)return Zn(e),e.decodeDate()},t.prototype.getModificationDate=function(){var e=this.getInfoDict().lookup(te.PDFName.ModDate);if(e)return Zn(e),e.decodeDate()},t.prototype.setTitle=function(e,r){Y.assertIs(e,"title",["string"]);var n=te.PDFName.of("Title");if(this.getInfoDict().set(n,te.PDFHexString.fromText(e)),r?.showInWindowTitleBar){var i=this.catalog.getOrCreateViewerPreferences();i.setDisplayDocTitle(!0)}},t.prototype.setAuthor=function(e){Y.assertIs(e,"author",["string"]);var r=te.PDFName.of("Author");this.getInfoDict().set(r,te.PDFHexString.fromText(e))},t.prototype.setSubject=function(e){Y.assertIs(e,"author",["string"]);var r=te.PDFName.of("Subject");this.getInfoDict().set(r,te.PDFHexString.fromText(e))},t.prototype.setKeywords=function(e){Y.assertIs(e,"keywords",[Array]);var r=te.PDFName.of("Keywords");this.getInfoDict().set(r,te.PDFHexString.fromText(e.join(" ")))},t.prototype.setCreator=function(e){Y.assertIs(e,"creator",["string"]);var r=te.PDFName.of("Creator");this.getInfoDict().set(r,te.PDFHexString.fromText(e))},t.prototype.setProducer=function(e){Y.assertIs(e,"creator",["string"]);var r=te.PDFName.of("Producer");this.getInfoDict().set(r,te.PDFHexString.fromText(e))},t.prototype.setLanguage=function(e){Y.assertIs(e,"language",["string"]);var r=te.PDFName.of("Lang");this.catalog.set(r,te.PDFString.of(e))},t.prototype.setCreationDate=function(e){Y.assertIs(e,"creationDate",[[Date,"Date"]]);var r=te.PDFName.of("CreationDate");this.getInfoDict().set(r,te.PDFString.fromDate(e))},t.prototype.setModificationDate=function(e){Y.assertIs(e,"modificationDate",[[Date,"Date"]]);var r=te.PDFName.of("ModDate");this.getInfoDict().set(r,te.PDFString.fromDate(e))},t.prototype.getPageCount=function(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount},t.prototype.getPages=function(){return this.pageCache.access()},t.prototype.getPage=function(e){var r=this.getPages();return Y.assertRange(e,"index",0,r.length-1),r[e]},t.prototype.getPageIndices=function(){return Y.range(0,this.getPageCount())},t.prototype.removePage=function(e){var r=this.getPageCount();if(this.pageCount===0)throw new jl.RemovePageFromEmptyDocumentError;Y.assertRange(e,"index",0,r-1),this.catalog.removeLeafNode(e),this.pageCount=r-1},t.prototype.addPage=function(e){return Y.assertIs(e,"page",["undefined",[Qa.default,"PDFPage"],Array]),this.insertPage(this.getPageCount(),e)},t.prototype.insertPage=function(e,r){var n=this.getPageCount();if(Y.assertRange(e,"index",0,n),Y.assertIs(r,"page",["undefined",[Qa.default,"PDFPage"],Array]),!r||Array.isArray(r)){var i=Array.isArray(r)?r:rT.PageSizes.A4;r=Qa.default.create(this),r.setSize.apply(r,i)}else if(r.doc!==this)throw new jl.ForeignPageError;var a=this.catalog.insertLeafNode(r.ref,e);return r.node.setParent(a),this.pageMap.set(r.node,r),this.pageCache.invalidate(),this.pageCount=n+1,r},t.prototype.copyPages=function(e,r){return de.__awaiter(this,void 0,void 0,function(){var n,i,a,o,s,l,u,c;return de.__generator(this,function(f){switch(f.label){case 0:return Y.assertIs(e,"srcDoc",[[t,"PDFDocument"]]),Y.assertIs(r,"indices",[Array]),[4,e.flush()];case 1:for(f.sent(),n=te.PDFObjectCopier.for(e.context,this.context),i=e.getPages(),a=new Array(r.length),o=0,s=r.length;o<s;o++)l=i[r[o]],u=n.copy(l.node),c=this.context.register(u),a[o]=Qa.default.of(u,c,this);return[2,a]}})})},t.prototype.copy=function(){return de.__awaiter(this,void 0,void 0,function(){var e,r,n,i;return de.__generator(this,function(a){switch(a.label){case 0:return[4,t.create()];case 1:return e=a.sent(),[4,e.copyPages(this,this.getPageIndices())];case 2:for(r=a.sent(),n=0,i=r.length;n<i;n++)e.addPage(r[n]);return this.getAuthor()!==void 0&&e.setAuthor(this.getAuthor()),this.getCreationDate()!==void 0&&e.setCreationDate(this.getCreationDate()),this.getCreator()!==void 0&&e.setCreator(this.getCreator()),this.getModificationDate()!==void 0&&e.setModificationDate(this.getModificationDate()),this.getProducer()!==void 0&&e.setProducer(this.getProducer()),this.getSubject()!==void 0&&e.setSubject(this.getSubject()),this.getTitle()!==void 0&&e.setTitle(this.getTitle()),e.defaultWordBreaks=this.defaultWordBreaks,[2,e]}})})},t.prototype.addJavaScript=function(e,r){Y.assertIs(e,"name",["string"]),Y.assertIs(r,"script",["string"]);var n=oT.default.for(r,e),i=this.context.nextRef(),a=aT.default.of(i,this,n);this.javaScripts.push(a)},t.prototype.attach=function(e,r,n){return n===void 0&&(n={}),de.__awaiter(this,void 0,void 0,function(){var i,a,o,s;return de.__generator(this,function(l){return Y.assertIs(e,"attachment",["string",Uint8Array,ArrayBuffer]),Y.assertIs(r,"name",["string"]),Y.assertOrUndefined(n.mimeType,"mimeType",["string"]),Y.assertOrUndefined(n.description,"description",["string"]),Y.assertOrUndefined(n.creationDate,"options.creationDate",[Date]),Y.assertOrUndefined(n.modificationDate,"options.modificationDate",[Date]),Y.assertIsOneOfOrUndefined(n.afRelationship,"options.afRelationship",OF.AFRelationship),i=Y.toUint8Array(e),a=OF.default.for(i,r,n),o=this.context.nextRef(),s=iT.default.of(o,this,a),this.embeddedFiles.push(s),[2]})})},t.prototype.embedFont=function(e,r){return r===void 0&&(r={}),de.__awaiter(this,void 0,void 0,function(){var n,i,a,o,s,l,u,c,f,d;return de.__generator(this,function(p){switch(p.label){case 0:return n=r.subset,i=n===void 0?!1:n,a=r.customName,o=r.features,Y.assertIs(e,"font",["string",Uint8Array,ArrayBuffer]),Y.assertIs(i,"subset",["boolean"]),Y.isStandardFont(e)?(s=te.StandardFontEmbedder.for(e,a),[3,7]):[3,1];case 1:return Y.canBeConvertedToUint8Array(e)?(l=Y.toUint8Array(e),u=this.assertFontkit(),i?[4,te.CustomFontSubsetEmbedder.for(u,l,a,o)]:[3,3]):[3,6];case 2:return c=p.sent(),[3,5];case 3:return[4,te.CustomFontEmbedder.for(u,l,a,o)];case 4:c=p.sent(),p.label=5;case 5:return s=c,[3,7];case 6:throw new TypeError("`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`");case 7:return f=this.context.nextRef(),d=EF.default.of(f,this,s),this.fonts.push(d),[2,d]}})})},t.prototype.embedStandardFont=function(e,r){if(Y.assertIs(e,"font",["string"]),!Y.isStandardFont(e))throw new TypeError("`font` must be one of type `StandardFonts`");var n=te.StandardFontEmbedder.for(e,r),i=this.context.nextRef(),a=EF.default.of(i,this,n);return this.fonts.push(a),a},t.prototype.embedJpg=function(e){return de.__awaiter(this,void 0,void 0,function(){var r,n,i,a;return de.__generator(this,function(o){switch(o.label){case 0:return Y.assertIs(e,"jpg",["string",Uint8Array,ArrayBuffer]),r=Y.toUint8Array(e),[4,te.JpegEmbedder.for(r)];case 1:return n=o.sent(),i=this.context.nextRef(),a=SF.default.of(i,this,n),this.images.push(a),[2,a]}})})},t.prototype.embedPng=function(e){return de.__awaiter(this,void 0,void 0,function(){var r,n,i,a;return de.__generator(this,function(o){switch(o.label){case 0:return Y.assertIs(e,"png",["string",Uint8Array,ArrayBuffer]),r=Y.toUint8Array(e),[4,te.PngEmbedder.for(r)];case 1:return n=o.sent(),i=this.context.nextRef(),a=SF.default.of(i,this,n),this.images.push(a),[2,a]}})})},t.prototype.embedPdf=function(e,r){return r===void 0&&(r=[0]),de.__awaiter(this,void 0,void 0,function(){var n,i,a;return de.__generator(this,function(o){switch(o.label){case 0:return Y.assertIs(e,"pdf",["string",Uint8Array,ArrayBuffer,[t,"PDFDocument"]]),Y.assertIs(r,"indices",[Array]),e instanceof t?(i=e,[3,3]):[3,1];case 1:return[4,t.load(e)];case 2:i=o.sent(),o.label=3;case 3:return n=i,a=Y.pluckIndices(n.getPages(),r),[2,this.embedPages(a)]}})})},t.prototype.embedPage=function(e,r,n){return de.__awaiter(this,void 0,void 0,function(){var i;return de.__generator(this,function(a){switch(a.label){case 0:return Y.assertIs(e,"page",[[Qa.default,"PDFPage"]]),[4,this.embedPages([e],[r],[n])];case 1:return i=a.sent()[0],[2,i]}})})},t.prototype.embedPages=function(e,r,n){return r===void 0&&(r=[]),n===void 0&&(n=[]),de.__awaiter(this,void 0,void 0,function(){var u,c,i,a,o,s,l,u,c,f,d,p,h,v,g;return de.__generator(this,function(m){switch(m.label){case 0:if(e.length===0)return[2,[]];for(u=0,c=e.length-1;u<c;u++)if(i=e[u],a=e[u+1],i.node.context!==a.node.context)throw new te.PageEmbeddingMismatchedContextError;o=e[0].node.context,s=o===this.context?function(b){return b}:te.PDFObjectCopier.for(o,this.context).copy,l=new Array(e.length),u=0,c=e.length,m.label=1;case 1:return u<c?(f=s(e[u].node),d=r[u],p=n[u],[4,te.PDFPageEmbedder.for(f,d,p)]):[3,4];case 2:h=m.sent(),v=this.context.nextRef(),l[u]=eT.default.of(v,this,h),m.label=3;case 3:return u++,[3,1];case 4:return(g=this.embeddedPages).push.apply(g,l),[2,l]}})})},t.prototype.flush=function(){return de.__awaiter(this,void 0,void 0,function(){return de.__generator(this,function(e){switch(e.label){case 0:return[4,this.embedAll(this.fonts)];case 1:return e.sent(),[4,this.embedAll(this.images)];case 2:return e.sent(),[4,this.embedAll(this.embeddedPages)];case 3:return e.sent(),[4,this.embedAll(this.embeddedFiles)];case 4:return e.sent(),[4,this.embedAll(this.javaScripts)];case 5:return e.sent(),[2]}})})},t.prototype.save=function(e){return e===void 0&&(e={}),de.__awaiter(this,void 0,void 0,function(){var r,n,i,a,o,s,l,u,c,f;return de.__generator(this,function(d){switch(d.label){case 0:return r=e.useObjectStreams,n=r===void 0?!0:r,i=e.addDefaultPage,a=i===void 0?!0:i,o=e.objectsPerTick,s=o===void 0?50:o,l=e.updateFieldAppearances,u=l===void 0?!0:l,Y.assertIs(n,"useObjectStreams",["boolean"]),Y.assertIs(a,"addDefaultPage",["boolean"]),Y.assertIs(s,"objectsPerTick",["number"]),Y.assertIs(u,"updateFieldAppearances",["boolean"]),a&&this.getPageCount()===0&&this.addPage(),u&&(c=this.formCache.getValue(),c&&c.updateFieldAppearances()),[4,this.flush()];case 1:return d.sent(),f=n?te.PDFStreamWriter:te.PDFWriter,[2,f.forContext(this.context,s).serializeToBuffer()]}})})},t.prototype.saveAsBase64=function(e){return e===void 0&&(e={}),de.__awaiter(this,void 0,void 0,function(){var r,n,i,a,o;return de.__generator(this,function(s){switch(s.label){case 0:return r=e.dataUri,n=r===void 0?!1:r,i=de.__rest(e,["dataUri"]),Y.assertIs(n,"dataUri",["boolean"]),[4,this.save(i)];case 1:return a=s.sent(),o=Y.encodeToBase64(a),[2,n?"data:application/pdf;base64,"+o:o]}})})},t.prototype.findPageForAnnotationRef=function(e){for(var r=this.getPages(),n=0,i=r.length;n<i;n++){var a=r[n],o=a.node.Annots();if(o?.indexOf(e)!==void 0)return a}},t.prototype.embedAll=function(e){return de.__awaiter(this,void 0,void 0,function(){var r,n;return de.__generator(this,function(i){switch(i.label){case 0:r=0,n=e.length,i.label=1;case 1:return r<n?[4,e[r].embed()]:[3,4];case 2:i.sent(),i.label=3;case 3:return r++,[3,1];case 4:return[2]}})})},t.prototype.updateInfoDict=function(){var e="pdf-lib (https://github.com/Hopding/pdf-lib)",r=new Date,n=this.getInfoDict();this.setProducer(e),this.setModificationDate(r),n.get(te.PDFName.of("Creator"))||this.setCreator(e),n.get(te.PDFName.of("CreationDate"))||this.setCreationDate(r)},t.prototype.getInfoDict=function(){var e=this.context.lookup(this.context.trailerInfo.Info);if(e instanceof te.PDFDict)return e;var r=this.context.obj({});return this.context.trailerInfo.Info=this.context.register(r),r},t.prototype.assertFontkit=function(){if(!this.fontkit)throw new jl.FontkitNotRegisteredError;return this.fontkit},t})();tp.default=sT;function Zn(t){if(!(t instanceof te.PDFHexString)&&!(t instanceof te.PDFString))throw new te.UnexpectedObjectTypeError([te.PDFHexString,te.PDFString],t)}});var rp=D(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.BlendMode=void 0;var uT;(function(t){t.Normal="Normal",t.Multiply="Multiply",t.Screen="Screen",t.Overlay="Overlay",t.Darken="Darken",t.Lighten="Lighten",t.ColorDodge="ColorDodge",t.ColorBurn="ColorBurn",t.HardLight="HardLight",t.SoftLight="SoftLight",t.Difference="Difference",t.Exclusion="Exclusion"})(uT=As.BlendMode||(As.BlendMode={}))});var _n=D(np=>{"use strict";Object.defineProperty(np,"__esModule",{value:!0});var Yn=(k(),R(T)),Ts=ur(),Ni=Ga(),Yr=Wn(),AF=Yn.__importDefault(Xn()),lT=Yn.__importDefault(_l()),TF=Yn.__importDefault(bn()),cT=Yn.__importDefault(wl()),Ii=rp(),St=Zt(),fT=Tl(),ft=et(),_=ae(),dT=(function(){function t(e,r,n){this.fontSize=24,this.fontColor=Ts.rgb(0,0,0),this.lineHeight=24,this.x=0,this.y=0,_.assertIs(e,"leafNode",[[ft.PDFPageLeaf,"PDFPageLeaf"]]),_.assertIs(r,"ref",[[ft.PDFRef,"PDFRef"]]),_.assertIs(n,"doc",[[AF.default,"PDFDocument"]]),this.node=e,this.ref=r,this.doc=n}return t.prototype.setRotation=function(e){var r=St.toDegrees(e);_.assertMultiple(r,"degreesAngle",90),this.node.set(ft.PDFName.of("Rotate"),this.doc.context.obj(r))},t.prototype.getRotation=function(){var e=this.node.Rotate();return St.degrees(e?e.asNumber():0)},t.prototype.setSize=function(e,r){_.assertIs(e,"width",["number"]),_.assertIs(r,"height",["number"]);var n=this.getMediaBox();this.setMediaBox(n.x,n.y,e,r);var i=this.getCropBox(),a=this.getBleedBox(),o=this.getTrimBox(),s=this.getArtBox(),l=this.node.CropBox(),u=this.node.BleedBox(),c=this.node.TrimBox(),f=this.node.ArtBox();l&&_.rectanglesAreEqual(i,n)&&this.setCropBox(n.x,n.y,e,r),u&&_.rectanglesAreEqual(a,n)&&this.setBleedBox(n.x,n.y,e,r),c&&_.rectanglesAreEqual(o,n)&&this.setTrimBox(n.x,n.y,e,r),f&&_.rectanglesAreEqual(s,n)&&this.setArtBox(n.x,n.y,e,r)},t.prototype.setWidth=function(e){_.assertIs(e,"width",["number"]),this.setSize(e,this.getSize().height)},t.prototype.setHeight=function(e){_.assertIs(e,"height",["number"]),this.setSize(this.getSize().width,e)},t.prototype.setMediaBox=function(e,r,n,i){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),_.assertIs(n,"width",["number"]),_.assertIs(i,"height",["number"]);var a=this.doc.context.obj([e,r,e+n,r+i]);this.node.set(ft.PDFName.MediaBox,a)},t.prototype.setCropBox=function(e,r,n,i){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),_.assertIs(n,"width",["number"]),_.assertIs(i,"height",["number"]);var a=this.doc.context.obj([e,r,e+n,r+i]);this.node.set(ft.PDFName.CropBox,a)},t.prototype.setBleedBox=function(e,r,n,i){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),_.assertIs(n,"width",["number"]),_.assertIs(i,"height",["number"]);var a=this.doc.context.obj([e,r,e+n,r+i]);this.node.set(ft.PDFName.BleedBox,a)},t.prototype.setTrimBox=function(e,r,n,i){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),_.assertIs(n,"width",["number"]),_.assertIs(i,"height",["number"]);var a=this.doc.context.obj([e,r,e+n,r+i]);this.node.set(ft.PDFName.TrimBox,a)},t.prototype.setArtBox=function(e,r,n,i){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),_.assertIs(n,"width",["number"]),_.assertIs(i,"height",["number"]);var a=this.doc.context.obj([e,r,e+n,r+i]);this.node.set(ft.PDFName.ArtBox,a)},t.prototype.getSize=function(){var e=this.getMediaBox(),r=e.width,n=e.height;return{width:r,height:n}},t.prototype.getWidth=function(){return this.getSize().width},t.prototype.getHeight=function(){return this.getSize().height},t.prototype.getMediaBox=function(){var e=this.node.MediaBox();return e.asRectangle()},t.prototype.getCropBox=function(){var e,r=this.node.CropBox();return(e=r?.asRectangle())!==null&&e!==void 0?e:this.getMediaBox()},t.prototype.getBleedBox=function(){var e,r=this.node.BleedBox();return(e=r?.asRectangle())!==null&&e!==void 0?e:this.getCropBox()},t.prototype.getTrimBox=function(){var e,r=this.node.TrimBox();return(e=r?.asRectangle())!==null&&e!==void 0?e:this.getCropBox()},t.prototype.getArtBox=function(){var e,r=this.node.ArtBox();return(e=r?.asRectangle())!==null&&e!==void 0?e:this.getCropBox()},t.prototype.translateContent=function(e,r){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(Yr.pushGraphicsState(),Yr.translate(e,r)),i=this.doc.context.register(n),a=this.createContentStream(Yr.popGraphicsState()),o=this.doc.context.register(a);this.node.wrapContentStreams(i,o)},t.prototype.scale=function(e,r){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),this.setSize(this.getWidth()*e,this.getHeight()*r),this.scaleContent(e,r),this.scaleAnnotations(e,r)},t.prototype.scaleContent=function(e,r){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),this.node.normalize(),this.getContentStream();var n=this.createContentStream(Yr.pushGraphicsState(),Yr.scale(e,r)),i=this.doc.context.register(n),a=this.createContentStream(Yr.popGraphicsState()),o=this.doc.context.register(a);this.node.wrapContentStreams(i,o)},t.prototype.scaleAnnotations=function(e,r){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]);var n=this.node.Annots();if(n)for(var i=0;i<n.size();i++){var a=n.lookup(i);a instanceof ft.PDFDict&&this.scaleAnnot(a,e,r)}},t.prototype.resetPosition=function(){this.getContentStream(!1),this.x=0,this.y=0},t.prototype.setFont=function(e){_.assertIs(e,"font",[[TF.default,"PDFFont"]]),this.font=e,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)},t.prototype.setFontSize=function(e){_.assertIs(e,"fontSize",["number"]),this.fontSize=e},t.prototype.setFontColor=function(e){_.assertIs(e,"fontColor",[[Object,"Color"]]),this.fontColor=e},t.prototype.setLineHeight=function(e){_.assertIs(e,"lineHeight",["number"]),this.lineHeight=e},t.prototype.getPosition=function(){return{x:this.x,y:this.y}},t.prototype.getX=function(){return this.x},t.prototype.getY=function(){return this.y},t.prototype.moveTo=function(e,r){_.assertIs(e,"x",["number"]),_.assertIs(r,"y",["number"]),this.x=e,this.y=r},t.prototype.moveDown=function(e){_.assertIs(e,"yDecrease",["number"]),this.y-=e},t.prototype.moveUp=function(e){_.assertIs(e,"yIncrease",["number"]),this.y+=e},t.prototype.moveLeft=function(e){_.assertIs(e,"xDecrease",["number"]),this.x-=e},t.prototype.moveRight=function(e){_.assertIs(e,"xIncrease",["number"]),this.x+=e},t.prototype.pushOperators=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];_.assertEachIs(e,"operator",[[ft.PDFOperator,"PDFOperator"]]);var n=this.getContentStream();n.push.apply(n,e)},t.prototype.drawText=function(e,r){var n,i,a,o,s,l,u;r===void 0&&(r={}),_.assertIs(e,"text",["string"]),_.assertOrUndefined(r.color,"options.color",[[Object,"Color"]]),_.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),_.assertOrUndefined(r.font,"options.font",[[TF.default,"PDFFont"]]),_.assertOrUndefined(r.size,"options.size",["number"]),_.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),_.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),_.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),_.assertOrUndefined(r.x,"options.x",["number"]),_.assertOrUndefined(r.y,"options.y",["number"]),_.assertOrUndefined(r.lineHeight,"options.lineHeight",["number"]),_.assertOrUndefined(r.maxWidth,"options.maxWidth",["number"]),_.assertOrUndefined(r.wordBreaks,"options.wordBreaks",[Array]),_.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ii.BlendMode);for(var c=this.setOrEmbedFont(r.font),f=c.oldFont,d=c.newFont,p=c.newFontKey,h=r.size||this.fontSize,v=r.wordBreaks||this.doc.defaultWordBreaks,g=function(S){return d.widthOfTextAtSize(S,h)},m=r.maxWidth===void 0?_.lineSplit(_.cleanText(e)):_.breakTextIntoLines(e,v,r.maxWidth,g),b=new Array(m.length),w=0,F=m.length;w<F;w++)b[w]=d.encodeText(m[w]);var y=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),C=this.getContentStream();C.push.apply(C,Ni.drawLinesOfText(b,{color:(n=r.color)!==null&&n!==void 0?n:this.fontColor,font:p,size:h,rotate:(i=r.rotate)!==null&&i!==void 0?i:St.degrees(0),xSkew:(a=r.xSkew)!==null&&a!==void 0?a:St.degrees(0),ySkew:(o=r.ySkew)!==null&&o!==void 0?o:St.degrees(0),x:(s=r.x)!==null&&s!==void 0?s:this.x,y:(l=r.y)!==null&&l!==void 0?l:this.y,lineHeight:(u=r.lineHeight)!==null&&u!==void 0?u:this.lineHeight,graphicsState:y})),r.font&&(f?this.setFont(f):this.resetFont())},t.prototype.drawImage=function(e,r){var n,i,a,o,s,l,u;r===void 0&&(r={}),_.assertIs(e,"image",[[cT.default,"PDFImage"]]),_.assertOrUndefined(r.x,"options.x",["number"]),_.assertOrUndefined(r.y,"options.y",["number"]),_.assertOrUndefined(r.width,"options.width",["number"]),_.assertOrUndefined(r.height,"options.height",["number"]),_.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),_.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),_.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),_.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),_.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ii.BlendMode);var c=this.node.newXObject("Image",e.ref),f=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),d=this.getContentStream();d.push.apply(d,Ni.drawImage(c,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,width:(a=r.width)!==null&&a!==void 0?a:e.size().width,height:(o=r.height)!==null&&o!==void 0?o:e.size().height,rotate:(s=r.rotate)!==null&&s!==void 0?s:St.degrees(0),xSkew:(l=r.xSkew)!==null&&l!==void 0?l:St.degrees(0),ySkew:(u=r.ySkew)!==null&&u!==void 0?u:St.degrees(0),graphicsState:f}))},t.prototype.drawPage=function(e,r){var n,i,a,o,s;r===void 0&&(r={}),_.assertIs(e,"embeddedPage",[[lT.default,"PDFEmbeddedPage"]]),_.assertOrUndefined(r.x,"options.x",["number"]),_.assertOrUndefined(r.y,"options.y",["number"]),_.assertOrUndefined(r.xScale,"options.xScale",["number"]),_.assertOrUndefined(r.yScale,"options.yScale",["number"]),_.assertOrUndefined(r.width,"options.width",["number"]),_.assertOrUndefined(r.height,"options.height",["number"]),_.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),_.assertOrUndefined(r.xSkew,"options.xSkew",[[Object,"Rotation"]]),_.assertOrUndefined(r.ySkew,"options.ySkew",[[Object,"Rotation"]]),_.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),_.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ii.BlendMode);var l=this.node.newXObject("EmbeddedPdfPage",e.ref),u=this.maybeEmbedGraphicsState({opacity:r.opacity,blendMode:r.blendMode}),c=r.width!==void 0?r.width/e.width:r.xScale!==void 0?r.xScale:1,f=r.height!==void 0?r.height/e.height:r.yScale!==void 0?r.yScale:1,d=this.getContentStream();d.push.apply(d,Ni.drawPage(l,{x:(n=r.x)!==null&&n!==void 0?n:this.x,y:(i=r.y)!==null&&i!==void 0?i:this.y,xScale:c,yScale:f,rotate:(a=r.rotate)!==null&&a!==void 0?a:St.degrees(0),xSkew:(o=r.xSkew)!==null&&o!==void 0?o:St.degrees(0),ySkew:(s=r.ySkew)!==null&&s!==void 0?s:St.degrees(0),graphicsState:u}))},t.prototype.drawSvgPath=function(e,r){var n,i,a,o,s,l,u,c,f;r===void 0&&(r={}),_.assertIs(e,"path",["string"]),_.assertOrUndefined(r.x,"options.x",["number"]),_.assertOrUndefined(r.y,"options.y",["number"]),_.assertOrUndefined(r.scale,"options.scale",["number"]),_.assertOrUndefined(r.rotate,"options.rotate",[[Object,"Rotation"]]),_.assertOrUndefined(r.borderWidth,"options.borderWidth",["number"]),_.assertOrUndefined(r.color,"options.color",[[Object,"Color"]]),_.assertRangeOrUndefined(r.opacity,"opacity.opacity",0,1),_.assertOrUndefined(r.borderColor,"options.borderColor",[[Object,"Color"]]),_.assertOrUndefined(r.borderDashArray,"options.borderDashArray",[Array]),_.assertOrUndefined(r.borderDashPhase,"options.borderDashPhase",["number"]),_.assertIsOneOfOrUndefined(r.borderLineCap,"options.borderLineCap",Yr.LineCapStyle),_.assertRangeOrUndefined(r.borderOpacity,"options.borderOpacity",0,1),_.assertIsOneOfOrUndefined(r.blendMode,"options.blendMode",Ii.BlendMode);var d=this.maybeEmbedGraphicsState({opacity:r.opacity,borderOpacity:r.borderOpacity,blendMode:r.blendMode});!("color"in r)&&!("borderColor"in r)&&(r.borderColor=Ts.rgb(0,0,0));var p=this.getContentStream();p.push.apply(p,Ni.drawSvgPath(e,{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:(a=r.rotate)!==null&&a!==void 0?a:St.degrees(0),color:(o=r.color)!==null&&o!==void 0?o:void 0,borderColor:(s=r.borderColor)!==null&&s!==void 0?s:void 0,borderWidth:(l=r.borderWidth)!==null&&l!==void 0?l:0,borderDashArray:(u=r.borderDashArray)!==null&&u!==void 0?u:void 0,borderDashPhase:(c=r.borderDashPhase)!==null&&c!==void 0?c:void 0,borderLineCap:(f=r.borderLineCap)!==null&&f!==void 0?f:void 0,graphicsState:d}))},t.prototype.drawLine=function(e){var r,n,i,a,o;_.assertIs(e.start,"options.start",[[Object,"{ x: number, y: number }"]]),_.assertIs(e.end,"options.end",[[Object,"{ x: number, y: number }"]]),_.assertIs(e.start.x,"options.start.x",["number"]),_.assertIs(e.start.y,"options.start.y",["number"]),_.assertIs(e.end.x,"options.end.x",["number"]),_.assertIs(e.end.y,"options.end.y",["number"]),_.assertOrUndefined(e.thickness,"options.thickness",["number"]),_.assertOrUndefined(e.color,"options.color",[[Object,"Color"]]),_.assertOrUndefined(e.dashArray,"options.dashArray",[Array]),_.assertOrUndefined(e.dashPhase,"options.dashPhase",["number"]),_.assertIsOneOfOrUndefined(e.lineCap,"options.lineCap",Yr.LineCapStyle),_.assertRangeOrUndefined(e.opacity,"opacity.opacity",0,1),_.assertIsOneOfOrUndefined(e.blendMode,"options.blendMode",Ii.BlendMode);var s=this.maybeEmbedGraphicsState({borderOpacity:e.opacity,blendMode:e.blendMode});"color"in e||(e.color=Ts.rgb(0,0,0));var l=this.getContentStream();l.push.apply(l,Ni.drawLine({start:e.start,end:e.end,thickness:(r=e.thickness)!==null&&r!==void 0?r:1,color:(n=e.color)!==null&&n!==void 0?n:void 0,dashArray:(i=e.dashArray)!==null&&i!==void 0?i:void 0,dashPhase:(a=e.dashPhase)!==null&&a!==void 0?a:void 0,lineCap:(o=e.lineCap)!==null&&o!==void 0?o:void 0,graphicsState:s}))},t.prototype.drawRectangle=function(e){var r,n,i,a,o,s,l,u,c,f,d,p,h;e===void 0&&(e={}),_.assertOrUndefined(e.x,"options.x",["number"]),_.assertOrUndefined(e.y,"options.y",["number"]),_.assertOrUndefined(e.width,"options.width",["number"]),_.assertOrUndefined(e.height,"options.height",["number"]),_.assertOrUndefined(e.rotate,"options.rotate",[[Object,"Rotation"]]),_.assertOrUndefined(e.xSkew,"options.xSkew",[[Object,"Rotation"]]),_.assertOrUndefined(e.ySkew,"options.ySkew",[[Object,"Rotation"]]),_.assertOrUndefined(e.borderWidth,"options.borderWidth",["number"]),_.assertOrUndefined(e.color,"options.color",[[Object,"Color"]]),_.assertRangeOrUndefined(e.opacity,"opacity.opacity",0,1),_.assertOrUndefined(e.borderColor,"options.borderColor",[[Object,"Color"]]),_.assertOrUndefined(e.borderDashArray,"options.borderDashArray",[Array]),_.assertOrUndefined(e.borderDashPhase,"options.borderDashPhase",["number"]),_.assertIsOneOfOrUndefined(e.borderLineCap,"options.borderLineCap",Yr.LineCapStyle),_.assertRangeOrUndefined(e.borderOpacity,"options.borderOpacity",0,1),_.assertIsOneOfOrUndefined(e.blendMode,"options.blendMode",Ii.BlendMode);var v=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=Ts.rgb(0,0,0));var g=this.getContentStream();g.push.apply(g,Ni.drawRectangle({x:(r=e.x)!==null&&r!==void 0?r:this.x,y:(n=e.y)!==null&&n!==void 0?n:this.y,width:(i=e.width)!==null&&i!==void 0?i:150,height:(a=e.height)!==null&&a!==void 0?a:100,rotate:(o=e.rotate)!==null&&o!==void 0?o:St.degrees(0),xSkew:(s=e.xSkew)!==null&&s!==void 0?s:St.degrees(0),ySkew:(l=e.ySkew)!==null&&l!==void 0?l:St.degrees(0),borderWidth:(u=e.borderWidth)!==null&&u!==void 0?u:0,color:(c=e.color)!==null&&c!==void 0?c:void 0,borderColor:(f=e.borderColor)!==null&&f!==void 0?f:void 0,borderDashArray:(d=e.borderDashArray)!==null&&d!==void 0?d:void 0,borderDashPhase:(p=e.borderDashPhase)!==null&&p!==void 0?p:void 0,graphicsState:v,borderLineCap:(h=e.borderLineCap)!==null&&h!==void 0?h:void 0}))},t.prototype.drawSquare=function(e){e===void 0&&(e={});var r=e.size;_.assertOrUndefined(r,"size",["number"]),this.drawRectangle(Yn.__assign(Yn.__assign({},e),{width:r,height:r}))},t.prototype.drawEllipse=function(e){var r,n,i,a,o,s,l,u,c,f,d;e===void 0&&(e={}),_.assertOrUndefined(e.x,"options.x",["number"]),_.assertOrUndefined(e.y,"options.y",["number"]),_.assertOrUndefined(e.xScale,"options.xScale",["number"]),_.assertOrUndefined(e.yScale,"options.yScale",["number"]),_.assertOrUndefined(e.rotate,"options.rotate",[[Object,"Rotation"]]),_.assertOrUndefined(e.color,"options.color",[[Object,"Color"]]),_.assertRangeOrUndefined(e.opacity,"opacity.opacity",0,1),_.assertOrUndefined(e.borderColor,"options.borderColor",[[Object,"Color"]]),_.assertRangeOrUndefined(e.borderOpacity,"options.borderOpacity",0,1),_.assertOrUndefined(e.borderWidth,"options.borderWidth",["number"]),_.assertOrUndefined(e.borderDashArray,"options.borderDashArray",[Array]),_.assertOrUndefined(e.borderDashPhase,"options.borderDashPhase",["number"]),_.assertIsOneOfOrUndefined(e.borderLineCap,"options.borderLineCap",Yr.LineCapStyle),_.assertIsOneOfOrUndefined(e.blendMode,"options.blendMode",Ii.BlendMode);var p=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=Ts.rgb(0,0,0));var h=this.getContentStream();h.push.apply(h,Ni.drawEllipse({x:(r=e.x)!==null&&r!==void 0?r:this.x,y:(n=e.y)!==null&&n!==void 0?n:this.y,xScale:(i=e.xScale)!==null&&i!==void 0?i:100,yScale:(a=e.yScale)!==null&&a!==void 0?a:100,rotate:(o=e.rotate)!==null&&o!==void 0?o:void 0,color:(s=e.color)!==null&&s!==void 0?s:void 0,borderColor:(l=e.borderColor)!==null&&l!==void 0?l:void 0,borderWidth:(u=e.borderWidth)!==null&&u!==void 0?u:0,borderDashArray:(c=e.borderDashArray)!==null&&c!==void 0?c:void 0,borderDashPhase:(f=e.borderDashPhase)!==null&&f!==void 0?f:void 0,borderLineCap:(d=e.borderLineCap)!==null&&d!==void 0?d:void 0,graphicsState:p}))},t.prototype.drawCircle=function(e){e===void 0&&(e={});var r=e.size,n=r===void 0?100:r;_.assertOrUndefined(n,"size",["number"]),this.drawEllipse(Yn.__assign(Yn.__assign({},e),{xScale:n,yScale:n}))},t.prototype.setOrEmbedFont=function(e){var r=this.font,n=this.fontKey;e?this.setFont(e):this.getFont();var i=this.font,a=this.fontKey;return{oldFont:r,oldFontKey:n,newFont:i,newFontKey:a}},t.prototype.getFont=function(){if(!this.font||!this.fontKey){var e=this.doc.embedStandardFont(fT.StandardFonts.Helvetica);this.setFont(e)}return[this.font,this.fontKey]},t.prototype.resetFont=function(){this.font=void 0,this.fontKey=void 0},t.prototype.getContentStream=function(e){return e===void 0&&(e=!0),e&&this.contentStream?this.contentStream:(this.contentStream=this.createContentStream(),this.contentStreamRef=this.doc.context.register(this.contentStream),this.node.addContentStream(this.contentStreamRef),this.contentStream)},t.prototype.createContentStream=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=this.doc.context.obj({}),i=ft.PDFContentStream.of(n,e);return i},t.prototype.maybeEmbedGraphicsState=function(e){var r=e.opacity,n=e.borderOpacity,i=e.blendMode;if(!(r===void 0&&n===void 0&&i===void 0)){var a=this.doc.context.obj({Type:"ExtGState",ca:r,CA:n,BM:i}),o=this.node.newExtGState("GS",a);return o}},t.prototype.scaleAnnot=function(e,r,n){for(var i=["RD","CL","Vertices","QuadPoints","L","Rect"],a=0,o=i.length;a<o;a++){var s=e.lookup(ft.PDFName.of(i[a]));s instanceof ft.PDFArray&&s.scalePDFNumbers(r,n)}var l=e.lookup(ft.PDFName.of("InkList"));if(l instanceof ft.PDFArray)for(var a=0,o=l.size();a<o;a++){var u=l.lookup(a);u instanceof ft.PDFArray&&u.scalePDFNumbers(r,n)}},t.of=function(e,r,n){return new t(e,r,n)},t.create=function(e){_.assertIs(e,"doc",[[AF.default,"PDFDocument"]]);var r=ft.PDFRef.of(-1),n=ft.PDFPageLeaf.withContextAndParent(e.context,r),i=e.context.register(n);return new t(n,i,e)},t})();np.default=dT});var K0=D(ip=>{"use strict";Object.defineProperty(ip,"__esModule",{value:!0});var Ml=(k(),R(T)),hT=Ml.__importDefault(_n()),kF=Ml.__importDefault(bn()),pT=Pl(),RF=Kn(),BF=Ml.__importStar(xn()),NF=ur(),vT=Zt(),IF=et(),qi=ae(),mT=(function(t){Ml.__extends(e,t);function e(r,n,i){var a=t.call(this,r,n,i)||this;return qi.assertIs(r,"acroButton",[[IF.PDFAcroPushButton,"PDFAcroPushButton"]]),a.acroField=r,a}return e.prototype.setImage=function(r,n){n===void 0&&(n=pT.ImageAlignment.Center);for(var i=this.acroField.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a],l=this.createImageAppearanceStream(s,r,n);this.updateWidgetAppearances(s,{normal:l})}this.markAsClean()},e.prototype.setFontSize=function(r){qi.assertPositive(r,"fontSize"),this.acroField.setFontSize(r),this.markAsDirty()},e.prototype.addToPage=function(r,n,i){var a,o,s,l,u,c,f,d,p,h,v;qi.assertOrUndefined(r,"text",["string"]),qi.assertOrUndefined(n,"page",[[hT.default,"PDFPage"]]),BF.assertFieldAppearanceOptions(i);var g=this.createWidget({x:((a=i?.x)!==null&&a!==void 0?a:0)-((o=i?.borderWidth)!==null&&o!==void 0?o:0)/2,y:((s=i?.y)!==null&&s!==void 0?s:0)-((l=i?.borderWidth)!==null&&l!==void 0?l:0)/2,width:(u=i?.width)!==null&&u!==void 0?u:100,height:(c=i?.height)!==null&&c!==void 0?c:50,textColor:(f=i?.textColor)!==null&&f!==void 0?f:NF.rgb(0,0,0),backgroundColor:(d=i?.backgroundColor)!==null&&d!==void 0?d:NF.rgb(.75,.75,.75),borderColor:i?.borderColor,borderWidth:(p=i?.borderWidth)!==null&&p!==void 0?p:0,rotate:(h=i?.rotate)!==null&&h!==void 0?h:vT.degrees(0),caption:r,hidden:i?.hidden,page:n.ref}),m=this.doc.context.register(g.dict);this.acroField.addWidget(m);var b=(v=i?.font)!==null&&v!==void 0?v:this.doc.getForm().getDefaultFont();this.updateWidgetAppearance(g,b),n.node.addAnnot(m)},e.prototype.needsAppearancesUpdate=function(){var r;if(this.isDirty())return!0;for(var n=this.acroField.getWidgets(),i=0,a=n.length;i<a;i++){var o=n[i],s=((r=o.getAppearances())===null||r===void 0?void 0:r.normal)instanceof IF.PDFStream;if(!s)return!0}return!1},e.prototype.defaultUpdateAppearances=function(r){qi.assertIs(r,"font",[[kF.default,"PDFFont"]]),this.updateAppearances(r)},e.prototype.updateAppearances=function(r,n){qi.assertIs(r,"font",[[kF.default,"PDFFont"]]),qi.assertOrUndefined(n,"provider",[Function]);for(var i=this.acroField.getWidgets(),a=0,o=i.length;a<o;a++){var s=i[a];this.updateWidgetAppearance(s,r,n)}},e.prototype.updateWidgetAppearance=function(r,n,i){var a=i??RF.defaultButtonAppearanceProvider,o=RF.normalizeAppearance(a(this,r,n));this.updateWidgetAppearanceWithFont(r,n,o)},e.of=function(r,n,i){return new e(r,n,i)},e})(BF.default);ip.default=mT});var qF=D(pr=>{"use strict";Object.defineProperty(pr,"__esModule",{value:!0});var gT=(k(),R(T));gT.__exportStar(Kn(),pr);var DT=K0();Object.defineProperty(pr,"PDFButton",{enumerable:!0,get:function(){return DT.default}});var yT=P0();Object.defineProperty(pr,"PDFCheckBox",{enumerable:!0,get:function(){return yT.default}});var FT=O0();Object.defineProperty(pr,"PDFDropdown",{enumerable:!0,get:function(){return FT.default}});var bT=xn();Object.defineProperty(pr,"PDFField",{enumerable:!0,get:function(){return bT.default}});var xT=H0();Object.defineProperty(pr,"PDFForm",{enumerable:!0,get:function(){return xT.default}});var _T=k0();Object.defineProperty(pr,"PDFOptionList",{enumerable:!0,get:function(){return _T.default}});var CT=I0();Object.defineProperty(pr,"PDFRadioGroup",{enumerable:!0,get:function(){return CT.default}});var wT=j0();Object.defineProperty(pr,"PDFSignature",{enumerable:!0,get:function(){return wT.default}});var PT=W0();Object.defineProperty(pr,"PDFTextField",{enumerable:!0,get:function(){return PT.default}})});var MF=D(Ul=>{"use strict";Object.defineProperty(Ul,"__esModule",{value:!0});var jF=(k(),R(T));jF.__exportStar(_s(),Ul);jF.__exportStar(f0(),Ul)});var UF=D(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});var Qt=(k(),R(T));Qt.__exportStar(qF(),Ze);Qt.__exportStar(MF(),Ze);Qt.__exportStar(ur(),Ze);Qt.__exportStar(Ha(),Ze);Qt.__exportStar(F0(),Ze);Qt.__exportStar(pl(),Ze);Qt.__exportStar(Ga(),Ze);Qt.__exportStar(Wn(),Ze);Qt.__exportStar(Zt(),Ze);Qt.__exportStar(X0(),Ze);Qt.__exportStar(rp(),Ze);Qt.__exportStar(Z0(),Ze);Qt.__exportStar(Tl(),Ze);var ET=Xn();Object.defineProperty(Ze,"PDFDocument",{enumerable:!0,get:function(){return ET.default}});var ST=bn();Object.defineProperty(Ze,"PDFFont",{enumerable:!0,get:function(){return ST.default}});var OT=wl();Object.defineProperty(Ze,"PDFImage",{enumerable:!0,get:function(){return OT.default}});var AT=_n();Object.defineProperty(Ze,"PDFPage",{enumerable:!0,get:function(){return AT.default}});var TT=_l();Object.defineProperty(Ze,"PDFEmbeddedPage",{enumerable:!0,get:function(){return TT.default}});var kT=Q0();Object.defineProperty(Ze,"PDFJavaScript",{enumerable:!0,get:function(){return kT.default}})});var zF=D(VF=>{"use strict";Object.defineProperty(VF,"__esModule",{value:!0})});var WF=D($a=>{"use strict";Object.defineProperty($a,"__esModule",{value:!0});var Vl=(k(),R(T));Vl.__exportStar(UF(),$a);Vl.__exportStar(et(),$a);Vl.__exportStar(zF(),$a);Vl.__exportStar(ae(),$a)});(function(){gp().config(Object.assign({},yp(),bp()(process.argv)))})();var Bp=je(Rp(),1),{program:gk,createCommand:Dk,createArgument:yk,createOption:Fk,CommanderError:bk,InvalidArgumentError:xk,InvalidOptionArgumentError:_k,Command:Np,Argument:Ck,Option:wk,Help:Pk}=Bp.default;kr();var an=je(require("node:path"),1),Tv=je(require("sharp"),1);xo();kr();var ia=je(require("node:fs/promises"),1),nn=je(require("node:path"),1),E1=[".png",".jpg",".jpeg"],S1=[".pdf"];async function Ys(t,e){let r=nn.resolve(t);try{if(!(await ia.stat(r)).isDirectory())throw new Error(`Not a directory: ${r}`)}catch(o){throw o.code==="ENOENT"?new Error(`Directory not found: ${r}`):o}let n=await ia.readdir(r,{withFileTypes:!0}),i=e.map(o=>o.startsWith(".")?o.toLowerCase():`.${o.toLowerCase()}`),a=[];for(let o of n)if(o.isFile()){let s=nn.extname(o.name).toLowerCase();i.includes(s)&&a.push(nn.join(r,o.name))}return a.sort((o,s)=>nn.basename(o).localeCompare(nn.basename(s))),{directory:r,files:a,count:a.length}}async function Sv(t){return Ys(t,E1)}async function Ov(t){return Ys(t,S1)}var Av=je(require("node:readline"),1);kr();async function aa(t){let{fileCount:e,fileType:r,actions:n,preserveOriginals:i=!0}=t;console.log(),console.log(Q.cyan(`Found ${Q.bold(e)} ${r}`)),console.log(),console.log(Q.yellow("Planned actions:"));for(let a of n)console.log(Q.white(` \u2022 ${a}`));return i&&console.log(Q.white(" \u2022 Originals will remain unchanged")),console.log(),new Promise(a=>{let o=Av.createInterface({input:process.stdin,output:process.stdout}),s=!1;o.on("close",()=>{s||(s=!0,console.log(),console.log(Q.red("Aborted.")),a(!1))}),o.question(Q.green("Continue? (y/N) "),l=>{s=!0,o.close();let u=l.trim().toLowerCase();u==="y"||u==="yes"?a(!0):(console.log(Q.red("Aborted.")),a(!1))})})}var O1=["png","jpg","jpeg","webp","gif","tiff","avif"];async function jc(t,e={}){let{from:r,to:n="webp",quality:i=80,maxWidth:a}=e,s=(r?Array.isArray(r)?r:[r]:[...O1]).filter(v=>n==="jpg"&&(v==="jpg"||v==="jpeg")?!1:v!==n);if(s.length===0){console.log(Q.yellow("No valid source formats to convert."));return}let l=await Ys(t,s);if(l.count===0){let v=s.map(g=>g.toUpperCase()).join(", ");console.log(Q.yellow(`No ${v} images found in directory.`));return}let u=r?(Array.isArray(r)?r.join(", "):r).toUpperCase():"all supported formats",c=[`Convert ${u} \u2192 ${n.toUpperCase()}`];if(a&&c.push(`Resize to max width ${a}px`),c.push(`Quality: ${i}%`),!await aa({fileCount:l.count,fileType:`${u} images`,actions:c,preserveOriginals:!0}))return;let d=rn("Converting images...").start(),p=0,h=0;for(let v of l.files)try{let g=an.dirname(v),m=an.basename(v,an.extname(v)),w=an.join(g,`${m}.${n==="jpg"?"jpg":n}`),F=(0,Tv.default)(v);switch(a&&(F=F.resize({width:a,withoutEnlargement:!0})),n){case"webp":await F.webp({quality:i}).toFile(w);break;case"png":await F.png({quality:i}).toFile(w);break;case"jpg":await F.jpeg({quality:i}).toFile(w);break}p++,d.text=`Converting images... (${p}/${l.count})`}catch{h++,d.warn(`Failed to convert: ${an.basename(v)}`),d.start()}d.stop(),console.log(),console.log(Q.green(`\u2713 Converted ${p} images to ${n.toUpperCase()}`)),h>0&&console.log(Q.red(`\u2717 Failed to convert ${h} images`))}var Rr=je(require("node:path"),1),Mc=je(require("sharp"),1);xo();kr();async function Uc(t,e){let{maxWidth:r,quality:n=80}=e,i=await Sv(t);if(i.count===0){console.log(Q.yellow("No images found in directory."));return}let a=[`Resize to max width ${r}px`,"Preserve aspect ratio"];if(!await aa({fileCount:i.count,fileType:"images",actions:a,preserveOriginals:!0}))return;let s=rn("Resizing images...").start(),l=0,u=0;for(let c of i.files)try{let f=Rr.dirname(c),d=Rr.extname(c),p=Rr.basename(c,d),h=Rr.join(f,`${p}_resized${d}`),v=await(0,Mc.default)(c).metadata();if(v.width&&v.width<=r){s.text=`Skipping ${Rr.basename(c)} (already ${v.width}px wide)`,l++;continue}await(0,Mc.default)(c).resize({width:r,withoutEnlargement:!0}).toFile(h),l++,s.text=`Resizing images... (${l}/${i.count})`}catch{u++,s.warn(`Failed to resize: ${Rr.basename(c)}`),s.start()}s.stop(),console.log(),console.log(Q.green(`\u2713 Resized ${l} images successfully`)),u>0&&console.log(Q.red(`\u2717 Failed to resize ${u} images`))}var eo=je(require("node:fs/promises"),1),zl=je(require("node:path"),1),ap=je(WF(),1);xo();kr();async function LF(t){return(await eo.stat(t)).mtimeMs}async function RT(t,e){let r=[...t];switch(e){case"name":return r;case"name-desc":return r.reverse();case"date":{let n=await Promise.all(r.map(async i=>({path:i,mtime:await LF(i)})));return n.sort((i,a)=>i.mtime-a.mtime),n.map(i=>i.path)}case"date-desc":{let n=await Promise.all(r.map(async i=>({path:i,mtime:await LF(i)})));return n.sort((i,a)=>a.mtime-i.mtime),n.map(i=>i.path)}case"random":for(let n=r.length-1;n>0;n--){let i=Math.floor(Math.random()*(n+1));[r[n],r[i]]=[r[i],r[n]]}return r;default:return r}}function BT(t){switch(t){case"name":return"alphabetical (A\u2192Z)";case"name-desc":return"reverse alphabetical (Z\u2192A)";case"date":return"oldest first";case"date-desc":return"newest first";case"random":return"random";default:return"alphabetical"}}async function op(t,e={}){let{outputFile:r="merged.pdf",order:n="name"}=e,i=await Ov(t);if(i.count===0){console.log(Q.yellow("No PDF files found in directory."));return}if(i.count===1){console.log(Q.yellow("Only one PDF found. Nothing to merge."));return}let a=await RT(i.files,n),o=zl.join(i.directory,r),s=BT(n),l=[`Merge ${i.count} PDFs (${s})`,`Output: ${r}`];if(!await aa({fileCount:i.count,fileType:"PDF files",actions:l,preserveOriginals:!0}))return;let c=rn("Merging PDFs...").start();try{let f=await ap.PDFDocument.create();for(let p=0;p<a.length;p++){let h=a[p];c.text=`Merging PDFs... (${p+1}/${i.count})`;try{let v=await eo.readFile(h),g=await ap.PDFDocument.load(v),m=await f.copyPages(g,g.getPageIndices());for(let b of m)f.addPage(b)}catch{c.warn(`Failed to read: ${zl.basename(h)}`),c.start()}}let d=await f.save();await eo.writeFile(o,d),c.stop(),console.log(),console.log(Q.green(`\u2713 Created ${r} with ${f.getPageCount()} pages`))}catch(f){c.stop(),console.log(Q.red(`\u2717 Failed to merge PDFs: ${f.message}`))}}kr();var Ye={};Yl(Ye,{BRAND:()=>o8,DIRTY:()=>ji,EMPTY_PATH:()=>jT,INVALID:()=>re,NEVER:()=>L8,OK:()=>bt,ParseStatus:()=>gt,Schema:()=>he,ZodAny:()=>$n,ZodArray:()=>Sn,ZodBigInt:()=>Ui,ZodBoolean:()=>Vi,ZodBranded:()=>Rs,ZodCatch:()=>Qi,ZodDate:()=>zi,ZodDefault:()=>Ji,ZodDiscriminatedUnion:()=>Gl,ZodEffects:()=>gr,ZodEnum:()=>Zi,ZodError:()=>zt,ZodFirstPartyTypeKind:()=>ie,ZodFunction:()=>Kl,ZodIntersection:()=>Hi,ZodIssueCode:()=>N,ZodLazy:()=>Ki,ZodLiteral:()=>Xi,ZodMap:()=>oo,ZodNaN:()=>uo,ZodNativeEnum:()=>Yi,ZodNever:()=>Or,ZodNull:()=>Li,ZodNullable:()=>$r,ZodNumber:()=>Mi,ZodObject:()=>Wt,ZodOptional:()=>vr,ZodParsedType:()=>V,ZodPipeline:()=>Bs,ZodPromise:()=>ei,ZodReadonly:()=>$i,ZodRecord:()=>Hl,ZodSchema:()=>he,ZodSet:()=>so,ZodString:()=>Qn,ZodSymbol:()=>io,ZodTransformer:()=>gr,ZodTuple:()=>Qr,ZodType:()=>he,ZodUndefined:()=>Wi,ZodUnion:()=>Gi,ZodUnknown:()=>En,ZodVoid:()=>ao,addIssueToContext:()=>M,any:()=>v8,array:()=>y8,bigint:()=>c8,boolean:()=>tb,coerce:()=>W8,custom:()=>QF,date:()=>f8,datetimeRegex:()=>YF,defaultErrorMap:()=>wn,discriminatedUnion:()=>_8,effect:()=>N8,enum:()=>k8,function:()=>O8,getErrorMap:()=>to,getParsedType:()=>Jr,instanceof:()=>u8,intersection:()=>C8,isAborted:()=>Wl,isAsync:()=>ro,isDirty:()=>Ll,isValid:()=>Jn,late:()=>s8,lazy:()=>A8,literal:()=>T8,makeIssue:()=>ks,map:()=>E8,nan:()=>l8,nativeEnum:()=>R8,never:()=>g8,null:()=>p8,nullable:()=>q8,number:()=>eb,object:()=>F8,objectUtil:()=>sp,oboolean:()=>z8,onumber:()=>V8,optional:()=>I8,ostring:()=>U8,pipeline:()=>M8,preprocess:()=>j8,promise:()=>B8,quotelessJson:()=>NT,record:()=>P8,set:()=>S8,setErrorMap:()=>qT,strictObject:()=>b8,string:()=>$F,symbol:()=>d8,transformer:()=>N8,tuple:()=>w8,undefined:()=>h8,union:()=>x8,unknown:()=>m8,util:()=>ve,void:()=>D8});var ve;(function(t){t.assertEqual=i=>{};function e(i){}t.assertIs=e;function r(i){throw new Error}t.assertNever=r,t.arrayToEnum=i=>{let a={};for(let o of i)a[o]=o;return a},t.getValidEnumValues=i=>{let a=t.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),o={};for(let s of a)o[s]=i[s];return t.objectValues(o)},t.objectValues=i=>t.objectKeys(i).map(function(a){return i[a]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{let a=[];for(let o in i)Object.prototype.hasOwnProperty.call(i,o)&&a.push(o);return a},t.find=(i,a)=>{for(let o of i)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function n(i,a=" | "){return i.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(i,a)=>typeof a=="bigint"?a.toString():a})(ve||(ve={}));var sp;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(sp||(sp={}));var V=ve.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Jr=t=>{switch(typeof t){case"undefined":return V.undefined;case"string":return V.string;case"number":return Number.isNaN(t)?V.nan:V.number;case"boolean":return V.boolean;case"function":return V.function;case"bigint":return V.bigint;case"symbol":return V.symbol;case"object":return Array.isArray(t)?V.array:t===null?V.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?V.promise:typeof Map<"u"&&t instanceof Map?V.map:typeof Set<"u"&&t instanceof Set?V.set:typeof Date<"u"&&t instanceof Date?V.date:V.object;default:return V.unknown}};var N=ve.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),NT=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),zt=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(a){return a.message},n={_errors:[]},i=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(i);else if(o.code==="invalid_return_type")i(o.returnTypeError);else if(o.code==="invalid_arguments")i(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let s=n,l=0;for(;l<o.path.length;){let u=o.path[l];l===o.path.length-1?(s[u]=s[u]||{_errors:[]},s[u]._errors.push(r(o))):s[u]=s[u]||{_errors:[]},s=s[u],l++}}};return i(this),n}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ve.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let i of this.issues)if(i.path.length>0){let a=i.path[0];r[a]=r[a]||[],r[a].push(e(i))}else n.push(e(i));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};zt.create=t=>new zt(t);var IT=(t,e)=>{let r;switch(t.code){case N.invalid_type:t.received===V.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case N.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ve.jsonStringifyReplacer)}`;break;case N.unrecognized_keys:r=`Unrecognized key(s) in object: ${ve.joinValues(t.keys,", ")}`;break;case N.invalid_union:r="Invalid input";break;case N.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ve.joinValues(t.options)}`;break;case N.invalid_enum_value:r=`Invalid enum value. Expected ${ve.joinValues(t.options)}, received '${t.received}'`;break;case N.invalid_arguments:r="Invalid function arguments";break;case N.invalid_return_type:r="Invalid function return type";break;case N.invalid_date:r="Invalid date";break;case N.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ve.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case N.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case N.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case N.custom:r="Invalid input";break;case N.invalid_intersection_types:r="Intersection results could not be merged";break;case N.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case N.not_finite:r="Number must be finite";break;default:r=e.defaultError,ve.assertNever(t)}return{message:r}},wn=IT;var GF=wn;function qT(t){GF=t}function to(){return GF}var ks=t=>{let{data:e,path:r,errorMaps:n,issueData:i}=t,a=[...r,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s="",l=n.filter(u=>!!u).slice().reverse();for(let u of l)s=u(o,{data:e,defaultError:s}).message;return{...i,path:a,message:s}},jT=[];function M(t,e){let r=to(),n=ks({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===wn?void 0:wn].filter(i=>!!i)});t.common.issues.push(n)}var gt=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let i of r){if(i.status==="aborted")return re;i.status==="dirty"&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let i of r){let a=await i.key,o=await i.value;n.push({key:a,value:o})}return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let i of r){let{key:a,value:o}=i;if(a.status==="aborted"||o.status==="aborted")return re;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||i.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},re=Object.freeze({status:"aborted"}),ji=t=>({status:"dirty",value:t}),bt=t=>({status:"valid",value:t}),Wl=t=>t.status==="aborted",Ll=t=>t.status==="dirty",Jn=t=>t.status==="valid",ro=t=>typeof Promise<"u"&&t instanceof Promise;var G;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(G||(G={}));var mr=class{constructor(e,r,n,i){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},HF=(t,e)=>{if(Jn(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new zt(t.common.issues);return this._error=r,this._error}}};function fe(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:i}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(o,s)=>{let{message:l}=t;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??r??s.defaultError}},description:i}}var he=class{get description(){return this._def.description}_getType(e){return Jr(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Jr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new gt,ctx:{common:e.parent.common,data:e.data,parsedType:Jr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(ro(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){let n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Jr(e)},i=this._parseSync({data:e,path:n.path,parent:n});return HF(n,i)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Jr(e)};if(!this["~standard"].async)try{let n=this._parseSync({data:e,path:[],parent:r});return Jn(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>Jn(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Jr(e)},i=this._parse({data:e,path:n.path,parent:n}),a=await(ro(i)?i:Promise.resolve(i));return HF(n,a)}refine(e,r){let n=i=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(i):r;return this._refinement((i,a)=>{let o=e(i),s=()=>a.addIssue({code:N.custom,...n(i)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,r){return this._refinement((n,i)=>e(n)?!0:(i.addIssue(typeof r=="function"?r(n,i):r),!1))}_refinement(e){return new gr({schema:this,typeName:ie.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return vr.create(this,this._def)}nullable(){return $r.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Sn.create(this)}promise(){return ei.create(this,this._def)}or(e){return Gi.create([this,e],this._def)}and(e){return Hi.create(this,e,this._def)}transform(e){return new gr({...fe(this._def),schema:this,typeName:ie.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new Ji({...fe(this._def),innerType:this,defaultValue:r,typeName:ie.ZodDefault})}brand(){return new Rs({typeName:ie.ZodBranded,type:this,...fe(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new Qi({...fe(this._def),innerType:this,catchValue:r,typeName:ie.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Bs.create(this,e)}readonly(){return $i.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},MT=/^c[^\s-]{8,}$/i,UT=/^[0-9a-z]+$/,VT=/^[0-9A-HJKMNP-TV-Z]{26}$/i,zT=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,WT=/^[a-z0-9_-]{21}$/i,LT=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,GT=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,HT=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,KT="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",up,XT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ZT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,YT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,JT=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,QT=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,$T=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,XF="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",e8=new RegExp(`^${XF}$`);function ZF(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function t8(t){return new RegExp(`^${ZF(t)}$`)}function YF(t){let e=`${XF}T${ZF(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function r8(t,e){return!!((e==="v4"||!e)&&XT.test(t)||(e==="v6"||!e)&&YT.test(t))}function n8(t,e){if(!LT.test(t))return!1;try{let[r]=t.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),i=JSON.parse(atob(n));return!(typeof i!="object"||i===null||"typ"in i&&i?.typ!=="JWT"||!i.alg||e&&i.alg!==e)}catch{return!1}}function i8(t,e){return!!((e==="v4"||!e)&&ZT.test(t)||(e==="v6"||!e)&&JT.test(t))}var Qn=class t extends he{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==V.string){let a=this._getOrReturnCtx(e);return M(a,{code:N.invalid_type,expected:V.string,received:a.parsedType}),re}let n=new gt,i;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(i=this._getOrReturnCtx(e,i),M(i,{code:N.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(i=this._getOrReturnCtx(e,i),M(i,{code:N.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,s=e.data.length<a.value;(o||s)&&(i=this._getOrReturnCtx(e,i),o?M(i,{code:N.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):s&&M(i,{code:N.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")HT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"email",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")up||(up=new RegExp(KT,"u")),up.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"emoji",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")zT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"uuid",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")WT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"nanoid",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")MT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"cuid",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")UT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"cuid2",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")VT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"ulid",code:N.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{i=this._getOrReturnCtx(e,i),M(i,{validation:"url",code:N.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"regex",code:N.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(i=this._getOrReturnCtx(e,i),M(i,{code:N.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(i=this._getOrReturnCtx(e,i),M(i,{code:N.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(i=this._getOrReturnCtx(e,i),M(i,{code:N.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?YF(a).test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{code:N.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?e8.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{code:N.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?t8(a).test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{code:N.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?GT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"duration",code:N.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?r8(e.data,a.version)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"ip",code:N.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?n8(e.data,a.alg)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"jwt",code:N.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?i8(e.data,a.version)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"cidr",code:N.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?QT.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"base64",code:N.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?$T.test(e.data)||(i=this._getOrReturnCtx(e,i),M(i,{validation:"base64url",code:N.invalid_string,message:a.message}),n.dirty()):ve.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(i=>e.test(i),{validation:r,code:N.invalid_string,...G.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...G.errToObj(e)})}url(e){return this._addCheck({kind:"url",...G.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...G.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...G.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...G.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...G.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...G.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...G.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...G.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...G.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...G.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...G.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...G.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...G.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...G.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...G.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...G.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...G.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...G.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...G.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...G.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...G.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...G.errToObj(r)})}nonempty(e){return this.min(1,G.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Qn.create=t=>new Qn({checks:[],typeName:ie.ZodString,coerce:t?.coerce??!1,...fe(t)});function a8(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,i=r>n?r:n,a=Number.parseInt(t.toFixed(i).replace(".","")),o=Number.parseInt(e.toFixed(i).replace(".",""));return a%o/10**i}var Mi=class t extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==V.number){let a=this._getOrReturnCtx(e);return M(a,{code:N.invalid_type,expected:V.number,received:a.parsedType}),re}let n,i=new gt;for(let a of this._def.checks)a.kind==="int"?ve.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),M(n,{code:N.invalid_type,expected:"integer",received:"float",message:a.message}),i.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),M(n,{code:N.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),M(n,{code:N.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),i.dirty()):a.kind==="multipleOf"?a8(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),M(n,{code:N.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),M(n,{code:N.not_finite,message:a.message}),i.dirty()):ve.assertNever(a);return{status:i.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,G.toString(r))}gt(e,r){return this.setLimit("min",e,!1,G.toString(r))}lte(e,r){return this.setLimit("max",e,!0,G.toString(r))}lt(e,r){return this.setLimit("max",e,!1,G.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:G.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:G.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:G.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:G.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:G.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:G.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ve.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};Mi.create=t=>new Mi({checks:[],typeName:ie.ZodNumber,coerce:t?.coerce||!1,...fe(t)});var Ui=class t extends he{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==V.bigint)return this._getInvalidInput(e);let n,i=new gt;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),M(n,{code:N.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),M(n,{code:N.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),i.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),M(n,{code:N.not_multiple_of,multipleOf:a.value,message:a.message}),i.dirty()):ve.assertNever(a);return{status:i.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:V.bigint,received:r.parsedType}),re}gte(e,r){return this.setLimit("min",e,!0,G.toString(r))}gt(e,r){return this.setLimit("min",e,!1,G.toString(r))}lte(e,r){return this.setLimit("max",e,!0,G.toString(r))}lt(e,r){return this.setLimit("max",e,!1,G.toString(r))}setLimit(e,r,n,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:G.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:G.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:G.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:G.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:G.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:G.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Ui.create=t=>new Ui({checks:[],typeName:ie.ZodBigInt,coerce:t?.coerce??!1,...fe(t)});var Vi=class extends he{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==V.boolean){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:V.boolean,received:n.parsedType}),re}return bt(e.data)}};Vi.create=t=>new Vi({typeName:ie.ZodBoolean,coerce:t?.coerce||!1,...fe(t)});var zi=class t extends he{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==V.date){let a=this._getOrReturnCtx(e);return M(a,{code:N.invalid_type,expected:V.date,received:a.parsedType}),re}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return M(a,{code:N.invalid_date}),re}let n=new gt,i;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(i=this._getOrReturnCtx(e,i),M(i,{code:N.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(i=this._getOrReturnCtx(e,i),M(i,{code:N.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):ve.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:G.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:G.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};zi.create=t=>new zi({checks:[],coerce:t?.coerce||!1,typeName:ie.ZodDate,...fe(t)});var io=class extends he{_parse(e){if(this._getType(e)!==V.symbol){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:V.symbol,received:n.parsedType}),re}return bt(e.data)}};io.create=t=>new io({typeName:ie.ZodSymbol,...fe(t)});var Wi=class extends he{_parse(e){if(this._getType(e)!==V.undefined){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:V.undefined,received:n.parsedType}),re}return bt(e.data)}};Wi.create=t=>new Wi({typeName:ie.ZodUndefined,...fe(t)});var Li=class extends he{_parse(e){if(this._getType(e)!==V.null){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:V.null,received:n.parsedType}),re}return bt(e.data)}};Li.create=t=>new Li({typeName:ie.ZodNull,...fe(t)});var $n=class extends he{constructor(){super(...arguments),this._any=!0}_parse(e){return bt(e.data)}};$n.create=t=>new $n({typeName:ie.ZodAny,...fe(t)});var En=class extends he{constructor(){super(...arguments),this._unknown=!0}_parse(e){return bt(e.data)}};En.create=t=>new En({typeName:ie.ZodUnknown,...fe(t)});var Or=class extends he{_parse(e){let r=this._getOrReturnCtx(e);return M(r,{code:N.invalid_type,expected:V.never,received:r.parsedType}),re}};Or.create=t=>new Or({typeName:ie.ZodNever,...fe(t)});var ao=class extends he{_parse(e){if(this._getType(e)!==V.undefined){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:V.void,received:n.parsedType}),re}return bt(e.data)}};ao.create=t=>new ao({typeName:ie.ZodVoid,...fe(t)});var Sn=class t extends he{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),i=this._def;if(r.parsedType!==V.array)return M(r,{code:N.invalid_type,expected:V.array,received:r.parsedType}),re;if(i.exactLength!==null){let o=r.data.length>i.exactLength.value,s=r.data.length<i.exactLength.value;(o||s)&&(M(r,{code:o?N.too_big:N.too_small,minimum:s?i.exactLength.value:void 0,maximum:o?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),n.dirty())}if(i.minLength!==null&&r.data.length<i.minLength.value&&(M(r,{code:N.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),n.dirty()),i.maxLength!==null&&r.data.length>i.maxLength.value&&(M(r,{code:N.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,s)=>i.type._parseAsync(new mr(r,o,r.path,s)))).then(o=>gt.mergeArray(n,o));let a=[...r.data].map((o,s)=>i.type._parseSync(new mr(r,o,r.path,s)));return gt.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:G.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:G.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:G.toString(r)}})}nonempty(e){return this.min(1,e)}};Sn.create=(t,e)=>new Sn({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ie.ZodArray,...fe(e)});function no(t){if(t instanceof Wt){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=vr.create(no(n))}return new Wt({...t._def,shape:()=>e})}else return t instanceof Sn?new Sn({...t._def,type:no(t.element)}):t instanceof vr?vr.create(no(t.unwrap())):t instanceof $r?$r.create(no(t.unwrap())):t instanceof Qr?Qr.create(t.items.map(e=>no(e))):t}var Wt=class t extends he{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=ve.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==V.object){let u=this._getOrReturnCtx(e);return M(u,{code:N.invalid_type,expected:V.object,received:u.parsedType}),re}let{status:n,ctx:i}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof Or&&this._def.unknownKeys==="strip"))for(let u in i.data)o.includes(u)||s.push(u);let l=[];for(let u of o){let c=a[u],f=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new mr(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof Or){let u=this._def.unknownKeys;if(u==="passthrough")for(let c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(M(i,{code:N.unrecognized_keys,keys:s}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let c of s){let f=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new mr(i,f,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{let u=[];for(let c of l){let f=await c.key,d=await c.value;u.push({key:f,value:d,alwaysSet:c.alwaysSet})}return u}).then(u=>gt.mergeObjectSync(n,u)):gt.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return G.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{let i=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:G.errToObj(e).message??i}:{message:i}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ie.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let n of ve.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let n of ve.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new t({...this._def,shape:()=>r})}deepPartial(){return no(this)}partial(e){let r={};for(let n of ve.objectKeys(this.shape)){let i=this.shape[n];e&&!e[n]?r[n]=i:r[n]=i.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let n of ve.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof vr;)a=a._def.innerType;r[n]=a}return new t({...this._def,shape:()=>r})}keyof(){return JF(ve.objectKeys(this.shape))}};Wt.create=(t,e)=>new Wt({shape:()=>t,unknownKeys:"strip",catchall:Or.create(),typeName:ie.ZodObject,...fe(e)});Wt.strictCreate=(t,e)=>new Wt({shape:()=>t,unknownKeys:"strict",catchall:Or.create(),typeName:ie.ZodObject,...fe(e)});Wt.lazycreate=(t,e)=>new Wt({shape:t,unknownKeys:"strip",catchall:Or.create(),typeName:ie.ZodObject,...fe(e)});var Gi=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function i(a){for(let s of a)if(s.result.status==="valid")return s.result;for(let s of a)if(s.result.status==="dirty")return r.common.issues.push(...s.ctx.common.issues),s.result;let o=a.map(s=>new zt(s.ctx.common.issues));return M(r,{code:N.invalid_union,unionErrors:o}),re}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(i);{let a,o=[];for(let l of n){let u={...r,common:{...r.common,issues:[]},parent:null},c=l._parseSync({data:r.data,path:r.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!a&&(a={result:c,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let s=o.map(l=>new zt(l));return M(r,{code:N.invalid_union,unionErrors:s}),re}}get options(){return this._def.options}};Gi.create=(t,e)=>new Gi({options:t,typeName:ie.ZodUnion,...fe(e)});var Pn=t=>t instanceof Ki?Pn(t.schema):t instanceof gr?Pn(t.innerType()):t instanceof Xi?[t.value]:t instanceof Zi?t.options:t instanceof Yi?ve.objectValues(t.enum):t instanceof Ji?Pn(t._def.innerType):t instanceof Wi?[void 0]:t instanceof Li?[null]:t instanceof vr?[void 0,...Pn(t.unwrap())]:t instanceof $r?[null,...Pn(t.unwrap())]:t instanceof Rs||t instanceof $i?Pn(t.unwrap()):t instanceof Qi?Pn(t._def.innerType):[],Gl=class t extends he{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==V.object)return M(r,{code:N.invalid_type,expected:V.object,received:r.parsedType}),re;let n=this.discriminator,i=r.data[n],a=this.optionsMap.get(i);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(M(r,{code:N.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),re)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let i=new Map;for(let a of r){let o=Pn(a.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let s of o){if(i.has(s))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(s)}`);i.set(s,a)}}return new t({typeName:ie.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:i,...fe(n)})}};function lp(t,e){let r=Jr(t),n=Jr(e);if(t===e)return{valid:!0,data:t};if(r===V.object&&n===V.object){let i=ve.objectKeys(e),a=ve.objectKeys(t).filter(s=>i.indexOf(s)!==-1),o={...t,...e};for(let s of a){let l=lp(t[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(r===V.array&&n===V.array){if(t.length!==e.length)return{valid:!1};let i=[];for(let a=0;a<t.length;a++){let o=t[a],s=e[a],l=lp(o,s);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return r===V.date&&n===V.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var Hi=class extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=(a,o)=>{if(Wl(a)||Wl(o))return re;let s=lp(a.value,o.value);return s.valid?((Ll(a)||Ll(o))&&r.dirty(),{status:r.value,value:s.data}):(M(n,{code:N.invalid_intersection_types}),re)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>i(a,o)):i(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Hi.create=(t,e,r)=>new Hi({left:t,right:e,typeName:ie.ZodIntersection,...fe(r)});var Qr=class t extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==V.array)return M(n,{code:N.invalid_type,expected:V.array,received:n.parsedType}),re;if(n.data.length<this._def.items.length)return M(n,{code:N.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),re;!this._def.rest&&n.data.length>this._def.items.length&&(M(n,{code:N.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,s)=>{let l=this._def.items[s]||this._def.rest;return l?l._parse(new mr(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>gt.mergeArray(r,o)):gt.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Qr.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Qr({items:t,typeName:ie.ZodTuple,rest:null,...fe(e)})};var Hl=class t extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==V.object)return M(n,{code:N.invalid_type,expected:V.object,received:n.parsedType}),re;let i=[],a=this._def.keyType,o=this._def.valueType;for(let s in n.data)i.push({key:a._parse(new mr(n,s,n.path,s)),value:o._parse(new mr(n,n.data[s],n.path,s)),alwaysSet:s in n.data});return n.common.async?gt.mergeObjectAsync(r,i):gt.mergeObjectSync(r,i)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof he?new t({keyType:e,valueType:r,typeName:ie.ZodRecord,...fe(n)}):new t({keyType:Qn.create(),valueType:e,typeName:ie.ZodRecord,...fe(r)})}},oo=class extends he{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==V.map)return M(n,{code:N.invalid_type,expected:V.map,received:n.parsedType}),re;let i=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([s,l],u)=>({key:i._parse(new mr(n,s,n.path,[u,"key"])),value:a._parse(new mr(n,l,n.path,[u,"value"]))}));if(n.common.async){let s=new Map;return Promise.resolve().then(async()=>{for(let l of o){let u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return re;(u.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(u.value,c.value)}return{status:r.value,value:s}})}else{let s=new Map;for(let l of o){let u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return re;(u.status==="dirty"||c.status==="dirty")&&r.dirty(),s.set(u.value,c.value)}return{status:r.value,value:s}}}};oo.create=(t,e,r)=>new oo({valueType:e,keyType:t,typeName:ie.ZodMap,...fe(r)});var so=class t extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==V.set)return M(n,{code:N.invalid_type,expected:V.set,received:n.parsedType}),re;let i=this._def;i.minSize!==null&&n.data.size<i.minSize.value&&(M(n,{code:N.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),r.dirty()),i.maxSize!==null&&n.data.size>i.maxSize.value&&(M(n,{code:N.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),r.dirty());let a=this._def.valueType;function o(l){let u=new Set;for(let c of l){if(c.status==="aborted")return re;c.status==="dirty"&&r.dirty(),u.add(c.value)}return{status:r.value,value:u}}let s=[...n.data.values()].map((l,u)=>a._parse(new mr(n,l,n.path,u)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,r){return new t({...this._def,minSize:{value:e,message:G.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:G.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};so.create=(t,e)=>new so({valueType:t,minSize:null,maxSize:null,typeName:ie.ZodSet,...fe(e)});var Kl=class t extends he{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==V.function)return M(r,{code:N.invalid_type,expected:V.function,received:r.parsedType}),re;function n(s,l){return ks({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,to(),wn].filter(u=>!!u),issueData:{code:N.invalid_arguments,argumentsError:l}})}function i(s,l){return ks({data:s,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,to(),wn].filter(u=>!!u),issueData:{code:N.invalid_return_type,returnTypeError:l}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof ei){let s=this;return bt(async function(...l){let u=new zt([]),c=await s._def.args.parseAsync(l,a).catch(p=>{throw u.addIssue(n(l,p)),u}),f=await Reflect.apply(o,this,c);return await s._def.returns._def.type.parseAsync(f,a).catch(p=>{throw u.addIssue(i(f,p)),u})})}else{let s=this;return bt(function(...l){let u=s._def.args.safeParse(l,a);if(!u.success)throw new zt([n(l,u.error)]);let c=Reflect.apply(o,this,u.data),f=s._def.returns.safeParse(c,a);if(!f.success)throw new zt([i(c,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Qr.create(e).rest(En.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||Qr.create([]).rest(En.create()),returns:r||En.create(),typeName:ie.ZodFunction,...fe(n)})}},Ki=class extends he{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};Ki.create=(t,e)=>new Ki({getter:t,typeName:ie.ZodLazy,...fe(e)});var Xi=class extends he{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return M(r,{received:r.data,code:N.invalid_literal,expected:this._def.value}),re}return{status:"valid",value:e.data}}get value(){return this._def.value}};Xi.create=(t,e)=>new Xi({value:t,typeName:ie.ZodLiteral,...fe(e)});function JF(t,e){return new Zi({values:t,typeName:ie.ZodEnum,...fe(e)})}var Zi=class t extends he{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return M(r,{expected:ve.joinValues(n),received:r.parsedType,code:N.invalid_type}),re}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),n=this._def.values;return M(r,{received:r.data,code:N.invalid_enum_value,options:n}),re}return bt(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}};Zi.create=JF;var Yi=class extends he{_parse(e){let r=ve.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==V.string&&n.parsedType!==V.number){let i=ve.objectValues(r);return M(n,{expected:ve.joinValues(i),received:n.parsedType,code:N.invalid_type}),re}if(this._cache||(this._cache=new Set(ve.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let i=ve.objectValues(r);return M(n,{received:n.data,code:N.invalid_enum_value,options:i}),re}return bt(e.data)}get enum(){return this._def.values}};Yi.create=(t,e)=>new Yi({values:t,typeName:ie.ZodNativeEnum,...fe(e)});var ei=class extends he{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==V.promise&&r.common.async===!1)return M(r,{code:N.invalid_type,expected:V.promise,received:r.parsedType}),re;let n=r.parsedType===V.promise?r.data:Promise.resolve(r.data);return bt(n.then(i=>this._def.type.parseAsync(i,{path:r.path,errorMap:r.common.contextualErrorMap})))}};ei.create=(t,e)=>new ei({type:t,typeName:ie.ZodPromise,...fe(e)});var gr=class extends he{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ie.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),i=this._def.effect||null,a={addIssue:o=>{M(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),i.type==="preprocess"){let o=i.transform(n.data,a);if(n.common.async)return Promise.resolve(o).then(async s=>{if(r.value==="aborted")return re;let l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?re:l.status==="dirty"?ji(l.value):r.value==="dirty"?ji(l.value):l});{if(r.value==="aborted")return re;let s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?re:s.status==="dirty"?ji(s.value):r.value==="dirty"?ji(s.value):s}}if(i.type==="refinement"){let o=s=>{let l=i.refinement(s,a);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){let s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?re:(s.status==="dirty"&&r.dirty(),o(s.value),{status:r.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?re:(s.status==="dirty"&&r.dirty(),o(s.value).then(()=>({status:r.value,value:s.value}))))}if(i.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Jn(o))return re;let s=i.transform(o.value,a);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Jn(o)?Promise.resolve(i.transform(o.value,a)).then(s=>({status:r.value,value:s})):re);ve.assertNever(i)}};gr.create=(t,e,r)=>new gr({schema:t,typeName:ie.ZodEffects,effect:e,...fe(r)});gr.createWithPreprocess=(t,e,r)=>new gr({schema:e,effect:{type:"preprocess",transform:t},typeName:ie.ZodEffects,...fe(r)});var vr=class extends he{_parse(e){return this._getType(e)===V.undefined?bt(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};vr.create=(t,e)=>new vr({innerType:t,typeName:ie.ZodOptional,...fe(e)});var $r=class extends he{_parse(e){return this._getType(e)===V.null?bt(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};$r.create=(t,e)=>new $r({innerType:t,typeName:ie.ZodNullable,...fe(e)});var Ji=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===V.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};Ji.create=(t,e)=>new Ji({innerType:t,typeName:ie.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...fe(e)});var Qi=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ro(i)?i.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new zt(n.common.issues)},input:n.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new zt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Qi.create=(t,e)=>new Qi({innerType:t,typeName:ie.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...fe(e)});var uo=class extends he{_parse(e){if(this._getType(e)!==V.nan){let n=this._getOrReturnCtx(e);return M(n,{code:N.invalid_type,expected:V.nan,received:n.parsedType}),re}return{status:"valid",value:e.data}}};uo.create=t=>new uo({typeName:ie.ZodNaN,...fe(t)});var o8=Symbol("zod_brand"),Rs=class extends he{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},Bs=class t extends he{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?re:a.status==="dirty"?(r.dirty(),ji(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let i=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?re:i.status==="dirty"?(r.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:n.path,parent:n})}}static create(e,r){return new t({in:e,out:r,typeName:ie.ZodPipeline})}},$i=class extends he{_parse(e){let r=this._def.innerType._parse(e),n=i=>(Jn(i)&&(i.value=Object.freeze(i.value)),i);return ro(r)?r.then(i=>n(i)):n(r)}unwrap(){return this._def.innerType}};$i.create=(t,e)=>new $i({innerType:t,typeName:ie.ZodReadonly,...fe(e)});function KF(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function QF(t,e={},r){return t?$n.create().superRefine((n,i)=>{let a=t(n);if(a instanceof Promise)return a.then(o=>{if(!o){let s=KF(e,n),l=s.fatal??r??!0;i.addIssue({code:"custom",...s,fatal:l})}});if(!a){let o=KF(e,n),s=o.fatal??r??!0;i.addIssue({code:"custom",...o,fatal:s})}}):$n.create()}var s8={object:Wt.lazycreate},ie;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ie||(ie={}));var u8=(t,e={message:`Input not instance of ${t.name}`})=>QF(r=>r instanceof t,e),$F=Qn.create,eb=Mi.create,l8=uo.create,c8=Ui.create,tb=Vi.create,f8=zi.create,d8=io.create,h8=Wi.create,p8=Li.create,v8=$n.create,m8=En.create,g8=Or.create,D8=ao.create,y8=Sn.create,F8=Wt.create,b8=Wt.strictCreate,x8=Gi.create,_8=Gl.create,C8=Hi.create,w8=Qr.create,P8=Hl.create,E8=oo.create,S8=so.create,O8=Kl.create,A8=Ki.create,T8=Xi.create,k8=Zi.create,R8=Yi.create,B8=ei.create,N8=gr.create,I8=vr.create,q8=$r.create,j8=gr.createWithPreprocess,M8=Bs.create,U8=()=>$F().optional(),V8=()=>eb().optional(),z8=()=>tb().optional(),W8={string:(t=>Qn.create({...t,coerce:!0})),number:(t=>Mi.create({...t,coerce:!0})),boolean:(t=>Vi.create({...t,coerce:!0})),bigint:(t=>Ui.create({...t,coerce:!0})),date:(t=>zi.create({...t,coerce:!0}))};var L8=re;var G8=Ye.object({from:Ye.enum(["png","jpg","jpeg","webp","gif","tiff","avif"]).optional(),to:Ye.enum(["webp","png","jpg"]).optional(),format:Ye.literal("webp").optional(),maxWidth:Ye.number().positive().optional(),quality:Ye.number().min(1).max(100).optional()}).strict().optional(),H8=Ye.object({maxWidth:Ye.number().positive()}).strict(),K8=Ye.object({outputFile:Ye.string().optional(),order:Ye.enum(["name","name-desc","date","date-desc","random"]).optional()}).strict().optional(),X8=Ye.object({action:Ye.literal("convert_images"),options:G8}).strict(),Z8=Ye.object({action:Ye.literal("resize_images"),options:H8}).strict(),Y8=Ye.object({action:Ye.literal("merge_pdfs"),options:K8}).strict(),J8=Ye.discriminatedUnion("action",[X8,Z8,Y8]);function rb(t){let e=J8.safeParse(t);return e.success?e.data:null}var Q8=process.env.FILEX_API_URL||"https://filex-xi.vercel.app/api/parse-intent";async function nb(t,e=3){let r="";for(let n=1;n<=e;n++)try{let i=await fetch(Q8,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({input:t})});if(!i.ok)return{success:!1,error:(await i.json().catch(()=>({}))).error||`API error: ${i.status}`};let a=await i.text(),o;try{o=JSON.parse(a)}catch{if(r="AI returned invalid JSON",n<e){await new Promise(l=>setTimeout(l,500*n));continue}return{success:!1,error:r}}if(typeof o=="object"&&o!==null&&"error"in o){let l=o;return l.error==="unsupported"?{success:!1,error:"This feature is not supported yet. Let us know and we'll add it!"}:l.error==="unclear"?{success:!1,error:"Could not understand your request. Please use a manual command."}:{success:!1,error:l.error}}let s=rb(o);if(!s){if(r="Response did not match expected schema. Please use a manual command.",n<e){await new Promise(l=>setTimeout(l,500*n));continue}return{success:!1,error:r}}return{success:!0,action:s}}catch(i){if(r=`Request failed: ${i.message}`,n<e){await new Promise(a=>setTimeout(a,500*n));continue}return{success:!1,error:r}}return{success:!1,error:r||"Failed after multiple retries"}}function ib(t){console.log(),console.log(Q.red("Error:"),t),console.log(),console.log(Q.yellow("Manual commands:")),console.log(),console.log(Q.cyan(" Convert images:")),console.log(Q.gray(" filex convert ./photos --to webp")),console.log(Q.gray(" filex convert ./photos --from png --to jpg")),console.log(),console.log(Q.cyan(" Resize images:")),console.log(Q.gray(" filex resize ./photos --max-width 1200")),console.log(),console.log(Q.cyan(" Merge PDFs:")),console.log(Q.gray(" filex merge-pdfs ./docs")),console.log(Q.gray(" filex merge-pdfs ./docs --order date --output combined.pdf")),console.log()}kr();function $8(t){switch(t.action){case"convert_images":return"Image Conversion";case"resize_images":return"Image Resize";case"merge_pdfs":return"PDF Merge";default:return"Unknown"}}function ek(t){switch(t.action){case"convert_images":{let e=[],r=t.options?.from,n=t.options?.to??t.options?.format??"webp";return r?e.push(`Convert: ${r.toUpperCase()} \u2192 ${n.toUpperCase()}`):e.push(`Convert to: ${n.toUpperCase()}`),t.options?.maxWidth&&e.push(`Max width: ${t.options.maxWidth}px`),t.options?.quality&&e.push(`Quality: ${t.options.quality}%`),e}case"resize_images":return[`Max width: ${t.options.maxWidth}px`,"Aspect ratio preserved"];case"merge_pdfs":{let e=t.options?.outputFile??"merged.pdf",r=t.options?.order??"name";return[`Order: ${{name:"Alphabetical (A\u2192Z)","name-desc":"Reverse (Z\u2192A)",date:"Oldest first","date-desc":"Newest first",random:"Random"}[r]??"Alphabetical"}`,`Output: ${e}`]}default:return["Unknown action"]}}function ab(t){let e=$8(t),n=ek(t).map(i=>` ${Q.gray("\u203A")} ${Q.white(i)}`).join(`
|
|
72
72
|
`);return`${Q.cyan.bold(`\u25B8 ${e}`)}
|
|
73
|
-
${n}`}var tk="0.1.
|
|
73
|
+
${n}`}var tk="0.1.4";async function rk(t,e){switch(t.action){case"convert_images":await jc(e,{from:t.options?.from,to:t.options?.to??t.options?.format,maxWidth:t.options?.maxWidth,quality:t.options?.quality});break;case"resize_images":await Uc(e,{maxWidth:t.options.maxWidth});break;case"merge_pdfs":await op(e,{outputFile:t.options?.outputFile,order:t.options?.order});break}}async function nk(t,e){let r=(await Promise.resolve().then(()=>(xo(),Pv))).default("Processing...").start(),n=await nb(t);n.success||(r.fail("Could not parse request"),ib(n.error),process.exit(1)),r.succeed("Request parsed"),console.log(),console.log(ab(n.action)),console.log(),await rk(n.action,e)}function ob(){let t=new Np;t.name("filex").description("A CLI agent to modify and interact with your files").version(tk),t.command("convert").description("Convert images between formats").argument("<directory>","Directory containing images").option("--from <format>","Source format (png, jpg, webp, gif, tiff, avif)").option("--to <format>","Target format (webp, png, jpg)","webp").option("--max-width <pixels>","Maximum width in pixels",parseInt).option("--quality <percent>","Output quality (1-100)",parseInt,80).action(async(e,r)=>{try{await jc(e,{from:r.from,to:r.to||"webp",maxWidth:r.maxWidth,quality:r.quality})}catch(n){console.error(Q.red(`Error: ${n.message}`)),process.exit(1)}}),t.command("resize").description("Resize images to a maximum width").argument("<directory>","Directory containing images").requiredOption("--max-width <pixels>","Maximum width in pixels",parseInt).action(async(e,r)=>{try{await Uc(e,{maxWidth:r.maxWidth})}catch(n){console.error(Q.red(`Error: ${n.message}`)),process.exit(1)}}),t.command("merge-pdfs").description("Merge all PDFs in a directory").argument("<directory>","Directory containing PDFs").option("-o, --output <filename>","Output filename","merged.pdf").option("--order <type>","Sort order: name, name-desc, date, date-desc, random","name").action(async(e,r)=>{try{await op(e,{outputFile:r.output,order:r.order})}catch(n){console.error(Q.red(`Error: ${n.message}`)),process.exit(1)}}),t.argument("[input...]","Natural language input for AI parsing").option("-d, --directory <path>","Target directory",".").action(async(e,r)=>{let n=e.join(" ").trim();if(!n){t.help();return}if(["convert","resize","merge-pdfs","help","--help","-h","--version","-V"].includes(n.toLowerCase())){t.help();return}try{await nk(n,r.directory)}catch(a){console.error(Q.red(`Error: ${a.message}`)),process.exit(1)}}),process.on("SIGINT",()=>{console.log(),console.log(Q.red("Interrupted.")),process.exit(0)}),t.parse()}ob();
|
|
74
74
|
/*! Bundled license information:
|
|
75
75
|
|
|
76
76
|
tslib/tslib.es6.js:
|