@vue-pdf-viewer/annotation 1.6.0-rc.2 → 1.6.0-rc.3

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/index.js CHANGED
@@ -9303,8 +9303,11 @@ ${new XMLSerializer().serializeToString(r)}`;
9303
9303
  s?.textContent && (n.contents = s.textContent), r && (n.hexColor = r);
9304
9304
  }
9305
9305
  static parseFreeText(t, n) {
9306
- const r = t.querySelector("contents");
9307
- r?.textContent && (n.value = r.textContent, n.contents = r.textContent);
9306
+ const r = t.querySelector("contents") ?? t.querySelector("contents-richtext");
9307
+ if (r?.textContent) {
9308
+ const s = r.textContent.trim();
9309
+ n.value = s, n.contents = s;
9310
+ }
9308
9311
  const i = t.querySelector("defaultappearance");
9309
9312
  if (i?.textContent) {
9310
9313
  const s = i.textContent.trim(), o = s.match(/\/(\S+)\s+([\d.]+)\s+Tf/), c = s.match(
@@ -9318,7 +9321,7 @@ ${new XMLSerializer().serializeToString(r)}`;
9318
9321
  fontName: l,
9319
9322
  fontSize: a,
9320
9323
  fontColor: h
9321
- }, n.fontSize = a, !n.color && c && (n.color = h);
9324
+ }, n.fontSize = a, c && (n.color = h);
9322
9325
  }
9323
9326
  }
