officeparser 6.0.7 → 6.1.1

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.
Files changed (40) hide show
  1. package/README.md +136 -52
  2. package/dist/OfficeParser.d.ts +10 -1
  3. package/dist/OfficeParser.js +44 -56
  4. package/dist/cli.d.ts +20 -0
  5. package/dist/cli.js +117 -0
  6. package/dist/index.d.ts +4 -4
  7. package/dist/index.js +7 -59
  8. package/dist/index.mjs +18 -0
  9. package/dist/officeparser.browser.d.ts +133 -3
  10. package/dist/officeparser.browser.iife.js +115 -0
  11. package/dist/officeparser.browser.mjs +114 -0
  12. package/dist/parsers/ExcelParser.d.ts +1 -1
  13. package/dist/parsers/ExcelParser.js +76 -68
  14. package/dist/parsers/OpenOfficeParser.d.ts +1 -1
  15. package/dist/parsers/OpenOfficeParser.js +224 -159
  16. package/dist/parsers/PdfParser.d.ts +1 -1
  17. package/dist/parsers/PdfParser.js +98 -94
  18. package/dist/parsers/PowerPointParser.d.ts +1 -1
  19. package/dist/parsers/PowerPointParser.js +188 -179
  20. package/dist/parsers/RtfParser.d.ts +21 -1
  21. package/dist/parsers/RtfParser.js +117 -48
  22. package/dist/parsers/WordParser.d.ts +2 -1
  23. package/dist/parsers/WordParser.js +214 -123
  24. package/dist/sbom.cdx.json +1807 -0
  25. package/dist/types.d.ts +123 -3
  26. package/dist/utils/chartUtils.js +2 -0
  27. package/dist/utils/dateUtils.d.ts +17 -0
  28. package/dist/utils/dateUtils.js +69 -0
  29. package/dist/utils/envUtils.d.ts +24 -0
  30. package/dist/utils/envUtils.js +69 -0
  31. package/dist/utils/moduleLoader.d.ts +2 -1
  32. package/dist/utils/moduleLoader.js +9 -39
  33. package/dist/utils/ocrUtils.d.ts +16 -12
  34. package/dist/utils/ocrUtils.js +186 -25
  35. package/dist/utils/xmlUtils.d.ts +80 -9
  36. package/dist/utils/xmlUtils.js +236 -18
  37. package/dist/utils/zipUtils.js +6 -47
  38. package/package.json +31 -16
  39. package/dist/officeParserBundle@6.0.7.js +0 -154
  40. package/dist/officeparser.browser.js +0 -154
@@ -0,0 +1,114 @@
1
+ // officeparser browser bundle
2
+ // Shim for setImmediate (not available in all browsers)
3
+ if (typeof setImmediate === 'undefined') {
4
+ window.setImmediate = function(callback) { return setTimeout(callback, 0); };
5
+ }
6
+ var tD=Object.create;var qm=Object.defineProperty;var eD=Object.getOwnPropertyDescriptor;var iD=Object.getOwnPropertyNames;var nD=Object.getPrototypeOf,rD=Object.prototype.hasOwnProperty;var Xw=r=>{throw TypeError(r)};var sD=(r,t,e)=>t in r?qm(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Wm=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var te=(r,t)=>()=>(r&&(t=r(r=0)),t);var Vt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Vy=(r,t)=>{for(var e in t)qm(r,e,{get:t[e],enumerable:!0})},aD=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of iD(t))!rD.call(r,n)&&n!==e&&qm(r,n,{get:()=>t[n],enumerable:!(i=eD(t,n))||i.enumerable});return r};var $c=(r,t,e)=>(e=r!=null?tD(nD(r)):{},aD(t||!r||!r.__esModule?qm(e,"default",{value:r,enumerable:!0}):e,r));var j=(r,t,e)=>sD(r,typeof t!="symbol"?t+"":t,e),qy=(r,t,e)=>t.has(r)||Xw("Cannot "+e);var a=(r,t,e)=>(qy(r,t,"read from private field"),e?e.call(r):t.get(r)),g=(r,t,e)=>t.has(r)?Xw("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),p=(r,t,e,i)=>(qy(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e),b=(r,t,e)=>(qy(r,t,"access private method"),e);var Ze=(r,t,e,i)=>({set _(n){p(r,t,n,e)},get _(){return a(r,t,i)}});var Zw=Vt(Xm=>{"use strict";H();Xm.byteLength=lD;Xm.toByteArray=uD;Xm.fromByteArray=fD;var $r=[],Xn=[],oD=typeof Uint8Array<"u"?Uint8Array:Array,Wy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Vo=0,Yw=Wy.length;Vo<Yw;++Vo)$r[Vo]=Wy[Vo],Xn[Wy.charCodeAt(Vo)]=Vo;var Vo,Yw;Xn[45]=62;Xn[95]=63;function Kw(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");e===-1&&(e=t);var i=e===t?0:4-e%4;return[e,i]}function lD(r){var t=Kw(r),e=t[0],i=t[1];return(e+i)*3/4-i}function cD(r,t,e){return(t+e)*3/4-e}function uD(r){var t,e=Kw(r),i=e[0],n=e[1],s=new oD(cD(r,i,n)),o=0,l=n>0?i-4:i,c;for(c=0;c<l;c+=4)t=Xn[r.charCodeAt(c)]<<18|Xn[r.charCodeAt(c+1)]<<12|Xn[r.charCodeAt(c+2)]<<6|Xn[r.charCodeAt(c+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=t&255;return n===2&&(t=Xn[r.charCodeAt(c)]<<2|Xn[r.charCodeAt(c+1)]>>4,s[o++]=t&255),n===1&&(t=Xn[r.charCodeAt(c)]<<10|Xn[r.charCodeAt(c+1)]<<4|Xn[r.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function hD(r){return $r[r>>18&63]+$r[r>>12&63]+$r[r>>6&63]+$r[r&63]}function dD(r,t,e){for(var i,n=[],s=t;s<e;s+=3)i=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),n.push(hD(i));return n.join("")}function fD(r){for(var t,e=r.length,i=e%3,n=[],s=16383,o=0,l=e-i;o<l;o+=s)n.push(dD(r,o,o+s>l?l:o+s));return i===1?(t=r[e-1],n.push($r[t>>2]+$r[t<<4&63]+"==")):i===2&&(t=(r[e-2]<<8)+r[e-1],n.push($r[t>>10]+$r[t>>4&63]+$r[t<<2&63]+"=")),n.join("")}});var Yy=Vt(Xy=>{H();Xy.read=function(r,t,e,i,n){var s,o,l=n*8-i-1,c=(1<<l)-1,u=c>>1,h=-7,d=e?n-1:0,f=e?-1:1,m=r[t+d];for(d+=f,s=m&(1<<-h)-1,m>>=-h,h+=l;h>0;s=s*256+r[t+d],d+=f,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=i;h>0;o=o*256+r[t+d],d+=f,h-=8);if(s===0)s=1-u;else{if(s===c)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,i),s=s-u}return(m?-1:1)*o*Math.pow(2,s-i)};Xy.write=function(r,t,e,i,n,s){var o,l,c,u=s*8-n-1,h=(1<<u)-1,d=h>>1,f=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=i?0:s-1,x=i?1:-1,y=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*Math.pow(2,1-d),t*c>=2&&(o++,c/=2),o+d>=h?(l=0,o=h):o+d>=1?(l=(t*c-1)*Math.pow(2,n),o=o+d):(l=t*Math.pow(2,d-1)*Math.pow(2,n),o=0));n>=8;r[e+m]=l&255,m+=x,l/=256,n-=8);for(o=o<<n|l,u+=n;u>0;r[e+m]=o&255,m+=x,o/=256,u-=8);r[e+m-x]|=y*128}});var pA=Vt(Xc=>{"use strict";H();var Ky=Zw(),qc=Yy(),Qw=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Xc.Buffer=Z;Xc.SlowBuffer=bD;Xc.INSPECT_MAX_BYTES=50;var Ym=2147483647;Xc.kMaxLength=Ym;Z.TYPED_ARRAY_SUPPORT=pD();!Z.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function pD(){try{let r=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(r,t),r.foo()===42}catch{return!1}}Object.defineProperty(Z.prototype,"parent",{enumerable:!0,get:function(){if(Z.isBuffer(this))return this.buffer}});Object.defineProperty(Z.prototype,"offset",{enumerable:!0,get:function(){if(Z.isBuffer(this))return this.byteOffset}});function Ns(r){if(r>Ym)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,Z.prototype),t}function Z(r,t,e){if(typeof r=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return tx(r)}return iA(r,t,e)}Z.poolSize=8192;function iA(r,t,e){if(typeof r=="string")return gD(r,t);if(ArrayBuffer.isView(r))return yD(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(Vr(r,ArrayBuffer)||r&&Vr(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Vr(r,SharedArrayBuffer)||r&&Vr(r.buffer,SharedArrayBuffer)))return Qy(r,t,e);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return Z.from(i,t,e);let n=xD(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return Z.from(r[Symbol.toPrimitive]("string"),t,e);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}Z.from=function(r,t,e){return iA(r,t,e)};Object.setPrototypeOf(Z.prototype,Uint8Array.prototype);Object.setPrototypeOf(Z,Uint8Array);function nA(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function mD(r,t,e){return nA(r),r<=0?Ns(r):t!==void 0?typeof e=="string"?Ns(r).fill(t,e):Ns(r).fill(t):Ns(r)}Z.alloc=function(r,t,e){return mD(r,t,e)};function tx(r){return nA(r),Ns(r<0?0:ex(r)|0)}Z.allocUnsafe=function(r){return tx(r)};Z.allocUnsafeSlow=function(r){return tx(r)};function gD(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!Z.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=rA(r,t)|0,i=Ns(e),n=i.write(r,t);return n!==e&&(i=i.slice(0,n)),i}function Zy(r){let t=r.length<0?0:ex(r.length)|0,e=Ns(t);for(let i=0;i<t;i+=1)e[i]=r[i]&255;return e}function yD(r){if(Vr(r,Uint8Array)){let t=new Uint8Array(r);return Qy(t.buffer,t.byteOffset,t.byteLength)}return Zy(r)}function Qy(r,t,e){if(t<0||r.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw new RangeError('"length" is outside of buffer bounds');let i;return t===void 0&&e===void 0?i=new Uint8Array(r):e===void 0?i=new Uint8Array(r,t):i=new Uint8Array(r,t,e),Object.setPrototypeOf(i,Z.prototype),i}function xD(r){if(Z.isBuffer(r)){let t=ex(r.length)|0,e=Ns(t);return e.length===0||r.copy(e,0,0,t),e}if(r.length!==void 0)return typeof r.length!="number"||nx(r.length)?Ns(0):Zy(r);if(r.type==="Buffer"&&Array.isArray(r.data))return Zy(r.data)}function ex(r){if(r>=Ym)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ym.toString(16)+" bytes");return r|0}function bD(r){return+r!=r&&(r=0),Z.alloc(+r)}Z.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==Z.prototype};Z.compare=function(t,e){if(Vr(t,Uint8Array)&&(t=Z.from(t,t.offset,t.byteLength)),Vr(e,Uint8Array)&&(e=Z.from(e,e.offset,e.byteLength)),!Z.isBuffer(t)||!Z.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let i=t.length,n=e.length;for(let s=0,o=Math.min(i,n);s<o;++s)if(t[s]!==e[s]){i=t[s],n=e[s];break}return i<n?-1:n<i?1:0};Z.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};Z.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return Z.alloc(0);let i;if(e===void 0)for(e=0,i=0;i<t.length;++i)e+=t[i].length;let n=Z.allocUnsafe(e),s=0;for(i=0;i<t.length;++i){let o=t[i];if(Vr(o,Uint8Array))s+o.length>n.length?(Z.isBuffer(o)||(o=Z.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(Z.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function rA(r,t){if(Z.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||Vr(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let e=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&e===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return Jy(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return fA(r).length;default:if(n)return i?-1:Jy(r).length;t=(""+t).toLowerCase(),n=!0}}Z.byteLength=rA;function wD(r,t,e){let i=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((e===void 0||e>this.length)&&(e=this.length),e<=0)||(e>>>=0,t>>>=0,e<=t))return"";for(r||(r="utf8");;)switch(r){case"hex":return ND(this,t,e);case"utf8":case"utf-8":return aA(this,t,e);case"ascii":return ID(this,t,e);case"latin1":case"binary":return kD(this,t,e);case"base64":return SD(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _D(this,t,e);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}Z.prototype._isBuffer=!0;function qo(r,t,e){let i=r[t];r[t]=r[e],r[e]=i}Z.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)qo(this,e,e+1);return this};Z.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)qo(this,e,e+3),qo(this,e+1,e+2);return this};Z.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)qo(this,e,e+7),qo(this,e+1,e+6),qo(this,e+2,e+5),qo(this,e+3,e+4);return this};Z.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?aA(this,0,t):wD.apply(this,arguments)};Z.prototype.toLocaleString=Z.prototype.toString;Z.prototype.equals=function(t){if(!Z.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:Z.compare(this,t)===0};Z.prototype.inspect=function(){let t="",e=Xc.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"};Qw&&(Z.prototype[Qw]=Z.prototype.inspect);Z.prototype.compare=function(t,e,i,n,s){if(Vr(t,Uint8Array)&&(t=Z.from(t,t.offset,t.byteLength)),!Z.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(e===void 0&&(e=0),i===void 0&&(i=t?t.length:0),n===void 0&&(n=0),s===void 0&&(s=this.length),e<0||i>t.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&e>=i)return 0;if(n>=s)return-1;if(e>=i)return 1;if(e>>>=0,i>>>=0,n>>>=0,s>>>=0,this===t)return 0;let o=s-n,l=i-e,c=Math.min(o,l),u=this.slice(n,s),h=t.slice(e,i);for(let d=0;d<c;++d)if(u[d]!==h[d]){o=u[d],l=h[d];break}return o<l?-1:l<o?1:0};function sA(r,t,e,i,n){if(r.length===0)return-1;if(typeof e=="string"?(i=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,nx(e)&&(e=n?0:r.length-1),e<0&&(e=r.length+e),e>=r.length){if(n)return-1;e=r.length-1}else if(e<0)if(n)e=0;else return-1;if(typeof t=="string"&&(t=Z.from(t,i)),Z.isBuffer(t))return t.length===0?-1:Jw(r,t,e,i,n);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?n?Uint8Array.prototype.indexOf.call(r,t,e):Uint8Array.prototype.lastIndexOf.call(r,t,e):Jw(r,[t],e,i,n);throw new TypeError("val must be string, number or Buffer")}function Jw(r,t,e,i,n){let s=1,o=r.length,l=t.length;if(i!==void 0&&(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le")){if(r.length<2||t.length<2)return-1;s=2,o/=2,l/=2,e/=2}function c(h,d){return s===1?h[d]:h.readUInt16BE(d*s)}let u;if(n){let h=-1;for(u=e;u<o;u++)if(c(r,u)===c(t,h===-1?0:u-h)){if(h===-1&&(h=u),u-h+1===l)return h*s}else h!==-1&&(u-=u-h),h=-1}else for(e+l>o&&(e=o-l),u=e;u>=0;u--){let h=!0;for(let d=0;d<l;d++)if(c(r,u+d)!==c(t,d)){h=!1;break}if(h)return u}return-1}Z.prototype.includes=function(t,e,i){return this.indexOf(t,e,i)!==-1};Z.prototype.indexOf=function(t,e,i){return sA(this,t,e,i,!0)};Z.prototype.lastIndexOf=function(t,e,i){return sA(this,t,e,i,!1)};function AD(r,t,e,i){e=Number(e)||0;let n=r.length-e;i?(i=Number(i),i>n&&(i=n)):i=n;let s=t.length;i>s/2&&(i=s/2);let o;for(o=0;o<i;++o){let l=parseInt(t.substr(o*2,2),16);if(nx(l))return o;r[e+o]=l}return o}function vD(r,t,e,i){return Km(Jy(t,r.length-e),r,e,i)}function ED(r,t,e,i){return Km(OD(t),r,e,i)}function CD(r,t,e,i){return Km(fA(t),r,e,i)}function TD(r,t,e,i){return Km(RD(t,r.length-e),r,e,i)}Z.prototype.write=function(t,e,i,n){if(e===void 0)n="utf8",i=this.length,e=0;else if(i===void 0&&typeof e=="string")n=e,i=this.length,e=0;else if(isFinite(e))e=e>>>0,isFinite(i)?(i=i>>>0,n===void 0&&(n="utf8")):(n=i,i=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-e;if((i===void 0||i>s)&&(i=s),t.length>0&&(i<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return AD(this,t,e,i);case"utf8":case"utf-8":return vD(this,t,e,i);case"ascii":case"latin1":case"binary":return ED(this,t,e,i);case"base64":return CD(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return TD(this,t,e,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};Z.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function SD(r,t,e){return t===0&&e===r.length?Ky.fromByteArray(r):Ky.fromByteArray(r.slice(t,e))}function aA(r,t,e){e=Math.min(r.length,e);let i=[],n=t;for(;n<e;){let s=r[n],o=null,l=s>239?4:s>223?3:s>191?2:1;if(n+l<=e){let c,u,h,d;switch(l){case 1:s<128&&(o=s);break;case 2:c=r[n+1],(c&192)===128&&(d=(s&31)<<6|c&63,d>127&&(o=d));break;case 3:c=r[n+1],u=r[n+2],(c&192)===128&&(u&192)===128&&(d=(s&15)<<12|(c&63)<<6|u&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:c=r[n+1],u=r[n+2],h=r[n+3],(c&192)===128&&(u&192)===128&&(h&192)===128&&(d=(s&15)<<18|(c&63)<<12|(u&63)<<6|h&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,l=1):o>65535&&(o-=65536,i.push(o>>>10&1023|55296),o=56320|o&1023),i.push(o),n+=l}return DD(i)}var tA=4096;function DD(r){let t=r.length;if(t<=tA)return String.fromCharCode.apply(String,r);let e="",i=0;for(;i<t;)e+=String.fromCharCode.apply(String,r.slice(i,i+=tA));return e}function ID(r,t,e){let i="";e=Math.min(r.length,e);for(let n=t;n<e;++n)i+=String.fromCharCode(r[n]&127);return i}function kD(r,t,e){let i="";e=Math.min(r.length,e);for(let n=t;n<e;++n)i+=String.fromCharCode(r[n]);return i}function ND(r,t,e){let i=r.length;(!t||t<0)&&(t=0),(!e||e<0||e>i)&&(e=i);let n="";for(let s=t;s<e;++s)n+=LD[r[s]];return n}function _D(r,t,e){let i=r.slice(t,e),n="";for(let s=0;s<i.length-1;s+=2)n+=String.fromCharCode(i[s]+i[s+1]*256);return n}Z.prototype.slice=function(t,e){let i=this.length;t=~~t,e=e===void 0?i:~~e,t<0?(t+=i,t<0&&(t=0)):t>i&&(t=i),e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),e<t&&(e=t);let n=this.subarray(t,e);return Object.setPrototypeOf(n,Z.prototype),n};function hi(r,t,e){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+t>e)throw new RangeError("Trying to access beyond buffer length")}Z.prototype.readUintLE=Z.prototype.readUIntLE=function(t,e,i){t=t>>>0,e=e>>>0,i||hi(t,e,this.length);let n=this[t],s=1,o=0;for(;++o<e&&(s*=256);)n+=this[t+o]*s;return n};Z.prototype.readUintBE=Z.prototype.readUIntBE=function(t,e,i){t=t>>>0,e=e>>>0,i||hi(t,e,this.length);let n=this[t+--e],s=1;for(;e>0&&(s*=256);)n+=this[t+--e]*s;return n};Z.prototype.readUint8=Z.prototype.readUInt8=function(t,e){return t=t>>>0,e||hi(t,1,this.length),this[t]};Z.prototype.readUint16LE=Z.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||hi(t,2,this.length),this[t]|this[t+1]<<8};Z.prototype.readUint16BE=Z.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||hi(t,2,this.length),this[t]<<8|this[t+1]};Z.prototype.readUint32LE=Z.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||hi(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};Z.prototype.readUint32BE=Z.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||hi(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};Z.prototype.readBigUInt64LE=La(function(t){t=t>>>0,Wc(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Dd(t,this.length-8);let n=e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,s=this[++t]+this[++t]*2**8+this[++t]*2**16+i*2**24;return BigInt(n)+(BigInt(s)<<BigInt(32))});Z.prototype.readBigUInt64BE=La(function(t){t=t>>>0,Wc(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Dd(t,this.length-8);let n=e*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],s=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i;return(BigInt(n)<<BigInt(32))+BigInt(s)});Z.prototype.readIntLE=function(t,e,i){t=t>>>0,e=e>>>0,i||hi(t,e,this.length);let n=this[t],s=1,o=0;for(;++o<e&&(s*=256);)n+=this[t+o]*s;return s*=128,n>=s&&(n-=Math.pow(2,8*e)),n};Z.prototype.readIntBE=function(t,e,i){t=t>>>0,e=e>>>0,i||hi(t,e,this.length);let n=e,s=1,o=this[t+--n];for(;n>0&&(s*=256);)o+=this[t+--n]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*e)),o};Z.prototype.readInt8=function(t,e){return t=t>>>0,e||hi(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};Z.prototype.readInt16LE=function(t,e){t=t>>>0,e||hi(t,2,this.length);let i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};Z.prototype.readInt16BE=function(t,e){t=t>>>0,e||hi(t,2,this.length);let i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};Z.prototype.readInt32LE=function(t,e){return t=t>>>0,e||hi(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};Z.prototype.readInt32BE=function(t,e){return t=t>>>0,e||hi(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};Z.prototype.readBigInt64LE=La(function(t){t=t>>>0,Wc(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Dd(t,this.length-8);let n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(i<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});Z.prototype.readBigInt64BE=La(function(t){t=t>>>0,Wc(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Dd(t,this.length-8);let n=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+i)});Z.prototype.readFloatLE=function(t,e){return t=t>>>0,e||hi(t,4,this.length),qc.read(this,t,!0,23,4)};Z.prototype.readFloatBE=function(t,e){return t=t>>>0,e||hi(t,4,this.length),qc.read(this,t,!1,23,4)};Z.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||hi(t,8,this.length),qc.read(this,t,!0,52,8)};Z.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||hi(t,8,this.length),qc.read(this,t,!1,52,8)};function rn(r,t,e,i,n,s){if(!Z.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw new RangeError('"value" argument is out of bounds');if(e+i>r.length)throw new RangeError("Index out of range")}Z.prototype.writeUintLE=Z.prototype.writeUIntLE=function(t,e,i,n){if(t=+t,e=e>>>0,i=i>>>0,!n){let l=Math.pow(2,8*i)-1;rn(this,t,e,i,l,0)}let s=1,o=0;for(this[e]=t&255;++o<i&&(s*=256);)this[e+o]=t/s&255;return e+i};Z.prototype.writeUintBE=Z.prototype.writeUIntBE=function(t,e,i,n){if(t=+t,e=e>>>0,i=i>>>0,!n){let l=Math.pow(2,8*i)-1;rn(this,t,e,i,l,0)}let s=i-1,o=1;for(this[e+s]=t&255;--s>=0&&(o*=256);)this[e+s]=t/o&255;return e+i};Z.prototype.writeUint8=Z.prototype.writeUInt8=function(t,e,i){return t=+t,e=e>>>0,i||rn(this,t,e,1,255,0),this[e]=t&255,e+1};Z.prototype.writeUint16LE=Z.prototype.writeUInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||rn(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};Z.prototype.writeUint16BE=Z.prototype.writeUInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||rn(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};Z.prototype.writeUint32LE=Z.prototype.writeUInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||rn(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=t&255,e+4};Z.prototype.writeUint32BE=Z.prototype.writeUInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||rn(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};function oA(r,t,e,i,n){dA(t,i,n,r,e,7);let s=Number(t&BigInt(4294967295));r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s,s=s>>8,r[e++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o,e}function lA(r,t,e,i,n){dA(t,i,n,r,e,7);let s=Number(t&BigInt(4294967295));r[e+7]=s,s=s>>8,r[e+6]=s,s=s>>8,r[e+5]=s,s=s>>8,r[e+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=o,o=o>>8,r[e+2]=o,o=o>>8,r[e+1]=o,o=o>>8,r[e]=o,e+8}Z.prototype.writeBigUInt64LE=La(function(t,e=0){return oA(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});Z.prototype.writeBigUInt64BE=La(function(t,e=0){return lA(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});Z.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e=e>>>0,!n){let c=Math.pow(2,8*i-1);rn(this,t,e,i,c-1,-c)}let s=0,o=1,l=0;for(this[e]=t&255;++s<i&&(o*=256);)t<0&&l===0&&this[e+s-1]!==0&&(l=1),this[e+s]=(t/o>>0)-l&255;return e+i};Z.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e=e>>>0,!n){let c=Math.pow(2,8*i-1);rn(this,t,e,i,c-1,-c)}let s=i-1,o=1,l=0;for(this[e+s]=t&255;--s>=0&&(o*=256);)t<0&&l===0&&this[e+s+1]!==0&&(l=1),this[e+s]=(t/o>>0)-l&255;return e+i};Z.prototype.writeInt8=function(t,e,i){return t=+t,e=e>>>0,i||rn(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};Z.prototype.writeInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||rn(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};Z.prototype.writeInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||rn(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};Z.prototype.writeInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||rn(this,t,e,4,2147483647,-2147483648),this[e]=t&255,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4};Z.prototype.writeInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||rn(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=t&255,e+4};Z.prototype.writeBigInt64LE=La(function(t,e=0){return oA(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});Z.prototype.writeBigInt64BE=La(function(t,e=0){return lA(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function cA(r,t,e,i,n,s){if(e+i>r.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function uA(r,t,e,i,n){return t=+t,e=e>>>0,n||cA(r,t,e,4,34028234663852886e22,-34028234663852886e22),qc.write(r,t,e,i,23,4),e+4}Z.prototype.writeFloatLE=function(t,e,i){return uA(this,t,e,!0,i)};Z.prototype.writeFloatBE=function(t,e,i){return uA(this,t,e,!1,i)};function hA(r,t,e,i,n){return t=+t,e=e>>>0,n||cA(r,t,e,8,17976931348623157e292,-17976931348623157e292),qc.write(r,t,e,i,52,8),e+8}Z.prototype.writeDoubleLE=function(t,e,i){return hA(this,t,e,!0,i)};Z.prototype.writeDoubleBE=function(t,e,i){return hA(this,t,e,!1,i)};Z.prototype.copy=function(t,e,i,n){if(!Z.isBuffer(t))throw new TypeError("argument should be a Buffer");if(i||(i=0),!n&&n!==0&&(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<i&&(n=i),n===i||t.length===0||this.length===0)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-i&&(n=t.length-e+i);let s=n-i;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(e,i,n):Uint8Array.prototype.set.call(t,this.subarray(i,n),e),s};Z.prototype.fill=function(t,e,i,n){if(typeof t=="string"){if(typeof e=="string"?(n=e,e=0,i=this.length):typeof i=="string"&&(n=i,i=this.length),n!==void 0&&typeof n!="string")throw new TypeError("encoding must be a string");if(typeof n=="string"&&!Z.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(t.length===1){let o=t.charCodeAt(0);(n==="utf8"&&o<128||n==="latin1")&&(t=o)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(e<0||this.length<e||this.length<i)throw new RangeError("Out of range index");if(i<=e)return this;e=e>>>0,i=i===void 0?this.length:i>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s<i;++s)this[s]=t;else{let o=Z.isBuffer(t)?t:Z.from(t,n),l=o.length;if(l===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<i-e;++s)this[s+e]=o[s%l]}return this};var Vc={};function ix(r,t,e){Vc[r]=class extends e{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(n){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:n,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}ix("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ix("ERR_INVALID_ARG_TYPE",function(r,t){return`The "${r}" argument must be of type number. Received type ${typeof t}`},TypeError);ix("ERR_OUT_OF_RANGE",function(r,t,e){let i=`The value of "${r}" is out of range.`,n=e;return Number.isInteger(e)&&Math.abs(e)>2**32?n=eA(String(e)):typeof e=="bigint"&&(n=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(n=eA(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i},RangeError);function eA(r){let t="",e=r.length,i=r[0]==="-"?1:0;for(;e>=i+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return`${r.slice(0,e)}${t}`}function MD(r,t,e){Wc(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&Dd(t,r.length-(e+1))}function dA(r,t,e,i,n,s){if(r>e||r<t){let o=typeof t=="bigint"?"n":"",l;throw s>3?t===0||t===BigInt(0)?l=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:l=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:l=`>= ${t}${o} and <= ${e}${o}`,new Vc.ERR_OUT_OF_RANGE("value",l,r)}MD(i,n,s)}function Wc(r,t){if(typeof r!="number")throw new Vc.ERR_INVALID_ARG_TYPE(t,"number",r)}function Dd(r,t,e){throw Math.floor(r)!==r?(Wc(r,e),new Vc.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new Vc.ERR_BUFFER_OUT_OF_BOUNDS:new Vc.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}var FD=/[^+/0-9A-Za-z-_]/g;function PD(r){if(r=r.split("=")[0],r=r.trim().replace(FD,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Jy(r,t){t=t||1/0;let e,i=r.length,n=null,s=[];for(let o=0;o<i;++o){if(e=r.charCodeAt(o),e>55295&&e<57344){if(!n){if(e>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=e;continue}if(e<56320){(t-=3)>-1&&s.push(239,191,189),n=e;continue}e=(n-55296<<10|e-56320)+65536}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,e<128){if((t-=1)<0)break;s.push(e)}else if(e<2048){if((t-=2)<0)break;s.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;s.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;s.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw new Error("Invalid code point")}return s}function OD(r){let t=[];for(let e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function RD(r,t){let e,i,n,s=[];for(let o=0;o<r.length&&!((t-=2)<0);++o)e=r.charCodeAt(o),i=e>>8,n=e%256,s.push(n),s.push(i);return s}function fA(r){return Ky.toByteArray(PD(r))}function Km(r,t,e,i){let n;for(n=0;n<i&&!(n+e>=t.length||n>=r.length);++n)t[n+e]=r[n];return n}function Vr(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function nx(r){return r!==r}var LD=(function(){let r="0123456789abcdef",t=new Array(256);for(let e=0;e<16;++e){let i=e*16;for(let n=0;n<16;++n)t[i+n]=r[e]+r[n]}return t})();function La(r){return typeof BigInt>"u"?BD:r}function BD(){throw new Error("BigInt not supported")}});var bA=Vt((KM,xA)=>{H();var Ge=xA.exports={},qr,Wr;function rx(){throw new Error("setTimeout has not been defined")}function sx(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?qr=setTimeout:qr=rx}catch{qr=rx}try{typeof clearTimeout=="function"?Wr=clearTimeout:Wr=sx}catch{Wr=sx}})();function mA(r){if(qr===setTimeout)return setTimeout(r,0);if((qr===rx||!qr)&&setTimeout)return qr=setTimeout,setTimeout(r,0);try{return qr(r,0)}catch{try{return qr.call(null,r,0)}catch{return qr.call(this,r,0)}}}function UD(r){if(Wr===clearTimeout)return clearTimeout(r);if((Wr===sx||!Wr)&&clearTimeout)return Wr=clearTimeout,clearTimeout(r);try{return Wr(r)}catch{try{return Wr.call(null,r)}catch{return Wr.call(this,r)}}}var _s=[],Yc=!1,Wo,Zm=-1;function zD(){!Yc||!Wo||(Yc=!1,Wo.length?_s=Wo.concat(_s):Zm=-1,_s.length&&gA())}function gA(){if(!Yc){var r=mA(zD);Yc=!0;for(var t=_s.length;t;){for(Wo=_s,_s=[];++Zm<t;)Wo&&Wo[Zm].run();Zm=-1,t=_s.length}Wo=null,Yc=!1,UD(r)}}Ge.nextTick=function(r){var t=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)t[e-1]=arguments[e];_s.push(new yA(r,t)),_s.length===1&&!Yc&&mA(gA)};function yA(r,t){this.fun=r,this.array=t}yA.prototype.run=function(){this.fun.apply(null,this.array)};Ge.title="browser";Ge.browser=!0;Ge.env={};Ge.argv=[];Ge.version="";Ge.versions={};function Ms(){}Ge.on=Ms;Ge.addListener=Ms;Ge.once=Ms;Ge.off=Ms;Ge.removeListener=Ms;Ge.removeAllListeners=Ms;Ge.emit=Ms;Ge.prependListener=Ms;Ge.prependOnceListener=Ms;Ge.listeners=function(r){return[]};Ge.binding=function(r){throw new Error("process.binding is not supported")};Ge.cwd=function(){return"/"};Ge.chdir=function(r){throw new Error("process.chdir is not supported")};Ge.umask=function(){return 0}});var at,rt,ax,H=te(()=>{"use strict";at=$c(pA()),rt=$c(bA()),ax=[typeof globalThis<"u"?globalThis:null,typeof window<"u"?window:null,typeof self<"u"?self:null,typeof window<"u"?window:null].filter(Boolean);ax.forEach(r=>{r.Buffer||(r.Buffer=at.Buffer),r.process||(r.process=rt.default)});typeof rt.default<"u"&&!rt.default.env&&(rt.default.env={NODE_ENV:"production"});if(typeof ax[0]<"u"){let r=ax[0];r.util||(r.util={debuglog:()=>()=>{},inspect:t=>JSON.stringify(t)})}});var Yo=Vt(Ei=>{"use strict";H();function HD(r,t,e){if(e===void 0&&(e=Array.prototype),r&&typeof e.find=="function")return e.find.call(r,t);for(var i=0;i<r.length;i++)if(Xo(r,i)){var n=r[i];if(t.call(void 0,n,i,r))return n}}function Zc(r,t){return t===void 0&&(t=Object),t&&typeof t.getOwnPropertyDescriptors=="function"&&(r=t.create(null,t.getOwnPropertyDescriptors(r))),t&&typeof t.freeze=="function"?t.freeze(r):r}function Xo(r,t){return Object.prototype.hasOwnProperty.call(r,t)}function GD(r,t){if(r===null||typeof r!="object")throw new TypeError("target is not an object");for(var e in t)Xo(t,e)&&(r[e]=t[e]);return r}var AA=Zc({allowfullscreen:!0,async:!0,autofocus:!0,autoplay:!0,checked:!0,controls:!0,default:!0,defer:!0,disabled:!0,formnovalidate:!0,hidden:!0,ismap:!0,itemscope:!0,loop:!0,multiple:!0,muted:!0,nomodule:!0,novalidate:!0,open:!0,playsinline:!0,readonly:!0,required:!0,reversed:!0,selected:!0});function $D(r){return Xo(AA,r.toLowerCase())}var vA=Zc({area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function VD(r){return Xo(vA,r.toLowerCase())}var Id=Zc({script:!1,style:!1,textarea:!0,title:!0});function qD(r){var t=r.toLowerCase();return Xo(Id,t)&&!Id[t]}function WD(r){var t=r.toLowerCase();return Xo(Id,t)&&Id[t]}function EA(r){return r===kd.HTML}function XD(r){return EA(r)||r===kd.XML_XHTML_APPLICATION}var kd=Zc({HTML:"text/html",XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),YD=Object.keys(kd).map(function(r){return kd[r]});function KD(r){return YD.indexOf(r)>-1}var ZD=Zc({HTML:"http://www.w3.org/1999/xhtml",SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Ei.assign=GD;Ei.find=HD;Ei.freeze=Zc;Ei.HTML_BOOLEAN_ATTRIBUTES=AA;Ei.HTML_RAW_TEXT_ELEMENTS=Id;Ei.HTML_VOID_ELEMENTS=vA;Ei.hasDefaultHTMLNamespace=XD;Ei.hasOwn=Xo;Ei.isHTMLBooleanAttribute=$D;Ei.isHTMLRawTextElement=qD;Ei.isHTMLEscapableRawTextElement=WD;Ei.isHTMLMimeType=EA;Ei.isHTMLVoidElement=VD;Ei.isValidMimeType=KD;Ei.MIME_TYPE=kd;Ei.NAMESPACE=ZD});var Pd=Vt(Fd=>{"use strict";H();var QD=Yo();function TA(r,t){r.prototype=Object.create(Error.prototype,{constructor:{value:r},name:{value:r.name,enumerable:!0,writable:t}})}var _d=QD.freeze({Error:"Error",IndexSizeError:"IndexSizeError",DomstringSizeError:"DomstringSizeError",HierarchyRequestError:"HierarchyRequestError",WrongDocumentError:"WrongDocumentError",InvalidCharacterError:"InvalidCharacterError",NoDataAllowedError:"NoDataAllowedError",NoModificationAllowedError:"NoModificationAllowedError",NotFoundError:"NotFoundError",NotSupportedError:"NotSupportedError",InUseAttributeError:"InUseAttributeError",InvalidStateError:"InvalidStateError",SyntaxError:"SyntaxError",InvalidModificationError:"InvalidModificationError",NamespaceError:"NamespaceError",InvalidAccessError:"InvalidAccessError",ValidationError:"ValidationError",TypeMismatchError:"TypeMismatchError",SecurityError:"SecurityError",NetworkError:"NetworkError",AbortError:"AbortError",URLMismatchError:"URLMismatchError",QuotaExceededError:"QuotaExceededError",TimeoutError:"TimeoutError",InvalidNodeTypeError:"InvalidNodeTypeError",DataCloneError:"DataCloneError",EncodingError:"EncodingError",NotReadableError:"NotReadableError",UnknownError:"UnknownError",ConstraintError:"ConstraintError",DataError:"DataError",TransactionInactiveError:"TransactionInactiveError",ReadOnlyError:"ReadOnlyError",VersionError:"VersionError",OperationError:"OperationError",NotAllowedError:"NotAllowedError",OptOutError:"OptOutError"}),SA=Object.keys(_d);function DA(r){return typeof r=="number"&&r>=1&&r<=25}function JD(r){return typeof r=="string"&&r.substring(r.length-_d.Error.length)===_d.Error}function Md(r,t){DA(r)?(this.name=SA[r],this.message=t||""):(this.message=r,this.name=JD(t)?t:_d.Error),Error.captureStackTrace&&Error.captureStackTrace(this,Md)}TA(Md,!0);Object.defineProperties(Md.prototype,{code:{enumerable:!0,get:function(){var r=SA.indexOf(this.name);return DA(r)?r:0}}});var IA={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25},ox=Object.entries(IA);for(Nd=0;Nd<ox.length;Nd++)CA=ox[Nd][0],Md[CA]=ox[Nd][1];var CA,Nd;function lx(r,t){this.message=r,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,lx)}TA(lx);Fd.DOMException=Md;Fd.DOMExceptionName=_d;Fd.ExceptionCode=IA;Fd.ParseError=lx});var mx=Vt(Lt=>{"use strict";H();function OA(r){try{typeof r!="function"&&(r=RegExp);var t=new r("\u{1D306}","u").exec("\u{1D306}");return!!t&&t[0].length===2}catch{}return!1}var tu=OA();function Ba(r){if(r.source[0]!=="[")throw new Error(r+" can not be used with chars");return r.source.slice(1,r.source.lastIndexOf("]"))}function Qc(r,t){if(r.source[0]!=="[")throw new Error("/"+r.source+"/ can not be used with chars_without");if(!t||typeof t!="string")throw new Error(JSON.stringify(t)+" is not a valid search");if(r.source.indexOf(t)===-1)throw new Error('"'+t+'" is not is /'+r.source+"/");if(t==="-"&&r.source.indexOf(t)!==1)throw new Error('"'+t+'" is not at the first postion of /'+r.source+"/");return new RegExp(r.source.replace(t,""),tu?"u":"")}function Gt(r){var t=this;return new RegExp(Array.prototype.slice.call(arguments).map(function(e){var i=typeof e=="string";if(i&&t===void 0&&e==="|")throw new Error("use regg instead of reg to wrap expressions with `|`!");return i?e:e.source}).join(""),tu?"mu":"m")}function Ft(r){if(arguments.length===0)throw new Error("no parameters provided");return Gt.apply(Ft,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var tI="\uFFFD",Ua=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;tu&&(Ua=Gt("[",Ba(Ua),"\\u{10000}-\\u{10FFFF}","]"));var eI=new RegExp("[^"+Ba(Ua)+"]",tu?"u":""),ux=/[\x20\x09\x0D\x0A]/,iI=Ba(ux),oe=Gt(ux,"+"),Se=Gt(ux,"*"),Od=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;tu&&(Od=Gt("[",Ba(Od),"\\u{10000}-\\u{10FFFF}","]"));var nI=Ba(Od),hx=Gt("[",nI,Ba(/[-.0-9\xB7]/),Ba(/[\u0300-\u036F\u203F-\u2040]/),"]"),Yn=Gt(Od,hx,"*"),kA=Gt(hx,"+"),rI=Gt("&",Yn,";"),sI=Ft(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Rd=Ft(rI,"|",sI),Ld=Gt("%",Yn,";"),dx=Ft(Gt('"',Ft(/[^%&"]/,"|",Ld,"|",Rd),"*",'"'),"|",Gt("'",Ft(/[^%&']/,"|",Ld,"|",Rd),"*","'")),aI=Ft('"',Ft(/[^<&"]/,"|",Rd),"*",'"',"|","'",Ft(/[^<&']/,"|",Rd),"*","'"),oI=Qc(Od,":"),lI=Qc(hx,":"),NA=Gt(oI,lI,"*"),Bd=Gt(NA,Ft(":",NA),"?"),cI=Gt("^",Bd,"$"),uI=Gt("(",Bd,")"),Jc=Ft(/"[^"]*"|'[^']*'/),hI=Gt(/^<\?/,"(",Yn,")",Ft(oe,"(",Ua,"*?)"),"?",/\?>/),_A=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Ud=Ft('"',_A,'*"',"|","'",Qc(_A,"'"),"*'"),RA="<!--",LA="-->",dI=Gt(RA,Ft(Qc(Ua,"-"),"|",Gt("-",Qc(Ua,"-"))),"*",LA),MA="#PCDATA",fI=Ft(Gt(/\(/,Se,MA,Ft(Se,/\|/,Se,Bd),"*",Se,/\)\*/),"|",Gt(/\(/,Se,MA,Se,/\)/)),pI=/[?*+]?/,mI=Gt(/\([^>]+\)/,pI),gI=Ft("EMPTY","|","ANY","|",fI,"|",mI),yI="<!ELEMENT",xI=Gt(yI,oe,Ft(Bd,"|",Ld),oe,Ft(gI,"|",Ld),Se,">"),bI=Gt("NOTATION",oe,/\(/,Se,Yn,Ft(Se,/\|/,Se,Yn),"*",Se,/\)/),wI=Gt(/\(/,Se,kA,Ft(Se,/\|/,Se,kA),"*",Se,/\)/),AI=Ft(bI,"|",wI),vI=Ft(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",AI),EI=Ft(/#REQUIRED|#IMPLIED/,"|",Ft(Ft("#FIXED",oe),"?",aI)),CI=Ft(oe,Yn,oe,vI,oe,EI),TI="<!ATTLIST",SI=Gt(TI,oe,Yn,CI,"*",Se,">"),cx="about:legacy-compat",DI=Ft('"'+cx+'"',"|","'"+cx+"'"),fx="SYSTEM",Jm="PUBLIC",tg=Ft(Ft(fx,oe,Jc),"|",Ft(Jm,oe,Ud,oe,Jc)),II=Gt("^",Ft(Ft(fx,oe,"(?<SystemLiteralOnly>",Jc,")"),"|",Ft(Jm,oe,"(?<PubidLiteral>",Ud,")",oe,"(?<SystemLiteral>",Jc,")"))),kI=Gt("^",Ud,"$"),NI=Gt("^",Jc,"$"),_I=Ft(oe,"NDATA",oe,Yn),MI=Ft(dx,"|",Ft(tg,_I,"?")),BA="<!ENTITY",FI=Gt(BA,oe,Yn,oe,MI,Se,">"),PI=Ft(dx,"|",tg),OI=Gt(BA,oe,"%",oe,Yn,oe,PI,Se,">"),RI=Ft(FI,"|",OI),LI=Gt(Jm,oe,Ud),BI=Gt("<!NOTATION",oe,Yn,oe,Ft(tg,"|",LI),Se,">"),px=Gt(Se,"=",Se),FA=/1[.]\d+/,UI=Gt(oe,"version",px,Ft("'",FA,"'","|",'"',FA,'"')),PA=/[A-Za-z][-A-Za-z0-9._]*/,zI=Ft(oe,"encoding",px,Ft('"',PA,'"',"|","'",PA,"'")),jI=Ft(oe,"standalone",px,Ft("'",Ft("yes","|","no"),"'","|",'"',Ft("yes","|","no"),'"')),HI=Gt(/^<\?xml/,UI,zI,"?",jI,"?",Se,/\?>/),GI="<!DOCTYPE",$I="<![CDATA[",VI="]]>",qI=/<!\[CDATA\[/,WI=/\]\]>/,XI=Gt(Ua,"*?",WI),YI=Gt(qI,XI);Lt.chars=Ba;Lt.chars_without=Qc;Lt.detectUnicodeSupport=OA;Lt.reg=Gt;Lt.regg=Ft;Lt.ABOUT_LEGACY_COMPAT=cx;Lt.ABOUT_LEGACY_COMPAT_SystemLiteral=DI;Lt.AttlistDecl=SI;Lt.CDATA_START=$I;Lt.CDATA_END=VI;Lt.CDSect=YI;Lt.Char=Ua;Lt.Comment=dI;Lt.COMMENT_START=RA;Lt.COMMENT_END=LA;Lt.DOCTYPE_DECL_START=GI;Lt.elementdecl=xI;Lt.EntityDecl=RI;Lt.EntityValue=dx;Lt.ExternalID=tg;Lt.ExternalID_match=II;Lt.Name=Yn;Lt.NotationDecl=BI;Lt.Reference=Rd;Lt.PEReference=Ld;Lt.PI=hI;Lt.PUBLIC=Jm;Lt.PubidLiteral=Ud;Lt.PubidLiteral_match=kI;Lt.QName=Bd;Lt.QName_exact=cI;Lt.QName_group=uI;Lt.S=oe;Lt.SChar_s=iI;Lt.S_OPT=Se;Lt.SYSTEM=fx;Lt.SystemLiteral=Jc;Lt.SystemLiteral_match=NI;Lt.InvalidChar=eI;Lt.UNICODE_REPLACEMENT_CHARACTER=tI;Lt.UNICODE_SUPPORT=tu;Lt.XMLDecl=HI});var Ex=Vt(Oe=>{"use strict";H();var Qn=Yo(),Yr=Qn.find,KI=Qn.hasDefaultHTMLNamespace,iu=Qn.hasOwn,ZI=Qn.isHTMLMimeType,QI=Qn.isHTMLRawTextElement,JI=Qn.isHTMLVoidElement,zd=Qn.MIME_TYPE,Kr=Qn.NAMESPACE,Vi=Symbol(),VA=Pd(),Dt=VA.DOMException,Kn=VA.DOMExceptionName,Ci=mx();function sn(r){if(r!==Vi)throw new TypeError("Illegal constructor")}function tk(r){return r!==""}function ek(r){return r?r.split(/[\t\n\f\r ]+/).filter(tk):[]}function ik(r,t){return iu(r,t)||(r[t]=!0),r}function UA(r){if(!r)return[];var t=ek(r);return Object.keys(t.reduce(ik,{}))}function nk(r){return function(t){return r&&r.indexOf(t)!==-1}}function qA(r){if(!Ci.QName_exact.test(r))throw new Dt(Dt.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+r+'"')}function yx(r,t){qA(t),r=r||null;var e=null,i=t;if(t.indexOf(":")>=0){var n=t.split(":");e=n[0],i=n[1]}if(e!==null&&r===null)throw new Dt(Dt.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(e==="xml"&&r!==Qn.NAMESPACE.XML)throw new Dt(Dt.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((e==="xmlns"||t==="xmlns")&&r!==Qn.NAMESPACE.XMLNS)throw new Dt(Dt.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(r===Qn.NAMESPACE.XMLNS&&e!=="xmlns"&&t!=="xmlns")throw new Dt(Dt.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[r,e,i]}function su(r,t){for(var e in r)iu(r,e)&&(t[e]=r[e])}function an(r,t){var e=r.prototype;if(!(e instanceof t)){let i=function(){};i.prototype=t.prototype,i=new i,su(e,i),r.prototype=e=i}e.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),e.constructor=r)}var on={},Zn=on.ELEMENT_NODE=1,nu=on.ATTRIBUTE_NODE=2,ng=on.TEXT_NODE=3,WA=on.CDATA_SECTION_NODE=4,XA=on.ENTITY_REFERENCE_NODE=5,rk=on.ENTITY_NODE=6,xx=on.PROCESSING_INSTRUCTION_NODE=7,bx=on.COMMENT_NODE=8,eu=on.DOCUMENT_NODE=9,YA=on.DOCUMENT_TYPE_NODE=10,za=on.DOCUMENT_FRAGMENT_NODE=11,sk=on.NOTATION_NODE=12,Pe=Qn.freeze({DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:2,DOCUMENT_POSITION_FOLLOWING:4,DOCUMENT_POSITION_CONTAINS:8,DOCUMENT_POSITION_CONTAINED_BY:16,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:32});function KA(r,t){if(t.length<r.length)return KA(t,r);var e=null;for(var i in r){if(r[i]!==t[i])return e;e=r[i]}return e}function zA(r){return r.guid||(r.guid=Math.random()),r.guid}function ni(){}ni.prototype={length:0,item:function(r){return r>=0&&r<this.length?this[r]:null},toString:function(r){var t;typeof r=="function"?t={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:r}:r?t={requireWellFormed:!!r.requireWellFormed,splitCDATASections:r.splitCDATASections!==!1,nodeFilter:r.nodeFilter||null}:t={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};for(var e=[],i=0;i<this.length;i++)vx(this[i],e,null,t);return e.join("")},filter:function(r){return Array.prototype.filter.call(this,r)},indexOf:function(r){return Array.prototype.indexOf.call(this,r)}};ni.prototype[Symbol.iterator]=function(){var r=this,t=0;return{next:function(){return t<r.length?{value:r[t++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function Xr(r,t){this._node=r,this._refresh=t,sg(this)}function sg(r){var t=r._node._inc||r._node.ownerDocument._inc;if(r._inc!==t){var e=r._refresh(r._node);if(lv(r,"length",e.length),!r.$$length||e.length<r.$$length)for(var i=e.length;i in r;i++)iu(r,i)&&delete r[i];su(e,r),r._inc=t}}Xr.prototype.item=function(r){return sg(this),this[r]||null};an(Xr,ni);function ru(){}function ZA(r,t){for(var e=0;e<r.length;){if(r[e]===t)return e;e++}}function ak(r,t,e,i){if(i?t[ZA(t,i)]=e:(t[t.length]=e,t.length++),r){e.ownerElement=r;var n=r.ownerDocument;n&&(i&&tv(n,r,i),ok(n,r,e))}}function jA(r,t,e){var i=ZA(t,e);if(i>=0){for(var n=t.length-1;i<=n;)t[i]=t[++i];if(t.length=n,r){var s=r.ownerDocument;s&&tv(s,r,e),e.ownerElement=null}}}ru.prototype={length:0,item:ni.prototype.item,getNamedItem:function(r){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());for(var t=0;t<this.length;){var e=this[t];if(e.nodeName===r)return e;t++}return null},setNamedItem:function(r){var t=r.ownerElement;if(t&&t!==this._ownerElement)throw new Dt(Dt.INUSE_ATTRIBUTE_ERR);var e=this.getNamedItemNS(r.namespaceURI,r.localName);return e===r?r:(ak(this._ownerElement,this,r,e),e)},setNamedItemNS:function(r){return this.setNamedItem(r)},removeNamedItem:function(r){var t=this.getNamedItem(r);if(!t)throw new Dt(Dt.NOT_FOUND_ERR,r);return jA(this._ownerElement,this,t),t},removeNamedItemNS:function(r,t){var e=this.getNamedItemNS(r,t);if(!e)throw new Dt(Dt.NOT_FOUND_ERR,r?r+" : "+t:t);return jA(this._ownerElement,this,e),e},getNamedItemNS:function(r,t){r||(r=null);for(var e=0;e<this.length;){var i=this[e];if(i.localName===t&&i.namespaceURI===r)return i;e++}return null}};ru.prototype[Symbol.iterator]=function(){var r=this,t=0;return{next:function(){return t<r.length?{value:r[t++],done:!1}:{done:!0}},return:function(){return{done:!0}}}};function QA(){}QA.prototype={hasFeature:function(r,t){return!0},createDocument:function(r,t,e){var i=zd.XML_APPLICATION;r===Kr.HTML?i=zd.XML_XHTML_APPLICATION:r===Kr.SVG&&(i=zd.XML_SVG_IMAGE);var n=new Ps(Vi,{contentType:i});if(n.implementation=this,n.childNodes=new ni,n.doctype=e||null,e&&n.appendChild(e),t){var s=n.createElementNS(r,t);n.appendChild(s)}return n},createDocumentType:function(r,t,e,i){qA(r);var n=new lg(Vi);return n.name=r,n.nodeName=r,n.publicId=t||"",n.systemId=e||"",n.internalSubset=i||"",n.childNodes=new ni,n},createHTMLDocument:function(r){var t=new Ps(Vi,{contentType:zd.HTML});if(t.implementation=this,t.childNodes=new ni,r!==!1){t.doctype=this.createDocumentType("html"),t.doctype.ownerDocument=t,t.appendChild(t.doctype);var e=t.createElement("html");t.appendChild(e);var i=t.createElement("head");if(e.appendChild(i),typeof r=="string"){var n=t.createElement("title");n.appendChild(t.createTextNode(r)),i.appendChild(n)}e.appendChild(t.createElement("body"))}return t}};function Yt(r){sn(r)}Yt.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,parentNode:null,get parentElement(){return this.parentNode&&this.parentNode.nodeType===this.ELEMENT_NODE?this.parentNode:null},childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,baseURI:"about:blank",get isConnected(){var r=this.getRootNode();return r&&r.nodeType===r.DOCUMENT_NODE},contains:function(r){if(!r)return!1;var t=r;do{if(this===t)return!0;t=t.parentNode}while(t);return!1},getRootNode:function(r){var t=this;do{if(!t.parentNode)return t;t=t.parentNode}while(t)},isEqualNode:function(r){if(!r)return!1;for(var t=[{node:this,other:r}];t.length>0;){var e=t.pop(),i=e.node,n=e.other;if(i.nodeType!==n.nodeType)return!1;switch(i.nodeType){case i.DOCUMENT_TYPE_NODE:if(i.name!==n.name||i.publicId!==n.publicId||i.systemId!==n.systemId)return!1;break;case i.ELEMENT_NODE:if(i.namespaceURI!==n.namespaceURI||i.prefix!==n.prefix||i.localName!==n.localName||i.attributes.length!==n.attributes.length)return!1;for(var s=0;s<i.attributes.length;s++){var o=i.attributes.item(s),l=n.getAttributeNodeNS(o.namespaceURI,o.localName);if(!l)return!1;t.push({node:o,other:l})}break;case i.ATTRIBUTE_NODE:if(i.namespaceURI!==n.namespaceURI||i.localName!==n.localName||i.value!==n.value)return!1;break;case i.PROCESSING_INSTRUCTION_NODE:if(i.target!==n.target||i.data!==n.data)return!1;break;case i.TEXT_NODE:case i.CDATA_SECTION_NODE:case i.COMMENT_NODE:if(i.data!==n.data)return!1;break}if(i.childNodes.length!==n.childNodes.length)return!1;for(var s=i.childNodes.length-1;s>=0;s--)t.push({node:i.childNodes[s],other:n.childNodes[s]})}return!0},isSameNode:function(r){return this===r},insertBefore:function(r,t){return rg(this,r,t)},replaceChild:function(r,t){rg(this,r,t,rv),t&&this.removeChild(t)},removeChild:function(r){return iv(this,r)},appendChild:function(r){return this.insertBefore(r,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(r){return ov(this.ownerDocument||this,this,r)},normalize:function(){Ti(this,null,{enter:function(r){for(var t=r.firstChild;t;){var e=t.nextSibling;e!==null&&e.nodeType===ng&&t.nodeType===ng?(r.removeChild(e),t.appendData(e.data)):t=e}return!0}})},isSupported:function(r,t){return this.ownerDocument.implementation.hasFeature(r,t)},lookupPrefix:function(r){for(var t=this;t;){var e=t._nsMap;if(e){for(var i in e)if(iu(e,i)&&e[i]===r)return i}t=t.nodeType==nu?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(r){for(var t=this;t;){var e=t._nsMap;if(e&&iu(e,r))return e[r];t=t.nodeType==nu?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(r){var t=this.lookupPrefix(r);return t==null},compareDocumentPosition:function(r){if(this===r)return 0;var t=r,e=this,i=null,n=null;if(t instanceof Ko&&(i=t,t=i.ownerElement),e instanceof Ko&&(n=e,e=n.ownerElement,i&&t&&e===t))for(var s=0,o;o=e.attributes[s];s++){if(o===i)return Pe.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+Pe.DOCUMENT_POSITION_PRECEDING;if(o===n)return Pe.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+Pe.DOCUMENT_POSITION_FOLLOWING}if(!t||!e||e.ownerDocument!==t.ownerDocument)return Pe.DOCUMENT_POSITION_DISCONNECTED+Pe.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC+(zA(e.ownerDocument)>zA(t.ownerDocument)?Pe.DOCUMENT_POSITION_FOLLOWING:Pe.DOCUMENT_POSITION_PRECEDING);if(n&&t===e)return Pe.DOCUMENT_POSITION_CONTAINS+Pe.DOCUMENT_POSITION_PRECEDING;if(i&&t===e)return Pe.DOCUMENT_POSITION_CONTAINED_BY+Pe.DOCUMENT_POSITION_FOLLOWING;for(var l=[],c=t.parentNode;c;){if(!n&&c===e)return Pe.DOCUMENT_POSITION_CONTAINED_BY+Pe.DOCUMENT_POSITION_FOLLOWING;l.push(c),c=c.parentNode}l.reverse();for(var u=[],h=e.parentNode;h;){if(!i&&h===t)return Pe.DOCUMENT_POSITION_CONTAINS+Pe.DOCUMENT_POSITION_PRECEDING;u.push(h),h=h.parentNode}u.reverse();var d=KA(l,u);for(var f in d.childNodes){var m=d.childNodes[f];if(m===e)return Pe.DOCUMENT_POSITION_FOLLOWING;if(m===t)return Pe.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(m)>=0)return Pe.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(m)>=0)return Pe.DOCUMENT_POSITION_PRECEDING}return 0}};function JA(r){return r=="<"&&"&lt;"||r==">"&&"&gt;"||r=="&"&&"&amp;"||r=='"'&&"&quot;"||"&#"+r.charCodeAt()+";"}su(on,Yt);su(on,Yt.prototype);su(Pe,Yt);su(Pe,Yt.prototype);function ig(r,t){Ti(r,null,{enter:function(e){return t(e)?Ti.STOP:!0}})}function Ti(r,t,e){for(var i=[{node:r,context:t,phase:Ti.ENTER}];i.length>0;){var n=i.pop();if(n.phase===Ti.ENTER){var s=e.enter(n.node,n.context);if(s===Ti.STOP)return Ti.STOP;if(i.push({node:n.node,context:s,phase:Ti.EXIT}),s==null)continue;for(var o=n.node.lastChild;o;)i.push({node:o,context:s,phase:Ti.ENTER}),o=o.previousSibling}else e.exit&&e.exit(n.node,n.context)}}Ti.STOP=Symbol("walkDOM.STOP");Ti.ENTER=0;Ti.EXIT=1;function Ps(r,t){sn(r);var e=t||{};this.ownerDocument=this,this.contentType=e.contentType||zd.XML_APPLICATION,this.type=ZI(this.contentType)?"html":"xml"}function ok(r,t,e){r&&r._inc++;var i=e.namespaceURI;i===Kr.XMLNS&&(t._nsMap[e.prefix?e.localName:""]=e.value)}function tv(r,t,e,i){r&&r._inc++;var n=e.namespaceURI;n===Kr.XMLNS&&delete t._nsMap[e.prefix?e.localName:""]}function ev(r,t,e){if(r&&r._inc){r._inc++;var i=t.childNodes;if(e&&!e.nextSibling)i[i.length++]=e;else{for(var n=t.firstChild,s=0;n;)i[s++]=n,n=n.nextSibling;i.length=s,delete i[i.length]}}}function iv(r,t){if(r!==t.parentNode)throw new Dt(Dt.NOT_FOUND_ERR,"child's parent is not parent");var e=t.previousSibling,i=t.nextSibling;return e?e.nextSibling=i:r.firstChild=i,i?i.previousSibling=e:r.lastChild=e,ev(r.ownerDocument,r),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}function lk(r){return r&&(r.nodeType===Yt.DOCUMENT_NODE||r.nodeType===Yt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Yt.ELEMENT_NODE)}function ck(r){return r&&(r.nodeType===Yt.CDATA_SECTION_NODE||r.nodeType===Yt.COMMENT_NODE||r.nodeType===Yt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Yt.DOCUMENT_TYPE_NODE||r.nodeType===Yt.ELEMENT_NODE||r.nodeType===Yt.PROCESSING_INSTRUCTION_NODE||r.nodeType===Yt.TEXT_NODE)}function ja(r){return r&&r.nodeType===Yt.DOCUMENT_TYPE_NODE}function Fs(r){return r&&r.nodeType===Yt.ELEMENT_NODE}function nv(r){return r&&r.nodeType===Yt.TEXT_NODE}function HA(r,t){var e=r.childNodes||[];if(Yr(e,Fs)||ja(t))return!1;var i=Yr(e,ja);return!(t&&i&&e.indexOf(i)>e.indexOf(t))}function GA(r,t){var e=r.childNodes||[];function i(s){return Fs(s)&&s!==t}if(Yr(e,i))return!1;var n=Yr(e,ja);return!(t&&n&&e.indexOf(n)>e.indexOf(t))}function uk(r,t,e){if(!lk(r))throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+r.nodeType);if(e&&e.parentNode!==r)throw new Dt(Dt.NOT_FOUND_ERR,"child not in parent");if(!ck(t)||ja(t)&&r.nodeType!==Yt.DOCUMENT_NODE)throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+r.nodeType)}function hk(r,t,e){var i=r.childNodes||[],n=t.childNodes||[];if(t.nodeType===Yt.DOCUMENT_FRAGMENT_NODE){var s=n.filter(Fs);if(s.length>1||Yr(n,nv))throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!HA(r,e))throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Fs(t)&&!HA(r,e))throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(ja(t)){if(Yr(i,ja))throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Yr(i,Fs);if(e&&i.indexOf(o)<i.indexOf(e))throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element");if(!e&&o)throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"Doctype can not be appended since element is present")}}function rv(r,t,e){var i=r.childNodes||[],n=t.childNodes||[];if(t.nodeType===Yt.DOCUMENT_FRAGMENT_NODE){var s=n.filter(Fs);if(s.length>1||Yr(n,nv))throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!GA(r,e))throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Fs(t)&&!GA(r,e))throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(ja(t)){if(Yr(i,function(c){return ja(c)&&c!==e}))throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Yr(i,Fs);if(e&&i.indexOf(o)<i.indexOf(e))throw new Dt(Dt.HIERARCHY_REQUEST_ERR,"Doctype can only be inserted before an element")}}function rg(r,t,e,i){uk(r,t,e),r.nodeType===Yt.DOCUMENT_NODE&&(i||hk)(r,t,e);var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===za){var s=t.firstChild;if(s==null)return t;var o=t.lastChild}else s=o=t;var l=e?e.previousSibling:r.lastChild;s.previousSibling=l,o.nextSibling=e,l?l.nextSibling=s:r.firstChild=s,e==null?r.lastChild=o:e.previousSibling=o;do s.parentNode=r;while(s!==o&&(s=s.nextSibling));return ev(r.ownerDocument||r,r,t),t.nodeType==za&&(t.firstChild=t.lastChild=null),t}Ps.prototype={implementation:null,nodeName:"#document",nodeType:eu,doctype:null,documentElement:null,_inc:1,insertBefore:function(r,t){if(r.nodeType===za){for(var e=r.firstChild;e;){var i=e.nextSibling;this.insertBefore(e,t),e=i}return r}return rg(this,r,t),r.ownerDocument=this,this.documentElement===null&&r.nodeType===Zn&&(this.documentElement=r),r},removeChild:function(r){var t=iv(this,r);return t===this.documentElement&&(this.documentElement=null),t},replaceChild:function(r,t){rg(this,r,t,rv),r.ownerDocument=this,t&&this.removeChild(t),Fs(r)&&(this.documentElement=r)},importNode:function(r,t){return dk(this,r,t)},getElementById:function(r){var t=null;return ig(this.documentElement,function(e){if(e.nodeType==Zn&&e.getAttribute("id")==r)return t=e,!0}),t},createElement:function(r){var t=new Os(Vi);t.ownerDocument=this,this.type==="html"&&(r=r.toLowerCase()),KI(this.contentType)&&(t.namespaceURI=Kr.HTML),t.nodeName=r,t.tagName=r,t.localName=r,t.childNodes=new ni;var e=t.attributes=new ru;return e._ownerElement=t,t},createDocumentFragment:function(){var r=new ou(Vi);return r.ownerDocument=this,r.childNodes=new ni,r},createTextNode:function(r){var t=new jd(Vi);return t.ownerDocument=this,t.childNodes=new ni,t.appendData(r),t},createComment:function(r){var t=new ag(Vi);return t.ownerDocument=this,t.childNodes=new ni,t.appendData(r),t},createCDATASection:function(r){if(r.indexOf("]]>")!==-1)throw new Dt(Dt.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new og(Vi);return t.ownerDocument=this,t.childNodes=new ni,t.appendData(r),t},createProcessingInstruction:function(r,t){var e=new ug(Vi);return e.ownerDocument=this,e.childNodes=new ni,e.nodeName=e.target=r,e.nodeValue=e.data=t,e},createAttribute:function(r){if(!Ci.QName_exact.test(r))throw new Dt(Dt.INVALID_CHARACTER_ERR,'invalid character in name "'+r+'"');return this.type==="html"&&(r=r.toLowerCase()),this._createAttribute(r)},_createAttribute:function(r){var t=new Ko(Vi);return t.ownerDocument=this,t.childNodes=new ni,t.name=r,t.nodeName=r,t.localName=r,t.specified=!0,t},createEntityReference:function(r){if(!Ci.Name.test(r))throw new Dt(Dt.INVALID_CHARACTER_ERR,'not a valid xml name "'+r+'"');if(this.type==="html")throw new Dt("document is an html document",Kn.NotSupportedError);var t=new cg(Vi);return t.ownerDocument=this,t.childNodes=new ni,t.nodeName=r,t},createElementNS:function(r,t){var e=yx(r,t),i=new Os(Vi),n=i.attributes=new ru;return i.childNodes=new ni,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e[0],i.prefix=e[1],i.localName=e[2],n._ownerElement=i,i},createAttributeNS:function(r,t){var e=yx(r,t),i=new Ko(Vi);return i.ownerDocument=this,i.childNodes=new ni,i.nodeName=t,i.name=t,i.specified=!0,i.namespaceURI=e[0],i.prefix=e[1],i.localName=e[2],i}};an(Ps,Yt);function Os(r){sn(r),this._nsMap=Object.create(null)}Os.prototype={nodeType:Zn,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===Kr.HTML},hasAttributes:function(){return!!(this.attributes&&this.attributes.length)},hasAttribute:function(r){return!!this.getAttributeNode(r)},getAttribute:function(r){var t=this.getAttributeNode(r);return t?t.value:null},getAttributeNode:function(r){return this._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase()),this.attributes.getNamedItem(r)},setAttribute:function(r,t){this._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());var e=this.getAttributeNode(r);e?e.value=e.nodeValue=""+t:(e=this.ownerDocument._createAttribute(r),e.value=e.nodeValue=""+t,this.setAttributeNode(e))},removeAttribute:function(r){var t=this.getAttributeNode(r);t&&this.removeAttributeNode(t)},setAttributeNode:function(r){return this.attributes.setNamedItem(r)},setAttributeNodeNS:function(r){return this.attributes.setNamedItemNS(r)},removeAttributeNode:function(r){return this.attributes.removeNamedItem(r.nodeName)},removeAttributeNS:function(r,t){var e=this.getAttributeNodeNS(r,t);e&&this.removeAttributeNode(e)},hasAttributeNS:function(r,t){return this.getAttributeNodeNS(r,t)!=null},getAttributeNS:function(r,t){var e=this.getAttributeNodeNS(r,t);return e?e.value:null},setAttributeNS:function(r,t,e){var i=yx(r,t),n=i[2],s=this.getAttributeNodeNS(r,n);s?s.value=s.nodeValue=""+e:(s=this.ownerDocument.createAttributeNS(r,t),s.value=s.nodeValue=""+e,this.setAttributeNode(s))},getAttributeNodeNS:function(r,t){return this.attributes.getNamedItemNS(r,t)},getElementsByClassName:function(r){var t=UA(r);return new Xr(this,function(e){var i=[];return t.length>0&&ig(e,function(n){if(n!==e&&n.nodeType===Zn){var s=n.getAttribute("class");if(s){var o=r===s;if(!o){var l=UA(s);o=t.every(nk(l))}o&&i.push(n)}}}),i})},getElementsByTagName:function(r){var t=(this.nodeType===eu?this:this.ownerDocument).type==="html",e=r.toLowerCase();return new Xr(this,function(i){var n=[];return ig(i,function(s){if(!(s===i||s.nodeType!==Zn))if(r==="*")n.push(s);else{var o=s.getQualifiedName(),l=t&&s.namespaceURI===Kr.HTML?e:r;o===l&&n.push(s)}}),n})},getElementsByTagNameNS:function(r,t){return new Xr(this,function(e){var i=[];return ig(e,function(n){n!==e&&n.nodeType===Zn&&(r==="*"||n.namespaceURI===r)&&(t==="*"||n.localName==t)&&i.push(n)}),i})}};Ps.prototype.getElementsByClassName=Os.prototype.getElementsByClassName;Ps.prototype.getElementsByTagName=Os.prototype.getElementsByTagName;Ps.prototype.getElementsByTagNameNS=Os.prototype.getElementsByTagNameNS;an(Os,Yt);function Ko(r){sn(r),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}Ko.prototype.nodeType=nu;an(Ko,Yt);function au(r){sn(r)}au.prototype={data:"",substringData:function(r,t){return this.data.substring(r,r+t)},appendData:function(r){r=this.data+r,this.nodeValue=this.data=r,this.length=r.length},insertData:function(r,t){this.replaceData(r,0,t)},deleteData:function(r,t){this.replaceData(r,t,"")},replaceData:function(r,t,e){var i=this.data.substring(0,r),n=this.data.substring(r+t);e=i+e+n,this.nodeValue=this.data=e,this.length=e.length}};an(au,Yt);function jd(r){sn(r)}jd.prototype={nodeName:"#text",nodeType:ng,splitText:function(r){var t=this.data,e=t.substring(r);t=t.substring(0,r),this.data=this.nodeValue=t,this.length=t.length;var i=this.ownerDocument.createTextNode(e);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}};an(jd,au);function ag(r){sn(r)}ag.prototype={nodeName:"#comment",nodeType:bx};an(ag,au);function og(r){sn(r)}og.prototype={nodeName:"#cdata-section",nodeType:WA};an(og,jd);function lg(r){sn(r)}lg.prototype.nodeType=YA;an(lg,Yt);function wx(r){sn(r)}wx.prototype.nodeType=sk;an(wx,Yt);function Ax(r){sn(r)}Ax.prototype.nodeType=rk;an(Ax,Yt);function cg(r){sn(r)}cg.prototype.nodeType=XA;an(cg,Yt);function ou(r){sn(r)}ou.prototype.nodeName="#document-fragment";ou.prototype.nodeType=za;an(ou,Yt);function ug(r){sn(r)}ug.prototype.nodeType=xx;an(ug,au);function sv(){}sv.prototype.serializeToString=function(r,t){return av.call(r,t)};Yt.prototype.toString=av;function av(r){var t;typeof r=="function"?t={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:r}:r!=null?t={requireWellFormed:!!r.requireWellFormed,splitCDATASections:r.splitCDATASections!==!1,nodeFilter:r.nodeFilter||null}:t={requireWellFormed:!1,splitCDATASections:!0,nodeFilter:null};var e=[],i=this.nodeType===eu&&this.documentElement||this,n=i.prefix,s=i.namespaceURI;if(s&&n==null){var n=i.lookupPrefix(s);if(n==null)var o=[{namespace:s,prefix:null}]}return vx(this,e,o,t),e.join("")}function $A(r,t,e){var i=r.prefix||"",n=r.namespaceURI;if(!n||i==="xml"&&n===Kr.XML||n===Kr.XMLNS)return!1;for(var s=e.length;s--;){var o=e[s];if(o.prefix===i)return o.namespace!==n}return!0}function eg(r,t,e){r.push(" ",t,'="',e.replace(/[<>&"\t\n\r]/g,JA),'"')}function vx(r,t,e,i){e||(e=[]);var n=i.nodeFilter,s=i.requireWellFormed,o=i.splitCDATASections,l=r.nodeType===eu?r:r.ownerDocument,c=l.type==="html";Ti(r,{ns:e},{enter:function(u,h){var d=h.ns;if(n)if(u=n(u),u){if(typeof u=="string")return t.push(u),null}else return null;switch(u.nodeType){case Zn:var f=u.attributes,m=f.length,x=u.tagName,y=x;if(!c&&!u.prefix&&u.namespaceURI){for(var A,w=0;w<f.length;w++)if(f.item(w).name==="xmlns"){A=f.item(w).value;break}if(!A)for(var v=d.length-1;v>=0;v--){var C=d[v];if(C.prefix===""&&C.namespace===u.namespaceURI){A=C.namespace;break}}if(A!==u.namespaceURI)for(var v=d.length-1;v>=0;v--){var C=d[v];if(C.namespace===u.namespaceURI){C.prefix&&(y=C.prefix+":"+x);break}}}t.push("<",y);for(var D=d.slice(),_=0;_<m;_++){var k=f.item(_);k.prefix=="xmlns"?D.push({prefix:k.localName,namespace:k.value}):k.nodeName=="xmlns"&&D.push({prefix:"",namespace:k.value})}for(var _=0;_<m;_++){var k=f.item(_);if($A(k,c,D)){var R=k.prefix||"",K=k.namespaceURI;eg(t,R?"xmlns:"+R:"xmlns",K),D.push({prefix:R,namespace:K})}var W=n?n(k):k;W&&(typeof W=="string"?t.push(W):eg(t,W.name,W.value))}if(x===y&&$A(u,c,D)){var V=u.prefix||"",K=u.namespaceURI;eg(t,V?"xmlns:"+V:"xmlns",K),D.push({prefix:V,namespace:K})}var U=!u.firstChild;if(U&&(c||u.namespaceURI===Kr.HTML)&&(U=JI(x)),U)return t.push("/>"),null;if(t.push(">"),c&&QI(x)){for(var tt=u.firstChild;tt;)tt.data?t.push(tt.data):vx(tt,t,D.slice(),i),tt=tt.nextSibling;return t.push("</",y,">"),null}return{ns:D,tag:y};case eu:case za:if(s&&u.nodeType===eu&&u.documentElement==null)throw new Dt("The Document has no documentElement",Kn.InvalidStateError);return{ns:d};case nu:return eg(t,u.name,u.value),null;case ng:if(s&&Ci.InvalidChar.test(u.data))throw new Dt("The Text node data contains characters outside the XML Char production",Kn.InvalidStateError);return t.push(u.data.replace(/[<&>]/g,JA)),null;case WA:if(s&&u.data.indexOf("]]>")!==-1)throw new Dt('The CDATASection data contains "]]>"',Kn.InvalidStateError);return o?t.push(Ci.CDATA_START,u.data.replace(/]]>/g,"]]]]><![CDATA[>"),Ci.CDATA_END):t.push(Ci.CDATA_START,u.data,Ci.CDATA_END),null;case bx:if(s){if(Ci.InvalidChar.test(u.data))throw new Dt("The comment node data contains characters outside the XML Char production",Kn.InvalidStateError);if(u.data.indexOf("--")!==-1||u.data[u.data.length-1]==="-")throw new Dt('The comment node data contains "--" or ends with "-"',Kn.InvalidStateError)}return t.push(Ci.COMMENT_START,u.data,Ci.COMMENT_END),null;case YA:var et=u.publicId,B=u.systemId;if(s){if(et&&!Ci.PubidLiteral_match.test(et))throw new Dt("DocumentType publicId is not a valid PubidLiteral",Kn.InvalidStateError);if(B&&B!=="."&&!Ci.SystemLiteral_match.test(B))throw new Dt("DocumentType systemId is not a valid SystemLiteral",Kn.InvalidStateError);if(u.internalSubset&&u.internalSubset.indexOf("]>")!==-1)throw new Dt('DocumentType internalSubset contains "]>"',Kn.InvalidStateError)}return t.push(Ci.DOCTYPE_DECL_START," ",u.name),et?(t.push(" ",Ci.PUBLIC," ",et),B&&B!=="."&&t.push(" ",B)):B&&B!=="."&&t.push(" ",Ci.SYSTEM," ",B),u.internalSubset&&t.push(" [",u.internalSubset,"]"),t.push(">"),null;case xx:if(s){if(u.target.indexOf(":")!==-1||u.target.toLowerCase()==="xml")throw new Dt("The ProcessingInstruction target is not well-formed",Kn.InvalidStateError);if(Ci.InvalidChar.test(u.data))throw new Dt("The ProcessingInstruction data contains characters outside the XML Char production",Kn.InvalidStateError);if(u.data.indexOf("?>")!==-1)throw new Dt('The ProcessingInstruction data contains "?>"',Kn.InvalidStateError)}return t.push("<?",u.target," ",u.data,"?>"),null;case XA:return t.push("&",u.nodeName,";"),null;default:return t.push("??",u.nodeName),null}},exit:function(u,h){h&&h.tag&&t.push("</",h.tag,">")}})}function dk(r,t,e){var i;return Ti(t,null,{enter:function(n,s){var o=n.cloneNode(!1);o.ownerDocument=r,o.parentNode=null,s===null?i=o:s.appendChild(o);var l=n.nodeType===nu||e;return l?o:null}}),i}function ov(r,t,e){var i;return Ti(t,null,{enter:function(n,s){var o=new n.constructor(Vi);for(var l in n)if(iu(n,l)){var c=n[l];typeof c!="object"&&c!=o[l]&&(o[l]=c)}n.childNodes&&(o.childNodes=new ni),o.ownerDocument=r;var u=e;switch(o.nodeType){case Zn:var h=n.attributes,d=o.attributes=new ru,f=h.length;d._ownerElement=o;for(var m=0;m<f;m++)o.setAttributeNode(ov(r,h.item(m),!0));break;case nu:u=!0}return s!==null?s.appendChild(o):i=o,u?o:null}}),i}function lv(r,t,e){r[t]=e}function gx(r){for(var t=[],e=r.firstChild;e;)e.nodeType===Zn&&t.push(e),e=e.nextSibling;return t}try{Object.defineProperty&&(Object.defineProperty(Xr.prototype,"length",{get:function(){return sg(this),this.$$length}}),Object.defineProperty(Yt.prototype,"textContent",{get:function(){if(this.nodeType===Zn||this.nodeType===za){var r=[];return Ti(this,null,{enter:function(t){if(t.nodeType===Zn||t.nodeType===za)return!0;if(t.nodeType===xx||t.nodeType===bx)return null;r.push(t.nodeValue)}}),r.join("")}return this.nodeValue},set:function(r){switch(this.nodeType){case Zn:case za:for(;this.firstChild;)this.removeChild(this.firstChild);(r||String(r))&&this.appendChild(this.ownerDocument.createTextNode(r));break;default:this.data=r,this.value=r,this.nodeValue=r}}}),Object.defineProperty(Os.prototype,"children",{get:function(){return new Xr(this,gx)}}),Object.defineProperty(Ps.prototype,"children",{get:function(){return new Xr(this,gx)}}),Object.defineProperty(ou.prototype,"children",{get:function(){return new Xr(this,gx)}}),lv=function(r,t,e){r["$$"+t]=e})}catch{}Oe._updateLiveList=sg;Oe.Attr=Ko;Oe.CDATASection=og;Oe.CharacterData=au;Oe.Comment=ag;Oe.Document=Ps;Oe.DocumentFragment=ou;Oe.DocumentType=lg;Oe.DOMImplementation=QA;Oe.Element=Os;Oe.Entity=Ax;Oe.EntityReference=cg;Oe.LiveNodeList=Xr;Oe.NamedNodeMap=ru;Oe.Node=Yt;Oe.NodeList=ni;Oe.Notation=wx;Oe.Text=jd;Oe.ProcessingInstruction=ug;Oe.walkDOM=Ti;Oe.XMLSerializer=sv});var uv=Vt(Hd=>{"use strict";H();var cv=Yo().freeze;Hd.XML_ENTITIES=cv({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});Hd.HTML_ENTITIES=cv({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
7
+ `,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"});Hd.entityMap=Hd.HTML_ENTITIES});var Av=Vt(dg=>{"use strict";H();var hu=Yo(),zt=mx(),mv=Pd(),fk=hu.isHTMLEscapableRawTextElement,pk=hu.isHTMLMimeType,mk=hu.isHTMLRawTextElement,qd=hu.hasOwn,hv=hu.NAMESPACE,dv=mv.ParseError,gk=mv.DOMException,Gd=0,Ha=1,lu=2,$d=3,cu=4,uu=5,Vd=6,hg=7;function gv(){}gv.prototype={parse:function(r,t,e){var i=this.domBuilder;i.startDocument(),yv(t,t=Object.create(null)),yk(r,t,e,i,this.errorHandler),i.endDocument()}};var Cx=/&#?\w+;?/g;function yk(r,t,e,i,n){var s=pk(i.mimeType);r.indexOf(zt.UNICODE_REPLACEMENT_CHARACTER)>=0&&n.warning("Unicode replacement character detected, source encoding issues?");function o(M){if(M>65535){M-=65536;var E=55296+(M>>10),S=56320+(M&1023);return String.fromCharCode(E,S)}else return String.fromCharCode(M)}function l(M){var E=M[M.length-1]===";"?M:M+";";if(!s&&E!==M)return n.error("EntityRef: expecting ;"),M;var S=zt.Reference.exec(E);if(!S||S[0].length!==E.length)return n.error("entity not matching Reference production: "+M),M;var N=E.slice(1,-1);return qd(e,N)?e[N]:N.charAt(0)==="#"?o(parseInt(N.substring(1).replace("x","0x"))):(n.error("entity not found:"+M),M)}function c(M){if(M>A){var E=r.substring(A,M).replace(Cx,l);f&&m(A),i.characters(E,0,M-A),A=M}}var u=0,h=0,d=/\r\n?|\n|$/g,f=i.locator;function m(M,E){for(;M>=h&&(E=d.exec(r));)u=h,h=E.index+E[0].length,f.lineNumber++;f.columnNumber=M-u+1}for(var x=[{currentNSMap:t}],y=[],A=0;;){try{var w=r.indexOf("<",A);if(w<0){if(!s&&y.length>0)return n.fatalError("unclosed xml tag(s): "+y.join(", "));if(!r.substring(A).match(/^\s*$/)){var v=i.doc,C=v.createTextNode(r.substring(A));if(v.documentElement)return n.error("Extra content at the end of the document");v.appendChild(C),i.currentElement=C}return}if(w>A){var D=r.substring(A,w);!s&&y.length===0&&(D=D.replace(new RegExp(zt.S_OPT.source,"g"),""),D&&n.error("Unexpected content outside root element: '"+D+"'")),c(w)}switch(r.charAt(w+1)){case"/":var B=r.indexOf(">",w+2),_=r.substring(w+2,B>0?B:void 0);if(!_)return n.fatalError("end tag name missing");var k=B>0&&zt.reg("^",zt.QName_group,zt.S_OPT,"$").exec(_);if(!k)return n.fatalError('end tag name contains invalid characters: "'+_+'"');if(!i.currentElement&&!i.doc.documentElement)return;var R=y[y.length-1]||i.currentElement.tagName||i.doc.documentElement.tagName||"";if(R!==k[1]){var K=k[1].toLowerCase();if(!s||R.toLowerCase()!==K)return n.fatalError('Opening and ending tag mismatch: "'+R+'" != "'+_+'"')}var W=x.pop();y.pop();var V=W.localNSMap;if(i.endElement(W.uri,W.localName,R),V)for(var U in V)qd(V,U)&&i.endPrefixMapping(U);B++;break;case"?":f&&m(w),B=Ak(r,w,i,n);break;case"!":f&&m(w),B=bv(r,w,i,n,s);break;default:f&&m(w);var tt=new wv,et=x[x.length-1].currentNSMap,B=xk(r,w,tt,et,l,n,s),ot=tt.length;if(tt.closed||(s&&hu.isHTMLVoidElement(tt.tagName)?tt.closed=!0:y.push(tt.tagName)),f&&ot){for(var L=fv(f,{}),T=0;T<ot;T++){var I=tt[T];m(I.offset),I.locator=fv(f,{})}i.locator=L,pv(tt,i,et)&&x.push(tt),i.locator=f}else pv(tt,i,et)&&x.push(tt);s&&!tt.closed?B=bk(r,B,tt.tagName,l,i):B++}}catch(M){if(M instanceof dv)throw M;if(M instanceof gk)throw new dv(M.name+": "+M.message,i.locator,M);n.error("element parse error: "+M),B=-1}B>A?A=B:c(Math.max(w,A)+1)}}function fv(r,t){return t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber,t}function xk(r,t,e,i,n,s,o){function l(m,x,y){if(qd(e.attributeNames,m))return s.fatalError("Attribute "+m+" redefined");if(!o&&x.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");e.addValue(m,x.replace(/[\t\n\r]/g," ").replace(Cx,n),y)}for(var c,u,h=++t,d=Gd;;){var f=r.charAt(h);switch(f){case"=":if(d===Ha)c=r.slice(t,h),d=$d;else if(d===lu)d=$d;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===$d||d===Ha)if(d===Ha&&(s.warning('attribute value must after "="'),c=r.slice(t,h)),t=h+1,h=r.indexOf(f,t),h>0)u=r.slice(t,h),l(c,u,t-1),d=uu;else throw new Error("attribute value no end '"+f+"' match");else if(d==cu)u=r.slice(t,h),l(c,u,t),s.warning('attribute "'+c+'" missed start quot('+f+")!!"),t=h+1,d=uu;else throw new Error('attribute value must after "="');break;case"/":switch(d){case Gd:e.setTagName(r.slice(t,h));case uu:case Vd:case hg:d=hg,e.closed=!0;case cu:case Ha:break;case lu:e.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==Gd&&e.setTagName(r.slice(t,h)),h;case">":switch(d){case Gd:e.setTagName(r.slice(t,h));case uu:case Vd:case hg:break;case cu:case Ha:u=r.slice(t,h),u.slice(-1)==="/"&&(e.closed=!0,u=u.slice(0,-1));case lu:d===lu&&(u=c),d==cu?(s.warning('attribute "'+u+'" missed quot(")!'),l(c,u,t)):(o||s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),l(u,u,t));break;case $d:if(!o)return s.fatalError(`AttValue: ' or " expected`)}return h;case"\x80":f=" ";default:if(f<=" ")switch(d){case Gd:e.setTagName(r.slice(t,h)),d=Vd;break;case Ha:c=r.slice(t,h),d=lu;break;case cu:var u=r.slice(t,h);s.warning('attribute "'+u+'" missed quot(")!!'),l(c,u,t);case uu:d=Vd;break}else switch(d){case lu:o||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),l(c,c,t),t=h,d=Ha;break;case uu:s.warning('attribute space is required"'+c+'"!!');case Vd:d=Ha,t=h;break;case $d:d=cu,t=h;break;case hg:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function pv(r,t,e){for(var i=r.tagName,n=null,d=r.length;d--;){var s=r[d],o=s.qName,l=s.value,f=o.indexOf(":");if(f>0)var c=s.prefix=o.slice(0,f),u=o.slice(f+1),h=c==="xmlns"&&u;else u=o,c=null,h=o==="xmlns"&&"";s.localName=u,h!==!1&&(n==null&&(n=Object.create(null),yv(e,e=Object.create(null))),e[h]=n[h]=l,s.uri=hv.XMLNS,t.startPrefixMapping(h,l))}for(var d=r.length;d--;)s=r[d],s.prefix&&(s.prefix==="xml"&&(s.uri=hv.XML),s.prefix!=="xmlns"&&(s.uri=e[s.prefix]));var f=i.indexOf(":");f>0?(c=r.prefix=i.slice(0,f),u=r.localName=i.slice(f+1)):(c=null,u=r.localName=i);var m=r.uri=e[c||""];if(t.startElement(m,u,i,r),r.closed){if(t.endElement(m,u,i),n)for(c in n)qd(n,c)&&t.endPrefixMapping(c)}else return r.currentNSMap=e,r.localNSMap=n,!0}function bk(r,t,e,i,n){var s=fk(e);if(s||mk(e)){var o=r.indexOf("</"+e+">",t),l=r.substring(t+1,o);return s&&(l=l.replace(Cx,i)),n.characters(l,0,l.length),o}return t+1}function yv(r,t){for(var e in r)qd(r,e)&&(t[e]=r[e])}function xv(r,t){var e=t;function i(h){return h=h||0,r.charAt(e+h)}function n(h){h=h||1,e+=h}function s(){for(var h=0;e<r.length;){var d=i();if(d!==" "&&d!==`
8
+ `&&d!==" "&&d!=="\r")return h;h++,n()}return-1}function o(){return r.substring(e)}function l(h){return r.substring(e,e+h.length)===h}function c(h){return r.substring(e,e+h.length).toUpperCase()===h.toUpperCase()}function u(h){var d=zt.reg("^",h),f=d.exec(o());return f?(n(f[0].length),f[0]):null}return{char:i,getIndex:function(){return e},getMatch:u,getSource:function(){return r},skip:n,skipBlanks:s,substringFromIndex:o,substringStartsWith:l,substringStartsWithCaseInsensitive:c}}function wk(r,t){function e(l,c){var u=zt.PI.exec(l.substringFromIndex());return u?u[1].toLowerCase()==="xml"?c.fatalError("xml declaration is only allowed at the start of the document, but found at position "+l.getIndex()):(l.skip(u[0].length),u[0]):c.fatalError("processing instruction is not well-formed at position "+l.getIndex())}var i=r.getSource();if(r.char()==="["){r.skip(1);for(var n=r.getIndex();r.getIndex()<i.length;){if(r.skipBlanks(),r.char()==="]"){var s=i.substring(n,r.getIndex());return r.skip(1),s}var o=null;if(r.char()==="<"&&r.char(1)==="!")switch(r.char(2)){case"E":r.char(3)==="L"?o=r.getMatch(zt.elementdecl):r.char(3)==="N"&&(o=r.getMatch(zt.EntityDecl));break;case"A":o=r.getMatch(zt.AttlistDecl);break;case"N":o=r.getMatch(zt.NotationDecl);break;case"-":o=r.getMatch(zt.Comment);break}else if(r.char()==="<"&&r.char(1)==="?")o=e(r,t);else if(r.char()==="%")o=r.getMatch(zt.PEReference);else return t.fatalError("Error detected in Markup declaration");if(!o)return t.fatalError("Error in internal subset at position "+r.getIndex())}return t.fatalError("doctype internal subset is not well-formed, missing ]")}}function bv(r,t,e,i,n){var s=xv(r,t);switch(n?s.char(2).toUpperCase():s.char(2)){case"-":var o=s.getMatch(zt.Comment);return o?(e.comment(o,zt.COMMENT_START.length,o.length-zt.COMMENT_START.length-zt.COMMENT_END.length),s.getIndex()):i.fatalError("comment is not well-formed at position "+s.getIndex());case"[":var l=s.getMatch(zt.CDSect);return l?!n&&!e.currentElement?i.fatalError("CDATA outside of element"):(e.startCDATA(),e.characters(l,zt.CDATA_START.length,l.length-zt.CDATA_START.length-zt.CDATA_END.length),e.endCDATA(),s.getIndex()):i.fatalError("Invalid CDATA starting at position "+t);case"D":{if(e.doc&&e.doc.documentElement)return i.fatalError("Doctype not allowed inside or after documentElement at position "+s.getIndex());if(n?!s.substringStartsWithCaseInsensitive(zt.DOCTYPE_DECL_START):!s.substringStartsWith(zt.DOCTYPE_DECL_START))return i.fatalError("Expected "+zt.DOCTYPE_DECL_START+" at position "+s.getIndex());if(s.skip(zt.DOCTYPE_DECL_START.length),s.skipBlanks()<1)return i.fatalError("Expected whitespace after "+zt.DOCTYPE_DECL_START+" at position "+s.getIndex());var c={name:void 0,publicId:void 0,systemId:void 0,internalSubset:void 0};if(c.name=s.getMatch(zt.Name),!c.name)return i.fatalError("doctype name missing or contains unexpected characters at position "+s.getIndex());if(n&&c.name.toLowerCase()!=="html"&&i.warning("Unexpected DOCTYPE in HTML document at position "+s.getIndex()),s.skipBlanks(),s.substringStartsWith(zt.PUBLIC)||s.substringStartsWith(zt.SYSTEM)){var u=zt.ExternalID_match.exec(s.substringFromIndex());if(!u)return i.fatalError("doctype external id is not well-formed at position "+s.getIndex());u.groups.SystemLiteralOnly!==void 0?c.systemId=u.groups.SystemLiteralOnly:(c.systemId=u.groups.SystemLiteral,c.publicId=u.groups.PubidLiteral),s.skip(u[0].length)}else if(n&&s.substringStartsWithCaseInsensitive(zt.SYSTEM)){if(s.skip(zt.SYSTEM.length),s.skipBlanks()<1)return i.fatalError("Expected whitespace after "+zt.SYSTEM+" at position "+s.getIndex());if(c.systemId=s.getMatch(zt.ABOUT_LEGACY_COMPAT_SystemLiteral),!c.systemId)return i.fatalError("Expected "+zt.ABOUT_LEGACY_COMPAT+" in single or double quotes after "+zt.SYSTEM+" at position "+s.getIndex())}return n&&c.systemId&&!zt.ABOUT_LEGACY_COMPAT_SystemLiteral.test(c.systemId)&&i.warning("Unexpected doctype.systemId in HTML document at position "+s.getIndex()),n||(s.skipBlanks(),c.internalSubset=wk(s,i)),s.skipBlanks(),s.char()!==">"?i.fatalError("doctype not terminated with > at position "+s.getIndex()):(s.skip(1),e.startDTD(c.name,c.publicId,c.systemId,c.internalSubset),e.endDTD(),s.getIndex())}default:return i.fatalError('Not well-formed XML starting with "<!" at position '+t)}}function Ak(r,t,e,i){var n=r.substring(t).match(zt.PI);if(!n)return i.fatalError("Invalid processing instruction starting at position "+t);if(n[1].toLowerCase()==="xml"){if(t>0)return i.fatalError("processing instruction at position "+t+" is an xml declaration which is only at the start of the document");if(!zt.XMLDecl.test(r.substring(t)))return i.fatalError("xml declaration is not well-formed")}return e.processingInstruction(n[1],n[2]),t+n[0].length}function wv(){this.attributeNames=Object.create(null)}wv.prototype={setTagName:function(r){if(!zt.QName_exact.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,t,e){if(!zt.QName_exact.test(r))throw new Error("invalid attribute:"+r);this.attributeNames[r]=this.length,this[this.length++]={qName:r,value:t,offset:e}},length:0,getLocalName:function(r){return this[r].localName},getLocator:function(r){return this[r].locator},getQName:function(r){return this[r].qName},getURI:function(r){return this[r].uri},getValue:function(r){return this[r].value}};dg.XMLReader=gv;dg.parseUtils=xv;dg.parseDoctypeCommentOrCData=bv});var Iv=Vt(fu=>{"use strict";H();var Zo=Yo(),vk=Ex(),Ek=Pd(),vv=uv(),Ck=Av(),Tk=vk.DOMImplementation,Sk=Zo.hasDefaultHTMLNamespace,Dk=Zo.isHTMLMimeType,Ik=Zo.isValidMimeType,Tv=Zo.MIME_TYPE,Tx=Zo.NAMESPACE,Ev=Ek.ParseError,kk=Ck.XMLReader;function Sv(r){return r.replace(/\r[\n\u0085]/g,`
9
+ `).replace(/[\r\u0085\u2028\u2029]/g,`
10
+ `)}function Dv(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||Zo.assign,this.domHandler=r.domHandler||pg,this.onError=r.onError||r.errorHandler,r.errorHandler&&typeof r.errorHandler!="function")throw new TypeError("errorHandler object is no longer supported, switch to onError!");r.errorHandler&&r.errorHandler("warning","The `errorHandler` option has been deprecated, use `onError` instead!",this),this.normalizeLineEndings=r.normalizeLineEndings||Sv,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}Dv.prototype.parseFromString=function(r,t){if(!Ik(t))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+t+'" is not valid.');var e=this.assign(Object.create(null),this.xmlns),i=vv.XML_ENTITIES,n=e[""]||null;Sk(t)?(i=vv.HTML_ENTITIES,n=Tx.HTML):t===Tv.XML_SVG_IMAGE&&(n=Tx.SVG),e[""]=n,e.xml=e.xml||Tx.XML;var s=new this.domHandler({mimeType:t,defaultNamespace:n,onError:this.onError}),o=this.locator?{}:void 0;this.locator&&s.setDocumentLocator(o);var l=new kk;l.errorHandler=s,l.domBuilder=s;var c=!Zo.isHTMLMimeType(t);return c&&typeof r!="string"&&l.errorHandler.fatalError("source is not a string"),l.parse(this.normalizeLineEndings(String(r)),e,i),s.doc.documentElement||l.errorHandler.fatalError("missing root element"),s.doc};function pg(r){var t=r||{};this.mimeType=t.mimeType||Tv.XML_APPLICATION,this.defaultNamespace=t.defaultNamespace||null,this.cdata=!1,this.currentElement=void 0,this.doc=void 0,this.locator=void 0,this.onError=t.onError}function du(r,t){t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber}pg.prototype={startDocument:function(){var r=new Tk;this.doc=Dk(this.mimeType)?r.createHTMLDocument(!1):r.createDocument(this.defaultNamespace,"")},startElement:function(r,t,e,i){var n=this.doc,s=n.createElementNS(r,e||t),o=i.length;fg(this,s),this.currentElement=s,this.locator&&du(this.locator,s);for(var l=0;l<o;l++){var r=i.getURI(l),c=i.getValue(l),e=i.getQName(l),u=n.createAttributeNS(r,e);this.locator&&du(i.getLocator(l),u),u.value=u.nodeValue=c,s.setAttributeNode(u)}},endElement:function(r,t,e){this.currentElement=this.currentElement.parentNode},startPrefixMapping:function(r,t){},endPrefixMapping:function(r){},processingInstruction:function(r,t){var e=this.doc.createProcessingInstruction(r,t);this.locator&&du(this.locator,e),fg(this,e)},ignorableWhitespace:function(r,t,e){},characters:function(r,t,e){if(r=Cv.apply(this,arguments),r){if(this.cdata)var i=this.doc.createCDATASection(r);else var i=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(r)&&this.doc.appendChild(i),this.locator&&du(this.locator,i)}},skippedEntity:function(r){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(r){r&&(r.lineNumber=0),this.locator=r},comment:function(r,t,e){r=Cv.apply(this,arguments);var i=this.doc.createComment(r);this.locator&&du(this.locator,i),fg(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(r,t,e,i){var n=this.doc.implementation;if(n&&n.createDocumentType){var s=n.createDocumentType(r,t,e,i);this.locator&&du(this.locator,s),fg(this,s),this.doc.doctype=s}},reportError:function(r,t){if(typeof this.onError=="function")try{this.onError(r,t,this)}catch(e){throw new Ev("Reporting "+r+' "'+t+'" caused '+e,this.locator)}else console.error("[xmldom "+r+"] "+t,Nk(this.locator))},warning:function(r){this.reportError("warning",r)},error:function(r){this.reportError("error",r)},fatalError:function(r){throw this.reportError("fatalError",r),new Ev(r,this.locator)}};function Nk(r){if(r)return`
11
+ @#[line:`+r.lineNumber+",col:"+r.columnNumber+"]"}function Cv(r,t,e){return typeof r=="string"?r.substr(t,e):r.length>=t+e||t?new java.lang.String(r,t,e)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){pg.prototype[r]=function(){return null}});function fg(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}function _k(r){if(r==="error")throw"onErrorStopParsing"}function Mk(){throw"onWarningStopParsing"}fu.__DOMHandler=pg;fu.DOMParser=Dv;fu.normalizeLineEndings=Sv;fu.onErrorStopParsing=_k;fu.onWarningStopParsing=Mk});var kv=Vt(Kt=>{"use strict";H();var pu=Yo();Kt.assign=pu.assign;Kt.hasDefaultHTMLNamespace=pu.hasDefaultHTMLNamespace;Kt.isHTMLMimeType=pu.isHTMLMimeType;Kt.isValidMimeType=pu.isValidMimeType;Kt.MIME_TYPE=pu.MIME_TYPE;Kt.NAMESPACE=pu.NAMESPACE;var mg=Pd();Kt.DOMException=mg.DOMException;Kt.DOMExceptionName=mg.DOMExceptionName;Kt.ExceptionCode=mg.ExceptionCode;Kt.ParseError=mg.ParseError;var ri=Ex();Kt.Attr=ri.Attr;Kt.CDATASection=ri.CDATASection;Kt.CharacterData=ri.CharacterData;Kt.Comment=ri.Comment;Kt.Document=ri.Document;Kt.DocumentFragment=ri.DocumentFragment;Kt.DocumentType=ri.DocumentType;Kt.DOMImplementation=ri.DOMImplementation;Kt.Element=ri.Element;Kt.Entity=ri.Entity;Kt.EntityReference=ri.EntityReference;Kt.LiveNodeList=ri.LiveNodeList;Kt.NamedNodeMap=ri.NamedNodeMap;Kt.Node=ri.Node;Kt.NodeList=ri.NodeList;Kt.Notation=ri.Notation;Kt.ProcessingInstruction=ri.ProcessingInstruction;Kt.Text=ri.Text;Kt.XMLSerializer=ri.XMLSerializer;var gg=Iv();Kt.DOMParser=gg.DOMParser;Kt.normalizeLineEndings=gg.normalizeLineEndings;Kt.onErrorStopParsing=gg.onErrorStopParsing;Kt.onWarningStopParsing=gg.onWarningStopParsing});var Mv=Vt((_F,Dx)=>{H();var Sx=(function(r){"use strict";var t=Object.prototype,e=t.hasOwnProperty,i=Object.defineProperty||function(T,I,M){T[I]=M.value},n,s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function u(T,I,M){return Object.defineProperty(T,I,{value:M,enumerable:!0,configurable:!0,writable:!0}),T[I]}try{u({},"")}catch{u=function(I,M,E){return I[M]=E}}function h(T,I,M,E){var S=I&&I.prototype instanceof w?I:w,N=Object.create(S.prototype),P=new B(E||[]);return i(N,"_invoke",{value:V(T,M,P)}),N}r.wrap=h;function d(T,I,M){try{return{type:"normal",arg:T.call(I,M)}}catch(E){return{type:"throw",arg:E}}}var f="suspendedStart",m="suspendedYield",x="executing",y="completed",A={};function w(){}function v(){}function C(){}var D={};u(D,o,function(){return this});var _=Object.getPrototypeOf,k=_&&_(_(ot([])));k&&k!==t&&e.call(k,o)&&(D=k);var R=C.prototype=w.prototype=Object.create(D);v.prototype=C,i(R,"constructor",{value:C,configurable:!0}),i(C,"constructor",{value:v,configurable:!0}),v.displayName=u(C,c,"GeneratorFunction");function K(T){["next","throw","return"].forEach(function(I){u(T,I,function(M){return this._invoke(I,M)})})}r.isGeneratorFunction=function(T){var I=typeof T=="function"&&T.constructor;return I?I===v||(I.displayName||I.name)==="GeneratorFunction":!1},r.mark=function(T){return Object.setPrototypeOf?Object.setPrototypeOf(T,C):(T.__proto__=C,u(T,c,"GeneratorFunction")),T.prototype=Object.create(R),T},r.awrap=function(T){return{__await:T}};function W(T,I){function M(N,P,$,G){var O=d(T[N],T,P);if(O.type==="throw")G(O.arg);else{var z=O.arg,it=z.value;return it&&typeof it=="object"&&e.call(it,"__await")?I.resolve(it.__await).then(function(X){M("next",X,$,G)},function(X){M("throw",X,$,G)}):I.resolve(it).then(function(X){z.value=X,$(z)},function(X){return M("throw",X,$,G)})}}var E;function S(N,P){function $(){return new I(function(G,O){M(N,P,G,O)})}return E=E?E.then($,$):$()}i(this,"_invoke",{value:S})}K(W.prototype),u(W.prototype,l,function(){return this}),r.AsyncIterator=W,r.async=function(T,I,M,E,S){S===void 0&&(S=Promise);var N=new W(h(T,I,M,E),S);return r.isGeneratorFunction(I)?N:N.next().then(function(P){return P.done?P.value:N.next()})};function V(T,I,M){var E=f;return function(N,P){if(E===x)throw new Error("Generator is already running");if(E===y){if(N==="throw")throw P;return L()}for(M.method=N,M.arg=P;;){var $=M.delegate;if($){var G=U($,M);if(G){if(G===A)continue;return G}}if(M.method==="next")M.sent=M._sent=M.arg;else if(M.method==="throw"){if(E===f)throw E=y,M.arg;M.dispatchException(M.arg)}else M.method==="return"&&M.abrupt("return",M.arg);E=x;var O=d(T,I,M);if(O.type==="normal"){if(E=M.done?y:m,O.arg===A)continue;return{value:O.arg,done:M.done}}else O.type==="throw"&&(E=y,M.method="throw",M.arg=O.arg)}}}function U(T,I){var M=I.method,E=T.iterator[M];if(E===n)return I.delegate=null,M==="throw"&&T.iterator.return&&(I.method="return",I.arg=n,U(T,I),I.method==="throw")||M!=="return"&&(I.method="throw",I.arg=new TypeError("The iterator does not provide a '"+M+"' method")),A;var S=d(E,T.iterator,I.arg);if(S.type==="throw")return I.method="throw",I.arg=S.arg,I.delegate=null,A;var N=S.arg;if(!N)return I.method="throw",I.arg=new TypeError("iterator result is not an object"),I.delegate=null,A;if(N.done)I[T.resultName]=N.value,I.next=T.nextLoc,I.method!=="return"&&(I.method="next",I.arg=n);else return N;return I.delegate=null,A}K(R),u(R,c,"Generator"),u(R,o,function(){return this}),u(R,"toString",function(){return"[object Generator]"});function tt(T){var I={tryLoc:T[0]};1 in T&&(I.catchLoc=T[1]),2 in T&&(I.finallyLoc=T[2],I.afterLoc=T[3]),this.tryEntries.push(I)}function et(T){var I=T.completion||{};I.type="normal",delete I.arg,T.completion=I}function B(T){this.tryEntries=[{tryLoc:"root"}],T.forEach(tt,this),this.reset(!0)}r.keys=function(T){var I=Object(T),M=[];for(var E in I)M.push(E);return M.reverse(),function S(){for(;M.length;){var N=M.pop();if(N in I)return S.value=N,S.done=!1,S}return S.done=!0,S}};function ot(T){if(T){var I=T[o];if(I)return I.call(T);if(typeof T.next=="function")return T;if(!isNaN(T.length)){var M=-1,E=function S(){for(;++M<T.length;)if(e.call(T,M))return S.value=T[M],S.done=!1,S;return S.value=n,S.done=!0,S};return E.next=E}}return{next:L}}r.values=ot;function L(){return{value:n,done:!0}}return B.prototype={constructor:B,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(et),!T)for(var I in this)I.charAt(0)==="t"&&e.call(this,I)&&!isNaN(+I.slice(1))&&(this[I]=n)},stop:function(){this.done=!0;var T=this.tryEntries[0],I=T.completion;if(I.type==="throw")throw I.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var I=this;function M(G,O){return N.type="throw",N.arg=T,I.next=G,O&&(I.method="next",I.arg=n),!!O}for(var E=this.tryEntries.length-1;E>=0;--E){var S=this.tryEntries[E],N=S.completion;if(S.tryLoc==="root")return M("end");if(S.tryLoc<=this.prev){var P=e.call(S,"catchLoc"),$=e.call(S,"finallyLoc");if(P&&$){if(this.prev<S.catchLoc)return M(S.catchLoc,!0);if(this.prev<S.finallyLoc)return M(S.finallyLoc)}else if(P){if(this.prev<S.catchLoc)return M(S.catchLoc,!0)}else if($){if(this.prev<S.finallyLoc)return M(S.finallyLoc)}else throw new Error("try statement without catch or finally")}}},abrupt:function(T,I){for(var M=this.tryEntries.length-1;M>=0;--M){var E=this.tryEntries[M];if(E.tryLoc<=this.prev&&e.call(E,"finallyLoc")&&this.prev<E.finallyLoc){var S=E;break}}S&&(T==="break"||T==="continue")&&S.tryLoc<=I&&I<=S.finallyLoc&&(S=null);var N=S?S.completion:{};return N.type=T,N.arg=I,S?(this.method="next",this.next=S.finallyLoc,A):this.complete(N)},complete:function(T,I){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&I&&(this.next=I),A},finish:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var M=this.tryEntries[I];if(M.finallyLoc===T)return this.complete(M.completion,M.afterLoc),et(M),A}},catch:function(T){for(var I=this.tryEntries.length-1;I>=0;--I){var M=this.tryEntries[I];if(M.tryLoc===T){var E=M.completion;if(E.type==="throw"){var S=E.arg;et(M)}return S}}throw new Error("illegal catch attempt")},delegateYield:function(T,I,M){return this.delegate={iterator:ot(T),resultName:I,nextLoc:M},this.method==="next"&&(this.arg=n),A}},r})(typeof Dx=="object"?Dx.exports:{});try{regeneratorRuntime=Sx}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=Sx:Function("r","regeneratorRuntime = r")(Sx)}});var bg=Vt((FF,Fv)=>{"use strict";H();Fv.exports=(r,t)=>`${r}-${t}-${Math.random().toString(16).slice(3,8)}`});var Ix=Vt((OF,Ov)=>{"use strict";H();var zk=bg(),Pv=0;Ov.exports=({id:r,action:t,payload:e={}})=>{let i=r;return typeof i>"u"&&(i=zk("Job",Pv),Pv+=1),{id:i,action:t,payload:e}}});var wg=Vt(Xd=>{"use strict";H();var kx=!1;Xd.logging=kx;Xd.setLogging=r=>{kx=r};Xd.log=(...r)=>kx?console.log.apply(Xd,r):null});var Uv=Vt((Lv,Bv)=>{"use strict";H();var jk=Ix(),{log:Ag}=wg(),Hk=bg(),Rv=0;Bv.exports=()=>{let r=Hk("Scheduler",Rv),t={},e={},i=[];Rv+=1;let n=()=>i.length,s=()=>Object.keys(t).length,o=()=>{if(i.length!==0){let d=Object.keys(t);for(let f=0;f<d.length;f+=1)if(typeof e[d[f]]>"u"){i[0](t[d[f]]);break}}},l=(d,f)=>new Promise((m,x)=>{let y=jk({action:d,payload:f});i.push(async A=>{i.shift(),e[A.id]=y;try{m(await A[d].apply(Lv,[...f,y.id]))}catch(w){x(w)}finally{delete e[A.id],o()}}),Ag(`[${r}]: Add ${y.id} to JobQueue`),Ag(`[${r}]: JobQueue length=${i.length}`),o()});return{addWorker:d=>(t[d.id]=d,Ag(`[${r}]: Add ${d.id}`),Ag(`[${r}]: Number of workers=${s()}`),o(),d.id),addJob:async(d,...f)=>{if(s()===0)throw Error(`[${r}]: You need to have at least one worker before adding jobs`);return l(d,f)},terminate:async()=>{Object.keys(t).forEach(async d=>{await t[d].terminate()}),i=[]},getQueueLen:n,getNumWorkers:s}}});var jv=Vt((zF,zv)=>{"use strict";H();zv.exports=r=>{let t={};return typeof WorkerGlobalScope<"u"?t.type="webworker":typeof document=="object"?t.type="browser":typeof rt.default=="object"&&typeof Wm=="function"&&(t.type="node"),typeof r>"u"?t:t[r]}});var Gv=Vt((GF,Hv)=>{"use strict";H();var Gk=jv()("type")==="browser",$k=Gk?r=>new URL(r,window.location.href).href:r=>r;Hv.exports=r=>{let t={...r};return["corePath","workerPath","langPath"].forEach(e=>{r[e]&&(t[e]=$k(t[e]))}),t}});var Nx=Vt((VF,$v)=>{"use strict";H();$v.exports={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}});var Vv=Vt((WF,Vk)=>{Vk.exports={name:"tesseract.js",version:"7.0.0",description:"Pure Javascript Multilingual OCR",main:"src/index.js",type:"commonjs",types:"src/index.d.ts",unpkg:"dist/tesseract.min.js",jsdelivr:"dist/tesseract.min.js",scripts:{start:"node scripts/server.js",build:"rimraf dist && webpack --config scripts/webpack.config.prod.js && rollup -c scripts/rollup.esm.mjs","profile:tesseract":"webpack-bundle-analyzer dist/tesseract-stats.json","profile:worker":"webpack-bundle-analyzer dist/worker-stats.json",prepublishOnly:"npm run build",wait:"rimraf dist && wait-on http://localhost:3000/dist/tesseract.min.js",test:"npm-run-all -p -r start test:all","test:all":"npm-run-all wait test:browser test:node:all","test:browser":"karma start karma.conf.js","test:node":"nyc mocha --exit --bail --require ./scripts/test-helper.mjs","test:node:all":"npm run test:node -- ./tests/*.test.mjs",lint:"eslint src","lint:fix":"eslint --fix src",postinstall:"opencollective-postinstall || true"},browser:{"./src/worker/node/index.js":"./src/worker/browser/index.js"},author:"",contributors:["jeromewu"],license:"Apache-2.0",devDependencies:{"@babel/core":"^7.21.4","@babel/eslint-parser":"^7.21.3","@babel/preset-env":"^7.21.4","@rollup/plugin-commonjs":"^24.1.0",acorn:"^8.8.2","babel-loader":"^9.1.2",buffer:"^6.0.3",cors:"^2.8.5",eslint:"^7.32.0","eslint-config-airbnb-base":"^14.2.1","eslint-plugin-import":"^2.27.5","expect.js":"^0.3.1",express:"^4.18.2",mocha:"^10.2.0","npm-run-all":"^4.1.5",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-firefox-launcher":"^2.1.2","karma-mocha":"^2.0.1","karma-webpack":"^5.0.0",nyc:"^15.1.0",rimraf:"^5.0.0",rollup:"^3.20.7","wait-on":"^7.0.1",webpack:"^5.79.0","webpack-bundle-analyzer":"^4.8.0","webpack-cli":"^5.0.1","webpack-dev-middleware":"^6.0.2","rollup-plugin-sourcemaps":"^0.6.3"},dependencies:{"bmp-js":"^0.1.0","idb-keyval":"^6.2.0","is-url":"^1.2.4","node-fetch":"^2.6.9","opencollective-postinstall":"^2.0.3","regenerator-runtime":"^0.13.3","tesseract.js-core":"^7.0.0","wasm-feature-detect":"^1.8.0",zlibjs:"^0.3.1"},overrides:{"@rollup/pluginutils":"^5.0.2"},repository:{type:"git",url:"https://github.com/naptha/tesseract.js.git"},bugs:{url:"https://github.com/naptha/tesseract.js/issues"},homepage:"https://github.com/naptha/tesseract.js",collective:{type:"opencollective",url:"https://opencollective.com/tesseractjs"}}});var Wv=Vt((XF,qv)=>{"use strict";H();qv.exports={workerBlobURL:!0,logger:()=>{}}});var Yv=Vt((KF,Xv)=>{"use strict";H();var qk=Vv().version,Wk=Wv();Xv.exports={...Wk,workerPath:`https://cdn.jsdelivr.net/npm/tesseract.js@v${qk}/dist/worker.min.js`}});var Zv=Vt((QF,Kv)=>{"use strict";H();Kv.exports=({workerPath:r,workerBlobURL:t})=>{let e;if(Blob&&URL&&t){let i=new Blob([`importScripts("${r}");`],{type:"application/javascript"});e=new Worker(URL.createObjectURL(i))}else e=new Worker(r);return e}});var Jv=Vt((tP,Qv)=>{"use strict";H();Qv.exports=r=>{r.terminate()}});var eE=Vt((iP,tE)=>{"use strict";H();tE.exports=(r,t)=>{r.onmessage=({data:e})=>{t(e)}}});var nE=Vt((rP,iE)=>{"use strict";H();iE.exports=async(r,t)=>{r.postMessage(t)}});var sE=Vt((aP,rE)=>{"use strict";H();var _x=r=>new Promise((t,e)=>{let i=new FileReader;i.onload=()=>{t(i.result)},i.onerror=({target:{error:{code:n}}})=>{e(Error(`File could not be read! Code=${n}`))},i.readAsArrayBuffer(r)}),Mx=async r=>{let t=r;if(typeof r>"u")return"undefined";if(typeof r=="string")/data:image\/([a-zA-Z]*);base64,([^"]*)/.test(r)?t=atob(r.split(",")[1]).split("").map(e=>e.charCodeAt(0)):t=await(await fetch(r)).arrayBuffer();else if(typeof HTMLElement<"u"&&r instanceof HTMLElement)r.tagName==="IMG"&&(t=await Mx(r.src)),r.tagName==="VIDEO"&&(t=await Mx(r.poster)),r.tagName==="CANVAS"&&await new Promise(e=>{r.toBlob(async i=>{t=await _x(i),e()})});else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas){let e=await r.convertToBlob();t=await _x(e)}else(r instanceof File||r instanceof Blob)&&(t=await _x(r));return new Uint8Array(t)};rE.exports=Mx});var oE=Vt((lP,aE)=>{"use strict";H();var Xk=Yv(),Yk=Zv(),Kk=Jv(),Zk=eE(),Qk=nE(),Jk=sE();aE.exports={defaultOptions:Xk,spawnWorker:Yk,terminateWorker:Kk,onMessage:Zk,send:Qk,loadImage:Jk}});var Fx=Vt((uP,hE)=>{"use strict";H();var tN=Gv(),Qr=Ix(),{log:lE}=wg(),eN=bg(),Jo=Nx(),{defaultOptions:iN,spawnWorker:nN,terminateWorker:rN,onMessage:sN,loadImage:cE,send:aN}=oE(),uE=0;hE.exports=async(r="eng",t=Jo.LSTM_ONLY,e={},i={})=>{let n=eN("Worker",uE),{logger:s,errorHandler:o,...l}=tN({...iN,...e}),c={},u=typeof r=="string"?r.split("+"):r,h=t,d=i,f=[Jo.DEFAULT,Jo.LSTM_ONLY].includes(t)&&!l.legacyCore,m,x,y=new Promise((T,I)=>{x=T,m=I}),A=T=>{m(T.message)},w=nN(l);w.onerror=A,uE+=1;let v=({id:T,action:I,payload:M})=>new Promise((E,S)=>{lE(`[${n}]: Start ${T}, action=${I}`);let N=`${I}-${T}`;c[N]={resolve:E,reject:S},aN(w,{workerId:n,jobId:T,action:I,payload:M})}),C=()=>console.warn("`load` is depreciated and should be removed from code (workers now come pre-loaded)"),D=T=>v(Qr({id:T,action:"load",payload:{options:{lstmOnly:f,corePath:l.corePath,logging:l.logging}}})),_=(T,I,M)=>v(Qr({id:M,action:"FS",payload:{method:"writeFile",args:[T,I]}})),k=(T,I)=>v(Qr({id:I,action:"FS",payload:{method:"readFile",args:[T,{encoding:"utf8"}]}})),R=(T,I)=>v(Qr({id:I,action:"FS",payload:{method:"unlink",args:[T]}})),K=(T,I,M)=>v(Qr({id:M,action:"FS",payload:{method:T,args:I}})),W=(T,I)=>v(Qr({id:I,action:"loadLanguage",payload:{langs:T,options:{langPath:l.langPath,dataPath:l.dataPath,cachePath:l.cachePath,cacheMethod:l.cacheMethod,gzip:l.gzip,lstmOnly:[Jo.DEFAULT,Jo.LSTM_ONLY].includes(h)&&!l.legacyLang}}})),V=(T,I,M,E)=>v(Qr({id:E,action:"initialize",payload:{langs:T,oem:I,config:M}})),U=(T="eng",I,M,E)=>{if(f&&[Jo.TESSERACT_ONLY,Jo.TESSERACT_LSTM_COMBINED].includes(I))throw Error("Legacy model requested but code missing.");let S=I||h;h=S;let N=M||d;d=N;let $=(typeof T=="string"?T.split("+"):T).filter(G=>!u.includes(G));return u.push(...$),$.length>0?W($,E).then(()=>V(T,S,N,E)):V(T,S,N,E)},tt=(T={},I)=>v(Qr({id:I,action:"setParameters",payload:{params:T}})),et=async(T,I={},M={text:!0},E)=>v(Qr({id:E,action:"recognize",payload:{image:await cE(T),options:I,output:M}})),B=async(T,I)=>{if(f)throw Error("`worker.detect` requires Legacy model, which was not loaded.");return v(Qr({id:I,action:"detect",payload:{image:await cE(T)}}))},ot=async()=>(w!==null&&(rN(w),w=null),Promise.resolve());sN(w,({workerId:T,jobId:I,status:M,action:E,data:S})=>{let N=`${E}-${I}`;if(M==="resolve")lE(`[${T}]: Complete ${I}`),c[N].resolve({jobId:I,data:S}),delete c[N];else if(M==="reject")if(c[N].reject(S),delete c[N],E==="load"&&m(S),o)o(S);else throw Error(S);else M==="progress"&&s({...S,userJobId:I})});let L={id:n,worker:w,load:C,writeText:_,readText:k,removeFile:R,FS:K,reinitialize:U,setParameters:tt,recognize:et,detect:B,terminate:ot};return D().then(()=>W(r)).then(()=>V(r,t,i)).then(()=>x(L)).catch(()=>{}),y}});var pE=Vt((dP,fE)=>{"use strict";H();var dE=Fx(),oN=async(r,t,e)=>{let i=await dE(t,1,e);return i.recognize(r).finally(async()=>{await i.terminate()})},lN=async(r,t)=>{let e=await dE("osd",0,t);return e.detect(r).finally(async()=>{await e.terminate()})};fE.exports={recognize:oN,detect:lN}});var gE=Vt((pP,mE)=>{"use strict";H();mE.exports={AFR:"afr",AMH:"amh",ARA:"ara",ASM:"asm",AZE:"aze",AZE_CYRL:"aze_cyrl",BEL:"bel",BEN:"ben",BOD:"bod",BOS:"bos",BUL:"bul",CAT:"cat",CEB:"ceb",CES:"ces",CHI_SIM:"chi_sim",CHI_TRA:"chi_tra",CHR:"chr",CYM:"cym",DAN:"dan",DEU:"deu",DZO:"dzo",ELL:"ell",ENG:"eng",ENM:"enm",EPO:"epo",EST:"est",EUS:"eus",FAS:"fas",FIN:"fin",FRA:"fra",FRK:"frk",FRM:"frm",GLE:"gle",GLG:"glg",GRC:"grc",GUJ:"guj",HAT:"hat",HEB:"heb",HIN:"hin",HRV:"hrv",HUN:"hun",IKU:"iku",IND:"ind",ISL:"isl",ITA:"ita",ITA_OLD:"ita_old",JAV:"jav",JPN:"jpn",KAN:"kan",KAT:"kat",KAT_OLD:"kat_old",KAZ:"kaz",KHM:"khm",KIR:"kir",KOR:"kor",KUR:"kur",LAO:"lao",LAT:"lat",LAV:"lav",LIT:"lit",MAL:"mal",MAR:"mar",MKD:"mkd",MLT:"mlt",MSA:"msa",MYA:"mya",NEP:"nep",NLD:"nld",NOR:"nor",ORI:"ori",PAN:"pan",POL:"pol",POR:"por",PUS:"pus",RON:"ron",RUS:"rus",SAN:"san",SIN:"sin",SLK:"slk",SLV:"slv",SPA:"spa",SPA_OLD:"spa_old",SQI:"sqi",SRP:"srp",SRP_LATN:"srp_latn",SWA:"swa",SWE:"swe",SYR:"syr",TAM:"tam",TEL:"tel",TGK:"tgk",TGL:"tgl",THA:"tha",TIR:"tir",TUR:"tur",UIG:"uig",UKR:"ukr",URD:"urd",UZB:"uzb",UZB_CYRL:"uzb_cyrl",VIE:"vie",YID:"yid"}});var xE=Vt((gP,yE)=>{"use strict";H();yE.exports={OSD_ONLY:"0",AUTO_OSD:"1",AUTO_ONLY:"2",AUTO:"3",SINGLE_COLUMN:"4",SINGLE_BLOCK_VERT_TEXT:"5",SINGLE_BLOCK:"6",SINGLE_LINE:"7",SINGLE_WORD:"8",CIRCLE_WORD:"9",SINGLE_CHAR:"10",SPARSE_TEXT:"11",SPARSE_TEXT_OSD:"12",RAW_LINE:"13"}});var wE=Vt((xP,bE)=>{"use strict";H();Mv();var cN=Uv(),uN=Fx(),hN=pE(),dN=gE(),fN=Nx(),pN=xE(),{setLogging:mN}=wg();bE.exports={languages:dN,OEM:fN,PSM:pN,createScheduler:cN,createWorker:uN,setLogging:mN,...hN}});function MN(){if(!(typeof globalThis.TextDecoder>"u"))return Dg??(Dg=new globalThis.TextDecoder("utf-8"))}function GE(r,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let e=MN();return e?e.decode(r):PN(r)}case"utf-16le":return ON(r);case"us-ascii":case"ascii":return RN(r);case"latin1":case"iso-8859-1":return LN(r);case"windows-1252":return BN(r);default:throw new RangeError(`Encoding '${t}' not supported`)}}function zx(r,t){t.length!==0&&(r.push(String.fromCharCode.apply(null,t)),t.length=0)}function Je(r,t,e){t.push(e),t.length>=xu&&zx(r,t)}function FN(r,t,e){if(e<=65535){Je(r,t,e);return}e-=65536,Je(r,t,55296+(e>>10)),Je(r,t,56320+(e&1023))}function PN(r){let t=[],e=[],i=0;for(r.length>=3&&r[0]===239&&r[1]===187&&r[2]===191&&(i=3);i<r.length;){let n=r[i];if(n<=127){Je(t,e,n),i++;continue}if(n<194||n>244){Je(t,e,Er),i++;continue}if(n<=223){if(i+1>=r.length){Je(t,e,Er),i++;continue}let h=r[i+1];if((h&192)!==128){Je(t,e,Er),i++;continue}let d=(n&31)<<6|h&63;Je(t,e,d),i+=2;continue}if(n<=239){if(i+2>=r.length){Je(t,e,Er),i++;continue}let h=r[i+1],d=r[i+2];if(!((h&192)===128&&(d&192)===128&&!(n===224&&h<160)&&!(n===237&&h>=160))){Je(t,e,Er),i++;continue}let m=(n&15)<<12|(h&63)<<6|d&63;Je(t,e,m),i+=3;continue}if(i+3>=r.length){Je(t,e,Er),i++;continue}let s=r[i+1],o=r[i+2],l=r[i+3];if(!((s&192)===128&&(o&192)===128&&(l&192)===128&&!(n===240&&s<144)&&!(n===244&&s>143))){Je(t,e,Er),i++;continue}let u=(n&7)<<18|(s&63)<<12|(o&63)<<6|l&63;FN(t,e,u),i+=4}return zx(t,e),t.join("")}function ON(r){let t=[],e=[],i=r.length,n=0;for(;n+1<i;){let s=r[n]|r[n+1]<<8;if(n+=2,s>=55296&&s<=56319){if(n+1<i){let o=r[n]|r[n+1]<<8;o>=56320&&o<=57343?(Je(t,e,s),Je(t,e,o),n+=2):Je(t,e,Er)}else Je(t,e,Er);continue}if(s>=56320&&s<=57343){Je(t,e,Er);continue}Je(t,e,s)}return n<i&&Je(t,e,Er),zx(t,e),t.join("")}function RN(r){let t=[];for(let e=0;e<r.length;e+=xu){let i=Math.min(r.length,e+xu),n=new Array(i-e);for(let s=e,o=0;s<i;s++,o++)n[o]=r[s]&127;t.push(String.fromCharCode.apply(null,n))}return t.join("")}function LN(r){let t=[];for(let e=0;e<r.length;e+=xu){let i=Math.min(r.length,e+xu),n=new Array(i-e);for(let s=e,o=0;s<i;s++,o++)n[o]=r[s];t.push(String.fromCharCode.apply(null,n))}return t.join("")}function BN(r){let t=[],e="";for(let i=0;i<r.length;i++){let n=r[i],s=n>=128&&n<=159?HE[n]:void 0;e+=s??String.fromCharCode(n),e.length>=xu&&(t.push(e),e="")}return e&&t.push(e),t.join("")}var HE,_N,Dg,xu,Er,$E=te(()=>{H();HE={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},_N={};for(let[r,t]of Object.entries(HE))_N[t]=Number.parseInt(r,10);xu=32*1024,Er=65533});function cn(r){return new DataView(r.buffer,r.byteOffset)}var VE,qE,De,el,ve,jx,WE,XE,Ri,Bs=te(()=>{H();VE=$c(Yy(),1);$E();qE={len:1,get(r,t){return cn(r).getUint8(t)},put(r,t,e){return cn(r).setUint8(t,e),t+1}},De={len:2,get(r,t){return cn(r).getUint16(t,!0)},put(r,t,e){return cn(r).setUint16(t,e,!0),t+2}},el={len:2,get(r,t){return cn(r).getUint16(t)},put(r,t,e){return cn(r).setUint16(t,e),t+2}},ve={len:4,get(r,t){return cn(r).getUint32(t,!0)},put(r,t,e){return cn(r).setUint32(t,e,!0),t+4}},jx={len:4,get(r,t){return cn(r).getUint32(t)},put(r,t,e){return cn(r).setUint32(t,e),t+4}},WE={len:4,get(r,t){return cn(r).getInt32(t)},put(r,t,e){return cn(r).setInt32(t,e),t+4}},XE={len:8,get(r,t){return cn(r).getBigUint64(t,!0)},put(r,t,e){return cn(r).setBigUint64(t,e,!0),t+8}},Ri=class{constructor(t,e){this.len=t,this.encoding=e}get(t,e=0){let i=t.subarray(e,e+this.len);return GE(i,this.encoding)}}});var UN,Xt,il,Qd=te(()=>{H();UN="End-Of-Stream",Xt=class extends Error{constructor(){super(UN),this.name="EndOfStreamError"}},il=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var YE=te(()=>{H()});var nl,Ig=te(()=>{H();Qd();nl=class{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(t,e=!1){let i=await this.read(t,e);return this.peekQueue.push(t.subarray(0,i)),i}async read(t,e=!1){if(t.length===0)return 0;let i=this.readFromPeekBuffer(t);if(this.endOfStream||(i+=await this.readRemainderFromStream(t.subarray(i),e)),i===0&&!e)throw new Xt;return i}readFromPeekBuffer(t){let e=t.length,i=0;for(;this.peekQueue.length>0&&e>0;){let n=this.peekQueue.pop();if(!n)throw new Error("peekData should be defined");let s=Math.min(n.length,e);t.set(n.subarray(0,s),i),i+=s,e-=s,s<n.length&&this.peekQueue.push(n.subarray(s))}return i}async readRemainderFromStream(t,e){let i=0;for(;i<t.length&&!this.endOfStream;){if(this.interrupted)throw new il;let n=await this.readFromStream(t.subarray(i),e);if(n===0)break;i+=n}if(!e&&i<t.length)throw new Xt;return i}}});var KE=te(()=>{H();Qd();YE();Ig()});var kg,ZE=te(()=>{H();Ig();kg=class extends nl{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var Jd,Hx=te(()=>{H();ZE();Jd=class extends kg{async readFromStream(t,e){if(t.length===0)return 0;let i=await this.reader.read(new Uint8Array(t.length),{min:e?void 0:t.length});return i.done&&(this.endOfStream=i.done),i.value?(t.set(i.value),i.value.length):0}}});var bu,Gx=te(()=>{H();Qd();Ig();bu=class extends nl{constructor(t){super(),this.reader=t,this.buffer=null}writeChunk(t,e){let i=Math.min(e.length,t.length);return t.set(e.subarray(0,i)),i<e.length?this.buffer=e.subarray(i):this.buffer=null,i}async readFromStream(t,e){if(t.length===0)return 0;let i=0;for(this.buffer&&(i+=this.writeChunk(t,this.buffer));i<t.length&&!this.endOfStream;){let n=await this.reader.read();if(n.done){this.endOfStream=!0;break}n.value&&(i+=this.writeChunk(t.subarray(i),n.value))}if(!e&&i===0&&this.endOfStream)throw new Xt;return i}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}});function $x(r){try{let t=r.getReader({mode:"byob"});return t instanceof ReadableStreamDefaultReader?new bu(t):new Jd(t)}catch(t){if(t instanceof TypeError)return new bu(r.getReader());throw t}}var QE=te(()=>{H();Hx();Gx()});var rl=te(()=>{H();Qd();KE();Hx();Gx();QE()});var Us,tf=te(()=>{H();rl();Us=class{constructor(t){this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=t?.onClose,t?.abortSignal&&t.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(t,e=this.position){let i=new Uint8Array(t.len);if(await this.readBuffer(i,{position:e})<t.len)throw new Xt;return t.get(i,0)}async peekToken(t,e=this.position){let i=new Uint8Array(t.len);if(await this.peekBuffer(i,{position:e})<t.len)throw new Xt;return t.get(i,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new Xt;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new Xt;return t.get(this.numBuffer,0)}async ignore(t){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");if(this.fileInfo.size!==void 0){let e=this.fileInfo.size-this.position;if(t>e)return this.position+=e,e}return this.position+=t,t}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(t,e){if(!this.supportsRandomAccess()&&e&&e.position!==void 0&&e.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return{mayBeLess:!1,offset:0,length:t.length,position:this.position,...e}}abort(){return Promise.resolve()}}});var jN,Ng,JE=te(()=>{H();tf();rl();jN=256e3,Ng=class extends Us{constructor(t,e){super(e),this.streamReader=t,this.fileInfo=e?.fileInfo??{}}async readBuffer(t,e){let i=this.normalizeOptions(t,e),n=i.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(t,e);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(i.length===0)return 0;let s=await this.streamReader.read(t.subarray(0,i.length),i.mayBeLess);if(this.position+=s,(!e||!e.mayBeLess)&&s<i.length)throw new Xt;return s}async peekBuffer(t,e){let i=this.normalizeOptions(t,e),n=0;if(i.position){let s=i.position-this.position;if(s>0){let o=new Uint8Array(i.length+s);return n=await this.peekBuffer(o,{mayBeLess:i.mayBeLess}),t.set(o.subarray(s)),n-s}if(s<0)throw new Error("Cannot peek from a negative offset in a stream")}if(i.length>0){try{n=await this.streamReader.peek(t.subarray(0,i.length),i.mayBeLess)}catch(s){if(e?.mayBeLess&&s instanceof Xt)return 0;throw s}if(!i.mayBeLess&&n<i.length)throw new Xt}return n}async ignore(t){if(t<0)throw new RangeError("ignore length must be \u2265 0 bytes");let e=Math.min(jN,t),i=new Uint8Array(e),n=0;for(;n<t;){let s=t-n,o=await this.readBuffer(i,{length:Math.min(e,s)});if(o<0)return o;n+=o}return n}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}});var _g,t1=te(()=>{H();rl();tf();_g=class extends Us{constructor(t,e){super(e),this.uint8Array=t,this.fileInfo={...e?.fileInfo??{},size:t.length}}async readBuffer(t,e){e?.position&&(this.position=e.position);let i=await this.peekBuffer(t,e);return this.position+=i,i}async peekBuffer(t,e){let i=this.normalizeOptions(t,e),n=Math.min(this.uint8Array.length-i.position,i.length);if(!i.mayBeLess&&n<i.length)throw new Xt;return t.set(this.uint8Array.subarray(i.position,i.position+n)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});var Mg,e1=te(()=>{H();rl();tf();Mg=class extends Us{constructor(t,e){super(e),this.blob=t,this.fileInfo={...e?.fileInfo??{},size:t.size,mimeType:t.type}}async readBuffer(t,e){e?.position&&(this.position=e.position);let i=await this.peekBuffer(t,e);return this.position+=i,i}async peekBuffer(t,e){let i=this.normalizeOptions(t,e),n=Math.min(this.blob.size-i.position,i.length);if(!i.mayBeLess&&n<i.length)throw new Xt;let s=await this.blob.slice(i.position,i.position+n).arrayBuffer();return t.set(new Uint8Array(s)),n}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(t){this.position=t}}});function i1(r,t){let e=$x(r),i=t??{},n=i.onClose;return i.onClose=async()=>{if(await e.close(),n)return n()},new Ng(e,i)}function n1(r,t){return new _g(r,t)}function r1(r,t){return new Mg(r,t)}var ef=te(()=>{H();rl();JE();t1();e1();rl();tf()});var a1=Vt((QO,s1)=>{H();var wu=1e3,Au=wu*60,vu=Au*60,sl=vu*24,HN=sl*7,GN=sl*365.25;s1.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return $N(r);if(e==="number"&&isFinite(r))return t.long?qN(r):VN(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function $N(r){if(r=String(r),!(r.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(t){var e=parseFloat(t[1]),i=(t[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return e*GN;case"weeks":case"week":case"w":return e*HN;case"days":case"day":case"d":return e*sl;case"hours":case"hour":case"hrs":case"hr":case"h":return e*vu;case"minutes":case"minute":case"mins":case"min":case"m":return e*Au;case"seconds":case"second":case"secs":case"sec":case"s":return e*wu;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function VN(r){var t=Math.abs(r);return t>=sl?Math.round(r/sl)+"d":t>=vu?Math.round(r/vu)+"h":t>=Au?Math.round(r/Au)+"m":t>=wu?Math.round(r/wu)+"s":r+"ms"}function qN(r){var t=Math.abs(r);return t>=sl?Pg(r,t,sl,"day"):t>=vu?Pg(r,t,vu,"hour"):t>=Au?Pg(r,t,Au,"minute"):t>=wu?Pg(r,t,wu,"second"):r+" ms"}function Pg(r,t,e,i){var n=t>=e*1.5;return Math.round(r/e)+" "+i+(n?"s":"")}});var l1=Vt((tR,o1)=>{H();function WN(r){e.debug=e,e.default=e,e.coerce=c,e.disable=o,e.enable=n,e.enabled=l,e.humanize=a1(),e.destroy=u,Object.keys(r).forEach(h=>{e[h]=r[h]}),e.names=[],e.skips=[],e.formatters={};function t(h){let d=0;for(let f=0;f<h.length;f++)d=(d<<5)-d+h.charCodeAt(f),d|=0;return e.colors[Math.abs(d)%e.colors.length]}e.selectColor=t;function e(h){let d,f=null,m,x;function y(...A){if(!y.enabled)return;let w=y,v=Number(new Date),C=v-(d||v);w.diff=C,w.prev=d,w.curr=v,d=v,A[0]=e.coerce(A[0]),typeof A[0]!="string"&&A.unshift("%O");let D=0;A[0]=A[0].replace(/%([a-zA-Z%])/g,(k,R)=>{if(k==="%%")return"%";D++;let K=e.formatters[R];if(typeof K=="function"){let W=A[D];k=K.call(w,W),A.splice(D,1),D--}return k}),e.formatArgs.call(w,A),(w.log||e.log).apply(w,A)}return y.namespace=h,y.useColors=e.useColors(),y.color=e.selectColor(h),y.extend=i,y.destroy=e.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==e.namespaces&&(m=e.namespaces,x=e.enabled(h)),x),set:A=>{f=A}}),typeof e.init=="function"&&e.init(y),y}function i(h,d){let f=e(this.namespace+(typeof d>"u"?":":d)+h);return f.log=this.log,f}function n(h){e.save(h),e.namespaces=h,e.names=[],e.skips=[];let d=(typeof h=="string"?h:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let f of d)f[0]==="-"?e.skips.push(f.slice(1)):e.names.push(f)}function s(h,d){let f=0,m=0,x=-1,y=0;for(;f<h.length;)if(m<d.length&&(d[m]===h[f]||d[m]==="*"))d[m]==="*"?(x=m,y=f,m++):(f++,m++);else if(x!==-1)m=x+1,y++,f=y;else return!1;for(;m<d.length&&d[m]==="*";)m++;return m===d.length}function o(){let h=[...e.names,...e.skips.map(d=>"-"+d)].join(",");return e.enable(""),h}function l(h){for(let d of e.skips)if(s(h,d))return!1;for(let d of e.names)if(s(h,d))return!0;return!1}function c(h){return h instanceof Error?h.stack||h.message:h}function u(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return e.enable(e.load()),e}o1.exports=WN});var c1=Vt((un,Og)=>{H();un.formatArgs=YN;un.save=KN;un.load=ZN;un.useColors=XN;un.storage=QN();un.destroy=(()=>{let r=!1;return()=>{r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();un.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function XN(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let r;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(r=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(r[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function YN(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Og.exports.humanize(this.diff),!this.useColors)return;let t="color: "+this.color;r.splice(1,0,t,"color: inherit");let e=0,i=0;r[0].replace(/%[a-zA-Z%]/g,n=>{n!=="%%"&&(e++,n==="%c"&&(i=e))}),r.splice(i,0,t)}un.log=console.debug||console.log||(()=>{});function KN(r){try{r?un.storage.setItem("debug",r):un.storage.removeItem("debug")}catch{}}function ZN(){let r;try{r=un.storage.getItem("debug")||un.storage.getItem("DEBUG")}catch{}return!r&&typeof rt.default<"u"&&"env"in rt.default&&(r=rt.default.env.DEBUG),r}function QN(){try{return localStorage}catch{}}Og.exports=l1()(un);var{formatters:JN}=Og.exports;JN.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var al,Vx,u1,h1,d1,f1=te(()=>{H();Bs();al={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},Vx={get(r){return{signature:ve.get(r,0),compressedSize:ve.get(r,8),uncompressedSize:ve.get(r,12)}},len:16},u1={get(r){let t=De.get(r,6);return{signature:ve.get(r,0),minVersion:De.get(r,4),dataDescriptor:!!(t&8),compressedMethod:De.get(r,8),compressedSize:ve.get(r,18),uncompressedSize:ve.get(r,22),filenameLength:De.get(r,26),extraFieldLength:De.get(r,28),filename:null}},len:30},h1={get(r){return{signature:ve.get(r,0),nrOfThisDisk:De.get(r,4),nrOfThisDiskWithTheStart:De.get(r,6),nrOfEntriesOnThisDisk:De.get(r,8),nrOfEntriesOfSize:De.get(r,10),sizeOfCd:ve.get(r,12),offsetOfStartOfCd:ve.get(r,16),zipFileCommentLength:De.get(r,20)}},len:22},d1={get(r){let t=De.get(r,8);return{signature:ve.get(r,0),minVersion:De.get(r,6),dataDescriptor:!!(t&8),compressedMethod:De.get(r,10),compressedSize:ve.get(r,20),uncompressedSize:ve.get(r,24),filenameLength:De.get(r,28),extraFieldLength:De.get(r,30),fileCommentLength:De.get(r,32),relativeOffsetOfLocalHeader:ve.get(r,42),filename:null}},len:46}});function m1(r){let t=new Uint8Array(ve.len);return ve.put(t,0,r),t}function e_(r,t){let e=r.length,i=t.length;if(i>e)return-1;for(let n=0;n<=e-i;n++){let s=!0;for(let o=0;o<i;o++)if(r[n+o]!==t[o]){s=!1;break}if(s)return n}return-1}function i_(r){let t=r.reduce((n,s)=>n+s.length,0),e=new Uint8Array(t),i=0;for(let n of r)e.set(n,i),i+=n.length;return e}var p1,ts,qx,t_,Rg,ol,g1=te(()=>{H();Bs();p1=$c(c1(),1);f1();ts=(0,p1.default)("tokenizer:inflate"),qx=256*1024,t_=m1(al.DataDescriptor),Rg=m1(al.EndOfCentralDirectory),ol=class r{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(qx)}async isZip(){return await this.peekSignature()===al.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(ve)}async findEndOfCentralDirectoryLocator(){let t=this.tokenizer,e=Math.min(16*1024,t.fileInfo.size),i=this.syncBuffer.subarray(0,e);await this.tokenizer.readBuffer(i,{position:t.fileInfo.size-e});for(let n=i.length-4;n>=0;n--)if(i[n]===Rg[0]&&i[n+1]===Rg[1]&&i[n+2]===Rg[2]&&i[n+3]===Rg[3])return t.fileInfo.size-e+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){ts("Cannot reading central-directory without random-read support");return}ts("Reading central-directory...");let t=this.tokenizer.position,e=await this.findEndOfCentralDirectoryLocator();if(e>0){ts("Central-directory 32-bit signature found");let i=await this.tokenizer.readToken(h1,e),n=[];this.tokenizer.setPosition(i.offsetOfStartOfCd);for(let s=0;s<i.nrOfEntriesOfSize;++s){let o=await this.tokenizer.readToken(d1);if(o.signature!==al.CentralFileHeader)throw new Error("Expected Central-File-Header signature");o.filename=await this.tokenizer.readToken(new Ri(o.filenameLength,"utf-8")),await this.tokenizer.ignore(o.extraFieldLength),await this.tokenizer.ignore(o.fileCommentLength),n.push(o),ts(`Add central-directory file-entry: n=${s+1}/${n.length}: filename=${n[s].filename}`)}return this.tokenizer.setPosition(t),n}this.tokenizer.setPosition(t)}async unzip(t){let e=await this.readCentralDirectory();if(e)return this.iterateOverCentralDirectory(e,t);let i=!1;do{let n=await this.readLocalFileHeader();if(!n)break;let s=t(n);i=!!s.stop;let o;if(await this.tokenizer.ignore(n.extraFieldLength),n.dataDescriptor&&n.compressedSize===0){let l=[],c=qx;ts("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let u=-1;for(;u<0&&c===qx;){c=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),u=e_(this.syncBuffer.subarray(0,c),t_);let h=u>=0?u:c;if(s.handler){let d=new Uint8Array(h);await this.tokenizer.readBuffer(d),l.push(d)}else await this.tokenizer.ignore(h)}ts(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(n,i_(l),s.handler)}else s.handler?(ts(`Reading compressed-file-data: ${n.compressedSize} bytes`),o=new Uint8Array(n.compressedSize),await this.tokenizer.readBuffer(o),await this.inflate(n,o,s.handler)):(ts(`Ignoring compressed-file-data: ${n.compressedSize} bytes`),await this.tokenizer.ignore(n.compressedSize));if(ts(`Reading data-descriptor at pos=${this.tokenizer.position}`),n.dataDescriptor&&(await this.tokenizer.readToken(Vx)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-Vx.len}`)}while(!i)}async iterateOverCentralDirectory(t,e){for(let i of t){let n=e(i);if(n.handler){this.tokenizer.setPosition(i.relativeOffsetOfLocalHeader);let s=await this.readLocalFileHeader();if(s){await this.tokenizer.ignore(s.extraFieldLength);let o=new Uint8Array(i.compressedSize);await this.tokenizer.readBuffer(o),await this.inflate(s,o,n.handler)}}if(n.stop)break}}async inflate(t,e,i){if(t.compressedMethod===0)return i(e);if(t.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${t.compressedMethod}`);ts(`Decompress filename=${t.filename}, compressed-size=${e.length}`);let n=await r.decompressDeflateRaw(e);return i(n)}static async decompressDeflateRaw(t){let e=new ReadableStream({start(s){s.enqueue(t),s.close()}}),i=new DecompressionStream("deflate-raw"),n=e.pipeThrough(i);try{let o=await new Response(n).arrayBuffer();return new Uint8Array(o)}catch(s){let o=s instanceof Error?`Failed to deflate ZIP entry: ${s.message}`:"Unknown decompression error in ZIP entry";throw new TypeError(o)}}async readLocalFileHeader(){let t=await this.tokenizer.peekToken(ve);if(t===al.LocalFileHeader){let e=await this.tokenizer.readToken(u1);return e.filename=await this.tokenizer.readToken(new Ri(e.filenameLength,"utf-8")),e}if(t===al.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var nf,y1=te(()=>{H();nf=class{constructor(t){this.tokenizer=t}inflate(){let t=this.tokenizer;return new ReadableStream({async pull(e){let i=new Uint8Array(1024),n=await t.readBuffer(i,{mayBeLess:!0});if(n===0){e.close();return}e.enqueue(i.subarray(0,n))}}).pipeThrough(new DecompressionStream("gzip"))}}});var Wx=te(()=>{H();g1();y1()});function s_(r,t,e){return r?r.constructor===t?!0:n_.call(r)===e:!1}function a_(r){return s_(r,Uint8Array,r_)}function o_(r){if(!a_(r))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof r}\``)}function x1(r,t){if(r.length===0)return new Uint8Array(0);t??(t=r.reduce((n,s)=>n+s.length,0));let e=new Uint8Array(t),i=0;for(let n of r)o_(n),e.set(n,i),i+=n.length;return e}function Xx(r){let{byteLength:t}=r;if(t===6)return r.getUint16(0)*2**32+r.getUint32(2);if(t===5)return r.getUint8(0)*2**32+r.getUint32(1);if(t===4)return r.getUint32(0);if(t===3)return r.getUint8(0)*2**16+r.getUint16(1);if(t===2)return r.getUint16(0);if(t===1)return r.getUint8(0)}var n_,r_,gR,yR,xR,Yx=te(()=>{H();n_=Object.prototype.toString,r_="[object Uint8Array]";gR={utf8:new globalThis.TextDecoder("utf8")},yR=new globalThis.TextEncoder,xR=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"))});function b1(r,t){if(t==="utf-16le"){let e=[];for(let i=0;i<r.length;i++){let n=r.charCodeAt(i);e.push(n&255,n>>8&255)}return e}if(t==="utf-16be"){let e=[];for(let i=0;i<r.length;i++){let n=r.charCodeAt(i);e.push(n>>8&255,n&255)}return e}return[...r].map(e=>e.charCodeAt(0))}function w1(r,t=0){let e=Number.parseInt(new Ri(6).get(r,148).replace(new RegExp("\\0.*$","v"),"").trim(),8);if(Number.isNaN(e))return!1;let i=256;for(let n=t;n<t+148;n++)i+=r[n];for(let n=t+156;n<t+512;n++)i+=r[n];return e===i}var A1,v1=te(()=>{H();Bs();A1={get:(r,t)=>r[t+3]&127|(r[t+2]&127)<<7|(r[t+1]&127)<<14|(r[t]&127)<<21,len:4}});var E1,C1,T1=te(()=>{H();E1=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat","key","numbers","pages"],C1=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x-ms-shortcut","application/x-ft-apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x-ft-fbx","application/vnd.visio","application/vnd.android.package-archive","application/x-ft-draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data","application/vnd.apple.keynote","application/vnd.apple.numbers","application/vnd.apple.pages"]});function Lg(r,t,e){if(!Number.isFinite(r)||r<0||r>t)throw new bn(`${e} has invalid size ${r} (maximum ${t} bytes)`);return r}async function wn(r,t,{maximumLength:e=16777216,reason:i="skip"}={}){let n=Lg(t,e,i);await r.ignore(n)}async function rf(r,t,e,{maximumLength:i=t.length,reason:n="read"}={}){let s=e?.length??t.length,o=Lg(s,i,n);return r.readBuffer(t,{...e,length:o})}function er(r,t,e){e={offset:0,...e};for(let[i,n]of t.entries())if(e.mask){if(n!==(e.mask[i]&r[i+e.offset]))return!1}else if(n!==r[i+e.offset])return!1;return!0}function Ve(r){let t=r.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function zs(r,t,e){return Ve(r)&&r.position-t>e}var bn,Eu=te(()=>{H();bn=class extends Error{}});async function d_(r,{maximumLength:t=js}={}){let n=new ReadableStream({start(u){u.enqueue(r),u.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),s=[],o=0;try{for(;;){let{done:u,value:h}=await n.read();if(u)break;if(o+=h.length,o>t)throw await n.cancel(),new Error(`ZIP entry decompressed data exceeds ${t} bytes`);s.push(h)}}finally{n.releaseLock()}let l=new Uint8Array(o),c=0;for(let u of s)l.set(u,c),c+=u.length;return l}function f_(r,t){let e=new Uint8Array(t),i=0;for(let n of r)e.set(n,i),i+=n.length;return e}function p_(r){let t=r.fileInfo.size,e=Number.isFinite(t)?Math.max(0,t-r.position):Number.MAX_SAFE_INTEGER;return Math.min(e,l_)}function m_(r){if(r instanceof Xt||r instanceof bn)return!0;if(!(r instanceof Error))return!1;if(c_.has(r.message)||h_.has(r.code))return!0;for(let t of u_)if(r.message.startsWith(t))return!0;return!1}function I1(r,t=js){let e=[r.compressedSize,r.uncompressedSize];for(let i of e)if(!Number.isFinite(i)||i<0||i>t)return!1;return!0}function g_(){return{hasDocumentEntry:!1,hasMasterSlideEntry:!1,hasTablesEntry:!1,hasCalculationEngineEntry:!1}}function y_(r,t){t==="Index/Document.iwa"&&(r.hasDocumentEntry=!0),t.startsWith("Index/MasterSlide")&&(r.hasMasterSlideEntry=!0),t.startsWith("Index/Tables/")&&(r.hasTablesEntry=!0),t==="Index/CalculationEngine.iwa"&&(r.hasCalculationEngineEntry=!0)}function k1(r){if(r.hasDocumentEntry)return r.hasMasterSlideEntry?{ext:"key",mime:"application/vnd.apple.keynote"}:r.hasTablesEntry?{ext:"numbers",mime:"application/vnd.apple.numbers"}:{ext:"pages",mime:"application/vnd.apple.pages"}}function N1(r){switch(r=r.toLowerCase(),r){case"application/epub+zip":return{ext:"epub",mime:r};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:r};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:r};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:r};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:r};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:r};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:r};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:r};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:r};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:r};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:r};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:r};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:r};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:r};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:r};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:r};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function x_(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function b_(r,t){t.startsWith("word/")&&(r.hasWordDirectory=!0),t.startsWith("ppt/")&&(r.hasPresentationDirectory=!0),t.startsWith("xl/")&&(r.hasSpreadsheetDirectory=!0),t.startsWith("3D/")&&t.endsWith(".model")&&(r.hasThreeDimensionalModelEntry=!0)}function M1(r){if(r.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(r.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(r.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(r.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}function _1(r){if(!(!r.hasContentTypesEntry||r.hasUnparseableContentTypes||r.isParsingContentTypes||r.hasParsedContentTypesEntry))return M1(r)}function w_(r){let t=r.indexOf('.main+xml"');if(t===-1){let n="application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return r.includes(`ContentType="${n}"`)?n:void 0}let e=r.slice(0,t),i=e.lastIndexOf('"');return e.slice(i+1)}function v_(r,t){if(r.length<Bg)return-1;let e=r.length-Bg;for(let i=0;i<=e;i++)if(ve.get(r,i)===F1&&ve.get(r,i+8)===t+i)return i;return-1}async function E_(r,{shouldBuffer:t,maximumLength:e=js}={}){let{syncBuffer:i}=r,{length:n}=i,s=[],o=0;for(;;){let l=await r.tokenizer.peekBuffer(i,{mayBeLess:!0}),c=v_(i.subarray(0,l),o),u=c>=0?0:l===n?Math.min(A_,l-1):0,h=c>=0?c:l-u;if(h===0)break;if(o+=h,o>e)throw new Error(`ZIP entry compressed data exceeds ${e} bytes`);if(t){let d=new Uint8Array(h);await r.tokenizer.readBuffer(d),s.push(d)}else await r.tokenizer.ignore(h);if(c>=0)break}if(Ve(r.tokenizer)||(r.knownSizeDescriptorScannedBytes+=o),!!t)return f_(s,o)}function C_(r,t){return Ve(r.tokenizer)?Math.max(0,16777216-(r.tokenizer.position-t)):Math.max(0,js-r.knownSizeDescriptorScannedBytes)}async function T_(r,t,{shouldBuffer:e,maximumDescriptorLength:i=js}={}){if(t.dataDescriptor&&t.compressedSize===0)return E_(r,{shouldBuffer:e,maximumLength:i});if(!e){await wn(r.tokenizer,t.compressedSize,{maximumLength:Ve(r.tokenizer)?js:r.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let n=p_(r.tokenizer);if(!Number.isFinite(t.compressedSize)||t.compressedSize<0||t.compressedSize>n)throw new Error(`ZIP entry compressed data exceeds ${n} bytes`);let s=new Uint8Array(t.compressedSize);return await r.tokenizer.readBuffer(s),s}async function P1(r){let t,e=x_(),i=g_();try{await new ol(r).unzip(s=>{if(b_(e,s.filename),y_(i,s.filename),i.hasDocumentEntry&&(i.hasMasterSlideEntry||i.hasTablesEntry))return t=k1(i),{stop:!0};let o=s.filename==="[Content_Types].xml",l=_1(e);if(!o&&l)return t=l,{stop:!0};switch(s.filename){case"META-INF/mozilla.rsa":return t={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return t={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":return I1(s,D1)?{async handler(c){let u=new TextDecoder("utf-8").decode(c).trim();t=N1(u)},stop:!0}:{};case"[Content_Types].xml":return e.hasContentTypesEntry=!0,I1(s,D1)?(e.isParsingContentTypes=!0,{async handler(c){let u=new TextDecoder("utf-8").decode(c),h=w_(u);h&&(t=N1(h)),e.hasParsedContentTypesEntry=!0,e.isParsingContentTypes=!1},stop:!0}):(e.hasUnparseableContentTypes=!0,{});default:return new RegExp("classes\\d*\\.dex","v").test(s.filename)?(t={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0}):{}}})}catch(s){if(!m_(s))throw s;e.isParsingContentTypes&&(e.isParsingContentTypes=!1,e.hasUnparseableContentTypes=!0),!t&&s instanceof Xt&&!e.hasContentTypesEntry&&(t=M1(e))}let n=Ve(r)&&i.hasDocumentEntry&&!i.hasMasterSlideEntry&&!i.hasTablesEntry&&!i.hasCalculationEngineEntry?void 0:k1(i);return t??_1(e)??n??{ext:"zip",mime:"application/zip"}}var js,S1,l_,D1,c_,u_,h_,F1,Bg,A_,O1=te(()=>{H();Bs();ef();Wx();Eu();js=1024*1024,S1=1024,l_=2**31-1,D1=js,c_=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),u_=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],h_=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);F1=134695760,Bg=16,A_=Bg-1;ol.prototype.inflate=async function(r,t,e){if(r.compressedMethod===0)return e(t);if(r.compressedMethod!==8)throw new Error(`Unsupported ZIP compression method: ${r.compressedMethod}`);let i=await d_(t,{maximumLength:js});return e(i)};ol.prototype.unzip=async function(r){let t=!1,e=0,i=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(zs(this.tokenizer,i,16777216))throw new bn(`ZIP stream probing exceeds ${16777216} bytes`);let n=await this.readLocalFileHeader();if(!n)break;if(e++,e>S1)throw new Error(`ZIP entry count exceeds ${S1}`);let s=r(n);t=!!s.stop,await this.tokenizer.ignore(n.extraFieldLength);let o=await T_(this,n,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(js,C_(this,i))});if(s.handler&&await this.inflate(n,o,s.handler),n.dataDescriptor){let l=new Uint8Array(Bg);if(await this.tokenizer.readBuffer(l),ve.get(l,0)!==F1)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(zs(this.tokenizer,i,16777216))throw new bn(`ZIP stream probing exceeds ${16777216} bytes`)}while(!t)}});async function B1(r){async function t(){let l=await r.peekNumber(qE),c=128,u=0;for(;(l&c)===0&&c!==0;)++u,c>>=1;let h=new Uint8Array(u+1);return await rf(r,h,void 0,{maximumLength:h.length,reason:"EBML field"}),h}async function e(){let l=await t(),c=await t();c[0]^=128>>c.length-1;let u=Math.min(6,c.length),h=new DataView(l.buffer),d=new DataView(c.buffer,c.length-u,u);return{id:Xx(h),len:Xx(d)}}async function i(l){let c=0;for(;l>0;){if(c++,c>S_||zs(r,s,16777216))return;let u=r.position,h=await e();if(h.id===17026){if(h.len>R1)return;let d=Lg(h.len,R1,"EBML DocType");return(await r.readToken(new Ri(d))).replaceAll(new RegExp("\\0.*$","gv"),"")}if(Ve(r)&&(!Number.isFinite(h.len)||h.len<0||h.len>L1)||(await wn(r,h.len,{maximumLength:Ve(r)?L1:r.fileInfo.size,reason:"EBML payload"}),--l,r.position<=u))return}}let n=await e(),s=r.position;switch(await i(n.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:}}var R1,L1,S_,U1=te(()=>{H();Bs();Yx();Eu();R1=64,L1=1024*1024,S_=256});function k_(r){return(r.codePointAt(0)&32)!==0}async function j1(r){let t={ext:"png",mime:"image/png"},e={ext:"apng",mime:"image/apng"};await r.ignore(8);async function i(){return{length:await r.readToken(WE),type:await r.readToken(new Ri(4,"latin1"))}}let n=Ve(r),s=r.position,o=0,l=!1;do{if(o++,o>D_||zs(r,s,I_))break;let c=r.position,u=await i();if(u.length<0)return;if(u.type==="IHDR"){if(u.length!==13)return;l=!0}switch(u.type){case"IDAT":return t;case"acTL":return e;default:if(!l&&u.type!=="CgBI")return;if(n&&u.length>z1)return l&&k_(u.type)?t:void 0;try{await wn(r,u.length+4,{maximumLength:n?z1+4:r.fileInfo.size,reason:"PNG chunk payload"})}catch(h){if(!n&&(h instanceof bn||h instanceof Xt))return t;throw h}}if(r.position<=c)break}while(r.position+8<r.fileInfo.size);return t}var D_,I_,z1,H1=te(()=>{H();Bs();ef();Eu();D_=512,I_=16*1024*1024,z1=1024*1024});async function $1(r){let t=!1;try{async function e(){let o=new Uint8Array(16);return await rf(r,o,void 0,{maximumLength:o.length,reason:"ASF header GUID"}),{id:o,size:Number(await r.readToken(XE))}}await wn(r,30,{maximumLength:30,reason:"ASF header prelude"});let i=Ve(r),n=r.position,s=0;for(;r.position+24<r.fileInfo.size&&(s++,!(s>N_||zs(r,n,16777216)));){let o=r.position,l=await e(),c=l.size-24;if(!Number.isFinite(c)||c<0){t=!0;break}if(er(l.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let u=new Uint8Array(16);if(c-=await rf(r,u,void 0,{maximumLength:u.length,reason:"ASF stream type GUID"}),er(u,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(er(u,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(i&&c>G1){t=!0;break}if(await wn(r,c,{maximumLength:i?G1:r.fileInfo.size,reason:"ASF header payload"}),r.position<=o){t=!0;break}}}catch(e){if(e instanceof Xt||e instanceof bn)Ve(r)&&(t=!0);else throw e}if(!t)return{ext:"asf",mime:"application/vnd.ms-asf"}}var N_,G1,V1=te(()=>{H();Bs();ef();Eu();N_=512,G1=1024*1024});var Q1={};Vy(Q1,{FileTypeParser:()=>Hs,fileTypeFromBlob:()=>H_,fileTypeFromBuffer:()=>j_,fileTypeFromFile:()=>W_,fileTypeFromStream:()=>z_,fileTypeFromTokenizer:()=>G_,fileTypeStream:()=>$_,normalizeSampleSize:()=>Z1,reasonableDetectionSizeInBytes:()=>Cu,supportedExtensions:()=>V_,supportedMimeTypes:()=>q_});function Z1(r){return Number.isFinite(r)?Math.max(1,Math.trunc(r)):Cu}function R_(r){return Number.isFinite(r)?Math.max(0,Math.min(__,Math.trunc(r))):0}function L_(r){return Number.isFinite(r)?Math.max(0,r):Number.MAX_SAFE_INTEGER}function Y1(r){return import(r)}function B_(r){return r.pipeThrough(new TransformStream)}function K1(r,t){return t===void 0?r.read():(t.throwIfAborted(),Promise.race([r.read(),new Promise((e,i)=>{t.addEventListener("abort",()=>{i(t.reason),r.cancel(t.reason).catch(()=>{})},{once:!0})})]))}function U_(r,t){let e=r.getReader(),i=0,n=!1,s=!1,o=async l=>{n||s||(s=!0,await e.cancel(l))};return new ReadableStream({async pull(l){if(i>=t){l.close(),await o();return}let{done:c,value:u}=await e.read();if(c||!u){n=!0,l.close();return}let h=t-i;if(u.length>h){l.enqueue(u.subarray(0,h)),i+=h,l.close(),await o();return}l.enqueue(u),i+=u.length},async cancel(l){await o(l)}})}async function z_(r,t){return new Hs(t).fromStream(r)}async function j_(r,t){return new Hs(t).fromBuffer(r)}async function H_(r,t){return new Hs(t).fromBlob(r)}async function G_(r,t){return new Hs(t).fromTokenizer(r)}async function $_(r,t){return new Hs(t).toDetectionStream(r,t)}async function W_(r,t){return new Hs(t).fromFile(r)}var Cu,__,M_,F_,q1,Kx,P_,W1,O_,X1,Hs,V_,q_,J1=te(()=>{H();Bs();ef();Wx();Yx();v1();T1();Eu();O1();U1();H1();V1();Cu=4100,__=Cu-2,M_=16777216,F_=1,q1=100,Kx=16777216,P_=512,W1=256,O_=1024*1024,X1=16777216;Hs=class r{constructor(t){j(this,"detectConfident",async t=>{if(this.buffer=new Uint8Array(Cu),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,Ve(t)&&(await t.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8])))return this.detectGzip(t);if(await t.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await t.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.detectionReentryCount>=W1?void 0:(this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(t));if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(t);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await wn(t,6,{maximumLength:6,reason:"ID3 header prefix"});let e=await t.readToken(A1),i=Ve(t);if(!Number.isFinite(e)||e<0||i&&(e>Kx||t.position+e>Kx))return;if(t.position+e>t.fileInfo.size)return i?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await wn(t,e,{maximumLength:i?Kx:t.fileInfo.size,reason:"ID3 payload"})}catch(n){if(n instanceof Xt)return;throw n}return this.detectionReentryCount>=W1?void 0:(this.detectionReentryCount++,this.parseTokenizer(t,this.detectionReentryCount))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4]))return P1(t);if(this.checkString("OggS")){await t.ignore(28);let e=new Uint8Array(8);return await t.readBuffer(e),er(e,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:er(e,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:er(e,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:er(e,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:er(e,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:er(e,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let e=await this.readTiffHeader(!1);if(e)return e}if(this.check([77,77])){let e=await this.readTiffHeader(!0);if(e)return e}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163]))return B1(t);if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString(String.raw`{\rtf`))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){let e=jx.get(this.buffer,4),i=el.get(this.buffer,6);if(e>0&&e<=30)return{ext:"macho",mime:"application/x-mach-binary"};if(i>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/x-ft-draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let e=new Ri(4,"latin1").get(this.buffer,2);if(new RegExp("^\\d+$","v").test(e)&&e>=1e3&&e<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await t.ignore(8),await t.readToken(new Ri(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[`
12
+ `,"\r"," "," ","\0"].some(e=>this.checkString(e,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10]))return j1(t);if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let e=new Ri(4,"latin1").get(this.buffer,8).replace("\0"," ").trim();switch(e){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return e.startsWith("3g")?e.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
13
+ `))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217]))return $1(t);if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await t.ignore(20),await t.readToken(new Ri(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.checkString("<?xml ",{offset:2,encoding:"utf-16be"})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await t.peekBuffer(this.buffer,{length:Math.min(256,t.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let e=new DataView(this.buffer.buffer).getUint32(12,!0);if(e>12&&this.buffer.length>=e+16)try{let i=new TextDecoder().decode(this.buffer.subarray(16,e+16));if(JSON.parse(i).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x-ms-shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x-ft-apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x-ft-fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await t.peekBuffer(this.buffer,{length:Math.min(512,t.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\0",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&w1(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let e="utf-16le";return this.checkString("<?xml ",{offset:2,encoding:e})?{ext:"xml",mime:"application/xml"}:this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:e})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:this.checkString(`Windows Registry Editor Version 5.00\r
14
+ `,{offset:2,encoding:e})?{ext:"reg",mime:"application/x-ms-regedit"}:void 0}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}});j(this,"detectImprecise",async t=>{this.buffer=new Uint8Array(Cu);let e=L_(t.fileInfo.size);if(await t.peekBuffer(this.buffer,{length:Math.min(8,e),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await t.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,e),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let i=0;i<=this.options.mpegOffsetTolerance;++i){let n=this.scanMpeg(i);if(n)return n}});let e=R_(t?.mpegOffsetTolerance);this.options={...t,mpegOffsetTolerance:e},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(t){return i1(B_(t),this.getTokenizerOptions())}async parseTokenizer(t,e=0){this.detectionReentryCount=e;let i=t.position;for(let n of this.detectors){let s;try{s=await n.detect(t)}catch(o){if(o instanceof Xt||o instanceof bn)return;throw o}if(s)return s;if(i!==t.position)return}}async fromTokenizer(t){try{return await this.parseTokenizer(t)}finally{await t.close()}}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``);let e=t instanceof Uint8Array?t:new Uint8Array(t);if(e?.length>1)return this.fromTokenizer(n1(e,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let e=r1(t,this.getTokenizerOptions());return this.fromTokenizer(e)}async fromStream(t){this.options.signal?.throwIfAborted();let e=this.createTokenizerFromWebStream(t);return this.fromTokenizer(e)}async fromFile(t){this.options.signal?.throwIfAborted();let[{default:e},{FileTokenizer:i}]=await Promise.all([Y1("node:fs/promises"),Y1("strtok3")]),n=await e.open(t,e.constants.O_RDONLY|e.constants.O_NONBLOCK),s=await n.stat();if(!s.isFile()){await n.close();return}let o=new i(n,{...this.getTokenizerOptions(),fileInfo:{path:t,size:s.size}});return this.fromTokenizer(o)}async toDetectionStream(t,e){this.options.signal?.throwIfAborted();let i=Z1(e?.sampleSize??Cu),n,s=!1,o=t.getReader(),l=[],c=0;try{for(;c<i;){let{value:d,done:f}=await K1(o,this.options.signal);if(f||!d){s=!0;break}l.push(d),c+=d.length}if(!s&&c===i){let{value:d,done:f}=await K1(o,this.options.signal);f||!d?s=!0:(l.push(d),c+=d.length)}}finally{o.releaseLock()}if(c>0){let d=l.length===1?l[0]:x1(l);try{n=await this.fromBuffer(d.subarray(0,i))}catch(f){if(!(f instanceof Xt))throw f;n=void 0}!s&&n?.ext==="pages"&&(n={ext:"zip",mime:"application/zip"})}let u=new TransformStream({start(d){for(let f of l)d.enqueue(f)},transform(d,f){f.enqueue(d)}}),h=t.pipeThrough(u);return h.fileType=n,h}async detectGzip(t){if(this.gzipProbeDepth>=F_)return{ext:"gz",mime:"application/gzip"};let e=new nf(t),i=U_(e.inflate(),M_),n=Ve(t),s,o,l,c;if(n){let u=new AbortController;s=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${q1} ms`,"TimeoutError"))},q1),o=this.options.signal===void 0?u.signal:AbortSignal.any([this.options.signal,u.signal]),l=new r({...this.options,signal:o}),l.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{c=await(l??this).fromStream(i)}catch(u){if(u?.name==="AbortError"&&o?.reason?.name!=="TimeoutError")throw u}finally{clearTimeout(s),n||this.gzipProbeDepth--}return c?.ext==="tar"?{ext:"tar.gz",mime:"application/gzip"}:{ext:"gz",mime:"application/gzip"}}check(t,e){return er(this.buffer,t,e)}checkString(t,e){return this.check(b1(t,e?.encoding),e)}async readTiffTag(t){let e=await this.tokenizer.readToken(t?el:De);switch(await this.tokenizer.ignore(10),e){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(t){let e=await this.tokenizer.readToken(t?el:De);if(!(e>P_)&&!(Ve(this.tokenizer)&&2+e*12>X1))for(let i=0;i<e;++i){let n=await this.readTiffTag(t);if(n)return n}}async readTiffHeader(t){let e={ext:"tif",mime:"image/tiff"},i=(t?el:De).get(this.buffer,2),n=(t?jx:ve).get(this.buffer,4);if(i===42){if(n>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(n>=8){let l=(t?el:De).get(this.buffer,8),c=(t?el:De).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(Ve(this.tokenizer)&&n>O_)return e;let s=Ve(this.tokenizer)?X1:this.tokenizer.fileInfo.size;try{await wn(this.tokenizer,n,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof Xt)return;throw l}let o;try{o=await this.readTiffIFD(t)}catch(l){if(l instanceof Xt)return;throw l}return o??e}if(i===43)return e}scanMpeg(t){if(this.check([255,224],{offset:t,mask:[255,224]})){if(this.check([16],{offset:t+1,mask:[22]}))return this.check([8],{offset:t+1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:t+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:t+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:t+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}},V_=new Set(E1),q_=new Set(C1)});var RS={};Vy(RS,{AbortException:()=>Hr,AnnotationEditorLayer:()=>ly,AnnotationEditorParamsType:()=>Wt,AnnotationEditorType:()=>Pt,AnnotationEditorUIManager:()=>Go,AnnotationLayer:()=>ey,AnnotationMode:()=>Da,AnnotationType:()=>qe,CSSConstants:()=>L0,ColorPicker:()=>qf,DOMSVGFactory:()=>Bc,DrawLayer:()=>cy,FeatureTest:()=>je,GlobalWorkerOptions:()=>yr,ImageKind:()=>_f,InvalidPDFException:()=>gd,MathClamp:()=>li,OPS:()=>md,OutputScale:()=>Ds,PDFDataRangeTransport:()=>Vf,PDFDateString:()=>Oc,PDFWorker:()=>vd,PasswordResponses:()=>TC,PermissionFlag:()=>CC,PixelsPerInch:()=>_a,RenderingCancelledException:()=>yd,ResponseException:()=>Rc,SignatureExtractor:()=>xr,SupportedImageMimeTypes:()=>R0,TextLayer:()=>Ad,TextLayerImages:()=>uy,TouchManager:()=>jf,Util:()=>mt,VerbosityLevel:()=>Gm,XfaLayer:()=>Uf,applyOpacity:()=>NC,build:()=>HT,createValidAbsoluteUrl:()=>Pw,fetchData:()=>Uy,findContrastColor:()=>_C,getDocument:()=>BT,getFilenameFromUrl:()=>DC,getPdfFilenameFromUrl:()=>IC,getRGB:()=>Td,getUuid:()=>Rw,getXfaPageViewport:()=>kC,isDataScheme:()=>$m,isPdfFile:()=>zy,isValidExplicitDest:()=>dT,makeArr:()=>Ly,makeMap:()=>By,makeObj:()=>P0,noContextMenu:()=>qn,normalizeUnicode:()=>SC,renderRichText:()=>Lw,setLayerDimensions:()=>Ho,shadow:()=>Ot,stopEvent:()=>_e,updateUrlHash:()=>Ow,version:()=>jT});function Y_(r){Number.isInteger(r)&&(Py=r)}function K_(){return Py}function Oy(r){Py>=Gm.INFOS&&console.info(`Info: ${r}`)}function Ut(r){Py>=Gm.WARNINGS&&console.warn(`Warning: ${r}`)}function se(r){throw new Error(r)}function Me(r,t){r||se(t)}function Z_(r){switch(r?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Pw(r,t=null,e=null){if(!r)return null;if(e&&typeof r=="string"&&(e.addDefaultProtocol&&r.startsWith("www.")&&r.match(/\./g)?.length>=2&&(r=`http://${r}`),e.tryConvertEncoding))try{r=iM(r)}catch{}let i=t?URL.parse(r,t):URL.parse(r);return Z_(i)?i:null}function Ow(r,t,e=!1){let i=URL.parse(r);return i?(i.hash=t,i.href):e&&Pw(r,"http://example.com")?r.split("#",1)[0]+`${t?`#${t}`:""}`:""}function nb(r){return r.substring(r.lastIndexOf("/")+1)}function Ot(r,t,e,i=!1){return Object.defineProperty(r,t,{value:e,enumerable:!i,configurable:!0,writable:!1}),e}function Q_(r){(typeof r!="object"||r?.length===void 0)&&se("Invalid argument for bytesToString");let t=r.length,e=8192;if(t<e)return String.fromCharCode.apply(null,r);let i=[];for(let n=0;n<t;n+=e){let s=Math.min(n+e,t),o=r.subarray(n,s);i.push(String.fromCharCode.apply(null,o))}return i.join("")}function Ry(r){typeof r!="string"&&se("Invalid argument for stringToBytes");let t=r.length,e=new Uint8Array(t);for(let i=0;i<t;++i)e[i]=r.charCodeAt(i)&255;return e}function J_(r){return String.fromCharCode(r>>24&255,r>>16&255,r>>8&255,r&255)}function tM(){let r=new Uint8Array(4);return r[0]=1,new Uint32Array(r.buffer,0,1)[0]===1}function eM(){try{return new Function(""),!0}catch{return!1}}function iM(r){return decodeURIComponent(escape(r))}function SC(r){return Qx||(Qx=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,tC=new Map([["\uFB05","\u017Ft"]])),r.replaceAll(Qx,(t,e,i)=>e?e.normalize("NFKC"):tC.get(i))}function Rw(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let r=new Uint8Array(32);return crypto.getRandomValues(r),Q_(r)}function nM(r,t,e){if(!Array.isArray(e)||e.length<2)return!1;let[i,n,...s]=e;if(!r(i)&&!Number.isInteger(i)||!t(n))return!1;let o=s.length,l=!0;switch(n.name){case"XYZ":if(o<2||o>3)return!1;break;case"Fit":case"FitB":return o===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(o>1)return!1;break;case"FitR":if(o!==4)return!1;l=!1;break;default:return!1}for(let c of s)if(!(typeof c=="number"||l&&c===null))return!1;return!0}function li(r,t,e){return Math.min(Math.max(r,t),e)}async function Uy(r,t="text"){if(Ff(r,document.baseURI)){let e=await fetch(r);if(!e.ok)throw new Error(e.statusText);switch(t){case"blob":return e.blob();case"bytes":return e.bytes();case"json":return e.json()}return e.text()}return new Promise((e,i)=>{let n=new XMLHttpRequest;n.open("GET",r,!0),n.responseType=t==="bytes"?"arraybuffer":t,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE){if(n.status===200||n.status===0){switch(t){case"bytes":e(new Uint8Array(n.response));return;case"blob":case"json":e(n.response);return}e(n.responseText);return}i(new Error(n.statusText))}},n.send(null)})}function $m(r){let t=r.length,e=0;for(;e<t&&r[e].trim()==="";)e++;return r.substring(e,e+5).toLowerCase()==="data:"}function zy(r){return typeof r=="string"&&/\.pdf$/i.test(r)}function DC(r){return[r]=r.split(/[#?]/,1),nb(r)}function IC(r,t="document.pdf"){if(typeof r!="string")return t;if($m(r))return Ut('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;let i=(l=>{try{return new URL(l)}catch{try{return new URL(decodeURIComponent(l))}catch{try{return new URL(l,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(l),"https://foo.bar")}catch{return null}}}}})(r);if(!i)return t;let n=l=>{try{let c=decodeURIComponent(l);return c.includes("/")&&(c=nb(c),/^\.pdf$/i.test(c))?l:c}catch{return l}},s=/\.pdf$/i,o=nb(i.pathname);if(s.test(o))return n(o);if(i.searchParams.size>0){let l=u=>[...u].findLast(h=>s.test(h)),c=l(i.searchParams.values())??l(i.searchParams.keys());if(c)return n(c)}if(i.hash){let c=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(c)return n(c[0])}return t}function Ff(r,t){let e=t?URL.parse(r,t):URL.parse(r);return/https?:/.test(e?.protocol??"")}function qn(r){r.preventDefault()}function _e(r){r.preventDefault(),r.stopPropagation()}function rM(r){console.log("Deprecated API usage: "+r)}function kC(r,{scale:t=1,rotation:e=0}){let{width:i,height:n}=r.attributes.style,s=[0,0,parseInt(i),parseInt(n)];return new zf({viewBox:s,userUnit:1,scale:t,rotation:e})}function Td(r){if(r.startsWith("#")){let t=parseInt(r.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return r.startsWith("rgb(")?r.slice(4,-1).split(",").map(t=>parseInt(t)):r.startsWith("rgba(")?r.slice(5,-1).split(",",3).map(t=>parseInt(t)):(Ut(`Not a valid color format: "${r}"`),[0,0,0])}function sM(r){let t=document.createElement("span");t.style.visibility="hidden",t.style.colorScheme="only light",document.body.append(t);for(let e of r.keys()){t.style.color=e;let i=window.getComputedStyle(t).color;r.set(e,Td(i))}t.remove()}function Ne(r){let{a:t,b:e,c:i,d:n,e:s,f:o}=r.getTransform();return[t,e,i,n,s,o]}function es(r){let{a:t,b:e,c:i,d:n,e:s,f:o}=r.getTransform().invertSelf();return[t,e,i,n,s,o]}function Ho(r,t,e=!1,i=!0){if(t instanceof zf){let{pageWidth:n,pageHeight:s}=t.rawDims,{style:o}=r,l=je.isCSSRoundSupported,c=`var(--total-scale-factor) * ${n}px`,u=`var(--total-scale-factor) * ${s}px`,h=l?`round(down, ${c}, var(--scale-round-x))`:`calc(${c})`,d=l?`round(down, ${u}, var(--scale-round-y))`:`calc(${u})`;!e||t.rotation%180===0?(o.width=h,o.height=d):(o.width=d,o.height=h)}i&&r.setAttribute("data-main-rotation",t.rotation)}function NC(r,t){t=li(t??1,0,1);let e=255*(1-t);return r.map(i=>Math.round(i*t+e))}function eC(r,t){let e=r[0]/255,i=r[1]/255,n=r[2]/255,s=Math.max(e,i,n),o=Math.min(e,i,n),l=(s+o)/2;if(s===o)t[0]=t[1]=0;else{let c=s-o;switch(t[1]=l<.5?c/(s+o):c/(2-s-o),s){case e:t[0]=((i-n)/c+(i<n?6:0))*60;break;case i:t[0]=((n-e)/c+2)*60;break;case n:t[0]=((e-i)/c+4)*60;break}}t[2]=l}function ob(r,t){let e=r[0],i=r[1],n=r[2],s=(1-Math.abs(2*n-1))*i,o=s*(1-Math.abs(e/60%2-1)),l=n-s/2;switch(Math.floor(e/60)){case 0:t[0]=s+l,t[1]=o+l,t[2]=l;break;case 1:t[0]=o+l,t[1]=s+l,t[2]=l;break;case 2:t[0]=l,t[1]=s+l,t[2]=o+l;break;case 3:t[0]=l,t[1]=o+l,t[2]=s+l;break;case 4:t[0]=o+l,t[1]=l,t[2]=s+l;break;case 5:case 6:t[0]=s+l,t[1]=l,t[2]=o+l;break}}function iC(r){return r<=.03928?r/12.92:((r+.055)/1.055)**2.4}function nC(r,t,e){ob(r,e),e.map(iC);let i=.2126*e[0]+.7152*e[1]+.0722*e[2];ob(t,e),e.map(iC);let n=.2126*e[0]+.7152*e[1]+.0722*e[2];return i>n?(i+.05)/(n+.05):(n+.05)/(i+.05)}function _C(r,t){let e=r[0]+r[1]*256+r[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,i=rC.get(e);if(i)return i;let n=new Float32Array(9),s=n.subarray(0,3),o=n.subarray(3,6);eC(r,o);let l=n.subarray(6,9);eC(t,l);let c=l[2]<.5,u=c?12:4.5;if(o[2]=c?Math.sqrt(o[2]):1-Math.sqrt(1-o[2]),nC(o,l,s)<u){let h,d;c?(h=o[2],d=1):(h=0,d=o[2]);let f=.005;for(;d-h>f;){let m=o[2]=(h+d)/2;c===nC(o,l,s)<u?h=m:d=m}o[2]=c?d:h}return ob(o,s),i=mt.makeHexColor(Math.round(s[0]*255),Math.round(s[1]*255),Math.round(s[2]*255)),rC.set(e,i),i}function Lw({html:r,dir:t,className:e},i){let n=document.createDocumentFragment();if(typeof r=="string"){let s=document.createElement("p");s.dir=t||"auto";let o=r.split(/(?:\r\n?|\n)/);for(let l=0,c=o.length;l<c;++l){let u=o[l];s.append(document.createTextNode(u)),l<c-1&&s.append(document.createElement("br"))}n.append(s)}else Uf.render({xfaHtml:r,div:n,intent:"richText"});n.firstElementChild.classList.add("richText",e),i.append(n)}function MC(r){let t=new Path2D;if(!r)return t;for(let e=0,i=r.length;e<i;)switch(r[e++]){case sf.moveTo:t.moveTo(r[e++],r[e++]);break;case sf.lineTo:t.lineTo(r[e++],r[e++]);break;case sf.curveTo:t.bezierCurveTo(r[e++],r[e++],r[e++],r[e++],r[e++],r[e++]);break;case sf.quadraticCurveTo:t.quadraticCurveTo(r[e++],r[e++],r[e++],r[e++]);break;case sf.closePath:t.closePath();break;default:Ut(`Unrecognized drawing path operator: ${r[e-1]}`);break}return t}function BC(r,t,e){for(let i of e)t.addEventListener(i,r[i].bind(r))}function lC(r,t,e,i,n,s){r[t*4+0]=Math.min(r[t*4+0],e),r[t*4+1]=Math.min(r[t*4+1],i),r[t*4+2]=Math.max(r[t*4+2],n),r[t*4+3]=Math.max(r[t*4+3],s)}function aM(r){if(r instanceof URL)return r;if(typeof r=="string"){if(Hn){if(/^[a-z][a-z0-9\-+.]+:/i.test(r))return new URL(r);let e=rt.default.getBuiltinModule("url");return new URL(e.pathToFileURL(r))}let t=URL.parse(r,window.location);if(t)return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function oM(r){if(Hn&&typeof at.Buffer<"u"&&r instanceof at.Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength)return r;if(typeof r=="string")return Ry(r);if(r instanceof ArrayBuffer||ArrayBuffer.isView(r)||typeof r=="object"&&!isNaN(r?.length))return new Uint8Array(r);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function Ug(r){if(typeof r!="string")return null;if(r.endsWith("/"))return r;throw new Error(`Invalid factory url: "${r}" must include trailing slash.`)}function uC(){}function hn(r){if(r instanceof Hr||r instanceof gd||r instanceof F0||r instanceof Rc||r instanceof Mf)return r;switch(r instanceof Error||typeof r=="object"&&r!==null||se('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),r.name){case"AbortException":return new Hr(r.message);case"InvalidPDFException":return new gd(r.message);case"PasswordException":return new F0(r.message,r.code);case"ResponseException":return new Rc(r.message,r.status,r.missing);case"UnknownErrorException":return new Mf(r.message,r.details)}return new Mf(r.message,r.toString())}async function cM(r){let e=await rt.default.getBuiltinModule("fs").promises.readFile(r);return new Uint8Array(e)}function hM(){Bw.init()}function dM(){return Bw.isReady}function fM(r,t,e,i,n,s){return Bw.draw(r,t,e,i,n,s)}function o0(r,t){if(!t)return;let e=t[2]-t[0],i=t[3]-t[1],n=new Path2D;n.rect(t[0],t[1],e,i),r.clip(n)}function Jx(r,t,e,i,n,s,o,l){let c=t.coords,u=t.colors,h=r.data,d=r.width*4,f;c[e*2+1]>c[i*2+1]&&(f=e,e=i,i=f,f=s,s=o,o=f),c[i*2+1]>c[n*2+1]&&(f=i,i=n,n=f,f=o,o=l,l=f),c[e*2+1]>c[i*2+1]&&(f=e,e=i,i=f,f=s,s=o,o=f);let m=(c[e*2]+t.offsetX)*t.scaleX,x=(c[e*2+1]+t.offsetY)*t.scaleY,y=(c[i*2]+t.offsetX)*t.scaleX,A=(c[i*2+1]+t.offsetY)*t.scaleY,w=(c[n*2]+t.offsetX)*t.scaleX,v=(c[n*2+1]+t.offsetY)*t.scaleY;if(x>=v)return;let C=u[s*4],D=u[s*4+1],_=u[s*4+2],k=u[o*4],R=u[o*4+1],K=u[o*4+2],W=u[l*4],V=u[l*4+1],U=u[l*4+2],tt=Math.round(x),et=Math.round(v),B,ot,L,T,I,M,E,S;for(let N=tt;N<=et;N++){if(N<A){let z=N<x?0:(x-N)/(x-A);B=m-(m-y)*z,ot=C-(C-k)*z,L=D-(D-R)*z,T=_-(_-K)*z}else{let z;N>v?z=1:A===v?z=0:z=(A-N)/(A-v),B=y-(y-w)*z,ot=k-(k-W)*z,L=R-(R-V)*z,T=K-(K-U)*z}let P;N<x?P=0:N>v?P=1:P=(x-N)/(x-v),I=m-(m-w)*P,M=C-(C-W)*P,E=D-(D-V)*P,S=_-(_-U)*P;let $=Math.round(Math.min(B,I)),G=Math.round(Math.max(B,I)),O=d*N+$*4;for(let z=$;z<=G;z++)P=(B-z)/(B-I),P<0?P=0:P>1&&(P=1),h[O++]=ot-(ot-M)*P|0,h[O++]=L-(L-E)*P|0,h[O++]=T-(T-S)*P|0,h[O++]=255}}function pM(r,t,e){let i=t.coords,n=t.colors,s,o;switch(t.type){case pl.LATTICE:let l=t.verticesPerRow,c=Math.floor(i.length/l)-1,u=l-1;for(s=0;s<c;s++){let h=s*l;for(let d=0;d<u;d++,h++)Jx(r,e,i[h],i[h+1],i[h+l],n[h],n[h+1],n[h+l]),Jx(r,e,i[h+l+1],i[h+1],i[h+l],n[h+l+1],n[h+1],n[h+l])}break;case pl.TRIANGLES:for(s=0,o=i.length;s<o;s+=3)Jx(r,e,i[s],i[s+1],i[s+2],n[s],n[s+1],n[s+2]);break;default:throw new Error("illegal figure")}}function mM(r){switch(r[0]){case"RadialAxial":return new Qb(r);case"Mesh":return new Jb(r);case"Dummy":return new t2}throw new Error(`Unknown IR type: ${r[0]}`)}function gM({src:r,srcPos:t=0,dest:e,width:i,height:n,nonBlackColor:s=4294967295,inverseDecode:o=!1}){let l=je.isLittleEndian?4278190080:255,[c,u]=o?[s,l]:[l,s],h=i>>3,d=i&7,f=c^u,m=r.length;e=new Uint32Array(e.buffer);let x=0;for(let y=0;y<n;++y){for(let w=t+h;t<w;++t,x+=8){let v=r[t];e[x]=c^-(v>>7&1)&f,e[x+1]=c^-(v>>6&1)&f,e[x+2]=c^-(v>>5&1)&f,e[x+3]=c^-(v>>4&1)&f,e[x+4]=c^-(v>>3&1)&f,e[x+5]=c^-(v>>2&1)&f,e[x+6]=c^-(v>>1&1)&f,e[x+7]=c^-(v&1)&f}if(d===0)continue;let A=t<m?r[t++]:255;for(let w=0;w<d;++w,++x)e[x]=c^-(A>>7-w&1)&f}return{srcPos:t,destPos:x}}function xM(r,t){if(r._removeMirroring)throw new Error("Context is already forwarding operations.");r.__originalSave=r.save,r.__originalRestore=r.restore,r.__originalRotate=r.rotate,r.__originalScale=r.scale,r.__originalTranslate=r.translate,r.__originalTransform=r.transform,r.__originalSetTransform=r.setTransform,r.__originalResetTransform=r.resetTransform,r.__originalClip=r.clip,r.__originalMoveTo=r.moveTo,r.__originalLineTo=r.lineTo,r.__originalBezierCurveTo=r.bezierCurveTo,r.__originalRect=r.rect,r.__originalClosePath=r.closePath,r.__originalBeginPath=r.beginPath,r._removeMirroring=()=>{r.save=r.__originalSave,r.restore=r.__originalRestore,r.rotate=r.__originalRotate,r.scale=r.__originalScale,r.translate=r.__originalTranslate,r.transform=r.__originalTransform,r.setTransform=r.__originalSetTransform,r.resetTransform=r.__originalResetTransform,r.clip=r.__originalClip,r.moveTo=r.__originalMoveTo,r.lineTo=r.__originalLineTo,r.bezierCurveTo=r.__originalBezierCurveTo,r.rect=r.__originalRect,r.closePath=r.__originalClosePath,r.beginPath=r.__originalBeginPath,delete r._removeMirroring},r.save=function(){t.save(),this.__originalSave()},r.restore=function(){t.restore(),this.__originalRestore()},r.translate=function(e,i){t.translate(e,i),this.__originalTranslate(e,i)},r.scale=function(e,i){t.scale(e,i),this.__originalScale(e,i)},r.transform=function(e,i,n,s,o,l){t.transform(e,i,n,s,o,l),this.__originalTransform(e,i,n,s,o,l)},r.setTransform=function(e,i,n,s,o,l){t.setTransform(e,i,n,s,o,l),this.__originalSetTransform(e,i,n,s,o,l)},r.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},r.rotate=function(e){t.rotate(e),this.__originalRotate(e)},r.clip=function(e){t.clip(e),this.__originalClip(e)},r.moveTo=function(e,i){t.moveTo(e,i),this.__originalMoveTo(e,i)},r.lineTo=function(e,i){t.lineTo(e,i),this.__originalLineTo(e,i)},r.bezierCurveTo=function(e,i,n,s,o,l){t.bezierCurveTo(e,i,n,s,o,l),this.__originalBezierCurveTo(e,i,n,s,o,l)},r.rect=function(e,i,n,s){t.rect(e,i,n,s),this.__originalRect(e,i,n,s)},r.closePath=function(){t.closePath(),this.__originalClosePath()},r.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}function jg(r,t,e,i,n,s,o,l,c,u){let[h,d,f,m,x,y]=Ne(r);if(d===0&&f===0){let v=o*h+x,C=Math.round(v),D=l*m+y,_=Math.round(D),k=(o+c)*h+x,R=Math.abs(Math.round(k)-C)||1,K=(l+u)*m+y,W=Math.abs(Math.round(K)-_)||1;return r.setTransform(Math.sign(h),0,0,Math.sign(m),C,_),r.drawImage(t,e,i,n,s,0,0,R,W),r.setTransform(h,d,f,m,x,y),[R,W]}if(h===0&&m===0){let v=l*f+x,C=Math.round(v),D=o*d+y,_=Math.round(D),k=(l+u)*f+x,R=Math.abs(Math.round(k)-C)||1,K=(o+c)*d+y,W=Math.abs(Math.round(K)-_)||1;return r.setTransform(0,Math.sign(d),Math.sign(f),0,C,_),r.drawImage(t,e,i,n,s,0,0,W,R),r.setTransform(h,d,f,m,x,y),[W,R]}r.drawImage(t,e,i,n,s,o,l,c,u);let A=Math.hypot(h,d),w=Math.hypot(f,m);return[A*c,w*u]}function mC(r,t){if(t instanceof ImageData){r.putImageData(t,0,0);return}let e=t.height,i=t.width,n=e%xn,s=(e-n)/xn,o=n===0?s:s+1,l=r.createImageData(i,xn),c=0,u,h=t.data,d=l.data,f,m,x,y;if(t.kind===_f.GRAYSCALE_1BPP){let A=h.byteLength,w=new Uint32Array(d.buffer,0,d.byteLength>>2),v=w.length,C=i+7>>3,D=4294967295,_=je.isLittleEndian?4278190080:255;for(f=0;f<o;f++){for(x=f<s?xn:n,u=0,m=0;m<x;m++){let k=A-c,R=0,K=k>C?i:k*8-7,W=K&-8,V=0,U=0;for(;R<W;R+=8)U=h[c++],w[u++]=U&128?D:_,w[u++]=U&64?D:_,w[u++]=U&32?D:_,w[u++]=U&16?D:_,w[u++]=U&8?D:_,w[u++]=U&4?D:_,w[u++]=U&2?D:_,w[u++]=U&1?D:_;for(;R<K;R++)V===0&&(U=h[c++],V=128),w[u++]=U&V?D:_,V>>=1}for(;u<v;)w[u++]=0;r.putImageData(l,0,f*xn)}}else if(t.kind===_f.RGBA_32BPP){for(m=0,y=i*xn*4,f=0;f<s;f++)d.set(h.subarray(c,c+y)),c+=y,r.putImageData(l,0,m),m+=xn;f<o&&(y=i*n*4,d.set(h.subarray(c,c+y)),r.putImageData(l,0,m))}else if(t.kind===_f.RGB_24BPP)for(x=xn,y=i*x,f=0;f<o;f++){for(f>=s&&(x=n,y=i*x),u=0,m=y;m--;)d[u++]=h[c++],d[u++]=h[c++],d[u++]=h[c++],d[u++]=255;r.putImageData(l,0,f*xn)}else throw new Error(`bad image kind: ${t.kind}`)}function gC(r,t){if(t.bitmap){r.drawImage(t.bitmap,0,0);return}let e=t.height,i=t.width,n=e%xn,s=(e-n)/xn,o=n===0?s:s+1,l=r.createImageData(i,xn),c=0,u=t.data,h=l.data;for(let d=0;d<o;d++){let f=d<s?xn:n;({srcPos:c}=gM({src:u,srcPos:c,dest:h,width:i,height:f,nonBlackColor:0})),r.putImageData(l,0,d*xn)}}function af(r,t){let e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let i of e)r[i]!==void 0&&(t[i]=r[i]);r.setLineDash!==void 0&&(t.setLineDash(r.getLineDash()),t.lineDashOffset=r.lineDashOffset)}function Hg(r){r.strokeStyle=r.fillStyle="#000000",r.fillRule="nonzero",r.globalAlpha=1,r.lineWidth=1,r.lineCap="butt",r.lineJoin="miter",r.miterLimit=10,r.globalCompositeOperation="source-over",r.font="10px sans-serif",r.setLineDash!==void 0&&(r.setLineDash([]),r.lineDashOffset=0);let{filter:t}=r;t!=="none"&&t!==""&&(r.filter="none")}function yC(r,t){if(t)return!0;mt.singularValueDecompose2dScale(r,Gn);let e=Math.fround(Ds.pixelRatio*_a.PDF_TO_CSS_UNITS);return Gn[0]<=e&&Gn[1]<=e}function vM(r){let t=!0,e=i("filename\\*","i").exec(r);if(e){e=e[1];let h=l(e);return h=unescape(h),h=c(h),h=u(h),s(h)}if(e=o(r),e){let h=u(e);return s(h)}if(e=i("filename","i").exec(r),e){e=e[1];let h=l(e);return h=u(h),s(h)}function i(h,d){return new RegExp("(?:^|;)\\s*"+h+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',d)}function n(h,d){if(h){if(!/^[\x00-\xFF]+$/.test(d))return d;try{let f=new TextDecoder(h,{fatal:!0}),m=Ry(d);d=f.decode(m),t=!1}catch{}}return d}function s(h){return t&&/[\x80-\xff]/.test(h)&&(h=n("utf-8",h),t&&(h=n("iso-8859-1",h))),h}function o(h){let d=[],f,m=i("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=m.exec(h))!==null;){let[,y,A,w]=f;if(y=parseInt(y,10),y in d){if(y===0)break;continue}d[y]=[A,w]}let x=[];for(let y=0;y<d.length&&y in d;++y){let[A,w]=d[y];w=l(w),A&&(w=unescape(w),y===0&&(w=c(w))),x.push(w)}return x.join("")}function l(h){if(h.startsWith('"')){let d=h.slice(1).split('\\"');for(let f=0;f<d.length;++f){let m=d[f].indexOf('"');m!==-1&&(d[f]=d[f].slice(0,m),d.length=f+1),d[f]=d[f].replaceAll(/\\(.)/g,"$1")}h=d.join('"')}return h}function c(h){let d=h.indexOf("'");if(d===-1)return h;let f=h.slice(0,d),x=h.slice(d+1).replace(/^[^']*'/,"");return n(f,x)}function u(h){return!h.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(h)?h:h.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(d,f,m,x){if(m==="q"||m==="Q")return x=x.replaceAll("_"," "),x=x.replaceAll(/=([0-9a-fA-F]{2})/g,function(y,A){return String.fromCharCode(parseInt(A,16))}),n(f,x);try{x=atob(x)}catch{}return n(f,x)})}return""}function bT(r,t){let e=new Headers;if(!r||!t||typeof t!="object")return e;for(let i in t){let n=t[i];n!==void 0&&e.append(i,n)}return e}function jy(r){return URL.parse(r)?.origin??null}function wT({responseHeaders:r,isHttp:t,rangeChunkSize:e,disableRange:i}){let n={contentLength:0,isRangeSupported:!1},s=parseInt(r.get("Content-Length"),10);return!Number.isInteger(s)||(n.contentLength=s,s<=2*e)||i||!t||r.get("Accept-Ranges")!=="bytes"||(r.get("Content-Encoding")||"identity")==="identity"&&(n.isRangeSupported=!0),n}function AT(r){let t=r.get("Content-Disposition");if(t){let e=vM(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(zy(e))return e}return null}function Hy(r,t){return new Rc(`Unexpected server response (${r}) while retrieving PDF "${t.href}".`,r,r===404||r===0&&t.protocol==="file:")}function vT(r,t){if(r!==t)throw new Error(`Expected range response-origin "${r}" to match "${t}".`)}function ET(r,t,e,i){return fetch(r,{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"})}function CT(r,t){if(r!==200&&r!==206)throw Hy(r,t)}function Gy(r){if(r instanceof Uint8Array)return r.buffer;if(r instanceof ArrayBuffer)return r;throw new Error(`getArrayBuffer - unexpected data: ${r}`)}function bC(r){return r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer}function $y(){for(let r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0}function EM(r){return typeof r!="string"?r:Ry(r).buffer}function FT(r){let{Readable:t}=rt.default.getBuiltinModule("stream");return typeof t.toWeb=="function"?t.toWeb(r):rt.default.getBuiltinModule("module").createRequire("")("node-readable-to-web-readable-stream").makeDefaultReadableStreamFromNodeReadable(r)}function CM(r){return Ff(r)?s2:Hn?g2:d2}function BT(r={}){typeof r=="string"||r instanceof URL?r={url:r}:(r instanceof ArrayBuffer||ArrayBuffer.isView(r))&&(r={data:r});let t=new S2,{docId:e}=t,i=r.url?aM(r.url):null,n=r.data?oM(r.data):null,s=r.httpHeaders||null,o=r.withCredentials===!0,l=r.password??null,c=r.range instanceof Vf?r.range:null,u=Number.isInteger(r.rangeChunkSize)&&r.rangeChunkSize>0?r.rangeChunkSize:2**16,h=r.worker instanceof vd?r.worker:null,d=r.verbosity,f=typeof r.docBaseUrl=="string"&&!$m(r.docBaseUrl)?r.docBaseUrl:null,m=Ug(r.cMapUrl),x=r.cMapPacked!==!1,y=Ug(r.iccUrl),A=Ug(r.standardFontDataUrl),w=Ug(r.wasmUrl),v=r.stopAtErrors!==!0,C=Number.isInteger(r.maxImageSize)&&r.maxImageSize>-1?r.maxImageSize:-1,D=r.isEvalSupported!==!1,_=typeof r.isOffscreenCanvasSupported=="boolean"?r.isOffscreenCanvasSupported:!Hn,k=typeof r.isImageDecoderSupported=="boolean"?r.isImageDecoderSupported:!Hn&&(je.platform.isFirefox||!globalThis.chrome),R=Number.isInteger(r.canvasMaxAreaInBytes)?r.canvasMaxAreaInBytes:-1,K=typeof r.disableFontFace=="boolean"?r.disableFontFace:Hn,W=r.fontExtraProperties===!0,V=r.enableXfa===!0,U=r.ownerDocument||globalThis.document,tt=r.disableRange===!0,et=r.disableStream===!0,B=r.disableAutoFetch===!0,ot=r.pdfBug===!0,L=r.CanvasFactory||(Hn?Yb:$b),T=r.FilterFactory||(Hn?Xb:Vb),I=r.BinaryDataFactory||(Hn?Kb:G0),M=r.enableHWA===!0,E=r.enableWebGPU===!0,S=r.useWasm!==!1,N=r.pagesMapper||new E2,P=typeof r.useSystemFonts=="boolean"?r.useSystemFonts:!Hn&&!K,$=typeof r.useWorkerFetch=="boolean"?r.useWorkerFetch:!!(I===G0&&m&&x&&A&&w&&Ff(m,document.baseURI)&&Ff(A,document.baseURI)&&Ff(w,document.baseURI)),G=null;Y_(d);let O={canvasFactory:new L({ownerDocument:U,enableHWA:M}),filterFactory:new T({docId:e,ownerDocument:U}),binaryDataFactory:$?null:new I({cMapUrl:m,standardFontDataUrl:A,wasmUrl:w})};h||(h=vd.create({verbosity:d,port:yr.workerPort}),t._worker=h);let z={docId:e,apiVersion:"5.6.205",data:n,password:l,disableAutoFetch:B,rangeChunkSize:u,docBaseUrl:f,enableXfa:V,evaluatorOptions:{maxImageSize:C,disableFontFace:K,ignoreErrors:v,isEvalSupported:D,isOffscreenCanvasSupported:_,isImageDecoderSupported:k,canvasMaxAreaInBytes:R,fontExtraProperties:W,useSystemFonts:P,useWasm:S,useWorkerFetch:$,cMapUrl:m,cMapPacked:x,iccUrl:y,standardFontDataUrl:A,wasmUrl:w,enableWebGPU:E}},it={ownerDocument:U,pdfBug:ot,styleElement:G,enableHWA:M,loadingParams:{disableAutoFetch:B,enableXfa:V}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let X=h.messageHandler.sendWithPromise("GetDocRequest",z,n?[n.buffer]:null),Q;if(!n)if(c)Q=new l2({pdfDataRangeTransport:c,disableRange:tt,disableStream:et});else if(i){let J=CM(i);Q=new J({url:i,httpHeaders:s,withCredentials:o,rangeChunkSize:u,disableRange:tt,disableStream:et})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return X.then(J=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let Y=new ml(e,J,h.port),ct=new k2(Y,t,Q,it,O,N);t._transport=ct,Y.send("Ready",null)})}).catch(t._capability.reject),t}function EC(r){return Math.floor(Math.max(0,Math.min(1,r))*255).toString(16).padStart(2,"0")}function of(r){return Math.max(0,Math.min(255,255*r))}function Vg(r){return`${(r*100).toFixed(2)}%`}var qg,Hn,ib,Wg,X_,JR,jn,Da,Lf,Pt,Wt,CC,pl,si,_f,qe,Su,Gm,md,sf,TC,Py,jc,F0,Mf,gd,Rc,rb,Hr,je,Zx,Ia,Xg,sb,mt,Qx,tC,Ou,Ly,By,P0,Bf,Uf,Gs,hl,_a,zf,yd,Wa,O0,Jf,Oc,Ds,R0,ab,L0,rC,Xa,Ya,rr,sr,tp,Ka,ju,Hu,ep,hy,FC,Oi,PC,OC,Du,cf,qs,lb,ip,gl,Xs,Fa,RC,LC,ub,cb,yl,xl,Gu,bl,he,Ui,dy,hb,$u,np,zi,Vu,Yg,Uw,db,We,Za,rp,Ie,fb,fy,UC,Lc,py,pb,qu,Cn,Wu,Le,ke,Xu,Yu,Ki,Ku,ar,di,Qa,Ja,to,eo,rs,or,wl,sp,ap,Zu,op,ss,io,Qu,no,as,my,Ys,Ju,lp,ro,Al,th,so,cp,ei,le,Ks,ao,oo,up,eh,hp,lo,os,Zs,dp,fp,lr,xt,Kg,mb,zC,jC,HC,uf,GC,$C,VC,gb,qC,WC,XC,YC,Xi,$s,KC,ZC,yb,QC,hf,xb,Bu,Go,fi,ls,Sr,ih,cs,Tn,nh,us,fn,Qs,vl,hs,co,zr,df,Zg,Yi,B0,Di,cr,El,we,pp,uo,ur,ho,fo,Cl,mp,bb,Ru,rh,Tl,gp,yp,xp,bp,wp,Js,Sl,ta,Dl,ea,$o,JC,tT,eT,zw,jf,Il,Dr,Ce,ce,ia,sh,po,Ap,Ii,kl,na,hr,mo,vp,Nl,Sn,Ep,_l,ra,ds,ah,oh,dr,Ml,Cp,gy,Mt,wb,Tp,Ab,Qg,iT,nT,vb,Jg,Eb,rT,sT,aT,Cb,oT,Tb,lT,cT,uT,Sb,ff,Bt,Ae,Db,sC,ir,is,U0,Hf,Fl,Pl,sa,ki,yy,hT,Gf,Sp,z0,Tu,aC,oC,Ib,lh,go,kb,cC,aa,re,de,Ol,Rl,Ll,ji,Dp,_b,Nb,pn,mn,Bl,Ir,ch,yo,xo,fe,Mb,pe,Be,kr,uh,hh,jw,j0,nr,Ul,zl,jl,Hl,Gl,Ip,Of,Fb,dh,Pb,me,Ob,t0,e0,Bi,vn,wi,kp,xy,fh,ph,i0,Rb,$l,mh,fs,Vl,pf,Lb,Nr,by,Xe,ue,Cr,n0,r0,mf,Ub,Bb,zb,gh,jb,Hb,lM,dT,oa,wy,Gb,zg,ti,yh,wr,fT,pT,mT,s0,ml,Ay,H0,G0,Np,$0,$b,V0,ql,xh,la,ca,Hi,Wl,Xl,St,Li,gf,Iu,a0,ku,gT,qb,Nu,yf,xf,Wb,bf,Vb,Xb,Yb,Kb,uM,_p,bh,wh,Ah,Ed,yT,xT,Zb,Bw,Fi,$f,Qb,Jb,t2,hC,vy,e2,dC,fC,yM,pC,xn,tb,Gn,Lu,q0,bM,wM,AM,xC,Gr,i2,n2,r2,Hw,zu,Mp,Fp,xd,bd,wd,s2,a2,o2,Pp,c2,l2,Op,u2,Rp,h2,eb,wC,ps,Cd,TT,ST,d2,Lp,Is,DT,IT,kT,NT,f2,Bp,Pa,_T,MT,m2,p2,g2,y2,x2,Up,zp,yr,vh,jp,b2,_u,Hp,Gp,$p,Eh,w2,bo,ge,Ch,Th,Vp,v2,A2,Ye,_r,Ni,Yl,ms,$i,wf,Af,l0,E2,Mu,AC,fr,W0,TM,vC,wo,Zi,qp,Wp,Sh,Kl,ua,Xp,Yp,Zl,Kp,Dh,Ao,Ih,Zp,kh,Ql,Qp,Jp,Nh,Jl,tm,_h,Mh,Oa,PT,OT,C2,Vn,c0,T2,RT,LT,Si,Ad,SM,Ey,Cy,S2,Fh,em,im,nm,Vf,D2,ha,tc,ec,vf,Gw,I2,vo,Mr,da,ic,Ty,nc,rc,en,u0,UT,zT,Ef,Ph,h0,Re,vd,Dn,sc,fa,Fr,ac,Oh,pa,jr,Cf,d0,k2,N2,Eo,oc,dl,_2,jT,HT,In,lc,Rh,oi,rm,Lh,ma,sm,Co,Pr,am,ye,M2,F2,P2,ll,GT,qa,dn,qf,gs,om,Bh,lm,fl,X0,Y0,O2,Bc,DM,Uc,IM,Pf,cc,Uh,pr,cm,R2,$w,Fe,L2,$n,cl,$T,VT,Wf,B2,Ma,U2,z2,j2,K0,H2,G2,um,$2,Xf,kn,To,Sy,Dy,zh,jh,Ue,ys,So,uc,Hh,Gh,xs,Nn,ga,ya,ze,xa,Do,hm,ba,$h,hc,Io,pi,ko,Ht,f0,q2,W2,X2,p0,Y2,qT,WT,XT,YT,m0,g0,K2,V2,Z0,dm,Z2,fm,Q2,pm,J2,mm,Q0,tw,ew,gm,dc,ym,iw,Yf,J0,nw,rw,sw,ty,xm,bm,ow,aw,fc,pc,Vh,No,wm,mc,_n,Am,ka,y0,lw,Vw,ey,Gg,Mn,vm,gc,Fn,ii,KT,ZT,QT,x0,Na,b0,w0,JT,uw,tS,Ee,cw,Ct,Pn,Or,qh,Wh,bs,$t,yc,xc,Em,Cm,Xh,Yh,_o,Tm,Iy,ky,ci,Tf,eS,iS,nS,rS,sS,aS,Ws,iy,Kh,bc,wa,Sm,On,Dm,Ke,Ny,oS,ny,Im,km,Nm,Mo,Rr,nn,lS,A0,cS,uS,hw,Kf,_m,Zh,dw,Zf,fw,Qh,Mm,Aa,wc,Fm,gn,Pm,Om,Ac,Rn,Ln,_i,Jh,td,Gi,ed,mr,Rm,jt,pw,v0,hS,dS,fS,mw,ul,br,Fu,pS,E0,C0,mS,gS,yS,xS,bS,ne,ry,vc,sy,Bn,id,mi,Ec,Cc,Qt,gw,yw,xw,Sf,wS,T0,Df,Pu,qt,ay,ws,gi,yi,Tc,nd,Qi,Mi,gr,Sc,Dc,Ic,rd,S0,bw,Ji,Lm,Bm,Un,As,vs,sd,ad,kc,Pi,Vs,AS,vS,ES,zc,oy,_y,CS,Uu,ww,Qf,$g,lf,Nc,ae,Aw,Lr,TS,SS,vw,D0,DS,IS,kS,Ew,Cw,NS,xr,Tw,Sw,Fo,Es,Po,_c,En,Dw,Te,xi,Oo,va,Ro,od,Ea,Mc,Cs,zn,ld,Jt,kf,Nf,I0,k0,N0,Iw,_0,_S,If,Fc,cd,Lo,Bo,Ca,yn,Uo,ud,hd,Br,Ta,bi,Sa,zo,dd,It,jo,be,kw,MS,ns,Nw,_w,M0,Tr,ly,Ur,tn,Pc,Um,My,FS,ks,Mw,PS,Fw,ai,cy,fd,zm,jm,pd,Ts,Ss,Hm,Fy,OS,Rf,uy,LS=te(()=>{H();qg={};qg.d=(r,t)=>{for(var e in t)qg.o(t,e)&&!qg.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})};qg.o=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);Hn=typeof rt.default=="object"&&rt.default+""=="[object process]"&&!rt.default.versions.nw&&!(rt.default.versions.electron&&rt.default.type&&rt.default.type!=="browser"),ib=[.001,0,0,.001,0,0],Wg=1.35,X_=.35,JR=X_/Wg,jn={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Da={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Lf="pdfjs_internal_editor_",Pt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},Wt={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},CC={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},pl={TRIANGLES:1,LATTICE:2,PATCH:3},si={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},_f={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},qe={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},Su={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Gm={ERRORS:0,WARNINGS:1,INFOS:5},md={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},sf={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},TC={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Py=Gm.WARNINGS;jc=(function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t})(),F0=class extends jc{constructor(t,e){super(t,"PasswordException"),this.code=e}},Mf=class extends jc{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},gd=class extends jc{constructor(t){super(t,"InvalidPDFException")}},Rc=class extends jc{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}},rb=class extends jc{constructor(t){super(t,"FormatError")}},Hr=class extends jc{constructor(t){super(t,"AbortException")}};je=class{static get isLittleEndian(){return Ot(this,"isLittleEndian",tM())}static get isEvalSupported(){return Ot(this,"isEvalSupported",eM())}static get isOffscreenCanvasSupported(){return Ot(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Ot(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return Ot(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return Ot(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:t,userAgent:e}=navigator;return Ot(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){return Ot(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}},Zx=Array.from(Array(256).keys(),r=>r.toString(16).padStart(2,"0")),mt=class{static makeHexColor(t,e,i){return`#${Zx[t]}${Zx[e]}${Zx[i]}`}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,i=0){let n=t[i],s=t[i+1];t[i]=n*e[0]+s*e[2]+e[4],t[i+1]=n*e[1]+s*e[3]+e[5]}static applyTransformToBezier(t,e,i=0){let n=e[0],s=e[1],o=e[2],l=e[3],c=e[4],u=e[5];for(let h=0;h<6;h+=2){let d=t[i+h],f=t[i+h+1];t[i+h]=d*n+f*o+c,t[i+h+1]=d*s+f*l+u}}static applyInverseTransform(t,e){let i=t[0],n=t[1],s=e[0]*e[3]-e[1]*e[2];t[0]=(i*e[3]-n*e[2]+e[2]*e[5]-e[4]*e[3])/s,t[1]=(-i*e[1]+n*e[0]+e[4]*e[1]-e[5]*e[0])/s}static axialAlignedBoundingBox(t,e,i){let n=e[0],s=e[1],o=e[2],l=e[3],c=e[4],u=e[5],h=t[0],d=t[1],f=t[2],m=t[3],x=n*h+c,y=x,A=n*f+c,w=A,v=l*d+u,C=v,D=l*m+u,_=D;if(s!==0||o!==0){let k=s*h,R=s*f,K=o*d,W=o*m;x+=K,w+=K,A+=W,y+=W,v+=k,_+=k,D+=R,C+=R}i[0]=Math.min(i[0],x,A,y,w),i[1]=Math.min(i[1],v,D,C,_),i[2]=Math.max(i[2],x,A,y,w),i[3]=Math.max(i[3],v,D,C,_)}static inverseTransform(t){let e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){let i=t[0],n=t[1],s=t[2],o=t[3],l=i**2+n**2,c=i*s+n*o,u=s**2+o**2,h=(l+u)/2,d=Math.sqrt(h**2-(l*u-c**2));e[0]=Math.sqrt(h+d||1),e[1]=Math.sqrt(h-d||1)}static normalizeRect(t){let e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){let i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),n=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>n)return null;let s=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),o=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return s>o?null:[i,s,n,o]}static pointBoundingBox(t,e,i){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}static rectBoundingBox(t,e,i,n,s){s[0]=Math.min(s[0],t,i),s[1]=Math.min(s[1],e,n),s[2]=Math.max(s[2],t,i),s[3]=Math.max(s[3],e,n)}static bezierBoundingBox(t,e,i,n,s,o,l,c,u){u[0]=Math.min(u[0],t,l),u[1]=Math.min(u[1],e,c),u[2]=Math.max(u[2],t,l),u[3]=Math.max(u[3],e,c),b(this,Ia,sb).call(this,t,i,s,l,e,n,o,c,3*(-t+3*(i-s)+l),6*(t-2*i+s),3*(i-t),u),b(this,Ia,sb).call(this,t,i,s,l,e,n,o,c,3*(-e+3*(n-o)+c),6*(e-2*n+o),3*(n-e),u)}};Ia=new WeakSet,Xg=function(t,e,i,n,s,o,l,c,u,h){if(u<=0||u>=1)return;let d=1-u,f=u*u,m=f*u,x=d*(d*(d*t+3*u*e)+3*f*i)+m*n,y=d*(d*(d*s+3*u*o)+3*f*l)+m*c;h[0]=Math.min(h[0],x),h[1]=Math.min(h[1],y),h[2]=Math.max(h[2],x),h[3]=Math.max(h[3],y)},sb=function(t,e,i,n,s,o,l,c,u,h,d,f){if(Math.abs(u)<1e-12){Math.abs(h)>=1e-12&&b(this,Ia,Xg).call(this,t,e,i,n,s,o,l,c,-d/h,f);return}let m=h**2-4*d*u;if(m<0)return;let x=Math.sqrt(m),y=2*u;b(this,Ia,Xg).call(this,t,e,i,n,s,o,l,c,(-h+x)/y,f),b(this,Ia,Xg).call(this,t,e,i,n,s,o,l,c,(-h-x)/y,f)},g(mt,Ia);Qx=null,tC=null;Ou="pdfjs_internal_id_";Ly=()=>[],By=()=>new Map,P0=()=>Object.create(null);typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(r){return r.reduce((t,e)=>t+e,0)});Bf=class r{static textContent(t){let e=[],i={items:e,styles:Object.create(null)};function n(s){if(!s)return;let o=null,l=s.name;if(l==="#text")o=s.value;else if(r.shouldBuildText(l))s?.attributes?.textContent?o=s.attributes.textContent:s.value&&(o=s.value);else return;if(o!==null&&e.push({str:o}),!!s.children)for(let c of s.children)n(c)}return n(t),i}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}},Uf=class{static setupStorage(t,e,i,n,s){let o=n.getValue(e,{value:null});switch(i.name){case"textarea":if(o.value!==null&&(t.textContent=o.value),s==="print")break;t.addEventListener("input",l=>{n.setValue(e,{value:l.target.value})});break;case"input":if(i.attributes.type==="radio"||i.attributes.type==="checkbox"){if(o.value===i.attributes.xfaOn?t.setAttribute("checked",!0):o.value===i.attributes.xfaOff&&t.removeAttribute("checked"),s==="print")break;t.addEventListener("change",l=>{n.setValue(e,{value:l.target.checked?l.target.getAttribute("xfaOn"):l.target.getAttribute("xfaOff")})})}else{if(o.value!==null&&t.setAttribute("value",o.value),s==="print")break;t.addEventListener("input",l=>{n.setValue(e,{value:l.target.value})})}break;case"select":if(o.value!==null){t.setAttribute("value",o.value);for(let l of i.children)l.attributes.value===o.value?l.attributes.selected=!0:l.attributes.hasOwnProperty("selected")&&delete l.attributes.selected}t.addEventListener("input",l=>{let c=l.target.options,u=c.selectedIndex===-1?"":c[c.selectedIndex].value;n.setValue(e,{value:u})});break}}static setAttributes({html:t,element:e,storage:i=null,intent:n,linkService:s}){let{attributes:o}=e,l=t instanceof HTMLAnchorElement;o.type==="radio"&&(o.name=`${o.name}-${n}`);for(let[c,u]of Object.entries(o))if(u!=null)switch(c){case"class":u.length&&t.setAttribute(c,u.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",u);break;case"style":Object.assign(t.style,u);break;case"textContent":t.textContent=u;break;default:(!l||c!=="href"&&c!=="newWindow")&&t.setAttribute(c,u)}l&&s.addLinkAttributes(t,o.href,o.newWindow),i&&o.dataId&&this.setupStorage(t,o.dataId,e,i)}static render(t){let e=t.annotationStorage,i=t.linkService,n=t.xfaHtml,s=t.intent||"display",o=document.createElement(n.name);n.attributes&&this.setAttributes({html:o,element:n,intent:s,linkService:i});let l=s!=="richText",c=t.div;if(c.append(o),t.viewport){let d=`matrix(${t.viewport.transform.join(",")})`;c.style.transform=d}l&&c.setAttribute("class","xfaLayer xfaFont");let u=[];if(n.children.length===0){if(n.value){let d=document.createTextNode(n.value);o.append(d),l&&Bf.shouldBuildText(n.name)&&u.push(d)}return{textDivs:u}}let h=[[n,-1,o]];for(;h.length>0;){let[d,f,m]=h.at(-1);if(f+1===d.children.length){h.pop();continue}let x=d.children[++h.at(-1)[1]];if(x===null)continue;let{name:y}=x;if(y==="#text"){let w=document.createTextNode(x.value);u.push(w),m.append(w);continue}let A=x?.attributes?.xmlns?document.createElementNS(x.attributes.xmlns,y):document.createElement(y);if(m.append(A),x.attributes&&this.setAttributes({html:A,element:x,storage:e,intent:s,linkService:i}),x.children?.length>0)h.push([x,-1,A]);else if(x.value){let w=document.createTextNode(x.value);l&&Bf.shouldBuildText(y)&&u.push(w),A.append(w)}}for(let d of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))d.setAttribute("readOnly",!0);return{textDivs:u}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}},Gs="http://www.w3.org/2000/svg",hl=class hl{};j(hl,"CSS",96),j(hl,"PDF",72),j(hl,"PDF_TO_CSS_UNITS",hl.CSS/hl.PDF);_a=hl;zf=class r{constructor({viewBox:t,userUnit:e,scale:i,rotation:n,offsetX:s=0,offsetY:o=0,dontFlip:l=!1}){this.viewBox=t,this.userUnit=e,this.scale=i,this.rotation=n,this.offsetX=s,this.offsetY=o,i*=e;let c=(t[2]+t[0])/2,u=(t[3]+t[1])/2,h,d,f,m;switch(n%=360,n<0&&(n+=360),n){case 180:h=-1,d=0,f=0,m=1;break;case 90:h=0,d=1,f=1,m=0;break;case 270:h=0,d=-1,f=-1,m=0;break;case 0:h=1,d=0,f=0,m=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}l&&(f=-f,m=-m);let x,y,A,w;h===0?(x=Math.abs(u-t[1])*i+s,y=Math.abs(c-t[0])*i+o,A=(t[3]-t[1])*i,w=(t[2]-t[0])*i):(x=Math.abs(c-t[0])*i+s,y=Math.abs(u-t[1])*i+o,A=(t[2]-t[0])*i,w=(t[3]-t[1])*i),this.transform=[h*i,d*i,f*i,m*i,x-h*i*c-f*i*u,y-d*i*c-m*i*u],this.width=A,this.height=w}get rawDims(){let t=this.viewBox;return Ot(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new r({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:s})}convertToViewportPoint(t,e){let i=[t,e];return mt.applyTransform(i,this.transform),i}convertToViewportRectangle(t){let e=[t[0],t[1]];mt.applyTransform(e,this.transform);let i=[t[2],t[3]];return mt.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){let i=[t,e];return mt.applyInverseTransform(i,this.transform),i}},yd=class extends jc{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};O0=class{constructor(){g(this,Wa,new Map);j(this,"times",[])}time(t){a(this,Wa).has(t)&&Ut(`Timer is already running for ${t}`),a(this,Wa).set(t,Date.now())}timeEnd(t){a(this,Wa).has(t)||Ut(`Timer has not been started for ${t}`),this.times.push({name:t,start:a(this,Wa).get(t),end:Date.now()}),a(this,Wa).delete(t)}toString(){let t=Math.max(...this.times.map(e=>e.name.length));return this.times.map(e=>`${e.name.padEnd(t)} ${e.end-e.start}ms
15
+ `).join("")}};Wa=new WeakMap;Oc=class{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;a(this,Jf)||p(this,Jf,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));let e=a(this,Jf).exec(t);if(!e)return null;let i=parseInt(e[1],10),n=parseInt(e[2],10);n=n>=1&&n<=12?n-1:0;let s=parseInt(e[3],10);s=s>=1&&s<=31?s:1;let o=parseInt(e[4],10);o=o>=0&&o<=23?o:0;let l=parseInt(e[5],10);l=l>=0&&l<=59?l:0;let c=parseInt(e[6],10);c=c>=0&&c<=59?c:0;let u=e[7]||"Z",h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,u==="-"?(o+=h,l+=d):u==="+"&&(o-=h,l-=d),new Date(Date.UTC(i,n,s,o,l,c))}};Jf=new WeakMap,g(Oc,Jf);Ds=class r{constructor(){let{pixelRatio:t}=r;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,i,n,s=-1){let o=1/0,l=1/0,c=1/0;i=r.capPixels(i,s),i>0&&(o=Math.sqrt(i/(t*e))),n!==-1&&(l=n/t,c=n/e);let u=Math.min(o,l,c);return this.sx>u||this.sy>u?(this.sx=u,this.sy=u,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>=0){let i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,i):i}return t}},R0=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],ab=class{static get isDarkMode(){return Ot(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}},L0=class{static get commentForegroundColor(){let t=document.createElement("span");t.classList.add("comment","sidebar");let{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);let{color:i}=window.getComputedStyle(t);return t.remove(),Ot(this,"commentForegroundColor",Td(i))}};rC=new Map;qs=class qs{constructor(t){g(this,Oi);g(this,Xa,null);g(this,Ya,null);g(this,rr);g(this,sr,null);g(this,tp,null);g(this,Ka,null);g(this,ju,null);g(this,Hu,null);p(this,rr,t),a(qs,ep)||p(qs,ep,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"}))}render(){let t=p(this,Xa,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=a(this,rr)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",qn,{signal:e}),t.addEventListener("pointerdown",b(qs,hy,FC),{signal:e}));let i=p(this,sr,document.createElement("div"));i.className="buttons",t.append(i);let n=a(this,rr).toolbarPosition;if(n){let{style:s}=t,o=a(this,rr)._uiManager.direction==="ltr"?1-n[0]:n[0];s.insetInlineEnd=`${100*o}%`,s.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return a(this,Xa)}hide(){a(this,Xa).classList.add("hidden"),a(this,Ya)?.hideDropdown()}show(){a(this,Xa).classList.remove("hidden"),a(this,tp)?.shown(),a(this,Ka)?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=a(this,rr),i=document.createElement("button");i.classList.add("basic","deleteButton"),i.tabIndex=0,i.setAttribute("data-l10n-id",a(qs,ep)[t]),b(this,Oi,Du).call(this,i)&&i.addEventListener("click",n=>{e.delete()},{signal:e._signal}),a(this,sr).append(i)}async addAltText(t){let e=await t.render();b(this,Oi,Du).call(this,e),a(this,sr).append(e,a(this,Oi,cf)),p(this,tp,t)}addComment(t,e=null){if(a(this,Ka))return;let i=t.renderForToolbar();if(!i)return;b(this,Oi,Du).call(this,i);let n=p(this,ju,a(this,Oi,cf));e?(a(this,sr).insertBefore(i,e),a(this,sr).insertBefore(n,e)):a(this,sr).append(i,n),p(this,Ka,t),t.toolbar=this}addColorPicker(t){if(a(this,Ya))return;p(this,Ya,t);let e=t.renderButton();b(this,Oi,Du).call(this,e),a(this,sr).append(e,a(this,Oi,cf))}async addEditSignatureButton(t){let e=p(this,Hu,await t.renderEditButton(a(this,rr)));b(this,Oi,Du).call(this,e),a(this,sr).append(e,a(this,Oi,cf))}removeButton(t){t==="comment"&&(a(this,Ka)?.removeToolbarCommentButton(),p(this,Ka,null),a(this,ju)?.remove(),p(this,ju,null))}async addButton(t,e){switch(t){case"colorPicker":e&&this.addColorPicker(e);break;case"altText":e&&await this.addAltText(e);break;case"editSignature":e&&await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":e&&this.addComment(e);break}}async addButtonBefore(t,e,i){if(!e&&t==="comment")return;let n=a(this,sr).querySelector(i);n&&t==="comment"&&this.addComment(e,n)}updateEditSignatureButton(t){a(this,Hu)&&(a(this,Hu).title=t)}remove(){a(this,Xa).remove(),a(this,Ya)?.destroy(),p(this,Ya,null)}};Xa=new WeakMap,Ya=new WeakMap,rr=new WeakMap,sr=new WeakMap,tp=new WeakMap,Ka=new WeakMap,ju=new WeakMap,Hu=new WeakMap,ep=new WeakMap,hy=new WeakSet,FC=function(t){t.stopPropagation()},Oi=new WeakSet,PC=function(t){a(this,rr)._focusEventsAllowed=!1,_e(t)},OC=function(t){a(this,rr)._focusEventsAllowed=!0,_e(t)},Du=function(t){let e=a(this,rr)._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",b(this,Oi,PC).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",b(this,Oi,OC).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",qn,{signal:e}),!0)},cf=function(){let t=document.createElement("div");return t.className="divider",t},g(qs,hy),g(qs,ep,null);lb=qs,cb=class{constructor(t){g(this,Fa);g(this,ip,null);g(this,gl,null);g(this,Xs);p(this,Xs,t)}show(t,e,i){let[n,s]=b(this,Fa,LC).call(this,e,i),{style:o}=a(this,gl)||p(this,gl,b(this,Fa,RC).call(this));t.append(a(this,gl)),o.insetInlineEnd=`${100*n}%`,o.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){a(this,gl).remove()}};ip=new WeakMap,gl=new WeakMap,Xs=new WeakMap,Fa=new WeakSet,RC=function(){let t=p(this,gl,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");let e=a(this,Xs)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",qn,{signal:e});let i=p(this,ip,document.createElement("div"));return i.className="buttons",t.append(i),a(this,Xs).hasCommentManager()&&b(this,Fa,ub).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{a(this,Xs).commentSelection("floating_button")}),b(this,Fa,ub).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{a(this,Xs).highlightSelection("floating_button")}),t},LC=function(t,e){let i=0,n=0;for(let s of t){let o=s.y+s.height;if(o<i)continue;let l=s.x+(e?s.width:0);if(o>i){n=l,i=o;continue}e?l>n&&(n=l):l<n&&(n=l)}return[e?1-n:n,i]},ub=function(t,e,i,n){let s=document.createElement("button");s.classList.add("basic",t),s.tabIndex=0,s.setAttribute("data-l10n-id",e);let o=document.createElement("span");s.append(o),o.className="visuallyHidden",o.setAttribute("data-l10n-id",i);let l=a(this,Xs)._signal;l instanceof AbortSignal&&!l.aborted&&(s.addEventListener("contextmenu",qn,{signal:l}),s.addEventListener("click",n,{signal:l})),a(this,ip).append(s)};he=class he{static initializeAndAddPointerId(t){(a(he,xl)||p(he,xl,new Set)).add(t)}static setPointer(t,e){a(he,yl)||p(he,yl,e),a(he,bl)??p(he,bl,t)}static setTimeStamp(t){p(he,Gu,t)}static isSamePointerId(t){return a(he,yl)===t}static isSamePointerIdOrRemove(t){return a(he,yl)===t?!0:(a(he,xl)?.delete(t),!1)}static isSamePointerType(t){return a(he,bl)===t}static isInitializedAndDifferentPointerType(t){return a(he,bl)!==null&&!he.isSamePointerType(t)}static isSameTimeStamp(t){return a(he,Gu)===t}static isUsingMultiplePointers(){return a(he,xl)?.size>=1}static clearPointerType(){p(he,bl,null)}static clearPointerIds(){p(he,yl,NaN),p(he,xl,null)}static clearTimeStamp(){p(he,Gu,NaN)}};yl=new WeakMap,xl=new WeakMap,Gu=new WeakMap,bl=new WeakMap,g(he,yl,NaN),g(he,xl,null),g(he,Gu,NaN),g(he,bl,null);Ui=he,hb=class{constructor(){g(this,dy,0)}get id(){return`${Lf}${Ze(this,dy)._++}`}};dy=new WeakMap;Uw=class Uw{constructor(){g(this,Vu);g(this,$u,Rw());g(this,np,0);g(this,zi,null)}static get _isSVGFittingCanvas(){let t='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',i=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),n=new Image;n.src=t;let s=n.decode().then(()=>(i.drawImage(n,0,0,1,1,0,0,1,3),new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0]===0));return Ot(this,"_isSVGFittingCanvas",s)}async getFromFile(t){let{lastModified:e,name:i,size:n,type:s}=t;return b(this,Vu,Yg).call(this,`${e}_${i}_${n}_${s}`,t)}async getFromUrl(t){return b(this,Vu,Yg).call(this,t,t)}async getFromBlob(t,e){let i=await e;return b(this,Vu,Yg).call(this,t,i)}async getFromId(t){a(this,zi)||p(this,zi,new Map);let e=a(this,zi).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){let{blobPromise:i}=e;return delete e.blobPromise,this.getFromBlob(e.id,i)}return this.getFromUrl(e.url)}getFromCanvas(t,e){a(this,zi)||p(this,zi,new Map);let i=a(this,zi).get(t);if(i?.bitmap)return i.refCounter+=1,i;let n=new OffscreenCanvas(e.width,e.height);return n.getContext("2d").drawImage(e,0,0),i={bitmap:n.transferToImageBitmap(),id:`image_${a(this,$u)}_${Ze(this,np)._++}`,refCounter:1,isSvg:!1},a(this,zi).set(t,i),a(this,zi).set(i.id,i),i}getSvgUrl(t){let e=a(this,zi).get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){a(this,zi)||p(this,zi,new Map);let e=a(this,zi).get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;let{bitmap:i}=e;if(!e.url&&!e.file){let n=new OffscreenCanvas(i.width,i.height);n.getContext("bitmaprenderer").transferFromImageBitmap(i),e.blobPromise=n.convertToBlob()}i.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${a(this,$u)}_`)}};$u=new WeakMap,np=new WeakMap,zi=new WeakMap,Vu=new WeakSet,Yg=async function(t,e){a(this,zi)||p(this,zi,new Map);let i=a(this,zi).get(t);if(i===null)return null;if(i?.bitmap)return i.refCounter+=1,i;try{i||(i={bitmap:null,id:`image_${a(this,$u)}_${Ze(this,np)._++}`,refCounter:0,isSvg:!1});let n;if(typeof e=="string"?(i.url=e,n=await Uy(e,"blob")):e instanceof File?n=i.file=e:e instanceof Blob&&(n=e),n.type==="image/svg+xml"){let s=Uw._isSVGFittingCanvas,o=new FileReader,l=new Image,c=new Promise((u,h)=>{l.onload=()=>{i.bitmap=l,i.isSvg=!0,u()},o.onload=async()=>{let d=i.svgUrl=o.result;l.src=await s?`${d}#svgView(preserveAspectRatio(none))`:d},l.onerror=o.onerror=h});o.readAsDataURL(n),await c}else i.bitmap=await createImageBitmap(n);i.refCounter=1}catch(n){Ut(n),i=null}return a(this,zi).set(t,i),i&&a(this,zi).set(i.id,i),i};db=Uw,fb=class{constructor(t=128){g(this,We,[]);g(this,Za,!1);g(this,rp);g(this,Ie,-1);p(this,rp,t)}add({cmd:t,undo:e,post:i,mustExec:n,type:s=NaN,overwriteIfSameType:o=!1,keepUndo:l=!1}){if(n&&t(),a(this,Za))return;let c={cmd:t,undo:e,post:i,type:s};if(a(this,Ie)===-1){a(this,We).length>0&&(a(this,We).length=0),p(this,Ie,0),a(this,We).push(c);return}if(o&&a(this,We)[a(this,Ie)].type===s){l&&(c.undo=a(this,We)[a(this,Ie)].undo),a(this,We)[a(this,Ie)]=c;return}let u=a(this,Ie)+1;u===a(this,rp)?a(this,We).splice(0,1):(p(this,Ie,u),u<a(this,We).length&&a(this,We).splice(u)),a(this,We).push(c)}undo(){if(a(this,Ie)===-1)return;p(this,Za,!0);let{undo:t,post:e}=a(this,We)[a(this,Ie)];t(),e?.(),p(this,Za,!1),p(this,Ie,a(this,Ie)-1)}redo(){if(a(this,Ie)<a(this,We).length-1){p(this,Ie,a(this,Ie)+1),p(this,Za,!0);let{cmd:t,post:e}=a(this,We)[a(this,Ie)];t(),e?.(),p(this,Za,!1)}}hasSomethingToUndo(){return a(this,Ie)!==-1}hasSomethingToRedo(){return a(this,Ie)<a(this,We).length-1}cleanType(t){if(a(this,Ie)!==-1){for(let e=a(this,Ie);e>=0;e--)if(a(this,We)[e].type!==t){a(this,We).splice(e+1,a(this,Ie)-e),p(this,Ie,e);return}a(this,We).length=0,p(this,Ie,-1)}}destroy(){p(this,We,null)}};We=new WeakMap,Za=new WeakMap,rp=new WeakMap,Ie=new WeakMap;Lc=class{constructor(t){g(this,fy);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=je.platform;for(let[i,n,s={}]of t)for(let o of i){let l=o.startsWith("mac+");e&&l?(this.callbacks.set(o.slice(4),{callback:n,options:s}),this.allKeys.add(o.split("+").at(-1))):!e&&!l&&(this.callbacks.set(o,{callback:n,options:s}),this.allKeys.add(o.split("+").at(-1)))}}exec(t,e){if(!this.allKeys.has(e.key))return;let i=this.callbacks.get(b(this,fy,UC).call(this,e));if(!i)return;let{callback:n,options:{bubbles:s=!1,args:o=[],checker:l=null}}=i;l&&!l(t,e)||(n.bind(t,...o,e)(),s||_e(e))}};fy=new WeakSet,UC=function(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);let e=this.buffer.join("+");return this.buffer.length=0,e};py=class py{get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return sM(t),Ot(this,"_colors",t)}convert(t){let e=Td(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[i,n]of this._colors)if(n.every((s,o)=>s===e[o]))return py._colorsMapping.get(i);return e}getHexCode(t){let e=this._colors.get(t);return e?mt.makeHexColor(...e):t}};j(py,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));pb=py,Bu=class Bu{constructor(t,e,i,n,s,o,l,c,u,h,d,f,m,x,y,A){g(this,xt);g(this,qu,new AbortController);g(this,Cn,null);g(this,Wu,null);g(this,Le,new Map);g(this,ke,new Map);g(this,Xu,null);g(this,Yu,null);g(this,Ki,null);g(this,Ku,null);g(this,ar,new fb);g(this,di,null);g(this,Qa,null);g(this,Ja,null);g(this,to,0);g(this,eo,new Set);g(this,rs,null);g(this,or,null);g(this,wl,new Set);j(this,"_editorUndoBar",null);g(this,sp,!1);g(this,ap,!1);g(this,Zu,!1);g(this,op,null);g(this,ss,null);g(this,io,null);g(this,Qu,null);g(this,no,!1);g(this,as,null);g(this,my,new hb);g(this,Ys,!1);g(this,Ju,!1);g(this,lp,!1);g(this,ro,null);g(this,Al,null);g(this,th,null);g(this,so,null);g(this,cp,null);g(this,ei,Pt.NONE);g(this,le,new Set);g(this,Ks,null);g(this,ao,null);g(this,oo,null);g(this,up,null);g(this,eh,null);g(this,hp,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});g(this,lo,[0,0]);g(this,os,null);g(this,Zs,null);g(this,dp,null);g(this,fp,null);g(this,lr,null);let w=this._signal=a(this,qu).signal;p(this,Zs,t),p(this,dp,e),p(this,fp,i),p(this,Yu,n),p(this,di,s),p(this,ao,o),p(this,eh,c),this._eventBus=l,l._on("editingaction",this.onEditingAction.bind(this),{signal:w}),l._on("pagechanging",this.onPageChanging.bind(this),{signal:w}),l._on("scalechanging",this.onScaleChanging.bind(this),{signal:w}),l._on("rotationchanging",this.onRotationChanging.bind(this),{signal:w}),l._on("setpreference",this.onSetPreference.bind(this),{signal:w}),l._on("switchannotationeditorparams",v=>this.updateParams(v.type,v.value),{signal:w}),window.addEventListener("pointerdown",()=>{p(this,Ju,!0)},{capture:!0,signal:w}),window.addEventListener("pointerup",()=>{p(this,Ju,!1)},{capture:!0,signal:w}),window.addEventListener("beforeunload",b(this,xt,zC).bind(this),{capture:!0,signal:w}),b(this,xt,GC).call(this),b(this,xt,YC).call(this),b(this,xt,gb).call(this),p(this,Ki,c.annotationStorage),p(this,op,c.filterFactory),p(this,oo,u),p(this,Qu,h||null),p(this,sp,d),p(this,ap,f),p(this,Zu,m),p(this,cp,x||null),this.viewParameters={realScale:_a.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=y||null,this._supportsPinchToZoom=A!==!1,s?.setSidebarUiManager(this)}static get _keyboardManager(){let t=Bu.prototype,e=o=>a(o,Zs).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&o.hasSomethingToControl(),i=(o,{target:l})=>{if(l instanceof HTMLInputElement){let{type:c}=l;return c!=="text"&&c!=="number"}return!0},n=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return Ot(this,"_keyboardManager",new Lc([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&a(o,Zs).contains(l)&&!o.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&a(o,Zs).contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}]]))}destroy(){a(this,lr)?.resolve(),p(this,lr,null),a(this,qu)?.abort(),p(this,qu,null),this._signal=null;for(let t of a(this,ke).values())t.destroy();a(this,ke).clear(),a(this,Le).clear(),a(this,wl).clear(),a(this,so)?.clear(),p(this,Cn,null),a(this,le).clear(),a(this,ar).destroy(),a(this,Yu)?.destroy(),a(this,di)?.destroy(),a(this,ao)?.destroy(),a(this,as)?.hide(),p(this,as,null),a(this,th)?.destroy(),p(this,th,null),p(this,Wu,null),a(this,ss)&&(clearTimeout(a(this,ss)),p(this,ss,null)),a(this,os)&&(clearTimeout(a(this,os)),p(this,os,null)),this._editorUndoBar?.destroy(),p(this,eh,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return a(this,cp)}get useNewAltTextFlow(){return a(this,ap)}get useNewAltTextWhenAddingImage(){return a(this,Zu)}get hcmFilter(){return Ot(this,"hcmFilter",a(this,oo)?a(this,op).addHCMFilter(a(this,oo).foreground,a(this,oo).background):"none")}get direction(){return Ot(this,"direction",getComputedStyle(a(this,Zs)).direction)}get _highlightColors(){return Ot(this,"_highlightColors",a(this,Qu)?new Map(a(this,Qu).split(",").map(t=>(t=t.split("=").map(e=>e.trim()),t[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){let{_highlightColors:t}=this;if(!t)return Ot(this,"highlightColors",null);let e=new Map,i=!!a(this,oo);for(let[n,s]of t){let o=n.endsWith("_HCM");if(i&&o){e.set(n.replace("_HCM",""),s);continue}!i&&!o&&e.set(n,s)}return Ot(this,"highlightColors",e)}get highlightColorNames(){return Ot(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;let e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),p(this,Ja,t)}setMainHighlightColorPicker(t){p(this,th,t)}editAltText(t,e=!1){a(this,Yu)?.editAltText(this,t,e)}hasCommentManager(){return!!a(this,di)}editComment(t,e,i,n){a(this,di)?.showDialog(this,t,e,i,n)}selectComment(t,e){a(this,ke).get(t)?.getEditorByUID(e)?.toggleComment(!0,!0)}updateComment(t){a(this,di)?.updateComment(t.getData())}updatePopupColor(t){a(this,di)?.updatePopupColor(t)}removeComment(t){a(this,di)?.removeComments([t.uid])}deleteComment(t,e){let i=()=>{t.comment=e},n=()=>{this._editorUndoBar?.show(i,"comment"),this.toggleComment(null),t.comment=null};this.addCommands({cmd:n,undo:i,mustExec:!0})}toggleComment(t,e,i=void 0){a(this,di)?.toggleCommentPopup(t,e,i)}makeCommentColor(t,e){return t&&a(this,di)?.makeCommentColor(t,e)||null}getCommentDialogElement(){return a(this,di)?.dialogElement||null}async waitForEditorsRendered(t){if(a(this,ke).has(t-1))return;let{resolve:e,promise:i}=Promise.withResolvers(),n=s=>{s.pageNumber===t&&(this._eventBus._off("editorsrendered",n),e())};this._eventBus.on("editorsrendered",n),await i}getSignature(t){a(this,ao)?.getSignature({uiManager:this,editor:t})}get signatureManager(){return a(this,ao)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){t==="enableNewAltTextWhenAddingImage"&&p(this,Zu,e)}onPageChanging({pageNumber:t}){p(this,to,t-1)}deletePage(t){for(let e of this.getEditors(t))e.remove();a(this,ke).delete(t),a(this,to)===t&&p(this,to,0)}focusMainContainer(){a(this,Zs).focus()}findParent(t,e){for(let i of a(this,ke).values()){let{x:n,y:s,width:o,height:l}=i.div.getBoundingClientRect();if(t>=n&&t<=n+o&&e>=s&&e<=s+l)return i}return null}disableUserSelect(t=!1){a(this,dp).classList.toggle("noUserSelect",t)}addShouldRescale(t){a(this,wl).add(t)}removeShouldRescale(t){a(this,wl).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*_a.PDF_TO_CSS_UNITS;for(let e of a(this,wl))e.onScaleChanging();a(this,Ja)?.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}highlightSelection(t="",e=!1){let i=document.getSelection();if(!i||i.isCollapsed)return;let{anchorNode:n,anchorOffset:s,focusNode:o,focusOffset:l}=i,c=i.toString(),h=b(this,xt,Kg).call(this,i).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;i.empty();let f=b(this,xt,mb).call(this,h),m=a(this,ei)===Pt.NONE,x=()=>{let y=f?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:n,anchorOffset:s,focusNode:o,focusOffset:l,text:c});m&&this.showAllEditors("highlight",!0,!0),e&&y?.editComment()};if(m){this.switchToMode(Pt.HIGHLIGHT,x);return}x()}commentSelection(t=""){this.highlightSelection(t,!0)}getAndRemoveDataFromAnnotationStorage(t){if(!a(this,Ki))return null;let e=`${Lf}${t}`,i=a(this,Ki).getRawValue(e);return i&&a(this,Ki).remove(e),i}addToAnnotationStorage(t){!t.isEmpty()&&a(this,Ki)&&!a(this,Ki).has(t.id)&&a(this,Ki).setValue(t.id,t)}a11yAlert(t,e=null){let i=a(this,fp);i&&(i.setAttribute("data-l10n-id",t),e?i.setAttribute("data-l10n-args",JSON.stringify(e)):i.removeAttribute("data-l10n-args"))}blur(){if(this.isShiftKeyDown=!1,a(this,no)&&(p(this,no,!1),b(this,xt,uf).call(this,"main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of a(this,le))if(e.div.contains(t)){p(this,Al,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!a(this,Al))return;let[t,e]=a(this,Al);p(this,Al,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){b(this,xt,gb).call(this),this.setEditingState(!0)}removeEditListeners(){b(this,xt,qC).call(this),this.setEditingState(!1)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let i of a(this,or))if(i.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(let e of t.dataTransfer.items)for(let i of a(this,or))if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),a(this,Cn)?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let i of a(this,le)){let n=i.serialize(!0);n&&e.push(n)}e.length!==0&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();let{clipboardData:e}=t;for(let s of e.items)for(let o of a(this,or))if(o.isHandlingMimeForPasting(s.type)){o.paste(s,this.currentLayer);return}let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(s){Ut(`paste: "${s.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();let n=this.currentLayer;try{let s=[];for(let c of i){let u=await n.deserialize(c);if(!u)return;s.push(u)}let o=()=>{for(let c of s)b(this,xt,yb).call(this,c);b(this,xt,xb).call(this,s)},l=()=>{for(let c of s)c.remove()};this.addCommands({cmd:o,undo:l,mustExec:!0})}catch(s){Ut(`paste: "${s.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),a(this,ei)!==Pt.NONE&&!this.isEditorHandlingKeyboard&&Bu._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,a(this,no)&&(p(this,no,!1),b(this,xt,uf).call(this,"main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu");break}}updatePageIndex(t,e){for(let n of this.getEditors(t))n.pageIndex=e;let i=a(this,Xu).get(t);i&&(i.pageIndex=e,a(this,ke).set(e,i),a(this,Ys)?i.enable():i.disable())}startUpdatePages(){p(this,Xu,new Map(a(this,ke))),a(this,ke).clear()}endUpdatePages(){p(this,Xu,null)}clonePage(t,e){for(let i of this.getEditors(t)){let n=i.serialize(i.mode!==Pt.HIGHLIGHT);n&&(n.pageIndex=e,n.id=this.getId(),n.isClone=!0,delete n.popupRef,a(this,Ki).setValue(n.id,n))}}findClonesForPage(t){let e=[],{pageIndex:i}=t;for(let[n,s]of a(this,Ki))s.pageIndex===i&&s.isClone&&(a(this,Ki).remove(n),e.push(t.deserialize(s).then(o=>{o&&(o.isClone=!0,t.addOrRebuild(o))})));return Promise.all(e)}setEditingState(t){t?(b(this,xt,$C).call(this),b(this,xt,WC).call(this),b(this,xt,Xi).call(this,{isEditing:a(this,ei)!==Pt.NONE,isEmpty:b(this,xt,hf).call(this),hasSomethingToUndo:a(this,ar).hasSomethingToUndo(),hasSomethingToRedo:a(this,ar).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,xt,VC).call(this),b(this,xt,XC).call(this),b(this,xt,Xi).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!a(this,or)){p(this,or,t);for(let e of a(this,or))b(this,xt,$s).call(this,e.defaultPropertiesToUpdate)}}getId(){return a(this,my).id}get currentLayer(){return a(this,ke).get(a(this,to))}getLayer(t){return a(this,ke).get(t)}get currentPageIndex(){return a(this,to)}addLayer(t){a(this,ke).set(t.pageIndex,t),a(this,Ys)?t.enable():t.disable()}removeLayer(t){a(this,ke).delete(t.pageIndex)}async updateMode(t,e=null,i=!1,n=!1,s=!1,o=!1){if(a(this,ei)!==t&&!(a(this,lr)&&(await a(this,lr).promise,!a(this,lr)))){if(p(this,lr,Promise.withResolvers()),a(this,Ja)?.commitOrRemove(),a(this,ei)===Pt.POPUP&&a(this,di)?.hideSidebar(),a(this,di)?.destroyPopup(),p(this,ei,t),t===Pt.NONE){this.setEditingState(!1),b(this,xt,ZC).call(this);for(let l of a(this,Le).values())l.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),a(this,lr).resolve();return}for(let l of a(this,Le).values())l.addStandaloneCommentButton();t===Pt.SIGNATURE&&await a(this,ao)?.loadSignatures(),i&&Ui.clearPointerType(),this.setEditingState(!0),await b(this,xt,KC).call(this),this.unselectAll();for(let l of a(this,ke).values())l.updateMode(t);if(t===Pt.POPUP){a(this,Wu)||p(this,Wu,await a(this,eh).getAnnotationsByType(new Set(a(this,or).map(u=>u._editorType))));let l=new Set,c=[];for(let u of a(this,Le).values()){let{annotationElementId:h,hasComment:d,deleted:f}=u;h&&l.add(h),d&&!f&&c.push(u.getData())}for(let u of a(this,Wu)){let{id:h,popupRef:d,contentsObj:f}=u;d&&f?.str&&!l.has(h)&&!a(this,eo).has(h)&&c.push(u)}a(this,di)?.showSidebar(c)}if(!e){n&&this.addNewEditorFromKeyboard(),a(this,lr).resolve();return}for(let l of a(this,Le).values())l.uid===e?(this.setSelected(l),o?l.editComment():s?l.enterInEditMode():l.focus()):l.unselect();a(this,lr).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==a(this,ei)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(a(this,or)){switch(t){case Wt.CREATE:this.currentLayer.addNewEditor(e);return;case Wt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(a(this,up)||p(this,up,new Map)).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(let i of a(this,le))i.updateParams(t,e);else for(let i of a(this,or))i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){for(let s of a(this,Le).values())s.editorType===t&&s.show(e);(a(this,up)?.get(Wt.HIGHLIGHT_SHOW_ALL)??!0)!==e&&b(this,xt,$s).call(this,[[Wt.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(a(this,lp)!==t){p(this,lp,t);for(let e of a(this,ke).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(let e of a(this,Le).values())e.pageIndex===t&&(yield e)}getEditor(t){return a(this,Le).get(t)}addEditor(t){a(this,Le).set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(a(this,ss)&&clearTimeout(a(this,ss)),p(this,ss,setTimeout(()=>{this.focusMainContainer(),p(this,ss,null)},0))),a(this,Le).delete(t.id),t.annotationElementId&&a(this,so)?.delete(t.annotationElementId),this.unselect(t),(!t.annotationElementId||!a(this,eo).has(t.annotationElementId))&&a(this,Ki)?.remove(t.id)}addDeletedAnnotationElement(t){a(this,eo).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return a(this,eo).has(t)}removeDeletedAnnotationElement(t){a(this,eo).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){a(this,Cn)!==t&&(p(this,Cn,t),t&&b(this,xt,$s).call(this,t.propertiesToUpdate))}updateUI(t){a(this,xt,QC)===t&&b(this,xt,$s).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){b(this,xt,$s).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(a(this,le).has(t)){a(this,le).delete(t),t.unselect(),b(this,xt,Xi).call(this,{hasSelectedEditor:this.hasSelection});return}a(this,le).add(t),t.select(),b(this,xt,$s).call(this,t.propertiesToUpdate),b(this,xt,Xi).call(this,{hasSelectedEditor:!0})}setSelected(t){this.updateToolbar({mode:t.mode,editId:t.uid}),a(this,Ja)?.commitOrRemove();for(let e of a(this,le))e!==t&&e.unselect();a(this,di)?.destroyPopup(),a(this,le).clear(),a(this,le).add(t),t.select(),b(this,xt,$s).call(this,t.propertiesToUpdate),b(this,xt,Xi).call(this,{hasSelectedEditor:!0})}isSelected(t){return a(this,le).has(t)}get firstSelectedEditor(){return a(this,le).values().next().value}unselect(t){t.unselect(),a(this,le).delete(t),b(this,xt,Xi).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return a(this,le).size!==0}get isEnterHandled(){return a(this,le).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){a(this,ar).undo(),b(this,xt,Xi).call(this,{hasSomethingToUndo:a(this,ar).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,xt,hf).call(this)}),this._editorUndoBar?.hide()}redo(){a(this,ar).redo(),b(this,xt,Xi).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:a(this,ar).hasSomethingToRedo(),isEmpty:b(this,xt,hf).call(this)})}addCommands(t){a(this,ar).add(t),b(this,xt,Xi).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,xt,hf).call(this)})}cleanUndoStack(t){a(this,ar).cleanType(t)}delete(){this.commitOrRemove();let t=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let e=t?[t]:[...a(this,le)],i=()=>{this._editorUndoBar?.show(n,e.length===1?e[0].editorType:e.length);for(let s of e)s.remove()},n=()=>{for(let s of e)b(this,xt,yb).call(this,s)};this.addCommands({cmd:i,undo:n,mustExec:!0})}commitOrRemove(){a(this,Cn)?.commitOrRemove()}hasSomethingToControl(){return a(this,Cn)||this.hasSelection}selectAll(){for(let t of a(this,le))t.commit();b(this,xt,xb).call(this,a(this,Le).values())}unselectAll(){if(!(a(this,Cn)&&(a(this,Cn).commitOrRemove(),a(this,ei)!==Pt.NONE))&&!a(this,Ja)?.commitOrRemove()&&(a(this,di)?.destroyPopup(),!!this.hasSelection)){for(let t of a(this,le))t.unselect();a(this,le).clear(),b(this,xt,Xi).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;a(this,lo)[0]+=t,a(this,lo)[1]+=e;let[n,s]=a(this,lo),o=[...a(this,le)],l=1e3;a(this,os)&&clearTimeout(a(this,os)),p(this,os,setTimeout(()=>{p(this,os,null),a(this,lo)[0]=a(this,lo)[1]=0,this.addCommands({cmd:()=>{for(let c of o)a(this,Le).has(c.id)&&(c.translateInPage(n,s),c.translationDone())},undo:()=>{for(let c of o)a(this,Le).has(c.id)&&(c.translateInPage(-n,-s),c.translationDone())},mustExec:!1})},l));for(let c of o)c.translateInPage(t,e),c.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),p(this,rs,new Map);for(let t of a(this,le))a(this,rs).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!a(this,rs))return!1;this.disableUserSelect(!1);let t=a(this,rs);p(this,rs,null);let e=!1;for(let[{x:n,y:s,pageIndex:o},l]of t)l.newX=n,l.newY=s,l.newPageIndex=o,e||(e=n!==l.savedX||s!==l.savedY||o!==l.savedPageIndex);if(!e)return!1;let i=(n,s,o,l)=>{if(a(this,Le).has(n.id)){let c=a(this,ke).get(l);c?n._setParentAndPosition(c,s,o):(n.pageIndex=l,n.x=s,n.y=o)}};return this.addCommands({cmd:()=>{for(let[n,{newX:s,newY:o,newPageIndex:l}]of t)i(n,s,o,l)},undo:()=>{for(let[n,{savedX:s,savedY:o,savedPageIndex:l}]of t)i(n,s,o,l)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(a(this,rs))for(let i of a(this,rs).keys())i.drag(t,e)}rebuild(t){if(t.parent===null){let e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||a(this,le).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return a(this,Cn)===t}getActive(){return a(this,Cn)}getMode(){return a(this,ei)}isEditingMode(){return a(this,ei)!==Pt.NONE}get imageManager(){return Ot(this,"imageManager",new db)}getSelectionBoxes(t){if(!t)return null;let e=document.getSelection();for(let u=0,h=e.rangeCount;u<h;u++)if(!t.contains(e.getRangeAt(u).commonAncestorContainer))return null;let{x:i,y:n,width:s,height:o}=t.getBoundingClientRect(),l;switch(t.getAttribute("data-main-rotation")){case"90":l=(u,h,d,f)=>({x:(h-n)/o,y:1-(u+d-i)/s,width:f/o,height:d/s});break;case"180":l=(u,h,d,f)=>({x:1-(u+d-i)/s,y:1-(h+f-n)/o,width:d/s,height:f/o});break;case"270":l=(u,h,d,f)=>({x:1-(h+f-n)/o,y:(u-i)/s,width:f/o,height:d/s});break;default:l=(u,h,d,f)=>({x:(u-i)/s,y:(h-n)/o,width:d/s,height:f/o});break}let c=[];for(let u=0,h=e.rangeCount;u<h;u++){let d=e.getRangeAt(u);if(!d.collapsed)for(let{x:f,y:m,width:x,height:y}of d.getClientRects())x===0||y===0||c.push(l(f,m,x,y))}return c.length===0?null:c}addChangedExistingAnnotation({annotationElementId:t,id:e}){(a(this,Ku)||p(this,Ku,new Map)).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){a(this,Ku)?.delete(t)}renderAnnotationElement(t){let e=a(this,Ku)?.get(t.data.id);if(!e)return;let i=a(this,Ki).getRawValue(e);i&&(a(this,ei)===Pt.NONE&&!i.hasBeenModified||i.renderAnnotationElement(t))}setMissingCanvas(t,e,i){let n=a(this,so)?.get(t);n&&(n.setCanvas(e,i),a(this,so).delete(t))}addMissingCanvas(t,e){(a(this,so)||p(this,so,new Map)).set(t,e)}};qu=new WeakMap,Cn=new WeakMap,Wu=new WeakMap,Le=new WeakMap,ke=new WeakMap,Xu=new WeakMap,Yu=new WeakMap,Ki=new WeakMap,Ku=new WeakMap,ar=new WeakMap,di=new WeakMap,Qa=new WeakMap,Ja=new WeakMap,to=new WeakMap,eo=new WeakMap,rs=new WeakMap,or=new WeakMap,wl=new WeakMap,sp=new WeakMap,ap=new WeakMap,Zu=new WeakMap,op=new WeakMap,ss=new WeakMap,io=new WeakMap,Qu=new WeakMap,no=new WeakMap,as=new WeakMap,my=new WeakMap,Ys=new WeakMap,Ju=new WeakMap,lp=new WeakMap,ro=new WeakMap,Al=new WeakMap,th=new WeakMap,so=new WeakMap,cp=new WeakMap,ei=new WeakMap,le=new WeakMap,Ks=new WeakMap,ao=new WeakMap,oo=new WeakMap,up=new WeakMap,eh=new WeakMap,hp=new WeakMap,lo=new WeakMap,os=new WeakMap,Zs=new WeakMap,dp=new WeakMap,fp=new WeakMap,lr=new WeakMap,xt=new WeakSet,Kg=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},mb=function(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let i of a(this,ke).values())if(i.hasTextLayer(t))return i;return null},zC=function(t){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)},jC=function(){let t=document.getSelection();if(!t||t.isCollapsed)return;let i=b(this,xt,Kg).call(this,t).closest(".textLayer"),n=this.getSelectionBoxes(i);n&&(a(this,as)||p(this,as,new cb(this)),a(this,as).show(i,n,this.direction==="ltr"))},HC=function(){let t=document.getSelection();if(!t||t.isCollapsed){a(this,Ks)&&(a(this,as)?.hide(),p(this,Ks,null),b(this,xt,Xi).call(this,{hasSelectedText:!1}));return}let{anchorNode:e}=t;if(e===a(this,Ks))return;let n=b(this,xt,Kg).call(this,t).closest(".textLayer");if(!n){a(this,Ks)&&(a(this,as)?.hide(),p(this,Ks,null),b(this,xt,Xi).call(this,{hasSelectedText:!1}));return}if(a(this,as)?.hide(),p(this,Ks,e),b(this,xt,Xi).call(this,{hasSelectedText:!0}),!(a(this,ei)!==Pt.HIGHLIGHT&&a(this,ei)!==Pt.NONE)&&(a(this,ei)===Pt.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),p(this,no,this.isShiftKeyDown),!this.isShiftKeyDown)){let s=a(this,ei)===Pt.HIGHLIGHT?b(this,xt,mb).call(this,n):null;if(s?.toggleDrawing(),a(this,Ju)){let o=new AbortController,l=this.combinedSignal(o),c=u=>{u.type==="pointerup"&&u.button!==0||(o.abort(),s?.toggleDrawing(!0),u.type==="pointerup"&&b(this,xt,uf).call(this,"main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}else s?.toggleDrawing(!0),b(this,xt,uf).call(this,"main_toolbar")}},uf=function(t=""){a(this,ei)===Pt.HIGHLIGHT?this.highlightSelection(t):a(this,sp)&&b(this,xt,jC).call(this)},GC=function(){document.addEventListener("selectionchange",b(this,xt,HC).bind(this),{signal:this._signal})},$C=function(){if(a(this,io))return;p(this,io,new AbortController);let t=this.combinedSignal(a(this,io));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},VC=function(){a(this,io)?.abort(),p(this,io,null)},gb=function(){if(a(this,ro))return;p(this,ro,new AbortController);let t=this.combinedSignal(a(this,ro));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},qC=function(){a(this,ro)?.abort(),p(this,ro,null)},WC=function(){if(a(this,Qa))return;p(this,Qa,new AbortController);let t=this.combinedSignal(a(this,Qa));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},XC=function(){a(this,Qa)?.abort(),p(this,Qa,null)},YC=function(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},Xi=function(t){Object.entries(t).some(([i,n])=>a(this,hp)[i]!==n)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(a(this,hp),t)}),a(this,ei)===Pt.HIGHLIGHT&&t.hasSelectedEditor===!1&&b(this,xt,$s).call(this,[[Wt.HIGHLIGHT_FREE,!0]]))},$s=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},KC=async function(){if(!a(this,Ys)){p(this,Ys,!0);let t=[];for(let e of a(this,ke).values())t.push(e.enable());await Promise.all(t);for(let e of a(this,Le).values())e.enable()}},ZC=function(){if(this.unselectAll(),a(this,Ys)){p(this,Ys,!1);for(let t of a(this,ke).values())t.disable();for(let t of a(this,Le).values())t.disable()}},yb=function(t){let e=a(this,ke).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},QC=function(){let t=null;for(t of a(this,le));return t},hf=function(){if(a(this,Le).size===0)return!0;if(a(this,Le).size===1)for(let t of a(this,Le).values())return t.isEmpty();return!1},xb=function(t){for(let e of a(this,le))e.unselect();a(this,le).clear();for(let e of t)e.isEmpty()||(a(this,le).add(e),e.select());b(this,xt,Xi).call(this,{hasSelectedEditor:this.hasSelection})},j(Bu,"TRANSLATE_SMALL",1),j(Bu,"TRANSLATE_BIG",10);Go=Bu,Yi=class Yi{constructor(t){g(this,zr);g(this,fi,null);g(this,ls,!1);g(this,Sr,null);g(this,ih,null);g(this,cs,null);g(this,Tn,null);g(this,nh,!1);g(this,us,null);g(this,fn,null);g(this,Qs,null);g(this,vl,null);g(this,hs,!1);p(this,fn,t),p(this,hs,t._uiManager.useNewAltTextFlow),a(Yi,co)||p(Yi,co,Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}static initialize(t){Yi._l10n??(Yi._l10n=t)}async render(){let t=p(this,Sr,document.createElement("button"));t.className="altText",t.tabIndex="0";let e=p(this,ih,document.createElement("span"));t.append(e),a(this,hs)?(t.classList.add("new"),t.setAttribute("data-l10n-id",a(Yi,co).missing),e.setAttribute("data-l10n-id",a(Yi,co)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let i=a(this,fn)._uiManager._signal;t.addEventListener("contextmenu",qn,{signal:i}),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:i});let n=s=>{s.preventDefault(),a(this,fn)._uiManager.editAltText(a(this,fn)),a(this,hs)&&a(this,fn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:a(this,zr,df)}})};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(p(this,nh,!0),n(s))},{signal:i}),await b(this,zr,Zg).call(this),t}finish(){a(this,Sr)&&(a(this,Sr).focus({focusVisible:a(this,nh)}),p(this,nh,!1))}isEmpty(){return a(this,hs)?a(this,fi)===null:!a(this,fi)&&!a(this,ls)}hasData(){return a(this,hs)?a(this,fi)!==null||!!a(this,Qs):this.isEmpty()}get guessedText(){return a(this,Qs)}async setGuessedText(t){a(this,fi)===null&&(p(this,Qs,t),p(this,vl,await Yi._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),b(this,zr,Zg).call(this))}toggleAltTextBadge(t=!1){if(!a(this,hs)||a(this,fi)){a(this,us)?.remove(),p(this,us,null);return}if(!a(this,us)){let e=p(this,us,document.createElement("div"));e.className="noAltTextBadge",a(this,fn).div.append(e)}a(this,us).classList.toggle("hidden",!t)}serialize(t){let e=a(this,fi);return!t&&a(this,Qs)===e&&(e=a(this,vl)),{altText:e,decorative:a(this,ls),guessedText:a(this,Qs),textWithDisclaimer:a(this,vl)}}get data(){return{altText:a(this,fi),decorative:a(this,ls)}}set data({altText:t,decorative:e,guessedText:i,textWithDisclaimer:n,cancel:s=!1}){i&&(p(this,Qs,i),p(this,vl,n)),!(a(this,fi)===t&&a(this,ls)===e)&&(s||(p(this,fi,t),p(this,ls,e)),b(this,zr,Zg).call(this))}toggle(t=!1){a(this,Sr)&&(!t&&a(this,Tn)&&(clearTimeout(a(this,Tn)),p(this,Tn,null)),a(this,Sr).disabled=!t)}shown(){a(this,fn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:a(this,zr,df)}})}destroy(){a(this,Sr)?.remove(),p(this,Sr,null),p(this,ih,null),p(this,cs,null),a(this,us)?.remove(),p(this,us,null)}};fi=new WeakMap,ls=new WeakMap,Sr=new WeakMap,ih=new WeakMap,cs=new WeakMap,Tn=new WeakMap,nh=new WeakMap,us=new WeakMap,fn=new WeakMap,Qs=new WeakMap,vl=new WeakMap,hs=new WeakMap,co=new WeakMap,zr=new WeakSet,df=function(){return a(this,fi)&&"added"||a(this,fi)===null&&this.guessedText&&"review"||"missing"},Zg=async function(){let t=a(this,Sr);if(!t)return;if(a(this,hs)){if(t.classList.toggle("done",!!a(this,fi)),t.setAttribute("data-l10n-id",a(Yi,co)[a(this,zr,df)]),a(this,ih)?.setAttribute("data-l10n-id",a(Yi,co)[`${a(this,zr,df)}-label`]),!a(this,fi)){a(this,cs)?.remove();return}}else{if(!a(this,fi)&&!a(this,ls)){t.classList.remove("done"),a(this,cs)?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=a(this,cs);if(!e){p(this,cs,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${a(this,fn).id}`;let n=100,s=a(this,fn)._uiManager._signal;s.addEventListener("abort",()=>{clearTimeout(a(this,Tn)),p(this,Tn,null)},{once:!0}),t.addEventListener("mouseenter",()=>{p(this,Tn,setTimeout(()=>{p(this,Tn,null),a(this,cs).classList.add("show"),a(this,fn)._reportTelemetry({action:"alt_text_tooltip"})},n))},{signal:s}),t.addEventListener("mouseleave",()=>{a(this,Tn)&&(clearTimeout(a(this,Tn)),p(this,Tn,null)),a(this,cs)?.classList.remove("show")},{signal:s})}a(this,ls)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=a(this,fi)),e.parentNode||t.append(e),a(this,fn).getElementForAltText()?.setAttribute("aria-describedby",e.id)},g(Yi,co,null),j(Yi,"_l10n",null);B0=Yi,Ru=class{constructor(t){g(this,mp);g(this,Di,null);g(this,cr,null);g(this,El,!1);g(this,we,null);g(this,pp,null);g(this,uo,null);g(this,ur,null);g(this,ho,null);g(this,fo,!1);g(this,Cl,null);p(this,we,t)}renderForToolbar(){let t=p(this,cr,document.createElement("button"));return t.className="comment",b(this,mp,bb).call(this,t,!1)}renderForStandalone(){let t=p(this,Di,document.createElement("button"));t.className="annotationCommentButton";let e=a(this,we).commentButtonPosition;if(e){let{style:i}=t;i.insetInlineEnd=`calc(${100*(a(this,we)._uiManager.direction==="ltr"?1-e[0]:e[0])}% - var(--comment-button-dim))`,i.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;let n=a(this,we).commentButtonColor;n&&(i.backgroundColor=n)}return b(this,mp,bb).call(this,t,!0)}focusButton(){setTimeout(()=>{(a(this,Di)??a(this,cr))?.focus()},0)}onUpdatedColor(){if(!a(this,Di))return;let t=a(this,we).commentButtonColor;t&&(a(this,Di).style.backgroundColor=t),a(this,we)._uiManager.updatePopupColor(a(this,we))}get commentButtonWidth(){return(a(this,Di)?.getBoundingClientRect().width??0)/a(this,we).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(a(this,Cl))return a(this,Cl);if(!a(this,Di))return null;let{x:t,y:e,height:i}=a(this,Di).getBoundingClientRect(),{x:n,y:s,width:o,height:l}=a(this,we).parent.boundingClientRect;return[(t-n)/o,(e+i-s)/l]}set commentPopupPositionInLayer(t){p(this,Cl,t)}hasDefaultPopupPosition(){return a(this,Cl)===null}removeStandaloneCommentButton(){a(this,Di)?.remove(),p(this,Di,null)}removeToolbarCommentButton(){a(this,cr)?.remove(),p(this,cr,null)}setCommentButtonStates({selected:t,hasPopup:e}){a(this,Di)&&(a(this,Di).classList.toggle("selected",t),a(this,Di).ariaExpanded=e)}edit(t){let e=this.commentPopupPositionInLayer,i,n;if(e)[i,n]=e;else{[i,n]=a(this,we).commentButtonPosition;let{width:h,height:d,x:f,y:m}=a(this,we);i=f+i*h,n=m+n*d}let s=a(this,we).parent.boundingClientRect,{x:o,y:l,width:c,height:u}=s;a(this,we)._uiManager.editComment(a(this,we),o+i*c,l+n*u,{...t,parentDimensions:s})}finish(){a(this,cr)&&(a(this,cr).focus({focusVisible:a(this,El)}),p(this,El,!1))}isDeleted(){return a(this,fo)||a(this,ur)===""}isEmpty(){return a(this,ur)===null}hasBeenEdited(){return this.isDeleted()||a(this,ur)!==a(this,pp)}serialize(){return this.data}get data(){return{text:a(this,ur),richText:a(this,uo),date:a(this,ho),deleted:this.isDeleted()}}set data(t){if(t!==a(this,ur)&&p(this,uo,null),t===null){p(this,ur,""),p(this,fo,!0);return}p(this,ur,t),p(this,ho,new Date),p(this,fo,!1)}restoreData({text:t,richText:e,date:i}){p(this,ur,t),p(this,uo,e),p(this,ho,i),p(this,fo,!1)}setInitialText(t,e=null){p(this,pp,t),this.data=t,p(this,ho,null),p(this,uo,e)}shown(){}destroy(){a(this,cr)?.remove(),p(this,cr,null),a(this,Di)?.remove(),p(this,Di,null),p(this,ur,""),p(this,uo,null),p(this,ho,null),p(this,we,null),p(this,El,!1),p(this,fo,!1)}};Di=new WeakMap,cr=new WeakMap,El=new WeakMap,we=new WeakMap,pp=new WeakMap,uo=new WeakMap,ur=new WeakMap,ho=new WeakMap,fo=new WeakMap,Cl=new WeakMap,mp=new WeakSet,bb=function(t,e){if(!a(this,we)._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[a(this,we)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let i=a(this,we)._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",qn,{signal:i}),e&&(t.addEventListener("focusin",s=>{a(this,we)._focusEventsAllowed=!1,_e(s)},{capture:!0,signal:i}),t.addEventListener("focusout",s=>{a(this,we)._focusEventsAllowed=!0,_e(s)},{capture:!0,signal:i})),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:i});let n=s=>{s.preventDefault(),t===a(this,cr)?this.edit():a(this,we).toggleComment(!0)};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(p(this,El,!0),n(s))},{signal:i}),t.addEventListener("pointerenter",()=>{a(this,we).toggleComment(!1,!0)},{signal:i}),t.addEventListener("pointerleave",()=>{a(this,we).toggleComment(!1,!1)},{signal:i}),t};zw=class zw{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:n=null,onPinching:s=null,onPinchEnd:o=null,signal:l}){g(this,$o);g(this,rh);g(this,Tl,!1);g(this,gp,null);g(this,yp);g(this,xp);g(this,bp);g(this,wp);g(this,Js,null);g(this,Sl);g(this,ta,null);g(this,Dl);g(this,ea,null);p(this,rh,t),p(this,gp,i),p(this,yp,e),p(this,xp,n),p(this,bp,s),p(this,wp,o),p(this,Dl,new AbortController),p(this,Sl,AbortSignal.any([l,a(this,Dl).signal])),t.addEventListener("touchstart",b(this,$o,JC).bind(this),{passive:!1,signal:a(this,Sl)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Ds.pixelRatio}destroy(){a(this,Dl)?.abort(),p(this,Dl,null),a(this,Js)?.abort(),p(this,Js,null)}};rh=new WeakMap,Tl=new WeakMap,gp=new WeakMap,yp=new WeakMap,xp=new WeakMap,bp=new WeakMap,wp=new WeakMap,Js=new WeakMap,Sl=new WeakMap,ta=new WeakMap,Dl=new WeakMap,ea=new WeakMap,$o=new WeakSet,JC=function(t){var n,s,o;if((n=a(this,yp))!=null&&n.call(this))return;if(t.touches.length===1){if(a(this,Js))return;let l=p(this,Js,new AbortController),c=AbortSignal.any([a(this,Sl),l.signal]),u=a(this,rh),h={capture:!0,signal:c,passive:!1},d=f=>{f.pointerType==="touch"&&(a(this,Js)?.abort(),p(this,Js,null))};u.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(_e(f),d(f))},h),u.addEventListener("pointerup",d,h),u.addEventListener("pointercancel",d,h);return}if(!a(this,ea)){p(this,ea,new AbortController);let l=AbortSignal.any([a(this,Sl),a(this,ea).signal]),c=a(this,rh),u={signal:l,capture:!1,passive:!1};c.addEventListener("touchmove",b(this,$o,tT).bind(this),u);let h=b(this,$o,eT).bind(this);c.addEventListener("touchend",h,u),c.addEventListener("touchcancel",h,u),u.capture=!0,c.addEventListener("pointerdown",_e,u),c.addEventListener("pointermove",_e,u),c.addEventListener("pointercancel",_e,u),c.addEventListener("pointerup",_e,u),(s=a(this,xp))==null||s.call(this)}if(_e(t),t.touches.length!==2||(o=a(this,gp))!=null&&o.call(this)){p(this,ta,null);return}let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]),p(this,ta,{touch0X:e.screenX,touch0Y:e.screenY,touch1X:i.screenX,touch1Y:i.screenY})},tT=function(t){var D;if(!a(this,ta)||t.touches.length!==2)return;_e(t);let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]);let{screenX:n,screenY:s}=e,{screenX:o,screenY:l}=i,c=a(this,ta),{touch0X:u,touch0Y:h,touch1X:d,touch1Y:f}=c,m=d-u,x=f-h,y=o-n,A=l-s,w=Math.hypot(y,A)||1,v=Math.hypot(m,x)||1;if(!a(this,Tl)&&Math.abs(v-w)<=zw.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=n,c.touch0Y=s,c.touch1X=o,c.touch1Y=l,!a(this,Tl)){p(this,Tl,!0);return}let C=[(n+o)/2,(s+l)/2];(D=a(this,bp))==null||D.call(this,C,v,w)},eT=function(t){var e;t.touches.length>=2||(a(this,ea)&&(a(this,ea).abort(),p(this,ea,null),(e=a(this,wp))==null||e.call(this)),a(this,ta)&&(_e(t),p(this,ta,null),p(this,Tl,!1)))};jf=zw,Bt=class Bt{constructor(t){g(this,Mt);g(this,Il,null);g(this,Dr,null);g(this,Ce,null);g(this,ce,null);g(this,ia,null);g(this,sh,!1);g(this,po,null);g(this,Ap,"");g(this,Ii,null);g(this,kl,null);g(this,na,null);g(this,hr,null);g(this,mo,null);g(this,vp,"");g(this,Nl,!1);g(this,Sn,null);g(this,Ep,!1);g(this,_l,!1);g(this,ra,!1);g(this,ds,null);g(this,ah,0);g(this,oh,0);g(this,dr,null);g(this,Ml,null);j(this,"isSelected",!1);j(this,"_isCopy",!1);j(this,"_editToolbar",null);j(this,"_initialOptions",Object.create(null));j(this,"_initialData",null);j(this,"_isVisible",!0);j(this,"_uiManager",null);j(this,"_focusEventsAllowed",!0);g(this,Cp,!1);g(this,gy,Bt._zIndex++);this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null,this.canAddComment=!0;let{rotation:e,rawDims:{pageWidth:i,pageHeight:n,pageX:s,pageY:o}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,n],this.pageTranslation=[s,o];let[l,c]=this.parentDimensions;this.x=t.x/l,this.y=t.y/c,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){let t=Bt.prototype._resizeWithKeyboard,e=Go.TRANSLATE_SMALL,i=Go.TRANSLATE_BIG;return Ot(this,"_resizerKeyboardManager",new Lc([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],Bt.prototype._stopResizingWithKeyboard]]))}updatePageIndex(t){this.pageIndex=t}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return Ot(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new Db({id:t._uiManager.getId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(Bt._l10n??(Bt._l10n=t),Bt._l10nResizer||(Bt._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),Bt._borderLineWidth!==-1)return;let i=getComputedStyle(document.documentElement);Bt._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){se("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return a(this,Cp)}set _isDraggable(t){p(this,Cp,t),this.div?.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=a(this,gy)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(b(this,Mt,ff).call(this),a(this,hr)?.remove(),p(this,hr,null)),this.parent=t}focusin(t){this._focusEventsAllowed&&(a(this,Nl)?p(this,Nl,!1):this.parent.setSelected(this))}focusout(t){!this._focusEventsAllowed||!this.isAttachedToDOM||t.relatedTarget?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,n){let[s,o]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(t+i)/s,this.y=(e+n)/o,this.fixAndSetPosition()}_moveAfterPaste(t,e){if(this.isClone){delete this.isClone;return}let[i,n]=this.parentDimensions;this.setAt(t*i,e*n,this.width*i,this.height*n),this._onTranslated()}translate(t,e){b(this,Mt,wb).call(this,this.parentDimensions,t,e)}translateInPage(t,e){a(this,Sn)||p(this,Sn,[this.x,this.y,this.width,this.height]),b(this,Mt,wb).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){a(this,Sn)||p(this,Sn,[this.x,this.y,this.width,this.height]);let{div:i,parentDimensions:[n,s]}=this;if(this.x+=t/n,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:d,y:f}=this.div.getBoundingClientRect();this.parent.findNewParent(this,d,f)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:o,y:l}=this,[c,u]=this.getBaseTranslation();o+=c,l+=u;let{style:h}=i;h.left=`${(100*o).toFixed(2)}%`,h.top=`${(100*l).toFixed(2)}%`,this._onTranslating(o,l),i.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!a(this,Sn)&&(a(this,Sn)[0]!==this.x||a(this,Sn)[1]!==this.y)}get _hasBeenResized(){return!!a(this,Sn)&&(a(this,Sn)[2]!==this.width||a(this,Sn)[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=Bt,n=i/t,s=i/e;switch(this.rotation){case 90:return[-n,s];case 180:return[n,s];case 270:return[n,-s];default:return[-n,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){let{div:{style:e},pageDimensions:[i,n]}=this,{x:s,y:o,width:l,height:c}=this;if(l*=i,c*=n,s*=i,o*=n,this._mustFixPosition)switch(t){case 0:s=li(s,0,i-l),o=li(o,0,n-c);break;case 90:s=li(s,0,i-c),o=li(o,l,n);break;case 180:s=li(s,l,i),o=li(o,c,n);break;case 270:s=li(s,c,i),o=li(o,0,n-l);break}this.x=s/=i,this.y=o/=n;let[u,h]=this.getBaseTranslation();s+=u,o+=h,e.left=`${(100*s).toFixed(2)}%`,e.top=`${(100*o).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(t,e){var i;return b(i=Bt,Tp,Ab).call(i,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var i;return b(i=Bt,Tp,Ab).call(i,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(){let{div:{style:t},width:e,height:i}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*i).toFixed(2)}%`}getInitialTranslation(){return[0,0]}_onResized(){}static _round(t){return Math.round(t*1e4)/1e4}_onResizing(){}altTextFinish(){a(this,Ce)?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||a(this,_l))return this._editToolbar;this._editToolbar=new lb(this),this.div.append(this._editToolbar.render());let{toolbarButtons:t}=this;if(t)for(let[e,i]of t)await this._editToolbar.addButton(e,i);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,a(this,Ce)?.destroy()}addContainer(t){let e=this._editToolbar?.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return a(this,Ce)||(B0.initialize(Bt._l10n),p(this,Ce,new B0(this)),a(this,Il)&&(a(this,Ce).data=a(this,Il),p(this,Il,null))),a(this,Ce)}get altTextData(){return a(this,Ce)?.data}set altTextData(t){a(this,Ce)&&(a(this,Ce).data=t)}get guessedAltText(){return a(this,Ce)?.guessedText}async setGuessedAltText(t){await a(this,Ce)?.setGuessedText(t)}serializeAltText(t){return a(this,Ce)?.serialize(t)}hasAltText(){return!!a(this,Ce)&&!a(this,Ce).isEmpty()}hasAltTextData(){return a(this,Ce)?.hasData()??!1}focusCommentButton(){a(this,ce)?.focusButton()}addCommentButton(){return this.canAddComment?a(this,ce)||p(this,ce,new Ru(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(a(this,ia)){this._uiManager.isEditingMode()&&a(this,ia).classList.remove("hidden");return}this.hasComment&&(p(this,ia,a(this,ce).renderForStandalone()),this.div.append(a(this,ia)))}}removeStandaloneCommentButton(){a(this,ce).removeStandaloneCommentButton(),p(this,ia,null)}hideStandaloneCommentButton(){a(this,ia)?.classList.add("hidden")}get comment(){if(!a(this,ce))return null;let{data:{richText:t,text:e,date:i,deleted:n}}=a(this,ce);return{text:e,richText:t,date:i,deleted:n,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){a(this,ce)||p(this,ce,new Ru(this)),typeof t=="object"&&t!==null?a(this,ce).restoreData(t):a(this,ce).data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:t,popupRef:e,richText:i}){if(!e||(a(this,ce)||p(this,ce,new Ru(this)),a(this,ce).setInitialText(t,i),!this.annotationElementId))return;let n=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);n&&this.updateFromAnnotationLayer(n)}get hasEditedComment(){return a(this,ce)?.hasBeenEdited()}get hasDeletedComment(){return a(this,ce)?.isDeleted()}get hasComment(){return!!a(this,ce)&&!a(this,ce).isEmpty()&&!a(this,ce).isDeleted()}async editComment(t){a(this,ce)||p(this,ce,new Ru(this)),a(this,ce).edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){a(this,ce).setSelectedButton(t)}addComment(t){if(this.hasEditedComment){let[,,,n]=t.rect,[s]=this.pageDimensions,[o]=this.pageTranslation,l=o+s+1,c=n-100,u=l+180;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[l,c,u,n]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){a(this,ce).data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let t=this.div=document.createElement("div");t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=a(this,sh)?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),b(this,Mt,Tb).call(this);let[e,i]=this.parentDimensions;this.parentRotation%180!==0&&(t.style.maxWidth=`${(100*i/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/i).toFixed(2)}%`);let[n,s]=this.getInitialTranslation();return this.translate(n,s),BC(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(a(this,Ml)||p(this,Ml,new jf({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:b(this,Mt,rT).bind(this),onPinching:b(this,Mt,sT).bind(this),onPinchEnd:b(this,Mt,aT).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}pointerdown(t){let{isMac:e}=je.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(p(this,Nl,!0),this._isDraggable){b(this,Mt,oT).call(this,t);return}b(this,Mt,Cb).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){a(this,ds)&&clearTimeout(a(this,ds)),p(this,ds,setTimeout(()=>{p(this,ds,null),this.parent?.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,i=this.rotation){let n=this.parentScale,[s,o]=this.pageDimensions,[l,c]=this.pageTranslation,u=t/n,h=e/n,d=this.x*s,f=this.y*o,m=this.width*s,x=this.height*o;switch(i){case 0:return[d+u+l,o-f-h-x+c,d+u+m+l,o-f-h+c];case 90:return[d+h+l,o-f+u+c,d+h+x+l,o-f+u+m+c];case 180:return[d-u-m+l,o-f+h+c,d-u+l,o-f+h+x+c];case 270:return[d-h-x+l,o-f-u-m+c,d-h+l,o-f-u+c];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[i,n,s,o]=t,l=s-i,c=o-n;switch(this.rotation){case 0:return[i,e-o,l,c];case 90:return[i,e-n,c,l];case 180:return[s,e-n,l,c];case 270:return[s,e-o,c,l];default:throw new Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&Bt._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){a(this,ce)?.onUpdatedColor()}getData(){let{comment:{text:t,color:e,date:i,opacity:n,deleted:s,richText:o},uid:l,pageIndex:c,creationDate:u,modificationDate:h}=this;return{id:l,pageIndex:c,rect:this.getPDFRect(),richText:o,contentsObj:{str:t},creationDate:u,modificationDate:i||h,popupRef:!s,color:e,opacity:n}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),p(this,_l,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),p(this,_l,!1),!0):!1}isInEditMode(){return a(this,_l)}shouldGetKeyboardEvents(){return a(this,ra)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:t,left:e,bottom:i,right:n}=this.getClientDimensions(),{innerHeight:s,innerWidth:o}=window;return e<o&&n>0&&t<s&&i>0}rebuild(){b(this,Mt,Tb).call(this)}rotate(t){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(t=!1,e=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(t,e,i){let n=new this.prototype.constructor({parent:e,id:i.getId(),uiManager:i,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});n.rotation=t.rotation,p(n,Il,t.accessibilityData),n._isCopy=t.isCopy||!1;let[s,o]=n.pageDimensions,[l,c,u,h]=n.getRectInCurrentCoords(t.rect,o);return n.x=l/s,n.y=c/o,n.width=u/s,n.height=h/o,n}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(a(this,mo)?.abort(),p(this,mo,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),a(this,ds)&&(clearTimeout(a(this,ds)),p(this,ds,null)),b(this,Mt,ff).call(this),this.removeEditToolbar(),a(this,dr)){for(let t of a(this,dr).values())clearTimeout(t);p(this,dr,null)}this.parent=null,a(this,Ml)?.destroy(),p(this,Ml,null),a(this,hr)?.remove(),p(this,hr,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,Mt,iT).call(this),a(this,Ii).classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return this._uiManager.direction==="ltr"?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[t,e]}=this,[i,n,s,o]=this.getPDFRect();return[Bt._round(i+(s-i)*t),Bt._round(n+(o-n)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return a(this,ce).commentPopupPositionInLayer}set commentPopupPosition(t){a(this,ce).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return a(this,ce).hasDefaultPopupPosition()}get commentButtonWidth(){return a(this,ce).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){a(this,ce)?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),p(this,na,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let e=a(this,Ii).children;if(!a(this,Dr)){p(this,Dr,Array.from(e));let o=b(this,Mt,lT).bind(this),l=b(this,Mt,cT).bind(this),c=this._uiManager._signal;for(let u of a(this,Dr)){let h=u.getAttribute("data-resizer-name");u.setAttribute("role","spinbutton"),u.addEventListener("keydown",o,{signal:c}),u.addEventListener("blur",l,{signal:c}),u.addEventListener("focus",b(this,Mt,uT).bind(this,h),{signal:c}),u.setAttribute("data-l10n-id",Bt._l10nResizer[h])}}let i=a(this,Dr)[0],n=0;for(let o of e){if(o===i)break;n++}let s=(360-this.rotation+this.parentRotation)%360/90*(a(this,Dr).length/4);if(s!==n){if(s<n)for(let l=0;l<n-s;l++)a(this,Ii).append(a(this,Ii).firstElementChild);else if(s>n)for(let l=0;l<s-n;l++)a(this,Ii).firstElementChild.before(a(this,Ii).lastElementChild);let o=0;for(let l of e){let u=a(this,Dr)[o++].getAttribute("data-resizer-name");l.setAttribute("data-l10n-id",Bt._l10nResizer[u])}}b(this,Mt,Sb).call(this,0),p(this,ra,!0),a(this,Ii).firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){a(this,ra)&&b(this,Mt,Eb).call(this,a(this,vp),{deltaX:t,deltaY:e,fromKeyboard:!0})}_stopResizingWithKeyboard(){b(this,Mt,ff).call(this),this.div.focus()}select(){if(this.isSelected&&this._editToolbar){this._editToolbar.show();return}if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),a(this,Ce)?.toggleAltTextBadge(!1)}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,a(this,Ii)?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),a(this,Ce)?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){t.target.nodeName!=="BUTTON"&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return a(this,Ep)}set isEditing(t){p(this,Ep,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){a(this,dr)||p(this,dr,new Map);let{action:i}=t,n=a(this,dr).get(i);n&&clearTimeout(n),n=setTimeout(()=>{this._reportTelemetry(t),a(this,dr).delete(i),a(this,dr).size===0&&p(this,dr,null)},Bt._telemetryTimeout),a(this,dr).set(i,n);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),p(this,sh,!1)}disable(){this.div&&(this.div.tabIndex=-1),p(this,sh,!0)}updateFakeAnnotationElement(t){if(!a(this,hr)&&!this.deleted){p(this,hr,t.addFakeAnnotation(this));return}if(this.deleted){a(this,hr).remove(),p(this,hr,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&a(this,hr).updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){let i=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),i.before(e)}return e}resetAnnotationElement(t){let{firstElementChild:e}=t.container;e?.nodeName==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}};Il=new WeakMap,Dr=new WeakMap,Ce=new WeakMap,ce=new WeakMap,ia=new WeakMap,sh=new WeakMap,po=new WeakMap,Ap=new WeakMap,Ii=new WeakMap,kl=new WeakMap,na=new WeakMap,hr=new WeakMap,mo=new WeakMap,vp=new WeakMap,Nl=new WeakMap,Sn=new WeakMap,Ep=new WeakMap,_l=new WeakMap,ra=new WeakMap,ds=new WeakMap,ah=new WeakMap,oh=new WeakMap,dr=new WeakMap,Ml=new WeakMap,Cp=new WeakMap,gy=new WeakMap,Mt=new WeakSet,wb=function([t,e],i,n){[i,n]=this.screenToPageTranslation(i,n),this.x+=i/t,this.y+=n/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()},Tp=new WeakSet,Ab=function(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},Qg=function(t){switch(t){case 90:{let[e,i]=this.pageDimensions;return[0,-e/i,i/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,i]=this.pageDimensions;return[0,e/i,-i/e,0]}default:return[1,0,0,1]}},iT=function(){if(a(this,Ii))return;p(this,Ii,document.createElement("div")),a(this,Ii).classList.add("resizers");let t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(let i of t){let n=document.createElement("div");a(this,Ii).append(n),n.classList.add("resizer",i),n.setAttribute("data-resizer-name",i),n.addEventListener("pointerdown",b(this,Mt,nT).bind(this,i),{signal:e}),n.addEventListener("contextmenu",qn,{signal:e}),n.tabIndex=-1}this.div.prepend(a(this,Ii))},nT=function(t,e){e.preventDefault();let{isMac:i}=je.platform;if(e.button!==0||e.ctrlKey&&i)return;a(this,Ce)?.toggle(!1);let n=this._isDraggable;this._isDraggable=!1,p(this,kl,[e.screenX,e.screenY]);let s=new AbortController,o=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,Mt,Eb).bind(this,t),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",_e,{passive:!1,signal:o}),window.addEventListener("contextmenu",qn,{signal:o}),p(this,na,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let l=this.parent.div.style.cursor,c=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let u=()=>{s.abort(),this.parent.togglePointerEvents(!0),a(this,Ce)?.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=l,this.div.style.cursor=c,b(this,Mt,Jg).call(this)};window.addEventListener("pointerup",u,{signal:o}),window.addEventListener("blur",u,{signal:o})},vb=function(t,e,i,n){this.width=i,this.height=n,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()},Jg=function(){if(!a(this,na))return;let{savedX:t,savedY:e,savedWidth:i,savedHeight:n}=a(this,na);p(this,na,null);let s=this.x,o=this.y,l=this.width,c=this.height;s===t&&o===e&&l===i&&c===n||this.addCommands({cmd:b(this,Mt,vb).bind(this,s,o,l,c),undo:b(this,Mt,vb).bind(this,t,e,i,n),mustExec:!0})},Eb=function(t,e){let[i,n]=this.parentDimensions,s=this.x,o=this.y,l=this.width,c=this.height,u=Bt.MIN_SIZE/i,h=Bt.MIN_SIZE/n,d=b(this,Mt,Qg).call(this,this.rotation),f=(L,T)=>[d[0]*L+d[2]*T,d[1]*L+d[3]*T],m=b(this,Mt,Qg).call(this,360-this.rotation),x=(L,T)=>[m[0]*L+m[2]*T,m[1]*L+m[3]*T],y,A,w=!1,v=!1;switch(t){case"topLeft":w=!0,y=(L,T)=>[0,0],A=(L,T)=>[L,T];break;case"topMiddle":y=(L,T)=>[L/2,0],A=(L,T)=>[L/2,T];break;case"topRight":w=!0,y=(L,T)=>[L,0],A=(L,T)=>[0,T];break;case"middleRight":v=!0,y=(L,T)=>[L,T/2],A=(L,T)=>[0,T/2];break;case"bottomRight":w=!0,y=(L,T)=>[L,T],A=(L,T)=>[0,0];break;case"bottomMiddle":y=(L,T)=>[L/2,T],A=(L,T)=>[L/2,0];break;case"bottomLeft":w=!0,y=(L,T)=>[0,T],A=(L,T)=>[L,0];break;case"middleLeft":v=!0,y=(L,T)=>[0,T/2],A=(L,T)=>[L,T/2];break}let C=y(l,c),D=A(l,c),_=f(...D),k=Bt._round(s+_[0]),R=Bt._round(o+_[1]),K=1,W=1,V,U;if(e.fromKeyboard)({deltaX:V,deltaY:U}=e);else{let{screenX:L,screenY:T}=e,[I,M]=a(this,kl);[V,U]=this.screenToPageTranslation(L-I,T-M),a(this,kl)[0]=L,a(this,kl)[1]=T}if([V,U]=x(V/i,U/n),w){let L=Math.hypot(l,c);K=W=Math.max(Math.min(Math.hypot(D[0]-C[0]-V,D[1]-C[1]-U)/L,1/l,1/c),u/l,h/c)}else v?K=li(Math.abs(D[0]-C[0]-V),u,1)/l:W=li(Math.abs(D[1]-C[1]-U),h,1)/c;let tt=Bt._round(l*K),et=Bt._round(c*W);_=f(...A(tt,et));let B=k-_[0],ot=R-_[1];a(this,Sn)||p(this,Sn,[this.x,this.y,this.width,this.height]),this.width=tt,this.height=et,this.x=B,this.y=ot,this.setDims(),this.fixAndSetPosition(),this._onResizing()},rT=function(){p(this,na,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),a(this,Ce)?.toggle(!1),this.parent.togglePointerEvents(!1)},sT=function(t,e,i){let s=.7*(i/e)+1-.7;if(s===1)return;let o=b(this,Mt,Qg).call(this,this.rotation),l=(k,R)=>[o[0]*k+o[2]*R,o[1]*k+o[3]*R],[c,u]=this.parentDimensions,h=this.x,d=this.y,f=this.width,m=this.height,x=Bt.MIN_SIZE/c,y=Bt.MIN_SIZE/u;s=Math.max(Math.min(s,1/f,1/m),x/f,y/m);let A=Bt._round(f*s),w=Bt._round(m*s);if(A===f&&w===m)return;a(this,Sn)||p(this,Sn,[h,d,f,m]);let v=l(f/2,m/2),C=Bt._round(h+v[0]),D=Bt._round(d+v[1]),_=l(A/2,w/2);this.x=C-_[0],this.y=D-_[1],this.width=A,this.height=w,this.setDims(),this.fixAndSetPosition(),this._onResizing()},aT=function(){a(this,Ce)?.toggle(!0),this.parent.togglePointerEvents(!0),b(this,Mt,Jg).call(this)},Cb=function(t){let{isMac:e}=je.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},oT=function(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1,n=new AbortController,s=this._uiManager.combinedSignal(n),o={capture:!0,passive:!1,signal:s},l=u=>{n.abort(),p(this,po,null),p(this,Nl,!1),this._uiManager.endDragSession()||b(this,Mt,Cb).call(this,u),i&&this._onStopDragging()};e&&(p(this,ah,t.clientX),p(this,oh,t.clientY),p(this,po,t.pointerId),p(this,Ap,t.pointerType),window.addEventListener("pointermove",u=>{i||(i=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:h,clientY:d,pointerId:f}=u;if(f!==a(this,po)){_e(u);return}let[m,x]=this.screenToPageTranslation(h-a(this,ah),d-a(this,oh));p(this,ah,h),p(this,oh,d),this._uiManager.dragSelectedEditors(m,x)},o),window.addEventListener("touchmove",_e,o),window.addEventListener("pointerdown",u=>{u.pointerType===a(this,Ap)&&(a(this,Ml)||u.isPrimary)&&l(u),_e(u)},o));let c=u=>{if(!a(this,po)||a(this,po)===u.pointerId){l(u);return}_e(u)};window.addEventListener("pointerup",c,{signal:s}),window.addEventListener("blur",c,{signal:s})},Tb=function(){if(a(this,mo)||!this.div)return;p(this,mo,new AbortController);let t=this._uiManager.combinedSignal(a(this,mo));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},lT=function(t){Bt._resizerKeyboardManager.exec(this,t)},cT=function(t){a(this,ra)&&t.relatedTarget?.parentNode!==a(this,Ii)&&b(this,Mt,ff).call(this)},uT=function(t){p(this,vp,a(this,ra)?t:"")},Sb=function(t){if(a(this,Dr))for(let e of a(this,Dr))e.tabIndex=t},ff=function(){p(this,ra,!1),b(this,Mt,Sb).call(this,-1),b(this,Mt,Jg).call(this)},g(Bt,Tp),j(Bt,"_l10n",null),j(Bt,"_l10nResizer",null),j(Bt,"_borderLineWidth",-1),j(Bt,"_colorManager",new pb),j(Bt,"_zIndex",1),j(Bt,"_telemetryTimeout",1e3);Ae=Bt,Db=class extends Ae{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},sC=3285377520,ir=4294901760,is=65535,U0=class{constructor(t){this.h1=t?t&4294967295:sC,this.h2=t?t&4294967295:sC}update(t){let e,i;if(typeof t=="string"){e=new Uint8Array(t.length*2),i=0;for(let y=0,A=t.length;y<A;y++){let w=t.charCodeAt(y);w<=255?e[i++]=w:(e[i++]=w>>>8,e[i++]=w&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),i=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");let n=i>>2,s=i-n*4,o=new Uint32Array(e.buffer,0,n),l=0,c=0,u=this.h1,h=this.h2,d=3432918353,f=461845907,m=d&is,x=f&is;for(let y=0;y<n;y++)y&1?(l=o[y],l=l*d&ir|l*m&is,l=l<<15|l>>>17,l=l*f&ir|l*x&is,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=o[y],c=c*d&ir|c*m&is,c=c<<15|c>>>17,c=c*f&ir|c*x&is,h^=c,h=h<<13|h>>>19,h=h*5+3864292196);switch(l=0,s){case 3:l^=e[n*4+2]<<16;case 2:l^=e[n*4+1]<<8;case 1:l^=e[n*4],l=l*d&ir|l*m&is,l=l<<15|l>>>17,l=l*f&ir|l*x&is,n&1?u^=l:h^=l}this.h1=u,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&ir|t*36045&is,e=e*4283543511&ir|((e<<16|t>>>16)*2950163797&ir)>>>16,t^=e>>>1,t=t*444984403&ir|t*60499&is,e=e*3301882366&ir|((e<<16|t>>>16)*3120437893&ir)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}},Hf=Object.freeze({map:null,hash:"",transfer:void 0}),Gf=class{constructor(){g(this,yy);g(this,Fl,!1);g(this,Pl,null);g(this,sa,null);g(this,ki,new Map);j(this,"onSetModified",null);j(this,"onResetModified",null);j(this,"onAnnotationEditor",null)}getValue(t,e){let i=a(this,ki).get(t);return i===void 0?e:Object.assign(e,i)}getRawValue(t){return a(this,ki).get(t)}remove(t){let e=a(this,ki).get(t);e!==void 0&&(e instanceof Ae&&a(this,sa).delete(e.annotationElementId),a(this,ki).delete(t),a(this,ki).size===0&&this.resetModified(),!a(this,ki).values().some(i=>i instanceof Ae)&&this.onAnnotationEditor?.(null))}setValue(t,e){let i=a(this,ki).get(t),n=!1;if(i!==void 0)for(let[s,o]of Object.entries(e))i[s]!==o&&(n=!0,i[s]=o);else n=!0,a(this,ki).set(t,e);n&&b(this,yy,hT).call(this),e instanceof Ae&&((a(this,sa)||p(this,sa,new Map)).set(e.annotationElementId,e),this.onAnnotationEditor?.(e.constructor._type))}has(t){return a(this,ki).has(t)}get size(){return a(this,ki).size}resetModified(){a(this,Fl)&&(p(this,Fl,!1),this.onResetModified?.())}get print(){return new z0(this)}get serializable(){if(a(this,ki).size===0)return Hf;let t=new Map,e=new U0,i=[],n=Object.create(null),s=!1;for(let[o,l]of a(this,ki)){let c=l instanceof Ae?l.serialize(!1,n):l;l.page&&(l.pageIndex=l.page._pageIndex,delete l.page),c&&(t.set(o,c),e.update(`${o}:${JSON.stringify(c)}`),s||(s=!!c.bitmap))}if(s)for(let o of t.values())o.bitmap&&i.push(o.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:Hf}get editorStats(){let t=null,e=new Map,i=0,n=0;for(let s of a(this,ki).values()){if(!(s instanceof Ae)){s.popup&&(s.popup.deleted?n+=1:i+=1);continue}s.isCommentDeleted?n+=1:s.hasEditedComment&&(i+=1);let o=s.telemetryFinalData;if(!o)continue;let{type:l}=o;e.has(l)||e.set(l,Object.getPrototypeOf(s).constructor),t||(t=Object.create(null));let c=t[l]||(t[l]=new Map);for(let[u,h]of Object.entries(o)){if(u==="type")continue;let d=c.getOrInsertComputed(u,By);d.set(h,(d.get(h)??0)+1)}}if((n>0||i>0)&&(t||(t=Object.create(null)),t.comments={deleted:n,edited:i}),!t)return null;for(let[s,o]of e)t[s]=o.computeTelemetryFinalData(t[s]);return t}resetModifiedIds(){p(this,Pl,null)}updateEditor(t,e){let i=a(this,sa)?.get(t);return i?(i.updateFromAnnotationLayer(e),!0):!1}getEditor(t){return a(this,sa)?.get(t)||null}get modifiedIds(){if(a(this,Pl))return a(this,Pl);let t=[];if(a(this,sa))for(let e of a(this,sa).values())e.serialize()&&t.push(e.annotationElementId);return p(this,Pl,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return a(this,ki).entries()}};Fl=new WeakMap,Pl=new WeakMap,sa=new WeakMap,ki=new WeakMap,yy=new WeakSet,hT=function(){a(this,Fl)||(p(this,Fl,!0),this.onSetModified?.())};z0=class extends Gf{constructor(e){super();g(this,Sp,Hf);let{serializable:i}=e;if(i===Hf)return;let{map:n,hash:s,transfer:o}=i,l=structuredClone(n,o?{transfer:o}:null);p(this,Sp,{map:l,hash:s,transfer:[]})}get print(){se("Should not call PrintAnnotationStorage.print")}get serializable(){return a(this,Sp)}get modifiedIds(){return Ot(this,"modifiedIds",{ids:new Set,hash:""})}};Sp=new WeakMap;Tu="__forcedDependency",{floor:aC,ceil:oC}=Math;Ib=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],kb=class{constructor(t,e){g(this,lh);g(this,go);p(this,lh,t),p(this,go,e)}get length(){return a(this,lh).length}isEmpty(t){return a(this,lh)[t]===Ib}minX(t){return a(this,go)[t*4+0]/256}minY(t){return a(this,go)[t*4+1]/256}maxX(t){return(a(this,go)[t*4+2]+1)/256}maxY(t){return(a(this,go)[t*4+3]+1)/256}};lh=new WeakMap,go=new WeakMap;cC=(r,t)=>r?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),Nb=class{constructor(t,e){g(this,Dp);g(this,aa,[[1,0,0,1,0,0]]);g(this,re,[-1/0,-1/0,1/0,1/0]);g(this,de,new Float64Array([1/0,1/0,-1/0,-1/0]));j(this,"_pendingBBoxIdx",-1);g(this,Ol);g(this,Rl);g(this,Ll);g(this,ji);j(this,"_savesStack",[]);j(this,"_markedContentStack",[]);p(this,Ol,t.width),p(this,Rl,t.height),b(this,Dp,_b).call(this,e)}growOperationsCount(t){t>=a(this,ji).length&&b(this,Dp,_b).call(this,t,a(this,ji))}get clipBox(){return a(this,re)}save(t){return p(this,re,{__proto__:a(this,re)}),this._savesStack.push(t),this}restore(t,e){let i=Object.getPrototypeOf(a(this,re));if(i===null)return this;p(this,re,i);let n=this._savesStack.pop();return n!==void 0&&(e?.(n,t),a(this,ji)[t]=a(this,ji)[n]),this}recordOpenMarker(t){return this._savesStack.push(t),this}getOpenMarker(){return this._savesStack.length===0?null:this._savesStack.at(-1)}recordCloseMarker(t,e){let i=this._savesStack.pop();return i!==void 0&&(e?.(i,t),a(this,ji)[t]=a(this,ji)[i]),this}beginMarkedContent(t){return this._markedContentStack.push(t),this}endMarkedContent(t,e){let i=this._markedContentStack.pop();return i!==void 0&&(e?.(i,t),a(this,ji)[t]=a(this,ji)[i]),this}pushBaseTransform(t){return a(this,aa).push(mt.multiplyByDOMMatrix(a(this,aa).at(-1),t.getTransform())),this}popBaseTransform(){return a(this,aa).length>1&&a(this,aa).pop(),this}resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,a(this,de)[0]=1/0,a(this,de)[1]=1/0,a(this,de)[2]=-1/0,a(this,de)[3]=-1/0),this}recordClipBox(t,e,i,n,s,o){let l=mt.multiplyByDOMMatrix(a(this,aa).at(-1),e.getTransform()),c=[1/0,1/0,-1/0,-1/0];mt.axialAlignedBoundingBox([i,s,n,o],l,c);let u=mt.intersect(a(this,re),c);return u?(a(this,re)[0]=u[0],a(this,re)[1]=u[1],a(this,re)[2]=u[2],a(this,re)[3]=u[3]):(a(this,re)[0]=a(this,re)[1]=1/0,a(this,re)[2]=a(this,re)[3]=-1/0),this}recordBBox(t,e,i,n,s,o){let l=a(this,re);if(l[0]===1/0)return this;let c=mt.multiplyByDOMMatrix(a(this,aa).at(-1),e.getTransform());if(l[0]===-1/0)return mt.axialAlignedBoundingBox([i,s,n,o],c,a(this,de)),this;let u=[1/0,1/0,-1/0,-1/0];return mt.axialAlignedBoundingBox([i,s,n,o],c,u),a(this,de)[0]=Math.min(a(this,de)[0],Math.max(u[0],l[0])),a(this,de)[1]=Math.min(a(this,de)[1],Math.max(u[1],l[1])),a(this,de)[2]=Math.max(a(this,de)[2],Math.min(u[2],l[2])),a(this,de)[3]=Math.max(a(this,de)[3],Math.min(u[3],l[3])),this}recordFullPageBBox(t){return a(this,de)[0]=Math.max(0,a(this,re)[0]),a(this,de)[1]=Math.max(0,a(this,re)[1]),a(this,de)[2]=Math.min(a(this,Ol),a(this,re)[2]),a(this,de)[3]=Math.min(a(this,Rl),a(this,re)[3]),this}recordOperation(t,e=!1,i){if(this._pendingBBoxIdx!==t)return this;let n=aC(a(this,de)[0]*256/a(this,Ol)),s=aC(a(this,de)[1]*256/a(this,Rl)),o=oC(a(this,de)[2]*256/a(this,Ol)),l=oC(a(this,de)[3]*256/a(this,Rl));if(lC(a(this,Ll),t,n,s,o,l),i)for(let c of i)for(let u of c)u!==t&&lC(a(this,Ll),u,n,s,o,l);return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,a(this,re)[0]=Math.max(a(this,re)[0],a(this,de)[0]),a(this,re)[1]=Math.max(a(this,re)[1],a(this,de)[1]),a(this,re)[2]=Math.min(a(this,re)[2],a(this,de)[2]),a(this,re)[3]=Math.min(a(this,re)[3],a(this,de)[3])),this}take(){return new kb(a(this,ji),a(this,Ll))}takeDebugMetadata(){throw new Error("Unreachable")}recordSimpleData(t,e){return this}recordIncrementalData(t,e){return this}resetIncrementalData(t,e){return this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return this}recordFutureForcedDependency(t,e){return this}inheritSimpleDataAsFutureForcedDependencies(t){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(t,e,i,n=1,s=0,o=0,l){return this}getSimpleIndex(t){}recordDependencies(t,e){return this}recordNamedDependency(t,e){return this}recordShowTextOperation(t,e=!1){return this}};aa=new WeakMap,re=new WeakMap,de=new WeakMap,Ol=new WeakMap,Rl=new WeakMap,Ll=new WeakMap,ji=new WeakMap,Dp=new WeakSet,_b=function(t,e){let i=new ArrayBuffer(t*4);p(this,Ll,new Uint8ClampedArray(i)),p(this,ji,new Uint32Array(i)),e&&e.length>0?(a(this,ji).set(e),a(this,ji).fill(Ib,e.length)):a(this,ji).fill(Ib)};Mb=class{constructor(t,e=!1){g(this,pn,{__proto__:null});g(this,mn,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Tu]:[]});g(this,Bl,new Map);g(this,Ir,new Set);g(this,ch,new Map);g(this,yo);g(this,xo);g(this,fe);p(this,fe,t),e&&(p(this,yo,new Map),p(this,xo,(i,n)=>{cC(a(this,yo),n).dependencies.add(i)}))}get clipBox(){return a(this,fe).clipBox}growOperationsCount(t){a(this,fe).growOperationsCount(t)}save(t){return p(this,pn,{__proto__:a(this,pn)}),p(this,mn,{__proto__:a(this,mn),transform:{__proto__:a(this,mn).transform},moveText:{__proto__:a(this,mn).moveText},sameLineText:{__proto__:a(this,mn).sameLineText},[Tu]:{__proto__:a(this,mn)[Tu]}}),a(this,fe).save(t),this}restore(t){a(this,fe).restore(t,a(this,xo));let e=Object.getPrototypeOf(a(this,pn));return e===null?this:(p(this,pn,e),p(this,mn,Object.getPrototypeOf(a(this,mn))),this)}recordOpenMarker(t){return a(this,fe).recordOpenMarker(t,a(this,xo)),this}getOpenMarker(){return a(this,fe).getOpenMarker()}recordCloseMarker(t){return a(this,fe).recordCloseMarker(t,a(this,xo)),this}beginMarkedContent(t){return a(this,fe).beginMarkedContent(t),this}endMarkedContent(t){return a(this,fe).endMarkedContent(t,a(this,xo)),this}pushBaseTransform(t){return a(this,fe).pushBaseTransform(t),this}popBaseTransform(){return a(this,fe).popBaseTransform(),this}recordSimpleData(t,e){return a(this,pn)[t]=e,this}recordIncrementalData(t,e){return a(this,mn)[t].push(e),this}resetIncrementalData(t,e){return a(this,mn)[t].length=0,this}recordNamedData(t,e){return a(this,Bl).set(t,e),this}recordSimpleDataFromNamed(t,e,i){a(this,pn)[t]=a(this,Bl).get(e)??i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Tu,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(let e of t)e in a(this,pn)&&this.recordFutureForcedDependency(e,a(this,pn)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let t of a(this,Ir))this.recordFutureForcedDependency(Tu,t);return this}resetBBox(t){return a(this,fe).resetBBox(t),this}recordClipBox(t,e,i,n,s,o){return a(this,fe).recordClipBox(t,e,i,n,s,o),this}recordBBox(t,e,i,n,s,o){return a(this,fe).recordBBox(t,e,i,n,s,o),this}recordCharacterBBox(t,e,i,n=1,s=0,o=0,l){let c=i.bbox,u,h;if(c&&(u=c[2]!==c[0]&&c[3]!==c[1]&&a(this,ch).get(i),u!==!1&&(h=[0,0,0,0],mt.axialAlignedBoundingBox(c,i.fontMatrix,h),(n!==1||s!==0||o!==0)&&mt.scaleMinMax([n,0,0,-n,s,o],h),u)))return this.recordBBox(t,e,h[0],h[2],h[1],h[3]);if(!l)return this.recordFullPageBBox(t);let d=l();return c&&h&&u===void 0&&(u=h[0]<=s-d.actualBoundingBoxLeft&&h[2]>=s+d.actualBoundingBoxRight&&h[1]<=o-d.actualBoundingBoxAscent&&h[3]>=o+d.actualBoundingBoxDescent,a(this,ch).set(i,u),u)?this.recordBBox(t,e,h[0],h[2],h[1],h[3]):this.recordBBox(t,e,s-d.actualBoundingBoxLeft,s+d.actualBoundingBoxRight,o-d.actualBoundingBoxAscent,o+d.actualBoundingBoxDescent)}recordFullPageBBox(t){return a(this,fe).recordFullPageBBox(t),this}getSimpleIndex(t){return a(this,pn)[t]}recordDependencies(t,e){let i=a(this,Ir),n=a(this,pn),s=a(this,mn);for(let o of e)o in a(this,pn)?i.add(n[o]):o in s&&s[o].forEach(i.add,i);return this}recordNamedDependency(t,e){return a(this,Bl).has(e)&&a(this,Ir).add(a(this,Bl).get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Tu]),a(this,yo)){let n=cC(a(this,yo),t),{dependencies:s}=n;a(this,Ir).forEach(s.add,s),a(this,fe)._savesStack.forEach(s.add,s),a(this,fe)._markedContentStack.forEach(s.add,s),s.delete(t),n.isRenderingOperation=!0}let i=!e&&t===a(this,fe)._pendingBBoxIdx;return a(this,fe).recordOperation(t,e,[a(this,Ir),a(this,fe)._savesStack,a(this,fe)._markedContentStack]),i&&a(this,Ir).clear(),this}recordShowTextOperation(t,e=!1){let i=Array.from(a(this,Ir));this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t);for(let n of i)this.recordIncrementalData("sameLineText",n);return this}bboxToClipBoxDropOperation(t,e=!1){let i=!e&&t===a(this,fe)._pendingBBoxIdx;return a(this,fe).bboxToClipBoxDropOperation(t),i&&a(this,Ir).clear(),this}take(){return a(this,ch).clear(),a(this,fe).take()}takeDebugMetadata(){return a(this,yo)}};pn=new WeakMap,mn=new WeakMap,Bl=new WeakMap,Ir=new WeakMap,ch=new WeakMap,yo=new WeakMap,xo=new WeakMap,fe=new WeakMap;jw=class jw{constructor(t,e,i){g(this,pe);g(this,Be);g(this,kr);g(this,uh,0);g(this,hh,0);if(t instanceof jw&&a(t,kr)===!!i)return t;p(this,pe,t),p(this,Be,e),p(this,kr,!!i)}get clipBox(){return a(this,pe).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(t){return Ze(this,hh)._++,a(this,pe).save(a(this,Be)),this}restore(t){return a(this,hh)>0&&(a(this,pe).restore(a(this,Be)),Ze(this,hh)._--),this}recordOpenMarker(t){return Ze(this,uh)._++,this}getOpenMarker(){return a(this,uh)>0?a(this,Be):a(this,pe).getOpenMarker()}recordCloseMarker(t){return Ze(this,uh)._--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return a(this,pe).pushBaseTransform(t),this}popBaseTransform(){return a(this,pe).popBaseTransform(),this}recordSimpleData(t,e){return a(this,pe).recordSimpleData(t,a(this,Be)),this}recordIncrementalData(t,e){return a(this,pe).recordIncrementalData(t,a(this,Be)),this}resetIncrementalData(t,e){return a(this,pe).resetIncrementalData(t,a(this,Be)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return a(this,pe).recordSimpleDataFromNamed(t,e,a(this,Be)),this}recordFutureForcedDependency(t,e){return a(this,pe).recordFutureForcedDependency(t,a(this,Be)),this}inheritSimpleDataAsFutureForcedDependencies(t){return a(this,pe).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return a(this,pe).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return a(this,kr)||a(this,pe).resetBBox(a(this,Be)),this}recordClipBox(t,e,i,n,s,o){return a(this,kr)||a(this,pe).recordClipBox(a(this,Be),e,i,n,s,o),this}recordBBox(t,e,i,n,s,o){return a(this,kr)||a(this,pe).recordBBox(a(this,Be),e,i,n,s,o),this}recordCharacterBBox(t,e,i,n,s,o,l){return a(this,kr)||a(this,pe).recordCharacterBBox(a(this,Be),e,i,n,s,o,l),this}recordFullPageBBox(t){return a(this,kr)||a(this,pe).recordFullPageBBox(a(this,Be)),this}getSimpleIndex(t){return a(this,pe).getSimpleIndex(t)}recordDependencies(t,e){return a(this,pe).recordDependencies(a(this,Be),e),this}recordNamedDependency(t,e){return a(this,pe).recordNamedDependency(a(this,Be),e),this}recordOperation(t){return a(this,pe).recordOperation(a(this,Be),!0),this}recordShowTextOperation(t){return a(this,pe).recordShowTextOperation(a(this,Be),!0),this}bboxToClipBoxDropOperation(t){return a(this,kr)||a(this,pe).bboxToClipBoxDropOperation(a(this,Be),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};pe=new WeakMap,Be=new WeakMap,kr=new WeakMap,uh=new WeakMap,hh=new WeakMap;j0=jw,nr={stroke:["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],fill:["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],imageXObject:["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],rawFillPath:["filter","fillColor","fillAlpha"],showText:["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],transform:["transform"],transformAndFill:["transform","fillColor"]},Of=class Of{constructor(t){g(this,Ul);g(this,zl);g(this,jl,4);g(this,Hl,0);g(this,Gl,new(a(Of,Ip))(a(this,jl)*6));p(this,Ul,t.width),p(this,zl,t.height)}record(t,e,i,n){if(a(this,Hl)===a(this,jl)){p(this,jl,a(this,jl)*2);let l=new(a(Of,Ip))(a(this,jl)*6);l.set(a(this,Gl)),p(this,Gl,l)}let s=mt.domMatrixToTransform(t.getTransform()),o;if(n[0]!==1/0){let l=[1/0,1/0,-1/0,-1/0];mt.axialAlignedBoundingBox([0,-i,e,0],s,l);let c=mt.intersect(n,l);if(!c)return;let[u,h,d,f]=c;if(u!==l[0]||h!==l[1]||d!==l[2]||f!==l[3]){let m=Math.atan2(s[1],s[0]),x=Math.abs(Math.sin(m)),y=Math.abs(Math.cos(m));if(x<1e-6||y<1e-6||Math.abs(x-y)<1e-6)o=[u,h,u,f,d,h];else{let A=d-u,w=f-h,v=x*x,C=y*y,D=y*x,_=C-v,k=(w*C-A*D)/_,R=(w*D-A*v)/_;o=[u+R,h,u,h+k,d,f-k]}}}o||(o=[0,-i,0,0,e,-i],mt.applyTransform(o,s,0),mt.applyTransform(o,s,2),mt.applyTransform(o,s,4)),o[0]/=a(this,Ul),o[1]/=a(this,zl),o[2]/=a(this,Ul),o[3]/=a(this,zl),o[4]/=a(this,Ul),o[5]/=a(this,zl),a(this,Gl).set(o,a(this,Hl)*6),Ze(this,Hl)._++}take(){return a(this,Gl).subarray(0,a(this,Hl)*6)}};Ul=new WeakMap,zl=new WeakMap,jl=new WeakMap,Hl=new WeakMap,Gl=new WeakMap,Ip=new WeakMap,g(Of,Ip,je.isFloat16ArraySupported?Float16Array:Float32Array);Fb=Of,Pb=class{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){g(this,dh,new Set);this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),a(this,dh).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:i}){if(!(!t||a(this,dh).has(t.loadedName))){if(Me(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:n,src:s,style:o}=t,l=new FontFace(n,s,o);this.addNativeFontFace(l);try{await l.load(),a(this,dh).add(n),i?.(t)}catch{Ut(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}se("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){let i=t.createNativeFontFace();if(i){this.addNativeFontFace(i);try{await i.loaded}catch(n){throw Ut(`Failed to load font '${i.family}': '${n}'.`),t.disableFontFace=!0,n}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(i=>{let n=this._queueLoadingCallback(i);this._prepareFontLoadEvent(t,n)})}}get isFontLoadingAPISupported(){let t=!!this._document?.fonts;return Ot(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return Ot(this,"isSyncFontLoadingSupported",Hn||je.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(Me(!n.done,"completeRequest() cannot be called twice."),n.done=!0;i.length>0&&i[0].done;){let s=i.shift();setTimeout(s.callback,0)}}let{loadingRequests:i}=this,n={done:!1,complete:e,callback:t};return i.push(n),n}get _loadTestFont(){let t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return Ot(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function i(D,_){return D.charCodeAt(_)<<24|D.charCodeAt(_+1)<<16|D.charCodeAt(_+2)<<8|D.charCodeAt(_+3)&255}function n(D,_,k,R){let K=D.substring(0,_),W=D.substring(_+k);return K+R+W}let s,o,l=this._document.createElement("canvas");l.width=1,l.height=1;let c=l.getContext("2d"),u=0;function h(D,_){if(++u>30){Ut("Load test font never loaded."),_();return}if(c.font="30px "+D,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){_();return}setTimeout(h.bind(null,D,_))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=n(f,976,d.length,d);let x=16,y=1482184792,A=i(f,x);for(s=0,o=d.length-3;s<o;s+=4)A=A-y+i(d,s)|0;s<d.length&&(A=A-y+i(d+"XXX",s)|0),f=n(f,x,4,J_(A));let w=`url(data:font/opentype;base64,${btoa(f)});`,v=`@font-face {font-family:"${d}";src:${w}}`;this.insertRule(v);let C=this._document.createElement("div");C.style.visibility="hidden",C.style.width=C.style.height="10px",C.style.position="absolute",C.style.top=C.style.left="0px";for(let D of[t.loadedName,d]){let _=this._document.createElement("span");_.textContent="Hi",_.style.fontFamily=D,C.append(_)}this._document.body.append(C),h(d,()=>{C.remove(),e.complete()})}};dh=new WeakMap;Ob=class{constructor(t,e=null,i,n){j(this,"compiledGlyphs",Object.create(null));g(this,me);p(this,me,t),this._inspectFont=e,i&&(this.charProcOperatorList=i),n&&Object.assign(this,n)}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{let e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let t=`url(data:${this.mimetype};base64,${this.data.toBase64()});`,e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${t}}`}return this._inspectFont?.(this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let i=this.loadedName+"_path_"+e,n;try{n=t.get(i)}catch(o){Ut(`getPathGenerator - ignoring character: "${o}".`)}let s=MC(n?.path);return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=s}get black(){return a(this,me).black}get bold(){return a(this,me).bold}get disableFontFace(){return a(this,me).disableFontFace}set disableFontFace(t){Ot(this,"disableFontFace",!!t)}get fontExtraProperties(){return a(this,me).fontExtraProperties}get isInvalidPDFjsFont(){return a(this,me).isInvalidPDFjsFont}get isType3Font(){return a(this,me).isType3Font}get italic(){return a(this,me).italic}get missingFile(){return a(this,me).missingFile}get remeasure(){return a(this,me).remeasure}get vertical(){return a(this,me).vertical}get ascent(){return a(this,me).ascent}get defaultWidth(){return a(this,me).defaultWidth}get descent(){return a(this,me).descent}get bbox(){return a(this,me).bbox}get fontMatrix(){return a(this,me).fontMatrix}get fallbackName(){return a(this,me).fallbackName}get loadedName(){return a(this,me).loadedName}get mimetype(){return a(this,me).mimetype}get name(){return a(this,me).name}get data(){return a(this,me).data}clearData(){a(this,me).clearData()}get cssFontInfo(){return a(this,me).cssFontInfo}get systemFontInfo(){return a(this,me).systemFontInfo}get defaultVMetrics(){return a(this,me).defaultVMetrics}};me=new WeakMap;t0=class{};j(t0,"strings",["fontFamily","fontWeight","italicAngle"]);e0=class{};j(e0,"strings",["css","loadedName","baseFontName","src"]);Bi=class Bi{};j(Bi,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),j(Bi,"numbers",["ascent","defaultWidth","descent"]),j(Bi,"strings",["fallbackName","loadedName","mimetype","name"]),j(Bi,"OFFSET_NUMBERS",Math.ceil(Bi.bools.length*2/8)),j(Bi,"OFFSET_BBOX",Bi.OFFSET_NUMBERS+Bi.numbers.length*8),j(Bi,"OFFSET_FONT_MATRIX",Bi.OFFSET_BBOX+1+8),j(Bi,"OFFSET_DEFAULT_VMETRICS",Bi.OFFSET_FONT_MATRIX+1+48),j(Bi,"OFFSET_STRINGS",Bi.OFFSET_DEFAULT_VMETRICS+1+6);vn=Bi,wi=class{};j(wi,"KIND",0),j(wi,"HAS_BBOX",1),j(wi,"HAS_BACKGROUND",2),j(wi,"SHADING_TYPE",3),j(wi,"N_COORD",4),j(wi,"N_COLOR",8),j(wi,"N_STOP",12),j(wi,"N_FIGURES",16);Rb=class{constructor(t){g(this,ph);g(this,kp);g(this,xy,new TextDecoder);g(this,fh);p(this,kp,t),p(this,fh,new DataView(t))}get fontFamily(){return b(this,ph,i0).call(this,0)}get fontWeight(){return b(this,ph,i0).call(this,1)}get italicAngle(){return b(this,ph,i0).call(this,2)}};kp=new WeakMap,xy=new WeakMap,fh=new WeakMap,ph=new WeakSet,i0=function(t){Me(t<t0.strings.length,"Invalid string index");let e=0;for(let n=0;n<t;n++)e+=a(this,fh).getUint32(e)+4;let i=a(this,fh).getUint32(e);return a(this,xy).decode(new Uint8Array(a(this,kp),e+4,i))};Lb=class{constructor(t){g(this,Vl);g(this,$l);g(this,mh,new TextDecoder);g(this,fs);p(this,$l,t),p(this,fs,new DataView(t))}get guessFallback(){return a(this,fs).getUint8(0)!==0}get css(){return b(this,Vl,pf).call(this,0)}get loadedName(){return b(this,Vl,pf).call(this,1)}get baseFontName(){return b(this,Vl,pf).call(this,2)}get src(){return b(this,Vl,pf).call(this,3)}get style(){let t=1;t+=4+a(this,fs).getUint32(t);let e=a(this,fs).getUint32(t),i=a(this,mh).decode(new Uint8Array(a(this,$l),t+4,e));t+=4+e;let n=a(this,fs).getUint32(t),s=a(this,mh).decode(new Uint8Array(a(this,$l),t+4,n));return{style:i,weight:s}}};$l=new WeakMap,mh=new WeakMap,fs=new WeakMap,Vl=new WeakSet,pf=function(t){Me(t<e0.strings.length,"Invalid string index");let e=5;for(let n=0;n<t;n++)e+=a(this,fs).getUint32(e)+4;let i=a(this,fs).getUint32(e);return a(this,mh).decode(new Uint8Array(a(this,$l),e+4,i))};Bb=class{constructor({buffer:t,extra:e}){g(this,ue);g(this,Nr);g(this,by,new TextDecoder);g(this,Xe);p(this,Nr,t),p(this,Xe,new DataView(t)),e&&Object.assign(this,e)}get black(){return b(this,ue,Cr).call(this,0)}get bold(){return b(this,ue,Cr).call(this,1)}get disableFontFace(){return b(this,ue,Cr).call(this,2)}get fontExtraProperties(){return b(this,ue,Cr).call(this,3)}get isInvalidPDFjsFont(){return b(this,ue,Cr).call(this,4)}get isType3Font(){return b(this,ue,Cr).call(this,5)}get italic(){return b(this,ue,Cr).call(this,6)}get missingFile(){return b(this,ue,Cr).call(this,7)}get remeasure(){return b(this,ue,Cr).call(this,8)}get vertical(){return b(this,ue,Cr).call(this,9)}get ascent(){return b(this,ue,n0).call(this,0)}get defaultWidth(){return b(this,ue,n0).call(this,1)}get descent(){return b(this,ue,n0).call(this,2)}get bbox(){return b(this,ue,r0).call(this,vn.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return b(this,ue,r0).call(this,vn.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return b(this,ue,r0).call(this,vn.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}get fallbackName(){return b(this,ue,mf).call(this,0)}get loadedName(){return b(this,ue,mf).call(this,1)}get mimetype(){return b(this,ue,mf).call(this,2)}get name(){return b(this,ue,mf).call(this,3)}get data(){let{offset:t,length:e}=b(this,ue,Ub).call(this);return e===0?void 0:new Uint8Array(a(this,Nr),t+4,e)}clearData(){let{offset:t,length:e}=b(this,ue,Ub).call(this);e!==0&&(a(this,Xe).setUint32(t,0),p(this,Nr,new Uint8Array(a(this,Nr),0,t+4).slice().buffer),p(this,Xe,new DataView(a(this,Nr))))}get cssFontInfo(){let t=vn.OFFSET_STRINGS,e=a(this,Xe).getUint32(t);t+=4+e;let i=a(this,Xe).getUint32(t);t+=4+i;let n=a(this,Xe).getUint32(t);if(n===0)return null;let s=new Uint8Array(n);return s.set(new Uint8Array(a(this,Nr),t+4,n)),new Rb(s.buffer)}get systemFontInfo(){let t=vn.OFFSET_STRINGS,e=a(this,Xe).getUint32(t);t+=4+e;let i=a(this,Xe).getUint32(t);if(i===0)return null;let n=new Uint8Array(i);return n.set(new Uint8Array(a(this,Nr),t+4,i)),new Lb(n.buffer)}};Nr=new WeakMap,by=new WeakMap,Xe=new WeakMap,ue=new WeakSet,Cr=function(t){Me(t<vn.bools.length,"Invalid boolean index");let e=Math.floor(t/4),i=t*2%8,n=a(this,Xe).getUint8(e)>>i&3;return n===0?void 0:n===2},n0=function(t){return Me(t<vn.numbers.length,"Invalid number index"),a(this,Xe).getFloat64(vn.OFFSET_NUMBERS+t*8)},r0=function(t,e,i,n){let s=a(this,Xe).getUint8(t);if(s===0)return;Me(s===e,"Invalid array length."),t+=1;let o=new Array(s);for(let l=0;l<s;l++)o[l]=a(this,Xe)[i](t,!0),t+=n;return o},mf=function(t){Me(t<vn.strings.length,"Invalid string index");let e=vn.OFFSET_STRINGS+4;for(let n=0;n<t;n++)e+=a(this,Xe).getUint32(e)+4;let i=a(this,Xe).getUint32(e);return a(this,by).decode(new Uint8Array(a(this,Nr),e+4,i))},Ub=function(){let t=vn.OFFSET_STRINGS,e=a(this,Xe).getUint32(t);t+=4+e;let i=a(this,Xe).getUint32(t);t+=4+i;let n=a(this,Xe).getUint32(t);t+=4+n;let s=a(this,Xe).getUint32(t);return{offset:t,length:s}};zb=class{constructor(t){this.buffer=t,this.view=new DataView(t),this.data=new Uint8Array(t)}getIR(){let t=this.view,e=this.data[wi.KIND],i=!!this.data[wi.HAS_BBOX],n=!!this.data[wi.HAS_BACKGROUND],s=t.getUint32(wi.N_COORD,!0),o=t.getUint32(wi.N_COLOR,!0),l=t.getUint32(wi.N_STOP,!0),c=t.getUint32(wi.N_FIGURES,!0),u=20,h=new Float32Array(this.buffer,u,s*2);u+=s*8;let d=new Uint8Array(this.buffer,u,o*3);u+=o*3;let f=[];for(let A=0;A<l;++A){let w=t.getFloat32(u,!0);u+=4;let v=t.getUint32(u,!0);u+=4,f.push([w,`#${v.toString(16).padStart(6,"0")}`])}let m=null;if(i){m=[];for(let A=0;A<4;++A)m.push(t.getFloat32(u,!0)),u+=4}let x=null;n&&(x=new Uint8Array(this.buffer,u,3),u+=3);let y=[];for(let A=0;A<c;++A){let w=t.getUint8(u);u+=1,u=Math.ceil(u/4)*4;let v=t.getUint32(u,!0);u+=4;let C=new Int32Array(this.buffer,u,v);u+=v*4;let D=t.getUint32(u,!0);u+=4;let _=new Int32Array(this.buffer,u,D);u+=D*4;let k={type:w,coords:C,colors:_};w===pl.LATTICE&&(k.verticesPerRow=t.getUint32(u,!0),u+=4),y.push(k)}if(e===1)return["RadialAxial","axial",m,f,Array.from(h.slice(0,2)),Array.from(h.slice(2,4)),null,null];if(e===2)return["RadialAxial","radial",m,f,[h[0],h[1]],[h[3],h[4]],h[2],h[5]];if(e===3){let A=this.data[wi.SHADING_TYPE],w=null;if(h.length>0){w=[1/0,1/0,-1/0,-1/0];for(let v=0,C=h.length;v<C;v+=2)mt.pointBoundingBox(h[v],h[v+1],w)}return["Mesh",A,h,d,y,w,m,x]}throw new Error(`Unsupported pattern kind: ${e}`)}},jb=class{constructor(t){g(this,gh);p(this,gh,t)}get path(){return je.isFloat16ArraySupported?new Float16Array(a(this,gh)):new Float32Array(a(this,gh))}};gh=new WeakMap;Hb=r=>typeof r=="object"&&Number.isInteger(r?.num)&&r.num>=0&&Number.isInteger(r?.gen)&&r.gen>=0,lM=r=>typeof r=="object"&&typeof r?.name=="string",dT=nM.bind(null,Hb,lM),Gb=class{constructor(){g(this,oa,new Map);g(this,wy,Promise.resolve())}postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};a(this,wy).then(()=>{for(let[n]of a(this,oa))n.call(this,i)})}addEventListener(t,e,i=null){let n=null;if(i?.signal instanceof AbortSignal){let{signal:s}=i;if(s.aborted){Ut("LoopbackPort - cannot use an `aborted` signal.");return}let o=()=>this.removeEventListener(t,e);n=()=>s.removeEventListener("abort",o),s.addEventListener("abort",o)}a(this,oa).set(e,n)}removeEventListener(t,e){a(this,oa).get(e)?.(),a(this,oa).delete(e)}terminate(){for(let[,t]of a(this,oa))t?.();a(this,oa).clear()}};oa=new WeakMap,wy=new WeakMap;zg={DATA:1,ERROR:2},ti={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};ml=class{constructor(t,e,i){g(this,wr);g(this,yh,new AbortController);this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",b(this,wr,fT).bind(this),{signal:a(this,yh).signal})}on(t,e){let i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){let n=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[n]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:n,data:e},i)}catch(o){s.reject(o)}return s.promise}sendWithStream(t,e,i,n){let s=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:u=>{let h=Promise.withResolvers();return this.streamControllers[s]={controller:u,startCall:h,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:o,targetName:l,action:t,streamId:s,data:e,desiredSize:u.desiredSize},n),h.promise},pull:u=>{let h=Promise.withResolvers();return this.streamControllers[s].pullCall=h,c.postMessage({sourceName:o,targetName:l,stream:ti.PULL,streamId:s,desiredSize:u.desiredSize}),h.promise},cancel:u=>{Me(u instanceof Error,"cancel must have a valid reason");let h=Promise.withResolvers();return this.streamControllers[s].cancelCall=h,this.streamControllers[s].isClosed=!0,c.postMessage({sourceName:o,targetName:l,stream:ti.CANCEL,streamId:s,reason:hn(u)}),h.promise}},i)}destroy(){a(this,yh)?.abort(),p(this,yh,null)}};yh=new WeakMap,wr=new WeakSet,fT=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){b(this,wr,mT).call(this,t);return}if(t.callback){let i=t.callbackId,n=this.callbackCapabilities[i];if(!n)throw new Error(`Cannot resolve callback ${i}`);if(delete this.callbackCapabilities[i],t.callback===zg.DATA)n.resolve(t.data);else if(t.callback===zg.ERROR)n.reject(hn(t.reason));else throw new Error("Unexpected callback case");return}let e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){let i=this.sourceName,n=t.sourceName,s=this.comObj;Promise.try(e,t.data).then(function(o){s.postMessage({sourceName:i,targetName:n,callback:zg.DATA,callbackId:t.callbackId,data:o})},function(o){s.postMessage({sourceName:i,targetName:n,callback:zg.ERROR,callbackId:t.callbackId,reason:hn(o)})});return}if(t.streamId){b(this,wr,pT).call(this,t);return}e(t.data)},pT=function(t){let e=t.streamId,i=this.sourceName,n=t.sourceName,s=this.comObj,o=this,l=this.actionHandler[t.action],c={enqueue(u,h=1,d){if(this.isCancelled)return;let f=this.desiredSize;this.desiredSize-=h,f>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:i,targetName:n,stream:ti.ENQUEUE,streamId:e,chunk:u},d)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:ti.CLOSE,streamId:e}),delete o.streamSinks[e])},error(u){Me(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:ti.ERROR,streamId:e,reason:hn(u)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[e]=c,Promise.try(l,t.data,c).then(function(){s.postMessage({sourceName:i,targetName:n,stream:ti.START_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:ti.START_COMPLETE,streamId:e,reason:hn(u)})})},mT=function(t){let e=t.streamId,i=this.sourceName,n=t.sourceName,s=this.comObj,o=this.streamControllers[e],l=this.streamSinks[e];switch(t.stream){case ti.START_COMPLETE:t.success?o.startCall.resolve():o.startCall.reject(hn(t.reason));break;case ti.PULL_COMPLETE:t.success?o.pullCall.resolve():o.pullCall.reject(hn(t.reason));break;case ti.PULL:if(!l){s.postMessage({sourceName:i,targetName:n,stream:ti.PULL_COMPLETE,streamId:e,success:!0});break}l.desiredSize<=0&&t.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=t.desiredSize,Promise.try(l.onPull||uC).then(function(){s.postMessage({sourceName:i,targetName:n,stream:ti.PULL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:ti.PULL_COMPLETE,streamId:e,reason:hn(u)})});break;case ti.ENQUEUE:if(Me(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(t.chunk);break;case ti.CLOSE:if(Me(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),b(this,wr,s0).call(this,o,e);break;case ti.ERROR:Me(o,"error should have stream controller"),o.controller.error(hn(t.reason)),b(this,wr,s0).call(this,o,e);break;case ti.CANCEL_COMPLETE:t.success?o.cancelCall.resolve():o.cancelCall.reject(hn(t.reason)),b(this,wr,s0).call(this,o,e);break;case ti.CANCEL:if(!l)break;let c=hn(t.reason);Promise.try(l.onCancel||uC,c).then(function(){s.postMessage({sourceName:i,targetName:n,stream:ti.CANCEL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:ti.CANCEL_COMPLETE,streamId:e,reason:hn(u)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},s0=async function(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]};H0=class{constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:i=null}){g(this,Ay,Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"}));this.cMapUrl=t,this.standardFontDataUrl=e,this.wasmUrl=i}async fetch({kind:t,filename:e}){switch(t){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:se(`Not implemented: ${t}`)}let i=this[t];if(!i)throw new Error(`Ensure that the \`${t}\` API parameter is provided.`);let n=`${i}${e}`;return this._fetch(n,t).catch(s=>{throw new Error(`Unable to load ${a(this,Ay)[t]} data at: ${n}`)})}async _fetch(t,e){se("Abstract method `_fetch` called.")}};Ay=new WeakMap;G0=class extends H0{async _fetch(t,e){let i=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",n=await Uy(t,i);return n instanceof Uint8Array?n:Ry(n)}},$0=class{constructor({enableHWA:t=!1}){g(this,Np,!1);p(this,Np,t)}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");let i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!a(this,Np)})}}reset({canvas:t},e,i){if(!t)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.width=e,t.height=i}destroy(t){let{canvas:e}=t;if(!e)throw new Error("Canvas is not specified");e.width=e.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){se("Abstract method `_createCanvas` called.")}};Np=new WeakMap;$b=class extends $0{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){let i=this._document.createElement("canvas");return i.width=t,i.height=e,i}},V0=class{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,n,s){return"none"}destroy(t=!1){}},Vb=class extends V0{constructor({docId:e,ownerDocument:i=globalThis.document}){super();g(this,St);g(this,ql);g(this,xh);g(this,la);g(this,ca);g(this,Hi);g(this,Wl);g(this,Xl,0);p(this,ca,e),p(this,Hi,i)}addFilter(e){if(!e)return"none";let i=a(this,St,Li).get(e);if(i)return i;let[n,s,o]=b(this,St,a0).call(this,e),l=e.length===1?n:`${n}${s}${o}`;if(i=a(this,St,Li).get(l),i)return a(this,St,Li).set(e,i),i;let c=`g_${a(this,ca)}_transfer_map_${Ze(this,Xl)._++}`,u=b(this,St,ku).call(this,c);a(this,St,Li).set(e,u),a(this,St,Li).set(l,u);let h=b(this,St,Nu).call(this,c);return b(this,St,xf).call(this,n,s,o,h),u}addHCMFilter(e,i){let n=`${e}-${i}`,s="base",o=a(this,St,gf).get(s);if(o?.key===n||(o?(o.filter?.remove(),o.key=n,o.url="none",o.filter=null):(o={key:n,url:"none",filter:null},a(this,St,gf).set(s,o)),!e||!i))return o.url;let l=b(this,St,bf).call(this,e);e=mt.makeHexColor(...l);let c=b(this,St,bf).call(this,i);if(i=mt.makeHexColor(...c),a(this,St,Iu).style.color="",e==="#000000"&&i==="#ffffff"||e===i)return o.url;let u=new Array(256);for(let x=0;x<=255;x++){let y=x/255;u[x]=y<=.03928?y/12.92:((y+.055)/1.055)**2.4}let h=u.join(","),d=`g_${a(this,ca)}_hcm_filter`,f=o.filter=b(this,St,Nu).call(this,d);b(this,St,xf).call(this,h,h,h,f),b(this,St,qb).call(this,f);let m=(x,y)=>{let A=l[x]/255,w=c[x]/255,v=new Array(y+1);for(let C=0;C<=y;C++)v[C]=A+C/y*(w-A);return v.join(",")};return b(this,St,xf).call(this,m(0,5),m(1,5),m(2,5),f),o.url=b(this,St,ku).call(this,d),o.url}addAlphaFilter(e){let i=a(this,St,Li).get(e);if(i)return i;let[n]=b(this,St,a0).call(this,[e]),s=`alpha_${n}`;if(i=a(this,St,Li).get(s),i)return a(this,St,Li).set(e,i),i;let o=`g_${a(this,ca)}_alpha_map_${Ze(this,Xl)._++}`,l=b(this,St,ku).call(this,o);a(this,St,Li).set(e,l),a(this,St,Li).set(s,l);let c=b(this,St,Nu).call(this,o);return b(this,St,Wb).call(this,n,c),l}addLuminosityFilter(e){let i=a(this,St,Li).get(e||"luminosity");if(i)return i;let n,s;if(e?([n]=b(this,St,a0).call(this,[e]),s=`luminosity_${n}`):s="luminosity",i=a(this,St,Li).get(s),i)return a(this,St,Li).set(e,i),i;let o=`g_${a(this,ca)}_luminosity_map_${Ze(this,Xl)._++}`,l=b(this,St,ku).call(this,o);a(this,St,Li).set(e,l),a(this,St,Li).set(s,l);let c=b(this,St,Nu).call(this,o);return b(this,St,gT).call(this,c),e&&b(this,St,Wb).call(this,n,c),l}addHighlightHCMFilter(e,i,n,s,o){let l=`${i}-${n}-${s}-${o}`,c=a(this,St,gf).get(e);if(c?.key===l||(c?(c.filter?.remove(),c.key=l,c.url="none",c.filter=null):(c={key:l,url:"none",filter:null},a(this,St,gf).set(e,c)),!i||!n))return c.url;let[u,h]=[i,n].map(b(this,St,bf).bind(this)),d=Math.round(.2126*u[0]+.7152*u[1]+.0722*u[2]),f=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[m,x]=[s,o].map(b(this,St,bf).bind(this));f<d&&([d,f,m,x]=[f,d,x,m]),a(this,St,Iu).style.color="";let y=(v,C,D)=>{let _=new Array(256),k=(f-d)/D,R=v/255,K=(C-v)/(255*D),W=0;for(let V=0;V<=D;V++){let U=Math.round(d+V*k),tt=R+V*K;for(let et=W;et<=U;et++)_[et]=tt;W=U+1}for(let V=W;V<256;V++)_[V]=_[W-1];return _.join(",")},A=`g_${a(this,ca)}_hcm_${e}_filter`,w=c.filter=b(this,St,Nu).call(this,A);return b(this,St,qb).call(this,w),b(this,St,xf).call(this,y(m[0],x[0],5),y(m[1],x[1],5),y(m[2],x[2],5),w),c.url=b(this,St,ku).call(this,A),c.url}destroy(e=!1){e&&a(this,Wl)?.size||(a(this,la)?.parentNode.parentNode.remove(),p(this,la,null),a(this,xh)?.clear(),p(this,xh,null),a(this,Wl)?.clear(),p(this,Wl,null),p(this,Xl,0))}};ql=new WeakMap,xh=new WeakMap,la=new WeakMap,ca=new WeakMap,Hi=new WeakMap,Wl=new WeakMap,Xl=new WeakMap,St=new WeakSet,Li=function(){return a(this,xh)||p(this,xh,new Map)},gf=function(){return a(this,Wl)||p(this,Wl,new Map)},Iu=function(){if(!a(this,la)){let e=a(this,Hi).createElement("div"),{style:i}=e;i.visibility="hidden",i.contain="strict",i.width=i.height=0,i.position="absolute",i.top=i.left=0,i.zIndex=-1;let n=a(this,Hi).createElementNS(Gs,"svg");n.setAttribute("width",0),n.setAttribute("height",0),p(this,la,a(this,Hi).createElementNS(Gs,"defs")),e.append(n),n.append(a(this,la)),a(this,Hi).body.append(e)}return a(this,la)},a0=function(e){if(e.length===1){let u=e[0],h=new Array(256);for(let f=0;f<256;f++)h[f]=u[f]/255;let d=h.join(",");return[d,d,d]}let[i,n,s]=e,o=new Array(256),l=new Array(256),c=new Array(256);for(let u=0;u<256;u++)o[u]=i[u]/255,l[u]=n[u]/255,c[u]=s[u]/255;return[o.join(","),l.join(","),c.join(",")]},ku=function(e){if(a(this,ql)===void 0){p(this,ql,"");let i=a(this,Hi).URL;i!==a(this,Hi).baseURI&&($m(i)?Ut('#createUrl: ignore "data:"-URL for performance reasons.'):p(this,ql,Ow(i,"")))}return`url(${a(this,ql)}#${e})`},gT=function(e){let i=a(this,Hi).createElementNS(Gs,"feColorMatrix");i.setAttribute("type","matrix"),i.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),e.append(i)},qb=function(e){let i=a(this,Hi).createElementNS(Gs,"feColorMatrix");i.setAttribute("type","matrix"),i.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),e.append(i)},Nu=function(e){let i=a(this,Hi).createElementNS(Gs,"filter");return i.setAttribute("color-interpolation-filters","sRGB"),i.setAttribute("id",e),a(this,St,Iu).append(i),i},yf=function(e,i,n){let s=a(this,Hi).createElementNS(Gs,i);s.setAttribute("type","discrete"),s.setAttribute("tableValues",n),e.append(s)},xf=function(e,i,n,s){let o=a(this,Hi).createElementNS(Gs,"feComponentTransfer");s.append(o),b(this,St,yf).call(this,o,"feFuncR",e),b(this,St,yf).call(this,o,"feFuncG",i),b(this,St,yf).call(this,o,"feFuncB",n)},Wb=function(e,i){let n=a(this,Hi).createElementNS(Gs,"feComponentTransfer");i.append(n),b(this,St,yf).call(this,n,"feFuncA",e)},bf=function(e){return a(this,St,Iu).style.color=e,Td(getComputedStyle(a(this,St,Iu)).getPropertyValue("color"))};Hn&&Ut("Please use the `legacy` build in Node.js environments.");Xb=class extends V0{},Yb=class extends $0{_createCanvas(t,e){return rt.default.getBuiltinModule("module").createRequire("")("@napi-rs/canvas").createCanvas(t,e)}},Kb=class extends H0{async _fetch(t,e){return cM(t)}},uM=`
16
+ struct Uniforms {
17
+ offsetX : f32,
18
+ offsetY : f32,
19
+ scaleX : f32,
20
+ scaleY : f32,
21
+ paddedWidth : f32,
22
+ paddedHeight : f32,
23
+ borderSize : f32,
24
+ _pad : f32,
25
+ };
26
+
27
+ @group(0) @binding(0) var<uniform> u : Uniforms;
28
+
29
+ struct VertexInput {
30
+ @location(0) position : vec2<f32>,
31
+ @location(1) color : vec4<f32>,
32
+ };
33
+
34
+ struct VertexOutput {
35
+ @builtin(position) position : vec4<f32>,
36
+ @location(0) color : vec3<f32>,
37
+ };
38
+
39
+ @vertex
40
+ fn vs_main(in : VertexInput) -> VertexOutput {
41
+ var out : VertexOutput;
42
+ let cx = (in.position.x + u.offsetX) * u.scaleX;
43
+ let cy = (in.position.y + u.offsetY) * u.scaleY;
44
+ out.position = vec4<f32>(
45
+ ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
46
+ 1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
47
+ 0.0,
48
+ 1.0
49
+ );
50
+ out.color = in.color.rgb;
51
+ return out;
52
+ }
53
+
54
+ @fragment
55
+ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
56
+ return vec4<f32>(in.color, 1.0);
57
+ }
58
+ `,Zb=class{constructor(){g(this,Ed);g(this,_p,null);g(this,bh,null);g(this,wh,null);g(this,Ah,null)}init(){a(this,_p)===null&&p(this,_p,b(this,Ed,yT).call(this))}get isReady(){return a(this,bh)!==null}draw(t,e,i,n,s,o){let l=a(this,bh),{offsetX:c,offsetY:u,scaleX:h,scaleY:d}=e,{posData:f,colData:m,vertexCount:x}=b(this,Ed,xT).call(this,t,e),y=l.createBuffer({size:Math.max(f.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});f.byteLength>0&&l.queue.writeBuffer(y,0,f);let A=l.createBuffer({size:Math.max(m.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});m.byteLength>0&&l.queue.writeBuffer(A,0,m);let w=l.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});l.queue.writeBuffer(w,0,new Float32Array([c,u,h,d,n,s,o,0]));let v=l.createBindGroup({layout:a(this,wh).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:w}}]}),C=new OffscreenCanvas(n,s),D=C.getContext("webgpu");D.configure({device:l,format:a(this,Ah),alphaMode:i?"opaque":"premultiplied"});let _=i?{r:i[0]/255,g:i[1]/255,b:i[2]/255,a:1}:{r:0,g:0,b:0,a:0},k=l.createCommandEncoder(),R=k.beginRenderPass({colorAttachments:[{view:D.getCurrentTexture().createView(),clearValue:_,loadOp:"clear",storeOp:"store"}]});return x>0&&(R.setPipeline(a(this,wh)),R.setBindGroup(0,v),R.setVertexBuffer(0,y),R.setVertexBuffer(1,A),R.draw(x)),R.end(),l.queue.submit([k.finish()]),y.destroy(),A.destroy(),w.destroy(),C.transferToImageBitmap()}};_p=new WeakMap,bh=new WeakMap,wh=new WeakMap,Ah=new WeakMap,Ed=new WeakSet,yT=async function(){if(!globalThis.navigator?.gpu)return!1;try{let t=await navigator.gpu.requestAdapter();if(!t)return!1;p(this,Ah,navigator.gpu.getPreferredCanvasFormat());let e=p(this,bh,await t.requestDevice()),i=e.createShaderModule({code:uM});return p(this,wh,e.createRenderPipeline({layout:"auto",vertex:{module:i,entryPoint:"vs_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:i,entryPoint:"fs_main",targets:[{format:a(this,Ah)}]},primitive:{topology:"triangle-list"}})),!0}catch{return!1}},xT=function(t,e){let{coords:i,colors:n}=e,s=0;for(let d of t){let f=d.coords;if(d.type===pl.TRIANGLES)s+=f.length;else if(d.type===pl.LATTICE){let m=d.verticesPerRow;s+=(Math.floor(f.length/m)-1)*(m-1)*6}}let o=new Float32Array(s*2),l=new Uint8Array(s*4),c=0,u=0,h=(d,f)=>{o[c++]=i[d*2],o[c++]=i[d*2+1],l[u++]=n[f*4],l[u++]=n[f*4+1],l[u++]=n[f*4+2],u++};for(let d of t){let f=d.coords,m=d.colors;if(d.type===pl.TRIANGLES)for(let x=0,y=f.length;x<y;x+=3)h(f[x],m[x]),h(f[x+1],m[x+1]),h(f[x+2],m[x+2]);else if(d.type===pl.LATTICE){let x=d.verticesPerRow,y=Math.floor(f.length/x)-1,A=x-1;for(let w=0;w<y;w++){let v=w*x;for(let C=0;C<A;C++,v++)h(f[v],m[v]),h(f[v+1],m[v+1]),h(f[v+x],m[v+x]),h(f[v+x+1],m[v+x+1]),h(f[v+1],m[v+1]),h(f[v+x],m[v+x])}}}return{posData:o,colData:l,vertexCount:s}};Bw=new Zb;Fi={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};$f=class{isModifyingCurrentTransform(){return!1}getPattern(){se("Abstract method `getPattern` called.")}},Qb=class extends $f{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}isOriginBased(){return this._p0[0]===0&&this._p0[1]===0&&(!this.isRadial()||this._p1[0]===0&&this._p1[1]===0)}isRadial(){return this._type==="radial"}_isCircleCenterOutside(){return!this.isRadial()||this._r0>this._r1?!1:Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1])>this._r1}_createGradient(t,e=null){let i,n=this._p0,s=this._p1;if(e&&(n=n.slice(),s=s.slice(),mt.applyTransform(n,e),mt.applyTransform(s,e)),this._type==="axial")i=t.createLinearGradient(n[0],n[1],s[0],s[1]);else if(this._type==="radial"){let o=this._r0,l=this._r1;if(e){let c=new Float32Array(2);mt.singularValueDecompose2dScale(e,c),o*=c[0],l*=c[0]}i=t.createRadialGradient(n[0],n[1],o,s[0],s[1],l)}for(let o of this._colorStops)i.addColorStop(o[0],o[1]);return i}_createReversedGradient(t,e=null){let i=this._p1,n=this._p0;e&&(i=i.slice(),n=n.slice(),mt.applyTransform(i,e),mt.applyTransform(n,e));let s=this._r1,o=this._r0;if(e){let u=new Float32Array(2);mt.singularValueDecompose2dScale(e,u),s*=u[0],o*=u[0]}let l=t.createRadialGradient(i[0],i[1],s,n[0],n[1],o),c=this._colorStops.map(([u,h])=>[1-u,h]).reverse();for(let[u,h]of c)l.addColorStop(u,h);return l}getPattern(t,e,i,n){let s;if(n===Fi.STROKE||n===Fi.FILL){if(this.isOriginBased()){let f=mt.transform(i,e.baseTransform);this.matrix&&(f=mt.transform(f,this.matrix));let m=.001,x=Math.hypot(f[0],f[1]),y=Math.hypot(f[2],f[3]),A=(f[0]*f[2]+f[1]*f[3])/(x*y);if(Math.abs(A)<m)if(this.isRadial()){if(Math.abs(x-y)<m)return this._createGradient(t,f)}else return this._createGradient(t,f)}let o=e.current.getClippedPathBoundingBox(n,Ne(t))||[0,0,0,0],l=Math.ceil(o[2]-o[0])||1,c=Math.ceil(o[3]-o[1])||1,u=e.canvasFactory.create(l,c),h=u.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-o[0],-o[1]),i=mt.transform(i,[1,0,0,1,o[0],o[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),o0(h,this._bbox),this._isCircleCenterOutside()&&(h.fillStyle=this._createReversedGradient(h),h.fill()),h.fillStyle=this._createGradient(h),h.fill(),s=t.createPattern(u.canvas,"no-repeat"),e.canvasFactory.destroy(u);let d=new DOMMatrix(i);s.setTransform(d)}else this._isCircleCenterOutside()&&(t.save(),o0(t,this._bbox),t.fillStyle=this._createReversedGradient(t),t.fillRect(-1e10,-1e10,2e10,2e10),t.restore()),o0(t,this._bbox),s=this._createGradient(t);return s}};Jb=class extends $f{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null}_createMeshCanvas(t,e,i){let l=Math.floor(this._bounds[0]),c=Math.floor(this._bounds[1]),u=Math.ceil(this._bounds[2])-l,h=Math.ceil(this._bounds[3])-c,d=Math.min(Math.ceil(Math.abs(u*t[0]*1.1)),3e3)||1,f=Math.min(Math.ceil(Math.abs(h*t[1]*1.1)),3e3)||1,m=u?u/d:1,x=h?h/f:1,y={coords:this._coords,colors:this._colors,offsetX:-l,offsetY:-c,scaleX:1/m,scaleY:1/x},A=d+4,w=f+4,v=i.create(A,w);if(dM())v.context.drawImage(fM(this._figures,y,e,A,w,2),0,0);else{let C=v.context.createImageData(d,f);if(e){let D=C.data;for(let _=0,k=D.length;_<k;_+=4)D[_]=e[0],D[_+1]=e[1],D[_+2]=e[2],D[_+3]=255}for(let D of this._figures)pM(C,D,y);v.context.putImageData(C,2,2)}return{canvas:v.canvas,offsetX:l-2*m,offsetY:c-2*x,scaleX:m,scaleY:x}}isModifyingCurrentTransform(){return!0}getPattern(t,e,i,n){o0(t,this._bbox);let s=new Float32Array(2);if(n===Fi.SHADING)mt.singularValueDecompose2dScale(Ne(t),s);else if(this.matrix){mt.singularValueDecompose2dScale(this.matrix,s);let[c,u]=s;mt.singularValueDecompose2dScale(e.baseTransform,s),s[0]*=c,s[1]*=u}else mt.singularValueDecompose2dScale(e.baseTransform,s);let o=this._createMeshCanvas(s,n===Fi.SHADING?null:this._background,e.canvasFactory);n!==Fi.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(o.offsetX,o.offsetY),t.scale(o.scaleX,o.scaleY);let l=t.createPattern(o.canvas,"no-repeat");return e.canvasFactory.destroy(o),l}},t2=class extends $f{getPattern(){return"hotpink"}};hC={COLORED:1,UNCOLORED:2},vy=class vy{constructor(t,e,i,n){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.ctx=e,this.canvasGraphicsFactory=i,this.baseTransform=n}createPatternCanvas(t,e){let{bbox:i,operatorList:n,paintType:s,tilingType:o,color:l,canvasGraphicsFactory:c}=this,{xstep:u,ystep:h}=this;u=Math.abs(u),h=Math.abs(h),Oy("TilingType: "+o);let d=i[0],f=i[1],m=i[2],x=i[3],y=m-d,A=x-f,w=new Float32Array(2);mt.singularValueDecompose2dScale(this.matrix,w);let[v,C]=w;mt.singularValueDecompose2dScale(this.baseTransform,w);let D=v*w[0],_=C*w[1],k=y,R=A,K=!1,W=!1,V=Math.ceil(u*D),U=Math.ceil(h*_),tt=Math.ceil(y*D),et=Math.ceil(A*_);V>=tt?k=u:K=!0,U>=et?R=h:W=!0;let B=this.getSizeAndScale(k,this.ctx.canvas.width,D),ot=this.getSizeAndScale(R,this.ctx.canvas.height,_),L=t.canvasFactory.create(B.size,ot.size),T=L.context,I=c.createCanvasGraphics(T,e);if(I.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(I,s,l),T.translate(-B.scale*d,-ot.scale*f),I.transform(0,B.scale,0,0,ot.scale,0,0),T.save(),I.dependencyTracker?.save(),this.clipBbox(I,d,f,m,x),I.baseTransform=Ne(I.ctx),I.executeOperatorList(n),I.endDrawing(),I.dependencyTracker?.restore(),T.restore(),K||W){let M=L.canvas;K&&(k=u),W&&(R=h);let E=this.getSizeAndScale(k,this.ctx.canvas.width,D),S=this.getSizeAndScale(R,this.ctx.canvas.height,_),N=E.size,P=S.size,$=t.canvasFactory.create(N,P),G=$.context,O=K?Math.floor(y/u):0,z=W?Math.floor(A/h):0;for(let it=0;it<=O;it++)for(let X=0;X<=z;X++)G.drawImage(M,N*it,P*X,N,P,0,0,N,P);return t.canvasFactory.destroy(L),{canvas:$.canvas,canvasEntry:$,scaleX:E.scale,scaleY:S.scale,offsetX:d,offsetY:f}}return{canvas:L.canvas,canvasEntry:L,scaleX:B.scale,scaleY:ot.scale,offsetX:d,offsetY:f}}getSizeAndScale(t,e,i){let n=Math.max(vy.MAX_PATTERN_SIZE,e),s=Math.ceil(t*i);return s>=n?s=n:i=s/t,{scale:i,size:s}}clipBbox(t,e,i,n,s){let o=n-e,l=s-i;t.ctx.rect(e,i,o,l),mt.axialAlignedBoundingBox([e,i,n,s],Ne(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let n=t.ctx,s=t.current;switch(e){case hC.COLORED:let{fillStyle:o,strokeStyle:l}=this.ctx;n.fillStyle=s.fillColor=o,n.strokeStyle=s.strokeColor=l;break;case hC.UNCOLORED:n.fillStyle=n.strokeStyle=i,s.fillColor=s.strokeColor=i;break;default:throw new rb(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,n,s){let o=i;n!==Fi.SHADING&&(o=mt.transform(o,e.baseTransform),this.matrix&&(o=mt.transform(o,this.matrix)));let l=this.createPatternCanvas(e,s),c=new DOMMatrix(o);c=c.translate(l.offsetX,l.offsetY),c=c.scale(1/l.scaleX,1/l.scaleY);let u=t.createPattern(l.canvas,"repeat");return e.canvasFactory.destroy(l.canvasEntry),u.setTransform(c),u}};j(vy,"MAX_PATTERN_SIZE",3e3);e2=vy;dC=16,fC=100,yM=15,pC=10,xn=16,tb=new DOMMatrix,Gn=new Float32Array(2),Lu=new Float32Array([1/0,1/0,-1/0,-1/0]);q0=class{constructor(t,e){j(this,"alphaIsShape",!1);j(this,"fontSize",0);j(this,"fontSizeScale",1);j(this,"textMatrix",null);j(this,"textMatrixScale",1);j(this,"fontMatrix",ib);j(this,"leading",0);j(this,"x",0);j(this,"y",0);j(this,"lineX",0);j(this,"lineY",0);j(this,"charSpacing",0);j(this,"wordSpacing",0);j(this,"textHScale",1);j(this,"textRenderingMode",si.FILL);j(this,"textRise",0);j(this,"fillColor","#000000");j(this,"strokeColor","#000000");j(this,"patternFill",!1);j(this,"patternStroke",!1);j(this,"fillAlpha",1);j(this,"strokeAlpha",1);j(this,"lineWidth",1);j(this,"activeSMask",null);j(this,"transferMaps","none");j(this,"minMax",Lu.slice());this.clipBox=new Float32Array([0,0,t,e])}clone(){let t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t}getPathBoundingBox(t=Fi.FILL,e=null){let i=this.minMax.slice();if(t===Fi.STROKE){e||se("Stroke bounding box must include transform."),mt.singularValueDecompose2dScale(e,Gn);let n=Gn[0]*this.lineWidth/2,s=Gn[1]*this.lineWidth/2;i[0]-=n,i[1]-=s,i[2]+=n,i[3]+=s}return i}updateClipFromPath(){let t=mt.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(Lu,0)}getClippedPathBoundingBox(t=Fi.FILL,e=null){return mt.intersect(this.clipBox,this.getPathBoundingBox(t,e))}};bM=["butt","round","square"],wM=["miter","round","bevel"],AM={},xC={},Hw=class Hw{constructor(t,e,i,n,s,{optionalContentConfig:o,markedContentStack:l=null},c,u,h,d){g(this,Gr);this.ctx=t,this.current=new q0(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=e,this.objs=i,this.canvasFactory=n,this.filterFactory=s,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.smaskGroupCanvases=[],this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=l||[],this.optionalContentConfig=o,this.cachedPatterns=new Map,this.annotationCanvasMap=c,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=u,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=h??null,this.imagesTracker=d??null}getObject(t,e,i=null){return typeof e=="string"?(this.dependencyTracker?.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):i}beginDrawing({transform:t,viewport:e,transparency:i=!1,background:n=null}){let s=this.ctx.canvas.width,o=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,s,o),this.ctx.fillStyle=l,i){let c=this.transparentCanvasEntry=this.canvasFactory.create(s,o);this.compositeCtx=this.ctx,{canvas:this.transparentCanvas,context:this.ctx}=c,this.ctx.save(),this.ctx.transform(...Ne(this.compositeCtx))}this.ctx.save(),Hg(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=Ne(this.ctx)}executeOperatorList(t,e,i,n,s){let o=t.argsArray,l=t.fnArray,c=e||0,u=o.length;if(u===c)return c;let h=u-c>pC&&typeof i=="function",d=h?Date.now()+yM:0,f=0,m=this.commonObjs,x=this.objs,y,A;for(;;){if(n!==void 0){if(c===n.nextBreakPoint)return n.breakIt(c,i),c;if(n.shouldSkip(c)){if(++c===u)return c;continue}}if(!s||s(c))if(y=l[c],A=o[c]??null,y!==md.dependency)A===null?this[y](c):this[y](c,...A);else for(let w of A){this.dependencyTracker?.recordNamedData(w,c);let v=w.startsWith("g_")?m:x;if(!v.has(w))return v.get(w,i),c}if(c++,c===u)return c;if(h&&++f>pC){if(Date.now()>d)return i(),c;f=0}}}endDrawing(){b(this,Gr,i2).call(this);for(let t of this.smaskGroupCanvases)this.canvasFactory.destroy(t);this.smaskGroupCanvases.length=0,this.tempSMask=null,this.smaskStack.length=0,this.cachedPatterns.clear();for(let t of this._cachedBitmapsMap.values()){for(let e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),b(this,Gr,n2).call(this)}_scaleImage(t,e){let i=t.width??t.displayWidth,n=t.height??t.displayHeight,s=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=[],c=s,u=o,h=i,d=n;for(;c>2&&h>1||u>2&&d>1;){let w=h,v=d;c>2&&h>1&&(w=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h/2),c/=h/w),u>2&&d>1&&(v=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d)/2,u/=d/v),l.push({newWidth:w,newHeight:v}),h=w,d=v}if(l.length===0)return{img:t,paintWidth:i,paintHeight:n,tmpCanvas:null};if(l.length===1){let{newWidth:w,newHeight:v}=l[0],C=this.canvasFactory.create(w,v);return C.context.drawImage(t,0,0,i,n,0,0,w,v),{img:C.canvas,paintWidth:w,paintHeight:v,tmpCanvas:C}}let f=this.canvasFactory.create(1,1),m=this.canvasFactory.create(1,1),x=i,y=n,A=t;for(let{newWidth:w,newHeight:v}of l)this.canvasFactory.reset(m,w,v),m.context.drawImage(A,0,0,x,y,0,0,w,v),[f,m]=[m,f],A=f.canvas,x=w,y=v;return this.canvasFactory.destroy(m),{img:f.canvas,paintWidth:x,paintHeight:y,tmpCanvas:f}}_createMaskCanvas(t,e){let i=this.ctx,{width:n,height:s}=e,o=this.current.fillColor,l=this.current.patternFill,c=Ne(i),u,h,d,f;if((e.bitmap||e.data)&&e.count>1){let U=e.bitmap||e.data.buffer;h=JSON.stringify(l?c:[c.slice(0,4),o]),u=this._cachedBitmapsMap.getOrInsertComputed(U,By);let tt=u.get(h);if(tt&&!l){let et=Math.round(Math.min(c[0],c[2])+c[4]),B=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(t,nr.transformAndFill),{canvas:tt,offsetX:et,offsetY:B}}d=tt}d||(f=this.canvasFactory.create(n,s),gC(f.context,e));let m=mt.transform(c,[1/n,0,0,-1/s,0,0]);m=mt.transform(m,[1,0,0,1,0,-s]);let x=Lu.slice();mt.axialAlignedBoundingBox([0,0,n,s],m,x);let[y,A,w,v]=x,C=Math.round(w-y)||1,D=Math.round(v-A)||1,_=this.canvasFactory.create(C,D),k=_.context,R=y,K=A;k.translate(-R,-K),k.transform(...m);let W=null;if(!d){let U=this._scaleImage(f.canvas,es(k));d=U.img,W=U.tmpCanvas,d!==f.canvas&&(this.canvasFactory.destroy(f),f=null),u&&l&&(u.set(h,d),W=null,f=null)}k.imageSmoothingEnabled=yC(Ne(k),e.interpolate),jg(k,d,0,0,d.width,d.height,0,0,n,s),W&&this.canvasFactory.destroy(W),f&&this.canvasFactory.destroy(f),k.globalCompositeOperation="source-in";let V=mt.transform(es(k),[1,0,0,1,-R,-K]);return k.fillStyle=l?o.getPattern(i,this,V,Fi.FILL,t):o,k.fillRect(0,0,n,s),u&&!l&&u.set(h,_.canvas),this.dependencyTracker?.recordDependencies(t,nr.transformAndFill),{canvas:_.canvas,canvasEntry:u&&!l?null:_,offsetX:Math.round(R),offsetY:Math.round(K)}}setLineWidth(t,e){this.dependencyTracker?.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){this.dependencyTracker?.recordSimpleData("lineCap",t),this.ctx.lineCap=bM[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=wM[e]}setMiterLimit(t,e){this.dependencyTracker?.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,i){this.dependencyTracker?.recordSimpleData("dash",t);let n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(e),n.lineDashOffset=i)}setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){for(let[i,n]of e)switch(i){case"LW":this.setLineWidth(t,n);break;case"LC":this.setLineCap(t,n);break;case"LJ":this.setLineJoin(t,n);break;case"ML":this.setMiterLimit(t,n);break;case"D":this.setDash(t,n[0],n[1]);break;case"RI":this.setRenderingIntent(t,n);break;case"FL":this.setFlatness(t,n);break;case"Font":this.setFont(t,n[0],n[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=n;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=n;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=n;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",t),this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.dependencyTracker?.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(t){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");let e=this.ctx.canvas.width,i=this.ctx.canvas.height,n=this.canvasFactory.create(e,i);this.smaskScratchCanvas=n,this.suspendedCtx=this.ctx;let s=this.ctx=n.context;s.setTransform(this.suspendedCtx.getTransform()),af(this.suspendedCtx,s),xM(s,this.suspendedCtx),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),af(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}composeSMask(t,e,i,n){let s=n[0],o=n[1],l=n[2]-s,c=n[3]-o;l===0||c===0||(this.genericComposeSMask(e.context,i,l,c,e.subtype,e.backdrop,e.transferMap,s,o,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,n,s,o,l,c,u,h,d){let f=t.canvas,m=c-h,x=u-d,y=null;if(o)if(m<0||x<0||m+i>f.width||x+n>f.height){y=this.canvasFactory.create(i,n);let w=y.context;w.drawImage(f,-m,-x),w.globalCompositeOperation="destination-atop",w.fillStyle=o,w.fillRect(0,0,i,n),w.globalCompositeOperation="source-over",f=y.canvas,m=x=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let w=new Path2D;w.rect(m,x,i,n),t.clip(w),t.globalCompositeOperation="destination-atop",t.fillStyle=o,t.fillRect(m,x,i,n),t.restore()}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),s==="Alpha"&&l?e.filter=this.filterFactory.addAlphaFilter(l):s==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(l));let A=new Path2D;A.rect(c,u,i,n),e.clip(A),e.globalCompositeOperation="destination-in",e.drawImage(f,m,x,i,n,c,u,i,n),e.restore(),y&&this.canvasFactory.destroy(y)}save(t){this.inSMaskMode&&af(this.ctx,this.suspendedCtx),this.ctx.save();let e=this.current;this.stateStack.push(e),this.current=e.clone(),this.dependencyTracker?.save(t)}restore(t){if(this.dependencyTracker?.restore(t),this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&af(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,i,n,s,o,l){this.dependencyTracker?.recordIncrementalData("transform",t),this.ctx.transform(e,i,n,s,o,l),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i,n){let[s]=i;if(!n){s||(s=i[0]=new Path2D),this[e](t,s);return}if(this.dependencyTracker!==null){let o=e===md.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,n[0]-o,n[2]+o,n[1]-o,n[3]+o).recordDependencies(t,["transform"])}s instanceof Path2D||(s=i[0]=MC(s)),mt.axialAlignedBoundingBox(n,Ne(this.ctx),this.current.minMax),this[e](t,s),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,i=!0){let n=this.ctx,s=this.current.strokeColor;if(n.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof s=="object"&&s?.getPattern){let o=s.isModifyingCurrentTransform()?n.getTransform():null;if(n.save(),n.strokeStyle=s.getPattern(n,this,es(n),Fi.STROKE,t),o){let l=new Path2D;l.addPath(e,n.getTransform().invertSelf().multiplySelf(o)),e=l}this.rescaleAndStroke(e,!1),n.restore()}else this.rescaleAndStroke(e,!0);this.dependencyTracker?.recordDependencies(t,nr.stroke),i&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(Fi.STROKE,Ne(this.ctx))),n.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e,i=!0){let n=this.ctx,s=this.current.fillColor,o=this.current.patternFill,l=!1;if(o){let u=s.isModifyingCurrentTransform()?n.getTransform():null;if(this.dependencyTracker?.save(t),n.save(),n.fillStyle=s.getPattern(n,this,es(n),Fi.FILL,t),u){let h=new Path2D;h.addPath(e,n.getTransform().invertSelf().multiplySelf(u)),e=h}l=!0}let c=this.current.getClippedPathBoundingBox();this.contentVisible&&c!==null&&(this.pendingEOFill?(n.fill(e,"evenodd"),this.pendingEOFill=!1):n.fill(e)),this.dependencyTracker?.recordDependencies(t,nr.fill),l&&(n.restore(),this.dependencyTracker?.restore(t)),i&&this.consumePath(t,e,c)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){this.ctx.fill(e),this.dependencyTracker?.recordDependencies(t,nr.rawFillPath).recordOperation(t)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=AM}eoClip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=xC}beginText(t){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){let e=this.pendingTextPaths,i=this.ctx;if(this.dependencyTracker){let{dependencyTracker:n}=this;e!==void 0&&n.recordFutureForcedDependency("textClip",n.getOpenMarker()).recordFutureForcedDependency("textClip",t),n.recordCloseMarker(t)}if(e!==void 0){let n=new Path2D,s=i.getTransform().invertSelf();for(let{transform:o,x:l,y:c,fontSize:u,path:h}of e)h&&n.addPath(h,new DOMMatrix(o).preMultiplySelf(s).translate(l,c).scale(u,-u));i.clip(n)}delete this.pendingTextPaths}setCharSpacing(t,e){this.dependencyTracker?.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){this.dependencyTracker?.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){this.dependencyTracker?.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){this.dependencyTracker?.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,i){this.dependencyTracker?.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);let n=this.commonObjs.get(e),s=this.current;if(!n)throw new Error(`Can't find font for ${e}`);if(s.fontMatrix=n.fontMatrix||ib,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&Ut("Invalid font matrix for font "+e),i<0?(i=-i,s.fontDirection=-1):s.fontDirection=1,this.current.font=n,this.current.fontSize=i,n.isType3Font)return;let o=n.loadedName||"sans-serif",l=n.systemFontInfo?.css||`"${o}", ${n.fallbackName}`,c="normal";n.black?c="900":n.bold&&(c="bold");let u=n.italic?"italic":"normal",h=i;i<dC?h=dC:i>fC&&(h=fC),this.current.fontSizeScale=i/h,this.ctx.font=`${u} ${c} ${h}px ${l}`}setTextRenderingMode(t,e){this.dependencyTracker?.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){this.dependencyTracker?.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,i){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=i}setLeadingMoveText(t,e,i){this.setLeading(t,-i),this.moveText(t,e,i)}setTextMatrix(t,e){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",t);let{current:i}=this;i.textMatrix=e,i.textMatrixScale=Math.hypot(e[0],e[1]),i.x=i.lineX=0,i.y=i.lineY=0}nextLine(t){this.moveText(t,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??t)}paintChar(t,e,i,n,s,o){let l=this.ctx,c=this.current,u=c.font,h=c.textRenderingMode,d=c.fontSize/c.fontSizeScale,f=h&si.FILL_STROKE_MASK,m=!!(h&si.ADD_TO_PATH_FLAG),x=c.patternFill&&!u.missingFile,y=c.patternStroke&&!u.missingFile,A;if((u.disableFontFace||m||x||y)&&!u.missingFile&&(A=u.getPathGenerator(this.commonObjs,e)),A&&(u.disableFontFace||x||y)){l.save(),l.translate(i,n),l.scale(d,-d),this.dependencyTracker?.recordCharacterBBox(t,l,u);let w;if(f===si.FILL||f===si.FILL_STROKE)if(s){w=l.getTransform(),l.setTransform(...s);let v=b(this,Gr,r2).call(this,A,w,s);l.fill(v)}else l.fill(A);if(f===si.STROKE||f===si.FILL_STROKE)if(o){w||(w=l.getTransform()),l.setTransform(...o);let{a:v,b:C,c:D,d:_}=w,k=mt.inverseTransform(o),R=mt.transform([v,C,D,_,0,0],k);mt.singularValueDecompose2dScale(R,Gn),l.lineWidth*=Math.max(Gn[0],Gn[1])/d,l.stroke(b(this,Gr,r2).call(this,A,w,o))}else l.lineWidth/=d,l.stroke(A);l.restore()}else(f===si.FILL||f===si.FILL_STROKE)&&(l.fillText(e,i,n),this.dependencyTracker?.recordCharacterBBox(t,l,u,d,i,n,()=>l.measureText(e))),(f===si.STROKE||f===si.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,l,u,d,i,n,()=>l.measureText(e)).recordDependencies(t,nr.stroke),l.strokeText(e,i,n));m&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Ne(l),x:i,y:n,fontSize:d,path:A}),this.dependencyTracker?.recordCharacterBBox(t,l,u,d,i,n))}get isFontSubpixelAAEnabled(){let t=this.canvasFactory.create(10,10),e=t.context;e.scale(1.5,1),e.fillText("I",0,10);let i=e.getImageData(0,0,10,10).data;this.canvasFactory.destroy(t);let n=!1;for(let s=3;s<i.length;s+=4)if(i[s]>0&&i[s]<255){n=!0;break}return Ot(this,"isFontSubpixelAAEnabled",n)}showText(t,e){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,nr.showText).resetBBox(t),this.current.textRenderingMode&si.ADD_TO_PATH_FLAG&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());let i=this.current,n=i.font;if(n.isType3Font){this.showType3Text(t,e),this.dependencyTracker?.recordShowTextOperation(t);return}let s=i.fontSize;if(s===0){this.dependencyTracker?.recordOperation(t);return}let o=this.ctx,l=i.fontSizeScale,c=i.charSpacing,u=i.wordSpacing,h=i.fontDirection,d=i.textHScale*h,f=e.length,m=n.vertical,x=m?1:-1,y=n.defaultVMetrics,A=s*i.fontMatrix[0],w=i.textRenderingMode===si.FILL&&!n.disableFontFace&&!i.patternFill;o.save(),i.textMatrix&&o.transform(...i.textMatrix),o.translate(i.x,i.y+i.textRise),h>0?o.scale(d,-1):o.scale(d,1);let v,C,D=i.textRenderingMode&si.FILL_STROKE_MASK,_=D===si.FILL||D===si.FILL_STROKE,k=D===si.STROKE||D===si.FILL_STROKE;if(_&&i.patternFill){o.save();let U=i.fillColor.getPattern(o,this,es(o),Fi.FILL,t);v=Ne(o),o.restore(),o.fillStyle=U}if(k&&i.patternStroke){o.save();let U=i.strokeColor.getPattern(o,this,es(o),Fi.STROKE,t);C=Ne(o),o.restore(),o.strokeStyle=U}let R=i.lineWidth,K=i.textMatrixScale;if(K===0||R===0?k&&(R=this.getSinglePixelWidth()):R/=K,l!==1&&(o.scale(l,l),R/=l),o.lineWidth=R,n.isInvalidPDFjsFont){let U=[],tt=0;for(let B of e)U.push(B.unicode),tt+=B.width;let et=U.join("");if(o.fillText(et,0,0),this.dependencyTracker!==null){let B=o.measureText(et);this.dependencyTracker.recordBBox(t,this.ctx,-B.actualBoundingBoxLeft,B.actualBoundingBoxRight,-B.actualBoundingBoxAscent,B.actualBoundingBoxDescent).recordShowTextOperation(t)}i.x+=tt*A*d,o.restore(),this.compose();return}let W=0,V;for(V=0;V<f;++V){let U=e[V];if(typeof U=="number"){W+=x*U*s/1e3;continue}let tt=!1,et=(U.isSpace?u:0)+c,B=U.fontChar,ot=U.accent,L,T,I=U.width;if(m){let S=U.vmetric||y,N=-(U.vmetric?S[1]:I*.5)*A,P=S[2]*A;I=S?-S[0]:I,L=N/l,T=(W+P)/l}else L=W/l,T=0;let M;if(n.remeasure&&I>0){M=o.measureText(B);let S=M.width*1e3/s*l;if(I<S&&this.isFontSubpixelAAEnabled){let N=I/S;tt=!0,o.save(),o.scale(N,1),L/=N}else I!==S&&(L+=(I-S)/2e3*s/l)}if(this.contentVisible&&(U.isInFont||n.missingFile)){if(w&&!ot)o.fillText(B,L,T),this.dependencyTracker?.recordCharacterBBox(t,o,M?{bbox:null}:n,s/l,L,T,()=>M??o.measureText(B));else if(this.paintChar(t,B,L,T,v,C),ot){let S=L+s*ot.offset.x/l,N=T-s*ot.offset.y/l;this.paintChar(t,ot.fontChar,S,N,v,C)}}let E=m?I*A-et*h:I*A+et*h;W+=E,tt&&o.restore()}m?i.y-=W:i.x+=W*d,o.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(t)}showType3Text(t,e){let i=this.ctx,n=this.current,s=n.font,o=n.fontSize,l=n.fontDirection,c=s.vertical?1:-1,u=n.charSpacing,h=n.wordSpacing,d=n.textHScale*l,f=n.fontMatrix||ib,m=e.length,x=n.textRenderingMode===si.INVISIBLE,y,A,w,v;if(x||o===0)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),n.textMatrix&&i.transform(...n.textMatrix),i.translate(n.x,n.y+n.textRise),i.scale(d,l);let C=this.dependencyTracker;for(this.dependencyTracker=C?new j0(C,t):null,y=0;y<m;++y){if(A=e[y],typeof A=="number"){v=c*A*o/1e3,this.ctx.translate(v,0),n.x+=v*d;continue}let D=(A.isSpace?h:0)+u,_=s.charProcOperatorList[A.operatorListId];_?this.contentVisible&&(this.save(),i.scale(o,o),i.transform(...f),this.executeOperatorList(_),this.restore()):Ut(`Type3 character "${A.operatorListId}" is not available.`);let k=[A.width,0];mt.applyTransform(k,f),w=k[0]*o+D,i.translate(w,0),n.x+=w*d}i.restore(),C&&(this.dependencyTracker=C)}setCharWidth(t,e,i){}setCharWidthAndBounds(t,e,i,n,s,o,l){let c=new Path2D;c.rect(n,s,o-n,l-s),this.ctx.clip(c),this.dependencyTracker?.recordBBox(t,this.ctx,n,o,s,l).recordClipBox(t,this.ctx,n,o,s,l),this.endPath(t)}getColorN_Pattern(t,e){let i;if(e[0]==="TilingPattern"){let n=this.baseTransform||Ne(this.ctx),s={createCanvasGraphics:(o,l)=>new Hw(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new j0(this.dependencyTracker,l,!0):null)};i=new e2(e,this.ctx,s,n)}else i=this._getPattern(t,e[1],e[2]);return i}setStrokeColorN(t,...e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.current.strokeColor=this.getColorN_Pattern(t,e),this.current.patternStroke=!0}setFillColorN(t,...e){this.dependencyTracker?.recordSimpleData("fillColor",t),this.current.fillColor=this.getColorN_Pattern(t,e),this.current.patternFill=!0}setStrokeRGBColor(t,e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(t){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1}setFillTransparent(t){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e,i=null){let n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=mM(this.getObject(t,e)),this.cachedPatterns.set(e,n)),i&&(n.matrix=i),n}shadingFill(t,e){if(!this.contentVisible)return;let i=this.ctx;this.save(t);let n=this._getPattern(t,e);i.fillStyle=n.getPattern(i,this,es(i),Fi.SHADING,t);let s=es(i);if(s){let{width:o,height:l}=i.canvas,c=Lu.slice();mt.axialAlignedBoundingBox([0,0,o,l],s,c);let[u,h,d,f]=c;this.ctx.fillRect(u,h,d-u,f-h)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,nr.transform).recordDependencies(t,nr.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){se("Should not call beginInlineImage")}beginImageData(){se("Should not call beginImageData")}paintFormXObjectBegin(t,e,i){if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=Ne(this.ctx),i)){mt.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);let[n,s,o,l]=i,c=new Path2D;c.rect(n,s,o-n,l-s),this.ctx.clip(c),this.dependencyTracker?.recordClipBox(t,this.ctx,n,o,s,l),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){if(!this.contentVisible)return;this.save(t),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let i=this.ctx;e.isolated||Oy("TODO: Support non-isolated groups."),e.knockout&&Ut("Knockout groups not supported.");let n=Ne(i);e.matrix&&i.transform(...e.matrix);let s=[0,0,i.canvas.width,i.canvas.height],o;e.bbox?(o=Lu.slice(),mt.axialAlignedBoundingBox(e.bbox,Ne(i),o),o=mt.intersect(o,s)||[0,0,0,0]):o=s;let l=Math.floor(o[0]),c=Math.floor(o[1]),u=Math.max(Math.ceil(o[2])-l,1),h=Math.max(Math.ceil(o[3])-c,1);this.current.startNewPathAndClipBox([0,0,u,h]),e.smask&&this.smaskCounter++;let d=this.canvasFactory.create(u,h);e.smask&&this.smaskGroupCanvases.push(d);let f=d.context;if(f.translate(-l,-c),f.transform(...n),e.bbox){let m=new Path2D,[x,y,A,w]=e.bbox;if(m.rect(x,y,A-x,w-y),e.matrix){let v=new Path2D;v.addPath(m,new DOMMatrix(e.matrix)),m=v}f.clip(m)}e.smask&&this.smaskStack.push({canvas:d.canvas,context:f,offsetX:l,offsetY:c,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}),(!e.smask||this.dependencyTracker)&&(i.setTransform(1,0,0,1,0,0),i.translate(l,c),i.save()),af(i,f),this.ctx=f,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(i),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(i),this.groupLevel++}endGroup(t,e){if(!this.contentVisible)return;this.groupLevel--;let i=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&this.ctx.restore();else{this.ctx.restore();let s=Ne(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...s);let o=Lu.slice();mt.axialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],s,o),this.ctx.drawImage(i.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy({canvas:i.canvas,context:i}),this.compose(o)}}beginAnnotation(t,e,i,n,s,o){if(b(this,Gr,i2).call(this),Hg(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){let l=i[2]-i[0],c=i[3]-i[1];if(o&&this.annotationCanvasMap){n=n.slice(),n[4]-=i[0],n[5]-=i[1],i=i.slice(),i[0]=i[1]=0,i[2]=l,i[3]=c,mt.singularValueDecompose2dScale(Ne(this.ctx),Gn);let{viewportScale:u}=this,h=Math.ceil(l*this.outputScaleX*u),d=Math.ceil(c*this.outputScaleY*u);this.annotationCanvas=this.canvasFactory.create(h,d);let{canvas:f,context:m}=this.annotationCanvas;this.annotationCanvasMap.set(e,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=m,this.ctx.save(),this.ctx.setTransform(Gn[0],0,0,-Gn[1],0,c*Gn[1]),Hg(this.ctx)}else{Hg(this.ctx),this.endPath(t);let u=new Path2D;u.rect(i[0],i[1],l,c),this.ctx.clip(u)}}this.current=new q0(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(t,...n),this.transform(t,...s)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),b(this,Gr,n2).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t,e){if(!this.contentVisible)return;let i=e.count;e=this.getObject(t,e.data,e),e.count=i;let n=this.ctx,s=this._createMaskCanvas(t,e),o=s.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(o,s.offsetX,s.offsetY),this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,s.offsetX,s.offsetX+o.width,s.offsetY,s.offsetY+o.height).recordOperation(t),n.restore(),s.canvasEntry&&this.canvasFactory.destroy(s.canvasEntry),this.compose()}paintImageMaskXObjectRepeat(t,e,i,n=0,s=0,o,l){if(!this.contentVisible)return;e=this.getObject(t,e.data,e);let c=this.ctx;c.save();let u=Ne(c);c.transform(i,n,s,o,0,0);let h=this._createMaskCanvas(t,e);c.setTransform(1,0,0,1,h.offsetX-u[4],h.offsetY-u[5]),this.dependencyTracker?.resetBBox(t);for(let d=0,f=l.length;d<f;d+=2){let m=mt.transform(u,[i,n,s,o,l[d],l[d+1]]);c.drawImage(h.canvas,m[4],m[5]),this.dependencyTracker?.recordBBox(t,this.ctx,m[4],m[4]+h.canvas.width,m[5],m[5]+h.canvas.height)}c.restore(),h.canvasEntry&&this.canvasFactory.destroy(h.canvasEntry),this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageMaskXObjectGroup(t,e){if(!this.contentVisible)return;let i=this.ctx,n=this.current.fillColor,s=this.current.patternFill;this.dependencyTracker?.resetBBox(t).recordDependencies(t,nr.transformAndFill);for(let o of e){let{data:l,width:c,height:u,transform:h}=o,d=this.canvasFactory.create(c,u),f=d.context;f.save();let m=this.getObject(t,l,o);gC(f,m),f.globalCompositeOperation="source-in",f.fillStyle=s?n.getPattern(f,this,es(i),Fi.FILL,t):n,f.fillRect(0,0,c,u),f.restore(),i.save(),i.transform(...h),i.scale(1,-1),jg(i,d.canvas,0,0,c,u,0,-1,1,1),this.canvasFactory.destroy(d),this.dependencyTracker?.recordBBox(t,i,0,c,0,u),i.restore()}this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageXObject(t,e){if(!this.contentVisible)return;let i=this.getObject(t,e);if(!i){Ut("Dependent image isn't ready yet");return}this.paintInlineImageXObject(t,i)}paintImageXObjectRepeat(t,e,i,n,s){if(!this.contentVisible)return;let o=this.getObject(t,e);if(!o){Ut("Dependent image isn't ready yet");return}let l=o.width,c=o.height,u=[];for(let h=0,d=s.length;h<d;h+=2)u.push({transform:[i,0,0,n,s[h],s[h+1]],x:0,y:0,w:l,h:c});this.paintInlineImageXObjectGroup(t,o,u)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return{img:t.bitmap,canvasEntry:null};let{bitmap:e,width:i,height:n}=t,s=this.canvasFactory.create(i,n),o=s.context;return o.filter=this.current.transferMaps,o.drawImage(e,0,0),o.filter="none",{img:s.canvas,canvasEntry:s}}paintInlineImageXObject(t,e){if(!this.contentVisible)return;let i=e.width,n=e.height,s=this.ctx;this.save(t);let{filter:o}=s;o!=="none"&&o!==""&&(s.filter="none"),s.scale(1/i,-1/n);let l,c=null;if(e.bitmap){let h=this.applyTransferMapsToBitmap(e);l=h.img,c=h.canvasEntry}else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)l=e;else{let h=this.canvasFactory.create(i,n);mC(h.context,e),l=this.applyTransferMapsToCanvas(h.context),c=h}let u=this._scaleImage(l,es(s));s.imageSmoothingEnabled=yC(Ne(s),e.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(t).recordBBox(t,s,0,i,-n,0).recordDependencies(t,nr.imageXObject).recordOperation(t),this.imagesTracker?.record(s,i,n,this.dependencyTracker.clipBox)),jg(s,u.img,0,0,u.paintWidth,u.paintHeight,0,-n,i,n),u.tmpCanvas&&this.canvasFactory.destroy(u.tmpCanvas),c&&this.canvasFactory.destroy(c),this.compose(),this.restore(t)}paintInlineImageXObjectGroup(t,e,i){if(!this.contentVisible)return;let n=this.ctx,s,o=null;if(e.bitmap)s=e.bitmap;else{let l=e.width,c=e.height,u=this.canvasFactory.create(l,c);mC(u.context,e),s=this.applyTransferMapsToCanvas(u.context),o=u}this.dependencyTracker?.resetBBox(t);for(let l of i)n.save(),n.transform(...l.transform),n.scale(1,-1),jg(n,s,l.x,l.y,l.w,l.h,0,-1,1,1),this.dependencyTracker?.recordBBox(t,n,0,1,-1,0),n.restore();o&&this.canvasFactory.destroy(o),this.dependencyTracker?.recordOperation(t),this.compose()}paintSolidColorImageMask(t){this.contentVisible&&(this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,nr.fill).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t,e){}markPointProps(t,e,i){}beginMarkedContent(t,e){this.dependencyTracker?.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,i){this.dependencyTracker?.beginMarkedContent(t),e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(t){this.dependencyTracker?.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,i){let n=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(i);let s=this.ctx;this.pendingClip?(n||(this.pendingClip===xC?s.clip(e,"evenodd"):s.clip(e)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):this.dependencyTracker?.recordOperation(t),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=Ne(this.ctx);if(t[1]===0&&t[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{let e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),n=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:t}=this.current,{a:e,b:i,c:n,d:s}=this.ctx.getTransform(),o,l;if(i===0&&n===0){let c=Math.abs(e),u=Math.abs(s);if(c===u)if(t===0)o=l=1/c;else{let h=c*t;o=l=h<1?1/h:1}else if(t===0)o=1/c,l=1/u;else{let h=c*t,d=u*t;o=h<1?1/h:1,l=d<1?1/d:1}}else{let c=Math.abs(e*s-i*n),u=Math.hypot(e,i),h=Math.hypot(n,s);if(t===0)o=h/c,l=u/c;else{let d=t*c;o=h>d?h/d:1,l=u>d?u/d:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(t,e){let{ctx:i,current:{lineWidth:n}}=this,[s,o]=this.getScaleForStroking();if(s===o){i.lineWidth=(n||1)*s,i.stroke(t);return}let l=i.getLineDash();e&&i.save(),i.scale(s,o),tb.a=1/s,tb.d=1/o;let c=new Path2D;if(c.addPath(t,tb),l.length>0){let u=Math.max(s,o);i.setLineDash(l.map(h=>h/u)),i.lineDashOffset/=u}i.lineWidth=n||1,i.stroke(c),e&&i.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};Gr=new WeakSet,i2=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)},n2=function(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}},r2=function(t,e,i){let n=new Path2D;return n.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),n};zu=Hw;for(let r in md)zu.prototype[r]!==void 0&&(zu.prototype[md[r]]=zu.prototype[r]);xd=class{constructor(t,e,i){g(this,Mp,null);g(this,Fp,null);j(this,"_fullReader",null);j(this,"_rangeReaders",new Set);j(this,"_source",null);this._source=t,p(this,Mp,e),p(this,Fp,i)}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return Me(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(a(this,Mp))(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new(a(this,Fp))(this,t,e);return this._rangeReaders.add(i),i}cancelAllRequests(t){this._fullReader?.cancel(t);for(let e of new Set(this._rangeReaders))e.cancel(t)}};Mp=new WeakMap,Fp=new WeakMap;bd=class{constructor(t){j(this,"onProgress",null);j(this,"_contentLength",0);j(this,"_filename",null);j(this,"_headersCapability",Promise.withResolvers());j(this,"_isRangeSupported",!1);j(this,"_isStreamingSupported",!1);j(this,"_loaded",0);j(this,"_stream",null);this._stream=t}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){se("Abstract method `read` called")}cancel(t){se("Abstract method `cancel` called")}},wd=class{constructor(t,e,i){j(this,"_stream",null);this._stream=t}async read(){se("Abstract method `read` called")}cancel(t){se("Abstract method `cancel` called")}};s2=class extends xd{constructor(e){super(e,a2,o2);j(this,"_responseOrigin",null);let{httpHeaders:i,url:n}=e;Me(/https?:/.test(n.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=bT(!0,i)}},a2=class extends bd{constructor(e){super(e);j(this,"_abortController",new AbortController);j(this,"_reader",null);let{disableRange:i,disableStream:n,rangeChunkSize:s,url:o,withCredentials:l}=e._source;this._isStreamingSupported=!n;let c=new Headers(e.headers);ET(o,c,l,this._abortController).then(u=>{e._responseOrigin=jy(u.url),CT(u.status,o),this._reader=u.body.getReader();let h=u.headers,{contentLength:d,isRangeSupported:f}=wT({responseHeaders:h,isHttp:!0,rangeChunkSize:s,disableRange:i});this._contentLength=d,this._isRangeSupported=f,this._filename=AT(h),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Hr("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;let{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:Gy(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},o2=class extends wd{constructor(e,i,n){super(e,i,n);j(this,"_abortController",new AbortController);j(this,"_readCapability",Promise.withResolvers());j(this,"_reader",null);let{url:s,withCredentials:o}=e._source,l=new Headers(e.headers);l.append("Range",`bytes=${i}-${n-1}`),ET(s,l,o,this._abortController).then(c=>{let u=jy(c.url);vT(u,e._responseOrigin),CT(c.status,s),this._reader=c.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:{value:Gy(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}};l2=class extends xd{constructor(e){super(e,u2,h2);g(this,Pp);j(this,"_progressiveDone",!1);j(this,"_queuedChunks",[]);let{pdfDataRangeTransport:i}=e,{initialData:n,progressiveDone:s}=i;if(n?.length>0){let o=bC(n);this._queuedChunks.push(o)}this._progressiveDone=s,i.addRangeListener((o,l)=>{b(this,Pp,c2).call(this,o,l)}),i.addProgressiveReadListener(o=>{b(this,Pp,c2).call(this,void 0,o)}),i.addProgressiveDoneListener(()=>{this._fullReader?.progressiveDone(),this._progressiveDone=!0}),i.transportReady()}getFullReader(){let e=super.getFullReader();return this._queuedChunks=null,e}getRangeReader(e,i){let n=super.getRangeReader(e,i);return n&&(n.onDone=()=>this._rangeReaders.delete(n),this._source.pdfDataRangeTransport.requestDataRange(e,i)),n}cancelAllRequests(e){super.cancelAllRequests(e),this._source.pdfDataRangeTransport.abort()}};Pp=new WeakSet,c2=function(e,i){let n=bC(i);if(e===void 0)this._fullReader?this._fullReader._enqueue(n):this._queuedChunks.push(n);else{let s=this._rangeReaders.keys().find(o=>o._begin===e);Me(s,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),s._enqueue(n)}};u2=class extends bd{constructor(e){super(e);g(this,Op,$y.bind(this));j(this,"_done",!1);j(this,"_queuedChunks",null);j(this,"_requests",[]);let{pdfDataRangeTransport:i,disableRange:n,disableStream:s}=e._source,{length:o,contentDispositionFilename:l}=i;this._queuedChunks=e._queuedChunks||[];for(let u of this._queuedChunks)this._loaded+=u.byteLength;this._done=e._progressiveDone,this._contentLength=o,this._isStreamingSupported=!s,this._isRangeSupported=!n,zy(l)&&(this._filename=l),this._headersCapability.resolve();let c=this._loaded;Promise.resolve().then(()=>{c>0&&this._loaded===c&&this._callOnProgress()})}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,a(this,Op).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&a(this,Op).call(this)}};Op=new WeakMap;h2=class extends wd{constructor(e,i,n){super(e,i,n);g(this,Rp,$y.bind(this));j(this,"onDone",null);j(this,"_begin",-1);j(this,"_done",!1);j(this,"_queuedChunk",null);j(this,"_requests",[]);this._begin=i}_enqueue(e){this._done||(this._requests.length===0?this._queuedChunk=e:(this._requests.shift().resolve({value:e,done:!1}),a(this,Rp).call(this)),this._done=!0,this.onDone?.())}async read(){if(this._queuedChunk){let i=this._queuedChunk;return this._queuedChunk=null,{value:i,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,a(this,Rp).call(this),this.onDone?.()}};Rp=new WeakMap;eb=200,wC=206;d2=class extends xd{constructor(e){super(e,f2,p2);g(this,Cd);g(this,ps,new WeakMap);j(this,"_responseOrigin",null);let{httpHeaders:i,url:n}=e;this.url=n,this.isHttp=/https?:/.test(n.protocol),this.headers=bT(this.isHttp,i)}_request(e){let i=new XMLHttpRequest,n={validateStatus:null,onHeadersReceived:e.onHeadersReceived,onDone:e.onDone,onError:e.onError,onProgress:e.onProgress};a(this,ps).set(i,n),i.open("GET",this.url),i.withCredentials=this._source.withCredentials;for(let[s,o]of this.headers)i.setRequestHeader(s,o);return this.isHttp&&"begin"in e&&"end"in e?(i.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),n.validateStatus=s=>s===wC||s===eb):n.validateStatus=s=>s===eb,i.responseType="arraybuffer",Me(e.onError,"Expected `onError` callback to be provided."),i.onerror=()=>e.onError(i.status),i.onreadystatechange=b(this,Cd,ST).bind(this,i),i.onprogress=b(this,Cd,TT).bind(this,i),i.send(null),i}_abortRequest(e){a(this,ps).has(e)&&(a(this,ps).delete(e),e.abort())}getRangeReader(e,i){let n=super.getRangeReader(e,i);return n&&(n.onClosed=()=>this._rangeReaders.delete(n)),n}};ps=new WeakMap,Cd=new WeakSet,TT=function(e,i){a(this,ps).get(e)?.onProgress?.(i)},ST=function(e,i){let n=a(this,ps).get(e);if(!n||(e.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),e.readyState!==4)||!a(this,ps).has(e))return;if(a(this,ps).delete(e),e.status===0&&this.isHttp){n.onError(e.status);return}let s=e.status||eb;if(!n.validateStatus(s)){n.onError(e.status);return}let o=EM(e.response);if(s===wC){let l=e.getResponseHeader("Content-Range");/bytes (\d+)-(\d+)\/(\d+)/.test(l)?n.onDone(o):(Ut('Missing or invalid "Content-Range" header.'),n.onError(0))}else o?n.onDone(o):n.onError(e.status)};f2=class extends bd{constructor(e){super(e);g(this,Is);g(this,Lp,$y.bind(this));j(this,"_cachedChunks",[]);j(this,"_done",!1);j(this,"_requests",[]);j(this,"_storedError",null);this._fullRequestXhr=e._request({onHeadersReceived:b(this,Is,DT).bind(this),onDone:b(this,Is,IT).bind(this),onError:b(this,Is,kT).bind(this),onProgress:b(this,Is,NT).bind(this)})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.reject(e),a(this,Lp).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}};Lp=new WeakMap,Is=new WeakSet,DT=function(){let e=this._stream,{disableRange:i,rangeChunkSize:n}=e._source,s=this._fullRequestXhr;e._responseOrigin=jy(s.responseURL);let o=s.getAllResponseHeaders(),l=new Headers(o?o.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(h=>{let[d,...f]=h.split(": ");return[d,f.join(": ")]}):[]),{contentLength:c,isRangeSupported:u}=wT({responseHeaders:l,isHttp:e.isHttp,rangeChunkSize:n,disableRange:i});this._contentLength=c,this._isRangeSupported=u,this._filename=AT(l),this._isRangeSupported&&e._abortRequest(s),this._headersCapability.resolve()},IT=function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._cachedChunks.push(e),this._done=!0,this._cachedChunks.length===0&&a(this,Lp).call(this)},kT=function(e){this._storedError=Hy(e,this._stream.url),this._headersCapability.reject(this._storedError);for(let i of this._requests)i.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0},NT=function(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})};p2=class extends wd{constructor(e,i,n){super(e,i,n);g(this,Pa);g(this,Bp,$y.bind(this));j(this,"onClosed",null);j(this,"_done",!1);j(this,"_queuedChunk",null);j(this,"_requests",[]);j(this,"_storedError",null);this._requestXhr=e._request({begin:i,end:n,onHeadersReceived:b(this,Pa,_T).bind(this),onDone:b(this,Pa,MT).bind(this),onError:b(this,Pa,m2).bind(this),onProgress:null})}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let i=this._queuedChunk;return this._queuedChunk=null,{value:i,done:!1}}if(this._done)return{value:void 0,done:!0};let e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,a(this,Bp).call(this),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};Bp=new WeakMap,Pa=new WeakSet,_T=function(){let e=jy(this._requestXhr?.responseURL);try{vT(e,this._stream._responseOrigin)}catch(i){this._storedError=i,b(this,Pa,m2).call(this,0)}},MT=function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,a(this,Bp).call(this),this.onClosed?.()},m2=function(e){this._storedError??(this._storedError=Hy(e,this._stream.url));for(let i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};g2=class extends xd{constructor(t){super(t,y2,x2);let{url:e}=t;Me(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}},y2=class extends bd{constructor(e){super(e);j(this,"_reader",null);let{disableRange:i,disableStream:n,rangeChunkSize:s,url:o}=e._source;this._isStreamingSupported=!n;let l=rt.default.getBuiltinModule("fs");l.promises.lstat(o).then(c=>{let u=l.createReadStream(o),h=FT(u);this._reader=h.getReader();let{size:d}=c;this._contentLength=d,this._isRangeSupported=!i&&d>2*s,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Hr("Streaming is disabled.")),this._headersCapability.resolve()}).catch(c=>{c.code==="ENOENT"&&(c=Hy(0,o)),this._headersCapability.reject(c)})}async read(){await this._headersCapability.promise;let{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,this._callOnProgress(),{value:Gy(e),done:!1})}cancel(e){this._reader?.cancel(e)}},x2=class extends wd{constructor(e,i,n){super(e,i,n);j(this,"_readCapability",Promise.withResolvers());j(this,"_reader",null);let{url:s}=e._source,o=rt.default.getBuiltinModule("fs");try{let l=o.createReadStream(s,{start:i,end:n-1}),c=FT(l);this._reader=c.getReader(),this._readCapability.resolve()}catch(l){this._readCapability.reject(l)}}async read(){await this._readCapability.promise;let{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:{value:Gy(e),done:!1}}cancel(e){this._reader?.cancel(e)}};yr=class{static get workerPort(){return a(this,Up)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");p(this,Up,t)}static get workerSrc(){return a(this,zp)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");p(this,zp,t)}};Up=new WeakMap,zp=new WeakMap,g(yr,Up,null),g(yr,zp,"");b2=class{constructor({parsedData:t,rawData:e}){g(this,vh);g(this,jp);p(this,vh,t),p(this,jp,e)}getRaw(){return a(this,jp)}get(t){return a(this,vh).get(t)??null}[Symbol.iterator](){return a(this,vh).entries()}};vh=new WeakMap,jp=new WeakMap;_u=Symbol("INTERNAL"),w2=class{constructor(t,{name:e,intent:i,usage:n,rbGroups:s}){g(this,Hp,!1);g(this,Gp,!1);g(this,$p,!1);g(this,Eh,!0);p(this,Hp,!!(t&jn.DISPLAY)),p(this,Gp,!!(t&jn.PRINT)),this.name=e,this.intent=i,this.usage=n,this.rbGroups=s}get visible(){if(a(this,$p))return a(this,Eh);if(!a(this,Eh))return!1;let{print:t,view:e}=this.usage;return a(this,Hp)?e?.viewState!=="OFF":a(this,Gp)?t?.printState!=="OFF":!0}_setVisible(t,e,i=!1){t!==_u&&se("Internal method `_setVisible` called."),p(this,$p,i),p(this,Eh,e)}};Hp=new WeakMap,Gp=new WeakMap,$p=new WeakMap,Eh=new WeakMap;A2=class{constructor(t,e=jn.DISPLAY){g(this,Vp);g(this,bo,null);g(this,ge,new Map);g(this,Ch,null);g(this,Th,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,p(this,Th,t.order);for(let i of t.groups)a(this,ge).set(i.id,new w2(e,i));if(t.baseState==="OFF")for(let i of a(this,ge).values())i._setVisible(_u,!1);for(let i of t.on)a(this,ge).get(i)._setVisible(_u,!0);for(let i of t.off)a(this,ge).get(i)._setVisible(_u,!1);p(this,Ch,this.getHash())}}isVisible(t){if(a(this,ge).size===0)return!0;if(!t)return Oy("Optional content group not defined."),!0;if(t.type==="OCG")return a(this,ge).has(t.id)?a(this,ge).get(t.id).visible:(Ut(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return b(this,Vp,v2).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(let e of t.ids){if(!a(this,ge).has(e))return Ut(`Optional content group not found: ${e}`),!0;if(a(this,ge).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(let e of t.ids){if(!a(this,ge).has(e))return Ut(`Optional content group not found: ${e}`),!0;if(!a(this,ge).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(let e of t.ids){if(!a(this,ge).has(e))return Ut(`Optional content group not found: ${e}`),!0;if(!a(this,ge).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(let e of t.ids){if(!a(this,ge).has(e))return Ut(`Optional content group not found: ${e}`),!0;if(a(this,ge).get(e).visible)return!1}return!0}return Ut(`Unknown optional content policy ${t.policy}.`),!0}return Ut(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,i=!0){let n=a(this,ge).get(t);if(!n){Ut(`Optional content group not found: ${t}`);return}if(i&&e&&n.rbGroups.length)for(let s of n.rbGroups)for(let o of s)o!==t&&a(this,ge).get(o)?._setVisible(_u,!1,!0);n._setVisible(_u,!!e,!0),p(this,bo,null)}setOCGState({state:t,preserveRB:e}){let i;for(let n of t){switch(n){case"ON":case"OFF":case"Toggle":i=n;continue}let s=a(this,ge).get(n);if(s)switch(i){case"ON":this.setVisibility(n,!0,e);break;case"OFF":this.setVisibility(n,!1,e);break;case"Toggle":this.setVisibility(n,!s.visible,e);break}}p(this,bo,null)}get hasInitialVisibility(){return a(this,Ch)===null||this.getHash()===a(this,Ch)}getOrder(){return a(this,ge).size?a(this,Th)?a(this,Th).slice():[...a(this,ge).keys()]:null}getGroup(t){return a(this,ge).get(t)||null}getHash(){if(a(this,bo)!==null)return a(this,bo);let t=new U0;for(let[e,i]of a(this,ge))t.update(`${e}:${i.visible}`);return p(this,bo,t.hexdigest())}[Symbol.iterator](){return a(this,ge).entries()}};bo=new WeakMap,ge=new WeakMap,Ch=new WeakMap,Th=new WeakMap,Vp=new WeakSet,v2=function(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let n=1;n<e;n++){let s=t[n],o;if(Array.isArray(s))o=b(this,Vp,v2).call(this,s);else if(a(this,ge).has(s))o=a(this,ge).get(s).visible;else return Ut(`Optional content group not found: ${s}`),!0;switch(i){case"And":if(!o)return!1;break;case"Or":if(o)return!0;break;case"Not":return!o;default:return!0}}return i==="And"};E2=class{constructor(){g(this,$i);g(this,Ye,null);g(this,_r,null);g(this,Ni,0);g(this,Yl,null);g(this,ms,null)}get pagesNumber(){return a(this,Ni)}set pagesNumber(t){a(this,Ni)!==t&&(p(this,Ni,t),p(this,Ye,null),p(this,_r,null))}movePages(t,e,i){b(this,$i,wf).call(this);let n=a(this,Ye),s=b(this,$i,Af).call(this),o=e.length,l=new Uint32Array(o),c=0;for(let f=0;f<o;f++){let m=e[f]-1;l[f]=n[m],m<i&&c++}let u=a(this,Ni),h=u-o,d=li(i-c,0,h);for(let f=0,m=0;f<u;f++)t.has(f+1)||(n[m++]=n[f]);n.copyWithin(d+o,d,h),n.set(l,d),b(this,$i,l0).call(this,s),n.every((f,m)=>f===m+1)&&p(this,Ye,null)}deletePages(t){b(this,$i,wf).call(this);let e=a(this,Ye),i=b(this,$i,Af).call(this);p(this,ms,{pageNumberToId:e.slice(),pagesNumber:a(this,Ni),prevPageNumbers:a(this,_r).slice()});let n=a(this,Ni)-t.length;p(this,Ni,n);let s=p(this,Ye,new Uint32Array(n));p(this,_r,new Int32Array(n));let o=0,l=0;for(let c of t){let u=c-1;u!==o&&(s.set(e.subarray(o,u),l),l+=u-o),o=u+1}o<e.length&&s.set(e.subarray(o),l),b(this,$i,l0).call(this,i,new Set(t))}cancelDelete(){a(this,ms)&&(p(this,Ye,a(this,ms).pageNumberToId),p(this,Ni,a(this,ms).pagesNumber),p(this,_r,a(this,ms).prevPageNumbers),p(this,ms,null))}cleanSavedData(){p(this,ms,null)}copyPages(t){b(this,$i,wf).call(this),p(this,Yl,{pageNumbers:t,pageIds:t.map(e=>a(this,Ye)[e-1])})}cancelCopy(){p(this,Yl,null)}pastePages(t){b(this,$i,wf).call(this);let e=a(this,Ye),i=b(this,$i,Af).call(this),{pageNumbers:n,pageIds:s}=a(this,Yl),o=a(this,Ni)+n.length;p(this,Ni,o);let l=p(this,Ye,new Uint32Array(o));p(this,_r,new Int32Array(o)),l.set(e.subarray(0,t),0),l.set(s,t),l.set(e.subarray(t),t+n.length),b(this,$i,l0).call(this,i,null,t,n),p(this,Yl,null)}hasBeenAltered(){return a(this,Ye)!==null}getPageMappingForSaving(t=null){t??(t=b(this,$i,Af).call(this));let e=0;for(let n of t.values())e=Math.max(e,n.length);let i=new Array(e);for(let n=0;n<e;n++)i[n]={document:null,pageIndices:[],includePages:[]};for(let[n,s]of t)for(let o=0,l=s.length;o<l;o++)i[o].includePages.push([n-1,s[o]-1]);for(let{includePages:n,pageIndices:s}of i){n.sort((o,l)=>o[0]-l[0]);for(let o=0,l=n.length;o<l;o++)s.push(n[o][1]),n[o]=n[o][0]}return i}extractPages(t){t=Array.from(t).sort((i,n)=>i-n);let e=new Map;for(let i=0,n=t.length;i<n;i++){let s=this.getPageId(t[i]);e.getOrInsertComputed(s,Ly).push(i+1)}return this.getPageMappingForSaving(e)}getPrevPageNumber(t){return a(this,_r)?.[t-1]??0}getPageNumber(t){if(!a(this,Ye))return t;let e=a(this,Ye);for(let i=0,n=a(this,Ni);i<n;i++)if(e[i]===t)return i+1;return 0}getPageId(t){return a(this,Ye)?.[t-1]??t}getMapping(){return a(this,Ye)?.subarray(0,this.pagesNumber)}};Ye=new WeakMap,_r=new WeakMap,Ni=new WeakMap,Yl=new WeakMap,ms=new WeakMap,$i=new WeakSet,wf=function(){if(a(this,Ye))return;let t=a(this,Ni),e=p(this,Ye,new Uint32Array(t));for(let i=0;i<t;i++)e[i]=i+1;p(this,_r,new Int32Array(e))},Af=function(){let t=new Map,e=a(this,Ye);for(let i=0,n=a(this,Ni);i<n;i++){let s=e[i],o=t.get(s);o?o.push(i+1):t.set(s,[i+1])}return t},l0=function(t,e=null,i=-1,n=null){let s=a(this,_r),o=a(this,Ye),l=i+(n?.length??0),c=new Map;for(let u=0,h=a(this,Ni);u<h;u++){if(u>=i&&u<l){s[u]=-n[u-i];continue}let d=o[u],f=t.get(d),m=c.get(d)||0;if(e&&f)for(;m<f.length&&e.has(f[m]);)m++;s[u]=f?.[m],c.set(d,m+1)}};Mu=Symbol("INITIAL_DATA"),AC=()=>({...Promise.withResolvers(),data:Mu}),W0=class{constructor(){g(this,fr,new Map)}get(t,e=null){if(e){let n=a(this,fr).getOrInsertComputed(t,AC);return n.promise.then(()=>e(n.data)),null}let i=a(this,fr).get(t);if(!i||i.data===Mu)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){let e=a(this,fr).get(t);return!!e&&e.data!==Mu}delete(t){let e=a(this,fr).get(t);return!e||e.data===Mu?!1:(a(this,fr).delete(t),!0)}resolve(t,e=null){let i=a(this,fr).getOrInsertComputed(t,AC);if(i.data!==Mu)throw new Error(`Object already resolved ${t}.`);i.data=e,i.resolve()}clear(){for(let{data:t}of a(this,fr).values())t?.bitmap?.close();a(this,fr).clear()}*[Symbol.iterator](){for(let[t,{data:e}]of a(this,fr))e!==Mu&&(yield[t,e])}};fr=new WeakMap;TM=1e5,vC=30,Si=class Si{constructor({textContentSource:t,images:e,container:i,viewport:n}){g(this,Oa);g(this,wo,Promise.withResolvers());g(this,Zi,null);g(this,qp,!1);g(this,Wp,!!globalThis.FontInspector?.enabled);g(this,Sh,null);g(this,Kl,null);g(this,ua,null);g(this,Xp,0);g(this,Yp,0);g(this,Zl,null);g(this,Kp,null);g(this,Dh,0);g(this,Ao,0);g(this,Ih,Object.create(null));g(this,Zp,[]);g(this,kh,null);g(this,Ql,[]);g(this,Qp,new WeakMap);g(this,Jp,null);var u;if(t instanceof ReadableStream)p(this,kh,t);else if(typeof t=="object")p(this,kh,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');p(this,Zi,p(this,Kp,i)),p(this,Sh,e),p(this,Ao,n.scale*Ds.pixelRatio),p(this,Dh,n.rotation),p(this,ua,{div:null,properties:null,ctx:null});let{pageWidth:s,pageHeight:o,pageX:l,pageY:c}=n.rawDims;p(this,Jp,[1,0,0,-1,-l,c+o]),p(this,Yp,s),p(this,Xp,o),b(u=Si,Vn,RT).call(u),i.style.setProperty("--min-font-size",a(Si,_h)),Ho(i,n),a(this,wo).promise.finally(()=>{a(Si,Mh).delete(this),p(this,ua,null),p(this,Ih,null)}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=je.platform;return Ot(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){a(this,Sh)&&a(this,Zi).append(a(this,Sh).render());let t=()=>{a(this,Zl).read().then(({value:e,done:i})=>{if(i){a(this,wo).resolve();return}a(this,Kl)??p(this,Kl,e.lang),Object.assign(a(this,Ih),e.styles),b(this,Oa,PT).call(this,e.items),t()},a(this,wo).reject)};return p(this,Zl,a(this,kh).getReader()),a(Si,Mh).add(this),t(),a(this,wo).promise}update({viewport:t,onBefore:e=null}){var s;let i=t.scale*Ds.pixelRatio,n=t.rotation;if(n!==a(this,Dh)&&(e?.(),p(this,Dh,n),Ho(a(this,Kp),{rotation:n})),i!==a(this,Ao)){e?.(),p(this,Ao,i);let o={div:null,properties:null,ctx:b(s=Si,Vn,c0).call(s,a(this,Kl))};for(let l of a(this,Ql))o.properties=a(this,Qp).get(l),o.div=l,b(this,Oa,C2).call(this,o)}}cancel(){let t=new Hr("TextLayer task cancelled.");a(this,Zl)?.cancel(t).catch(()=>{}),p(this,Zl,null),a(this,wo).reject(t)}get textDivs(){return a(this,Ql)}get textContentItemsStr(){return a(this,Zp)}static cleanup(){if(!(a(this,Mh).size>0)){a(this,Nh).clear();for(let{canvas:t}of a(this,Jl).values())t.remove();a(this,Jl).clear()}}};wo=new WeakMap,Zi=new WeakMap,qp=new WeakMap,Wp=new WeakMap,Sh=new WeakMap,Kl=new WeakMap,ua=new WeakMap,Xp=new WeakMap,Yp=new WeakMap,Zl=new WeakMap,Kp=new WeakMap,Dh=new WeakMap,Ao=new WeakMap,Ih=new WeakMap,Zp=new WeakMap,kh=new WeakMap,Ql=new WeakMap,Qp=new WeakMap,Jp=new WeakMap,Nh=new WeakMap,Jl=new WeakMap,tm=new WeakMap,_h=new WeakMap,Mh=new WeakMap,Oa=new WeakSet,PT=function(t){var n,s;if(a(this,qp))return;(s=a(this,ua)).ctx??(s.ctx=b(n=Si,Vn,c0).call(n,a(this,Kl)));let e=a(this,Ql),i=a(this,Zp);for(let o of t){if(e.length>TM){Ut("Ignoring additional textDivs for performance reasons."),p(this,qp,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){let l=a(this,Zi);p(this,Zi,document.createElement("span")),a(this,Zi).classList.add("markedContent"),o.id&&a(this,Zi).setAttribute("id",`${o.id}`),o.tag==="Artifact"&&(a(this,Zi).ariaHidden=!0),l.append(a(this,Zi))}else o.type==="endMarkedContent"&&p(this,Zi,a(this,Zi).parentNode);continue}i.push(o.str),b(this,Oa,OT).call(this,o)}},OT=function(t){var x;let e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};a(this,Ql).push(e);let n=mt.transform(a(this,Jp),t.transform),s=Math.atan2(n[1],n[0]),o=a(this,Ih)[t.fontName];o.vertical&&(s+=Math.PI/2);let l=a(this,Wp)&&o.fontSubstitution||o.fontFamily;l=Si.fontFamilyMap.get(l)||l;let c=Math.hypot(n[2],n[3]),u=c*b(x=Si,Vn,LT).call(x,l,o,a(this,Kl)),h,d;s===0?(h=n[4],d=n[5]-u):(h=n[4]+u*Math.sin(s),d=n[5]-u*Math.cos(s));let f=e.style;f.left=`${(100*h/a(this,Yp)).toFixed(2)}%`,f.top=`${(100*d/a(this,Xp)).toFixed(2)}%`,f.setProperty("--font-height",`${c.toFixed(2)}px`),f.fontFamily=l,i.fontSize=c,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,a(this,Wp)&&(e.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),s!==0&&(i.angle=s*(180/Math.PI));let m=!1;if(t.str.length>1)m=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){let y=Math.abs(t.transform[0]),A=Math.abs(t.transform[3]);y!==A&&Math.max(y,A)/Math.min(y,A)>1.5&&(m=!0)}if(m&&(i.canvasWidth=o.vertical?t.height:t.width),a(this,Qp).set(e,i),a(this,ua).div=e,a(this,ua).properties=i,b(this,Oa,C2).call(this,a(this,ua)),i.hasText&&a(this,Zi).append(e),i.hasEOL){let y=document.createElement("br");y.setAttribute("role","presentation"),a(this,Zi).append(y)}},C2=function(t){var o;let{div:e,properties:i,ctx:n}=t,{style:s}=e;if(i.canvasWidth!==0&&i.hasText){let{fontFamily:l}=s,{canvasWidth:c,fontSize:u}=i;b(o=Si,Vn,T2).call(o,n,u*a(this,Ao),l);let{width:h}=n.measureText(e.textContent);h>0&&s.setProperty("--scale-x",c*a(this,Ao)/h)}i.angle!==0&&s.setProperty("--rotate",`${i.angle}deg`)},Vn=new WeakSet,c0=function(t=null){let e=a(this,Jl).get(t||(t=""));if(!e){let i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),a(this,Jl).set(t,e),a(this,tm).set(e,{size:0,family:""})}return e},T2=function(t,e,i){let n=a(this,tm).get(t);e===n.size&&i===n.family||(t.font=`${e}px ${i}`,n.size=e,n.family=i)},RT=function(){if(a(this,_h)!==null)return;let t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),p(this,_h,t.getBoundingClientRect().height),t.remove()},LT=function(t,e,i){let n=a(this,Nh).get(t);if(n)return n;let s=b(this,Vn,c0).call(this,i);s.canvas.width=s.canvas.height=vC,b(this,Vn,T2).call(this,s,vC,t);let o=s.measureText(""),l=o.fontBoundingBoxAscent,c=Math.abs(o.fontBoundingBoxDescent);s.canvas.width=s.canvas.height=0;let u=.8;return l?u=l/(l+c):(je.platform.isFirefox&&Ut("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?u=e.ascent:e.descent&&(u=1+e.descent)),a(this,Nh).set(t,u),u},g(Si,Vn),g(Si,Nh,new Map),g(Si,Jl,new Map),g(Si,tm,new WeakMap),g(Si,_h,null),g(Si,Mh,new Set);Ad=Si,SM=100;Cy=class Cy{constructor(){j(this,"_capability",Promise.withResolvers());j(this,"_transport",null);j(this,"_worker",null);j(this,"docId",`d${Ze(Cy,Ey)._++}`);j(this,"destroyed",!1);j(this,"onPassword",null);j(this,"onProgress",null)}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}};Ey=new WeakMap,g(Cy,Ey,0);S2=Cy,Vf=class{constructor(t,e,i=!1,n=null){g(this,Fh,Promise.withResolvers());g(this,em,[]);g(this,im,[]);g(this,nm,[]);this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=n,Object.defineProperty(this,"onDataProgress",{value:()=>{rM("`PDFDataRangeTransport.prototype.onDataProgress` - method was removed, since loading progress is now reported automatically through the `PDFDataTransportStream` class (and related code).")}})}addRangeListener(t){a(this,nm).push(t)}addProgressiveReadListener(t){a(this,im).push(t)}addProgressiveDoneListener(t){a(this,em).push(t)}onDataRange(t,e){for(let i of a(this,nm))i(t,e)}onDataProgressiveRead(t){a(this,Fh).promise.then(()=>{for(let e of a(this,im))e(t)})}onDataProgressiveDone(){a(this,Fh).promise.then(()=>{for(let t of a(this,em))t()})}transportReady(){a(this,Fh).resolve()}requestDataRange(t,e){se("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};Fh=new WeakMap,em=new WeakMap,im=new WeakMap,nm=new WeakMap;D2=class{constructor(t,e){this._pdfInfo=t,this._transport=e}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return Ot(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(t){return this._transport.extractPages(t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getRawData(t){return this._transport.getRawData(t)}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}},Gw=class Gw{constructor(t,e,i,n,s=!1){g(this,ec);g(this,ha,!1);g(this,tc,null);this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new O0:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new W0,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,p(this,tc,n),this.imageCoordinates=null}clone(t){let e=new Gw(t,this._pageInfo,this._transport,a(this,tc),this._pdfBug);return e.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(e),e}get pageNumber(){return this._pageIndex+1}set pageNumber(t){this._pageIndex=t-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:s=!1}={}){return new zf({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:s})}getAnnotations({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return Ot(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:t,canvas:e=t.canvas,viewport:i,intent:n="display",annotationMode:s=Da.ENABLE,transform:o=null,background:l=null,optionalContentConfigPromise:c=null,annotationCanvasMap:u=null,pageColors:h=null,printAnnotationStorage:d=null,isEditing:f=!1,recordImages:m=!1,recordOperations:x=!1,operationsFilter:y=null}){this._stats?.time("Overall");let A=this._transport.getRenderingIntent(n,s,d,f),{renderingIntent:w,cacheKey:v}=A;p(this,ha,!1),c||(c=this._transport.getOptionalContentConfig(w));let C=this._intentStates.getOrInsertComputed(v,P0);C.streamReaderCancelTimeout&&(clearTimeout(C.streamReaderCancelTimeout),C.streamReaderCancelTimeout=null);let D=!!(w&jn.PRINT);C.displayReadyCapability||(C.displayReadyCapability=Promise.withResolvers(),C.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(A));let _=!!(this._pdfBug&&globalThis.StepperManager?.enabled),k=!!e&&!this.recordedBBoxes&&(x||_),R=!!e&&!this.imageCoordinates&&m,K=et=>{if(C.renderTasks.delete(U),k){let B=U.gfx?.dependencyTracker.take();B&&(U.stepper?.setOperatorBBoxes(B,U.gfx.dependencyTracker.takeDebugMetadata()),x&&(this.recordedBBoxes=B))}R&&!et&&(this.imageCoordinates=U.gfx?.imagesTracker.take()),D&&p(this,ha,!0),b(this,ec,vf).call(this),et?(U.capability.reject(et),this._abortOperatorList({intentState:C,reason:et instanceof Error?et:new Error(et)})):U.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},W=null,V=null;(k||R)&&(V=new Nb(e,C.operatorList.length)),k&&(W=new Mb(V,_));let U=new _2({callback:K,params:{canvas:e,canvasContext:t,dependencyTracker:W??V,imagesTracker:R?new Fb(e):null,viewport:i,transform:o,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:C.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!D,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:y});(C.renderTasks||(C.renderTasks=new Set)).add(U);let tt=U.task;return Promise.all([C.displayReadyCapability.promise,c]).then(([et,B])=>{if(this.destroyed){K();return}if(this._stats?.time("Rendering"),!(B.renderingIntent&w))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");U.initializeGraphics({transparency:et,optionalContentConfig:B}),U.operatorListChanged()}).catch(K),tt}getOperatorList({intent:t="display",annotationMode:e=Da.ENABLE,printAnnotationStorage:i=null,isEditing:n=!1}={}){function s(){l.operatorList.lastChunk&&(l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(c))}let o=this._transport.getRenderingIntent(t,e,i,n,!0),l=this._intentStates.getOrInsertComputed(o.cacheKey,P0),c;return l.opListReadCapability||(c=Object.create(null),c.operatorListChanged=s,l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||(l.renderTasks=new Set)).add(c),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(o)),l.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:a(this,tc).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(n){return n.items.length}})}async getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(n=>Bf.textContent(n));let e=this.streamTextContent(t),i={items:[],styles:Object.create(null),lang:null};for await(let n of e)i.lang??(i.lang=n.lang),Object.assign(i.styles,n.styles),i.items.push(...n.items);return i}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let t=[];for(let e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(let i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),p(this,ha,!1),Promise.all(t)}cleanup(t=!1){p(this,ha,!0);let e=b(this,ec,vf).call(this);return t&&e&&this._stats&&(this._stats=new O0),e}_startRenderPage(t,e){let i=this._intentStates.get(e);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let i=0,n=t.length;i<n;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(let i of e.renderTasks)i.operatorListChanged();t.lastChunk&&b(this,ec,vf).call(this)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:i,modifiedIds:n}){let{map:s,transfer:o}=i,c=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:a(this,tc).getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:s,modifiedIds:n},void 0,o).getReader(),u=this._intentStates.get(e);u.streamReader=c;let h=()=>{c.read().then(({value:d,done:f})=>{if(f){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,u),h())},d=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(let f of u.renderTasks)f.operatorListChanged();b(this,ec,vf).call(this)}if(u.displayReadyCapability)u.displayReadyCapability.reject(d);else if(u.opListReadCapability)u.opListReadCapability.reject(d);else throw d}})};h()}_abortOperatorList({intentState:t,reason:e,force:i=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(e instanceof yd){let n=SM;e.extraDelay>0&&e.extraDelay<1e3&&(n+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},n);return}}if(t.streamReader.cancel(new Hr(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(let[n,s]of this._intentStates)if(s===t){this._intentStates.delete(n);break}this.cleanup()}}}get stats(){return this._stats}};ha=new WeakMap,tc=new WeakMap,ec=new WeakSet,vf=function(){if(!a(this,ha)||this.destroyed)return!1;for(let{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),p(this,ha,!1),!0};I2=Gw,Re=class Re{constructor({name:t=null,port:e=null,verbosity:i=K_()}={}){g(this,en);g(this,vo,Promise.withResolvers());g(this,Mr,null);g(this,da,null);g(this,ic,null);if(this.name=t,this.destroyed=!1,this.verbosity=i,e){if(a(Re,rc).has(e))throw new Error("Cannot use more than one PDFWorker per port.");a(Re,rc).set(e,this),b(this,en,UT).call(this,e)}else b(this,en,zT).call(this)}get promise(){return a(this,vo).promise}get port(){return a(this,da)}get messageHandler(){return a(this,Mr)}destroy(){this.destroyed=!0,a(this,ic)?.terminate(),p(this,ic,null),a(Re,rc).delete(a(this,da)),p(this,da,null),a(this,Mr)?.destroy(),p(this,Mr,null)}static create(t){let e=a(this,rc).get(t?.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new Re(t)}static get workerSrc(){if(yr.workerSrc)return yr.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Ot(this,"_setupFakeWorkerGlobal",(async()=>a(this,Ph,h0)?a(this,Ph,h0):(await import(/* @vite-ignore */ this.workerSrc)).WorkerMessageHandler)())}};vo=new WeakMap,Mr=new WeakMap,da=new WeakMap,ic=new WeakMap,Ty=new WeakMap,nc=new WeakMap,rc=new WeakMap,en=new WeakSet,u0=function(){a(this,vo).resolve(),a(this,Mr).send("configure",{verbosity:this.verbosity})},UT=function(t){p(this,da,t),p(this,Mr,new ml("main","worker",t)),a(this,Mr).on("ready",()=>{}),b(this,en,u0).call(this)},zT=function(){if(a(Re,nc)||a(Re,Ph,h0)){b(this,en,Ef).call(this);return}let{workerSrc:t}=Re;try{Re._isSameOrigin(window.location,t)||(t=Re._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new ml("main","worker",e),n=()=>{s.abort(),i.destroy(),e.terminate(),this.destroyed?a(this,vo).reject(new Error("Worker was destroyed")):b(this,en,Ef).call(this)},s=new AbortController;e.addEventListener("error",()=>{a(this,ic)||n()},{signal:s.signal}),i.on("test",l=>{if(s.abort(),this.destroyed||!l){n();return}p(this,Mr,i),p(this,da,e),p(this,ic,e),b(this,en,u0).call(this)}),i.on("ready",l=>{if(s.abort(),this.destroyed){n();return}try{o()}catch{b(this,en,Ef).call(this)}});let o=()=>{let l=new Uint8Array;i.send("test",l,[l.buffer])};o();return}catch{Oy("The worker has been disabled.")}b(this,en,Ef).call(this)},Ef=function(){a(Re,nc)||(Ut("Setting up fake worker."),p(Re,nc,!0)),Re._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){a(this,vo).reject(new Error("Worker was destroyed"));return}let e=new Gb;p(this,da,e);let i=`fake${Ze(Re,Ty)._++}`,n=new ml(i+"_worker",i,e);t.setup(n,e),p(this,Mr,new ml(i,i+"_worker",e)),b(this,en,u0).call(this)}).catch(t=>{a(this,vo).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},Ph=new WeakSet,h0=function(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}},g(Re,Ph),g(Re,Ty,0),g(Re,nc,!1),g(Re,rc,new WeakMap),Hn&&(p(Re,nc,!0),yr.workerSrc||(yr.workerSrc="./pdf.worker.mjs")),Re._isSameOrigin=(t,e)=>{let i=URL.parse(t);if(!i?.origin||i.origin==="null")return!1;let n=new URL(e,i);return i.origin===n.origin},Re._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};vd=Re,k2=class{constructor(t,e,i,n,s,o){g(this,jr);j(this,"downloadInfoCapability",Promise.withResolvers());g(this,Dn,null);g(this,sc,new Map);g(this,fa,null);g(this,Fr,new Map);g(this,ac,new Map);g(this,Oh,new Map);g(this,pa,null);this.messageHandler=t,this.loadingTask=e,p(this,fa,i),this.commonObjs=new W0,this.fontLoader=new Pb({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.enableHWA=n.enableHWA,this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.binaryDataFactory=s.binaryDataFactory,this.pagesMapper=o,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(t){let{_pageIndex:e}=t;a(this,Fr).set(e,t),a(this,ac).set(e,Promise.resolve(t))}get annotationStorage(){return Ot(this,"annotationStorage",new Gf)}getRenderingIntent(t,e=Da.ENABLE,i=null,n=!1,s=!1){let o=jn.DISPLAY,l=Hf;switch(t){case"any":o=jn.ANY;break;case"display":break;case"print":o=jn.PRINT;break;default:Ut(`getRenderingIntent - invalid intent: ${t}`)}let c=o&jn.PRINT&&i instanceof z0?i:this.annotationStorage;switch(e){case Da.DISABLE:o+=jn.ANNOTATIONS_DISABLE;break;case Da.ENABLE:break;case Da.ENABLE_FORMS:o+=jn.ANNOTATIONS_FORMS;break;case Da.ENABLE_STORAGE:o+=jn.ANNOTATIONS_STORAGE,l=c.serializable;break;default:Ut(`getRenderingIntent - invalid annotationMode: ${e}`)}n&&(o+=jn.IS_EDITING),s&&(o+=jn.OPLIST);let{ids:u,hash:h}=c.modifiedIds,d=[o,l.hash,h];return{renderingIntent:o,cacheKey:d.join("_"),annotationStorageSerializable:l,modifiedIds:u}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),a(this,pa)?.reject(new Error("Worker was destroyed during onPassword callback"));let t=[];for(let i of a(this,Fr).values())t.push(i._destroy());a(this,Fr).clear(),a(this,ac).clear(),a(this,Oh).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),a(this,sc).clear(),this.filterFactory.destroy(),Ad.cleanup(),a(this,fa)?.cancelAllRequests(new Hr("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(i,n)=>{Me(a(this,fa),"GetReader - no `BasePDFStream` instance available."),p(this,Dn,a(this,fa).getFullReader()),a(this,Dn).onProgress=s=>b(this,jr,d0).call(this,s),n.onPull=()=>{a(this,Dn).read().then(function({value:s,done:o}){if(o){n.close();return}Me(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{n.error(s)})},n.onCancel=s=>{a(this,Dn).cancel(s),n.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("ReaderHeadersReady",async i=>{await a(this,Dn).headersReady;let{isStreamingSupported:n,isRangeSupported:s,contentLength:o}=a(this,Dn);return n&&s&&(a(this,Dn).onProgress=null),{isStreamingSupported:n,isRangeSupported:s,contentLength:o}}),t.on("GetRangeReader",(i,n)=>{Me(a(this,fa),"GetRangeReader - no `BasePDFStream` instance available.");let s=a(this,fa).getRangeReader(i.begin,i.end);if(!s){n.close();return}n.onPull=()=>{s.read().then(function({value:o,done:l}){if(l){n.close();return}Me(o instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{n.error(o)})},n.onCancel=o=>{s.cancel(o),n.ready.catch(l=>{if(!this.destroyed)throw l})}}),t.on("GetDoc",({pdfInfo:i})=>{this.pagesMapper.pagesNumber=i.numPages,this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new D2(i,this))}),t.on("DocException",i=>{e._capability.reject(hn(i))}),t.on("PasswordRequest",i=>{p(this,pa,Promise.withResolvers());try{if(!e.onPassword)throw hn(i);let n=s=>{s instanceof Error?a(this,pa).reject(s):a(this,pa).resolve({password:s})};e.onPassword(n,i.code)}catch(n){a(this,pa).reject(n)}return a(this,pa).promise}),t.on("DataLoaded",i=>{b(this,jr,d0).call(this,{loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)}),t.on("StartRenderPage",i=>{if(this.destroyed)return;a(this,Fr).get(i.pageIndex)._startRenderPage(i.transparency,i.cacheKey)}),t.on("commonobj",([i,n,s])=>{if(this.destroyed||this.commonObjs.has(i))return null;switch(n){case"Font":if("error"in s){let d=s.error;Ut(`Error during font loading: ${d}`),this.commonObjs.resolve(i,d);break}let o=new Bb(s),l=this._params.pdfBug&&globalThis.FontInspector?.enabled?(d,f)=>globalThis.FontInspector.fontAdded(d,f):null,c=new Ob(o,l,s.charProcOperatorList,s.extra);this.fontLoader.bind(c).catch(()=>t.sendWithPromise("FontFallback",{id:i})).finally(()=>{c.fontExtraProperties||c.clearData(),this.commonObjs.resolve(i,c)});break;case"CopyLocalImage":let{imageRef:u}=s;Me(u,"The imageRef must be defined.");for(let d of a(this,Fr).values())for(let[,f]of d.objs)if(f?.ref===u)return f.dataLen?(this.commonObjs.resolve(i,structuredClone(f)),f.dataLen):null;break;case"FontPath":this.commonObjs.resolve(i,new jb(s));break;case"Image":this.commonObjs.resolve(i,s);break;case"Pattern":let h=new zb(s);this.commonObjs.resolve(i,h.getIR());break;default:throw new Error(`Got unknown common object type ${n}`)}return null}),t.on("obj",([i,n,s,o])=>{if(this.destroyed)return;let l=a(this,Fr).get(n);if(!l.objs.has(i)){if(l._intentStates.size===0){o?.bitmap?.close();return}switch(s){case"Image":case"Pattern":l.objs.resolve(i,o);break;default:throw new Error(`Got unknown object type ${s}`)}}}),t.on("DocProgress",i=>{this.destroyed||b(this,jr,d0).call(this,i)}),t.on("PrepareWebGPU",()=>{this.destroyed||hM()}),t.on("FetchBinaryData",async i=>{if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.binaryDataFactory)throw new Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(i)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&Ut("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:a(this,Dn)?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}extractPages(t){let e={pageInfos:t},i;if(this.annotationStorage.size>0){let{map:n,transfer:s}=this.annotationStorage.serializable;e.annotationStorage=n,i=s}return this.messageHandler.sendWithPromise("ExtractPages",e,i).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this.pagesMapper.pagesNumber)return Promise.reject(new Error("Invalid page request."));let e=t-1,i=this.pagesMapper.getPageId(t)-1,n=a(this,ac).get(e);if(n)return n;let s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then(o=>{if(this.destroyed)throw new Error("Transport destroyed");o.refStr&&a(this,Oh).set(o.refStr,i);let l=new I2(e,o,this,this.pagesMapper,this._params.pdfBug);return a(this,Fr).set(e,l),l});return a(this,ac).set(e,s),s}async getPageIndex(t){if(!Hb(t))throw new Error("Invalid pageIndex request.");let e=await this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}),i=this.pagesMapper.getPageNumber(e+1);if(i===0)throw new Error("GetPageIndex: page has been removed.");return i-1}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(t+1)-1,intent:e})}getFieldObjects(){return b(this,jr,Cf).call(this,"GetFieldObjects")}hasJSActions(){return b(this,jr,Cf).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return b(this,jr,Cf).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return b(this,jr,Cf).call(this,"GetOptionalContentConfig").then(e=>new A2(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata";return a(this,sc).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(e=>({info:e[0],metadata:e[1]?new b2(e[1]):null,contentDispositionFilename:a(this,Dn)?.filename??null,contentLength:a(this,Dn)?.contentLength??null,hasStructTree:e[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}getRawData(t){return this.messageHandler.sendWithPromise("GetRawData",t)}async startCleanup(t=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(let e of a(this,Fr).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),a(this,sc).clear(),this.filterFactory.destroy(!0),Ad.cleanup()}}cachedPageNumber(t){if(!Hb(t))return null;let e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,i=a(this,Oh).get(e);if(i>=0){let n=this.pagesMapper.getPageNumber(i+1);if(n!==0)return n}return null}};Dn=new WeakMap,sc=new WeakMap,fa=new WeakMap,Fr=new WeakMap,ac=new WeakMap,Oh=new WeakMap,pa=new WeakMap,jr=new WeakSet,Cf=function(t,e=null){return a(this,sc).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))},d0=function({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:e?li(Math.round(t/e*100),0,100):NaN})};N2=class{constructor(t){j(this,"_internalRenderTask",null);j(this,"onContinue",null);j(this,"onError",null);this._internalRenderTask=t}get promise(){return this._internalRenderTask.capability.promise}cancel(t=0){this._internalRenderTask.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this._internalRenderTask.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this._internalRenderTask;return t.form||t.canvas&&e?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}},dl=class dl{constructor({callback:t,params:e,objs:i,commonObjs:n,annotationCanvasMap:s,operatorList:o,pageIndex:l,canvasFactory:c,filterFactory:u,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:f=null,enableHWA:m=!1,operationsFilter:x=null}){g(this,Eo,null);this.callback=t,this.params=e,this.objs=i,this.commonObjs=n,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=o,this._pageIndex=l,this.canvasFactory=c,this.filterFactory=u,this._pdfBug=d,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=h===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new N2(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvas,this._canvasContext=e.canvas?null:e.canvasContext,this._enableHWA=m,this._dependencyTracker=e.dependencyTracker,this._imagesTracker=e.imagesTracker,this._operationsFilter=x}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(a(dl,oc).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");a(dl,oc).add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{viewport:i,transform:n,background:s,dependencyTracker:o,imagesTracker:l}=this.params,c=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new zu(c,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,o,l),this.gfx.beginDrawing({transform:n,viewport:i,transparency:t,background:s}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),a(this,Eo)&&(window.cancelAnimationFrame(a(this,Eo)),p(this,Eo,null)),a(dl,oc).delete(this._canvas),t||(t=new yd(`Rendering cancelled, page ${this._pageIndex+1}`,e)),this.callback(t),this.task.onError?.(t)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?p(this,Eo,window.requestAnimationFrame(()=>{p(this,Eo,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),a(dl,oc).delete(this._canvas),this.callback())))}};Eo=new WeakMap,oc=new WeakMap,g(dl,oc,new WeakSet);_2=dl,jT="5.6.205",HT="ada343803",dn=class dn{constructor({editor:t=null,uiManager:e=null}){g(this,ye);g(this,In,null);g(this,lc,null);g(this,Rh);g(this,oi,null);g(this,rm,!1);g(this,Lh,!1);g(this,ma,null);g(this,sm);g(this,Co,null);g(this,Pr,null);t?(p(this,Lh,!1),p(this,ma,t)):p(this,Lh,!0),p(this,Pr,t?._uiManager||e),p(this,sm,a(this,Pr)._eventBus),p(this,Rh,t?.color?.toUpperCase()||a(this,Pr)?.highlightColors.values().next().value||"#FFFF98"),a(dn,am)||p(dn,am,Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}static get _keyboardManager(){return Ot(this,"_keyboardManager",new Lc([[["Escape","mac+Escape"],dn.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],dn.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],dn.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],dn.prototype._moveToPrevious],[["Home","mac+Home"],dn.prototype._moveToBeginning],[["End","mac+End"],dn.prototype._moveToEnd]]))}renderButton(){let t=p(this,In,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",a(this,ma)&&(t.ariaControls=`${a(this,ma).id}_colorpicker_dropdown`);let e=a(this,Pr)._signal;t.addEventListener("click",b(this,ye,ll).bind(this),{signal:e}),t.addEventListener("keydown",b(this,ye,P2).bind(this),{signal:e});let i=p(this,lc,document.createElement("span"));return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=a(this,Rh),t.append(i),t}renderMainDropdown(){let t=p(this,oi,b(this,ye,M2).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===a(this,In)){b(this,ye,ll).call(this,t);return}let e=t.target.getAttribute("data-color");e&&b(this,ye,F2).call(this,e,t)}_moveToNext(t){if(!a(this,ye,qa)){b(this,ye,ll).call(this,t);return}if(t.target===a(this,In)){a(this,oi).firstElementChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===a(this,oi)?.firstElementChild||t.target===a(this,In)){a(this,ye,qa)&&this._hideDropdownFromKeyboard();return}a(this,ye,qa)||b(this,ye,ll).call(this,t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!a(this,ye,qa)){b(this,ye,ll).call(this,t);return}a(this,oi).firstElementChild?.focus()}_moveToEnd(t){if(!a(this,ye,qa)){b(this,ye,ll).call(this,t);return}a(this,oi).lastElementChild?.focus()}hideDropdown(){a(this,oi)?.classList.add("hidden"),a(this,In).ariaExpanded="false",a(this,Co)?.abort(),p(this,Co,null)}_hideDropdownFromKeyboard(){if(!a(this,Lh)){if(!a(this,ye,qa)){a(this,ma)?.unselect();return}this.hideDropdown(),a(this,In).focus({preventScroll:!0,focusVisible:a(this,rm)})}}updateColor(t){if(a(this,lc)&&(a(this,lc).style.backgroundColor=t),!a(this,oi))return;let e=a(this,Pr).highlightColors.values();for(let i of a(this,oi).children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){a(this,In)?.remove(),p(this,In,null),p(this,lc,null),a(this,oi)?.remove(),p(this,oi,null)}};In=new WeakMap,lc=new WeakMap,Rh=new WeakMap,oi=new WeakMap,rm=new WeakMap,Lh=new WeakMap,ma=new WeakMap,sm=new WeakMap,Co=new WeakMap,Pr=new WeakMap,am=new WeakMap,ye=new WeakSet,M2=function(){let t=document.createElement("div"),e=a(this,Pr)._signal;t.addEventListener("contextmenu",qn,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),a(this,ma)&&(t.id=`${a(this,ma).id}_colorpicker_dropdown`);for(let[i,n]of a(this,Pr).highlightColors){let s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",n),s.title=i,s.setAttribute("data-l10n-id",a(dn,am)[i]);let o=document.createElement("span");s.append(o),o.className="swatch",o.style.backgroundColor=n,s.ariaSelected=n===a(this,Rh),s.addEventListener("click",b(this,ye,F2).bind(this,n),{signal:e}),t.append(s)}return t.addEventListener("keydown",b(this,ye,P2).bind(this),{signal:e}),t},F2=function(t,e){e.stopPropagation(),a(this,sm).dispatch("switchannotationeditorparams",{source:this,type:Wt.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)},P2=function(t){dn._keyboardManager.exec(this,t)},ll=function(t){if(a(this,ye,qa)){this.hideDropdown();return}if(p(this,rm,t.detail===0),a(this,Co)||(p(this,Co,new AbortController),window.addEventListener("pointerdown",b(this,ye,GT).bind(this),{signal:a(this,Pr).combinedSignal(a(this,Co))})),a(this,In).ariaExpanded="true",a(this,oi)){a(this,oi).classList.remove("hidden");return}let e=p(this,oi,b(this,ye,M2).call(this));a(this,In).append(e)},GT=function(t){a(this,oi)?.contains(t.target)||this.hideDropdown()},qa=function(){return a(this,oi)&&!a(this,oi).classList.contains("hidden")},g(dn,am,null);qf=dn,fl=class fl{constructor(t){g(this,gs,null);g(this,om,null);g(this,Bh,null);p(this,om,t),p(this,Bh,t._uiManager),a(fl,lm)||p(fl,lm,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(a(this,gs))return a(this,gs);let{editorType:t,colorType:e,color:i}=a(this,om),n=p(this,gs,document.createElement("input"));return n.type="color",n.value=i||"#000000",n.className="basicColorPicker",n.tabIndex=0,n.setAttribute("data-l10n-id",a(fl,lm)[t]),n.addEventListener("input",()=>{a(this,Bh).updateParams(e,n.value)},{signal:a(this,Bh)._signal}),n}update(t){a(this,gs)&&(a(this,gs).value=t)}destroy(){a(this,gs)?.remove(),p(this,gs,null)}hideDropdown(){}};gs=new WeakMap,om=new WeakMap,Bh=new WeakMap,lm=new WeakMap,g(fl,lm,null);X0=fl;Y0=class{static CMYK_G([t,e,i,n]){return["G",1-Math.min(1,.3*t+.59*i+.11*e+n)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=of(t),[t,t,t]}static G_HTML([t]){let e=EC(t);return`#${e}${e}${e}`}static RGB_G([t,e,i]){return["G",.3*t+.59*e+.11*i]}static RGB_rgb(t){return t.map(of)}static RGB_HTML(t){return`#${t.map(EC).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,i,n]){return["RGB",1-Math.min(1,t+n),1-Math.min(1,i+n),1-Math.min(1,e+n)]}static CMYK_rgb([t,e,i,n]){return[of(1-Math.min(1,t+n)),of(1-Math.min(1,i+n)),of(1-Math.min(1,e+n))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,i]){let n=1-t,s=1-e,o=1-i,l=Math.min(n,s,o);return["CMYK",n,s,o,l]}},O2=class{create(t,e,i=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");let n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width",`${t}px`),n.setAttribute("height",`${e}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${t} ${e}`),n}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){se("Abstract method `_createSVG` called.")}},Bc=class extends O2{_createSVG(t){return document.createElementNS(Gs,t)}},DM=9,Uc=new WeakSet,IM=new Date().getTimezoneOffset()*60*1e3,Pf=class{static create(t){switch(t.data.annotationType){case qe.LINK:return new Wf(t);case qe.TEXT:return new B2(t);case qe.WIDGET:switch(t.data.fieldType){case"Tx":return new U2(t);case"Btn":return t.data.radioButton?new K0(t):t.data.checkBox?new j2(t):new H2(t);case"Ch":return new G2(t);case"Sig":return new z2(t)}return new Ma(t);case qe.POPUP:return new Xf(t);case qe.FREETEXT:return new Z0(t);case qe.LINE:return new Z2(t);case qe.SQUARE:return new Q2(t);case qe.CIRCLE:return new J2(t);case qe.POLYLINE:return new Q0(t);case qe.CARET:return new ew(t);case qe.INK:return new Yf(t);case qe.POLYGON:return new tw(t);case qe.HIGHLIGHT:return new J0(t);case qe.UNDERLINE:return new nw(t);case qe.SQUIGGLY:return new rw(t);case qe.STRIKEOUT:return new sw(t);case qe.STAMP:return new ty(t);case qe.FILEATTACHMENT:return new aw(t);default:return new Fe(t)}}},$w=class $w{constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}={}){g(this,cm);g(this,cc,null);g(this,Uh,!1);g(this,pr,null);this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,this.hasOwnCommentButton=!1,e&&(this.contentElement=this.container=this._createContainer(i)),n&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t?.str||e?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return $w._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:t}=this,e=this.annotationStorage?.getEditor(t.id);return e?e.getData():t}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}get commentButtonPosition(){let t=this.annotationStorage?.getEditor(this.data.id);if(t)return t.commentButtonPositionInPage;let{quadPoints:e,inkLists:i,rect:n}=this.data,s=-1/0,o=-1/0;if(e?.length>=8){for(let l=0;l<e.length;l+=8)e[l+1]>o?(o=e[l+1],s=e[l+2]):e[l+1]===o&&(s=Math.max(s,e[l+2]));return[s,o]}if(i?.length>=1){for(let l of i)for(let c=0,u=l.length;c<u;c+=2)l[c+1]>o?(o=l[c+1],s=l[c]):l[c+1]===o&&(s=Math.max(s,l[c]));if(s!==1/0)return[s,o]}return n?[n[2],n[3]]:null}_normalizePoint(t){let{page:{view:e},viewport:{rawDims:{pageWidth:i,pageHeight:n,pageX:s,pageY:o}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-s)/i,t[1]=100*(t[1]-o)/n,t}get commentText(){let{data:t}=this;return this.annotationStorage.getRawValue(`${Lf}${t.id}`)?.popup?.contents||t.contentsObj?.str||""}set commentText(t){let{data:e}=this,i={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:i})||this.annotationStorage.setValue(`${Lf}${e.id}`,{id:e.id,annotationType:e.annotationType,page:this.parent.page,popup:i,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){(a(this,pr)?.popup||this.popup)?.remove(),p(this,pr,this.popup=null)}updateEdited(t){if(!this.container)return;t.rect&&(a(this,cc)||p(this,cc,{rect:this.data.rect.slice(0)}));let{rect:e,popup:i}=t;e&&b(this,cm,R2).call(this,e);let n=a(this,pr)?.popup||this.popup;!n&&i?.text&&(this._createPopup(i),n=a(this,pr).popup),n&&(n.updateEdited(t),i?.deleted&&(n.remove(),p(this,pr,null),this.popup=null))}resetEdited(){a(this,cc)&&(b(this,cm,R2).call(this,a(this,cc).rect),a(this,pr)?.popup.resetEdited(),p(this,cc,null))}_createContainer(t){let{data:e,parent:{page:i,viewport:n}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",e.id),!(this instanceof Ma)&&!(this instanceof Wf)&&(s.tabIndex=0);let{style:o}=s;if(o.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(s.title=e.alternativeText),e.noRotate&&s.classList.add("norotate"),!e.rect||this instanceof Xf){let{rotation:y}=e;return!e.hasOwnCanvas&&y!==0&&this.setRotation(y,s),s}let{width:l,height:c}=this;if(!t&&e.borderStyle.width>0){o.borderWidth=`${e.borderStyle.width}px`;let y=e.borderStyle.horizontalCornerRadius,A=e.borderStyle.verticalCornerRadius;if(y>0||A>0){let v=`calc(${y}px * var(--total-scale-factor)) / calc(${A}px * var(--total-scale-factor))`;o.borderRadius=v}else if(this instanceof K0){let v=`calc(${l}px * var(--total-scale-factor)) / calc(${c}px * var(--total-scale-factor))`;o.borderRadius=v}switch(e.borderStyle.style){case Su.SOLID:o.borderStyle="solid";break;case Su.DASHED:o.borderStyle="dashed";break;case Su.BEVELED:Ut("Unimplemented border style: beveled");break;case Su.INSET:Ut("Unimplemented border style: inset");break;case Su.UNDERLINE:o.borderBottomStyle="solid";break;default:break}let w=e.borderColor||null;w?(p(this,Uh,!0),o.borderColor=mt.makeHexColor(w[0]|0,w[1]|0,w[2]|0)):o.borderWidth=0}let u=mt.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:h,pageHeight:d,pageX:f,pageY:m}=n.rawDims;o.left=`${100*(u[0]-f)/h}%`,o.top=`${100*(u[1]-m)/d}%`;let{rotation:x}=e;return e.hasOwnCanvas||x===0?(o.width=`${100*l/h}%`,o.height=`${100*c/d}%`):this.setRotation(x,s),s}setRotation(t,e=this.container){if(!this.data.rect)return;let{pageWidth:i,pageHeight:n}=this.parent.viewport.rawDims,{width:s,height:o}=this;t%180!==0&&([s,o]=[o,s]),e.style.width=`${100*s/i}%`,e.style.height=`${100*o/n}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(e,i,n)=>{let s=n.detail[e],o=s[0],l=s.slice(1);n.target.style[i]=Y0[`${o}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[i]:Y0[`${o}_rgb`](l)})};return Ot(this,"_commonActions",{display:e=>{let{display:i}=e.detail,n=i%2===1;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:i===1||i===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:i}=e.detail;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:i,noView:i})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{let i=e.detail.rotation;this.setRotation(i),this.annotationStorage.setValue(this.data.id,{rotation:i})}})}_dispatchEventFromSandbox(t,e){let i=this._commonActions;for(let n of Object.keys(e.detail))(t[n]||i[n])?.(e)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let i=this._commonActions;for(let[n,s]of Object.entries(e)){let o=i[n];if(o){let l={detail:{[n]:s},target:t};o(l),delete e[n]}}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:t}=this.data;if(!t)return;let[e,i,n,s]=this.data.rect.map(y=>Math.fround(y));if(t.length===8){let[y,A,w,v]=t.subarray(2,6);if(n===y&&s===A&&e===w&&i===v)return}let{style:o}=this.container,l;if(a(this,Uh)){let{borderColor:y,borderWidth:A}=o;o.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${y}" stroke-width="${A}">`],this.container.classList.add("hasBorder")}let c=n-e,u=s-i,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0),d.role="none";let f=h.createElement("defs");d.append(f);let m=h.createElement("clipPath"),x=`clippath_${this.data.id}`;m.setAttribute("id",x),m.setAttribute("clipPathUnits","objectBoundingBox"),f.append(m);for(let y=2,A=t.length;y<A;y+=8){let w=t[y],v=t[y+1],C=t[y+2],D=t[y+3],_=h.createElement("rect"),k=(C-e)/c,R=(s-v)/u,K=(w-C)/c,W=(v-D)/u;_.setAttribute("x",k),_.setAttribute("y",R),_.setAttribute("width",K),_.setAttribute("height",W),m.append(_),l?.push(`<rect vector-effect="non-scaling-stroke" x="${k}" y="${R}" width="${K}" height="${W}"/>`)}a(this,Uh)&&(l.push("</g></svg>')"),o.backgroundImage=l.join("")),this.container.append(d),this.container.style.clipPath=`url(#${x})`}_createPopup(t=null){let{data:e}=this,i,n;t?(i={str:t.text},n=t.date):(i=e.contentsObj,n=e.modificationDate),p(this,pr,new Xf({data:{color:e.color,titleObj:e.titleObj,modificationDate:n,contentsObj:i,richText:e.richText,parentRect:e.rect,borderStyle:0,id:`popup_${e.id}`,rotation:e.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]}))}get hasPopupElement(){return!!(a(this,pr)||this.popup||this.data.popupRef)}get extraPopupElement(){return a(this,pr)}render(){se("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){let i=[];if(this._fieldObjects){let n=this._fieldObjects[t];if(n)for(let{page:s,id:o,exportValues:l}of n){if(s===-1||o===e)continue;let c=typeof l=="string"?l:null,u=document.querySelector(`[data-element-id="${o}"]`);if(u&&!Uc.has(u)){Ut(`_getElementsByName - element not allowed: ${o}`);continue}i.push({id:o,exportValue:c,domElement:u})}return i}for(let n of document.getElementsByName(t)){let{exportValue:s}=n,o=n.getAttribute("data-element-id");o!==e&&Uc.has(n)&&i.push({id:o,exportValue:s,domElement:n})}return i}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(let e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}};cc=new WeakMap,Uh=new WeakMap,pr=new WeakMap,cm=new WeakSet,R2=function(t){let{container:{style:e},data:{rect:i,rotation:n},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:o,pageX:l,pageY:c}}}}=this;i?.splice(0,4,...t),e.left=`${100*(t[0]-l)/s}%`,e.top=`${100*(o-t[3]+c)/o}%`,n===0?(e.width=`${100*(t[2]-t[0])/s}%`,e.height=`${100*(t[3]-t[1])/o}%`):this.setRotation(n)};Fe=$w,L2=class extends Fe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){let{editor:t}=this;t.hasComment&&this._createPopup(t.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}},Wf=class extends Fe{constructor(e,i=null){super(e,{isRenderable:!0,ignoreBorder:!!i?.ignoreBorder,createQuadrilaterals:!0});g(this,$n);this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:i}=this,n=document.createElement("a");n.setAttribute("data-element-id",e.id);let s=!1;return e.url?(i.addLinkAttributes(n,e.url,e.newWindow),s=!0):e.action?(this._bindNamedAction(n,e.action,e.overlaidText),s=!0):e.attachment?(b(this,$n,$T).call(this,n,e.attachment,e.overlaidText,e.attachmentDest),s=!0):e.setOCGState?(b(this,$n,VT).call(this,n,e.setOCGState,e.overlaidText),s=!0):e.dest?(this._bindLink(n,e.dest,e.overlaidText),s=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),s=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(n,""),s=!0)),this.container.classList.add("linkAnnotation"),s&&(this.contentElement=n,this.container.append(n)),this.container}_bindLink(e,i,n=""){e.href=this.linkService.getDestinationHash(i),e.onclick=()=>(i&&this.linkService.goToDestination(i),!1),(i||i==="")&&b(this,$n,cl).call(this),n&&(e.title=n)}_bindNamedAction(e,i,n=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(i),!1),n&&(e.title=n),b(this,$n,cl).call(this)}_bindJSAction(e,i){e.href=this.linkService.getAnchorUrl("");let n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let s of Object.keys(i.actions)){let o=n.get(s);o&&(e[o]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i.id,name:s}}),!1))}i.overlaidText&&(e.title=i.overlaidText),e.onclick||(e.onclick=()=>!1),b(this,$n,cl).call(this)}_bindResetFormAction(e,i){let n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl("")),b(this,$n,cl).call(this),!this._fieldObjects){Ut('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(e.onclick=()=>!1);return}e.onclick=()=>{n?.();let{fields:s,refs:o,include:l}=i,c=[];if(s.length!==0||o.length!==0){let d=new Set(o);for(let f of s){let m=this._fieldObjects[f]||[];for(let{id:x}of m)d.add(x)}for(let f of Object.values(this._fieldObjects))for(let m of f)d.has(m.id)===l&&c.push(m)}else for(let d of Object.values(this._fieldObjects))c.push(...d);let u=this.annotationStorage,h=[];for(let d of c){let{id:f}=d;switch(h.push(f),d.type){case"text":{let x=d.defaultValue||"";u.setValue(f,{value:x});break}case"checkbox":case"radiobutton":{let x=d.defaultValue===d.exportValues;u.setValue(f,{value:x});break}case"combobox":case"listbox":{let x=d.defaultValue||"";u.setValue(f,{value:x});break}default:continue}let m=document.querySelector(`[data-element-id="${f}"]`);if(m){if(!Uc.has(m)){Ut(`_bindResetFormAction - element not allowed: ${f}`);continue}}else continue;m.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}}),!1}}};$n=new WeakSet,cl=function(){this.container.setAttribute("data-internal-link","")},$T=function(e,i,n="",s=null){e.href=this.linkService.getAnchorUrl(""),i.description?e.title=i.description:n&&(e.title=n),e.onclick=()=>(this.downloadManager?.openOrDownloadData(i.content,i.filename,s),!1),b(this,$n,cl).call(this)},VT=function(e,i,n=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(i),!1),n&&(e.title=n),b(this,$n,cl).call(this)};B2=class extends Fe{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(t),this.container}},Ma=class extends Fe{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return je.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,n,s){i.includes("mouse")?t.addEventListener(i,o=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(o),shift:o.shiftKey,modifier:this._getKeyModifier(o)}})}):t.addEventListener(i,o=>{if(i==="blur"){if(!e.focused||!o.relatedTarget)return;e.focused=!1}else if(i==="focus"){if(e.focused)return;e.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(o)}})})}_setEventListeners(t,e,i,n){for(let[s,o]of i)(o==="Action"||this.data.actions?.[o])&&((o==="Focus"||o==="Blur")&&(e||(e={focused:!1})),this._setEventListener(t,e,s,o,n),o==="Focus"&&!this.data.actions?.Blur?this._setEventListener(t,e,"blur","Blur",null):o==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":mt.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||DM,s=t.style,o,l=2,c=u=>Math.round(10*u)/10;if(this.data.multiLine){let u=Math.abs(this.data.rect[3]-this.data.rect[1]-l),h=Math.round(u/(Wg*n))||1,d=u/h;o=Math.min(n,c(d/Wg))}else{let u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);o=Math.min(n,c(u/Wg))}s.fontSize=`calc(${o}px * var(--total-scale-factor))`,s.color=mt.makeHexColor(i[0],i[1],i[2]),this.data.textAlignment!==null&&(s.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}},U2=class extends Ma{constructor(t){let e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,i,n){let s=this.annotationStorage;for(let o of this._getElementsByName(t.name,t.id))o.domElement&&(o.domElement[e]=i),s.setValue(o.id,{[n]:i})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){let n=t.getValue(e,{value:this.data.fieldValue}),s=n.value||"",o=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;o&&s.length>o&&(s=s.slice(0,o));let l=n.formattedValue||this.data.textContent?.join(`
59
+ `)||null;l&&this.data.comb&&(l=l.replaceAll(/\s+/g,""));let c={userValue:s,formattedValue:l,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=l??s,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type=this.data.password?"password":"text",i.setAttribute("value",l??s),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),Uc.add(i),this.contentElement=i,i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=0;let{datetimeFormat:u,datetimeType:h,timeStep:d}=this.data,f=!!h&&this.enableScripting;u&&(i.title=u),this._setRequired(i,this.data.required),o&&(i.maxLength=o),i.addEventListener("input",x=>{t.setValue(e,{value:x.target.value}),this.setPropertyOnSiblings(i,"value",x.target.value,"value"),c.formattedValue=null}),i.addEventListener("resetform",x=>{let y=this.data.defaultFieldValue??"";i.value=c.userValue=y,c.formattedValue=null});let m=x=>{let{formattedValue:y}=c;y!=null&&(x.target.value=y),x.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",y=>{if(c.focused)return;let{target:A}=y;if(f&&(A.type=h,d&&(A.step=d)),c.userValue){let w=c.userValue;if(f)if(h==="time"){let v=new Date(w),C=[v.getHours(),v.getMinutes(),v.getSeconds()];A.value=C.map(D=>D.toString().padStart(2,"0")).join(":")}else A.value=new Date(w-IM).toISOString().split(h==="date"?"T":".",1)[0];else A.value=w}c.lastCommittedValue=A.value,c.commitKey=1,this.data.actions?.Focus||(c.focused=!0)}),i.addEventListener("updatefromsandbox",y=>{this.showElementAndHideCanvas(y.target);let A={value(w){c.userValue=w.detail.value??"",f||t.setValue(e,{value:c.userValue.toString()}),w.target.value=c.userValue},formattedValue(w){let{formattedValue:v}=w.detail;c.formattedValue=v,v!=null&&w.target!==document.activeElement&&(w.target.value=v);let C={formattedValue:v};f&&(C.value=v),t.setValue(e,C)},selRange(w){w.target.setSelectionRange(...w.detail.selRange)},charLimit:w=>{let{charLimit:v}=w.detail,{target:C}=w;if(v===0){C.removeAttribute("maxLength");return}C.setAttribute("maxLength",v);let D=c.userValue;!D||D.length<=v||(D=D.slice(0,v),C.value=c.userValue=D,t.setValue(e,{value:D}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:D,willCommit:!0,commitKey:1,selStart:C.selectionStart,selEnd:C.selectionEnd}}))}};this._dispatchEventFromSandbox(A,y)}),i.addEventListener("keydown",y=>{c.commitKey=1;let A=-1;if(y.key==="Escape"?A=0:y.key==="Enter"&&!this.data.multiLine?A=2:y.key==="Tab"&&(c.commitKey=3),A===-1)return;let{value:w}=y.target;c.lastCommittedValue!==w&&(c.lastCommittedValue=w,c.userValue=w,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:w,willCommit:!0,commitKey:A,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}))});let x=m;m=null,i.addEventListener("blur",y=>{if(!c.focused||!y.relatedTarget)return;this.data.actions?.Blur||(c.focused=!1);let{target:A}=y,{value:w}=A;if(f){if(w&&h==="time"){let v=w.split(":").map(C=>parseInt(C,10));w=new Date(2e3,0,1,v[0],v[1],v[2]||0).valueOf(),A.step=""}else w.includes("T")||(w=`${w}T00:00`),w=new Date(w).valueOf();A.type="text"}c.userValue=w,c.lastCommittedValue!==w&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:w,willCommit:!0,commitKey:c.commitKey,selStart:y.target.selectionStart,selEnd:y.target.selectionEnd}}),x(y)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",y=>{c.lastCommittedValue=null;let{data:A,target:w}=y,{value:v,selectionStart:C,selectionEnd:D}=w,_=C,k=D;switch(y.inputType){case"deleteWordBackward":{let R=v.substring(0,C).match(/\w*[^\w]*$/);R&&(_-=R[0].length);break}case"deleteWordForward":{let R=v.substring(C).match(/^[^\w]*\w*/);R&&(k+=R[0].length);break}case"deleteContentBackward":C===D&&(_-=1);break;case"deleteContentForward":C===D&&(k+=1);break}y.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:v,change:A||"",willCommit:!1,selStart:_,selEnd:k}})}),this._setEventListeners(i,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],y=>y.target.value)}if(m&&i.addEventListener("blur",m),this.data.comb){let y=(this.data.rect[2]-this.data.rect[0])/o;i.classList.add("comb"),i.style.letterSpacing=`calc(${y}px * var(--total-scale-factor) - 1ch)`}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},z2=class extends Ma{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}},j2=class extends Ma{constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,i=e.id,n=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;typeof n=="string"&&(n=n!=="Off",t.setValue(i,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let s=document.createElement("input");return Uc.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=e.fieldName,n&&s.setAttribute("checked",!0),s.setAttribute("exportValue",e.exportValue),s.tabIndex=0,s.addEventListener("change",o=>{let{name:l,checked:c}=o.target;for(let u of this._getElementsByName(l,i)){let h=c&&u.exportValue===e.exportValue;u.domElement&&(u.domElement.checked=h),t.setValue(u.id,{value:h})}t.setValue(i,{value:c})}),s.addEventListener("resetform",o=>{let l=e.defaultFieldValue||"Off";o.target.checked=l===e.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",o=>{let l={value(c){c.target.checked=c.detail.value!=="Off",t.setValue(i,{value:c.target.checked})}};this._dispatchEventFromSandbox(l,o)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}},K0=class extends Ma{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,i=e.id,n=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if(typeof n=="string"&&(n=n!==e.buttonValue,t.setValue(i,{value:n})),n)for(let o of this._getElementsByName(e.fieldName,i))t.setValue(o.id,{value:!1});let s=document.createElement("input");if(Uc.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=e.fieldName,n&&s.setAttribute("checked",!0),s.tabIndex=0,s.addEventListener("change",o=>{let{name:l,checked:c}=o.target;for(let u of this._getElementsByName(l,i))t.setValue(u.id,{value:!1});t.setValue(i,{value:c})}),s.addEventListener("resetform",o=>{let l=e.defaultFieldValue;o.target.checked=l!=null&&l===e.buttonValue}),this.enableScripting&&this.hasJSActions){let o=e.buttonValue;s.addEventListener("updatefromsandbox",l=>{let c={value:u=>{let h=o===u.detail.value;for(let d of this._getElementsByName(u.target.name)){let f=h&&d.id===i;d.domElement&&(d.domElement.checked=f),t.setValue(d.id,{value:f})}}};this._dispatchEventFromSandbox(c,l)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],l=>l.target.checked)}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}},H2=class extends Wf{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){let t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");let e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",i=>{this._dispatchEventFromSandbox({},i)})),t}},G2=class extends Ma{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),n=document.createElement("select");Uc.add(n),n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=0;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",d=>{let f=this.data.defaultFieldValue;for(let m of n.options)m.selected=m.value===f});let o=(d,f)=>{let m=f.replaceAll(" ","\xA0");d.textContent=m,m!==f&&d.setAttribute("display-value",f)};for(let d of this.data.options){let f=document.createElement("option");o(f,d.displayValue),f.value=d.exportValue,i.value.includes(d.exportValue)&&(f.setAttribute("selected",!0),s=!1),n.append(f)}let l=null;if(s){let d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),n.prepend(d),l=()=>{d.remove(),n.removeEventListener("input",l),l=null},n.addEventListener("input",l)}let c=d=>{let f=d?"value":"textContent",{options:m,multiple:x}=n;return x?Array.prototype.filter.call(m,y=>y.selected).map(y=>y[f]):m.selectedIndex===-1?null:m[m.selectedIndex][f]},u=c(!1),h=d=>{let f=d.target.options;return Array.prototype.map.call(f,m=>({displayValue:m.getAttribute("display-value")||m.textContent,exportValue:m.value}))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",d=>{let f={value(m){l?.();let x=m.detail.value,y=new Set(Array.isArray(x)?x:[x]);for(let A of n.options)A.selected=y.has(A.value);t.setValue(e,{value:c(!0)}),u=c(!1)},multipleSelection(m){n.multiple=!0},remove(m){let x=n.options,y=m.detail.remove;x[y].selected=!1,n.remove(y),x.length>0&&Array.prototype.findIndex.call(x,w=>w.selected)===-1&&(x[0].selected=!0),t.setValue(e,{value:c(!0),items:h(m)}),u=c(!1)},clear(m){for(;n.length!==0;)n.remove(0);t.setValue(e,{value:null,items:[]}),u=c(!1)},insert(m){let{index:x,displayValue:y,exportValue:A}=m.detail.insert,w=n.children[x],v=document.createElement("option");o(v,y),v.value=A,w?w.before(v):n.append(v),t.setValue(e,{value:c(!0),items:h(m)}),u=c(!1)},items(m){let{items:x}=m.detail;for(;n.length!==0;)n.remove(0);for(let y of x){let{displayValue:A,exportValue:w}=y,v=document.createElement("option");o(v,A),v.value=w,n.append(v)}n.options.length>0&&(n.options[0].selected=!0),t.setValue(e,{value:c(!0),items:h(m)}),u=c(!1)},indices(m){let x=new Set(m.detail.indices);for(let y of m.target.options)y.selected=x.has(y.index);t.setValue(e,{value:c(!0)}),u=c(!1)},editable(m){m.target.disabled=!m.detail.editable}};this._dispatchEventFromSandbox(f,d)}),n.addEventListener("input",d=>{let f=c(!0),m=c(!1);t.setValue(e,{value:f}),d.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:u,change:m,changeEx:f,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):n.addEventListener("input",function(d){t.setValue(e,{value:c(!0)})}),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},Xf=class extends Fe{constructor(e){let{data:i,elements:n,parent:s}=e,o=!!s._commentManager;super(e,{isRenderable:!o&&Fe._hasPopupData(i)});g(this,um);if(this.elements=n,o&&Fe._hasPopupData(i)){let l=this.popup=b(this,um,$2).call(this);for(let c of n)c.popup=l}else this.popup=null}render(){let{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";let i=this.popup=b(this,um,$2).call(this),n=[];for(let s of this.elements)s.popup=i,s.container.ariaHasPopup="dialog",n.push(s.data.id),s.addHighlightArea();return this.container.setAttribute("aria-controls",n.map(s=>`${Ou}${s}`).join(",")),this.container}};um=new WeakSet,$2=function(){return new V2({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,commentManager:this.parent._commentManager})};V2=class{constructor({container:t,color:e,elements:i,titleObj:n,modificationDate:s,contentsObj:o,richText:l,parent:c,rect:u,parentRect:h,open:d,commentManager:f=null}){g(this,Ht);g(this,kn,null);g(this,To,b(this,Ht,XT).bind(this));g(this,Sy,b(this,Ht,K2).bind(this));g(this,Dy,b(this,Ht,g0).bind(this));g(this,zh,b(this,Ht,m0).bind(this));g(this,jh,null);g(this,Ue,null);g(this,ys,null);g(this,So,null);g(this,uc,null);g(this,Hh,null);g(this,Gh,null);g(this,xs,!1);g(this,Nn,null);g(this,ga,null);g(this,ya,null);g(this,ze,null);g(this,xa,null);g(this,Do,null);g(this,hm,null);g(this,ba,null);g(this,$h,null);g(this,hc,null);g(this,Io,!1);g(this,pi,null);g(this,ko,null);p(this,Ue,t),p(this,$h,n),p(this,ys,o),p(this,ba,l),p(this,Hh,c),p(this,jh,e),p(this,hm,u),p(this,Gh,h),p(this,uc,i),p(this,kn,f),p(this,pi,i[0]),p(this,So,Oc.toDateObject(s)),this.trigger=i.flatMap(m=>m.getElementsToTriggerPopup()),f||(b(this,Ht,f0).call(this),a(this,Ue).hidden=!0,d&&b(this,Ht,m0).call(this))}renderCommentButton(){if(a(this,ze)){a(this,ze).parentNode||a(this,pi).container.after(a(this,ze));return}if(a(this,xa)||b(this,Ht,q2).call(this),!a(this,xa))return;let{signal:t}=p(this,ga,new AbortController),e=a(this,pi).hasOwnCommentButton,i=()=>{a(this,kn).toggleCommentPopup(this,!0,void 0,!e)},n=()=>{a(this,kn).toggleCommentPopup(this,!1,!0,!e)},s=()=>{a(this,kn).toggleCommentPopup(this,!1,!1)};if(e){p(this,ze,a(this,pi).container);for(let o of this.trigger)o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.addEventListener("keydown",a(this,To),{signal:t}),o.addEventListener("click",i,{signal:t}),o.addEventListener("pointerenter",n,{signal:t}),o.addEventListener("pointerleave",s,{signal:t}),o.classList.add("popupTriggerArea")}else{let o=p(this,ze,document.createElement("button"));o.className="annotationCommentButton";let l=a(this,pi).container;o.style.zIndex=l.style.zIndex+1,o.tabIndex=0,o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.setAttribute("data-l10n-id","pdfjs-show-comment-button"),b(this,Ht,X2).call(this),b(this,Ht,W2).call(this),o.addEventListener("keydown",a(this,To),{signal:t}),o.addEventListener("click",i,{signal:t}),o.addEventListener("pointerenter",n,{signal:t}),o.addEventListener("pointerleave",s,{signal:t}),l.after(o)}}get commentButtonColor(){let{color:t,opacity:e}=a(this,pi).commentData;return t?a(this,Hh)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{a(this,ze)?.focus()},0)}getData(){let{richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}=a(this,pi).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}}get elementBeforePopup(){return a(this,ze)}get comment(){return a(this,ko)||p(this,ko,a(this,pi).commentText),a(this,ko)}set comment(t){t!==this.comment&&(a(this,pi).commentText=p(this,ko,t))}focus(){a(this,pi).container?.focus()}get parentBoundingClientRect(){return a(this,pi).layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){a(this,ze)&&(a(this,ze).classList.toggle("selected",t),a(this,ze).ariaExpanded=e)}setSelectedCommentButton(t){a(this,ze).classList.toggle("selected",t)}get commentPopupPosition(){if(a(this,Do))return a(this,Do);let{x:t,y:e,height:i}=a(this,ze).getBoundingClientRect(),{x:n,y:s,width:o,height:l}=a(this,pi).layer.getBoundingClientRect();return[(t-n)/o,(e+i-s)/l]}set commentPopupPosition(t){p(this,Do,t)}hasDefaultPopupPosition(){return a(this,Do)===null}get commentButtonPosition(){return a(this,xa)}get commentButtonWidth(){return a(this,ze).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,i]=a(this,Do)||this.commentButtonPosition.map(u=>u/100),n=this.parentBoundingClientRect,{x:s,y:o,width:l,height:c}=n;a(this,kn).showDialog(null,this,s+e*l,o+i*c,{...t,parentDimensions:n})}render(){if(a(this,Nn))return;let t=p(this,Nn,document.createElement("div"));if(t.className="popup",a(this,jh)){let i=t.style.outlineColor=mt.makeHexColor(...a(this,jh));t.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`}let e=document.createElement("span");if(e.className="header",a(this,$h)?.str){let i=document.createElement("span");i.className="title",e.append(i),{dir:i.dir,str:i.textContent}=a(this,$h)}if(t.append(e),a(this,So)){let i=document.createElement("time");i.className="popupDate",i.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),i.setAttribute("data-l10n-args",JSON.stringify({dateObj:a(this,So).valueOf()})),i.dateTime=a(this,So).toISOString(),e.append(i)}Lw({html:a(this,Ht,p0)||a(this,ys).str,dir:a(this,ys)?.dir,className:"popupContent"},t),a(this,Ue).append(t)}updateEdited({rect:t,popup:e,deleted:i}){if(a(this,kn)){i?(this.remove(),p(this,ko,null)):e&&(e.deleted?this.remove():(b(this,Ht,X2).call(this),p(this,ko,e.text))),t&&(p(this,xa,null),b(this,Ht,q2).call(this),b(this,Ht,W2).call(this));return}if(i||e?.deleted){this.remove();return}b(this,Ht,f0).call(this),a(this,hc)||p(this,hc,{contentsObj:a(this,ys),richText:a(this,ba)}),t&&p(this,ya,null),e&&e.text&&(p(this,ba,b(this,Ht,WT).call(this,e.text)),p(this,So,Oc.toDateObject(e.date)),p(this,ys,null)),a(this,Nn)?.remove(),p(this,Nn,null)}resetEdited(){a(this,hc)&&({contentsObj:Ze(this,ys)._,richText:Ze(this,ba)._}=a(this,hc),p(this,hc,null),a(this,Nn)?.remove(),p(this,Nn,null),p(this,ya,null))}remove(){if(a(this,ga)?.abort(),p(this,ga,null),a(this,Nn)?.remove(),p(this,Nn,null),p(this,Io,!1),p(this,xs,!1),a(this,ze)?.remove(),p(this,ze,null),this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}forceHide(){p(this,Io,this.isVisible),a(this,Io)&&(a(this,Ue).hidden=!0)}maybeShow(){a(this,kn)||(b(this,Ht,f0).call(this),a(this,Io)&&(a(this,Nn)||b(this,Ht,g0).call(this),p(this,Io,!1),a(this,Ue).hidden=!1))}get isVisible(){return a(this,kn)?!1:a(this,Ue).hidden===!1}};kn=new WeakMap,To=new WeakMap,Sy=new WeakMap,Dy=new WeakMap,zh=new WeakMap,jh=new WeakMap,Ue=new WeakMap,ys=new WeakMap,So=new WeakMap,uc=new WeakMap,Hh=new WeakMap,Gh=new WeakMap,xs=new WeakMap,Nn=new WeakMap,ga=new WeakMap,ya=new WeakMap,ze=new WeakMap,xa=new WeakMap,Do=new WeakMap,hm=new WeakMap,ba=new WeakMap,$h=new WeakMap,hc=new WeakMap,Io=new WeakMap,pi=new WeakMap,ko=new WeakMap,Ht=new WeakSet,f0=function(){if(a(this,ga))return;p(this,ga,new AbortController);let{signal:t}=a(this,ga);for(let e of this.trigger)e.addEventListener("click",a(this,zh),{signal:t}),e.addEventListener("pointerenter",a(this,Dy),{signal:t}),e.addEventListener("pointerleave",a(this,Sy),{signal:t}),e.classList.add("popupTriggerArea");for(let e of a(this,uc))e.container?.addEventListener("keydown",a(this,To),{signal:t})},q2=function(){let t=a(this,uc).find(e=>e.hasCommentButton);t&&p(this,xa,t._normalizePoint(t.commentButtonPosition))},W2=function(){if(a(this,pi).extraPopupElement&&!a(this,pi).editor)return;a(this,ze)||this.renderCommentButton();let[t,e]=a(this,xa),{style:i}=a(this,ze);i.left=`calc(${t}%)`,i.top=`calc(${e}% - var(--comment-button-dim))`},X2=function(){a(this,pi).extraPopupElement||(a(this,ze)||this.renderCommentButton(),a(this,ze).style.backgroundColor=this.commentButtonColor||"")},p0=function(){let t=a(this,ba),e=a(this,ys);return t?.str&&(!e?.str||e.str===t.str)&&a(this,ba).html||null},Y2=function(){return a(this,Ht,p0)?.attributes?.style?.fontSize||0},qT=function(){return a(this,Ht,p0)?.attributes?.style?.color||null},WT=function(t){let e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},n={style:{color:a(this,Ht,qT),fontSize:a(this,Ht,Y2)?`calc(${a(this,Ht,Y2)}px * var(--total-scale-factor))`:""}};for(let s of t.split(`
60
+ `))e.push({name:"span",value:s,attributes:n});return i},XT=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&a(this,xs))&&b(this,Ht,m0).call(this)},YT=function(){if(a(this,ya)!==null)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:s}}}=a(this,Hh),o=!!a(this,Gh),l=o?a(this,Gh):a(this,hm);for(let x of a(this,uc))if(!l||mt.intersect(x.data.rect,l)!==null){l=x.data.rect,o=!0;break}let c=mt.normalizeRect([l[0],t[3]-l[1]+t[1],l[2],t[3]-l[3]+t[1]]),h=o?l[2]-l[0]+5:0,d=c[0]+h,f=c[1];p(this,ya,[100*(d-n)/e,100*(f-s)/i]);let{style:m}=a(this,Ue);m.left=`${a(this,ya)[0]}%`,m.top=`${a(this,ya)[1]}%`},m0=function(){if(a(this,kn)){a(this,kn).toggleCommentPopup(this,!1);return}p(this,xs,!a(this,xs)),a(this,xs)?(b(this,Ht,g0).call(this),a(this,Ue).addEventListener("click",a(this,zh)),a(this,Ue).addEventListener("keydown",a(this,To))):(b(this,Ht,K2).call(this),a(this,Ue).removeEventListener("click",a(this,zh)),a(this,Ue).removeEventListener("keydown",a(this,To)))},g0=function(){a(this,Nn)||this.render(),this.isVisible?a(this,xs)&&a(this,Ue).classList.add("focused"):(b(this,Ht,YT).call(this),a(this,Ue).hidden=!1,a(this,Ue).style.zIndex=parseInt(a(this,Ue).style.zIndex)+1e3)},K2=function(){a(this,Ue).classList.remove("focused"),!(a(this,xs)||!this.isVisible)&&(a(this,Ue).hidden=!0,a(this,Ue).style.zIndex=parseInt(a(this,Ue).style.zIndex)-1e3)};Z0=class extends Fe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=Pt.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=this.contentElement=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(let e of this.textContent){let i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},Z2=class extends Fe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});g(this,dm,null)}render(){this.container.classList.add("lineAnnotation");let{data:e,width:i,height:n}=this,s=this.svgFactory.create(i,n,!0),o=p(this,dm,this.svgFactory.createElement("svg:line"));return o.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),o.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),o.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),o.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),o.setAttribute("stroke-width",e.borderStyle.width||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),s.append(o),this.container.append(s),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return a(this,dm)}addHighlightArea(){this.container.classList.add("highlightArea")}};dm=new WeakMap;Q2=class extends Fe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});g(this,fm,null)}render(){this.container.classList.add("squareAnnotation");let{data:e,width:i,height:n}=this,s=this.svgFactory.create(i,n,!0),o=e.borderStyle.width,l=p(this,fm,this.svgFactory.createElement("svg:rect"));return l.setAttribute("x",o/2),l.setAttribute("y",o/2),l.setAttribute("width",i-o),l.setAttribute("height",n-o),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),s.append(l),this.container.append(s),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return a(this,fm)}addHighlightArea(){this.container.classList.add("highlightArea")}};fm=new WeakMap;J2=class extends Fe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});g(this,pm,null)}render(){this.container.classList.add("circleAnnotation");let{data:e,width:i,height:n}=this,s=this.svgFactory.create(i,n,!0),o=e.borderStyle.width,l=p(this,pm,this.svgFactory.createElement("svg:ellipse"));return l.setAttribute("cx",i/2),l.setAttribute("cy",n/2),l.setAttribute("rx",i/2-o/2),l.setAttribute("ry",n/2-o/2),l.setAttribute("stroke-width",o||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),s.append(l),this.container.append(s),!e.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return a(this,pm)}addHighlightArea(){this.container.classList.add("highlightArea")}};pm=new WeakMap;Q0=class extends Fe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});g(this,mm,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,vertices:i,borderStyle:n,popupRef:s},width:o,height:l}=this;if(!i)return this.container;let c=this.svgFactory.create(o,l,!0),u=[];for(let d=0,f=i.length;d<f;d+=2){let m=i[d]-e[0],x=e[3]-i[d+1];u.push(`${m},${x}`)}u=u.join(" ");let h=p(this,mm,this.svgFactory.createElement(this.svgElementName));return h.setAttribute("points",u),h.setAttribute("stroke-width",n.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),c.append(h),this.container.append(c),!s&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return a(this,mm)}addHighlightArea(){this.container.classList.add("highlightArea")}};mm=new WeakMap;tw=class extends Q0{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}},ew=class extends Fe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}},Yf=class extends Fe{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});g(this,ym);g(this,gm,null);g(this,dc,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?Pt.HIGHLIGHT:Pt.INK}render(){this.container.classList.add(this.containerClassName);let{data:{rect:e,rotation:i,inkLists:n,borderStyle:s,popupRef:o}}=this,{transform:l,width:c,height:u}=b(this,ym,iw).call(this,i,e),h=this.svgFactory.create(c,u,!0),d=p(this,gm,this.svgFactory.createElement("svg:g"));h.append(d),d.setAttribute("stroke-width",s.width||1),d.setAttribute("stroke-linecap","round"),d.setAttribute("stroke-linejoin","round"),d.setAttribute("stroke-miterlimit",10),d.setAttribute("stroke","transparent"),d.setAttribute("fill","transparent"),d.setAttribute("transform",l);for(let f=0,m=n.length;f<m;f++){let x=this.svgFactory.createElement(this.svgElementName);a(this,dc).push(x),x.setAttribute("points",n[f].join(",")),d.append(x)}return!o&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(h),this._editOnDoubleClick(),this.container}updateEdited(e){super.updateEdited(e);let{thickness:i,points:n,rect:s}=e,o=a(this,gm);if(i>=0&&o.setAttribute("stroke-width",i||1),n)for(let l=0,c=a(this,dc).length;l<c;l++)a(this,dc)[l].setAttribute("points",n[l].join(","));if(s){let{transform:l,width:c,height:u}=b(this,ym,iw).call(this,this.data.rotation,s);o.parentElement.setAttribute("viewBox",`0 0 ${c} ${u}`),o.setAttribute("transform",l)}}getElementsToTriggerPopup(){return a(this,dc)}addHighlightArea(){this.container.classList.add("highlightArea")}};gm=new WeakMap,dc=new WeakMap,ym=new WeakSet,iw=function(e,i){switch(e){case 90:return{transform:`rotate(90) translate(${-i[0]},${i[1]}) scale(1,-1)`,width:i[3]-i[1],height:i[2]-i[0]};case 180:return{transform:`rotate(180) translate(${-i[2]},${i[1]}) scale(1,-1)`,width:i[2]-i[0],height:i[3]-i[1]};case 270:return{transform:`rotate(270) translate(${-i[2]},${i[3]}) scale(1,-1)`,width:i[3]-i[1],height:i[2]-i[0]};default:return{transform:`translate(${-i[0]},${i[3]}) scale(1,-1)`,width:i[2]-i[0],height:i[3]-i[1]}}};J0=class extends Fe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=Pt.HIGHLIGHT}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){let i=document.createElement("mark");i.classList.add("overlaidText"),i.textContent=t,this.container.append(i)}return this.container}},nw=class extends Fe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),t){let i=document.createElement("u");i.classList.add("overlaidText"),i.textContent=t,this.container.append(i)}return this.container}},rw=class extends Fe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),t){let i=document.createElement("u");i.classList.add("overlaidText"),i.textContent=t,this.container.append(i)}return this.container}},sw=class extends Fe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),t){let i=document.createElement("s");i.classList.add("overlaidText"),i.textContent=t,this.container.append(i)}return this.container}},ty=class extends Fe{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=Pt.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}},aw=class extends Fe{constructor(e){super(e,{isRenderable:!0});g(this,bm);g(this,xm,null);let{file:i}=this.data;this.filename=i.filename,this.content=i.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...i})}render(){this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:i}=this,n;i.hasAppearance||i.fillAlpha===0?n=document.createElement("div"):(n=document.createElement("img"),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(i.name)?"paperclip":"pushpin"}.svg`,i.fillAlpha&&i.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(i.fillAlpha*100)}%);`)),n.addEventListener("dblclick",b(this,bm,ow).bind(this)),p(this,xm,n);let{isMac:s}=je.platform;return e.addEventListener("keydown",o=>{o.key==="Enter"&&(s?o.metaKey:o.ctrlKey)&&b(this,bm,ow).call(this)}),!i.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):n.classList.add("popupTriggerArea"),e.append(n),e}getElementsToTriggerPopup(){return a(this,xm)}addHighlightArea(){this.container.classList.add("highlightArea")}};xm=new WeakMap,bm=new WeakSet,ow=function(){this.downloadManager?.openOrDownloadData(this.content,this.filename)};Vw=class Vw{constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:n,page:s,viewport:o,structTreeLayer:l,commentManager:c,linkService:u,annotationStorage:h}){g(this,ka);g(this,fc,null);g(this,pc,null);g(this,Vh,null);g(this,No,new Map);g(this,wm,null);g(this,mc,null);g(this,_n,[]);g(this,Am,!1);this.div=t,p(this,fc,e),p(this,pc,i),p(this,wm,l||null),p(this,mc,u||null),p(this,Vh,h||new Gf),this.page=s,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=n,this._commentManager=c||null}hasEditableAnnotations(){return a(this,No).size>0}async render(t){let{annotations:e}=t,i=this.div;Ho(i,this.viewport);let n=new Map,s=[],o={data:null,layer:i,linkService:a(this,mc),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Bc,annotationStorage:a(this,Vh),enableComment:t.enableComment===!0,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let l of e){if(l.noHTML)continue;let c=l.annotationType===qe.POPUP;if(c){let d=n.get(l.id);if(!d)continue;if(!this._commentManager){s.push(l);continue}o.elements=d}else if(l.rect[2]===l.rect[0]||l.rect[3]===l.rect[1])continue;o.data=l;let u=Pf.create(o);if(!u.isRenderable)continue;c||(a(this,_n).push(u),l.popupRef&&n.getOrInsertComputed(l.popupRef,Ly).push(u));let h=u.render();l.hidden&&(h.style.visibility="hidden"),u._isEditable&&(a(this,No).set(u.data.id,u),this._annotationEditorUIManager?.renderAnnotationElement(u))}await b(this,ka,y0).call(this);for(let l of s){let c=o.elements=n.get(l.id);o.data=l;let u=Pf.create(o);if(!u.isRenderable)continue;let h=u.render();u.contentElement.id=`${Ou}${l.id}`,l.hidden&&(h.style.visibility="hidden"),c.at(-1).container.after(h)}b(this,ka,lw).call(this)}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:a(this,mc),svgFactory:new Bc,parent:this};for(let i of t){i.borderStyle||(i.borderStyle=Vw._defaultBorderStyle),e.data=i;let n=Pf.create(e);n.isRenderable&&(n.render(),n.contentElement.id=`${Ou}${i.id}`,a(this,_n).push(n))}await b(this,ka,y0).call(this)}update({viewport:t}){let e=this.div;this.viewport=t,Ho(e,{rotation:t.rotation}),b(this,ka,lw).call(this),e.hidden=!1}getEditableAnnotations(){return a(this,No).values()}getEditableAnnotation(t){return a(this,No).get(t)}addFakeAnnotation(t){let{div:e}=this,{id:i,rotation:n}=t,s=new L2({data:{id:i,rect:t.getPDFRect(),rotation:n},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:a(this,mc),annotationStorage:a(this,Vh)});return s.render(),s.contentElement.id=`${Ou}${i}`,s.createOrUpdatePopup(),a(this,_n).push(s),s}removeAnnotation(t){let e=a(this,_n).findIndex(n=>n.data.id===t);if(e<0)return;let[i]=a(this,_n).splice(e,1);a(this,fc)?.removePointerInTextLayer(i.contentElement)}updateFakeAnnotations(t){if(t.length!==0){for(let e of t)e.updateFakeAnnotationElement(this);b(this,ka,y0).call(this)}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return Ot(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Su.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};fc=new WeakMap,pc=new WeakMap,Vh=new WeakMap,No=new WeakMap,wm=new WeakMap,mc=new WeakMap,_n=new WeakMap,Am=new WeakMap,ka=new WeakSet,y0=async function(){if(a(this,_n).length===0)return;this.div.replaceChildren();let t=[];if(!a(this,Am)){p(this,Am,!0);for(let{contentElement:i,data:{id:n}}of a(this,_n)){let s=i.id=`${Ou}${n}`;t.push(a(this,wm)?.getAriaAttributes(s).then(o=>{if(o)for(let[l,c]of o)i.setAttribute(l,c)}))}}a(this,_n).sort(({data:{rect:[i,n,s,o]}},{data:{rect:[l,c,u,h]}})=>{if(i===s&&n===o)return 1;if(l===u&&c===h)return-1;let d=o,f=n,m=(n+o)/2,x=h,y=c,A=(c+h)/2;if(m>=x&&A<=f)return-1;if(A>=d&&m<=y)return 1;let w=(i+s)/2,v=(l+u)/2;return w-v});let e=document.createDocumentFragment();for(let i of a(this,_n))e.append(i.container),this._commentManager?(i.extraPopupElement?.popup||i.popup)?.renderCommentButton():i.extraPopupElement&&e.append(i.extraPopupElement.render());if(this.div.append(e),await Promise.all(t),a(this,fc))for(let i of a(this,_n))a(this,fc).addPointerInTextLayer(i.contentElement,!1)},lw=function(){if(!a(this,pc))return;let t=this.div;for(let[e,i]of a(this,pc)){let n=t.querySelector(`[data-annotation-id="${e}"]`);if(!n)continue;i.className="annotationContent";let{firstChild:s}=n;s?s.nodeName==="CANVAS"?s.replaceWith(i):s.classList.contains("annotationContent")?s.after(i):s.before(i):n.append(i);let o=a(this,No).get(e);o&&(o._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,n.id,i),o._hasNoCanvas=!1):o.canvas=i)}a(this,pc).clear()};ey=Vw,Gg=/\r\n?|\n/g,Ee=class Ee extends Ae{constructor(e){super({...e,name:"freeTextEditor"});g(this,ii);g(this,Mn,"");g(this,vm,`${this.id}-editor`);g(this,gc,null);g(this,Fn);j(this,"_colorPicker",null);this.color=e.color||Ee._defaultColor||Ae._defaultLineColor,p(this,Fn,e.fontSize||Ee._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static get _keyboardManager(){let e=Ee.prototype,i=o=>o.isEmpty(),n=Go.TRANSLATE_SMALL,s=Go.TRANSLATE_BIG;return Ot(this,"_keyboardManager",new Lc([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-n,0],checker:i}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-s,0],checker:i}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[n,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[s,0],checker:i}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-n],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-s],checker:i}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,n],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,s],checker:i}]]))}static initialize(e,i){Ae.initialize(e,i);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,i){switch(e){case Wt.FREETEXT_SIZE:Ee._defaultFontSize=i;break;case Wt.FREETEXT_COLOR:Ee._defaultColor=i;break}}updateParams(e,i){switch(e){case Wt.FREETEXT_SIZE:b(this,ii,KT).call(this,i);break;case Wt.FREETEXT_COLOR:b(this,ii,ZT).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[Wt.FREETEXT_SIZE,Ee._defaultFontSize],[Wt.FREETEXT_COLOR,Ee._defaultColor||Ae._defaultLineColor]]}get propertiesToUpdate(){return[[Wt.FREETEXT_SIZE,a(this,Fn)],[Wt.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new X0(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Wt.FREETEXT_COLOR}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}_translateEmpty(e,i){this._uiManager.translateSelectedEditors(e,i,!0)}getInitialTranslation(){let e=this.parentScale;return[-Ee._internalPadding*e,-(Ee._internalPadding+a(this,Fn))*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),p(this,gc,new AbortController);let e=this._uiManager.combinedSignal(a(this,gc));return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:e}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:e}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:e}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:e}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:e}),!0}disableEditMode(){return super.disableEditMode()?(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",a(this,vm)),this._isDraggable=!0,a(this,gc)?.abort(),p(this,gc,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0):!1}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(e){this.width||(this.enableEditMode(),e&&this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let e=a(this,Mn),i=p(this,Mn,b(this,ii,QT).call(this).trimEnd());if(e===i)return;let n=s=>{if(p(this,Mn,s),!s){this.remove();return}b(this,ii,w0).call(this),this._uiManager.rebuild(this),b(this,ii,x0).call(this)};this.addCommands({cmd:()=>{n(i)},undo:()=>{n(e)},mustExec:!1}),b(this,ii,x0).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&e.key==="Enter"&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){Ee._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){if(this.div)return this.div;let e,i;(this._isCopy||this.annotationElementId)&&(e=this.x,i=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",a(this,vm)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:n}=this.editorDiv;if(n.fontSize=`calc(${a(this,Fn)}px * var(--total-scale-factor))`,n.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){let[s,o]=this.parentDimensions;if(this.annotationElementId){let{position:l}=this._initialData,[c,u]=this.getInitialTranslation();[c,u]=this.pageTranslationToScreen(c,u);let[h,d]=this.pageDimensions,[f,m]=this.pageTranslation,x,y;switch(this.rotation){case 0:x=e+(l[0]-f)/h,y=i+this.height-(l[1]-m)/d;break;case 90:x=e+(l[0]-f)/h,y=i-(l[1]-m)/d,[c,u]=[u,-c];break;case 180:x=e-this.width+(l[0]-f)/h,y=i-(l[1]-m)/d,[c,u]=[-c,-u];break;case 270:x=e+(l[0]-f-this.height*d)/h,y=i+(l[1]-m-this.width*h)/d,[c,u]=[-u,c];break}this.setAt(x*s,y*o,c,u)}else this._moveAfterPaste(e,i);b(this,ii,w0).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var x,y,A;let i=e.clipboardData||window.clipboardData,{types:n}=i;if(n.length===1&&n[0]==="text/plain")return;e.preventDefault();let s=b(x=Ee,Na,uw).call(x,i.getData("text")||"").replaceAll(Gg,`
61
+ `);if(!s)return;let o=window.getSelection();if(!o.rangeCount)return;this.editorDiv.normalize(),o.deleteFromDocument();let l=o.getRangeAt(0);if(!s.includes(`
62
+ `)){l.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),o.collapseToStart();return}let{startContainer:c,startOffset:u}=l,h=[],d=[];if(c.nodeType===Node.TEXT_NODE){let w=c.parentElement;if(d.push(c.nodeValue.slice(u).replaceAll(Gg,"")),w!==this.editorDiv){let v=h;for(let C of this.editorDiv.childNodes){if(C===w){v=d;continue}v.push(b(y=Ee,Na,b0).call(y,C))}}h.push(c.nodeValue.slice(0,u).replaceAll(Gg,""))}else if(c===this.editorDiv){let w=h,v=0;for(let C of this.editorDiv.childNodes)v++===u&&(w=d),w.push(b(A=Ee,Na,b0).call(A,C))}p(this,Mn,`${h.join(`
63
+ `)}${s}${d.join(`
64
+ `)}`),b(this,ii,w0).call(this);let f=new Range,m=Math.sumPrecise(h.map(w=>w.length));for(let{firstChild:w}of this.editorDiv.childNodes)if(w.nodeType===Node.TEXT_NODE){let v=w.nodeValue.length;if(m<=v){f.setStart(w,m),f.setEnd(w,m);break}m-=v}o.removeAllRanges(),o.addRange(f)}get contentDiv(){return this.editorDiv}getPDFRect(){let e=Ee._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,i,n){var l;let s=null;if(e instanceof Z0){let{data:{defaultAppearanceData:{fontSize:c,fontColor:u},rect:h,rotation:d,id:f,popupRef:m,richText:x,contentsObj:y,creationDate:A,modificationDate:w},textContent:v,textPosition:C,parent:{page:{pageNumber:D}}}=e;if(!v||v.length===0)return null;s=e={annotationType:Pt.FREETEXT,color:Array.from(u),fontSize:c,value:v.join(`
65
+ `),position:C,pageIndex:D-1,rect:h.slice(0),rotation:d,annotationElementId:f,id:f,deleted:!1,popupRef:m,comment:y?.str||null,richText:x,creationDate:A,modificationDate:w}}let o=await super.deserialize(e,i,n);return p(o,Fn,e.fontSize),o.color=mt.makeHexColor(...e.color),p(o,Mn,b(l=Ee,Na,uw).call(l,e.value)),o._initialData=s,e.comment&&o.setCommentData(e),o}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let i=Ae._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(e),{color:i,fontSize:a(this,Fn),value:b(this,ii,JT).call(this)});return this.addComment(n),e?(n.isCopy=!0,n):this.annotationElementId&&!b(this,ii,tS).call(this,n)?null:(n.id=this.annotationElementId,n)}renderAnnotationElement(e){let i=super.renderAnnotationElement(e);if(!i)return null;let{style:n}=i;n.fontSize=`calc(${a(this,Fn)}px * var(--total-scale-factor))`,n.color=this.color,i.replaceChildren();for(let s of a(this,Mn).split(`
66
+ `)){let o=document.createElement("div");o.append(s?document.createTextNode(s):document.createElement("br")),i.append(o)}return e.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:a(this,Mn)}}),i}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};Mn=new WeakMap,vm=new WeakMap,gc=new WeakMap,Fn=new WeakMap,ii=new WeakSet,KT=function(e){let i=s=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-a(this,Fn))*this.parentScale),p(this,Fn,s),b(this,ii,x0).call(this)},n=a(this,Fn);this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Wt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},ZT=function(e){let i=s=>{this.color=s,this.onUpdatedColor()},n=this.color;this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Wt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},QT=function(){var n;let e=[];this.editorDiv.normalize();let i=null;for(let s of this.editorDiv.childNodes)i?.nodeType===Node.TEXT_NODE&&s.nodeName==="BR"||(e.push(b(n=Ee,Na,b0).call(n,s)),i=s);return e.join(`
67
+ `)},x0=function(){let[e,i]=this.parentDimensions,n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{let{currentLayer:s,div:o}=this,l=o.style.display,c=o.classList.contains("hidden");o.classList.remove("hidden"),o.style.display="hidden",s.div.append(this.div),n=o.getBoundingClientRect(),o.remove(),o.style.display=l,o.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=n.width/e,this.height=n.height/i):(this.width=n.height/e,this.height=n.width/i),this.fixAndSetPosition()},Na=new WeakSet,b0=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(Gg,"")},w0=function(){if(this.editorDiv.replaceChildren(),!!a(this,Mn))for(let e of a(this,Mn).split(`
68
+ `)){let i=document.createElement("div");i.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(i)}},JT=function(){return a(this,Mn).replaceAll("\xA0"," ")},uw=function(e){return e.replaceAll(" ","\xA0")},tS=function(e){let{value:i,fontSize:n,color:s,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||e.value!==i||e.fontSize!==n||e.color.some((l,c)=>l!==s[c])||e.pageIndex!==o},g(Ee,Na),j(Ee,"_freeTextDefaultContent",""),j(Ee,"_internalPadding",0),j(Ee,"_defaultColor",null),j(Ee,"_defaultFontSize",10),j(Ee,"_type","freetext"),j(Ee,"_editorType",Pt.FREETEXT);cw=Ee,Ct=class{toSVGPath(){se("Abstract method `toSVGPath` must be implemented.")}get box(){se("Abstract getter `box` must be implemented.")}serialize(t,e){se("Abstract method `serialize` must be implemented.")}static _rescale(t,e,i,n,s,o){o||(o=new Float32Array(t.length));for(let l=0,c=t.length;l<c;l+=2)o[l]=e+t[l]*n,o[l+1]=i+t[l+1]*s;return o}static _rescaleAndSwap(t,e,i,n,s,o){o||(o=new Float32Array(t.length));for(let l=0,c=t.length;l<c;l+=2)o[l]=e+t[l+1]*n,o[l+1]=i+t[l]*s;return o}static _translate(t,e,i,n){n||(n=new Float32Array(t.length));for(let s=0,o=t.length;s<o;s+=2)n[s]=e+t[s],n[s+1]=i+t[s+1];return n}static svgRound(t){return Math.round(t*1e4)}static _normalizePoint(t,e,i,n,s){switch(s){case 90:return[1-e/i,t/n];case 180:return[1-t/i,1-e/n];case 270:return[e/i,1-t/n];default:return[t/i,e/n]}}static _normalizePagePoint(t,e,i){switch(i){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,i,n,s,o){return[(t+5*i)/6,(e+5*n)/6,(5*i+s)/6,(5*n+o)/6,(i+s)/2,(n+o)/2]}};j(Ct,"PRECISION",1e-4);Ws=class Ws{constructor({x:t,y:e},i,n,s,o,l=0){g(this,ci);g(this,Pn);g(this,Or,[]);g(this,qh);g(this,Wh);g(this,bs,[]);g(this,$t,new Float32Array(18));g(this,yc);g(this,xc);g(this,Em);g(this,Cm);g(this,Xh);g(this,Yh);g(this,_o,[]);p(this,Pn,i),p(this,Yh,s*n),p(this,Wh,o),a(this,$t).set([NaN,NaN,NaN,NaN,t,e],6),p(this,qh,l),p(this,Cm,a(Ws,Tm)*n),p(this,Em,a(Ws,ky)*n),p(this,Xh,n),a(this,_o).push(t,e)}isEmpty(){return isNaN(a(this,$t)[8])}add({x:t,y:e}){p(this,yc,t),p(this,xc,e);let[i,n,s,o]=a(this,Pn),[l,c,u,h]=a(this,$t).subarray(8,12),d=t-u,f=e-h,m=Math.hypot(d,f);if(m<a(this,Em))return!1;let x=m-a(this,Cm),y=x/m,A=y*d,w=y*f,v=l,C=c;l=u,c=h,u+=A,h+=w,a(this,_o)?.push(t,e);let D=-w/x,_=A/x,k=D*a(this,Yh),R=_*a(this,Yh);return a(this,$t).set(a(this,$t).subarray(2,8),0),a(this,$t).set([u+k,h+R],4),a(this,$t).set(a(this,$t).subarray(14,18),12),a(this,$t).set([u-k,h-R],16),isNaN(a(this,$t)[6])?(a(this,bs).length===0&&(a(this,$t).set([l+k,c+R],2),a(this,bs).push(NaN,NaN,NaN,NaN,(l+k-i)/s,(c+R-n)/o),a(this,$t).set([l-k,c-R],14),a(this,Or).push(NaN,NaN,NaN,NaN,(l-k-i)/s,(c-R-n)/o)),a(this,$t).set([v,C,l,c,u,h],6),!this.isEmpty()):(a(this,$t).set([v,C,l,c,u,h],6),Math.abs(Math.atan2(C-c,v-l)-Math.atan2(w,A))<Math.PI/2?([l,c,u,h]=a(this,$t).subarray(2,6),a(this,bs).push(NaN,NaN,NaN,NaN,((l+u)/2-i)/s,((c+h)/2-n)/o),[l,c,v,C]=a(this,$t).subarray(14,18),a(this,Or).push(NaN,NaN,NaN,NaN,((v+l)/2-i)/s,((C+c)/2-n)/o),!0):([v,C,l,c,u,h]=a(this,$t).subarray(0,6),a(this,bs).push(((v+5*l)/6-i)/s,((C+5*c)/6-n)/o,((5*l+u)/6-i)/s,((5*c+h)/6-n)/o,((l+u)/2-i)/s,((c+h)/2-n)/o),[u,h,l,c,v,C]=a(this,$t).subarray(12,18),a(this,Or).push(((v+5*l)/6-i)/s,((C+5*c)/6-n)/o,((5*l+u)/6-i)/s,((5*c+h)/6-n)/o,((l+u)/2-i)/s,((c+h)/2-n)/o),!0))}toSVGPath(){if(this.isEmpty())return"";let t=a(this,bs),e=a(this,Or);if(isNaN(a(this,$t)[6])&&!this.isEmpty())return b(this,ci,eS).call(this);let i=[];i.push(`M${t[4]} ${t[5]}`);for(let n=6;n<t.length;n+=6)isNaN(t[n])?i.push(`L${t[n+4]} ${t[n+5]}`):i.push(`C${t[n]} ${t[n+1]} ${t[n+2]} ${t[n+3]} ${t[n+4]} ${t[n+5]}`);b(this,ci,nS).call(this,i);for(let n=e.length-6;n>=6;n-=6)isNaN(e[n])?i.push(`L${e[n+4]} ${e[n+5]}`):i.push(`C${e[n]} ${e[n+1]} ${e[n+2]} ${e[n+3]} ${e[n+4]} ${e[n+5]}`);return b(this,ci,iS).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,n,s,o){return new ny(t,e,i,n,s,o)}getOutlines(){let t=a(this,bs),e=a(this,Or),i=a(this,$t),[n,s,o,l]=a(this,Pn),c=new Float32Array((a(this,_o)?.length??0)+2);for(let d=0,f=c.length-2;d<f;d+=2)c[d]=(a(this,_o)[d]-n)/o,c[d+1]=(a(this,_o)[d+1]-s)/l;if(c[c.length-2]=(a(this,yc)-n)/o,c[c.length-1]=(a(this,xc)-s)/l,isNaN(i[6])&&!this.isEmpty())return b(this,ci,rS).call(this,c);let u=new Float32Array(a(this,bs).length+24+a(this,Or).length),h=t.length;for(let d=0;d<h;d+=2){if(isNaN(t[d])){u[d]=u[d+1]=NaN;continue}u[d]=t[d],u[d+1]=t[d+1]}h=b(this,ci,aS).call(this,u,h);for(let d=e.length-6;d>=6;d-=6)for(let f=0;f<6;f+=2){if(isNaN(e[d+f])){u[h]=u[h+1]=NaN,h+=2;continue}u[h]=e[d+f],u[h+1]=e[d+f+1],h+=2}return b(this,ci,sS).call(this,u,h),this.newFreeDrawOutline(u,c,a(this,Pn),a(this,Xh),a(this,qh),a(this,Wh))}};Pn=new WeakMap,Or=new WeakMap,qh=new WeakMap,Wh=new WeakMap,bs=new WeakMap,$t=new WeakMap,yc=new WeakMap,xc=new WeakMap,Em=new WeakMap,Cm=new WeakMap,Xh=new WeakMap,Yh=new WeakMap,_o=new WeakMap,Tm=new WeakMap,Iy=new WeakMap,ky=new WeakMap,ci=new WeakSet,Tf=function(){let t=a(this,$t).subarray(4,6),e=a(this,$t).subarray(16,18),[i,n,s,o]=a(this,Pn);return[(a(this,yc)+(t[0]-e[0])/2-i)/s,(a(this,xc)+(t[1]-e[1])/2-n)/o,(a(this,yc)+(e[0]-t[0])/2-i)/s,(a(this,xc)+(e[1]-t[1])/2-n)/o]},eS=function(){let[t,e,i,n]=a(this,Pn),[s,o,l,c]=b(this,ci,Tf).call(this);return`M${(a(this,$t)[2]-t)/i} ${(a(this,$t)[3]-e)/n} L${(a(this,$t)[4]-t)/i} ${(a(this,$t)[5]-e)/n} L${s} ${o} L${l} ${c} L${(a(this,$t)[16]-t)/i} ${(a(this,$t)[17]-e)/n} L${(a(this,$t)[14]-t)/i} ${(a(this,$t)[15]-e)/n} Z`},iS=function(t){let e=a(this,Or);t.push(`L${e[4]} ${e[5]} Z`)},nS=function(t){let[e,i,n,s]=a(this,Pn),o=a(this,$t).subarray(4,6),l=a(this,$t).subarray(16,18),[c,u,h,d]=b(this,ci,Tf).call(this);t.push(`L${(o[0]-e)/n} ${(o[1]-i)/s} L${c} ${u} L${h} ${d} L${(l[0]-e)/n} ${(l[1]-i)/s}`)},rS=function(t){let e=a(this,$t),[i,n,s,o]=a(this,Pn),[l,c,u,h]=b(this,ci,Tf).call(this),d=new Float32Array(36);return d.set([NaN,NaN,NaN,NaN,(e[2]-i)/s,(e[3]-n)/o,NaN,NaN,NaN,NaN,(e[4]-i)/s,(e[5]-n)/o,NaN,NaN,NaN,NaN,l,c,NaN,NaN,NaN,NaN,u,h,NaN,NaN,NaN,NaN,(e[16]-i)/s,(e[17]-n)/o,NaN,NaN,NaN,NaN,(e[14]-i)/s,(e[15]-n)/o],0),this.newFreeDrawOutline(d,t,a(this,Pn),a(this,Xh),a(this,qh),a(this,Wh))},sS=function(t,e){let i=a(this,Or);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+=6},aS=function(t,e){let i=a(this,$t).subarray(4,6),n=a(this,$t).subarray(16,18),[s,o,l,c]=a(this,Pn),[u,h,d,f]=b(this,ci,Tf).call(this);return t.set([NaN,NaN,NaN,NaN,(i[0]-s)/l,(i[1]-o)/c,NaN,NaN,NaN,NaN,u,h,NaN,NaN,NaN,NaN,d,f,NaN,NaN,NaN,NaN,(n[0]-s)/l,(n[1]-o)/c],e),e+=24},g(Ws,Tm,8),g(Ws,Iy,2),g(Ws,ky,a(Ws,Tm)+a(Ws,Iy));iy=Ws,ny=class extends Ct{constructor(e,i,n,s,o,l){super();g(this,Ny);g(this,Kh);g(this,bc,new Float32Array(4));g(this,wa);g(this,Sm);g(this,On);g(this,Dm);g(this,Ke);p(this,Ke,e),p(this,On,i),p(this,Kh,n),p(this,Dm,s),p(this,wa,o),p(this,Sm,l),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],b(this,Ny,oS).call(this,l);let[c,u,h,d]=a(this,bc);for(let f=0,m=e.length;f<m;f+=2)e[f]=(e[f]-c)/h,e[f+1]=(e[f+1]-u)/d;for(let f=0,m=i.length;f<m;f+=2)i[f]=(i[f]-c)/h,i[f+1]=(i[f+1]-u)/d}toSVGPath(){let e=[`M${a(this,Ke)[4]} ${a(this,Ke)[5]}`];for(let i=6,n=a(this,Ke).length;i<n;i+=6){if(isNaN(a(this,Ke)[i])){e.push(`L${a(this,Ke)[i+4]} ${a(this,Ke)[i+5]}`);continue}e.push(`C${a(this,Ke)[i]} ${a(this,Ke)[i+1]} ${a(this,Ke)[i+2]} ${a(this,Ke)[i+3]} ${a(this,Ke)[i+4]} ${a(this,Ke)[i+5]}`)}return e.push("Z"),e.join(" ")}serialize([e,i,n,s],o){let l=n-e,c=s-i,u,h;switch(o){case 0:u=Ct._rescale(a(this,Ke),e,s,l,-c),h=Ct._rescale(a(this,On),e,s,l,-c);break;case 90:u=Ct._rescaleAndSwap(a(this,Ke),e,i,l,c),h=Ct._rescaleAndSwap(a(this,On),e,i,l,c);break;case 180:u=Ct._rescale(a(this,Ke),n,i,-l,c),h=Ct._rescale(a(this,On),n,i,-l,c);break;case 270:u=Ct._rescaleAndSwap(a(this,Ke),n,s,-l,-c),h=Ct._rescaleAndSwap(a(this,On),n,s,-l,-c);break}return{outline:Array.from(u),points:[Array.from(h)]}}get box(){return a(this,bc)}newOutliner(e,i,n,s,o,l=0){return new iy(e,i,n,s,o,l)}getNewOutline(e,i){let[n,s,o,l]=a(this,bc),[c,u,h,d]=a(this,Kh),f=o*h,m=l*d,x=n*h+c,y=s*d+u,A=this.newOutliner({x:a(this,On)[0]*f+x,y:a(this,On)[1]*m+y},a(this,Kh),a(this,Dm),e,a(this,Sm),i??a(this,wa));for(let w=2;w<a(this,On).length;w+=2)A.add({x:a(this,On)[w]*f+x,y:a(this,On)[w+1]*m+y});return A.getOutlines()}};Kh=new WeakMap,bc=new WeakMap,wa=new WeakMap,Sm=new WeakMap,On=new WeakMap,Dm=new WeakMap,Ke=new WeakMap,Ny=new WeakSet,oS=function(e){let i=a(this,Ke),n=i[4],s=i[5],o=[n,s,n,s],l=n,c=s,u=n,h=s,d=e?Math.max:Math.min,f=new Float32Array(4);for(let x=6,y=i.length;x<y;x+=6){let A=i[x+4],w=i[x+5];isNaN(i[x])?(mt.pointBoundingBox(A,w,o),c>w?(l=A,c=w):c===w&&(l=d(l,A)),h<w?(u=A,h=w):h===w&&(u=d(u,A))):(f[0]=f[1]=1/0,f[2]=f[3]=-1/0,mt.bezierBoundingBox(n,s,...i.slice(x,x+6),f),mt.rectBoundingBox(f[0],f[1],f[2],f[3],o),c>f[1]?(l=f[0],c=f[1]):c===f[1]&&(l=d(l,f[0])),h<f[3]?(u=f[2],h=f[3]):h===f[3]&&(u=d(u,f[2]))),n=A,s=w}let m=a(this,bc);m[0]=o[0]-a(this,wa),m[1]=o[1]-a(this,wa),m[2]=o[2]-o[0]+2*a(this,wa),m[3]=o[3]-o[1]+2*a(this,wa),this.firstPoint=[l,c],this.lastPoint=[u,h]};Kf=class{constructor(t,e=0,i=0,n=!0){g(this,nn);g(this,Im);g(this,km);g(this,Nm);g(this,Mo,[]);g(this,Rr,[]);let s=[1/0,1/0,-1/0,-1/0],l=10**-4;for(let{x:A,y:w,width:v,height:C}of t){let D=Math.floor((A-e)/l)*l,_=Math.ceil((A+v+e)/l)*l,k=Math.floor((w-e)/l)*l,R=Math.ceil((w+C+e)/l)*l,K=[D,k,R,!0],W=[_,k,R,!1];a(this,Mo).push(K,W),mt.rectBoundingBox(D,k,_,R,s)}let c=s[2]-s[0]+2*i,u=s[3]-s[1]+2*i,h=s[0]-i,d=s[1]-i,f=n?-1/0:1/0,m=1/0,x=a(this,Mo).at(n?-1:-2),y=[x[0],x[2]];for(let A of a(this,Mo)){let[w,v,C,D]=A;!D&&n?v<m?(m=v,f=w):v===m&&(f=Math.max(f,w)):D&&!n&&(v<m?(m=v,f=w):v===m&&(f=Math.min(f,w))),A[0]=(w-h)/c,A[1]=(v-d)/u,A[2]=(C-d)/u}p(this,Im,new Float32Array([h,d,c,u])),p(this,km,[f,m]),p(this,Nm,y)}getOutlines(){a(this,Mo).sort((e,i)=>e[0]-i[0]||e[1]-i[1]||e[2]-i[2]);let t=[];for(let e of a(this,Mo))e[3]?(t.push(...b(this,nn,hw).call(this,e)),b(this,nn,cS).call(this,e)):(b(this,nn,uS).call(this,e),t.push(...b(this,nn,hw).call(this,e)));return b(this,nn,lS).call(this,t)}};Im=new WeakMap,km=new WeakMap,Nm=new WeakMap,Mo=new WeakMap,Rr=new WeakMap,nn=new WeakSet,lS=function(t){let e=[],i=new Set;for(let o of t){let[l,c,u]=o;e.push([l,c,o],[l,u,o])}e.sort((o,l)=>o[1]-l[1]||o[0]-l[0]);for(let o=0,l=e.length;o<l;o+=2){let c=e[o][2],u=e[o+1][2];c.push(u),u.push(c),i.add(c),i.add(u)}let n=[],s;for(;i.size>0;){let o=i.values().next().value,[l,c,u,h,d]=o;i.delete(o);let f=l,m=c;for(s=[l,u],n.push(s);;){let x;if(i.has(h))x=h;else if(i.has(d))x=d;else break;i.delete(x),[l,c,u,h,d]=x,f!==l&&(s.push(f,m,l,m===c?c:u),f=l),m=m===c?u:c}s.push(f,m)}return new dw(n,a(this,Im),a(this,km),a(this,Nm))},A0=function(t){let e=a(this,Rr),i=0,n=e.length-1;for(;i<=n;){let s=i+n>>1,o=e[s][0];if(o===t)return s;o<t?i=s+1:n=s-1}return n+1},cS=function([,t,e]){let i=b(this,nn,A0).call(this,t);a(this,Rr).splice(i,0,[t,e])},uS=function([,t,e]){let i=b(this,nn,A0).call(this,t);for(let n=i;n<a(this,Rr).length;n++){let[s,o]=a(this,Rr)[n];if(s!==t)break;if(s===t&&o===e){a(this,Rr).splice(n,1);return}}for(let n=i-1;n>=0;n--){let[s,o]=a(this,Rr)[n];if(s!==t)break;if(s===t&&o===e){a(this,Rr).splice(n,1);return}}},hw=function(t){let[e,i,n]=t,s=[[e,i,n]],o=b(this,nn,A0).call(this,n);for(let l=0;l<o;l++){let[c,u]=a(this,Rr)[l];for(let h=0,d=s.length;h<d;h++){let[,f,m]=s[h];if(!(u<=f||m<=c)){if(f>=c){if(m>u)s[h][1]=u;else{if(d===1)return[];s.splice(h,1),h--,d--}continue}s[h][2]=c,m>u&&s.push([e,u,m])}}}return s};dw=class extends Ct{constructor(e,i,n,s){super();g(this,_m);g(this,Zh);p(this,Zh,e),p(this,_m,i),this.firstPoint=n,this.lastPoint=s}toSVGPath(){let e=[];for(let i of a(this,Zh)){let[n,s]=i;e.push(`M${n} ${s}`);for(let o=2;o<i.length;o+=2){let l=i[o],c=i[o+1];l===n?(e.push(`V${c}`),s=c):c===s&&(e.push(`H${l}`),n=l)}e.push("Z")}return e.join(" ")}serialize([e,i,n,s],o){let l=[],c=n-e,u=s-i;for(let h of a(this,Zh)){let d=new Array(h.length);for(let f=0;f<h.length;f+=2)d[f]=e+h[f]*c,d[f+1]=s-h[f+1]*u;l.push(d)}return l}get box(){return a(this,_m)}get classNamesForOutlining(){return["highlightOutline"]}};_m=new WeakMap,Zh=new WeakMap;Zf=class extends iy{newFreeDrawOutline(t,e,i,n,s,o){return new fw(t,e,i,n,s,o)}},fw=class extends ny{newOutliner(t,e,i,n,s,o=0){return new Zf(t,e,i,n,s,o)}},ne=class ne extends Ae{constructor(e){super({...e,name:"highlightEditor"});g(this,jt);g(this,Qh,null);g(this,Mm,0);g(this,Aa);g(this,wc,null);g(this,Fm,null);g(this,gn,null);g(this,Pm,null);g(this,Om,0);g(this,Ac,null);g(this,Rn,null);g(this,Ln,null);g(this,_i,!1);g(this,Jh,null);g(this,td,null);g(this,Gi,null);g(this,ed,"");g(this,mr);g(this,Rm,"");this.color=e.color||ne._defaultColor,p(this,mr,e.thickness||ne._defaultThickness),this.opacity=e.opacity||ne._defaultOpacity,p(this,Aa,e.boxes||null),p(this,Rm,e.methodOfCreation||""),p(this,ed,e.text||""),this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",e.highlightId>-1?(p(this,_i,!0),b(this,jt,v0).call(this,e),b(this,jt,ul).call(this)):a(this,Aa)&&(p(this,Qh,e.anchorNode),p(this,Mm,e.anchorOffset),p(this,Pm,e.focusNode),p(this,Om,e.focusOffset),b(this,jt,pw).call(this),b(this,jt,ul).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){let e=ne.prototype;return Ot(this,"_keyboardManager",new Lc([[["ArrowLeft","mac+ArrowLeft"],e._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],e._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],e._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],e._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:a(this,_i)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:a(this,mr),methodOfCreation:a(this,Rm)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,i){Ae.initialize(e,i),ne._defaultColor||(ne._defaultColor=i.highlightColors?.values().next().value||"#fff066")}static updateDefaultParams(e,i){switch(e){case Wt.HIGHLIGHT_COLOR:ne._defaultColor=i;break;case Wt.HIGHLIGHT_THICKNESS:ne._defaultThickness=i;break}}translateInPage(e,i){}get toolbarPosition(){return a(this,td)}get commentButtonPosition(){return a(this,Jh)}updateParams(e,i){switch(e){case Wt.HIGHLIGHT_COLOR:b(this,jt,hS).call(this,i);break;case Wt.HIGHLIGHT_THICKNESS:b(this,jt,dS).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[Wt.HIGHLIGHT_COLOR,ne._defaultColor],[Wt.HIGHLIGHT_THICKNESS,ne._defaultThickness]]}get propertiesToUpdate(){return[[Wt.HIGHLIGHT_COLOR,this.color||ne._defaultColor],[Wt.HIGHLIGHT_THICKNESS,a(this,mr)||ne._defaultThickness],[Wt.HIGHLIGHT_FREE,a(this,_i)]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(a(this,Ln),{root:{fill:this.color,"fill-opacity":this.opacity}}),a(this,Fm)?.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",p(this,Fm,new qf({editor:this}))]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(b(this,jt,C0).call(this))}getBaseTranslation(){return[0,0]}getRect(e,i){return super.getRect(e,i,b(this,jt,C0).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){b(this,jt,mw).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,jt,ul).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let i=!1;this.parent&&!e?b(this,jt,mw).call(this):e&&(b(this,jt,ul).call(this,e),i=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),this.show(this._isVisible),i&&this.select()}rotate(e){var s,o,l;let{drawLayer:i}=this.parent,n;a(this,_i)?(e=(e-this.rotation+360)%360,n=b(s=ne,br,Fu).call(s,a(this,Rn).box,e)):n=b(o=ne,br,Fu).call(o,[this.x,this.y,this.width,this.height],e),i.updateProperties(a(this,Ln),{bbox:n,root:{"data-main-rotation":e}}),i.updateProperties(a(this,Gi),{bbox:b(l=ne,br,Fu).call(l,a(this,gn).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;let e=super.render();a(this,ed)&&(e.setAttribute("aria-label",a(this,ed)),e.setAttribute("role","mark")),a(this,_i)?e.classList.add("free"):this.div.addEventListener("keydown",b(this,jt,pS).bind(this),{signal:this._uiManager._signal});let i=p(this,Ac,document.createElement("div"));return e.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",i.style.clipPath=a(this,wc),this.setDims(),BC(this,a(this,Ac),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(a(this,Gi),{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(a(this,Gi),{rootClass:{hovered:!1}})}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:b(this,jt,E0).call(this,!0);break;case 1:case 3:b(this,jt,E0).call(this,!1);break}}select(){super.select(),a(this,Gi)&&this.parent?.drawLayer.updateProperties(a(this,Gi),{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),a(this,Gi)&&(this.parent?.drawLayer.updateProperties(a(this,Gi),{rootClass:{selected:!1}}),a(this,_i)||b(this,jt,E0).call(this,!1))}get _mustFixPosition(){return!a(this,_i)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(a(this,Ln),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(a(this,Gi),{rootClass:{hidden:!e}}))}static startHighlighting(e,i,{target:n,x:s,y:o}){let{x:l,y:c,width:u,height:h}=n.getBoundingClientRect(),d=new AbortController,f=e.combinedSignal(d),m=x=>{d.abort(),b(this,br,xS).call(this,e,x)};window.addEventListener("blur",m,{signal:f}),window.addEventListener("pointerup",m,{signal:f}),window.addEventListener("pointerdown",_e,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",qn,{signal:f}),n.addEventListener("pointermove",b(this,br,yS).bind(this,e),{signal:f}),this._freeHighlight=new Zf({x:s,y:o},[l,c,u,h],e.scale,this._defaultThickness/2,i,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static async deserialize(e,i,n){var A,w,v,C;let s=null;if(e instanceof J0){let{data:{quadPoints:D,rect:_,rotation:k,id:R,color:K,opacity:W,popupRef:V,richText:U,contentsObj:tt,creationDate:et,modificationDate:B},parent:{page:{pageNumber:ot}}}=e;s=e={annotationType:Pt.HIGHLIGHT,color:Array.from(K),opacity:W,quadPoints:D,boxes:null,pageIndex:ot-1,rect:_.slice(0),rotation:k,annotationElementId:R,id:R,deleted:!1,popupRef:V,richText:U,comment:tt?.str||null,creationDate:et,modificationDate:B}}else if(e instanceof Yf){let{data:{inkLists:D,rect:_,rotation:k,id:R,color:K,borderStyle:{rawWidth:W},popupRef:V,richText:U,contentsObj:tt,creationDate:et,modificationDate:B},parent:{page:{pageNumber:ot}}}=e;s=e={annotationType:Pt.HIGHLIGHT,color:Array.from(K),thickness:W,inkLists:D,boxes:null,pageIndex:ot-1,rect:_.slice(0),rotation:k,annotationElementId:R,id:R,deleted:!1,popupRef:V,richText:U,comment:tt?.str||null,creationDate:et,modificationDate:B}}let{color:o,quadPoints:l,inkLists:c,outlines:u,opacity:h}=e,d=await super.deserialize(e,i,n);d.color=mt.makeHexColor(...o),d.opacity=h||1,c&&p(d,mr,e.thickness),d._initialData=s,e.comment&&d.setCommentData(e);let[f,m]=d.pageDimensions,[x,y]=d.pageTranslation;if(l){let D=p(d,Aa,[]);for(let _=0;_<l.length;_+=8)D.push({x:(l[_]-x)/f,y:1-(l[_+1]-y)/m,width:(l[_+2]-l[_])/f,height:(l[_+1]-l[_+5])/m});b(A=d,jt,pw).call(A),b(w=d,jt,ul).call(w),d.rotate(d.rotation)}else if(c||u){p(d,_i,!0);let D=(c||u.points)[0],_={x:D[0]-x,y:m-(D[1]-y)},k=new Zf(_,[0,0,f,m],1,a(d,mr)/2,!0,.001);for(let W=0,V=D.length;W<V;W+=2)_.x=D[W]-x,_.y=m-(D[W+1]-y),k.add(_);let{id:R,clipPathId:K}=i.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:d.color,"fill-opacity":d._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:k.toSVGPath()}},!0,!0);b(v=d,jt,v0).call(v,{highlightOutlines:k.getOutlines(),highlightId:R,clipPathId:K}),b(C=d,jt,ul).call(C),d.rotate(d.parentRotation)}return d}serialize(e=!1){if(this.isEmpty()||e)return null;if(this.deleted)return this.serializeDeleted();let i=Ae._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),n=super.serialize(e);return Object.assign(n,{color:i,opacity:this.opacity,thickness:a(this,mr),quadPoints:b(this,jt,mS).call(this),outlines:b(this,jt,gS).call(this,n.rect)}),this.addComment(n),this.annotationElementId&&!b(this,jt,bS).call(this,n)?null:(n.id=this.annotationElementId,n)}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}static canCreateNewEmptyEditor(){return!1}};Qh=new WeakMap,Mm=new WeakMap,Aa=new WeakMap,wc=new WeakMap,Fm=new WeakMap,gn=new WeakMap,Pm=new WeakMap,Om=new WeakMap,Ac=new WeakMap,Rn=new WeakMap,Ln=new WeakMap,_i=new WeakMap,Jh=new WeakMap,td=new WeakMap,Gi=new WeakMap,ed=new WeakMap,mr=new WeakMap,Rm=new WeakMap,jt=new WeakSet,pw=function(){let e=new Kf(a(this,Aa),.001);p(this,Rn,e.getOutlines()),[this.x,this.y,this.width,this.height]=a(this,Rn).box;let i=new Kf(a(this,Aa),.0025,.001,this._uiManager.direction==="ltr");p(this,gn,i.getOutlines());let{firstPoint:n}=a(this,Rn);p(this,Jh,[(n[0]-this.x)/this.width,(n[1]-this.y)/this.height]);let{lastPoint:s}=a(this,gn);p(this,td,[(s[0]-this.x)/this.width,(s[1]-this.y)/this.height])},v0=function({highlightOutlines:e,highlightId:i,clipPathId:n}){var f,m;if(p(this,Rn,e),p(this,gn,e.getNewOutline(a(this,mr)/2+1.5,.0025)),i>=0)p(this,Ln,i),p(this,wc,n),this.parent.drawLayer.finalizeDraw(i,{bbox:e.box,path:{d:e.toSVGPath()}}),p(this,Gi,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:a(this,gn).box,path:{d:a(this,gn).toSVGPath()}},!0));else if(this.parent){let x=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(a(this,Ln),{bbox:b(f=ne,br,Fu).call(f,a(this,Rn).box,(x-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(a(this,Gi),{bbox:b(m=ne,br,Fu).call(m,a(this,gn).box,x),path:{d:a(this,gn).toSVGPath()}})}let[o,l,c,u]=e.box;switch(this.rotation){case 0:this.x=o,this.y=l,this.width=c,this.height=u;break;case 90:{let[x,y]=this.parentDimensions;this.x=l,this.y=1-o,this.width=c*y/x,this.height=u*x/y;break}case 180:this.x=1-o,this.y=1-l,this.width=c,this.height=u;break;case 270:{let[x,y]=this.parentDimensions;this.x=1-l,this.y=o,this.width=c*y/x,this.height=u*x/y;break}}let{firstPoint:h}=e;p(this,Jh,[(h[0]-o)/c,(h[1]-l)/u]);let{lastPoint:d}=a(this,gn);p(this,td,[(d[0]-o)/c,(d[1]-l)/u])},hS=function(e){let i=(o,l)=>{this.color=o,this.opacity=l,this.onUpdatedColor()},n=this.color,s=this.opacity;this.addCommands({cmd:i.bind(this,e,ne._defaultOpacity),undo:i.bind(this,n,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Wt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)},dS=function(e){let i=a(this,mr),n=s=>{p(this,mr,s),b(this,jt,fS).call(this,s)};this.addCommands({cmd:n.bind(this,e),undo:n.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Wt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},fS=function(e){a(this,_i)&&(b(this,jt,v0).call(this,{highlightOutlines:a(this,Rn).getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims())},mw=function(){a(this,Ln)===null||!this.parent||(this.parent.drawLayer.remove(a(this,Ln)),p(this,Ln,null),this.parent.drawLayer.remove(a(this,Gi)),p(this,Gi,null))},ul=function(e=this.parent){a(this,Ln)===null&&({id:Ze(this,Ln)._,clipPathId:Ze(this,wc)._}=e.drawLayer.draw({bbox:a(this,Rn).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:a(this,_i)},path:{d:a(this,Rn).toSVGPath()}},!1,!0),p(this,Gi,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:a(this,_i)},bbox:a(this,gn).box,path:{d:a(this,gn).toSVGPath()}},a(this,_i))),a(this,Ac)&&(a(this,Ac).style.clipPath=a(this,wc)))},br=new WeakSet,Fu=function([e,i,n,s],o){switch(o){case 90:return[1-i-s,e,s,n];case 180:return[1-e-n,1-i-s,n,s];case 270:return[i,1-e-n,s,n]}return[e,i,n,s]},pS=function(e){ne._keyboardManager.exec(this,e)},E0=function(e){if(!a(this,Qh))return;let i=window.getSelection();e?i.setPosition(a(this,Qh),a(this,Mm)):i.setPosition(a(this,Pm),a(this,Om))},C0=function(){return a(this,_i)?this.rotation:0},mS=function(){if(a(this,_i))return null;let[e,i]=this.pageDimensions,[n,s]=this.pageTranslation,o=a(this,Aa),l=new Float32Array(o.length*8),c=0;for(let{x:u,y:h,width:d,height:f}of o){let m=u*e+n,x=(1-h)*i+s;l[c]=l[c+4]=m,l[c+1]=l[c+3]=x,l[c+2]=l[c+6]=m+d*e,l[c+5]=l[c+7]=x-f*i,c+=8}return l},gS=function(e){return a(this,Rn).serialize(e,b(this,jt,C0).call(this))},yS=function(e,i){this._freeHighlight.add(i)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},xS=function(e,i){this._freeHighlight.isEmpty()?e.drawLayer.remove(this._freeHighlightId):e.createAndAddNewEditor(i,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},bS=function(e){let{color:i}=this._initialData;return this.hasEditedComment||e.color.some((n,s)=>n!==i[s])},g(ne,br),j(ne,"_defaultColor",null),j(ne,"_defaultOpacity",1),j(ne,"_defaultThickness",12),j(ne,"_type","highlight"),j(ne,"_editorType",Pt.HIGHLIGHT),j(ne,"_freeHighlightId",-1),j(ne,"_freeHighlight",null),j(ne,"_freeHighlightClipId","");ry=ne,sy=class{constructor(){g(this,vc,Object.create(null))}updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(let[e,i]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,i)}updateSVGProperty(t,e){a(this,vc)[t]=e}toSVGProperties(){let t=a(this,vc);return p(this,vc,Object.create(null)),{root:t}}reset(){p(this,vc,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){se("Not implemented")}};vc=new WeakMap;qt=class qt extends Ae{constructor(e){super(e);g(this,Qt);g(this,Bn,null);g(this,id);j(this,"_colorPicker",null);j(this,"_drawId",null);p(this,id,e.mustBeCommitted||!1),this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(e){e.drawOutlines&&(b(this,Qt,gw).call(this,e),b(this,Qt,Sf).call(this))}static _mergeSVGProperties(e,i){let n=new Set(Object.keys(e));for(let[s,o]of Object.entries(i))n.has(s)?Object.assign(e[s],o):e[s]=o;return e}static getDefaultDrawingOptions(e){se("Not implemented")}static get typesMap(){se("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(e,i){let n=this.typesMap.get(e);n&&this._defaultDrawingOptions.updateProperty(n,i),this._currentParent&&(a(qt,mi).updateProperty(n,i),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(e,i){let n=this.constructor.typesMap.get(e);n&&this._updateProperty(e,n,i)}static get defaultPropertiesToUpdate(){let e=[],i=this._defaultDrawingOptions;for(let[n,s]of this.typesMap)e.push([n,i[s]]);return e}get propertiesToUpdate(){let e=[],{_drawingOptions:i}=this;for(let[n,s]of this.constructor.typesMap)e.push([n,i[s]]);return e}_updateProperty(e,i,n){let s=this._drawingOptions,o=s[i],l=c=>{s.updateProperty(i,c);let u=a(this,Bn).updateProperty(i,c);u&&b(this,Qt,Df).call(this,u),this.parent?.drawLayer.updateProperties(this._drawId,s.toSVGProperties()),e===this.colorType&&this.onUpdatedColor()};this.addCommands({cmd:l.bind(this,n),undo:l.bind(this,o),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:e,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,qt._mergeSVGProperties(a(this,Bn).getPathResizingSVGProperties(b(this,Qt,T0).call(this)),{bbox:b(this,Qt,Pu).call(this)}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,qt._mergeSVGProperties(a(this,Bn).getPathResizedSVGProperties(b(this,Qt,T0).call(this)),{bbox:b(this,Qt,Pu).call(this)}))}_onTranslating(e,i){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:b(this,Qt,Pu).call(this)})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,qt._mergeSVGProperties(a(this,Bn).getPathTranslatedSVGProperties(b(this,Qt,T0).call(this),this.parentDimensions),{bbox:b(this,Qt,Pu).call(this)}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,a(this,id)&&(p(this,id,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){b(this,Qt,xw).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Qt,Sf).call(this),b(this,Qt,Df).call(this,a(this,Bn).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let i=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),b(this,Qt,xw).call(this)):e&&(this._uiManager.addShouldRescale(this),b(this,Qt,Sf).call(this,e),i=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(e),i&&this.select()}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,qt._mergeSVGProperties({bbox:b(this,Qt,Pu).call(this)},a(this,Bn).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&b(this,Qt,Df).call(this,a(this,Bn).updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){if(this.div)return this.div;let e,i;this._isCopy&&(e=this.x,i=this.y);let n=super.render();n.classList.add("draw");let s=document.createElement("div");return n.append(s),s.setAttribute("aria-hidden","true"),s.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(e,i),n}static createDrawerInstance(e,i,n,s,o){se("Not implemented")}static startDrawing(e,i,n,s){let{target:o,offsetX:l,offsetY:c,pointerId:u,pointerType:h}=s;if(Ui.isInitializedAndDifferentPointerType(h))return;let{viewport:{rotation:d}}=e,{width:f,height:m}=o.getBoundingClientRect(),x=p(qt,Ec,new AbortController),y=e.combinedSignal(x);if(Ui.setPointer(h,u),window.addEventListener("pointerup",A=>{Ui.isSamePointerIdOrRemove(A.pointerId)&&this._endDraw(A)},{signal:y}),window.addEventListener("pointercancel",A=>{Ui.isSamePointerIdOrRemove(A.pointerId)&&this._currentParent.endDrawingSession()},{signal:y}),window.addEventListener("pointerdown",A=>{Ui.isSamePointerType(A.pointerType)&&(Ui.initializeAndAddPointerId(A.pointerId),a(qt,mi).isCancellable()&&(a(qt,mi).removeLastElement(),a(qt,mi).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:y}),window.addEventListener("contextmenu",qn,{signal:y}),o.addEventListener("pointermove",this._drawMove.bind(this),{signal:y}),o.addEventListener("touchmove",A=>{Ui.isSameTimeStamp(A.timeStamp)&&_e(A)},{signal:y}),e.toggleDrawing(),i._editorUndoBar?.hide(),a(qt,mi)){e.drawLayer.updateProperties(this._currentDrawId,a(qt,mi).startNew(l,c,f,m,d));return}i.updateUIForDefaultProperties(this),p(qt,mi,this.createDrawerInstance(l,c,f,m,d)),p(qt,Cc,this.getDefaultDrawingOptions()),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(a(qt,Cc).toSVGProperties(),a(qt,mi).defaultSVGProperties),!0,!1)}static _drawMove(e){if(Ui.isSameTimeStamp(e.timeStamp),!a(qt,mi))return;let{offsetX:i,offsetY:n,pointerId:s}=e;if(Ui.isSamePointerId(s)){if(Ui.isUsingMultiplePointers()){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,a(qt,mi).add(i,n)),Ui.setTimeStamp(e.timeStamp),_e(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,p(qt,mi,null),p(qt,Cc,null),Ui.clearTimeStamp()),a(qt,Ec)&&(a(qt,Ec).abort(),p(qt,Ec,null),Ui.clearPointerIds())}static _endDraw(e){let i=this._currentParent;if(i){if(i.toggleDrawing(!0),this._cleanup(!1),e?.target===i.div&&i.drawLayer.updateProperties(this._currentDrawId,a(qt,mi).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){let n=a(qt,mi),s=this._currentDrawId,o=n.getLastElement();i.addCommands({cmd:()=>{i.drawLayer.updateProperties(s,n.setLastElement(o))},undo:()=>{i.drawLayer.updateProperties(s,n.removeLastElement())},mustExec:!1,type:Wt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){let i=this._currentParent;if(!i)return null;if(i.toggleDrawing(!0),i.cleanUndoStack(Wt.DRAW_STEP),!a(qt,mi).isEmpty()){let{pageDimensions:[n,s],scale:o}=i,l=i.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:a(qt,mi).getOutlines(n*o,s*o,o,this._INNER_MARGIN),drawingOptions:a(qt,Cc),mustBeCommitted:!e});return this._cleanup(!0),l}return i.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(e){}static deserializeDraw(e,i,n,s,o,l){se("Not implemented")}static async deserialize(e,i,n){var d,f;let{rawDims:{pageWidth:s,pageHeight:o,pageX:l,pageY:c}}=i.viewport,u=this.deserializeDraw(l,c,s,o,this._INNER_MARGIN,e),h=await super.deserialize(e,i,n);return h.createDrawingOptions(e),b(d=h,Qt,gw).call(d,{drawOutlines:u}),b(f=h,Qt,Sf).call(f),h.onScaleChanging(),h.rotate(),h}serializeDraw(e){let[i,n]=this.pageTranslation,[s,o]=this.pageDimensions;return a(this,Bn).serialize([i,n,s,o],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};Bn=new WeakMap,id=new WeakMap,mi=new WeakMap,Ec=new WeakMap,Cc=new WeakMap,Qt=new WeakSet,gw=function({drawOutlines:e,drawId:i,drawingOptions:n}){p(this,Bn,e),this._drawingOptions||(this._drawingOptions=n),this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),i>=0?(this._drawId=i,this.parent.drawLayer.finalizeDraw(i,e.defaultProperties)):this._drawId=b(this,Qt,yw).call(this,e,this.parent),b(this,Qt,Df).call(this,e.box)},yw=function(e,i){let{id:n}=i.drawLayer.draw(qt._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n},xw=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},Sf=function(e=this.parent){if(!(this._drawId!==null&&this.parent===e)){if(this._drawId!==null){this.parent.drawLayer.updateParent(this._drawId,e.drawLayer);return}this._drawingOptions.updateAll(),this._drawId=b(this,Qt,yw).call(this,a(this,Bn),e)}},wS=function([e,i,n,s]){let{parentDimensions:[o,l],rotation:c}=this;switch(c){case 90:return[i,1-e,n*(l/o),s*(o/l)];case 180:return[1-e,1-i,n,s];case 270:return[1-i,e,n*(l/o),s*(o/l)];default:return[e,i,n,s]}},T0=function(){let{x:e,y:i,width:n,height:s,parentDimensions:[o,l],rotation:c}=this;switch(c){case 90:return[1-i,e,n*(o/l),s*(l/o)];case 180:return[1-e,1-i,n,s];case 270:return[i,1-e,n*(o/l),s*(l/o)];default:return[e,i,n,s]}},Df=function(e){[this.x,this.y,this.width,this.height]=b(this,Qt,wS).call(this,e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},Pu=function(){let{x:e,y:i,width:n,height:s,rotation:o,parentRotation:l,parentDimensions:[c,u]}=this;switch((o*4+l)/90){case 1:return[1-i-s,e,s,n];case 2:return[1-e-n,1-i-s,n,s];case 3:return[i,1-e-n,s,n];case 4:return[e,i-n*(c/u),s*(u/c),n*(c/u)];case 5:return[1-i,e,n*(c/u),s*(u/c)];case 6:return[1-e-s*(u/c),1-i,s*(u/c),n*(c/u)];case 7:return[i-n*(c/u),1-e-s*(u/c),n*(c/u),s*(u/c)];case 8:return[e-n,i-s,n,s];case 9:return[1-i,e-n,s,n];case 10:return[1-e,1-i,n,s];case 11:return[i-s,1-e,s,n];case 12:return[e-s*(u/c),i,s*(u/c),n*(c/u)];case 13:return[1-i-n*(c/u),e-s*(u/c),n*(c/u),s*(u/c)];case 14:return[1-e,1-i-n*(c/u),s*(u/c),n*(c/u)];case 15:return[i,1-e,n*(c/u),s*(u/c)];default:return[e,i,n,s]}},j(qt,"_currentDrawId",-1),j(qt,"_currentParent",null),g(qt,mi,null),g(qt,Ec,null),g(qt,Cc,null),j(qt,"_INNER_MARGIN",3);ay=qt,bw=class{constructor(t,e,i,n,s,o){g(this,rd);g(this,ws,new Float64Array(6));g(this,gi);g(this,yi);g(this,Tc);g(this,nd);g(this,Qi);g(this,Mi,"");g(this,gr,0);g(this,Sc,new zc);g(this,Dc);g(this,Ic);p(this,Dc,i),p(this,Ic,n),p(this,Tc,s),p(this,nd,o),[t,e]=b(this,rd,S0).call(this,t,e);let l=p(this,gi,[NaN,NaN,NaN,NaN,t,e]);p(this,Qi,[t,e]),p(this,yi,[{line:l,points:a(this,Qi)}]),a(this,ws).set(l,0)}updateProperty(t,e){t==="stroke-width"&&p(this,nd,e)}isEmpty(){return!a(this,yi)||a(this,yi).length===0}isCancellable(){return a(this,Qi).length<=10}add(t,e){[t,e]=b(this,rd,S0).call(this,t,e);let[i,n,s,o]=a(this,ws).subarray(2,6),l=t-s,c=e-o;return Math.hypot(a(this,Dc)*l,a(this,Ic)*c)<=2?null:(a(this,Qi).push(t,e),isNaN(i)?(a(this,ws).set([s,o,t,e],2),a(this,gi).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(a(this,ws)[0])&&a(this,gi).splice(6,6),a(this,ws).set([i,n,s,o,t,e],0),a(this,gi).push(...Ct.createBezierPoints(i,n,s,o,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){let i=this.add(t,e);return i||(a(this,Qi).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,n,s){p(this,Dc,i),p(this,Ic,n),p(this,Tc,s),[t,e]=b(this,rd,S0).call(this,t,e);let o=p(this,gi,[NaN,NaN,NaN,NaN,t,e]);p(this,Qi,[t,e]);let l=a(this,yi).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),a(this,yi).push({line:o,points:a(this,Qi)}),a(this,ws).set(o,0),p(this,gr,0),this.toSVGPath(),null}getLastElement(){return a(this,yi).at(-1)}setLastElement(t){return a(this,yi)?(a(this,yi).push(t),p(this,gi,t.line),p(this,Qi,t.points),p(this,gr,0),{path:{d:this.toSVGPath()}}):a(this,Sc).setLastElement(t)}removeLastElement(){if(!a(this,yi))return a(this,Sc).removeLastElement();a(this,yi).pop(),p(this,Mi,"");for(let t=0,e=a(this,yi).length;t<e;t++){let{line:i,points:n}=a(this,yi)[t];p(this,gi,i),p(this,Qi,n),p(this,gr,0),this.toSVGPath()}return{path:{d:a(this,Mi)}}}toSVGPath(){let t=Ct.svgRound(a(this,gi)[4]),e=Ct.svgRound(a(this,gi)[5]);if(a(this,Qi).length===2)return p(this,Mi,`${a(this,Mi)} M ${t} ${e} Z`),a(this,Mi);if(a(this,Qi).length<=6){let n=a(this,Mi).lastIndexOf("M");p(this,Mi,`${a(this,Mi).slice(0,n)} M ${t} ${e}`),p(this,gr,6)}if(a(this,Qi).length===4){let n=Ct.svgRound(a(this,gi)[10]),s=Ct.svgRound(a(this,gi)[11]);return p(this,Mi,`${a(this,Mi)} L ${n} ${s}`),p(this,gr,12),a(this,Mi)}let i=[];a(this,gr)===0&&(i.push(`M ${t} ${e}`),p(this,gr,6));for(let n=a(this,gr),s=a(this,gi).length;n<s;n+=6){let[o,l,c,u,h,d]=a(this,gi).slice(n,n+6).map(Ct.svgRound);i.push(`C${o} ${l} ${c} ${u} ${h} ${d}`)}return p(this,Mi,a(this,Mi)+i.join(" ")),p(this,gr,a(this,gi).length),a(this,Mi)}getOutlines(t,e,i,n){let s=a(this,yi).at(-1);return s.line=new Float32Array(s.line),s.points=new Float32Array(s.points),a(this,Sc).build(a(this,yi),t,e,i,a(this,Tc),a(this,nd),n),p(this,ws,null),p(this,gi,null),p(this,yi,null),p(this,Mi,null),a(this,Sc)}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}};ws=new WeakMap,gi=new WeakMap,yi=new WeakMap,Tc=new WeakMap,nd=new WeakMap,Qi=new WeakMap,Mi=new WeakMap,gr=new WeakMap,Sc=new WeakMap,Dc=new WeakMap,Ic=new WeakMap,rd=new WeakSet,S0=function(t,e){return Ct._normalizePoint(t,e,a(this,Dc),a(this,Ic),a(this,Tc))};zc=class extends Ct{constructor(){super(...arguments);g(this,Pi);g(this,Ji);g(this,Lm,0);g(this,Bm);g(this,Un);g(this,As);g(this,vs);g(this,sd);g(this,ad);g(this,kc)}build(e,i,n,s,o,l,c){p(this,As,i),p(this,vs,n),p(this,sd,s),p(this,ad,o),p(this,kc,l),p(this,Bm,c??0),p(this,Un,e),b(this,Pi,vS).call(this)}get thickness(){return a(this,kc)}setLastElement(e){return a(this,Un).push(e),{path:{d:this.toSVGPath()}}}removeLastElement(){return a(this,Un).pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let e=[];for(let{line:i}of a(this,Un)){if(e.push(`M${Ct.svgRound(i[4])} ${Ct.svgRound(i[5])}`),i.length===6){e.push("Z");continue}if(i.length===12&&isNaN(i[6])){e.push(`L${Ct.svgRound(i[10])} ${Ct.svgRound(i[11])}`);continue}for(let n=6,s=i.length;n<s;n+=6){let[o,l,c,u,h,d]=i.subarray(n,n+6).map(Ct.svgRound);e.push(`C${o} ${l} ${c} ${u} ${h} ${d}`)}}return e.join("")}serialize([e,i,n,s],o){let l=[],c=[],[u,h,d,f]=b(this,Pi,AS).call(this),m,x,y,A,w,v,C,D,_;switch(a(this,ad)){case 0:_=Ct._rescale,m=e,x=i+s,y=n,A=-s,w=e+u*n,v=i+(1-h-f)*s,C=e+(u+d)*n,D=i+(1-h)*s;break;case 90:_=Ct._rescaleAndSwap,m=e,x=i,y=n,A=s,w=e+h*n,v=i+u*s,C=e+(h+f)*n,D=i+(u+d)*s;break;case 180:_=Ct._rescale,m=e+n,x=i,y=-n,A=s,w=e+(1-u-d)*n,v=i+h*s,C=e+(1-u)*n,D=i+(h+f)*s;break;case 270:_=Ct._rescaleAndSwap,m=e+n,x=i+s,y=-n,A=-s,w=e+(1-h-f)*n,v=i+(1-u-d)*s,C=e+(1-h)*n,D=i+(1-u)*s;break}for(let{line:k,points:R}of a(this,Un))l.push(_(k,m,x,y,A,o?new Array(k.length):null)),c.push(_(R,m,x,y,A,o?new Array(R.length):null));return{lines:l,points:c,rect:[w,v,C,D]}}static deserialize(e,i,n,s,o,{paths:{lines:l,points:c},rotation:u,thickness:h}){let d=[],f,m,x,y,A;switch(u){case 0:A=Ct._rescale,f=-e/n,m=i/s+1,x=1/n,y=-1/s;break;case 90:A=Ct._rescaleAndSwap,f=-i/s,m=-e/n,x=1/s,y=1/n;break;case 180:A=Ct._rescale,f=e/n+1,m=-i/s,x=-1/n,y=1/s;break;case 270:A=Ct._rescaleAndSwap,f=i/s+1,m=e/n+1,x=-1/s,y=-1/n;break}if(!l){l=[];for(let v of c){let C=v.length;if(C===2){l.push(new Float32Array([NaN,NaN,NaN,NaN,v[0],v[1]]));continue}if(C===4){l.push(new Float32Array([NaN,NaN,NaN,NaN,v[0],v[1],NaN,NaN,NaN,NaN,v[2],v[3]]));continue}let D=new Float32Array(3*(C-2));l.push(D);let[_,k,R,K]=v.subarray(0,4);D.set([NaN,NaN,NaN,NaN,_,k],0);for(let W=4;W<C;W+=2){let V=v[W],U=v[W+1];D.set(Ct.createBezierPoints(_,k,R,K,V,U),(W-2)*3),[_,k,R,K]=[R,K,V,U]}}}for(let v=0,C=l.length;v<C;v++)d.push({line:A(l[v].map(D=>D??NaN),f,m,x,y),points:A(c[v].map(D=>D??NaN),f,m,x,y)});let w=new this.prototype.constructor;return w.build(d,n,s,1,u,h,o),w}get box(){return a(this,Ji)}updateProperty(e,i){return e==="stroke-width"?b(this,Pi,ES).call(this,i):null}updateParentDimensions([e,i],n){let[s,o]=b(this,Pi,Vs).call(this);p(this,As,e),p(this,vs,i),p(this,sd,n);let[l,c]=b(this,Pi,Vs).call(this),u=l-s,h=c-o,d=a(this,Ji);return d[0]-=u,d[1]-=h,d[2]+=2*u,d[3]+=2*h,d}updateRotation(e){return p(this,Lm,e),{path:{transform:this.rotationTransform}}}get viewBox(){return a(this,Ji).map(Ct.svgRound).join(" ")}get defaultProperties(){let[e,i]=a(this,Ji);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Ct.svgRound(e)} ${Ct.svgRound(i)}`}}}get rotationTransform(){let[,,e,i]=a(this,Ji),n=0,s=0,o=0,l=0,c=0,u=0;switch(a(this,Lm)){case 90:s=i/e,o=-e/i,c=e;break;case 180:n=-1,l=-1,c=e,u=i;break;case 270:s=-i/e,o=e/i,u=i;break;default:return""}return`matrix(${n} ${s} ${o} ${l} ${Ct.svgRound(c)} ${Ct.svgRound(u)})`}getPathResizingSVGProperties([e,i,n,s]){let[o,l]=b(this,Pi,Vs).call(this),[c,u,h,d]=a(this,Ji);if(Math.abs(h-o)<=Ct.PRECISION||Math.abs(d-l)<=Ct.PRECISION){let A=e+n/2-(c+h/2),w=i+s/2-(u+d/2);return{path:{"transform-origin":`${Ct.svgRound(e)} ${Ct.svgRound(i)}`,transform:`${this.rotationTransform} translate(${A} ${w})`}}}let f=(n-2*o)/(h-2*o),m=(s-2*l)/(d-2*l),x=h/n,y=d/s;return{path:{"transform-origin":`${Ct.svgRound(c)} ${Ct.svgRound(u)}`,transform:`${this.rotationTransform} scale(${x} ${y}) translate(${Ct.svgRound(o)} ${Ct.svgRound(l)}) scale(${f} ${m}) translate(${Ct.svgRound(-o)} ${Ct.svgRound(-l)})`}}}getPathResizedSVGProperties([e,i,n,s]){let[o,l]=b(this,Pi,Vs).call(this),c=a(this,Ji),[u,h,d,f]=c;if(c[0]=e,c[1]=i,c[2]=n,c[3]=s,Math.abs(d-o)<=Ct.PRECISION||Math.abs(f-l)<=Ct.PRECISION){let w=e+n/2-(u+d/2),v=i+s/2-(h+f/2);for(let{line:C,points:D}of a(this,Un))Ct._translate(C,w,v,C),Ct._translate(D,w,v,D);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Ct.svgRound(e)} ${Ct.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let m=(n-2*o)/(d-2*o),x=(s-2*l)/(f-2*l),y=-m*(u+o)+e+o,A=-x*(h+l)+i+l;if(m!==1||x!==1||y!==0||A!==0)for(let{line:w,points:v}of a(this,Un))Ct._rescale(w,y,A,m,x,w),Ct._rescale(v,y,A,m,x,v);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${Ct.svgRound(e)} ${Ct.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,i],n){let[s,o]=n,l=a(this,Ji),c=e-l[0],u=i-l[1];if(a(this,As)===s&&a(this,vs)===o)for(let{line:h,points:d}of a(this,Un))Ct._translate(h,c,u,h),Ct._translate(d,c,u,d);else{let h=a(this,As)/s,d=a(this,vs)/o;p(this,As,s),p(this,vs,o);for(let{line:f,points:m}of a(this,Un))Ct._rescale(f,c,u,h,d,f),Ct._rescale(m,c,u,h,d,m);l[2]*=h,l[3]*=d}return l[0]=e,l[1]=i,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${Ct.svgRound(e)} ${Ct.svgRound(i)}`}}}get defaultSVGProperties(){let e=a(this,Ji);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${Ct.svgRound(e[0])} ${Ct.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}};Ji=new WeakMap,Lm=new WeakMap,Bm=new WeakMap,Un=new WeakMap,As=new WeakMap,vs=new WeakMap,sd=new WeakMap,ad=new WeakMap,kc=new WeakMap,Pi=new WeakSet,Vs=function(e=a(this,kc)){let i=a(this,Bm)+e/2*a(this,sd);return a(this,ad)%180===0?[i/a(this,As),i/a(this,vs)]:[i/a(this,vs),i/a(this,As)]},AS=function(){let[e,i,n,s]=a(this,Ji),[o,l]=b(this,Pi,Vs).call(this,0);return[e+o,i+l,n-2*o,s-2*l]},vS=function(){let e=p(this,Ji,new Float32Array([1/0,1/0,-1/0,-1/0]));for(let{line:s}of a(this,Un)){if(s.length<=12){for(let c=4,u=s.length;c<u;c+=6)mt.pointBoundingBox(s[c],s[c+1],e);continue}let o=s[4],l=s[5];for(let c=6,u=s.length;c<u;c+=6){let[h,d,f,m,x,y]=s.subarray(c,c+6);mt.bezierBoundingBox(o,l,h,d,f,m,x,y,e),o=x,l=y}}let[i,n]=b(this,Pi,Vs).call(this);e[0]=li(e[0]-i,0,1),e[1]=li(e[1]-n,0,1),e[2]=li(e[2]+i,0,1),e[3]=li(e[3]+n,0,1),e[2]-=e[0],e[3]-=e[1]},ES=function(e){let[i,n]=b(this,Pi,Vs).call(this);p(this,kc,e);let[s,o]=b(this,Pi,Vs).call(this),[l,c]=[s-i,o-n],u=a(this,Ji);return u[0]-=l,u[1]-=c,u[2]+=2*l,u[3]+=2*c,u};oy=class r extends sy{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:Ae._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){t==="stroke-width"&&(e??(e=this["stroke-width"]),e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){let t=new r(this._viewParameters);return t.updateAll(this),t}},Uu=class Uu extends ay{constructor(e){super({...e,name:"inkEditor"});g(this,_y);this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(e,i){Ae.initialize(e,i),this._defaultDrawingOptions=new oy(i.viewParameters)}static getDefaultDrawingOptions(e){let i=this._defaultDrawingOptions.clone();return i.updateProperties(e),i}static get supportMultipleDrawings(){return!0}static get typesMap(){return Ot(this,"typesMap",new Map([[Wt.INK_THICKNESS,"stroke-width"],[Wt.INK_COLOR,"stroke"],[Wt.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(e,i,n,s,o){return new bw(e,i,n,s,o,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(e,i,n,s,o,l){return zc.deserialize(e,i,n,s,o,l)}static async deserialize(e,i,n){let s=null;if(e instanceof Yf){let{data:{inkLists:l,rect:c,rotation:u,id:h,color:d,opacity:f,borderStyle:{rawWidth:m},popupRef:x,richText:y,contentsObj:A,creationDate:w,modificationDate:v},parent:{page:{pageNumber:C}}}=e;s=e={annotationType:Pt.INK,color:Array.from(d),thickness:m,opacity:f,paths:{points:l},boxes:null,pageIndex:C-1,rect:c.slice(0),rotation:u,annotationElementId:h,id:h,deleted:!1,popupRef:x,richText:y,comment:A?.str||null,creationDate:w,modificationDate:v}}let o=await super.deserialize(e,i,n);return o._initialData=s,e.comment&&o.setCommentData(e),o}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new X0(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Wt.INK_COLOR}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:e,_drawingOptions:i,parent:n}=this;i.updateSVGProperty("stroke-width"),n.drawLayer.updateProperties(e,i.toSVGProperties())}static onScaleChangingWhenDrawing(){let e=this._currentParent;e&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),e.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:e,thickness:i,opacity:n}){this._drawingOptions=Uu.getDefaultDrawingOptions({stroke:mt.makeHexColor(...e),"stroke-width":i,"stroke-opacity":n})}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:i,points:n}=this.serializeDraw(e),{_drawingOptions:{stroke:s,"stroke-opacity":o,"stroke-width":l}}=this,c=Object.assign(super.serialize(e),{color:Ae._colorManager.convert(s),opacity:o,thickness:l,paths:{lines:i,points:n}});return this.addComment(c),e?(c.isCopy=!0,c):this.annotationElementId&&!b(this,_y,CS).call(this,c)?null:(c.id=this.annotationElementId,c)}renderAnnotationElement(e){if(this.deleted)return e.hide(),null;let{points:i,rect:n}=this.serializeDraw(!1);return e.updateEdited({rect:n,thickness:this._drawingOptions["stroke-width"],points:i,popup:this.comment}),null}};_y=new WeakSet,CS=function(e){let{color:i,thickness:n,opacity:s,pageIndex:o}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||e.color.some((l,c)=>l!==i[c])||e.thickness!==n||e.opacity!==s||e.pageIndex!==o},j(Uu,"_type","ink"),j(Uu,"_editorType",Pt.INK),j(Uu,"_defaultDrawingOptions",null);ww=Uu,Qf=class extends zc{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}},$g=8,lf=3,xr=class{static extractContoursFromText(t,{fontFamily:e,fontStyle:i,fontWeight:n},s,o,l,c){let u=new OffscreenCanvas(1,1),h=u.getContext("2d",{alpha:!1}),d=200,f=h.font=`${i} ${n} ${d}px ${e}`,{actualBoundingBoxLeft:m,actualBoundingBoxRight:x,actualBoundingBoxAscent:y,actualBoundingBoxDescent:A,fontBoundingBoxAscent:w,fontBoundingBoxDescent:v,width:C}=h.measureText(t),D=1.5,_=Math.ceil(Math.max(Math.abs(m)+Math.abs(x)||0,C)*D),k=Math.ceil(Math.max(Math.abs(y)+Math.abs(A)||d,Math.abs(w)+Math.abs(v)||d)*D);u=new OffscreenCanvas(_,k),h=u.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=f,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,_,k),h.fillStyle="black",h.fillText(t,_*(D-1)/2,k*(3-D)/2);let R=b(this,ae,Ew).call(this,h.getImageData(0,0,_,k).data),K=b(this,ae,kS).call(this,R),W=b(this,ae,Cw).call(this,K),V=b(this,ae,vw).call(this,R,_,k,W);return this.processDrawnLines({lines:{curves:V,width:_,height:k},pageWidth:s,pageHeight:o,rotation:l,innerMargin:c,mustSmooth:!0,areContours:!0})}static process(t,e,i,n,s){let[o,l,c]=b(this,ae,NS).call(this,t),[u,h]=b(this,ae,IS).call(this,o,l,c,Math.hypot(l,c)*a(this,Nc).sigmaSFactor,a(this,Nc).sigmaR,a(this,Nc).kernelSize),d=b(this,ae,Cw).call(this,h),f=b(this,ae,vw).call(this,u,l,c,d);return this.processDrawnLines({lines:{curves:f,width:l,height:c},pageWidth:e,pageHeight:i,rotation:n,innerMargin:s,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:n,innerMargin:s,mustSmooth:o,areContours:l}){n%180!==0&&([e,i]=[i,e]);let{curves:c,width:u,height:h}=t,d=t.thickness??0,f=[],m=Math.min(e/u,i/h),x=m/e,y=m/i,A=[];for(let{points:v}of c){let C=o?b(this,ae,DS).call(this,v):v;if(!C)continue;A.push(C);let D=C.length,_=new Float32Array(D),k=new Float32Array(3*(D===2?2:D-2));if(f.push({line:k,points:_}),D===2){_[0]=C[0]*x,_[1]=C[1]*y,k.set([NaN,NaN,NaN,NaN,_[0],_[1]],0);continue}let[R,K,W,V]=C;R*=x,K*=y,W*=x,V*=y,_.set([R,K,W,V],0),k.set([NaN,NaN,NaN,NaN,R,K],0);for(let U=4;U<D;U+=2){let tt=_[U]=C[U]*x,et=_[U+1]=C[U+1]*y;k.set(Ct.createBezierPoints(R,K,W,V,tt,et),(U-2)*3),[R,K,W,V]=[W,V,tt,et]}}if(f.length===0)return null;let w=l?new Qf:new zc;return w.build(f,e,i,1,n,l?0:d,s),{outline:w,newCurves:A,areContours:l,thickness:d,width:u,height:h}}static async compressSignature({outlines:t,areContours:e,thickness:i,width:n,height:s}){let o=1/0,l=-1/0,c=0;for(let v of t){c+=v.length;for(let C=2,D=v.length;C<D;C++){let _=v[C]-v[C-2];o=Math.min(o,_),l=Math.max(l,_)}}let u;o>=-128&&l<=127?u=Int8Array:o>=-32768&&l<=32767?u=Int16Array:u=Int32Array;let h=t.length,d=$g+lf*h,f=new Uint32Array(d),m=0;f[m++]=d*Uint32Array.BYTES_PER_ELEMENT+(c-2*h)*u.BYTES_PER_ELEMENT,f[m++]=0,f[m++]=n,f[m++]=s,f[m++]=e?0:1,f[m++]=Math.max(0,Math.floor(i??0)),f[m++]=h,f[m++]=u.BYTES_PER_ELEMENT;for(let v of t)f[m++]=v.length-2,f[m++]=v[0],f[m++]=v[1];let x=new CompressionStream("deflate-raw"),y=x.writable.getWriter();await y.ready,y.write(f);let A=u.prototype.constructor;for(let v of t){let C=new A(v.length-2);for(let D=2,_=v.length;D<_;D++)C[D-2]=v[D]-v[D-2];y.write(C)}return y.close(),(await new Response(x.readable).bytes()).toBase64()}static async decompressSignature(t){try{let e=Uint8Array.fromBase64(t),{readable:i,writable:n}=new DecompressionStream("deflate-raw"),s=n.getWriter();await s.ready,s.write(e).then(async()=>{await s.ready,await s.close()}).catch(()=>{});let o=null,l=0;for await(let C of i)o||(o=new Uint8Array(new Uint32Array(C.buffer,0,4)[0])),o.set(C,l),l+=C.length;let c=new Uint32Array(o.buffer,0,o.length>>2),u=c[1];if(u!==0)throw new Error(`Invalid version: ${u}`);let h=c[2],d=c[3],f=c[4]===0,m=c[5],x=c[6],y=c[7],A=[],w=($g+lf*x)*Uint32Array.BYTES_PER_ELEMENT,v;switch(y){case Int8Array.BYTES_PER_ELEMENT:v=new Int8Array(o.buffer,w);break;case Int16Array.BYTES_PER_ELEMENT:v=new Int16Array(o.buffer,w);break;case Int32Array.BYTES_PER_ELEMENT:v=new Int32Array(o.buffer,w);break}l=0;for(let C=0;C<x;C++){let D=c[lf*C+$g],_=new Float32Array(D+2);A.push(_);for(let k=0;k<lf-1;k++)_[k]=c[lf*C+$g+k+1];for(let k=0;k<D;k++)_[k+2]=_[k]+v[l++]}return{areContours:f,thickness:m,outlines:A,width:h,height:d}}catch(e){return Ut(`decompressSignature: ${e}`),null}}};Nc=new WeakMap,ae=new WeakSet,Aw=function(t,e,i,n){return i-=t,n-=e,i===0?n>0?0:4:i===1?n+6:2-n},Lr=new WeakMap,TS=function(t,e,i,n,s,o,l){let c=b(this,ae,Aw).call(this,i,n,s,o);for(let u=0;u<8;u++){let h=(-u+c-l+16)%8,d=a(this,Lr)[2*h],f=a(this,Lr)[2*h+1];if(t[(i+d)*e+(n+f)]!==0)return h}return-1},SS=function(t,e,i,n,s,o,l){let c=b(this,ae,Aw).call(this,i,n,s,o);for(let u=0;u<8;u++){let h=(u+c+l+16)%8,d=a(this,Lr)[2*h],f=a(this,Lr)[2*h+1];if(t[(i+d)*e+(n+f)]!==0)return h}return-1},vw=function(t,e,i,n){let s=t.length,o=new Int32Array(s);for(let h=0;h<s;h++)o[h]=t[h]<=n?1:0;for(let h=1;h<i-1;h++)o[h*e]=o[h*e+e-1]=0;for(let h=0;h<e;h++)o[h]=o[e*i-1-h]=0;let l=1,c,u=[];for(let h=1;h<i-1;h++){c=1;for(let d=1;d<e-1;d++){let f=h*e+d,m=o[f];if(m===0)continue;let x=h,y=d;if(m===1&&o[f-1]===0)l+=1,y-=1;else if(m>=1&&o[f+1]===0)l+=1,y+=1,m>1&&(c=m);else{m!==1&&(c=Math.abs(m));continue}let A=[d,h],w=y===d+1,v={isHole:w,points:A,id:l,parent:0};u.push(v);let C;for(let U of u)if(U.id===c){C=U;break}C?C.isHole?v.parent=w?C.parent:c:v.parent=w?c:C.parent:v.parent=w?c:0;let D=b(this,ae,TS).call(this,o,e,h,d,x,y,0);if(D===-1){o[f]=-l,o[f]!==1&&(c=Math.abs(o[f]));continue}let _=a(this,Lr)[2*D],k=a(this,Lr)[2*D+1],R=h+_,K=d+k;x=R,y=K;let W=h,V=d;for(;;){let U=b(this,ae,SS).call(this,o,e,W,V,x,y,1);_=a(this,Lr)[2*U],k=a(this,Lr)[2*U+1];let tt=W+_,et=V+k;A.push(et,tt);let B=W*e+V;if(o[B+1]===0?o[B]=-l:o[B]===1&&(o[B]=l),tt===h&&et===d&&W===R&&V===K){o[f]!==1&&(c=Math.abs(o[f]));break}else x=W,y=V,W=tt,V=et}}}return u},D0=function(t,e,i,n){if(i-e<=4){for(let R=e;R<i-2;R+=2)n.push(t[R],t[R+1]);return}let s=t[e],o=t[e+1],l=t[i-4]-s,c=t[i-3]-o,u=Math.hypot(l,c),h=l/u,d=c/u,f=h*o-d*s,m=c/l,x=1/u,y=Math.atan(m),A=Math.cos(y),w=Math.sin(y),v=x*(Math.abs(A)+Math.abs(w)),C=x*(1-v+v**2),D=Math.max(Math.atan(Math.abs(w+A)*C),Math.atan(Math.abs(w-A)*C)),_=0,k=e;for(let R=e+2;R<i-2;R+=2){let K=Math.abs(f-h*t[R+1]+d*t[R]);K>_&&(k=R,_=K)}_>(u*D)**2?(b(this,ae,D0).call(this,t,e,k+2,n),b(this,ae,D0).call(this,t,k,i,n)):n.push(s,o)},DS=function(t){let e=[],i=t.length;return b(this,ae,D0).call(this,t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e},IS=function(t,e,i,n,s,o){let l=new Float32Array(o**2),c=-2*n**2,u=o>>1;for(let y=0;y<o;y++){let A=(y-u)**2;for(let w=0;w<o;w++)l[y*o+w]=Math.exp((A+(w-u)**2)/c)}let h=new Float32Array(256),d=-2*s**2;for(let y=0;y<256;y++)h[y]=Math.exp(y**2/d);let f=t.length,m=new Uint8Array(f),x=new Uint32Array(256);for(let y=0;y<i;y++)for(let A=0;A<e;A++){let w=y*e+A,v=t[w],C=0,D=0;for(let k=0;k<o;k++){let R=y+k-u;if(!(R<0||R>=i))for(let K=0;K<o;K++){let W=A+K-u;if(W<0||W>=e)continue;let V=t[R*e+W],U=l[k*o+K]*h[Math.abs(V-v)];C+=V*U,D+=U}}let _=m[w]=Math.round(C/D);x[_]++}return[m,x]},kS=function(t){let e=new Uint32Array(256);for(let i of t)e[i]++;return e},Ew=function(t){let e=t.length,i=new Uint8ClampedArray(e>>2),n=-1/0,s=1/0;for(let l=0,c=i.length;l<c;l++){let u=i[l]=t[l<<2];n=Math.max(n,u),s=Math.min(s,u)}let o=255/(n-s);for(let l=0,c=i.length;l<c;l++)i[l]=(i[l]-s)*o;return i},Cw=function(t){let e,i=-1/0,n=-1/0,s=t.findIndex(c=>c!==0),o=s,l=s;for(e=s;e<256;e++){let c=t[e];c>i&&(e-o>n&&(n=e-o,l=e-1),i=c,o=e)}for(e=l-1;e>=0&&!(t[e]>t[e+1]);e--);return e},NS=function(t){let e=t,{width:i,height:n}=t,{maxDim:s}=a(this,Nc),o=i,l=n;if(i>s||n>s){let f=i,m=n,x=Math.log2(Math.max(i,n)/s),y=Math.floor(x);x=x===y?y-1:y;for(let w=0;w<x;w++){o=Math.ceil(f/2),l=Math.ceil(m/2);let v=new OffscreenCanvas(o,l);v.getContext("2d").drawImage(t,0,0,f,m,0,0,o,l),f=o,m=l,t!==e&&t.close(),t=v.transferToImageBitmap()}let A=Math.min(s/o,s/l);o=Math.round(o*A),l=Math.round(l*A)}let u=new OffscreenCanvas(o,l).getContext("2d",{willReadFrequently:!0});u.fillStyle="white",u.fillRect(0,0,o,l),u.filter="grayscale(1)",u.drawImage(t,0,0,t.width,t.height,0,0,o,l);let h=u.getImageData(0,0,o,l).data;return[b(this,ae,Ew).call(this,h),o,l]},g(xr,ae),g(xr,Nc,{maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16}),g(xr,Lr,new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]));Tw=class r extends sy{constructor(){super(),super.updateProperties({fill:Ae._defaultLineColor,"stroke-width":0})}clone(){let t=new r;return t.updateAll(this),t}},Sw=class r extends oy{constructor(t){super(t),super.updateProperties({stroke:Ae._defaultLineColor,"stroke-width":1})}clone(){let t=new r(this._viewParameters);return t.updateAll(this),t}},En=class En extends ay{constructor(e){super({...e,mustBeCommitted:!0,name:"signatureEditor"});g(this,Fo,!1);g(this,Es,null);g(this,Po,null);g(this,_c,null);this._willKeepAspectRatio=!0,p(this,Po,e.signatureData||null),p(this,Es,null),this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(e,i){Ae.initialize(e,i),this._defaultDrawingOptions=new Tw,this._defaultDrawnSignatureOptions=new Sw(i.viewParameters)}static getDefaultDrawingOptions(e){let i=this._defaultDrawingOptions.clone();return i.updateProperties(e),i}static get supportMultipleDrawings(){return!1}static get typesMap(){return Ot(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!a(this,Es)}}static computeTelemetryFinalData(e){let i=e.get("hasDescription");return{hasAltText:i.get(!0)??0,hasNoAltText:i.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){this._drawId!==null&&super.onScaleChanging()}render(){if(this.div)return this.div;let e,i,{_isCopy:n}=this;if(n&&(this._isCopy=!1,e=this.x,i=this.y),super.render(),this._drawId===null)if(a(this,Po)){let{lines:s,mustSmooth:o,areContours:l,description:c,uuid:u,heightInPage:h}=a(this,Po),{rawDims:{pageWidth:d,pageHeight:f},rotation:m}=this.parent.viewport,x=xr.processDrawnLines({lines:s,pageWidth:d,pageHeight:f,rotation:m,innerMargin:En._INNER_MARGIN,mustSmooth:o,areContours:l});this.addSignature(x,h,c,u)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:a(this,Es)||""}));return n&&(this._isCopy=!0,this._moveAfterPaste(e,i)),this.div}setUuid(e){p(this,_c,e),this.addEditToolbar()}getUuid(){return a(this,_c)}get description(){return a(this,Es)}set description(e){p(this,Es,e),this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:e})),super.addEditToolbar().then(i=>{i?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:i,thickness:n,width:s,height:o}=a(this,Po),l=Math.max(s,o),c=xr.processDrawnLines({lines:{curves:e.map(u=>({points:u})),thickness:n,width:s,height:o},pageWidth:l,pageHeight:l,rotation:0,innerMargin:0,mustSmooth:!1,areContours:i});return{areContours:i,outline:c.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(e,i,n,s){let{x:o,y:l}=this,{outline:c}=p(this,Po,e);p(this,Fo,c instanceof Qf),this.description=n;let u;a(this,Fo)?u=En.getDefaultDrawingOptions():(u=En._defaultDrawnSignatureOptions.clone(),u.updateProperties({"stroke-width":c.thickness})),this._addOutlines({drawOutlines:c,drawingOptions:u});let[,h]=this.pageDimensions,d=i/h;d=d>=1?.5:d,this.width*=d/this.height,this.width>=1&&(d*=.9/this.width,this.width=.9),this.height=d,this.setDims(),this.x=o,this.y=l,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(s),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!s,hasDescription:!!n}}),this.div.hidden=!1}getFromImage(e){let{rawDims:{pageWidth:i,pageHeight:n},rotation:s}=this.parent.viewport;return xr.process(e,i,n,s,En._INNER_MARGIN)}getFromText(e,i){let{rawDims:{pageWidth:n,pageHeight:s},rotation:o}=this.parent.viewport;return xr.extractContoursFromText(e,i,n,s,o,En._INNER_MARGIN)}getDrawnSignature(e){let{rawDims:{pageWidth:i,pageHeight:n},rotation:s}=this.parent.viewport;return xr.processDrawnLines({lines:e,pageWidth:i,pageHeight:n,rotation:s,innerMargin:En._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:i}){e?this._drawingOptions=En.getDefaultDrawingOptions():(this._drawingOptions=En._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":i}))}serialize(e=!1){if(this.isEmpty())return null;let{lines:i,points:n}=this.serializeDraw(e),{_drawingOptions:{"stroke-width":s}}=this,o=Object.assign(super.serialize(e),{isSignature:!0,areContours:a(this,Fo),color:[0,0,0],thickness:a(this,Fo)?0:s});return this.addComment(o),e?(o.paths={lines:i,points:n},o.uuid=a(this,_c),o.isCopy=!0):o.lines=i,a(this,Es)&&(o.accessibilityData={type:"Figure",alt:a(this,Es)}),o}static deserializeDraw(e,i,n,s,o,l){return l.areContours?Qf.deserialize(e,i,n,s,o,l):zc.deserialize(e,i,n,s,o,l)}static async deserialize(e,i,n){let s=await super.deserialize(e,i,n);return p(s,Fo,e.areContours),s.description=e.accessibilityData?.alt||"",p(s,_c,e.uuid),s}};Fo=new WeakMap,Es=new WeakMap,Po=new WeakMap,_c=new WeakMap,j(En,"_type","signature"),j(En,"_editorType",Pt.SIGNATURE),j(En,"_defaultDrawingOptions",null);Dw=En,If=class extends Ae{constructor(e){super({...e,name:"stampEditor"});g(this,Jt);g(this,Te,null);g(this,xi,null);g(this,Oo,null);g(this,va,null);g(this,Ro,null);g(this,od,"");g(this,Ea,null);g(this,Mc,!1);g(this,Cs,null);g(this,zn,!1);g(this,ld,!1);p(this,va,e.bitmapUrl),p(this,Ro,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,i){Ae.initialize(e,i)}static isHandlingMimeForPasting(e){return R0.includes(e)}static paste(e,i){i.pasteEditor({mode:Pt.STAMP},{bitmapFile:e.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(e){let i=e.get("hasAltText");return{hasAltText:i.get(!0)??0,hasNoAltText:i.get(!1)??0}}async mlGuessAltText(e=null,i=!0){if(this.hasAltTextData())return null;let{mlManager:n}=this._uiManager;if(!n)throw new Error("No ML.");if(!await n.isEnabledFor("altText"))throw new Error("ML isn't enabled for alt text.");let{data:s,width:o,height:l}=e||this.copyCanvas(null,null,!0).imageData,c=await n.guess({name:"altText",request:{data:s,width:o,height:l,channels:s.length/(o*l)}});if(!c)throw new Error("No response from the AI service.");if(c.error)throw new Error("Error from the AI service.");if(c.cancel)return null;if(!c.output)throw new Error("No valid response from the AI service.");let u=c.output;return await this.setGuessedAltText(u),i&&!this.hasAltTextData()&&(this.altTextData={alt:u,decorative:!1}),u}remove(){a(this,xi)&&(p(this,Te,null),this._uiManager.imageManager.deleteId(a(this,xi)),a(this,Ea)?.remove(),p(this,Ea,null),a(this,Cs)&&(clearTimeout(a(this,Cs)),p(this,Cs,null))),super.remove()}rebuild(){if(!this.parent){a(this,xi)&&b(this,Jt,I0).call(this);return}super.rebuild(),this.div!==null&&(a(this,xi)&&a(this,Ea)===null&&b(this,Jt,I0).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(a(this,Oo)||a(this,Te)||a(this,va)||a(this,Ro)||a(this,xi)||a(this,Mc))}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){if(this.div)return this.div;let e,i;return this._isCopy&&(e=this.x,i=this.y),super.render(),this.div.hidden=!0,this.createAltText(),a(this,Mc)||(a(this,Te)?b(this,Jt,k0).call(this):b(this,Jt,I0).call(this)),this._isCopy&&this._moveAfterPaste(e,i),this._uiManager.addShouldRescale(this),this.div}setCanvas(e,i){let{id:n,bitmap:s}=this._uiManager.imageManager.getFromCanvas(e,i);i.remove(),n&&this._uiManager.imageManager.isValidId(n)&&(p(this,xi,n),s&&p(this,Te,s),p(this,Mc,!1),b(this,Jt,k0).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;a(this,Cs)!==null&&clearTimeout(a(this,Cs)),p(this,Cs,setTimeout(()=>{p(this,Cs,null),b(this,Jt,Iw).call(this)},200))}copyCanvas(e,i,n=!1){e||(e=224);let{width:s,height:o}=a(this,Te),l=new Ds,c=a(this,Te),u=s,h=o,d=null;if(i){if(s>i||o>i){let R=Math.min(i/s,i/o);u=Math.floor(s*R),h=Math.floor(o*R)}d=document.createElement("canvas");let m=d.width=Math.ceil(u*l.sx),x=d.height=Math.ceil(h*l.sy);a(this,zn)||(c=b(this,Jt,N0).call(this,m,x));let y=d.getContext("2d");y.filter=this._uiManager.hcmFilter;let A="white",w="#cfcfd8";this._uiManager.hcmFilter!=="none"?w="black":ab.isDarkMode&&(A="#8f8f9d",w="#42414d");let v=15,C=v*l.sx,D=v*l.sy,_=new OffscreenCanvas(C*2,D*2),k=_.getContext("2d");k.fillStyle=A,k.fillRect(0,0,C*2,D*2),k.fillStyle=w,k.fillRect(0,0,C,D),k.fillRect(C,D,C,D),y.fillStyle=y.createPattern(_,"repeat"),y.fillRect(0,0,m,x),y.drawImage(c,0,0,c.width,c.height,0,0,m,x)}let f=null;if(n){let m,x;if(l.symmetric&&c.width<e&&c.height<e)m=c.width,x=c.height;else if(c=a(this,Te),s>e||o>e){let w=Math.min(e/s,e/o);m=Math.floor(s*w),x=Math.floor(o*w),a(this,zn)||(c=b(this,Jt,N0).call(this,m,x))}let A=new OffscreenCanvas(m,x).getContext("2d",{willReadFrequently:!0});A.drawImage(c,0,0,c.width,c.height,0,0,m,x),f={width:m,height:x,data:A.getImageData(0,0,m,x).data}}return{canvas:d,width:u,height:h,imageData:f}}static async deserialize(e,i,n){let s=null,o=!1;if(e instanceof ty){let{data:{rect:A,rotation:w,id:v,structParent:C,popupRef:D,richText:_,contentsObj:k,creationDate:R,modificationDate:K},container:W,parent:{page:{pageNumber:V}},canvas:U}=e,tt,et;U?(delete e.canvas,{id:tt,bitmap:et}=n.imageManager.getFromCanvas(W.id,U),U.remove()):(o=!0,e._hasNoCanvas=!0);let B=(await i._structTree.getAriaAttributes(`${Ou}${v}`))?.get("aria-label")||"";s=e={annotationType:Pt.STAMP,bitmapId:tt,bitmap:et,pageIndex:V-1,rect:A.slice(0),rotation:w,annotationElementId:v,id:v,deleted:!1,accessibilityData:{decorative:!1,altText:B},isSvg:!1,structParent:C,popupRef:D,richText:_,comment:k?.str||null,creationDate:R,modificationDate:K}}let l=await super.deserialize(e,i,n),{rect:c,bitmap:u,bitmapUrl:h,bitmapId:d,isSvg:f,accessibilityData:m}=e;o?(n.addMissingCanvas(e.id,l),p(l,Mc,!0)):d&&n.imageManager.isValidId(d)?(p(l,xi,d),u&&p(l,Te,u)):p(l,va,h),p(l,zn,f);let[x,y]=l.pageDimensions;return l.width=(c[2]-c[0])/x,l.height=(c[3]-c[1])/y,m&&(l.altTextData=m),l._initialData=s,e.comment&&l.setCommentData(e),p(l,ld,!!s),l}serialize(e=!1,i=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let n=Object.assign(super.serialize(e),{bitmapId:a(this,xi),isSvg:a(this,zn)});if(this.addComment(n),e)return n.bitmapUrl=b(this,Jt,_0).call(this,!0),n.accessibilityData=this.serializeAltText(!0),n.isCopy=!0,n;let{decorative:s,altText:o}=this.serializeAltText(!1);if(!s&&o&&(n.accessibilityData={type:"Figure",alt:o}),this.annotationElementId){let c=b(this,Jt,_S).call(this,n);return c.isSame?null:(c.isSameAltText?delete n.accessibilityData:n.accessibilityData.structParent=this._initialData.structParent??-1,n.id=this.annotationElementId,delete n.bitmapId,n)}if(i===null)return n;i.stamps||(i.stamps=new Map);let l=a(this,zn)?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!i.stamps.has(a(this,xi)))i.stamps.set(a(this,xi),{area:l,serialized:n}),n.bitmap=b(this,Jt,_0).call(this,!1);else if(a(this,zn)){let c=i.stamps.get(a(this,xi));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=b(this,Jt,_0).call(this,!1))}return n}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}};Te=new WeakMap,xi=new WeakMap,Oo=new WeakMap,va=new WeakMap,Ro=new WeakMap,od=new WeakMap,Ea=new WeakMap,Mc=new WeakMap,Cs=new WeakMap,zn=new WeakMap,ld=new WeakMap,Jt=new WeakSet,kf=function(e,i=!1){if(!e){this.remove();return}p(this,Te,e.bitmap),i||(p(this,xi,e.id),p(this,zn,e.isSvg)),e.file&&p(this,od,e.file.name),b(this,Jt,k0).call(this)},Nf=function(){if(p(this,Oo,null),this._uiManager.enableWaiting(!1),!!a(this,Ea)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,Te)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,Te)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},I0=function(){if(a(this,xi)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(a(this,xi)).then(n=>b(this,Jt,kf).call(this,n,!0)).finally(()=>b(this,Jt,Nf).call(this));return}if(a(this,va)){let n=a(this,va);p(this,va,null),this._uiManager.enableWaiting(!0),p(this,Oo,this._uiManager.imageManager.getFromUrl(n).then(s=>b(this,Jt,kf).call(this,s)).finally(()=>b(this,Jt,Nf).call(this)));return}if(a(this,Ro)){let n=a(this,Ro);p(this,Ro,null),this._uiManager.enableWaiting(!0),p(this,Oo,this._uiManager.imageManager.getFromFile(n).then(s=>b(this,Jt,kf).call(this,s)).finally(()=>b(this,Jt,Nf).call(this)));return}let e=document.createElement("input");e.type="file",e.accept=R0.join(",");let i=this._uiManager._signal;p(this,Oo,new Promise(n=>{e.addEventListener("change",async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let s=await this._uiManager.imageManager.getFromFile(e.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),b(this,Jt,kf).call(this,s)}n()},{signal:i}),e.addEventListener("cancel",()=>{this.remove(),n()},{signal:i})}).finally(()=>b(this,Jt,Nf).call(this))),e.click()},k0=function(){let{div:e}=this,{width:i,height:n}=a(this,Te),[s,o]=this.pageDimensions,l=.75;if(this.width)i=this.width*s,n=this.height*o;else if(i>l*s||n>l*o){let u=Math.min(l*s/i,l*o/n);i*=u,n*=u}this._uiManager.enableWaiting(!1);let c=p(this,Ea,document.createElement("canvas"));c.setAttribute("role","img"),this.addContainer(c),this.width=i/s,this.height=n/o,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(e.hidden=!1),b(this,Jt,Iw).call(this),a(this,ld)||(this.parent.addUndoableEditor(this),p(this,ld,!0)),this._reportTelemetry({action:"inserted_image"}),a(this,od)&&this.div.setAttribute("aria-description",a(this,od)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},N0=function(e,i){let{width:n,height:s}=a(this,Te),o=n,l=s,c=a(this,Te);for(;o>2*e||l>2*i;){let u=o,h=l;o>2*e&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2)),l>2*i&&(l=l>=16384?Math.floor(l/2)-1:Math.ceil(l/2));let d=new OffscreenCanvas(o,l);d.getContext("2d").drawImage(c,0,0,u,h,0,0,o,l),c=d.transferToImageBitmap()}return c},Iw=function(){let[e,i]=this.parentDimensions,{width:n,height:s}=this,o=new Ds,l=Math.ceil(n*e*o.sx),c=Math.ceil(s*i*o.sy),u=a(this,Ea);if(!u||u.width===l&&u.height===c)return;u.width=l,u.height=c;let h=a(this,zn)?a(this,Te):b(this,Jt,N0).call(this,l,c),d=u.getContext("2d");d.filter=this._uiManager.hcmFilter,d.drawImage(h,0,0,h.width,h.height,0,0,l,c)},_0=function(e){if(e){if(a(this,zn)){let s=this._uiManager.imageManager.getSvgUrl(a(this,xi));if(s)return s}let i=document.createElement("canvas");return{width:i.width,height:i.height}=a(this,Te),i.getContext("2d").drawImage(a(this,Te),0,0),i.toDataURL()}if(a(this,zn)){let[i,n]=this.pageDimensions,s=Math.round(this.width*i*_a.PDF_TO_CSS_UNITS),o=Math.round(this.height*n*_a.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(s,o);return l.getContext("2d").drawImage(a(this,Te),0,0,a(this,Te).width,a(this,Te).height,0,0,s,o),l.transferToImageBitmap()}return structuredClone(a(this,Te))},_S=function(e){let{pageIndex:i,accessibilityData:{altText:n}}=this._initialData,s=e.pageIndex===i,o=(e.accessibilityData?.alt||"")===n;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&s&&o,isSameAltText:o}},j(If,"_type","stamp"),j(If,"_editorType",Pt.STAMP);Tr=class Tr{constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:n,accessibilityManager:s,annotationLayer:o,drawLayer:l,textLayer:c,viewport:u,l10n:h}){g(this,be);g(this,Fc);g(this,cd,!1);g(this,Lo,null);g(this,Bo,null);g(this,Ca,null);g(this,yn,new Map);g(this,Uo,!1);g(this,ud,!1);g(this,hd,!1);g(this,Br,null);g(this,Ta,null);g(this,bi,null);g(this,Sa,null);g(this,zo,null);g(this,dd,-1);g(this,It);let d=[...a(Tr,jo).values()];if(!Tr._initialized){Tr._initialized=!0;for(let f of d)f.initialize(h,t)}t.registerEditorTypes(d),p(this,It,t),this.pageIndex=e,this.div=i,p(this,Fc,s),p(this,Lo,o),this.viewport=u,p(this,bi,c),this.drawLayer=l,this._structTree=n,a(this,It).addLayer(this)}get isEmpty(){return a(this,yn).size===0}get isInvisible(){return this.isEmpty&&a(this,It).getMode()===Pt.NONE}updateToolbar(t){a(this,It).updateToolbar(t)}updateMode(t=a(this,It).getMode()){switch(b(this,be,M0).call(this),t){case Pt.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Pt.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case Pt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===Pt.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(let i of a(Tr,jo).values())e.toggle(`${i._type}Editing`,t===i._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===a(this,bi)?.div}setEditingState(t){a(this,It).setEditingState(t)}addCommands(t){a(this,It).addCommands(t)}cleanUndoStack(t){a(this,It).cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){a(this,Lo)?.togglePointerEvents(t)}async enable(){p(this,hd,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),a(this,zo)?.abort(),p(this,zo,null);let t=new Set;for(let i of a(this,be,kw))i.enableEditing(),i.show(!0),i.annotationElementId&&(a(this,It).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));let e=a(this,Lo);if(e)for(let i of e.getEditableAnnotations()){if(i.hide(),a(this,It).isDeletedAnnotationElement(i.data.id)||t.has(i.data.id))continue;let n=await this.deserialize(i);n&&(this.addOrRebuild(n),n.enableEditing())}p(this,hd,!1),a(this,It)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(p(this,ud,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),a(this,bi)&&!a(this,zo)){p(this,zo,new AbortController);let n=a(this,It).combinedSignal(a(this,zo));a(this,bi).div.addEventListener("pointerdown",s=>{let{clientX:l,clientY:c,timeStamp:u}=s,h=a(this,dd);if(u-h>500){p(this,dd,u);return}p(this,dd,-1);let{classList:d}=this.div;d.toggle("getElements",!0);let f=document.elementsFromPoint(l,c);if(d.toggle("getElements",!1),!this.div.contains(f[0]))return;let m,x=new RegExp(`^${Lf}[0-9]+$`);for(let A of f)if(x.test(A.id)){m=A.id;break}if(!m)return;let y=a(this,yn).get(m);y?.annotationElementId===null&&(s.stopPropagation(),s.preventDefault(),y.dblclick(s))},{signal:n,capture:!0})}let t=a(this,Lo),e=[];if(t){let n=new Map,s=new Map;for(let o of a(this,be,kw)){if(o.disableEditing(),!o.annotationElementId){e.push(o);continue}if(o.serialize()!==null){n.set(o.annotationElementId,o);continue}else s.set(o.annotationElementId,o);this.getEditableAnnotation(o.annotationElementId)?.show(),o.remove()}for(let o of t.getEditableAnnotations()){let{id:l}=o.data;if(a(this,It).isDeletedAnnotationElement(l)){o.updateEdited({deleted:!0});continue}let c=s.get(l);if(c){c.resetAnnotationElement(o),c.show(!1),o.show();continue}c=n.get(l),c&&(a(this,It).addChangedExistingAnnotation(c),c.renderAnnotationElement(o)&&c.show(!1)),o.show()}}b(this,be,M0).call(this),this.isEmpty&&(this.div.hidden=!0);let{classList:i}=this.div;for(let n of a(Tr,jo).values())i.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),p(this,ud,!1)}getEditableAnnotation(t){return a(this,Lo)?.getEditableAnnotation(t)||null}setActiveEditor(t){a(this,It).getActive()!==t&&a(this,It).setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,a(this,bi)?.div&&!a(this,Sa)){p(this,Sa,new AbortController);let t=a(this,It).combinedSignal(a(this,Sa));a(this,bi).div.addEventListener("pointerdown",b(this,be,MS).bind(this),{signal:t}),a(this,bi).div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,a(this,bi)?.div&&a(this,Sa)&&(a(this,Sa).abort(),p(this,Sa,null),a(this,bi).div.classList.remove("highlighting"))}enableClick(){if(a(this,Bo))return;p(this,Bo,new AbortController);let t=a(this,It).combinedSignal(a(this,Bo));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});let e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){a(this,Bo)?.abort(),p(this,Bo,null)}attach(t){a(this,yn).set(t.id,t);let{annotationElementId:e}=t;e&&a(this,It).isDeletedAnnotationElement(e)&&a(this,It).removeDeletedAnnotationElement(t)}detach(t){a(this,yn).delete(t.id),a(this,Fc)?.removePointerInTextLayer(t.contentDiv),!a(this,ud)&&t.annotationElementId&&a(this,It).addDeletedAnnotationElement(t)}remove(t){this.detach(t),a(this,It).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(a(this,It).addDeletedAnnotationElement(t),Ae.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(!(t.parent===this&&t.isAttachedToDOM)){if(this.changeParent(t),a(this,It).addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!a(this,hd)),a(this,It).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!a(this,Ca)&&(t._focusEventsAllowed=!1,p(this,Ca,setTimeout(()=>{p(this,Ca,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:a(this,It)._signal}),e.focus())},0))),t._structTreeParentId=a(this,Fc)?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){let e=()=>t._uiManager.rebuild(t),i=()=>{t.remove()};this.addCommands({cmd:e,undo:i,mustExec:!1})}getEditorByUID(t){for(let e of a(this,yn).values())if(e.uid===t)return e;return null}combinedSignal(t){return a(this,It).combinedSignal(t)}canCreateNewEmptyEditor(){return a(this,be,ns)?.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await a(this,It).updateMode(t.mode);let{offsetX:i,offsetY:n}=b(this,be,_w).call(this),s=a(this,It).getId(),o=b(this,be,Nw).call(this,{parent:this,id:s,x:i,y:n,uiManager:a(this,It),isCentered:!0,...e});o&&this.add(o)}async deserialize(t){return await a(Tr,jo).get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,a(this,It))||null}createAndAddNewEditor(t,e,i={}){let n=a(this,It).getId(),s=b(this,be,Nw).call(this,{parent:this,id:n,x:t.offsetX,y:t.offsetY,uiManager:a(this,It),isCentered:e,...i});return s&&this.add(s),s}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(t={}){this.createAndAddNewEditor(b(this,be,_w).call(this),!0,t)}setSelected(t){a(this,It).setSelected(t)}toggleSelected(t){a(this,It).toggleSelected(t)}unselect(t){a(this,It).unselect(t)}pointerup(t){let{isMac:e}=je.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!a(this,Uo)||(p(this,Uo,!1),a(this,be,ns)?.isDrawer&&a(this,be,ns).supportMultipleDrawings))return;if(!a(this,cd)){p(this,cd,!0);return}let i=a(this,It).getMode();if(i===Pt.STAMP||i===Pt.POPUP||i===Pt.SIGNATURE){a(this,It).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(a(this,It).getMode()===Pt.HIGHLIGHT&&this.enableTextSelection(),a(this,Uo)){p(this,Uo,!1);return}let{isMac:e}=je.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(p(this,Uo,!0),a(this,be,ns)?.isDrawer){this.startDrawingSession(t);return}let i=a(this,It).getActive();p(this,cd,!i||i.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),a(this,Br)){a(this,be,ns).startDrawing(this,a(this,It),!1,t);return}a(this,It).setCurrentDrawingSession(this),p(this,Br,new AbortController);let e=a(this,It).combinedSignal(a(this,Br));this.div.addEventListener("blur",({relatedTarget:i})=>{i&&!this.div.contains(i)&&(p(this,Ta,null),this.commitOrRemove())},{signal:e}),a(this,be,ns).startDrawing(this,a(this,It),!1,t)}pause(t){if(t){let{activeElement:e}=document;this.div.contains(e)&&p(this,Ta,e);return}a(this,Ta)&&setTimeout(()=>{a(this,Ta)?.focus(),p(this,Ta,null)},0)}endDrawingSession(t=!1){return a(this,Br)?(a(this,It).setCurrentDrawingSession(null),a(this,Br).abort(),p(this,Br,null),p(this,Ta,null),a(this,be,ns).endDrawing(t)):null}findNewParent(t,e,i){let n=a(this,It).findParent(e,i);return n===null||n===this?!1:(n.changeParent(t),!0)}commitOrRemove(){return a(this,Br)?(this.endDrawingSession(),!0):!1}onScaleChanging(){a(this,Br)&&a(this,be,ns).onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),a(this,It).getActive()?.parent===this&&(a(this,It).commitOrRemove(),a(this,It).setActiveEditor(null)),a(this,Ca)&&(clearTimeout(a(this,Ca)),p(this,Ca,null));for(let t of a(this,yn).values())a(this,Fc)?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,a(this,yn).clear(),a(this,It).removeLayer(this)}async render({viewport:t}){this.viewport=t,Ho(this.div,t);for(let e of a(this,It).getEditors(this.pageIndex))this.add(e),e.rebuild();await a(this,It).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){a(this,It).commitOrRemove(),b(this,be,M0).call(this);let e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,Ho(this.div,{rotation:i}),e!==i)for(let n of a(this,yn).values())n.rotate(i)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return a(this,It).viewParameters.realScale}};Fc=new WeakMap,cd=new WeakMap,Lo=new WeakMap,Bo=new WeakMap,Ca=new WeakMap,yn=new WeakMap,Uo=new WeakMap,ud=new WeakMap,hd=new WeakMap,Br=new WeakMap,Ta=new WeakMap,bi=new WeakMap,Sa=new WeakMap,zo=new WeakMap,dd=new WeakMap,It=new WeakMap,jo=new WeakMap,be=new WeakSet,kw=function(){return a(this,yn).size!==0?a(this,yn).values():a(this,It).getEditors(this.pageIndex)},MS=function(t){a(this,It).unselectAll();let{target:e}=t;if(e===a(this,bi).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&a(this,bi).div.contains(e)){let{isMac:i}=je.platform;if(t.button!==0||t.ctrlKey&&i)return;a(this,It).showAllEditors("highlight",!0,!0),a(this,bi).div.classList.add("free"),this.toggleDrawing(),ry.startHighlighting(this,a(this,It).direction==="ltr",{target:a(this,bi).div,x:t.x,y:t.y}),a(this,bi).div.addEventListener("pointerup",()=>{a(this,bi).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:a(this,It)._signal}),t.preventDefault()}},ns=function(){return a(Tr,jo).get(a(this,It).getMode())},Nw=function(t){let e=a(this,be,ns);return e?new e.prototype.constructor(t):null},_w=function(){let{x:t,y:e,width:i,height:n}=this.boundingClientRect,s=Math.max(0,t),o=Math.max(0,e),l=Math.min(window.innerWidth,t+i),c=Math.min(window.innerHeight,e+n),u=(s+l)/2-t,h=(o+c)/2-e,[d,f]=this.viewport.rotation%180===0?[u,h]:[h,u];return{offsetX:d,offsetY:f}},M0=function(){for(let t of a(this,yn).values())t.isEmpty()&&t.remove()},j(Tr,"_initialized",!1),g(Tr,jo,new Map([cw,ww,If,ry,Dw].map(t=>[t._editorType,t])));ly=Tr,ai=class ai{constructor(){g(this,ks);g(this,Ur,null);g(this,tn,new Map);g(this,Pc,new Map)}setParent(t){if(!a(this,Ur)){p(this,Ur,t);return}if(a(this,Ur)!==t){if(a(this,tn).size>0)for(let e of a(this,tn).values())e.remove(),t.append(e);p(this,Ur,t)}}static get _svgFactory(){return Ot(this,"_svgFactory",new Bc)}draw(t,e=!1,i=!1){let n=Ze(ai,Um)._++,s=b(this,ks,Mw).call(this),o=ai._svgFactory.createElement("defs");s.append(o);let l=ai._svgFactory.createElement("path");o.append(l);let c=`path_${n}`;l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),e&&a(this,Pc).set(n,l);let u=i?b(this,ks,PS).call(this,o,c):null,h=ai._svgFactory.createElement("use");return s.append(h),h.setAttribute("href",`#${c}`),this.updateProperties(s,t),a(this,tn).set(n,s),{id:n,clipPathId:`url(#${u})`}}drawOutline(t,e){let i=Ze(ai,Um)._++,n=b(this,ks,Mw).call(this),s=ai._svgFactory.createElement("defs");n.append(s);let o=ai._svgFactory.createElement("path");s.append(o);let l=`path_${i}`;o.setAttribute("id",l),o.setAttribute("vector-effect","non-scaling-stroke");let c;if(e){let d=ai._svgFactory.createElement("mask");s.append(d),c=`mask_${i}`,d.setAttribute("id",c),d.setAttribute("maskUnits","objectBoundingBox");let f=ai._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");let m=ai._svgFactory.createElement("use");d.append(m),m.setAttribute("href",`#${l}`),m.setAttribute("stroke","none"),m.setAttribute("fill","black"),m.setAttribute("fill-rule","nonzero"),m.classList.add("mask")}let u=ai._svgFactory.createElement("use");n.append(u),u.setAttribute("href",`#${l}`),c&&u.setAttribute("mask",`url(#${c})`);let h=u.cloneNode();return n.append(h),u.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.updateProperties(n,t),a(this,tn).set(i,n),i}finalizeDraw(t,e){a(this,Pc).delete(t),this.updateProperties(t,e)}updateProperties(t,e){var c;if(!e)return;let{root:i,bbox:n,rootClass:s,path:o}=e,l=typeof t=="number"?a(this,tn).get(t):t;if(l){if(i&&b(this,ks,Fw).call(this,l,i),n&&b(c=ai,My,FS).call(c,l,n),s){let{classList:u}=l;for(let[h,d]of Object.entries(s))u.toggle(h,d)}if(o){let h=l.firstElementChild.firstElementChild;b(this,ks,Fw).call(this,h,o)}}}updateParent(t,e){if(e===this)return;let i=a(this,tn).get(t);i&&(a(e,Ur).append(i),a(this,tn).delete(t),a(e,tn).set(t,i))}remove(t){a(this,Pc).delete(t),a(this,Ur)!==null&&(a(this,tn).get(t).remove(),a(this,tn).delete(t))}destroy(){p(this,Ur,null);for(let t of a(this,tn).values())t.remove();a(this,tn).clear(),a(this,Pc).clear()}};Ur=new WeakMap,tn=new WeakMap,Pc=new WeakMap,Um=new WeakMap,My=new WeakSet,FS=function(t,[e,i,n,s]){let{style:o}=t;o.top=`${100*i}%`,o.left=`${100*e}%`,o.width=`${100*n}%`,o.height=`${100*s}%`},ks=new WeakSet,Mw=function(){let t=ai._svgFactory.create(1,1,!0);return a(this,Ur).append(t),t.setAttribute("aria-hidden",!0),t},PS=function(t,e){let i=ai._svgFactory.createElement("clipPath");t.append(i);let n=`clip_${e}`;i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");let s=ai._svgFactory.createElement("use");return i.append(s),s.setAttribute("href",`#${e}`),s.classList.add("clip"),n},Fw=function(t,e){for(let[i,n]of Object.entries(e))n===null?t.removeAttribute(i):t.setAttribute(i,n)},g(ai,My),g(ai,Um,0);cy=ai;Rf=class Rf{constructor(t,e,i,n){g(this,Fy);g(this,fd,[]);g(this,zm,new Map);g(this,jm,null);g(this,pd,0);g(this,Ts,0);g(this,Ss,0);p(this,pd,t),p(this,fd,e),p(this,Ts,i.rawDims.pageWidth),p(this,Ss,i.rawDims.pageHeight),p(this,jm,n)}render(){let t=document.createElement("div");t.className="textLayerImages";for(let e=0;e<a(this,fd).length;e+=6){let i=b(this,Fy,OS).call(this,a(this,fd).subarray(e,e+6));i&&t.append(i)}return t.addEventListener("contextmenu",e=>{if(!(e.target instanceof HTMLCanvasElement))return;let i=e.target,n=a(this,zm).get(i);if(!n)return;let s=a(Rf,Hm)?.deref();if(s===i)return;s&&(s.width=0,s.height=0),p(Rf,Hm,new WeakRef(i));let{inverseTransform:o,x1:l,y1:c,width:u,height:h}=n,d=a(this,jm).call(this),f=Math.ceil(l*d.width),m=Math.ceil(c*d.height),x=Math.floor((l+u/a(this,Ts))*d.width),y=Math.floor((c+h/a(this,Ss))*d.height);i.width=x-f,i.height=y-m;let A=i.getContext("2d");A.setTransform(...o),A.translate(-f,-m),A.drawImage(d,0,0)}),t}};fd=new WeakMap,zm=new WeakMap,jm=new WeakMap,pd=new WeakMap,Ts=new WeakMap,Ss=new WeakMap,Hm=new WeakMap,Fy=new WeakSet,OS=function([t,e,i,n,s,o]){let l=Math.hypot((s-t)*a(this,Ts),(o-e)*a(this,Ss)),c=Math.hypot((i-t)*a(this,Ts),(n-e)*a(this,Ss));if(l<a(this,pd)||c<a(this,pd))return null;let u=[(s-t)*a(this,Ts)/l,(o-e)*a(this,Ss)/l,(i-t)*a(this,Ts)/c,(n-e)*a(this,Ss)/c,0,0],h=mt.inverseTransform(u),d=document.createElement("canvas");return d.className="textLayerImagePlaceholder",d.width=0,d.height=0,Object.assign(d.style,{opacity:0,position:"absolute",left:Vg(t),top:Vg(e),width:Vg(l/a(this,Ts)),height:Vg(c/a(this,Ss)),transformOrigin:"0% 0%",transform:`matrix(${u.join(",")})`}),a(this,zm).set(d,{inverseTransform:h,width:l,height:c,x1:t,y1:e}),d},g(Rf,Hm,null);uy=Rf;globalThis._pdfjsTestingUtils={HighlightOutliner:Kf};globalThis.pdfjsLib={AbortException:Hr,AnnotationEditorLayer:ly,AnnotationEditorParamsType:Wt,AnnotationEditorType:Pt,AnnotationEditorUIManager:Go,AnnotationLayer:ey,AnnotationMode:Da,AnnotationType:qe,applyOpacity:NC,build:HT,ColorPicker:qf,createValidAbsoluteUrl:Pw,CSSConstants:L0,DOMSVGFactory:Bc,DrawLayer:cy,FeatureTest:je,fetchData:Uy,findContrastColor:_C,getDocument:BT,getFilenameFromUrl:DC,getPdfFilenameFromUrl:IC,getRGB:Td,getUuid:Rw,getXfaPageViewport:kC,GlobalWorkerOptions:yr,ImageKind:_f,InvalidPDFException:gd,isDataScheme:$m,isPdfFile:zy,isValidExplicitDest:dT,makeArr:Ly,makeMap:By,makeObj:P0,MathClamp:li,noContextMenu:qn,normalizeUnicode:SC,OPS:md,OutputScale:Ds,PasswordResponses:TC,PDFDataRangeTransport:Vf,PDFDateString:Oc,PDFWorker:vd,PermissionFlag:CC,PixelsPerInch:_a,RenderingCancelledException:yd,renderRichText:Lw,ResponseException:Rc,setLayerDimensions:Ho,shadow:Ot,SignatureExtractor:xr,stopEvent:_e,SupportedImageMimeTypes:R0,TextLayer:Ad,TextLayerImages:uy,TouchManager:jf,updateUrlHash:Ow,Util:mt,VerbosityLevel:Gm,version:jT,XfaLayer:Uf}});var QS={};Vy(QS,{default:()=>jM,existsSync:()=>qS,lstatSync:()=>XS,mkdirSync:()=>KS,readFile:()=>VS,readFileSync:()=>$S,readdirSync:()=>YS,statSync:()=>WS,writeFileSync:()=>ZS});function Hc(r){throw new Error(`officeparser: 'fs.${r}' is not supported in the browser. Callers must pass file content as Buffer or Uint8Array directly to the parser.`)}var $S,VS,qS,WS,XS,YS,KS,ZS,jM,JS=te(()=>{"use strict";H();$S=r=>Hc("readFileSync"),VS=(r,t)=>Hc("readFile"),qS=r=>!1,WS=r=>Hc("statSync"),XS=r=>Hc("lstatSync"),YS=r=>Hc("readdirSync"),KS=r=>Hc("mkdirSync"),ZS=(r,t)=>Hc("writeFileSync"),jM={readFileSync:$S,readFile:VS,existsSync:qS,statSync:WS,lstatSync:XS,readdirSync:YS,mkdirSync:KS,writeFileSync:ZS,promises:{readFile:r=>Promise.reject(new Error("officeparser: 'fs.promises.readFile' is not supported in the browser.")),writeFile:(r,t)=>Promise.reject(new Error("officeparser: 'fs.promises.writeFile' is not supported in the browser.")),readdir:r=>Promise.reject(new Error("officeparser: 'fs.promises.readdir' is not supported in the browser."))}}});H();H();H();var Kc=typeof window<"u"&&typeof window.document<"u",jD={fs:"direct file system access","path-parsing":"parsing from file path string","pdf-worker-auto-resolution":"automatic PDF worker resolution from node_modules"};function Qm(r){if(Kc)throw new Error(`officeparser: '${jD[r]}' is not supported in the browser. Browser users must pass file content as Buffer or ArrayBuffer directly.`)}function wA(){typeof window<"u"&&!window.DOMMatrix&&(window.DOMMatrix=class{constructor(t){j(this,"a");j(this,"b");j(this,"c");j(this,"d");j(this,"e");j(this,"f");Array.isArray(t)&&t.length>=6?(this.a=t[0],this.b=t[1],this.c=t[2],this.d=t[3],this.e=t[4],this.f=t[5]):(this.a=this.d=1,this.b=this.c=this.e=this.f=0)}get m11(){return this.a}get m12(){return this.b}get m21(){return this.c}get m22(){return this.d}get m41(){return this.e}get m42(){return this.f}})}H();H();H();var yg=$c(kv());H();function Zr(r){if(r)try{if(r.startsWith("D:"))return Fk(r);let t=new Date(r);return isNaN(t.getTime())?void 0:t}catch{return}}function Fk(r){try{let t=r.slice(2),e=parseInt(t.slice(0,4),10),i=parseInt(t.slice(4,6),10)-1,n=parseInt(t.slice(6,8),10)||1,s=parseInt(t.slice(8,10),10)||0,o=parseInt(t.slice(10,12),10)||0,l=parseInt(t.slice(12,14),10)||0,c=t.slice(14).match(/([+-Z])(\d{2})'?(\d{2})?'?/);if(c){if(c[1]==="Z")return new Date(Date.UTC(e,i,n,s,o,l));let u=c[1]==="-"?-1:1,h=parseInt(c[2],10)||0,d=parseInt(c[3],10)||0,f=u*(h*60+d),m=Date.UTC(e,i,n,s,o,l);return new Date(m-f*6e4)}return new Date(e,i,n,s,o,l)}catch{return}}var Qe=r=>r.nodeType===1,ee=(r,t={})=>{let e=new yg.DOMParser(t),i=r.charCodeAt(0)===65279?r.slice(1):r.trim();return e.parseFromString(i,"text/xml")},nt=(r,t)=>{let e=Array.from(r.getElementsByTagName(t));if(e.length===0&&t.includes(":")){let i=t.split(":").pop();return Array.from(r.getElementsByTagName(i))}return e},xg=(r,t={})=>new yg.XMLSerializer().serializeToString(r),Pk=(r,t)=>{if(!r||typeof r.lineNumber!="number"||typeof r.columnNumber!="number")return;let e=t.split(`
69
+ `),i=0;for(let n=0;n<r.lineNumber-1;n++)i+=e[n].length+1;if(i+=r.columnNumber-1,Qe(r)){let s=`</${r.tagName}>`,o=t.indexOf(s,i);if(o!==-1)return t.substring(i,o+s.length);let l=t.indexOf("/>",i),c=t.indexOf("<",i+1);if(l!==-1&&(c===-1||l<c))return t.substring(i,l+2)}},Zt=(r,t,e)=>{if(e.serializeRawContent===!1){let i=Pk(r,t);if(i)return i}return xg(r,{preserveWhitespace:e.preserveXmlWhitespace})},pt=(r,t)=>{let e=r.getElementsByTagName(t);if(e&&e.length>0)return e[0]};var $e=(r,t)=>{let e=[];if(!r.childNodes)return e;for(let i=0;i<r.childNodes.length;i++){let n=r.childNodes[i];Qe(n)&&n.tagName===t&&e.push(n)}return e},Ga=r=>{let t=ee(r),e={},i=nt(t,"cp:coreProperties")[0];if(i){let s=nt(i,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let o=nt(i,"dc:creator")[0];o&&o.textContent&&(e.author=o.textContent);let l=nt(i,"cp:lastModifiedBy")[0];l&&l.textContent&&(e.lastModifiedBy=l.textContent);let c=nt(i,"dcterms:created")[0];c&&c.textContent&&(e.created=Zr(c.textContent));let u=nt(i,"dcterms:modified")[0];u&&u.textContent&&(e.modified=Zr(u.textContent));let h=nt(i,"dc:description")[0];h&&h.textContent&&(e.description=h.textContent);let d=nt(i,"dc:subject")[0];return d&&d.textContent&&(e.subject=d.textContent),e}let n=nt(t,"office:meta")[0];if(n){let s=nt(n,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let o=nt(n,"dc:creator")[0];o&&o.textContent&&(e.author=o.textContent);let l=nt(n,"dc:description")[0];l&&l.textContent&&(e.description=l.textContent);let c=nt(n,"dc:subject")[0];c&&c.textContent&&(e.subject=c.textContent);let u=nt(n,"meta:creation-date")[0];u&&u.textContent&&(e.created=Zr(u.textContent));let h=nt(n,"dc:date")[0];h&&h.textContent&&(e.modified=Zr(h.textContent));let d=nt(n,"meta:user-defined");if(d.length>0){let f={};for(let m of d){let x=m.getAttribute("meta:name");if(!x||!m.textContent)continue;let y=m.getAttribute("meta:value-type")||"string",A=m.textContent;if(y==="boolean")f[x]=A.toLowerCase()==="true";else if(y==="float"){let w=Number(A);isNaN(w)||(f[x]=w)}else if(y==="date"||y==="time"){let w=Zr(A);w?f[x]=w:f[x]=A}else f[x]=A}Object.keys(f).length>0&&(e.customProperties=f)}}return e},mu=r=>{let t=ee(r),e={},i=nt(t,"property");for(let n of i){let s=n.getAttribute("name");if(s)for(let o=0;o<n.childNodes.length;o++){let l=n.childNodes[o];if(l.nodeType!==1)continue;let c=l,u=c.tagName||"",h=c.textContent||"";if(/vt:lpwstr|vt:lpstr|vt:bstr/.test(u))e[s]=h;else if(/vt:bool/.test(u))e[s]=h.toLowerCase()==="true";else if(/vt:(i[1248]|ui[1248]|int|uint|r4|r8|decimal)/.test(u)){let d=Number(h);isNaN(d)||(e[s]=d)}else if(/vt:filetime|vt:date/.test(u)){let d=Zr(h);d?e[s]=d:e[s]=h}else h&&(e[s]=h);break}}return e};var Wd=(r,t)=>{let e=r.localName===t||r.tagName===t?r:r.getElementsByTagName(t)[0];if(!e)return;let i=e.getElementsByTagName("c:rich"),n=e.getElementsByTagName("a:p"),s=i.length>0?Array.from(i):Array.from(n);if(s.length>0){let l="";for(let c of s){let u=c.getElementsByTagName("a:t");for(let h=0;h<u.length;h++)l+=(u[h].textContent||"")+" "}if(l.trim())return l.trim()}let o=e.getElementsByTagName("c:v")[0];if(o&&o.textContent)return o.textContent.trim()||void 0},Ok=r=>{let t=r.toString("utf8"),i=ee(t).documentElement;if(!i)return{title:void 0,xAxisTitle:void 0,yAxisTitle:void 0,dataSets:[],labels:[],rawTexts:[]};let n=Wd(i,"c:title"),s,o,l=i.getElementsByTagName("c:catAx");l.length>0&&(s=Wd(l[0],"c:title"));let c=i.getElementsByTagName("c:valAx");c.length>0&&(o=Wd(c[0],"c:title"));let u=i.getElementsByTagName("c:ser"),h=[],d=[];for(let m=0;m<u.length;m++){let x=u[m],y=Wd(x,"c:tx"),A=[],w=x.getElementsByTagName("c:val")[0]||x.getElementsByTagName("c:yVal")[0];if(w){let _=w.getElementsByTagName("c:v");for(let k=0;k<_.length;k++){let R=_[k].textContent?.trim();R&&A.push(R)}}let v=[],C=x.getElementsByTagName("c:dLbl");for(let _=0;_<C.length;_++){let k=Wd(C[_],"c:tx");k&&v.push(k)}let D=x.getElementsByTagName("c:cat")[0]||x.getElementsByTagName("c:xVal")[0];if(D){let _=D.getElementsByTagName("c:v"),k=[];for(let R=0;R<_.length;R++){let K=_[R].textContent?.trim();K&&k.push(K)}k.length>0&&d.length===0&&d.push(...k)}h.push({name:y,values:A,pointLabels:v})}let f=[];for(let m of h)m.name&&f.push(m.name),f.push(...d),f.push(...m.values);return{title:n,xAxisTitle:s,yAxisTitle:o,dataSets:h,labels:d,rawTexts:f}},Rk=r=>{let t=r.toString("utf8"),e=ee(t),i=nt(e,"chart:chart")[0]||e.documentElement,n=nt(i,"chart:title")[0],s=n&&nt(n,"text:p")[0]?.textContent||void 0,o=nt(i,"table:table")[0],l=[],c=[],u=[];if(o){let m=[],x=$e(o,"table:table-header-rows")[0];if(x&&m.push(...$e(x,"table:table-row")),m.push(...$e(o,"table:table-row")),m.length>0){let y=$e(m[0],"table:table-cell");for(let A=1;A<y.length;A++){let w=parseInt(y[A].getAttribute("table:number-columns-repeated")||"1"),v=$e(y[A],"text:p")[0]?.textContent||void 0;for(let C=0;C<w;C++)l.push({name:v,values:[],pointLabels:[]})}for(let A=1;A<m.length;A++){let w=$e(m[A],"table:table-cell");if(w.length>0){let v=$e(w[0],"text:p")[0]?.textContent||void 0;v&&c.push(v);let C=0;for(let D=1;D<w.length;D++){let _=parseInt(w[D].getAttribute("table:number-columns-repeated")||"1"),k=w[D].getAttribute("office:value")||$e(w[D],"text:p")[0]?.textContent||"";for(let R=0;R<_;R++)l[C]&&l[C].values.push(k),C++}}}}}else{let m=nt(i,"chart:series");for(let y of m){let A=y.getAttribute("chart:label-cell-address"),w=y.getAttribute("chart:values-cell-range-address"),v,C=nt(y,"text:p");C.length>0&&(v=C[0].textContent||void 0),!v&&A&&(v=`Series ${A.split(".").pop()?.replace(/\$/g,"")||A}`);let D={name:v,values:[],pointLabels:[]};w&&D.values.push(`[${w}]`),l.push(D)}let x=nt(i,"chart:categories")[0];if(x){let y=x.getAttribute("table:cell-range-address");y&&c.push(`[${y}]`)}}let h=nt(e,"chart:axis"),d,f;for(let m of h){let x=m.getAttribute("chart:dimension"),y=nt(m,"chart:title")[0],A=y&&nt(y,"text:p")[0]?.textContent||void 0;x==="x"?d=A:x==="y"&&(f=A)}s&&u.push(s);for(let m of l)m.name&&u.push(m.name),u.push(...c),u.push(...m.values);return{title:s,xAxisTitle:d,yAxisTitle:f,dataSets:l,labels:c,rawTexts:u}},Qo=r=>r.toString("utf8",0,500).includes("urn:oasis:names:tc:opendocument:xmlns:chart:1.0")?Rk(r):Ok(r);H();var gu="[OfficeParser]: ";var Lk={EXTENSION_UNSUPPORTED:r=>`Sorry, OfficeParser currently supports docx, pptx, xlsx, odt, odp, ods, pdf, rtf files only. Create a ticket in Issues on github to add support for ${r} files. Stay tuned for further updates.`,FILE_CORRUPTED:r=>`Your file ${r} seems to be corrupted. If you are sure it is fine, please create a ticket in Issues on github with the file to reproduce error.`,FILE_DOES_NOT_EXIST:r=>`File ${r} could not be found! Check if the file exists or verify if the relative path to the file is correct from your terminal's location.`,LOCATION_NOT_FOUND:r=>`Entered location ${r} is not reachable! Please make sure that the entered directory location exists. Check relative paths and reenter.`,IMPROPER_ARGUMENTS:"Improper arguments",IMPROPER_BUFFERS:"Error occured while reading the file buffers",INVALID_INPUT:"Invalid input type: Expected a Buffer or a valid file path",PDF_WORKER_MISSING:'Missing PDF worker configuration. PDF parsing in browser environments requires a worker source. Please provide "pdfWorkerSrc" in your configuration.'},Nv=(r,t)=>{let e=Lk[r];return typeof e=="function"?e(t):e},Rs=(r,t,e)=>{let i=Nv(r,e);return t.outputErrorToConsole&&console.error(gu+i),new Error(gu+i)},_v=(r,t,e)=>{let i=r.message||r;return e&&(i.includes("end of central directory record")||i.includes("invalid XML")||i.includes("Failed to open zip file")||i.includes("invalid distance too far back"))&&(i=Nv("FILE_CORRUPTED",e)),t.outputErrorToConsole&&console.error(gu+i),new Error(gu+i)},ln=(r,t,e)=>{t.outputErrorToConsole&&(e?console.warn(gu+r,e):console.warn(gu+r))};H();var Bk=r=>{switch(r.toLowerCase()){case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"gif":return"image/gif";case"bmp":return"image/bmp";case"tiff":return"image/tiff";case"webp":return"image/webp";default:return"application/octet-stream"}},Uk=r=>{if(!(r.length<4)){if(r[0]===137&&r[1]===80&&r[2]===78&&r[3]===71)return"image/png";if(r[0]===255&&r[1]===216&&r[2]===255)return"image/jpeg";if(r[0]===71&&r[1]===73&&r[2]===70&&r[3]===56)return"image/gif";if(r[0]===66&&r[1]===77)return"image/bmp";if(r[0]===73&&r[1]===73&&r[2]===42&&r[3]===0||r[0]===77&&r[1]===77&&r[2]===0&&r[3]===42)return"image/tiff";if(r.length>=12&&r[0]===82&&r[1]===73&&r[2]===70&&r[3]===70&&r[8]===87&&r[9]===69&&r[10]===66&&r[11]===80)return"image/webp"}},Ar=(r,t)=>{let e=r.split(".").pop()||"",i=Uk(t);return i||(i=Bk(e)),{type:"image",mimeType:i,data:t.toString("base64"),name:r,extension:e}};H();var $a=class $a{constructor(){j(this,"pool",[]);j(this,"queue",[]);j(this,"MAX_WORKERS",4);j(this,"idleTimeout",1e4);j(this,"timeoutId",null)}static getInstance(){return $a.instance||($a.instance=new $a),$a.instance}static hasInstance(){return!!$a.instance}resetIdleTimer(){this.timeoutId&&clearTimeout(this.timeoutId),this.idleTimeout>0&&(this.timeoutId=setTimeout(async()=>{await this.terminate()},this.idleTimeout))}async recognize(t,e){return new Promise((i,n)=>{e?.autoTerminateTimeout!==void 0&&(this.idleTimeout=e.autoTerminateTimeout),this.resetIdleTimer(),this.queue.push({image:t,config:e||{},resolve:i,reject:n}),this.processQueue()})}async processQueue(){if(this.queue.length===0)return;let t=this.queue[0],e=t.config.language||"eng",i=this.pool.find(n=>!n.isBusy&&n.language===e);if(!i&&this.pool.length<this.MAX_WORKERS)try{let{createWorker:n}=await Promise.resolve().then(()=>$c(wE())),s={logger:()=>{}};t.config.workerPath&&(s.workerPath=t.config.workerPath),t.config.corePath&&(s.corePath=t.config.corePath),t.config.langPath&&(s.langPath=t.config.langPath),i={worker:await n(e,1,s),language:e,lastUsed:Date.now(),isBusy:!1},this.pool.push(i)}catch(n){this.queue.shift()?.reject(n),this.processQueue();return}if(!i){let n=this.pool.filter(s=>!s.isBusy);if(n.length>0){i=n.reduce((s,o)=>s.lastUsed<o.lastUsed?s:o);try{await i.worker.reinitialize(e),i.language=e}catch(s){this.queue.shift()?.reject(s),this.processQueue();return}}}if(i){let n=this.queue.shift();if(!n)return;i.isBusy=!0,i.lastUsed=Date.now();try{let{data:{text:s}}=await i.worker.recognize(n.image);n.resolve(s)}catch(s){n.reject(s)}finally{i.isBusy=!1,i.lastUsed=Date.now(),this.processQueue()}}}async terminate(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let t=this.pool.map(e=>e.worker.terminate());await Promise.all(t),this.pool=[]}};j($a,"instance");var Yd=$a,Jn=async(r,t)=>{let e=r;return typeof window<"u"&&typeof Blob<"u"&&at.Buffer.isBuffer(r)&&(e=new Blob([r],{type:"image/bmp"})),await Yd.getInstance().recognize(e,t)},AE=async()=>{Yd.hasInstance()&&await Yd.getInstance().terminate()};H();H();var vE={},gN=(function(r,t,e,i,n){var s=new Worker(vE[t]||(vE[t]=URL.createObjectURL(new Blob([r+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return s.onmessage=function(o){var l=o.data,c=l.$e$;if(c){var u=new Error(c[0]);u.code=c[1],u.stack=c[2],n(u,null)}else n(null,l)},s.postMessage(e,i),s}),Wi=Uint8Array,tl=Uint16Array,TE=Int32Array,Rx=new Wi([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]),Lx=new Wi([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]),SE=new Wi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),DE=function(r,t){for(var e=new tl(31),i=0;i<31;++i)e[i]=t+=1<<r[i-1];for(var n=new TE(e[30]),i=1;i<30;++i)for(var s=e[i];s<e[i+1];++s)n[s]=s-e[i]<<5|i;return{b:e,r:n}},IE=DE(Rx,2),Bx=IE.b,yN=IE.r;Bx[28]=258,yN[258]=28;var kE=DE(Lx,0),NE=kE.b,EP=kE.r,Tg=new tl(32768);for(ie=0;ie<32768;++ie)Ls=(ie&43690)>>1|(ie&21845)<<1,Ls=(Ls&52428)>>2|(Ls&13107)<<2,Ls=(Ls&61680)>>4|(Ls&3855)<<4,Tg[ie]=((Ls&65280)>>8|(Ls&255)<<8)>>1;var Ls,ie,yu=(function(r,t,e){for(var i=r.length,n=0,s=new tl(t);n<i;++n)r[n]&&++s[r[n]-1];var o=new tl(t);for(n=1;n<t;++n)o[n]=o[n-1]+s[n-1]<<1;var l;if(e){l=new tl(1<<t);var c=15-t;for(n=0;n<i;++n)if(r[n])for(var u=n<<4|r[n],h=t-r[n],d=o[r[n]-1]++<<h,f=d|(1<<h)-1;d<=f;++d)l[Tg[d]>>c]=u}else for(l=new tl(i),n=0;n<i;++n)r[n]&&(l[n]=Tg[o[r[n]-1]++]>>15-r[n]);return l}),Kd=new Wi(288);for(ie=0;ie<144;++ie)Kd[ie]=8;var ie;for(ie=144;ie<256;++ie)Kd[ie]=9;var ie;for(ie=256;ie<280;++ie)Kd[ie]=7;var ie;for(ie=280;ie<288;++ie)Kd[ie]=8;var ie,_E=new Wi(32);for(ie=0;ie<32;++ie)_E[ie]=5;var ie;var ME=yu(Kd,9,1);var FE=yu(_E,5,1),Eg=function(r){for(var t=r[0],e=1;e<r.length;++e)r[e]>t&&(t=r[e]);return t},tr=function(r,t,e){var i=t/8|0;return(r[i]|r[i+1]<<8)>>(t&7)&e},Cg=function(r,t){var e=t/8|0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>(t&7)},PE=function(r){return(r+7)/8|0},Sg=function(r,t,e){return(t==null||t<0)&&(t=0),(e==null||e>r.length)&&(e=r.length),new Wi(r.subarray(t,e))};var OE=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],qi=function(r,t,e){var i=new Error(t||OE[r]);if(i.code=r,Error.captureStackTrace&&Error.captureStackTrace(i,qi),!e)throw i;return i},RE=function(r,t,e,i){var n=r.length,s=i?i.length:0;if(!n||t.f&&!t.l)return e||new Wi(0);var o=!e,l=o||t.i!=2,c=t.i;o&&(e=new Wi(n*3));var u=function(J){var Y=e.length;if(J>Y){var ct=new Wi(Math.max(Y*2,J));ct.set(e),e=ct}},h=t.f||0,d=t.p||0,f=t.b||0,m=t.l,x=t.d,y=t.m,A=t.n,w=n*8;do{if(!m){h=tr(r,d,1);var v=tr(r,d+1,3);if(d+=3,v)if(v==1)m=ME,x=FE,y=9,A=5;else if(v==2){var k=tr(r,d,31)+257,R=tr(r,d+10,15)+4,K=k+tr(r,d+5,31)+1;d+=14;for(var W=new Wi(K),V=new Wi(19),U=0;U<R;++U)V[SE[U]]=tr(r,d+U*3,7);d+=R*3;for(var tt=Eg(V),et=(1<<tt)-1,B=yu(V,tt,1),U=0;U<K;){var ot=B[tr(r,d,et)];d+=ot&15;var C=ot>>4;if(C<16)W[U++]=C;else{var L=0,T=0;for(C==16?(T=3+tr(r,d,3),d+=2,L=W[U-1]):C==17?(T=3+tr(r,d,7),d+=3):C==18&&(T=11+tr(r,d,127),d+=7);T--;)W[U++]=L}}var I=W.subarray(0,k),M=W.subarray(k);y=Eg(I),A=Eg(M),m=yu(I,y,1),x=yu(M,A,1)}else qi(1);else{var C=PE(d)+4,D=r[C-4]|r[C-3]<<8,_=C+D;if(_>n){c&&qi(0);break}l&&u(f+D),e.set(r.subarray(C,_),f),t.b=f+=D,t.p=d=_*8,t.f=h;continue}if(d>w){c&&qi(0);break}}l&&u(f+131072);for(var E=(1<<y)-1,S=(1<<A)-1,N=d;;N=d){var L=m[Cg(r,d)&E],P=L>>4;if(d+=L&15,d>w){c&&qi(0);break}if(L||qi(2),P<256)e[f++]=P;else if(P==256){N=d,m=null;break}else{var $=P-254;if(P>264){var U=P-257,G=Rx[U];$=tr(r,d,(1<<G)-1)+Bx[U],d+=G}var O=x[Cg(r,d)&S],z=O>>4;O||qi(3),d+=O&15;var M=NE[z];if(z>3){var G=Lx[z];M+=Cg(r,d)&(1<<G)-1,d+=G}if(d>w){c&&qi(0);break}l&&u(f+131072);var it=f+$;if(f<M){var X=s-M,Q=Math.min(M,it);for(X+f<0&&qi(3);f<Q;++f)e[f]=i[X+f]}for(;f<it;++f)e[f]=e[f-M]}}t.l=m,t.p=N,t.b=f,t.f=h,m&&(h=1,t.m=y,t.d=x,t.n=A)}while(!h);return f!=e.length&&o?Sg(e,0,f):e.subarray(0,f)};var xN=new Wi(0);var bN=function(r,t){var e={};for(var i in r)e[i]=r[i];for(var i in t)e[i]=t[i];return e},EE=function(r,t,e){for(var i=r(),n=r.toString(),s=n.slice(n.indexOf("[")+1,n.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<i.length;++o){var l=i[o],c=s[o];if(typeof l=="function"){t+=";"+c+"=";var u=l.toString();if(l.prototype)if(u.indexOf("[native code]")!=-1){var h=u.indexOf(" ",8)+1;t+=u.slice(h,u.indexOf("(",h))}else{t+=u;for(var d in l.prototype)t+=";"+c+".prototype."+d+"="+l.prototype[d].toString()}else t+=u}else e[c]=l}return t},vg=[],wN=function(r){var t=[];for(var e in r)r[e].buffer&&t.push((r[e]=new r[e].constructor(r[e])).buffer);return t},AN=function(r,t,e,i){if(!vg[e]){for(var n="",s={},o=r.length-1,l=0;l<o;++l)n=EE(r[l],n,s);vg[e]={c:EE(r[o],n,s),e:s}}var c=bN({},vg[e].e);return gN(vg[e].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+t.toString()+"}",e,c,wN(c),i)},vN=function(){return[Wi,tl,TE,Rx,Lx,SE,Bx,NE,ME,FE,Tg,OE,yu,Eg,tr,Cg,PE,Sg,qi,RE,Ux,LE,BE]};var LE=function(r){return postMessage(r,[r.buffer])},BE=function(r){return r&&{out:r.size&&new Wi(r.size),dictionary:r.dictionary}},EN=function(r,t,e,i,n,s){var o=AN(e,i,n,function(l,c){o.terminate(),s(l,c)});return o.postMessage([r,t],t.consume?[r.buffer]:[]),function(){o.terminate()}};var Jr=function(r,t){return r[t]|r[t+1]<<8},vr=function(r,t){return(r[t]|r[t+1]<<8|r[t+2]<<16|r[t+3]<<24)>>>0},Px=function(r,t){return vr(r,t)+vr(r,t+4)*4294967296};function CN(r,t,e){return e||(e=t,t={}),typeof e!="function"&&qi(7),EN(r,t,[vN],function(i){return LE(Ux(i.data[0],BE(i.data[1])))},1,e)}function Ux(r,t){return RE(r,{i:2},t&&t.out,t&&t.dictionary)}var Ox=typeof TextDecoder<"u"&&new TextDecoder,TN=0;try{Ox.decode(xN,{stream:!0}),TN=1}catch{}var SN=function(r){for(var t="",e=0;;){var i=r[e++],n=(i>127)+(i>223)+(i>239);if(e+n>r.length)return{s:t,r:Sg(r,e-1)};n?n==3?(i=((i&15)<<18|(r[e++]&63)<<12|(r[e++]&63)<<6|r[e++]&63)-65536,t+=String.fromCharCode(55296|i>>10,56320|i&1023)):n&1?t+=String.fromCharCode((i&31)<<6|r[e++]&63):t+=String.fromCharCode((i&15)<<12|(r[e++]&63)<<6|r[e++]&63):t+=String.fromCharCode(i)}};function DN(r,t){if(t){for(var e="",i=0;i<r.length;i+=16384)e+=String.fromCharCode.apply(null,r.subarray(i,i+16384));return e}else{if(Ox)return Ox.decode(r);var n=SN(r),s=n.s,e=n.r;return e.length&&qi(8),s}}var IN=function(r,t){return t+30+Jr(r,t+26)+Jr(r,t+28)},kN=function(r,t,e){var i=Jr(r,t+28),n=DN(r.subarray(t+46,t+46+i),!(Jr(r,t+8)&2048)),s=t+46+i,o=vr(r,t+20),l=e&&o==4294967295?NN(r,s):[o,vr(r,t+24),vr(r,t+42)],c=l[0],u=l[1],h=l[2];return[Jr(r,t+10),c,u,n,s+Jr(r,t+30)+Jr(r,t+32),h]},NN=function(r,t){for(;Jr(r,t)!=1;t+=4+Jr(r,t+2));return[Px(r,t+12),Px(r,t+4),Px(r,t+20)]};var CE=typeof queueMicrotask=="function"?queueMicrotask:typeof setTimeout=="function"?setTimeout:function(r){r()};function UE(r,t,e){e||(e=t,t={}),typeof e!="function"&&qi(7);var i=[],n=function(){for(var A=0;A<i.length;++A)i[A]()},s={},o=function(A,w){CE(function(){e(A,w)})};CE(function(){o=e});for(var l=r.length-22;vr(r,l)!=101010256;--l)if(!l||r.length-l>65558)return o(qi(13,0,1),null),n;var c=Jr(r,l+8);if(c){var u=c,h=vr(r,l+16),d=h==4294967295||u==65535;if(d){var f=vr(r,l-12);d=vr(r,f)==101075792,d&&(u=c=vr(r,f+32),h=vr(r,f+48))}for(var m=t&&t.filter,x=function(A){var w=kN(r,h,d),v=w[0],C=w[1],D=w[2],_=w[3],k=w[4],R=w[5],K=IN(r,R);h=k;var W=function(U,tt){U?(n(),o(U,null)):(tt&&(s[_]=tt),--c||o(null,s))};if(!m||m({name:_,size:C,originalSize:D,compression:v}))if(!v)W(null,Sg(r,K,K+C));else if(v==8){var V=r.subarray(K,K+C);if(D<524288||C>.8*D)try{W(null,Ux(V,{out:new Wi(D)}))}catch(U){W(U,null)}else i.push(CN(V,{size:D},W))}else W(qi(14,"unknown compression type "+v,1),null);else W(null,null)},y=0;y<u;++y)x(y)}else o(null,{});return n}var Va=(r,t)=>new Promise((e,i)=>{UE(new Uint8Array(r.buffer,r.byteOffset,r.byteLength),{filter:n=>t(n.name)},(n,s)=>{if(n)return i(n);e(Object.entries(s).map(([o,l])=>({path:o,content:at.Buffer.from(l)})))})});var zE=async(r,t)=>{let e=/xl\/worksheets\/sheet\d+.xml/g,i=/xl\/drawings\/drawing\d+.xml/g,n=/xl\/charts\/chart\d+.xml/g,s="xl/sharedStrings.xml",o=/xl\/media\/.*/,l=/docProps\/core\.xml/,c=/docProps\/custom\.xml/,u=/xl\/worksheets\/_rels\/sheet\d+\.xml\.rels/g,h=/xl\/drawings\/_rels\/drawing\d+\.xml\.rels/g,d=await Va(r,B=>!!B.match(e)||!!B.match(i)||!!B.match(n)||B===s||B==="xl/styles.xml"||B==="xl/workbook.xml"||B==="xl/_rels/workbook.xml.rels"||!!B.match(l)||!!B.match(c)||!!t.extractAttachments&&(!!B.match(o)||!!B.match(u)||!!B.match(h))),f=d.find(B=>B.path===s),m=[];if(f){let B=ee(f.content.toString()),ot=nt(B,"si");for(let L of ot){let T=nt(L,"r");if(T.length>0){let I=[];for(let M of T){let E=nt(M,"t")[0];if(E){let S=E.textContent||"",N=nt(M,"rPr")[0],P={};if(N){nt(N,"b").length>0&&(P.bold=!0),nt(N,"i").length>0&&(P.italic=!0),nt(N,"u").length>0&&(P.underline=!0),nt(N,"strike").length>0&&(P.strikethrough=!0);let $=nt(N,"sz")[0];$&&(P.size=$.getAttribute("val")+"pt");let G=nt(N,"color")[0];if(G){let it=G.getAttribute("rgb");it&&(P.color="#"+it.substring(2))}let O=nt(N,"rFont")[0];O&&(P.font=O.getAttribute("val")||void 0);let z=nt(N,"vertAlign")[0];if(z){let it=z.getAttribute("val");it==="subscript"&&(P.subscript=!0),it==="superscript"&&(P.superscript=!0)}}I.push({type:"text",text:S,formatting:Object.keys(P).length>0?P:void 0})}}m.push(I)}else{let I=nt(L,"t"),M="";for(let E of I)M+=E.textContent||"";m.push(M)}}}let x=d.find(B=>B.path==="xl/styles.xml"),y={};if(x){let B=ee(x.content.toString()),ot=nt(B,"fonts")[0],L=[];if(ot){let E=nt(ot,"font");for(let S of E){let N={};nt(S,"b").length>0&&(N.bold=!0),nt(S,"i").length>0&&(N.italic=!0),nt(S,"u").length>0&&(N.underline=!0),nt(S,"strike").length>0&&(N.strikethrough=!0);let P=nt(S,"sz")[0];if(P){let z=P.getAttribute("val");z&&(N.size=z+"pt")}let $=nt(S,"color")[0];if($){let z=$.getAttribute("rgb");z&&(N.color="#"+z.substring(2))}let G=nt(S,"name")[0];if(G){let z=G.getAttribute("val");z&&(N.font=z)}let O=nt(S,"vertAlign")[0];if(O){let z=O.getAttribute("val");z==="subscript"&&(N.subscript=!0),z==="superscript"&&(N.superscript=!0)}L.push(N)}}let T=nt(B,"fills")[0],I=[];if(T){let E=nt(T,"fill");for(let S of E){let N={},P=nt(S,"patternFill")[0];if(P){let $=nt(P,"fgColor")[0];if($){let G=$.getAttribute("rgb"),O=$.getAttribute("theme");if(G&&G!=="00000000")N.backgroundColor="#"+G.substring(2);else if(O){let z=parseInt(O);z===0?N.backgroundColor="#FFFFFF":z===1?N.backgroundColor="#000000":z===2?N.backgroundColor="#EEECE1":z===3&&(N.backgroundColor="#1F497D")}}}I.push(N)}}let M=nt(B,"cellXfs")[0];if(M){let E=nt(M,"xf");for(let S=0;S<E.length;S++){let N=E[S],P={},$=N.getAttribute("fontId");if($){let z=parseInt($);L[z]&&Object.assign(P,L[z])}let G=N.getAttribute("fillId");if(G){let z=parseInt(G);I[z]&&I[z].backgroundColor&&(P.backgroundColor=I[z].backgroundColor)}let O=nt(N,"alignment")[0];if(O){let z=O.getAttribute("horizontal");(z==="center"||z==="right"||z==="justify"||z==="left")&&(P.alignment=z)}y[S]=P}}}let A=[],w=d.filter(B=>B.path.match(/xl\/media\/.*/)),v=d.filter(B=>B.path.match(n)),C={};if(t.extractAttachments){let B=d.filter(L=>L.path.match(h));for(let L of B){let I=`xl/drawings/${L.path.split("/").pop()?.replace(".rels","")||""}`,M=ee(L.content.toString()),E=nt(M,"Relationship");C[I]||(C[I]={});for(let S of E){let N=S.getAttribute("Id"),P=S.getAttribute("Target");if(N&&P&&P.includes("media/")){let $="xl/"+P.replace("../","");C[I][N]={path:$}}}}let ot=d.filter(L=>L.path.match(i));for(let L of ot){let T=ee(L.content.toString()),I=nt(T,"xdr:pic"),M=C[L.path]||{};for(let E of I){let S=nt(E,"xdr:blipFill")[0],N=S?nt(S,"a:blip")[0]:null,P=N?N.getAttribute("r:embed"):null,$=nt(E,"xdr:nvPicPr")[0],G=$?nt($,"xdr:cNvPr")[0]:null,O=G?G.getAttribute("descr")||G.getAttribute("name"):void 0;P&&M[P]&&(M[P].altText=O||"")}}for(let L of w){let T=Ar(L.path.split("/").pop()||"image",L.content),I="";for(let M in C){for(let E in C[M])if(C[M][E].path===L.path){I=C[M][E].altText||"";break}if(I)break}if(I&&(T.altText=I),A.push(T),t.ocr&&T.mimeType.startsWith("image/"))try{let M=(await Jn(L.content,{language:t.ocrLanguage,...t.ocrConfig})).trim();M&&(T.ocrText=M)}catch(M){ln(`OCR failed for ${T.name}:`,t,M)}}for(let L of v){let T={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:L.content.toString("base64"),name:L.path.split("/").pop()||"",extension:"xml"};try{let I=Qo(L.content);T.chartData=I}catch(I){ln(`Failed to extract chart data from ${L.path}:`,t,I)}A.push(T)}}let D={};if(t.extractAttachments){let B=d.filter(ot=>ot.path.match(h));for(let ot of B){let T=`xl/drawings/${ot.path.split("/").pop()?.replace(".rels","")||""}`,I=ee(ot.content.toString()),M=nt(I,"Relationship");D[T]||(D[T]={});for(let E of M){let S=E.getAttribute("Id"),N=E.getAttribute("Target"),P=E.getAttribute("Type");if(S&&N&&P&&P.includes("chart")){let $=N.split("/").pop()||"";D[T][S]=$}}}}let _={},k=d.find(B=>B.path==="xl/workbook.xml"),R=d.find(B=>B.path==="xl/_rels/workbook.xml.rels");if(k&&R){let B=ee(R.content.toString()),ot=nt(B,"Relationship"),L={};for(let M of ot){let E=M.getAttribute("Id"),S=M.getAttribute("Target");if(E&&S){let N=S.split("/").pop()||"";L[E]=N}}let T=ee(k.content.toString()),I=nt(T,"sheet");for(let M of I){let E=M.getAttribute("name"),S=M.getAttribute("r:id");E&&S&&L[S]&&(_[L[S]]=E)}}let K=[],W=[];for(let B of d)if(!B.path.match(o)&&B.path!==s&&B.path!=="xl/styles.xml"&&!B.path.match(i)&&!B.path.match(n)&&!B.path.match(u)&&!B.path.match(h)&&B.path.match(e)){t.includeRawContent&&W.push(B.content.toString());let ot=[],L=/<row.*?>[\s\S]*?<\/row>/g,T=B.content.toString().match(L);if(T)for(let E of T){let S=[],N=/<c.*?>[\s\S]*?<\/c>/g,P=E.match(N),$=E.match(/r="(\d+)"/),G=$?parseInt($[1])-1:0;if(P)for(let O of P){let z=O.match(/t="([a-zA-Z]+)"/),it=z?z[1]:"n",X=O.match(/<v>([\s\S]*?)<\/v>/),Q=O.match(/<t>([\s\S]*?)<\/t>/),J="",Y=[];if(it==="s"&&X){let gt=parseInt(X[1]),Tt=m[gt];Array.isArray(Tt)?(Y=JSON.parse(JSON.stringify(Tt)),J=Y.map(st=>st.text).join("")):J=Tt||""}else it==="inlineStr"&&Q?J=Q[1].trim():X&&(J=X[1].trim());let ct=O.match(/r="([A-Z]+)(\d+)"/),lt=(ct?ct[1]:"").charCodeAt(0)-65;if(J||Y.length>0){let gt=O.match(/s="(\d+)"/),Tt=gt?parseInt(gt[1]):void 0,st=Tt!==void 0&&y[Tt]?y[Tt]:{};if(Y.length>0)for(let ft of Y)ft.formatting||(ft.formatting={}),st.backgroundColor&&(ft.formatting.backgroundColor=st.backgroundColor),st.alignment&&(ft.formatting.alignment=st.alignment),!ft.formatting.font&&st.font&&(ft.formatting.font=st.font),!ft.formatting.size&&st.size&&(ft.formatting.size=st.size);else Y.push({type:"text",text:J,formatting:st});let ht={type:"cell",text:J,children:Y,metadata:{row:G,col:lt}};t.includeRawContent&&(ht.rawContent=O),S.push(ht)}}if(S.length>0){let O={type:"row",children:S,metadata:void 0};t.includeRawContent&&(O.rawContent=E),ot.push(O)}}if(t.extractAttachments){let S=`xl/worksheets/_rels/${B.path.split("/").pop()||""}.rels`,N=d.find(G=>G.path===S),P={};if(N){let G=ee(N.content.toString()),O=nt(G,"Relationship");for(let z of O){let it=z.getAttribute("Id"),X=z.getAttribute("Target"),Q=z.getAttribute("Type");it&&X&&Q&&Q.includes("drawing")&&(P[it]="xl/drawings/"+X.replace("../drawings/",""))}}let $=B.content.toString().match(/<drawing r:id="(.*?)"/g);if($)for(let G of $){let O=G.match(/r:id="(.*?)"/),z=O?O[1]:null;if(z&&P[z]){let it=P[z],X=C[it];if(X)for(let J in X){let Y=X[J],ct=A.find(ut=>ut.name===Y.path.split("/").pop());if(ct){let ut={type:"image",text:"",children:[],metadata:{attachmentName:ct.name||"unknown",altText:Y.altText||void 0}};ot.push(ut)}}let Q=D[it];if(Q)for(let J in Q){let Y=Q[J];if(A.find(ut=>ut.name===Y)){let ut={type:"chart",text:"",children:[],metadata:{attachmentName:Y}};ot.push(ut)}}}}}let I=B.path.split("/").pop()||"Sheet",M=_[I]||I;K.push({type:"sheet",children:ot,metadata:{sheetName:M},rawContent:t.includeRawContent?B.content.toString():void 0})}let V=d.find(B=>B.path.match(l)),U=V?Ga(V.content.toString()):{},tt=d.find(B=>B.path.match(c));if(tt){let B=mu(tt.content.toString());Object.keys(B).length>0&&(U.customProperties=B)}let et=B=>{for(let ot of B){if("attachmentName"in(ot.metadata||{})){let L=ot.metadata,T=A.find(I=>I.name===L.attachmentName);T&&(ot.type==="image"&&(T.ocrText&&(ot.text=T.ocrText),L.altText&&(T.altText=L.altText)),ot.type==="chart"&&T.chartData&&(ot.text=T.chartData.rawTexts.join(t.newlineDelimiter||`
70
+ `)))}ot.children&&et(ot.children)}};return et(K),{type:"xlsx",metadata:U,content:K,attachments:A,toText:()=>K.map(B=>{let ot=L=>{let T="";return L.children?T+=L.children.map(ot).filter(I=>I!="").join(L.children[0]?.children?t.newlineDelimiter??`
71
+ `:""):T+=L.text||"",T};return ot(B)}).filter(B=>B!="").join(t.newlineDelimiter??`
72
+ `)}};H();var jE=async(r,t)=>{let e=/content\.xml/,i=/Object \d+\/content\.xml/,n=/(Pictures|media)\/.*/,s=/meta\.xml/,o=/styles\.xml/,l=/mimetype/,c=await Va(r,E=>!!E.match(e)||!!E.match(i)||!!E.match(s)||!!E.match(o)||!!E.match(l)||!!t.extractAttachments&&!!E.match(n)),u=c.find(E=>E.path==="mimetype"),h="odt";if(u){let E=u.content.toString().trim();E.includes("spreadsheet")?h="ods":E.includes("presentation")?h="odp":E.includes("text")&&(h="odt")}let d=c.find(E=>E.path==="content.xml")||c.find(E=>E.path.match(e)),f=c.find(E=>E.path==="styles.xml"),m=[],x=[],y={},A={},w={},v=null,C=null,D=null,_=0,k=!1;f&&(E=>{let S=ee(E),N=nt(S,"style:style");for(let P of N){let $=P.getAttribute("style:name");if(!$)continue;let G={},O=pt(P,"style:paragraph-properties");if(O){let Q=O.getAttribute("fo:text-align");if(Q){let Y={start:"left",left:"left",center:"center",end:"right",right:"right",justify:"justify"};Y[Q]&&(G.alignment=Y[Q])}pt(O,"style:drop-cap")&&(G.dropCap=!0)}Object.keys(G).length>0&&(A[$]=G);let z=pt(P,"style:text-properties"),it=pt(P,"style:table-cell-properties"),X={};if(it){let Q=it.getAttribute("fo:background-color");Q&&Q!=="transparent"&&(X.backgroundColor=Q)}if(z){(z.getAttribute("fo:font-weight")==="bold"||z.getAttribute("style:font-weight-asian")==="bold")&&(X.bold=!0),(z.getAttribute("fo:font-style")==="italic"||z.getAttribute("style:font-style-asian")==="italic")&&(X.italic=!0),z.getAttribute("style:text-underline-style")==="solid"&&(X.underline=!0),z.getAttribute("style:text-line-through-style")==="solid"&&(X.strikethrough=!0);let Q=z.getAttribute("fo:font-size")||z.getAttribute("style:font-size-asian");Q&&(X.size=Q);let J=z.getAttribute("fo:color");J&&(X.color=J);let Y=z.getAttribute("fo:background-color");Y&&Y!=="transparent"&&(X.backgroundColor=Y);let ct=z.getAttribute("style:font-name")||z.getAttribute("fo:font-family");ct&&(X.font=ct);let ut=z.getAttribute("style:text-position");ut&&(ut.startsWith("sub")&&(X.subscript=!0),ut.startsWith("super")&&(X.superscript=!0)),Object.keys(X).length>0&&(y[$]=X)}}})(f.content.toString());let K=(E,S,N,P,$,G={},O,z="")=>{let it=[],X="";if(!E.childNodes)return{text:"",children:[]};for(let Q=0;Q<E.childNodes.length;Q++){let J=E.childNodes[Q];if(J.nodeType===3){let Y=J.textContent||"";Y&&(X+=Y,it.push({type:"text",text:Y,formatting:G,metadata:O?{...O}:void 0}))}else if(Qe(J)){let Y=J,ct=Y.tagName;if(ct==="text:s"){let ut=parseInt(Y.getAttribute("text:c")||"1"),lt=" ".repeat(ut);X+=lt,it.push({type:"text",text:lt,formatting:G,metadata:O?{...O}:void 0})}else if(ct==="text:tab")X+=" ",it.push({type:"text",text:" ",formatting:G,metadata:O?{...O}:void 0});else if(ct==="text:line-break")X+=`
73
+ `,it.push({type:"text",text:`
74
+ `,formatting:G,metadata:{...O||{},isLineBreak:!0}});else if(ct==="text:span"){let ut=Y.getAttribute("text:style-name"),lt=ut?{...G,...S[ut]}:G,gt=K(Y,S,N,P,$,lt,O,z);X+=gt.text,it.push(...gt.children)}else if(ct==="text:a"){let ut=Y.getAttribute("xlink:href")||"",lt=ut.startsWith("#")?"internal":"external",Tt=K(Y,S,N,P,$,G,{link:ut,linkType:lt},z);X+=Tt.text,it.push(...Tt.children)}else if(ct==="text:note"&&!N.ignoreNotes){let ut=Y.getAttribute("text:note-class")||"footnote",lt=Y.getAttribute("text:id")||Y.getAttribute("xml:id")||void 0,gt=pt(Y,"text:note-body");if(gt){let Tt=nt(gt,"text:p"),st=[],ht="";for(let wt of Tt){let At=W(wt,$,S,N,z);ht+=(ht?" ":"")+At.text;let Nt={type:"paragraph",text:At.text,children:At.children,metadata:At.alignment?{alignment:At.alignment}:void 0};st.push(Nt)}let ft={type:"note",text:ht,children:st,metadata:{noteType:ut,noteId:lt}};N.putNotesAtLast?P.push(ft):it.push(ft)}}else if(ct==="draw:frame"){let ut=Y,lt="",gt=pt(ut,"svg:title"),Tt=pt(ut,"svg:desc");gt&&gt.textContent?lt=gt.textContent:Tt&&Tt.textContent&&(lt=Tt.textContent);let st="",ht=nt(ut,"draw:image");if(ht.length>0&&(st=ht[0].getAttribute("xlink:href")||"",st)){let wt=st.split("/");st=wt[wt.length-1]}let ft={type:"image",text:"",children:[],metadata:{attachmentName:st,...lt?{altText:lt}:{}}};N.includeRawContent&&(ft.rawContent=Zt(ut,z,N)),it.push(ft)}}}return{text:X,children:it}},W=(E,S,N,P,$)=>{let G=E.getAttribute("text:style-name"),O=G?S[G]:void 0,z=O?.alignment,it=O?.dropCap,X=K(E,N,P,x,S,{},void 0,$);if(G&&X.children.forEach(Q=>{if(Q.type==="text"){Q.metadata||(Q.metadata={});let J=Q.metadata;J.style||(J.style=G)}}),X.children.length===0&&E.textContent){let Q=E.textContent;Q.trim()&&(X.text=Q,X.children.push({type:"text",text:Q}))}if(it&&X.children.length>0){let Q=X.children[0];if(Q.type==="text"&&Q.text)if(Q.text.length===1)Q.formatting={...Q.formatting,size:"58.5pt"};else{let J=Q.text[0],Y=Q.text.substring(1),ct={type:"text",text:J,formatting:{...Q.formatting,size:"58.5pt"},metadata:Q.metadata};Q.text=Y,X.children.unshift(ct)}}return{text:X.text,children:X.children,alignment:z,style:G||void 0}},V=E=>{let S=[],N="",P=[];for(let $ of E.children)$.type==="text"&&$.metadata?.isLineBreak?(S.push({text:N,children:P}),N="",P=[]):(N+=$.text||"",P.push($));return S.push({text:N,children:P}),S},U=(E,S,N,P,$)=>{let G=[],O=$e(E,"table:table-row"),z=0;for(let it of O){let X=[],Q=$e(it,"table:table-cell"),J=parseInt(it.getAttribute("table:number-rows-repeated")||"1"),Y=0;for(let ct of Q){let ut=[],lt={value:""},gt=parseInt(ct.getAttribute("table:number-columns-repeated")||"1"),Tt=parseInt(ct.getAttribute("table:number-columns-spanned")||"1"),st=parseInt(ct.getAttribute("table:number-rows-spanned")||"1"),ht=wt=>{if(wt.childNodes)for(let At=0;At<wt.childNodes.length;At++){let Nt=wt.childNodes[At];if(Qe(Nt)){let bt=Nt;if(bt.tagName==="text:p"||bt.tagName==="text:h"){let yt=W(bt,S,N,P,$),kt={type:bt.tagName==="text:h"?"heading":"paragraph",text:yt.text,children:yt.children,metadata:{...yt.alignment?{alignment:yt.alignment}:{},...yt.style?{style:yt.style}:{}}};Object.keys(kt.metadata||{}).length===0&&delete kt.metadata,bt.tagName==="text:h"&&(kt.metadata||(kt.metadata={}),kt.metadata.level=parseInt(bt.getAttribute("text:outline-level")||"1")),P.includeRawContent&&(kt.rawContent=Zt(bt,$,P)),ut.push(kt),lt.value+=yt.text,lt.value&&!lt.value.endsWith(`
75
+ `)&&(lt.value+=`
76
+ `)}else if(bt.tagName==="table:table"){let yt=U(bt,S,N,P,$);ut.push(yt)}else(bt.tagName==="draw:frame"||bt.tagName==="draw:text-box")&&ht(bt)}}};ht(ct);let ft=lt.value;ft.endsWith(`
77
+ `)&&(ft=ft.slice(0,-1));for(let wt=0;wt<gt;wt++){let At={type:"cell",text:ft,children:ut.length>0?wt===0?ut:JSON.parse(JSON.stringify(ut)):[],metadata:{row:z,col:Y}},Nt=At.metadata;Tt>1&&(Nt.colSpan=Tt),st>1&&(Nt.rowSpan=st),P.includeRawContent&&(At.rawContent=Zt(ct,$,P)),X.push(At),Y++}}for(let ct=0;ct<J;ct++){let ut={type:"row",children:ct===0?X:JSON.parse(JSON.stringify(X))};ct>0&&ut.children?.forEach(lt=>{lt.metadata&&"row"in lt.metadata&&(lt.metadata.row=z)}),P.includeRawContent&&(ut.rawContent=Zt(it,$,P)),G.push(ut),z++}}return{type:"table",children:G}};d&&(E=>{let S=ee(E,{locator:t.includeRawContent}),N=pt(S,"office:body");if(!N)return;let P=pt(S,"office:automatic-styles");if(P){let O=nt(P,"style:style");for(let z of O){let it=z.getAttribute("style:name");if(!it)continue;let X=pt(z,"style:paragraph-properties"),Q={};if(X){let Y=X.getAttribute("fo:text-align");if(Y){let ut={start:"left",left:"left",center:"center",end:"right",right:"right",justify:"justify"};ut[Y]&&(Q.alignment=ut[Y])}pt(X,"style:drop-cap")&&(Q.dropCap=!0)}Object.keys(Q).length>0&&(A[it]=Q);let J=pt(z,"style:text-properties");if(J){let Y={};(J.getAttribute("fo:font-weight")==="bold"||J.getAttribute("style:font-weight-asian")==="bold")&&(Y.bold=!0),(J.getAttribute("fo:font-style")==="italic"||J.getAttribute("style:font-style-asian")==="italic")&&(Y.italic=!0),J.getAttribute("style:text-underline-style")==="solid"&&(Y.underline=!0),J.getAttribute("style:text-line-through-style")==="solid"&&(Y.strikethrough=!0);let ct=J.getAttribute("fo:font-size")||J.getAttribute("style:font-size-asian");ct&&(Y.size=ct);let ut=J.getAttribute("fo:color");ut&&(Y.color=ut);let lt=J.getAttribute("fo:background-color");lt&&lt!=="transparent"&&(Y.backgroundColor=lt);let gt=J.getAttribute("style:font-name")||J.getAttribute("fo:font-family");gt&&(Y.font=gt);let Tt=J.getAttribute("style:text-position");Tt&&(Tt.startsWith("sub")&&(Y.subscript=!0),Tt.startsWith("super")&&(Y.superscript=!0)),Object.keys(Y).length>0&&(y[it]=Y)}}}let $=pt(S,"office:body");if($){let O=$e($,"office:text")[0]||$e($,"office:presentation")[0]||$e($,"office:spreadsheet")[0];if(O){let z=$e(O,"*");for(let it of z)G(it,m,!1,E)}}function G(O,z,it=!1,X){if(O.tagName==="text:p"){let Q=W(O,A,y,t,X),J=it||(O.getAttribute("text:style-name")||"").toLowerCase().includes("title")?"heading":"paragraph",Y={type:J,text:Q.text,children:Q.children,metadata:{...Q.alignment?{alignment:Q.alignment}:{},...Q.style?{style:Q.style}:{}}};J==="heading"&&Y.metadata&&(Y.metadata.level=Y.metadata.level||1),Object.keys(Y.metadata||{}).length===0&&delete Y.metadata,t.includeRawContent&&(Y.rawContent=Zt(O,X,t)),z.push(Y),k=!1}else if(O.tagName==="text:h"){let Q=parseInt(O.getAttribute("text:outline-level")||"1"),J=W(O,A,y,t,X),Y={type:"heading",text:J.text,children:J.children,metadata:{level:Q,...J.alignment?{alignment:J.alignment}:{},...J.style?{style:J.style}:{}}};t.includeRawContent&&(Y.rawContent=Zt(O,X,t)),z.push(Y),k=!1}else if(O.tagName==="table:table"){let Q=U(O,A,y,t,X);t.includeRawContent&&(Q.rawContent=Zt(O,X,t)),z.push(Q),k=!1}else if(O.tagName==="text:list"){let Q=$e(O,"text:list-item"),J="unordered",Y=!1,ut=O.getAttribute("text:style-name")||O.getAttribute("xml:id");if(!ut){let At=O.parentNode;for(;At&&!ut&&!(At.nodeName==="text:list"&&(ut=At.getAttribute("text:style-name"),ut));)At=At.parentNode}if(ut){let At=pt(ee(d?.content.toString()||""),"office:automatic-styles");if(At){let Nt=nt(At,"text:list-style");for(let bt of Nt)if(bt.getAttribute("style:name")===ut){let yt=nt(bt,"text:list-level-style-bullet"),kt=nt(bt,"text:list-level-style-number"),_t=nt(bt,"text:list-level-style-image");kt.length>0?(J="ordered",Y=kt.some(F=>!!F.getAttribute("style:num-format"))):yt.length>0&&(J="unordered",Y=yt.some(F=>!!F.getAttribute("text:bullet-char"))),_t.length>0&&(Y=!0);break}}if(f&&!Y){let Nt=ee(f.content.toString()),bt=nt(Nt,"text:list-style");for(let yt of bt)if(yt.getAttribute("style:name")===ut){let kt=nt(yt,"text:list-level-style-bullet"),_t=nt(yt,"text:list-level-style-number"),F=nt(yt,"text:list-level-style-image");_t.length>0?(J="ordered",Y=_t.some(q=>!!q.getAttribute("style:num-format"))):kt.length>0&&(J="unordered",Y=kt.some(q=>!!q.getAttribute("text:bullet-char"))),F.length>0&&(Y=!0);break}}}if(!Y){k=!1;for(let At=0;At<Q.length;At++){let Nt=Q[At];if(Nt.childNodes)for(let bt=0;bt<Nt.childNodes.length;bt++){let yt=Nt.childNodes[bt];Qe(yt)&&G(yt,z,it,X)}}return}let lt=h==="odp",gt=ut&&ut===D,Tt=J===C,st;k&&(gt||lt&&Tt)?st=v:(st=ut||`list-${++_}`,v=st,C=J,D=ut),k=!0;let ht=0,ft=O.parentNode;for(;ft;)ft.nodeName==="text:list"&&ht++,ft=ft.parentNode;w[st]||(w[st]={});let wt=ht.toString();w[st][wt]===void 0&&(w[st][wt]=-1);for(let At=0;At<Q.length;At++){let Nt=Q[At],bt=!1;if(Nt.childNodes)for(let yt=0;yt<Nt.childNodes.length;yt++){let kt=Nt.childNodes[yt];if(Qe(kt)){let _t=kt;if(_t.tagName==="text:p"||_t.tagName==="text:h"){if(!bt){w[st][wt]++,bt=!0;for(let dt=ht+1;dt<10;dt++)w[st][dt.toString()]!==void 0&&(w[st][dt.toString()]=-1)}let F=w[st][wt],q=W(_t,A,y,t,X),Et=V(q);for(let dt=0;dt<Et.length;dt++){let vt=Et[dt];if(!vt.text.trim()&&vt.children.length===0)continue;let Rt=dt===0,ui={type:Rt?"list":"paragraph",text:vt.text,children:vt.children,metadata:Rt?{listType:J,indentation:ht,itemIndex:F,listId:st,alignment:q.alignment||"left",style:q.style}:{alignment:q.alignment||"left",style:q.style}};if(Rt&&_t.tagName==="text:h"){let Ai=parseInt(_t.getAttribute("text:outline-level")||"1");ui.metadata.level=Ai}t.includeRawContent&&(ui.rawContent=Zt(_t,X,t)),z.push(ui)}}else _t.tagName==="text:list"&&G(_t,z,it,X)}}}}else if(O.tagName==="draw:frame"){let Q=O.getAttribute("presentation:class"),J=Q==="title"||Q==="sub-title",Y=pt(O,"draw:text-box"),ct=pt(O,"draw:image"),ut=pt(O,"table:table"),lt=pt(O,"draw:object");if(Y)G(Y,z,J||it,X);else if(ut){let gt=U(ut,A,y,t,X);t.includeRawContent&&(gt.rawContent=Zt(ut,X,t)),z.push(gt)}else if(ct){let gt="",Tt=pt(O,"svg:title"),st=pt(O,"svg:desc");Tt&&Tt.textContent?gt=Tt.textContent:st&&st.textContent&&(gt=st.textContent);let ht=ct.getAttribute("xlink:href")||"";if(ht){let wt=ht.split("/");ht=wt[wt.length-1]}let ft={type:"image",text:"",children:[],metadata:{attachmentName:ht,...gt?{altText:gt}:{}}};t.includeRawContent&&(ft.rawContent=Zt(O,X,t)),z.push(ft)}else if(lt){let gt=lt.getAttribute("xlink:href");if(gt){let Tt=gt.split("/")[0],st=`${Tt}/content.xml`,ht=c.find(ft=>ft.path===st||ft.path.endsWith(st));if(ht){let ft=Qo(ht.content),wt={type:"chart",text:ft.rawTexts.join(" "),metadata:{attachmentName:Tt,chartData:ft}};t.includeRawContent&&(wt.rawContent=Zt(O,X,t)),z.push(wt)}else{let ft={type:"chart",text:"",metadata:{attachmentName:Tt}};t.includeRawContent&&(ft.rawContent=Zt(O,X,t)),z.push(ft)}}}}else if(O.childNodes)for(let Q=0;Q<O.childNodes.length;Q++){let J=O.childNodes[Q];Qe(J)&&G(J,z,it,X)}}if(h==="ods"){let O=pt(N,"office:spreadsheet");if(O){let z=nt(O,"table:table");for(let it=0;it<z.length;it++){let X=z[it],Q=X.getAttribute("table:name")||`Sheet${it+1}`,J=[],Y=nt(X,"table:table-row"),ct=0;for(let lt=0;lt<Y.length;lt++){let gt=Y[lt],Tt=[],st=nt(gt,"table:table-cell"),ht=0,ft=parseInt(gt.getAttribute("table:number-rows-repeated")||"1");for(let wt=0;wt<st.length;wt++){let At=st[wt],Nt=parseInt(At.getAttribute("table:number-columns-repeated")||"1"),bt="",yt=[],kt=nt(At,"text:p");for(let F=0;F<kt.length;F++){let q=kt[F],Et=nt(q,"text:span");if(Et.length>0)for(let dt of Et){let vt=dt.getAttribute("text:style-name"),Rt=vt?y[vt]:{},xe=dt.textContent||"";bt+=xe;let ui={type:"text",text:xe,formatting:Rt};yt.push(ui)}else{let dt=q.textContent||"";if(bt+=dt,dt.trim()){let vt={type:"text",text:dt,formatting:{}};yt.push(vt)}}F<kt.length-1&&(bt+=`
78
+ `)}let _t=nt(At,"draw:frame");for(let F of _t){let q="",Et=pt(F,"svg:title"),dt=pt(F,"svg:desc");Et&&Et.textContent?q=Et.textContent:dt&&dt.textContent&&(q=dt.textContent);let vt="",Rt=nt(F,"draw:image");if(Rt.length>0){let Ai=Rt[0].getAttribute("xlink:href");if(Ai){let Vm=Ai.split("/");vt=Vm[Vm.length-1]}}let xe="",ui=nt(F,"draw:object");if(ui.length>0){let Ai=ui[0].getAttribute("xlink:href");Ai&&(xe=Ai.split("/")[0])}if(Rt.length>0){let Ai={type:"image",text:"",children:[],metadata:{attachmentName:vt,...q?{altText:q}:{}}};t.includeRawContent&&(Ai.rawContent=Zt(F,E,t)),yt.push(Ai)}else if(xe){let Ai={type:"chart",text:"",children:[],metadata:{attachmentName:xe}};yt.push(Ai)}}for(let F=0;F<Nt;F++){if(bt||yt.length>0||h!=="ods"){let q={type:"cell",text:bt,children:yt,metadata:{row:ct,col:ht}};t.includeRawContent&&(q.rawContent=Zt(At,E,t)),Tt.push(q)}ht++}}if(Tt.length>0)for(let wt=0;wt<ft;wt++){let At={type:"row",children:JSON.parse(JSON.stringify(Tt)),metadata:void 0};wt>0&&At.children?.forEach(Nt=>{Nt.metadata&&"row"in Nt.metadata&&(Nt.metadata.row=ct)}),t.includeRawContent&&(At.rawContent=Zt(gt,E,t)),J.push(At),ct++}else ct+=ft}let ut={type:"sheet",children:J,metadata:{sheetName:Q}};t.includeRawContent&&(ut.rawContent=Zt(X,E,t)),m.push(ut)}}}else if(h==="odp"){let O=pt(N,"office:presentation");if(O){let z=$e(O,"draw:page"),it=[];for(let X=0;X<z.length;X++){let Q=z[X],J={type:"slide",children:[],metadata:{slideNumber:X+1}},Y,ct=Q.childNodes;if(ct)for(let ut=0;ut<ct.length;ut++){let lt=ct[ut];if(Qe(lt)){let gt=lt;if(gt.tagName==="presentation:notes"){t.ignoreNotes||(Y={type:"note",children:[],metadata:{slideNumber:X+1,noteId:`slide-note-${X+1}`}},G(gt,Y.children,!1,E));continue}G(gt,J.children,!1,E)}}t.includeRawContent&&(J.rawContent=Zt(Q,E,t)),m.push(J),Y&&Y.children&&Y.children.length>0&&(t.putNotesAtLast?it.push(Y):m.push(Y))}it.length>0&&m.push(...it)}}else{let O=pt(N,"office:text");O&&G(O,m,!1,E)}})(d.content.toString());let et=[],B=c.filter(E=>E.path.match(/(Pictures|media)\/.*/));if(t.extractAttachments){let E=c.filter(S=>S.path.match(/Object \d+\/content\.xml/));for(let S of E){let N=ee(S.content.toString());if(nt(N,"chart:chart").length>0){let $=S.path.split("/")[0],G={type:"chart",mimeType:"application/vnd.oasis.opendocument.chart",data:S.content.toString("base64"),name:$,extension:"xml"},O=Qo(S.content);O.rawTexts.length>0&&(G.chartData=O),et.push(G)}}}if(t.extractAttachments)for(let E of B){let S=Ar(E.path.split("/").pop()||"image",E.content);if(et.push(S),t.ocr&&S.mimeType.startsWith("image/"))try{S.ocrText=(await Jn(E.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(N){ln(`OCR failed for ${S.name}:`,t,N)}}let ot=c.find(E=>E.path.match(s)),L=ot?Ga(ot.content.toString()):{},T=(E,S)=>{let N=$=>{let G=$.replace(/^\[|\]$/g,""),[O,z]=G.split(":"),it=O.lastIndexOf(".");if(it===-1)return[$];let X=O.substring(0,it).replace(/^'|'$/g,""),Q=O.substring(it+1).replace(/\$/g,""),J=Q;if(z)if(z.startsWith("."))J=z.substring(1).replace(/\$/g,"");else{let Tt=z.lastIndexOf(".");J=z.substring(Tt+1).replace(/\$/g,"")}let Y=Tt=>{let st=Tt.match(/[A-Z]+/),ht=Tt.match(/\d+/);if(!st||!ht)return null;let ft=st[0],wt=0;for(let Nt=0;Nt<ft.length;Nt++)wt=wt*26+(ft.charCodeAt(Nt)-65+1);return wt-=1,{r:parseInt(ht[0])-1,c:wt}},ct=Y(Q),ut=Y(J);if(!ct||!ut)return[$];let lt=S.find(Tt=>Tt.type==="sheet"&&Tt.metadata?.sheetName===X);if(!lt||!lt.children)return[$];let gt=[];for(let Tt of lt.children)if(Tt.children)for(let st of Tt.children){let ht=st.metadata;ht&&ht.row>=ct.r&&ht.row<=ut.r&&ht.col>=ct.c&&ht.col<=ut.c&&gt.push(st.text||"")}return gt.length>0?gt:[]};for(let $ of E.dataSets){let G=[];for(let O of $.values)O.startsWith("[")?G.push(...N(O)):G.push(O);$.values=G}let P=[];for(let $ of E.labels)$.startsWith("[")?P.push(...N($)):P.push($);E.labels=P,E.rawTexts=[],E.title&&E.rawTexts.push(E.title);for(let $ of E.dataSets)$.name&&E.rawTexts.push($.name),E.rawTexts.push(...E.labels),E.rawTexts.push(...$.values)};for(let E of et)E.type==="chart"&&E.chartData&&T(E.chartData,m);(E=>{let S=new Set,N=O=>{for(let z of O){if(z.metadata&&"attachmentName"in z.metadata){let it=z.metadata.attachmentName;it&&S.add(it)}z.children&&N(z.children)}};N(E);let P=et.filter(O=>O.type==="image"&&O.name&&!S.has(O.name)),$=0,G=O=>{if((O.type==="image"||O.type==="chart")&&O.metadata&&"attachmentName"in O.metadata){let z=O.metadata.attachmentName;if(!z&&O.type==="image"&&$<P.length&&(z=P[$++].name,O.metadata.attachmentName=z),z){let it=et.find(X=>X.name===z);it&&(it.ocrText&&(O.text=it.ocrText),it.chartData&&O.type==="chart"&&(O.text=it.chartData.rawTexts.join(t.newlineDelimiter??`
79
+ `)))}}O.children&&O.children.forEach(G)};E.forEach(G)})(m);let M={};for(let E in y)M[E]={formatting:y[E],alignment:A[E]?.alignment};for(let E in A)M[E]||(M[E]={formatting:{},alignment:A[E]?.alignment});return t.putNotesAtLast&&x.length>0&&m.push(...x),{type:h,metadata:{...L,styleMap:M},content:m,attachments:et,toText:()=>m.map(E=>{let S=N=>{let P="";if(N.children&&N.children.length>0){let G=N.children.some(O=>O.children&&O.children.length>0)?t.newlineDelimiter??`
80
+ `:"";P+=N.children.map(S).filter(O=>O!="").join(G)}else P+=N.text||"";return P};return S(E)}).filter(E=>E!="").join(t.newlineDelimiter??`
81
+ `)}};H();H();async function qw(r){return new Function("s","return import(s)")(r)}async function BS(){return Kc?Promise.resolve().then(()=>(J1(),Q1)):qw("file-type")}async function US(){if(!Kc){wA();try{return await qw("pdfjs-dist/legacy/build/pdf.mjs")}catch{return await qw("pdfjs-dist")}}return Promise.resolve().then(()=>(LS(),RS))}function NM(r){return r&&typeof r.str=="string"&&Array.isArray(r.transform)&&r.transform.length>=6}function _M(r){let t=[];for(let n of r)for(let s of n)s.type==="text"&&s.height>0&&t.push(s.height);if(t.length===0)return{median:12,max:12};t.sort((n,s)=>n-s);let e=t[Math.floor(t.length/2)],i=t[t.length-1];return{median:e,max:i}}function MM(r,t){if(r<=t.median*1.2)return 0;let e=r/t.median;return e>=2?1:e>=1.7?2:e>=1.5?3:e>=1.35?4:e>=1.2?5:0}function FM(r,t){let e=r.x,i=r.x+r.width,n=r.y,s=r.y+r.height;for(let o of t){let[l,c,u,h]=o.rect,d=Math.min(l,u),f=Math.max(l,u),m=Math.min(c,h),x=Math.max(c,h);if(e<f&&i>d&&n<x&&s>m)return o}}function PM(r,t,e){let i=Math.floor((24*r+31)/32)*4,n=i-r*3,s=54,o=i*t,l=s+o,c=at.Buffer.alloc(l);c.write("BM",0),c.writeUInt32LE(l,2),c.writeUInt32LE(0,6),c.writeUInt32LE(s,10),c.writeUInt32LE(40,14),c.writeInt32LE(r,18),c.writeInt32LE(-t,22),c.writeUInt16LE(1,26),c.writeUInt16LE(24,28),c.writeUInt32LE(0,30),c.writeUInt32LE(o,34),c.writeInt32LE(2835,38),c.writeInt32LE(2835,42),c.writeUInt32LE(0,46),c.writeUInt32LE(0,50);let u=s;for(let h=0;h<t;h++){for(let d=0;d<r;d++){let f=(h*r+d)*4,m=e[f+0],x=e[f+1],y=e[f+2],w=e[f+3]/255,v=Math.round(m*w+255*(1-w)),C=Math.round(x*w+255*(1-w)),D=Math.round(y*w+255*(1-w));c[u+0]=D,c[u+1]=C,c[u+2]=v,u+=3}for(let d=0;d<n;d++)c[u]=0,u++}return c}function OM(r,t,e,i){let n;if(i===1){n=new Uint8ClampedArray(t*e*4);for(let s=0;s<t*e;s++){let o=r[s];n[s*4]=o,n[s*4+1]=o,n[s*4+2]=o,n[s*4+3]=255}}else if(i===2||r.length===t*e*3){n=new Uint8ClampedArray(t*e*4);for(let s=0;s<t*e;s++)n[s*4]=r[s*3],n[s*4+1]=r[s*3+1],n[s*4+2]=r[s*3+2],n[s*4+3]=255}else n=r instanceof Uint8ClampedArray?r:new Uint8ClampedArray(r);return at.Buffer.from(n.buffer,n.byteOffset,n.byteLength)}var zS=async(r,t)=>{let e=await US();if(t.pdfWorkerSrc)e.GlobalWorkerOptions.workerSrc=t.pdfWorkerSrc;else if(Kc)e.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${e.version}/build/pdf.worker.min.mjs`;else{Qm("pdf-worker-auto-resolution");try{let y=Wm.resolve("pdfjs-dist/legacy/build/pdf.worker.mjs");e.GlobalWorkerOptions.workerSrc=y}catch(y){t.outputErrorToConsole&&console.warn("[PdfParser] Could not auto-resolve local worker path:",y)}}let i=new Uint8Array(r),n=e.getDocument({data:i,verbosity:0}),s;try{s=await n.promise}catch(y){let A=y instanceof Error?y.message:String(y);throw A.includes("workerSrc")||A.includes('No "GlobalWorkerOptions.workerSrc" specified')?Rs("PDF_WORKER_MISSING",t):y}let o=[],l=[],c=s.numPages,u=[],d=(await s.getMetadata().catch(()=>({info:{}}))).info,f={pages:c,title:d?.Title,author:d?.Author,subject:d?.Subject,description:d?.Keywords,created:Zr(d?.CreationDate),modified:Zr(d?.ModDate)},m=new Set(["Title","Author","Subject","Keywords","Creator","Producer","CreationDate","ModDate","Trapped","IsAcroFormPresent","IsXFAPresent","IsCollectionPresent","IsSignaturesPresent","PDFFormatVersion"]);if(d){let y={};for(let A of Object.keys(d)){if(m.has(A))continue;let w=d[A];if(w!=null){if(A==="Custom"&&typeof w=="object"&&!Array.isArray(w)&&!(w instanceof Date)){for(let[v,C]of Object.entries(w))C!=null&&(typeof C=="string"||typeof C=="number"||typeof C=="boolean"||C instanceof Date)&&(y[v]=C);continue}(typeof w=="string"||typeof w=="number"||typeof w=="boolean"||w instanceof Date)&&(y[A]=w)}}Object.keys(y).length>0&&(f.customProperties=y)}try{let y=await s.getAttachments();if(y&&t.extractAttachments)for(let A in y){let w=y[A],v=at.Buffer.from(w.content),C=Ar(w.filename,v);l.push(C)}}catch(y){t.outputErrorToConsole&&console.error("Error extracting embedded attachments:",y)}for(let y=1;y<=c;y++){let A,w,v=[];try{A=await s.getPage(y),w=await A.getTextContent()}catch(D){t.outputErrorToConsole&&console.warn(`[PdfParser] Error loading page ${y}:`,D),u.push(v);continue}let C=A.commonObjs;for(let D of w.items){if(!NM(D))continue;let _=D,k=_.transform,R=k[4],K=k[5],W=_.width||0,V=_.height||Math.abs(k[3])||12,U={},tt;if(_.fontName&&C)try{if(C.has(_.fontName)){let et=await new Promise(B=>{C.get(_.fontName,ot=>B(ot))});if(et?.name&&typeof et.name=="string"){tt=et.name.replace(/^[A-Z]{6}\+/,""),U.font=tt;let B=et.name.toLowerCase();B.includes("bold")&&(U.bold=!0),(B.includes("italic")||B.includes("oblique"))&&(U.italic=!0)}}}catch{}V>0&&(U.size=Math.round(V).toString()),v.push({type:"text",x:R,y:K,width:W,height:V,text:_.str,fontName:tt,formatting:U})}if(t.extractAttachments||t.ocr)try{let D=await A.getOperatorList(),_=D.fnArray,k=D.argsArray;for(let R=0;R<_.length;R++){let K=_[R];if(K===e.OPS.dependency){let W=k[R];for(let V of W)try{if(A.objs.has(V))continue;await new Promise(U=>{let tt=setTimeout(()=>{U()},500);A.objs.get(V,et=>{clearTimeout(tt),U()})})}catch(U){t.outputErrorToConsole&&console.error(`[PdfParser] Failed to load dependency ${V}:`,U)}}if(K===e.OPS.paintImageXObject||K===e.OPS.paintXObject){let W=k[R][0];try{let V=A.objs.has(W),U=A.objs;if(!V&&A.commonObjs.has(W)&&(V=!0,U=A.commonObjs),V){let tt=await new Promise(et=>{U.get(W,B=>et(B))});if(typeof window<"u"&&!tt.data&&tt.bitmap)try{let et=document.createElement("canvas");et.width=tt.width,et.height=tt.height;let B=et.getContext("2d");B&&(B.drawImage(tt.bitmap,0,0),tt.data=B.getImageData(0,0,tt.width,tt.height).data,tt.kind=3)}catch(et){t.outputErrorToConsole&&console.error("[PdfParser] Failed to extract from ImageBitmap:",et)}if(tt?.data&&tt.width>0&&tt.height>0){let et=0,B=0;for(let ot=R-1;ot>=0;ot--)if(_[ot]===e.OPS.transform){et=k[ot][4],B=k[ot][5];break}v.push({type:"image",x:et,y:B,name:W,data:tt.data,width:tt.width,height:tt.height,kind:tt.kind})}}}catch{}}}}catch(D){t.outputErrorToConsole&&console.error(`Error extracting images from page ${y}:`,D)}u.push(v)}let x=_M(u);for(let y=0;y<u.length;y++){let A=y+1,w;try{w=await s.getPage(A)}catch(V){t.outputErrorToConsole&&console.warn(`[PdfParser] Error loading page ${A} in second pass:`,V);continue}let v=u[y],C=[],D=[],_=new Set;try{let V=await w.getAnnotations();for(let U of V)if(U.subtype==="Link"&&U.rect){let tt=U.url||U.unsafeUrl||U.data?.url;D.push({rect:U.rect,url:tt,dest:U.dest})}}catch(V){t.outputErrorToConsole&&console.error(`Error extracting annotations from page ${A}:`,V)}v.sort((V,U)=>Math.abs(U.y-V.y)>7?U.y-V.y:V.x-U.x);let k=null,R=0,K=-1,W=0;for(let V of v)if(V.type==="text"){let U=V.text;if(!U)continue;if(K!==-1&&Math.abs(V.y-K)>5&&k&&((k.text||"").trim().length>0&&C.push(k),k=null),!k&&U.trim().length===0){K=V.y;continue}let et=MM(V.height,x);if(k||(et>0?k={type:"heading",text:"",children:[],metadata:{level:et}}:k={type:"paragraph",text:"",children:[]},R=V.height),U.trim().length===0){if(k.children&&k.children.length>0){let T=k.children[k.children.length-1];T.type==="text"&&T.text&&(T.text+=U,k.text+=U)}K=V.y;continue}if(k.text&&k.text.length>0&&!k.text.endsWith(" ")&&(k.text+=" ",k.children&&k.children.length>0)){let T=k.children[k.children.length-1];T.type==="text"&&T.text&&(T.text+=" ")}k.text+=U;let B=FM(V,D);B&&_.add(B);let ot;B&&(B.url?ot={link:B.url,linkType:B.url.startsWith("#")?"internal":"external"}:B.dest&&(ot={link:typeof B.dest=="string"?`#${B.dest}`:"#internal",linkType:"internal"}));let L=!1;if(k.children&&k.children.length>0&&!ot){let T=k.children[k.children.length-1];T.type==="text"&&RM(T.formatting,V.formatting)&&!T.metadata&&(T.text=(T.text||"")+U,L=!0)}if(!L){let T={type:"text",text:U,formatting:Object.keys(V.formatting).length>0?V.formatting:void 0};ot&&(T.metadata=ot),k.children?.push(T)}K=V.y}else if(V.type==="image"){k&&((k.text||"").trim().length>0&&C.push(k),k=null),W++;let U=`pdf_image_p${A}_${W}.bmp`;if(t.extractAttachments)try{let tt=OM(V.data,V.width,V.height,V.kind),et=PM(V.width,V.height,new Uint8Array(tt)),B=Ar(U,et);if(B.mimeType="image/bmp",t.ocr)try{V.width>=10&&V.height>=10&&(B.ocrText=(await Jn(et,{language:t.ocrLanguage,...t.ocrConfig})).trim())}catch(L){t.outputErrorToConsole&&console.error(`OCR failed for ${U}:`,L)}l.push(B);let ot={attachmentName:U};C.push({type:"image",text:B.ocrText||"",metadata:{...ot}})}catch(tt){ln(`Failed to process image ${U}:`,t,tt)}}k&&(k.text||"").trim().length>0&&C.push(k),o.push({type:"page",children:C,text:C.map(V=>V.text).join(t.newlineDelimiter??`
82
+
83
+ `),metadata:{pageNumber:A}})}return{type:"pdf",metadata:f,content:o,attachments:l,toText:()=>o.map(y=>y.text).join(t.newlineDelimiter??`
84
+
85
+ `)}};function RM(r,t){if(!r&&!t)return!0;if(!r||!t)return!1;let e=Object.keys(r).sort(),i=Object.keys(t).sort();if(e.length!==i.length)return!1;for(let n=0;n<e.length;n++){let s=e[n];if(e[n]!==i[n]||r[s]!==t[s])return!1}return!0}H();var jS=async(r,t)=>{let e=/ppt\/(notesSlides|slides)\/(notesSlide|slide)\d+.xml/g,i=/ppt\/slides\/slide\d+.xml/g,n=/ppt\/slides\/_rels\/slide\d+\.xml\.rels/,s=/lide(\d+)\.xml/,o=/ppt\/media\/.*/,l=/ppt\/charts\/chart\d+\.xml/,c=/docProps\/core\.xml/,u=/docProps\/custom\.xml/,h=await Va(r,L=>!!L.match(t.ignoreNotes?i:e)||!!L.match(c)||!!L.match(u)||!!L.match(n)||!!t.extractAttachments&&(!!L.match(o)||!!L.match(l))),d=h.find(L=>L.path.match(c)),f=d?Ga(d.content.toString()):{},m=h.find(L=>L.path.match(u));if(m){let L=mu(m.content.toString());Object.keys(L).length>0&&(f.customProperties=L)}h.sort((L,T)=>{let I=L.path.match(s),M=T.path.match(s),E=I?parseInt(I[1]):0,S=M?parseInt(M[1]):0;return E-S});let x=[],y=[],A={},w=0,v=0,C=!1,D=null,_=0,k={},R=(L,T)=>{let I=[],M=nt(L,"a:tr");for(let E=0;E<M.length;E++){let S=M[E],N=[],P=nt(S,"a:tc");for(let G=0;G<P.length;G++){let O=P[G],z=[],it="",X=pt(O,"a:txBody");if(X){let J=nt(X,"a:p");for(let Y of J){let ct={type:"paragraph",text:"",children:[],metadata:{}};t.includeRawContent&&(ct.rawContent=Zt(Y,T,t));let ut=nt(Y,"a:r");for(let lt of ut){let gt=pt(lt,"a:t");if(gt&&gt.childNodes[0]){let Tt=gt.childNodes[0].nodeValue||"";ct.text+=Tt;let st=pt(lt,"a:rPr"),ht={};if(st){st.getAttribute("b")==="1"&&(ht.bold=!0),st.getAttribute("i")==="1"&&(ht.italic=!0),st.getAttribute("u")==="sng"&&(ht.underline=!0),st.getAttribute("strike")==="sngStrike"&&(ht.strikethrough=!0);let ft=st.getAttribute("sz");ft&&(ht.size=(parseInt(ft)/100).toString()+"pt");let wt=pt(st,"a:solidFill");if(wt){let Nt=pt(wt,"a:srgbClr");if(Nt){let bt=Nt.getAttribute("val");bt&&(ht.color="#"+bt)}}let At=pt(st,"a:latin");if(At){let Nt=At.getAttribute("typeface");Nt&&(ht.font=Nt)}}ct.children?.push({type:"text",text:Tt,formatting:ht})}}z.push(ct),it+=ct.text}}let Q={type:"cell",text:it,children:z,metadata:{row:E,col:G}};N.push(Q)}let $={type:"row",children:N};I.push($)}return{type:"table",children:I}},K=(L,T,I)=>{let M=pt(L,"a:blip");if(!M)return null;let E=M.getAttribute("r:embed");if(!E)return null;let S=A[T]?.[E];if(!S||S.type!=="image")return null;let N=S.target,P=pt(L,"p:nvPicPr"),G=(P?pt(P,"p:cNvPr"):null)?.getAttribute("descr")||void 0;return{type:"image",text:"",metadata:{attachmentName:N,altText:G}}},W=(L,T,I)=>{let M=pt(L,"a:graphicData");if(!M||!(M.getAttribute("uri")==="http://schemas.openxmlformats.org/drawingml/2006/chart"))return null;let N=pt(M,"c:chart");if(!N)return null;let P=N.getAttribute("r:id");if(!P)return null;let $=A[T]?.[P];if(!$||$.type!=="chart")return null;let O={type:"chart",text:"",metadata:{attachmentName:$.target}};return t.includeRawContent&&(O.rawContent=Zt(L,I,t)),O},V=(L,T,I)=>{let M=pt(L,"a:tbl");if(M){let E=R(M,I);if(t.includeRawContent&&(E.rawContent=Zt(L,I,t)),E.children&&E.children.length>0)return E}if(L.getElementsByTagName("c:chart").length>0){let E=W(L,T,I);if(E)return E}return null},U=(L,T,I)=>{let M=[],E=pt(L,"p:nvSpPr"),S=E?pt(E,"p:nvPr"):null,N=S?pt(S,"p:ph"):null,P=N?N.getAttribute("type"):"body",$=P==="title"||P==="ctrTitle",G=pt(L,"p:txBody");if(G){let O=nt(G,"a:p");for(let z=0;z<O.length;z++){let it=O[z],X={type:$?"heading":"paragraph",text:"",children:[],metadata:$?{level:1}:{}},Q=pt(it,"a:pPr"),J=!1,Y="unordered",ct=0;if(Q){let gt=Q.getAttribute("lvl");gt&&(ct=parseInt(gt));let Tt=pt(Q,"a:buAutoNum"),st=pt(Q,"a:buChar"),ht=pt(Q,"a:buBlip"),ft=pt(Q,"a:bu");Tt?(J=!0,Y="ordered"):(st||ht||ft)&&(J=!0,Y="unordered");let wt=Q.getAttribute("algn");if(wt){let At={l:"left",ctr:"center",r:"right",just:"justify"};At[wt]&&(X.metadata.alignment=At[wt])}}if(J){X.type="list";let gt=ct;if(!C||Y!==D){w++;for(let st in k)delete k[st];v=0,k[gt]=0}else if(gt>_)v=0,k[gt]=0;else if(gt<_){for(let ht in k){let ft=parseInt(ht);ft>gt&&delete k[ft]}v=(k[gt]||0)+1,k[gt]=v}else v=(k[gt]||0)+1,k[gt]=v;C=!0,D=Y,_=gt,X.metadata={...X.metadata,listType:Y,indentation:gt,listId:w.toString(),itemIndex:v,alignment:X.metadata?.alignment||"left"}}else C=!1,D=null,_=0;$&&(X.metadata={...X.metadata,level:1}),t.includeRawContent&&(X.rawContent=Zt(it,I,t));let ut=Array.from(it.childNodes),lt=X;M.push(lt);for(let gt of ut){if(!Qe(gt))continue;let Tt=gt,st=Tt.tagName;if(st==="a:r"||st==="a:fld"){let ht=pt(Tt,"a:t");if(ht&&ht.childNodes[0]){let ft=ht.childNodes[0].nodeValue||"";lt.text+=ft;let wt=pt(Tt,"a:rPr"),At={};if(wt){wt.getAttribute("b")==="1"&&(At.bold=!0),wt.getAttribute("i")==="1"&&(At.italic=!0),wt.getAttribute("u")==="sng"&&(At.underline=!0),wt.getAttribute("strike")==="sngStrike"&&(At.strikethrough=!0);let yt=wt.getAttribute("sz");yt&&(At.size=(parseInt(yt)/100).toString()+"pt");let kt=pt(wt,"a:solidFill");if(kt){let Et=pt(kt,"a:srgbClr");if(Et){let dt=Et.getAttribute("val");dt&&(At.color="#"+dt)}}let _t=pt(wt,"a:highlight");if(_t){let Et=pt(_t,"a:srgbClr");if(Et){let dt=Et.getAttribute("val");dt&&(At.backgroundColor="#"+dt)}}let F=pt(wt,"a:latin");if(F){let Et=F.getAttribute("typeface");Et&&(At.font=Et)}let q=wt.getAttribute("baseline");if(q){let Et=parseInt(q);Et<0&&(At.subscript=!0),Et>0&&(At.superscript=!0)}}let Nt={type:"text",text:ft,formatting:At},bt=pt(Tt,"a:hlinkClick");if(bt){let yt=bt.getAttribute("r:id"),kt=bt.getAttribute("action"),_t,F;yt&&A[T]&&A[T][yt]&&A[T][yt].type==="hyperlink"?(_t=A[T][yt].target,F="external"):yt&&A[T]&&A[T][yt]&&A[T][yt].type==="slide"?(_t=A[T][yt].target,F="internal"):kt&&(_t=kt,F="internal"),_t&&(Nt.metadata={link:_t,linkType:F})}lt.children?.push(Nt)}}else st==="a:br"&&(J?(lt={type:"paragraph",text:"",children:[],metadata:{indentation:ct,alignment:X.metadata?.alignment||"left"}},t.includeRawContent&&(lt.rawContent=Zt(it,I,t)),M.push(lt)):(lt.text+=`
86
+ `,lt.children?.push({type:"text",text:`
87
+ `})))}}}return M.filter(O=>O.text?.trim()||O.children&&O.children.length>0)};function tt(L,T,I){let M=[];for(let E of Array.from(L?.childNodes||[])){if(!Qe(E))continue;let S=E,N=S.tagName;if(N==="p:sp")M.push(...U(S,T,I));else if(N==="p:pic"){let P=K(S,T,I);P&&M.push(P)}else if(N==="p:graphicFrame"){let P=V(S,T,I);P&&M.push(P)}else if(N==="p:grpSp"){let P=pt(S,"p:spTree");P&&M.push(...tt(P,T,I))}}return M}for(let L of h)if(L.path.match(n)){let T=L.path.match(/slide(\d+)\.xml\.rels/);if(T){let I=parseInt(T[1]);A[I]={};let M=ee(L.content.toString()),E=nt(M,"Relationship");for(let S=0;S<E.length;S++){let N=E[S].getAttribute("Id"),P=E[S].getAttribute("Type"),$=E[S].getAttribute("Target");if(N&&P&&$){let G="other";P.includes("relationships/image")?G="image":P.includes("relationships/hyperlink")?G="hyperlink":P.includes("relationships/chart")?G="chart":P.includes("relationships/slide")?G="slide":P.includes("relationships/notesSlide")&&(G="notes");let O=$;$.startsWith("http://")||$.startsWith("https://")||(O=O.split("/").pop()||""),A[I][N]={type:G,target:O}}}}}for(let L of h){if(L.path.match(o)||L.path.match(l)||L.path.match(n)||L.path.match(c))continue;let T=L.content.toString(),I=ee(T,{locator:t.includeRawContent});t.includeRawContent&&y.push(T);let M=L.path.match(s),E=M?parseInt(M[1]):0,S=L.path.includes("notesSlide"),N={type:S?"note":"slide",children:[],metadata:{slideNumber:E,...S?{noteId:`slide-note-${E}`}:{}}};t.includeRawContent&&(N.rawContent=Zt(I,T,t));let P=pt(I,"p:spTree");P&&N.children?.push(...tt(P,E,T)),N.children&&N.children.length>0&&x.push(N)}let et=[],B=h.filter(L=>L.path.match(/ppt\/media\/.*/)),ot=h.filter(L=>L.path.match(/ppt\/charts\/chart\d+\.xml/));if(t.extractAttachments){for(let T of B){let I=Ar(T.path.split("/").pop()||"image",T.content);if(et.push(I),t.ocr&&I.mimeType.startsWith("image/"))try{I.ocrText=(await Jn(T.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(M){ln(`OCR failed for ${I.name}:`,t,M)}}for(let T of ot){let I={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:T.content.toString("base64"),name:T.path.split("/").pop()||"",extension:"xml"};et.push(I);try{let M=await Qo(T.content);I.chartData=M}catch(M){ln(`Failed to extract text from chart ${T.path}:`,t,M)}}let L=T=>{for(let I of T){if("attachmentName"in(I.metadata||{})){let M=I.metadata,E=et.find(S=>S.name===M.attachmentName);E&&(I.type==="image"&&(E.altText=M.altText,E.ocrText&&(I.text=E.ocrText)),I.type==="chart"&&(I.text=E.chartData?.rawTexts.join(t.newlineDelimiter||`
88
+ `)))}I.children&&L(I.children)}};L(x)}return!t.ignoreNotes&&t.putNotesAtLast&&x.sort((L,T)=>{let I=L.type==="note"?1:0,M=T.type==="note"?1:0;return I-M}),{type:"pptx",metadata:f,content:x,attachments:et,toText:()=>x.map(L=>{let T=I=>{let M="";return I.children?M+=I.children.map(T).filter(E=>E!="").join(I.children[0]?.children?t.newlineDelimiter??`
89
+ `:""):M+=I.text||"",M};return T(L)}).filter(L=>L!="").join(t.newlineDelimiter??`
90
+ `)}};H();var LM={pngblip:"png",jpegblip:"jpeg",gifblip:"gif",tiffblip:"tiff",dibitmap:"bmp",wbitmap:"bmp"},BM={png:"image/png",jpeg:"image/jpeg",gif:"image/gif",tiff:"image/tiff",bmp:"image/bmp"},Ww=class{constructor(t){j(this,"index",0);j(this,"buffer");j(this,"codePage",1252);j(this,"decoders",{});j(this,"pendingBytes",[]);j(this,"length");this.buffer=t,this.length=t.length}parse(){let t={type:"group",content:[]},e=[t];for(;this.index<this.length;){let i=this.buffer[this.index],n=e[e.length-1];if(i===123){this.index++,this.flushPendingText(n);let s={type:"group",content:[]};n.content.push(s),e.push(s)}else i===125?(this.index++,this.flushPendingText(n),e.length>1&&e.pop()):i===92?(this.index++,this.parseControl(n)):i===13||i===10?this.index++:this.parseText(n)}return this.flushPendingText(t),t}parseControl(t){if(this.index>=this.length)return;let e=this.buffer[this.index];if(e===123||e===125||e===92){this.pendingBytes.push(e),this.index++;return}if(e===39){if(this.index++,this.index+1<this.length){let l=String.fromCharCode(this.buffer[this.index],this.buffer[this.index+1]),c=parseInt(l,16);isNaN(c)||this.pendingBytes.push(c),this.index+=2}return}if(this.flushPendingText(t),e===42){t.content.push({type:"control",value:"*"}),this.index++;return}let i="";for(;this.index<this.length;){let l=this.buffer[this.index];if(l>=97&&l<=122||l>=65&&l<=90)i+=String.fromCharCode(l),this.index++;else break}let n,s=!1,o="";for(this.index<this.length&&this.buffer[this.index]===45&&(o+="-",this.index++);this.index<this.length;){let l=this.buffer[this.index];if(l>=48&&l<=57)o+=String.fromCharCode(l),this.index++,s=!0;else break}if(s&&(n=parseInt(o,10)),i!==""&&this.index<this.length&&this.buffer[this.index]===32&&this.index++,i==="bin"&&n!==void 0&&n>0){this.index+=n;return}i==="ansicpg"&&n!==void 0?this.codePage=n:i==="ansi"?this.codePage=1252:i==="mac"?this.codePage=1e4:i==="pc"?this.codePage=437:i==="pca"&&(this.codePage=850),t.content.push({type:"control",value:i,param:n}),(t.content.length===1&&t.type==="group"||t.content.length===2&&t.content[0].type==="control"&&t.content[0].value==="*")&&(t.destination=i)}parseText(t){for(;this.index<this.length;){let e=this.buffer[this.index];if(e===void 0||e===123||e===125||e===92||e===13||e===10)break;this.pendingBytes.push(e),this.index++}}flushPendingText(t){this.pendingBytes.length>0&&(t.content.push({type:"text",value:this.decodeBytes(this.pendingBytes,this.codePage)}),this.pendingBytes=[])}decodeBytes(t,e){let i=new Uint8Array(t);if(t.some(s=>s>127))try{return new TextDecoder("utf-8",{fatal:!0}).decode(i)}catch{}if(!this.decoders[e]){let s=`windows-${e}`;e===1e4?s="macintosh":e===437?s="ibm437":e===850&&(s="ibm850");try{this.decoders[e]=new TextDecoder(s)}catch{if(e!==1252)try{this.decoders[e]=new TextDecoder("windows-1252")}catch{return String.fromCharCode(...t)}else return String.fromCharCode(...t)}}let n=this.decoders[e].decode(i);if(e===1252&&/[\u0080-\u009F]/.test(n)){let s={"\x80":"\u20AC","\x82":"\u201A","\x83":"\u0192","\x84":"\u201E","\x85":"\u2026","\x86":"\u2020","\x87":"\u2021","\x88":"\u02C6","\x89":"\u2030","\x8A":"\u0160","\x8B":"\u2039","\x8C":"\u0152","\x8E":"\u017D","\x91":"\u2018","\x92":"\u2019","\x93":"\u201C","\x94":"\u201D","\x95":"\u2022","\x96":"\u2013","\x97":"\u2014","\x98":"\u02DC","\x99":"\u2122","\x9A":"\u0161","\x9B":"\u203A","\x9C":"\u0153","\x9E":"\u017E","\x9F":"\u0178"};return n.replace(/[\u0080-\u009F]/g,o=>s[o]||o)}return n}},HS=async(r,t)=>{try{let i=new Ww(r).parse(),n=UM(i),s=zM(i),o=[],l=[],c=[],u="",h=[],d="",f="",m={},x=o,y=0,A="left",w=!1,v,C,D,_,k,R=[],K=0,W=0,V=()=>R.length>0?R[R.length-1]:void 0,U=()=>{R.length===0&&R.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})},tt=!1,et=!1,B=0,ot=[],L={isMergedContinuation:!1},T=0,I=0,M={},E=!1,S=!1,N,P,$={},G=!1,O,z,it={},X={},Q,J=(F,q)=>F.bold!==q.bold||F.italic!==q.italic||F.underline!==q.underline||F.strikethrough!==q.strikethrough||F.size!==q.size||F.font!==q.font||F.color!==q.color||F.backgroundColor!==q.backgroundColor||F.subscript!==q.subscript||F.superscript!==q.superscript,Y=()=>{if(f){let F={type:"text",text:f,formatting:{...m}};Q&&(F.metadata={link:Q,linkType:ht(Q)}),h.push(F),u+=f,f=""}},ct=!1,ut=()=>{Y();let F=u||h.length>0;if(tt&&!et&&!ct&&F){let q=u,Et=[...h],dt=d;u="",h=[],d="",Tt(),u=q,h=Et,d=dt}if(F){let q="paragraph",Et;if(C!==void 0&&C>0)q="heading",Et={level:C},_=void 0,k=void 0;else if(w){q="list";let vt=D||_,Rt=v||k||"unordered",xe=0;vt&&(X[vt]||(X[vt]={}),X[vt][y]===void 0?X[vt][y]=0:X[vt][y]++,xe=X[vt][y]),Et={listType:Rt,indentation:y,listId:vt||"",itemIndex:xe,alignment:A},vt&&(_=vt),Rt&&(k=Rt)}let dt={type:q,text:u,children:h,formatting:void 0,metadata:Et};t.includeRawContent&&d&&(dt.rawContent=d),tt&&et?(U(),V().currentCellContent.push(dt)):x.push(dt),u="",h=[],d="",y=0,w=!1,v=void 0,C=void 0,D=void 0}},lt=F=>{ut();let q=F||V();if(!q)return;let Et={type:"cell",text:q.currentCellContent.map(dt=>dt.text).join(`
91
+ `),children:[...q.currentCellContent],metadata:{row:q.rowIndex,col:q.currentCells.length}};return q.currentCellContent=[],Et},gt=F=>{let q=F||V();if(!q)return;let Et=lt(q);if(Et&&(Et.children&&Et.children.length>0||Et.text)&&q.currentCells.push(Et),q.currentCells.length>0){let dt={type:"row",text:q.currentCells.map(vt=>vt.text).filter(vt=>vt!=="").join(t.newlineDelimiter??`
92
+ `),children:[...q.currentCells]};q.rows.push(dt),q.currentCells=[],q.rowIndex++}},Tt=()=>{if(ct)return;ct=!0;let F=V();if(!F){ct=!1;return}if(gt(F),F.rows.length>0){B++;let q={type:"table",text:F.rows.map(Et=>Et.text).join(`
93
+ `),children:[...F.rows]};R.length>1?R[R.length-2].currentCellContent.push(q):x.push(q)}R.pop(),R.length===0&&(tt=!1,et=!1),ct=!1},st=F=>{let q,Et=dt=>{if(dt.type==="text"){let vt=dt.value,Rt=vt.match(/HYPERLINK\s+"([^"]+)"/i);if(Rt)return Rt[1];let xe=vt.match(/"(https?:\/\/[^"]+|mailto:[^"]+|#[^"]+)"/);if(xe)return xe[1]}else if(dt.type==="group"){let vt=!1,Rt;for(let xe of dt.content)if(xe.type==="text"){xe.value.toUpperCase().includes("HYPERLINK")&&(vt=!0);let Ai=xe.value.match(/"([^"]+)"/);Ai&&vt&&(Rt=Ai[1])}else if(xe.type==="group"){let ui=Et(xe);ui&&(Rt=ui)}if(Rt)return Rt}};for(let dt of F.content)if(dt.type==="group"){let vt=Et(dt);if(vt)return vt}return q},ht=F=>{let q=F.trim();return q.startsWith("#")||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(q)?"internal":"external"},ft=F=>{let q="",Et=dt=>{if(dt.type==="text")q+=dt.value;else if(dt.type==="group")for(let vt of dt.content)Et(vt)};for(let dt of F.content)Et(dt);return q},wt=F=>{let q,Et="";for(let vt of F.content)if(vt.type==="control"){let Rt=LM[vt.value];Rt&&(q=Rt)}else vt.type==="text"?Et+=vt.value.replace(/[^0-9a-fA-F]/g,""):vt.type;if(!q||Et.length===0)return;let dt=BM[q];if(dt)try{let vt=at.Buffer.from(Et,"hex"),Rt=q,xe=`image_${c.length+1}.${Rt}`;return{type:"image",mimeType:dt,data:vt.toString("base64"),name:xe,extension:Rt}}catch{return}},At=F=>{if(!/^[a-zA-Z]/.test(F.value))return`\\${F.value}`;let q=`\\${F.value}`;return F.param!==void 0&&(q+=F.param),q+=" ",q},Nt=F=>F.value.replace(/([\\{}])/g,"\\$1"),bt=(F,q,Et=0)=>{if(F.type==="group"){let dt=["fonttbl","colortbl","stylesheet","info","macpict","pmmetafile","wmetafile","dibitmap","bitmap","object","nextGenerator","header","footer","nonshppict","xml","private","upnp","ud","filetbl","operator","author","creatim","revtim","printim","comment","fldinst","listtext","pntext"],vt=!1,Rt=!1,xe=!1,ui=!1;if(F.destination){if(F.destination==="footnote")Rt=!0;else if(F.destination==="field"){let He=st(F);He&&(Y(),xe=!0,Q=He)}else if(F.destination==="listtable")E=!0;else if(E&&F.destination==="list")S=!0,N=void 0,P=void 0;else if(F.destination==="listoverridetable")G=!0;else if(G&&F.destination==="listoverride")O=void 0,z=void 0;else if(F.destination==="pict")t.extractAttachments?ui=!0:vt=!0;else if(dt.includes(F.destination))vt=!0;else if(F.content.length>0&&F.content[0].type==="control"&&F.content[0].value==="*"){let He=["fldinst","nesttableprops"];t.extractAttachments&&He.push("shppict","listpicture"),He.includes(F.destination||"")||(vt=!0)}}if(F.destination==="listtext"||F.destination==="pntext"){w||(y=0),w=!0;let He=ft(F);if(He){let vi=He.trim();["\xB7","\u2022","o","\xA7","\u25A0","\u25A1","\u25CF","\u25CB","\u25C6","\u25C7","\u25BA","\u25B8","\xB7","\u2022","\u25CF","\u25CB"].some(Ra=>vi.includes(Ra))||vi.length===1&&!/[0-9a-zA-Z]/.test(vi)?v="unordered":(/^[0-9ivxlcdm]+[\.\)]/i.test(vi)||/^[a-z][\.\)]/i.test(vi))&&(v="ordered")}vt=!0}if(vt)return;if(d+="{",ui){let He=wt(F);He&&(c.push(He),!E&&!S&&(ut(),x.push({type:"image",text:"",metadata:{attachmentName:He.name||`image_${c.length}`}})));for(let vi of F.content)if(vi.type==="control")d+=At(vi);else if(vi.type==="text")d+=Nt(vi);else if(vi.type==="group"){let Gc=Wn=>{for(let Ra of Wn.content)Ra.type==="control"?d+=At(Ra):Ra.type==="text"?d+=Nt(Ra):Ra.type==="group"&&(d+="{",Gc(Ra),d+="}")};Gc(F)}d+="}";return}let Ai=x;if(Rt){if(t.ignoreNotes)return;ut(),K++;let He="footnote";W===1?He="endnote":W===2&&(He=F.content.some(Wn=>Wn.type==="control"&&Wn.value==="ftnalt")?"endnote":"footnote");let vi={type:"note",children:[],metadata:{noteId:K.toString(),noteType:He}};l.push(vi),x=vi.children}let Vm={...q};for(let He of F.content){if(He.type==="group"&&He.destination==="fldinst"){d+="{";let vi=Gc=>{for(let Wn of Gc.content)Wn.type==="control"?d+=At(Wn):Wn.type==="text"?d+=Nt(Wn):Wn.type==="group"&&(d+="{",vi(Wn),d+="}")};vi(He),d+="}";continue}bt(He,Vm,Et+1)}F.destination==="listtable"?E=!1:F.destination==="list"?(S=!1,N!==void 0&&P!==void 0&&($[N]=P)):F.destination==="listoverridetable"?G=!1:G&&F.destination==="listoverride"&&z!==void 0&&O!==void 0&&(it[z]=O),Rt&&(ut(),x=Ai),xe&&(Y(),Q=void 0),d+="}"}else if(F.type==="text"){if(E||G){d+=Nt(F);return}J(m,q)&&(Y(),m={...q}),f+=F.value,d+=Nt(F)}else if(F.type==="control"){if(d+=At(F),E){if(F.value==="listid")N=F.param;else if(F.value==="levelnfc"||F.value==="levelnfcn"){let dt=F.param!==void 0&&(F.param===0||F.param>=0&&F.param<=4);(!P||P==="unordered"&&dt)&&(P=dt?"ordered":"unordered")}return}if(G){F.value==="listid"?O=F.param:F.value==="ls"&&(z=F.param);return}if(F.value==="par")ut(),m={...q};else if(F.value==="trowd"){let dt=V();tt&&dt&&dt.currentCellContent.length>0?(U(),R.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})):tt||(tt=!0,U()),et=!0,ot=[],L={isMergedContinuation:!1},T=0}else if(F.value==="clvmrg")L.isMergedContinuation=!0;else if(F.value==="clmgf")L.isMergedContinuation=!1;else if(F.value==="cellx")ot.push({...L}),L={isMergedContinuation:!1};else if(F.value==="cell"){et=!0;let dt=!1;T<ot.length&&(dt=ot[T].isMergedContinuation),T++;let vt=lt();if(vt&&!dt){let Rt=V();Rt&&Rt.currentCells.push(vt)}m={...q}}else if(F.value==="nestcell"){if(R.length>1){let vt=V();vt&&(vt.rows.length>0||vt.currentCells.length>0)&&Tt()}et=!0;let dt=lt();if(dt){let vt=V();vt&&vt.currentCells.push(dt)}m={...q}}else if(F.value==="row")gt(),m={...q},T=0,et=!1;else if(F.value==="nestrow")R.length>1&&Tt(),gt(),m={...q},T=0;else if(F.value==="intbl")tt=!0,et=!0,U();else if(F.value==="pard")et=!1,y=0,A="left",w=!1,v=void 0,C=void 0,D=void 0,q.backgroundColor=void 0;else if(F.value==="tab")J(m,q)&&(Y(),m={...q}),f+=" ";else if(F.value==="line")J(m,q)&&(Y(),m={...q}),f+=`
94
+ `;else if(F.value==="lquote")J(m,q)&&(Y(),m={...q}),f+="\u2018";else if(F.value==="rquote")J(m,q)&&(Y(),m={...q}),f+="\u2019";else if(F.value==="ldblquote")J(m,q)&&(Y(),m={...q}),f+="\u201C";else if(F.value==="rdblquote")J(m,q)&&(Y(),m={...q}),f+="\u201D";else if(F.value==="u"){if(F.param!==void 0){let dt=F.param;dt<0&&(dt+=65536),J(m,q)&&(Y(),m={...q}),f+=String.fromCharCode(dt)}}else if(F.value==="b")q.bold=F.param!==0;else if(F.value==="i")q.italic=F.param!==0;else if(F.value==="ul")q.underline=F.param!==0;else if(F.value==="ulnone")q.underline=!1;else if(F.value==="strike")q.strikethrough=F.param!==0;else if(F.value==="plain")q.bold=!1,q.italic=!1,q.underline=!1,q.strikethrough=!1,q.subscript=!1,q.superscript=!1,q.size=void 0,q.font=void 0,q.color=void 0,q.backgroundColor=void 0;else if(F.value==="fs")F.param!==void 0&&(q.size=(F.param/2).toString()+"pt");else if(F.value==="f")F.param!==void 0&&n[F.param]&&(q.font=n[F.param]);else if(F.value==="cf")F.param!==void 0&&s[F.param]&&(q.color=s[F.param]);else if(F.value==="fet")F.param!==void 0&&(W=F.param);else if(F.value==="cb"||F.value==="highlight"||F.value==="chcbpat"||F.value==="cbpat")F.param!==void 0&&s[F.param]&&(q.backgroundColor=s[F.param]);else if(F.value==="sub")q.subscript=!0,q.superscript=!1;else if(F.value==="super")q.superscript=!0,q.subscript=!1;else if(F.value==="nosupersub")q.subscript=!1,q.superscript=!1;else if(F.value==="li")F.param!==void 0&&(y=Math.floor(F.param/360));else if(F.value==="ls"){if(F.param!==void 0){w||(y=0),w=!0,M[F.param]||(I++,M[F.param]=`rtf-list-${I}`),D=M[F.param];let dt=it[F.param]!==void 0?it[F.param]:F.param;$[dt]&&(v=$[dt])}}else F.value==="ilvl"?F.param!==void 0&&(w=!0,y=F.param):F.value==="pnlvl"?(w=!0,F.param!==void 0&&(y=F.param)):F.value==="levelnfc"||F.value==="pnf"?F.param!==void 0&&(w=!0,F.param===23?v="unordered":v="ordered"):F.value==="pndec"||F.value==="pnord"||F.value==="pnlcltr"||F.value==="pnucltr"?(w||(y=0),w=!0,v="ordered"):F.value==="pnbullet"||F.value==="pncard"?(w||(y=0),w=!0,v="unordered"):F.value==="s"?F.param!==void 0&&F.param>=1&&F.param<=9&&(C=F.param):F.value==="ql"?A="left":F.value==="qc"?A="center":F.value==="qr"?A="right":F.value==="qj"&&(A="justify")}};bt(i,{});let yt=V();if((tt||yt&&(yt.rows.length>0||yt.currentCells.length>0))&&Tt(),ut(),!t.putNotesAtLast&&l.length>0&&(o.push(...l),l.length=0),t.ocr&&t.extractAttachments){for(let q of c)if(q.mimeType.startsWith("image/"))try{let Et=at.Buffer.from(q.data,"base64");q.ocrText=(await Jn(Et,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(Et){ln(`OCR failed for ${q.name}:`,t,Et)}let F=q=>{for(let Et of q){if(Et.type==="image"&&Et.metadata&&"attachmentName"in Et.metadata){let dt=Et.metadata,vt=c.find(Rt=>Rt.name===dt.attachmentName);vt&&(vt.ocrText&&(Et.text=vt.ocrText),vt.altText&&(dt.altText=vt.altText))}Et.children&&F(Et.children)}};F(o)}let kt=F=>{for(let q of F){if(q.type==="note"&&q.children){let Et=dt=>dt.children&&dt.children.length>0?dt.children.map(Et).join(""):dt.text||"";q.text=q.children.map(Et).join("").trim()}q.children&&kt(q.children)}};kt(o),kt(l);let _t={type:"rtf",metadata:{},content:o,attachments:c,toText:()=>{let F=o.map(q=>q.text).join(t.newlineDelimiter??`
95
+ `);return t.putNotesAtLast&&l.length>0&&(F+=(t.newlineDelimiter??`
96
+ `)+l.map(q=>q.text).join(t.newlineDelimiter??`
97
+ `)),F}};return t.putNotesAtLast&&l.length>0&&o.push(...l),_t}catch(e){throw e}};function UM(r){let t={},e=i=>{for(let n of i.content)if(n.type==="group"){if(n.destination==="fonttbl"){for(let s of n.content)if(s.type==="group"){let o,l="";for(let c of s.content)c.type==="control"&&c.value==="f"?o=c.param:c.type==="text"&&(l+=c.value);o!==void 0&&l&&(l=l.replace(/;$/,"").trim(),t[o]=l)}return!0}if(e(n))return!0}return!1};return e(r),t}function zM(r){let t={},e=i=>{for(let n of i.content)if(n.type==="group"){if(n.destination==="colortbl"){let s=0,o=0,l=0,c=0;for(let u of n.content)if(u.type==="control")u.value==="red"&&u.param!==void 0?o=u.param:u.value==="green"&&u.param!==void 0?l=u.param:u.value==="blue"&&u.param!==void 0&&(c=u.param);else if(u.type==="text"&&u.value===";"){let h=`#${o.toString(16).padStart(2,"0")}${l.toString(16).padStart(2,"0")}${c.toString(16).padStart(2,"0")}`;t[s]=h,s++,o=0,l=0,c=0}return!0}if(e(n))return!0}return!1};return e(r),t}H();var GS=async(r,t)=>{let e=/word\/document[\d+]?.xml/,i=/word\/footnotes[\d+]?.xml/,n=/word\/endnotes[\d+]?.xml/,s=/word\/numbering[\d+]?.xml/,o=/(word\/)?media\/.*/,l=/docProps\/core[\d+]?.xml/,c=/docProps\/custom\.xml/,u=/word\/_rels\/document[\d+]?.xml\.rels/,h=/word\/styles[\d+]?.xml/,d=E=>{let S={},N=xg(E),P=(lt,gt)=>{let Tt=new RegExp(`<${gt}(?:\\s+w:val="([^"]+)")?\\s*\\/?>`),st=lt.match(Tt);if(st){let ht=st[1];return ht===void 0?!0:ht==="1"||ht==="true"||ht==="on"}return null},$=P(N,"w:b");$!==null&&(S.bold=$);let G=P(N,"w:i");G!==null&&(S.italic=G);let O=N.match(/<w:u(?: w:val="([^"]+)")?\/?>/);if(O){let lt=O[1];(!lt||lt!=="none")&&(S.underline=!0)}let z=P(N,"w:strike"),it=P(N,"w:dstrike");z!==null?S.strikethrough=z:it!==null&&(S.strikethrough=it);let X=N.match(/<w:sz w:val="(\d+)"/);X&&(S.size=(parseInt(X[1],10)/2).toString()+"pt");let Q=N.match(/<w:color w:val="([^"]+)"/);Q&&Q[1]!=="auto"&&(S.color="#"+Q[1]);let J=N.match(/<w:shd[^>]*w:fill="([^"]+)"/);J&&J[1]!=="auto"&&(S.backgroundColor="#"+J[1]);let Y=N.match(/<w:highlight w:val="([^"]+)"/);if(Y&&Y[1]!=="none"){let lt={yellow:"#FFFF00",green:"#00FF00",cyan:"#00FFFF",magenta:"#FF00FF",blue:"#0000FF",red:"#FF0000",darkBlue:"#00008B",darkCyan:"#008B8B",darkGreen:"#006400",darkMagenta:"#8B008B",darkRed:"#8B0000",darkYellow:"#808000",darkGray:"#A9A9A9",lightGray:"#D3D3D3",black:"#000000"};S.backgroundColor=lt[Y[1]]||Y[1]}let ct=N.match(/<w:rFonts[^>]*w:ascii="([^"]+)"/);if(ct)S.font=ct[1];else{let lt=N.match(/<w:rFonts[^>]*w:hAnsi="([^"]+)"/);lt&&(S.font=lt[1])}let ut=N.match(/<w:vertAlign w:val="([^"]+)"/);return ut&&(ut[1]==="subscript"&&(S.subscript=!0),ut[1]==="superscript"&&(S.superscript=!0)),S},f=E=>{let S=pt(E,"w:ind");if(S){let N={},P=S.getAttribute("w:left")||S.getAttribute("w:start"),$=S.getAttribute("w:right")||S.getAttribute("w:end"),G=S.getAttribute("w:firstLine"),O=S.getAttribute("w:hanging");return P&&(N.left=parseInt(P,10)),$&&(N.right=parseInt($,10)),G&&(N.firstLine=parseInt(G,10)),O&&(N.hanging=parseInt(O,10)),Object.keys(N).length>0?N:void 0}},m=await Va(r,E=>!!E.match(e)||!!E.match(i)||!!E.match(n)||!!E.match(s)||!!E.match(l)||!!E.match(c)||!!E.match(u)||!!E.match(h)||!!t.extractAttachments&&!!E.match(o)),x=m.find(E=>E.path.match(l)),y=x?Ga(x.content.toString()):{},A=m.find(E=>E.path.match(c));if(A){let E=mu(A.content.toString());Object.keys(E).length>0&&(y.customProperties=E)}let w=new Map,v=new Map,C=[],D=[],_=m.filter(E=>E.path.match(o)),k=m.find(E=>E.path.match(u)),R={};if(k){let E=ee(k.content.toString()),S=nt(E,"Relationship");for(let N of S){let P=N.getAttribute("Id"),$=N.getAttribute("Target");P&&$&&(R[P]=$)}}let K=m.find(E=>E.path.match(s)),W={};if(K){let E=ee(K.content.toString()),S=nt(E,"w:num"),N=nt(E,"w:abstractNum"),P={};for(let $ of N){let G=$.getAttribute("w:abstractNumId");G&&(P[G]=$)}for(let $ of S){let G=$.getAttribute("w:numId"),z=pt($,"w:abstractNumId")?.getAttribute("w:val");if(G&&z&&P[z]){W[G]={};let it=nt(P[z],"w:lvl");for(let X of it){let Q=X.getAttribute("w:ilvl"),J=pt(X,"w:numFmt"),Y=pt(X,"w:lvlText");Q&&(W[G][Q]={numFmt:J?.getAttribute("w:val")||"decimal",lvlText:Y?.getAttribute("w:val")||""})}}}}let V=m.find(E=>E.path.match(h)),U={};if(V){let E=ee(V.content.toString()),S=nt(E,"w:style");for(let N of S){let P=N.getAttribute("w:styleId");if(P){let $=pt(N,"w:rPr"),G=pt(N,"w:pPr"),O=$?d($):{},z,it,X;if(G){let Q=pt(G,"w:jc");if(Q){let ct=Q.getAttribute("w:val");(ct==="left"||ct==="center"||ct==="right"||ct==="justify")&&(z=ct)}let J=pt(G,"w:shd");if(J){let ct=J.getAttribute("w:fill");ct&&ct!=="auto"&&(it="#"+ct)}let Y=f(G);Y&&(X=Y)}U[P]={formatting:O,alignment:z,backgroundColor:it,paragraphIndentation:X}}}}let tt={};if(V){let E=ee(V.content.toString()),S=pt(E,"w:docDefaults");if(S){let N=pt(S,"w:rPrDefault");if(N){let P=pt(N,"w:rPr");P&&(tt=d(P))}}}let et;if(V){let E=ee(V.content.toString()),S=nt(E,"w:style");for(let N of S){let P=N.getAttribute("w:type"),$=N.getAttribute("w:default"),G=N.getAttribute("w:styleId");if(P==="paragraph"&&$==="1"&&G){et=G;break}}!et&&U.Normal&&(et="Normal")}let B=[],ot=[],L={},T={},I=(E,S)=>{let N=E.toString(),P=pt(E,"w:numPr"),$=!!P,G=pt(E,"w:pPr"),z=(G?pt(G,"w:pStyle"):null)?.getAttribute("w:val"),it=z?z.startsWith("Heading")||z==="Title":!1,X=z&&U[z]?U[z]:{formatting:{}},Q=X.alignment;if(G){let st=pt(G,"w:jc");if(st){let ht=st.getAttribute("w:val");(ht==="left"||ht==="center"||ht==="right"||ht==="justify")&&(Q=ht)}}let J=X.paragraphIndentation;if(G){let st=f(G);st&&(J={...J,...st})}let Y=X.backgroundColor;if(G){let st=pt(G,"w:shd");if(st){let ht=st.getAttribute("w:fill");ht&&ht!=="auto"&&(Y="#"+ht)}}let ct={...X.formatting};if(G){let st=pt(G,"w:rPr");if(st){let ht=d(st);for(let ft in ht){let wt=ht[ft];wt===!1?delete ct[ft]:wt!==void 0&&(ct[ft]=wt)}}}let ut="",lt=[],gt=st=>{if(Qe(st)&&st.nodeName==="w:r"){let ht=st,ft=pt(ht,"w:rPr"),wt={};for(let bt in ct)wt[bt]=ct[bt];let At=ft?pt(ft,"w:rStyle"):null,Nt=At?At.getAttribute("w:val"):z;if(Nt&&U[Nt])for(let bt in U[Nt].formatting)wt[bt]=U[Nt].formatting[bt];if(ft){let bt=d(ft);for(let yt in bt){let kt=bt[yt];kt===!1?delete wt[yt]:kt!==void 0&&(wt[yt]=kt)}}!wt.backgroundColor&&Y&&(wt.backgroundColor=Y);for(let bt of ht.childNodes)if(Qe(bt)){if(bt.tagName==="w:t"||bt.tagName==="t"){let yt=bt,kt=yt.textContent||"";ut+=kt;let _t={type:"text",text:kt,formatting:wt};t.includeRawContent&&(_t.rawContent=Zt(yt,S,t));let F=Nt||z||et;F&&(_t.metadata={style:F}),lt.push(_t)}else if(t.includeBreakNodes&&(bt.tagName==="w:br"||bt.tagName==="br"||bt.tagName==="w:cr"||bt.tagName==="cr")){let yt=bt,kt="textWrapping";if(bt.tagName==="w:cr"||bt.tagName==="cr")kt="carriageReturn";else{let q=yt.getAttribute("w:type")||yt.getAttribute("type");q!==null&&(kt=q)}let _t;kt==="textWrapping"&&yt.getAttribute("w:clear")!==null&&(_t=yt.getAttribute("w:clear"));let F={type:"break",metadata:{breakType:kt,clear:_t}};t.includeRawContent&&(F.rawContent=Zt(yt,S,t)),lt.push(F)}else if(t.includeBreakNodes&&(bt.tagName==="w:lastRenderedPageBreak"||bt.tagName==="lastRenderedPageBreak")){let yt={type:"break",metadata:{breakType:"lastRenderedPage"}};t.includeRawContent&&(yt.rawContent=Zt(bt,S,t)),lt.push(yt)}}if(t.extractAttachments){let bt=nt(ht,"w:drawing"),yt=nt(ht,"w:pict"),kt=[...bt,...yt];for(let _t of kt){let F=xg(_t),q="",Et=pt(_t,"wp:docPr");Et&&(q=Et.getAttribute("descr")||Et.getAttribute("title")||"");let dt="",vt=pt(_t,"a:blip");if(vt)dt=vt.getAttribute("r:embed")||"";else{let Rt=pt(_t,"v:imagedata");Rt&&(dt=Rt.getAttribute("r:id")||"")}if(dt&&R[dt]){let xe=R[dt].split("/").pop();if(xe){let ui={type:"image",text:"",metadata:{attachmentName:xe,altText:q}};t.includeRawContent&&(ui.rawContent=Zt(_t,S,t)),lt.push(ui)}}else{let Rt={type:"image",text:""};t.includeRawContent&&(Rt.rawContent=Zt(_t,S,t)),lt.push(Rt)}}}if(!t.ignoreNotes){let bt=pt(ht,"w:footnoteReference");if(bt){let kt=bt.getAttribute("w:id");if(kt&&w.has(kt)){let _t=w.get(kt),F={type:"note",text:_t.map(q=>q.text).join(" "),children:_t,metadata:{noteType:"footnote",noteId:kt}};t.putNotesAtLast?C.push(F):lt.push(F)}}let yt=pt(ht,"w:endnoteReference");if(yt){let kt=yt.getAttribute("w:id");if(kt&&v.has(kt)){let _t=v.get(kt),F={type:"note",text:_t.map(q=>q.text).join(" "),children:_t,metadata:{noteType:"endnote",noteId:kt}};t.putNotesAtLast?C.push(F):lt.push(F)}}}}else if(Qe(st)&&st.nodeName==="w:hyperlink"){let ht=st,ft=ht.getAttribute("r:id"),wt=ht.getAttribute("w:anchor"),At;wt?At={link:"#"+wt,linkType:"internal"}:ft&&R[ft]&&(At={link:R[ft],linkType:"external"});let Nt=Array.from(ht.childNodes);for(let bt of Nt){let yt=lt.length;if(gt(bt),At)for(let kt=yt;kt<lt.length;kt++)lt[kt].type==="text"&&(lt[kt].metadata={...lt[kt].metadata??{},...At})}}},Tt=Array.from(E.childNodes);for(let st of Tt)gt(st);if($){let st=pt(P,"w:numId"),ht=pt(P,"w:ilvl"),ft=st&&st.getAttribute("w:val")||"0",wt=ht?parseInt(ht.getAttribute("w:val")||"0",10):0,At="ordered",Nt=0;if(ft&&W[ft]){let yt=wt.toString();L[ft]||(L[ft]={}),L[ft][yt]||(L[ft][yt]=0),L[ft][yt]++;for(let _t=wt+1;_t<10;_t++)L[ft][_t.toString()]&&(L[ft][_t.toString()]=0);At=(W[ft][yt]?.numFmt||"decimal")==="bullet"?"unordered":"ordered",T[ft]||(T[ft]={}),T[ft][yt]===void 0?T[ft][yt]=0:T[ft][yt]++,Nt=T[ft][yt]}let bt={type:"list",text:ut,children:lt,metadata:{listType:At,indentation:wt,paragraphIndentation:J,alignment:Q||"left",listId:ft,itemIndex:Nt,style:z}};return t.includeRawContent&&(bt.rawContent=Zt(E,S,t)),bt}else if(it){let st=z&&parseInt(z.replace("Heading",""),10)||1,ht={type:"heading",text:ut,children:lt,metadata:{level:st,alignment:Q,paragraphIndentation:J,style:z??void 0}};return t.includeRawContent&&(ht.rawContent=Zt(E,S,t)),ht}else{let st={type:"paragraph",text:ut,children:lt,metadata:{alignment:Q,paragraphIndentation:J,style:z??void 0}};return t.includeRawContent&&(st.rawContent=Zt(E,S,t)),st}},M=(E,S)=>{let N=[],P=$e(E,"w:tr");for(let $=0;$<P.length;$++){let G=P[$],O=[],z=$e(G,"w:tc");for(let X=0;X<z.length;X++){let Q=z[X],J=[],Y="",ct=Array.from(Q.childNodes);for(let lt of ct)if(Qe(lt)&&lt.nodeName==="w:p"){let gt=I(lt,S);J.push(gt),Y+=gt.text}else if(Qe(lt)&&lt.nodeName==="w:tbl"){let gt=M(lt,S);J.push(gt)}let ut={type:"cell",text:Y,children:J,metadata:{row:$,col:X}};O.push(ut)}let it={type:"row",children:O};N.push(it)}return{type:"table",children:N}};if(!t.ignoreNotes){let E=m.find(N=>N.path.match(i));if(E){let N=ee(E.content.toString()),P=E.content.toString(),$=nt(N,"w:footnote");for(let G of $){let O=G.getAttribute("w:id");if(!O||O==="-1"||O==="0")continue;let z=nt(G,"w:p");w.set(O,z.map(it=>I(it,P)))}}let S=m.find(N=>N.path.match(n));if(S){let N=ee(S.content.toString()),P=S.content.toString(),$=nt(N,"w:endnote");for(let G of $){let O=G.getAttribute("w:id");if(!O||O==="-1"||O==="0")continue;let z=nt(G,"w:p");v.set(O,z.map(it=>I(it,P)))}}}for(let E of m){if(E.path.match(o)||E.path.match(s)||E.path.match(u)||E.path.match(h)||E.path.match(i)||E.path.match(n))continue;let S=E.content.toString();t.includeRawContent&&ot.push(S);let N=ee(S,{locator:t.includeRawContent}),P=pt(N,"w:body");if(P){let $=Array.from(P.childNodes);for(let G of $)Qe(G)&&G.nodeName==="w:p"?B.push(I(G,S)):Qe(G)&&G.nodeName==="w:tbl"&&B.push(M(G,S))}}if(t.extractAttachments){for(let E of _){let S=Ar(E.path.split("/").pop()||"image",E.content);if(D.push(S),t.ocr&&S.mimeType.startsWith("image/"))try{S.ocrText=(await Jn(E.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(N){ln(`OCR failed for ${S.name}:`,t,N)}}if(t.ocr){let E=S=>{for(let N of S){if(N.type==="image"&&"attachmentName"in(N.metadata||{})){let P=N.metadata,$=D.find(G=>G.name===P.attachmentName);$&&$.ocrText&&(N.text=$.ocrText,$.altText=P.altText)}N.children&&E(N.children)}};E(B)}}return t.putNotesAtLast&&C.length>0&&B.push(...C),{type:"docx",metadata:{...y,formatting:tt,styleMap:U},content:B,attachments:D,toText:()=>B.map(E=>{let S=N=>{let P="";return N.children?P+=N.children.map(S).filter($=>$!="").join(N.children[0]?.children?t.newlineDelimiter??`
98
+ `:""):N.type==="break"?P+=t.newlineDelimiter??`
99
+ `:P+=N.text||"",P};return S(E)}).filter(E=>E!="").join(t.newlineDelimiter??`
100
+ `)}};var Sd=class{static async parseOffice(t,e,i){let n,s={};typeof e=="function"?(n=e,s=i||{}):s=e||{};let o={ignoreNotes:!1,newlineDelimiter:`
101
+ `,putNotesAtLast:!1,outputErrorToConsole:!1,extractAttachments:!1,ocr:!1,ocrLanguage:"eng",includeRawContent:!1,serializeRawContent:!0,preserveXmlWhitespace:!1,pdfWorkerSrc:"",ocrConfig:{},includeBreakNodes:!1,...s},l=at.Buffer.alloc(0),c="",u;try{if(!t)throw Rs("IMPROPER_ARGUMENTS",o);if(t instanceof ArrayBuffer)l=at.Buffer.from(t);else if(at.Buffer.isBuffer(t))l=t;else if(typeof t=="string"){u=t,Qm("path-parsing");let d=await Promise.resolve().then(()=>(JS(),QS));if(!d.existsSync(t))throw Rs("FILE_DOES_NOT_EXIST",o,t);if(d.lstatSync(t).isDirectory())throw Rs("LOCATION_NOT_FOUND",o,t);l=d.readFileSync(t),c=t.split(".").pop()?.toLowerCase()||""}else throw Rs("INVALID_INPUT",o);if(!c){let{fileTypeFromBuffer:d}=await BS(),f=await d(l);if(f)c=f.ext.toLowerCase();else throw Rs("IMPROPER_BUFFERS",o)}let h;switch(c){case"docx":h=await GS(l,o);break;case"pptx":h=await jS(l,o);break;case"xlsx":h=await zE(l,o);break;case"odt":case"odp":case"ods":h=await jE(l,o);break;case"pdf":h=await zS(l,o);break;case"rtf":h=await HS(l,o);break;default:throw Rs("EXTENSION_UNSUPPORTED",o,c)}return n&&n(h),h}catch(h){let d=_v(h,o,u);throw n&&n(void 0,d),d}}static async terminateOcr(){await AE()}};var YL=Sd.parseOffice,KL=Sd.terminateOcr;var ZL=Sd;export{Sd as OfficeParser,ZL as default,YL as parseOffice,KL as terminateOcr};
102
+ /*! Bundled license information:
103
+
104
+ ieee754/index.js:
105
+ (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
106
+
107
+ buffer/index.js:
108
+ (*!
109
+ * The buffer module from node.js, for the browser.
110
+ *
111
+ * @author Feross Aboukhadijeh <https://feross.org>
112
+ * @license MIT
113
+ *)
114
+ */