9324
9327
  static parseStamp(t, n) {
@@ -14,4 +14,4 @@ ${this.lastXRefOffset}
14
14
  %%EOF`}sizeInBytes(){return 16+this.lastXRefOffset.length}copyBytesInto(e,t){const n=t;return e[t++]=m.s,e[t++]=m.t,e[t++]=m.a,e[t++]=m.r,e[t++]=m.t,e[t++]=m.x,e[t++]=m.r,e[t++]=m.e,e[t++]=m.f,e[t++]=m.Newline,t+=me(this.lastXRefOffset,e,t),e[t++]=m.Newline,e[t++]=m.Percent,e[t++]=m.Percent,e[t++]=m.E,e[t++]=m.O,e[t++]=m.F,t-n}};let tr=ga;b(tr,"forLastCrossRefSectionOffset",e=>new ga(e));const pa=class{constructor(e){b(this,"dict"),this.dict=e}toString(){return`trailer
15
15
  ${this.dict.toString()}`}sizeInBytes(){return 8+this.dict.sizeInBytes()}copyBytesInto(e,t){const n=t;return e[t++]=m.t,e[t++]=m.r,e[t++]=m.a,e[t++]=m.i,e[t++]=m.l,e[t++]=m.e,e[t++]=m.r,e[t++]=m.Newline,t+=this.dict.copyBytesInto(e,t),t-n}};let ba=pa;b(ba,"of",e=>new pa(e));const vi=class extends wi{constructor(e,t,n=!0){super(e.obj({}),n),b(this,"objects"),b(this,"offsets"),b(this,"offsetsString"),this.objects=t,this.offsets=this.computeObjectOffsets(),this.offsetsString=this.computeOffsetsString(),this.dict.set(p.of("Type"),p.of("ObjStm")),this.dict.set(p.of("N"),H.of(this.objects.length)),this.dict.set(p.of("First"),H.of(this.offsetsString.length))}getObjectsCount(){return this.objects.length}clone(e){return vi.withContextAndObjects(e||this.dict.context,this.objects.slice(),this.encode)}getContentsString(){let e=this.offsetsString;for(let t=0,n=this.objects.length;t<n;t++){const[,r]=this.objects[t];e+=`${r}
16
16
  `}return e}getUnencodedContents(){const e=new Uint8Array(this.getUnencodedContentsSize());let t=me(this.offsetsString,e,0);for(let n=0,r=this.objects.length;n<r;n++){const[,i]=this.objects[n];t+=i.copyBytesInto(e,t),e[t++]=m.Newline}return e}getUnencodedContentsSize(){return this.offsetsString.length+Nn(this.offsets)[1]+Nn(this.objects)[1].sizeInBytes()+1}computeOffsetsString(){let e="";for(let t=0,n=this.offsets.length;t<n;t++){const[r,i]=this.offsets[t];e+=`${r} ${i} `}return e}computeObjectOffsets(){let e=0;const t=new Array(this.objects.length);for(let n=0,r=this.objects.length;n<r;n++){const[i,o]=this.objects[n];t[n]=[i.objectNumber,e],e+=o.sizeInBytes()+1}return t}};let ki=vi;b(ki,"withContextAndObjects",(e,t,n=!0)=>new vi(e,t,n));const ma=class{constructor(e,t){b(this,"context"),b(this,"objectsPerTick"),b(this,"parsedObjects",0),b(this,"shouldWaitForTick",n=>(this.parsedObjects+=n,this.parsedObjects%this.objectsPerTick===0)),this.context=e,this.objectsPerTick=t}async serializeToBuffer(){const{size:e,header:t,indirectObjects:n,xref:r,trailerDict:i,trailer:o}=await this.computeBufferSize();let s=0;const c=new Uint8Array(e);s+=t.copyBytesInto(c,s),c[s++]=m.Newline,c[s++]=m.Newline;for(let l=0,a=n.length;l<a;l++){const[h,d]=n[l],u=String(h.objectNumber);s+=me(u,c,s),c[s++]=m.Space;const f=String(h.generationNumber);s+=me(f,c,s),c[s++]=m.Space,c[s++]=m.o,c[s++]=m.b,c[s++]=m.j,c[s++]=m.Newline,s+=d.copyBytesInto(c,s),c[s++]=m.Newline,c[s++]=m.e,c[s++]=m.n,c[s++]=m.d,c[s++]=m.o,c[s++]=m.b,c[s++]=m.j,c[s++]=m.Newline,c[s++]=m.Newline;const y=d instanceof ki?d.getObjectsCount():1;this.shouldWaitForTick(y)&&await Ct()}return r&&(s+=r.copyBytesInto(c,s),c[s++]=m.Newline),i&&(s+=i.copyBytesInto(c,s),c[s++]=m.Newline,c[s++]=m.Newline),s+=o.copyBytesInto(c,s),c}computeIndirectObjectSize([e,t]){const n=e.sizeInBytes()+3,r=t.sizeInBytes()+9;return n+r}createTrailerDict(){return this.context.obj({Size:this.context.largestObjectNumber+1,Root:this.context.trailerInfo.Root,Encrypt:this.context.trailerInfo.Encrypt,Info:this.context.trailerInfo.Info,ID:this.context.trailerInfo.ID})}async computeBufferSize(){const e=yn.forVersion(1,7);let t=e.sizeInBytes()+2;const n=er.create(),r=this.context.enumerateIndirectObjects();for(let c=0,l=r.length;c<l;c++){const a=r[c],[h]=a;n.addEntry(h,t),t+=this.computeIndirectObjectSize(a),this.shouldWaitForTick(1)&&await Ct()}const i=t;t+=n.sizeInBytes()+1;const o=ba.of(this.createTrailerDict());t+=o.sizeInBytes()+2;const s=tr.forLastCrossRefSectionOffset(i);return t+=s.sizeInBytes(),{size:t,header:e,indirectObjects:r,xref:n,trailerDict:o,trailer:s}}};let Ai=ma;b(Ai,"forContext",(e,t)=>new ma(e,t));const nr=class extends xe{constructor(e){super(),b(this,"value"),this.value=e}asBytes(){const e=[];let t="",n=!1;const r=i=>{i!==void 0&&e.push(i),n=!1};for(let i=0,o=this.value.length;i<o;i++){const s=this.value[i],c=G(s),l=this.value[i+1];n?c===m.Newline||c===m.CarriageReturn?r():c===m.n?r(m.Newline):c===m.r?r(m.CarriageReturn):c===m.t?r(m.Tab):c===m.b?r(m.Backspace):c===m.f?r(m.FormFeed):c===m.LeftParen?r(m.LeftParen):c===m.RightParen?r(m.RightParen):c===m.Backspace?r(m.BackSlash):c>=m.Zero&&c<=m.Seven?(t+=s,(t.length===3||!(l>="0"&&l<="7"))&&(r(parseInt(t,8)),t="")):r(c):c===m.BackSlash?n=!0:r(c)}return new Uint8Array(e)}decodeText(){const e=this.asBytes();return Po(e)?Co(e):ko(e)}decodeDate(){const e=this.decodeText(),t=xo(e);if(!t)throw new Oo(e);return t}asString(){return this.value}clone(){return nr.of(this.value)}toString(){return`(${this.value})`}sizeInBytes(){return this.value.length+2}copyBytesInto(e,t){return e[t++]=m.LeftParen,t+=me(this.value,e,t),e[t++]=m.RightParen,this.value.length+2}};let te=nr;b(te,"of",e=>new nr(e)),b(te,"fromDate",e=>{const t=ze(String(e.getUTCFullYear()),4,"0"),n=ze(String(e.getUTCMonth()+1),2,"0"),r=ze(String(e.getUTCDate()),2,"0"),i=ze(String(e.getUTCHours()),2,"0"),o=ze(String(e.getUTCMinutes()),2,"0"),s=ze(String(e.getUTCSeconds()),2,"0");return new nr(`D:${t}${n}${r}${i}${o}${s}Z`)});class rr{constructor(t,n,r){b(this,"bytes"),b(this,"start"),b(this,"pos"),b(this,"end"),this.bytes=t,this.start=n||0,this.pos=this.start,this.end=!!n&&!!r?n+r:this.bytes.length}get length(){return this.end-this.start}get isEmpty(){return this.length===0}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getUint16(){const t=this.getByte(),n=this.getByte();return t===-1||n===-1?-1:(t<<8)+n}getInt32(){const t=this.getByte(),n=this.getByte(),r=this.getByte(),i=this.getByte();return(t<<24)+(n<<16)+(r<<8)+i}getBytes(t,n=!1){const r=this.bytes,i=this.pos,o=this.end;if(t){let s=i+t;s>o&&(s=o),this.pos=s;const c=r.subarray(i,s);return n?new Uint8ClampedArray(c):c}else{const s=r.subarray(i,o);return n?new Uint8ClampedArray(s):s}}peekByte(){const t=this.getByte();return this.pos--,t}peekBytes(t,n=!1){const r=this.getBytes(t,n);return this.pos-=r.length,r}skip(t){t||(t=1),this.pos+=t}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(t,n){return new rr(this.bytes,t,n)}decode(){return this.bytes}}const df=new Uint8Array(0);class wn{constructor(t){if(b(this,"bufferLength"),b(this,"buffer"),b(this,"eof"),b(this,"pos"),b(this,"minBufferLength"),this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=df,this.minBufferLength=512,t)for(;this.minBufferLength<t;)this.minBufferLength*=2}get isEmpty(){for(;!this.eof&&this.bufferLength===0;)this.readBlock();return this.bufferLength===0}getByte(){const t=this.pos;for(;this.bufferLength<=t;){if(this.eof)return-1;this.readBlock()}return this.buffer[this.pos++]}getUint16(){const t=this.getByte(),n=this.getByte();return t===-1||n===-1?-1:(t<<8)+n}getInt32(){const t=this.getByte(),n=this.getByte(),r=this.getByte(),i=this.getByte();return(t<<24)+(n<<16)+(r<<8)+i}getBytes(t,n=!1){let r;const i=this.pos;if(t){for(this.ensureBuffer(i+t),r=i+t;!this.eof&&this.bufferLength<r;)this.readBlock();const s=this.bufferLength;r>s&&(r=s)}else{for(;!this.eof;)this.readBlock();r=this.bufferLength}this.pos=r;const o=this.buffer.subarray(i,r);return n&&!(o instanceof Uint8ClampedArray)?new Uint8ClampedArray(o):o}peekByte(){const t=this.getByte();return this.pos--,t}peekBytes(t,n=!1){const r=this.getBytes(t,n);return this.pos-=r.length,r}skip(t){t||(t=1),this.pos+=t}reset(){this.pos=0}makeSubStream(t,n){const r=t+n;for(;this.bufferLength<=r&&!this.eof;)this.readBlock();return new rr(this.buffer,t,n)}decode(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)}readBlock(){throw new Ue(this.constructor.name,"readBlock")}ensureBuffer(t){const n=this.buffer;if(t<=n.byteLength)return n;let r=this.minBufferLength;for(;r<t;)r*=2;const i=new Uint8Array(r);return i.set(n),this.buffer=i}}const ya=e=>e===32||e===9||e===13||e===10;class ff extends wn{constructor(t,n){super(n),b(this,"stream"),b(this,"input"),this.stream=t,this.input=new Uint8Array(5),n&&(n=.8*n)}readBlock(){const i=this.stream;let o=i.getByte();for(;ya(o);)o=i.getByte();if(o===-1||o===126){this.eof=!0;return}const s=this.bufferLength;let c,l;if(o===122){for(c=this.ensureBuffer(s+4),l=0;l<4;++l)c[s+l]=0;this.bufferLength+=4}else{const a=this.input;for(a[0]=o,l=1;l<5;++l){for(o=i.getByte();ya(o);)o=i.getByte();if(a[l]=o,o===-1||o===126)break}if(c=this.ensureBuffer(s+l-1),this.bufferLength+=l-1,l<5){for(;l<5;++l)a[l]=33+84;this.eof=!0}let h=0;for(l=0;l<5;++l)h=h*85+(a[l]-33);for(l=3;l>=0;--l)c[s+l]=h&255,h>>=8}}}class uf extends wn{constructor(t,n){super(n),b(this,"stream"),b(this,"firstDigit"),this.stream=t,this.firstDigit=-1,n&&(n=.5*n)}readBlock(){const n=this.stream.getBytes(8e3);if(!n.length){this.eof=!0;return}const r=n.length+1>>1,i=this.ensureBuffer(this.bufferLength+r);let o=this.bufferLength,s=this.firstDigit;for(let c=0,l=n.length;c<l;c++){const a=n[c];let h;if(a>=48&&a<=57)h=a&15;else if(a>=65&&a<=70||a>=97&&a<=102)h=(a&15)+9;else if(a===62){this.eof=!0;break}else continue;s<0?s=h:(i[o++]=s<<4|h,s=-1)}s>=0&&this.eof&&(i[o++]=s<<4,s=-1),this.firstDigit=s,this.bufferLength=o}}const wa=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gf=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]),pf=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]),bf=[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],mf=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];class yf extends wn{constructor(t,n){super(n),b(this,"stream"),b(this,"codeSize"),b(this,"codeBuf"),this.stream=t;const r=t.getByte(),i=t.getByte();if(r===-1||i===-1)throw new Error(`Invalid header in flate stream: ${r}, ${i}`);if((r&15)!==8)throw new Error(`Unknown compression method in flate stream: ${r}, ${i}`);if(((r<<8)+i)%31!==0)throw new Error(`Bad FCHECK in flate stream: ${r}, ${i}`);if(i&32)throw new Error(`FDICT bit set in flate stream: ${r}, ${i}`);this.codeSize=0,this.codeBuf=0}readBlock(){let t,n;const r=this.stream;let i=this.getBits(3);if(i&1&&(this.eof=!0),i>>=1,i===0){let a;if((a=r.getByte())===-1)throw new Error("Bad block header in flate stream");let h=a;if((a=r.getByte())===-1)throw new Error("Bad block header in flate stream");if(h|=a<<8,(a=r.getByte())===-1)throw new Error("Bad block header in flate stream");let d=a;if((a=r.getByte())===-1)throw new Error("Bad block header in flate stream");if(d|=a<<8,d!==(~h&65535)&&(h!==0||d!==0))throw new Error("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;const u=this.bufferLength;t=this.ensureBuffer(u+h);const f=u+h;if(this.bufferLength=f,h===0)r.peekByte()===-1&&(this.eof=!0);else for(let y=u;y<f;++y){if((a=r.getByte())===-1){this.eof=!0;break}t[y]=a}return}let o,s;if(i===1)o=bf,s=mf;else if(i===2){const a=this.getBits(5)+257,h=this.getBits(5)+1,d=this.getBits(4)+4,u=new Uint8Array(wa.length);let f;for(f=0;f<d;++f)u[wa[f]]=this.getBits(3);const y=this.generateHuffmanTable(u);n=0,f=0;const _=a+h,x=new Uint8Array(_);let w,T,v;for(;f<_;){const S=this.getCode(y);if(S===16)w=2,T=3,v=n;else if(S===17)w=3,T=3,v=n=0;else if(S===18)w=7,T=11,v=n=0;else{x[f++]=n=S;continue}let N=this.getBits(w)+T;for(;N-- >0;)x[f++]=v}o=this.generateHuffmanTable(x.subarray(0,a)),s=this.generateHuffmanTable(x.subarray(a,_))}else throw new Error("Unknown block type in flate stream");t=this.buffer;let c=t?t.length:0,l=this.bufferLength;for(;;){let a=this.getCode(o);if(a<256){l+1>=c&&(t=this.ensureBuffer(l+1),c=t.length),t[l++]=a;continue}if(a===256){this.bufferLength=l;return}a-=257,a=gf[a];let h=a>>16;h>0&&(h=this.getBits(h)),n=(a&65535)+h,a=this.getCode(s),a=pf[a],h=a>>16,h>0&&(h=this.getBits(h));const d=(a&65535)+h;l+n>=c&&(t=this.ensureBuffer(l+n),c=t.length);for(let u=0;u<n;++u,++l)t[l]=t[l-d]}}getBits(t){const n=this.stream;let r=this.codeSize,i=this.codeBuf,o;for(;r<t;){if((o=n.getByte())===-1)throw new Error("Bad encoding in flate stream");i|=o<<r,r+=8}return o=i&(1<<t)-1,this.codeBuf=i>>t,this.codeSize=r-=t,o}getCode(t){const n=this.stream,r=t[0],i=t[1];let o=this.codeSize,s=this.codeBuf,c;for(;o<i&&(c=n.getByte())!==-1;)s|=c<<o,o+=8;const l=r[s&(1<<i)-1];typeof r=="number"&&console.log("FLATE:",l);const a=l>>16,h=l&65535;if(a<1||o<a)throw new Error("Bad encoding in flate stream");return this.codeBuf=s>>a,this.codeSize=o-a,h}generateHuffmanTable(t){const n=t.length;let r=0,i;for(i=0;i<n;++i)t[i]>r&&(r=t[i]);const o=1<<r,s=new Int32Array(o);for(let c=1,l=0,a=2;c<=r;++c,l<<=1,a<<=1)for(let h=0;h<n;++h)if(t[h]===c){let d=0,u=l;for(i=0;i<c;++i)d=d<<1|u&1,u>>=1;for(i=d;i<o;i+=a)s[i]=c<<16|h;++l}return[s,r]}}class wf extends wn{constructor(t,n,r){super(n),b(this,"stream"),b(this,"cachedData"),b(this,"bitsCached"),b(this,"lzwState"),this.stream=t,this.cachedData=0,this.bitsCached=0;const i=4096,o={earlyChange:r,codeLength:9,nextCode:258,dictionaryValues:new Uint8Array(i),dictionaryLengths:new Uint16Array(i),dictionaryPrevCodes:new Uint16Array(i),currentSequence:new Uint8Array(i),currentSequenceLength:0};for(let s=0;s<256;++s)o.dictionaryValues[s]=s,o.dictionaryLengths[s]=1;this.lzwState=o}readBlock(){let n=1024;const r=512;let i,o,s;const c=this.lzwState;if(!c)return;const l=c.earlyChange;let a=c.nextCode;const h=c.dictionaryValues,d=c.dictionaryLengths,u=c.dictionaryPrevCodes;let f=c.codeLength,y=c.prevCode;const _=c.currentSequence;let x=c.currentSequenceLength,w=0,T=this.bufferLength,v=this.ensureBuffer(this.bufferLength+n);for(i=0;i<512;i++){const S=this.readBits(f),N=x>0;if(!S||S<256)_[0]=S,x=1;else if(S>=258)if(S<a)for(x=d[S],o=x-1,s=S;o>=0;o--)_[o]=h[s],s=u[s];else _[x++]=_[0];else if(S===256){f=9,a=258,x=0;continue}else{this.eof=!0,delete this.lzwState;break}if(N&&(u[a]=y,d[a]=d[y]+1,h[a]=_[0],a++,f=a+l&a+l-1?f:Math.min(Math.log(a+l)/.6931471805599453+1,12)|0),y=S,w+=x,n<w){do n+=r;while(n<w);v=this.ensureBuffer(this.bufferLength+n)}for(o=0;o<x;o++)v[T++]=_[o]}c.nextCode=a,c.codeLength=f,c.prevCode=y,c.currentSequenceLength=x,this.bufferLength=T}readBits(t){let n=this.bitsCached,r=this.cachedData;for(;n<t;){const i=this.stream.getByte();if(i===-1)return this.eof=!0,null;r=r<<8|i,n+=8}return this.bitsCached=n-=t,this.cachedData=r,r>>>n&(1<<t)-1}}class _f extends wn{constructor(t,n){super(n),b(this,"stream"),this.stream=t}readBlock(){const t=this.stream.getBytes(2);if(!t||t.length<2||t[0]===128){this.eof=!0;return}let n,r=this.bufferLength,i=t[0];if(i<128){if(n=this.ensureBuffer(r+i+1),n[r++]=t[1],i>0){const o=this.stream.getBytes(i);n.set(o,r),r+=i}}else{i=257-i;const o=t[1];n=this.ensureBuffer(r+i+1);for(let s=0;s<i;s++)n[r++]=o}this.bufferLength=r}}const _a=(e,t,n)=>{if(t===p.of("FlateDecode"))return new yf(e);if(t===p.of("LZWDecode")){let r=1;if(n instanceof W){const i=n.lookup(p.of("EarlyChange"));i instanceof H&&(r=i.asNumber())}return new wf(e,void 0,r)}if(t===p.of("ASCII85Decode"))return new ff(e);if(t===p.of("ASCIIHexDecode"))return new uf(e);if(t===p.of("RunLengthDecode"))return new _f(e);throw new el(t.asString())},xa=({dict:e,contents:t})=>{let n=new rr(t);const r=e.lookup(p.of("Filter")),i=e.lookup(p.of("DecodeParms"));if(r instanceof p)n=_a(n,r,i);else if(r instanceof X)for(let o=0,s=r.size();o<s;o++)n=_a(n,r.lookup(o,p),i&&i.lookupMaybe(o,W));else if(r)throw new Rr([p,X],r);return n},xf=e=>{const t=e.MediaBox(),n=t.lookup(2,H).asNumber()-t.lookup(0,H).asNumber(),r=t.lookup(3,H).asNumber()-t.lookup(1,H).asNumber();return{left:0,bottom:0,right:n,top:r}},Sf=e=>[1,0,0,1,-e.left,-e.bottom];class Ci{constructor(t,n,r){b(this,"width"),b(this,"height"),b(this,"boundingBox"),b(this,"transformationMatrix"),b(this,"page"),this.page=t;const i=n??xf(t);this.width=i.right-i.left,this.height=i.top-i.bottom,this.boundingBox=i,this.transformationMatrix=r??Sf(i)}static async for(t,n,r){return new Ci(t,n,r)}async embedIntoContext(t,n){const{Contents:r,Resources:i}=this.page.normalizedEntries();if(!r)throw new tl;const o=this.decodeContents(r),{left:s,bottom:c,right:l,top:a}=this.boundingBox,h=t.flateStream(o,{Type:"XObject",Subtype:"Form",FormType:1,BBox:[s,c,l,a],Matrix:this.transformationMatrix,Resources:i});return n?(t.assign(n,h),n):t.register(h)}decodeContents(t){const n=Uint8Array.of(m.Newline),r=[];for(let i=0,o=t.size();i<o;i++){const s=t.lookup(i,ht);let c;if(s instanceof zt)c=xa(s).decode();else if(s instanceof Mt)c=s.getUnencodedContents();else throw new nl(s);r.push(c,n)}return zc(...r)}}const Ti=class extends xe{constructor(e){super(),b(this,"data"),this.data=e}clone(){return Ti.of(this.data.slice())}toString(){return`PDFInvalidObject(${this.data.length} bytes)`}sizeInBytes(){return this.data.length}copyBytesInto(e,t){const n=this.data.length;for(let r=0;r<n;r++)e[t++]=this.data[r];return n}};let Bi=Ti;b(Bi,"of",e=>new Ti(e));const ir=class extends wi{constructor(e,t,n=!0){super(e,n),b(this,"entries"),b(this,"entryTuplesCache"),b(this,"maxByteWidthsCache"),b(this,"indexCache"),b(this,"computeIndex",()=>{const r=[];let i=0;for(let o=0,s=this.entries.length;o<s;o++){const c=this.entries[o],l=this.entries[o-1];o===0?r.push(c.ref.objectNumber):c.ref.objectNumber-l.ref.objectNumber>1&&(r.push(i),r.push(c.ref.objectNumber),i=0),i+=1}return r.push(i),r}),b(this,"computeEntryTuples",()=>{const r=new Array(this.entries.length);for(let i=0,o=this.entries.length;i<o;i++){const s=this.entries[i];if(s.type===0){const{type:c,nextFreeObjectNumber:l,ref:a}=s;r[i]=[c,l,a.generationNumber]}if(s.type===1){const{type:c,offset:l,ref:a}=s;r[i]=[c,l,a.generationNumber]}if(s.type===2){const{type:c,objectStreamRef:l,index:a}=s;r[i]=[c,l.objectNumber,a]}}return r}),b(this,"computeMaxEntryByteWidths",()=>{const r=this.entryTuplesCache.access(),i=[0,0,0];for(let o=0,s=r.length;o<s;o++){const[c,l,a]=r[o],h=zn(c),d=zn(l),u=zn(a);h>i[0]&&(i[0]=h),d>i[1]&&(i[1]=d),u>i[2]&&(i[2]=u)}return i}),this.entries=t||[],this.entryTuplesCache=Tt.populatedBy(this.computeEntryTuples),this.maxByteWidthsCache=Tt.populatedBy(this.computeMaxEntryByteWidths),this.indexCache=Tt.populatedBy(this.computeIndex),e.set(p.of("Type"),p.of("XRef"))}addDeletedEntry(e,t){this.entries.push({type:0,ref:e,nextFreeObjectNumber:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}addUncompressedEntry(e,t){this.entries.push({type:1,ref:e,offset:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}addCompressedEntry(e,t,n){this.entries.push({type:2,ref:e,objectStreamRef:t,index:n}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}clone(e){const{dict:t,entries:n,encode:r}=this;return ir.of(t.clone(e),n.slice(),r)}getContentsString(){const e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access();let n="";for(let r=0,i=e.length;r<i;r++){const[o,s,c]=e[r],l=At(Bt(o)),a=At(Bt(s)),h=At(Bt(c));for(let d=t[0]-1;d>=0;d--)n+=(l[d]||0).toString(2);for(let d=t[1]-1;d>=0;d--)n+=(a[d]||0).toString(2);for(let d=t[2]-1;d>=0;d--)n+=(h[d]||0).toString(2)}return n}getUnencodedContents(){const e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access(),n=new Uint8Array(this.getUnencodedContentsSize());let r=0;for(let i=0,o=e.length;i<o;i++){const[s,c,l]=e[i],a=At(Bt(s)),h=At(Bt(c)),d=At(Bt(l));for(let u=t[0]-1;u>=0;u--)n[r++]=a[u]||0;for(let u=t[1]-1;u>=0;u--)n[r++]=h[u]||0;for(let u=t[2]-1;u>=0;u--)n[r++]=d[u]||0}return n}getUnencodedContentsSize(){const e=this.maxByteWidthsCache.access();return Mc(e)*this.entries.length}updateDict(){super.updateDict();const e=this.maxByteWidthsCache.access(),t=this.indexCache.access(),{context:n}=this.dict;this.dict.set(p.of("W"),n.obj(e)),this.dict.set(p.of("Index"),n.obj(t))}};let Di=ir;b(Di,"create",(e,t=!0)=>{const n=new ir(e,[],t);return n.addDeletedEntry(se.of(0,65535),0),n}),b(Di,"of",(e,t,n=!0)=>new ir(e,t,n));const Sa=class extends Ai{constructor(e,t,n,r){super(e,t),b(this,"encodeStreams"),b(this,"objectsPerStream"),this.encodeStreams=n,this.objectsPerStream=r}async computeBufferSize(){let e=this.context.largestObjectNumber+1;const t=yn.forVersion(1,7);let n=t.sizeInBytes()+2;const r=Di.create(this.createTrailerDict(),this.encodeStreams),i=[],o=[],s=[],c=this.context.enumerateIndirectObjects();for(let d=0,u=c.length;d<u;d++){const f=c[d],[y,_]=f;if(y===this.context.trailerInfo.Encrypt||_ instanceof ht||_ instanceof Bi||y.generationNumber!==0)i.push(f),r.addUncompressedEntry(y,n),n+=this.computeIndirectObjectSize(f),this.shouldWaitForTick(1)&&await Ct();else{let w=Nn(o),T=Nn(s);(!w||w.length%this.objectsPerStream===0)&&(w=[],o.push(w),T=se.of(e++),s.push(T)),r.addCompressedEntry(y,T,w.length),w.push(f)}}for(let d=0,u=o.length;d<u;d++){const f=o[d],y=s[d],_=ki.withContextAndObjects(this.context,f,this.encodeStreams);r.addUncompressedEntry(y,n),n+=this.computeIndirectObjectSize([y,_]),i.push([y,_]),this.shouldWaitForTick(f.length)&&await Ct()}const l=se.of(e++);r.dict.set(p.of("Size"),H.of(e)),r.addUncompressedEntry(l,n);const a=n;n+=this.computeIndirectObjectSize([l,r]),i.push([l,r]);const h=tr.forLastCrossRefSectionOffset(a);return n+=h.sizeInBytes(),{size:n,header:t,indirectObjects:i,trailer:h}}};let va=Sa;b(va,"forContext",(e,t,n=!0,r=50)=>new Sa(e,t,n,r));const ka=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],vf={1:"DeviceGray",3:"DeviceRGB",4:"DeviceCMYK"};class Ei{constructor(t,n,r,i,o){b(this,"bitsPerComponent"),b(this,"height"),b(this,"width"),b(this,"colorSpace"),b(this,"imageData"),this.imageData=t,this.bitsPerComponent=n,this.width=r,this.height=i,this.colorSpace=o}static async for(t){const n=new DataView(t.buffer);if(n.getUint16(0)!==65496)throw new Error("SOI not found in JPEG");let i=2,o;for(;i<n.byteLength&&(o=n.getUint16(i),i+=2,!ka.includes(o));)i+=n.getUint16(i);if(!ka.includes(o))throw new Error("Invalid JPEG");i+=2;const s=n.getUint8(i++),c=n.getUint16(i);i+=2;const l=n.getUint16(i);i+=2;const a=n.getUint8(i++),h=vf[a];if(!h)throw new Error("Unknown JPEG channel.");const d=h;return new Ei(t,s,l,c,d)}async embedIntoContext(t,n){const r=t.stream(this.imageData,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.bitsPerComponent,Width:this.width,Height:this.height,ColorSpace:this.colorSpace,Filter:"DCTDecode",Decode:this.colorSpace==="DeviceCMYK"?[1,0,1,0,1,0,1,0]:void 0});return n?(t.assign(n,r),n):t.register(r)}}var A={};A.toRGBA8=function(e){var t=e.width,n=e.height;if(e.tabs.acTL==null)return[A.toRGBA8.decodeImage(e.data,t,n,e).buffer];var r=[];e.frames[0].data==null&&(e.frames[0].data=e.data);for(var i=t*n*4,o=new Uint8Array(i),s=new Uint8Array(i),c=new Uint8Array(i),l=0;l<e.frames.length;l++){var a=e.frames[l],h=a.rect.x,d=a.rect.y,u=a.rect.width,f=a.rect.height,y=A.toRGBA8.decodeImage(a.data,u,f,e);if(l!=0)for(var _=0;_<i;_++)c[_]=o[_];if(a.blend==0?A._copyTile(y,u,f,o,t,n,h,d,0):a.blend==1&&A._copyTile(y,u,f,o,t,n,h,d,1),r.push(o.buffer.slice(0)),a.dispose!=0){if(a.dispose==1)A._copyTile(s,u,f,o,t,n,h,d,0);else if(a.dispose==2)for(var _=0;_<i;_++)o[_]=c[_]}}return r},A.toRGBA8.decodeImage=function(e,t,n,r){var i=t*n,o=A.decode._getBPP(r),s=Math.ceil(t*o/8),c=new Uint8Array(i*4),l=new Uint32Array(c.buffer),a=r.ctype,h=r.depth,d=A._bin.readUshort;if(a==6){var u=i<<2;if(h==8)for(var f=0;f<u;f+=4)c[f]=e[f],c[f+1]=e[f+1],c[f+2]=e[f+2],c[f+3]=e[f+3];if(h==16)for(var f=0;f<u;f++)c[f]=e[f<<1]}else if(a==2){var y=r.tabs.tRNS;if(y==null){if(h==8)for(var f=0;f<i;f++){var _=f*3;l[f]=255<<24|e[_+2]<<16|e[_+1]<<8|e[_]}if(h==16)for(var f=0;f<i;f++){var _=f*6;l[f]=255<<24|e[_+4]<<16|e[_+2]<<8|e[_]}}else{var x=y[0],w=y[1],T=y[2];if(h==8)for(var f=0;f<i;f++){var v=f<<2,_=f*3;l[f]=255<<24|e[_+2]<<16|e[_+1]<<8|e[_],e[_]==x&&e[_+1]==w&&e[_+2]==T&&(c[v+3]=0)}if(h==16)for(var f=0;f<i;f++){var v=f<<2,_=f*6;l[f]=255<<24|e[_+4]<<16|e[_+2]<<8|e[_],d(e,_)==x&&d(e,_+2)==w&&d(e,_+4)==T&&(c[v+3]=0)}}}else if(a==3){var S=r.tabs.PLTE,N=r.tabs.tRNS,C=N?N.length:0;if(h==1)for(var k=0;k<n;k++)for(var F=k*s,I=k*t,f=0;f<t;f++){var v=I+f<<2,E=e[F+(f>>3)]>>7-((f&7)<<0)&1,R=3*E;c[v]=S[R],c[v+1]=S[R+1],c[v+2]=S[R+2],c[v+3]=E<C?N[E]:255}if(h==2)for(var k=0;k<n;k++)for(var F=k*s,I=k*t,f=0;f<t;f++){var v=I+f<<2,E=e[F+(f>>2)]>>6-((f&3)<<1)&3,R=3*E;c[v]=S[R],c[v+1]=S[R+1],c[v+2]=S[R+2],c[v+3]=E<C?N[E]:255}if(h==4)for(var k=0;k<n;k++)for(var F=k*s,I=k*t,f=0;f<t;f++){var v=I+f<<2,E=e[F+(f>>1)]>>4-((f&1)<<2)&15,R=3*E;c[v]=S[R],c[v+1]=S[R+1],c[v+2]=S[R+2],c[v+3]=E<C?N[E]:255}if(h==8)for(var f=0;f<i;f++){var v=f<<2,E=e[f],R=3*E;c[v]=S[R],c[v+1]=S[R+1],c[v+2]=S[R+2],c[v+3]=E<C?N[E]:255}}else if(a==4){if(h==8)for(var f=0;f<i;f++){var v=f<<2,Q=f<<1,M=e[Q];c[v]=M,c[v+1]=M,c[v+2]=M,c[v+3]=e[Q+1]}if(h==16)for(var f=0;f<i;f++){var v=f<<2,Q=f<<2,M=e[Q];c[v]=M,c[v+1]=M,c[v+2]=M,c[v+3]=e[Q+2]}}else if(a==0)for(var x=r.tabs.tRNS?r.tabs.tRNS:-1,k=0;k<n;k++){var O=k*s,P=k*t;if(h==1)for(var D=0;D<t;D++){var M=255*(e[O+(D>>>3)]>>>7-(D&7)&1),$=M==x*255?0:255;l[P+D]=$<<24|M<<16|M<<8|M}else if(h==2)for(var D=0;D<t;D++){var M=85*(e[O+(D>>>2)]>>>6-((D&3)<<1)&3),$=M==x*85?0:255;l[P+D]=$<<24|M<<16|M<<8|M}else if(h==4)for(var D=0;D<t;D++){var M=17*(e[O+(D>>>1)]>>>4-((D&1)<<2)&15),$=M==x*17?0:255;l[P+D]=$<<24|M<<16|M<<8|M}else if(h==8)for(var D=0;D<t;D++){var M=e[O+D],$=M==x?0:255;l[P+D]=$<<24|M<<16|M<<8|M}else if(h==16)for(var D=0;D<t;D++){var M=e[O+(D<<1)],$=d(e,O+(D<<f))==x?0:255;l[P+D]=$<<24|M<<16|M<<8|M}}return c},A.decode=function(e){for(var t=new Uint8Array(e),n=8,r=A._bin,i=r.readUshort,o=r.readUint,s={tabs:{},frames:[]},c=new Uint8Array(t.length),l=0,a,h=0,d=[137,80,78,71,13,10,26,10],u=0;u<8;u++)if(t[u]!=d[u])throw"The input is not a PNG file!";for(;n<t.length;){var f=r.readUint(t,n);n+=4;var y=r.readASCII(t,n,4);if(n+=4,y=="IHDR")A.decode._IHDR(t,n,s);else if(y=="IDAT"){for(var u=0;u<f;u++)c[l+u]=t[n+u];l+=f}else if(y=="acTL")s.tabs[y]={num_frames:o(t,n),num_plays:o(t,n+4)},a=new Uint8Array(t.length);else if(y=="fcTL"){if(h!=0){var _=s.frames[s.frames.length-1];_.data=A.decode._decompress(s,a.slice(0,h),_.rect.width,_.rect.height),h=0}var x={x:o(t,n+12),y:o(t,n+16),width:o(t,n+4),height:o(t,n+8)},w=i(t,n+22);w=i(t,n+20)/(w==0?100:w);var T={rect:x,delay:Math.round(w*1e3),dispose:t[n+24],blend:t[n+25]};s.frames.push(T)}else if(y=="fdAT"){for(var u=0;u<f-4;u++)a[h+u]=t[n+u+4];h+=f-4}else if(y=="pHYs")s.tabs[y]=[r.readUint(t,n),r.readUint(t,n+4),t[n+8]];else if(y=="cHRM"){s.tabs[y]=[];for(var u=0;u<8;u++)s.tabs[y].push(r.readUint(t,n+u*4))}else if(y=="tEXt"){s.tabs[y]==null&&(s.tabs[y]={});var v=r.nextZero(t,n),S=r.readASCII(t,n,v-n),N=r.readASCII(t,v+1,n+f-v-1);s.tabs[y][S]=N}else if(y=="iTXt"){s.tabs[y]==null&&(s.tabs[y]={});var v=0,C=n;v=r.nextZero(t,C);var S=r.readASCII(t,C,v-C);C=v+1,t[C],t[C+1],C+=2,v=r.nextZero(t,C),r.readASCII(t,C,v-C),C=v+1,v=r.nextZero(t,C),r.readUTF8(t,C,v-C),C=v+1;var N=r.readUTF8(t,C,f-(C-n));s.tabs[y][S]=N}else if(y=="PLTE")s.tabs[y]=r.readBytes(t,n,f);else if(y=="hIST"){var k=s.tabs.PLTE.length/3;s.tabs[y]=[];for(var u=0;u<k;u++)s.tabs[y].push(i(t,n+u*2))}else if(y=="tRNS")s.ctype==3?s.tabs[y]=r.readBytes(t,n,f):s.ctype==0?s.tabs[y]=i(t,n):s.ctype==2&&(s.tabs[y]=[i(t,n),i(t,n+2),i(t,n+4)]);else if(y=="gAMA")s.tabs[y]=r.readUint(t,n)/1e5;else if(y=="sRGB")s.tabs[y]=t[n];else if(y=="bKGD")s.ctype==0||s.ctype==4?s.tabs[y]=[i(t,n)]:s.ctype==2||s.ctype==6?s.tabs[y]=[i(t,n),i(t,n+2),i(t,n+4)]:s.ctype==3&&(s.tabs[y]=t[n]);else if(y=="IEND")break;n+=f,r.readUint(t,n),n+=4}if(h!=0){var _=s.frames[s.frames.length-1];_.data=A.decode._decompress(s,a.slice(0,h),_.rect.width,_.rect.height),h=0}return s.data=A.decode._decompress(s,c,s.width,s.height),delete s.compress,delete s.interlace,delete s.filter,s},A.decode._decompress=function(e,t,n,r){var i=A.decode._getBPP(e),o=Math.ceil(n*i/8),s=new Uint8Array((o+1+e.interlace)*r);return t=A.decode._inflate(t,s),e.interlace==0?t=A.decode._filterZero(t,e,0,n,r):e.interlace==1&&(t=A.decode._readInterlace(t,e)),t},A.decode._inflate=function(e,t){var n=A.inflateRaw(new Uint8Array(e.buffer,2,e.length-6),t);return n},A.inflateRaw=function(){var e={};return e.H={},e.H.N=function(t,n){var r=Uint8Array,i=0,o=0,s=0,c=0,l=0,a=0,h=0,d=0,u=0,f,y;if(t[0]==3&&t[1]==0)return n||new r(0);var _=e.H,x=_.b,w=_.e,T=_.R,v=_.n,S=_.A,N=_.Z,C=_.m,k=n==null;for(k&&(n=new r(t.length>>>2<<3));i==0;){if(i=x(t,u,1),o=x(t,u+1,2),u+=3,o==0){(u&7)!=0&&(u+=8-(u&7));var F=(u>>>3)+4,I=t[F-4]|t[F-3]<<8;k&&(n=e.H.W(n,d+I)),n.set(new r(t.buffer,t.byteOffset+F,I),d),u=F+I<<3,d+=I;continue}if(k&&(n=e.H.W(n,d+(1<<17))),o==1&&(f=C.J,y=C.h,a=(1<<9)-1,h=(1<<5)-1),o==2){s=w(t,u,5)+257,c=w(t,u+5,5)+1,l=w(t,u+10,4)+4,u+=14;for(var E=1,R=0;R<38;R+=2)C.Q[R]=0,C.Q[R+1]=0;for(var R=0;R<l;R++){var Q=w(t,u+R*3,3);C.Q[(C.X[R]<<1)+1]=Q,Q>E&&(E=Q)}u+=3*l,v(C.Q,E),S(C.Q,E,C.u),f=C.w,y=C.d,u=T(C.u,(1<<E)-1,s+c,t,u,C.v);var M=_.V(C.v,0,s,C.C);a=(1<<M)-1;var O=_.V(C.v,s,c,C.D);h=(1<<O)-1,v(C.C,M),S(C.C,M,f),v(C.D,O),S(C.D,O,y)}for(;;){var P=f[N(t,u)&a];u+=P&15;var D=P>>>4;if(D>>>8==0)n[d++]=D;else{if(D==256)break;var $=d+D-254;if(D>264){var oe=C.q[D-257];$=d+(oe>>>3)+w(t,u,oe&7),u+=oe&7}var he=y[N(t,u)&h];u+=he&15;var be=he>>>4,Ce=C.c[be],Fe=(Ce>>>4)+x(t,u,Ce&15);for(u+=Ce&15;d<$;)n[d]=n[d++-Fe],n[d]=n[d++-Fe],n[d]=n[d++-Fe],n[d]=n[d++-Fe];d=$}}}return n.length==d?n:n.slice(0,d)},e.H.W=function(t,n){var r=t.length;if(n<=r)return t;var i=new Uint8Array(r<<1);return i.set(t,0),i},e.H.R=function(t,n,r,i,o,s){for(var c=e.H.e,l=e.H.Z,a=0;a<r;){var h=t[l(i,o)&n];o+=h&15;var d=h>>>4;if(d<=15)s[a]=d,a++;else{var u=0,f=0;d==16?(f=3+c(i,o,2),o+=2,u=s[a-1]):d==17?(f=3+c(i,o,3),o+=3):d==18&&(f=11+c(i,o,7),o+=7);for(var y=a+f;a<y;)s[a]=u,a++}}return o},e.H.V=function(t,n,r,i){for(var o=0,s=0,c=i.length>>>1;s<r;){var l=t[s+n];i[s<<1]=0,i[(s<<1)+1]=l,l>o&&(o=l),s++}for(;s<c;)i[s<<1]=0,i[(s<<1)+1]=0,s++;return o},e.H.n=function(t,n){for(var r=e.H.m,i=t.length,o,s,c,l,a,h=r.j,l=0;l<=n;l++)h[l]=0;for(l=1;l<i;l+=2)h[t[l]]++;var d=r.K;for(o=0,h[0]=0,s=1;s<=n;s++)o=o+h[s-1]<<1,d[s]=o;for(c=0;c<i;c+=2)a=t[c+1],a!=0&&(t[c]=d[a],d[a]++)},e.H.A=function(t,n,r){for(var i=t.length,o=e.H.m,s=o.r,c=0;c<i;c+=2)if(t[c+1]!=0)for(var l=c>>1,a=t[c+1],h=l<<4|a,d=n-a,u=t[c]<<d,f=u+(1<<d);u!=f;){var y=s[u]>>>15-n;r[y]=h,u++}},e.H.l=function(t,n){for(var r=e.H.m.r,i=15-n,o=0;o<t.length;o+=2){var s=t[o]<<n-t[o+1];t[o]=r[s]>>>i}},e.H.M=function(t,n,r){r=r<<(n&7);var i=n>>>3;t[i]|=r,t[i+1]|=r>>>8},e.H.I=function(t,n,r){r=r<<(n&7);var i=n>>>3;t[i]|=r,t[i+1]|=r>>>8,t[i+2]|=r>>>16},e.H.e=function(t,n,r){return(t[n>>>3]|t[(n>>>3)+1]<<8)>>>(n&7)&(1<<r)-1},e.H.b=function(t,n,r){return(t[n>>>3]|t[(n>>>3)+1]<<8|t[(n>>>3)+2]<<16)>>>(n&7)&(1<<r)-1},e.H.Z=function(t,n){return(t[n>>>3]|t[(n>>>3)+1]<<8|t[(n>>>3)+2]<<16)>>>(n&7)},e.H.i=function(t,n){return(t[n>>>3]|t[(n>>>3)+1]<<8|t[(n>>>3)+2]<<16|t[(n>>>3)+3]<<24)>>>(n&7)},e.H.m=function(){var t=Uint16Array,n=Uint32Array;return{K:new t(16),j:new t(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new t(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new n(32),J:new t(512),_:[],h:new t(32),$:[],w:new t(32768),C:[],v:[],d:new t(32768),D:[],u:new t(512),Q:[],r:new t(1<<15),s:new n(286),Y:new n(30),a:new n(19),t:new n(15e3),k:new t(1<<16),g:new t(1<<15)}}(),function(){for(var t=e.H.m,n=1<<15,r=0;r<n;r++){var i=r;i=(i&2863311530)>>>1|(i&1431655765)<<1,i=(i&3435973836)>>>2|(i&858993459)<<2,i=(i&4042322160)>>>4|(i&252645135)<<4,i=(i&4278255360)>>>8|(i&16711935)<<8,t.r[r]=(i>>>16|i<<16)>>>17}function o(s,c,l){for(;c--!=0;)s.push(0,l)}for(var r=0;r<32;r++)t.q[r]=t.S[r]<<3|t.T[r],t.c[r]=t.p[r]<<4|t.z[r];o(t._,144,8),o(t._,255-143,9),o(t._,279-255,7),o(t._,287-279,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),o(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),o(t.Q,19,0),o(t.C,286,0),o(t.D,30,0),o(t.v,320,0)}(),e.H.N}(),A.decode._readInterlace=function(e,t){for(var n=t.width,r=t.height,i=A.decode._getBPP(t),o=i>>3,s=Math.ceil(n*i/8),c=new Uint8Array(r*s),l=0,a=[0,0,4,0,2,0,1],h=[0,4,0,2,0,1,0],d=[8,8,8,4,4,2,2],u=[8,8,4,4,2,2,1],f=0;f<7;){for(var y=d[f],_=u[f],x=0,w=0,T=a[f];T<r;)T+=y,w++;for(var v=h[f];v<n;)v+=_,x++;var S=Math.ceil(x*i/8);A.decode._filterZero(e,t,l,x,w);for(var N=0,C=a[f];C<r;){for(var k=h[f],F=l+N*S<<3;k<n;){if(i==1){var I=e[F>>3];I=I>>7-(F&7)&1,c[C*s+(k>>3)]|=I<<7-((k&7)<<0)}if(i==2){var I=e[F>>3];I=I>>6-(F&7)&3,c[C*s+(k>>2)]|=I<<6-((k&3)<<1)}if(i==4){var I=e[F>>3];I=I>>4-(F&7)&15,c[C*s+(k>>1)]|=I<<4-((k&1)<<2)}if(i>=8)for(var E=C*s+k*o,R=0;R<o;R++)c[E+R]=e[(F>>3)+R];F+=i,k+=_}N++,C+=y}x*w!=0&&(l+=w*(1+S)),f=f+1}return c},A.decode._getBPP=function(e){var t=[1,null,3,1,2,null,4][e.ctype];return t*e.depth},A.decode._filterZero=function(e,t,n,r,i){var o=A.decode._getBPP(t),s=Math.ceil(r*o/8),c=A.decode._paeth;o=Math.ceil(o/8);var l=0,a=1,h=e[n],d=0;if(h>1&&(e[n]=[0,0,1][h-2]),h==3)for(d=o;d<s;d++)e[d+1]=e[d+1]+(e[d+1-o]>>>1)&255;for(var u=0;u<i;u++)if(l=n+u*s,a=l+u+1,h=e[a-1],d=0,h==0)for(;d<s;d++)e[l+d]=e[a+d];else if(h==1){for(;d<o;d++)e[l+d]=e[a+d];for(;d<s;d++)e[l+d]=e[a+d]+e[l+d-o]}else if(h==2)for(;d<s;d++)e[l+d]=e[a+d]+e[l+d-s];else if(h==3){for(;d<o;d++)e[l+d]=e[a+d]+(e[l+d-s]>>>1);for(;d<s;d++)e[l+d]=e[a+d]+(e[l+d-s]+e[l+d-o]>>>1)}else{for(;d<o;d++)e[l+d]=e[a+d]+c(0,e[l+d-s],0);for(;d<s;d++)e[l+d]=e[a+d]+c(e[l+d-o],e[l+d-s],e[l+d-o-s])}return e},A.decode._paeth=function(e,t,n){var r=e+t-n,i=r-e,o=r-t,s=r-n;return i*i<=o*o&&i*i<=s*s?e:o*o<=s*s?t:n},A.decode._IHDR=function(e,t,n){var r=A._bin;n.width=r.readUint(e,t),t+=4,n.height=r.readUint(e,t),t+=4,n.depth=e[t],t++,n.ctype=e[t],t++,n.compress=e[t],t++,n.filter=e[t],t++,n.interlace=e[t],t++},A._bin={nextZero:function(e,t){for(;e[t]!=0;)t++;return t},readUshort:function(e,t){return e[t]<<8|e[t+1]},writeUshort:function(e,t,n){e[t]=n>>8&255,e[t+1]=n&255},readUint:function(e,t){return e[t]*(256*256*256)+(e[t+1]<<16|e[t+2]<<8|e[t+3])},writeUint:function(e,t,n){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=n&255},readASCII:function(e,t,n){for(var r="",i=0;i<n;i++)r+=String.fromCharCode(e[t+i]);return r},writeASCII:function(e,t,n){for(var r=0;r<n.length;r++)e[t+r]=n.charCodeAt(r)},readBytes:function(e,t,n){for(var r=[],i=0;i<n;i++)r.push(e[t+i]);return r},pad:function(e){return e.length<2?"0"+e:e},readUTF8:function(e,t,n){for(var r="",i,o=0;o<n;o++)r+="%"+A._bin.pad(e[t+o].toString(16));try{i=decodeURIComponent(r)}catch{return A._bin.readASCII(e,t,n)}return i}},A._copyTile=function(e,t,n,r,i,o,s,c,l){for(var a=Math.min(t,i),h=Math.min(n,o),d=0,u=0,f=0;f<h;f++)for(var y=0;y<a;y++)if(s>=0&&c>=0?(d=f*t+y<<2,u=(c+f)*i+s+y<<2):(d=(-c+f)*t-s+y<<2,u=f*i+y<<2),l==0)r[u]=e[d],r[u+1]=e[d+1],r[u+2]=e[d+2],r[u+3]=e[d+3];else if(l==1){var _=e[d+3]*.00392156862745098,x=e[d]*_,w=e[d+1]*_,T=e[d+2]*_,v=r[u+3]*(1/255),S=r[u]*v,N=r[u+1]*v,C=r[u+2]*v,k=1-_,F=_+v*k,I=F==0?0:1/F;r[u+3]=255*F,r[u+0]=(x+S*k)*I,r[u+1]=(w+N*k)*I,r[u+2]=(T+C*k)*I}else if(l==2){var _=e[d+3],x=e[d],w=e[d+1],T=e[d+2],v=r[u+3],S=r[u],N=r[u+1],C=r[u+2];_==v&&x==S&&w==N&&T==C?(r[u]=0,r[u+1]=0,r[u+2]=0,r[u+3]=0):(r[u]=x,r[u+1]=w,r[u+2]=T,r[u+3]=_)}else if(l==3){var _=e[d+3],x=e[d],w=e[d+1],T=e[d+2],v=r[u+3],S=r[u],N=r[u+1],C=r[u+2];if(_==v&&x==S&&w==N&&T==C)continue;if(_<220&&v>20)return!1}return!0},A.encode=function(e,t,n,r,i,o,s){r==null&&(r=0),s==null&&(s=!1);var c=A.encode.compress(e,t,n,r,[!1,!1,!1,0,s]);return A.encode.compressPNG(c,-1),A.encode._main(c,t,n,i,o)},A.encodeLL=function(e,t,n,r,i,o,s,c){for(var l={ctype:0+(r==1?0:2)+(i==0?0:4),depth:o,frames:[]},a=(r+i)*o,h=a*t,d=0;d<e.length;d++)l.frames.push({rect:{x:0,y:0,width:t,height:n},img:new Uint8Array(e[d]),blend:0,dispose:1,bpp:Math.ceil(a/8),bpl:Math.ceil(h/8)});A.encode.compressPNG(l,0,!0);var u=A.encode._main(l,t,n,s,c);return u},A.encode._main=function(e,t,n,r,i){i==null&&(i={});var o=A.crc.crc,s=A._bin.writeUint,c=A._bin.writeUshort,l=A._bin.writeASCII,a=8,h=e.frames.length>1,d=!1,u=8+(16+5+4)+(h?20:0);if(i.sRGB!=null&&(u+=8+1+4),i.pHYs!=null&&(u+=8+9+4),e.ctype==3){for(var f=e.plte.length,y=0;y<f;y++)e.plte[y]>>>24!=255&&(d=!0);u+=8+f*3+4+(d?8+f*1+4:0)}for(var _=0;_<e.frames.length;_++){var x=e.frames[_];h&&(u+=38),u+=x.cimg.length+12,_!=0&&(u+=4)}u+=12;for(var w=new Uint8Array(u),T=[137,80,78,71,13,10,26,10],y=0;y<8;y++)w[y]=T[y];if(s(w,a,13),a+=4,l(w,a,"IHDR"),a+=4,s(w,a,t),a+=4,s(w,a,n),a+=4,w[a]=e.depth,a++,w[a]=e.ctype,a++,w[a]=0,a++,w[a]=0,a++,w[a]=0,a++,s(w,a,o(w,a-17,17)),a+=4,i.sRGB!=null&&(s(w,a,1),a+=4,l(w,a,"sRGB"),a+=4,w[a]=i.sRGB,a++,s(w,a,o(w,a-5,5)),a+=4),i.pHYs!=null&&(s(w,a,9),a+=4,l(w,a,"pHYs"),a+=4,s(w,a,i.pHYs[0]),a+=4,s(w,a,i.pHYs[1]),a+=4,w[a]=i.pHYs[2],a++,s(w,a,o(w,a-13,13)),a+=4),h&&(s(w,a,8),a+=4,l(w,a,"acTL"),a+=4,s(w,a,e.frames.length),a+=4,s(w,a,i.loop!=null?i.loop:0),a+=4,s(w,a,o(w,a-12,12)),a+=4),e.ctype==3){var f=e.plte.length;s(w,a,f*3),a+=4,l(w,a,"PLTE"),a+=4;for(var y=0;y<f;y++){var v=y*3,S=e.plte[y],N=S&255,C=S>>>8&255,k=S>>>16&255;w[a+v+0]=N,w[a+v+1]=C,w[a+v+2]=k}if(a+=f*3,s(w,a,o(w,a-f*3-4,f*3+4)),a+=4,d){s(w,a,f),a+=4,l(w,a,"tRNS"),a+=4;for(var y=0;y<f;y++)w[a+y]=e.plte[y]>>>24&255;a+=f,s(w,a,o(w,a-f-4,f+4)),a+=4}}for(var F=0,_=0;_<e.frames.length;_++){var x=e.frames[_];h&&(s(w,a,26),a+=4,l(w,a,"fcTL"),a+=4,s(w,a,F++),a+=4,s(w,a,x.rect.width),a+=4,s(w,a,x.rect.height),a+=4,s(w,a,x.rect.x),a+=4,s(w,a,x.rect.y),a+=4,c(w,a,r[_]),a+=2,c(w,a,1e3),a+=2,w[a]=x.dispose,a++,w[a]=x.blend,a++,s(w,a,o(w,a-30,30)),a+=4);var I=x.cimg,f=I.length;s(w,a,f+(_==0?0:4)),a+=4;var E=a;l(w,a,_==0?"IDAT":"fdAT"),a+=4,_!=0&&(s(w,a,F++),a+=4),w.set(I,a),a+=f,s(w,a,o(w,E,a-E)),a+=4}return s(w,a,0),a+=4,l(w,a,"IEND"),a+=4,s(w,a,o(w,a-4,4)),a+=4,w.buffer},A.encode.compressPNG=function(e,t,n){for(var r=0;r<e.frames.length;r++){var i=e.frames[r];i.rect.width;var o=i.rect.height,s=new Uint8Array(o*i.bpl+o);i.cimg=A.encode._filterZero(i.img,o,i.bpp,i.bpl,s,t,n)}},A.encode.compress=function(e,t,n,r,i){for(var o=i[0],s=i[1],c=i[2],l=i[3],a=i[4],h=6,d=8,u=255,f=0;f<e.length;f++)for(var y=new Uint8Array(e[f]),_=y.length,x=0;x<_;x+=4)u&=y[x+3];var w=u!=255,T=A.encode.framize(e,t,n,o,s,c),v={},S=[],N=[];if(r!=0){for(var C=[],x=0;x<T.length;x++)C.push(T[x].img.buffer);for(var k=A.encode.concatRGBA(C),F=A.quantize(k,r),I=0,E=new Uint8Array(F.abuf),x=0;x<T.length;x++){var R=T[x].img,Q=R.length;N.push(new Uint8Array(F.inds.buffer,I>>2,Q>>2));for(var f=0;f<Q;f+=4)R[f]=E[I+f],R[f+1]=E[I+f+1],R[f+2]=E[I+f+2],R[f+3]=E[I+f+3];I+=Q}for(var x=0;x<F.plte.length;x++)S.push(F.plte[x].est.rgba)}else for(var f=0;f<T.length;f++){var M=T[f],O=new Uint32Array(M.img.buffer),P=M.rect.width,_=O.length,D=new Uint8Array(_);N.push(D);for(var x=0;x<_;x++){var $=O[x];if(x!=0&&$==O[x-1])D[x]=D[x-1];else if(x>P&&$==O[x-P])D[x]=D[x-P];else{var oe=v[$];if(oe==null&&(v[$]=oe=S.length,S.push($),S.length>=300))break;D[x]=oe}}}var he=S.length;he<=256&&a==!1&&(he<=2?d=1:he<=4?d=2:he<=16?d=4:d=8,d=Math.max(d,l));for(var f=0;f<T.length;f++){var M=T[f];M.rect.x,M.rect.y;var P=M.rect.width,be=M.rect.height,Ce=M.img;new Uint32Array(Ce.buffer);var Fe=4*P,bo=4;if(he<=256&&a==!1){Fe=Math.ceil(d*P/8);for(var Ze=new Uint8Array(Fe*be),Tr=N[f],Br=0;Br<be;Br++){var x=Br*Fe,Dr=Br*P;if(d==8)for(var fe=0;fe<P;fe++)Ze[x+fe]=Tr[Dr+fe];else if(d==4)for(var fe=0;fe<P;fe++)Ze[x+(fe>>1)]|=Tr[Dr+fe]<<4-(fe&1)*4;else if(d==2)for(var fe=0;fe<P;fe++)Ze[x+(fe>>2)]|=Tr[Dr+fe]<<6-(fe&3)*2;else if(d==1)for(var fe=0;fe<P;fe++)Ze[x+(fe>>3)]|=Tr[Dr+fe]<<7-(fe&7)*1}Ce=Ze,h=3,bo=1}else if(w==!1&&T.length==1){for(var Ze=new Uint8Array(P*be*3),e0=P*be,x=0;x<e0;x++){var R=x*3,mo=x*4;Ze[R]=Ce[mo],Ze[R+1]=Ce[mo+1],Ze[R+2]=Ce[mo+2]}Ce=Ze,h=2,bo=3,Fe=3*P}M.img=Ce,M.bpl=Fe,M.bpp=bo}return{ctype:h,depth:d,plte:S,frames:T}},A.encode.framize=function(e,t,n,r,i,o){for(var s=[],c=0;c<e.length;c++){var l=new Uint8Array(e[c]),a=new Uint32Array(l.buffer),h,d=0,u=0,f=t,y=n,_=r?1:0;if(c!=0){for(var x=o||r||c==1||s[c-2].dispose!=0?1:2,w=0,T=1e9,v=0;v<x;v++){for(var M=new Uint8Array(e[c-1-v]),S=new Uint32Array(e[c-1-v]),N=t,C=n,k=-1,F=-1,I=0;I<n;I++)for(var E=0;E<t;E++){var R=I*t+E;a[R]!=S[R]&&(E<N&&(N=E),E>k&&(k=E),I<C&&(C=I),I>F&&(F=I))}k==-1&&(N=C=k=F=0),i&&((N&1)==1&&N--,(C&1)==1&&C--);var Q=(k-N+1)*(F-C+1);Q<T&&(T=Q,w=v,d=N,u=C,f=k-N+1,y=F-C+1)}var M=new Uint8Array(e[c-1-w]);w==1&&(s[c-1].dispose=2),h=new Uint8Array(f*y*4),A._copyTile(M,t,n,h,f,y,-d,-u,0),_=A._copyTile(l,t,n,h,f,y,-d,-u,3)?1:0,_==1?A.encode._prepareDiff(l,t,n,h,{x:d,y:u,width:f,height:y}):A._copyTile(l,t,n,h,f,y,-d,-u,0)}else h=l.slice(0);s.push({rect:{x:d,y:u,width:f,height:y},img:h,blend:_,dispose:0})}if(r)for(var c=0;c<s.length;c++){var O=s[c];if(O.blend!=1){var P=O.rect,D=s[c-1].rect,$=Math.min(P.x,D.x),oe=Math.min(P.y,D.y),he=Math.max(P.x+P.width,D.x+D.width),be=Math.max(P.y+P.height,D.y+D.height),Ce={x:$,y:oe,width:he-$,height:be-oe};s[c-1].dispose=1,c-1!=0&&A.encode._updateFrame(e,t,n,s,c-1,Ce,i),A.encode._updateFrame(e,t,n,s,c,Ce,i)}}var Fe=0;if(e.length!=1)for(var R=0;R<s.length;R++){var O=s[R];Fe+=O.rect.width*O.rect.height}return s},A.encode._updateFrame=function(e,t,n,r,i,o,s){for(var c=Uint8Array,l=Uint32Array,a=new c(e[i-1]),h=new l(e[i-1]),d=i+1<e.length?new c(e[i+1]):null,u=new c(e[i]),f=new l(u.buffer),y=t,_=n,x=-1,w=-1,T=0;T<o.height;T++)for(var v=0;v<o.width;v++){var S=o.x+v,N=o.y+T,C=N*t+S,k=f[C];k==0||r[i-1].dispose==0&&h[C]==k&&(d==null||d[C*4+3]!=0)||(S<y&&(y=S),S>x&&(x=S),N<_&&(_=N),N>w&&(w=N))}x==-1&&(y=_=x=w=0),s&&((y&1)==1&&y--,(_&1)==1&&_--),o={x:y,y:_,width:x-y+1,height:w-_+1};var F=r[i];F.rect=o,F.blend=1,F.img=new Uint8Array(o.width*o.height*4),r[i-1].dispose==0?(A._copyTile(a,t,n,F.img,o.width,o.height,-o.x,-o.y,0),A.encode._prepareDiff(u,t,n,F.img,o)):A._copyTile(u,t,n,F.img,o.width,o.height,-o.x,-o.y,0)},A.encode._prepareDiff=function(e,t,n,r,i){A._copyTile(e,t,n,r,i.width,i.height,-i.x,-i.y,2)},A.encode._filterZero=function(e,t,n,r,i,o,s){var c=[],l=[0,1,2,3,4];o!=-1?l=[o]:(t*r>5e5||n==1)&&(l=[0]);var a;s&&(a={level:0});for(var h=s&&UZIP!=null?UZIP:gi,d=0;d<l.length;d++){for(var u=0;u<t;u++)A.encode._filterLine(i,e,u,r,n,l[d]);c.push(h.deflate(i,a))}for(var f,y=1e9,d=0;d<c.length;d++)c[d].length<y&&(f=d,y=c[d].length);return c[f]},A.encode._filterLine=function(e,t,n,r,i,o){var s=n*r,c=s+n,l=A.decode._paeth;if(e[c]=o,c++,o==0)if(r<500)for(var a=0;a<r;a++)e[c+a]=t[s+a];else e.set(new Uint8Array(t.buffer,s,r),c);else if(o==1){for(var a=0;a<i;a++)e[c+a]=t[s+a];for(var a=i;a<r;a++)e[c+a]=t[s+a]-t[s+a-i]+256&255}else if(n==0){for(var a=0;a<i;a++)e[c+a]=t[s+a];if(o==2)for(var a=i;a<r;a++)e[c+a]=t[s+a];if(o==3)for(var a=i;a<r;a++)e[c+a]=t[s+a]-(t[s+a-i]>>1)+256&255;if(o==4)for(var a=i;a<r;a++)e[c+a]=t[s+a]-l(t[s+a-i],0,0)+256&255}else{if(o==2)for(var a=0;a<r;a++)e[c+a]=t[s+a]+256-t[s+a-r]&255;if(o==3){for(var a=0;a<i;a++)e[c+a]=t[s+a]+256-(t[s+a-r]>>1)&255;for(var a=i;a<r;a++)e[c+a]=t[s+a]+256-(t[s+a-r]+t[s+a-i]>>1)&255}if(o==4){for(var a=0;a<i;a++)e[c+a]=t[s+a]+256-l(0,t[s+a-r],0)&255;for(var a=i;a<r;a++)e[c+a]=t[s+a]+256-l(t[s+a-i],t[s+a-r],t[s+a-i-r])&255}}},A.crc={table:function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var n=t,r=0;r<8;r++)n&1?n=3988292384^n>>>1:n=n>>>1;e[t]=n}return e}(),update:function(e,t,n,r){for(var i=0;i<r;i++)e=A.crc.table[(e^t[n+i])&255]^e>>>8;return e},crc:function(e,t,n){return A.crc.update(4294967295,e,t,n)^4294967295}},A.quantize=function(e,t){var n=new Uint8Array(e),r=n.slice(0),i=new Uint32Array(r.buffer),o=A.quantize.getKDtree(r,t),s=o[0],c=o[1];A.quantize.planeDst;for(var l=n,a=i,h=l.length,d=new Uint8Array(n.length>>2),u=0;u<h;u+=4){var f=l[u]*.00392156862745098,y=l[u+1]*(1/255),_=l[u+2]*(1/255),x=l[u+3]*(1/255),w=A.quantize.getNearest(s,f,y,_,x);d[u>>2]=w.ind,a[u>>2]=w.est.rgba}return{abuf:r.buffer,inds:d,plte:c}},A.quantize.getKDtree=function(e,t,n){n==null&&(n=1e-4);var r=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=A.quantize.stats(e,i.i0,i.i1),i.est=A.quantize.estats(i.bst);for(var o=[i];o.length<t;){for(var s=0,c=0,l=0;l<o.length;l++)o[l].est.L>s&&(s=o[l].est.L,c=l);if(s<n)break;var a=o[c],h=A.quantize.splitPixels(e,r,a.i0,a.i1,a.est.e,a.est.eMq255),d=a.i0>=h||a.i1<=h;if(d){a.est.L=0;continue}var u={i0:a.i0,i1:h,bst:null,est:null,tdst:0,left:null,right:null};u.bst=A.quantize.stats(e,u.i0,u.i1),u.est=A.quantize.estats(u.bst);var f={i0:h,i1:a.i1,bst:null,est:null,tdst:0,left:null,right:null};f.bst={R:[],m:[],N:a.bst.N-u.bst.N};for(var l=0;l<16;l++)f.bst.R[l]=a.bst.R[l]-u.bst.R[l];for(var l=0;l<4;l++)f.bst.m[l]=a.bst.m[l]-u.bst.m[l];f.est=A.quantize.estats(f.bst),a.left=u,a.right=f,o[c]=u,o.push(f)}o.sort(function(y,_){return _.bst.N-y.bst.N});for(var l=0;l<o.length;l++)o[l].ind=l;return[i,o]},A.quantize.getNearest=function(e,t,n,r,i){if(e.left==null)return e.tdst=A.quantize.dist(e.est.q,t,n,r,i),e;var o=A.quantize.planeDst(e.est,t,n,r,i),s=e.left,c=e.right;o>0&&(s=e.right,c=e.left);var l=A.quantize.getNearest(s,t,n,r,i);if(l.tdst<=o*o)return l;var a=A.quantize.getNearest(c,t,n,r,i);return a.tdst<l.tdst?a:l},A.quantize.planeDst=function(e,t,n,r,i){var o=e.e;return o[0]*t+o[1]*n+o[2]*r+o[3]*i-e.eMq},A.quantize.dist=function(e,t,n,r,i){var o=t-e[0],s=n-e[1],c=r-e[2],l=i-e[3];return o*o+s*s+c*c+l*l},A.quantize.splitPixels=function(e,t,n,r,i,o){var s=A.quantize.vecDot;for(r-=4;n<r;){for(;s(e,n,i)<=o;)n+=4;for(;s(e,r,i)>o;)r-=4;if(n>=r)break;var c=t[n>>2];t[n>>2]=t[r>>2],t[r>>2]=c,n+=4,r-=4}for(;s(e,n,i)>o;)n-=4;return n+4},A.quantize.vecDot=function(e,t,n){return e[t]*n[0]+e[t+1]*n[1]+e[t+2]*n[2]+e[t+3]*n[3]},A.quantize.stats=function(e,t,n){for(var r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],o=n-t>>2,s=t;s<n;s+=4){var c=e[s]*.00392156862745098,l=e[s+1]*(1/255),a=e[s+2]*(1/255),h=e[s+3]*(1/255);i[0]+=c,i[1]+=l,i[2]+=a,i[3]+=h,r[0]+=c*c,r[1]+=c*l,r[2]+=c*a,r[3]+=c*h,r[5]+=l*l,r[6]+=l*a,r[7]+=l*h,r[10]+=a*a,r[11]+=a*h,r[15]+=h*h}return r[4]=r[1],r[8]=r[2],r[9]=r[6],r[12]=r[3],r[13]=r[7],r[14]=r[11],{R:r,m:i,N:o}},A.quantize.estats=function(e){var t=e.R,n=e.m,r=e.N,i=n[0],o=n[1],s=n[2],c=n[3],l=r==0?0:1/r,a=[t[0]-i*i*l,t[1]-i*o*l,t[2]-i*s*l,t[3]-i*c*l,t[4]-o*i*l,t[5]-o*o*l,t[6]-o*s*l,t[7]-o*c*l,t[8]-s*i*l,t[9]-s*o*l,t[10]-s*s*l,t[11]-s*c*l,t[12]-c*i*l,t[13]-c*o*l,t[14]-c*s*l,t[15]-c*c*l],h=a,d=A.M4,u=[.5,.5,.5,.5],f=0,y=0;if(r!=0)for(var _=0;_<10&&(u=d.multVec(h,u),y=Math.sqrt(d.dot(u,u)),u=d.sml(1/y,u),!(Math.abs(y-f)<1e-9));_++)f=y;var x=[i*l,o*l,s*l,c*l],w=d.dot(d.sml(255,x),u);return{Cov:a,q:x,e:u,L:f,eMq255:w,eMq:d.dot(u,x),rgba:(Math.round(255*x[3])<<24|Math.round(255*x[2])<<16|Math.round(255*x[1])<<8|Math.round(255*x[0])<<0)>>>0}},A.M4={multVec:function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]]},dot:function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},sml:function(e,t){return[e*t[0],e*t[1],e*t[2],e*t[3]]}},A.encode.concatRGBA=function(e){for(var t=0,n=0;n<e.length;n++)t+=e[n].byteLength;for(var r=new Uint8Array(t),i=0,n=0;n<e.length;n++){for(var o=new Uint8Array(e[n]),s=o.length,c=0;c<s;c+=4){var l=o[c],a=o[c+1],h=o[c+2],d=o[c+3];d==0&&(l=a=h=0),r[i+c]=l,r[i+c+1]=a,r[i+c+2]=h,r[i+c+3]=d}i+=s}return r.buffer};const kf=e=>{if(e===0)return Lt.Greyscale;if(e===2)return Lt.Truecolour;if(e===3)return Lt.IndexedColour;if(e===4)return Lt.GreyscaleWithAlpha;if(e===6)return Lt.TruecolourWithAlpha;throw new Error(`Unknown color type: ${e}`)},Af=e=>{const t=Math.floor(e.length/4),n=new Uint8Array(t*3),r=new Uint8Array(t*1);let i=0,o=0,s=0;for(;i<e.length;)n[o++]=e[i++],n[o++]=e[i++],n[o++]=e[i++],r[s++]=e[i++];return{rgbChannel:n,alphaChannel:r}};var Lt=(e=>(e.Greyscale="Greyscale",e.Truecolour="Truecolour",e.IndexedColour="IndexedColour",e.GreyscaleWithAlpha="GreyscaleWithAlpha",e.TruecolourWithAlpha="TruecolourWithAlpha",e))(Lt||{});const Aa=class{constructor(e){b(this,"rgbChannel"),b(this,"alphaChannel"),b(this,"type"),b(this,"width"),b(this,"height"),b(this,"bitsPerComponent");const t=A.decode(e),n=A.toRGBA8(t);if(n.length>1)throw new Error("Animated PNGs are not supported");const r=new Uint8Array(n[0]),{rgbChannel:i,alphaChannel:o}=Af(r);this.rgbChannel=i,o.some(c=>c<255)&&(this.alphaChannel=o),this.type=kf(t.ctype),this.width=t.width,this.height=t.height,this.bitsPerComponent=8}};let Ca=Aa;b(Ca,"load",e=>new Aa(e));class Pi{constructor(t){b(this,"bitsPerComponent"),b(this,"height"),b(this,"width"),b(this,"colorSpace"),b(this,"image"),this.image=t,this.bitsPerComponent=t.bitsPerComponent,this.width=t.width,this.height=t.height,this.colorSpace="DeviceRGB"}static async for(t){const n=Ca.load(t);return new Pi(n)}async embedIntoContext(t,n){const r=this.embedAlphaChannel(t),i=t.flateStream(this.image.rgbChannel,{Type:"XObject",Subtype:"Image",BitsPerComponent:this.image.bitsPerComponent,Width:this.image.width,Height:this.image.height,ColorSpace:this.colorSpace,SMask:r});return n?(t.assign(n,i),n):t.register(i)}embedAlphaChannel(t){if(!this.image.alphaChannel)return;const n=t.flateStream(this.image.alphaChannel,{Type:"XObject",Subtype:"Image",Height:this.image.height,Width:this.image.width,BitsPerComponent:this.image.bitsPerComponent,ColorSpace:"DeviceGray",Decode:[0,1]});return t.register(n)}}const Cf=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+Tf/;class or{constructor(t,n){b(this,"dict"),b(this,"ref"),this.dict=t,this.ref=n}T(){return this.dict.lookupMaybe(p.of("T"),te,Y)}Ff(){const t=this.getInheritableAttribute(p.of("Ff"));return this.dict.context.lookupMaybe(t,H)}V(){const t=this.getInheritableAttribute(p.of("V"));return this.dict.context.lookup(t)}Kids(){return this.dict.lookupMaybe(p.of("Kids"),X)}DA(){const t=this.dict.lookup(p.of("DA"));if(t instanceof te||t instanceof Y)return t}setKids(t){this.dict.set(p.of("Kids"),this.dict.context.obj(t))}getParent(){const t=this.dict.get(p.of("Parent"));if(t instanceof se){const n=this.dict.lookup(p.of("Parent"),W);return new or(n,t)}}setParent(t){t?this.dict.set(p.of("Parent"),t):this.dict.delete(p.of("Parent"))}getFullyQualifiedName(){const t=this.getParent();return t?`${t.getFullyQualifiedName()}.${this.getPartialName()}`:this.getPartialName()}getPartialName(){var t;return(t=this.T())==null?void 0:t.decodeText()}setPartialName(t){t?this.dict.set(p.of("T"),Y.fromText(t)):this.dict.delete(p.of("T"))}setDefaultAppearance(t){this.dict.set(p.of("DA"),te.of(t))}getDefaultAppearance(){const t=this.DA();return t instanceof Y?t.decodeText():t?.asString()}setFontSize(t){var n;const r=(n=this.getFullyQualifiedName())!=null?n:"",i=this.getDefaultAppearance();if(!i)throw new ol(r);const o=Fc(i,Cf);if(!o.match)throw new sl(r);const s=i.slice(0,o.pos-o.match[0].length),c=o.pos<=i.length?i.slice(o.pos):"",l=o.match[1],a=`${s} /${l} ${t} Tf ${c}`;this.setDefaultAppearance(a)}getFlags(){var t,n;return(n=(t=this.Ff())==null?void 0:t.asNumber())!=null?n:0}setFlags(t){this.dict.set(p.of("Ff"),H.of(t))}hasFlag(t){return(this.getFlags()&t)!==0}setFlag(t){const n=this.getFlags();this.setFlags(n|t)}clearFlag(t){const n=this.getFlags();this.setFlags(n&~t)}setFlagTo(t,n){n?this.setFlag(t):this.clearFlag(t)}getInheritableAttribute(t){let n;return this.ascend(r=>{n||(n=r.dict.get(t))}),n}ascend(t){t(this);const n=this.getParent();n&&n.ascend(t)}}const Ta=class{constructor(e){b(this,"dict"),this.dict=e}W(){const e=this.dict.lookup(p.of("W"));if(e instanceof H)return e}getWidth(){var e,t;return(t=(e=this.W())==null?void 0:e.asNumber())!=null?t:1}setWidth(e){const t=this.dict.context.obj(e);this.dict.set(p.of("W"),t)}};let sr=Ta;b(sr,"fromDict",e=>new Ta(e));const Ba=class{constructor(e){b(this,"dict"),this.dict=e}Rect(){return this.dict.lookup(p.of("Rect"),X)}AP(){return this.dict.lookupMaybe(p.of("AP"),W)}F(){const e=this.dict.lookup(p.of("F"));return this.dict.context.lookupMaybe(e,H)}getRectangle(){var e;const t=this.Rect();return(e=t?.asRectangle())!=null?e:{x:0,y:0,width:0,height:0}}setRectangle(e){const{x:t,y:n,width:r,height:i}=e,o=this.dict.context.obj([t,n,t+r,n+i]);this.dict.set(p.of("Rect"),o)}getAppearanceState(){const e=this.dict.lookup(p.of("AS"));if(e instanceof p)return e}setAppearanceState(e){this.dict.set(p.of("AS"),e)}setAppearances(e){this.dict.set(p.of("AP"),e)}ensureAP(){let e=this.AP();return e||(e=this.dict.context.obj({}),this.dict.set(p.of("AP"),e)),e}getNormalAppearance(){const t=this.ensureAP().get(p.of("N"));if(t instanceof se||t instanceof W)return t;throw new Error(`Unexpected N type: ${t?.constructor.name}`)}setNormalAppearance(e){this.ensureAP().set(p.of("N"),e)}setRolloverAppearance(e){this.ensureAP().set(p.of("R"),e)}setDownAppearance(e){this.ensureAP().set(p.of("D"),e)}removeRolloverAppearance(){const e=this.AP();e?.delete(p.of("R"))}removeDownAppearance(){const e=this.AP();e?.delete(p.of("D"))}getAppearances(){const e=this.AP();if(!e)return;const t=e.lookup(p.of("N"),W,ht),n=e.lookupMaybe(p.of("R"),W,ht),r=e.lookupMaybe(p.of("D"),W,ht);return{normal:t,rollover:n,down:r}}getFlags(){var e,t;return(t=(e=this.F())==null?void 0:e.asNumber())!=null?t:0}setFlags(e){this.dict.set(p.of("F"),H.of(e))}hasFlag(e){return(this.getFlags()&e)!==0}setFlag(e){const t=this.getFlags();this.setFlags(t|e)}clearFlag(e){const t=this.getFlags();this.setFlags(t&~e)}setFlagTo(e,t){t?this.setFlag(e):this.clearFlag(e)}};let Da=Ba;b(Da,"fromDict",e=>new Ba(e));const Ea=class{constructor(e){b(this,"dict"),this.dict=e}R(){const e=this.dict.lookup(p.of("R"));if(e instanceof H)return e}BC(){const e=this.dict.lookup(p.of("BC"));if(e instanceof X)return e}BG(){const e=this.dict.lookup(p.of("BG"));if(e instanceof X)return e}CA(){const e=this.dict.lookup(p.of("CA"));if(e instanceof Y||e instanceof te)return e}RC(){const e=this.dict.lookup(p.of("RC"));if(e instanceof Y||e instanceof te)return e}AC(){const e=this.dict.lookup(p.of("AC"));if(e instanceof Y||e instanceof te)return e}getRotation(){var e;return(e=this.R())==null?void 0:e.asNumber()}getBorderColor(){const e=this.BC();if(!e)return;const t=[];for(let n=0,r=e?.size();n<r;n++){const i=e.get(n);i instanceof H&&t.push(i.asNumber())}return t}getBackgroundColor(){const e=this.BG();if(!e)return;const t=[];for(let n=0,r=e?.size();n<r;n++){const i=e.get(n);i instanceof H&&t.push(i.asNumber())}return t}getCaptions(){const e=this.CA(),t=this.RC(),n=this.AC();return{normal:e?.decodeText(),rollover:t?.decodeText(),down:n?.decodeText()}}setRotation(e){const t=this.dict.context.obj(e);this.dict.set(p.of("R"),t)}setBorderColor(e){const t=this.dict.context.obj(e);this.dict.set(p.of("BC"),t)}setBackgroundColor(e){const t=this.dict.context.obj(e);this.dict.set(p.of("BG"),t)}setCaptions(e){const t=Y.fromText(e.normal);if(this.dict.set(p.of("CA"),t),e.rollover){const n=Y.fromText(e.rollover);this.dict.set(p.of("RC"),n)}else this.dict.delete(p.of("RC"));if(e.down){const n=Y.fromText(e.down);this.dict.set(p.of("AC"),n)}else this.dict.delete(p.of("AC"))}};let ar=Ea;b(ar,"fromDict",e=>new Ea(e));const Ri=class extends Da{MK(){const e=this.dict.lookup(p.of("MK"));if(e instanceof W)return e}BS(){const e=this.dict.lookup(p.of("BS"));if(e instanceof W)return e}DA(){const e=this.dict.lookup(p.of("DA"));if(e instanceof te||e instanceof Y)return e}P(){const e=this.dict.get(p.of("P"));if(e instanceof se)return e}setP(e){this.dict.set(p.of("P"),e)}setDefaultAppearance(e){this.dict.set(p.of("DA"),te.of(e))}getDefaultAppearance(){const e=this.DA();return e instanceof Y?e.decodeText():e?.asString()}getAppearanceCharacteristics(){const e=this.MK();if(e)return ar.fromDict(e)}getOrCreateAppearanceCharacteristics(){const e=this.MK();if(e)return ar.fromDict(e);const t=ar.fromDict(this.dict.context.obj({}));return this.dict.set(p.of("MK"),t.dict),t}getBorderStyle(){const e=this.BS();if(e)return sr.fromDict(e)}getOrCreateBorderStyle(){const e=this.BS();if(e)return sr.fromDict(e);const t=sr.fromDict(this.dict.context.obj({}));return this.dict.set(p.of("BS"),t.dict),t}getOnValue(){var e;const t=(e=this.getAppearances())==null?void 0:e.normal;if(t instanceof W){const n=t.keys();for(let r=0,i=n.length;r<i;r++){const o=n[r];if(o!==p.of("Off"))return o}}}};let cr=Ri;b(cr,"fromDict",e=>new Ri(e)),b(cr,"create",(e,t)=>{const n=e.obj({Type:"Annot",Subtype:"Widget",Rect:[0,0,0,0],Parent:t});return new Ri(n)});const Pa=class extends or{FT(){const e=this.getInheritableAttribute(p.of("FT"));return this.dict.context.lookup(e,p)}getWidgets(){const e=this.Kids();if(!e)return[cr.fromDict(this.dict)];const t=new Array(e.size());for(let n=0,r=e.size();n<r;n++){const i=e.lookup(n,W);t[n]=cr.fromDict(i)}return t}addWidget(e){const{Kids:t}=this.normalizedEntries();t.push(e)}removeWidget(e){const t=this.Kids();if(t){if(e<0||e>t.size())throw new Ln(e,0,t.size());t.remove(e)}else{if(e!==0)throw new Ln(e,0,0);this.setKids([])}}normalizedEntries(){let e=this.Kids();return e||(e=this.dict.context.obj([this.ref]),this.dict.set(p.of("Kids"),e)),{Kids:e}}};let jt=Pa;b(jt,"fromDict",(e,t)=>new Pa(e,t));class Ii extends jt{Opt(){return this.dict.lookupMaybe(p.of("Opt"),te,Y,X)}setOpt(t){this.dict.set(p.of("Opt"),this.dict.context.obj(t))}getExportValues(){const t=this.Opt();if(!t)return;if(t instanceof te||t instanceof Y)return[t];const n=[];for(let r=0,i=t.size();r<i;r++){const o=t.lookup(r);(o instanceof te||o instanceof Y)&&n.push(o)}return n}removeExportValue(t){const n=this.Opt();if(!!n)if(n instanceof te||n instanceof Y){if(t!==0)throw new Ln(t,0,0);this.setOpt([])}else{if(t<0||t>n.size())throw new Ln(t,0,n.size());n.remove(t)}}normalizeExportValues(){var t,n,r,i;const o=(t=this.getExportValues())!=null?t:[],s=[],c=this.getWidgets();for(let l=0,a=c.length;l<a;l++){const h=c[l],d=(i=o[l])!=null?i:Y.fromText((r=(n=h.getOnValue())==null?void 0:n.decodeText())!=null?r:"");s.push(d)}this.setOpt(s)}addOpt(t,n){var r;this.normalizeExportValues();const i=t.decodeText();let o;if(n){const c=(r=this.getExportValues())!=null?r:[];for(let l=0,a=c.length;l<a;l++)c[l].decodeText()===i&&(o=l)}const s=this.Opt();return s.push(t),o??s.size()-1}addWidgetWithOpt(t,n,r){const i=this.addOpt(n,r),o=p.of(String(i));return this.addWidget(t),o}}const Oi=class extends Ii{setValue(e){var t;const n=(t=this.getOnValue())!=null?t:p.of("Yes");if(e!==n&&e!==p.of("Off"))throw new Or;this.dict.set(p.of("V"),e);const r=this.getWidgets();for(let i=0,o=r.length;i<o;i++){const s=r[i],c=s.getOnValue()===e?e:p.of("Off");s.setAppearanceState(c)}}getValue(){const e=this.V();return e instanceof p?e:p.of("Off")}getOnValue(){const[e]=this.getWidgets();return e?.getOnValue()}};let Ni=Oi;b(Ni,"fromDict",(e,t)=>new Oi(e,t)),b(Ni,"create",e=>{const t=e.obj({FT:"Btn",Kids:[]}),n=e.register(t);return new Oi(t,n)});const ue=e=>1<<e;var Tf=(e=>(e[e.ReadOnly=ue(0)]="ReadOnly",e[e.Required=ue(1)]="Required",e[e.NoExport=ue(2)]="NoExport",e))(Tf||{}),_n=(e=>(e[e.NoToggleToOff=ue(14)]="NoToggleToOff",e[e.Radio=ue(15)]="Radio",e[e.PushButton=ue(16)]="PushButton",e[e.RadiosInUnison=ue(25)]="RadiosInUnison",e))(_n||{}),Bf=(e=>(e[e.Multiline=ue(12)]="Multiline",e[e.Password=ue(13)]="Password",e[e.FileSelect=ue(20)]="FileSelect",e[e.DoNotSpellCheck=ue(22)]="DoNotSpellCheck",e[e.DoNotScroll=ue(23)]="DoNotScroll",e[e.Comb=ue(24)]="Comb",e[e.RichText=ue(25)]="RichText",e))(Bf||{}),Ut=(e=>(e[e.Combo=ue(17)]="Combo",e[e.Edit=ue(18)]="Edit",e[e.Sort=ue(19)]="Sort",e[e.MultiSelect=ue(21)]="MultiSelect",e[e.DoNotSpellCheck=ue(22)]="DoNotSpellCheck",e[e.CommitOnSelChange=ue(26)]="CommitOnSelChange",e))(Ut||{});class Ra extends jt{setValues(t){if(this.hasFlag(Ut.Combo)&&!this.hasFlag(Ut.Edit)&&!this.valuesAreValid(t))throw new Or;if(t.length===0&&this.dict.delete(p.of("V")),t.length===1&&this.dict.set(p.of("V"),t[0]),t.length>1){if(!this.hasFlag(Ut.MultiSelect))throw new il;this.dict.set(p.of("V"),this.dict.context.obj(t))}this.updateSelectedIndices(t)}valuesAreValid(t){const n=this.getOptions();for(let r=0,i=t.length;r<i;r++){const o=t[r].decodeText();if(!n.find(s=>o===(s.display||s.value).decodeText()))return!1}return!0}updateSelectedIndices(t){if(t.length>1){const n=new Array(t.length),r=this.getOptions();for(let i=0,o=t.length;i<o;i++){const s=t[i].decodeText();n[i]=r.findIndex(c=>s===(c.display||c.value).decodeText())}this.dict.set(p.of("I"),this.dict.context.obj(n.sort()))}else this.dict.delete(p.of("I"))}getValues(){const t=this.V();if(t instanceof te||t instanceof Y)return[t];if(t instanceof X){const n=[];for(let r=0,i=t.size();r<i;r++){const o=t.lookup(r);(o instanceof te||o instanceof Y)&&n.push(o)}return n}return[]}Opt(){return this.dict.lookupMaybe(p.of("Opt"),te,Y,X)}setOptions(t){const n=new Array(t.length);for(let r=0,i=t.length;r<i;r++){const{value:o,display:s}=t[r];n[r]=this.dict.context.obj([o,s||o])}this.dict.set(p.of("Opt"),this.dict.context.obj(n))}getOptions(){const t=this.Opt();if(t instanceof te||t instanceof Y)return[{value:t,display:t}];if(t instanceof X){const n=[];for(let r=0,i=t.size();r<i;r++){const o=t.lookup(r);if((o instanceof te||o instanceof Y)&&n.push({value:o,display:o}),o instanceof X&&o.size()>0){const s=o.lookup(0,te,Y),c=o.lookupMaybe(1,te,Y);n.push({value:s,display:c||s})}}return n}return[]}}const Fi=class extends Ra{};let zi=Fi;b(zi,"fromDict",(e,t)=>new Fi(e,t)),b(zi,"create",e=>{const t=e.obj({FT:"Ch",Ff:Ut.Combo,Kids:[]}),n=e.register(t);return new Fi(t,n)});const Mi=class extends or{addField(e){const{Kids:t}=this.normalizedEntries();t?.push(e)}normalizedEntries(){let e=this.Kids();return e||(e=this.dict.context.obj([]),this.dict.set(p.of("Kids"),e)),{Kids:e}}};let lr=Mi;b(lr,"fromDict",(e,t)=>new Mi(e,t)),b(lr,"create",e=>{const t=e.obj({}),n=e.register(t);return new Mi(t,n)});const Ia=class extends jt{};let Oa=Ia;b(Oa,"fromDict",(e,t)=>new Ia(e,t));const Li=class extends jt{MaxLen(){const e=this.dict.lookup(p.of("MaxLen"));if(e instanceof H)return e}Q(){const e=this.dict.lookup(p.of("Q"));if(e instanceof H)return e}setMaxLength(e){this.dict.set(p.of("MaxLen"),H.of(e))}removeMaxLength(){this.dict.delete(p.of("MaxLen"))}getMaxLength(){var e;return(e=this.MaxLen())==null?void 0:e.asNumber()}setQuadding(e){this.dict.set(p.of("Q"),H.of(e))}getQuadding(){var e;return(e=this.Q())==null?void 0:e.asNumber()}setValue(e){this.dict.set(p.of("V"),e)}removeValue(){this.dict.delete(p.of("V"))}getValue(){const e=this.V();if(e instanceof te||e instanceof Y)return e}};let ji=Li;b(ji,"fromDict",(e,t)=>new Li(e,t)),b(ji,"create",e=>{const t=e.obj({FT:"Tx",Kids:[]}),n=e.register(t);return new Li(t,n)});const Ui=class extends Ii{};let $i=Ui;b($i,"fromDict",(e,t)=>new Ui(e,t)),b($i,"create",e=>{const t=e.obj({FT:"Btn",Ff:_n.PushButton,Kids:[]}),n=e.register(t);return new Ui(t,n)});const Hi=class extends Ii{setValue(e){if(!this.getOnValues().includes(e)&&e!==p.of("Off"))throw new Or;this.dict.set(p.of("V"),e);const n=this.getWidgets();for(let r=0,i=n.length;r<i;r++){const o=n[r],s=o.getOnValue()===e?e:p.of("Off");o.setAppearanceState(s)}}getValue(){const e=this.V();return e instanceof p?e:p.of("Off")}getOnValues(){const e=this.getWidgets(),t=[];for(let n=0,r=e.length;n<r;n++){const i=e[n].getOnValue();i&&t.push(i)}return t}};let Gi=Hi;b(Gi,"fromDict",(e,t)=>new Hi(e,t)),b(Gi,"create",e=>{const t=e.obj({FT:"Btn",Ff:_n.Radio,Kids:[]}),n=e.register(t);return new Hi(t,n)});const Vi=class extends Ra{};let Wi=Vi;b(Wi,"fromDict",(e,t)=>new Vi(e,t)),b(Wi,"create",e=>{const t=e.obj({FT:"Ch",Kids:[]}),n=e.register(t);return new Vi(t,n)});const Df=e=>{if(!e)return[];const t=[];for(let n=0,r=e.size();n<r;n++){const i=e.get(n),o=e.lookup(n);i instanceof se&&o instanceof W&&t.push([Na(o,i),i])}return t},Na=(e,t)=>Ef(e)?lr.fromDict(e,t):Pf(e,t),Ef=e=>{const t=e.lookup(p.of("Kids"));if(t instanceof X)for(let n=0,r=t.size();n<r;n++){const i=t.lookup(n);if(i instanceof W&&i.has(p.of("T")))return!0}return!1},Pf=(e,t)=>{const n=Zi(e,p.of("FT")),r=e.context.lookup(n,p);return r===p.of("Btn")?Rf(e,t):r===p.of("Ch")?If(e,t):r===p.of("Tx")?ji.fromDict(e,t):r===p.of("Sig")?Oa.fromDict(e,t):jt.fromDict(e,t)},Rf=(e,t)=>{var n;const r=Zi(e,p.of("Ff")),i=e.context.lookupMaybe(r,H),o=(n=i?.asNumber())!=null?n:0;return Ki(o,_n.PushButton)?$i.fromDict(e,t):Ki(o,_n.Radio)?Gi.fromDict(e,t):Ni.fromDict(e,t)},If=(e,t)=>{var n;const r=Zi(e,p.of("Ff")),i=e.context.lookupMaybe(r,H),o=(n=i?.asNumber())!=null?n:0;return Ki(o,Ut.Combo)?zi.fromDict(e,t):Wi.fromDict(e,t)},Ki=(e,t)=>(e&t)!==0,Zi=(e,t)=>{let n;return Fa(e,r=>{n||(n=r.get(t))}),n},Fa=(e,t)=>{t(e);const n=e.lookupMaybe(p.of("Parent"),W);n&&Fa(n,t)},qi=class{constructor(e){b(this,"dict"),this.dict=e}Fields(){const e=this.dict.lookup(p.of("Fields"));if(e instanceof X)return e}getFields(){const{Fields:e}=this.normalizedEntries(),t=new Array(e.size());for(let n=0,r=e.size();n<r;n++){const i=e.get(n),o=e.lookup(n,W);t[n]=[Na(o,i),i]}return t}getAllFields(){const e=[],t=n=>{if(!!n)for(let r=0,i=n.length;r<i;r++){const o=n[r];e.push(o);const[s]=o;s instanceof lr&&t(Df(s.Kids()))}};return t(this.getFields()),e}addField(e){const{Fields:t}=this.normalizedEntries();t?.push(e)}removeField(e){const t=e.getParent(),n=t===void 0?this.normalizedEntries().Fields:t.Kids(),r=n?.indexOf(e.ref);if(n===void 0||r===void 0)throw new Error(`Tried to remove inexistent field ${e.getFullyQualifiedName()}`);n.remove(r),t!==void 0&&n.size()===0&&this.removeField(t)}normalizedEntries(){let e=this.Fields();return e||(e=this.dict.context.obj([]),this.dict.set(p.of("Fields"),e)),{Fields:e}}};let hr=qi;b(hr,"fromDict",e=>new qi(e)),b(hr,"create",e=>{const t=e.obj({Fields:[]});return new qi(t)});const dr=(e,t)=>{if(e!==void 0)return t[e]};var Xi=(e=>(e.UseNone="UseNone",e.UseOutlines="UseOutlines",e.UseThumbs="UseThumbs",e.UseOC="UseOC",e))(Xi||{}),Yi=(e=>(e.L2R="L2R",e.R2L="R2L",e))(Yi||{}),Ji=(e=>(e.None="None",e.AppDefault="AppDefault",e))(Ji||{}),Qi=(e=>(e.Simplex="Simplex",e.DuplexFlipShortEdge="DuplexFlipShortEdge",e.DuplexFlipLongEdge="DuplexFlipLongEdge",e))(Qi||{});const eo=class{constructor(e){b(this,"dict"),this.dict=e}lookupBool(e){const t=this.dict.lookup(p.of(e));if(t instanceof xt)return t}lookupName(e){const t=this.dict.lookup(p.of(e));if(t instanceof p)return t}HideToolbar(){return this.lookupBool("HideToolbar")}HideMenubar(){return this.lookupBool("HideMenubar")}HideWindowUI(){return this.lookupBool("HideWindowUI")}FitWindow(){return this.lookupBool("FitWindow")}CenterWindow(){return this.lookupBool("CenterWindow")}DisplayDocTitle(){return this.lookupBool("DisplayDocTitle")}NonFullScreenPageMode(){return this.lookupName("NonFullScreenPageMode")}Direction(){return this.lookupName("Direction")}PrintScaling(){return this.lookupName("PrintScaling")}Duplex(){return this.lookupName("Duplex")}PickTrayByPDFSize(){return this.lookupBool("PickTrayByPDFSize")}PrintPageRange(){const e=this.dict.lookup(p.of("PrintPageRange"));if(e instanceof X)return e}NumCopies(){const e=this.dict.lookup(p.of("NumCopies"));if(e instanceof H)return e}getHideToolbar(){var e,t;return(t=(e=this.HideToolbar())==null?void 0:e.asBoolean())!=null?t:!1}getHideMenubar(){var e,t;return(t=(e=this.HideMenubar())==null?void 0:e.asBoolean())!=null?t:!1}getHideWindowUI(){var e,t;return(t=(e=this.HideWindowUI())==null?void 0:e.asBoolean())!=null?t:!1}getFitWindow(){var e,t;return(t=(e=this.FitWindow())==null?void 0:e.asBoolean())!=null?t:!1}getCenterWindow(){var e,t;return(t=(e=this.CenterWindow())==null?void 0:e.asBoolean())!=null?t:!1}getDisplayDocTitle(){var e,t;return(t=(e=this.DisplayDocTitle())==null?void 0:e.asBoolean())!=null?t:!1}getNonFullScreenPageMode(){var e,t;const n=(e=this.NonFullScreenPageMode())==null?void 0:e.decodeText();return(t=dr(n,Xi))!=null?t:"UseNone"}getReadingDirection(){var e,t;const n=(e=this.Direction())==null?void 0:e.decodeText();return(t=dr(n,Yi))!=null?t:"L2R"}getPrintScaling(){var e,t;const n=(e=this.PrintScaling())==null?void 0:e.decodeText();return(t=dr(n,Ji))!=null?t:"AppDefault"}getDuplex(){var e;const t=(e=this.Duplex())==null?void 0:e.decodeText();return dr(t,Qi)}getPickTrayByPDFSize(){var e;return(e=this.PickTrayByPDFSize())==null?void 0:e.asBoolean()}getPrintPageRange(){const e=this.PrintPageRange();if(!e)return[];const t=[];for(let n=0;n<e.size();n+=2){const r=e.lookup(n,H).asNumber(),i=e.lookup(n+1,H).asNumber();t.push({start:r,end:i})}return t}getNumCopies(){var e,t;return(t=(e=this.NumCopies())==null?void 0:e.asNumber())!=null?t:1}setHideToolbar(e){const t=this.dict.context.obj(e);this.dict.set(p.of("HideToolbar"),t)}setHideMenubar(e){const t=this.dict.context.obj(e);this.dict.set(p.of("HideMenubar"),t)}setHideWindowUI(e){const t=this.dict.context.obj(e);this.dict.set(p.of("HideWindowUI"),t)}setFitWindow(e){const t=this.dict.context.obj(e);this.dict.set(p.of("FitWindow"),t)}setCenterWindow(e){const t=this.dict.context.obj(e);this.dict.set(p.of("CenterWindow"),t)}setDisplayDocTitle(e){const t=this.dict.context.obj(e);this.dict.set(p.of("DisplayDocTitle"),t)}setNonFullScreenPageMode(e){Jt(e,"nonFullScreenPageMode",Xi);const t=p.of(e);this.dict.set(p.of("NonFullScreenPageMode"),t)}setReadingDirection(e){Jt(e,"readingDirection",Yi);const t=p.of(e);this.dict.set(p.of("Direction"),t)}setPrintScaling(e){Jt(e,"printScaling",Ji);const t=p.of(e);this.dict.set(p.of("PrintScaling"),t)}setDuplex(e){Jt(e,"duplex",Qi);const t=p.of(e);this.dict.set(p.of("Duplex"),t)}setPickTrayByPDFSize(e){const t=this.dict.context.obj(e);this.dict.set(p.of("PickTrayByPDFSize"),t)}setPrintPageRange(e){Array.isArray(e)||(e=[e]);const t=[];for(let r=0,i=e.length;r<i;r++)t.push(e[r].start),t.push(e[r].end);Io(t,"printPageRange",["number"]);const n=this.dict.context.obj(t);this.dict.set(p.of("PrintPageRange"),n)}setNumCopies(e){rt(e,"numCopies",1,Number.MAX_VALUE),Qc(e,"numCopies");const t=this.dict.context.obj(e);this.dict.set(p.of("NumCopies"),t)}};let fr=eo;b(fr,"fromDict",e=>new eo(e)),b(fr,"create",e=>{const t=e.obj({});return new eo(t)});const to=class extends W{Pages(){return this.lookup(p.of("Pages"),W)}AcroForm(){return this.lookupMaybe(p.of("AcroForm"),W)}getAcroForm(){const e=this.AcroForm();if(!!e)return hr.fromDict(e)}getOrCreateAcroForm(){let e=this.getAcroForm();if(!e){e=hr.create(this.context);const t=this.context.register(e.dict);this.set(p.of("AcroForm"),t)}return e}ViewerPreferences(){return this.lookupMaybe(p.of("ViewerPreferences"),W)}getViewerPreferences(){const e=this.ViewerPreferences();if(!!e)return fr.fromDict(e)}getOrCreateViewerPreferences(){let e=this.getViewerPreferences();if(!e){e=fr.create(this.context);const t=this.context.register(e.dict);this.set(p.of("ViewerPreferences"),t)}return e}insertLeafNode(e,t){const n=this.get(p.of("Pages"));return this.Pages().insertLeafNode(e,t)||n}removeLeafNode(e){this.Pages().removeLeafNode(e)}};let no=to;b(no,"withContextAndPages",(e,t)=>{const n=new Map;return n.set(p.of("Type"),p.of("Catalog")),n.set(p.of("Pages"),t),new to(n,e)}),b(no,"fromMapWithContext",(e,t)=>new to(e,t));const ur=class extends W{constructor(e,t,n=!0){super(e,t),b(this,"normalized",!1),b(this,"autoNormalizeCTM"),this.autoNormalizeCTM=n}clone(e){const t=ur.fromMapWithContext(new Map,e||this.context,this.autoNormalizeCTM),n=this.entries();for(let r=0,i=n.length;r<i;r++){const[o,s]=n[r];t.set(o,s)}return t}Parent(){return this.lookupMaybe(p.Parent,W)}Contents(){return this.lookup(p.of("Contents"))}Annots(){return this.lookupMaybe(p.Annots,X)}BleedBox(){return this.lookupMaybe(p.BleedBox,X)}TrimBox(){return this.lookupMaybe(p.TrimBox,X)}ArtBox(){return this.lookupMaybe(p.ArtBox,X)}Resources(){const e=this.getInheritableAttribute(p.Resources);return this.context.lookupMaybe(e,W)}MediaBox(){const e=this.getInheritableAttribute(p.MediaBox);return this.context.lookup(e,X)}CropBox(){const e=this.getInheritableAttribute(p.CropBox);return this.context.lookupMaybe(e,X)}Rotate(){const e=this.getInheritableAttribute(p.Rotate);return this.context.lookupMaybe(e,H)}getInheritableAttribute(e){let t;return this.ascend(n=>{t||(t=n.get(e))}),t}setParent(e){this.set(p.Parent,e)}addContentStream(e){const t=this.normalizedEntries().Contents||this.context.obj([]);this.set(p.Contents,t),t.push(e)}wrapContentStreams(e,t){const n=this.Contents();return n instanceof X?(n.insert(0,e),n.push(t),!0):!1}addAnnot(e){const{Annots:t}=this.normalizedEntries();t.push(e)}removeAnnot(e){const{Annots:t}=this.normalizedEntries(),n=t.indexOf(e);n!==void 0&&t.remove(n)}setFontDictionary(e,t){const{Font:n}=this.normalizedEntries();n.set(e,t)}newFontDictionaryKey(e){const{Font:t}=this.normalizedEntries();return t.uniqueKey(e)}newFontDictionary(e,t){const n=this.newFontDictionaryKey(e);return this.setFontDictionary(n,t),n}setXObject(e,t){const{XObject:n}=this.normalizedEntries();n.set(e,t)}newXObjectKey(e){const{XObject:t}=this.normalizedEntries();return t.uniqueKey(e)}newXObject(e,t){const n=this.newXObjectKey(e);return this.setXObject(n,t),n}setExtGState(e,t){const{ExtGState:n}=this.normalizedEntries();n.set(e,t)}newExtGStateKey(e){const{ExtGState:t}=this.normalizedEntries();return t.uniqueKey(e)}newExtGState(e,t){const n=this.newExtGStateKey(e);return this.setExtGState(n,t),n}ascend(e){e(this);const t=this.Parent();t&&t.ascend(e)}normalize(){if(this.normalized)return;const{context:e}=this,t=this.get(p.Contents);this.context.lookup(t)instanceof ht&&this.set(p.Contents,e.obj([t])),this.autoNormalizeCTM&&this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(),this.context.getPopGraphicsStateContentStream());const r=this.getInheritableAttribute(p.Resources),i=e.lookupMaybe(r,W)||e.obj({});this.set(p.Resources,i);const o=i.lookupMaybe(p.Font,W)||e.obj({});i.set(p.Font,o);const s=i.lookupMaybe(p.XObject,W)||e.obj({});i.set(p.XObject,s);const c=i.lookupMaybe(p.ExtGState,W)||e.obj({});i.set(p.ExtGState,c);const l=this.Annots()||e.obj([]);this.set(p.Annots,l),this.normalized=!0}normalizedEntries(){this.normalize();const e=this.Annots(),t=this.Resources(),n=this.Contents();return{Annots:e,Resources:t,Contents:n,Font:t.lookup(p.Font,W),XObject:t.lookup(p.XObject,W),ExtGState:t.lookup(p.ExtGState,W)}}};let We=ur;b(We,"InheritableEntries",["Resources","MediaBox","CropBox","Rotate"]),b(We,"withContextAndParent",(e,t)=>{const n=new Map;return n.set(p.Type,p.Page),n.set(p.Parent,t),n.set(p.Resources,e.obj({})),n.set(p.MediaBox,e.obj([0,0,612,792])),new ur(n,e,!1)}),b(We,"fromMapWithContext",(e,t,n=!0)=>new ur(e,t,n));const ro=class{constructor(e){b(this,"bytes"),b(this,"length"),b(this,"idx",0),b(this,"line",0),b(this,"column",0),this.bytes=e,this.length=this.bytes.length}moveTo(e){this.idx=e}next(){const e=this.bytes[this.idx++];return e===m.Newline?(this.line+=1,this.column=0):this.column+=1,e}assertNext(e){if(this.peek()!==e)throw new al(this.position(),e,this.peek());return this.next()}peek(){return this.bytes[this.idx]}peekAhead(e){return this.bytes[this.idx+e]}peekAt(e){return this.bytes[e]}done(){return this.idx>=this.length}offset(){return this.idx}slice(e,t){return this.bytes.slice(e,t)}position(){return{line:this.line,column:this.column,offset:this.idx}}};let $t=ro;b($t,"of",e=>new ro(e)),b($t,"fromPDFRawStream",e=>ro.of(xa(e).decode()));const _e=new Uint8Array(256);_e[m.Zero]=1,_e[m.One]=1,_e[m.Two]=1,_e[m.Three]=1,_e[m.Four]=1,_e[m.Five]=1,_e[m.Six]=1,_e[m.Seven]=1,_e[m.Eight]=1,_e[m.Nine]=1;const gr=new Uint8Array(256);gr[m.Period]=1,gr[m.Plus]=1,gr[m.Minus]=1;const io=new Uint8Array(256);for(let e=0,t=256;e<t;e++)io[e]=_e[e]||gr[e]?1:0;const{Newline:za,CarriageReturn:Ma}=m;class Of{constructor(t,n=!1){b(this,"bytes"),b(this,"capNumbers"),this.bytes=t,this.capNumbers=n}parseRawInt(){let t="";for(;!this.bytes.done();){const r=this.bytes.peek();if(!_e[r])break;t+=qe(this.bytes.next())}const n=Number(t);if(!t||!isFinite(n))throw new zo(this.bytes.position(),t);return n}parseRawNumber(){let t="";for(;!this.bytes.done();){const r=this.bytes.peek();if(!io[r]||(t+=qe(this.bytes.next()),r===m.Period))break}for(;!this.bytes.done();){const r=this.bytes.peek();if(!_e[r])break;t+=qe(this.bytes.next())}const n=Number(t);if(!t||!isFinite(n))throw new zo(this.bytes.position(),t);if(n>Number.MAX_SAFE_INTEGER)if(this.capNumbers){const r=`Parsed number that is too large for some PDF readers: ${t}, using Number.MAX_SAFE_INTEGER instead.`;return console.warn(r),Number.MAX_SAFE_INTEGER}else{const r=`Parsed number that is too large for some PDF readers: ${t}, not capping.`;console.warn(r)}return n}skipWhitespace(){for(;!this.bytes.done()&&Ye[this.bytes.peek()];)this.bytes.next()}skipLine(){for(;!this.bytes.done();){const t=this.bytes.peek();if(t===za||t===Ma)return;this.bytes.next()}}skipComment(){if(this.bytes.peek()!==m.Percent)return!1;for(;!this.bytes.done();){const t=this.bytes.peek();if(t===za||t===Ma)return!0;this.bytes.next()}return!0}skipWhitespaceAndComments(){for(this.skipWhitespace();this.skipComment();)this.skipWhitespace()}matchKeyword(t){const n=this.bytes.offset();for(let r=0,i=t.length;r<i;r++)if(this.bytes.done()||this.bytes.next()!==t[r])return this.bytes.moveTo(n),!1;return!0}}const Ht=class extends W{Parent(){return this.lookup(p.of("Parent"))}Kids(){return this.lookup(p.of("Kids"),X)}Count(){return this.lookup(p.of("Count"),H)}pushTreeNode(e){this.Kids().push(e)}pushLeafNode(e){const t=this.Kids();this.insertLeafKid(t.size(),e)}insertLeafNode(e,t){const n=this.Kids(),r=this.Count().asNumber();if(t>r)throw new No(t,r);let i=t;for(let o=0,s=n.size();o<s;o++){if(i===0){this.insertLeafKid(o,e);return}const c=n.get(o),l=this.context.lookup(c);if(l instanceof Ht){if(l.Count().asNumber()>i)return l.insertLeafNode(e,i)||c;i-=l.Count().asNumber()}l instanceof We&&(i-=1)}if(i===0){this.insertLeafKid(n.size(),e);return}throw new Fo(t,"insertLeafNode")}removeLeafNode(e,t=!0){const n=this.Kids(),r=this.Count().asNumber();if(e>=r)throw new No(e,r);let i=e;for(let o=0,s=n.size();o<s;o++){const c=n.get(o),l=this.context.lookup(c);if(l instanceof Ht)if(l.Count().asNumber()>i){l.removeLeafNode(i,t),t&&l.Kids().size()===0&&n.remove(o);return}else i-=l.Count().asNumber();if(l instanceof We)if(i===0){this.removeKid(o);return}else i-=1}throw new Fo(e,"removeLeafNode")}ascend(e){e(this);const t=this.Parent();t&&t.ascend(e)}traverse(e){const t=this.Kids();for(let n=0,r=t.size();n<r;n++){const i=t.get(n),o=this.context.lookup(i);o instanceof Ht&&o.traverse(e),e(o,i)}}insertLeafKid(e,t){const n=this.Kids();this.ascend(r=>{const i=r.Count().asNumber()+1;r.set(p.of("Count"),H.of(i))}),n.insert(e,t)}removeKid(e){const t=this.Kids();t.lookup(e)instanceof We&&this.ascend(r=>{const i=r.Count().asNumber()-1;r.set(p.of("Count"),H.of(i))}),t.remove(e)}};let oo=Ht;b(oo,"withContext",(e,t)=>{const n=new Map;return n.set(p.of("Type"),p.of("Pages")),n.set(p.of("Kids"),e.obj([])),n.set(p.of("Count"),e.obj(0)),t&&n.set(p.of("Parent"),t),new Ht(n,e)}),b(oo,"fromMapWithContext",(e,t)=>new Ht(e,t));const{Space:Nf,CarriageReturn:xn,Newline:Sn}=m,vn=[m.s,m.t,m.r,m.e,m.a,m.m],pr=[m.e,m.n,m.d,m.s,m.t,m.r,m.e,m.a,m.m],ne={header:[m.Percent,m.P,m.D,m.F,m.Dash],eof:[m.Percent,m.Percent,m.E,m.O,m.F],obj:[m.o,m.b,m.j],endobj:[m.e,m.n,m.d,m.o,m.b,m.j],xref:[m.x,m.r,m.e,m.f],trailer:[m.t,m.r,m.a,m.i,m.l,m.e,m.r],startxref:[m.s,m.t,m.a,m.r,m.t,m.x,m.r,m.e,m.f],true:[m.t,m.r,m.u,m.e],false:[m.f,m.a,m.l,m.s,m.e],null:[m.n,m.u,m.l,m.l],stream:vn,streamEOF1:[...vn,Nf,xn,Sn],streamEOF2:[...vn,xn,Sn],streamEOF3:[...vn,xn],streamEOF4:[...vn,Sn],endstream:pr,EOF1endstream:[xn,Sn,...pr],EOF2endstream:[xn,...pr],EOF3endstream:[Sn,...pr]},so=class extends Of{constructor(e,t,n=!1){super(e,n),b(this,"context"),this.context=t}parseObject(){if(this.skipWhitespaceAndComments(),this.matchKeyword(ne.true))return xt.True;if(this.matchKeyword(ne.false))return xt.False;if(this.matchKeyword(ne.null))return ke;const e=this.bytes.peek();if(e===m.LessThan&&this.bytes.peekAhead(1)===m.LessThan)return this.parseDictOrStream();if(e===m.LessThan)return this.parseHexString();if(e===m.LeftParen)return this.parseString();if(e===m.ForwardSlash)return this.parseName();if(e===m.LeftSquareBracket)return this.parseArray();if(io[e])return this.parseNumberOrRef();throw new cl(this.bytes.position(),e)}parseNumberOrRef(){const e=this.parseRawNumber();this.skipWhitespaceAndComments();const t=this.bytes.offset();if(_e[this.bytes.peek()]){const n=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===m.R)return this.bytes.assertNext(m.R),se.of(e,n)}return this.bytes.moveTo(t),H.of(e)}parseHexString(){let e="";for(this.bytes.assertNext(m.LessThan);!this.bytes.done()&&this.bytes.peek()!==m.GreaterThan;)e+=qe(this.bytes.next());return this.bytes.assertNext(m.GreaterThan),Y.of(e)}parseString(){let e=0,t=!1,n="";for(;!this.bytes.done();){const r=this.bytes.next();if(n+=qe(r),t||(r===m.LeftParen&&(e+=1),r===m.RightParen&&(e-=1)),r===m.BackSlash?t=!t:t&&(t=!1),e===0)return te.of(n.substring(1,n.length-1))}throw new dl(this.bytes.position())}parseName(){this.bytes.assertNext(m.ForwardSlash);let e="";for(;!this.bytes.done();){const t=this.bytes.peek();if(Ye[t]||Pe[t])break;e+=qe(t),this.bytes.next()}return p.of(e)}parseArray(){this.bytes.assertNext(m.LeftSquareBracket),this.skipWhitespaceAndComments();const e=X.withContext(this.context);for(;this.bytes.peek()!==m.RightSquareBracket;){const t=this.parseObject();e.push(t),this.skipWhitespaceAndComments()}return this.bytes.assertNext(m.RightSquareBracket),e}parseDict(){this.bytes.assertNext(m.LessThan),this.bytes.assertNext(m.LessThan),this.skipWhitespaceAndComments();const e=new Map;for(;!this.bytes.done()&&this.bytes.peek()!==m.GreaterThan&&this.bytes.peekAhead(1)!==m.GreaterThan;){const n=this.parseName(),r=this.parseObject();e.set(n,r),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(m.GreaterThan),this.bytes.assertNext(m.GreaterThan);const t=e.get(p.of("Type"));return t===p.of("Catalog")?no.fromMapWithContext(e,this.context):t===p.of("Pages")?oo.fromMapWithContext(e,this.context):t===p.of("Page")?We.fromMapWithContext(e,this.context):W.fromMapWithContext(e,this.context)}parseDictOrStream(){const e=this.bytes.position(),t=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(ne.streamEOF1)&&!this.matchKeyword(ne.streamEOF2)&&!this.matchKeyword(ne.streamEOF3)&&!this.matchKeyword(ne.streamEOF4)&&!this.matchKeyword(ne.stream))return t;const n=this.bytes.offset();let r;const i=t.get(p.of("Length"));i instanceof H?(r=n+i.asNumber(),this.bytes.moveTo(r),this.skipWhitespaceAndComments(),this.matchKeyword(ne.endstream)||(this.bytes.moveTo(n),r=this.findEndOfStreamFallback(e))):r=this.findEndOfStreamFallback(e);const o=this.bytes.slice(n,r);return zt.of(t,o)}findEndOfStreamFallback(e){let t=1,n=this.bytes.offset();for(;!this.bytes.done()&&(n=this.bytes.offset(),this.matchKeyword(ne.stream)?t+=1:this.matchKeyword(ne.EOF1endstream)||this.matchKeyword(ne.EOF2endstream)||this.matchKeyword(ne.EOF3endstream)||this.matchKeyword(ne.endstream)?t-=1:this.bytes.next(),t!==0););if(t!==0)throw new hl(e);return n}};let br=so;b(br,"forBytes",(e,t,n)=>new so($t.of(e),t,n)),b(br,"forByteStream",(e,t,n=!1)=>new so(e,t,n));const La=class extends br{constructor(e,t){super($t.fromPDFRawStream(e),e.dict.context),b(this,"alreadyParsed"),b(this,"shouldWaitForTick"),b(this,"firstOffset"),b(this,"objectCount");const{dict:n}=e;this.alreadyParsed=!1,this.shouldWaitForTick=t||(()=>!1),this.firstOffset=n.lookup(p.of("First"),H).asNumber(),this.objectCount=n.lookup(p.of("N"),H).asNumber()}async parseIntoContext(){if(this.alreadyParsed)throw new Ir("PDFObjectStreamParser","parseIntoContext");this.alreadyParsed=!0;const e=this.parseOffsetsAndObjectNumbers();for(let t=0,n=e.length;t<n;t++){const{objectNumber:r,offset:i}=e[t];this.bytes.moveTo(this.firstOffset+i);const o=this.parseObject(),s=se.of(r,0);this.context.assign(s,o),this.shouldWaitForTick()&&await Ct()}}parseOffsetsAndObjectNumbers(){const e=[];for(let t=0,n=this.objectCount;t<n;t++){this.skipWhitespaceAndComments();const r=this.parseRawInt();this.skipWhitespaceAndComments();const i=this.parseRawInt();e.push({objectNumber:r,offset:i})}return e}};let ja=La;b(ja,"forStream",(e,t)=>new La(e,t));const Ua=class{constructor(e){b(this,"alreadyParsed"),b(this,"dict"),b(this,"context"),b(this,"bytes"),b(this,"subsections"),b(this,"byteWidths"),this.alreadyParsed=!1,this.dict=e.dict,this.bytes=$t.fromPDFRawStream(e),this.context=this.dict.context;const t=this.dict.lookup(p.of("Size"),H),n=this.dict.lookup(p.of("Index"));if(n instanceof X){this.subsections=[];for(let i=0,o=n.size();i<o;i+=2){const s=n.lookup(i+0,H).asNumber(),c=n.lookup(i+1,H).asNumber();this.subsections.push({firstObjectNumber:s,length:c})}}else this.subsections=[{firstObjectNumber:0,length:t.asNumber()}];const r=this.dict.lookup(p.of("W"),X);this.byteWidths=[-1,-1,-1];for(let i=0,o=r.size();i<o;i++)this.byteWidths[i]=r.lookup(i,H).asNumber()}parseIntoContext(){if(this.alreadyParsed)throw new Ir("PDFXRefStreamParser","parseIntoContext");return this.alreadyParsed=!0,this.context.trailerInfo={Root:this.dict.get(p.of("Root")),Encrypt:this.dict.get(p.of("Encrypt")),Info:this.dict.get(p.of("Info")),ID:this.dict.get(p.of("ID"))},this.parseEntries()}parseEntries(){const e=[],[t,n,r]=this.byteWidths;for(let i=0,o=this.subsections.length;i<o;i++){const{firstObjectNumber:s,length:c}=this.subsections[i];for(let l=0;l<c;l++){let a=0;for(let y=0,_=t;y<_;y++)a=a<<8|this.bytes.next();let h=0;for(let y=0,_=n;y<_;y++)h=h<<8|this.bytes.next();let d=0;for(let y=0,_=r;y<_;y++)d=d<<8|this.bytes.next();t===0&&(a=1);const u=s+l,f={ref:se.of(u,d),offset:h,deleted:a===0,inObjectStream:a===2};e.push(f)}}return e}};let $a=Ua;b($a,"forStream",e=>new Ua(e));const Ha=class extends br{constructor(e,t=1/0,n=!1,r=!1){super($t.of(e),xi.create(),r),b(this,"objectsPerTick"),b(this,"throwOnInvalidObject"),b(this,"alreadyParsed",!1),b(this,"parsedObjects",0),b(this,"shouldWaitForTick",()=>(this.parsedObjects+=1,this.parsedObjects%this.objectsPerTick===0)),this.objectsPerTick=t,this.throwOnInvalidObject=n}async parseDocument(){if(this.alreadyParsed)throw new Ir("PDFParser","parseDocument");this.alreadyParsed=!0,this.context.header=this.parseHeader();let e;for(;!this.bytes.done();){await this.parseDocumentSection();const t=this.bytes.offset();if(t===e)throw new fl(this.bytes.position());e=t}return this.maybeRecoverRoot(),this.context.lookup(se.of(0))&&(console.warn("Removing parsed object: 0 0 R"),this.context.delete(se.of(0))),this.context}maybeRecoverRoot(){const e=n=>n instanceof W&&n.lookup(p.of("Type"))===p.of("Catalog"),t=this.context.lookup(this.context.trailerInfo.Root);if(!e(t)){const n=this.context.enumerateIndirectObjects();for(let r=0,i=n.length;r<i;r++){const[o,s]=n[r];e(s)&&(this.context.trailerInfo.Root=o)}}}parseHeader(){for(;!this.bytes.done();){if(this.matchKeyword(ne.header)){const e=this.parseRawInt();this.bytes.assertNext(m.Period);const t=this.parseRawInt(),n=yn.forVersion(e,t);return this.skipBinaryHeaderComment(),n}this.bytes.next()}throw new ul(this.bytes.position())}parseIndirectObjectHeader(){this.skipWhitespaceAndComments();const e=this.parseRawInt();this.skipWhitespaceAndComments();const t=this.parseRawInt();if(this.skipWhitespaceAndComments(),!this.matchKeyword(ne.obj))throw new gl(this.bytes.position(),ne.obj);return se.of(e,t)}matchIndirectObjectHeader(){const e=this.bytes.offset();try{return this.parseIndirectObjectHeader(),!0}catch{return this.bytes.moveTo(e),!1}}async parseIndirectObject(){const e=this.parseIndirectObjectHeader();this.skipWhitespaceAndComments();const t=this.parseObject();return this.skipWhitespaceAndComments(),this.matchKeyword(ne.endobj),t instanceof zt&&t.dict.lookup(p.of("Type"))===p.of("ObjStm")?await ja.forStream(t,this.shouldWaitForTick).parseIntoContext():t instanceof zt&&t.dict.lookup(p.of("Type"))===p.of("XRef")?$a.forStream(t).parseIntoContext():this.context.assign(e,t),e}tryToParseInvalidIndirectObject(){const e=this.bytes.position(),t=`Trying to parse invalid object: ${JSON.stringify(e)})`;if(this.throwOnInvalidObject)throw new Error(t);console.warn(t);const n=this.parseIndirectObjectHeader();console.warn(`Invalid object ref: ${n}`),this.skipWhitespaceAndComments();const r=this.bytes.offset();let i=!0;for(;!this.bytes.done()&&(this.matchKeyword(ne.endobj)&&(i=!1),!!i);)this.bytes.next();if(i)throw new ll(e);const o=this.bytes.offset()-ne.endobj.length,s=Bi.of(this.bytes.slice(r,o));return this.context.assign(n,s),n}async parseIndirectObjects(){for(this.skipWhitespaceAndComments();!this.bytes.done()&&_e[this.bytes.peek()];){const e=this.bytes.offset();try{await this.parseIndirectObject()}catch{this.bytes.moveTo(e),this.tryToParseInvalidIndirectObject()}this.skipWhitespaceAndComments(),this.skipJibberish(),this.shouldWaitForTick()&&await Ct()}}maybeParseCrossRefSection(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(ne.xref))return;this.skipWhitespaceAndComments();let e=-1;const t=er.createEmpty();for(;!this.bytes.done()&&_e[this.bytes.peek()];){const n=this.parseRawInt();this.skipWhitespaceAndComments();const r=this.parseRawInt();this.skipWhitespaceAndComments();const i=this.bytes.peek();if(i===m.n||i===m.f){const o=se.of(e,r);this.bytes.next()===m.n?t.addEntry(o,n):t.addDeletedEntry(o,n),e+=1}else e=n;this.skipWhitespaceAndComments()}return t}maybeParseTrailerDict(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(ne.trailer))return;this.skipWhitespaceAndComments();const e=this.parseDict(),{context:t}=this;t.trailerInfo={Root:e.get(p.of("Root"))||t.trailerInfo.Root,Encrypt:e.get(p.of("Encrypt"))||t.trailerInfo.Encrypt,Info:e.get(p.of("Info"))||t.trailerInfo.Info,ID:e.get(p.of("ID"))||t.trailerInfo.ID}}maybeParseTrailer(){if(this.skipWhitespaceAndComments(),!this.matchKeyword(ne.startxref))return;this.skipWhitespaceAndComments();const e=this.parseRawInt();return this.skipWhitespace(),this.matchKeyword(ne.eof),this.skipWhitespaceAndComments(),this.matchKeyword(ne.eof),this.skipWhitespaceAndComments(),tr.forLastCrossRefSectionOffset(e)}async parseDocumentSection(){await this.parseIndirectObjects(),this.maybeParseCrossRefSection(),this.maybeParseTrailerDict(),this.maybeParseTrailer(),this.skipJibberish()}skipJibberish(){for(this.skipWhitespaceAndComments();!this.bytes.done();){const e=this.bytes.offset(),t=this.bytes.peek();if(t>=m.Space&&t<=m.Tilde&&(this.matchKeyword(ne.xref)||this.matchKeyword(ne.trailer)||this.matchKeyword(ne.startxref)||this.matchIndirectObjectHeader())){this.bytes.moveTo(e);break}this.bytes.next()}}skipBinaryHeaderComment(){this.skipWhitespaceAndComments();try{const e=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(e)}catch{this.bytes.next(),this.skipWhitespaceAndComments()}}};let Ga=Ha;b(Ga,"forBytesWithOptions",(e,t,n,r)=>new Ha(e,t,n,r));const Va=e=>e instanceof p?e:p.of(e),K=e=>e instanceof H?e:H.of(e),Ae=e=>e instanceof H?e.asNumber():e;var Wa=(e=>(e.Degrees="degrees",e.Radians="radians",e))(Wa||{});const De=e=>(B(e,"degreeAngle",["number"]),{type:"degrees",angle:e}),{Radians:Ka,Degrees:Za}=Wa,Ff=e=>e*Math.PI/180,zf=e=>e*180/Math.PI,Me=e=>e.type===Ka?e.angle:e.type===Za?Ff(e.angle):Fn(`Invalid rotation: ${JSON.stringify(e)}`),Mf=e=>e.type===Ka?zf(e.angle):e.type===Za?e.angle:Fn(`Invalid rotation: ${JSON.stringify(e)}`),{cos:qa,sin:Xa,tan:Ya}=Math,mr=(e,t,n,r,i,o)=>ie.of(ae.ConcatTransformationMatrix,[K(e),K(t),K(n),K(r),K(i),K(o)]),Gt=(e,t)=>mr(1,0,0,1,e,t),kn=(e,t)=>mr(e,0,0,t,0,0),An=e=>mr(qa(Ae(e)),Xa(Ae(e)),-Xa(Ae(e)),qa(Ae(e)),0,0),ao=(e,t)=>mr(1,Ya(Ae(e)),Ya(Ae(t)),1,0,0),yr=(e,t)=>ie.of(ae.SetLineDashPattern,[`[${e.map(K).join(" ")}]`,K(t)]);var Cn=(e=>(e[e.Butt=0]="Butt",e[e.Round=1]="Round",e[e.Projecting=2]="Projecting",e))(Cn||{});const wr=e=>ie.of(ae.SetLineCapStyle,[K(e)]),Vt=e=>ie.of(ae.SetGraphicsStateParams,[Va(e)]),tt=()=>ie.of(ae.PushGraphicsState),nt=()=>ie.of(ae.PopGraphicsState),_r=e=>ie.of(ae.SetLineWidth,[K(e)]),Ee=(e,t,n,r,i,o)=>ie.of(ae.AppendBezierCurve,[K(e),K(t),K(n),K(r),K(i),K(o)]),xr=(e,t,n,r)=>ie.of(ae.CurveToReplicateInitialPoint,[K(e),K(t),K(n),K(r)]),Wt=()=>ie.of(ae.ClosePath),St=(e,t)=>ie.of(ae.MoveTo,[K(e),K(t)]),Ke=(e,t)=>ie.of(ae.LineTo,[K(e),K(t)]),Sr=()=>ie.of(ae.StrokePath),co=()=>ie.of(ae.FillNonZero),lo=()=>ie.of(ae.FillNonZeroAndStroke),Ja=e=>ie.of(ae.DrawObject,[Va(e)]),Lf=e=>ie.of(ae.NonStrokingColorGray,[K(e)]),jf=e=>ie.of(ae.StrokingColorGray,[K(e)]),Uf=(e,t,n)=>ie.of(ae.NonStrokingColorRgb,[K(e),K(t),K(n)]),$f=(e,t,n)=>ie.of(ae.StrokingColorRgb,[K(e),K(t),K(n)]),Hf=(e,t,n,r)=>ie.of(ae.NonStrokingColorCmyk,[K(e),K(t),K(n),K(r)]),Gf=(e,t,n,r)=>ie.of(ae.StrokingColorCmyk,[K(e),K(t),K(n),K(r)]);var Qa=(e=>(e.Grayscale="Grayscale",e.RGB="RGB",e.CMYK="CMYK",e))(Qa||{});const Tn=(e,t,n)=>(rt(e,"red",0,1),rt(t,"green",0,1),rt(n,"blue",0,1),{type:"RGB",red:e,green:t,blue:n}),{Grayscale:ec,RGB:tc,CMYK:nc}=Qa,ho=e=>e.type===ec?Lf(e.gray):e.type===tc?Uf(e.red,e.green,e.blue):e.type===nc?Hf(e.cyan,e.magenta,e.yellow,e.key):Fn(`Invalid color: ${JSON.stringify(e)}`),vr=e=>e.type===ec?jf(e.gray):e.type===tc?$f(e.red,e.green,e.blue):e.type===nc?Gf(e.cyan,e.magenta,e.yellow,e.key):Fn(`Invalid color: ${JSON.stringify(e)}`);class Vf extends Error{constructor(){const t="Input document to `PDFDocument.load` is encrypted. You can use `PDFDocument.load(..., { ignoreEncryption: true })` if you wish to load the document anyways.";super(t)}}class Wf extends Error{constructor(){const t="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.";super(t)}}class Kf extends Error{constructor(){const t="PDFDocument has no pages so `PDFDocument.removePage` cannot be called";super(t)}}let L=0,j=0,Z=0,q=0,Bn=0,Dn=0;const rc=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]]),Zf=e=>{let t;const n=[];let r=[],i="",o=!1,s=0;for(const c of e)if(rc.has(c))s=rc.get(c),t&&(i.length>0&&(r[r.length]=+i),n[n.length]={cmd:t,args:r},r=[],i="",o=!1),t=c;else if([" ",","].includes(c)||c==="-"&&i.length>0&&i[i.length-1]!=="e"||c==="."&&o){if(i.length===0)continue;r.length===s?(n[n.length]={cmd:t,args:r},r=[+i],t==="M"&&(t="L"),t==="m"&&(t="l")):r[r.length]=+i,o=c===".",i=["-","."].includes(c)?c:""}else i+=c,c==="."&&(o=!0);return i.length>0&&(r.length===s?(n[n.length]={cmd:t,args:r},r=[+i],t==="M"&&(t="L"),t==="m"&&(t="l")):r[r.length]=+i),n[n.length]={cmd:t,args:r},n},qf=e=>{L=j=Z=q=Bn=Dn=0;let t=[];for(let n=0;n<e.length;n++){const r=e[n];if(r.cmd&&typeof ic[r.cmd]=="function"){const i=ic[r.cmd](r.args);Array.isArray(i)?t=t.concat(i):t.push(i)}}return t},ic={M(e){return L=e[0],j=e[1],Z=q=null,Bn=L,Dn=j,St(L,j)},m(e){return L+=e[0],j+=e[1],Z=q=null,Bn=L,Dn=j,St(L,j)},C(e){return L=e[4],j=e[5],Z=e[2],q=e[3],Ee(e[0],e[1],e[2],e[3],e[4],e[5])},c(e){const t=Ee(e[0]+L,e[1]+j,e[2]+L,e[3]+j,e[4]+L,e[5]+j);return Z=L+e[2],q=j+e[3],L+=e[4],j+=e[5],t},S(e){(Z===null||q===null)&&(Z=L,q=j);const t=Ee(L-(Z-L),j-(q-j),e[0],e[1],e[2],e[3]);return Z=e[0],q=e[1],L=e[2],j=e[3],t},s(e){(Z===null||q===null)&&(Z=L,q=j);const t=Ee(L-(Z-L),j-(q-j),L+e[0],j+e[1],L+e[2],j+e[3]);return Z=L+e[0],q=j+e[1],L+=e[2],j+=e[3],t},Q(e){return Z=e[0],q=e[1],L=e[2],j=e[3],xr(e[0],e[1],L,j)},q(e){const t=xr(e[0]+L,e[1]+j,e[2]+L,e[3]+j);return Z=L+e[0],q=j+e[1],L+=e[2],j+=e[3],t},T(e){Z===null||q===null?(Z=L,q=j):(Z=L-(Z-L),q=j-(q-j));const t=xr(Z,q,e[0],e[1]);return Z=L-(Z-L),q=j-(q-j),L=e[0],j=e[1],t},t(e){Z===null||q===null?(Z=L,q=j):(Z=L-(Z-L),q=j-(q-j));const t=xr(Z,q,L+e[0],j+e[1]);return L+=e[0],j+=e[1],t},A(e){const t=oc(L,j,e);return L=e[5],j=e[6],t},a(e){e[5]+=L,e[6]+=j;const t=oc(L,j,e);return L=e[5],j=e[6],t},L(e){return L=e[0],j=e[1],Z=q=null,Ke(L,j)},l(e){return L+=e[0],j+=e[1],Z=q=null,Ke(L,j)},H(e){return L=e[0],Z=q=null,Ke(L,j)},h(e){return L+=e[0],Z=q=null,Ke(L,j)},V(e){return j=e[0],Z=q=null,Ke(L,j)},v(e){return j+=e[0],Z=q=null,Ke(L,j)},Z(){const e=Wt();return L=Bn,j=Dn,e},z(){const e=Wt();return L=Bn,j=Dn,e}},oc=(e,t,n)=>{const[r,i,o,s,c,l,a]=n,h=Xf(l,a,r,i,s,c,o,e,t),d=[];for(const u of h){const f=Yf(...u);d.push(Ee(...f))}return d},Xf=(e,t,n,r,i,o,s,c,l)=>{const a=s*(Math.PI/180),h=Math.sin(a),d=Math.cos(a);n=Math.abs(n),r=Math.abs(r),Z=d*(c-e)*.5+h*(l-t)*.5,q=d*(l-t)*.5-h*(c-e)*.5;let u=Z*Z/(n*n)+q*q/(r*r);u>1&&(u=Math.sqrt(u),n*=u,r*=u);const f=d/n,y=h/n,_=-h/r,x=d/r,w=f*c+y*l,T=_*c+x*l,v=f*e+y*t,S=_*e+x*t;let C=1/((v-w)*(v-w)+(S-T)*(S-T))-.25;C<0&&(C=0);let k=Math.sqrt(C);o===i&&(k=-k);const F=.5*(w+v)-k*(S-T),I=.5*(T+S)+k*(v-w),E=Math.atan2(T-I,w-F);let Q=Math.atan2(S-I,v-F)-E;Q<0&&o===1?Q+=2*Math.PI:Q>0&&o===0&&(Q-=2*Math.PI);const M=Math.ceil(Math.abs(Q/(Math.PI*.5+.001))),O=[];for(let P=0;P<M;P++){const D=E+P*Q/M,$=E+(P+1)*Q/M;O[P]=[F,I,D,$,n,r,h,d]}return O},Yf=(e,t,n,r,i,o,s,c)=>{const l=c*i,a=-s*o,h=s*i,d=c*o,u=.5*(r-n),f=8/3*Math.sin(u*.5)*Math.sin(u*.5)/Math.sin(u),y=e+Math.cos(n)-f*Math.sin(n),_=t+Math.sin(n)+f*Math.cos(n),x=e+Math.cos(r),w=t+Math.sin(r),T=x+f*Math.sin(r),v=w-f*Math.cos(r);return[l*y+a*_,h*y+d*_,l*T+a*v,h*T+d*v,l*x+a*w,h*x+d*w]},Jf=e=>qf(Zf(e)),Qf=(e,t)=>[tt(),t.graphicsState&&Vt(t.graphicsState),Gt(t.x,t.y),An(Me(t.rotate)),kn(t.width,t.height),ao(Me(t.xSkew),Me(t.ySkew)),Ja(e),nt()].filter(Boolean),eu=(e,t)=>[tt(),t.graphicsState&&Vt(t.graphicsState),Gt(t.x,t.y),An(Me(t.rotate)),kn(t.xScale,t.yScale),ao(Me(t.xSkew),Me(t.ySkew)),Ja(e),nt()].filter(Boolean),tu=e=>{var t,n;return[tt(),e.graphicsState&&Vt(e.graphicsState),e.color&&vr(e.color),_r(e.thickness),yr((t=e.dashArray)!=null?t:[],(n=e.dashPhase)!=null?n:0),St(e.start.x,e.start.y),e.lineCap&&wr(e.lineCap),St(e.start.x,e.start.y),Ke(e.end.x,e.end.y),Sr(),nt()].filter(Boolean)},nu=e=>{var t,n;return[tt(),e.graphicsState&&Vt(e.graphicsState),e.color&&ho(e.color),e.borderColor&&vr(e.borderColor),_r(e.borderWidth),e.borderLineCap&&wr(e.borderLineCap),yr((t=e.borderDashArray)!=null?t:[],(n=e.borderDashPhase)!=null?n:0),Gt(e.x,e.y),An(Me(e.rotate)),ao(Me(e.xSkew),Me(e.ySkew)),St(0,0),Ke(0,e.height),Ke(e.width,e.height),Ke(e.width,0),Wt(),e.color&&e.borderWidth?lo():e.color?co():e.borderColor?Sr():Wt(),nt()].filter(Boolean)},kr=4*((Math.sqrt(2)-1)/3),ru=e=>{let t=Ae(e.x),n=Ae(e.y);const r=Ae(e.xScale),i=Ae(e.yScale);t-=r,n-=i;const o=r*kr,s=i*kr,c=t+r*2,l=n+i*2,a=t+r,h=n+i;return[tt(),St(t,h),Ee(t,h-s,a-o,n,a,n),Ee(a+o,n,c,h-s,c,h),Ee(c,h+s,a+o,l,a,l),Ee(a-o,l,t,h+s,t,h),nt()]},iu=e=>{const t=Ae(e.x),n=Ae(e.y),r=Ae(e.xScale),i=Ae(e.yScale),o=-r,s=-i,c=r*kr,l=i*kr,a=o+r*2,h=s+i*2,d=o+r,u=s+i;return[Gt(t,n),An(Me(e.rotate)),St(o,u),Ee(o,u-l,d-c,s,d,s),Ee(d+c,s,a,u-l,a,u),Ee(a,u+l,d+c,h,d,h),Ee(d-c,h,o,u+l,o,u)]},ou=e=>{var t,n,r;return[tt(),e.graphicsState&&Vt(e.graphicsState),e.color&&ho(e.color),e.borderColor&&vr(e.borderColor),_r(e.borderWidth),e.borderLineCap&&wr(e.borderLineCap),yr((t=e.borderDashArray)!=null?t:[],(n=e.borderDashPhase)!=null?n:0),...e.rotate===void 0?ru({x:e.x,y:e.y,xScale:e.xScale,yScale:e.yScale}):iu({x:e.x,y:e.y,xScale:e.xScale,yScale:e.yScale,rotate:(r=e.rotate)!=null?r:De(0)}),e.color&&e.borderWidth?lo():e.color?co():e.borderColor?Sr():Wt(),nt()].filter(Boolean)},su=(e,t)=>{var n,r,i;return[tt(),t.graphicsState&&Vt(t.graphicsState),Gt(t.x,t.y),An(Me((n=t.rotate)!=null?n:De(0))),t.scale?kn(t.scale,-t.scale):kn(1,-1),t.color&&ho(t.color),t.borderColor&&vr(t.borderColor),t.borderWidth&&_r(t.borderWidth),t.borderLineCap&&wr(t.borderLineCap),yr((r=t.borderDashArray)!=null?r:[],(i=t.borderDashPhase)!=null?i:0),...Jf(e),t.color&&t.borderWidth?lo():t.color?co():t.borderColor?Sr():Wt(),nt()].filter(Boolean)},au={"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 vt=(e=>(e.Normal="Normal",e.Multiply="Multiply",e.Screen="Screen",e.Overlay="Overlay",e.Darken="Darken",e.Lighten="Lighten",e.ColorDodge="ColorDodge",e.ColorBurn="ColorBurn",e.HardLight="HardLight",e.SoftLight="SoftLight",e.Difference="Difference",e.Exclusion="Exclusion",e))(vt||{});const sc=class{constructor(e,t,n){b(this,"ref"),b(this,"doc"),b(this,"width"),b(this,"height"),b(this,"alreadyEmbedded",!1),b(this,"embedder"),B(e,"ref",[[se,"PDFRef"]]),B(t,"doc",[[dt,"PDFDocument"]]),B(n,"embedder",[[Ci,"PDFPageEmbedder"]]),this.ref=e,this.doc=t,this.width=n.width,this.height=n.height,this.embedder=n}scale(e){return B(e,"factor",["number"]),{width:this.width*e,height:this.height*e}}size(){return this.scale(1)}async embed(){this.alreadyEmbedded||(await this.embedder.embedIntoContext(this.doc.context,this.ref),this.alreadyEmbedded=!0)}};let ac=sc;b(ac,"of",(e,t,n)=>new sc(e,t,n));const cc=class{constructor(e,t,n){b(this,"ref"),b(this,"doc"),b(this,"name"),b(this,"modified",!0),b(this,"embedder"),B(e,"ref",[[se,"PDFRef"]]),B(t,"doc",[[dt,"PDFDocument"]]),this.ref=e,this.doc=t,this.name=n.fontName,this.embedder=n}encodeText(e){return B(e,"text",["string"]),this.modified=!0,this.embedder.encodeText(e)}widthOfTextAtSize(e,t){return B(e,"text",["string"]),B(t,"size",["number"]),this.embedder.widthOfTextAtSize(e,t)}heightAtSize(e,t){var n;return B(e,"size",["number"]),U(t?.descender,"options.descender",["boolean"]),this.embedder.heightOfFontAtSize(e,{descender:(n=t?.descender)!=null?n:!0})}sizeAtHeight(e){return B(e,"height",["number"]),this.embedder.sizeOfFontAtHeight(e)}getCharacterSet(){return this.embedder.font.characterSet}async embed(){this.modified&&(await this.embedder.embedIntoContext(this.doc.context,this.ref),this.modified=!1)}};let lc=cc;b(lc,"of",(e,t,n)=>new cc(e,t,n));const hc=class{constructor(e,t,n){b(this,"ref"),b(this,"doc"),b(this,"width"),b(this,"height"),b(this,"embedder"),b(this,"embedTask"),B(e,"ref",[[se,"PDFRef"]]),B(t,"doc",[[dt,"PDFDocument"]]),B(n,"embedder",[[Ei,"JpegEmbedder"],[Pi,"PngEmbedder"]]),this.ref=e,this.doc=t,this.width=n.width,this.height=n.height,this.embedder=n}scale(e){return B(e,"factor",["number"]),{width:this.width*e,height:this.height*e}}scaleToFit(e,t){B(e,"width",["number"]),B(t,"height",["number"]);const n=e/this.width,r=t/this.height,i=Math.min(n,r);return this.scale(i)}size(){return this.scale(1)}async embed(){if(!!this.embedder){if(!this.embedTask){const{doc:e,ref:t}=this;this.embedTask=this.embedder.embedIntoContext(e.context,t)}await this.embedTask,this.embedder=void 0}}};let dc=hc;b(dc,"of",(e,t,n)=>new hc(e,t,n));const fo=class{constructor(e,t,n){b(this,"node"),b(this,"ref"),b(this,"doc"),b(this,"fontKey"),b(this,"font"),b(this,"fontSize",24),b(this,"fontColor",Tn(0,0,0)),b(this,"lineHeight",24),b(this,"x",0),b(this,"y",0),b(this,"contentStream"),b(this,"contentStreamRef"),B(e,"leafNode",[[We,"PDFPageLeaf"]]),B(t,"ref",[[se,"PDFRef"]]),B(n,"doc",[[dt,"PDFDocument"]]),this.node=e,this.ref=t,this.doc=n}setRotation(e){const t=Mf(e);Jc(t,"degreesAngle",90),this.node.set(p.of("Rotate"),this.doc.context.obj(t))}getRotation(){const e=this.node.Rotate();return De(e?e.asNumber():0)}setSize(e,t){B(e,"width",["number"]),B(t,"height",["number"]);const n=this.getMediaBox();this.setMediaBox(n.x,n.y,e,t);const r=this.getCropBox(),i=this.getBleedBox(),o=this.getTrimBox(),s=this.getArtBox(),c=this.node.CropBox(),l=this.node.BleedBox(),a=this.node.TrimBox(),h=this.node.ArtBox();c&&Mn(r,n)&&this.setCropBox(n.x,n.y,e,t),l&&Mn(i,n)&&this.setBleedBox(n.x,n.y,e,t),a&&Mn(o,n)&&this.setTrimBox(n.x,n.y,e,t),h&&Mn(s,n)&&this.setArtBox(n.x,n.y,e,t)}setWidth(e){B(e,"width",["number"]),this.setSize(e,this.getSize().height)}setHeight(e){B(e,"height",["number"]),this.setSize(this.getSize().width,e)}setMediaBox(e,t,n,r){B(e,"x",["number"]),B(t,"y",["number"]),B(n,"width",["number"]),B(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.MediaBox,i)}setCropBox(e,t,n,r){B(e,"x",["number"]),B(t,"y",["number"]),B(n,"width",["number"]),B(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.CropBox,i)}setBleedBox(e,t,n,r){B(e,"x",["number"]),B(t,"y",["number"]),B(n,"width",["number"]),B(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.BleedBox,i)}setTrimBox(e,t,n,r){B(e,"x",["number"]),B(t,"y",["number"]),B(n,"width",["number"]),B(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.TrimBox,i)}setArtBox(e,t,n,r){B(e,"x",["number"]),B(t,"y",["number"]),B(n,"width",["number"]),B(r,"height",["number"]);const i=this.doc.context.obj([e,t,e+n,t+r]);this.node.set(p.ArtBox,i)}getSize(){const{width:e,height:t}=this.getMediaBox();return{width:e,height:t}}getWidth(){return this.getSize().width}getHeight(){return this.getSize().height}getMediaBox(){return this.node.MediaBox().asRectangle()}getCropBox(){var e;const t=this.node.CropBox();return(e=t?.asRectangle())!=null?e:this.getMediaBox()}getBleedBox(){var e;const t=this.node.BleedBox();return(e=t?.asRectangle())!=null?e:this.getCropBox()}getTrimBox(){var e;const t=this.node.TrimBox();return(e=t?.asRectangle())!=null?e:this.getCropBox()}getArtBox(){var e;const t=this.node.ArtBox();return(e=t?.asRectangle())!=null?e:this.getCropBox()}translateContent(e,t){B(e,"x",["number"]),B(t,"y",["number"]),this.node.normalize(),this.getContentStream();const n=this.createContentStream(tt(),Gt(e,t)),r=this.doc.context.register(n),i=this.createContentStream(nt()),o=this.doc.context.register(i);this.node.wrapContentStreams(r,o)}scale(e,t){B(e,"x",["number"]),B(t,"y",["number"]),this.setSize(this.getWidth()*e,this.getHeight()*t),this.scaleContent(e,t),this.scaleAnnotations(e,t)}scaleContent(e,t){B(e,"x",["number"]),B(t,"y",["number"]),this.node.normalize(),this.getContentStream();const n=this.createContentStream(tt(),kn(e,t)),r=this.doc.context.register(n),i=this.createContentStream(nt()),o=this.doc.context.register(i);this.node.wrapContentStreams(r,o)}scaleAnnotations(e,t){B(e,"x",["number"]),B(t,"y",["number"]);const n=this.node.Annots();if(!!n)for(let r=0;r<n.size();r++){const i=n.lookup(r);i instanceof W&&this.scaleAnnot(i,e,t)}}resetPosition(){this.getContentStream(!1),this.x=0,this.y=0}setFont(e){B(e,"font",[[lc,"PDFFont"]]),this.font=e,this.fontKey=this.node.newFontDictionary(this.font.name,this.font.ref)}setFontSize(e){B(e,"fontSize",["number"]),this.fontSize=e}setFontColor(e){B(e,"fontColor",[[Object,"Color"]]),this.fontColor=e}setLineHeight(e){B(e,"lineHeight",["number"]),this.lineHeight=e}getPosition(){return{x:this.x,y:this.y}}getX(){return this.x}getY(){return this.y}moveTo(e,t){B(e,"x",["number"]),B(t,"y",["number"]),this.x=e,this.y=t}moveDown(e){B(e,"yDecrease",["number"]),this.y-=e}moveUp(e){B(e,"yIncrease",["number"]),this.y+=e}moveLeft(e){B(e,"xDecrease",["number"]),this.x-=e}moveRight(e){B(e,"xIncrease",["number"]),this.x+=e}pushOperators(...e){Io(e,"operator",[[ie,"PDFOperator"]]),this.getContentStream().push(...e)}drawImage(e,t={}){var n,r,i,o,s,c,l;B(e,"image",[[dc,"PDFImage"]]),U(t.x,"options.x",["number"]),U(t.y,"options.y",["number"]),U(t.width,"options.width",["number"]),U(t.height,"options.height",["number"]),U(t.rotate,"options.rotate",[[Object,"Rotation"]]),U(t.xSkew,"options.xSkew",[[Object,"Rotation"]]),U(t.ySkew,"options.ySkew",[[Object,"Rotation"]]),Xe(t.opacity,"opacity.opacity",0,1),je(t.blendMode,"options.blendMode",vt);const a=this.node.newXObject("Image",e.ref),h=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode});this.getContentStream().push(...Qf(a,{x:(n=t.x)!=null?n:this.x,y:(r=t.y)!=null?r:this.y,width:(i=t.width)!=null?i:e.size().width,height:(o=t.height)!=null?o:e.size().height,rotate:(s=t.rotate)!=null?s:De(0),xSkew:(c=t.xSkew)!=null?c:De(0),ySkew:(l=t.ySkew)!=null?l:De(0),graphicsState:h}))}drawPage(e,t={}){var n,r,i,o,s;B(e,"embeddedPage",[[ac,"PDFEmbeddedPage"]]),U(t.x,"options.x",["number"]),U(t.y,"options.y",["number"]),U(t.xScale,"options.xScale",["number"]),U(t.yScale,"options.yScale",["number"]),U(t.width,"options.width",["number"]),U(t.height,"options.height",["number"]),U(t.rotate,"options.rotate",[[Object,"Rotation"]]),U(t.xSkew,"options.xSkew",[[Object,"Rotation"]]),U(t.ySkew,"options.ySkew",[[Object,"Rotation"]]),Xe(t.opacity,"opacity.opacity",0,1),je(t.blendMode,"options.blendMode",vt);const c=this.node.newXObject("EmbeddedPdfPage",e.ref),l=this.maybeEmbedGraphicsState({opacity:t.opacity,blendMode:t.blendMode}),a=t.width!==void 0?t.width/e.width:t.xScale!==void 0?t.xScale:1,h=t.height!==void 0?t.height/e.height:t.yScale!==void 0?t.yScale:1;this.getContentStream().push(...eu(c,{x:(n=t.x)!=null?n:this.x,y:(r=t.y)!=null?r:this.y,xScale:a,yScale:h,rotate:(i=t.rotate)!=null?i:De(0),xSkew:(o=t.xSkew)!=null?o:De(0),ySkew:(s=t.ySkew)!=null?s:De(0),graphicsState:l}))}drawSvgPath(e,t={}){var n,r,i,o,s,c,l,a,h;B(e,"path",["string"]),U(t.x,"options.x",["number"]),U(t.y,"options.y",["number"]),U(t.scale,"options.scale",["number"]),U(t.rotate,"options.rotate",[[Object,"Rotation"]]),U(t.borderWidth,"options.borderWidth",["number"]),U(t.color,"options.color",[[Object,"Color"]]),Xe(t.opacity,"opacity.opacity",0,1),U(t.borderColor,"options.borderColor",[[Object,"Color"]]),U(t.borderDashArray,"options.borderDashArray",[Array]),U(t.borderDashPhase,"options.borderDashPhase",["number"]),je(t.borderLineCap,"options.borderLineCap",Cn),Xe(t.borderOpacity,"options.borderOpacity",0,1),je(t.blendMode,"options.blendMode",vt);const d=this.maybeEmbedGraphicsState({opacity:t.opacity,borderOpacity:t.borderOpacity,blendMode:t.blendMode});!("color"in t)&&!("borderColor"in t)&&(t.borderColor=Tn(0,0,0)),this.getContentStream().push(...su(e,{x:(n=t.x)!=null?n:this.x,y:(r=t.y)!=null?r:this.y,scale:t.scale,rotate:(i=t.rotate)!=null?i:De(0),color:(o=t.color)!=null?o:void 0,borderColor:(s=t.borderColor)!=null?s:void 0,borderWidth:(c=t.borderWidth)!=null?c:0,borderDashArray:(l=t.borderDashArray)!=null?l:void 0,borderDashPhase:(a=t.borderDashPhase)!=null?a:void 0,borderLineCap:(h=t.borderLineCap)!=null?h:void 0,graphicsState:d}))}drawLine(e){var t,n,r,i,o;B(e.start,"options.start",[[Object,"{ x: number, y: number }"]]),B(e.end,"options.end",[[Object,"{ x: number, y: number }"]]),B(e.start.x,"options.start.x",["number"]),B(e.start.y,"options.start.y",["number"]),B(e.end.x,"options.end.x",["number"]),B(e.end.y,"options.end.y",["number"]),U(e.thickness,"options.thickness",["number"]),U(e.color,"options.color",[[Object,"Color"]]),U(e.dashArray,"options.dashArray",[Array]),U(e.dashPhase,"options.dashPhase",["number"]),je(e.lineCap,"options.lineCap",Cn),Xe(e.opacity,"opacity.opacity",0,1),je(e.blendMode,"options.blendMode",vt);const s=this.maybeEmbedGraphicsState({borderOpacity:e.opacity,blendMode:e.blendMode});"color"in e||(e.color=Tn(0,0,0)),this.getContentStream().push(...tu({start:e.start,end:e.end,thickness:(t=e.thickness)!=null?t:1,color:(n=e.color)!=null?n:void 0,dashArray:(r=e.dashArray)!=null?r:void 0,dashPhase:(i=e.dashPhase)!=null?i:void 0,lineCap:(o=e.lineCap)!=null?o:void 0,graphicsState:s}))}drawRectangle(e={}){var t,n,r,i,o,s,c,l,a,h,d,u,f;U(e.x,"options.x",["number"]),U(e.y,"options.y",["number"]),U(e.width,"options.width",["number"]),U(e.height,"options.height",["number"]),U(e.rotate,"options.rotate",[[Object,"Rotation"]]),U(e.xSkew,"options.xSkew",[[Object,"Rotation"]]),U(e.ySkew,"options.ySkew",[[Object,"Rotation"]]),U(e.borderWidth,"options.borderWidth",["number"]),U(e.color,"options.color",[[Object,"Color"]]),Xe(e.opacity,"opacity.opacity",0,1),U(e.borderColor,"options.borderColor",[[Object,"Color"]]),U(e.borderDashArray,"options.borderDashArray",[Array]),U(e.borderDashPhase,"options.borderDashPhase",["number"]),je(e.borderLineCap,"options.borderLineCap",Cn),Xe(e.borderOpacity,"options.borderOpacity",0,1),je(e.blendMode,"options.blendMode",vt);const y=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=Tn(0,0,0)),this.getContentStream().push(...nu({x:(t=e.x)!=null?t:this.x,y:(n=e.y)!=null?n:this.y,width:(r=e.width)!=null?r:150,height:(i=e.height)!=null?i:100,rotate:(o=e.rotate)!=null?o:De(0),xSkew:(s=e.xSkew)!=null?s:De(0),ySkew:(c=e.ySkew)!=null?c:De(0),borderWidth:(l=e.borderWidth)!=null?l:0,color:(a=e.color)!=null?a:void 0,borderColor:(h=e.borderColor)!=null?h:void 0,borderDashArray:(d=e.borderDashArray)!=null?d:void 0,borderDashPhase:(u=e.borderDashPhase)!=null?u:void 0,graphicsState:y,borderLineCap:(f=e.borderLineCap)!=null?f:void 0}))}drawSquare(e={}){const{size:t}=e;U(t,"size",["number"]),this.drawRectangle({...e,width:t,height:t})}drawEllipse(e={}){var t,n,r,i,o,s,c,l,a,h,d;U(e.x,"options.x",["number"]),U(e.y,"options.y",["number"]),U(e.xScale,"options.xScale",["number"]),U(e.yScale,"options.yScale",["number"]),U(e.rotate,"options.rotate",[[Object,"Rotation"]]),U(e.color,"options.color",[[Object,"Color"]]),Xe(e.opacity,"opacity.opacity",0,1),U(e.borderColor,"options.borderColor",[[Object,"Color"]]),Xe(e.borderOpacity,"options.borderOpacity",0,1),U(e.borderWidth,"options.borderWidth",["number"]),U(e.borderDashArray,"options.borderDashArray",[Array]),U(e.borderDashPhase,"options.borderDashPhase",["number"]),je(e.borderLineCap,"options.borderLineCap",Cn),je(e.blendMode,"options.blendMode",vt);const u=this.maybeEmbedGraphicsState({opacity:e.opacity,borderOpacity:e.borderOpacity,blendMode:e.blendMode});!("color"in e)&&!("borderColor"in e)&&(e.color=Tn(0,0,0)),this.getContentStream().push(...ou({x:(t=e.x)!=null?t:this.x,y:(n=e.y)!=null?n:this.y,xScale:(r=e.xScale)!=null?r:100,yScale:(i=e.yScale)!=null?i:100,rotate:(o=e.rotate)!=null?o:void 0,color:(s=e.color)!=null?s:void 0,borderColor:(c=e.borderColor)!=null?c:void 0,borderWidth:(l=e.borderWidth)!=null?l:0,borderDashArray:(a=e.borderDashArray)!=null?a:void 0,borderDashPhase:(h=e.borderDashPhase)!=null?h:void 0,borderLineCap:(d=e.borderLineCap)!=null?d:void 0,graphicsState:u}))}drawCircle(e={}){const{size:t=100}=e;U(t,"size",["number"]),this.drawEllipse({...e,xScale:t,yScale:t})}resetFont(){this.font=void 0,this.fontKey=void 0}getContentStream(e=!0){return e&&this.contentStream?this.contentStream:(this.contentStream=this.createContentStream(),this.contentStreamRef=this.doc.context.register(this.contentStream),this.node.addContentStream(this.contentStreamRef),this.contentStream)}createContentStream(...e){const t=this.doc.context.obj({});return Mt.of(t,e)}maybeEmbedGraphicsState(e){const{opacity:t,borderOpacity:n,blendMode:r}=e;if(t===void 0&&n===void 0&&r===void 0)return;const i=this.doc.context.obj({Type:"ExtGState",ca:t,CA:n,BM:r});return this.node.newExtGState("GS",i)}scaleAnnot(e,t,n){const r=["RD","CL","Vertices","QuadPoints","L","Rect"];for(let o=0,s=r.length;o<s;o++){const c=e.lookup(p.of(r[o]));c instanceof X&&c.scalePDFNumbers(t,n)}const i=e.lookup(p.of("InkList"));if(i instanceof X)for(let o=0,s=i.size();o<s;o++){const c=i.lookup(o);c instanceof X&&c.scalePDFNumbers(t,n)}}};let Kt=fo;b(Kt,"of",(e,t,n)=>new fo(e,t,n)),b(Kt,"create",e=>{B(e,"doc",[[dt,"PDFDocument"]]);const t=se.of(-1),n=We.withContextAndParent(e.context,t),r=e.context.register(n);return new fo(n,r,e)});const fc=class{constructor(e,t,n){b(this,"ref"),b(this,"doc"),b(this,"alreadyEmbedded",!1),b(this,"embedder"),this.ref=e,this.doc=t,this.embedder=n}async embed(){if(!this.alreadyEmbedded){const{catalog:e,context:t}=this.doc,n=await this.embedder.embedIntoContext(this.doc.context,this.ref);e.has(p.of("Names"))||e.set(p.of("Names"),t.obj({}));const r=e.lookup(p.of("Names"),W);r.has(p.of("JavaScript"))||r.set(p.of("JavaScript"),t.obj({}));const i=r.lookup(p.of("JavaScript"),W);i.has(p.of("Names"))||i.set(p.of("Names"),t.obj([]));const o=i.lookup(p.of("Names"),X);o.push(Y.fromText(this.embedder.scriptName)),o.push(n),this.alreadyEmbedded=!0}}};let uc=fc;b(uc,"of",(e,t,n)=>new fc(e,t,n));class uo{constructor(t,n){b(this,"script"),b(this,"scriptName"),this.script=t,this.scriptName=n}static for(t,n){return new uo(t,n)}async embedIntoContext(t,n){const r=t.obj({Type:"Action",S:"JavaScript",JS:Y.fromText(this.script)});return n?(t.assign(n,r),n):t.register(r)}}class dt{constructor(t,n){if(b(this,"context"),b(this,"catalog"),b(this,"isEncrypted"),b(this,"defaultWordBreaks",[" "]),b(this,"fontkit"),b(this,"pageCount"),b(this,"pageCache"),b(this,"pageMap"),b(this,"fonts"),b(this,"images"),b(this,"embeddedPages"),b(this,"embeddedFiles"),b(this,"javaScripts"),b(this,"computePages",()=>{const r=[];return this.catalog.Pages().traverse((i,o)=>{if(i instanceof We){let s=this.pageMap.get(i);s||(s=Kt.of(i,o,this),this.pageMap.set(i,s)),r.push(s)}}),r}),B(t,"context",[[xi,"PDFContext"]]),B(n,"ignoreEncryption",["boolean"]),this.context=t,this.catalog=t.lookup(t.trailerInfo.Root),this.isEncrypted=!!t.lookup(t.trailerInfo.Encrypt),this.pageCache=Tt.populatedBy(this.computePages),this.pageMap=new Map,this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!n&&this.isEncrypted)throw new Vf}static async load(t,n={}){const{ignoreEncryption:r=!1,parseSpeed:i=100,throwOnInvalidObject:o=!1,updateMetadata:s=!0,capNumbers:c=!1}=n;B(t,"pdf",["string",Uint8Array,ArrayBuffer]),B(r,"ignoreEncryption",["boolean"]),B(i,"parseSpeed",["number"]),B(o,"throwOnInvalidObject",["boolean"]);const l=jc(t),a=await Ga.forBytesWithOptions(l,i,o,c).parseDocument();return new dt(a,r)}registerFontkit(t){this.fontkit=t}getPageCount(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount}getPages(){return this.pageCache.access()}getPage(t){const n=this.getPages();return rt(t,"index",0,n.length-1),n[t]}getPageIndices(){return Lc(0,this.getPageCount())}removePage(t){const n=this.getPageCount();if(this.pageCount===0)throw new Kf;rt(t,"index",0,n-1),this.catalog.removeLeafNode(t),this.pageCount=n-1}addPage(t){return B(t,"page",["undefined",[Kt,"PDFPage"],Array]),this.insertPage(this.getPageCount(),t)}insertPage(t,n){const r=this.getPageCount();if(rt(t,"index",0,r),B(n,"page",["undefined",[Kt,"PDFPage"],Array]),!n||Array.isArray(n)){const o=Array.isArray(n)?n:au.A4;n=Kt.create(this),n.setSize(...o)}else if(n.doc!==this)throw new Wf;const i=this.catalog.insertLeafNode(n.ref,t);return n.node.setParent(i),this.pageMap.set(n.node,n),this.pageCache.invalidate(),this.pageCount=r+1,n}addJavaScript(t,n){B(t,"name",["string"]),B(n,"script",["string"]);const r=uo.for(n,t),i=this.context.nextRef(),o=uc.of(i,this,r);this.javaScripts.push(o)}async flush(){await this.embedAll(this.fonts),await this.embedAll(this.images),await this.embedAll(this.embeddedPages),await this.embedAll(this.embeddedFiles),await this.embedAll(this.javaScripts)}async save(t={}){const{useObjectStreams:n=!0,addDefaultPage:r=!0,objectsPerTick:i=50,updateFieldAppearances:o=!0}=t;return B(n,"useObjectStreams",["boolean"]),B(r,"addDefaultPage",["boolean"]),B(i,"objectsPerTick",["number"]),B(o,"updateFieldAppearances",["boolean"]),r&&this.getPageCount()===0&&this.addPage(),await this.flush(),(n?va:Ai).forContext(this.context,i).serializeToBuffer()}async saveAsBase64(t={}){const{dataUri:n=!1,...r}=t;B(n,"dataUri",["boolean"]);const i=await this.save(r),o=Pc(i);return n?`data:application/pdf;base64,${o}`:o}findPageForAnnotationRef(t){const n=this.getPages();for(let r=0,i=n.length;r<i;r++){const o=n[r],s=o.node.Annots();if(s?.indexOf(t)!==void 0)return o}}async embedAll(t){for(let n=0,r=t.length;n<r;n++)await t[n].embed()}}var Le;(function(e){e.APNG="image/apng",e.AVIF="image/avif",e.BMP="image/bmp",e.GIF="image/gif",e.JPEG="image/jpeg",e.PNG="image/png",e.SVG="image/svg+xml",e.WEBP="image/webp",e.ICON="image/x-icon"})(Le||(Le={}));var Ar;(function(e){e.UnsupportedFileType="unsupported-file-type",e.FileSizeExceeded="file-size-exceeded"})(Ar||(Ar={}));var Zt;(function(e){e.textSelection="vpv:annotation:textSelection",e.freeText="vpv:annotation:freeText",e.signature="vpv:annotation:signature",e.image="vpv:annotation:image",e.highlight="vpv:annotation:highlight",e.underline="vpv:annotation:underline",e.strikeout="vpv:annotation:strikeout"})(Zt||(Zt={}));var Cr;(function(e){e.AnnotationCreated="vpv:annotation:created",e.AnnotationUpdated="vpv:annotation:updated",e.AnnotationDeleted="vpv:annotation:deleted",e.AnnotationMounted="vpv:annotation:mounted",e.Rotate="vpv:rotate",e.ShowNotificationError="vpv:notification:error"})(Cr||(Cr={})),z.AnnotationType=void 0,function(e){e[e.Text=1]="Text",e[e.Link=2]="Link",e[e.FreeText=3]="FreeText",e[e.Line=4]="Line",e[e.Square=5]="Square",e[e.Circle=6]="Circle",e[e.Polygon=7]="Polygon",e[e.Polyline=8]="Polyline",e[e.Highlight=9]="Highlight",e[e.Underline=10]="Underline",e[e.Squiggly=11]="Squiggly",e[e.StrikeOut=12]="StrikeOut",e[e.Stamp=13]="Stamp",e[e.Caret=14]="Caret",e[e.Ink=15]="Ink",e[e.Popup=16]="Popup",e[e.FileAttachment=17]="FileAttachment",e[e.Sound=18]="Sound",e[e.Movie=19]="Movie",e[e.Widget=20]="Widget",e[e.Screen=21]="Screen",e[e.PrinterMark=22]="PrinterMark",e[e.TrapNet=23]="TrapNet",e[e.Watermark=24]="Watermark",e[e.ThreeD=25]="ThreeD",e[e.Redact=26]="Redact"}(z.AnnotationType||(z.AnnotationType={})),z.AnnotationFlag=void 0,function(e){e[e.INVISIBLE=1]="INVISIBLE",e[e.HIDDEN=2]="HIDDEN",e[e.PRINT=4]="PRINT",e[e.NOZOOM=8]="NOZOOM",e[e.NOROTATE=16]="NOROTATE",e[e.NOVIEW=32]="NOVIEW",e[e.READONLY=64]="READONLY",e[e.LOCKED=128]="LOCKED",e[e.TOGGLENOVIEW=256]="TOGGLENOVIEW",e[e.LOCKEDCONTENTS=512]="LOCKEDCONTENTS"}(z.AnnotationFlag||(z.AnnotationFlag={}));const cu={ANNOTATIONS:"annotations"},En=Symbol("VPV Shared UIs"),gc=Symbol("VPV Current Localization"),Pn=Cr,go={Black:"#000000",DarkGray:"#444444",Gray:"#696969",LightGray:"#9C9C9C",LightestGray:"#CDCDCD",ChristmasWhite:"#EDEDED"},Oe={...go,Purple:"#7862FF",Blue:"#1777FF",Red:"#F66365",Orange:"#F67E63",Yellow:"#F5C463",Green:"#48BB77"},Ne={Purple:"#CAAAFF",Cyan:"#65EDE9",Red:"#FFACAC",Orange:"#FFBD82",Yellow:"#FCE244",Green:"#A0F751",...go},le={Purple:"#7862FF",Blue:"#1777FF",Red:"#F66365",Orange:"#F67E63",Yellow:"#F5C463",Green:"#48BB77",...go},lu={[Ne.Purple]:"Purple",[Ne.Cyan]:"Cyan",[Ne.Red]:"Red",[Ne.Orange]:"Orange",[Ne.Yellow]:"Yellow",[Ne.Green]:"Green",[Ne.Black]:"Black",[Ne.DarkGray]:"Dark Gray",[Ne.Gray]:"Gray",[Ne.LightGray]:"Light Gray",[Ne.LightestGray]:"Lightest Gray",[Ne.ChristmasWhite]:"Christmas White"},hu={[le.Purple]:"Purple",[le.Blue]:"Blue",[le.Red]:"Red",[le.Orange]:"Orange",[le.Yellow]:"Yellow",[le.Green]:"Green",[le.Black]:"Black",[le.DarkGray]:"Dark Gray",[le.Gray]:"Gray",[le.LightGray]:"Light Gray",[le.LightestGray]:"Lightest Gray",[le.ChristmasWhite]:"Christmas White"},du={[le.Purple]:"Purple",[le.Blue]:"Blue",[le.Red]:"Red",[le.Orange]:"Orange",[le.Yellow]:"Yellow",[le.Green]:"Green",[le.Black]:"Black",[le.DarkGray]:"Dark Gray",[le.Gray]:"Gray",[le.LightGray]:"Light Gray",[le.LightestGray]:"Lightest Gray",[le.ChristmasWhite]:"Christmas White"},fu={[Oe.Black]:"Black",[Oe.DarkGray]:"Dark Gray",[Oe.Gray]:"Gray",[Oe.LightGray]:"Light Gray",[Oe.LightestGray]:"Lightest Gray",[Oe.ChristmasWhite]:"Christmas White",[Oe.Purple]:"Purple",[Oe.Blue]:"Blue",[Oe.Red]:"Red",[Oe.Orange]:"Orange",[Oe.Yellow]:"Yellow",[Oe.Green]:"Green"},uu="pdfjs_internal_editor_",gu={highlight:z.AnnotationType.Highlight,underline:z.AnnotationType.Underline,strikeout:z.AnnotationType.StrikeOut,squiggly:z.AnnotationType.Squiggly,freetext:z.AnnotationType.FreeText,stamp:z.AnnotationType.Stamp,ink:z.AnnotationType.Ink,text:z.AnnotationType.Popup,square:z.AnnotationType.Square,circle:z.AnnotationType.Circle,line:z.AnnotationType.Line,polygon:z.AnnotationType.Polygon,polyline:z.AnnotationType.Polyline},pu={[z.AnnotationType.Highlight]:"highlight",[z.AnnotationType.Underline]:"underline",[z.AnnotationType.StrikeOut]:"strikeout",[z.AnnotationType.Squiggly]:"squiggly",[z.AnnotationType.FreeText]:"freetext",[z.AnnotationType.Stamp]:"stamp",[z.AnnotationType.Ink]:"ink",[z.AnnotationType.Popup]:"text",[z.AnnotationType.Square]:"square",[z.AnnotationType.Circle]:"circle",[z.AnnotationType.Line]:"line",[z.AnnotationType.Polygon]:"polygon",[z.AnnotationType.Polyline]:"polyline"},qt=(e,t)=>`${e}-${t}`;class bu{static async serializeAnnotationsToPdf(t,n,r){const i=await dt.load(t),o=i.getPages();if(r&&r.length>0){const a=typeof r[0]=="string"?r.map(h=>({id:h,pageIndex:-1,annotationType:-1})):r;await this.removeAnnotations(i,o,a)}const s=n.filter(a=>a.annotationType===z.AnnotationType.Underline||a.annotationType===z.AnnotationType.StrikeOut),c=n.filter(a=>a.annotationType===z.AnnotationType.Square);for(const a of s)await this.addTextMarkupAnnotation(i,o,a);for(const a of c)await this.addRectangleAnnotation(i,o,a);return await i.save()}static async removeAnnotations(t,n,r){const i=new Map,o=[];for(const s of r)if(s.pageIndex>=0){const c=i.get(s.pageIndex)||[];c.push(s),i.set(s.pageIndex,c)}else o.push(s);for(let s=0;s<n.length;s++){const c=n[s],l=[...i.get(s)||[],...o];if(l.length===0)continue;const a=c.node.Annots();if(!a||!(a instanceof X))continue;const h=[];for(let d=0;d<a.size();d++){const u=a.get(d);let f;if(u instanceof se){const _=t.context.lookup(u);_ instanceof W&&(f=_)}else u instanceof W&&(f=u);if(!f)continue;this.matchesDeletedAnnotation(f,l)&&h.push(d)}for(let d=h.length-1;d>=0;d--)a.remove(h[d])}}static matchesDeletedAnnotation(t,n){const r=t.get(p.of("NM"));let i=null;if((r instanceof te||r instanceof Y)&&(i=r.decodeText()),i&&n.find(d=>d.id===i))return!0;const o=t.get(p.of("Subtype")),s=o instanceof p?o.decodeText():null;let c=null;if(s==="Underline"?c=z.AnnotationType.Underline:s==="StrikeOut"&&(c=z.AnnotationType.StrikeOut),c===null)return!1;const l=t.get(p.of("Rect"));if(!(l instanceof X))return!1;const a=[];for(let h=0;h<l.size();h++){const d=l.get(h);d instanceof H&&a.push(d.asNumber())}if(a.length!==4)return!1;for(const h of n){if(h.annotationType!==-1&&h.annotationType!==c||!h.rect||h.rect.length!==4)continue;const d=1;if(Math.abs(a[0]-h.rect[0])<d&&Math.abs(a[1]-h.rect[1])<d&&Math.abs(a[2]-h.rect[2])<d&&Math.abs(a[3]-h.rect[3])<d)return!0}return!1}static async addTextMarkupAnnotation(t,n,r){const i=n[r.pageIndex??0],o=r.rect,s=Array.from(r.quadPoints||[]),c={Type:"Annot",Subtype:r.annotationType===z.AnnotationType.Underline?"Underline":"StrikeOut",Rect:o,QuadPoints:s,C:[(r.color?.[0]??0)/255,(r.color?.[1]??0)/255,(r.color?.[2]??0)/255],F:4,Contents:Y.fromText(r.contents||`${r.subtype} annotation`)};if(r.modificationDate){const d=r.modificationDate instanceof Date?this.formatPdfDate(r.modificationDate):r.modificationDate.toString();c.M=te.of(d)}if(r.creationDate){const d=r.creationDate instanceof Date?this.formatPdfDate(r.creationDate):r.creationDate.toString();c.CreationDate=te.of(d)}c.T=Y.fromText(r.titleObj?.str||"Vue PDF Viewer"),r.id&&(c.NM=Y.fromText(r.id));const l=t.context.obj(c),a=t.context.register(l);let h=i.node.lookup(p.of("Annots"));h||(h=t.context.obj([]),i.node.set(p.of("Annots"),h)),h instanceof X&&h.push(a)}static formatPdfDate(t){const n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),o=String(t.getHours()).padStart(2,"0"),s=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0"),l=-t.getTimezoneOffset(),a=l>=0?"+":"-",h=String(Math.floor(Math.abs(l)/60)).padStart(2,"0"),d=String(Math.abs(l)%60).padStart(2,"0");return`D:${n}${r}${i}${o}${s}${c}${a}${h}'${d}`}static async addRectangleAnnotation(t,n,r){const i=n[r.pageIndex??0],{height:o}=i.getSize(),s=this.convertRectToPdfCoords(r.rect,o),c=r.borderColor||r.color,l=r.backgroundColor,a={Type:"Annot",Subtype:"Square",Rect:s,F:r.annotationFlags??4};if(c&&(a.C=[(c[0]??0)/255,(c[1]??0)/255,(c[2]??0)/255]),l&&(a.IC=[(l[0]??0)/255,(l[1]??0)/255,(l[2]??0)/255]),r.borderStyle){const f={Type:"Border"};if(r.borderStyle.width!==void 0&&(f.W=r.borderStyle.width),r.borderStyle.style!==void 0){const y={1:"S",2:"D",3:"B",4:"I",5:"U"};f.S=p.of(y[r.borderStyle.style]||"S")}r.borderStyle.dashArray&&r.borderStyle.dashArray.length>0&&(f.D=r.borderStyle.dashArray),a.BS=t.context.obj(f)}if(r.opacity!==void 0&&r.opacity<1&&(a.CA=r.opacity),r.contents&&(a.Contents=Y.fromText(r.contents)),r.creationDate){const f=r.creationDate instanceof Date?this.formatPdfDate(r.creationDate):r.creationDate.toString();a.CreationDate=te.of(f)}if(r.modificationDate){const f=r.modificationDate instanceof Date?this.formatPdfDate(r.modificationDate):r.modificationDate.toString();a.M=te.of(f)}const h=t.context.obj(a),d=t.context.register(h);let u=i.node.lookup(p.of("Annots"));u||(u=t.context.obj([]),i.node.set(p.of("Annots"),u)),u instanceof X&&u.push(d)}static convertRectToPdfCoords(t,n){return[t[0],n-t[3],t[2],n-t[1]]}static convertQuadPointsToPdfCoords(t,n){const r=[];for(let i=0;i<t.length;i+=2)r.push(t[i],n-t[i+1]);return r}}const we="http://ns.adobe.com/xfdf/";function pc(e){e||(e=new Date);const t=e instanceof Date?e:new Date(e);isNaN(t.getTime())&&(e=new Date);const n=i=>String(i).padStart(2,"0"),r=e instanceof Date?e:new Date;return`D:${r.getFullYear()}${n(r.getMonth()+1)}${n(r.getDate())}${n(r.getHours())}${n(r.getMinutes())}${n(r.getSeconds())}`}function bc(e){const t=n=>Math.round(n).toString(16).padStart(2,"0");return`#${t(e[0])}${t(e[1])}${t(e[2])}`}function mc(e){const t=e.replace("#","");let n,r,i;return t.length===3?(n=parseInt(t[0]+t[0],16),r=parseInt(t[1]+t[1],16),i=parseInt(t[2]+t[2],16)):(n=parseInt(t.substring(0,2),16),r=parseInt(t.substring(2,4),16),i=parseInt(t.substring(4,6),16)),new Uint8ClampedArray([isNaN(n)?0:n,isNaN(r)?0:r,isNaN(i)?0:i])}class de{static serializeAnnotation(t,n){if(t.deleted)return null;const r=pu[t.annotationType];if(!r)return null;const i=n.createElementNS(we,r);i.setAttribute("page",String(t.pageIndex??0)),t.rect&&t.rect.length===4&&i.setAttribute("rect",t.rect.map(c=>c.toFixed(4)).join(","));const o=t;o.hexColor?i.setAttribute("color",o.hexColor):t.color&&i.setAttribute("color",bc(t.color)),i.setAttribute("name",t.id??crypto.randomUUID()),i.setAttribute("title",t.titleObj?.str??"Vue PDF Viewer");const s=new Date;switch(i.setAttribute("date",pc(t.modificationDate??s)),i.setAttribute("creationdate",pc(t.creationDate??s)),i.setAttribute("flags","print"),i.setAttribute("opacity",String(t.opacity??1)),t.rotation&&t.rotation!==0&&i.setAttribute("rotation",String(t.rotation)),t.inReplyTo&&(i.setAttribute("inreplyto",t.inReplyTo),i.setAttribute("replyType","r")),t.annotationType){case z.AnnotationType.Highlight:case z.AnnotationType.Underline:case z.AnnotationType.StrikeOut:case z.AnnotationType.Squiggly:return de.serializeTextMarkup(t,i,n);case z.AnnotationType.FreeText:return de.serializeFreeText(t,i,n);case z.AnnotationType.Stamp:return de.serializeStamp(t,i,n);case z.AnnotationType.Ink:return de.serializeInk(t,i,n);case z.AnnotationType.Popup:return de.serializePopup(t,i,n);case z.AnnotationType.Square:case z.AnnotationType.Circle:return de.serializeShape(t,i,n);case z.AnnotationType.Line:return de.serializeLine(t,i,n);case z.AnnotationType.Polygon:case z.AnnotationType.Polyline:return de.serializeVertexAnnotation(t,i,n);default:return null}}static serializeTextMarkup(t,n,r){if(t.quadPoints&&t.quadPoints.length>0&&n.setAttribute("coords",Array.from(t.quadPoints).map(i=>i.toFixed(4)).join(",")),t.contents){const i=r.createElementNS(we,"contents");i.textContent=t.contents,n.appendChild(i)}return n}static serializeFreeText(t,n,r){const i=t.value??t.contents??t.contentsObj?.str??"",o=r.createElementNS(we,"contents");o.textContent=i,n.appendChild(o);const s=t.defaultAppearanceData,c=s?.fontName??"Helvetica",l=s?.fontSize??t.fontSize??12;let a="0 0 0";const h=s?.fontColor??t.color;h&&(a=`${(h[0]/255).toFixed(3)} ${(h[1]/255).toFixed(3)} ${(h[2]/255).toFixed(3)}`);const d=r.createElementNS(we,"defaultappearance");return d.textContent=`/${c} ${l} Tf ${a} rg`,n.appendChild(d),n}static bitmapToDataUrlSync(t){try{const n=t?.width,r=t?.height;if(!n||!r)return null;const i=document.createElement("canvas");i.width=n,i.height=r;const o=i.getContext("2d");return o?(o.drawImage(t,0,0),i.toDataURL("image/png")):null}catch{return null}}static serializeStamp(t,n,r){if(t.iconName&&n.setAttribute("icon",t.iconName),t.contents){const o=r.createElementNS(we,"contents");o.textContent=t.contents,n.appendChild(o)}let i=t.imageDataUrl??null;if(!i){const o=t.bitmap;o&&(i=de.bitmapToDataUrlSync(o))}if(i){const o=r.createElementNS(we,"imagedata");o.textContent=i,n.appendChild(o)}return n}static serializeInk(t,n,r){const i=t.inkLists;if(i&&i.length>0){const o=r.createElementNS(we,"inklist");for(const s of i){const c=r.createElementNS(we,"gesture"),l=[];for(let a=0;a<s.length;a+=2)l.push(`${s[a].toFixed(4)};${s[a+1].toFixed(4)}`);c.textContent=l.join(";"),o.appendChild(c)}n.appendChild(o)}return t.borderStyle?.width!==void 0&&n.setAttribute("width",String(t.borderStyle.width)),n}static serializePopup(t,n,r){if(n.setAttribute("icon",t.iconName??"Comment"),t.contents){const i=r.createElementNS(we,"contents");i.textContent=t.contents,n.appendChild(i)}return n}static serializeShape(t,n,r){if(t.contents){const i=r.createElementNS(we,"contents");i.textContent=t.contents,n.appendChild(i)}return t.borderStyle?.width!==void 0&&n.setAttribute("width",String(t.borderStyle.width)),t.backgroundColor&&n.setAttribute("interior-color",bc(t.backgroundColor)),n}static serializeLine(t,n,r){const i=t.vertices;if(i&&i.length>=4&&(n.setAttribute("start",`${i[0].toFixed(4)},${i[1].toFixed(4)}`),n.setAttribute("end",`${i[2].toFixed(4)},${i[3].toFixed(4)}`)),t.contents){const o=r.createElementNS(we,"contents");o.textContent=t.contents,n.appendChild(o)}return n}static serializeVertexAnnotation(t,n,r){const i=t.vertices;if(i&&i.length>=2){const o=[];for(let s=0;s+1<i.length;s+=2)o.push(`${i[s].toFixed(4)},${i[s+1].toFixed(4)}`);n.setAttribute("vertices",o.join(";"))}if(t.contents){const o=r.createElementNS(we,"contents");o.textContent=t.contents,n.appendChild(o)}return n}static exportToXfdf(t,n){const r=document.implementation.createDocument(we,"xfdf",null),i=r.documentElement;i.setAttribute("xmlns",we),i.setAttribute("xml:space","preserve");const o=r.createElementNS(we,"f");o.setAttribute("href",n??"document.pdf"),i.appendChild(o);const s=r.createElementNS(we,"annots"),c=new Map,l=new Map;for(const d of t){if(!d.id)continue;const u=c.get(d.id)??0;c.set(d.id,u+1)}const a=new Set;for(const d of t)if(!!d.id&&c.get(d.id)>1){const u=a.has(d.id)?`-${Array.from(a).filter(y=>y===d.id||y.startsWith(d.id+"-")).length+1}`:"",f=d.id+u;l.set(d.id,f),a.add(d.id)}for(const d of t){const u=l.size>0&&d.id&&l.has(d.id)?{...d,id:l.get(d.id)??d.id,inReplyTo:d.inReplyTo&&l.has(d.inReplyTo)?l.get(d.inReplyTo)??d.inReplyTo:d.inReplyTo}:d,f=de.serializeAnnotation(u,r);f&&s.appendChild(f)}return i.appendChild(s),`<?xml version="1.0" encoding="UTF-8"?>
17
- ${new XMLSerializer().serializeToString(r)}`}static parseAnnotationElement(t,n){const r=t.localName.toLowerCase(),i=gu[r];if(i===void 0)return{annotation:null,skipped:{elementName:r,page:-1,reason:`Unsupported annotation type: ${r}`}};const o=t.getAttribute("page"),s=o!==null?parseInt(o,10):0;if(isNaN(s)||s<0||s>=n)return{annotation:null,skipped:{elementName:r,page:s,reason:`Page ${s} out of range (document has ${n} pages)`}};const c=t.getAttribute("rect");if(!c)return{annotation:null,skipped:{elementName:r,page:s,reason:"Missing required 'rect' attribute"}};const l=c.split(",").map(parseFloat);if(l.length!==4||l.some(isNaN))return{annotation:null,skipped:{elementName:r,page:s,reason:`Invalid rect value: ${c}`}};const a=t.getAttribute("color"),h=a?mc(a):void 0,d=t.getAttribute("name")??void 0,u=t.getAttribute("title")??void 0,f=t.getAttribute("date"),y=t.getAttribute("creationdate"),_=t.getAttribute("opacity"),x=t.getAttribute("rotation"),w=t.getAttribute("inreplyto")??void 0,T={id:d??null,annotationType:i,rotation:x?parseInt(x,10):0,rect:l,pageIndex:s,color:h,opacity:_?parseFloat(_):1,titleObj:u?{dir:"ltr",str:u}:void 0,modificationDate:f??void 0,creationDate:y??void 0,inReplyTo:w};switch(i){case z.AnnotationType.Highlight:case z.AnnotationType.Underline:case z.AnnotationType.StrikeOut:case z.AnnotationType.Squiggly:de.parseTextMarkup(t,T,a);break;case z.AnnotationType.FreeText:de.parseFreeText(t,T);break;case z.AnnotationType.Stamp:de.parseStamp(t,T);break;case z.AnnotationType.Ink:de.parseInk(t,T);break;case z.AnnotationType.Popup:de.parsePopup(t,T);break;case z.AnnotationType.Square:case z.AnnotationType.Circle:de.parseShape(t,T);break;case z.AnnotationType.Line:de.parseLine(t,T);break;case z.AnnotationType.Polygon:case z.AnnotationType.Polyline:de.parseVertexAnnotation(t,T);break}return{annotation:T,skipped:null}}static parseTextMarkup(t,n,r){const i=t.getAttribute("coords")??t.querySelector("coords")?.textContent;if(i){const s=i.split(",").map(parseFloat);s.length>0&&!s.some(isNaN)&&(n.quadPoints=new Float32Array(s))}const o=t.querySelector("contents");o?.textContent&&(n.contents=o.textContent),r&&(n.hexColor=r)}static parseFreeText(t,n){const r=t.querySelector("contents");r?.textContent&&(n.value=r.textContent,n.contents=r.textContent);const i=t.querySelector("defaultappearance");if(i?.textContent){const o=i.textContent.trim(),s=o.match(/\/(\S+)\s+([\d.]+)\s+Tf/),c=o.match(/([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+rg/),l=s?s[1]:"Helvetica",a=s?parseFloat(s[2]):12,h=c?new Uint8ClampedArray([Math.round(parseFloat(c[1])*255),Math.round(parseFloat(c[2])*255),Math.round(parseFloat(c[3])*255)]):new Uint8ClampedArray([0,0,0]);n.defaultAppearanceData={fontName:l,fontSize:a,fontColor:h},n.fontSize=a,!n.color&&c&&(n.color=h)}}static parseStamp(t,n){const r=t.getAttribute("icon");r&&(n.iconName=r);const i=t.querySelector("contents");i?.textContent&&(n.contents=i.textContent);const s=t.querySelector("imagedata")?.textContent?.trim();s&&(n.imageDataUrl=s),n.hasOwnCanvas=!0}static parseInk(t,n){const r=t.querySelector("inklist");if(r){const o=r.querySelectorAll("gesture"),s=[];for(const c of Array.from(o)){if(!c.textContent)continue;const l=[];for(const a of c.textContent.split(";").filter(Boolean)){const[h,d]=a.split(",").map(parseFloat);!isNaN(h)&&!isNaN(d)&&l.push(h,d)}l.length>=4&&s.push(l)}s.length>0&&(n.inkLists=s)}const i=t.getAttribute("width");i&&(n.borderStyle={dashArray:[],horizontalCornerRadius:0,style:0,verticalCornerRadius:0,width:parseFloat(i),rawWidth:parseFloat(i)})}static parsePopup(t,n){const r=t.getAttribute("icon");n.iconName=r??"Comment";const i=t.querySelector("contents");i?.textContent&&(n.contents=i.textContent)}static parseShape(t,n){const r=t.querySelector("contents");r?.textContent&&(n.contents=r.textContent);const i=t.getAttribute("width");if(i){const s=parseFloat(i);n.borderStyle={dashArray:[],horizontalCornerRadius:0,style:0,verticalCornerRadius:0,width:s,rawWidth:s}}const o=t.getAttribute("interior-color");o&&(n.backgroundColor=mc(o))}static parseLine(t,n){const r=t.getAttribute("start"),i=t.getAttribute("end");if(r&&i){const s=r.split(",").map(parseFloat),c=i.split(",").map(parseFloat);s.length===2&&c.length===2&&!s.some(isNaN)&&!c.some(isNaN)&&(n.vertices=[...s,...c])}const o=t.querySelector("contents");o?.textContent&&(n.contents=o.textContent)}static parseVertexAnnotation(t,n){const r=t.getAttribute("vertices");if(r){const o=[];for(const s of r.split(";")){const c=s.trim().split(",").map(parseFloat);c.length===2&&!c.some(isNaN)&&o.push(c[0],c[1])}o.length>=2&&(n.vertices=o)}const i=t.querySelector("contents");i?.textContent&&(n.contents=i.textContent)}static importFromXfdf(t,n){const r={annotations:[],skipped:[],errors:[]};let i;try{i=new DOMParser().parseFromString(t,"application/xml")}catch(u){return r.errors.push(`Failed to parse XML: ${u}`),r}const o=i.querySelector("parsererror");if(o)return r.errors.push(`Invalid XML: ${o.textContent?.trim()??"parse error"}`),r;const s=i.documentElement;if(!s||s.localName.toLowerCase()!=="xfdf")return r.errors.push(`Invalid XFDF: root element must be <xfdf>, got <${s?.localName??"unknown"}>`),r;const c=s.getAttribute("xmlns");c&&c!==we&&r.errors.push(`Warning: unexpected namespace '${c}', attempting tag-name matching`);const l=s.querySelector("annots");if(!l)return r;const a=Array.from(l.children);if(a.length===0)return r;const h=new Set,d=new Set;for(const u of a){const{annotation:f,skipped:y}=de.parseAnnotationElement(u,n);if(y){r.skipped.push(y);continue}f&&(f.id&&(h.has(f.id)?(d.add(f.id),r.errors.push(`Duplicate annotation name: ${f.id}`)):h.add(f.id)),r.annotations.push(f))}for(const u of r.annotations)u.inReplyTo&&!h.has(u.inReplyTo)&&(r.errors.push(`Orphaned inreplyto reference: ${u.inReplyTo}`),u.inReplyTo=void 0);return r}}const mu={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},yu=e=>e.startsWith("#")||e.startsWith("0x")?e:mu[e]||e,Rn=g.defineComponent({__name:"AppTooltip",setup(e){const t=g.inject(En),n=g.computed(()=>t?.AppTooltip);return(r,i)=>n.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.value),g.normalizeProps(g.mergeProps({key:0},r.$attrs)),g.createSlots({default:g.withCtx(()=>[g.renderSlot(r.$slots,"default")]),_:2},[g.renderList(r.$slots,(o,s)=>({name:s,fn:g.withCtx(()=>[g.renderSlot(r.$slots,s)])}))]),1040)):(g.openBlock(),g.createElementBlock("div",g.normalizeProps(g.mergeProps({key:1},r.$attrs)),[g.renderSlot(r.$slots,"default")],16))}}),In=g.defineComponent({inheritAttrs:!1,__name:"AppButton",props:{ariaLabel:{},ariaDisabled:{type:Boolean}},setup(e){const t=e,n=g.useAttrs(),r=g.inject(En),i=g.computed(()=>r?.AppButton),o=g.computed(()=>({"aria-label":t.ariaLabel,"aria-disabled":t.ariaDisabled,...n}));return(s,c)=>i.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(i.value),g.normalizeProps(g.mergeProps({key:0},o.value)),{default:g.withCtx(()=>[g.renderSlot(s.$slots,"default")]),_:3},16)):(g.openBlock(),g.createElementBlock("button",g.normalizeProps(g.mergeProps({key:1},o.value)),[g.renderSlot(s.$slots,"default")],16))}}),wu=(e,t)=>{const n=e[t];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((r,i)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+t)))})},_u=g.defineComponent({__name:"Icon",props:{name:{}},setup(e){const t=e,n=g.defineAsyncComponent({loader:()=>wu(Object.assign({"../assets/icons/annotations.svg":()=>Promise.resolve().then(()=>zu),"../assets/icons/tool-comment.svg":()=>Promise.resolve().then(()=>Lu),"../assets/icons/tool-free-text.svg":()=>Promise.resolve().then(()=>Uu),"../assets/icons/tool-highlight.svg":()=>Promise.resolve().then(()=>Hu),"../assets/icons/tool-image.svg":()=>Promise.resolve().then(()=>Vu),"../assets/icons/tool-signature.svg":()=>Promise.resolve().then(()=>Ku),"../assets/icons/tool-strikethrough.svg":()=>Promise.resolve().then(()=>qu),"../assets/icons/tool-text-selection.svg":()=>Promise.resolve().then(()=>Yu),"../assets/icons/tool-underline.svg":()=>Promise.resolve().then(()=>Qu)}),`../assets/icons/${t.name}.svg`)});return(r,i)=>(g.openBlock(),g.createBlock(g.resolveDynamicComponent(g.unref(n)),{class:"vp-text-xl"}))}}),a0="",po=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},ft=po(_u,[["__scopeId","data-v-9d5f0033"]]),On=()=>{const e=g.inject(gc,g.computed(()=>({})));return{t:g.computed(()=>n=>{const r=n.split(".").pop()||n;return e.value&&r in e.value?e.value[r]:(console.warn(`useLocalization - Translation not found for key: ${n}`),n)}).value,currentLocale:g.computed(()=>e.value)}},xu=g.defineComponent({__name:"ToolAnnotation",emits:["toggle"],setup(e,{emit:t}){const{t:n}=On(),r=t,i=g.ref(!1),o=()=>{i.value=!i.value,r("toggle",i.value)};return(s,c)=>s.$slots.default?g.renderSlot(s.$slots,"default",{key:0,onClick:o},void 0,!0):(g.openBlock(),g.createBlock(Rn,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(i.value?g.unref(n)("annotationToggleHideTooltip"):g.unref(n)("annotationToggleShowTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(In,{"aria-label":i.value?g.unref(n)("annotationToggleHideTooltip"):g.unref(n)("annotationToggleShowTooltip"),class:g.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":i.value}]),onClick:o},{default:g.withCtx(()=>[g.createVNode(ft,{name:"annotations",class:"vp-text-xl"})]),_:1},8,["aria-label","class"])]),_:1}))}}),c0="",Su=po(xu,[["__scopeId","data-v-df5778ee"]]),vu=g.defineComponent({__name:"ToolAnnotationTextSelection",props:g.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=g.useModel(e,"active"),{t:r}=On(),i=g.computed(()=>t.ariaDisabled===!0),o=()=>{i.value||(n.value=!n.value)};return(s,c)=>s.$slots.default?g.renderSlot(s.$slots,"default",g.mergeProps({key:0},s.$attrs,{onClick:o})):(g.openBlock(),g.createBlock(Rn,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationTextSelectionTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(In,g.mergeProps({"aria-label":g.unref(r)("annotationTextSelectionLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},s.$attrs,{onClick:o}),{default:g.withCtx(()=>[g.renderSlot(s.$slots,"icon",{},()=>[g.createVNode(ft,{name:"tool-text-selection"})])]),_:3},16,["aria-label","class"])]),_:3}))}}),ku=g.defineComponent({__name:"AppPopover",props:{open:{type:Boolean},side:{},sideOffset:{},class:{},ariaLabel:{}},setup(e){const t=e,n=g.inject(En),r=g.computed(()=>n?.AppPopover);return(i,o)=>r.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(r.value),g.normalizeProps(g.mergeProps({key:0},t)),{trigger:g.withCtx(()=>[g.renderSlot(i.$slots,"trigger")]),default:g.withCtx(()=>[g.renderSlot(i.$slots,"default")]),_:3},16)):(g.openBlock(),g.createElementBlock("button",g.normalizeProps(g.mergeProps({key:1},t)),[g.renderSlot(i.$slots,"default")],16))}}),Au=g.defineComponent({__name:"AppSignatures",setup(e){const t=g.inject(En),n=g.computed(()=>t?.AppSignatures);return(r,i)=>n.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.value),g.normalizeProps(g.mergeProps({key:0},r.$attrs)),null,16)):g.createCommentVNode("",!0)}}),Cu=g.defineComponent({__name:"ToolAnnotationSignature",props:g.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=g.useModel(e,"active"),{t:r}=On(),i=g.ref(!1),o=g.computed(()=>t.ariaDisabled===!0),s=()=>{o.value||(!n.value&&!i.value&&(i.value=!0),n.value=!n.value)},c=l=>{i.value=!1};return(l,a)=>l.$slots.default?g.renderSlot(l.$slots,"default",g.mergeProps({key:0},l.$attrs,{onClick:s})):(g.openBlock(),g.createBlock(ku,{key:1,open:i.value,side:"right",sideOffset:10,class:"vpv-annotation-signatures__popover",onInteractOutside:c},{trigger:g.withCtx(()=>[g.createVNode(Rn,null,{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationSignatureTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(In,g.mergeProps({"aria-label":g.unref(r)("annotationSignatureLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},l.$attrs,{onClick:s}),{default:g.withCtx(()=>[g.renderSlot(l.$slots,"icon",{},()=>[g.createVNode(ft,{name:"tool-signature"})])]),_:3},16,["aria-label","class"])]),_:3})]),default:g.withCtx(()=>[g.createVNode(Au)]),_:3},8,["open"]))}}),Tu=g.defineComponent({__name:"ToolAnnotationFreeText",props:g.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=g.useModel(e,"active"),{t:r}=On(),i=g.computed(()=>t.ariaDisabled===!0),o=()=>{i.value||(n.value=!n.value)};return(s,c)=>s.$slots.default?g.renderSlot(s.$slots,"default",g.mergeProps({key:0},s.$attrs,{onClick:o})):(g.openBlock(),g.createBlock(Rn,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationFreeTextTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(In,g.mergeProps({"aria-label":g.unref(r)("annotationFreeTextLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},s.$attrs,{onClick:o}),{default:g.withCtx(()=>[g.renderSlot(s.$slots,"icon",{},()=>[g.createVNode(ft,{name:"tool-free-text"})])]),_:3},16,["aria-label","class"])]),_:3}))}}),Bu=g.defineComponent({__name:"ToolAnnotationImage",props:{ariaDisabled:{type:Boolean}},emits:["change"],setup(e,{emit:t}){const n=e,{t:r}=On(),i=t,o=g.computed(()=>n.ariaDisabled===!0),s=()=>{if(o.value)return;const c=document.createElement("input");c.type="file",c.accept="image/*",c.onchange=l=>{const a=l.target.files?.[0];i("change",a)},c.click()};return(c,l)=>c.$slots.default?g.renderSlot(c.$slots,"default",g.mergeProps({key:0},c.$attrs,{onClick:s})):(g.openBlock(),g.createBlock(Rn,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationImageTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(In,g.mergeProps({"aria-label":g.unref(r)("annotationImageLabel"),class:"vpv-toolbar-btn"},c.$attrs,{onClick:s}),{default:g.withCtx(()=>[g.renderSlot(c.$slots,"icon",{},()=>[g.createVNode(ft,{name:"tool-image"})])]),_:3},16,["aria-label"])]),_:3}))}}),l0="",yc={B:1,K:1e3,KB:1e3,M:1e3**2,MB:1e3**2,G:1e3**3,GB:1e3**3,T:1e3**4,TB:1e3**4};function Du(e){if(!e||typeof e!="string")return{isValid:!1,bytes:0,error:"Size input is required and must be a string"};const n=e.trim().toUpperCase().match(/^(\d*\.?\d+)\s*([KMGTB]B?)?$/);if(!n)return{isValid:!1,bytes:0,error:'Invalid format. Expected: number + optional unit (e.g., "10MB", "1.5G", "512")'};const[,r,i="B"]=n,o=parseFloat(r);if(isNaN(o)||o<0)return{isValid:!1,bytes:0,error:"Size must be a positive number"};const s=i;return s in yc?{isValid:!0,bytes:Math.floor(o*yc[s])}:{isValid:!1,bytes:0,error:`Unsupported unit "${i}". Supported: B, K, KB, M, MB, G, GB, T, TB`}}function Eu(e,t=1){if(e===0)return"0 B";const n=["B","KB","MB","GB","TB"],r=1e3,i=Math.floor(Math.log(e)/Math.log(r)),o=e/Math.pow(r,i);return`${t===0?Math.round(o):o.toFixed(t)} ${n[i]}`}function Pu(e){const t=Du(e);if(!t.isValid)throw new Error(t.error);return t.bytes}const Ru={class:"vpv-annotation-tools-container"},Iu={key:0,class:"vpv-annotation-tools"},Ou=g.defineComponent({__name:"VPdfAnnotationTools",props:{textSelection:{type:[Object,Boolean],default:()=>!0},freeText:{type:[Object,Boolean],default:()=>!0},signature:{type:[Object,Boolean],default:()=>!1},image:{type:[Object,Boolean],default:()=>!0},instanceId:{type:Number,required:!0},onAnnotationCreated:{type:Function,default:void 0},onAnnotationUpdated:{type:Function,default:void 0},onAnnotationDeleted:{type:Function,default:void 0}},emits:["textSelection","freeText","signature","image"],setup(e,{emit:t}){const n=e,r=t,i=g.ref(!1),o=O=>qt(n.instanceId,O),s={textSelection:new CustomEvent(o(Zt.textSelection),{detail:{active:!1,highlight:null,strikethrough:null,underline:null}}),freeText:new CustomEvent(o(Zt.freeText),{detail:{active:!1,fontColors:null,fontSizes:null}}),signature:new CustomEvent(o(Zt.signature),{detail:{active:!1}}),image:new CustomEvent(o(Zt.image),{detail:{file:void 0}}),error:new CustomEvent(o(Cr.ShowNotificationError),{detail:{error:void 0,maxSize:void 0}})},c=g.ref(!1),l=g.reactive({textSelection:!1,freeText:!1,signature:!1}),a=g.computed({get:()=>l.textSelection,set:O=>{l.textSelection=O,O&&(l.freeText=!1,l.signature=!1),E()}}),h=g.computed({get:()=>l.freeText,set:O=>{O&&(l.textSelection=!1,l.signature=!1),l.freeText=O,E()}}),d=g.computed({get:()=>l.signature,set:O=>{O&&(l.textSelection=!1,l.freeText=!1),l.signature=O,E()}}),u=g.computed(()=>n.textSelection),f=g.computed(()=>n.freeText),y=g.computed(()=>n.signature),_=g.computed(()=>n.image);function x(O){return O.map(P=>typeof P=="string"?{value:yu(P),label:P}:P)}const w=O=>{c.value=O,O||(a.value=!1,h.value=!1,d.value=!1)},T=Object.entries(lu).map(([O,P])=>({value:O,label:P})),v=Object.entries(hu).map(([O,P])=>({value:O,label:P})),S=Object.entries(du).map(([O,P])=>({value:O,label:P})),N=O=>{r("textSelection",O),s.textSelection.detail.active=O;let P={icon:g.markRaw(g.h(ft,{name:"tool-highlight"}))},D={icon:g.markRaw(g.h(ft,{name:"tool-strikethrough"}))},$={icon:g.markRaw(g.h(ft,{name:"tool-underline"}))};if(typeof n.textSelection=="object"){const{highlight:oe,strikethrough:he,underline:be}=n.textSelection;oe===!1?P=!1:typeof oe=="object"&&(P={...P,...oe},oe.icon&&typeof oe.icon=="object"&&(P.icon=g.markRaw(oe.icon))),he===!1?D=!1:typeof he=="object"&&(D={...D,...he},he.icon&&typeof he.icon=="object"&&(D.icon=g.markRaw(he.icon))),be===!1?$=!1:typeof be=="object"&&($={...$,...be},be.icon&&typeof be.icon=="object"&&($.icon=g.markRaw(be.icon)))}P&&typeof P=="object"&&(P.colors?P.colors=x(P.colors):P.colors=T),$&&typeof $=="object"&&($.colors?$.colors=x($.colors):$.colors=v),D&&typeof D=="object"&&(D.colors?D.colors=x(D.colors):D.colors=S),s.textSelection.detail.highlight=P,s.textSelection.detail.strikethrough=D,s.textSelection.detail.underline=$,window.dispatchEvent(s.textSelection)},C=O=>{r("freeText",O),s.freeText.detail.active=O;let P=Object.entries(fu).map(([D,$])=>({value:D,label:$}));typeof n.freeText=="object"&&n.freeText?.fontColors&&(P=x(n.freeText.fontColors)),s.freeText.detail.fontColors=P,typeof n.freeText=="object"&&n.freeText?.fontSizes?.length&&(s.freeText.detail.fontSizes=n.freeText.fontSizes),window.dispatchEvent(s.freeText)},k=O=>{r("signature",O),s.signature.detail.active=O,window.dispatchEvent(s.signature)},F=(O,P="1MB",D=[Le.APNG,Le.AVIF,Le.BMP,Le.GIF,Le.ICON,Le.JPEG,Le.PNG,Le.SVG,Le.WEBP])=>{if(!O)return{isValid:!0};if(typeof P<"u"){let $;if(typeof P=="number"?$=P:$=Pu(P),O.size>$)return{isValid:!1,error:Ar.FileSizeExceeded,maxSize:Eu($)}}return D&&D.length>0&&!D.includes(O.type)?{isValid:!1,error:Ar.UnsupportedFileType}:{isValid:!0}},I=O=>{const P=n.image,D=F(O,P?.maxSize,P?.types);if(!D.isValid){s.error.detail.error=D?.error,s.error.detail.maxSize=D?.maxSize,window.dispatchEvent(s.error);return}l.textSelection=!1,l.freeText=!1,l.signature=!1,r("image",O),s.image.detail.file=O,window.dispatchEvent(s.image)};function E(){N(a.value),C(h.value),k(d.value)}const R=qt(n.instanceId,Pn.Rotate);g.onMounted(()=>{window.dispatchEvent(new CustomEvent(qt(n.instanceId,Pn.AnnotationMounted))),window.addEventListener(R,Q),E()});function Q(O){const{rotation:P}=O.detail;i.value=P!==0}g.watch(i,O=>{O&&(l.textSelection=!1,l.freeText=!1,l.signature=!1,E())});const M=O=>{const{id:P,...D}=O;return{...D,id:P?.startsWith(uu)?null:P}};return g.watch(()=>n.onAnnotationCreated,(O,P,D)=>{if(!O)return;const $=he=>{O(M(he.detail))},oe=qt(n.instanceId,Pn.AnnotationCreated);window.addEventListener(oe,$),D(()=>{window.removeEventListener(oe,$)})},{immediate:!0}),g.watch(()=>n.onAnnotationUpdated,(O,P,D)=>{if(!O)return;const $=he=>{O(M(he.detail))},oe=qt(n.instanceId,Pn.AnnotationUpdated);window.addEventListener(oe,$),D(()=>{window.removeEventListener(oe,$)})},{immediate:!0}),g.watch(()=>n.onAnnotationDeleted,(O,P,D)=>{if(!O)return;const $=he=>{O(M(he.detail))},oe=qt(n.instanceId,Pn.AnnotationDeleted);window.addEventListener(oe,$),D(()=>{window.removeEventListener(oe,$)})},{immediate:!0}),g.onUnmounted(()=>{window.removeEventListener(R,Q)}),(O,P)=>(g.openBlock(),g.createElementBlock("div",Ru,[g.createVNode(Su,{onToggle:w}),g.createVNode(g.Transition,{name:"slide"},{default:g.withCtx(()=>[c.value?(g.openBlock(),g.createElementBlock("div",Iu,[u.value?(g.openBlock(),g.createBlock(vu,{key:0,active:a.value,"onUpdate:active":P[0]||(P[0]=D=>a.value=D),"aria-disabled":i.value},g.createSlots({_:2},[typeof n.textSelection=="object"&&n.textSelection.icon?{name:"icon",fn:g.withCtx(()=>[typeof n.textSelection=="object"&&n.textSelection.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.textSelection.icon),{key:0})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.textSelection=="object"&&n.textSelection.component?{name:"default",fn:g.withCtx(({onClick:D})=>[typeof n.textSelection=="object"&&n.textSelection.component?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.textSelection.component),{key:0,onClick:D},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):g.createCommentVNode("",!0),f.value?(g.openBlock(),g.createBlock(Tu,{key:1,active:h.value,"onUpdate:active":P[1]||(P[1]=D=>h.value=D),"aria-disabled":i.value},g.createSlots({_:2},[typeof n.freeText=="object"&&n.freeText.icon?{name:"icon",fn:g.withCtx(()=>[typeof n.freeText=="object"&&n.freeText.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.freeText.icon),{key:0})):g.createCommentVNode("",!0),typeof n.freeText=="object"&&n.freeText.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.freeText.icon),{key:1})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.freeText=="object"&&n.freeText.component?{name:"default",fn:g.withCtx(({onClick:D})=>[typeof n.freeText=="object"&&n.freeText.component?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.freeText.component),{key:0,onClick:D},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):g.createCommentVNode("",!0),_.value?(g.openBlock(),g.createBlock(Bu,{key:2,onChange:I,"aria-disabled":i.value},g.createSlots({_:2},[typeof n.image=="object"&&n.image?{name:"icon",fn:g.withCtx(()=>[typeof n.image=="object"&&n.image.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.image.icon),{key:0})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.image=="object"&&n.image&&"component"in n.image?{name:"default",fn:g.withCtx(({onClick:D})=>[typeof n.image=="object"&&n.image&&"component"in n.image?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.image.component),{key:0,onClick:D},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["aria-disabled"])):g.createCommentVNode("",!0),y.value?(g.openBlock(),g.createBlock(Cu,{key:3,active:d.value,"onUpdate:active":P[2]||(P[2]=D=>d.value=D),"aria-disabled":i.value},g.createSlots({_:2},[typeof n.signature=="object"&&n.signature.icon?{name:"icon",fn:g.withCtx(()=>[typeof n.signature=="object"&&n.signature.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.signature.icon),{key:0})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.signature=="object"&&n.signature.component?{name:"default",fn:g.withCtx(({onClick:D})=>[typeof n.signature=="object"&&n.signature.component?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.signature.component),{key:0,onClick:D},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):g.createCommentVNode("",!0)])):g.createCommentVNode("",!0)]),_:1})]))}}),h0="",wc=po(Ou,[["__scopeId","data-v-c9502027"]]),Nu=(e={})=>{const{textSelection:t,freeText:n,image:r,...i}=e;let o=null;return{name:"annotation",setup(s){const{componentInstance:c,shared:l}=s,a=c?.uid??0;s.toolbar.addItem({id:cu.ANNOTATIONS,toolbarDirection:"left",component:g.h(wc,{textSelection:t,freeText:n,image:r,instanceId:a,...i})});const h=c?.appContext.app;l.ui?h.provide(En,l.ui):console.warn("VPdfAnnotationPlugin - No UI context found in plugin context"),l.localization?.value?h.provide(gc,l.localization):console.warn("VPdfAnnotationPlugin - No localization found in plugin context"),l.pdf||console.warn("VPdfAnnotationPlugin - PDF context not available"),o={exportToXfdf:(d,u)=>de.exportToXfdf(d,u),importFromXfdf:(d,u)=>de.importFromXfdf(d,u),exportToPdf:async(d,u)=>{const f=await l.pdf?.getOriginalBytes();if(!f)return console.error("[exportToPdf] originalBytes is null - cannot serialize text markup annotations. Check if PDF source type is supported."),null;try{const y=await bu.serializeAnnotationsToPdf(f,d,u);return console.debug("[exportToPdf] Serialization successful, result size:",y.byteLength),y}catch(y){throw console.error("[exportToPdf] Serialization failed:",y),y}}}},getApi:()=>o}},Fu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function _c(e,t){return g.openBlock(),g.createElementBlock("svg",Fu,[...t[0]||(t[0]=[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M10 18.334a8.333 8.333 0 1 0 0-16.667 8.333 8.333 0 0 0 0 16.667"},null,-1),g.createElementVNode("path",{stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.25",d:"m5.417 17.084 1.171-4.394c.238-.892.357-1.338.694-1.597s.798-.259 1.722-.259h1.992c.923 0 1.385 0 1.722.259.337.258.456.705.693 1.597l1.172 4.394"},null,-1),g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M7.917 10.834 9.23 7.8c.327-.756.491-1.134.769-1.134s.441.378.77 1.134l1.313 3.033"},null,-1)])])}const zu=Object.freeze(Object.defineProperty({__proto__:null,render:_c,default:{render:_c}},Symbol.toStringTag,{value:"Module"})),Mu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function xc(e,t){return g.openBlock(),g.createElementBlock("svg",Mu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M18.125 9.688a7.82 7.82 0 0 1-7.812 7.812H3.75a1.25 1.25 0 0 1-1.25-1.25V9.688a7.812 7.812 0 0 1 15.625 0m-1.25 0a6.563 6.563 0 0 0-13.125 0v6.562h6.563a6.57 6.57 0 0 0 6.562-6.562"},null,-1),g.createElementVNode("path",{fill:"currentColor",d:"M12.5 10a.624.624 0 0 1-.625.625h-1.25v1.25a.624.624 0 1 1-1.25 0v-1.25h-1.25a.625.625 0 1 1 0-1.25h1.25v-1.25a.625.625 0 0 1 1.25 0v1.25h1.25A.625.625 0 0 1 12.5 10"},null,-1)])])}const Lu=Object.freeze(Object.defineProperty({__proto__:null,render:xc,default:{render:xc}},Symbol.toStringTag,{value:"Module"})),ju={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function Sc(e,t){return g.openBlock(),g.createElementBlock("svg",ju,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M11.458 13.75a.624.624 0 1 0 0-1.25h-.625v-5h2.5v.625a.625.625 0 0 0 1.25 0v-1.25a.625.625 0 0 0-.625-.625h-7.5a.625.625 0 0 0-.625.625v1.25a.625.625 0 0 0 1.25 0V7.5h2.5v5h-.625a.625.625 0 1 0 0 1.25z"},null,-1),g.createElementVNode("path",{fill:"currentColor","fill-rule":"evenodd",d:"M3.125 3.75c0-.115.093-.208.208-.208h13.334c.115 0 .208.093.208.208v2.917a.625.625 0 1 0 1.25 0V3.75c0-.805-.653-1.458-1.458-1.458H3.333c-.805 0-1.458.653-1.458 1.458v3.334a.625.625 0 1 0 1.25 0zm0 12.5c0 .115.093.209.208.209h13.334a.21.21 0 0 0 .208-.209v-2.916a.625.625 0 1 1 1.25 0v2.916c0 .806-.653 1.459-1.458 1.459H3.333a1.46 1.46 0 0 1-1.458-1.459v-3.333a.625.625 0 1 1 1.25 0zM2.5 8.542c.345 0 .625.28.625.625v1.667a.625.625 0 0 1-1.25 0V9.167c0-.345.28-.625.625-.625m15.625.625a.625.625 0 1 0-1.25 0v1.667a.625.625 0 0 0 1.25 0z","clip-rule":"evenodd"},null,-1)])])}const Uu=Object.freeze(Object.defineProperty({__proto__:null,render:Sc,default:{render:Sc}},Symbol.toStringTag,{value:"Module"})),$u={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function vc(e,t){return g.openBlock(),g.createElementBlock("svg",$u,[...t[0]||(t[0]=[g.createElementVNode("g",{"clip-path":"url(#a)"},[g.createElementVNode("path",{fill:"currentColor",d:"M19.818 8.308a.625.625 0 0 0-.885 0L15 12.242 8.384 5.625l3.934-3.932a.626.626 0 0 0-.885-.885L7.5 4.742a1.25 1.25 0 0 0-.22 1.47L5.625 7.866a1.25 1.25 0 0 0 0 1.767l.367.366-4.559 4.558a.625.625 0 0 0 .245 1.035l5.625 1.875a.62.62 0 0 0 .437-.015.6.6 0 0 0 .203-.136l2.682-2.683.367.366a1.25 1.25 0 0 0 1.767 0l1.656-1.654a1.25 1.25 0 0 0 1.469-.22l3.934-3.933a.626.626 0 0 0 0-.885M7.332 16.16l-4.297-1.433 3.84-3.843 2.867 2.866zm4.543-2.043L6.51 8.75l1.616-1.616 5.367 5.366z"})],-1),g.createElementVNode("defs",null,[g.createElementVNode("clipPath",{id:"a"},[g.createElementVNode("path",{fill:"currentColor",d:"M0 0h20v20H0z"})])],-1)])])}const Hu=Object.freeze(Object.defineProperty({__proto__:null,render:vc,default:{render:vc}},Symbol.toStringTag,{value:"Module"})),Gu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function kc(e,t){return g.openBlock(),g.createElementBlock("svg",Gu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M16.875 3.125H3.125a1.25 1.25 0 0 0-1.25 1.25v11.25a1.25 1.25 0 0 0 1.25 1.25h13.75a1.25 1.25 0 0 0 1.25-1.25V4.375a1.25 1.25 0 0 0-1.25-1.25m0 1.25v8.027l-2.037-2.036a1.25 1.25 0 0 0-1.768 0l-1.562 1.563L8.07 8.49a1.25 1.25 0 0 0-1.767 0L3.125 11.67V4.376zm-13.75 9.063 4.063-4.063 6.25 6.25H3.124zm13.75 2.187h-1.67l-2.812-2.812 1.563-1.563 2.919 2.92zM11.25 7.813a.938.938 0 1 1 1.875 0 .938.938 0 0 1-1.875 0"},null,-1)])])}const Vu=Object.freeze(Object.defineProperty({__proto__:null,render:kc,default:{render:kc}},Symbol.toStringTag,{value:"Module"})),Wu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function Ac(e,t){return g.openBlock(),g.createElementBlock("svg",Wu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M18.125 13.125H4.99q.313-.615.625-1.259c1.172.13 2.546-.685 4.114-2.432.391 1.051 1.13 2.416 2.39 2.441.707.014 1.414-.406 2.142-1.279.53.634 1.623 1.279 3.865 1.279a.625.625 0 1 0 0-1.25c-2.377 0-3.08-.816-3.125-1.259a.6.6 0 0 0-.426-.605.636.636 0 0 0-.723.273c-.943 1.448-1.514 1.596-1.713 1.591-.645-.012-1.301-1.525-1.526-2.61a.625.625 0 0 0-1.1-.264c-1.579 1.98-2.637 2.646-3.295 2.818.663-1.474 1.158-2.768 1.475-3.858.533-1.831.572-3.112.118-3.914-.234-.42-.73-.922-1.723-.922-1.255 0-2.245 1.186-2.716 3.254-.28 1.227-.327 2.594-.127 3.75.2 1.155.615 1.996 1.218 2.495a72 72 0 0 1-.877 1.751h-1.71a.625.625 0 1 0 0 1.25h1.048c-.884 1.64-1.572 2.784-1.583 2.803a.625.625 0 1 0 1.071.644c.012-.02.88-1.468 1.93-3.447h13.784a.625.625 0 1 0 0-1.25M4.59 5.407c.311-1.365.914-2.282 1.498-2.282.416 0 .555.145.635.287.235.416.51 1.89-1.692 6.749-.645-.881-.865-2.895-.44-4.754"},null,-1)])])}const Ku=Object.freeze(Object.defineProperty({__proto__:null,render:Ac,default:{render:Ac}},Symbol.toStringTag,{value:"Module"})),Zu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function Cc(e,t){return g.openBlock(),g.createElementBlock("svg",Zu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M17.5 10a.624.624 0 0 1-.625.625h-3.13c.718.556 1.255 1.344 1.255 2.5 0 1.042-.547 2.008-1.543 2.718-.931.666-2.16 1.032-3.457 1.032-1.298 0-2.526-.366-3.457-1.032C5.547 15.133 5 14.167 5 13.125a.625.625 0 1 1 1.25 0c0 1.355 1.719 2.5 3.75 2.5s3.75-1.145 3.75-2.5c0-1.16-.823-1.842-3.029-2.5H3.125a.625.625 0 1 1 0-1.25h13.75A.625.625 0 0 1 17.5 10M5.963 8.125a.625.625 0 0 0 .595-.82 1.4 1.4 0 0 1-.065-.43c0-1.425 1.508-2.5 3.507-2.5 1.472 0 2.669.58 3.203 1.55a.625.625 0 0 0 1.094-.6c-.756-1.378-2.362-2.2-4.297-2.2-2.712 0-4.757 1.612-4.757 3.75-.001.278.041.555.127.82a.625.625 0 0 0 .593.43"},null,-1)])])}const qu=Object.freeze(Object.defineProperty({__proto__:null,render:Cc,default:{render:Cc}},Symbol.toStringTag,{value:"Module"})),Xu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function Tc(e,t){return g.openBlock(),g.createElementBlock("svg",Xu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M17.916 14.568c.345 0 .625.28.625.625V17.9c0 .345-.28.625-.625.625H2.083a.625.625 0 0 1-.625-.625v-2.708c0-.345.28-.625.625-.625zM2.708 17.276h14.583v-1.458H2.708zm8.333-15.428a.626.626 0 0 1 .88.887L8.39 6.242l3.525 3.524 3.584-3.558a.626.626 0 0 1 .88.887l-4.057 4.03a.63.63 0 0 1-.633.15v.001h.004l.002.002-.018-.004a1 1 0 0 0-.125-.02 2 2 0 0 0-.534.015c-.457.07-1.144.312-1.92 1.07a.625.625 0 0 1-.873 0l-.07-.069-1.173 1.09a.63.63 0 0 1-.426.166H3.75a.625.625 0 0 1-.444-1.065l2.487-2.5-.045-.044a.626.626 0 0 1 0-.894c.775-.757 1.018-1.425 1.09-1.862.035-.224.029-.4.016-.512a1 1 0 0 0-.02-.118l-.004-.012v.001l.002.002V6.52a.63.63 0 0 1 .15-.643zM5.254 12.276h1.058l.948-.88-.444-.435-.13-.127zm6.444-.998h-.003zM8.014 7.634c-.131.537-.412 1.162-.958 1.814l1.627 1.591c.648-.523 1.267-.8 1.802-.934z"},null,-1)])])}const Yu=Object.freeze(Object.defineProperty({__proto__:null,render:Tc,default:{render:Tc}},Symbol.toStringTag,{value:"Module"})),Ju={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function Bc(e,t){return g.openBlock(),g.createElementBlock("svg",Ju,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M15.625 17.5a.624.624 0 0 1-.625.625H5a.625.625 0 1 1 0-1.25h10a.624.624 0 0 1 .625.625M10 15.625a5.005 5.005 0 0 0 5-5v-6.25a.625.625 0 1 0-1.25 0v6.25a3.75 3.75 0 0 1-7.5 0v-6.25a.625.625 0 0 0-1.25 0v6.25a5.005 5.005 0 0 0 5 5"},null,-1)])])}const Qu=Object.freeze(Object.defineProperty({__proto__:null,render:Bc,default:{render:Bc}},Symbol.toStringTag,{value:"Module"}));z.VPdfAnnotationTools=wc,z.default=Nu,Object.defineProperties(z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
17
+ ${new XMLSerializer().serializeToString(r)}`}static parseAnnotationElement(t,n){const r=t.localName.toLowerCase(),i=gu[r];if(i===void 0)return{annotation:null,skipped:{elementName:r,page:-1,reason:`Unsupported annotation type: ${r}`}};const o=t.getAttribute("page"),s=o!==null?parseInt(o,10):0;if(isNaN(s)||s<0||s>=n)return{annotation:null,skipped:{elementName:r,page:s,reason:`Page ${s} out of range (document has ${n} pages)`}};const c=t.getAttribute("rect");if(!c)return{annotation:null,skipped:{elementName:r,page:s,reason:"Missing required 'rect' attribute"}};const l=c.split(",").map(parseFloat);if(l.length!==4||l.some(isNaN))return{annotation:null,skipped:{elementName:r,page:s,reason:`Invalid rect value: ${c}`}};const a=t.getAttribute("color"),h=a?mc(a):void 0,d=t.getAttribute("name")??void 0,u=t.getAttribute("title")??void 0,f=t.getAttribute("date"),y=t.getAttribute("creationdate"),_=t.getAttribute("opacity"),x=t.getAttribute("rotation"),w=t.getAttribute("inreplyto")??void 0,T={id:d??null,annotationType:i,rotation:x?parseInt(x,10):0,rect:l,pageIndex:s,color:h,opacity:_?parseFloat(_):1,titleObj:u?{dir:"ltr",str:u}:void 0,modificationDate:f??void 0,creationDate:y??void 0,inReplyTo:w};switch(i){case z.AnnotationType.Highlight:case z.AnnotationType.Underline:case z.AnnotationType.StrikeOut:case z.AnnotationType.Squiggly:de.parseTextMarkup(t,T,a);break;case z.AnnotationType.FreeText:de.parseFreeText(t,T);break;case z.AnnotationType.Stamp:de.parseStamp(t,T);break;case z.AnnotationType.Ink:de.parseInk(t,T);break;case z.AnnotationType.Popup:de.parsePopup(t,T);break;case z.AnnotationType.Square:case z.AnnotationType.Circle:de.parseShape(t,T);break;case z.AnnotationType.Line:de.parseLine(t,T);break;case z.AnnotationType.Polygon:case z.AnnotationType.Polyline:de.parseVertexAnnotation(t,T);break}return{annotation:T,skipped:null}}static parseTextMarkup(t,n,r){const i=t.getAttribute("coords")??t.querySelector("coords")?.textContent;if(i){const s=i.split(",").map(parseFloat);s.length>0&&!s.some(isNaN)&&(n.quadPoints=new Float32Array(s))}const o=t.querySelector("contents");o?.textContent&&(n.contents=o.textContent),r&&(n.hexColor=r)}static parseFreeText(t,n){const r=t.querySelector("contents")??t.querySelector("contents-richtext");if(r?.textContent){const o=r.textContent.trim();n.value=o,n.contents=o}const i=t.querySelector("defaultappearance");if(i?.textContent){const o=i.textContent.trim(),s=o.match(/\/(\S+)\s+([\d.]+)\s+Tf/),c=o.match(/([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+rg/),l=s?s[1]:"Helvetica",a=s?parseFloat(s[2]):12,h=c?new Uint8ClampedArray([Math.round(parseFloat(c[1])*255),Math.round(parseFloat(c[2])*255),Math.round(parseFloat(c[3])*255)]):new Uint8ClampedArray([0,0,0]);n.defaultAppearanceData={fontName:l,fontSize:a,fontColor:h},n.fontSize=a,c&&(n.color=h)}}static parseStamp(t,n){const r=t.getAttribute("icon");r&&(n.iconName=r);const i=t.querySelector("contents");i?.textContent&&(n.contents=i.textContent);const s=t.querySelector("imagedata")?.textContent?.trim();s&&(n.imageDataUrl=s),n.hasOwnCanvas=!0}static parseInk(t,n){const r=t.querySelector("inklist");if(r){const o=r.querySelectorAll("gesture"),s=[];for(const c of Array.from(o)){if(!c.textContent)continue;const l=[];for(const a of c.textContent.split(";").filter(Boolean)){const[h,d]=a.split(",").map(parseFloat);!isNaN(h)&&!isNaN(d)&&l.push(h,d)}l.length>=4&&s.push(l)}s.length>0&&(n.inkLists=s)}const i=t.getAttribute("width");i&&(n.borderStyle={dashArray:[],horizontalCornerRadius:0,style:0,verticalCornerRadius:0,width:parseFloat(i),rawWidth:parseFloat(i)})}static parsePopup(t,n){const r=t.getAttribute("icon");n.iconName=r??"Comment";const i=t.querySelector("contents");i?.textContent&&(n.contents=i.textContent)}static parseShape(t,n){const r=t.querySelector("contents");r?.textContent&&(n.contents=r.textContent);const i=t.getAttribute("width");if(i){const s=parseFloat(i);n.borderStyle={dashArray:[],horizontalCornerRadius:0,style:0,verticalCornerRadius:0,width:s,rawWidth:s}}const o=t.getAttribute("interior-color");o&&(n.backgroundColor=mc(o))}static parseLine(t,n){const r=t.getAttribute("start"),i=t.getAttribute("end");if(r&&i){const s=r.split(",").map(parseFloat),c=i.split(",").map(parseFloat);s.length===2&&c.length===2&&!s.some(isNaN)&&!c.some(isNaN)&&(n.vertices=[...s,...c])}const o=t.querySelector("contents");o?.textContent&&(n.contents=o.textContent)}static parseVertexAnnotation(t,n){const r=t.getAttribute("vertices");if(r){const o=[];for(const s of r.split(";")){const c=s.trim().split(",").map(parseFloat);c.length===2&&!c.some(isNaN)&&o.push(c[0],c[1])}o.length>=2&&(n.vertices=o)}const i=t.querySelector("contents");i?.textContent&&(n.contents=i.textContent)}static importFromXfdf(t,n){const r={annotations:[],skipped:[],errors:[]};let i;try{i=new DOMParser().parseFromString(t,"application/xml")}catch(u){return r.errors.push(`Failed to parse XML: ${u}`),r}const o=i.querySelector("parsererror");if(o)return r.errors.push(`Invalid XML: ${o.textContent?.trim()??"parse error"}`),r;const s=i.documentElement;if(!s||s.localName.toLowerCase()!=="xfdf")return r.errors.push(`Invalid XFDF: root element must be <xfdf>, got <${s?.localName??"unknown"}>`),r;const c=s.getAttribute("xmlns");c&&c!==we&&r.errors.push(`Warning: unexpected namespace '${c}', attempting tag-name matching`);const l=s.querySelector("annots");if(!l)return r;const a=Array.from(l.children);if(a.length===0)return r;const h=new Set,d=new Set;for(const u of a){const{annotation:f,skipped:y}=de.parseAnnotationElement(u,n);if(y){r.skipped.push(y);continue}f&&(f.id&&(h.has(f.id)?(d.add(f.id),r.errors.push(`Duplicate annotation name: ${f.id}`)):h.add(f.id)),r.annotations.push(f))}for(const u of r.annotations)u.inReplyTo&&!h.has(u.inReplyTo)&&(r.errors.push(`Orphaned inreplyto reference: ${u.inReplyTo}`),u.inReplyTo=void 0);return r}}const mu={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},yu=e=>e.startsWith("#")||e.startsWith("0x")?e:mu[e]||e,Rn=g.defineComponent({__name:"AppTooltip",setup(e){const t=g.inject(En),n=g.computed(()=>t?.AppTooltip);return(r,i)=>n.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.value),g.normalizeProps(g.mergeProps({key:0},r.$attrs)),g.createSlots({default:g.withCtx(()=>[g.renderSlot(r.$slots,"default")]),_:2},[g.renderList(r.$slots,(o,s)=>({name:s,fn:g.withCtx(()=>[g.renderSlot(r.$slots,s)])}))]),1040)):(g.openBlock(),g.createElementBlock("div",g.normalizeProps(g.mergeProps({key:1},r.$attrs)),[g.renderSlot(r.$slots,"default")],16))}}),In=g.defineComponent({inheritAttrs:!1,__name:"AppButton",props:{ariaLabel:{},ariaDisabled:{type:Boolean}},setup(e){const t=e,n=g.useAttrs(),r=g.inject(En),i=g.computed(()=>r?.AppButton),o=g.computed(()=>({"aria-label":t.ariaLabel,"aria-disabled":t.ariaDisabled,...n}));return(s,c)=>i.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(i.value),g.normalizeProps(g.mergeProps({key:0},o.value)),{default:g.withCtx(()=>[g.renderSlot(s.$slots,"default")]),_:3},16)):(g.openBlock(),g.createElementBlock("button",g.normalizeProps(g.mergeProps({key:1},o.value)),[g.renderSlot(s.$slots,"default")],16))}}),wu=(e,t)=>{const n=e[t];return n?typeof n=="function"?n():Promise.resolve(n):new Promise((r,i)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(i.bind(null,new Error("Unknown variable dynamic import: "+t)))})},_u=g.defineComponent({__name:"Icon",props:{name:{}},setup(e){const t=e,n=g.defineAsyncComponent({loader:()=>wu(Object.assign({"../assets/icons/annotations.svg":()=>Promise.resolve().then(()=>zu),"../assets/icons/tool-comment.svg":()=>Promise.resolve().then(()=>Lu),"../assets/icons/tool-free-text.svg":()=>Promise.resolve().then(()=>Uu),"../assets/icons/tool-highlight.svg":()=>Promise.resolve().then(()=>Hu),"../assets/icons/tool-image.svg":()=>Promise.resolve().then(()=>Vu),"../assets/icons/tool-signature.svg":()=>Promise.resolve().then(()=>Ku),"../assets/icons/tool-strikethrough.svg":()=>Promise.resolve().then(()=>qu),"../assets/icons/tool-text-selection.svg":()=>Promise.resolve().then(()=>Yu),"../assets/icons/tool-underline.svg":()=>Promise.resolve().then(()=>Qu)}),`../assets/icons/${t.name}.svg`)});return(r,i)=>(g.openBlock(),g.createBlock(g.resolveDynamicComponent(g.unref(n)),{class:"vp-text-xl"}))}}),a0="",po=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},ft=po(_u,[["__scopeId","data-v-9d5f0033"]]),On=()=>{const e=g.inject(gc,g.computed(()=>({})));return{t:g.computed(()=>n=>{const r=n.split(".").pop()||n;return e.value&&r in e.value?e.value[r]:(console.warn(`useLocalization - Translation not found for key: ${n}`),n)}).value,currentLocale:g.computed(()=>e.value)}},xu=g.defineComponent({__name:"ToolAnnotation",emits:["toggle"],setup(e,{emit:t}){const{t:n}=On(),r=t,i=g.ref(!1),o=()=>{i.value=!i.value,r("toggle",i.value)};return(s,c)=>s.$slots.default?g.renderSlot(s.$slots,"default",{key:0,onClick:o},void 0,!0):(g.openBlock(),g.createBlock(Rn,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(i.value?g.unref(n)("annotationToggleHideTooltip"):g.unref(n)("annotationToggleShowTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(In,{"aria-label":i.value?g.unref(n)("annotationToggleHideTooltip"):g.unref(n)("annotationToggleShowTooltip"),class:g.normalizeClass(["vpv-toolbar-btn",{"vpv-toolbar-btn-active":i.value}]),onClick:o},{default:g.withCtx(()=>[g.createVNode(ft,{name:"annotations",class:"vp-text-xl"})]),_:1},8,["aria-label","class"])]),_:1}))}}),c0="",Su=po(xu,[["__scopeId","data-v-df5778ee"]]),vu=g.defineComponent({__name:"ToolAnnotationTextSelection",props:g.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=g.useModel(e,"active"),{t:r}=On(),i=g.computed(()=>t.ariaDisabled===!0),o=()=>{i.value||(n.value=!n.value)};return(s,c)=>s.$slots.default?g.renderSlot(s.$slots,"default",g.mergeProps({key:0},s.$attrs,{onClick:o})):(g.openBlock(),g.createBlock(Rn,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationTextSelectionTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(In,g.mergeProps({"aria-label":g.unref(r)("annotationTextSelectionLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},s.$attrs,{onClick:o}),{default:g.withCtx(()=>[g.renderSlot(s.$slots,"icon",{},()=>[g.createVNode(ft,{name:"tool-text-selection"})])]),_:3},16,["aria-label","class"])]),_:3}))}}),ku=g.defineComponent({__name:"AppPopover",props:{open:{type:Boolean},side:{},sideOffset:{},class:{},ariaLabel:{}},setup(e){const t=e,n=g.inject(En),r=g.computed(()=>n?.AppPopover);return(i,o)=>r.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(r.value),g.normalizeProps(g.mergeProps({key:0},t)),{trigger:g.withCtx(()=>[g.renderSlot(i.$slots,"trigger")]),default:g.withCtx(()=>[g.renderSlot(i.$slots,"default")]),_:3},16)):(g.openBlock(),g.createElementBlock("button",g.normalizeProps(g.mergeProps({key:1},t)),[g.renderSlot(i.$slots,"default")],16))}}),Au=g.defineComponent({__name:"AppSignatures",setup(e){const t=g.inject(En),n=g.computed(()=>t?.AppSignatures);return(r,i)=>n.value?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.value),g.normalizeProps(g.mergeProps({key:0},r.$attrs)),null,16)):g.createCommentVNode("",!0)}}),Cu=g.defineComponent({__name:"ToolAnnotationSignature",props:g.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=g.useModel(e,"active"),{t:r}=On(),i=g.ref(!1),o=g.computed(()=>t.ariaDisabled===!0),s=()=>{o.value||(!n.value&&!i.value&&(i.value=!0),n.value=!n.value)},c=l=>{i.value=!1};return(l,a)=>l.$slots.default?g.renderSlot(l.$slots,"default",g.mergeProps({key:0},l.$attrs,{onClick:s})):(g.openBlock(),g.createBlock(ku,{key:1,open:i.value,side:"right",sideOffset:10,class:"vpv-annotation-signatures__popover",onInteractOutside:c},{trigger:g.withCtx(()=>[g.createVNode(Rn,null,{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationSignatureTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(In,g.mergeProps({"aria-label":g.unref(r)("annotationSignatureLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},l.$attrs,{onClick:s}),{default:g.withCtx(()=>[g.renderSlot(l.$slots,"icon",{},()=>[g.createVNode(ft,{name:"tool-signature"})])]),_:3},16,["aria-label","class"])]),_:3})]),default:g.withCtx(()=>[g.createVNode(Au)]),_:3},8,["open"]))}}),Tu=g.defineComponent({__name:"ToolAnnotationFreeText",props:g.mergeModels({ariaDisabled:{type:Boolean},active:{type:Boolean}},{active:{type:Boolean,required:!0},activeModifiers:{}}),emits:["update:active"],setup(e){const t=e,n=g.useModel(e,"active"),{t:r}=On(),i=g.computed(()=>t.ariaDisabled===!0),o=()=>{i.value||(n.value=!n.value)};return(s,c)=>s.$slots.default?g.renderSlot(s.$slots,"default",g.mergeProps({key:0},s.$attrs,{onClick:o})):(g.openBlock(),g.createBlock(Rn,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationFreeTextTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(In,g.mergeProps({"aria-label":g.unref(r)("annotationFreeTextLabel"),class:["vpv-toolbar-btn",{"vpv-toolbar-btn-active":n.value}]},s.$attrs,{onClick:o}),{default:g.withCtx(()=>[g.renderSlot(s.$slots,"icon",{},()=>[g.createVNode(ft,{name:"tool-free-text"})])]),_:3},16,["aria-label","class"])]),_:3}))}}),Bu=g.defineComponent({__name:"ToolAnnotationImage",props:{ariaDisabled:{type:Boolean}},emits:["change"],setup(e,{emit:t}){const n=e,{t:r}=On(),i=t,o=g.computed(()=>n.ariaDisabled===!0),s=()=>{if(o.value)return;const c=document.createElement("input");c.type="file",c.accept="image/*",c.onchange=l=>{const a=l.target.files?.[0];i("change",a)},c.click()};return(c,l)=>c.$slots.default?g.renderSlot(c.$slots,"default",g.mergeProps({key:0},c.$attrs,{onClick:s})):(g.openBlock(),g.createBlock(Rn,{key:1},{content:g.withCtx(()=>[g.createTextVNode(g.toDisplayString(g.unref(r)("annotationImageTooltip")),1)]),default:g.withCtx(()=>[g.createVNode(In,g.mergeProps({"aria-label":g.unref(r)("annotationImageLabel"),class:"vpv-toolbar-btn"},c.$attrs,{onClick:s}),{default:g.withCtx(()=>[g.renderSlot(c.$slots,"icon",{},()=>[g.createVNode(ft,{name:"tool-image"})])]),_:3},16,["aria-label"])]),_:3}))}}),l0="",yc={B:1,K:1e3,KB:1e3,M:1e3**2,MB:1e3**2,G:1e3**3,GB:1e3**3,T:1e3**4,TB:1e3**4};function Du(e){if(!e||typeof e!="string")return{isValid:!1,bytes:0,error:"Size input is required and must be a string"};const n=e.trim().toUpperCase().match(/^(\d*\.?\d+)\s*([KMGTB]B?)?$/);if(!n)return{isValid:!1,bytes:0,error:'Invalid format. Expected: number + optional unit (e.g., "10MB", "1.5G", "512")'};const[,r,i="B"]=n,o=parseFloat(r);if(isNaN(o)||o<0)return{isValid:!1,bytes:0,error:"Size must be a positive number"};const s=i;return s in yc?{isValid:!0,bytes:Math.floor(o*yc[s])}:{isValid:!1,bytes:0,error:`Unsupported unit "${i}". Supported: B, K, KB, M, MB, G, GB, T, TB`}}function Eu(e,t=1){if(e===0)return"0 B";const n=["B","KB","MB","GB","TB"],r=1e3,i=Math.floor(Math.log(e)/Math.log(r)),o=e/Math.pow(r,i);return`${t===0?Math.round(o):o.toFixed(t)} ${n[i]}`}function Pu(e){const t=Du(e);if(!t.isValid)throw new Error(t.error);return t.bytes}const Ru={class:"vpv-annotation-tools-container"},Iu={key:0,class:"vpv-annotation-tools"},Ou=g.defineComponent({__name:"VPdfAnnotationTools",props:{textSelection:{type:[Object,Boolean],default:()=>!0},freeText:{type:[Object,Boolean],default:()=>!0},signature:{type:[Object,Boolean],default:()=>!1},image:{type:[Object,Boolean],default:()=>!0},instanceId:{type:Number,required:!0},onAnnotationCreated:{type:Function,default:void 0},onAnnotationUpdated:{type:Function,default:void 0},onAnnotationDeleted:{type:Function,default:void 0}},emits:["textSelection","freeText","signature","image"],setup(e,{emit:t}){const n=e,r=t,i=g.ref(!1),o=O=>qt(n.instanceId,O),s={textSelection:new CustomEvent(o(Zt.textSelection),{detail:{active:!1,highlight:null,strikethrough:null,underline:null}}),freeText:new CustomEvent(o(Zt.freeText),{detail:{active:!1,fontColors:null,fontSizes:null}}),signature:new CustomEvent(o(Zt.signature),{detail:{active:!1}}),image:new CustomEvent(o(Zt.image),{detail:{file:void 0}}),error:new CustomEvent(o(Cr.ShowNotificationError),{detail:{error:void 0,maxSize:void 0}})},c=g.ref(!1),l=g.reactive({textSelection:!1,freeText:!1,signature:!1}),a=g.computed({get:()=>l.textSelection,set:O=>{l.textSelection=O,O&&(l.freeText=!1,l.signature=!1),E()}}),h=g.computed({get:()=>l.freeText,set:O=>{O&&(l.textSelection=!1,l.signature=!1),l.freeText=O,E()}}),d=g.computed({get:()=>l.signature,set:O=>{O&&(l.textSelection=!1,l.freeText=!1),l.signature=O,E()}}),u=g.computed(()=>n.textSelection),f=g.computed(()=>n.freeText),y=g.computed(()=>n.signature),_=g.computed(()=>n.image);function x(O){return O.map(P=>typeof P=="string"?{value:yu(P),label:P}:P)}const w=O=>{c.value=O,O||(a.value=!1,h.value=!1,d.value=!1)},T=Object.entries(lu).map(([O,P])=>({value:O,label:P})),v=Object.entries(hu).map(([O,P])=>({value:O,label:P})),S=Object.entries(du).map(([O,P])=>({value:O,label:P})),N=O=>{r("textSelection",O),s.textSelection.detail.active=O;let P={icon:g.markRaw(g.h(ft,{name:"tool-highlight"}))},D={icon:g.markRaw(g.h(ft,{name:"tool-strikethrough"}))},$={icon:g.markRaw(g.h(ft,{name:"tool-underline"}))};if(typeof n.textSelection=="object"){const{highlight:oe,strikethrough:he,underline:be}=n.textSelection;oe===!1?P=!1:typeof oe=="object"&&(P={...P,...oe},oe.icon&&typeof oe.icon=="object"&&(P.icon=g.markRaw(oe.icon))),he===!1?D=!1:typeof he=="object"&&(D={...D,...he},he.icon&&typeof he.icon=="object"&&(D.icon=g.markRaw(he.icon))),be===!1?$=!1:typeof be=="object"&&($={...$,...be},be.icon&&typeof be.icon=="object"&&($.icon=g.markRaw(be.icon)))}P&&typeof P=="object"&&(P.colors?P.colors=x(P.colors):P.colors=T),$&&typeof $=="object"&&($.colors?$.colors=x($.colors):$.colors=v),D&&typeof D=="object"&&(D.colors?D.colors=x(D.colors):D.colors=S),s.textSelection.detail.highlight=P,s.textSelection.detail.strikethrough=D,s.textSelection.detail.underline=$,window.dispatchEvent(s.textSelection)},C=O=>{r("freeText",O),s.freeText.detail.active=O;let P=Object.entries(fu).map(([D,$])=>({value:D,label:$}));typeof n.freeText=="object"&&n.freeText?.fontColors&&(P=x(n.freeText.fontColors)),s.freeText.detail.fontColors=P,typeof n.freeText=="object"&&n.freeText?.fontSizes?.length&&(s.freeText.detail.fontSizes=n.freeText.fontSizes),window.dispatchEvent(s.freeText)},k=O=>{r("signature",O),s.signature.detail.active=O,window.dispatchEvent(s.signature)},F=(O,P="1MB",D=[Le.APNG,Le.AVIF,Le.BMP,Le.GIF,Le.ICON,Le.JPEG,Le.PNG,Le.SVG,Le.WEBP])=>{if(!O)return{isValid:!0};if(typeof P<"u"){let $;if(typeof P=="number"?$=P:$=Pu(P),O.size>$)return{isValid:!1,error:Ar.FileSizeExceeded,maxSize:Eu($)}}return D&&D.length>0&&!D.includes(O.type)?{isValid:!1,error:Ar.UnsupportedFileType}:{isValid:!0}},I=O=>{const P=n.image,D=F(O,P?.maxSize,P?.types);if(!D.isValid){s.error.detail.error=D?.error,s.error.detail.maxSize=D?.maxSize,window.dispatchEvent(s.error);return}l.textSelection=!1,l.freeText=!1,l.signature=!1,r("image",O),s.image.detail.file=O,window.dispatchEvent(s.image)};function E(){N(a.value),C(h.value),k(d.value)}const R=qt(n.instanceId,Pn.Rotate);g.onMounted(()=>{window.dispatchEvent(new CustomEvent(qt(n.instanceId,Pn.AnnotationMounted))),window.addEventListener(R,Q),E()});function Q(O){const{rotation:P}=O.detail;i.value=P!==0}g.watch(i,O=>{O&&(l.textSelection=!1,l.freeText=!1,l.signature=!1,E())});const M=O=>{const{id:P,...D}=O;return{...D,id:P?.startsWith(uu)?null:P}};return g.watch(()=>n.onAnnotationCreated,(O,P,D)=>{if(!O)return;const $=he=>{O(M(he.detail))},oe=qt(n.instanceId,Pn.AnnotationCreated);window.addEventListener(oe,$),D(()=>{window.removeEventListener(oe,$)})},{immediate:!0}),g.watch(()=>n.onAnnotationUpdated,(O,P,D)=>{if(!O)return;const $=he=>{O(M(he.detail))},oe=qt(n.instanceId,Pn.AnnotationUpdated);window.addEventListener(oe,$),D(()=>{window.removeEventListener(oe,$)})},{immediate:!0}),g.watch(()=>n.onAnnotationDeleted,(O,P,D)=>{if(!O)return;const $=he=>{O(M(he.detail))},oe=qt(n.instanceId,Pn.AnnotationDeleted);window.addEventListener(oe,$),D(()=>{window.removeEventListener(oe,$)})},{immediate:!0}),g.onUnmounted(()=>{window.removeEventListener(R,Q)}),(O,P)=>(g.openBlock(),g.createElementBlock("div",Ru,[g.createVNode(Su,{onToggle:w}),g.createVNode(g.Transition,{name:"slide"},{default:g.withCtx(()=>[c.value?(g.openBlock(),g.createElementBlock("div",Iu,[u.value?(g.openBlock(),g.createBlock(vu,{key:0,active:a.value,"onUpdate:active":P[0]||(P[0]=D=>a.value=D),"aria-disabled":i.value},g.createSlots({_:2},[typeof n.textSelection=="object"&&n.textSelection.icon?{name:"icon",fn:g.withCtx(()=>[typeof n.textSelection=="object"&&n.textSelection.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.textSelection.icon),{key:0})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.textSelection=="object"&&n.textSelection.component?{name:"default",fn:g.withCtx(({onClick:D})=>[typeof n.textSelection=="object"&&n.textSelection.component?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.textSelection.component),{key:0,onClick:D},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):g.createCommentVNode("",!0),f.value?(g.openBlock(),g.createBlock(Tu,{key:1,active:h.value,"onUpdate:active":P[1]||(P[1]=D=>h.value=D),"aria-disabled":i.value},g.createSlots({_:2},[typeof n.freeText=="object"&&n.freeText.icon?{name:"icon",fn:g.withCtx(()=>[typeof n.freeText=="object"&&n.freeText.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.freeText.icon),{key:0})):g.createCommentVNode("",!0),typeof n.freeText=="object"&&n.freeText.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.freeText.icon),{key:1})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.freeText=="object"&&n.freeText.component?{name:"default",fn:g.withCtx(({onClick:D})=>[typeof n.freeText=="object"&&n.freeText.component?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.freeText.component),{key:0,onClick:D},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):g.createCommentVNode("",!0),_.value?(g.openBlock(),g.createBlock(Bu,{key:2,onChange:I,"aria-disabled":i.value},g.createSlots({_:2},[typeof n.image=="object"&&n.image?{name:"icon",fn:g.withCtx(()=>[typeof n.image=="object"&&n.image.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.image.icon),{key:0})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.image=="object"&&n.image&&"component"in n.image?{name:"default",fn:g.withCtx(({onClick:D})=>[typeof n.image=="object"&&n.image&&"component"in n.image?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.image.component),{key:0,onClick:D},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["aria-disabled"])):g.createCommentVNode("",!0),y.value?(g.openBlock(),g.createBlock(Cu,{key:3,active:d.value,"onUpdate:active":P[2]||(P[2]=D=>d.value=D),"aria-disabled":i.value},g.createSlots({_:2},[typeof n.signature=="object"&&n.signature.icon?{name:"icon",fn:g.withCtx(()=>[typeof n.signature=="object"&&n.signature.icon?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.signature.icon),{key:0})):g.createCommentVNode("",!0)]),key:"0"}:typeof n.signature=="object"&&n.signature.component?{name:"default",fn:g.withCtx(({onClick:D})=>[typeof n.signature=="object"&&n.signature.component?(g.openBlock(),g.createBlock(g.resolveDynamicComponent(n.signature.component),{key:0,onClick:D},null,8,["onClick"])):g.createCommentVNode("",!0)]),key:"1"}:void 0]),1032,["active","aria-disabled"])):g.createCommentVNode("",!0)])):g.createCommentVNode("",!0)]),_:1})]))}}),h0="",wc=po(Ou,[["__scopeId","data-v-c9502027"]]),Nu=(e={})=>{const{textSelection:t,freeText:n,image:r,...i}=e;let o=null;return{name:"annotation",setup(s){const{componentInstance:c,shared:l}=s,a=c?.uid??0;s.toolbar.addItem({id:cu.ANNOTATIONS,toolbarDirection:"left",component:g.h(wc,{textSelection:t,freeText:n,image:r,instanceId:a,...i})});const h=c?.appContext.app;l.ui?h.provide(En,l.ui):console.warn("VPdfAnnotationPlugin - No UI context found in plugin context"),l.localization?.value?h.provide(gc,l.localization):console.warn("VPdfAnnotationPlugin - No localization found in plugin context"),l.pdf||console.warn("VPdfAnnotationPlugin - PDF context not available"),o={exportToXfdf:(d,u)=>de.exportToXfdf(d,u),importFromXfdf:(d,u)=>de.importFromXfdf(d,u),exportToPdf:async(d,u)=>{const f=await l.pdf?.getOriginalBytes();if(!f)return console.error("[exportToPdf] originalBytes is null - cannot serialize text markup annotations. Check if PDF source type is supported."),null;try{const y=await bu.serializeAnnotationsToPdf(f,d,u);return console.debug("[exportToPdf] Serialization successful, result size:",y.byteLength),y}catch(y){throw console.error("[exportToPdf] Serialization failed:",y),y}}}},getApi:()=>o}},Fu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function _c(e,t){return g.openBlock(),g.createElementBlock("svg",Fu,[...t[0]||(t[0]=[g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M10 18.334a8.333 8.333 0 1 0 0-16.667 8.333 8.333 0 0 0 0 16.667"},null,-1),g.createElementVNode("path",{stroke:"currentColor","stroke-linejoin":"round","stroke-width":"1.25",d:"m5.417 17.084 1.171-4.394c.238-.892.357-1.338.694-1.597s.798-.259 1.722-.259h1.992c.923 0 1.385 0 1.722.259.337.258.456.705.693 1.597l1.172 4.394"},null,-1),g.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.25",d:"M7.917 10.834 9.23 7.8c.327-.756.491-1.134.769-1.134s.441.378.77 1.134l1.313 3.033"},null,-1)])])}const zu=Object.freeze(Object.defineProperty({__proto__:null,render:_c,default:{render:_c}},Symbol.toStringTag,{value:"Module"})),Mu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function xc(e,t){return g.openBlock(),g.createElementBlock("svg",Mu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M18.125 9.688a7.82 7.82 0 0 1-7.812 7.812H3.75a1.25 1.25 0 0 1-1.25-1.25V9.688a7.812 7.812 0 0 1 15.625 0m-1.25 0a6.563 6.563 0 0 0-13.125 0v6.562h6.563a6.57 6.57 0 0 0 6.562-6.562"},null,-1),g.createElementVNode("path",{fill:"currentColor",d:"M12.5 10a.624.624 0 0 1-.625.625h-1.25v1.25a.624.624 0 1 1-1.25 0v-1.25h-1.25a.625.625 0 1 1 0-1.25h1.25v-1.25a.625.625 0 0 1 1.25 0v1.25h1.25A.625.625 0 0 1 12.5 10"},null,-1)])])}const Lu=Object.freeze(Object.defineProperty({__proto__:null,render:xc,default:{render:xc}},Symbol.toStringTag,{value:"Module"})),ju={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function Sc(e,t){return g.openBlock(),g.createElementBlock("svg",ju,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M11.458 13.75a.624.624 0 1 0 0-1.25h-.625v-5h2.5v.625a.625.625 0 0 0 1.25 0v-1.25a.625.625 0 0 0-.625-.625h-7.5a.625.625 0 0 0-.625.625v1.25a.625.625 0 0 0 1.25 0V7.5h2.5v5h-.625a.625.625 0 1 0 0 1.25z"},null,-1),g.createElementVNode("path",{fill:"currentColor","fill-rule":"evenodd",d:"M3.125 3.75c0-.115.093-.208.208-.208h13.334c.115 0 .208.093.208.208v2.917a.625.625 0 1 0 1.25 0V3.75c0-.805-.653-1.458-1.458-1.458H3.333c-.805 0-1.458.653-1.458 1.458v3.334a.625.625 0 1 0 1.25 0zm0 12.5c0 .115.093.209.208.209h13.334a.21.21 0 0 0 .208-.209v-2.916a.625.625 0 1 1 1.25 0v2.916c0 .806-.653 1.459-1.458 1.459H3.333a1.46 1.46 0 0 1-1.458-1.459v-3.333a.625.625 0 1 1 1.25 0zM2.5 8.542c.345 0 .625.28.625.625v1.667a.625.625 0 0 1-1.25 0V9.167c0-.345.28-.625.625-.625m15.625.625a.625.625 0 1 0-1.25 0v1.667a.625.625 0 0 0 1.25 0z","clip-rule":"evenodd"},null,-1)])])}const Uu=Object.freeze(Object.defineProperty({__proto__:null,render:Sc,default:{render:Sc}},Symbol.toStringTag,{value:"Module"})),$u={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function vc(e,t){return g.openBlock(),g.createElementBlock("svg",$u,[...t[0]||(t[0]=[g.createElementVNode("g",{"clip-path":"url(#a)"},[g.createElementVNode("path",{fill:"currentColor",d:"M19.818 8.308a.625.625 0 0 0-.885 0L15 12.242 8.384 5.625l3.934-3.932a.626.626 0 0 0-.885-.885L7.5 4.742a1.25 1.25 0 0 0-.22 1.47L5.625 7.866a1.25 1.25 0 0 0 0 1.767l.367.366-4.559 4.558a.625.625 0 0 0 .245 1.035l5.625 1.875a.62.62 0 0 0 .437-.015.6.6 0 0 0 .203-.136l2.682-2.683.367.366a1.25 1.25 0 0 0 1.767 0l1.656-1.654a1.25 1.25 0 0 0 1.469-.22l3.934-3.933a.626.626 0 0 0 0-.885M7.332 16.16l-4.297-1.433 3.84-3.843 2.867 2.866zm4.543-2.043L6.51 8.75l1.616-1.616 5.367 5.366z"})],-1),g.createElementVNode("defs",null,[g.createElementVNode("clipPath",{id:"a"},[g.createElementVNode("path",{fill:"currentColor",d:"M0 0h20v20H0z"})])],-1)])])}const Hu=Object.freeze(Object.defineProperty({__proto__:null,render:vc,default:{render:vc}},Symbol.toStringTag,{value:"Module"})),Gu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function kc(e,t){return g.openBlock(),g.createElementBlock("svg",Gu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M16.875 3.125H3.125a1.25 1.25 0 0 0-1.25 1.25v11.25a1.25 1.25 0 0 0 1.25 1.25h13.75a1.25 1.25 0 0 0 1.25-1.25V4.375a1.25 1.25 0 0 0-1.25-1.25m0 1.25v8.027l-2.037-2.036a1.25 1.25 0 0 0-1.768 0l-1.562 1.563L8.07 8.49a1.25 1.25 0 0 0-1.767 0L3.125 11.67V4.376zm-13.75 9.063 4.063-4.063 6.25 6.25H3.124zm13.75 2.187h-1.67l-2.812-2.812 1.563-1.563 2.919 2.92zM11.25 7.813a.938.938 0 1 1 1.875 0 .938.938 0 0 1-1.875 0"},null,-1)])])}const Vu=Object.freeze(Object.defineProperty({__proto__:null,render:kc,default:{render:kc}},Symbol.toStringTag,{value:"Module"})),Wu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function Ac(e,t){return g.openBlock(),g.createElementBlock("svg",Wu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M18.125 13.125H4.99q.313-.615.625-1.259c1.172.13 2.546-.685 4.114-2.432.391 1.051 1.13 2.416 2.39 2.441.707.014 1.414-.406 2.142-1.279.53.634 1.623 1.279 3.865 1.279a.625.625 0 1 0 0-1.25c-2.377 0-3.08-.816-3.125-1.259a.6.6 0 0 0-.426-.605.636.636 0 0 0-.723.273c-.943 1.448-1.514 1.596-1.713 1.591-.645-.012-1.301-1.525-1.526-2.61a.625.625 0 0 0-1.1-.264c-1.579 1.98-2.637 2.646-3.295 2.818.663-1.474 1.158-2.768 1.475-3.858.533-1.831.572-3.112.118-3.914-.234-.42-.73-.922-1.723-.922-1.255 0-2.245 1.186-2.716 3.254-.28 1.227-.327 2.594-.127 3.75.2 1.155.615 1.996 1.218 2.495a72 72 0 0 1-.877 1.751h-1.71a.625.625 0 1 0 0 1.25h1.048c-.884 1.64-1.572 2.784-1.583 2.803a.625.625 0 1 0 1.071.644c.012-.02.88-1.468 1.93-3.447h13.784a.625.625 0 1 0 0-1.25M4.59 5.407c.311-1.365.914-2.282 1.498-2.282.416 0 .555.145.635.287.235.416.51 1.89-1.692 6.749-.645-.881-.865-2.895-.44-4.754"},null,-1)])])}const Ku=Object.freeze(Object.defineProperty({__proto__:null,render:Ac,default:{render:Ac}},Symbol.toStringTag,{value:"Module"})),Zu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function Cc(e,t){return g.openBlock(),g.createElementBlock("svg",Zu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M17.5 10a.624.624 0 0 1-.625.625h-3.13c.718.556 1.255 1.344 1.255 2.5 0 1.042-.547 2.008-1.543 2.718-.931.666-2.16 1.032-3.457 1.032-1.298 0-2.526-.366-3.457-1.032C5.547 15.133 5 14.167 5 13.125a.625.625 0 1 1 1.25 0c0 1.355 1.719 2.5 3.75 2.5s3.75-1.145 3.75-2.5c0-1.16-.823-1.842-3.029-2.5H3.125a.625.625 0 1 1 0-1.25h13.75A.625.625 0 0 1 17.5 10M5.963 8.125a.625.625 0 0 0 .595-.82 1.4 1.4 0 0 1-.065-.43c0-1.425 1.508-2.5 3.507-2.5 1.472 0 2.669.58 3.203 1.55a.625.625 0 0 0 1.094-.6c-.756-1.378-2.362-2.2-4.297-2.2-2.712 0-4.757 1.612-4.757 3.75-.001.278.041.555.127.82a.625.625 0 0 0 .593.43"},null,-1)])])}const qu=Object.freeze(Object.defineProperty({__proto__:null,render:Cc,default:{render:Cc}},Symbol.toStringTag,{value:"Module"})),Xu={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function Tc(e,t){return g.openBlock(),g.createElementBlock("svg",Xu,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M17.916 14.568c.345 0 .625.28.625.625V17.9c0 .345-.28.625-.625.625H2.083a.625.625 0 0 1-.625-.625v-2.708c0-.345.28-.625.625-.625zM2.708 17.276h14.583v-1.458H2.708zm8.333-15.428a.626.626 0 0 1 .88.887L8.39 6.242l3.525 3.524 3.584-3.558a.626.626 0 0 1 .88.887l-4.057 4.03a.63.63 0 0 1-.633.15v.001h.004l.002.002-.018-.004a1 1 0 0 0-.125-.02 2 2 0 0 0-.534.015c-.457.07-1.144.312-1.92 1.07a.625.625 0 0 1-.873 0l-.07-.069-1.173 1.09a.63.63 0 0 1-.426.166H3.75a.625.625 0 0 1-.444-1.065l2.487-2.5-.045-.044a.626.626 0 0 1 0-.894c.775-.757 1.018-1.425 1.09-1.862.035-.224.029-.4.016-.512a1 1 0 0 0-.02-.118l-.004-.012v.001l.002.002V6.52a.63.63 0 0 1 .15-.643zM5.254 12.276h1.058l.948-.88-.444-.435-.13-.127zm6.444-.998h-.003zM8.014 7.634c-.131.537-.412 1.162-.958 1.814l1.627 1.591c.648-.523 1.267-.8 1.802-.934z"},null,-1)])])}const Yu=Object.freeze(Object.defineProperty({__proto__:null,render:Tc,default:{render:Tc}},Symbol.toStringTag,{value:"Module"})),Ju={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 20 20"};function Bc(e,t){return g.openBlock(),g.createElementBlock("svg",Ju,[...t[0]||(t[0]=[g.createElementVNode("path",{fill:"currentColor",d:"M15.625 17.5a.624.624 0 0 1-.625.625H5a.625.625 0 1 1 0-1.25h10a.624.624 0 0 1 .625.625M10 15.625a5.005 5.005 0 0 0 5-5v-6.25a.625.625 0 1 0-1.25 0v6.25a3.75 3.75 0 0 1-7.5 0v-6.25a.625.625 0 0 0-1.25 0v6.25a5.005 5.005 0 0 0 5 5"},null,-1)])])}const Qu=Object.freeze(Object.defineProperty({__proto__:null,render:Bc,default:{render:Bc}},Symbol.toStringTag,{value:"Module"}));z.VPdfAnnotationTools=wc,z.default=Nu,Object.defineProperties(z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vue-pdf-viewer/annotation",
3
3
  "private": false,
4
- "version": "1.6.0-rc.2",
4
+ "version": "1.6.0-rc.3",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.cjs",
7
7
  "module": "./dist/index.js",