diff --git a/README.md b/README.md index ef10775..8b780df 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ npx officeparser /path/to/officeFile.docx --ignoreNotes=true --newlineDelimiter= - `--extractAttachments=[true|false]` Flag to extract images/charts as Base64. Default is false. - `--ocr=[true|false]` Flag to enable OCR for extracted images. Default is false. - `--includeRawContent=[true|false]` Flag to include raw XML/RTF content in nodes. Default is false. +- `--includeBreakNodes=[true|false]` Flag to include break nodes. Currently only available for DOCX documents - `--verbose=[true|false]` Show full error stack traces. @@ -277,13 +278,28 @@ Formatting can be found at two levels: 1. **Node Level**: Applied directly to a text run or paragraph. 2. **Document Level**: Found in `ast.metadata.formatting` (defaults) or `ast.metadata.styleMap` (named styles). -### 6. Advanced Metadata +### 6. Breaks +Breaks are currently only supported when parsing DOCX-documents. Breaks are added as a node of type `break` and carry metadata of the type `BreakMetadata`. + +```text +Break Node +├── type: "break" +└── metadata: { + breakType: "lineWrapping" | "page" | "column", + clear?: "all" | "left" | "none" | "right" + } +``` + +- `breakType`: Type of break. "lineWrapping" means just a simple line break, "page" a page break and "column" a break to the next column +- `clear`: This field is only relevant when `breakType` is set to "lineWrapping". This indicates how breaking to next line should be handled when there are e.g. floating objects in the document. + +### 7. Advanced Metadata The `ast.metadata` object provides document-wide context: - **`styleMap`**: A dictionary of style names to their `TextFormatting` definitions found in the document. - **`formatting`**: Document-wide default settings (e.g., default font or font size). - **`customProperties`**: A dictionary of user-defined metadata embedded in the document (OOXML `custom.xml`, ODF `meta:user-defined`, or PDF Info dictionary). -### 7. Custom Properties +### 8. Custom Properties You can access custom user-defined metadata that might be embedded in the document: ```javascript @@ -403,6 +419,7 @@ Pass an optional config object as the second argument to `parseOffice`. | `ocrConfig.workerPath` | string | `undefined` | Path to Tesseract worker script (for offline use). | | `ocrConfig.corePath` | string | `undefined` | Path to Tesseract core script (for offline use). | | `ocrConfig.langPath` | string | `undefined` | Path for Tesseract language files (for offline use). | +| `includeBreakNodes` | boolean | `false` | Specifically targets Word documents (DOCX). When set to true, officeParser will also parse `w:br`, `w:cr` and `w:lastRenderedPageBreak` nodes.| ### OCR Scheduler & Resource Management If your application uses OCR, `officeParser` utilizes an intelligent **Smart Worker Pool** to maintain a background worker pool and optimize repeated parse requests. diff --git a/docs/dist/officeparser.browser.iife.js b/docs/dist/officeparser.browser.iife.js index a321046..ebec450 100644 --- a/docs/dist/officeparser.browser.iife.js +++ b/docs/dist/officeparser.browser.iife.js @@ -3,16 +3,16 @@ if (typeof setImmediate === 'undefined') { window.setImmediate = function(callback) { return setTimeout(callback, 0); }; } -"use strict";var officeParser=(()=>{var tD=Object.create;var vd=Object.defineProperty;var eD=Object.getOwnPropertyDescriptor;var iD=Object.getOwnPropertyNames;var nD=Object.getPrototypeOf,rD=Object.prototype.hasOwnProperty;var $w=r=>{throw TypeError(r)};var sD=(r,t,e)=>t in r?vd(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Vm=(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 Kt=(r,t)=>()=>(r&&(t=r(r=0)),t);var Ut=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),qm=(r,t)=>{for(var e in t)vd(r,e,{get:t[e],enumerable:!0})},Vw=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of iD(t))!rD.call(r,n)&&n!==e&&vd(r,n,{get:()=>t[n],enumerable:!(i=eD(t,n))||i.enumerable});return r};var Hc=(r,t,e)=>(e=r!=null?tD(nD(r)):{},Vw(t||!r||!r.__esModule?vd(e,"default",{value:r,enumerable:!0}):e,r)),aD=r=>Vw(vd({},"__esModule",{value:!0}),r);var z=(r,t,e)=>sD(r,typeof t!="symbol"?t+"":t,e),Gx=(r,t,e)=>t.has(r)||$w("Cannot "+e);var a=(r,t,e)=>(Gx(r,t,"read from private field"),e?e.call(r):t.get(r)),x=(r,t,e)=>t.has(r)?$w("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),p=(r,t,e,i)=>(Gx(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e),b=(r,t,e)=>(Gx(r,t,"access private method"),e);var Ye=(r,t,e,i)=>({set _(n){p(r,t,n,e)},get _(){return a(r,t,i)}});var Xw=Ut(Wm=>{"use strict";H();Wm.byteLength=lD;Wm.toByteArray=uD;Wm.fromByteArray=fD;var Ur=[],$n=[],oD=typeof Uint8Array<"u"?Uint8Array:Array,$x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Uo=0,qw=$x.length;Uo0)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=Ww(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=Ww(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>16&255,s[o++]=t>>8&255,s[o++]=t&255;return n===2&&(t=$n[r.charCodeAt(c)]<<2|$n[r.charCodeAt(c+1)]>>4,s[o++]=t&255),n===1&&(t=$n[r.charCodeAt(c)]<<10|$n[r.charCodeAt(c+1)]<<4|$n[r.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function hD(r){return Ur[r>>18&63]+Ur[r>>12&63]+Ur[r>>6&63]+Ur[r&63]}function dD(r,t,e){for(var i,n=[],s=t;sl?l:o+s));return i===1?(t=r[e-1],n.push(Ur[t>>2]+Ur[t<<4&63]+"==")):i===2&&(t=(r[e-2]<<8)+r[e-1],n.push(Ur[t>>10]+Ur[t>>4&63]+Ur[t<<2&63]+"=")),n.join("")}});var qx=Ut(Vx=>{H();Vx.read=function(r,t,e,i,n){var s,o,l=n*8-i-1,c=(1<>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)};Vx.write=function(r,t,e,i,n,s){var o,l,c,u=s*8-n-1,h=(1<>1,f=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=i?0:s-1,y=i?1:-1,g=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+=y,l/=256,n-=8);for(o=o<0;r[e+m]=o&255,m+=y,o/=256,u-=8);r[e+m-y]|=g*128}});var hA=Ut(qc=>{"use strict";H();var Wx=Xw(),$c=qx(),Yw=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;qc.Buffer=K;qc.SlowBuffer=bD;qc.INSPECT_MAX_BYTES=50;var Xm=2147483647;qc.kMaxLength=Xm;K.TYPED_ARRAY_SUPPORT=pD();!K.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(K.prototype,"parent",{enumerable:!0,get:function(){if(K.isBuffer(this))return this.buffer}});Object.defineProperty(K.prototype,"offset",{enumerable:!0,get:function(){if(K.isBuffer(this))return this.byteOffset}});function Ss(r){if(r>Xm)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,K.prototype),t}function K(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 Zx(r)}return Jw(r,t,e)}K.poolSize=8192;function Jw(r,t,e){if(typeof r=="string")return gD(r,t);if(ArrayBuffer.isView(r))return xD(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(zr(r,ArrayBuffer)||r&&zr(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(zr(r,SharedArrayBuffer)||r&&zr(r.buffer,SharedArrayBuffer)))return Yx(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 K.from(i,t,e);let n=yD(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return K.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)}K.from=function(r,t,e){return Jw(r,t,e)};Object.setPrototypeOf(K.prototype,Uint8Array.prototype);Object.setPrototypeOf(K,Uint8Array);function tA(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 tA(r),r<=0?Ss(r):t!==void 0?typeof e=="string"?Ss(r).fill(t,e):Ss(r).fill(t):Ss(r)}K.alloc=function(r,t,e){return mD(r,t,e)};function Zx(r){return tA(r),Ss(r<0?0:Qx(r)|0)}K.allocUnsafe=function(r){return Zx(r)};K.allocUnsafeSlow=function(r){return Zx(r)};function gD(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!K.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=eA(r,t)|0,i=Ss(e),n=i.write(r,t);return n!==e&&(i=i.slice(0,n)),i}function Xx(r){let t=r.length<0?0:Qx(r.length)|0,e=Ss(t);for(let i=0;i=Xm)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Xm.toString(16)+" bytes");return r|0}function bD(r){return+r!=r&&(r=0),K.alloc(+r)}K.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==K.prototype};K.compare=function(t,e){if(zr(t,Uint8Array)&&(t=K.from(t,t.offset,t.byteLength)),zr(e,Uint8Array)&&(e=K.from(e,e.offset,e.byteLength)),!K.isBuffer(t)||!K.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);sn.length?(K.isBuffer(o)||(o=K.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(K.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function eA(r,t){if(K.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||zr(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 Kx(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return uA(r).length;default:if(n)return i?-1:Kx(r).length;t=(""+t).toLowerCase(),n=!0}}K.byteLength=eA;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 _D(this,t,e);case"utf8":case"utf-8":return nA(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 ND(this,t,e);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}K.prototype._isBuffer=!0;function zo(r,t,e){let i=r[t];r[t]=r[e],r[e]=i}K.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;ee&&(t+=" ... "),""};Yw&&(K.prototype[Yw]=K.prototype.inspect);K.prototype.compare=function(t,e,i,n,s){if(zr(t,Uint8Array)&&(t=K.from(t,t.offset,t.byteLength)),!K.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;d2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,ty(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=K.from(t,i)),K.isBuffer(t))return t.length===0?-1:Kw(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):Kw(r,[t],e,i,n);throw new TypeError("val must be string, number or Buffer")}function Kw(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;uo&&(e=o-l),u=e;u>=0;u--){let h=!0;for(let d=0;dn&&(i=n)):i=n;let s=t.length;i>s/2&&(i=s/2);let o;for(o=0;o>>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}};K.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?Wx.fromByteArray(r):Wx.fromByteArray(r.slice(t,e))}function nA(r,t,e){e=Math.min(r.length,e);let i=[],n=t;for(;n239?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 Zw=4096;function DD(r){let t=r.length;if(t<=Zw)return String.fromCharCode.apply(String,r);let e="",i=0;for(;ii)&&(e=i);let n="";for(let s=t;si&&(t=i),e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),ee)throw new RangeError("Trying to access beyond buffer length")}K.prototype.readUintLE=K.prototype.readUIntLE=function(t,e,i){t=t>>>0,e=e>>>0,i||li(t,e,this.length);let n=this[t],s=1,o=0;for(;++o>>0,e=e>>>0,i||li(t,e,this.length);let n=this[t+--e],s=1;for(;e>0&&(s*=256);)n+=this[t+--e]*s;return n};K.prototype.readUint8=K.prototype.readUInt8=function(t,e){return t=t>>>0,e||li(t,1,this.length),this[t]};K.prototype.readUint16LE=K.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||li(t,2,this.length),this[t]|this[t+1]<<8};K.prototype.readUint16BE=K.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||li(t,2,this.length),this[t]<<8|this[t+1]};K.prototype.readUint32LE=K.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||li(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};K.prototype.readUint32BE=K.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||li(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};K.prototype.readBigUInt64LE=Fa(function(t){t=t>>>0,Vc(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Ed(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)<>>0,Vc(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Ed(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)<>>0,e=e>>>0,i||li(t,e,this.length);let n=this[t],s=1,o=0;for(;++o=s&&(n-=Math.pow(2,8*e)),n};K.prototype.readIntBE=function(t,e,i){t=t>>>0,e=e>>>0,i||li(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};K.prototype.readInt8=function(t,e){return t=t>>>0,e||li(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};K.prototype.readInt16LE=function(t,e){t=t>>>0,e||li(t,2,this.length);let i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};K.prototype.readInt16BE=function(t,e){t=t>>>0,e||li(t,2,this.length);let i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};K.prototype.readInt32LE=function(t,e){return t=t>>>0,e||li(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};K.prototype.readInt32BE=function(t,e){return t=t>>>0,e||li(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};K.prototype.readBigInt64LE=Fa(function(t){t=t>>>0,Vc(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Ed(t,this.length-8);let n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(i<<24);return(BigInt(n)<>>0,Vc(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Ed(t,this.length-8);let n=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<>>0,e||li(t,4,this.length),$c.read(this,t,!0,23,4)};K.prototype.readFloatBE=function(t,e){return t=t>>>0,e||li(t,4,this.length),$c.read(this,t,!1,23,4)};K.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||li(t,8,this.length),$c.read(this,t,!0,52,8)};K.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||li(t,8,this.length),$c.read(this,t,!1,52,8)};function Ji(r,t,e,i,n,s){if(!K.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||tr.length)throw new RangeError("Index out of range")}K.prototype.writeUintLE=K.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;Ji(this,t,e,i,l,0)}let s=1,o=0;for(this[e]=t&255;++o>>0,i=i>>>0,!n){let l=Math.pow(2,8*i)-1;Ji(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};K.prototype.writeUint8=K.prototype.writeUInt8=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,1,255,0),this[e]=t&255,e+1};K.prototype.writeUint16LE=K.prototype.writeUInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};K.prototype.writeUint16BE=K.prototype.writeUInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};K.prototype.writeUint32LE=K.prototype.writeUInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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};K.prototype.writeUint32BE=K.prototype.writeUInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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 rA(r,t,e,i,n){cA(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 sA(r,t,e,i,n){cA(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}K.prototype.writeBigUInt64LE=Fa(function(t,e=0){return rA(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});K.prototype.writeBigUInt64BE=Fa(function(t,e=0){return sA(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});K.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e=e>>>0,!n){let c=Math.pow(2,8*i-1);Ji(this,t,e,i,c-1,-c)}let s=0,o=1,l=0;for(this[e]=t&255;++s>0)-l&255;return e+i};K.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e=e>>>0,!n){let c=Math.pow(2,8*i-1);Ji(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};K.prototype.writeInt8=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};K.prototype.writeInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};K.prototype.writeInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};K.prototype.writeInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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};K.prototype.writeInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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};K.prototype.writeBigInt64LE=Fa(function(t,e=0){return rA(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});K.prototype.writeBigInt64BE=Fa(function(t,e=0){return sA(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function aA(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 oA(r,t,e,i,n){return t=+t,e=e>>>0,n||aA(r,t,e,4,34028234663852886e22,-34028234663852886e22),$c.write(r,t,e,i,23,4),e+4}K.prototype.writeFloatLE=function(t,e,i){return oA(this,t,e,!0,i)};K.prototype.writeFloatBE=function(t,e,i){return oA(this,t,e,!1,i)};function lA(r,t,e,i,n){return t=+t,e=e>>>0,n||aA(r,t,e,8,17976931348623157e292,-17976931348623157e292),$c.write(r,t,e,i,52,8),e+8}K.prototype.writeDoubleLE=function(t,e,i){return lA(this,t,e,!0,i)};K.prototype.writeDoubleBE=function(t,e,i){return lA(this,t,e,!1,i)};K.prototype.copy=function(t,e,i,n){if(!K.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=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>>0,i=i===void 0?this.length:i>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s2**32?n=Qw(String(e)):typeof e=="bigint"&&(n=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(n=Qw(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i},RangeError);function Qw(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){Vc(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&Ed(t,r.length-(e+1))}function cA(r,t,e,i,n,s){if(r>e||r3?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 Gc.ERR_OUT_OF_RANGE("value",l,r)}MD(i,n,s)}function Vc(r,t){if(typeof r!="number")throw new Gc.ERR_INVALID_ARG_TYPE(t,"number",r)}function Ed(r,t,e){throw Math.floor(r)!==r?(Vc(r,e),new Gc.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new Gc.ERR_BUFFER_OUT_OF_BOUNDS:new Gc.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 Kx(r,t){t=t||1/0;let e,i=r.length,n=null,s=[];for(let o=0;o55295&&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>8,n=e%256,s.push(n),s.push(i);return s}function uA(r){return Wx.toByteArray(PD(r))}function Ym(r,t,e,i){let n;for(n=0;n=t.length||n>=r.length);++n)t[n+e]=r[n];return n}function zr(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function ty(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 Fa(r){return typeof BigInt>"u"?BD:r}function BD(){throw new Error("BigInt not supported")}});var gA=Ut((ZM,mA)=>{H();var ze=mA.exports={},jr,Hr;function ey(){throw new Error("setTimeout has not been defined")}function iy(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?jr=setTimeout:jr=ey}catch{jr=ey}try{typeof clearTimeout=="function"?Hr=clearTimeout:Hr=iy}catch{Hr=iy}})();function dA(r){if(jr===setTimeout)return setTimeout(r,0);if((jr===ey||!jr)&&setTimeout)return jr=setTimeout,setTimeout(r,0);try{return jr(r,0)}catch{try{return jr.call(null,r,0)}catch{return jr.call(this,r,0)}}}function UD(r){if(Hr===clearTimeout)return clearTimeout(r);if((Hr===iy||!Hr)&&clearTimeout)return Hr=clearTimeout,clearTimeout(r);try{return Hr(r)}catch{try{return Hr.call(null,r)}catch{return Hr.call(this,r)}}}var Ds=[],Wc=!1,jo,Km=-1;function zD(){!Wc||!jo||(Wc=!1,jo.length?Ds=jo.concat(Ds):Km=-1,Ds.length&&fA())}function fA(){if(!Wc){var r=dA(zD);Wc=!0;for(var t=Ds.length;t;){for(jo=Ds,Ds=[];++Km1)for(var e=1;e{"use strict";st=Hc(hA()),it=Hc(gA()),ny=[typeof globalThis<"u"?globalThis:null,typeof window<"u"?window:null,typeof self<"u"?self:null,typeof window<"u"?window:null].filter(Boolean);ny.forEach(r=>{r.Buffer||(r.Buffer=st.Buffer),r.process||(r.process=it.default)});typeof it.default<"u"&&!it.default.env&&(it.default.env={NODE_ENV:"production"});if(typeof ny[0]<"u"){let r=ny[0];r.util||(r.util={debuglog:()=>()=>{},inspect:t=>JSON.stringify(t)})}});var Go=Ut(Ai=>{"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-1}var ZD=Yc({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/"});Ai.assign=GD;Ai.find=HD;Ai.freeze=Yc;Ai.HTML_BOOLEAN_ATTRIBUTES=yA;Ai.HTML_RAW_TEXT_ELEMENTS=Cd;Ai.HTML_VOID_ELEMENTS=bA;Ai.hasDefaultHTMLNamespace=XD;Ai.hasOwn=Ho;Ai.isHTMLBooleanAttribute=$D;Ai.isHTMLRawTextElement=qD;Ai.isHTMLEscapableRawTextElement=WD;Ai.isHTMLMimeType=wA;Ai.isHTMLVoidElement=VD;Ai.isValidMimeType=KD;Ai.MIME_TYPE=Td;Ai.NAMESPACE=ZD});var _d=Ut(kd=>{"use strict";H();var QD=Go();function vA(r,t){r.prototype=Object.create(Error.prototype,{constructor:{value:r},name:{value:r.name,enumerable:!0,writable:t}})}var Dd=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"}),EA=Object.keys(Dd);function CA(r){return typeof r=="number"&&r>=1&&r<=25}function JD(r){return typeof r=="string"&&r.substring(r.length-Dd.Error.length)===Dd.Error}function Id(r,t){CA(r)?(this.name=EA[r],this.message=t||""):(this.message=r,this.name=JD(t)?t:Dd.Error),Error.captureStackTrace&&Error.captureStackTrace(this,Id)}vA(Id,!0);Object.defineProperties(Id.prototype,{code:{enumerable:!0,get:function(){var r=EA.indexOf(this.name);return CA(r)?r:0}}});var TA={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},ry=Object.entries(TA);for(Sd=0;Sd{"use strict";H();function MA(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 Od=MA();function $o(r){if(r.source[0]!=="[")throw new Error(r+" can not be used with chars");return r.source.slice(1,r.source.lastIndexOf("]"))}function Kc(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,""),Od?"u":"")}function zt(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(""),Od?"mu":"m")}function It(r){if(arguments.length===0)throw new Error("no parameters provided");return zt.apply(It,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var tI="\uFFFD",Vo=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;Od&&(Vo=zt("[",$o(Vo),"\\u{10000}-\\u{10FFFF}","]"));var oy=/[\x20\x09\x0D\x0A]/,eI=$o(oy),se=zt(oy,"+"),Ce=zt(oy,"*"),Nd=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;Od&&(Nd=zt("[",$o(Nd),"\\u{10000}-\\u{10FFFF}","]"));var iI=$o(Nd),ly=zt("[",iI,$o(/[-.0-9\xB7]/),$o(/[\u0300-\u036F\u203F-\u2040]/),"]"),Vn=zt(Nd,ly,"*"),SA=zt(ly,"+"),nI=zt("&",Vn,";"),rI=It(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Md=It(nI,"|",rI),Fd=zt("%",Vn,";"),cy=It(zt('"',It(/[^%&"]/,"|",Fd,"|",Md),"*",'"'),"|",zt("'",It(/[^%&']/,"|",Fd,"|",Md),"*","'")),sI=It('"',It(/[^<&"]/,"|",Md),"*",'"',"|","'",It(/[^<&']/,"|",Md),"*","'"),aI=Kc(Nd,":"),oI=Kc(ly,":"),DA=zt(aI,oI,"*"),Rd=zt(DA,It(":",DA),"?"),lI=zt("^",Rd,"$"),cI=zt("(",Rd,")"),Pd=It(/"[^"]*"|'[^']*'/),uI=zt(/^<\?/,"(",Vn,")",It(se,"(",Vo,"*?)"),"?",/\?>/),IA=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Qm=It('"',IA,'*"',"|","'",Kc(IA,"'"),"*'"),FA="",hI=zt(FA,It(Kc(Vo,"-"),"|",zt("-",Kc(Vo,"-"))),"*",PA),kA="#PCDATA",dI=It(zt(/\(/,Ce,kA,It(Ce,/\|/,Ce,Rd),"*",Ce,/\)\*/),"|",zt(/\(/,Ce,kA,Ce,/\)/)),fI=/[?*+]?/,pI=zt(/\([^>]+\)/,fI),mI=It("EMPTY","|","ANY","|",dI,"|",pI),gI=""),yI=zt("NOTATION",se,/\(/,Ce,Vn,It(Ce,/\|/,Ce,Vn),"*",Ce,/\)/),bI=zt(/\(/,Ce,SA,It(Ce,/\|/,Ce,SA),"*",Ce,/\)/),wI=It(yI,"|",bI),AI=It(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",wI),vI=It(/#REQUIRED|#IMPLIED/,"|",It(It("#FIXED",se),"?",sI)),EI=It(se,Vn,se,AI,se,vI),CI=""),ay="about:legacy-compat",SI=It('"'+ay+'"',"|","'"+ay+"'"),uy="SYSTEM",Jm="PUBLIC",tg=It(It(uy,se,Pd),"|",It(Jm,se,Qm,se,Pd)),DI=zt("^",It(It(uy,se,"(?",Pd,")"),"|",It(Jm,se,"(?",Qm,")",se,"(?",Pd,")"))),II=It(se,"NDATA",se,Vn),kI=It(cy,"|",It(tg,II,"?")),OA=""),NI=It(cy,"|",tg),MI=zt(OA,se,"%",se,Vn,se,NI,Ce,">"),FI=It(_I,"|",MI),PI=zt(Jm,se,Qm),OI=zt(""),hy=zt(Ce,"=",Ce),_A=/1[.]\d+/,RI=zt(se,"version",hy,It("'",_A,"'","|",'"',_A,'"')),NA=/[A-Za-z][-A-Za-z0-9._]*/,LI=It(se,"encoding",hy,It('"',NA,'"',"|","'",NA,"'")),BI=It(se,"standalone",hy,It("'",It("yes","|","no"),"'","|",'"',It("yes","|","no"),'"')),UI=zt(/^<\?xml/,RI,LI,"?",BI,"?",Ce,/\?>/),zI="",GI=//,VI=zt(Vo,"*?",$I),qI=zt(GI,VI);Rt.chars=$o;Rt.chars_without=Kc;Rt.detectUnicodeSupport=MA;Rt.reg=zt;Rt.regg=It;Rt.ABOUT_LEGACY_COMPAT=ay;Rt.ABOUT_LEGACY_COMPAT_SystemLiteral=SI;Rt.AttlistDecl=TI;Rt.CDATA_START=jI;Rt.CDATA_END=HI;Rt.CDSect=qI;Rt.Char=Vo;Rt.Comment=hI;Rt.COMMENT_START=FA;Rt.COMMENT_END=PA;Rt.DOCTYPE_DECL_START=zI;Rt.elementdecl=xI;Rt.EntityDecl=FI;Rt.EntityValue=cy;Rt.ExternalID=tg;Rt.ExternalID_match=DI;Rt.Name=Vn;Rt.NotationDecl=OI;Rt.Reference=Md;Rt.PEReference=Fd;Rt.PI=uI;Rt.PUBLIC=Jm;Rt.PubidLiteral=Qm;Rt.QName=Rd;Rt.QName_exact=lI;Rt.QName_group=cI;Rt.S=se;Rt.SChar_s=eI;Rt.S_OPT=Ce;Rt.SYSTEM=uy;Rt.SystemLiteral=Pd;Rt.UNICODE_REPLACEMENT_CHARACTER=tI;Rt.UNICODE_SUPPORT=Od;Rt.XMLDecl=UI});var by=Ut(je=>{"use strict";H();var Wn=Go(),Vr=Wn.find,WI=Wn.hasDefaultHTMLNamespace,Qc=Wn.hasOwn,XI=Wn.isHTMLMimeType,YI=Wn.isHTMLRawTextElement,KI=Wn.isHTMLVoidElement,Ld=Wn.MIME_TYPE,qr=Wn.NAMESPACE,ji=Symbol(),HA=_d(),Tt=HA.DOMException,ZI=HA.DOMExceptionName,Gr=dy();function tn(r){if(r!==ji)throw new TypeError("Illegal constructor")}function QI(r){return r!==""}function JI(r){return r?r.split(/[\t\n\f\r ]+/).filter(QI):[]}function tk(r,t){return Qc(r,t)||(r[t]=!0),r}function RA(r){if(!r)return[];var t=JI(r);return Object.keys(t.reduce(tk,{}))}function ek(r){return function(t){return r&&r.indexOf(t)!==-1}}function GA(r){if(!Gr.QName_exact.test(r))throw new Tt(Tt.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+r+'"')}function my(r,t){GA(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 Tt(Tt.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(e==="xml"&&r!==Wn.NAMESPACE.XML)throw new Tt(Tt.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((e==="xmlns"||t==="xmlns")&&r!==Wn.NAMESPACE.XMLNS)throw new Tt(Tt.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(r===Wn.NAMESPACE.XMLNS&&e!=="xmlns"&&t!=="xmlns")throw new Tt(Tt.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[r,e,i]}function eu(r,t){for(var e in r)Qc(r,e)&&(t[e]=r[e])}function en(r,t){var e=r.prototype;if(!(e instanceof t)){let i=function(){};i.prototype=t.prototype,i=new i,eu(e,i),r.prototype=e=i}e.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),e.constructor=r)}var nn={},qn=nn.ELEMENT_NODE=1,Jc=nn.ATTRIBUTE_NODE=2,eg=nn.TEXT_NODE=3,$A=nn.CDATA_SECTION_NODE=4,VA=nn.ENTITY_REFERENCE_NODE=5,ik=nn.ENTITY_NODE=6,qA=nn.PROCESSING_INSTRUCTION_NODE=7,WA=nn.COMMENT_NODE=8,Ud=nn.DOCUMENT_NODE=9,XA=nn.DOCUMENT_TYPE_NODE=10,Pa=nn.DOCUMENT_FRAGMENT_NODE=11,nk=nn.NOTATION_NODE=12,Me=Wn.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 YA(r,t){if(t.length=0&&r=0){for(var n=t.length-1;i<=n;)t[i]=t[++i];if(t.length=n,r){var s=r.ownerDocument;s&&JA(s,r,e),e.ownerElement=null}}}tu.prototype={length:0,item:ei.prototype.item,getNamedItem:function(r){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());for(var t=0;tLA(t.ownerDocument)?Me.DOCUMENT_POSITION_FOLLOWING:Me.DOCUMENT_POSITION_PRECEDING);if(n&&t===e)return Me.DOCUMENT_POSITION_CONTAINS+Me.DOCUMENT_POSITION_PRECEDING;if(i&&t===e)return Me.DOCUMENT_POSITION_CONTAINED_BY+Me.DOCUMENT_POSITION_FOLLOWING;for(var l=[],c=t.parentNode;c;){if(!n&&c===e)return Me.DOCUMENT_POSITION_CONTAINED_BY+Me.DOCUMENT_POSITION_FOLLOWING;l.push(c),c=c.parentNode}l.reverse();for(var u=[],h=e.parentNode;h;){if(!i&&h===t)return Me.DOCUMENT_POSITION_CONTAINS+Me.DOCUMENT_POSITION_PRECEDING;u.push(h),h=h.parentNode}u.reverse();var d=YA(l,u);for(var f in d.childNodes){var m=d.childNodes[f];if(m===e)return Me.DOCUMENT_POSITION_FOLLOWING;if(m===t)return Me.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(m)>=0)return Me.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(m)>=0)return Me.DOCUMENT_POSITION_PRECEDING}return 0}};function QA(r){return r=="<"&&"<"||r==">"&&">"||r=="&"&&"&"||r=='"'&&"""||"&#"+r.charCodeAt()+";"}eu(nn,Vt);eu(nn,Vt.prototype);eu(Me,Vt);eu(Me,Vt.prototype);function Bd(r,t){if(t(r))return!0;if(r=r.firstChild)do if(Bd(r,t))return!0;while(r=r.nextSibling)}function _s(r,t){tn(r);var e=t||{};this.ownerDocument=this,this.contentType=e.contentType||Ld.XML_APPLICATION,this.type=XI(this.contentType)?"html":"xml"}function sk(r,t,e){r&&r._inc++;var i=e.namespaceURI;i===qr.XMLNS&&(t._nsMap[e.prefix?e.localName:""]=e.value)}function JA(r,t,e,i){r&&r._inc++;var n=e.namespaceURI;n===qr.XMLNS&&delete t._nsMap[e.prefix?e.localName:""]}function tv(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 ev(r,t){if(r!==t.parentNode)throw new Tt(Tt.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,tv(r.ownerDocument,r),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}function ak(r){return r&&(r.nodeType===Vt.DOCUMENT_NODE||r.nodeType===Vt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Vt.ELEMENT_NODE)}function ok(r){return r&&(r.nodeType===Vt.CDATA_SECTION_NODE||r.nodeType===Vt.COMMENT_NODE||r.nodeType===Vt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Vt.DOCUMENT_TYPE_NODE||r.nodeType===Vt.ELEMENT_NODE||r.nodeType===Vt.PROCESSING_INSTRUCTION_NODE||r.nodeType===Vt.TEXT_NODE)}function Oa(r){return r&&r.nodeType===Vt.DOCUMENT_TYPE_NODE}function ks(r){return r&&r.nodeType===Vt.ELEMENT_NODE}function iv(r){return r&&r.nodeType===Vt.TEXT_NODE}function UA(r,t){var e=r.childNodes||[];if(Vr(e,ks)||Oa(t))return!1;var i=Vr(e,Oa);return!(t&&i&&e.indexOf(i)>e.indexOf(t))}function zA(r,t){var e=r.childNodes||[];function i(s){return ks(s)&&s!==t}if(Vr(e,i))return!1;var n=Vr(e,Oa);return!(t&&n&&e.indexOf(n)>e.indexOf(t))}function lk(r,t,e){if(!ak(r))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+r.nodeType);if(e&&e.parentNode!==r)throw new Tt(Tt.NOT_FOUND_ERR,"child not in parent");if(!ok(t)||Oa(t)&&r.nodeType!==Vt.DOCUMENT_NODE)throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+r.nodeType)}function ck(r,t,e){var i=r.childNodes||[],n=t.childNodes||[];if(t.nodeType===Vt.DOCUMENT_FRAGMENT_NODE){var s=n.filter(ks);if(s.length>1||Vr(n,iv))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!UA(r,e))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ks(t)&&!UA(r,e))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Oa(t)){if(Vr(i,Oa))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Vr(i,ks);if(e&&i.indexOf(o)1||Vr(n,iv))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!zA(r,e))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ks(t)&&!zA(r,e))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Oa(t)){if(Vr(i,function(c){return Oa(c)&&c!==e}))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Vr(i,ks);if(e&&i.indexOf(o)")!==-1)throw new Tt(Tt.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new sg(ji);return t.ownerDocument=this,t.childNodes=new ei,t.appendData(r),t},createProcessingInstruction:function(r,t){var e=new lg(ji);return e.ownerDocument=this,e.childNodes=new ei,e.nodeName=e.target=r,e.nodeValue=e.data=t,e},createAttribute:function(r){if(!Gr.QName_exact.test(r))throw new Tt(Tt.INVALID_CHARACTER_ERR,'invalid character in name "'+r+'"');return this.type==="html"&&(r=r.toLowerCase()),this._createAttribute(r)},_createAttribute:function(r){var t=new qo(ji);return t.ownerDocument=this,t.childNodes=new ei,t.name=r,t.nodeName=r,t.localName=r,t.specified=!0,t},createEntityReference:function(r){if(!Gr.Name.test(r))throw new Tt(Tt.INVALID_CHARACTER_ERR,'not a valid xml name "'+r+'"');if(this.type==="html")throw new Tt("document is an html document",ZI.NotSupportedError);var t=new og(ji);return t.ownerDocument=this,t.childNodes=new ei,t.nodeName=r,t},createElementNS:function(r,t){var e=my(r,t),i=new Ns(ji),n=i.attributes=new tu;return i.childNodes=new ei,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=my(r,t),i=new qo(ji);return i.ownerDocument=this,i.childNodes=new ei,i.nodeName=t,i.name=t,i.specified=!0,i.namespaceURI=e[0],i.prefix=e[1],i.localName=e[2],i}};en(_s,Vt);function Ns(r){tn(r),this._nsMap=Object.create(null)}Ns.prototype={nodeType:qn,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===qr.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=my(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=RA(r);return new $r(this,function(e){var i=[];return t.length>0&&Bd(e,function(n){if(n!==e&&n.nodeType===qn){var s=n.getAttribute("class");if(s){var o=r===s;if(!o){var l=RA(s);o=t.every(ek(l))}o&&i.push(n)}}}),i})},getElementsByTagName:function(r){var t=(this.nodeType===Ud?this:this.ownerDocument).type==="html",e=r.toLowerCase();return new $r(this,function(i){var n=[];return Bd(i,function(s){if(!(s===i||s.nodeType!==qn))if(r==="*")n.push(s);else{var o=s.getQualifiedName(),l=t&&s.namespaceURI===qr.HTML?e:r;o===l&&n.push(s)}}),n})},getElementsByTagNameNS:function(r,t){return new $r(this,function(e){var i=[];return Bd(e,function(n){n!==e&&n.nodeType===qn&&(r==="*"||n.namespaceURI===r)&&(t==="*"||n.localName==t)&&i.push(n)}),i})}};_s.prototype.getElementsByClassName=Ns.prototype.getElementsByClassName;_s.prototype.getElementsByTagName=Ns.prototype.getElementsByTagName;_s.prototype.getElementsByTagNameNS=Ns.prototype.getElementsByTagNameNS;en(Ns,Vt);function qo(r){tn(r),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}qo.prototype.nodeType=Jc;en(qo,Vt);function iu(r){tn(r)}iu.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}};en(iu,Vt);function zd(r){tn(r)}zd.prototype={nodeName:"#text",nodeType:eg,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}};en(zd,iu);function rg(r){tn(r)}rg.prototype={nodeName:"#comment",nodeType:WA};en(rg,iu);function sg(r){tn(r)}sg.prototype={nodeName:"#cdata-section",nodeType:$A};en(sg,zd);function ag(r){tn(r)}ag.prototype.nodeType=XA;en(ag,Vt);function xy(r){tn(r)}xy.prototype.nodeType=nk;en(xy,Vt);function yy(r){tn(r)}yy.prototype.nodeType=ik;en(yy,Vt);function og(r){tn(r)}og.prototype.nodeType=VA;en(og,Vt);function nu(r){tn(r)}nu.prototype.nodeName="#document-fragment";nu.prototype.nodeType=Pa;en(nu,Vt);function lg(r){tn(r)}lg.prototype.nodeType=qA;en(lg,iu);function rv(){}rv.prototype.serializeToString=function(r,t){return sv.call(r,t)};Vt.prototype.toString=sv;function sv(r){var t=[],e=this.nodeType===Ud&&this.documentElement||this,i=e.prefix,n=e.namespaceURI;if(n&&i==null){var i=e.lookupPrefix(n);if(i==null)var s=[{namespace:n,prefix:null}]}return Zc(this,t,r,s),t.join("")}function jA(r,t,e){var i=r.prefix||"",n=r.namespaceURI;if(!n||i==="xml"&&n===qr.XML||n===qr.XMLNS)return!1;for(var s=e.length;s--;){var o=e[s];if(o.prefix===i)return o.namespace!==n}return!0}function fy(r,t,e){r.push(" ",t,'="',e.replace(/[<>&"\t\n\r]/g,QA),'"')}function Zc(r,t,e,i){i||(i=[]);var n=r.nodeType===Ud?r:r.ownerDocument,s=n.type==="html";if(e)if(r=e(r),r){if(typeof r=="string"){t.push(r);return}}else return;switch(r.nodeType){case qn:var o=r.attributes,l=o.length,T=r.firstChild,c=r.tagName,u=c;if(!s&&!r.prefix&&r.namespaceURI){for(var h,d=0;d=0;f--){var m=i[f];if(m.prefix===""&&m.namespace===r.namespaceURI){h=m.namespace;break}}if(h!==r.namespaceURI)for(var f=i.length-1;f>=0;f--){var m=i[f];if(m.namespace===r.namespaceURI){m.prefix&&(u=m.prefix+":"+c);break}}}t.push("<",u);for(var y=0;y");else{if(t.push(">"),s&&YI(c))for(;T;)T.data?t.push(T.data):Zc(T,t,e,i.slice()),T=T.nextSibling;else for(;T;)Zc(T,t,e,i.slice()),T=T.nextSibling;t.push("")}return;case Ud:case Pa:for(var T=r.firstChild;T;)Zc(T,t,e,i.slice()),T=T.nextSibling;return;case Jc:return fy(t,r.name,r.value);case eg:return t.push(r.data.replace(/[<&>]/g,QA));case $A:return t.push(Gr.CDATA_START,r.data.replace(/]]>/g,"]]]]>"),Gr.CDATA_END);case WA:return t.push(Gr.COMMENT_START,r.data,Gr.COMMENT_END);case XA:var k=r.publicId,N=r.systemId;t.push(Gr.DOCTYPE_DECL_START," ",r.name),k?(t.push(" ",Gr.PUBLIC," ",k),N&&N!=="."&&t.push(" ",N)):N&&N!=="."&&t.push(" ",Gr.SYSTEM," ",N),r.internalSubset&&t.push(" [",r.internalSubset,"]"),t.push(">");return;case qA:return t.push("");case VA:return t.push("&",r.nodeName,";");default:t.push("??",r.nodeName)}}function av(r,t,e){var i;switch(t.nodeType){case qn:i=t.cloneNode(!1),i.ownerDocument=r;case Pa:break;case Jc:e=!0;break}if(i||(i=t.cloneNode(!1)),i.ownerDocument=r,i.parentNode=null,e)for(var n=t.firstChild;n;)i.appendChild(av(r,n,e)),n=n.nextSibling;return i}function gy(r,t,e){var i=new t.constructor(ji);for(var n in t)if(Qc(t,n)){var s=t[n];typeof s!="object"&&s!=i[n]&&(i[n]=s)}switch(t.childNodes&&(i.childNodes=new ei),i.ownerDocument=r,i.nodeType){case qn:var o=t.attributes,l=i.attributes=new tu,c=o.length;l._ownerElement=i;for(var u=0;u{"use strict";H();var lv=Go().freeze;jd.XML_ENTITIES=lv({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});jd.HTML_ENTITIES=lv({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:` -`,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"});jd.entityMap=jd.HTML_ENTITIES});var wv=Ut(ug=>{"use strict";H();var ou=Go(),Ft=dy(),pv=_d(),uk=ou.isHTMLEscapableRawTextElement,hk=ou.isHTMLMimeType,dk=ou.isHTMLRawTextElement,Vd=ou.hasOwn,uv=ou.NAMESPACE,hv=pv.ParseError,fk=pv.DOMException,Hd=0,Ra=1,ru=2,Gd=3,su=4,au=5,$d=6,cg=7;function mv(){}mv.prototype={parse:function(r,t,e){var i=this.domBuilder;i.startDocument(),gv(t,t=Object.create(null)),pk(r,t,e,i,this.errorHandler),i.endDocument()}};var wy=/&#?\w+;?/g;function pk(r,t,e,i,n){var s=hk(i.mimeType);r.indexOf(Ft.UNICODE_REPLACEMENT_CHARACTER)>=0&&n.warning("Unicode replacement character detected, source encoding issues?");function o(E){if(E>65535){E-=65536;var S=55296+(E>>10),I=56320+(E&1023);return String.fromCharCode(S,I)}else return String.fromCharCode(E)}function l(E){var S=E[E.length-1]===";"?E:E+";";if(!s&&S!==E)return n.error("EntityRef: expecting ;"),E;var I=Ft.Reference.exec(S);if(!I||I[0].length!==S.length)return n.error("entity not matching Reference production: "+E),E;var M=S.slice(1,-1);return Vd(e,M)?e[M]:M.charAt(0)==="#"?o(parseInt(M.substring(1).replace("x","0x"))):(n.error("entity not found:"+E),E)}function c(E){if(E>A){var S=r.substring(A,E).replace(wy,l);f&&m(A),i.characters(S,0,E-A),A=E}}var u=0,h=0,d=/\r\n?|\n|$/g,f=i.locator;function m(E,S){for(;E>=h&&(S=d.exec(r));)u=h,h=S.index+S[0].length,f.lineNumber++;f.columnNumber=E-u+1}for(var y=[{currentNSMap:t}],g=[],A=0;;){try{var w=r.indexOf("<",A);if(w<0){if(!s&&g.length>0)return n.fatalError("unclosed xml tag(s): "+g.join(", "));if(!r.substring(A).match(/^\s*$/)){var v=i.doc,T=v.createTextNode(r.substring(A));if(v.documentElement)return n.error("Extra content at the end of the document");v.appendChild(T),i.currentElement=T}return}if(w>A){var k=r.substring(A,w);!s&&g.length===0&&(k=k.replace(new RegExp(Ft.S_OPT.source,"g"),""),k&&n.error("Unexpected content outside root element: '"+k+"'")),c(w)}switch(r.charAt(w+1)){case"/":var _=r.indexOf(">",w+2),N=r.substring(w+2,_>0?_:void 0);if(!N)return n.fatalError("end tag name missing");var F=_>0&&Ft.reg("^",Ft.QName_group,Ft.S_OPT,"$").exec(N);if(!F)return n.fatalError('end tag name contains invalid characters: "'+N+'"');if(!i.currentElement&&!i.doc.documentElement)return;var L=g[g.length-1]||i.currentElement.tagName||i.doc.documentElement.tagName||"";if(L!==F[1]){var Y=F[1].toLowerCase();if(!s||L.toLowerCase()!==Y)return n.fatalError('Opening and ending tag mismatch: "'+L+'" != "'+N+'"')}var q=y.pop();g.pop();var G=q.localNSMap;if(i.endElement(q.uri,q.localName,L),G)for(var j in G)Vd(G,j)&&i.endPrefixMapping(j);_++;break;case"?":f&&m(w),_=yk(r,w,i,n);break;case"!":f&&m(w),_=yv(r,w,i,n,s);break;default:f&&m(w);var tt=new bv,et=y[y.length-1].currentNSMap,_=mk(r,w,tt,et,l,n,s),X=tt.length;if(tt.closed||(s&&ou.isHTMLVoidElement(tt.tagName)?tt.closed=!0:g.push(tt.tagName)),f&&X){for(var O=dv(f,{}),C=0;CA?A=_:c(Math.max(w,A)+1)}}function dv(r,t){return t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber,t}function mk(r,t,e,i,n,s,o){function l(m,y,g){if(Vd(e.attributeNames,m))return s.fatalError("Attribute "+m+" redefined");if(!o&&y.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");e.addValue(m,y.replace(/[\t\n\r]/g," ").replace(wy,n),g)}for(var c,u,h=++t,d=Hd;;){var f=r.charAt(h);switch(f){case"=":if(d===Ra)c=r.slice(t,h),d=Gd;else if(d===ru)d=Gd;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===Gd||d===Ra)if(d===Ra&&(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=au;else throw new Error("attribute value no end '"+f+"' match");else if(d==su)u=r.slice(t,h),l(c,u,t),s.warning('attribute "'+c+'" missed start quot('+f+")!!"),t=h+1,d=au;else throw new Error('attribute value must after "="');break;case"/":switch(d){case Hd:e.setTagName(r.slice(t,h));case au:case $d:case cg:d=cg,e.closed=!0;case su:case Ra:break;case ru:e.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==Hd&&e.setTagName(r.slice(t,h)),h;case">":switch(d){case Hd:e.setTagName(r.slice(t,h));case au:case $d:case cg:break;case su:case Ra:u=r.slice(t,h),u.slice(-1)==="/"&&(e.closed=!0,u=u.slice(0,-1));case ru:d===ru&&(u=c),d==su?(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 Gd:if(!o)return s.fatalError(`AttValue: ' or " expected`)}return h;case"\x80":f=" ";default:if(f<=" ")switch(d){case Hd:e.setTagName(r.slice(t,h)),d=$d;break;case Ra:c=r.slice(t,h),d=ru;break;case su:var u=r.slice(t,h);s.warning('attribute "'+u+'" missed quot(")!!'),l(c,u,t);case au:d=$d;break}else switch(d){case ru:o||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),l(c,c,t),t=h,d=Ra;break;case au:s.warning('attribute space is required"'+c+'"!!');case $d:d=Ra,t=h;break;case Gd:d=su,t=h;break;case cg:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function fv(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),gv(e,e=Object.create(null))),e[h]=n[h]=l,s.uri=uv.XMLNS,t.startPrefixMapping(h,l))}for(var d=r.length;d--;)s=r[d],s.prefix&&(s.prefix==="xml"&&(s.uri=uv.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)Vd(n,c)&&t.endPrefixMapping(c)}else return r.currentNSMap=e,r.localNSMap=n,!0}function gk(r,t,e,i,n){var s=uk(e);if(s||dk(e)){var o=r.indexOf("",t),l=r.substring(t+1,o);return s&&(l=l.replace(wy,i)),n.characters(l,0,l.length),o}return t+1}function gv(r,t){for(var e in r)Vd(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"?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 "0)return i.fatalError("processing instruction at position "+t+" is an xml declaration which is only at the start of the document");if(!Ft.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 bv(){this.attributeNames=Object.create(null)}bv.prototype={setTagName:function(r){if(!Ft.QName_exact.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,t,e){if(!Ft.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}};ug.XMLReader=mv;ug.parseUtils=xv;ug.parseDoctypeCommentOrCData=yv});var Dv=Ut(cu=>{"use strict";H();var Wo=Go(),bk=by(),wk=_d(),Av=cv(),Ak=wv(),vk=bk.DOMImplementation,Ek=Wo.hasDefaultHTMLNamespace,Ck=Wo.isHTMLMimeType,Tk=Wo.isValidMimeType,Cv=Wo.MIME_TYPE,Ay=Wo.NAMESPACE,vv=wk.ParseError,Sk=Ak.XMLReader;function Tv(r){return r.replace(/\r[\n\u0085]/g,` +"use strict";var officeParser=(()=>{var tD=Object.create;var vd=Object.defineProperty;var eD=Object.getOwnPropertyDescriptor;var iD=Object.getOwnPropertyNames;var nD=Object.getPrototypeOf,rD=Object.prototype.hasOwnProperty;var $w=r=>{throw TypeError(r)};var sD=(r,t,e)=>t in r?vd(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Vm=(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 Kt=(r,t)=>()=>(r&&(t=r(r=0)),t);var zt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),qm=(r,t)=>{for(var e in t)vd(r,e,{get:t[e],enumerable:!0})},Vw=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of iD(t))!rD.call(r,n)&&n!==e&&vd(r,n,{get:()=>t[n],enumerable:!(i=eD(t,n))||i.enumerable});return r};var Hc=(r,t,e)=>(e=r!=null?tD(nD(r)):{},Vw(t||!r||!r.__esModule?vd(e,"default",{value:r,enumerable:!0}):e,r)),aD=r=>Vw(vd({},"__esModule",{value:!0}),r);var z=(r,t,e)=>sD(r,typeof t!="symbol"?t+"":t,e),Gx=(r,t,e)=>t.has(r)||$w("Cannot "+e);var a=(r,t,e)=>(Gx(r,t,"read from private field"),e?e.call(r):t.get(r)),x=(r,t,e)=>t.has(r)?$w("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),p=(r,t,e,i)=>(Gx(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e),b=(r,t,e)=>(Gx(r,t,"access private method"),e);var Ye=(r,t,e,i)=>({set _(n){p(r,t,n,e)},get _(){return a(r,t,i)}});var Xw=zt(Wm=>{"use strict";H();Wm.byteLength=lD;Wm.toByteArray=uD;Wm.fromByteArray=fD;var Ur=[],$n=[],oD=typeof Uint8Array<"u"?Uint8Array:Array,$x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Uo=0,qw=$x.length;Uo0)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=Ww(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=Ww(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>16&255,s[o++]=t>>8&255,s[o++]=t&255;return n===2&&(t=$n[r.charCodeAt(c)]<<2|$n[r.charCodeAt(c+1)]>>4,s[o++]=t&255),n===1&&(t=$n[r.charCodeAt(c)]<<10|$n[r.charCodeAt(c+1)]<<4|$n[r.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function hD(r){return Ur[r>>18&63]+Ur[r>>12&63]+Ur[r>>6&63]+Ur[r&63]}function dD(r,t,e){for(var i,n=[],s=t;sl?l:o+s));return i===1?(t=r[e-1],n.push(Ur[t>>2]+Ur[t<<4&63]+"==")):i===2&&(t=(r[e-2]<<8)+r[e-1],n.push(Ur[t>>10]+Ur[t>>4&63]+Ur[t<<2&63]+"=")),n.join("")}});var qx=zt(Vx=>{H();Vx.read=function(r,t,e,i,n){var s,o,l=n*8-i-1,c=(1<>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)};Vx.write=function(r,t,e,i,n,s){var o,l,c,u=s*8-n-1,h=(1<>1,f=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=i?0:s-1,y=i?1:-1,g=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+=y,l/=256,n-=8);for(o=o<0;r[e+m]=o&255,m+=y,o/=256,u-=8);r[e+m-y]|=g*128}});var hA=zt(qc=>{"use strict";H();var Wx=Xw(),$c=qx(),Yw=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;qc.Buffer=K;qc.SlowBuffer=bD;qc.INSPECT_MAX_BYTES=50;var Xm=2147483647;qc.kMaxLength=Xm;K.TYPED_ARRAY_SUPPORT=pD();!K.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(K.prototype,"parent",{enumerable:!0,get:function(){if(K.isBuffer(this))return this.buffer}});Object.defineProperty(K.prototype,"offset",{enumerable:!0,get:function(){if(K.isBuffer(this))return this.byteOffset}});function Ss(r){if(r>Xm)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,K.prototype),t}function K(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 Zx(r)}return Jw(r,t,e)}K.poolSize=8192;function Jw(r,t,e){if(typeof r=="string")return gD(r,t);if(ArrayBuffer.isView(r))return xD(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(zr(r,ArrayBuffer)||r&&zr(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(zr(r,SharedArrayBuffer)||r&&zr(r.buffer,SharedArrayBuffer)))return Yx(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 K.from(i,t,e);let n=yD(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return K.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)}K.from=function(r,t,e){return Jw(r,t,e)};Object.setPrototypeOf(K.prototype,Uint8Array.prototype);Object.setPrototypeOf(K,Uint8Array);function tA(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 tA(r),r<=0?Ss(r):t!==void 0?typeof e=="string"?Ss(r).fill(t,e):Ss(r).fill(t):Ss(r)}K.alloc=function(r,t,e){return mD(r,t,e)};function Zx(r){return tA(r),Ss(r<0?0:Qx(r)|0)}K.allocUnsafe=function(r){return Zx(r)};K.allocUnsafeSlow=function(r){return Zx(r)};function gD(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!K.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=eA(r,t)|0,i=Ss(e),n=i.write(r,t);return n!==e&&(i=i.slice(0,n)),i}function Xx(r){let t=r.length<0?0:Qx(r.length)|0,e=Ss(t);for(let i=0;i=Xm)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Xm.toString(16)+" bytes");return r|0}function bD(r){return+r!=r&&(r=0),K.alloc(+r)}K.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==K.prototype};K.compare=function(t,e){if(zr(t,Uint8Array)&&(t=K.from(t,t.offset,t.byteLength)),zr(e,Uint8Array)&&(e=K.from(e,e.offset,e.byteLength)),!K.isBuffer(t)||!K.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);sn.length?(K.isBuffer(o)||(o=K.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(K.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function eA(r,t){if(K.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||zr(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 Kx(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return uA(r).length;default:if(n)return i?-1:Kx(r).length;t=(""+t).toLowerCase(),n=!0}}K.byteLength=eA;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 nA(this,t,e);case"ascii":return kD(this,t,e);case"latin1":case"binary":return ID(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}}K.prototype._isBuffer=!0;function zo(r,t,e){let i=r[t];r[t]=r[e],r[e]=i}K.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;ee&&(t+=" ... "),""};Yw&&(K.prototype[Yw]=K.prototype.inspect);K.prototype.compare=function(t,e,i,n,s){if(zr(t,Uint8Array)&&(t=K.from(t,t.offset,t.byteLength)),!K.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;d2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,ty(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=K.from(t,i)),K.isBuffer(t))return t.length===0?-1:Kw(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):Kw(r,[t],e,i,n);throw new TypeError("val must be string, number or Buffer")}function Kw(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;uo&&(e=o-l),u=e;u>=0;u--){let h=!0;for(let d=0;dn&&(i=n)):i=n;let s=t.length;i>s/2&&(i=s/2);let o;for(o=0;o>>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}};K.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?Wx.fromByteArray(r):Wx.fromByteArray(r.slice(t,e))}function nA(r,t,e){e=Math.min(r.length,e);let i=[],n=t;for(;n239?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 Zw=4096;function DD(r){let t=r.length;if(t<=Zw)return String.fromCharCode.apply(String,r);let e="",i=0;for(;ii)&&(e=i);let n="";for(let s=t;si&&(t=i),e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),ee)throw new RangeError("Trying to access beyond buffer length")}K.prototype.readUintLE=K.prototype.readUIntLE=function(t,e,i){t=t>>>0,e=e>>>0,i||ci(t,e,this.length);let n=this[t],s=1,o=0;for(;++o>>0,e=e>>>0,i||ci(t,e,this.length);let n=this[t+--e],s=1;for(;e>0&&(s*=256);)n+=this[t+--e]*s;return n};K.prototype.readUint8=K.prototype.readUInt8=function(t,e){return t=t>>>0,e||ci(t,1,this.length),this[t]};K.prototype.readUint16LE=K.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||ci(t,2,this.length),this[t]|this[t+1]<<8};K.prototype.readUint16BE=K.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||ci(t,2,this.length),this[t]<<8|this[t+1]};K.prototype.readUint32LE=K.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||ci(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};K.prototype.readUint32BE=K.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||ci(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};K.prototype.readBigUInt64LE=Fa(function(t){t=t>>>0,Vc(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Ed(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)<>>0,Vc(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Ed(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)<>>0,e=e>>>0,i||ci(t,e,this.length);let n=this[t],s=1,o=0;for(;++o=s&&(n-=Math.pow(2,8*e)),n};K.prototype.readIntBE=function(t,e,i){t=t>>>0,e=e>>>0,i||ci(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};K.prototype.readInt8=function(t,e){return t=t>>>0,e||ci(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};K.prototype.readInt16LE=function(t,e){t=t>>>0,e||ci(t,2,this.length);let i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};K.prototype.readInt16BE=function(t,e){t=t>>>0,e||ci(t,2,this.length);let i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};K.prototype.readInt32LE=function(t,e){return t=t>>>0,e||ci(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};K.prototype.readInt32BE=function(t,e){return t=t>>>0,e||ci(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};K.prototype.readBigInt64LE=Fa(function(t){t=t>>>0,Vc(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Ed(t,this.length-8);let n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(i<<24);return(BigInt(n)<>>0,Vc(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&Ed(t,this.length-8);let n=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<>>0,e||ci(t,4,this.length),$c.read(this,t,!0,23,4)};K.prototype.readFloatBE=function(t,e){return t=t>>>0,e||ci(t,4,this.length),$c.read(this,t,!1,23,4)};K.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||ci(t,8,this.length),$c.read(this,t,!0,52,8)};K.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||ci(t,8,this.length),$c.read(this,t,!1,52,8)};function Ji(r,t,e,i,n,s){if(!K.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||tr.length)throw new RangeError("Index out of range")}K.prototype.writeUintLE=K.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;Ji(this,t,e,i,l,0)}let s=1,o=0;for(this[e]=t&255;++o>>0,i=i>>>0,!n){let l=Math.pow(2,8*i)-1;Ji(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};K.prototype.writeUint8=K.prototype.writeUInt8=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,1,255,0),this[e]=t&255,e+1};K.prototype.writeUint16LE=K.prototype.writeUInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};K.prototype.writeUint16BE=K.prototype.writeUInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};K.prototype.writeUint32LE=K.prototype.writeUInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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};K.prototype.writeUint32BE=K.prototype.writeUInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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 rA(r,t,e,i,n){cA(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 sA(r,t,e,i,n){cA(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}K.prototype.writeBigUInt64LE=Fa(function(t,e=0){return rA(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});K.prototype.writeBigUInt64BE=Fa(function(t,e=0){return sA(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});K.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e=e>>>0,!n){let c=Math.pow(2,8*i-1);Ji(this,t,e,i,c-1,-c)}let s=0,o=1,l=0;for(this[e]=t&255;++s>0)-l&255;return e+i};K.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e=e>>>0,!n){let c=Math.pow(2,8*i-1);Ji(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};K.prototype.writeInt8=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};K.prototype.writeInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};K.prototype.writeInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};K.prototype.writeInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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};K.prototype.writeInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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};K.prototype.writeBigInt64LE=Fa(function(t,e=0){return rA(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});K.prototype.writeBigInt64BE=Fa(function(t,e=0){return sA(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function aA(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 oA(r,t,e,i,n){return t=+t,e=e>>>0,n||aA(r,t,e,4,34028234663852886e22,-34028234663852886e22),$c.write(r,t,e,i,23,4),e+4}K.prototype.writeFloatLE=function(t,e,i){return oA(this,t,e,!0,i)};K.prototype.writeFloatBE=function(t,e,i){return oA(this,t,e,!1,i)};function lA(r,t,e,i,n){return t=+t,e=e>>>0,n||aA(r,t,e,8,17976931348623157e292,-17976931348623157e292),$c.write(r,t,e,i,52,8),e+8}K.prototype.writeDoubleLE=function(t,e,i){return lA(this,t,e,!0,i)};K.prototype.writeDoubleBE=function(t,e,i){return lA(this,t,e,!1,i)};K.prototype.copy=function(t,e,i,n){if(!K.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=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>>0,i=i===void 0?this.length:i>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s2**32?n=Qw(String(e)):typeof e=="bigint"&&(n=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(n=Qw(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i},RangeError);function Qw(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){Vc(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&Ed(t,r.length-(e+1))}function cA(r,t,e,i,n,s){if(r>e||r3?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 Gc.ERR_OUT_OF_RANGE("value",l,r)}MD(i,n,s)}function Vc(r,t){if(typeof r!="number")throw new Gc.ERR_INVALID_ARG_TYPE(t,"number",r)}function Ed(r,t,e){throw Math.floor(r)!==r?(Vc(r,e),new Gc.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new Gc.ERR_BUFFER_OUT_OF_BOUNDS:new Gc.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 Kx(r,t){t=t||1/0;let e,i=r.length,n=null,s=[];for(let o=0;o55295&&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>8,n=e%256,s.push(n),s.push(i);return s}function uA(r){return Wx.toByteArray(PD(r))}function Ym(r,t,e,i){let n;for(n=0;n=t.length||n>=r.length);++n)t[n+e]=r[n];return n}function zr(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function ty(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 Fa(r){return typeof BigInt>"u"?BD:r}function BD(){throw new Error("BigInt not supported")}});var gA=zt((ZM,mA)=>{H();var ze=mA.exports={},jr,Hr;function ey(){throw new Error("setTimeout has not been defined")}function iy(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?jr=setTimeout:jr=ey}catch{jr=ey}try{typeof clearTimeout=="function"?Hr=clearTimeout:Hr=iy}catch{Hr=iy}})();function dA(r){if(jr===setTimeout)return setTimeout(r,0);if((jr===ey||!jr)&&setTimeout)return jr=setTimeout,setTimeout(r,0);try{return jr(r,0)}catch{try{return jr.call(null,r,0)}catch{return jr.call(this,r,0)}}}function UD(r){if(Hr===clearTimeout)return clearTimeout(r);if((Hr===iy||!Hr)&&clearTimeout)return Hr=clearTimeout,clearTimeout(r);try{return Hr(r)}catch{try{return Hr.call(null,r)}catch{return Hr.call(this,r)}}}var Ds=[],Wc=!1,jo,Km=-1;function zD(){!Wc||!jo||(Wc=!1,jo.length?Ds=jo.concat(Ds):Km=-1,Ds.length&&fA())}function fA(){if(!Wc){var r=dA(zD);Wc=!0;for(var t=Ds.length;t;){for(jo=Ds,Ds=[];++Km1)for(var e=1;e{"use strict";st=Hc(hA()),it=Hc(gA()),ny=[typeof globalThis<"u"?globalThis:null,typeof window<"u"?window:null,typeof self<"u"?self:null,typeof window<"u"?window:null].filter(Boolean);ny.forEach(r=>{r.Buffer||(r.Buffer=st.Buffer),r.process||(r.process=it.default)});typeof it.default<"u"&&!it.default.env&&(it.default.env={NODE_ENV:"production"});if(typeof ny[0]<"u"){let r=ny[0];r.util||(r.util={debuglog:()=>()=>{},inspect:t=>JSON.stringify(t)})}});var Go=zt(wi=>{"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-1}var ZD=Yc({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/"});wi.assign=GD;wi.find=HD;wi.freeze=Yc;wi.HTML_BOOLEAN_ATTRIBUTES=yA;wi.HTML_RAW_TEXT_ELEMENTS=Cd;wi.HTML_VOID_ELEMENTS=bA;wi.hasDefaultHTMLNamespace=XD;wi.hasOwn=Ho;wi.isHTMLBooleanAttribute=$D;wi.isHTMLRawTextElement=qD;wi.isHTMLEscapableRawTextElement=WD;wi.isHTMLMimeType=wA;wi.isHTMLVoidElement=VD;wi.isValidMimeType=KD;wi.MIME_TYPE=Td;wi.NAMESPACE=ZD});var Nd=zt(Id=>{"use strict";H();var QD=Go();function vA(r,t){r.prototype=Object.create(Error.prototype,{constructor:{value:r},name:{value:r.name,enumerable:!0,writable:t}})}var Dd=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"}),EA=Object.keys(Dd);function CA(r){return typeof r=="number"&&r>=1&&r<=25}function JD(r){return typeof r=="string"&&r.substring(r.length-Dd.Error.length)===Dd.Error}function kd(r,t){CA(r)?(this.name=EA[r],this.message=t||""):(this.message=r,this.name=JD(t)?t:Dd.Error),Error.captureStackTrace&&Error.captureStackTrace(this,kd)}vA(kd,!0);Object.defineProperties(kd.prototype,{code:{enumerable:!0,get:function(){var r=EA.indexOf(this.name);return CA(r)?r:0}}});var TA={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},ry=Object.entries(TA);for(Sd=0;Sd{"use strict";H();function MA(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 Od=MA();function $o(r){if(r.source[0]!=="[")throw new Error(r+" can not be used with chars");return r.source.slice(1,r.source.lastIndexOf("]"))}function Kc(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,""),Od?"u":"")}function jt(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(""),Od?"mu":"m")}function It(r){if(arguments.length===0)throw new Error("no parameters provided");return jt.apply(It,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var tk="\uFFFD",Vo=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;Od&&(Vo=jt("[",$o(Vo),"\\u{10000}-\\u{10FFFF}","]"));var oy=/[\x20\x09\x0D\x0A]/,ek=$o(oy),se=jt(oy,"+"),Ce=jt(oy,"*"),_d=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;Od&&(_d=jt("[",$o(_d),"\\u{10000}-\\u{10FFFF}","]"));var ik=$o(_d),ly=jt("[",ik,$o(/[-.0-9\xB7]/),$o(/[\u0300-\u036F\u203F-\u2040]/),"]"),Vn=jt(_d,ly,"*"),SA=jt(ly,"+"),nk=jt("&",Vn,";"),rk=It(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Md=It(nk,"|",rk),Fd=jt("%",Vn,";"),cy=It(jt('"',It(/[^%&"]/,"|",Fd,"|",Md),"*",'"'),"|",jt("'",It(/[^%&']/,"|",Fd,"|",Md),"*","'")),sk=It('"',It(/[^<&"]/,"|",Md),"*",'"',"|","'",It(/[^<&']/,"|",Md),"*","'"),ak=Kc(_d,":"),ok=Kc(ly,":"),DA=jt(ak,ok,"*"),Rd=jt(DA,It(":",DA),"?"),lk=jt("^",Rd,"$"),ck=jt("(",Rd,")"),Pd=It(/"[^"]*"|'[^']*'/),uk=jt(/^<\?/,"(",Vn,")",It(se,"(",Vo,"*?)"),"?",/\?>/),kA=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Qm=It('"',kA,'*"',"|","'",Kc(kA,"'"),"*'"),FA="",hk=jt(FA,It(Kc(Vo,"-"),"|",jt("-",Kc(Vo,"-"))),"*",PA),IA="#PCDATA",dk=It(jt(/\(/,Ce,IA,It(Ce,/\|/,Ce,Rd),"*",Ce,/\)\*/),"|",jt(/\(/,Ce,IA,Ce,/\)/)),fk=/[?*+]?/,pk=jt(/\([^>]+\)/,fk),mk=It("EMPTY","|","ANY","|",dk,"|",pk),gk=""),yk=jt("NOTATION",se,/\(/,Ce,Vn,It(Ce,/\|/,Ce,Vn),"*",Ce,/\)/),bk=jt(/\(/,Ce,SA,It(Ce,/\|/,Ce,SA),"*",Ce,/\)/),wk=It(yk,"|",bk),Ak=It(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",wk),vk=It(/#REQUIRED|#IMPLIED/,"|",It(It("#FIXED",se),"?",sk)),Ek=It(se,Vn,se,Ak,se,vk),Ck=""),ay="about:legacy-compat",Sk=It('"'+ay+'"',"|","'"+ay+"'"),uy="SYSTEM",Jm="PUBLIC",tg=It(It(uy,se,Pd),"|",It(Jm,se,Qm,se,Pd)),Dk=jt("^",It(It(uy,se,"(?",Pd,")"),"|",It(Jm,se,"(?",Qm,")",se,"(?",Pd,")"))),kk=It(se,"NDATA",se,Vn),Ik=It(cy,"|",It(tg,kk,"?")),OA=""),_k=It(cy,"|",tg),Mk=jt(OA,se,"%",se,Vn,se,_k,Ce,">"),Fk=It(Nk,"|",Mk),Pk=jt(Jm,se,Qm),Ok=jt(""),hy=jt(Ce,"=",Ce),NA=/1[.]\d+/,Rk=jt(se,"version",hy,It("'",NA,"'","|",'"',NA,'"')),_A=/[A-Za-z][-A-Za-z0-9._]*/,Lk=It(se,"encoding",hy,It('"',_A,'"',"|","'",_A,"'")),Bk=It(se,"standalone",hy,It("'",It("yes","|","no"),"'","|",'"',It("yes","|","no"),'"')),Uk=jt(/^<\?xml/,Rk,Lk,"?",Bk,"?",Ce,/\?>/),zk="",Gk=//,Vk=jt(Vo,"*?",$k),qk=jt(Gk,Vk);Bt.chars=$o;Bt.chars_without=Kc;Bt.detectUnicodeSupport=MA;Bt.reg=jt;Bt.regg=It;Bt.ABOUT_LEGACY_COMPAT=ay;Bt.ABOUT_LEGACY_COMPAT_SystemLiteral=Sk;Bt.AttlistDecl=Tk;Bt.CDATA_START=jk;Bt.CDATA_END=Hk;Bt.CDSect=qk;Bt.Char=Vo;Bt.Comment=hk;Bt.COMMENT_START=FA;Bt.COMMENT_END=PA;Bt.DOCTYPE_DECL_START=zk;Bt.elementdecl=xk;Bt.EntityDecl=Fk;Bt.EntityValue=cy;Bt.ExternalID=tg;Bt.ExternalID_match=Dk;Bt.Name=Vn;Bt.NotationDecl=Ok;Bt.Reference=Md;Bt.PEReference=Fd;Bt.PI=uk;Bt.PUBLIC=Jm;Bt.PubidLiteral=Qm;Bt.QName=Rd;Bt.QName_exact=lk;Bt.QName_group=ck;Bt.S=se;Bt.SChar_s=ek;Bt.S_OPT=Ce;Bt.SYSTEM=uy;Bt.SystemLiteral=Pd;Bt.UNICODE_REPLACEMENT_CHARACTER=tk;Bt.UNICODE_SUPPORT=Od;Bt.XMLDecl=Uk});var by=zt(je=>{"use strict";H();var Wn=Go(),Vr=Wn.find,Wk=Wn.hasDefaultHTMLNamespace,Qc=Wn.hasOwn,Xk=Wn.isHTMLMimeType,Yk=Wn.isHTMLRawTextElement,Kk=Wn.isHTMLVoidElement,Ld=Wn.MIME_TYPE,qr=Wn.NAMESPACE,ji=Symbol(),HA=Nd(),St=HA.DOMException,Zk=HA.DOMExceptionName,Gr=dy();function tn(r){if(r!==ji)throw new TypeError("Illegal constructor")}function Qk(r){return r!==""}function Jk(r){return r?r.split(/[\t\n\f\r ]+/).filter(Qk):[]}function tI(r,t){return Qc(r,t)||(r[t]=!0),r}function RA(r){if(!r)return[];var t=Jk(r);return Object.keys(t.reduce(tI,{}))}function eI(r){return function(t){return r&&r.indexOf(t)!==-1}}function GA(r){if(!Gr.QName_exact.test(r))throw new St(St.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+r+'"')}function my(r,t){GA(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 St(St.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(e==="xml"&&r!==Wn.NAMESPACE.XML)throw new St(St.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((e==="xmlns"||t==="xmlns")&&r!==Wn.NAMESPACE.XMLNS)throw new St(St.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(r===Wn.NAMESPACE.XMLNS&&e!=="xmlns"&&t!=="xmlns")throw new St(St.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[r,e,i]}function eu(r,t){for(var e in r)Qc(r,e)&&(t[e]=r[e])}function en(r,t){var e=r.prototype;if(!(e instanceof t)){let i=function(){};i.prototype=t.prototype,i=new i,eu(e,i),r.prototype=e=i}e.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),e.constructor=r)}var nn={},qn=nn.ELEMENT_NODE=1,Jc=nn.ATTRIBUTE_NODE=2,eg=nn.TEXT_NODE=3,$A=nn.CDATA_SECTION_NODE=4,VA=nn.ENTITY_REFERENCE_NODE=5,iI=nn.ENTITY_NODE=6,qA=nn.PROCESSING_INSTRUCTION_NODE=7,WA=nn.COMMENT_NODE=8,Ud=nn.DOCUMENT_NODE=9,XA=nn.DOCUMENT_TYPE_NODE=10,Pa=nn.DOCUMENT_FRAGMENT_NODE=11,nI=nn.NOTATION_NODE=12,Me=Wn.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 YA(r,t){if(t.length=0&&r=0){for(var n=t.length-1;i<=n;)t[i]=t[++i];if(t.length=n,r){var s=r.ownerDocument;s&&JA(s,r,e),e.ownerElement=null}}}tu.prototype={length:0,item:ei.prototype.item,getNamedItem:function(r){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());for(var t=0;tLA(t.ownerDocument)?Me.DOCUMENT_POSITION_FOLLOWING:Me.DOCUMENT_POSITION_PRECEDING);if(n&&t===e)return Me.DOCUMENT_POSITION_CONTAINS+Me.DOCUMENT_POSITION_PRECEDING;if(i&&t===e)return Me.DOCUMENT_POSITION_CONTAINED_BY+Me.DOCUMENT_POSITION_FOLLOWING;for(var l=[],c=t.parentNode;c;){if(!n&&c===e)return Me.DOCUMENT_POSITION_CONTAINED_BY+Me.DOCUMENT_POSITION_FOLLOWING;l.push(c),c=c.parentNode}l.reverse();for(var u=[],h=e.parentNode;h;){if(!i&&h===t)return Me.DOCUMENT_POSITION_CONTAINS+Me.DOCUMENT_POSITION_PRECEDING;u.push(h),h=h.parentNode}u.reverse();var d=YA(l,u);for(var f in d.childNodes){var m=d.childNodes[f];if(m===e)return Me.DOCUMENT_POSITION_FOLLOWING;if(m===t)return Me.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(m)>=0)return Me.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(m)>=0)return Me.DOCUMENT_POSITION_PRECEDING}return 0}};function QA(r){return r=="<"&&"<"||r==">"&&">"||r=="&"&&"&"||r=='"'&&"""||"&#"+r.charCodeAt()+";"}eu(nn,Vt);eu(nn,Vt.prototype);eu(Me,Vt);eu(Me,Vt.prototype);function Bd(r,t){if(t(r))return!0;if(r=r.firstChild)do if(Bd(r,t))return!0;while(r=r.nextSibling)}function Ns(r,t){tn(r);var e=t||{};this.ownerDocument=this,this.contentType=e.contentType||Ld.XML_APPLICATION,this.type=Xk(this.contentType)?"html":"xml"}function sI(r,t,e){r&&r._inc++;var i=e.namespaceURI;i===qr.XMLNS&&(t._nsMap[e.prefix?e.localName:""]=e.value)}function JA(r,t,e,i){r&&r._inc++;var n=e.namespaceURI;n===qr.XMLNS&&delete t._nsMap[e.prefix?e.localName:""]}function tv(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 ev(r,t){if(r!==t.parentNode)throw new St(St.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,tv(r.ownerDocument,r),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}function aI(r){return r&&(r.nodeType===Vt.DOCUMENT_NODE||r.nodeType===Vt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Vt.ELEMENT_NODE)}function oI(r){return r&&(r.nodeType===Vt.CDATA_SECTION_NODE||r.nodeType===Vt.COMMENT_NODE||r.nodeType===Vt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Vt.DOCUMENT_TYPE_NODE||r.nodeType===Vt.ELEMENT_NODE||r.nodeType===Vt.PROCESSING_INSTRUCTION_NODE||r.nodeType===Vt.TEXT_NODE)}function Oa(r){return r&&r.nodeType===Vt.DOCUMENT_TYPE_NODE}function Is(r){return r&&r.nodeType===Vt.ELEMENT_NODE}function iv(r){return r&&r.nodeType===Vt.TEXT_NODE}function UA(r,t){var e=r.childNodes||[];if(Vr(e,Is)||Oa(t))return!1;var i=Vr(e,Oa);return!(t&&i&&e.indexOf(i)>e.indexOf(t))}function zA(r,t){var e=r.childNodes||[];function i(s){return Is(s)&&s!==t}if(Vr(e,i))return!1;var n=Vr(e,Oa);return!(t&&n&&e.indexOf(n)>e.indexOf(t))}function lI(r,t,e){if(!aI(r))throw new St(St.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+r.nodeType);if(e&&e.parentNode!==r)throw new St(St.NOT_FOUND_ERR,"child not in parent");if(!oI(t)||Oa(t)&&r.nodeType!==Vt.DOCUMENT_NODE)throw new St(St.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+r.nodeType)}function cI(r,t,e){var i=r.childNodes||[],n=t.childNodes||[];if(t.nodeType===Vt.DOCUMENT_FRAGMENT_NODE){var s=n.filter(Is);if(s.length>1||Vr(n,iv))throw new St(St.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!UA(r,e))throw new St(St.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Is(t)&&!UA(r,e))throw new St(St.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Oa(t)){if(Vr(i,Oa))throw new St(St.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Vr(i,Is);if(e&&i.indexOf(o)1||Vr(n,iv))throw new St(St.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!zA(r,e))throw new St(St.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Is(t)&&!zA(r,e))throw new St(St.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Oa(t)){if(Vr(i,function(c){return Oa(c)&&c!==e}))throw new St(St.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Vr(i,Is);if(e&&i.indexOf(o)")!==-1)throw new St(St.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new sg(ji);return t.ownerDocument=this,t.childNodes=new ei,t.appendData(r),t},createProcessingInstruction:function(r,t){var e=new lg(ji);return e.ownerDocument=this,e.childNodes=new ei,e.nodeName=e.target=r,e.nodeValue=e.data=t,e},createAttribute:function(r){if(!Gr.QName_exact.test(r))throw new St(St.INVALID_CHARACTER_ERR,'invalid character in name "'+r+'"');return this.type==="html"&&(r=r.toLowerCase()),this._createAttribute(r)},_createAttribute:function(r){var t=new qo(ji);return t.ownerDocument=this,t.childNodes=new ei,t.name=r,t.nodeName=r,t.localName=r,t.specified=!0,t},createEntityReference:function(r){if(!Gr.Name.test(r))throw new St(St.INVALID_CHARACTER_ERR,'not a valid xml name "'+r+'"');if(this.type==="html")throw new St("document is an html document",Zk.NotSupportedError);var t=new og(ji);return t.ownerDocument=this,t.childNodes=new ei,t.nodeName=r,t},createElementNS:function(r,t){var e=my(r,t),i=new _s(ji),n=i.attributes=new tu;return i.childNodes=new ei,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=my(r,t),i=new qo(ji);return i.ownerDocument=this,i.childNodes=new ei,i.nodeName=t,i.name=t,i.specified=!0,i.namespaceURI=e[0],i.prefix=e[1],i.localName=e[2],i}};en(Ns,Vt);function _s(r){tn(r),this._nsMap=Object.create(null)}_s.prototype={nodeType:qn,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===qr.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=my(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=RA(r);return new $r(this,function(e){var i=[];return t.length>0&&Bd(e,function(n){if(n!==e&&n.nodeType===qn){var s=n.getAttribute("class");if(s){var o=r===s;if(!o){var l=RA(s);o=t.every(eI(l))}o&&i.push(n)}}}),i})},getElementsByTagName:function(r){var t=(this.nodeType===Ud?this:this.ownerDocument).type==="html",e=r.toLowerCase();return new $r(this,function(i){var n=[];return Bd(i,function(s){if(!(s===i||s.nodeType!==qn))if(r==="*")n.push(s);else{var o=s.getQualifiedName(),l=t&&s.namespaceURI===qr.HTML?e:r;o===l&&n.push(s)}}),n})},getElementsByTagNameNS:function(r,t){return new $r(this,function(e){var i=[];return Bd(e,function(n){n!==e&&n.nodeType===qn&&(r==="*"||n.namespaceURI===r)&&(t==="*"||n.localName==t)&&i.push(n)}),i})}};Ns.prototype.getElementsByClassName=_s.prototype.getElementsByClassName;Ns.prototype.getElementsByTagName=_s.prototype.getElementsByTagName;Ns.prototype.getElementsByTagNameNS=_s.prototype.getElementsByTagNameNS;en(_s,Vt);function qo(r){tn(r),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}qo.prototype.nodeType=Jc;en(qo,Vt);function iu(r){tn(r)}iu.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}};en(iu,Vt);function zd(r){tn(r)}zd.prototype={nodeName:"#text",nodeType:eg,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}};en(zd,iu);function rg(r){tn(r)}rg.prototype={nodeName:"#comment",nodeType:WA};en(rg,iu);function sg(r){tn(r)}sg.prototype={nodeName:"#cdata-section",nodeType:$A};en(sg,zd);function ag(r){tn(r)}ag.prototype.nodeType=XA;en(ag,Vt);function xy(r){tn(r)}xy.prototype.nodeType=nI;en(xy,Vt);function yy(r){tn(r)}yy.prototype.nodeType=iI;en(yy,Vt);function og(r){tn(r)}og.prototype.nodeType=VA;en(og,Vt);function nu(r){tn(r)}nu.prototype.nodeName="#document-fragment";nu.prototype.nodeType=Pa;en(nu,Vt);function lg(r){tn(r)}lg.prototype.nodeType=qA;en(lg,iu);function rv(){}rv.prototype.serializeToString=function(r,t){return sv.call(r,t)};Vt.prototype.toString=sv;function sv(r){var t=[],e=this.nodeType===Ud&&this.documentElement||this,i=e.prefix,n=e.namespaceURI;if(n&&i==null){var i=e.lookupPrefix(n);if(i==null)var s=[{namespace:n,prefix:null}]}return Zc(this,t,r,s),t.join("")}function jA(r,t,e){var i=r.prefix||"",n=r.namespaceURI;if(!n||i==="xml"&&n===qr.XML||n===qr.XMLNS)return!1;for(var s=e.length;s--;){var o=e[s];if(o.prefix===i)return o.namespace!==n}return!0}function fy(r,t,e){r.push(" ",t,'="',e.replace(/[<>&"\t\n\r]/g,QA),'"')}function Zc(r,t,e,i){i||(i=[]);var n=r.nodeType===Ud?r:r.ownerDocument,s=n.type==="html";if(e)if(r=e(r),r){if(typeof r=="string"){t.push(r);return}}else return;switch(r.nodeType){case qn:var o=r.attributes,l=o.length,T=r.firstChild,c=r.tagName,u=c;if(!s&&!r.prefix&&r.namespaceURI){for(var h,d=0;d=0;f--){var m=i[f];if(m.prefix===""&&m.namespace===r.namespaceURI){h=m.namespace;break}}if(h!==r.namespaceURI)for(var f=i.length-1;f>=0;f--){var m=i[f];if(m.namespace===r.namespaceURI){m.prefix&&(u=m.prefix+":"+c);break}}}t.push("<",u);for(var y=0;y");else{if(t.push(">"),s&&Yk(c))for(;T;)T.data?t.push(T.data):Zc(T,t,e,i.slice()),T=T.nextSibling;else for(;T;)Zc(T,t,e,i.slice()),T=T.nextSibling;t.push("")}return;case Ud:case Pa:for(var T=r.firstChild;T;)Zc(T,t,e,i.slice()),T=T.nextSibling;return;case Jc:return fy(t,r.name,r.value);case eg:return t.push(r.data.replace(/[<&>]/g,QA));case $A:return t.push(Gr.CDATA_START,r.data.replace(/]]>/g,"]]]]>"),Gr.CDATA_END);case WA:return t.push(Gr.COMMENT_START,r.data,Gr.COMMENT_END);case XA:var I=r.publicId,_=r.systemId;t.push(Gr.DOCTYPE_DECL_START," ",r.name),I?(t.push(" ",Gr.PUBLIC," ",I),_&&_!=="."&&t.push(" ",_)):_&&_!=="."&&t.push(" ",Gr.SYSTEM," ",_),r.internalSubset&&t.push(" [",r.internalSubset,"]"),t.push(">");return;case qA:return t.push("");case VA:return t.push("&",r.nodeName,";");default:t.push("??",r.nodeName)}}function av(r,t,e){var i;switch(t.nodeType){case qn:i=t.cloneNode(!1),i.ownerDocument=r;case Pa:break;case Jc:e=!0;break}if(i||(i=t.cloneNode(!1)),i.ownerDocument=r,i.parentNode=null,e)for(var n=t.firstChild;n;)i.appendChild(av(r,n,e)),n=n.nextSibling;return i}function gy(r,t,e){var i=new t.constructor(ji);for(var n in t)if(Qc(t,n)){var s=t[n];typeof s!="object"&&s!=i[n]&&(i[n]=s)}switch(t.childNodes&&(i.childNodes=new ei),i.ownerDocument=r,i.nodeType){case qn:var o=t.attributes,l=i.attributes=new tu,c=o.length;l._ownerElement=i;for(var u=0;u{"use strict";H();var lv=Go().freeze;jd.XML_ENTITIES=lv({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});jd.HTML_ENTITIES=lv({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:` +`,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"});jd.entityMap=jd.HTML_ENTITIES});var wv=zt(ug=>{"use strict";H();var ou=Go(),Ot=dy(),pv=Nd(),uI=ou.isHTMLEscapableRawTextElement,hI=ou.isHTMLMimeType,dI=ou.isHTMLRawTextElement,Vd=ou.hasOwn,uv=ou.NAMESPACE,hv=pv.ParseError,fI=pv.DOMException,Hd=0,Ra=1,ru=2,Gd=3,su=4,au=5,$d=6,cg=7;function mv(){}mv.prototype={parse:function(r,t,e){var i=this.domBuilder;i.startDocument(),gv(t,t=Object.create(null)),pI(r,t,e,i,this.errorHandler),i.endDocument()}};var wy=/&#?\w+;?/g;function pI(r,t,e,i,n){var s=hI(i.mimeType);r.indexOf(Ot.UNICODE_REPLACEMENT_CHARACTER)>=0&&n.warning("Unicode replacement character detected, source encoding issues?");function o(E){if(E>65535){E-=65536;var S=55296+(E>>10),k=56320+(E&1023);return String.fromCharCode(S,k)}else return String.fromCharCode(E)}function l(E){var S=E[E.length-1]===";"?E:E+";";if(!s&&S!==E)return n.error("EntityRef: expecting ;"),E;var k=Ot.Reference.exec(S);if(!k||k[0].length!==S.length)return n.error("entity not matching Reference production: "+E),E;var M=S.slice(1,-1);return Vd(e,M)?e[M]:M.charAt(0)==="#"?o(parseInt(M.substring(1).replace("x","0x"))):(n.error("entity not found:"+E),E)}function c(E){if(E>A){var S=r.substring(A,E).replace(wy,l);f&&m(A),i.characters(S,0,E-A),A=E}}var u=0,h=0,d=/\r\n?|\n|$/g,f=i.locator;function m(E,S){for(;E>=h&&(S=d.exec(r));)u=h,h=S.index+S[0].length,f.lineNumber++;f.columnNumber=E-u+1}for(var y=[{currentNSMap:t}],g=[],A=0;;){try{var w=r.indexOf("<",A);if(w<0){if(!s&&g.length>0)return n.fatalError("unclosed xml tag(s): "+g.join(", "));if(!r.substring(A).match(/^\s*$/)){var v=i.doc,T=v.createTextNode(r.substring(A));if(v.documentElement)return n.error("Extra content at the end of the document");v.appendChild(T),i.currentElement=T}return}if(w>A){var I=r.substring(A,w);!s&&g.length===0&&(I=I.replace(new RegExp(Ot.S_OPT.source,"g"),""),I&&n.error("Unexpected content outside root element: '"+I+"'")),c(w)}switch(r.charAt(w+1)){case"/":var N=r.indexOf(">",w+2),_=r.substring(w+2,N>0?N:void 0);if(!_)return n.fatalError("end tag name missing");var F=N>0&&Ot.reg("^",Ot.QName_group,Ot.S_OPT,"$").exec(_);if(!F)return n.fatalError('end tag name contains invalid characters: "'+_+'"');if(!i.currentElement&&!i.doc.documentElement)return;var L=g[g.length-1]||i.currentElement.tagName||i.doc.documentElement.tagName||"";if(L!==F[1]){var Y=F[1].toLowerCase();if(!s||L.toLowerCase()!==Y)return n.fatalError('Opening and ending tag mismatch: "'+L+'" != "'+_+'"')}var q=y.pop();g.pop();var G=q.localNSMap;if(i.endElement(q.uri,q.localName,L),G)for(var j in G)Vd(G,j)&&i.endPrefixMapping(j);N++;break;case"?":f&&m(w),N=yI(r,w,i,n);break;case"!":f&&m(w),N=yv(r,w,i,n,s);break;default:f&&m(w);var J=new bv,et=y[y.length-1].currentNSMap,N=mI(r,w,J,et,l,n,s),X=J.length;if(J.closed||(s&&ou.isHTMLVoidElement(J.tagName)?J.closed=!0:g.push(J.tagName)),f&&X){for(var O=dv(f,{}),C=0;CA?A=N:c(Math.max(w,A)+1)}}function dv(r,t){return t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber,t}function mI(r,t,e,i,n,s,o){function l(m,y,g){if(Vd(e.attributeNames,m))return s.fatalError("Attribute "+m+" redefined");if(!o&&y.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");e.addValue(m,y.replace(/[\t\n\r]/g," ").replace(wy,n),g)}for(var c,u,h=++t,d=Hd;;){var f=r.charAt(h);switch(f){case"=":if(d===Ra)c=r.slice(t,h),d=Gd;else if(d===ru)d=Gd;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===Gd||d===Ra)if(d===Ra&&(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=au;else throw new Error("attribute value no end '"+f+"' match");else if(d==su)u=r.slice(t,h),l(c,u,t),s.warning('attribute "'+c+'" missed start quot('+f+")!!"),t=h+1,d=au;else throw new Error('attribute value must after "="');break;case"/":switch(d){case Hd:e.setTagName(r.slice(t,h));case au:case $d:case cg:d=cg,e.closed=!0;case su:case Ra:break;case ru:e.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==Hd&&e.setTagName(r.slice(t,h)),h;case">":switch(d){case Hd:e.setTagName(r.slice(t,h));case au:case $d:case cg:break;case su:case Ra:u=r.slice(t,h),u.slice(-1)==="/"&&(e.closed=!0,u=u.slice(0,-1));case ru:d===ru&&(u=c),d==su?(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 Gd:if(!o)return s.fatalError(`AttValue: ' or " expected`)}return h;case"\x80":f=" ";default:if(f<=" ")switch(d){case Hd:e.setTagName(r.slice(t,h)),d=$d;break;case Ra:c=r.slice(t,h),d=ru;break;case su:var u=r.slice(t,h);s.warning('attribute "'+u+'" missed quot(")!!'),l(c,u,t);case au:d=$d;break}else switch(d){case ru:o||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),l(c,c,t),t=h,d=Ra;break;case au:s.warning('attribute space is required"'+c+'"!!');case $d:d=Ra,t=h;break;case Gd:d=su,t=h;break;case cg:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function fv(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),gv(e,e=Object.create(null))),e[h]=n[h]=l,s.uri=uv.XMLNS,t.startPrefixMapping(h,l))}for(var d=r.length;d--;)s=r[d],s.prefix&&(s.prefix==="xml"&&(s.uri=uv.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)Vd(n,c)&&t.endPrefixMapping(c)}else return r.currentNSMap=e,r.localNSMap=n,!0}function gI(r,t,e,i,n){var s=uI(e);if(s||dI(e)){var o=r.indexOf("",t),l=r.substring(t+1,o);return s&&(l=l.replace(wy,i)),n.characters(l,0,l.length),o}return t+1}function gv(r,t){for(var e in r)Vd(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"?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 "0)return i.fatalError("processing instruction at position "+t+" is an xml declaration which is only at the start of the document");if(!Ot.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 bv(){this.attributeNames=Object.create(null)}bv.prototype={setTagName:function(r){if(!Ot.QName_exact.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,t,e){if(!Ot.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}};ug.XMLReader=mv;ug.parseUtils=xv;ug.parseDoctypeCommentOrCData=yv});var Dv=zt(cu=>{"use strict";H();var Wo=Go(),bI=by(),wI=Nd(),Av=cv(),AI=wv(),vI=bI.DOMImplementation,EI=Wo.hasDefaultHTMLNamespace,CI=Wo.isHTMLMimeType,TI=Wo.isValidMimeType,Cv=Wo.MIME_TYPE,Ay=Wo.NAMESPACE,vv=wI.ParseError,SI=AI.XMLReader;function Tv(r){return r.replace(/\r[\n\u0085]/g,` `).replace(/[\r\u0085\u2028\u2029]/g,` -`)}function Sv(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||Wo.assign,this.domHandler=r.domHandler||dg,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||Tv,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}Sv.prototype.parseFromString=function(r,t){if(!Tk(t))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+t+'" is not valid.');var e=this.assign(Object.create(null),this.xmlns),i=Av.XML_ENTITIES,n=e[""]||null;Ek(t)?(i=Av.HTML_ENTITIES,n=Ay.HTML):t===Cv.XML_SVG_IMAGE&&(n=Ay.SVG),e[""]=n,e.xml=e.xml||Ay.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 Sk;l.errorHandler=s,l.domBuilder=s;var c=!Wo.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 dg(r){var t=r||{};this.mimeType=t.mimeType||Cv.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 lu(r,t){t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber}dg.prototype={startDocument:function(){var r=new vk;this.doc=Ck(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;hg(this,s),this.currentElement=s,this.locator&&lu(this.locator,s);for(var l=0;l=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){dg.prototype[r]=function(){return null}});function hg(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}function Ik(r){if(r==="error")throw"onErrorStopParsing"}function kk(){throw"onWarningStopParsing"}cu.__DOMHandler=dg;cu.DOMParser=Sv;cu.normalizeLineEndings=Tv;cu.onErrorStopParsing=Ik;cu.onWarningStopParsing=kk});var Iv=Ut(qt=>{"use strict";H();var uu=Go();qt.assign=uu.assign;qt.hasDefaultHTMLNamespace=uu.hasDefaultHTMLNamespace;qt.isHTMLMimeType=uu.isHTMLMimeType;qt.isValidMimeType=uu.isValidMimeType;qt.MIME_TYPE=uu.MIME_TYPE;qt.NAMESPACE=uu.NAMESPACE;var fg=_d();qt.DOMException=fg.DOMException;qt.DOMExceptionName=fg.DOMExceptionName;qt.ExceptionCode=fg.ExceptionCode;qt.ParseError=fg.ParseError;var ii=by();qt.Attr=ii.Attr;qt.CDATASection=ii.CDATASection;qt.CharacterData=ii.CharacterData;qt.Comment=ii.Comment;qt.Document=ii.Document;qt.DocumentFragment=ii.DocumentFragment;qt.DocumentType=ii.DocumentType;qt.DOMImplementation=ii.DOMImplementation;qt.Element=ii.Element;qt.Entity=ii.Entity;qt.EntityReference=ii.EntityReference;qt.LiveNodeList=ii.LiveNodeList;qt.NamedNodeMap=ii.NamedNodeMap;qt.Node=ii.Node;qt.NodeList=ii.NodeList;qt.Notation=ii.Notation;qt.ProcessingInstruction=ii.ProcessingInstruction;qt.Text=ii.Text;qt.XMLSerializer=ii.XMLSerializer;var pg=Dv();qt.DOMParser=pg.DOMParser;qt.normalizeLineEndings=pg.normalizeLineEndings;qt.onErrorStopParsing=pg.onErrorStopParsing;qt.onWarningStopParsing=pg.onWarningStopParsing});var Nv=Ut((MF,Ey)=>{H();var vy=(function(r){"use strict";var t=Object.prototype,e=t.hasOwnProperty,i=Object.defineProperty||function(C,D,E){C[D]=E.value},n,s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function u(C,D,E){return Object.defineProperty(C,D,{value:E,enumerable:!0,configurable:!0,writable:!0}),C[D]}try{u({},"")}catch{u=function(D,E,S){return D[E]=S}}function h(C,D,E,S){var I=D&&D.prototype instanceof w?D:w,M=Object.create(I.prototype),P=new _(S||[]);return i(M,"_invoke",{value:G(C,E,P)}),M}r.wrap=h;function d(C,D,E){try{return{type:"normal",arg:C.call(D,E)}}catch(S){return{type:"throw",arg:S}}}var f="suspendedStart",m="suspendedYield",y="executing",g="completed",A={};function w(){}function v(){}function T(){}var k={};u(k,o,function(){return this});var N=Object.getPrototypeOf,F=N&&N(N(X([])));F&&F!==t&&e.call(F,o)&&(k=F);var L=T.prototype=w.prototype=Object.create(k);v.prototype=T,i(L,"constructor",{value:T,configurable:!0}),i(T,"constructor",{value:v,configurable:!0}),v.displayName=u(T,c,"GeneratorFunction");function Y(C){["next","throw","return"].forEach(function(D){u(C,D,function(E){return this._invoke(D,E)})})}r.isGeneratorFunction=function(C){var D=typeof C=="function"&&C.constructor;return D?D===v||(D.displayName||D.name)==="GeneratorFunction":!1},r.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,T):(C.__proto__=T,u(C,c,"GeneratorFunction")),C.prototype=Object.create(L),C},r.awrap=function(C){return{__await:C}};function q(C,D){function E(M,P,B,$){var U=d(C[M],C,P);if(U.type==="throw")$(U.arg);else{var V=U.arg,Z=V.value;return Z&&typeof Z=="object"&&e.call(Z,"__await")?D.resolve(Z.__await).then(function(Q){E("next",Q,B,$)},function(Q){E("throw",Q,B,$)}):D.resolve(Z).then(function(Q){V.value=Q,B(V)},function(Q){return E("throw",Q,B,$)})}}var S;function I(M,P){function B(){return new D(function($,U){E(M,P,$,U)})}return S=S?S.then(B,B):B()}i(this,"_invoke",{value:I})}Y(q.prototype),u(q.prototype,l,function(){return this}),r.AsyncIterator=q,r.async=function(C,D,E,S,I){I===void 0&&(I=Promise);var M=new q(h(C,D,E,S),I);return r.isGeneratorFunction(D)?M:M.next().then(function(P){return P.done?P.value:M.next()})};function G(C,D,E){var S=f;return function(M,P){if(S===y)throw new Error("Generator is already running");if(S===g){if(M==="throw")throw P;return O()}for(E.method=M,E.arg=P;;){var B=E.delegate;if(B){var $=j(B,E);if($){if($===A)continue;return $}}if(E.method==="next")E.sent=E._sent=E.arg;else if(E.method==="throw"){if(S===f)throw S=g,E.arg;E.dispatchException(E.arg)}else E.method==="return"&&E.abrupt("return",E.arg);S=y;var U=d(C,D,E);if(U.type==="normal"){if(S=E.done?g:m,U.arg===A)continue;return{value:U.arg,done:E.done}}else U.type==="throw"&&(S=g,E.method="throw",E.arg=U.arg)}}}function j(C,D){var E=D.method,S=C.iterator[E];if(S===n)return D.delegate=null,E==="throw"&&C.iterator.return&&(D.method="return",D.arg=n,j(C,D),D.method==="throw")||E!=="return"&&(D.method="throw",D.arg=new TypeError("The iterator does not provide a '"+E+"' method")),A;var I=d(S,C.iterator,D.arg);if(I.type==="throw")return D.method="throw",D.arg=I.arg,D.delegate=null,A;var M=I.arg;if(!M)return D.method="throw",D.arg=new TypeError("iterator result is not an object"),D.delegate=null,A;if(M.done)D[C.resultName]=M.value,D.next=C.nextLoc,D.method!=="return"&&(D.method="next",D.arg=n);else return M;return D.delegate=null,A}Y(L),u(L,c,"Generator"),u(L,o,function(){return this}),u(L,"toString",function(){return"[object Generator]"});function tt(C){var D={tryLoc:C[0]};1 in C&&(D.catchLoc=C[1]),2 in C&&(D.finallyLoc=C[2],D.afterLoc=C[3]),this.tryEntries.push(D)}function et(C){var D=C.completion||{};D.type="normal",delete D.arg,C.completion=D}function _(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(tt,this),this.reset(!0)}r.keys=function(C){var D=Object(C),E=[];for(var S in D)E.push(S);return E.reverse(),function I(){for(;E.length;){var M=E.pop();if(M in D)return I.value=M,I.done=!1,I}return I.done=!0,I}};function X(C){if(C){var D=C[o];if(D)return D.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var E=-1,S=function I(){for(;++E=0;--S){var I=this.tryEntries[S],M=I.completion;if(I.tryLoc==="root")return E("end");if(I.tryLoc<=this.prev){var P=e.call(I,"catchLoc"),B=e.call(I,"finallyLoc");if(P&&B){if(this.prev=0;--E){var S=this.tryEntries[E];if(S.tryLoc<=this.prev&&e.call(S,"finallyLoc")&&this.prev=0;--D){var E=this.tryEntries[D];if(E.finallyLoc===C)return this.complete(E.completion,E.afterLoc),et(E),A}},catch:function(C){for(var D=this.tryEntries.length-1;D>=0;--D){var E=this.tryEntries[D];if(E.tryLoc===C){var S=E.completion;if(S.type==="throw"){var I=S.arg;et(E)}return I}}throw new Error("illegal catch attempt")},delegateYield:function(C,D,E){return this.delegate={iterator:X(C),resultName:D,nextLoc:E},this.method==="next"&&(this.arg=n),A}},r})(typeof Ey=="object"?Ey.exports:{});try{regeneratorRuntime=vy}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=vy:Function("r","regeneratorRuntime = r")(vy)}});var xg=Ut((PF,Mv)=>{"use strict";H();Mv.exports=(r,t)=>`${r}-${t}-${Math.random().toString(16).slice(3,8)}`});var Cy=Ut((RF,Pv)=>{"use strict";H();var Lk=xg(),Fv=0;Pv.exports=({id:r,action:t,payload:e={}})=>{let i=r;return typeof i>"u"&&(i=Lk("Job",Fv),Fv+=1),{id:i,action:t,payload:e}}});var yg=Ut(Wd=>{"use strict";H();var Ty=!1;Wd.logging=Ty;Wd.setLogging=r=>{Ty=r};Wd.log=(...r)=>Ty?console.log.apply(Wd,r):null});var Bv=Ut((Rv,Lv)=>{"use strict";H();var Bk=Cy(),{log:bg}=yg(),Uk=xg(),Ov=0;Lv.exports=()=>{let r=Uk("Scheduler",Ov),t={},e={},i=[];Ov+=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"u"){i[0](t[d[f]]);break}}},l=(d,f)=>new Promise((m,y)=>{let g=Bk({action:d,payload:f});i.push(async A=>{i.shift(),e[A.id]=g;try{m(await A[d].apply(Rv,[...f,g.id]))}catch(w){y(w)}finally{delete e[A.id],o()}}),bg(`[${r}]: Add ${g.id} to JobQueue`),bg(`[${r}]: JobQueue length=${i.length}`),o()});return{addWorker:d=>(t[d.id]=d,bg(`[${r}]: Add ${d.id}`),bg(`[${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 zv=Ut((jF,Uv)=>{"use strict";H();Uv.exports=r=>{let t={};return typeof WorkerGlobalScope<"u"?t.type="webworker":typeof document=="object"?t.type="browser":typeof it.default=="object"&&typeof Vm=="function"&&(t.type="node"),typeof r>"u"?t:t[r]}});var Hv=Ut(($F,jv)=>{"use strict";H();var zk=zv()("type")==="browser",jk=zk?r=>new URL(r,window.location.href).href:r=>r;jv.exports=r=>{let t={...r};return["corePath","workerPath","langPath"].forEach(e=>{r[e]&&(t[e]=jk(t[e]))}),t}});var Sy=Ut((qF,Gv)=>{"use strict";H();Gv.exports={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}});var $v=Ut((XF,Hk)=>{Hk.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 qv=Ut((YF,Vv)=>{"use strict";H();Vv.exports={workerBlobURL:!0,logger:()=>{}}});var Xv=Ut((ZF,Wv)=>{"use strict";H();var Gk=$v().version,$k=qv();Wv.exports={...$k,workerPath:`https://cdn.jsdelivr.net/npm/tesseract.js@v${Gk}/dist/worker.min.js`}});var Kv=Ut((JF,Yv)=>{"use strict";H();Yv.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 Qv=Ut((eP,Zv)=>{"use strict";H();Zv.exports=r=>{r.terminate()}});var tE=Ut((nP,Jv)=>{"use strict";H();Jv.exports=(r,t)=>{r.onmessage=({data:e})=>{t(e)}}});var iE=Ut((sP,eE)=>{"use strict";H();eE.exports=async(r,t)=>{r.postMessage(t)}});var rE=Ut((oP,nE)=>{"use strict";H();var Dy=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)}),Iy=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 Iy(r.src)),r.tagName==="VIDEO"&&(t=await Iy(r.poster)),r.tagName==="CANVAS"&&await new Promise(e=>{r.toBlob(async i=>{t=await Dy(i),e()})});else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas){let e=await r.convertToBlob();t=await Dy(e)}else(r instanceof File||r instanceof Blob)&&(t=await Dy(r));return new Uint8Array(t)};nE.exports=Iy});var aE=Ut((cP,sE)=>{"use strict";H();var Vk=Xv(),qk=Kv(),Wk=Qv(),Xk=tE(),Yk=iE(),Kk=rE();sE.exports={defaultOptions:Vk,spawnWorker:qk,terminateWorker:Wk,onMessage:Xk,send:Yk,loadImage:Kk}});var ky=Ut((hP,uE)=>{"use strict";H();var Zk=Hv(),Xr=Cy(),{log:oE}=yg(),Qk=xg(),Yo=Sy(),{defaultOptions:Jk,spawnWorker:t_,terminateWorker:e_,onMessage:i_,loadImage:lE,send:n_}=aE(),cE=0;uE.exports=async(r="eng",t=Yo.LSTM_ONLY,e={},i={})=>{let n=Qk("Worker",cE),{logger:s,errorHandler:o,...l}=Zk({...Jk,...e}),c={},u=typeof r=="string"?r.split("+"):r,h=t,d=i,f=[Yo.DEFAULT,Yo.LSTM_ONLY].includes(t)&&!l.legacyCore,m,y,g=new Promise((C,D)=>{y=C,m=D}),A=C=>{m(C.message)},w=t_(l);w.onerror=A,cE+=1;let v=({id:C,action:D,payload:E})=>new Promise((S,I)=>{oE(`[${n}]: Start ${C}, action=${D}`);let M=`${D}-${C}`;c[M]={resolve:S,reject:I},n_(w,{workerId:n,jobId:C,action:D,payload:E})}),T=()=>console.warn("`load` is depreciated and should be removed from code (workers now come pre-loaded)"),k=C=>v(Xr({id:C,action:"load",payload:{options:{lstmOnly:f,corePath:l.corePath,logging:l.logging}}})),N=(C,D,E)=>v(Xr({id:E,action:"FS",payload:{method:"writeFile",args:[C,D]}})),F=(C,D)=>v(Xr({id:D,action:"FS",payload:{method:"readFile",args:[C,{encoding:"utf8"}]}})),L=(C,D)=>v(Xr({id:D,action:"FS",payload:{method:"unlink",args:[C]}})),Y=(C,D,E)=>v(Xr({id:E,action:"FS",payload:{method:C,args:D}})),q=(C,D)=>v(Xr({id:D,action:"loadLanguage",payload:{langs:C,options:{langPath:l.langPath,dataPath:l.dataPath,cachePath:l.cachePath,cacheMethod:l.cacheMethod,gzip:l.gzip,lstmOnly:[Yo.DEFAULT,Yo.LSTM_ONLY].includes(h)&&!l.legacyLang}}})),G=(C,D,E,S)=>v(Xr({id:S,action:"initialize",payload:{langs:C,oem:D,config:E}})),j=(C="eng",D,E,S)=>{if(f&&[Yo.TESSERACT_ONLY,Yo.TESSERACT_LSTM_COMBINED].includes(D))throw Error("Legacy model requested but code missing.");let I=D||h;h=I;let M=E||d;d=M;let B=(typeof C=="string"?C.split("+"):C).filter($=>!u.includes($));return u.push(...B),B.length>0?q(B,S).then(()=>G(C,I,M,S)):G(C,I,M,S)},tt=(C={},D)=>v(Xr({id:D,action:"setParameters",payload:{params:C}})),et=async(C,D={},E={text:!0},S)=>v(Xr({id:S,action:"recognize",payload:{image:await lE(C),options:D,output:E}})),_=async(C,D)=>{if(f)throw Error("`worker.detect` requires Legacy model, which was not loaded.");return v(Xr({id:D,action:"detect",payload:{image:await lE(C)}}))},X=async()=>(w!==null&&(e_(w),w=null),Promise.resolve());i_(w,({workerId:C,jobId:D,status:E,action:S,data:I})=>{let M=`${S}-${D}`;if(E==="resolve")oE(`[${C}]: Complete ${D}`),c[M].resolve({jobId:D,data:I}),delete c[M];else if(E==="reject")if(c[M].reject(I),delete c[M],S==="load"&&m(I),o)o(I);else throw Error(I);else E==="progress"&&s({...I,userJobId:D})});let O={id:n,worker:w,load:T,writeText:N,readText:F,removeFile:L,FS:Y,reinitialize:j,setParameters:tt,recognize:et,detect:_,terminate:X};return k().then(()=>q(r)).then(()=>G(r,t,i)).then(()=>y(O)).catch(()=>{}),g}});var fE=Ut((fP,dE)=>{"use strict";H();var hE=ky(),r_=async(r,t,e)=>{let i=await hE(t,1,e);return i.recognize(r).finally(async()=>{await i.terminate()})},s_=async(r,t)=>{let e=await hE("osd",0,t);return e.detect(r).finally(async()=>{await e.terminate()})};dE.exports={recognize:r_,detect:s_}});var mE=Ut((mP,pE)=>{"use strict";H();pE.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=Ut((xP,gE)=>{"use strict";H();gE.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 bE=Ut((bP,yE)=>{"use strict";H();Nv();var a_=Bv(),o_=ky(),l_=fE(),c_=mE(),u_=Sy(),h_=xE(),{setLogging:d_}=yg();yE.exports={languages:c_,OEM:u_,PSM:h_,createScheduler:a_,createWorker:o_,setLogging:d_,...l_}});function k_(){if(!(typeof globalThis.TextDecoder>"u"))return Tg??(Tg=new globalThis.TextDecoder("utf-8"))}function HE(r,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let e=k_();return e?e.decode(r):N_(r)}case"utf-16le":return M_(r);case"us-ascii":case"ascii":return F_(r);case"latin1":case"iso-8859-1":return P_(r);case"windows-1252":return O_(r);default:throw new RangeError(`Encoding '${t}' not supported`)}}function Ry(r,t){t.length!==0&&(r.push(String.fromCharCode.apply(null,t)),t.length=0)}function Ke(r,t,e){t.push(e),t.length>=pu&&Ry(r,t)}function __(r,t,e){if(e<=65535){Ke(r,t,e);return}e-=65536,Ke(r,t,55296+(e>>10)),Ke(r,t,56320+(e&1023))}function N_(r){let t=[],e=[],i=0;for(r.length>=3&&r[0]===239&&r[1]===187&&r[2]===191&&(i=3);i244){Ke(t,e,yr),i++;continue}if(n<=223){if(i+1>=r.length){Ke(t,e,yr),i++;continue}let h=r[i+1];if((h&192)!==128){Ke(t,e,yr),i++;continue}let d=(n&31)<<6|h&63;Ke(t,e,d),i+=2;continue}if(n<=239){if(i+2>=r.length){Ke(t,e,yr),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))){Ke(t,e,yr),i++;continue}let m=(n&15)<<12|(h&63)<<6|d&63;Ke(t,e,m),i+=3;continue}if(i+3>=r.length){Ke(t,e,yr),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))){Ke(t,e,yr),i++;continue}let u=(n&7)<<18|(s&63)<<12|(o&63)<<6|l&63;__(t,e,u),i+=4}return Ry(t,e),t.join("")}function M_(r){let t=[],e=[],i=r.length,n=0;for(;n+1=55296&&s<=56319){if(n+1=56320&&o<=57343?(Ke(t,e,s),Ke(t,e,o),n+=2):Ke(t,e,yr)}else Ke(t,e,yr);continue}if(s>=56320&&s<=57343){Ke(t,e,yr);continue}Ke(t,e,s)}return n=128&&n<=159?jE[n]:void 0;e+=s??String.fromCharCode(n),e.length>=pu&&(t.push(e),e="")}return e&&t.push(e),t.join("")}var jE,I_,Tg,pu,yr,GE=Kt(()=>{H();jE={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"},I_={};for(let[r,t]of Object.entries(jE))I_[t]=Number.parseInt(r,10);pu=32*1024,yr=65533});function sn(r){return new DataView(r.buffer,r.byteOffset)}var $E,VE,Te,Zo,we,Ly,qE,WE,Mi,Ps=Kt(()=>{H();$E=Hc(qx(),1);GE();VE={len:1,get(r,t){return sn(r).getUint8(t)},put(r,t,e){return sn(r).setUint8(t,e),t+1}},Te={len:2,get(r,t){return sn(r).getUint16(t,!0)},put(r,t,e){return sn(r).setUint16(t,e,!0),t+2}},Zo={len:2,get(r,t){return sn(r).getUint16(t)},put(r,t,e){return sn(r).setUint16(t,e),t+2}},we={len:4,get(r,t){return sn(r).getUint32(t,!0)},put(r,t,e){return sn(r).setUint32(t,e,!0),t+4}},Ly={len:4,get(r,t){return sn(r).getUint32(t)},put(r,t,e){return sn(r).setUint32(t,e),t+4}},qE={len:4,get(r,t){return sn(r).getInt32(t)},put(r,t,e){return sn(r).setInt32(t,e),t+4}},WE={len:8,get(r,t){return sn(r).getBigUint64(t,!0)},put(r,t,e){return sn(r).setBigUint64(t,e,!0),t+8}},Mi=class{constructor(t,e){this.len=t,this.encoding=e}get(t,e=0){let i=t.subarray(e,e+this.len);return HE(i,this.encoding)}}});var R_,$t,Qo,Zd=Kt(()=>{H();R_="End-Of-Stream",$t=class extends Error{constructor(){super(R_),this.name="EndOfStreamError"}},Qo=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var XE=Kt(()=>{H()});var Jo,Sg=Kt(()=>{H();Zd();Jo=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 $t;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{H();Zd();XE();Sg()});var Dg,KE=Kt(()=>{H();Sg();Dg=class extends Jo{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var Qd,By=Kt(()=>{H();KE();Qd=class extends Dg{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 mu,Uy=Kt(()=>{H();Zd();Sg();mu=class extends Jo{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{H();By();Uy()});var tl=Kt(()=>{H();Zd();YE();By();Uy();ZE()});var Os,Jd=Kt(()=>{H();tl();Os=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})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{H();Jd();tl();B_=256e3,Ig=class extends Os{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)&&s0){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 $t)return 0;throw s}if(!i.mayBeLess&&n{H();tl();Jd();kg=class extends Os{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{H();tl();Jd();_g=class extends Os{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{if(await e.close(),n)return n()},new Ig(e,i)}function i1(r,t){return new kg(r,t)}function n1(r,t){return new _g(r,t)}var tf=Kt(()=>{H();tl();QE();JE();t1();tl();Jd()});var s1=Ut((JO,r1)=>{H();var gu=1e3,xu=gu*60,yu=xu*60,el=yu*24,U_=el*7,z_=el*365.25;r1.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return j_(r);if(e==="number"&&isFinite(r))return t.long?G_(r):H_(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function j_(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*z_;case"weeks":case"week":case"w":return e*U_;case"days":case"day":case"d":return e*el;case"hours":case"hour":case"hrs":case"hr":case"h":return e*yu;case"minutes":case"minute":case"mins":case"min":case"m":return e*xu;case"seconds":case"second":case"secs":case"sec":case"s":return e*gu;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function H_(r){var t=Math.abs(r);return t>=el?Math.round(r/el)+"d":t>=yu?Math.round(r/yu)+"h":t>=xu?Math.round(r/xu)+"m":t>=gu?Math.round(r/gu)+"s":r+"ms"}function G_(r){var t=Math.abs(r);return t>=el?Mg(r,t,el,"day"):t>=yu?Mg(r,t,yu,"hour"):t>=xu?Mg(r,t,xu,"minute"):t>=gu?Mg(r,t,gu,"second"):r+" ms"}function Mg(r,t,e,i){var n=t>=e*1.5;return Math.round(r/e)+" "+i+(n?"s":"")}});var o1=Ut((eR,a1)=>{H();function $_(r){e.debug=e,e.default=e,e.coerce=c,e.disable=o,e.enable=n,e.enabled=l,e.humanize=s1(),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{if(F==="%%")return"%";k++;let Y=e.formatters[L];if(typeof Y=="function"){let q=A[k];F=Y.call(w,q),A.splice(k,1),k--}return F}),e.formatArgs.call(w,A),(w.log||e.log).apply(w,A)}return g.namespace=h,g.useColors=e.useColors(),g.color=e.selectColor(h),g.extend=i,g.destroy=e.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==e.namespaces&&(m=e.namespaces,y=e.enabled(h)),y),set:A=>{f=A}}),typeof e.init=="function"&&e.init(g),g}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,y=-1,g=0;for(;f"-"+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}a1.exports=$_});var l1=Ut((an,Fg)=>{H();an.formatArgs=q_;an.save=W_;an.load=X_;an.useColors=V_;an.storage=Y_();an.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`."))}})();an.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 V_(){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 q_(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Fg.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)}an.log=console.debug||console.log||(()=>{});function W_(r){try{r?an.storage.setItem("debug",r):an.storage.removeItem("debug")}catch{}}function X_(){let r;try{r=an.storage.getItem("debug")||an.storage.getItem("DEBUG")}catch{}return!r&&typeof it.default<"u"&&"env"in it.default&&(r=it.default.env.DEBUG),r}function Y_(){try{return localStorage}catch{}}Fg.exports=o1()(an);var{formatters:K_}=Fg.exports;K_.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var il,jy,c1,u1,h1,d1=Kt(()=>{H();Ps();il={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},jy={get(r){return{signature:we.get(r,0),compressedSize:we.get(r,8),uncompressedSize:we.get(r,12)}},len:16},c1={get(r){let t=Te.get(r,6);return{signature:we.get(r,0),minVersion:Te.get(r,4),dataDescriptor:!!(t&8),compressedMethod:Te.get(r,8),compressedSize:we.get(r,18),uncompressedSize:we.get(r,22),filenameLength:Te.get(r,26),extraFieldLength:Te.get(r,28),filename:null}},len:30},u1={get(r){return{signature:we.get(r,0),nrOfThisDisk:Te.get(r,4),nrOfThisDiskWithTheStart:Te.get(r,6),nrOfEntriesOnThisDisk:Te.get(r,8),nrOfEntriesOfSize:Te.get(r,10),sizeOfCd:we.get(r,12),offsetOfStartOfCd:we.get(r,16),zipFileCommentLength:Te.get(r,20)}},len:22},h1={get(r){let t=Te.get(r,8);return{signature:we.get(r,0),minVersion:Te.get(r,6),dataDescriptor:!!(t&8),compressedMethod:Te.get(r,10),compressedSize:we.get(r,20),uncompressedSize:we.get(r,24),filenameLength:Te.get(r,28),extraFieldLength:Te.get(r,30),fileCommentLength:Te.get(r,32),relativeOffsetOfLocalHeader:we.get(r,42),filename:null}},len:46}});function p1(r){let t=new Uint8Array(we.len);return we.put(t,0,r),t}function Q_(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;on+s.length,0),e=new Uint8Array(t),i=0;for(let n of r)e.set(n,i),i+=n.length;return e}var f1,Kr,Hy,Z_,Pg,nl,m1=Kt(()=>{H();Ps();f1=Hc(l1(),1);d1();Kr=(0,f1.default)("tokenizer:inflate"),Hy=256*1024,Z_=p1(il.DataDescriptor),Pg=p1(il.EndOfCentralDirectory),nl=class r{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Hy)}async isZip(){return await this.peekSignature()===il.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(we)}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]===Pg[0]&&i[n+1]===Pg[1]&&i[n+2]===Pg[2]&&i[n+3]===Pg[3])return t.fileInfo.size-e+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){Kr("Cannot reading central-directory without random-read support");return}Kr("Reading central-directory...");let t=this.tokenizer.position,e=await this.findEndOfCentralDirectoryLocator();if(e>0){Kr("Central-directory 32-bit signature found");let i=await this.tokenizer.readToken(u1,e),n=[];this.tokenizer.setPosition(i.offsetOfStartOfCd);for(let s=0;s=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)}Kr(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(n,J_(l),s.handler)}else s.handler?(Kr(`Reading compressed-file-data: ${n.compressedSize} bytes`),o=new Uint8Array(n.compressedSize),await this.tokenizer.readBuffer(o),await this.inflate(n,o,s.handler)):(Kr(`Ignoring compressed-file-data: ${n.compressedSize} bytes`),await this.tokenizer.ignore(n.compressedSize));if(Kr(`Reading data-descriptor at pos=${this.tokenizer.position}`),n.dataDescriptor&&(await this.tokenizer.readToken(jy)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-jy.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}`);Kr(`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(we);if(t===il.LocalFileHeader){let e=await this.tokenizer.readToken(c1);return e.filename=await this.tokenizer.readToken(new Mi(e.filenameLength,"utf-8")),e}if(t===il.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var ef,g1=Kt(()=>{H();ef=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 Gy=Kt(()=>{H();m1();g1()});function iN(r,t,e){return r?r.constructor===t?!0:tN.call(r)===e:!1}function nN(r){return iN(r,Uint8Array,eN)}function rN(r){if(!nN(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)rN(n),e.set(n,i),i+=n.length;return e}function $y(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 tN,eN,xR,yR,bR,Vy=Kt(()=>{H();tN=Object.prototype.toString,eN="[object Uint8Array]";xR={utf8:new globalThis.TextDecoder("utf8")},yR=new globalThis.TextEncoder,bR=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"))});function y1(r,t){if(t==="utf-16le"){let e=[];for(let i=0;i>8&255)}return e}if(t==="utf-16be"){let e=[];for(let i=0;i>8&255,n&255)}return e}return[...r].map(e=>e.charCodeAt(0))}function b1(r,t=0){let e=Number.parseInt(new Mi(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{H();Ps();w1={get:(r,t)=>r[t+3]&127|(r[t+2]&127)<<7|(r[t+1]&127)<<14|(r[t]&127)<<21,len:4}});var v1,E1,C1=Kt(()=>{H();v1=["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"],E1=["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 Og(r,t,e){if(!Number.isFinite(r)||r<0||r>t)throw new mn(`${e} has invalid size ${r} (maximum ${t} bytes)`);return r}async function gn(r,t,{maximumLength:e=16777216,reason:i="skip"}={}){let n=Og(t,e,i);await r.ignore(n)}async function nf(r,t,e,{maximumLength:i=t.length,reason:n="read"}={}){let s=e?.length??t.length,o=Og(s,i,n);return r.readBuffer(t,{...e,length:o})}function Kn(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 Ge(r){let t=r.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Rs(r,t,e){return Ge(r)&&r.position-t>e}var mn,bu=Kt(()=>{H();mn=class extends Error{}});async function cN(r,{maximumLength:t=Ls}={}){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 uN(r,t){let e=new Uint8Array(t),i=0;for(let n of r)e.set(n,i),i+=n.length;return e}function hN(r){let t=r.fileInfo.size,e=Number.isFinite(t)?Math.max(0,t-r.position):Number.MAX_SAFE_INTEGER;return Math.min(e,sN)}function dN(r){if(r instanceof $t||r instanceof mn)return!0;if(!(r instanceof Error))return!1;if(aN.has(r.message)||lN.has(r.code))return!0;for(let t of oN)if(r.message.startsWith(t))return!0;return!1}function D1(r,t=Ls){let e=[r.compressedSize,r.uncompressedSize];for(let i of e)if(!Number.isFinite(i)||i<0||i>t)return!1;return!0}function fN(){return{hasDocumentEntry:!1,hasMasterSlideEntry:!1,hasTablesEntry:!1,hasCalculationEngineEntry:!1}}function pN(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 I1(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 k1(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 mN(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function gN(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 N1(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 N1(r)}function xN(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 bN(r,t){if(r.length=0?0:l===n?Math.min(yN,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(Ge(r.tokenizer)||(r.knownSizeDescriptorScannedBytes+=o),!!t)return uN(s,o)}function AN(r,t){return Ge(r.tokenizer)?Math.max(0,16777216-(r.tokenizer.position-t)):Math.max(0,Ls-r.knownSizeDescriptorScannedBytes)}async function vN(r,t,{shouldBuffer:e,maximumDescriptorLength:i=Ls}={}){if(t.dataDescriptor&&t.compressedSize===0)return wN(r,{shouldBuffer:e,maximumLength:i});if(!e){await gn(r.tokenizer,t.compressedSize,{maximumLength:Ge(r.tokenizer)?Ls:r.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let n=hN(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 F1(r){let t,e=mN(),i=fN();try{await new nl(r).unzip(s=>{if(gN(e,s.filename),pN(i,s.filename),i.hasDocumentEntry&&(i.hasMasterSlideEntry||i.hasTablesEntry))return t=I1(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 D1(s,S1)?{async handler(c){let u=new TextDecoder("utf-8").decode(c).trim();t=k1(u)},stop:!0}:{};case"[Content_Types].xml":return e.hasContentTypesEntry=!0,D1(s,S1)?(e.isParsingContentTypes=!0,{async handler(c){let u=new TextDecoder("utf-8").decode(c),h=xN(u);h&&(t=k1(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(!dN(s))throw s;e.isParsingContentTypes&&(e.isParsingContentTypes=!1,e.hasUnparseableContentTypes=!0),!t&&s instanceof $t&&!e.hasContentTypesEntry&&(t=N1(e))}let n=Ge(r)&&i.hasDocumentEntry&&!i.hasMasterSlideEntry&&!i.hasTablesEntry&&!i.hasCalculationEngineEntry?void 0:I1(i);return t??_1(e)??n??{ext:"zip",mime:"application/zip"}}var Ls,T1,sN,S1,aN,oN,lN,M1,Rg,yN,P1=Kt(()=>{H();Ps();tf();Gy();bu();Ls=1024*1024,T1=1024,sN=2**31-1,S1=Ls,aN=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),oN=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],lN=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);M1=134695760,Rg=16,yN=Rg-1;nl.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 cN(t,{maximumLength:Ls});return e(i)};nl.prototype.unzip=async function(r){let t=!1,e=0,i=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Rs(this.tokenizer,i,16777216))throw new mn(`ZIP stream probing exceeds ${16777216} bytes`);let n=await this.readLocalFileHeader();if(!n)break;if(e++,e>T1)throw new Error(`ZIP entry count exceeds ${T1}`);let s=r(n);t=!!s.stop,await this.tokenizer.ignore(n.extraFieldLength);let o=await vN(this,n,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(Ls,AN(this,i))});if(s.handler&&await this.inflate(n,o,s.handler),n.dataDescriptor){let l=new Uint8Array(Rg);if(await this.tokenizer.readBuffer(l),we.get(l,0)!==M1)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Rs(this.tokenizer,i,16777216))throw new mn(`ZIP stream probing exceeds ${16777216} bytes`)}while(!t)}});async function L1(r){async function t(){let l=await r.peekNumber(VE),c=128,u=0;for(;(l&c)===0&&c!==0;)++u,c>>=1;let h=new Uint8Array(u+1);return await nf(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:$y(h),len:$y(d)}}async function i(l){let c=0;for(;l>0;){if(c++,c>EN||Rs(r,s,16777216))return;let u=r.position,h=await e();if(h.id===17026){if(h.len>O1)return;let d=Og(h.len,O1,"EBML DocType");return(await r.readToken(new Mi(d))).replaceAll(new RegExp("\\0.*$","gv"),"")}if(Ge(r)&&(!Number.isFinite(h.len)||h.len<0||h.len>R1)||(await gn(r,h.len,{maximumLength:Ge(r)?R1: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 O1,R1,EN,B1=Kt(()=>{H();Ps();Vy();bu();O1=64,R1=1024*1024,EN=256});function SN(r){return(r.codePointAt(0)&32)!==0}async function z1(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(qE),type:await r.readToken(new Mi(4,"latin1"))}}let n=Ge(r),s=r.position,o=0,l=!1;do{if(o++,o>CN||Rs(r,s,TN))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>U1)return l&&SN(u.type)?t:void 0;try{await gn(r,u.length+4,{maximumLength:n?U1+4:r.fileInfo.size,reason:"PNG chunk payload"})}catch(h){if(!n&&(h instanceof mn||h instanceof $t))return t;throw h}}if(r.position<=c)break}while(r.position+8{H();Ps();tf();bu();CN=512,TN=16*1024*1024,U1=1024*1024});async function G1(r){let t=!1;try{async function e(){let o=new Uint8Array(16);return await nf(r,o,void 0,{maximumLength:o.length,reason:"ASF header GUID"}),{id:o,size:Number(await r.readToken(WE))}}await gn(r,30,{maximumLength:30,reason:"ASF header prelude"});let i=Ge(r),n=r.position,s=0;for(;r.position+24DN||Rs(r,n,16777216)));){let o=r.position,l=await e(),c=l.size-24;if(!Number.isFinite(c)||c<0){t=!0;break}if(Kn(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 nf(r,u,void 0,{maximumLength:u.length,reason:"ASF stream type GUID"}),Kn(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(Kn(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>H1){t=!0;break}if(await gn(r,c,{maximumLength:i?H1:r.fileInfo.size,reason:"ASF header payload"}),r.position<=o){t=!0;break}}}catch(e){if(e instanceof $t||e instanceof mn)Ge(r)&&(t=!0);else throw e}if(!t)return{ext:"asf",mime:"application/vnd.ms-asf"}}var DN,H1,$1=Kt(()=>{H();Ps();tf();bu();DN=512,H1=1024*1024});var Z1={};qm(Z1,{FileTypeParser:()=>Bs,fileTypeFromBlob:()=>UN,fileTypeFromBuffer:()=>BN,fileTypeFromFile:()=>$N,fileTypeFromStream:()=>LN,fileTypeFromTokenizer:()=>zN,fileTypeStream:()=>jN,normalizeSampleSize:()=>K1,reasonableDetectionSizeInBytes:()=>wu,supportedExtensions:()=>HN,supportedMimeTypes:()=>GN});function K1(r){return Number.isFinite(r)?Math.max(1,Math.trunc(r)):wu}function FN(r){return Number.isFinite(r)?Math.max(0,Math.min(IN,Math.trunc(r))):0}function PN(r){return Number.isFinite(r)?Math.max(0,r):Number.MAX_SAFE_INTEGER}function X1(r){return import(r)}function ON(r){return r.pipeThrough(new TransformStream)}function Y1(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 RN(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 LN(r,t){return new Bs(t).fromStream(r)}async function BN(r,t){return new Bs(t).fromBuffer(r)}async function UN(r,t){return new Bs(t).fromBlob(r)}async function zN(r,t){return new Bs(t).fromTokenizer(r)}async function jN(r,t){return new Bs(t).toDetectionStream(r,t)}async function $N(r,t){return new Bs(t).fromFile(r)}var wu,IN,kN,_N,V1,qy,NN,q1,MN,W1,Bs,HN,GN,Q1=Kt(()=>{H();Ps();tf();Gy();Vy();A1();C1();bu();P1();B1();j1();$1();wu=4100,IN=wu-2,kN=16777216,_N=1,V1=100,qy=16777216,NN=512,q1=256,MN=1024*1024,W1=16777216;Bs=class r{constructor(t){z(this,"detectConfident",async t=>{if(this.buffer=new Uint8Array(wu),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,Ge(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>=q1?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 gn(t,6,{maximumLength:6,reason:"ID3 header prefix"});let e=await t.readToken(w1),i=Ge(t);if(!Number.isFinite(e)||e<0||i&&(e>qy||t.position+e>qy))return;if(t.position+e>t.fileInfo.size)return i?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await gn(t,e,{maximumLength:i?qy:t.fileInfo.size,reason:"ID3 payload"})}catch(n){if(n instanceof $t)return;throw n}return this.detectionReentryCount>=q1?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 F1(t);if(this.checkString("OggS")){await t.ignore(28);let e=new Uint8Array(8);return await t.readBuffer(e),Kn(e,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:Kn(e,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Kn(e,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Kn(e,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Kn(e,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Kn(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 L1(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=Ly.get(this.buffer,4),i=Zo.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("=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("!"))return await t.ignore(8),await t.readToken(new Mi(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[` +`)}function Sv(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||Wo.assign,this.domHandler=r.domHandler||dg,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||Tv,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}Sv.prototype.parseFromString=function(r,t){if(!TI(t))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+t+'" is not valid.');var e=this.assign(Object.create(null),this.xmlns),i=Av.XML_ENTITIES,n=e[""]||null;EI(t)?(i=Av.HTML_ENTITIES,n=Ay.HTML):t===Cv.XML_SVG_IMAGE&&(n=Ay.SVG),e[""]=n,e.xml=e.xml||Ay.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 SI;l.errorHandler=s,l.domBuilder=s;var c=!Wo.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 dg(r){var t=r||{};this.mimeType=t.mimeType||Cv.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 lu(r,t){t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber}dg.prototype={startDocument:function(){var r=new vI;this.doc=CI(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;hg(this,s),this.currentElement=s,this.locator&&lu(this.locator,s);for(var l=0;l=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){dg.prototype[r]=function(){return null}});function hg(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}function kI(r){if(r==="error")throw"onErrorStopParsing"}function II(){throw"onWarningStopParsing"}cu.__DOMHandler=dg;cu.DOMParser=Sv;cu.normalizeLineEndings=Tv;cu.onErrorStopParsing=kI;cu.onWarningStopParsing=II});var kv=zt(qt=>{"use strict";H();var uu=Go();qt.assign=uu.assign;qt.hasDefaultHTMLNamespace=uu.hasDefaultHTMLNamespace;qt.isHTMLMimeType=uu.isHTMLMimeType;qt.isValidMimeType=uu.isValidMimeType;qt.MIME_TYPE=uu.MIME_TYPE;qt.NAMESPACE=uu.NAMESPACE;var fg=Nd();qt.DOMException=fg.DOMException;qt.DOMExceptionName=fg.DOMExceptionName;qt.ExceptionCode=fg.ExceptionCode;qt.ParseError=fg.ParseError;var ii=by();qt.Attr=ii.Attr;qt.CDATASection=ii.CDATASection;qt.CharacterData=ii.CharacterData;qt.Comment=ii.Comment;qt.Document=ii.Document;qt.DocumentFragment=ii.DocumentFragment;qt.DocumentType=ii.DocumentType;qt.DOMImplementation=ii.DOMImplementation;qt.Element=ii.Element;qt.Entity=ii.Entity;qt.EntityReference=ii.EntityReference;qt.LiveNodeList=ii.LiveNodeList;qt.NamedNodeMap=ii.NamedNodeMap;qt.Node=ii.Node;qt.NodeList=ii.NodeList;qt.Notation=ii.Notation;qt.ProcessingInstruction=ii.ProcessingInstruction;qt.Text=ii.Text;qt.XMLSerializer=ii.XMLSerializer;var pg=Dv();qt.DOMParser=pg.DOMParser;qt.normalizeLineEndings=pg.normalizeLineEndings;qt.onErrorStopParsing=pg.onErrorStopParsing;qt.onWarningStopParsing=pg.onWarningStopParsing});var _v=zt((MF,Ey)=>{H();var vy=(function(r){"use strict";var t=Object.prototype,e=t.hasOwnProperty,i=Object.defineProperty||function(C,D,E){C[D]=E.value},n,s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function u(C,D,E){return Object.defineProperty(C,D,{value:E,enumerable:!0,configurable:!0,writable:!0}),C[D]}try{u({},"")}catch{u=function(D,E,S){return D[E]=S}}function h(C,D,E,S){var k=D&&D.prototype instanceof w?D:w,M=Object.create(k.prototype),P=new N(S||[]);return i(M,"_invoke",{value:G(C,E,P)}),M}r.wrap=h;function d(C,D,E){try{return{type:"normal",arg:C.call(D,E)}}catch(S){return{type:"throw",arg:S}}}var f="suspendedStart",m="suspendedYield",y="executing",g="completed",A={};function w(){}function v(){}function T(){}var I={};u(I,o,function(){return this});var _=Object.getPrototypeOf,F=_&&_(_(X([])));F&&F!==t&&e.call(F,o)&&(I=F);var L=T.prototype=w.prototype=Object.create(I);v.prototype=T,i(L,"constructor",{value:T,configurable:!0}),i(T,"constructor",{value:v,configurable:!0}),v.displayName=u(T,c,"GeneratorFunction");function Y(C){["next","throw","return"].forEach(function(D){u(C,D,function(E){return this._invoke(D,E)})})}r.isGeneratorFunction=function(C){var D=typeof C=="function"&&C.constructor;return D?D===v||(D.displayName||D.name)==="GeneratorFunction":!1},r.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,T):(C.__proto__=T,u(C,c,"GeneratorFunction")),C.prototype=Object.create(L),C},r.awrap=function(C){return{__await:C}};function q(C,D){function E(M,P,B,$){var U=d(C[M],C,P);if(U.type==="throw")$(U.arg);else{var V=U.arg,Z=V.value;return Z&&typeof Z=="object"&&e.call(Z,"__await")?D.resolve(Z.__await).then(function(Q){E("next",Q,B,$)},function(Q){E("throw",Q,B,$)}):D.resolve(Z).then(function(Q){V.value=Q,B(V)},function(Q){return E("throw",Q,B,$)})}}var S;function k(M,P){function B(){return new D(function($,U){E(M,P,$,U)})}return S=S?S.then(B,B):B()}i(this,"_invoke",{value:k})}Y(q.prototype),u(q.prototype,l,function(){return this}),r.AsyncIterator=q,r.async=function(C,D,E,S,k){k===void 0&&(k=Promise);var M=new q(h(C,D,E,S),k);return r.isGeneratorFunction(D)?M:M.next().then(function(P){return P.done?P.value:M.next()})};function G(C,D,E){var S=f;return function(M,P){if(S===y)throw new Error("Generator is already running");if(S===g){if(M==="throw")throw P;return O()}for(E.method=M,E.arg=P;;){var B=E.delegate;if(B){var $=j(B,E);if($){if($===A)continue;return $}}if(E.method==="next")E.sent=E._sent=E.arg;else if(E.method==="throw"){if(S===f)throw S=g,E.arg;E.dispatchException(E.arg)}else E.method==="return"&&E.abrupt("return",E.arg);S=y;var U=d(C,D,E);if(U.type==="normal"){if(S=E.done?g:m,U.arg===A)continue;return{value:U.arg,done:E.done}}else U.type==="throw"&&(S=g,E.method="throw",E.arg=U.arg)}}}function j(C,D){var E=D.method,S=C.iterator[E];if(S===n)return D.delegate=null,E==="throw"&&C.iterator.return&&(D.method="return",D.arg=n,j(C,D),D.method==="throw")||E!=="return"&&(D.method="throw",D.arg=new TypeError("The iterator does not provide a '"+E+"' method")),A;var k=d(S,C.iterator,D.arg);if(k.type==="throw")return D.method="throw",D.arg=k.arg,D.delegate=null,A;var M=k.arg;if(!M)return D.method="throw",D.arg=new TypeError("iterator result is not an object"),D.delegate=null,A;if(M.done)D[C.resultName]=M.value,D.next=C.nextLoc,D.method!=="return"&&(D.method="next",D.arg=n);else return M;return D.delegate=null,A}Y(L),u(L,c,"Generator"),u(L,o,function(){return this}),u(L,"toString",function(){return"[object Generator]"});function J(C){var D={tryLoc:C[0]};1 in C&&(D.catchLoc=C[1]),2 in C&&(D.finallyLoc=C[2],D.afterLoc=C[3]),this.tryEntries.push(D)}function et(C){var D=C.completion||{};D.type="normal",delete D.arg,C.completion=D}function N(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(J,this),this.reset(!0)}r.keys=function(C){var D=Object(C),E=[];for(var S in D)E.push(S);return E.reverse(),function k(){for(;E.length;){var M=E.pop();if(M in D)return k.value=M,k.done=!1,k}return k.done=!0,k}};function X(C){if(C){var D=C[o];if(D)return D.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var E=-1,S=function k(){for(;++E=0;--S){var k=this.tryEntries[S],M=k.completion;if(k.tryLoc==="root")return E("end");if(k.tryLoc<=this.prev){var P=e.call(k,"catchLoc"),B=e.call(k,"finallyLoc");if(P&&B){if(this.prev=0;--E){var S=this.tryEntries[E];if(S.tryLoc<=this.prev&&e.call(S,"finallyLoc")&&this.prev=0;--D){var E=this.tryEntries[D];if(E.finallyLoc===C)return this.complete(E.completion,E.afterLoc),et(E),A}},catch:function(C){for(var D=this.tryEntries.length-1;D>=0;--D){var E=this.tryEntries[D];if(E.tryLoc===C){var S=E.completion;if(S.type==="throw"){var k=S.arg;et(E)}return k}}throw new Error("illegal catch attempt")},delegateYield:function(C,D,E){return this.delegate={iterator:X(C),resultName:D,nextLoc:E},this.method==="next"&&(this.arg=n),A}},r})(typeof Ey=="object"?Ey.exports:{});try{regeneratorRuntime=vy}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=vy:Function("r","regeneratorRuntime = r")(vy)}});var xg=zt((PF,Mv)=>{"use strict";H();Mv.exports=(r,t)=>`${r}-${t}-${Math.random().toString(16).slice(3,8)}`});var Cy=zt((RF,Pv)=>{"use strict";H();var LI=xg(),Fv=0;Pv.exports=({id:r,action:t,payload:e={}})=>{let i=r;return typeof i>"u"&&(i=LI("Job",Fv),Fv+=1),{id:i,action:t,payload:e}}});var yg=zt(Wd=>{"use strict";H();var Ty=!1;Wd.logging=Ty;Wd.setLogging=r=>{Ty=r};Wd.log=(...r)=>Ty?console.log.apply(Wd,r):null});var Bv=zt((Rv,Lv)=>{"use strict";H();var BI=Cy(),{log:bg}=yg(),UI=xg(),Ov=0;Lv.exports=()=>{let r=UI("Scheduler",Ov),t={},e={},i=[];Ov+=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"u"){i[0](t[d[f]]);break}}},l=(d,f)=>new Promise((m,y)=>{let g=BI({action:d,payload:f});i.push(async A=>{i.shift(),e[A.id]=g;try{m(await A[d].apply(Rv,[...f,g.id]))}catch(w){y(w)}finally{delete e[A.id],o()}}),bg(`[${r}]: Add ${g.id} to JobQueue`),bg(`[${r}]: JobQueue length=${i.length}`),o()});return{addWorker:d=>(t[d.id]=d,bg(`[${r}]: Add ${d.id}`),bg(`[${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 zv=zt((jF,Uv)=>{"use strict";H();Uv.exports=r=>{let t={};return typeof WorkerGlobalScope<"u"?t.type="webworker":typeof document=="object"?t.type="browser":typeof it.default=="object"&&typeof Vm=="function"&&(t.type="node"),typeof r>"u"?t:t[r]}});var Hv=zt(($F,jv)=>{"use strict";H();var zI=zv()("type")==="browser",jI=zI?r=>new URL(r,window.location.href).href:r=>r;jv.exports=r=>{let t={...r};return["corePath","workerPath","langPath"].forEach(e=>{r[e]&&(t[e]=jI(t[e]))}),t}});var Sy=zt((qF,Gv)=>{"use strict";H();Gv.exports={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}});var $v=zt((XF,HI)=>{HI.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 qv=zt((YF,Vv)=>{"use strict";H();Vv.exports={workerBlobURL:!0,logger:()=>{}}});var Xv=zt((ZF,Wv)=>{"use strict";H();var GI=$v().version,$I=qv();Wv.exports={...$I,workerPath:`https://cdn.jsdelivr.net/npm/tesseract.js@v${GI}/dist/worker.min.js`}});var Kv=zt((JF,Yv)=>{"use strict";H();Yv.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 Qv=zt((eP,Zv)=>{"use strict";H();Zv.exports=r=>{r.terminate()}});var tE=zt((nP,Jv)=>{"use strict";H();Jv.exports=(r,t)=>{r.onmessage=({data:e})=>{t(e)}}});var iE=zt((sP,eE)=>{"use strict";H();eE.exports=async(r,t)=>{r.postMessage(t)}});var rE=zt((oP,nE)=>{"use strict";H();var Dy=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)}),ky=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 ky(r.src)),r.tagName==="VIDEO"&&(t=await ky(r.poster)),r.tagName==="CANVAS"&&await new Promise(e=>{r.toBlob(async i=>{t=await Dy(i),e()})});else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas){let e=await r.convertToBlob();t=await Dy(e)}else(r instanceof File||r instanceof Blob)&&(t=await Dy(r));return new Uint8Array(t)};nE.exports=ky});var aE=zt((cP,sE)=>{"use strict";H();var VI=Xv(),qI=Kv(),WI=Qv(),XI=tE(),YI=iE(),KI=rE();sE.exports={defaultOptions:VI,spawnWorker:qI,terminateWorker:WI,onMessage:XI,send:YI,loadImage:KI}});var Iy=zt((hP,uE)=>{"use strict";H();var ZI=Hv(),Xr=Cy(),{log:oE}=yg(),QI=xg(),Yo=Sy(),{defaultOptions:JI,spawnWorker:tN,terminateWorker:eN,onMessage:iN,loadImage:lE,send:nN}=aE(),cE=0;uE.exports=async(r="eng",t=Yo.LSTM_ONLY,e={},i={})=>{let n=QI("Worker",cE),{logger:s,errorHandler:o,...l}=ZI({...JI,...e}),c={},u=typeof r=="string"?r.split("+"):r,h=t,d=i,f=[Yo.DEFAULT,Yo.LSTM_ONLY].includes(t)&&!l.legacyCore,m,y,g=new Promise((C,D)=>{y=C,m=D}),A=C=>{m(C.message)},w=tN(l);w.onerror=A,cE+=1;let v=({id:C,action:D,payload:E})=>new Promise((S,k)=>{oE(`[${n}]: Start ${C}, action=${D}`);let M=`${D}-${C}`;c[M]={resolve:S,reject:k},nN(w,{workerId:n,jobId:C,action:D,payload:E})}),T=()=>console.warn("`load` is depreciated and should be removed from code (workers now come pre-loaded)"),I=C=>v(Xr({id:C,action:"load",payload:{options:{lstmOnly:f,corePath:l.corePath,logging:l.logging}}})),_=(C,D,E)=>v(Xr({id:E,action:"FS",payload:{method:"writeFile",args:[C,D]}})),F=(C,D)=>v(Xr({id:D,action:"FS",payload:{method:"readFile",args:[C,{encoding:"utf8"}]}})),L=(C,D)=>v(Xr({id:D,action:"FS",payload:{method:"unlink",args:[C]}})),Y=(C,D,E)=>v(Xr({id:E,action:"FS",payload:{method:C,args:D}})),q=(C,D)=>v(Xr({id:D,action:"loadLanguage",payload:{langs:C,options:{langPath:l.langPath,dataPath:l.dataPath,cachePath:l.cachePath,cacheMethod:l.cacheMethod,gzip:l.gzip,lstmOnly:[Yo.DEFAULT,Yo.LSTM_ONLY].includes(h)&&!l.legacyLang}}})),G=(C,D,E,S)=>v(Xr({id:S,action:"initialize",payload:{langs:C,oem:D,config:E}})),j=(C="eng",D,E,S)=>{if(f&&[Yo.TESSERACT_ONLY,Yo.TESSERACT_LSTM_COMBINED].includes(D))throw Error("Legacy model requested but code missing.");let k=D||h;h=k;let M=E||d;d=M;let B=(typeof C=="string"?C.split("+"):C).filter($=>!u.includes($));return u.push(...B),B.length>0?q(B,S).then(()=>G(C,k,M,S)):G(C,k,M,S)},J=(C={},D)=>v(Xr({id:D,action:"setParameters",payload:{params:C}})),et=async(C,D={},E={text:!0},S)=>v(Xr({id:S,action:"recognize",payload:{image:await lE(C),options:D,output:E}})),N=async(C,D)=>{if(f)throw Error("`worker.detect` requires Legacy model, which was not loaded.");return v(Xr({id:D,action:"detect",payload:{image:await lE(C)}}))},X=async()=>(w!==null&&(eN(w),w=null),Promise.resolve());iN(w,({workerId:C,jobId:D,status:E,action:S,data:k})=>{let M=`${S}-${D}`;if(E==="resolve")oE(`[${C}]: Complete ${D}`),c[M].resolve({jobId:D,data:k}),delete c[M];else if(E==="reject")if(c[M].reject(k),delete c[M],S==="load"&&m(k),o)o(k);else throw Error(k);else E==="progress"&&s({...k,userJobId:D})});let O={id:n,worker:w,load:T,writeText:_,readText:F,removeFile:L,FS:Y,reinitialize:j,setParameters:J,recognize:et,detect:N,terminate:X};return I().then(()=>q(r)).then(()=>G(r,t,i)).then(()=>y(O)).catch(()=>{}),g}});var fE=zt((fP,dE)=>{"use strict";H();var hE=Iy(),rN=async(r,t,e)=>{let i=await hE(t,1,e);return i.recognize(r).finally(async()=>{await i.terminate()})},sN=async(r,t)=>{let e=await hE("osd",0,t);return e.detect(r).finally(async()=>{await e.terminate()})};dE.exports={recognize:rN,detect:sN}});var mE=zt((mP,pE)=>{"use strict";H();pE.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=zt((xP,gE)=>{"use strict";H();gE.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 bE=zt((bP,yE)=>{"use strict";H();_v();var aN=Bv(),oN=Iy(),lN=fE(),cN=mE(),uN=Sy(),hN=xE(),{setLogging:dN}=yg();yE.exports={languages:cN,OEM:uN,PSM:hN,createScheduler:aN,createWorker:oN,setLogging:dN,...lN}});function IN(){if(!(typeof globalThis.TextDecoder>"u"))return Tg??(Tg=new globalThis.TextDecoder("utf-8"))}function HE(r,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let e=IN();return e?e.decode(r):_N(r)}case"utf-16le":return MN(r);case"us-ascii":case"ascii":return FN(r);case"latin1":case"iso-8859-1":return PN(r);case"windows-1252":return ON(r);default:throw new RangeError(`Encoding '${t}' not supported`)}}function Ry(r,t){t.length!==0&&(r.push(String.fromCharCode.apply(null,t)),t.length=0)}function Ke(r,t,e){t.push(e),t.length>=pu&&Ry(r,t)}function NN(r,t,e){if(e<=65535){Ke(r,t,e);return}e-=65536,Ke(r,t,55296+(e>>10)),Ke(r,t,56320+(e&1023))}function _N(r){let t=[],e=[],i=0;for(r.length>=3&&r[0]===239&&r[1]===187&&r[2]===191&&(i=3);i244){Ke(t,e,yr),i++;continue}if(n<=223){if(i+1>=r.length){Ke(t,e,yr),i++;continue}let h=r[i+1];if((h&192)!==128){Ke(t,e,yr),i++;continue}let d=(n&31)<<6|h&63;Ke(t,e,d),i+=2;continue}if(n<=239){if(i+2>=r.length){Ke(t,e,yr),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))){Ke(t,e,yr),i++;continue}let m=(n&15)<<12|(h&63)<<6|d&63;Ke(t,e,m),i+=3;continue}if(i+3>=r.length){Ke(t,e,yr),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))){Ke(t,e,yr),i++;continue}let u=(n&7)<<18|(s&63)<<12|(o&63)<<6|l&63;NN(t,e,u),i+=4}return Ry(t,e),t.join("")}function MN(r){let t=[],e=[],i=r.length,n=0;for(;n+1=55296&&s<=56319){if(n+1=56320&&o<=57343?(Ke(t,e,s),Ke(t,e,o),n+=2):Ke(t,e,yr)}else Ke(t,e,yr);continue}if(s>=56320&&s<=57343){Ke(t,e,yr);continue}Ke(t,e,s)}return n=128&&n<=159?jE[n]:void 0;e+=s??String.fromCharCode(n),e.length>=pu&&(t.push(e),e="")}return e&&t.push(e),t.join("")}var jE,kN,Tg,pu,yr,GE=Kt(()=>{H();jE={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"},kN={};for(let[r,t]of Object.entries(jE))kN[t]=Number.parseInt(r,10);pu=32*1024,yr=65533});function sn(r){return new DataView(r.buffer,r.byteOffset)}var $E,VE,Te,Zo,we,Ly,qE,WE,Mi,Ps=Kt(()=>{H();$E=Hc(qx(),1);GE();VE={len:1,get(r,t){return sn(r).getUint8(t)},put(r,t,e){return sn(r).setUint8(t,e),t+1}},Te={len:2,get(r,t){return sn(r).getUint16(t,!0)},put(r,t,e){return sn(r).setUint16(t,e,!0),t+2}},Zo={len:2,get(r,t){return sn(r).getUint16(t)},put(r,t,e){return sn(r).setUint16(t,e),t+2}},we={len:4,get(r,t){return sn(r).getUint32(t,!0)},put(r,t,e){return sn(r).setUint32(t,e,!0),t+4}},Ly={len:4,get(r,t){return sn(r).getUint32(t)},put(r,t,e){return sn(r).setUint32(t,e),t+4}},qE={len:4,get(r,t){return sn(r).getInt32(t)},put(r,t,e){return sn(r).setInt32(t,e),t+4}},WE={len:8,get(r,t){return sn(r).getBigUint64(t,!0)},put(r,t,e){return sn(r).setBigUint64(t,e,!0),t+8}},Mi=class{constructor(t,e){this.len=t,this.encoding=e}get(t,e=0){let i=t.subarray(e,e+this.len);return HE(i,this.encoding)}}});var RN,$t,Qo,Zd=Kt(()=>{H();RN="End-Of-Stream",$t=class extends Error{constructor(){super(RN),this.name="EndOfStreamError"}},Qo=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var XE=Kt(()=>{H()});var Jo,Sg=Kt(()=>{H();Zd();Jo=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 $t;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{H();Zd();XE();Sg()});var Dg,KE=Kt(()=>{H();Sg();Dg=class extends Jo{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var Qd,By=Kt(()=>{H();KE();Qd=class extends Dg{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 mu,Uy=Kt(()=>{H();Zd();Sg();mu=class extends Jo{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{H();By();Uy()});var tl=Kt(()=>{H();Zd();YE();By();Uy();ZE()});var Os,Jd=Kt(()=>{H();tl();Os=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})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{H();Jd();tl();BN=256e3,kg=class extends Os{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)&&s0){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 $t)return 0;throw s}if(!i.mayBeLess&&n{H();tl();Jd();Ig=class extends Os{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{H();tl();Jd();Ng=class extends Os{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{if(await e.close(),n)return n()},new kg(e,i)}function i1(r,t){return new Ig(r,t)}function n1(r,t){return new Ng(r,t)}var tf=Kt(()=>{H();tl();QE();JE();t1();tl();Jd()});var s1=zt((JO,r1)=>{H();var gu=1e3,xu=gu*60,yu=xu*60,el=yu*24,UN=el*7,zN=el*365.25;r1.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return jN(r);if(e==="number"&&isFinite(r))return t.long?GN(r):HN(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function jN(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*zN;case"weeks":case"week":case"w":return e*UN;case"days":case"day":case"d":return e*el;case"hours":case"hour":case"hrs":case"hr":case"h":return e*yu;case"minutes":case"minute":case"mins":case"min":case"m":return e*xu;case"seconds":case"second":case"secs":case"sec":case"s":return e*gu;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function HN(r){var t=Math.abs(r);return t>=el?Math.round(r/el)+"d":t>=yu?Math.round(r/yu)+"h":t>=xu?Math.round(r/xu)+"m":t>=gu?Math.round(r/gu)+"s":r+"ms"}function GN(r){var t=Math.abs(r);return t>=el?Mg(r,t,el,"day"):t>=yu?Mg(r,t,yu,"hour"):t>=xu?Mg(r,t,xu,"minute"):t>=gu?Mg(r,t,gu,"second"):r+" ms"}function Mg(r,t,e,i){var n=t>=e*1.5;return Math.round(r/e)+" "+i+(n?"s":"")}});var o1=zt((eR,a1)=>{H();function $N(r){e.debug=e,e.default=e,e.coerce=c,e.disable=o,e.enable=n,e.enabled=l,e.humanize=s1(),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{if(F==="%%")return"%";I++;let Y=e.formatters[L];if(typeof Y=="function"){let q=A[I];F=Y.call(w,q),A.splice(I,1),I--}return F}),e.formatArgs.call(w,A),(w.log||e.log).apply(w,A)}return g.namespace=h,g.useColors=e.useColors(),g.color=e.selectColor(h),g.extend=i,g.destroy=e.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==e.namespaces&&(m=e.namespaces,y=e.enabled(h)),y),set:A=>{f=A}}),typeof e.init=="function"&&e.init(g),g}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,y=-1,g=0;for(;f"-"+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}a1.exports=$N});var l1=zt((an,Fg)=>{H();an.formatArgs=qN;an.save=WN;an.load=XN;an.useColors=VN;an.storage=YN();an.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`."))}})();an.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 VN(){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 qN(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Fg.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)}an.log=console.debug||console.log||(()=>{});function WN(r){try{r?an.storage.setItem("debug",r):an.storage.removeItem("debug")}catch{}}function XN(){let r;try{r=an.storage.getItem("debug")||an.storage.getItem("DEBUG")}catch{}return!r&&typeof it.default<"u"&&"env"in it.default&&(r=it.default.env.DEBUG),r}function YN(){try{return localStorage}catch{}}Fg.exports=o1()(an);var{formatters:KN}=Fg.exports;KN.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var il,jy,c1,u1,h1,d1=Kt(()=>{H();Ps();il={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},jy={get(r){return{signature:we.get(r,0),compressedSize:we.get(r,8),uncompressedSize:we.get(r,12)}},len:16},c1={get(r){let t=Te.get(r,6);return{signature:we.get(r,0),minVersion:Te.get(r,4),dataDescriptor:!!(t&8),compressedMethod:Te.get(r,8),compressedSize:we.get(r,18),uncompressedSize:we.get(r,22),filenameLength:Te.get(r,26),extraFieldLength:Te.get(r,28),filename:null}},len:30},u1={get(r){return{signature:we.get(r,0),nrOfThisDisk:Te.get(r,4),nrOfThisDiskWithTheStart:Te.get(r,6),nrOfEntriesOnThisDisk:Te.get(r,8),nrOfEntriesOfSize:Te.get(r,10),sizeOfCd:we.get(r,12),offsetOfStartOfCd:we.get(r,16),zipFileCommentLength:Te.get(r,20)}},len:22},h1={get(r){let t=Te.get(r,8);return{signature:we.get(r,0),minVersion:Te.get(r,6),dataDescriptor:!!(t&8),compressedMethod:Te.get(r,10),compressedSize:we.get(r,20),uncompressedSize:we.get(r,24),filenameLength:Te.get(r,28),extraFieldLength:Te.get(r,30),fileCommentLength:Te.get(r,32),relativeOffsetOfLocalHeader:we.get(r,42),filename:null}},len:46}});function p1(r){let t=new Uint8Array(we.len);return we.put(t,0,r),t}function QN(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;on+s.length,0),e=new Uint8Array(t),i=0;for(let n of r)e.set(n,i),i+=n.length;return e}var f1,Kr,Hy,ZN,Pg,nl,m1=Kt(()=>{H();Ps();f1=Hc(l1(),1);d1();Kr=(0,f1.default)("tokenizer:inflate"),Hy=256*1024,ZN=p1(il.DataDescriptor),Pg=p1(il.EndOfCentralDirectory),nl=class r{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Hy)}async isZip(){return await this.peekSignature()===il.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(we)}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]===Pg[0]&&i[n+1]===Pg[1]&&i[n+2]===Pg[2]&&i[n+3]===Pg[3])return t.fileInfo.size-e+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){Kr("Cannot reading central-directory without random-read support");return}Kr("Reading central-directory...");let t=this.tokenizer.position,e=await this.findEndOfCentralDirectoryLocator();if(e>0){Kr("Central-directory 32-bit signature found");let i=await this.tokenizer.readToken(u1,e),n=[];this.tokenizer.setPosition(i.offsetOfStartOfCd);for(let s=0;s=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)}Kr(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(n,JN(l),s.handler)}else s.handler?(Kr(`Reading compressed-file-data: ${n.compressedSize} bytes`),o=new Uint8Array(n.compressedSize),await this.tokenizer.readBuffer(o),await this.inflate(n,o,s.handler)):(Kr(`Ignoring compressed-file-data: ${n.compressedSize} bytes`),await this.tokenizer.ignore(n.compressedSize));if(Kr(`Reading data-descriptor at pos=${this.tokenizer.position}`),n.dataDescriptor&&(await this.tokenizer.readToken(jy)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-jy.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}`);Kr(`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(we);if(t===il.LocalFileHeader){let e=await this.tokenizer.readToken(c1);return e.filename=await this.tokenizer.readToken(new Mi(e.filenameLength,"utf-8")),e}if(t===il.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var ef,g1=Kt(()=>{H();ef=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 Gy=Kt(()=>{H();m1();g1()});function i_(r,t,e){return r?r.constructor===t?!0:t_.call(r)===e:!1}function n_(r){return i_(r,Uint8Array,e_)}function r_(r){if(!n_(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)r_(n),e.set(n,i),i+=n.length;return e}function $y(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 t_,e_,xR,yR,bR,Vy=Kt(()=>{H();t_=Object.prototype.toString,e_="[object Uint8Array]";xR={utf8:new globalThis.TextDecoder("utf8")},yR=new globalThis.TextEncoder,bR=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"))});function y1(r,t){if(t==="utf-16le"){let e=[];for(let i=0;i>8&255)}return e}if(t==="utf-16be"){let e=[];for(let i=0;i>8&255,n&255)}return e}return[...r].map(e=>e.charCodeAt(0))}function b1(r,t=0){let e=Number.parseInt(new Mi(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{H();Ps();w1={get:(r,t)=>r[t+3]&127|(r[t+2]&127)<<7|(r[t+1]&127)<<14|(r[t]&127)<<21,len:4}});var v1,E1,C1=Kt(()=>{H();v1=["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"],E1=["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 Og(r,t,e){if(!Number.isFinite(r)||r<0||r>t)throw new mn(`${e} has invalid size ${r} (maximum ${t} bytes)`);return r}async function gn(r,t,{maximumLength:e=16777216,reason:i="skip"}={}){let n=Og(t,e,i);await r.ignore(n)}async function nf(r,t,e,{maximumLength:i=t.length,reason:n="read"}={}){let s=e?.length??t.length,o=Og(s,i,n);return r.readBuffer(t,{...e,length:o})}function Kn(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 Ge(r){let t=r.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Rs(r,t,e){return Ge(r)&&r.position-t>e}var mn,bu=Kt(()=>{H();mn=class extends Error{}});async function c_(r,{maximumLength:t=Ls}={}){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 u_(r,t){let e=new Uint8Array(t),i=0;for(let n of r)e.set(n,i),i+=n.length;return e}function h_(r){let t=r.fileInfo.size,e=Number.isFinite(t)?Math.max(0,t-r.position):Number.MAX_SAFE_INTEGER;return Math.min(e,s_)}function d_(r){if(r instanceof $t||r instanceof mn)return!0;if(!(r instanceof Error))return!1;if(a_.has(r.message)||l_.has(r.code))return!0;for(let t of o_)if(r.message.startsWith(t))return!0;return!1}function D1(r,t=Ls){let e=[r.compressedSize,r.uncompressedSize];for(let i of e)if(!Number.isFinite(i)||i<0||i>t)return!1;return!0}function f_(){return{hasDocumentEntry:!1,hasMasterSlideEntry:!1,hasTablesEntry:!1,hasCalculationEngineEntry:!1}}function p_(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 I1(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 m_(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function g_(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 _1(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 N1(r){if(!(!r.hasContentTypesEntry||r.hasUnparseableContentTypes||r.isParsingContentTypes||r.hasParsedContentTypesEntry))return _1(r)}function x_(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 b_(r,t){if(r.length=0?0:l===n?Math.min(y_,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(Ge(r.tokenizer)||(r.knownSizeDescriptorScannedBytes+=o),!!t)return u_(s,o)}function A_(r,t){return Ge(r.tokenizer)?Math.max(0,16777216-(r.tokenizer.position-t)):Math.max(0,Ls-r.knownSizeDescriptorScannedBytes)}async function v_(r,t,{shouldBuffer:e,maximumDescriptorLength:i=Ls}={}){if(t.dataDescriptor&&t.compressedSize===0)return w_(r,{shouldBuffer:e,maximumLength:i});if(!e){await gn(r.tokenizer,t.compressedSize,{maximumLength:Ge(r.tokenizer)?Ls:r.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let n=h_(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 F1(r){let t,e=m_(),i=f_();try{await new nl(r).unzip(s=>{if(g_(e,s.filename),p_(i,s.filename),i.hasDocumentEntry&&(i.hasMasterSlideEntry||i.hasTablesEntry))return t=k1(i),{stop:!0};let o=s.filename==="[Content_Types].xml",l=N1(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 D1(s,S1)?{async handler(c){let u=new TextDecoder("utf-8").decode(c).trim();t=I1(u)},stop:!0}:{};case"[Content_Types].xml":return e.hasContentTypesEntry=!0,D1(s,S1)?(e.isParsingContentTypes=!0,{async handler(c){let u=new TextDecoder("utf-8").decode(c),h=x_(u);h&&(t=I1(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(!d_(s))throw s;e.isParsingContentTypes&&(e.isParsingContentTypes=!1,e.hasUnparseableContentTypes=!0),!t&&s instanceof $t&&!e.hasContentTypesEntry&&(t=_1(e))}let n=Ge(r)&&i.hasDocumentEntry&&!i.hasMasterSlideEntry&&!i.hasTablesEntry&&!i.hasCalculationEngineEntry?void 0:k1(i);return t??N1(e)??n??{ext:"zip",mime:"application/zip"}}var Ls,T1,s_,S1,a_,o_,l_,M1,Rg,y_,P1=Kt(()=>{H();Ps();tf();Gy();bu();Ls=1024*1024,T1=1024,s_=2**31-1,S1=Ls,a_=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),o_=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],l_=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);M1=134695760,Rg=16,y_=Rg-1;nl.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 c_(t,{maximumLength:Ls});return e(i)};nl.prototype.unzip=async function(r){let t=!1,e=0,i=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Rs(this.tokenizer,i,16777216))throw new mn(`ZIP stream probing exceeds ${16777216} bytes`);let n=await this.readLocalFileHeader();if(!n)break;if(e++,e>T1)throw new Error(`ZIP entry count exceeds ${T1}`);let s=r(n);t=!!s.stop,await this.tokenizer.ignore(n.extraFieldLength);let o=await v_(this,n,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(Ls,A_(this,i))});if(s.handler&&await this.inflate(n,o,s.handler),n.dataDescriptor){let l=new Uint8Array(Rg);if(await this.tokenizer.readBuffer(l),we.get(l,0)!==M1)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Rs(this.tokenizer,i,16777216))throw new mn(`ZIP stream probing exceeds ${16777216} bytes`)}while(!t)}});async function L1(r){async function t(){let l=await r.peekNumber(VE),c=128,u=0;for(;(l&c)===0&&c!==0;)++u,c>>=1;let h=new Uint8Array(u+1);return await nf(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:$y(h),len:$y(d)}}async function i(l){let c=0;for(;l>0;){if(c++,c>E_||Rs(r,s,16777216))return;let u=r.position,h=await e();if(h.id===17026){if(h.len>O1)return;let d=Og(h.len,O1,"EBML DocType");return(await r.readToken(new Mi(d))).replaceAll(new RegExp("\\0.*$","gv"),"")}if(Ge(r)&&(!Number.isFinite(h.len)||h.len<0||h.len>R1)||(await gn(r,h.len,{maximumLength:Ge(r)?R1: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 O1,R1,E_,B1=Kt(()=>{H();Ps();Vy();bu();O1=64,R1=1024*1024,E_=256});function S_(r){return(r.codePointAt(0)&32)!==0}async function z1(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(qE),type:await r.readToken(new Mi(4,"latin1"))}}let n=Ge(r),s=r.position,o=0,l=!1;do{if(o++,o>C_||Rs(r,s,T_))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>U1)return l&&S_(u.type)?t:void 0;try{await gn(r,u.length+4,{maximumLength:n?U1+4:r.fileInfo.size,reason:"PNG chunk payload"})}catch(h){if(!n&&(h instanceof mn||h instanceof $t))return t;throw h}}if(r.position<=c)break}while(r.position+8{H();Ps();tf();bu();C_=512,T_=16*1024*1024,U1=1024*1024});async function G1(r){let t=!1;try{async function e(){let o=new Uint8Array(16);return await nf(r,o,void 0,{maximumLength:o.length,reason:"ASF header GUID"}),{id:o,size:Number(await r.readToken(WE))}}await gn(r,30,{maximumLength:30,reason:"ASF header prelude"});let i=Ge(r),n=r.position,s=0;for(;r.position+24D_||Rs(r,n,16777216)));){let o=r.position,l=await e(),c=l.size-24;if(!Number.isFinite(c)||c<0){t=!0;break}if(Kn(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 nf(r,u,void 0,{maximumLength:u.length,reason:"ASF stream type GUID"}),Kn(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(Kn(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>H1){t=!0;break}if(await gn(r,c,{maximumLength:i?H1:r.fileInfo.size,reason:"ASF header payload"}),r.position<=o){t=!0;break}}}catch(e){if(e instanceof $t||e instanceof mn)Ge(r)&&(t=!0);else throw e}if(!t)return{ext:"asf",mime:"application/vnd.ms-asf"}}var D_,H1,$1=Kt(()=>{H();Ps();tf();bu();D_=512,H1=1024*1024});var Z1={};qm(Z1,{FileTypeParser:()=>Bs,fileTypeFromBlob:()=>U_,fileTypeFromBuffer:()=>B_,fileTypeFromFile:()=>$_,fileTypeFromStream:()=>L_,fileTypeFromTokenizer:()=>z_,fileTypeStream:()=>j_,normalizeSampleSize:()=>K1,reasonableDetectionSizeInBytes:()=>wu,supportedExtensions:()=>H_,supportedMimeTypes:()=>G_});function K1(r){return Number.isFinite(r)?Math.max(1,Math.trunc(r)):wu}function F_(r){return Number.isFinite(r)?Math.max(0,Math.min(k_,Math.trunc(r))):0}function P_(r){return Number.isFinite(r)?Math.max(0,r):Number.MAX_SAFE_INTEGER}function X1(r){return import(r)}function O_(r){return r.pipeThrough(new TransformStream)}function Y1(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 R_(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 L_(r,t){return new Bs(t).fromStream(r)}async function B_(r,t){return new Bs(t).fromBuffer(r)}async function U_(r,t){return new Bs(t).fromBlob(r)}async function z_(r,t){return new Bs(t).fromTokenizer(r)}async function j_(r,t){return new Bs(t).toDetectionStream(r,t)}async function $_(r,t){return new Bs(t).fromFile(r)}var wu,k_,I_,N_,V1,qy,__,q1,M_,W1,Bs,H_,G_,Q1=Kt(()=>{H();Ps();tf();Gy();Vy();A1();C1();bu();P1();B1();j1();$1();wu=4100,k_=wu-2,I_=16777216,N_=1,V1=100,qy=16777216,__=512,q1=256,M_=1024*1024,W1=16777216;Bs=class r{constructor(t){z(this,"detectConfident",async t=>{if(this.buffer=new Uint8Array(wu),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,Ge(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>=q1?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 gn(t,6,{maximumLength:6,reason:"ID3 header prefix"});let e=await t.readToken(w1),i=Ge(t);if(!Number.isFinite(e)||e<0||i&&(e>qy||t.position+e>qy))return;if(t.position+e>t.fileInfo.size)return i?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await gn(t,e,{maximumLength:i?qy:t.fileInfo.size,reason:"ID3 payload"})}catch(n){if(n instanceof $t)return;throw n}return this.detectionReentryCount>=q1?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 F1(t);if(this.checkString("OggS")){await t.ignore(28);let e=new Uint8Array(8);return await t.readBuffer(e),Kn(e,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:Kn(e,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Kn(e,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Kn(e,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Kn(e,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Kn(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 L1(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=Ly.get(this.buffer,4),i=Zo.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("=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("!"))return await t.ignore(8),await t.readToken(new Mi(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[` `,"\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 z1(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 Mi(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 `))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 G1(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 Mi(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("=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})&&b1(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let e="utf-16le";return this.checkString("{this.buffer=new Uint8Array(wu);let e=PN(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=FN(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 e1(ON(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 $t||o instanceof mn)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(i1(e,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let e=n1(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([X1("node:fs/promises"),X1("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=K1(e?.sampleSize??wu),n,s=!1,o=t.getReader(),l=[],c=0;try{for(;c0){let d=l.length===1?l[0]:x1(l);try{n=await this.fromBuffer(d.subarray(0,i))}catch(f){if(!(f instanceof $t))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>=_N)return{ext:"gz",mime:"application/gzip"};let e=new ef(t),i=RN(e.inflate(),kN),n=Ge(t),s,o,l,c;if(n){let u=new AbortController;s=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${V1} ms`,"TimeoutError"))},V1),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 Kn(this.buffer,t,e)}checkString(t,e){return this.check(y1(t,e?.encoding),e)}async readTiffTag(t){let e=await this.tokenizer.readToken(t?Zo:Te);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?Zo:Te);if(!(e>NN)&&!(Ge(this.tokenizer)&&2+e*12>W1))for(let i=0;i=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(n>=8){let l=(t?Zo:Te).get(this.buffer,8),c=(t?Zo:Te).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(Ge(this.tokenizer)&&n>MN)return e;let s=Ge(this.tokenizer)?W1:this.tokenizer.fileInfo.size;try{await gn(this.tokenizer,n,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof $t)return;throw l}let o;try{o=await this.readTiffIFD(t)}catch(l){if(l instanceof $t)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"}}}},HN=new Set(v1),GN=new Set(E1)});var OS={};qm(OS,{AbortException:()=>Lr,AnnotationEditorLayer:()=>ax,AnnotationEditorParamsType:()=>Ht,AnnotationEditorType:()=>kt,AnnotationEditorUIManager:()=>Lo,AnnotationLayer:()=>J0,AnnotationMode:()=>Ea,AnnotationType:()=>$e,CSSConstants:()=>O0,ColorPicker:()=>Vf,DOMSVGFactory:()=>Pc,DrawLayer:()=>ox,FeatureTest:()=>Be,GlobalWorkerOptions:()=>dr,ImageKind:()=>_f,InvalidPDFException:()=>dd,MathClamp:()=>ai,OPS:()=>hd,OutputScale:()=>Es,PDFDataRangeTransport:()=>$f,PDFDateString:()=>Nc,PDFWorker:()=>yd,PasswordResponses:()=>CC,PermissionFlag:()=>EC,PixelsPerInch:()=>Da,RenderingCancelledException:()=>fd,ResponseException:()=>Mc,SignatureExtractor:()=>fr,SupportedImageMimeTypes:()=>P0,TextLayer:()=>xd,TextLayerImages:()=>lx,TouchManager:()=>zf,Util:()=>ht,VerbosityLevel:()=>Hm,XfaLayer:()=>Bf,applyOpacity:()=>kC,build:()=>jT,createValidAbsoluteUrl:()=>_w,fetchData:()=>Lx,findContrastColor:()=>_C,getDocument:()=>LT,getFilenameFromUrl:()=>SC,getPdfFilenameFromUrl:()=>DC,getRGB:()=>Ad,getUuid:()=>Mw,getXfaPageViewport:()=>IC,isDataScheme:()=>Gm,isPdfFile:()=>Bx,isValidExplicitDest:()=>hT,makeArr:()=>Ox,makeMap:()=>Rx,makeObj:()=>M0,noContextMenu:()=>Hn,normalizeUnicode:()=>TC,renderRichText:()=>Fw,setLayerDimensions:()=>Ro,shadow:()=>_t,stopEvent:()=>ke,updateUrlHash:()=>Nw,version:()=>zT});function qN(r){Number.isInteger(r)&&(Mx=r)}function WN(){return Mx}function Fx(r){Mx>=Hm.INFOS&&console.info(`Info: ${r}`)}function Mt(r){Mx>=Hm.WARNINGS&&console.warn(`Warning: ${r}`)}function ie(r){throw new Error(r)}function _e(r,t){r||ie(t)}function XN(r){switch(r?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function _w(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=JN(r)}catch{}let i=t?URL.parse(r,t):URL.parse(r);return XN(i)?i:null}function Nw(r,t,e=!1){let i=URL.parse(r);return i?(i.hash=t,i.href):e&&_w(r,"http://example.com")?r.split("#",1)[0]+`${t?`#${t}`:""}`:""}function Jy(r){return r.substring(r.lastIndexOf("/")+1)}function _t(r,t,e,i=!1){return Object.defineProperty(r,t,{value:e,enumerable:!i,configurable:!0,writable:!1}),e}function YN(r){(typeof r!="object"||r?.length===void 0)&&ie("Invalid argument for bytesToString");let t=r.length,e=8192;if(t>24&255,r>>16&255,r>>8&255,r&255)}function ZN(){let r=new Uint8Array(4);return r[0]=1,new Uint32Array(r.buffer,0,1)[0]===1}function QN(){try{return new Function(""),!0}catch{return!1}}function JN(r){return decodeURIComponent(escape(r))}function TC(r){return Xy||(Xy=/([\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,J1=new Map([["\uFB05","\u017Ft"]])),r.replaceAll(Xy,(t,e,i)=>e?e.normalize("NFKC"):J1.get(i))}function Mw(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let r=new Uint8Array(32);return crypto.getRandomValues(r),YN(r)}function tM(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 ai(r,t,e){return Math.min(Math.max(r,t),e)}async function Lx(r,t="text"){if(Mf(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 Gm(r){let t=r.length,e=0;for(;e{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=Jy(c),/^\.pdf$/i.test(c))?l:c}catch{return l}},s=/\.pdf$/i,o=Jy(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 Mf(r,t){let e=t?URL.parse(r,t):URL.parse(r);return/https?:/.test(e?.protocol??"")}function Hn(r){r.preventDefault()}function ke(r){r.preventDefault(),r.stopPropagation()}function eM(r){console.log("Deprecated API usage: "+r)}function IC(r,{scale:t=1,rotation:e=0}){let{width:i,height:n}=r.attributes.style,s=[0,0,parseInt(i),parseInt(n)];return new Uf({viewBox:s,userUnit:1,scale:t,rotation:e})}function Ad(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)):(Mt(`Not a valid color format: "${r}"`),[0,0,0])}function iM(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,Ad(i))}t.remove()}function Ie(r){let{a:t,b:e,c:i,d:n,e:s,f:o}=r.getTransform();return[t,e,i,n,s,o]}function Zr(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 Ro(r,t,e=!1,i=!0){if(t instanceof Uf){let{pageWidth:n,pageHeight:s}=t.rawDims,{style:o}=r,l=Be.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 kC(r,t){t=ai(t??1,0,1);let e=255*(1-t);return r.map(i=>Math.round(i*t+e))}function tC(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+(in?(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=nC.get(e);if(i)return i;let n=new Float32Array(9),s=n.subarray(0,3),o=n.subarray(3,6);tC(r,o);let l=n.subarray(6,9);tC(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]),iC(o,l,s)f;){let m=o[2]=(h+d)/2;c===iC(o,l,s)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,y=(c[e*2+1]+t.offsetY)*t.scaleY,g=(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(y>=v)return;let T=u[s*4],k=u[s*4+1],N=u[s*4+2],F=u[o*4],L=u[o*4+1],Y=u[o*4+2],q=u[l*4],G=u[l*4+1],j=u[l*4+2],tt=Math.round(y),et=Math.round(v),_,X,O,C,D,E,S,I;for(let M=tt;M<=et;M++){if(Mv?V=1:A===v?V=0:V=(A-M)/(A-v),_=g-(g-w)*V,X=F-(F-q)*V,O=L-(L-G)*V,C=Y-(Y-j)*V}let P;Mv?P=1:P=(y-M)/(y-v),D=m-(m-w)*P,E=T-(T-q)*P,S=k-(k-G)*P,I=N-(N-j)*P;let B=Math.round(Math.min(_,D)),$=Math.round(Math.max(_,D)),U=d*M+B*4;for(let V=B;V<=$;V++)P=(_-V)/(_-D),P<0?P=0:P>1&&(P=1),h[U++]=X-(X-E)*P|0,h[U++]=O-(O-S)*P|0,h[U++]=C-(C-I)*P|0,h[U++]=255}}function hM(r,t,e){let i=t.coords,n=t.colors,s,o;switch(t.type){case ul.LATTICE:let l=t.verticesPerRow,c=Math.floor(i.length/l)-1,u=l-1;for(s=0;s>3,d=i&7,f=c^u,m=r.length;e=new Uint32Array(e.buffer);let y=0;for(let g=0;g>7&1)&f,e[y+1]=c^-(v>>6&1)&f,e[y+2]=c^-(v>>5&1)&f,e[y+3]=c^-(v>>4&1)&f,e[y+4]=c^-(v>>3&1)&f,e[y+5]=c^-(v>>2&1)&f,e[y+6]=c^-(v>>1&1)&f,e[y+7]=c^-(v&1)&f}if(d===0)continue;let A=t>7-w&1)&f}return{srcPos:t,destPos:y}}function mM(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 Ug(r,t,e,i,n,s,o,l,c,u){let[h,d,f,m,y,g]=Ie(r);if(d===0&&f===0){let v=o*h+y,T=Math.round(v),k=l*m+g,N=Math.round(k),F=(o+c)*h+y,L=Math.abs(Math.round(F)-T)||1,Y=(l+u)*m+g,q=Math.abs(Math.round(Y)-N)||1;return r.setTransform(Math.sign(h),0,0,Math.sign(m),T,N),r.drawImage(t,e,i,n,s,0,0,L,q),r.setTransform(h,d,f,m,y,g),[L,q]}if(h===0&&m===0){let v=l*f+y,T=Math.round(v),k=o*d+g,N=Math.round(k),F=(l+u)*f+y,L=Math.abs(Math.round(F)-T)||1,Y=(o+c)*d+g,q=Math.abs(Math.round(Y)-N)||1;return r.setTransform(0,Math.sign(d),Math.sign(f),0,T,N),r.drawImage(t,e,i,n,s,0,0,q,L),r.setTransform(h,d,f,m,y,g),[q,L]}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 pC(r,t){if(t instanceof ImageData){r.putImageData(t,0,0);return}let e=t.height,i=t.width,n=e%pn,s=(e-n)/pn,o=n===0?s:s+1,l=r.createImageData(i,pn),c=0,u,h=t.data,d=l.data,f,m,y,g;if(t.kind===_f.GRAYSCALE_1BPP){let A=h.byteLength,w=new Uint32Array(d.buffer,0,d.byteLength>>2),v=w.length,T=i+7>>3,k=4294967295,N=Be.isLittleEndian?4278190080:255;for(f=0;fT?i:F*8-7,q=Y&-8,G=0,j=0;for(;L>=1}for(;u=s&&(y=n,g=i*y),u=0,m=g;m--;)d[u++]=h[c++],d[u++]=h[c++],d[u++]=h[c++],d[u++]=255;r.putImageData(l,0,f*pn)}else throw new Error(`bad image kind: ${t.kind}`)}function mC(r,t){if(t.bitmap){r.drawImage(t.bitmap,0,0);return}let e=t.height,i=t.width,n=e%pn,s=(e-n)/pn,o=n===0?s:s+1,l=r.createImageData(i,pn),c=0,u=t.data,h=l.data;for(let d=0;d0?r.rangeChunkSize:2**16,h=r.worker instanceof yd?r.worker:null,d=r.verbosity,f=typeof r.docBaseUrl=="string"&&!Gm(r.docBaseUrl)?r.docBaseUrl:null,m=Lg(r.cMapUrl),y=r.cMapPacked!==!1,g=Lg(r.iccUrl),A=Lg(r.standardFontDataUrl),w=Lg(r.wasmUrl),v=r.stopAtErrors!==!0,T=Number.isInteger(r.maxImageSize)&&r.maxImageSize>-1?r.maxImageSize:-1,k=r.isEvalSupported!==!1,N=typeof r.isOffscreenCanvasSupported=="boolean"?r.isOffscreenCanvasSupported:!Bn,F=typeof r.isImageDecoderSupported=="boolean"?r.isImageDecoderSupported:!Bn&&(Be.platform.isFirefox||!globalThis.chrome),L=Number.isInteger(r.canvasMaxAreaInBytes)?r.canvasMaxAreaInBytes:-1,Y=typeof r.disableFontFace=="boolean"?r.disableFontFace:Bn,q=r.fontExtraProperties===!0,G=r.enableXfa===!0,j=r.ownerDocument||globalThis.document,tt=r.disableRange===!0,et=r.disableStream===!0,_=r.disableAutoFetch===!0,X=r.pdfBug===!0,O=r.CanvasFactory||(Bn?Vb:zb),C=r.FilterFactory||(Bn?$b:jb),D=r.BinaryDataFactory||(Bn?qb:j0),E=r.enableHWA===!0,S=r.enableWebGPU===!0,I=r.useWasm!==!1,M=r.pagesMapper||new b2,P=typeof r.useSystemFonts=="boolean"?r.useSystemFonts:!Bn&&!Y,B=typeof r.useWorkerFetch=="boolean"?r.useWorkerFetch:!!(D===j0&&m&&y&&A&&w&&Mf(m,document.baseURI)&&Mf(A,document.baseURI)&&Mf(w,document.baseURI)),$=null;qN(d);let U={canvasFactory:new O({ownerDocument:j,enableHWA:E}),filterFactory:new C({docId:e,ownerDocument:j}),binaryDataFactory:B?null:new D({cMapUrl:m,standardFontDataUrl:A,wasmUrl:w})};h||(h=yd.create({verbosity:d,port:dr.workerPort}),t._worker=h);let V={docId:e,apiVersion:"5.6.205",data:n,password:l,disableAutoFetch:_,rangeChunkSize:u,docBaseUrl:f,enableXfa:G,evaluatorOptions:{maxImageSize:T,disableFontFace:Y,ignoreErrors:v,isEvalSupported:k,isOffscreenCanvasSupported:N,isImageDecoderSupported:F,canvasMaxAreaInBytes:L,fontExtraProperties:q,useSystemFonts:P,useWasm:I,useWorkerFetch:B,cMapUrl:m,cMapPacked:y,iccUrl:g,standardFontDataUrl:A,wasmUrl:w,enableWebGPU:S}},Z={ownerDocument:j,pdfBug:X,styleElement:$,enableHWA:E,loadingParams:{disableAutoFetch:_,enableXfa:G}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let Q=h.messageHandler.sendWithPromise("GetDocRequest",V,n?[n.buffer]:null),nt;if(!n)if(c)nt=new r2({pdfDataRangeTransport:c,disableRange:tt,disableStream:et});else if(i){let at=AM(i);nt=new at({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 Q.then(at=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let dt=new hl(e,at,h.port),ot=new T2(dt,t,nt,Z,U,M);t._transport=ot,dt.send("Ready",null)})}).catch(t._capability.reject),t}function vC(r){return Math.floor(Math.max(0,Math.min(1,r))*255).toString(16).padStart(2,"0")}function af(r){return Math.max(0,Math.min(255,255*r))}function Gg(r){return`${(r*100).toFixed(2)}%`}var $g,Bn,Qy,Vg,VN,tL,Ln,Ea,Rf,kt,Ht,EC,ul,ni,_f,$e,vu,Hm,hd,rf,CC,Mx,Lc,N0,Nf,dd,Mc,tb,Lr,Be,Wy,Ca,qg,eb,ht,Xy,J1,Nu,Ox,Rx,M0,Lf,Bf,Us,ol,Da,Uf,fd,ja,F0,Qf,Nc,Es,P0,ib,O0,nC,Ha,Ga,Jn,tr,Jf,$a,Lu,Bu,tp,cx,MC,Ni,FC,PC,Eu,lf,Hs,rb,ep,dl,$s,ka,OC,RC,ab,sb,fl,pl,Uu,ml,ce,Oi,ux,ob,zu,ip,Ri,ju,Wg,Ow,lb,Ve,Va,np,Se,cb,hx,BC,Fc,dx,ub,Hu,wn,Gu,Pe,De,$u,Vu,qi,qu,er,ui,qa,Wa,Xa,Ya,ts,ir,gl,rp,sp,Wu,ap,es,Ka,Xu,Za,is,fx,Vs,Yu,op,Qa,xl,Ku,Ja,lp,Qe,ae,qs,to,eo,cp,Zu,up,io,ns,Ws,hp,dp,nr,mt,Xg,hb,UC,zC,jC,cf,HC,GC,$C,db,VC,qC,WC,XC,$i,zs,YC,KC,fb,ZC,uf,pb,Pu,Lo,hi,rs,Ar,Qu,ss,An,Ju,as,cn,Xs,yl,os,no,Or,hf,Yg,Vi,R0,Ei,rr,bl,ye,fp,ro,sr,so,ao,wl,pp,mb,Mu,th,Al,mp,gp,xp,yp,bp,Ys,vl,Ks,El,Zs,Bo,QC,JC,tT,Rw,zf,Cl,vr,ve,oe,Qs,eh,oo,wp,Ci,Tl,Js,ar,lo,Ap,Sl,vn,vp,Dl,ta,ls,ih,nh,or,Il,Ep,px,St,gb,Cp,xb,Kg,eT,iT,yb,Zg,bb,nT,rT,sT,wb,aT,Ab,oT,lT,cT,vb,df,Nt,be,Eb,rC,Zn,Qr,L0,jf,kl,_l,ea,Ti,mx,uT,Hf,Tp,B0,Au,sC,aC,Cb,rh,co,Tb,lC,ia,ee,ue,Nl,Ml,Fl,Li,Sp,Db,Sb,un,hn,Pl,Er,sh,uo,ho,he,Ib,de,Oe,Cr,ah,oh,Lw,U0,Qn,Ol,Rl,Ll,Bl,Ul,Dp,Pf,kb,lh,_b,fe,Nb,Qg,Jg,Pi,yn,yi,Ip,gx,ch,uh,t0,Mb,zl,hh,cs,jl,ff,Fb,Tr,xx,qe,le,br,e0,i0,pf,Ob,Pb,Rb,dh,Lb,Bb,sM,hT,na,yx,Ub,Bg,Ze,fh,mr,dT,fT,pT,n0,hl,bx,z0,j0,kp,H0,zb,G0,Hl,ph,ra,sa,Bi,Gl,$l,yt,Fi,mf,Cu,r0,Tu,mT,Hb,Su,gf,xf,Gb,yf,jb,$b,Vb,qb,oM,_p,mh,gh,xh,bd,gT,xT,Wb,Pw,ki,Gf,Xb,Yb,Kb,uC,wx,Zb,hC,dC,pM,fC,pn,Ky,Un,Fu,$0,gM,xM,yM,xC,Br,Qb,Jb,t2,Bw,Ru,Np,Mp,pd,md,gd,e2,i2,n2,Fp,s2,r2,Pp,a2,Op,o2,Zy,bC,us,wd,CT,TT,l2,Rp,Cs,ST,DT,IT,kT,c2,Lp,_a,_T,NT,h2,u2,d2,f2,p2,Bp,Up,dr,yh,zp,m2,Du,jp,Hp,Gp,bh,g2,fo,pe,wh,Ah,$p,y2,x2,We,Sr,Si,Vl,hs,zi,bf,wf,a0,b2,Iu,wC,lr,V0,vM,AC,po,Wi,Vp,qp,vh,ql,aa,Wp,Xp,Wl,Yp,Eh,mo,Ch,Kp,Th,Xl,Zp,Qp,Sh,Yl,Jp,Dh,Ih,Na,FT,PT,w2,jn,o0,A2,OT,RT,vi,xd,EM,Ax,vx,v2,kh,tm,em,im,$f,E2,oa,Kl,Zl,Af,Uw,C2,go,Dr,la,Ql,Ex,Jl,tc,Zi,l0,BT,UT,vf,_h,c0,Fe,yd,En,ec,ca,Ir,ic,Nh,ua,Rr,Ef,u0,T2,S2,xo,nc,ll,D2,zT,jT,Cn,rc,Mh,si,nm,Fh,ha,rm,yo,kr,sm,me,I2,k2,_2,rl,HT,za,ln,Vf,ds,am,Ph,om,cl,q0,W0,N2,Pc,CM,Oc,TM,Ff,sc,Oh,cr,lm,M2,zw,Ne,F2,zn,sl,GT,$T,qf,P2,Ia,O2,R2,L2,X0,B2,U2,cm,z2,Wf,Tn,bo,Cx,Tx,Rh,Lh,Re,fs,wo,ac,Bh,Uh,ps,Sn,da,fa,Le,pa,Ao,um,ma,zh,oc,vo,di,Eo,Ot,h0,H2,G2,$2,d0,V2,VT,qT,WT,XT,f0,p0,q2,j2,Y0,hm,W2,dm,X2,fm,Y2,pm,K0,K2,Z2,mm,lc,gm,Q2,Xf,Z0,J2,tw,ew,Q0,xm,ym,nw,iw,cc,uc,jh,Co,bm,hc,Dn,wm,Ta,m0,rw,jw,J0,jg,In,Am,dc,kn,Je,YT,KT,ZT,g0,Sa,x0,y0,QT,aw,JT,Ae,sw,xt,_n,_r,Hh,Gh,ms,Lt,fc,pc,vm,Em,$h,Vh,To,Cm,Sx,Dx,oi,Cf,tS,eS,iS,nS,rS,sS,Gs,tx,qh,mc,ga,Tm,Nn,Sm,Xe,Ix,aS,ex,Dm,Im,km,So,Nr,Qi,oS,b0,lS,cS,ow,Yf,_m,Wh,lw,Kf,cw,Xh,Nm,xa,gc,Mm,dn,Fm,Pm,xc,Mn,Fn,Di,Yh,Kh,Ui,Zh,ur,Om,Pt,uw,w0,uS,hS,dS,hw,al,pr,ku,fS,A0,v0,pS,mS,gS,xS,yS,te,ix,yc,nx,Pn,Qh,fi,bc,wc,Wt,dw,fw,pw,Tf,bS,E0,Sf,_u,jt,rx,gs,pi,mi,Ac,Jh,Xi,Ii,hr,vc,Ec,Cc,td,C0,mw,Yi,Rm,Lm,On,xs,ys,ed,id,Tc,_i,js,wS,AS,vS,Rc,sx,kx,ES,Ou,gw,Zf,Hg,of,Sc,ne,xw,Mr,CS,TS,yw,T0,SS,DS,IS,bw,ww,kS,fr,Aw,vw,Do,bs,Io,Dc,bn,Ew,Ee,gi,ko,ya,_o,nd,ba,Ic,ws,Rn,rd,Xt,If,kf,S0,D0,I0,Cw,k0,_S,Df,kc,sd,No,Mo,wa,fn,Fo,ad,od,Fr,Aa,xi,va,Po,ld,wt,Oo,ge,Tw,NS,Jr,Sw,Dw,_0,wr,ax,Pr,Ki,_c,Bm,_x,MS,Ts,Iw,FS,kw,ri,ox,cd,Um,zm,ud,As,vs,jm,Nx,PS,Of,lx,RS=Kt(()=>{H();$g={};$g.d=(r,t)=>{for(var e in t)$g.o(t,e)&&!$g.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})};$g.o=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);Bn=typeof it.default=="object"&&it.default+""=="[object process]"&&!it.default.versions.nw&&!(it.default.versions.electron&&it.default.type&&it.default.type!=="browser"),Qy=[.001,0,0,.001,0,0],Vg=1.35,VN=.35,tL=VN/Vg,Ln={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ea={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Rf="pdfjs_internal_editor_",kt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},Ht={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},EC={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},ul={TRIANGLES:1,LATTICE:2,PATCH:3},ni={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},$e={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},vu={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Hm={ERRORS:0,WARNINGS:1,INFOS:5},hd={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},rf={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},CC={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Mx=Hm.WARNINGS;Lc=(function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t})(),N0=class extends Lc{constructor(t,e){super(t,"PasswordException"),this.code=e}},Nf=class extends Lc{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},dd=class extends Lc{constructor(t){super(t,"InvalidPDFException")}},Mc=class extends Lc{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}},tb=class extends Lc{constructor(t){super(t,"FormatError")}},Lr=class extends Lc{constructor(t){super(t,"AbortException")}};Be=class{static get isLittleEndian(){return _t(this,"isLittleEndian",ZN())}static get isEvalSupported(){return _t(this,"isEvalSupported",QN())}static get isOffscreenCanvasSupported(){return _t(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return _t(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return _t(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return _t(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:t,userAgent:e}=navigator;return _t(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 _t(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}},Wy=Array.from(Array(256).keys(),r=>r.toString(16).padStart(2,"0")),ht=class{static makeHexColor(t,e,i){return`#${Wy[t]}${Wy[e]}${Wy[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],y=n*h+c,g=y,A=n*f+c,w=A,v=l*d+u,T=v,k=l*m+u,N=k;if(s!==0||o!==0){let F=s*h,L=s*f,Y=o*d,q=o*m;y+=Y,w+=Y,A+=q,g+=q,v+=F,N+=F,k+=L,T+=L}i[0]=Math.min(i[0],y,A,g,w),i[1]=Math.min(i[1],v,k,T,N),i[2]=Math.max(i[2],y,A,g,w),i[3]=Math.max(i[3],v,k,T,N)}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,Ca,eb).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,Ca,eb).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)}};Ca=new WeakSet,qg=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,y=d*(d*(d*t+3*u*e)+3*f*i)+m*n,g=d*(d*(d*s+3*u*o)+3*f*l)+m*c;h[0]=Math.min(h[0],y),h[1]=Math.min(h[1],g),h[2]=Math.max(h[2],y),h[3]=Math.max(h[3],g)},eb=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,Ca,qg).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 y=Math.sqrt(m),g=2*u;b(this,Ca,qg).call(this,t,e,i,n,s,o,l,c,(-h+y)/g,f),b(this,Ca,qg).call(this,t,e,i,n,s,o,l,c,(-h-y)/g,f)},x(ht,Ca);Xy=null,J1=null;Nu="pdfjs_internal_id_";Ox=()=>[],Rx=()=>new Map,M0=()=>Object.create(null);typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(r){return r.reduce((t,e)=>t+e,0)});Lf=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")}},Bf=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&&Lf.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 y=d.children[++h.at(-1)[1]];if(y===null)continue;let{name:g}=y;if(g==="#text"){let w=document.createTextNode(y.value);u.push(w),m.append(w);continue}let A=y?.attributes?.xmlns?document.createElementNS(y.attributes.xmlns,g):document.createElement(g);if(m.append(A),y.attributes&&this.setAttributes({html:A,element:y,storage:e,intent:s,linkService:i}),y.children?.length>0)h.push([y,-1,A]);else if(y.value){let w=document.createTextNode(y.value);l&&Lf.shouldBuildText(g)&&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}},Us="http://www.w3.org/2000/svg",ol=class ol{};z(ol,"CSS",96),z(ol,"PDF",72),z(ol,"PDF_TO_CSS_UNITS",ol.CSS/ol.PDF);Da=ol;Uf=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 y,g,A,w;h===0?(y=Math.abs(u-t[1])*i+s,g=Math.abs(c-t[0])*i+o,A=(t[3]-t[1])*i,w=(t[2]-t[0])*i):(y=Math.abs(c-t[0])*i+s,g=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,y-h*i*c-f*i*u,g-d*i*c-m*i*u],this.width=A,this.height=w}get rawDims(){let t=this.viewBox;return _t(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 ht.applyTransform(i,this.transform),i}convertToViewportRectangle(t){let e=[t[0],t[1]];ht.applyTransform(e,this.transform);let i=[t[2],t[3]];return ht.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){let i=[t,e];return ht.applyInverseTransform(i,this.transform),i}},fd=class extends Lc{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};F0=class{constructor(){x(this,ja,new Map);z(this,"times",[])}time(t){a(this,ja).has(t)&&Mt(`Timer is already running for ${t}`),a(this,ja).set(t,Date.now())}timeEnd(t){a(this,ja).has(t)||Mt(`Timer has not been started for ${t}`),this.times.push({name:t,start:a(this,ja).get(t),end:Date.now()}),a(this,ja).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 -`).join("")}};ja=new WeakMap;Nc=class{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;a(this,Qf)||p(this,Qf,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));let e=a(this,Qf).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))}};Qf=new WeakMap,x(Nc,Qf);Es=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}},P0=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],ib=class{static get isDarkMode(){return _t(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}},O0=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(),_t(this,"commentForegroundColor",Ad(i))}};nC=new Map;Hs=class Hs{constructor(t){x(this,Ni);x(this,Ha,null);x(this,Ga,null);x(this,Jn);x(this,tr,null);x(this,Jf,null);x(this,$a,null);x(this,Lu,null);x(this,Bu,null);p(this,Jn,t),a(Hs,tp)||p(Hs,tp,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,Ha,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=a(this,Jn)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",Hn,{signal:e}),t.addEventListener("pointerdown",b(Hs,cx,MC),{signal:e}));let i=p(this,tr,document.createElement("div"));i.className="buttons",t.append(i);let n=a(this,Jn).toolbarPosition;if(n){let{style:s}=t,o=a(this,Jn)._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,Ha)}hide(){a(this,Ha).classList.add("hidden"),a(this,Ga)?.hideDropdown()}show(){a(this,Ha).classList.remove("hidden"),a(this,Jf)?.shown(),a(this,$a)?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=a(this,Jn),i=document.createElement("button");i.classList.add("basic","deleteButton"),i.tabIndex=0,i.setAttribute("data-l10n-id",a(Hs,tp)[t]),b(this,Ni,Eu).call(this,i)&&i.addEventListener("click",n=>{e.delete()},{signal:e._signal}),a(this,tr).append(i)}async addAltText(t){let e=await t.render();b(this,Ni,Eu).call(this,e),a(this,tr).append(e,a(this,Ni,lf)),p(this,Jf,t)}addComment(t,e=null){if(a(this,$a))return;let i=t.renderForToolbar();if(!i)return;b(this,Ni,Eu).call(this,i);let n=p(this,Lu,a(this,Ni,lf));e?(a(this,tr).insertBefore(i,e),a(this,tr).insertBefore(n,e)):a(this,tr).append(i,n),p(this,$a,t),t.toolbar=this}addColorPicker(t){if(a(this,Ga))return;p(this,Ga,t);let e=t.renderButton();b(this,Ni,Eu).call(this,e),a(this,tr).append(e,a(this,Ni,lf))}async addEditSignatureButton(t){let e=p(this,Bu,await t.renderEditButton(a(this,Jn)));b(this,Ni,Eu).call(this,e),a(this,tr).append(e,a(this,Ni,lf))}removeButton(t){t==="comment"&&(a(this,$a)?.removeToolbarCommentButton(),p(this,$a,null),a(this,Lu)?.remove(),p(this,Lu,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,tr).querySelector(i);n&&t==="comment"&&this.addComment(e,n)}updateEditSignatureButton(t){a(this,Bu)&&(a(this,Bu).title=t)}remove(){a(this,Ha).remove(),a(this,Ga)?.destroy(),p(this,Ga,null)}};Ha=new WeakMap,Ga=new WeakMap,Jn=new WeakMap,tr=new WeakMap,Jf=new WeakMap,$a=new WeakMap,Lu=new WeakMap,Bu=new WeakMap,tp=new WeakMap,cx=new WeakSet,MC=function(t){t.stopPropagation()},Ni=new WeakSet,FC=function(t){a(this,Jn)._focusEventsAllowed=!1,ke(t)},PC=function(t){a(this,Jn)._focusEventsAllowed=!0,ke(t)},Eu=function(t){let e=a(this,Jn)._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",b(this,Ni,FC).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",b(this,Ni,PC).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Hn,{signal:e}),!0)},lf=function(){let t=document.createElement("div");return t.className="divider",t},x(Hs,cx),x(Hs,tp,null);rb=Hs,sb=class{constructor(t){x(this,ka);x(this,ep,null);x(this,dl,null);x(this,$s);p(this,$s,t)}show(t,e,i){let[n,s]=b(this,ka,RC).call(this,e,i),{style:o}=a(this,dl)||p(this,dl,b(this,ka,OC).call(this));t.append(a(this,dl)),o.insetInlineEnd=`${100*n}%`,o.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){a(this,dl).remove()}};ep=new WeakMap,dl=new WeakMap,$s=new WeakMap,ka=new WeakSet,OC=function(){let t=p(this,dl,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");let e=a(this,$s)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",Hn,{signal:e});let i=p(this,ep,document.createElement("div"));return i.className="buttons",t.append(i),a(this,$s).hasCommentManager()&&b(this,ka,ab).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{a(this,$s).commentSelection("floating_button")}),b(this,ka,ab).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{a(this,$s).highlightSelection("floating_button")}),t},RC=function(t,e){let i=0,n=0;for(let s of t){let o=s.y+s.height;if(oi){n=l,i=o;continue}e?l>n&&(n=l):l=1}static clearPointerType(){p(ce,ml,null)}static clearPointerIds(){p(ce,fl,NaN),p(ce,pl,null)}static clearTimeStamp(){p(ce,Uu,NaN)}};fl=new WeakMap,pl=new WeakMap,Uu=new WeakMap,ml=new WeakMap,x(ce,fl,NaN),x(ce,pl,null),x(ce,Uu,NaN),x(ce,ml,null);Oi=ce,ob=class{constructor(){x(this,ux,0)}get id(){return`${Rf}${Ye(this,ux)._++}`}};ux=new WeakMap;Ow=class Ow{constructor(){x(this,ju);x(this,zu,Mw());x(this,ip,0);x(this,Ri,null)}static get _isSVGFittingCanvas(){let t='data:image/svg+xml;charset=UTF-8,',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 _t(this,"_isSVGFittingCanvas",s)}async getFromFile(t){let{lastModified:e,name:i,size:n,type:s}=t;return b(this,ju,Wg).call(this,`${e}_${i}_${n}_${s}`,t)}async getFromUrl(t){return b(this,ju,Wg).call(this,t,t)}async getFromBlob(t,e){let i=await e;return b(this,ju,Wg).call(this,t,i)}async getFromId(t){a(this,Ri)||p(this,Ri,new Map);let e=a(this,Ri).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,Ri)||p(this,Ri,new Map);let i=a(this,Ri).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,zu)}_${Ye(this,ip)._++}`,refCounter:1,isSvg:!1},a(this,Ri).set(t,i),a(this,Ri).set(i.id,i),i}getSvgUrl(t){let e=a(this,Ri).get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){a(this,Ri)||p(this,Ri,new Map);let e=a(this,Ri).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,zu)}_`)}};zu=new WeakMap,ip=new WeakMap,Ri=new WeakMap,ju=new WeakSet,Wg=async function(t,e){a(this,Ri)||p(this,Ri,new Map);let i=a(this,Ri).get(t);if(i===null)return null;if(i?.bitmap)return i.refCounter+=1,i;try{i||(i={bitmap:null,id:`image_${a(this,zu)}_${Ye(this,ip)._++}`,refCounter:0,isSvg:!1});let n;if(typeof e=="string"?(i.url=e,n=await Lx(e,"blob")):e instanceof File?n=i.file=e:e instanceof Blob&&(n=e),n.type==="image/svg+xml"){let s=Ow._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){Mt(n),i=null}return a(this,Ri).set(t,i),i&&a(this,Ri).set(i.id,i),i};lb=Ow,cb=class{constructor(t=128){x(this,Ve,[]);x(this,Va,!1);x(this,np);x(this,Se,-1);p(this,np,t)}add({cmd:t,undo:e,post:i,mustExec:n,type:s=NaN,overwriteIfSameType:o=!1,keepUndo:l=!1}){if(n&&t(),a(this,Va))return;let c={cmd:t,undo:e,post:i,type:s};if(a(this,Se)===-1){a(this,Ve).length>0&&(a(this,Ve).length=0),p(this,Se,0),a(this,Ve).push(c);return}if(o&&a(this,Ve)[a(this,Se)].type===s){l&&(c.undo=a(this,Ve)[a(this,Se)].undo),a(this,Ve)[a(this,Se)]=c;return}let u=a(this,Se)+1;u===a(this,np)?a(this,Ve).splice(0,1):(p(this,Se,u),u=0;e--)if(a(this,Ve)[e].type!==t){a(this,Ve).splice(e+1,a(this,Se)-e),p(this,Se,e);return}a(this,Ve).length=0,p(this,Se,-1)}}destroy(){p(this,Ve,null)}};Ve=new WeakMap,Va=new WeakMap,np=new WeakMap,Se=new WeakMap;Fc=class{constructor(t){x(this,hx);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=Be.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,hx,BC).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||ke(e))}};hx=new WeakSet,BC=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};dx=class dx{get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return iM(t),_t(this,"_colors",t)}convert(t){let e=Ad(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 dx._colorsMapping.get(i);return e}getHexCode(t){let e=this._colors.get(t);return e?ht.makeHexColor(...e):t}};z(dx,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));ub=dx,Pu=class Pu{constructor(t,e,i,n,s,o,l,c,u,h,d,f,m,y,g,A){x(this,mt);x(this,Hu,new AbortController);x(this,wn,null);x(this,Gu,null);x(this,Pe,new Map);x(this,De,new Map);x(this,$u,null);x(this,Vu,null);x(this,qi,null);x(this,qu,null);x(this,er,new cb);x(this,ui,null);x(this,qa,null);x(this,Wa,null);x(this,Xa,0);x(this,Ya,new Set);x(this,ts,null);x(this,ir,null);x(this,gl,new Set);z(this,"_editorUndoBar",null);x(this,rp,!1);x(this,sp,!1);x(this,Wu,!1);x(this,ap,null);x(this,es,null);x(this,Ka,null);x(this,Xu,null);x(this,Za,!1);x(this,is,null);x(this,fx,new ob);x(this,Vs,!1);x(this,Yu,!1);x(this,op,!1);x(this,Qa,null);x(this,xl,null);x(this,Ku,null);x(this,Ja,null);x(this,lp,null);x(this,Qe,kt.NONE);x(this,ae,new Set);x(this,qs,null);x(this,to,null);x(this,eo,null);x(this,cp,null);x(this,Zu,null);x(this,up,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});x(this,io,[0,0]);x(this,ns,null);x(this,Ws,null);x(this,hp,null);x(this,dp,null);x(this,nr,null);let w=this._signal=a(this,Hu).signal;p(this,Ws,t),p(this,hp,e),p(this,dp,i),p(this,Vu,n),p(this,ui,s),p(this,to,o),p(this,Zu,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,Yu,!0)},{capture:!0,signal:w}),window.addEventListener("pointerup",()=>{p(this,Yu,!1)},{capture:!0,signal:w}),window.addEventListener("beforeunload",b(this,mt,UC).bind(this),{capture:!0,signal:w}),b(this,mt,HC).call(this),b(this,mt,XC).call(this),b(this,mt,db).call(this),p(this,qi,c.annotationStorage),p(this,ap,c.filterFactory),p(this,eo,u),p(this,Xu,h||null),p(this,rp,d),p(this,sp,f),p(this,Wu,m),p(this,lp,y||null),this.viewParameters={realScale:Da.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=g||null,this._supportsPinchToZoom=A!==!1,s?.setSidebarUiManager(this)}static get _keyboardManager(){let t=Pu.prototype,e=o=>a(o,Ws).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 _t(this,"_keyboardManager",new Fc([[["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,Ws).contains(l)&&!o.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&a(o,Ws).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,nr)?.resolve(),p(this,nr,null),a(this,Hu)?.abort(),p(this,Hu,null),this._signal=null;for(let t of a(this,De).values())t.destroy();a(this,De).clear(),a(this,Pe).clear(),a(this,gl).clear(),a(this,Ja)?.clear(),p(this,wn,null),a(this,ae).clear(),a(this,er).destroy(),a(this,Vu)?.destroy(),a(this,ui)?.destroy(),a(this,to)?.destroy(),a(this,is)?.hide(),p(this,is,null),a(this,Ku)?.destroy(),p(this,Ku,null),p(this,Gu,null),a(this,es)&&(clearTimeout(a(this,es)),p(this,es,null)),a(this,ns)&&(clearTimeout(a(this,ns)),p(this,ns,null)),this._editorUndoBar?.destroy(),p(this,Zu,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return a(this,lp)}get useNewAltTextFlow(){return a(this,sp)}get useNewAltTextWhenAddingImage(){return a(this,Wu)}get hcmFilter(){return _t(this,"hcmFilter",a(this,eo)?a(this,ap).addHCMFilter(a(this,eo).foreground,a(this,eo).background):"none")}get direction(){return _t(this,"direction",getComputedStyle(a(this,Ws)).direction)}get _highlightColors(){return _t(this,"_highlightColors",a(this,Xu)?new Map(a(this,Xu).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 _t(this,"highlightColors",null);let e=new Map,i=!!a(this,eo);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 _t(this,"highlightColors",e)}get highlightColorNames(){return _t(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,Wa,t)}setMainHighlightColorPicker(t){p(this,Ku,t)}editAltText(t,e=!1){a(this,Vu)?.editAltText(this,t,e)}hasCommentManager(){return!!a(this,ui)}editComment(t,e,i,n){a(this,ui)?.showDialog(this,t,e,i,n)}selectComment(t,e){a(this,De).get(t)?.getEditorByUID(e)?.toggleComment(!0,!0)}updateComment(t){a(this,ui)?.updateComment(t.getData())}updatePopupColor(t){a(this,ui)?.updatePopupColor(t)}removeComment(t){a(this,ui)?.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,ui)?.toggleCommentPopup(t,e,i)}makeCommentColor(t,e){return t&&a(this,ui)?.makeCommentColor(t,e)||null}getCommentDialogElement(){return a(this,ui)?.dialogElement||null}async waitForEditorsRendered(t){if(a(this,De).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,to)?.getSignature({uiManager:this,editor:t})}get signatureManager(){return a(this,to)}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,Wu,e)}onPageChanging({pageNumber:t}){p(this,Xa,t-1)}deletePage(t){for(let e of this.getEditors(t))e.remove();a(this,De).delete(t),a(this,Xa)===t&&p(this,Xa,0)}focusMainContainer(){a(this,Ws).focus()}findParent(t,e){for(let i of a(this,De).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,hp).classList.toggle("noUserSelect",t)}addShouldRescale(t){a(this,gl).add(t)}removeShouldRescale(t){a(this,gl).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Da.PDF_TO_CSS_UNITS;for(let e of a(this,gl))e.onScaleChanging();a(this,Wa)?.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,mt,Xg).call(this,i).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;i.empty();let f=b(this,mt,hb).call(this,h),m=a(this,Qe)===kt.NONE,y=()=>{let g=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&&g?.editComment()};if(m){this.switchToMode(kt.HIGHLIGHT,y);return}y()}commentSelection(t=""){this.highlightSelection(t,!0)}getAndRemoveDataFromAnnotationStorage(t){if(!a(this,qi))return null;let e=`${Rf}${t}`,i=a(this,qi).getRawValue(e);return i&&a(this,qi).remove(e),i}addToAnnotationStorage(t){!t.isEmpty()&&a(this,qi)&&!a(this,qi).has(t.id)&&a(this,qi).setValue(t.id,t)}a11yAlert(t,e=null){let i=a(this,dp);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,Za)&&(p(this,Za,!1),b(this,mt,cf).call(this,"main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of a(this,ae))if(e.div.contains(t)){p(this,xl,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!a(this,xl))return;let[t,e]=a(this,xl);p(this,xl,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){b(this,mt,db).call(this),this.setEditingState(!0)}removeEditListeners(){b(this,mt,VC).call(this),this.setEditingState(!1)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let i of a(this,ir))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,ir))if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),a(this,wn)?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let i of a(this,ae)){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,ir))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){Mt(`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,mt,fb).call(this,c);b(this,mt,pb).call(this,s)},l=()=>{for(let c of s)c.remove()};this.addCommands({cmd:o,undo:l,mustExec:!0})}catch(s){Mt(`paste: "${s.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),a(this,Qe)!==kt.NONE&&!this.isEditorHandlingKeyboard&&Pu._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,a(this,Za)&&(p(this,Za,!1),b(this,mt,cf).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,$u).get(t);i&&(i.pageIndex=e,a(this,De).set(e,i),a(this,Vs)?i.enable():i.disable())}startUpdatePages(){p(this,$u,new Map(a(this,De))),a(this,De).clear()}endUpdatePages(){p(this,$u,null)}clonePage(t,e){for(let i of this.getEditors(t)){let n=i.serialize(i.mode!==kt.HIGHLIGHT);n&&(n.pageIndex=e,n.id=this.getId(),n.isClone=!0,delete n.popupRef,a(this,qi).setValue(n.id,n))}}findClonesForPage(t){let e=[],{pageIndex:i}=t;for(let[n,s]of a(this,qi))s.pageIndex===i&&s.isClone&&(a(this,qi).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,mt,GC).call(this),b(this,mt,qC).call(this),b(this,mt,$i).call(this,{isEditing:a(this,Qe)!==kt.NONE,isEmpty:b(this,mt,uf).call(this),hasSomethingToUndo:a(this,er).hasSomethingToUndo(),hasSomethingToRedo:a(this,er).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,mt,$C).call(this),b(this,mt,WC).call(this),b(this,mt,$i).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!a(this,ir)){p(this,ir,t);for(let e of a(this,ir))b(this,mt,zs).call(this,e.defaultPropertiesToUpdate)}}getId(){return a(this,fx).id}get currentLayer(){return a(this,De).get(a(this,Xa))}getLayer(t){return a(this,De).get(t)}get currentPageIndex(){return a(this,Xa)}addLayer(t){a(this,De).set(t.pageIndex,t),a(this,Vs)?t.enable():t.disable()}removeLayer(t){a(this,De).delete(t.pageIndex)}async updateMode(t,e=null,i=!1,n=!1,s=!1,o=!1){if(a(this,Qe)!==t&&!(a(this,nr)&&(await a(this,nr).promise,!a(this,nr)))){if(p(this,nr,Promise.withResolvers()),a(this,Wa)?.commitOrRemove(),a(this,Qe)===kt.POPUP&&a(this,ui)?.hideSidebar(),a(this,ui)?.destroyPopup(),p(this,Qe,t),t===kt.NONE){this.setEditingState(!1),b(this,mt,KC).call(this);for(let l of a(this,Pe).values())l.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),a(this,nr).resolve();return}for(let l of a(this,Pe).values())l.addStandaloneCommentButton();t===kt.SIGNATURE&&await a(this,to)?.loadSignatures(),i&&Oi.clearPointerType(),this.setEditingState(!0),await b(this,mt,YC).call(this),this.unselectAll();for(let l of a(this,De).values())l.updateMode(t);if(t===kt.POPUP){a(this,Gu)||p(this,Gu,await a(this,Zu).getAnnotationsByType(new Set(a(this,ir).map(u=>u._editorType))));let l=new Set,c=[];for(let u of a(this,Pe).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,Gu)){let{id:h,popupRef:d,contentsObj:f}=u;d&&f?.str&&!l.has(h)&&!a(this,Ya).has(h)&&c.push(u)}a(this,ui)?.showSidebar(c)}if(!e){n&&this.addNewEditorFromKeyboard(),a(this,nr).resolve();return}for(let l of a(this,Pe).values())l.uid===e?(this.setSelected(l),o?l.editComment():s?l.enterInEditMode():l.focus()):l.unselect();a(this,nr).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==a(this,Qe)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(a(this,ir)){switch(t){case Ht.CREATE:this.currentLayer.addNewEditor(e);return;case Ht.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(a(this,cp)||p(this,cp,new Map)).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(let i of a(this,ae))i.updateParams(t,e);else for(let i of a(this,ir))i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){for(let s of a(this,Pe).values())s.editorType===t&&s.show(e);(a(this,cp)?.get(Ht.HIGHLIGHT_SHOW_ALL)??!0)!==e&&b(this,mt,zs).call(this,[[Ht.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(a(this,op)!==t){p(this,op,t);for(let e of a(this,De).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(let e of a(this,Pe).values())e.pageIndex===t&&(yield e)}getEditor(t){return a(this,Pe).get(t)}addEditor(t){a(this,Pe).set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(a(this,es)&&clearTimeout(a(this,es)),p(this,es,setTimeout(()=>{this.focusMainContainer(),p(this,es,null)},0))),a(this,Pe).delete(t.id),t.annotationElementId&&a(this,Ja)?.delete(t.annotationElementId),this.unselect(t),(!t.annotationElementId||!a(this,Ya).has(t.annotationElementId))&&a(this,qi)?.remove(t.id)}addDeletedAnnotationElement(t){a(this,Ya).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return a(this,Ya).has(t)}removeDeletedAnnotationElement(t){a(this,Ya).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){a(this,wn)!==t&&(p(this,wn,t),t&&b(this,mt,zs).call(this,t.propertiesToUpdate))}updateUI(t){a(this,mt,ZC)===t&&b(this,mt,zs).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){b(this,mt,zs).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(a(this,ae).has(t)){a(this,ae).delete(t),t.unselect(),b(this,mt,$i).call(this,{hasSelectedEditor:this.hasSelection});return}a(this,ae).add(t),t.select(),b(this,mt,zs).call(this,t.propertiesToUpdate),b(this,mt,$i).call(this,{hasSelectedEditor:!0})}setSelected(t){this.updateToolbar({mode:t.mode,editId:t.uid}),a(this,Wa)?.commitOrRemove();for(let e of a(this,ae))e!==t&&e.unselect();a(this,ui)?.destroyPopup(),a(this,ae).clear(),a(this,ae).add(t),t.select(),b(this,mt,zs).call(this,t.propertiesToUpdate),b(this,mt,$i).call(this,{hasSelectedEditor:!0})}isSelected(t){return a(this,ae).has(t)}get firstSelectedEditor(){return a(this,ae).values().next().value}unselect(t){t.unselect(),a(this,ae).delete(t),b(this,mt,$i).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return a(this,ae).size!==0}get isEnterHandled(){return a(this,ae).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){a(this,er).undo(),b(this,mt,$i).call(this,{hasSomethingToUndo:a(this,er).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,mt,uf).call(this)}),this._editorUndoBar?.hide()}redo(){a(this,er).redo(),b(this,mt,$i).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:a(this,er).hasSomethingToRedo(),isEmpty:b(this,mt,uf).call(this)})}addCommands(t){a(this,er).add(t),b(this,mt,$i).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,mt,uf).call(this)})}cleanUndoStack(t){a(this,er).cleanType(t)}delete(){this.commitOrRemove();let t=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let e=t?[t]:[...a(this,ae)],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,mt,fb).call(this,s)};this.addCommands({cmd:i,undo:n,mustExec:!0})}commitOrRemove(){a(this,wn)?.commitOrRemove()}hasSomethingToControl(){return a(this,wn)||this.hasSelection}selectAll(){for(let t of a(this,ae))t.commit();b(this,mt,pb).call(this,a(this,Pe).values())}unselectAll(){if(!(a(this,wn)&&(a(this,wn).commitOrRemove(),a(this,Qe)!==kt.NONE))&&!a(this,Wa)?.commitOrRemove()&&(a(this,ui)?.destroyPopup(),!!this.hasSelection)){for(let t of a(this,ae))t.unselect();a(this,ae).clear(),b(this,mt,$i).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;a(this,io)[0]+=t,a(this,io)[1]+=e;let[n,s]=a(this,io),o=[...a(this,ae)],l=1e3;a(this,ns)&&clearTimeout(a(this,ns)),p(this,ns,setTimeout(()=>{p(this,ns,null),a(this,io)[0]=a(this,io)[1]=0,this.addCommands({cmd:()=>{for(let c of o)a(this,Pe).has(c.id)&&(c.translateInPage(n,s),c.translationDone())},undo:()=>{for(let c of o)a(this,Pe).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,ts,new Map);for(let t of a(this,ae))a(this,ts).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!a(this,ts))return!1;this.disableUserSelect(!1);let t=a(this,ts);p(this,ts,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,Pe).has(n.id)){let c=a(this,De).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,ts))for(let i of a(this,ts).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,ae).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return a(this,wn)===t}getActive(){return a(this,wn)}getMode(){return a(this,Qe)}isEditingMode(){return a(this,Qe)!==kt.NONE}get imageManager(){return _t(this,"imageManager",new lb)}getSelectionBoxes(t){if(!t)return null;let e=document.getSelection();for(let u=0,h=e.rangeCount;u({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{u.type==="pointerup"&&u.button!==0||(o.abort(),s?.toggleDrawing(!0),u.type==="pointerup"&&b(this,mt,cf).call(this,"main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}else s?.toggleDrawing(!0),b(this,mt,cf).call(this,"main_toolbar")}},cf=function(t=""){a(this,Qe)===kt.HIGHLIGHT?this.highlightSelection(t):a(this,rp)&&b(this,mt,zC).call(this)},HC=function(){document.addEventListener("selectionchange",b(this,mt,jC).bind(this),{signal:this._signal})},GC=function(){if(a(this,Ka))return;p(this,Ka,new AbortController);let t=this.combinedSignal(a(this,Ka));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},$C=function(){a(this,Ka)?.abort(),p(this,Ka,null)},db=function(){if(a(this,Qa))return;p(this,Qa,new AbortController);let t=this.combinedSignal(a(this,Qa));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},VC=function(){a(this,Qa)?.abort(),p(this,Qa,null)},qC=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})},WC=function(){a(this,qa)?.abort(),p(this,qa,null)},XC=function(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},$i=function(t){Object.entries(t).some(([i,n])=>a(this,up)[i]!==n)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(a(this,up),t)}),a(this,Qe)===kt.HIGHLIGHT&&t.hasSelectedEditor===!1&&b(this,mt,zs).call(this,[[Ht.HIGHLIGHT_FREE,!0]]))},zs=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},YC=async function(){if(!a(this,Vs)){p(this,Vs,!0);let t=[];for(let e of a(this,De).values())t.push(e.enable());await Promise.all(t);for(let e of a(this,Pe).values())e.enable()}},KC=function(){if(this.unselectAll(),a(this,Vs)){p(this,Vs,!1);for(let t of a(this,De).values())t.disable();for(let t of a(this,Pe).values())t.disable()}},fb=function(t){let e=a(this,De).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},ZC=function(){let t=null;for(t of a(this,ae));return t},uf=function(){if(a(this,Pe).size===0)return!0;if(a(this,Pe).size===1)for(let t of a(this,Pe).values())return t.isEmpty();return!1},pb=function(t){for(let e of a(this,ae))e.unselect();a(this,ae).clear();for(let e of t)e.isEmpty()||(a(this,ae).add(e),e.select());b(this,mt,$i).call(this,{hasSelectedEditor:this.hasSelection})},z(Pu,"TRANSLATE_SMALL",1),z(Pu,"TRANSLATE_BIG",10);Lo=Pu,Vi=class Vi{constructor(t){x(this,Or);x(this,hi,null);x(this,rs,!1);x(this,Ar,null);x(this,Qu,null);x(this,ss,null);x(this,An,null);x(this,Ju,!1);x(this,as,null);x(this,cn,null);x(this,Xs,null);x(this,yl,null);x(this,os,!1);p(this,cn,t),p(this,os,t._uiManager.useNewAltTextFlow),a(Vi,no)||p(Vi,no,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){Vi._l10n??(Vi._l10n=t)}async render(){let t=p(this,Ar,document.createElement("button"));t.className="altText",t.tabIndex="0";let e=p(this,Qu,document.createElement("span"));t.append(e),a(this,os)?(t.classList.add("new"),t.setAttribute("data-l10n-id",a(Vi,no).missing),e.setAttribute("data-l10n-id",a(Vi,no)["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,cn)._uiManager._signal;t.addEventListener("contextmenu",Hn,{signal:i}),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:i});let n=s=>{s.preventDefault(),a(this,cn)._uiManager.editAltText(a(this,cn)),a(this,os)&&a(this,cn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:a(this,Or,hf)}})};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(p(this,Ju,!0),n(s))},{signal:i}),await b(this,Or,Yg).call(this),t}finish(){a(this,Ar)&&(a(this,Ar).focus({focusVisible:a(this,Ju)}),p(this,Ju,!1))}isEmpty(){return a(this,os)?a(this,hi)===null:!a(this,hi)&&!a(this,rs)}hasData(){return a(this,os)?a(this,hi)!==null||!!a(this,Xs):this.isEmpty()}get guessedText(){return a(this,Xs)}async setGuessedText(t){a(this,hi)===null&&(p(this,Xs,t),p(this,yl,await Vi._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),b(this,Or,Yg).call(this))}toggleAltTextBadge(t=!1){if(!a(this,os)||a(this,hi)){a(this,as)?.remove(),p(this,as,null);return}if(!a(this,as)){let e=p(this,as,document.createElement("div"));e.className="noAltTextBadge",a(this,cn).div.append(e)}a(this,as).classList.toggle("hidden",!t)}serialize(t){let e=a(this,hi);return!t&&a(this,Xs)===e&&(e=a(this,yl)),{altText:e,decorative:a(this,rs),guessedText:a(this,Xs),textWithDisclaimer:a(this,yl)}}get data(){return{altText:a(this,hi),decorative:a(this,rs)}}set data({altText:t,decorative:e,guessedText:i,textWithDisclaimer:n,cancel:s=!1}){i&&(p(this,Xs,i),p(this,yl,n)),!(a(this,hi)===t&&a(this,rs)===e)&&(s||(p(this,hi,t),p(this,rs,e)),b(this,Or,Yg).call(this))}toggle(t=!1){a(this,Ar)&&(!t&&a(this,An)&&(clearTimeout(a(this,An)),p(this,An,null)),a(this,Ar).disabled=!t)}shown(){a(this,cn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:a(this,Or,hf)}})}destroy(){a(this,Ar)?.remove(),p(this,Ar,null),p(this,Qu,null),p(this,ss,null),a(this,as)?.remove(),p(this,as,null)}};hi=new WeakMap,rs=new WeakMap,Ar=new WeakMap,Qu=new WeakMap,ss=new WeakMap,An=new WeakMap,Ju=new WeakMap,as=new WeakMap,cn=new WeakMap,Xs=new WeakMap,yl=new WeakMap,os=new WeakMap,no=new WeakMap,Or=new WeakSet,hf=function(){return a(this,hi)&&"added"||a(this,hi)===null&&this.guessedText&&"review"||"missing"},Yg=async function(){let t=a(this,Ar);if(!t)return;if(a(this,os)){if(t.classList.toggle("done",!!a(this,hi)),t.setAttribute("data-l10n-id",a(Vi,no)[a(this,Or,hf)]),a(this,Qu)?.setAttribute("data-l10n-id",a(Vi,no)[`${a(this,Or,hf)}-label`]),!a(this,hi)){a(this,ss)?.remove();return}}else{if(!a(this,hi)&&!a(this,rs)){t.classList.remove("done"),a(this,ss)?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=a(this,ss);if(!e){p(this,ss,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${a(this,cn).id}`;let n=100,s=a(this,cn)._uiManager._signal;s.addEventListener("abort",()=>{clearTimeout(a(this,An)),p(this,An,null)},{once:!0}),t.addEventListener("mouseenter",()=>{p(this,An,setTimeout(()=>{p(this,An,null),a(this,ss).classList.add("show"),a(this,cn)._reportTelemetry({action:"alt_text_tooltip"})},n))},{signal:s}),t.addEventListener("mouseleave",()=>{a(this,An)&&(clearTimeout(a(this,An)),p(this,An,null)),a(this,ss)?.classList.remove("show")},{signal:s})}a(this,rs)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=a(this,hi)),e.parentNode||t.append(e),a(this,cn).getElementForAltText()?.setAttribute("aria-describedby",e.id)},x(Vi,no,null),z(Vi,"_l10n",null);R0=Vi,Mu=class{constructor(t){x(this,pp);x(this,Ei,null);x(this,rr,null);x(this,bl,!1);x(this,ye,null);x(this,fp,null);x(this,ro,null);x(this,sr,null);x(this,so,null);x(this,ao,!1);x(this,wl,null);p(this,ye,t)}renderForToolbar(){let t=p(this,rr,document.createElement("button"));return t.className="comment",b(this,pp,mb).call(this,t,!1)}renderForStandalone(){let t=p(this,Ei,document.createElement("button"));t.className="annotationCommentButton";let e=a(this,ye).commentButtonPosition;if(e){let{style:i}=t;i.insetInlineEnd=`calc(${100*(a(this,ye)._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,ye).commentButtonColor;n&&(i.backgroundColor=n)}return b(this,pp,mb).call(this,t,!0)}focusButton(){setTimeout(()=>{(a(this,Ei)??a(this,rr))?.focus()},0)}onUpdatedColor(){if(!a(this,Ei))return;let t=a(this,ye).commentButtonColor;t&&(a(this,Ei).style.backgroundColor=t),a(this,ye)._uiManager.updatePopupColor(a(this,ye))}get commentButtonWidth(){return(a(this,Ei)?.getBoundingClientRect().width??0)/a(this,ye).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(a(this,wl))return a(this,wl);if(!a(this,Ei))return null;let{x:t,y:e,height:i}=a(this,Ei).getBoundingClientRect(),{x:n,y:s,width:o,height:l}=a(this,ye).parent.boundingClientRect;return[(t-n)/o,(e+i-s)/l]}set commentPopupPositionInLayer(t){p(this,wl,t)}hasDefaultPopupPosition(){return a(this,wl)===null}removeStandaloneCommentButton(){a(this,Ei)?.remove(),p(this,Ei,null)}removeToolbarCommentButton(){a(this,rr)?.remove(),p(this,rr,null)}setCommentButtonStates({selected:t,hasPopup:e}){a(this,Ei)&&(a(this,Ei).classList.toggle("selected",t),a(this,Ei).ariaExpanded=e)}edit(t){let e=this.commentPopupPositionInLayer,i,n;if(e)[i,n]=e;else{[i,n]=a(this,ye).commentButtonPosition;let{width:h,height:d,x:f,y:m}=a(this,ye);i=f+i*h,n=m+n*d}let s=a(this,ye).parent.boundingClientRect,{x:o,y:l,width:c,height:u}=s;a(this,ye)._uiManager.editComment(a(this,ye),o+i*c,l+n*u,{...t,parentDimensions:s})}finish(){a(this,rr)&&(a(this,rr).focus({focusVisible:a(this,bl)}),p(this,bl,!1))}isDeleted(){return a(this,ao)||a(this,sr)===""}isEmpty(){return a(this,sr)===null}hasBeenEdited(){return this.isDeleted()||a(this,sr)!==a(this,fp)}serialize(){return this.data}get data(){return{text:a(this,sr),richText:a(this,ro),date:a(this,so),deleted:this.isDeleted()}}set data(t){if(t!==a(this,sr)&&p(this,ro,null),t===null){p(this,sr,""),p(this,ao,!0);return}p(this,sr,t),p(this,so,new Date),p(this,ao,!1)}restoreData({text:t,richText:e,date:i}){p(this,sr,t),p(this,ro,e),p(this,so,i),p(this,ao,!1)}setInitialText(t,e=null){p(this,fp,t),this.data=t,p(this,so,null),p(this,ro,e)}shown(){}destroy(){a(this,rr)?.remove(),p(this,rr,null),a(this,Ei)?.remove(),p(this,Ei,null),p(this,sr,""),p(this,ro,null),p(this,so,null),p(this,ye,null),p(this,bl,!1),p(this,ao,!1)}};Ei=new WeakMap,rr=new WeakMap,bl=new WeakMap,ye=new WeakMap,fp=new WeakMap,ro=new WeakMap,sr=new WeakMap,so=new WeakMap,ao=new WeakMap,wl=new WeakMap,pp=new WeakSet,mb=function(t,e){if(!a(this,ye)._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,ye)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let i=a(this,ye)._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",Hn,{signal:i}),e&&(t.addEventListener("focusin",s=>{a(this,ye)._focusEventsAllowed=!1,ke(s)},{capture:!0,signal:i}),t.addEventListener("focusout",s=>{a(this,ye)._focusEventsAllowed=!0,ke(s)},{capture:!0,signal:i})),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:i});let n=s=>{s.preventDefault(),t===a(this,rr)?this.edit():a(this,ye).toggleComment(!0)};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(p(this,bl,!0),n(s))},{signal:i}),t.addEventListener("pointerenter",()=>{a(this,ye).toggleComment(!1,!0)},{signal:i}),t.addEventListener("pointerleave",()=>{a(this,ye).toggleComment(!1,!1)},{signal:i}),t};Rw=class Rw{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:n=null,onPinching:s=null,onPinchEnd:o=null,signal:l}){x(this,Bo);x(this,th);x(this,Al,!1);x(this,mp,null);x(this,gp);x(this,xp);x(this,yp);x(this,bp);x(this,Ys,null);x(this,vl);x(this,Ks,null);x(this,El);x(this,Zs,null);p(this,th,t),p(this,mp,i),p(this,gp,e),p(this,xp,n),p(this,yp,s),p(this,bp,o),p(this,El,new AbortController),p(this,vl,AbortSignal.any([l,a(this,El).signal])),t.addEventListener("touchstart",b(this,Bo,QC).bind(this),{passive:!1,signal:a(this,vl)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Es.pixelRatio}destroy(){a(this,El)?.abort(),p(this,El,null),a(this,Ys)?.abort(),p(this,Ys,null)}};th=new WeakMap,Al=new WeakMap,mp=new WeakMap,gp=new WeakMap,xp=new WeakMap,yp=new WeakMap,bp=new WeakMap,Ys=new WeakMap,vl=new WeakMap,Ks=new WeakMap,El=new WeakMap,Zs=new WeakMap,Bo=new WeakSet,QC=function(t){var n,s,o;if((n=a(this,gp))!=null&&n.call(this))return;if(t.touches.length===1){if(a(this,Ys))return;let l=p(this,Ys,new AbortController),c=AbortSignal.any([a(this,vl),l.signal]),u=a(this,th),h={capture:!0,signal:c,passive:!1},d=f=>{f.pointerType==="touch"&&(a(this,Ys)?.abort(),p(this,Ys,null))};u.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(ke(f),d(f))},h),u.addEventListener("pointerup",d,h),u.addEventListener("pointercancel",d,h);return}if(!a(this,Zs)){p(this,Zs,new AbortController);let l=AbortSignal.any([a(this,vl),a(this,Zs).signal]),c=a(this,th),u={signal:l,capture:!1,passive:!1};c.addEventListener("touchmove",b(this,Bo,JC).bind(this),u);let h=b(this,Bo,tT).bind(this);c.addEventListener("touchend",h,u),c.addEventListener("touchcancel",h,u),u.capture=!0,c.addEventListener("pointerdown",ke,u),c.addEventListener("pointermove",ke,u),c.addEventListener("pointercancel",ke,u),c.addEventListener("pointerup",ke,u),(s=a(this,xp))==null||s.call(this)}if(ke(t),t.touches.length!==2||(o=a(this,mp))!=null&&o.call(this)){p(this,Ks,null);return}let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]),p(this,Ks,{touch0X:e.screenX,touch0Y:e.screenY,touch1X:i.screenX,touch1Y:i.screenY})},JC=function(t){var k;if(!a(this,Ks)||t.touches.length!==2)return;ke(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,Ks),{touch0X:u,touch0Y:h,touch1X:d,touch1Y:f}=c,m=d-u,y=f-h,g=o-n,A=l-s,w=Math.hypot(g,A)||1,v=Math.hypot(m,y)||1;if(!a(this,Al)&&Math.abs(v-w)<=Rw.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=n,c.touch0Y=s,c.touch1X=o,c.touch1Y=l,!a(this,Al)){p(this,Al,!0);return}let T=[(n+o)/2,(s+l)/2];(k=a(this,yp))==null||k.call(this,T,v,w)},tT=function(t){var e;t.touches.length>=2||(a(this,Zs)&&(a(this,Zs).abort(),p(this,Zs,null),(e=a(this,bp))==null||e.call(this)),a(this,Ks)&&(ke(t),p(this,Ks,null),p(this,Al,!1)))};zf=Rw,Nt=class Nt{constructor(t){x(this,St);x(this,Cl,null);x(this,vr,null);x(this,ve,null);x(this,oe,null);x(this,Qs,null);x(this,eh,!1);x(this,oo,null);x(this,wp,"");x(this,Ci,null);x(this,Tl,null);x(this,Js,null);x(this,ar,null);x(this,lo,null);x(this,Ap,"");x(this,Sl,!1);x(this,vn,null);x(this,vp,!1);x(this,Dl,!1);x(this,ta,!1);x(this,ls,null);x(this,ih,0);x(this,nh,0);x(this,or,null);x(this,Il,null);z(this,"isSelected",!1);z(this,"_isCopy",!1);z(this,"_editToolbar",null);z(this,"_initialOptions",Object.create(null));z(this,"_initialData",null);z(this,"_isVisible",!0);z(this,"_uiManager",null);z(this,"_focusEventsAllowed",!0);x(this,Ep,!1);x(this,px,Nt._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=Nt.prototype._resizeWithKeyboard,e=Lo.TRANSLATE_SMALL,i=Lo.TRANSLATE_BIG;return _t(this,"_resizerKeyboardManager",new Fc([[["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"],Nt.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 _t(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new Eb({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(Nt._l10n??(Nt._l10n=t),Nt._l10nResizer||(Nt._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"})),Nt._borderLineWidth!==-1)return;let i=getComputedStyle(document.documentElement);Nt._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){ie("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return a(this,Ep)}set _isDraggable(t){p(this,Ep,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,px)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(b(this,St,df).call(this),a(this,ar)?.remove(),p(this,ar,null)),this.parent=t}focusin(t){this._focusEventsAllowed&&(a(this,Sl)?p(this,Sl,!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,St,gb).call(this,this.parentDimensions,t,e)}translateInPage(t,e){a(this,vn)||p(this,vn,[this.x,this.y,this.width,this.height]),b(this,St,gb).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){a(this,vn)||p(this,vn,[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,vn)&&(a(this,vn)[0]!==this.x||a(this,vn)[1]!==this.y)}get _hasBeenResized(){return!!a(this,vn)&&(a(this,vn)[2]!==this.width||a(this,vn)[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=Nt,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=ai(s,0,i-l),o=ai(o,0,n-c);break;case 90:s=ai(s,0,i-c),o=ai(o,l,n);break;case 180:s=ai(s,l,i),o=ai(o,c,n);break;case 270:s=ai(s,c,i),o=ai(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=Nt,Cp,xb).call(i,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var i;return b(i=Nt,Cp,xb).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,ve)?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||a(this,Dl))return this._editToolbar;this._editToolbar=new rb(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,ve)?.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,ve)||(R0.initialize(Nt._l10n),p(this,ve,new R0(this)),a(this,Cl)&&(a(this,ve).data=a(this,Cl),p(this,Cl,null))),a(this,ve)}get altTextData(){return a(this,ve)?.data}set altTextData(t){a(this,ve)&&(a(this,ve).data=t)}get guessedAltText(){return a(this,ve)?.guessedText}async setGuessedAltText(t){await a(this,ve)?.setGuessedText(t)}serializeAltText(t){return a(this,ve)?.serialize(t)}hasAltText(){return!!a(this,ve)&&!a(this,ve).isEmpty()}hasAltTextData(){return a(this,ve)?.hasData()??!1}focusCommentButton(){a(this,oe)?.focusButton()}addCommentButton(){return this.canAddComment?a(this,oe)||p(this,oe,new Mu(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(a(this,Qs)){this._uiManager.isEditingMode()&&a(this,Qs).classList.remove("hidden");return}this.hasComment&&(p(this,Qs,a(this,oe).renderForStandalone()),this.div.append(a(this,Qs)))}}removeStandaloneCommentButton(){a(this,oe).removeStandaloneCommentButton(),p(this,Qs,null)}hideStandaloneCommentButton(){a(this,Qs)?.classList.add("hidden")}get comment(){if(!a(this,oe))return null;let{data:{richText:t,text:e,date:i,deleted:n}}=a(this,oe);return{text:e,richText:t,date:i,deleted:n,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){a(this,oe)||p(this,oe,new Mu(this)),typeof t=="object"&&t!==null?a(this,oe).restoreData(t):a(this,oe).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,oe)||p(this,oe,new Mu(this)),a(this,oe).setInitialText(t,i),!this.annotationElementId))return;let n=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);n&&this.updateFromAnnotationLayer(n)}get hasEditedComment(){return a(this,oe)?.hasBeenEdited()}get hasDeletedComment(){return a(this,oe)?.isDeleted()}get hasComment(){return!!a(this,oe)&&!a(this,oe).isEmpty()&&!a(this,oe).isDeleted()}async editComment(t){a(this,oe)||p(this,oe,new Mu(this)),a(this,oe).edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){a(this,oe).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,oe).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,eh)?-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,St,Ab).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),LC(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(a(this,Il)||p(this,Il,new zf({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:b(this,St,nT).bind(this),onPinching:b(this,St,rT).bind(this),onPinchEnd:b(this,St,sT).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}pointerdown(t){let{isMac:e}=Be.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(p(this,Sl,!0),this._isDraggable){b(this,St,aT).call(this,t);return}b(this,St,wb).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){a(this,ls)&&clearTimeout(a(this,ls)),p(this,ls,setTimeout(()=>{p(this,ls,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,y=this.height*o;switch(i){case 0:return[d+u+l,o-f-h-y+c,d+u+m+l,o-f-h+c];case 90:return[d+h+l,o-f+u+c,d+h+y+l,o-f+u+m+c];case 180:return[d-u-m+l,o-f+h+c,d-u+l,o-f+h+y+c];case 270:return[d-h-y+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&&Nt._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){a(this,oe)?.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,Dl,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),p(this,Dl,!1),!0):!1}isInEditMode(){return a(this,Dl)}shouldGetKeyboardEvents(){return a(this,ta)}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 e0&&t0}rebuild(){b(this,St,Ab).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,Cl,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,lo)?.abort(),p(this,lo,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),a(this,ls)&&(clearTimeout(a(this,ls)),p(this,ls,null)),b(this,St,df).call(this),this.removeEditToolbar(),a(this,or)){for(let t of a(this,or).values())clearTimeout(t);p(this,or,null)}this.parent=null,a(this,Il)?.destroy(),p(this,Il,null),a(this,ar)?.remove(),p(this,ar,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,St,eT).call(this),a(this,Ci).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[Nt._round(i+(s-i)*t),Nt._round(n+(o-n)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return a(this,oe).commentPopupPositionInLayer}set commentPopupPosition(t){a(this,oe).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return a(this,oe).hasDefaultPopupPosition()}get commentButtonWidth(){return a(this,oe).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){a(this,oe)?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),p(this,Js,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let e=a(this,Ci).children;if(!a(this,vr)){p(this,vr,Array.from(e));let o=b(this,St,oT).bind(this),l=b(this,St,lT).bind(this),c=this._uiManager._signal;for(let u of a(this,vr)){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,St,cT).bind(this,h),{signal:c}),u.setAttribute("data-l10n-id",Nt._l10nResizer[h])}}let i=a(this,vr)[0],n=0;for(let o of e){if(o===i)break;n++}let s=(360-this.rotation+this.parentRotation)%360/90*(a(this,vr).length/4);if(s!==n){if(sn)for(let l=0;l{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),a(this,ve)?.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,Ci)?.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,ve)?.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,vp)}set isEditing(t){p(this,vp,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,or)||p(this,or,new Map);let{action:i}=t,n=a(this,or).get(i);n&&clearTimeout(n),n=setTimeout(()=>{this._reportTelemetry(t),a(this,or).delete(i),a(this,or).size===0&&p(this,or,null)},Nt._telemetryTimeout),a(this,or).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,eh,!1)}disable(){this.div&&(this.div.tabIndex=-1),p(this,eh,!0)}updateFakeAnnotationElement(t){if(!a(this,ar)&&!this.deleted){p(this,ar,t.addFakeAnnotation(this));return}if(this.deleted){a(this,ar).remove(),p(this,ar,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&a(this,ar).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()}};Cl=new WeakMap,vr=new WeakMap,ve=new WeakMap,oe=new WeakMap,Qs=new WeakMap,eh=new WeakMap,oo=new WeakMap,wp=new WeakMap,Ci=new WeakMap,Tl=new WeakMap,Js=new WeakMap,ar=new WeakMap,lo=new WeakMap,Ap=new WeakMap,Sl=new WeakMap,vn=new WeakMap,vp=new WeakMap,Dl=new WeakMap,ta=new WeakMap,ls=new WeakMap,ih=new WeakMap,nh=new WeakMap,or=new WeakMap,Il=new WeakMap,Ep=new WeakMap,px=new WeakMap,St=new WeakSet,gb=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()},Cp=new WeakSet,xb=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]}},Kg=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]}},eT=function(){if(a(this,Ci))return;p(this,Ci,document.createElement("div")),a(this,Ci).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,Ci).append(n),n.classList.add("resizer",i),n.setAttribute("data-resizer-name",i),n.addEventListener("pointerdown",b(this,St,iT).bind(this,i),{signal:e}),n.addEventListener("contextmenu",Hn,{signal:e}),n.tabIndex=-1}this.div.prepend(a(this,Ci))},iT=function(t,e){e.preventDefault();let{isMac:i}=Be.platform;if(e.button!==0||e.ctrlKey&&i)return;a(this,ve)?.toggle(!1);let n=this._isDraggable;this._isDraggable=!1,p(this,Tl,[e.screenX,e.screenY]);let s=new AbortController,o=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,St,bb).bind(this,t),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",ke,{passive:!1,signal:o}),window.addEventListener("contextmenu",Hn,{signal:o}),p(this,Js,{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,ve)?.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=l,this.div.style.cursor=c,b(this,St,Zg).call(this)};window.addEventListener("pointerup",u,{signal:o}),window.addEventListener("blur",u,{signal:o})},yb=function(t,e,i,n){this.width=i,this.height=n,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()},Zg=function(){if(!a(this,Js))return;let{savedX:t,savedY:e,savedWidth:i,savedHeight:n}=a(this,Js);p(this,Js,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,St,yb).bind(this,s,o,l,c),undo:b(this,St,yb).bind(this,t,e,i,n),mustExec:!0})},bb=function(t,e){let[i,n]=this.parentDimensions,s=this.x,o=this.y,l=this.width,c=this.height,u=Nt.MIN_SIZE/i,h=Nt.MIN_SIZE/n,d=b(this,St,Kg).call(this,this.rotation),f=(O,C)=>[d[0]*O+d[2]*C,d[1]*O+d[3]*C],m=b(this,St,Kg).call(this,360-this.rotation),y=(O,C)=>[m[0]*O+m[2]*C,m[1]*O+m[3]*C],g,A,w=!1,v=!1;switch(t){case"topLeft":w=!0,g=(O,C)=>[0,0],A=(O,C)=>[O,C];break;case"topMiddle":g=(O,C)=>[O/2,0],A=(O,C)=>[O/2,C];break;case"topRight":w=!0,g=(O,C)=>[O,0],A=(O,C)=>[0,C];break;case"middleRight":v=!0,g=(O,C)=>[O,C/2],A=(O,C)=>[0,C/2];break;case"bottomRight":w=!0,g=(O,C)=>[O,C],A=(O,C)=>[0,0];break;case"bottomMiddle":g=(O,C)=>[O/2,C],A=(O,C)=>[O/2,0];break;case"bottomLeft":w=!0,g=(O,C)=>[0,C],A=(O,C)=>[O,0];break;case"middleLeft":v=!0,g=(O,C)=>[0,C/2],A=(O,C)=>[O,C/2];break}let T=g(l,c),k=A(l,c),N=f(...k),F=Nt._round(s+N[0]),L=Nt._round(o+N[1]),Y=1,q=1,G,j;if(e.fromKeyboard)({deltaX:G,deltaY:j}=e);else{let{screenX:O,screenY:C}=e,[D,E]=a(this,Tl);[G,j]=this.screenToPageTranslation(O-D,C-E),a(this,Tl)[0]=O,a(this,Tl)[1]=C}if([G,j]=y(G/i,j/n),w){let O=Math.hypot(l,c);Y=q=Math.max(Math.min(Math.hypot(k[0]-T[0]-G,k[1]-T[1]-j)/O,1/l,1/c),u/l,h/c)}else v?Y=ai(Math.abs(k[0]-T[0]-G),u,1)/l:q=ai(Math.abs(k[1]-T[1]-j),h,1)/c;let tt=Nt._round(l*Y),et=Nt._round(c*q);N=f(...A(tt,et));let _=F-N[0],X=L-N[1];a(this,vn)||p(this,vn,[this.x,this.y,this.width,this.height]),this.width=tt,this.height=et,this.x=_,this.y=X,this.setDims(),this.fixAndSetPosition(),this._onResizing()},nT=function(){p(this,Js,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),a(this,ve)?.toggle(!1),this.parent.togglePointerEvents(!1)},rT=function(t,e,i){let s=.7*(i/e)+1-.7;if(s===1)return;let o=b(this,St,Kg).call(this,this.rotation),l=(F,L)=>[o[0]*F+o[2]*L,o[1]*F+o[3]*L],[c,u]=this.parentDimensions,h=this.x,d=this.y,f=this.width,m=this.height,y=Nt.MIN_SIZE/c,g=Nt.MIN_SIZE/u;s=Math.max(Math.min(s,1/f,1/m),y/f,g/m);let A=Nt._round(f*s),w=Nt._round(m*s);if(A===f&&w===m)return;a(this,vn)||p(this,vn,[h,d,f,m]);let v=l(f/2,m/2),T=Nt._round(h+v[0]),k=Nt._round(d+v[1]),N=l(A/2,w/2);this.x=T-N[0],this.y=k-N[1],this.width=A,this.height=w,this.setDims(),this.fixAndSetPosition(),this._onResizing()},sT=function(){a(this,ve)?.toggle(!0),this.parent.togglePointerEvents(!0),b(this,St,Zg).call(this)},wb=function(t){let{isMac:e}=Be.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},aT=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,oo,null),p(this,Sl,!1),this._uiManager.endDragSession()||b(this,St,wb).call(this,u),i&&this._onStopDragging()};e&&(p(this,ih,t.clientX),p(this,nh,t.clientY),p(this,oo,t.pointerId),p(this,wp,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,oo)){ke(u);return}let[m,y]=this.screenToPageTranslation(h-a(this,ih),d-a(this,nh));p(this,ih,h),p(this,nh,d),this._uiManager.dragSelectedEditors(m,y)},o),window.addEventListener("touchmove",ke,o),window.addEventListener("pointerdown",u=>{u.pointerType===a(this,wp)&&(a(this,Il)||u.isPrimary)&&l(u),ke(u)},o));let c=u=>{if(!a(this,oo)||a(this,oo)===u.pointerId){l(u);return}ke(u)};window.addEventListener("pointerup",c,{signal:s}),window.addEventListener("blur",c,{signal:s})},Ab=function(){if(a(this,lo)||!this.div)return;p(this,lo,new AbortController);let t=this._uiManager.combinedSignal(a(this,lo));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},oT=function(t){Nt._resizerKeyboardManager.exec(this,t)},lT=function(t){a(this,ta)&&t.relatedTarget?.parentNode!==a(this,Ci)&&b(this,St,df).call(this)},cT=function(t){p(this,Ap,a(this,ta)?t:"")},vb=function(t){if(a(this,vr))for(let e of a(this,vr))e.tabIndex=t},df=function(){p(this,ta,!1),b(this,St,vb).call(this,-1),b(this,St,Zg).call(this)},x(Nt,Cp),z(Nt,"_l10n",null),z(Nt,"_l10nResizer",null),z(Nt,"_borderLineWidth",-1),z(Nt,"_colorManager",new ub),z(Nt,"_zIndex",1),z(Nt,"_telemetryTimeout",1e3);be=Nt,Eb=class extends be{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},rC=3285377520,Zn=4294901760,Qr=65535,L0=class{constructor(t){this.h1=t?t&4294967295:rC,this.h2=t?t&4294967295:rC}update(t){let e,i;if(typeof t=="string"){e=new Uint8Array(t.length*2),i=0;for(let g=0,A=t.length;g>>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&Qr,y=f&Qr;for(let g=0;g>>17,l=l*f&Zn|l*y&Qr,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=o[g],c=c*d&Zn|c*m&Qr,c=c<<15|c>>>17,c=c*f&Zn|c*y&Qr,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&Zn|l*m&Qr,l=l<<15|l>>>17,l=l*f&Zn|l*y&Qr,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&Zn|t*36045&Qr,e=e*4283543511&Zn|((e<<16|t>>>16)*2950163797&Zn)>>>16,t^=e>>>1,t=t*444984403&Zn|t*60499&Qr,e=e*3301882366&Zn|((e<<16|t>>>16)*3120437893&Zn)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}},jf=Object.freeze({map:null,hash:"",transfer:void 0}),Hf=class{constructor(){x(this,mx);x(this,kl,!1);x(this,_l,null);x(this,ea,null);x(this,Ti,new Map);z(this,"onSetModified",null);z(this,"onResetModified",null);z(this,"onAnnotationEditor",null)}getValue(t,e){let i=a(this,Ti).get(t);return i===void 0?e:Object.assign(e,i)}getRawValue(t){return a(this,Ti).get(t)}remove(t){let e=a(this,Ti).get(t);e!==void 0&&(e instanceof be&&a(this,ea).delete(e.annotationElementId),a(this,Ti).delete(t),a(this,Ti).size===0&&this.resetModified(),!a(this,Ti).values().some(i=>i instanceof be)&&this.onAnnotationEditor?.(null))}setValue(t,e){let i=a(this,Ti).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,Ti).set(t,e);n&&b(this,mx,uT).call(this),e instanceof be&&((a(this,ea)||p(this,ea,new Map)).set(e.annotationElementId,e),this.onAnnotationEditor?.(e.constructor._type))}has(t){return a(this,Ti).has(t)}get size(){return a(this,Ti).size}resetModified(){a(this,kl)&&(p(this,kl,!1),this.onResetModified?.())}get print(){return new B0(this)}get serializable(){if(a(this,Ti).size===0)return jf;let t=new Map,e=new L0,i=[],n=Object.create(null),s=!1;for(let[o,l]of a(this,Ti)){let c=l instanceof be?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}:jf}get editorStats(){let t=null,e=new Map,i=0,n=0;for(let s of a(this,Ti).values()){if(!(s instanceof be)){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,Rx);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,_l,null)}updateEditor(t,e){let i=a(this,ea)?.get(t);return i?(i.updateFromAnnotationLayer(e),!0):!1}getEditor(t){return a(this,ea)?.get(t)||null}get modifiedIds(){if(a(this,_l))return a(this,_l);let t=[];if(a(this,ea))for(let e of a(this,ea).values())e.serialize()&&t.push(e.annotationElementId);return p(this,_l,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return a(this,Ti).entries()}};kl=new WeakMap,_l=new WeakMap,ea=new WeakMap,Ti=new WeakMap,mx=new WeakSet,uT=function(){a(this,kl)||(p(this,kl,!0),this.onSetModified?.())};B0=class extends Hf{constructor(e){super();x(this,Tp,jf);let{serializable:i}=e;if(i===jf)return;let{map:n,hash:s,transfer:o}=i,l=structuredClone(n,o?{transfer:o}:null);p(this,Tp,{map:l,hash:s,transfer:[]})}get print(){ie("Should not call PrintAnnotationStorage.print")}get serializable(){return a(this,Tp)}get modifiedIds(){return _t(this,"modifiedIds",{ids:new Set,hash:""})}};Tp=new WeakMap;Au="__forcedDependency",{floor:sC,ceil:aC}=Math;Cb=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],Tb=class{constructor(t,e){x(this,rh);x(this,co);p(this,rh,t),p(this,co,e)}get length(){return a(this,rh).length}isEmpty(t){return a(this,rh)[t]===Cb}minX(t){return a(this,co)[t*4+0]/256}minY(t){return a(this,co)[t*4+1]/256}maxX(t){return(a(this,co)[t*4+2]+1)/256}maxY(t){return(a(this,co)[t*4+3]+1)/256}};rh=new WeakMap,co=new WeakMap;lC=(r,t)=>r?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),Sb=class{constructor(t,e){x(this,Sp);x(this,ia,[[1,0,0,1,0,0]]);x(this,ee,[-1/0,-1/0,1/0,1/0]);x(this,ue,new Float64Array([1/0,1/0,-1/0,-1/0]));z(this,"_pendingBBoxIdx",-1);x(this,Nl);x(this,Ml);x(this,Fl);x(this,Li);z(this,"_savesStack",[]);z(this,"_markedContentStack",[]);p(this,Nl,t.width),p(this,Ml,t.height),b(this,Sp,Db).call(this,e)}growOperationsCount(t){t>=a(this,Li).length&&b(this,Sp,Db).call(this,t,a(this,Li))}get clipBox(){return a(this,ee)}save(t){return p(this,ee,{__proto__:a(this,ee)}),this._savesStack.push(t),this}restore(t,e){let i=Object.getPrototypeOf(a(this,ee));if(i===null)return this;p(this,ee,i);let n=this._savesStack.pop();return n!==void 0&&(e?.(n,t),a(this,Li)[t]=a(this,Li)[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,Li)[t]=a(this,Li)[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,Li)[t]=a(this,Li)[i]),this}pushBaseTransform(t){return a(this,ia).push(ht.multiplyByDOMMatrix(a(this,ia).at(-1),t.getTransform())),this}popBaseTransform(){return a(this,ia).length>1&&a(this,ia).pop(),this}resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,a(this,ue)[0]=1/0,a(this,ue)[1]=1/0,a(this,ue)[2]=-1/0,a(this,ue)[3]=-1/0),this}recordClipBox(t,e,i,n,s,o){let l=ht.multiplyByDOMMatrix(a(this,ia).at(-1),e.getTransform()),c=[1/0,1/0,-1/0,-1/0];ht.axialAlignedBoundingBox([i,s,n,o],l,c);let u=ht.intersect(a(this,ee),c);return u?(a(this,ee)[0]=u[0],a(this,ee)[1]=u[1],a(this,ee)[2]=u[2],a(this,ee)[3]=u[3]):(a(this,ee)[0]=a(this,ee)[1]=1/0,a(this,ee)[2]=a(this,ee)[3]=-1/0),this}recordBBox(t,e,i,n,s,o){let l=a(this,ee);if(l[0]===1/0)return this;let c=ht.multiplyByDOMMatrix(a(this,ia).at(-1),e.getTransform());if(l[0]===-1/0)return ht.axialAlignedBoundingBox([i,s,n,o],c,a(this,ue)),this;let u=[1/0,1/0,-1/0,-1/0];return ht.axialAlignedBoundingBox([i,s,n,o],c,u),a(this,ue)[0]=Math.min(a(this,ue)[0],Math.max(u[0],l[0])),a(this,ue)[1]=Math.min(a(this,ue)[1],Math.max(u[1],l[1])),a(this,ue)[2]=Math.max(a(this,ue)[2],Math.min(u[2],l[2])),a(this,ue)[3]=Math.max(a(this,ue)[3],Math.min(u[3],l[3])),this}recordFullPageBBox(t){return a(this,ue)[0]=Math.max(0,a(this,ee)[0]),a(this,ue)[1]=Math.max(0,a(this,ee)[1]),a(this,ue)[2]=Math.min(a(this,Nl),a(this,ee)[2]),a(this,ue)[3]=Math.min(a(this,Ml),a(this,ee)[3]),this}recordOperation(t,e=!1,i){if(this._pendingBBoxIdx!==t)return this;let n=sC(a(this,ue)[0]*256/a(this,Nl)),s=sC(a(this,ue)[1]*256/a(this,Ml)),o=aC(a(this,ue)[2]*256/a(this,Nl)),l=aC(a(this,ue)[3]*256/a(this,Ml));if(oC(a(this,Fl),t,n,s,o,l),i)for(let c of i)for(let u of c)u!==t&&oC(a(this,Fl),u,n,s,o,l);return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,a(this,ee)[0]=Math.max(a(this,ee)[0],a(this,ue)[0]),a(this,ee)[1]=Math.max(a(this,ee)[1],a(this,ue)[1]),a(this,ee)[2]=Math.min(a(this,ee)[2],a(this,ue)[2]),a(this,ee)[3]=Math.min(a(this,ee)[3],a(this,ue)[3])),this}take(){return new Tb(a(this,Li),a(this,Fl))}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}};ia=new WeakMap,ee=new WeakMap,ue=new WeakMap,Nl=new WeakMap,Ml=new WeakMap,Fl=new WeakMap,Li=new WeakMap,Sp=new WeakSet,Db=function(t,e){let i=new ArrayBuffer(t*4);p(this,Fl,new Uint8ClampedArray(i)),p(this,Li,new Uint32Array(i)),e&&e.length>0?(a(this,Li).set(e),a(this,Li).fill(Cb,e.length)):a(this,Li).fill(Cb)};Ib=class{constructor(t,e=!1){x(this,un,{__proto__:null});x(this,hn,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Au]:[]});x(this,Pl,new Map);x(this,Er,new Set);x(this,sh,new Map);x(this,uo);x(this,ho);x(this,he);p(this,he,t),e&&(p(this,uo,new Map),p(this,ho,(i,n)=>{lC(a(this,uo),n).dependencies.add(i)}))}get clipBox(){return a(this,he).clipBox}growOperationsCount(t){a(this,he).growOperationsCount(t)}save(t){return p(this,un,{__proto__:a(this,un)}),p(this,hn,{__proto__:a(this,hn),transform:{__proto__:a(this,hn).transform},moveText:{__proto__:a(this,hn).moveText},sameLineText:{__proto__:a(this,hn).sameLineText},[Au]:{__proto__:a(this,hn)[Au]}}),a(this,he).save(t),this}restore(t){a(this,he).restore(t,a(this,ho));let e=Object.getPrototypeOf(a(this,un));return e===null?this:(p(this,un,e),p(this,hn,Object.getPrototypeOf(a(this,hn))),this)}recordOpenMarker(t){return a(this,he).recordOpenMarker(t,a(this,ho)),this}getOpenMarker(){return a(this,he).getOpenMarker()}recordCloseMarker(t){return a(this,he).recordCloseMarker(t,a(this,ho)),this}beginMarkedContent(t){return a(this,he).beginMarkedContent(t),this}endMarkedContent(t){return a(this,he).endMarkedContent(t,a(this,ho)),this}pushBaseTransform(t){return a(this,he).pushBaseTransform(t),this}popBaseTransform(){return a(this,he).popBaseTransform(),this}recordSimpleData(t,e){return a(this,un)[t]=e,this}recordIncrementalData(t,e){return a(this,hn)[t].push(e),this}resetIncrementalData(t,e){return a(this,hn)[t].length=0,this}recordNamedData(t,e){return a(this,Pl).set(t,e),this}recordSimpleDataFromNamed(t,e,i){a(this,un)[t]=a(this,Pl).get(e)??i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Au,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(let e of t)e in a(this,un)&&this.recordFutureForcedDependency(e,a(this,un)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let t of a(this,Er))this.recordFutureForcedDependency(Au,t);return this}resetBBox(t){return a(this,he).resetBBox(t),this}recordClipBox(t,e,i,n,s,o){return a(this,he).recordClipBox(t,e,i,n,s,o),this}recordBBox(t,e,i,n,s,o){return a(this,he).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,sh).get(i),u!==!1&&(h=[0,0,0,0],ht.axialAlignedBoundingBox(c,i.fontMatrix,h),(n!==1||s!==0||o!==0)&&ht.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,sh).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,he).recordFullPageBBox(t),this}getSimpleIndex(t){return a(this,un)[t]}recordDependencies(t,e){let i=a(this,Er),n=a(this,un),s=a(this,hn);for(let o of e)o in a(this,un)?i.add(n[o]):o in s&&s[o].forEach(i.add,i);return this}recordNamedDependency(t,e){return a(this,Pl).has(e)&&a(this,Er).add(a(this,Pl).get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Au]),a(this,uo)){let n=lC(a(this,uo),t),{dependencies:s}=n;a(this,Er).forEach(s.add,s),a(this,he)._savesStack.forEach(s.add,s),a(this,he)._markedContentStack.forEach(s.add,s),s.delete(t),n.isRenderingOperation=!0}let i=!e&&t===a(this,he)._pendingBBoxIdx;return a(this,he).recordOperation(t,e,[a(this,Er),a(this,he)._savesStack,a(this,he)._markedContentStack]),i&&a(this,Er).clear(),this}recordShowTextOperation(t,e=!1){let i=Array.from(a(this,Er));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,he)._pendingBBoxIdx;return a(this,he).bboxToClipBoxDropOperation(t),i&&a(this,Er).clear(),this}take(){return a(this,sh).clear(),a(this,he).take()}takeDebugMetadata(){return a(this,uo)}};un=new WeakMap,hn=new WeakMap,Pl=new WeakMap,Er=new WeakMap,sh=new WeakMap,uo=new WeakMap,ho=new WeakMap,he=new WeakMap;Lw=class Lw{constructor(t,e,i){x(this,de);x(this,Oe);x(this,Cr);x(this,ah,0);x(this,oh,0);if(t instanceof Lw&&a(t,Cr)===!!i)return t;p(this,de,t),p(this,Oe,e),p(this,Cr,!!i)}get clipBox(){return a(this,de).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(t){return Ye(this,oh)._++,a(this,de).save(a(this,Oe)),this}restore(t){return a(this,oh)>0&&(a(this,de).restore(a(this,Oe)),Ye(this,oh)._--),this}recordOpenMarker(t){return Ye(this,ah)._++,this}getOpenMarker(){return a(this,ah)>0?a(this,Oe):a(this,de).getOpenMarker()}recordCloseMarker(t){return Ye(this,ah)._--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return a(this,de).pushBaseTransform(t),this}popBaseTransform(){return a(this,de).popBaseTransform(),this}recordSimpleData(t,e){return a(this,de).recordSimpleData(t,a(this,Oe)),this}recordIncrementalData(t,e){return a(this,de).recordIncrementalData(t,a(this,Oe)),this}resetIncrementalData(t,e){return a(this,de).resetIncrementalData(t,a(this,Oe)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return a(this,de).recordSimpleDataFromNamed(t,e,a(this,Oe)),this}recordFutureForcedDependency(t,e){return a(this,de).recordFutureForcedDependency(t,a(this,Oe)),this}inheritSimpleDataAsFutureForcedDependencies(t){return a(this,de).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return a(this,de).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return a(this,Cr)||a(this,de).resetBBox(a(this,Oe)),this}recordClipBox(t,e,i,n,s,o){return a(this,Cr)||a(this,de).recordClipBox(a(this,Oe),e,i,n,s,o),this}recordBBox(t,e,i,n,s,o){return a(this,Cr)||a(this,de).recordBBox(a(this,Oe),e,i,n,s,o),this}recordCharacterBBox(t,e,i,n,s,o,l){return a(this,Cr)||a(this,de).recordCharacterBBox(a(this,Oe),e,i,n,s,o,l),this}recordFullPageBBox(t){return a(this,Cr)||a(this,de).recordFullPageBBox(a(this,Oe)),this}getSimpleIndex(t){return a(this,de).getSimpleIndex(t)}recordDependencies(t,e){return a(this,de).recordDependencies(a(this,Oe),e),this}recordNamedDependency(t,e){return a(this,de).recordNamedDependency(a(this,Oe),e),this}recordOperation(t){return a(this,de).recordOperation(a(this,Oe),!0),this}recordShowTextOperation(t){return a(this,de).recordShowTextOperation(a(this,Oe),!0),this}bboxToClipBoxDropOperation(t){return a(this,Cr)||a(this,de).bboxToClipBoxDropOperation(a(this,Oe),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};de=new WeakMap,Oe=new WeakMap,Cr=new WeakMap,ah=new WeakMap,oh=new WeakMap;U0=Lw,Qn={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"]},Pf=class Pf{constructor(t){x(this,Ol);x(this,Rl);x(this,Ll,4);x(this,Bl,0);x(this,Ul,new(a(Pf,Dp))(a(this,Ll)*6));p(this,Ol,t.width),p(this,Rl,t.height)}record(t,e,i,n){if(a(this,Bl)===a(this,Ll)){p(this,Ll,a(this,Ll)*2);let l=new(a(Pf,Dp))(a(this,Ll)*6);l.set(a(this,Ul)),p(this,Ul,l)}let s=ht.domMatrixToTransform(t.getTransform()),o;if(n[0]!==1/0){let l=[1/0,1/0,-1/0,-1/0];ht.axialAlignedBoundingBox([0,-i,e,0],s,l);let c=ht.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]),y=Math.abs(Math.sin(m)),g=Math.abs(Math.cos(m));if(y<1e-6||g<1e-6||Math.abs(y-g)<1e-6)o=[u,h,u,f,d,h];else{let A=d-u,w=f-h,v=y*y,T=g*g,k=g*y,N=T-v,F=(w*T-A*k)/N,L=(w*k-A*v)/N;o=[u+L,h,u,h+F,d,f-F]}}}o||(o=[0,-i,0,0,e,-i],ht.applyTransform(o,s,0),ht.applyTransform(o,s,2),ht.applyTransform(o,s,4)),o[0]/=a(this,Ol),o[1]/=a(this,Rl),o[2]/=a(this,Ol),o[3]/=a(this,Rl),o[4]/=a(this,Ol),o[5]/=a(this,Rl),a(this,Ul).set(o,a(this,Bl)*6),Ye(this,Bl)._++}take(){return a(this,Ul).subarray(0,a(this,Bl)*6)}};Ol=new WeakMap,Rl=new WeakMap,Ll=new WeakMap,Bl=new WeakMap,Ul=new WeakMap,Dp=new WeakMap,x(Pf,Dp,Be.isFloat16ArraySupported?Float16Array:Float32Array);kb=Pf,_b=class{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){x(this,lh,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,lh).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:i}){if(!(!t||a(this,lh).has(t.loadedName))){if(_e(!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,lh).add(n),i?.(t)}catch{Mt(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}ie("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 Mt(`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 _t(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return _t(this,"isSyncFontLoadingSupported",Bn||Be.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(_e(!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 _t(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function i(k,N){return k.charCodeAt(N)<<24|k.charCodeAt(N+1)<<16|k.charCodeAt(N+2)<<8|k.charCodeAt(N+3)&255}function n(k,N,F,L){let Y=k.substring(0,N),q=k.substring(N+F);return Y+L+q}let s,o,l=this._document.createElement("canvas");l.width=1,l.height=1;let c=l.getContext("2d"),u=0;function h(k,N){if(++u>30){Mt("Load test font never loaded."),N();return}if(c.font="30px "+k,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){N();return}setTimeout(h.bind(null,k,N))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=n(f,976,d.length,d);let y=16,g=1482184792,A=i(f,y);for(s=0,o=d.length-3;s{T.remove(),e.complete()})}};lh=new WeakMap;Nb=class{constructor(t,e=null,i,n){z(this,"compiledGlyphs",Object.create(null));x(this,fe);p(this,fe,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){Mt(`getPathGenerator - ignoring character: "${o}".`)}let s=NC(n?.path);return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=s}get black(){return a(this,fe).black}get bold(){return a(this,fe).bold}get disableFontFace(){return a(this,fe).disableFontFace}set disableFontFace(t){_t(this,"disableFontFace",!!t)}get fontExtraProperties(){return a(this,fe).fontExtraProperties}get isInvalidPDFjsFont(){return a(this,fe).isInvalidPDFjsFont}get isType3Font(){return a(this,fe).isType3Font}get italic(){return a(this,fe).italic}get missingFile(){return a(this,fe).missingFile}get remeasure(){return a(this,fe).remeasure}get vertical(){return a(this,fe).vertical}get ascent(){return a(this,fe).ascent}get defaultWidth(){return a(this,fe).defaultWidth}get descent(){return a(this,fe).descent}get bbox(){return a(this,fe).bbox}get fontMatrix(){return a(this,fe).fontMatrix}get fallbackName(){return a(this,fe).fallbackName}get loadedName(){return a(this,fe).loadedName}get mimetype(){return a(this,fe).mimetype}get name(){return a(this,fe).name}get data(){return a(this,fe).data}clearData(){a(this,fe).clearData()}get cssFontInfo(){return a(this,fe).cssFontInfo}get systemFontInfo(){return a(this,fe).systemFontInfo}get defaultVMetrics(){return a(this,fe).defaultVMetrics}};fe=new WeakMap;Qg=class{};z(Qg,"strings",["fontFamily","fontWeight","italicAngle"]);Jg=class{};z(Jg,"strings",["css","loadedName","baseFontName","src"]);Pi=class Pi{};z(Pi,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),z(Pi,"numbers",["ascent","defaultWidth","descent"]),z(Pi,"strings",["fallbackName","loadedName","mimetype","name"]),z(Pi,"OFFSET_NUMBERS",Math.ceil(Pi.bools.length*2/8)),z(Pi,"OFFSET_BBOX",Pi.OFFSET_NUMBERS+Pi.numbers.length*8),z(Pi,"OFFSET_FONT_MATRIX",Pi.OFFSET_BBOX+1+8),z(Pi,"OFFSET_DEFAULT_VMETRICS",Pi.OFFSET_FONT_MATRIX+1+48),z(Pi,"OFFSET_STRINGS",Pi.OFFSET_DEFAULT_VMETRICS+1+6);yn=Pi,yi=class{};z(yi,"KIND",0),z(yi,"HAS_BBOX",1),z(yi,"HAS_BACKGROUND",2),z(yi,"SHADING_TYPE",3),z(yi,"N_COORD",4),z(yi,"N_COLOR",8),z(yi,"N_STOP",12),z(yi,"N_FIGURES",16);Mb=class{constructor(t){x(this,uh);x(this,Ip);x(this,gx,new TextDecoder);x(this,ch);p(this,Ip,t),p(this,ch,new DataView(t))}get fontFamily(){return b(this,uh,t0).call(this,0)}get fontWeight(){return b(this,uh,t0).call(this,1)}get italicAngle(){return b(this,uh,t0).call(this,2)}};Ip=new WeakMap,gx=new WeakMap,ch=new WeakMap,uh=new WeakSet,t0=function(t){_e(t>i&3;return n===0?void 0:n===2},e0=function(t){return _e(t0){w=[1/0,1/0,-1/0,-1/0];for(let v=0,T=h.length;vtypeof r=="object"&&Number.isInteger(r?.num)&&r.num>=0&&Number.isInteger(r?.gen)&&r.gen>=0,sM=r=>typeof r=="object"&&typeof r?.name=="string",hT=tM.bind(null,Bb,sM),Ub=class{constructor(){x(this,na,new Map);x(this,yx,Promise.resolve())}postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};a(this,yx).then(()=>{for(let[n]of a(this,na))n.call(this,i)})}addEventListener(t,e,i=null){let n=null;if(i?.signal instanceof AbortSignal){let{signal:s}=i;if(s.aborted){Mt("LoopbackPort - cannot use an `aborted` signal.");return}let o=()=>this.removeEventListener(t,e);n=()=>s.removeEventListener("abort",o),s.addEventListener("abort",o)}a(this,na).set(e,n)}removeEventListener(t,e){a(this,na).get(e)?.(),a(this,na).delete(e)}terminate(){for(let[,t]of a(this,na))t?.();a(this,na).clear()}};na=new WeakMap,yx=new WeakMap;Bg={DATA:1,ERROR:2},Ze={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};hl=class{constructor(t,e,i){x(this,mr);x(this,fh,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,mr,dT).bind(this),{signal:a(this,fh).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:Ze.PULL,streamId:s,desiredSize:u.desiredSize}),h.promise},cancel:u=>{_e(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:Ze.CANCEL,streamId:s,reason:on(u)}),h.promise}},i)}destroy(){a(this,fh)?.abort(),p(this,fh,null)}};fh=new WeakMap,mr=new WeakSet,dT=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){b(this,mr,pT).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===Bg.DATA)n.resolve(t.data);else if(t.callback===Bg.ERROR)n.reject(on(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:Bg.DATA,callbackId:t.callbackId,data:o})},function(o){s.postMessage({sourceName:i,targetName:n,callback:Bg.ERROR,callbackId:t.callbackId,reason:on(o)})});return}if(t.streamId){b(this,mr,fT).call(this,t);return}e(t.data)},fT=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:Ze.ENQUEUE,streamId:e,chunk:u},d)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:Ze.CLOSE,streamId:e}),delete o.streamSinks[e])},error(u){_e(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:Ze.ERROR,streamId:e,reason:on(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:Ze.START_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:Ze.START_COMPLETE,streamId:e,reason:on(u)})})},pT=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 Ze.START_COMPLETE:t.success?o.startCall.resolve():o.startCall.reject(on(t.reason));break;case Ze.PULL_COMPLETE:t.success?o.pullCall.resolve():o.pullCall.reject(on(t.reason));break;case Ze.PULL:if(!l){s.postMessage({sourceName:i,targetName:n,stream:Ze.PULL_COMPLETE,streamId:e,success:!0});break}l.desiredSize<=0&&t.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=t.desiredSize,Promise.try(l.onPull||cC).then(function(){s.postMessage({sourceName:i,targetName:n,stream:Ze.PULL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:Ze.PULL_COMPLETE,streamId:e,reason:on(u)})});break;case Ze.ENQUEUE:if(_e(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(t.chunk);break;case Ze.CLOSE:if(_e(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),b(this,mr,n0).call(this,o,e);break;case Ze.ERROR:_e(o,"error should have stream controller"),o.controller.error(on(t.reason)),b(this,mr,n0).call(this,o,e);break;case Ze.CANCEL_COMPLETE:t.success?o.cancelCall.resolve():o.cancelCall.reject(on(t.reason)),b(this,mr,n0).call(this,o,e);break;case Ze.CANCEL:if(!l)break;let c=on(t.reason);Promise.try(l.onCancel||cC,c).then(function(){s.postMessage({sourceName:i,targetName:n,stream:Ze.CANCEL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:Ze.CANCEL_COMPLETE,streamId:e,reason:on(u)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},n0=async function(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]};z0=class{constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:i=null}){x(this,bx,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:ie(`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,bx)[t]} data at: ${n}`)})}async _fetch(t,e){ie("Abstract method `_fetch` called.")}};bx=new WeakMap;j0=class extends z0{async _fetch(t,e){let i=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",n=await Lx(t,i);return n instanceof Uint8Array?n:Px(n)}},H0=class{constructor({enableHWA:t=!1}){x(this,kp,!1);p(this,kp,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,kp)})}}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){ie("Abstract method `_createCanvas` called.")}};kp=new WeakMap;zb=class extends H0{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}},G0=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){}},jb=class extends G0{constructor({docId:e,ownerDocument:i=globalThis.document}){super();x(this,yt);x(this,Hl);x(this,ph);x(this,ra);x(this,sa);x(this,Bi);x(this,Gl);x(this,$l,0);p(this,sa,e),p(this,Bi,i)}addFilter(e){if(!e)return"none";let i=a(this,yt,Fi).get(e);if(i)return i;let[n,s,o]=b(this,yt,r0).call(this,e),l=e.length===1?n:`${n}${s}${o}`;if(i=a(this,yt,Fi).get(l),i)return a(this,yt,Fi).set(e,i),i;let c=`g_${a(this,sa)}_transfer_map_${Ye(this,$l)._++}`,u=b(this,yt,Tu).call(this,c);a(this,yt,Fi).set(e,u),a(this,yt,Fi).set(l,u);let h=b(this,yt,Su).call(this,c);return b(this,yt,xf).call(this,n,s,o,h),u}addHCMFilter(e,i){let n=`${e}-${i}`,s="base",o=a(this,yt,mf).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,yt,mf).set(s,o)),!e||!i))return o.url;let l=b(this,yt,yf).call(this,e);e=ht.makeHexColor(...l);let c=b(this,yt,yf).call(this,i);if(i=ht.makeHexColor(...c),a(this,yt,Cu).style.color="",e==="#000000"&&i==="#ffffff"||e===i)return o.url;let u=new Array(256);for(let y=0;y<=255;y++){let g=y/255;u[y]=g<=.03928?g/12.92:((g+.055)/1.055)**2.4}let h=u.join(","),d=`g_${a(this,sa)}_hcm_filter`,f=o.filter=b(this,yt,Su).call(this,d);b(this,yt,xf).call(this,h,h,h,f),b(this,yt,Hb).call(this,f);let m=(y,g)=>{let A=l[y]/255,w=c[y]/255,v=new Array(g+1);for(let T=0;T<=g;T++)v[T]=A+T/g*(w-A);return v.join(",")};return b(this,yt,xf).call(this,m(0,5),m(1,5),m(2,5),f),o.url=b(this,yt,Tu).call(this,d),o.url}addAlphaFilter(e){let i=a(this,yt,Fi).get(e);if(i)return i;let[n]=b(this,yt,r0).call(this,[e]),s=`alpha_${n}`;if(i=a(this,yt,Fi).get(s),i)return a(this,yt,Fi).set(e,i),i;let o=`g_${a(this,sa)}_alpha_map_${Ye(this,$l)._++}`,l=b(this,yt,Tu).call(this,o);a(this,yt,Fi).set(e,l),a(this,yt,Fi).set(s,l);let c=b(this,yt,Su).call(this,o);return b(this,yt,Gb).call(this,n,c),l}addLuminosityFilter(e){let i=a(this,yt,Fi).get(e||"luminosity");if(i)return i;let n,s;if(e?([n]=b(this,yt,r0).call(this,[e]),s=`luminosity_${n}`):s="luminosity",i=a(this,yt,Fi).get(s),i)return a(this,yt,Fi).set(e,i),i;let o=`g_${a(this,sa)}_luminosity_map_${Ye(this,$l)._++}`,l=b(this,yt,Tu).call(this,o);a(this,yt,Fi).set(e,l),a(this,yt,Fi).set(s,l);let c=b(this,yt,Su).call(this,o);return b(this,yt,mT).call(this,c),e&&b(this,yt,Gb).call(this,n,c),l}addHighlightHCMFilter(e,i,n,s,o){let l=`${i}-${n}-${s}-${o}`,c=a(this,yt,mf).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,yt,mf).set(e,c)),!i||!n))return c.url;let[u,h]=[i,n].map(b(this,yt,yf).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,y]=[s,o].map(b(this,yt,yf).bind(this));f{let N=new Array(256),F=(f-d)/k,L=v/255,Y=(T-v)/(255*k),q=0;for(let G=0;G<=k;G++){let j=Math.round(d+G*F),tt=L+G*Y;for(let et=q;et<=j;et++)N[et]=tt;q=j+1}for(let G=q;G<256;G++)N[G]=N[q-1];return N.join(",")},A=`g_${a(this,sa)}_hcm_${e}_filter`,w=c.filter=b(this,yt,Su).call(this,A);return b(this,yt,Hb).call(this,w),b(this,yt,xf).call(this,g(m[0],y[0],5),g(m[1],y[1],5),g(m[2],y[2],5),w),c.url=b(this,yt,Tu).call(this,A),c.url}destroy(e=!1){e&&a(this,Gl)?.size||(a(this,ra)?.parentNode.parentNode.remove(),p(this,ra,null),a(this,ph)?.clear(),p(this,ph,null),a(this,Gl)?.clear(),p(this,Gl,null),p(this,$l,0))}};Hl=new WeakMap,ph=new WeakMap,ra=new WeakMap,sa=new WeakMap,Bi=new WeakMap,Gl=new WeakMap,$l=new WeakMap,yt=new WeakSet,Fi=function(){return a(this,ph)||p(this,ph,new Map)},mf=function(){return a(this,Gl)||p(this,Gl,new Map)},Cu=function(){if(!a(this,ra)){let e=a(this,Bi).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,Bi).createElementNS(Us,"svg");n.setAttribute("width",0),n.setAttribute("height",0),p(this,ra,a(this,Bi).createElementNS(Us,"defs")),e.append(n),n.append(a(this,ra)),a(this,Bi).body.append(e)}return a(this,ra)},r0=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(",")]},Tu=function(e){if(a(this,Hl)===void 0){p(this,Hl,"");let i=a(this,Bi).URL;i!==a(this,Bi).baseURI&&(Gm(i)?Mt('#createUrl: ignore "data:"-URL for performance reasons.'):p(this,Hl,Nw(i,"")))}return`url(${a(this,Hl)}#${e})`},mT=function(e){let i=a(this,Bi).createElementNS(Us,"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)},Hb=function(e){let i=a(this,Bi).createElementNS(Us,"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)},Su=function(e){let i=a(this,Bi).createElementNS(Us,"filter");return i.setAttribute("color-interpolation-filters","sRGB"),i.setAttribute("id",e),a(this,yt,Cu).append(i),i},gf=function(e,i,n){let s=a(this,Bi).createElementNS(Us,i);s.setAttribute("type","discrete"),s.setAttribute("tableValues",n),e.append(s)},xf=function(e,i,n,s){let o=a(this,Bi).createElementNS(Us,"feComponentTransfer");s.append(o),b(this,yt,gf).call(this,o,"feFuncR",e),b(this,yt,gf).call(this,o,"feFuncG",i),b(this,yt,gf).call(this,o,"feFuncB",n)},Gb=function(e,i){let n=a(this,Bi).createElementNS(Us,"feComponentTransfer");i.append(n),b(this,yt,gf).call(this,n,"feFuncA",e)},yf=function(e){return a(this,yt,Cu).style.color=e,Ad(getComputedStyle(a(this,yt,Cu)).getPropertyValue("color"))};Bn&&Mt("Please use the `legacy` build in Node.js environments.");$b=class extends G0{},Vb=class extends H0{_createCanvas(t,e){return it.default.getBuiltinModule("module").createRequire("")("@napi-rs/canvas").createCanvas(t,e)}},qb=class extends z0{async _fetch(t,e){return aM(t)}},oM=` +`,{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"}});z(this,"detectImprecise",async t=>{this.buffer=new Uint8Array(wu);let e=P_(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=F_(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 e1(O_(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 $t||o instanceof mn)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(i1(e,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let e=n1(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([X1("node:fs/promises"),X1("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=K1(e?.sampleSize??wu),n,s=!1,o=t.getReader(),l=[],c=0;try{for(;c0){let d=l.length===1?l[0]:x1(l);try{n=await this.fromBuffer(d.subarray(0,i))}catch(f){if(!(f instanceof $t))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>=N_)return{ext:"gz",mime:"application/gzip"};let e=new ef(t),i=R_(e.inflate(),I_),n=Ge(t),s,o,l,c;if(n){let u=new AbortController;s=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${V1} ms`,"TimeoutError"))},V1),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 Kn(this.buffer,t,e)}checkString(t,e){return this.check(y1(t,e?.encoding),e)}async readTiffTag(t){let e=await this.tokenizer.readToken(t?Zo:Te);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?Zo:Te);if(!(e>__)&&!(Ge(this.tokenizer)&&2+e*12>W1))for(let i=0;i=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(n>=8){let l=(t?Zo:Te).get(this.buffer,8),c=(t?Zo:Te).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(Ge(this.tokenizer)&&n>M_)return e;let s=Ge(this.tokenizer)?W1:this.tokenizer.fileInfo.size;try{await gn(this.tokenizer,n,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof $t)return;throw l}let o;try{o=await this.readTiffIFD(t)}catch(l){if(l instanceof $t)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"}}}},H_=new Set(v1),G_=new Set(E1)});var OS={};qm(OS,{AbortException:()=>Lr,AnnotationEditorLayer:()=>ax,AnnotationEditorParamsType:()=>Gt,AnnotationEditorType:()=>_t,AnnotationEditorUIManager:()=>Lo,AnnotationLayer:()=>J0,AnnotationMode:()=>Ea,AnnotationType:()=>$e,CSSConstants:()=>O0,ColorPicker:()=>Vf,DOMSVGFactory:()=>Pc,DrawLayer:()=>ox,FeatureTest:()=>Be,GlobalWorkerOptions:()=>dr,ImageKind:()=>Nf,InvalidPDFException:()=>dd,MathClamp:()=>oi,OPS:()=>hd,OutputScale:()=>Es,PDFDataRangeTransport:()=>$f,PDFDateString:()=>_c,PDFWorker:()=>yd,PasswordResponses:()=>CC,PermissionFlag:()=>EC,PixelsPerInch:()=>Da,RenderingCancelledException:()=>fd,ResponseException:()=>Mc,SignatureExtractor:()=>fr,SupportedImageMimeTypes:()=>P0,TextLayer:()=>xd,TextLayerImages:()=>lx,TouchManager:()=>zf,Util:()=>ht,VerbosityLevel:()=>Hm,XfaLayer:()=>Bf,applyOpacity:()=>IC,build:()=>jT,createValidAbsoluteUrl:()=>Nw,fetchData:()=>Lx,findContrastColor:()=>NC,getDocument:()=>LT,getFilenameFromUrl:()=>SC,getPdfFilenameFromUrl:()=>DC,getRGB:()=>Ad,getUuid:()=>Mw,getXfaPageViewport:()=>kC,isDataScheme:()=>Gm,isPdfFile:()=>Bx,isValidExplicitDest:()=>hT,makeArr:()=>Ox,makeMap:()=>Rx,makeObj:()=>M0,noContextMenu:()=>Hn,normalizeUnicode:()=>TC,renderRichText:()=>Fw,setLayerDimensions:()=>Ro,shadow:()=>Mt,stopEvent:()=>Ie,updateUrlHash:()=>_w,version:()=>zT});function q_(r){Number.isInteger(r)&&(Mx=r)}function W_(){return Mx}function Fx(r){Mx>=Hm.INFOS&&console.info(`Info: ${r}`)}function Pt(r){Mx>=Hm.WARNINGS&&console.warn(`Warning: ${r}`)}function ie(r){throw new Error(r)}function Ne(r,t){r||ie(t)}function X_(r){switch(r?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Nw(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=J_(r)}catch{}let i=t?URL.parse(r,t):URL.parse(r);return X_(i)?i:null}function _w(r,t,e=!1){let i=URL.parse(r);return i?(i.hash=t,i.href):e&&Nw(r,"http://example.com")?r.split("#",1)[0]+`${t?`#${t}`:""}`:""}function Jy(r){return r.substring(r.lastIndexOf("/")+1)}function Mt(r,t,e,i=!1){return Object.defineProperty(r,t,{value:e,enumerable:!i,configurable:!0,writable:!1}),e}function Y_(r){(typeof r!="object"||r?.length===void 0)&&ie("Invalid argument for bytesToString");let t=r.length,e=8192;if(t>24&255,r>>16&255,r>>8&255,r&255)}function Z_(){let r=new Uint8Array(4);return r[0]=1,new Uint32Array(r.buffer,0,1)[0]===1}function Q_(){try{return new Function(""),!0}catch{return!1}}function J_(r){return decodeURIComponent(escape(r))}function TC(r){return Xy||(Xy=/([\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,J1=new Map([["\uFB05","\u017Ft"]])),r.replaceAll(Xy,(t,e,i)=>e?e.normalize("NFKC"):J1.get(i))}function Mw(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let r=new Uint8Array(32);return crypto.getRandomValues(r),Y_(r)}function tM(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 oi(r,t,e){return Math.min(Math.max(r,t),e)}async function Lx(r,t="text"){if(Mf(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 Gm(r){let t=r.length,e=0;for(;e{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=Jy(c),/^\.pdf$/i.test(c))?l:c}catch{return l}},s=/\.pdf$/i,o=Jy(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 Mf(r,t){let e=t?URL.parse(r,t):URL.parse(r);return/https?:/.test(e?.protocol??"")}function Hn(r){r.preventDefault()}function Ie(r){r.preventDefault(),r.stopPropagation()}function eM(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 Uf({viewBox:s,userUnit:1,scale:t,rotation:e})}function Ad(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)):(Pt(`Not a valid color format: "${r}"`),[0,0,0])}function iM(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,Ad(i))}t.remove()}function ke(r){let{a:t,b:e,c:i,d:n,e:s,f:o}=r.getTransform();return[t,e,i,n,s,o]}function Zr(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 Ro(r,t,e=!1,i=!0){if(t instanceof Uf){let{pageWidth:n,pageHeight:s}=t.rawDims,{style:o}=r,l=Be.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 IC(r,t){t=oi(t??1,0,1);let e=255*(1-t);return r.map(i=>Math.round(i*t+e))}function tC(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+(in?(i+.05)/(n+.05):(n+.05)/(i+.05)}function NC(r,t){let e=r[0]+r[1]*256+r[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,i=nC.get(e);if(i)return i;let n=new Float32Array(9),s=n.subarray(0,3),o=n.subarray(3,6);tC(r,o);let l=n.subarray(6,9);tC(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]),iC(o,l,s)f;){let m=o[2]=(h+d)/2;c===iC(o,l,s)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,y=(c[e*2+1]+t.offsetY)*t.scaleY,g=(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(y>=v)return;let T=u[s*4],I=u[s*4+1],_=u[s*4+2],F=u[o*4],L=u[o*4+1],Y=u[o*4+2],q=u[l*4],G=u[l*4+1],j=u[l*4+2],J=Math.round(y),et=Math.round(v),N,X,O,C,D,E,S,k;for(let M=J;M<=et;M++){if(Mv?V=1:A===v?V=0:V=(A-M)/(A-v),N=g-(g-w)*V,X=F-(F-q)*V,O=L-(L-G)*V,C=Y-(Y-j)*V}let P;Mv?P=1:P=(y-M)/(y-v),D=m-(m-w)*P,E=T-(T-q)*P,S=I-(I-G)*P,k=_-(_-j)*P;let B=Math.round(Math.min(N,D)),$=Math.round(Math.max(N,D)),U=d*M+B*4;for(let V=B;V<=$;V++)P=(N-V)/(N-D),P<0?P=0:P>1&&(P=1),h[U++]=X-(X-E)*P|0,h[U++]=O-(O-S)*P|0,h[U++]=C-(C-k)*P|0,h[U++]=255}}function hM(r,t,e){let i=t.coords,n=t.colors,s,o;switch(t.type){case ul.LATTICE:let l=t.verticesPerRow,c=Math.floor(i.length/l)-1,u=l-1;for(s=0;s>3,d=i&7,f=c^u,m=r.length;e=new Uint32Array(e.buffer);let y=0;for(let g=0;g>7&1)&f,e[y+1]=c^-(v>>6&1)&f,e[y+2]=c^-(v>>5&1)&f,e[y+3]=c^-(v>>4&1)&f,e[y+4]=c^-(v>>3&1)&f,e[y+5]=c^-(v>>2&1)&f,e[y+6]=c^-(v>>1&1)&f,e[y+7]=c^-(v&1)&f}if(d===0)continue;let A=t>7-w&1)&f}return{srcPos:t,destPos:y}}function mM(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 Ug(r,t,e,i,n,s,o,l,c,u){let[h,d,f,m,y,g]=ke(r);if(d===0&&f===0){let v=o*h+y,T=Math.round(v),I=l*m+g,_=Math.round(I),F=(o+c)*h+y,L=Math.abs(Math.round(F)-T)||1,Y=(l+u)*m+g,q=Math.abs(Math.round(Y)-_)||1;return r.setTransform(Math.sign(h),0,0,Math.sign(m),T,_),r.drawImage(t,e,i,n,s,0,0,L,q),r.setTransform(h,d,f,m,y,g),[L,q]}if(h===0&&m===0){let v=l*f+y,T=Math.round(v),I=o*d+g,_=Math.round(I),F=(l+u)*f+y,L=Math.abs(Math.round(F)-T)||1,Y=(o+c)*d+g,q=Math.abs(Math.round(Y)-_)||1;return r.setTransform(0,Math.sign(d),Math.sign(f),0,T,_),r.drawImage(t,e,i,n,s,0,0,q,L),r.setTransform(h,d,f,m,y,g),[q,L]}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 pC(r,t){if(t instanceof ImageData){r.putImageData(t,0,0);return}let e=t.height,i=t.width,n=e%pn,s=(e-n)/pn,o=n===0?s:s+1,l=r.createImageData(i,pn),c=0,u,h=t.data,d=l.data,f,m,y,g;if(t.kind===Nf.GRAYSCALE_1BPP){let A=h.byteLength,w=new Uint32Array(d.buffer,0,d.byteLength>>2),v=w.length,T=i+7>>3,I=4294967295,_=Be.isLittleEndian?4278190080:255;for(f=0;fT?i:F*8-7,q=Y&-8,G=0,j=0;for(;L>=1}for(;u=s&&(y=n,g=i*y),u=0,m=g;m--;)d[u++]=h[c++],d[u++]=h[c++],d[u++]=h[c++],d[u++]=255;r.putImageData(l,0,f*pn)}else throw new Error(`bad image kind: ${t.kind}`)}function mC(r,t){if(t.bitmap){r.drawImage(t.bitmap,0,0);return}let e=t.height,i=t.width,n=e%pn,s=(e-n)/pn,o=n===0?s:s+1,l=r.createImageData(i,pn),c=0,u=t.data,h=l.data;for(let d=0;d0?r.rangeChunkSize:2**16,h=r.worker instanceof yd?r.worker:null,d=r.verbosity,f=typeof r.docBaseUrl=="string"&&!Gm(r.docBaseUrl)?r.docBaseUrl:null,m=Lg(r.cMapUrl),y=r.cMapPacked!==!1,g=Lg(r.iccUrl),A=Lg(r.standardFontDataUrl),w=Lg(r.wasmUrl),v=r.stopAtErrors!==!0,T=Number.isInteger(r.maxImageSize)&&r.maxImageSize>-1?r.maxImageSize:-1,I=r.isEvalSupported!==!1,_=typeof r.isOffscreenCanvasSupported=="boolean"?r.isOffscreenCanvasSupported:!Bn,F=typeof r.isImageDecoderSupported=="boolean"?r.isImageDecoderSupported:!Bn&&(Be.platform.isFirefox||!globalThis.chrome),L=Number.isInteger(r.canvasMaxAreaInBytes)?r.canvasMaxAreaInBytes:-1,Y=typeof r.disableFontFace=="boolean"?r.disableFontFace:Bn,q=r.fontExtraProperties===!0,G=r.enableXfa===!0,j=r.ownerDocument||globalThis.document,J=r.disableRange===!0,et=r.disableStream===!0,N=r.disableAutoFetch===!0,X=r.pdfBug===!0,O=r.CanvasFactory||(Bn?Vb:zb),C=r.FilterFactory||(Bn?$b:jb),D=r.BinaryDataFactory||(Bn?qb:j0),E=r.enableHWA===!0,S=r.enableWebGPU===!0,k=r.useWasm!==!1,M=r.pagesMapper||new b2,P=typeof r.useSystemFonts=="boolean"?r.useSystemFonts:!Bn&&!Y,B=typeof r.useWorkerFetch=="boolean"?r.useWorkerFetch:!!(D===j0&&m&&y&&A&&w&&Mf(m,document.baseURI)&&Mf(A,document.baseURI)&&Mf(w,document.baseURI)),$=null;q_(d);let U={canvasFactory:new O({ownerDocument:j,enableHWA:E}),filterFactory:new C({docId:e,ownerDocument:j}),binaryDataFactory:B?null:new D({cMapUrl:m,standardFontDataUrl:A,wasmUrl:w})};h||(h=yd.create({verbosity:d,port:dr.workerPort}),t._worker=h);let V={docId:e,apiVersion:"5.6.205",data:n,password:l,disableAutoFetch:N,rangeChunkSize:u,docBaseUrl:f,enableXfa:G,evaluatorOptions:{maxImageSize:T,disableFontFace:Y,ignoreErrors:v,isEvalSupported:I,isOffscreenCanvasSupported:_,isImageDecoderSupported:F,canvasMaxAreaInBytes:L,fontExtraProperties:q,useSystemFonts:P,useWasm:k,useWorkerFetch:B,cMapUrl:m,cMapPacked:y,iccUrl:g,standardFontDataUrl:A,wasmUrl:w,enableWebGPU:S}},Z={ownerDocument:j,pdfBug:X,styleElement:$,enableHWA:E,loadingParams:{disableAutoFetch:N,enableXfa:G}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let Q=h.messageHandler.sendWithPromise("GetDocRequest",V,n?[n.buffer]:null),nt;if(!n)if(c)nt=new r2({pdfDataRangeTransport:c,disableRange:J,disableStream:et});else if(i){let ot=AM(i);nt=new ot({url:i,httpHeaders:s,withCredentials:o,rangeChunkSize:u,disableRange:J,disableStream:et})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return Q.then(ot=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let dt=new hl(e,ot,h.port),at=new T2(dt,t,nt,Z,U,M);t._transport=at,dt.send("Ready",null)})}).catch(t._capability.reject),t}function vC(r){return Math.floor(Math.max(0,Math.min(1,r))*255).toString(16).padStart(2,"0")}function af(r){return Math.max(0,Math.min(255,255*r))}function Gg(r){return`${(r*100).toFixed(2)}%`}var $g,Bn,Qy,Vg,V_,tL,Ln,Ea,Rf,_t,Gt,EC,ul,ri,Nf,$e,vu,Hm,hd,rf,CC,Mx,Lc,_0,_f,dd,Mc,tb,Lr,Be,Wy,Ca,qg,eb,ht,Xy,J1,_u,Ox,Rx,M0,Lf,Bf,Us,ol,Da,Uf,fd,ja,F0,Qf,_c,Es,P0,ib,O0,nC,Ha,Ga,Jn,tr,Jf,$a,Lu,Bu,tp,cx,MC,Ni,FC,PC,Eu,lf,Hs,rb,ep,dl,$s,Ia,OC,RC,ab,sb,fl,pl,Uu,ml,ce,Oi,ux,ob,zu,ip,Ri,ju,Wg,Ow,lb,Ve,Va,np,Se,cb,hx,BC,Fc,dx,ub,Hu,wn,Gu,Pe,De,$u,Vu,qi,qu,er,ui,qa,Wa,Xa,Ya,ts,ir,gl,rp,sp,Wu,ap,es,Ka,Xu,Za,is,fx,Vs,Yu,op,Qa,xl,Ku,Ja,lp,Qe,ae,qs,to,eo,cp,Zu,up,io,ns,Ws,hp,dp,nr,mt,Xg,hb,UC,zC,jC,cf,HC,GC,$C,db,VC,qC,WC,XC,$i,zs,YC,KC,fb,ZC,uf,pb,Pu,Lo,hi,rs,Ar,Qu,ss,An,Ju,as,cn,Xs,yl,os,no,Or,hf,Yg,Vi,R0,vi,rr,bl,ye,fp,ro,sr,so,ao,wl,pp,mb,Mu,th,Al,mp,gp,xp,yp,bp,Ys,vl,Ks,El,Zs,Bo,QC,JC,tT,Rw,zf,Cl,vr,ve,oe,Qs,eh,oo,wp,Ei,Tl,Js,ar,lo,Ap,Sl,vn,vp,Dl,ta,ls,ih,nh,or,kl,Ep,px,Dt,gb,Cp,xb,Kg,eT,iT,yb,Zg,bb,nT,rT,sT,wb,aT,Ab,oT,lT,cT,vb,df,Ft,be,Eb,rC,Zn,Qr,L0,jf,Il,Nl,ea,Ci,mx,uT,Hf,Tp,B0,Au,sC,aC,Cb,rh,co,Tb,lC,ia,ee,ue,_l,Ml,Fl,Li,Sp,Db,Sb,un,hn,Pl,Er,sh,uo,ho,he,kb,de,Oe,Cr,ah,oh,Lw,U0,Qn,Ol,Rl,Ll,Bl,Ul,Dp,Pf,Ib,lh,Nb,fe,_b,Qg,Jg,Pi,yn,yi,kp,gx,ch,uh,t0,Mb,zl,hh,cs,jl,ff,Fb,Tr,xx,qe,le,br,e0,i0,pf,Ob,Pb,Rb,dh,Lb,Bb,sM,hT,na,yx,Ub,Bg,Ze,fh,mr,dT,fT,pT,n0,hl,bx,z0,j0,Ip,H0,zb,G0,Hl,ph,ra,sa,Bi,Gl,$l,yt,Fi,mf,Cu,r0,Tu,mT,Hb,Su,gf,xf,Gb,yf,jb,$b,Vb,qb,oM,Np,mh,gh,xh,bd,gT,xT,Wb,Pw,ki,Gf,Xb,Yb,Kb,uC,wx,Zb,hC,dC,pM,fC,pn,Ky,Un,Fu,$0,gM,xM,yM,xC,Br,Qb,Jb,t2,Bw,Ru,_p,Mp,pd,md,gd,e2,i2,n2,Fp,s2,r2,Pp,a2,Op,o2,Zy,bC,us,wd,CT,TT,l2,Rp,Cs,ST,DT,kT,IT,c2,Lp,Na,NT,_T,h2,u2,d2,f2,p2,Bp,Up,dr,yh,zp,m2,Du,jp,Hp,Gp,bh,g2,fo,pe,wh,Ah,$p,y2,x2,We,Sr,Ti,Vl,hs,zi,bf,wf,a0,b2,ku,wC,lr,V0,vM,AC,po,Wi,Vp,qp,vh,ql,aa,Wp,Xp,Wl,Yp,Eh,mo,Ch,Kp,Th,Xl,Zp,Qp,Sh,Yl,Jp,Dh,kh,_a,FT,PT,w2,jn,o0,A2,OT,RT,Ai,xd,EM,Ax,vx,v2,Ih,tm,em,im,$f,E2,oa,Kl,Zl,Af,Uw,C2,go,Dr,la,Ql,Ex,Jl,tc,Zi,l0,BT,UT,vf,Nh,c0,Fe,yd,En,ec,ca,kr,ic,_h,ua,Rr,Ef,u0,T2,S2,xo,nc,ll,D2,zT,jT,Cn,rc,Mh,ai,nm,Fh,ha,rm,yo,Ir,sm,me,k2,I2,N2,rl,HT,za,ln,Vf,ds,am,Ph,om,cl,q0,W0,_2,Pc,CM,Oc,TM,Ff,sc,Oh,cr,lm,M2,zw,_e,F2,zn,sl,GT,$T,qf,P2,ka,O2,R2,L2,X0,B2,U2,cm,z2,Wf,Tn,bo,Cx,Tx,Rh,Lh,Re,fs,wo,ac,Bh,Uh,ps,Sn,da,fa,Le,pa,Ao,um,ma,zh,oc,vo,di,Eo,Lt,h0,H2,G2,$2,d0,V2,VT,qT,WT,XT,f0,p0,q2,j2,Y0,hm,W2,dm,X2,fm,Y2,pm,K0,K2,Z2,mm,lc,gm,Q2,Xf,Z0,J2,tw,ew,Q0,xm,ym,nw,iw,cc,uc,jh,Co,bm,hc,Dn,wm,Ta,m0,rw,jw,J0,jg,kn,Am,dc,In,Je,YT,KT,ZT,g0,Sa,x0,y0,QT,aw,JT,Ae,sw,xt,Nn,Nr,Hh,Gh,ms,Ut,fc,pc,vm,Em,$h,Vh,To,Cm,Sx,Dx,li,Cf,tS,eS,iS,nS,rS,sS,Gs,tx,qh,mc,ga,Tm,_n,Sm,Xe,kx,aS,ex,Dm,km,Im,So,_r,Qi,oS,b0,lS,cS,ow,Yf,Nm,Wh,lw,Kf,cw,Xh,_m,xa,gc,Mm,dn,Fm,Pm,xc,Mn,Fn,Si,Yh,Kh,Ui,Zh,ur,Om,Rt,uw,w0,uS,hS,dS,hw,al,pr,Iu,fS,A0,v0,pS,mS,gS,xS,yS,te,ix,yc,nx,Pn,Qh,fi,bc,wc,Wt,dw,fw,pw,Tf,bS,E0,Sf,Nu,Ht,rx,gs,pi,mi,Ac,Jh,Xi,Di,hr,vc,Ec,Cc,td,C0,mw,Yi,Rm,Lm,On,xs,ys,ed,id,Tc,Ii,js,wS,AS,vS,Rc,sx,Ix,ES,Ou,gw,Zf,Hg,of,Sc,ne,xw,Mr,CS,TS,yw,T0,SS,DS,kS,bw,ww,IS,fr,Aw,vw,Do,bs,ko,Dc,bn,Ew,Ee,gi,Io,ya,No,nd,ba,kc,ws,Rn,rd,Xt,kf,If,S0,D0,k0,Cw,I0,NS,Df,Ic,sd,_o,Mo,wa,fn,Fo,ad,od,Fr,Aa,xi,va,Po,ld,vt,Oo,ge,Tw,_S,Jr,Sw,Dw,N0,wr,ax,Pr,Ki,Nc,Bm,Nx,MS,Ts,kw,FS,Iw,si,ox,cd,Um,zm,ud,As,vs,jm,_x,PS,Of,lx,RS=Kt(()=>{H();$g={};$g.d=(r,t)=>{for(var e in t)$g.o(t,e)&&!$g.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})};$g.o=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);Bn=typeof it.default=="object"&&it.default+""=="[object process]"&&!it.default.versions.nw&&!(it.default.versions.electron&&it.default.type&&it.default.type!=="browser"),Qy=[.001,0,0,.001,0,0],Vg=1.35,V_=.35,tL=V_/Vg,Ln={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ea={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Rf="pdfjs_internal_editor_",_t={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},Gt={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},EC={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},ul={TRIANGLES:1,LATTICE:2,PATCH:3},ri={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},Nf={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},$e={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},vu={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},Hm={ERRORS:0,WARNINGS:1,INFOS:5},hd={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},rf={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},CC={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Mx=Hm.WARNINGS;Lc=(function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t})(),_0=class extends Lc{constructor(t,e){super(t,"PasswordException"),this.code=e}},_f=class extends Lc{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},dd=class extends Lc{constructor(t){super(t,"InvalidPDFException")}},Mc=class extends Lc{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}},tb=class extends Lc{constructor(t){super(t,"FormatError")}},Lr=class extends Lc{constructor(t){super(t,"AbortException")}};Be=class{static get isLittleEndian(){return Mt(this,"isLittleEndian",Z_())}static get isEvalSupported(){return Mt(this,"isEvalSupported",Q_())}static get isOffscreenCanvasSupported(){return Mt(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Mt(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return Mt(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return Mt(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:t,userAgent:e}=navigator;return Mt(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 Mt(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}},Wy=Array.from(Array(256).keys(),r=>r.toString(16).padStart(2,"0")),ht=class{static makeHexColor(t,e,i){return`#${Wy[t]}${Wy[e]}${Wy[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],y=n*h+c,g=y,A=n*f+c,w=A,v=l*d+u,T=v,I=l*m+u,_=I;if(s!==0||o!==0){let F=s*h,L=s*f,Y=o*d,q=o*m;y+=Y,w+=Y,A+=q,g+=q,v+=F,_+=F,I+=L,T+=L}i[0]=Math.min(i[0],y,A,g,w),i[1]=Math.min(i[1],v,I,T,_),i[2]=Math.max(i[2],y,A,g,w),i[3]=Math.max(i[3],v,I,T,_)}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,Ca,eb).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,Ca,eb).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)}};Ca=new WeakSet,qg=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,y=d*(d*(d*t+3*u*e)+3*f*i)+m*n,g=d*(d*(d*s+3*u*o)+3*f*l)+m*c;h[0]=Math.min(h[0],y),h[1]=Math.min(h[1],g),h[2]=Math.max(h[2],y),h[3]=Math.max(h[3],g)},eb=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,Ca,qg).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 y=Math.sqrt(m),g=2*u;b(this,Ca,qg).call(this,t,e,i,n,s,o,l,c,(-h+y)/g,f),b(this,Ca,qg).call(this,t,e,i,n,s,o,l,c,(-h-y)/g,f)},x(ht,Ca);Xy=null,J1=null;_u="pdfjs_internal_id_";Ox=()=>[],Rx=()=>new Map,M0=()=>Object.create(null);typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(r){return r.reduce((t,e)=>t+e,0)});Lf=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")}},Bf=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&&Lf.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 y=d.children[++h.at(-1)[1]];if(y===null)continue;let{name:g}=y;if(g==="#text"){let w=document.createTextNode(y.value);u.push(w),m.append(w);continue}let A=y?.attributes?.xmlns?document.createElementNS(y.attributes.xmlns,g):document.createElement(g);if(m.append(A),y.attributes&&this.setAttributes({html:A,element:y,storage:e,intent:s,linkService:i}),y.children?.length>0)h.push([y,-1,A]);else if(y.value){let w=document.createTextNode(y.value);l&&Lf.shouldBuildText(g)&&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}},Us="http://www.w3.org/2000/svg",ol=class ol{};z(ol,"CSS",96),z(ol,"PDF",72),z(ol,"PDF_TO_CSS_UNITS",ol.CSS/ol.PDF);Da=ol;Uf=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 y,g,A,w;h===0?(y=Math.abs(u-t[1])*i+s,g=Math.abs(c-t[0])*i+o,A=(t[3]-t[1])*i,w=(t[2]-t[0])*i):(y=Math.abs(c-t[0])*i+s,g=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,y-h*i*c-f*i*u,g-d*i*c-m*i*u],this.width=A,this.height=w}get rawDims(){let t=this.viewBox;return Mt(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 ht.applyTransform(i,this.transform),i}convertToViewportRectangle(t){let e=[t[0],t[1]];ht.applyTransform(e,this.transform);let i=[t[2],t[3]];return ht.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){let i=[t,e];return ht.applyInverseTransform(i,this.transform),i}},fd=class extends Lc{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};F0=class{constructor(){x(this,ja,new Map);z(this,"times",[])}time(t){a(this,ja).has(t)&&Pt(`Timer is already running for ${t}`),a(this,ja).set(t,Date.now())}timeEnd(t){a(this,ja).has(t)||Pt(`Timer has not been started for ${t}`),this.times.push({name:t,start:a(this,ja).get(t),end:Date.now()}),a(this,ja).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 +`).join("")}};ja=new WeakMap;_c=class{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;a(this,Qf)||p(this,Qf,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));let e=a(this,Qf).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))}};Qf=new WeakMap,x(_c,Qf);Es=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}},P0=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],ib=class{static get isDarkMode(){return Mt(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}},O0=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(),Mt(this,"commentForegroundColor",Ad(i))}};nC=new Map;Hs=class Hs{constructor(t){x(this,Ni);x(this,Ha,null);x(this,Ga,null);x(this,Jn);x(this,tr,null);x(this,Jf,null);x(this,$a,null);x(this,Lu,null);x(this,Bu,null);p(this,Jn,t),a(Hs,tp)||p(Hs,tp,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,Ha,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=a(this,Jn)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",Hn,{signal:e}),t.addEventListener("pointerdown",b(Hs,cx,MC),{signal:e}));let i=p(this,tr,document.createElement("div"));i.className="buttons",t.append(i);let n=a(this,Jn).toolbarPosition;if(n){let{style:s}=t,o=a(this,Jn)._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,Ha)}hide(){a(this,Ha).classList.add("hidden"),a(this,Ga)?.hideDropdown()}show(){a(this,Ha).classList.remove("hidden"),a(this,Jf)?.shown(),a(this,$a)?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=a(this,Jn),i=document.createElement("button");i.classList.add("basic","deleteButton"),i.tabIndex=0,i.setAttribute("data-l10n-id",a(Hs,tp)[t]),b(this,Ni,Eu).call(this,i)&&i.addEventListener("click",n=>{e.delete()},{signal:e._signal}),a(this,tr).append(i)}async addAltText(t){let e=await t.render();b(this,Ni,Eu).call(this,e),a(this,tr).append(e,a(this,Ni,lf)),p(this,Jf,t)}addComment(t,e=null){if(a(this,$a))return;let i=t.renderForToolbar();if(!i)return;b(this,Ni,Eu).call(this,i);let n=p(this,Lu,a(this,Ni,lf));e?(a(this,tr).insertBefore(i,e),a(this,tr).insertBefore(n,e)):a(this,tr).append(i,n),p(this,$a,t),t.toolbar=this}addColorPicker(t){if(a(this,Ga))return;p(this,Ga,t);let e=t.renderButton();b(this,Ni,Eu).call(this,e),a(this,tr).append(e,a(this,Ni,lf))}async addEditSignatureButton(t){let e=p(this,Bu,await t.renderEditButton(a(this,Jn)));b(this,Ni,Eu).call(this,e),a(this,tr).append(e,a(this,Ni,lf))}removeButton(t){t==="comment"&&(a(this,$a)?.removeToolbarCommentButton(),p(this,$a,null),a(this,Lu)?.remove(),p(this,Lu,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,tr).querySelector(i);n&&t==="comment"&&this.addComment(e,n)}updateEditSignatureButton(t){a(this,Bu)&&(a(this,Bu).title=t)}remove(){a(this,Ha).remove(),a(this,Ga)?.destroy(),p(this,Ga,null)}};Ha=new WeakMap,Ga=new WeakMap,Jn=new WeakMap,tr=new WeakMap,Jf=new WeakMap,$a=new WeakMap,Lu=new WeakMap,Bu=new WeakMap,tp=new WeakMap,cx=new WeakSet,MC=function(t){t.stopPropagation()},Ni=new WeakSet,FC=function(t){a(this,Jn)._focusEventsAllowed=!1,Ie(t)},PC=function(t){a(this,Jn)._focusEventsAllowed=!0,Ie(t)},Eu=function(t){let e=a(this,Jn)._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",b(this,Ni,FC).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",b(this,Ni,PC).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Hn,{signal:e}),!0)},lf=function(){let t=document.createElement("div");return t.className="divider",t},x(Hs,cx),x(Hs,tp,null);rb=Hs,sb=class{constructor(t){x(this,Ia);x(this,ep,null);x(this,dl,null);x(this,$s);p(this,$s,t)}show(t,e,i){let[n,s]=b(this,Ia,RC).call(this,e,i),{style:o}=a(this,dl)||p(this,dl,b(this,Ia,OC).call(this));t.append(a(this,dl)),o.insetInlineEnd=`${100*n}%`,o.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){a(this,dl).remove()}};ep=new WeakMap,dl=new WeakMap,$s=new WeakMap,Ia=new WeakSet,OC=function(){let t=p(this,dl,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");let e=a(this,$s)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",Hn,{signal:e});let i=p(this,ep,document.createElement("div"));return i.className="buttons",t.append(i),a(this,$s).hasCommentManager()&&b(this,Ia,ab).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{a(this,$s).commentSelection("floating_button")}),b(this,Ia,ab).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{a(this,$s).highlightSelection("floating_button")}),t},RC=function(t,e){let i=0,n=0;for(let s of t){let o=s.y+s.height;if(oi){n=l,i=o;continue}e?l>n&&(n=l):l=1}static clearPointerType(){p(ce,ml,null)}static clearPointerIds(){p(ce,fl,NaN),p(ce,pl,null)}static clearTimeStamp(){p(ce,Uu,NaN)}};fl=new WeakMap,pl=new WeakMap,Uu=new WeakMap,ml=new WeakMap,x(ce,fl,NaN),x(ce,pl,null),x(ce,Uu,NaN),x(ce,ml,null);Oi=ce,ob=class{constructor(){x(this,ux,0)}get id(){return`${Rf}${Ye(this,ux)._++}`}};ux=new WeakMap;Ow=class Ow{constructor(){x(this,ju);x(this,zu,Mw());x(this,ip,0);x(this,Ri,null)}static get _isSVGFittingCanvas(){let t='data:image/svg+xml;charset=UTF-8,',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 Mt(this,"_isSVGFittingCanvas",s)}async getFromFile(t){let{lastModified:e,name:i,size:n,type:s}=t;return b(this,ju,Wg).call(this,`${e}_${i}_${n}_${s}`,t)}async getFromUrl(t){return b(this,ju,Wg).call(this,t,t)}async getFromBlob(t,e){let i=await e;return b(this,ju,Wg).call(this,t,i)}async getFromId(t){a(this,Ri)||p(this,Ri,new Map);let e=a(this,Ri).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,Ri)||p(this,Ri,new Map);let i=a(this,Ri).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,zu)}_${Ye(this,ip)._++}`,refCounter:1,isSvg:!1},a(this,Ri).set(t,i),a(this,Ri).set(i.id,i),i}getSvgUrl(t){let e=a(this,Ri).get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){a(this,Ri)||p(this,Ri,new Map);let e=a(this,Ri).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,zu)}_`)}};zu=new WeakMap,ip=new WeakMap,Ri=new WeakMap,ju=new WeakSet,Wg=async function(t,e){a(this,Ri)||p(this,Ri,new Map);let i=a(this,Ri).get(t);if(i===null)return null;if(i?.bitmap)return i.refCounter+=1,i;try{i||(i={bitmap:null,id:`image_${a(this,zu)}_${Ye(this,ip)._++}`,refCounter:0,isSvg:!1});let n;if(typeof e=="string"?(i.url=e,n=await Lx(e,"blob")):e instanceof File?n=i.file=e:e instanceof Blob&&(n=e),n.type==="image/svg+xml"){let s=Ow._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){Pt(n),i=null}return a(this,Ri).set(t,i),i&&a(this,Ri).set(i.id,i),i};lb=Ow,cb=class{constructor(t=128){x(this,Ve,[]);x(this,Va,!1);x(this,np);x(this,Se,-1);p(this,np,t)}add({cmd:t,undo:e,post:i,mustExec:n,type:s=NaN,overwriteIfSameType:o=!1,keepUndo:l=!1}){if(n&&t(),a(this,Va))return;let c={cmd:t,undo:e,post:i,type:s};if(a(this,Se)===-1){a(this,Ve).length>0&&(a(this,Ve).length=0),p(this,Se,0),a(this,Ve).push(c);return}if(o&&a(this,Ve)[a(this,Se)].type===s){l&&(c.undo=a(this,Ve)[a(this,Se)].undo),a(this,Ve)[a(this,Se)]=c;return}let u=a(this,Se)+1;u===a(this,np)?a(this,Ve).splice(0,1):(p(this,Se,u),u=0;e--)if(a(this,Ve)[e].type!==t){a(this,Ve).splice(e+1,a(this,Se)-e),p(this,Se,e);return}a(this,Ve).length=0,p(this,Se,-1)}}destroy(){p(this,Ve,null)}};Ve=new WeakMap,Va=new WeakMap,np=new WeakMap,Se=new WeakMap;Fc=class{constructor(t){x(this,hx);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=Be.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,hx,BC).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||Ie(e))}};hx=new WeakSet,BC=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};dx=class dx{get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return iM(t),Mt(this,"_colors",t)}convert(t){let e=Ad(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 dx._colorsMapping.get(i);return e}getHexCode(t){let e=this._colors.get(t);return e?ht.makeHexColor(...e):t}};z(dx,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));ub=dx,Pu=class Pu{constructor(t,e,i,n,s,o,l,c,u,h,d,f,m,y,g,A){x(this,mt);x(this,Hu,new AbortController);x(this,wn,null);x(this,Gu,null);x(this,Pe,new Map);x(this,De,new Map);x(this,$u,null);x(this,Vu,null);x(this,qi,null);x(this,qu,null);x(this,er,new cb);x(this,ui,null);x(this,qa,null);x(this,Wa,null);x(this,Xa,0);x(this,Ya,new Set);x(this,ts,null);x(this,ir,null);x(this,gl,new Set);z(this,"_editorUndoBar",null);x(this,rp,!1);x(this,sp,!1);x(this,Wu,!1);x(this,ap,null);x(this,es,null);x(this,Ka,null);x(this,Xu,null);x(this,Za,!1);x(this,is,null);x(this,fx,new ob);x(this,Vs,!1);x(this,Yu,!1);x(this,op,!1);x(this,Qa,null);x(this,xl,null);x(this,Ku,null);x(this,Ja,null);x(this,lp,null);x(this,Qe,_t.NONE);x(this,ae,new Set);x(this,qs,null);x(this,to,null);x(this,eo,null);x(this,cp,null);x(this,Zu,null);x(this,up,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});x(this,io,[0,0]);x(this,ns,null);x(this,Ws,null);x(this,hp,null);x(this,dp,null);x(this,nr,null);let w=this._signal=a(this,Hu).signal;p(this,Ws,t),p(this,hp,e),p(this,dp,i),p(this,Vu,n),p(this,ui,s),p(this,to,o),p(this,Zu,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,Yu,!0)},{capture:!0,signal:w}),window.addEventListener("pointerup",()=>{p(this,Yu,!1)},{capture:!0,signal:w}),window.addEventListener("beforeunload",b(this,mt,UC).bind(this),{capture:!0,signal:w}),b(this,mt,HC).call(this),b(this,mt,XC).call(this),b(this,mt,db).call(this),p(this,qi,c.annotationStorage),p(this,ap,c.filterFactory),p(this,eo,u),p(this,Xu,h||null),p(this,rp,d),p(this,sp,f),p(this,Wu,m),p(this,lp,y||null),this.viewParameters={realScale:Da.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=g||null,this._supportsPinchToZoom=A!==!1,s?.setSidebarUiManager(this)}static get _keyboardManager(){let t=Pu.prototype,e=o=>a(o,Ws).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 Mt(this,"_keyboardManager",new Fc([[["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,Ws).contains(l)&&!o.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&a(o,Ws).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,nr)?.resolve(),p(this,nr,null),a(this,Hu)?.abort(),p(this,Hu,null),this._signal=null;for(let t of a(this,De).values())t.destroy();a(this,De).clear(),a(this,Pe).clear(),a(this,gl).clear(),a(this,Ja)?.clear(),p(this,wn,null),a(this,ae).clear(),a(this,er).destroy(),a(this,Vu)?.destroy(),a(this,ui)?.destroy(),a(this,to)?.destroy(),a(this,is)?.hide(),p(this,is,null),a(this,Ku)?.destroy(),p(this,Ku,null),p(this,Gu,null),a(this,es)&&(clearTimeout(a(this,es)),p(this,es,null)),a(this,ns)&&(clearTimeout(a(this,ns)),p(this,ns,null)),this._editorUndoBar?.destroy(),p(this,Zu,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return a(this,lp)}get useNewAltTextFlow(){return a(this,sp)}get useNewAltTextWhenAddingImage(){return a(this,Wu)}get hcmFilter(){return Mt(this,"hcmFilter",a(this,eo)?a(this,ap).addHCMFilter(a(this,eo).foreground,a(this,eo).background):"none")}get direction(){return Mt(this,"direction",getComputedStyle(a(this,Ws)).direction)}get _highlightColors(){return Mt(this,"_highlightColors",a(this,Xu)?new Map(a(this,Xu).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 Mt(this,"highlightColors",null);let e=new Map,i=!!a(this,eo);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 Mt(this,"highlightColors",e)}get highlightColorNames(){return Mt(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,Wa,t)}setMainHighlightColorPicker(t){p(this,Ku,t)}editAltText(t,e=!1){a(this,Vu)?.editAltText(this,t,e)}hasCommentManager(){return!!a(this,ui)}editComment(t,e,i,n){a(this,ui)?.showDialog(this,t,e,i,n)}selectComment(t,e){a(this,De).get(t)?.getEditorByUID(e)?.toggleComment(!0,!0)}updateComment(t){a(this,ui)?.updateComment(t.getData())}updatePopupColor(t){a(this,ui)?.updatePopupColor(t)}removeComment(t){a(this,ui)?.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,ui)?.toggleCommentPopup(t,e,i)}makeCommentColor(t,e){return t&&a(this,ui)?.makeCommentColor(t,e)||null}getCommentDialogElement(){return a(this,ui)?.dialogElement||null}async waitForEditorsRendered(t){if(a(this,De).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,to)?.getSignature({uiManager:this,editor:t})}get signatureManager(){return a(this,to)}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,Wu,e)}onPageChanging({pageNumber:t}){p(this,Xa,t-1)}deletePage(t){for(let e of this.getEditors(t))e.remove();a(this,De).delete(t),a(this,Xa)===t&&p(this,Xa,0)}focusMainContainer(){a(this,Ws).focus()}findParent(t,e){for(let i of a(this,De).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,hp).classList.toggle("noUserSelect",t)}addShouldRescale(t){a(this,gl).add(t)}removeShouldRescale(t){a(this,gl).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Da.PDF_TO_CSS_UNITS;for(let e of a(this,gl))e.onScaleChanging();a(this,Wa)?.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,mt,Xg).call(this,i).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;i.empty();let f=b(this,mt,hb).call(this,h),m=a(this,Qe)===_t.NONE,y=()=>{let g=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&&g?.editComment()};if(m){this.switchToMode(_t.HIGHLIGHT,y);return}y()}commentSelection(t=""){this.highlightSelection(t,!0)}getAndRemoveDataFromAnnotationStorage(t){if(!a(this,qi))return null;let e=`${Rf}${t}`,i=a(this,qi).getRawValue(e);return i&&a(this,qi).remove(e),i}addToAnnotationStorage(t){!t.isEmpty()&&a(this,qi)&&!a(this,qi).has(t.id)&&a(this,qi).setValue(t.id,t)}a11yAlert(t,e=null){let i=a(this,dp);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,Za)&&(p(this,Za,!1),b(this,mt,cf).call(this,"main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of a(this,ae))if(e.div.contains(t)){p(this,xl,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!a(this,xl))return;let[t,e]=a(this,xl);p(this,xl,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){b(this,mt,db).call(this),this.setEditingState(!0)}removeEditListeners(){b(this,mt,VC).call(this),this.setEditingState(!1)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let i of a(this,ir))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,ir))if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),a(this,wn)?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let i of a(this,ae)){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,ir))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){Pt(`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,mt,fb).call(this,c);b(this,mt,pb).call(this,s)},l=()=>{for(let c of s)c.remove()};this.addCommands({cmd:o,undo:l,mustExec:!0})}catch(s){Pt(`paste: "${s.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),a(this,Qe)!==_t.NONE&&!this.isEditorHandlingKeyboard&&Pu._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,a(this,Za)&&(p(this,Za,!1),b(this,mt,cf).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,$u).get(t);i&&(i.pageIndex=e,a(this,De).set(e,i),a(this,Vs)?i.enable():i.disable())}startUpdatePages(){p(this,$u,new Map(a(this,De))),a(this,De).clear()}endUpdatePages(){p(this,$u,null)}clonePage(t,e){for(let i of this.getEditors(t)){let n=i.serialize(i.mode!==_t.HIGHLIGHT);n&&(n.pageIndex=e,n.id=this.getId(),n.isClone=!0,delete n.popupRef,a(this,qi).setValue(n.id,n))}}findClonesForPage(t){let e=[],{pageIndex:i}=t;for(let[n,s]of a(this,qi))s.pageIndex===i&&s.isClone&&(a(this,qi).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,mt,GC).call(this),b(this,mt,qC).call(this),b(this,mt,$i).call(this,{isEditing:a(this,Qe)!==_t.NONE,isEmpty:b(this,mt,uf).call(this),hasSomethingToUndo:a(this,er).hasSomethingToUndo(),hasSomethingToRedo:a(this,er).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,mt,$C).call(this),b(this,mt,WC).call(this),b(this,mt,$i).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!a(this,ir)){p(this,ir,t);for(let e of a(this,ir))b(this,mt,zs).call(this,e.defaultPropertiesToUpdate)}}getId(){return a(this,fx).id}get currentLayer(){return a(this,De).get(a(this,Xa))}getLayer(t){return a(this,De).get(t)}get currentPageIndex(){return a(this,Xa)}addLayer(t){a(this,De).set(t.pageIndex,t),a(this,Vs)?t.enable():t.disable()}removeLayer(t){a(this,De).delete(t.pageIndex)}async updateMode(t,e=null,i=!1,n=!1,s=!1,o=!1){if(a(this,Qe)!==t&&!(a(this,nr)&&(await a(this,nr).promise,!a(this,nr)))){if(p(this,nr,Promise.withResolvers()),a(this,Wa)?.commitOrRemove(),a(this,Qe)===_t.POPUP&&a(this,ui)?.hideSidebar(),a(this,ui)?.destroyPopup(),p(this,Qe,t),t===_t.NONE){this.setEditingState(!1),b(this,mt,KC).call(this);for(let l of a(this,Pe).values())l.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),a(this,nr).resolve();return}for(let l of a(this,Pe).values())l.addStandaloneCommentButton();t===_t.SIGNATURE&&await a(this,to)?.loadSignatures(),i&&Oi.clearPointerType(),this.setEditingState(!0),await b(this,mt,YC).call(this),this.unselectAll();for(let l of a(this,De).values())l.updateMode(t);if(t===_t.POPUP){a(this,Gu)||p(this,Gu,await a(this,Zu).getAnnotationsByType(new Set(a(this,ir).map(u=>u._editorType))));let l=new Set,c=[];for(let u of a(this,Pe).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,Gu)){let{id:h,popupRef:d,contentsObj:f}=u;d&&f?.str&&!l.has(h)&&!a(this,Ya).has(h)&&c.push(u)}a(this,ui)?.showSidebar(c)}if(!e){n&&this.addNewEditorFromKeyboard(),a(this,nr).resolve();return}for(let l of a(this,Pe).values())l.uid===e?(this.setSelected(l),o?l.editComment():s?l.enterInEditMode():l.focus()):l.unselect();a(this,nr).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==a(this,Qe)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(a(this,ir)){switch(t){case Gt.CREATE:this.currentLayer.addNewEditor(e);return;case Gt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(a(this,cp)||p(this,cp,new Map)).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(let i of a(this,ae))i.updateParams(t,e);else for(let i of a(this,ir))i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){for(let s of a(this,Pe).values())s.editorType===t&&s.show(e);(a(this,cp)?.get(Gt.HIGHLIGHT_SHOW_ALL)??!0)!==e&&b(this,mt,zs).call(this,[[Gt.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(a(this,op)!==t){p(this,op,t);for(let e of a(this,De).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(let e of a(this,Pe).values())e.pageIndex===t&&(yield e)}getEditor(t){return a(this,Pe).get(t)}addEditor(t){a(this,Pe).set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(a(this,es)&&clearTimeout(a(this,es)),p(this,es,setTimeout(()=>{this.focusMainContainer(),p(this,es,null)},0))),a(this,Pe).delete(t.id),t.annotationElementId&&a(this,Ja)?.delete(t.annotationElementId),this.unselect(t),(!t.annotationElementId||!a(this,Ya).has(t.annotationElementId))&&a(this,qi)?.remove(t.id)}addDeletedAnnotationElement(t){a(this,Ya).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return a(this,Ya).has(t)}removeDeletedAnnotationElement(t){a(this,Ya).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){a(this,wn)!==t&&(p(this,wn,t),t&&b(this,mt,zs).call(this,t.propertiesToUpdate))}updateUI(t){a(this,mt,ZC)===t&&b(this,mt,zs).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){b(this,mt,zs).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(a(this,ae).has(t)){a(this,ae).delete(t),t.unselect(),b(this,mt,$i).call(this,{hasSelectedEditor:this.hasSelection});return}a(this,ae).add(t),t.select(),b(this,mt,zs).call(this,t.propertiesToUpdate),b(this,mt,$i).call(this,{hasSelectedEditor:!0})}setSelected(t){this.updateToolbar({mode:t.mode,editId:t.uid}),a(this,Wa)?.commitOrRemove();for(let e of a(this,ae))e!==t&&e.unselect();a(this,ui)?.destroyPopup(),a(this,ae).clear(),a(this,ae).add(t),t.select(),b(this,mt,zs).call(this,t.propertiesToUpdate),b(this,mt,$i).call(this,{hasSelectedEditor:!0})}isSelected(t){return a(this,ae).has(t)}get firstSelectedEditor(){return a(this,ae).values().next().value}unselect(t){t.unselect(),a(this,ae).delete(t),b(this,mt,$i).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return a(this,ae).size!==0}get isEnterHandled(){return a(this,ae).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){a(this,er).undo(),b(this,mt,$i).call(this,{hasSomethingToUndo:a(this,er).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,mt,uf).call(this)}),this._editorUndoBar?.hide()}redo(){a(this,er).redo(),b(this,mt,$i).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:a(this,er).hasSomethingToRedo(),isEmpty:b(this,mt,uf).call(this)})}addCommands(t){a(this,er).add(t),b(this,mt,$i).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,mt,uf).call(this)})}cleanUndoStack(t){a(this,er).cleanType(t)}delete(){this.commitOrRemove();let t=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let e=t?[t]:[...a(this,ae)],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,mt,fb).call(this,s)};this.addCommands({cmd:i,undo:n,mustExec:!0})}commitOrRemove(){a(this,wn)?.commitOrRemove()}hasSomethingToControl(){return a(this,wn)||this.hasSelection}selectAll(){for(let t of a(this,ae))t.commit();b(this,mt,pb).call(this,a(this,Pe).values())}unselectAll(){if(!(a(this,wn)&&(a(this,wn).commitOrRemove(),a(this,Qe)!==_t.NONE))&&!a(this,Wa)?.commitOrRemove()&&(a(this,ui)?.destroyPopup(),!!this.hasSelection)){for(let t of a(this,ae))t.unselect();a(this,ae).clear(),b(this,mt,$i).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;a(this,io)[0]+=t,a(this,io)[1]+=e;let[n,s]=a(this,io),o=[...a(this,ae)],l=1e3;a(this,ns)&&clearTimeout(a(this,ns)),p(this,ns,setTimeout(()=>{p(this,ns,null),a(this,io)[0]=a(this,io)[1]=0,this.addCommands({cmd:()=>{for(let c of o)a(this,Pe).has(c.id)&&(c.translateInPage(n,s),c.translationDone())},undo:()=>{for(let c of o)a(this,Pe).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,ts,new Map);for(let t of a(this,ae))a(this,ts).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!a(this,ts))return!1;this.disableUserSelect(!1);let t=a(this,ts);p(this,ts,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,Pe).has(n.id)){let c=a(this,De).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,ts))for(let i of a(this,ts).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,ae).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return a(this,wn)===t}getActive(){return a(this,wn)}getMode(){return a(this,Qe)}isEditingMode(){return a(this,Qe)!==_t.NONE}get imageManager(){return Mt(this,"imageManager",new lb)}getSelectionBoxes(t){if(!t)return null;let e=document.getSelection();for(let u=0,h=e.rangeCount;u({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{u.type==="pointerup"&&u.button!==0||(o.abort(),s?.toggleDrawing(!0),u.type==="pointerup"&&b(this,mt,cf).call(this,"main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}else s?.toggleDrawing(!0),b(this,mt,cf).call(this,"main_toolbar")}},cf=function(t=""){a(this,Qe)===_t.HIGHLIGHT?this.highlightSelection(t):a(this,rp)&&b(this,mt,zC).call(this)},HC=function(){document.addEventListener("selectionchange",b(this,mt,jC).bind(this),{signal:this._signal})},GC=function(){if(a(this,Ka))return;p(this,Ka,new AbortController);let t=this.combinedSignal(a(this,Ka));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},$C=function(){a(this,Ka)?.abort(),p(this,Ka,null)},db=function(){if(a(this,Qa))return;p(this,Qa,new AbortController);let t=this.combinedSignal(a(this,Qa));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},VC=function(){a(this,Qa)?.abort(),p(this,Qa,null)},qC=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})},WC=function(){a(this,qa)?.abort(),p(this,qa,null)},XC=function(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},$i=function(t){Object.entries(t).some(([i,n])=>a(this,up)[i]!==n)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(a(this,up),t)}),a(this,Qe)===_t.HIGHLIGHT&&t.hasSelectedEditor===!1&&b(this,mt,zs).call(this,[[Gt.HIGHLIGHT_FREE,!0]]))},zs=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},YC=async function(){if(!a(this,Vs)){p(this,Vs,!0);let t=[];for(let e of a(this,De).values())t.push(e.enable());await Promise.all(t);for(let e of a(this,Pe).values())e.enable()}},KC=function(){if(this.unselectAll(),a(this,Vs)){p(this,Vs,!1);for(let t of a(this,De).values())t.disable();for(let t of a(this,Pe).values())t.disable()}},fb=function(t){let e=a(this,De).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},ZC=function(){let t=null;for(t of a(this,ae));return t},uf=function(){if(a(this,Pe).size===0)return!0;if(a(this,Pe).size===1)for(let t of a(this,Pe).values())return t.isEmpty();return!1},pb=function(t){for(let e of a(this,ae))e.unselect();a(this,ae).clear();for(let e of t)e.isEmpty()||(a(this,ae).add(e),e.select());b(this,mt,$i).call(this,{hasSelectedEditor:this.hasSelection})},z(Pu,"TRANSLATE_SMALL",1),z(Pu,"TRANSLATE_BIG",10);Lo=Pu,Vi=class Vi{constructor(t){x(this,Or);x(this,hi,null);x(this,rs,!1);x(this,Ar,null);x(this,Qu,null);x(this,ss,null);x(this,An,null);x(this,Ju,!1);x(this,as,null);x(this,cn,null);x(this,Xs,null);x(this,yl,null);x(this,os,!1);p(this,cn,t),p(this,os,t._uiManager.useNewAltTextFlow),a(Vi,no)||p(Vi,no,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){Vi._l10n??(Vi._l10n=t)}async render(){let t=p(this,Ar,document.createElement("button"));t.className="altText",t.tabIndex="0";let e=p(this,Qu,document.createElement("span"));t.append(e),a(this,os)?(t.classList.add("new"),t.setAttribute("data-l10n-id",a(Vi,no).missing),e.setAttribute("data-l10n-id",a(Vi,no)["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,cn)._uiManager._signal;t.addEventListener("contextmenu",Hn,{signal:i}),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:i});let n=s=>{s.preventDefault(),a(this,cn)._uiManager.editAltText(a(this,cn)),a(this,os)&&a(this,cn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:a(this,Or,hf)}})};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(p(this,Ju,!0),n(s))},{signal:i}),await b(this,Or,Yg).call(this),t}finish(){a(this,Ar)&&(a(this,Ar).focus({focusVisible:a(this,Ju)}),p(this,Ju,!1))}isEmpty(){return a(this,os)?a(this,hi)===null:!a(this,hi)&&!a(this,rs)}hasData(){return a(this,os)?a(this,hi)!==null||!!a(this,Xs):this.isEmpty()}get guessedText(){return a(this,Xs)}async setGuessedText(t){a(this,hi)===null&&(p(this,Xs,t),p(this,yl,await Vi._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),b(this,Or,Yg).call(this))}toggleAltTextBadge(t=!1){if(!a(this,os)||a(this,hi)){a(this,as)?.remove(),p(this,as,null);return}if(!a(this,as)){let e=p(this,as,document.createElement("div"));e.className="noAltTextBadge",a(this,cn).div.append(e)}a(this,as).classList.toggle("hidden",!t)}serialize(t){let e=a(this,hi);return!t&&a(this,Xs)===e&&(e=a(this,yl)),{altText:e,decorative:a(this,rs),guessedText:a(this,Xs),textWithDisclaimer:a(this,yl)}}get data(){return{altText:a(this,hi),decorative:a(this,rs)}}set data({altText:t,decorative:e,guessedText:i,textWithDisclaimer:n,cancel:s=!1}){i&&(p(this,Xs,i),p(this,yl,n)),!(a(this,hi)===t&&a(this,rs)===e)&&(s||(p(this,hi,t),p(this,rs,e)),b(this,Or,Yg).call(this))}toggle(t=!1){a(this,Ar)&&(!t&&a(this,An)&&(clearTimeout(a(this,An)),p(this,An,null)),a(this,Ar).disabled=!t)}shown(){a(this,cn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:a(this,Or,hf)}})}destroy(){a(this,Ar)?.remove(),p(this,Ar,null),p(this,Qu,null),p(this,ss,null),a(this,as)?.remove(),p(this,as,null)}};hi=new WeakMap,rs=new WeakMap,Ar=new WeakMap,Qu=new WeakMap,ss=new WeakMap,An=new WeakMap,Ju=new WeakMap,as=new WeakMap,cn=new WeakMap,Xs=new WeakMap,yl=new WeakMap,os=new WeakMap,no=new WeakMap,Or=new WeakSet,hf=function(){return a(this,hi)&&"added"||a(this,hi)===null&&this.guessedText&&"review"||"missing"},Yg=async function(){let t=a(this,Ar);if(!t)return;if(a(this,os)){if(t.classList.toggle("done",!!a(this,hi)),t.setAttribute("data-l10n-id",a(Vi,no)[a(this,Or,hf)]),a(this,Qu)?.setAttribute("data-l10n-id",a(Vi,no)[`${a(this,Or,hf)}-label`]),!a(this,hi)){a(this,ss)?.remove();return}}else{if(!a(this,hi)&&!a(this,rs)){t.classList.remove("done"),a(this,ss)?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=a(this,ss);if(!e){p(this,ss,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${a(this,cn).id}`;let n=100,s=a(this,cn)._uiManager._signal;s.addEventListener("abort",()=>{clearTimeout(a(this,An)),p(this,An,null)},{once:!0}),t.addEventListener("mouseenter",()=>{p(this,An,setTimeout(()=>{p(this,An,null),a(this,ss).classList.add("show"),a(this,cn)._reportTelemetry({action:"alt_text_tooltip"})},n))},{signal:s}),t.addEventListener("mouseleave",()=>{a(this,An)&&(clearTimeout(a(this,An)),p(this,An,null)),a(this,ss)?.classList.remove("show")},{signal:s})}a(this,rs)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=a(this,hi)),e.parentNode||t.append(e),a(this,cn).getElementForAltText()?.setAttribute("aria-describedby",e.id)},x(Vi,no,null),z(Vi,"_l10n",null);R0=Vi,Mu=class{constructor(t){x(this,pp);x(this,vi,null);x(this,rr,null);x(this,bl,!1);x(this,ye,null);x(this,fp,null);x(this,ro,null);x(this,sr,null);x(this,so,null);x(this,ao,!1);x(this,wl,null);p(this,ye,t)}renderForToolbar(){let t=p(this,rr,document.createElement("button"));return t.className="comment",b(this,pp,mb).call(this,t,!1)}renderForStandalone(){let t=p(this,vi,document.createElement("button"));t.className="annotationCommentButton";let e=a(this,ye).commentButtonPosition;if(e){let{style:i}=t;i.insetInlineEnd=`calc(${100*(a(this,ye)._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,ye).commentButtonColor;n&&(i.backgroundColor=n)}return b(this,pp,mb).call(this,t,!0)}focusButton(){setTimeout(()=>{(a(this,vi)??a(this,rr))?.focus()},0)}onUpdatedColor(){if(!a(this,vi))return;let t=a(this,ye).commentButtonColor;t&&(a(this,vi).style.backgroundColor=t),a(this,ye)._uiManager.updatePopupColor(a(this,ye))}get commentButtonWidth(){return(a(this,vi)?.getBoundingClientRect().width??0)/a(this,ye).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(a(this,wl))return a(this,wl);if(!a(this,vi))return null;let{x:t,y:e,height:i}=a(this,vi).getBoundingClientRect(),{x:n,y:s,width:o,height:l}=a(this,ye).parent.boundingClientRect;return[(t-n)/o,(e+i-s)/l]}set commentPopupPositionInLayer(t){p(this,wl,t)}hasDefaultPopupPosition(){return a(this,wl)===null}removeStandaloneCommentButton(){a(this,vi)?.remove(),p(this,vi,null)}removeToolbarCommentButton(){a(this,rr)?.remove(),p(this,rr,null)}setCommentButtonStates({selected:t,hasPopup:e}){a(this,vi)&&(a(this,vi).classList.toggle("selected",t),a(this,vi).ariaExpanded=e)}edit(t){let e=this.commentPopupPositionInLayer,i,n;if(e)[i,n]=e;else{[i,n]=a(this,ye).commentButtonPosition;let{width:h,height:d,x:f,y:m}=a(this,ye);i=f+i*h,n=m+n*d}let s=a(this,ye).parent.boundingClientRect,{x:o,y:l,width:c,height:u}=s;a(this,ye)._uiManager.editComment(a(this,ye),o+i*c,l+n*u,{...t,parentDimensions:s})}finish(){a(this,rr)&&(a(this,rr).focus({focusVisible:a(this,bl)}),p(this,bl,!1))}isDeleted(){return a(this,ao)||a(this,sr)===""}isEmpty(){return a(this,sr)===null}hasBeenEdited(){return this.isDeleted()||a(this,sr)!==a(this,fp)}serialize(){return this.data}get data(){return{text:a(this,sr),richText:a(this,ro),date:a(this,so),deleted:this.isDeleted()}}set data(t){if(t!==a(this,sr)&&p(this,ro,null),t===null){p(this,sr,""),p(this,ao,!0);return}p(this,sr,t),p(this,so,new Date),p(this,ao,!1)}restoreData({text:t,richText:e,date:i}){p(this,sr,t),p(this,ro,e),p(this,so,i),p(this,ao,!1)}setInitialText(t,e=null){p(this,fp,t),this.data=t,p(this,so,null),p(this,ro,e)}shown(){}destroy(){a(this,rr)?.remove(),p(this,rr,null),a(this,vi)?.remove(),p(this,vi,null),p(this,sr,""),p(this,ro,null),p(this,so,null),p(this,ye,null),p(this,bl,!1),p(this,ao,!1)}};vi=new WeakMap,rr=new WeakMap,bl=new WeakMap,ye=new WeakMap,fp=new WeakMap,ro=new WeakMap,sr=new WeakMap,so=new WeakMap,ao=new WeakMap,wl=new WeakMap,pp=new WeakSet,mb=function(t,e){if(!a(this,ye)._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,ye)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let i=a(this,ye)._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",Hn,{signal:i}),e&&(t.addEventListener("focusin",s=>{a(this,ye)._focusEventsAllowed=!1,Ie(s)},{capture:!0,signal:i}),t.addEventListener("focusout",s=>{a(this,ye)._focusEventsAllowed=!0,Ie(s)},{capture:!0,signal:i})),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:i});let n=s=>{s.preventDefault(),t===a(this,rr)?this.edit():a(this,ye).toggleComment(!0)};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(p(this,bl,!0),n(s))},{signal:i}),t.addEventListener("pointerenter",()=>{a(this,ye).toggleComment(!1,!0)},{signal:i}),t.addEventListener("pointerleave",()=>{a(this,ye).toggleComment(!1,!1)},{signal:i}),t};Rw=class Rw{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:n=null,onPinching:s=null,onPinchEnd:o=null,signal:l}){x(this,Bo);x(this,th);x(this,Al,!1);x(this,mp,null);x(this,gp);x(this,xp);x(this,yp);x(this,bp);x(this,Ys,null);x(this,vl);x(this,Ks,null);x(this,El);x(this,Zs,null);p(this,th,t),p(this,mp,i),p(this,gp,e),p(this,xp,n),p(this,yp,s),p(this,bp,o),p(this,El,new AbortController),p(this,vl,AbortSignal.any([l,a(this,El).signal])),t.addEventListener("touchstart",b(this,Bo,QC).bind(this),{passive:!1,signal:a(this,vl)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Es.pixelRatio}destroy(){a(this,El)?.abort(),p(this,El,null),a(this,Ys)?.abort(),p(this,Ys,null)}};th=new WeakMap,Al=new WeakMap,mp=new WeakMap,gp=new WeakMap,xp=new WeakMap,yp=new WeakMap,bp=new WeakMap,Ys=new WeakMap,vl=new WeakMap,Ks=new WeakMap,El=new WeakMap,Zs=new WeakMap,Bo=new WeakSet,QC=function(t){var n,s,o;if((n=a(this,gp))!=null&&n.call(this))return;if(t.touches.length===1){if(a(this,Ys))return;let l=p(this,Ys,new AbortController),c=AbortSignal.any([a(this,vl),l.signal]),u=a(this,th),h={capture:!0,signal:c,passive:!1},d=f=>{f.pointerType==="touch"&&(a(this,Ys)?.abort(),p(this,Ys,null))};u.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(Ie(f),d(f))},h),u.addEventListener("pointerup",d,h),u.addEventListener("pointercancel",d,h);return}if(!a(this,Zs)){p(this,Zs,new AbortController);let l=AbortSignal.any([a(this,vl),a(this,Zs).signal]),c=a(this,th),u={signal:l,capture:!1,passive:!1};c.addEventListener("touchmove",b(this,Bo,JC).bind(this),u);let h=b(this,Bo,tT).bind(this);c.addEventListener("touchend",h,u),c.addEventListener("touchcancel",h,u),u.capture=!0,c.addEventListener("pointerdown",Ie,u),c.addEventListener("pointermove",Ie,u),c.addEventListener("pointercancel",Ie,u),c.addEventListener("pointerup",Ie,u),(s=a(this,xp))==null||s.call(this)}if(Ie(t),t.touches.length!==2||(o=a(this,mp))!=null&&o.call(this)){p(this,Ks,null);return}let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]),p(this,Ks,{touch0X:e.screenX,touch0Y:e.screenY,touch1X:i.screenX,touch1Y:i.screenY})},JC=function(t){var I;if(!a(this,Ks)||t.touches.length!==2)return;Ie(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,Ks),{touch0X:u,touch0Y:h,touch1X:d,touch1Y:f}=c,m=d-u,y=f-h,g=o-n,A=l-s,w=Math.hypot(g,A)||1,v=Math.hypot(m,y)||1;if(!a(this,Al)&&Math.abs(v-w)<=Rw.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=n,c.touch0Y=s,c.touch1X=o,c.touch1Y=l,!a(this,Al)){p(this,Al,!0);return}let T=[(n+o)/2,(s+l)/2];(I=a(this,yp))==null||I.call(this,T,v,w)},tT=function(t){var e;t.touches.length>=2||(a(this,Zs)&&(a(this,Zs).abort(),p(this,Zs,null),(e=a(this,bp))==null||e.call(this)),a(this,Ks)&&(Ie(t),p(this,Ks,null),p(this,Al,!1)))};zf=Rw,Ft=class Ft{constructor(t){x(this,Dt);x(this,Cl,null);x(this,vr,null);x(this,ve,null);x(this,oe,null);x(this,Qs,null);x(this,eh,!1);x(this,oo,null);x(this,wp,"");x(this,Ei,null);x(this,Tl,null);x(this,Js,null);x(this,ar,null);x(this,lo,null);x(this,Ap,"");x(this,Sl,!1);x(this,vn,null);x(this,vp,!1);x(this,Dl,!1);x(this,ta,!1);x(this,ls,null);x(this,ih,0);x(this,nh,0);x(this,or,null);x(this,kl,null);z(this,"isSelected",!1);z(this,"_isCopy",!1);z(this,"_editToolbar",null);z(this,"_initialOptions",Object.create(null));z(this,"_initialData",null);z(this,"_isVisible",!0);z(this,"_uiManager",null);z(this,"_focusEventsAllowed",!0);x(this,Ep,!1);x(this,px,Ft._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=Ft.prototype._resizeWithKeyboard,e=Lo.TRANSLATE_SMALL,i=Lo.TRANSLATE_BIG;return Mt(this,"_resizerKeyboardManager",new Fc([[["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"],Ft.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 Mt(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new Eb({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(Ft._l10n??(Ft._l10n=t),Ft._l10nResizer||(Ft._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"})),Ft._borderLineWidth!==-1)return;let i=getComputedStyle(document.documentElement);Ft._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){ie("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return a(this,Ep)}set _isDraggable(t){p(this,Ep,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,px)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(b(this,Dt,df).call(this),a(this,ar)?.remove(),p(this,ar,null)),this.parent=t}focusin(t){this._focusEventsAllowed&&(a(this,Sl)?p(this,Sl,!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,Dt,gb).call(this,this.parentDimensions,t,e)}translateInPage(t,e){a(this,vn)||p(this,vn,[this.x,this.y,this.width,this.height]),b(this,Dt,gb).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){a(this,vn)||p(this,vn,[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,vn)&&(a(this,vn)[0]!==this.x||a(this,vn)[1]!==this.y)}get _hasBeenResized(){return!!a(this,vn)&&(a(this,vn)[2]!==this.width||a(this,vn)[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=Ft,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=oi(s,0,i-l),o=oi(o,0,n-c);break;case 90:s=oi(s,0,i-c),o=oi(o,l,n);break;case 180:s=oi(s,l,i),o=oi(o,c,n);break;case 270:s=oi(s,c,i),o=oi(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=Ft,Cp,xb).call(i,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var i;return b(i=Ft,Cp,xb).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,ve)?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||a(this,Dl))return this._editToolbar;this._editToolbar=new rb(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,ve)?.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,ve)||(R0.initialize(Ft._l10n),p(this,ve,new R0(this)),a(this,Cl)&&(a(this,ve).data=a(this,Cl),p(this,Cl,null))),a(this,ve)}get altTextData(){return a(this,ve)?.data}set altTextData(t){a(this,ve)&&(a(this,ve).data=t)}get guessedAltText(){return a(this,ve)?.guessedText}async setGuessedAltText(t){await a(this,ve)?.setGuessedText(t)}serializeAltText(t){return a(this,ve)?.serialize(t)}hasAltText(){return!!a(this,ve)&&!a(this,ve).isEmpty()}hasAltTextData(){return a(this,ve)?.hasData()??!1}focusCommentButton(){a(this,oe)?.focusButton()}addCommentButton(){return this.canAddComment?a(this,oe)||p(this,oe,new Mu(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(a(this,Qs)){this._uiManager.isEditingMode()&&a(this,Qs).classList.remove("hidden");return}this.hasComment&&(p(this,Qs,a(this,oe).renderForStandalone()),this.div.append(a(this,Qs)))}}removeStandaloneCommentButton(){a(this,oe).removeStandaloneCommentButton(),p(this,Qs,null)}hideStandaloneCommentButton(){a(this,Qs)?.classList.add("hidden")}get comment(){if(!a(this,oe))return null;let{data:{richText:t,text:e,date:i,deleted:n}}=a(this,oe);return{text:e,richText:t,date:i,deleted:n,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){a(this,oe)||p(this,oe,new Mu(this)),typeof t=="object"&&t!==null?a(this,oe).restoreData(t):a(this,oe).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,oe)||p(this,oe,new Mu(this)),a(this,oe).setInitialText(t,i),!this.annotationElementId))return;let n=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);n&&this.updateFromAnnotationLayer(n)}get hasEditedComment(){return a(this,oe)?.hasBeenEdited()}get hasDeletedComment(){return a(this,oe)?.isDeleted()}get hasComment(){return!!a(this,oe)&&!a(this,oe).isEmpty()&&!a(this,oe).isDeleted()}async editComment(t){a(this,oe)||p(this,oe,new Mu(this)),a(this,oe).edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){a(this,oe).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,oe).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,eh)?-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,Dt,Ab).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),LC(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(a(this,kl)||p(this,kl,new zf({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:b(this,Dt,nT).bind(this),onPinching:b(this,Dt,rT).bind(this),onPinchEnd:b(this,Dt,sT).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}pointerdown(t){let{isMac:e}=Be.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(p(this,Sl,!0),this._isDraggable){b(this,Dt,aT).call(this,t);return}b(this,Dt,wb).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){a(this,ls)&&clearTimeout(a(this,ls)),p(this,ls,setTimeout(()=>{p(this,ls,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,y=this.height*o;switch(i){case 0:return[d+u+l,o-f-h-y+c,d+u+m+l,o-f-h+c];case 90:return[d+h+l,o-f+u+c,d+h+y+l,o-f+u+m+c];case 180:return[d-u-m+l,o-f+h+c,d-u+l,o-f+h+y+c];case 270:return[d-h-y+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&&Ft._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){a(this,oe)?.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,Dl,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),p(this,Dl,!1),!0):!1}isInEditMode(){return a(this,Dl)}shouldGetKeyboardEvents(){return a(this,ta)}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 e0&&t0}rebuild(){b(this,Dt,Ab).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,Cl,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,lo)?.abort(),p(this,lo,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),a(this,ls)&&(clearTimeout(a(this,ls)),p(this,ls,null)),b(this,Dt,df).call(this),this.removeEditToolbar(),a(this,or)){for(let t of a(this,or).values())clearTimeout(t);p(this,or,null)}this.parent=null,a(this,kl)?.destroy(),p(this,kl,null),a(this,ar)?.remove(),p(this,ar,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,Dt,eT).call(this),a(this,Ei).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[Ft._round(i+(s-i)*t),Ft._round(n+(o-n)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return a(this,oe).commentPopupPositionInLayer}set commentPopupPosition(t){a(this,oe).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return a(this,oe).hasDefaultPopupPosition()}get commentButtonWidth(){return a(this,oe).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){a(this,oe)?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),p(this,Js,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let e=a(this,Ei).children;if(!a(this,vr)){p(this,vr,Array.from(e));let o=b(this,Dt,oT).bind(this),l=b(this,Dt,lT).bind(this),c=this._uiManager._signal;for(let u of a(this,vr)){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,Dt,cT).bind(this,h),{signal:c}),u.setAttribute("data-l10n-id",Ft._l10nResizer[h])}}let i=a(this,vr)[0],n=0;for(let o of e){if(o===i)break;n++}let s=(360-this.rotation+this.parentRotation)%360/90*(a(this,vr).length/4);if(s!==n){if(sn)for(let l=0;l{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),a(this,ve)?.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,Ei)?.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,ve)?.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,vp)}set isEditing(t){p(this,vp,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,or)||p(this,or,new Map);let{action:i}=t,n=a(this,or).get(i);n&&clearTimeout(n),n=setTimeout(()=>{this._reportTelemetry(t),a(this,or).delete(i),a(this,or).size===0&&p(this,or,null)},Ft._telemetryTimeout),a(this,or).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,eh,!1)}disable(){this.div&&(this.div.tabIndex=-1),p(this,eh,!0)}updateFakeAnnotationElement(t){if(!a(this,ar)&&!this.deleted){p(this,ar,t.addFakeAnnotation(this));return}if(this.deleted){a(this,ar).remove(),p(this,ar,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&a(this,ar).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()}};Cl=new WeakMap,vr=new WeakMap,ve=new WeakMap,oe=new WeakMap,Qs=new WeakMap,eh=new WeakMap,oo=new WeakMap,wp=new WeakMap,Ei=new WeakMap,Tl=new WeakMap,Js=new WeakMap,ar=new WeakMap,lo=new WeakMap,Ap=new WeakMap,Sl=new WeakMap,vn=new WeakMap,vp=new WeakMap,Dl=new WeakMap,ta=new WeakMap,ls=new WeakMap,ih=new WeakMap,nh=new WeakMap,or=new WeakMap,kl=new WeakMap,Ep=new WeakMap,px=new WeakMap,Dt=new WeakSet,gb=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()},Cp=new WeakSet,xb=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]}},Kg=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]}},eT=function(){if(a(this,Ei))return;p(this,Ei,document.createElement("div")),a(this,Ei).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,Ei).append(n),n.classList.add("resizer",i),n.setAttribute("data-resizer-name",i),n.addEventListener("pointerdown",b(this,Dt,iT).bind(this,i),{signal:e}),n.addEventListener("contextmenu",Hn,{signal:e}),n.tabIndex=-1}this.div.prepend(a(this,Ei))},iT=function(t,e){e.preventDefault();let{isMac:i}=Be.platform;if(e.button!==0||e.ctrlKey&&i)return;a(this,ve)?.toggle(!1);let n=this._isDraggable;this._isDraggable=!1,p(this,Tl,[e.screenX,e.screenY]);let s=new AbortController,o=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,Dt,bb).bind(this,t),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",Ie,{passive:!1,signal:o}),window.addEventListener("contextmenu",Hn,{signal:o}),p(this,Js,{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,ve)?.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=l,this.div.style.cursor=c,b(this,Dt,Zg).call(this)};window.addEventListener("pointerup",u,{signal:o}),window.addEventListener("blur",u,{signal:o})},yb=function(t,e,i,n){this.width=i,this.height=n,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()},Zg=function(){if(!a(this,Js))return;let{savedX:t,savedY:e,savedWidth:i,savedHeight:n}=a(this,Js);p(this,Js,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,Dt,yb).bind(this,s,o,l,c),undo:b(this,Dt,yb).bind(this,t,e,i,n),mustExec:!0})},bb=function(t,e){let[i,n]=this.parentDimensions,s=this.x,o=this.y,l=this.width,c=this.height,u=Ft.MIN_SIZE/i,h=Ft.MIN_SIZE/n,d=b(this,Dt,Kg).call(this,this.rotation),f=(O,C)=>[d[0]*O+d[2]*C,d[1]*O+d[3]*C],m=b(this,Dt,Kg).call(this,360-this.rotation),y=(O,C)=>[m[0]*O+m[2]*C,m[1]*O+m[3]*C],g,A,w=!1,v=!1;switch(t){case"topLeft":w=!0,g=(O,C)=>[0,0],A=(O,C)=>[O,C];break;case"topMiddle":g=(O,C)=>[O/2,0],A=(O,C)=>[O/2,C];break;case"topRight":w=!0,g=(O,C)=>[O,0],A=(O,C)=>[0,C];break;case"middleRight":v=!0,g=(O,C)=>[O,C/2],A=(O,C)=>[0,C/2];break;case"bottomRight":w=!0,g=(O,C)=>[O,C],A=(O,C)=>[0,0];break;case"bottomMiddle":g=(O,C)=>[O/2,C],A=(O,C)=>[O/2,0];break;case"bottomLeft":w=!0,g=(O,C)=>[0,C],A=(O,C)=>[O,0];break;case"middleLeft":v=!0,g=(O,C)=>[0,C/2],A=(O,C)=>[O,C/2];break}let T=g(l,c),I=A(l,c),_=f(...I),F=Ft._round(s+_[0]),L=Ft._round(o+_[1]),Y=1,q=1,G,j;if(e.fromKeyboard)({deltaX:G,deltaY:j}=e);else{let{screenX:O,screenY:C}=e,[D,E]=a(this,Tl);[G,j]=this.screenToPageTranslation(O-D,C-E),a(this,Tl)[0]=O,a(this,Tl)[1]=C}if([G,j]=y(G/i,j/n),w){let O=Math.hypot(l,c);Y=q=Math.max(Math.min(Math.hypot(I[0]-T[0]-G,I[1]-T[1]-j)/O,1/l,1/c),u/l,h/c)}else v?Y=oi(Math.abs(I[0]-T[0]-G),u,1)/l:q=oi(Math.abs(I[1]-T[1]-j),h,1)/c;let J=Ft._round(l*Y),et=Ft._round(c*q);_=f(...A(J,et));let N=F-_[0],X=L-_[1];a(this,vn)||p(this,vn,[this.x,this.y,this.width,this.height]),this.width=J,this.height=et,this.x=N,this.y=X,this.setDims(),this.fixAndSetPosition(),this._onResizing()},nT=function(){p(this,Js,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),a(this,ve)?.toggle(!1),this.parent.togglePointerEvents(!1)},rT=function(t,e,i){let s=.7*(i/e)+1-.7;if(s===1)return;let o=b(this,Dt,Kg).call(this,this.rotation),l=(F,L)=>[o[0]*F+o[2]*L,o[1]*F+o[3]*L],[c,u]=this.parentDimensions,h=this.x,d=this.y,f=this.width,m=this.height,y=Ft.MIN_SIZE/c,g=Ft.MIN_SIZE/u;s=Math.max(Math.min(s,1/f,1/m),y/f,g/m);let A=Ft._round(f*s),w=Ft._round(m*s);if(A===f&&w===m)return;a(this,vn)||p(this,vn,[h,d,f,m]);let v=l(f/2,m/2),T=Ft._round(h+v[0]),I=Ft._round(d+v[1]),_=l(A/2,w/2);this.x=T-_[0],this.y=I-_[1],this.width=A,this.height=w,this.setDims(),this.fixAndSetPosition(),this._onResizing()},sT=function(){a(this,ve)?.toggle(!0),this.parent.togglePointerEvents(!0),b(this,Dt,Zg).call(this)},wb=function(t){let{isMac:e}=Be.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},aT=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,oo,null),p(this,Sl,!1),this._uiManager.endDragSession()||b(this,Dt,wb).call(this,u),i&&this._onStopDragging()};e&&(p(this,ih,t.clientX),p(this,nh,t.clientY),p(this,oo,t.pointerId),p(this,wp,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,oo)){Ie(u);return}let[m,y]=this.screenToPageTranslation(h-a(this,ih),d-a(this,nh));p(this,ih,h),p(this,nh,d),this._uiManager.dragSelectedEditors(m,y)},o),window.addEventListener("touchmove",Ie,o),window.addEventListener("pointerdown",u=>{u.pointerType===a(this,wp)&&(a(this,kl)||u.isPrimary)&&l(u),Ie(u)},o));let c=u=>{if(!a(this,oo)||a(this,oo)===u.pointerId){l(u);return}Ie(u)};window.addEventListener("pointerup",c,{signal:s}),window.addEventListener("blur",c,{signal:s})},Ab=function(){if(a(this,lo)||!this.div)return;p(this,lo,new AbortController);let t=this._uiManager.combinedSignal(a(this,lo));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},oT=function(t){Ft._resizerKeyboardManager.exec(this,t)},lT=function(t){a(this,ta)&&t.relatedTarget?.parentNode!==a(this,Ei)&&b(this,Dt,df).call(this)},cT=function(t){p(this,Ap,a(this,ta)?t:"")},vb=function(t){if(a(this,vr))for(let e of a(this,vr))e.tabIndex=t},df=function(){p(this,ta,!1),b(this,Dt,vb).call(this,-1),b(this,Dt,Zg).call(this)},x(Ft,Cp),z(Ft,"_l10n",null),z(Ft,"_l10nResizer",null),z(Ft,"_borderLineWidth",-1),z(Ft,"_colorManager",new ub),z(Ft,"_zIndex",1),z(Ft,"_telemetryTimeout",1e3);be=Ft,Eb=class extends be{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},rC=3285377520,Zn=4294901760,Qr=65535,L0=class{constructor(t){this.h1=t?t&4294967295:rC,this.h2=t?t&4294967295:rC}update(t){let e,i;if(typeof t=="string"){e=new Uint8Array(t.length*2),i=0;for(let g=0,A=t.length;g>>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&Qr,y=f&Qr;for(let g=0;g>>17,l=l*f&Zn|l*y&Qr,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=o[g],c=c*d&Zn|c*m&Qr,c=c<<15|c>>>17,c=c*f&Zn|c*y&Qr,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&Zn|l*m&Qr,l=l<<15|l>>>17,l=l*f&Zn|l*y&Qr,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&Zn|t*36045&Qr,e=e*4283543511&Zn|((e<<16|t>>>16)*2950163797&Zn)>>>16,t^=e>>>1,t=t*444984403&Zn|t*60499&Qr,e=e*3301882366&Zn|((e<<16|t>>>16)*3120437893&Zn)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}},jf=Object.freeze({map:null,hash:"",transfer:void 0}),Hf=class{constructor(){x(this,mx);x(this,Il,!1);x(this,Nl,null);x(this,ea,null);x(this,Ci,new Map);z(this,"onSetModified",null);z(this,"onResetModified",null);z(this,"onAnnotationEditor",null)}getValue(t,e){let i=a(this,Ci).get(t);return i===void 0?e:Object.assign(e,i)}getRawValue(t){return a(this,Ci).get(t)}remove(t){let e=a(this,Ci).get(t);e!==void 0&&(e instanceof be&&a(this,ea).delete(e.annotationElementId),a(this,Ci).delete(t),a(this,Ci).size===0&&this.resetModified(),!a(this,Ci).values().some(i=>i instanceof be)&&this.onAnnotationEditor?.(null))}setValue(t,e){let i=a(this,Ci).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,Ci).set(t,e);n&&b(this,mx,uT).call(this),e instanceof be&&((a(this,ea)||p(this,ea,new Map)).set(e.annotationElementId,e),this.onAnnotationEditor?.(e.constructor._type))}has(t){return a(this,Ci).has(t)}get size(){return a(this,Ci).size}resetModified(){a(this,Il)&&(p(this,Il,!1),this.onResetModified?.())}get print(){return new B0(this)}get serializable(){if(a(this,Ci).size===0)return jf;let t=new Map,e=new L0,i=[],n=Object.create(null),s=!1;for(let[o,l]of a(this,Ci)){let c=l instanceof be?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}:jf}get editorStats(){let t=null,e=new Map,i=0,n=0;for(let s of a(this,Ci).values()){if(!(s instanceof be)){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,Rx);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,Nl,null)}updateEditor(t,e){let i=a(this,ea)?.get(t);return i?(i.updateFromAnnotationLayer(e),!0):!1}getEditor(t){return a(this,ea)?.get(t)||null}get modifiedIds(){if(a(this,Nl))return a(this,Nl);let t=[];if(a(this,ea))for(let e of a(this,ea).values())e.serialize()&&t.push(e.annotationElementId);return p(this,Nl,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return a(this,Ci).entries()}};Il=new WeakMap,Nl=new WeakMap,ea=new WeakMap,Ci=new WeakMap,mx=new WeakSet,uT=function(){a(this,Il)||(p(this,Il,!0),this.onSetModified?.())};B0=class extends Hf{constructor(e){super();x(this,Tp,jf);let{serializable:i}=e;if(i===jf)return;let{map:n,hash:s,transfer:o}=i,l=structuredClone(n,o?{transfer:o}:null);p(this,Tp,{map:l,hash:s,transfer:[]})}get print(){ie("Should not call PrintAnnotationStorage.print")}get serializable(){return a(this,Tp)}get modifiedIds(){return Mt(this,"modifiedIds",{ids:new Set,hash:""})}};Tp=new WeakMap;Au="__forcedDependency",{floor:sC,ceil:aC}=Math;Cb=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],Tb=class{constructor(t,e){x(this,rh);x(this,co);p(this,rh,t),p(this,co,e)}get length(){return a(this,rh).length}isEmpty(t){return a(this,rh)[t]===Cb}minX(t){return a(this,co)[t*4+0]/256}minY(t){return a(this,co)[t*4+1]/256}maxX(t){return(a(this,co)[t*4+2]+1)/256}maxY(t){return(a(this,co)[t*4+3]+1)/256}};rh=new WeakMap,co=new WeakMap;lC=(r,t)=>r?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),Sb=class{constructor(t,e){x(this,Sp);x(this,ia,[[1,0,0,1,0,0]]);x(this,ee,[-1/0,-1/0,1/0,1/0]);x(this,ue,new Float64Array([1/0,1/0,-1/0,-1/0]));z(this,"_pendingBBoxIdx",-1);x(this,_l);x(this,Ml);x(this,Fl);x(this,Li);z(this,"_savesStack",[]);z(this,"_markedContentStack",[]);p(this,_l,t.width),p(this,Ml,t.height),b(this,Sp,Db).call(this,e)}growOperationsCount(t){t>=a(this,Li).length&&b(this,Sp,Db).call(this,t,a(this,Li))}get clipBox(){return a(this,ee)}save(t){return p(this,ee,{__proto__:a(this,ee)}),this._savesStack.push(t),this}restore(t,e){let i=Object.getPrototypeOf(a(this,ee));if(i===null)return this;p(this,ee,i);let n=this._savesStack.pop();return n!==void 0&&(e?.(n,t),a(this,Li)[t]=a(this,Li)[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,Li)[t]=a(this,Li)[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,Li)[t]=a(this,Li)[i]),this}pushBaseTransform(t){return a(this,ia).push(ht.multiplyByDOMMatrix(a(this,ia).at(-1),t.getTransform())),this}popBaseTransform(){return a(this,ia).length>1&&a(this,ia).pop(),this}resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,a(this,ue)[0]=1/0,a(this,ue)[1]=1/0,a(this,ue)[2]=-1/0,a(this,ue)[3]=-1/0),this}recordClipBox(t,e,i,n,s,o){let l=ht.multiplyByDOMMatrix(a(this,ia).at(-1),e.getTransform()),c=[1/0,1/0,-1/0,-1/0];ht.axialAlignedBoundingBox([i,s,n,o],l,c);let u=ht.intersect(a(this,ee),c);return u?(a(this,ee)[0]=u[0],a(this,ee)[1]=u[1],a(this,ee)[2]=u[2],a(this,ee)[3]=u[3]):(a(this,ee)[0]=a(this,ee)[1]=1/0,a(this,ee)[2]=a(this,ee)[3]=-1/0),this}recordBBox(t,e,i,n,s,o){let l=a(this,ee);if(l[0]===1/0)return this;let c=ht.multiplyByDOMMatrix(a(this,ia).at(-1),e.getTransform());if(l[0]===-1/0)return ht.axialAlignedBoundingBox([i,s,n,o],c,a(this,ue)),this;let u=[1/0,1/0,-1/0,-1/0];return ht.axialAlignedBoundingBox([i,s,n,o],c,u),a(this,ue)[0]=Math.min(a(this,ue)[0],Math.max(u[0],l[0])),a(this,ue)[1]=Math.min(a(this,ue)[1],Math.max(u[1],l[1])),a(this,ue)[2]=Math.max(a(this,ue)[2],Math.min(u[2],l[2])),a(this,ue)[3]=Math.max(a(this,ue)[3],Math.min(u[3],l[3])),this}recordFullPageBBox(t){return a(this,ue)[0]=Math.max(0,a(this,ee)[0]),a(this,ue)[1]=Math.max(0,a(this,ee)[1]),a(this,ue)[2]=Math.min(a(this,_l),a(this,ee)[2]),a(this,ue)[3]=Math.min(a(this,Ml),a(this,ee)[3]),this}recordOperation(t,e=!1,i){if(this._pendingBBoxIdx!==t)return this;let n=sC(a(this,ue)[0]*256/a(this,_l)),s=sC(a(this,ue)[1]*256/a(this,Ml)),o=aC(a(this,ue)[2]*256/a(this,_l)),l=aC(a(this,ue)[3]*256/a(this,Ml));if(oC(a(this,Fl),t,n,s,o,l),i)for(let c of i)for(let u of c)u!==t&&oC(a(this,Fl),u,n,s,o,l);return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,a(this,ee)[0]=Math.max(a(this,ee)[0],a(this,ue)[0]),a(this,ee)[1]=Math.max(a(this,ee)[1],a(this,ue)[1]),a(this,ee)[2]=Math.min(a(this,ee)[2],a(this,ue)[2]),a(this,ee)[3]=Math.min(a(this,ee)[3],a(this,ue)[3])),this}take(){return new Tb(a(this,Li),a(this,Fl))}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}};ia=new WeakMap,ee=new WeakMap,ue=new WeakMap,_l=new WeakMap,Ml=new WeakMap,Fl=new WeakMap,Li=new WeakMap,Sp=new WeakSet,Db=function(t,e){let i=new ArrayBuffer(t*4);p(this,Fl,new Uint8ClampedArray(i)),p(this,Li,new Uint32Array(i)),e&&e.length>0?(a(this,Li).set(e),a(this,Li).fill(Cb,e.length)):a(this,Li).fill(Cb)};kb=class{constructor(t,e=!1){x(this,un,{__proto__:null});x(this,hn,{__proto__:null,transform:[],moveText:[],sameLineText:[],[Au]:[]});x(this,Pl,new Map);x(this,Er,new Set);x(this,sh,new Map);x(this,uo);x(this,ho);x(this,he);p(this,he,t),e&&(p(this,uo,new Map),p(this,ho,(i,n)=>{lC(a(this,uo),n).dependencies.add(i)}))}get clipBox(){return a(this,he).clipBox}growOperationsCount(t){a(this,he).growOperationsCount(t)}save(t){return p(this,un,{__proto__:a(this,un)}),p(this,hn,{__proto__:a(this,hn),transform:{__proto__:a(this,hn).transform},moveText:{__proto__:a(this,hn).moveText},sameLineText:{__proto__:a(this,hn).sameLineText},[Au]:{__proto__:a(this,hn)[Au]}}),a(this,he).save(t),this}restore(t){a(this,he).restore(t,a(this,ho));let e=Object.getPrototypeOf(a(this,un));return e===null?this:(p(this,un,e),p(this,hn,Object.getPrototypeOf(a(this,hn))),this)}recordOpenMarker(t){return a(this,he).recordOpenMarker(t,a(this,ho)),this}getOpenMarker(){return a(this,he).getOpenMarker()}recordCloseMarker(t){return a(this,he).recordCloseMarker(t,a(this,ho)),this}beginMarkedContent(t){return a(this,he).beginMarkedContent(t),this}endMarkedContent(t){return a(this,he).endMarkedContent(t,a(this,ho)),this}pushBaseTransform(t){return a(this,he).pushBaseTransform(t),this}popBaseTransform(){return a(this,he).popBaseTransform(),this}recordSimpleData(t,e){return a(this,un)[t]=e,this}recordIncrementalData(t,e){return a(this,hn)[t].push(e),this}resetIncrementalData(t,e){return a(this,hn)[t].length=0,this}recordNamedData(t,e){return a(this,Pl).set(t,e),this}recordSimpleDataFromNamed(t,e,i){a(this,un)[t]=a(this,Pl).get(e)??i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(Au,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(let e of t)e in a(this,un)&&this.recordFutureForcedDependency(e,a(this,un)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let t of a(this,Er))this.recordFutureForcedDependency(Au,t);return this}resetBBox(t){return a(this,he).resetBBox(t),this}recordClipBox(t,e,i,n,s,o){return a(this,he).recordClipBox(t,e,i,n,s,o),this}recordBBox(t,e,i,n,s,o){return a(this,he).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,sh).get(i),u!==!1&&(h=[0,0,0,0],ht.axialAlignedBoundingBox(c,i.fontMatrix,h),(n!==1||s!==0||o!==0)&&ht.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,sh).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,he).recordFullPageBBox(t),this}getSimpleIndex(t){return a(this,un)[t]}recordDependencies(t,e){let i=a(this,Er),n=a(this,un),s=a(this,hn);for(let o of e)o in a(this,un)?i.add(n[o]):o in s&&s[o].forEach(i.add,i);return this}recordNamedDependency(t,e){return a(this,Pl).has(e)&&a(this,Er).add(a(this,Pl).get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[Au]),a(this,uo)){let n=lC(a(this,uo),t),{dependencies:s}=n;a(this,Er).forEach(s.add,s),a(this,he)._savesStack.forEach(s.add,s),a(this,he)._markedContentStack.forEach(s.add,s),s.delete(t),n.isRenderingOperation=!0}let i=!e&&t===a(this,he)._pendingBBoxIdx;return a(this,he).recordOperation(t,e,[a(this,Er),a(this,he)._savesStack,a(this,he)._markedContentStack]),i&&a(this,Er).clear(),this}recordShowTextOperation(t,e=!1){let i=Array.from(a(this,Er));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,he)._pendingBBoxIdx;return a(this,he).bboxToClipBoxDropOperation(t),i&&a(this,Er).clear(),this}take(){return a(this,sh).clear(),a(this,he).take()}takeDebugMetadata(){return a(this,uo)}};un=new WeakMap,hn=new WeakMap,Pl=new WeakMap,Er=new WeakMap,sh=new WeakMap,uo=new WeakMap,ho=new WeakMap,he=new WeakMap;Lw=class Lw{constructor(t,e,i){x(this,de);x(this,Oe);x(this,Cr);x(this,ah,0);x(this,oh,0);if(t instanceof Lw&&a(t,Cr)===!!i)return t;p(this,de,t),p(this,Oe,e),p(this,Cr,!!i)}get clipBox(){return a(this,de).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(t){return Ye(this,oh)._++,a(this,de).save(a(this,Oe)),this}restore(t){return a(this,oh)>0&&(a(this,de).restore(a(this,Oe)),Ye(this,oh)._--),this}recordOpenMarker(t){return Ye(this,ah)._++,this}getOpenMarker(){return a(this,ah)>0?a(this,Oe):a(this,de).getOpenMarker()}recordCloseMarker(t){return Ye(this,ah)._--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return a(this,de).pushBaseTransform(t),this}popBaseTransform(){return a(this,de).popBaseTransform(),this}recordSimpleData(t,e){return a(this,de).recordSimpleData(t,a(this,Oe)),this}recordIncrementalData(t,e){return a(this,de).recordIncrementalData(t,a(this,Oe)),this}resetIncrementalData(t,e){return a(this,de).resetIncrementalData(t,a(this,Oe)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return a(this,de).recordSimpleDataFromNamed(t,e,a(this,Oe)),this}recordFutureForcedDependency(t,e){return a(this,de).recordFutureForcedDependency(t,a(this,Oe)),this}inheritSimpleDataAsFutureForcedDependencies(t){return a(this,de).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return a(this,de).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return a(this,Cr)||a(this,de).resetBBox(a(this,Oe)),this}recordClipBox(t,e,i,n,s,o){return a(this,Cr)||a(this,de).recordClipBox(a(this,Oe),e,i,n,s,o),this}recordBBox(t,e,i,n,s,o){return a(this,Cr)||a(this,de).recordBBox(a(this,Oe),e,i,n,s,o),this}recordCharacterBBox(t,e,i,n,s,o,l){return a(this,Cr)||a(this,de).recordCharacterBBox(a(this,Oe),e,i,n,s,o,l),this}recordFullPageBBox(t){return a(this,Cr)||a(this,de).recordFullPageBBox(a(this,Oe)),this}getSimpleIndex(t){return a(this,de).getSimpleIndex(t)}recordDependencies(t,e){return a(this,de).recordDependencies(a(this,Oe),e),this}recordNamedDependency(t,e){return a(this,de).recordNamedDependency(a(this,Oe),e),this}recordOperation(t){return a(this,de).recordOperation(a(this,Oe),!0),this}recordShowTextOperation(t){return a(this,de).recordShowTextOperation(a(this,Oe),!0),this}bboxToClipBoxDropOperation(t){return a(this,Cr)||a(this,de).bboxToClipBoxDropOperation(a(this,Oe),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};de=new WeakMap,Oe=new WeakMap,Cr=new WeakMap,ah=new WeakMap,oh=new WeakMap;U0=Lw,Qn={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"]},Pf=class Pf{constructor(t){x(this,Ol);x(this,Rl);x(this,Ll,4);x(this,Bl,0);x(this,Ul,new(a(Pf,Dp))(a(this,Ll)*6));p(this,Ol,t.width),p(this,Rl,t.height)}record(t,e,i,n){if(a(this,Bl)===a(this,Ll)){p(this,Ll,a(this,Ll)*2);let l=new(a(Pf,Dp))(a(this,Ll)*6);l.set(a(this,Ul)),p(this,Ul,l)}let s=ht.domMatrixToTransform(t.getTransform()),o;if(n[0]!==1/0){let l=[1/0,1/0,-1/0,-1/0];ht.axialAlignedBoundingBox([0,-i,e,0],s,l);let c=ht.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]),y=Math.abs(Math.sin(m)),g=Math.abs(Math.cos(m));if(y<1e-6||g<1e-6||Math.abs(y-g)<1e-6)o=[u,h,u,f,d,h];else{let A=d-u,w=f-h,v=y*y,T=g*g,I=g*y,_=T-v,F=(w*T-A*I)/_,L=(w*I-A*v)/_;o=[u+L,h,u,h+F,d,f-F]}}}o||(o=[0,-i,0,0,e,-i],ht.applyTransform(o,s,0),ht.applyTransform(o,s,2),ht.applyTransform(o,s,4)),o[0]/=a(this,Ol),o[1]/=a(this,Rl),o[2]/=a(this,Ol),o[3]/=a(this,Rl),o[4]/=a(this,Ol),o[5]/=a(this,Rl),a(this,Ul).set(o,a(this,Bl)*6),Ye(this,Bl)._++}take(){return a(this,Ul).subarray(0,a(this,Bl)*6)}};Ol=new WeakMap,Rl=new WeakMap,Ll=new WeakMap,Bl=new WeakMap,Ul=new WeakMap,Dp=new WeakMap,x(Pf,Dp,Be.isFloat16ArraySupported?Float16Array:Float32Array);Ib=Pf,Nb=class{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){x(this,lh,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,lh).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:i}){if(!(!t||a(this,lh).has(t.loadedName))){if(Ne(!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,lh).add(n),i?.(t)}catch{Pt(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}ie("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 Pt(`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 Mt(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return Mt(this,"isSyncFontLoadingSupported",Bn||Be.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(Ne(!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 Mt(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function i(I,_){return I.charCodeAt(_)<<24|I.charCodeAt(_+1)<<16|I.charCodeAt(_+2)<<8|I.charCodeAt(_+3)&255}function n(I,_,F,L){let Y=I.substring(0,_),q=I.substring(_+F);return Y+L+q}let s,o,l=this._document.createElement("canvas");l.width=1,l.height=1;let c=l.getContext("2d"),u=0;function h(I,_){if(++u>30){Pt("Load test font never loaded."),_();return}if(c.font="30px "+I,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){_();return}setTimeout(h.bind(null,I,_))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=n(f,976,d.length,d);let y=16,g=1482184792,A=i(f,y);for(s=0,o=d.length-3;s{T.remove(),e.complete()})}};lh=new WeakMap;_b=class{constructor(t,e=null,i,n){z(this,"compiledGlyphs",Object.create(null));x(this,fe);p(this,fe,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){Pt(`getPathGenerator - ignoring character: "${o}".`)}let s=_C(n?.path);return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=s}get black(){return a(this,fe).black}get bold(){return a(this,fe).bold}get disableFontFace(){return a(this,fe).disableFontFace}set disableFontFace(t){Mt(this,"disableFontFace",!!t)}get fontExtraProperties(){return a(this,fe).fontExtraProperties}get isInvalidPDFjsFont(){return a(this,fe).isInvalidPDFjsFont}get isType3Font(){return a(this,fe).isType3Font}get italic(){return a(this,fe).italic}get missingFile(){return a(this,fe).missingFile}get remeasure(){return a(this,fe).remeasure}get vertical(){return a(this,fe).vertical}get ascent(){return a(this,fe).ascent}get defaultWidth(){return a(this,fe).defaultWidth}get descent(){return a(this,fe).descent}get bbox(){return a(this,fe).bbox}get fontMatrix(){return a(this,fe).fontMatrix}get fallbackName(){return a(this,fe).fallbackName}get loadedName(){return a(this,fe).loadedName}get mimetype(){return a(this,fe).mimetype}get name(){return a(this,fe).name}get data(){return a(this,fe).data}clearData(){a(this,fe).clearData()}get cssFontInfo(){return a(this,fe).cssFontInfo}get systemFontInfo(){return a(this,fe).systemFontInfo}get defaultVMetrics(){return a(this,fe).defaultVMetrics}};fe=new WeakMap;Qg=class{};z(Qg,"strings",["fontFamily","fontWeight","italicAngle"]);Jg=class{};z(Jg,"strings",["css","loadedName","baseFontName","src"]);Pi=class Pi{};z(Pi,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),z(Pi,"numbers",["ascent","defaultWidth","descent"]),z(Pi,"strings",["fallbackName","loadedName","mimetype","name"]),z(Pi,"OFFSET_NUMBERS",Math.ceil(Pi.bools.length*2/8)),z(Pi,"OFFSET_BBOX",Pi.OFFSET_NUMBERS+Pi.numbers.length*8),z(Pi,"OFFSET_FONT_MATRIX",Pi.OFFSET_BBOX+1+8),z(Pi,"OFFSET_DEFAULT_VMETRICS",Pi.OFFSET_FONT_MATRIX+1+48),z(Pi,"OFFSET_STRINGS",Pi.OFFSET_DEFAULT_VMETRICS+1+6);yn=Pi,yi=class{};z(yi,"KIND",0),z(yi,"HAS_BBOX",1),z(yi,"HAS_BACKGROUND",2),z(yi,"SHADING_TYPE",3),z(yi,"N_COORD",4),z(yi,"N_COLOR",8),z(yi,"N_STOP",12),z(yi,"N_FIGURES",16);Mb=class{constructor(t){x(this,uh);x(this,kp);x(this,gx,new TextDecoder);x(this,ch);p(this,kp,t),p(this,ch,new DataView(t))}get fontFamily(){return b(this,uh,t0).call(this,0)}get fontWeight(){return b(this,uh,t0).call(this,1)}get italicAngle(){return b(this,uh,t0).call(this,2)}};kp=new WeakMap,gx=new WeakMap,ch=new WeakMap,uh=new WeakSet,t0=function(t){Ne(t>i&3;return n===0?void 0:n===2},e0=function(t){return Ne(t0){w=[1/0,1/0,-1/0,-1/0];for(let v=0,T=h.length;vtypeof r=="object"&&Number.isInteger(r?.num)&&r.num>=0&&Number.isInteger(r?.gen)&&r.gen>=0,sM=r=>typeof r=="object"&&typeof r?.name=="string",hT=tM.bind(null,Bb,sM),Ub=class{constructor(){x(this,na,new Map);x(this,yx,Promise.resolve())}postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};a(this,yx).then(()=>{for(let[n]of a(this,na))n.call(this,i)})}addEventListener(t,e,i=null){let n=null;if(i?.signal instanceof AbortSignal){let{signal:s}=i;if(s.aborted){Pt("LoopbackPort - cannot use an `aborted` signal.");return}let o=()=>this.removeEventListener(t,e);n=()=>s.removeEventListener("abort",o),s.addEventListener("abort",o)}a(this,na).set(e,n)}removeEventListener(t,e){a(this,na).get(e)?.(),a(this,na).delete(e)}terminate(){for(let[,t]of a(this,na))t?.();a(this,na).clear()}};na=new WeakMap,yx=new WeakMap;Bg={DATA:1,ERROR:2},Ze={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};hl=class{constructor(t,e,i){x(this,mr);x(this,fh,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,mr,dT).bind(this),{signal:a(this,fh).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:Ze.PULL,streamId:s,desiredSize:u.desiredSize}),h.promise},cancel:u=>{Ne(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:Ze.CANCEL,streamId:s,reason:on(u)}),h.promise}},i)}destroy(){a(this,fh)?.abort(),p(this,fh,null)}};fh=new WeakMap,mr=new WeakSet,dT=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){b(this,mr,pT).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===Bg.DATA)n.resolve(t.data);else if(t.callback===Bg.ERROR)n.reject(on(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:Bg.DATA,callbackId:t.callbackId,data:o})},function(o){s.postMessage({sourceName:i,targetName:n,callback:Bg.ERROR,callbackId:t.callbackId,reason:on(o)})});return}if(t.streamId){b(this,mr,fT).call(this,t);return}e(t.data)},fT=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:Ze.ENQUEUE,streamId:e,chunk:u},d)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:Ze.CLOSE,streamId:e}),delete o.streamSinks[e])},error(u){Ne(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:Ze.ERROR,streamId:e,reason:on(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:Ze.START_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:Ze.START_COMPLETE,streamId:e,reason:on(u)})})},pT=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 Ze.START_COMPLETE:t.success?o.startCall.resolve():o.startCall.reject(on(t.reason));break;case Ze.PULL_COMPLETE:t.success?o.pullCall.resolve():o.pullCall.reject(on(t.reason));break;case Ze.PULL:if(!l){s.postMessage({sourceName:i,targetName:n,stream:Ze.PULL_COMPLETE,streamId:e,success:!0});break}l.desiredSize<=0&&t.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=t.desiredSize,Promise.try(l.onPull||cC).then(function(){s.postMessage({sourceName:i,targetName:n,stream:Ze.PULL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:Ze.PULL_COMPLETE,streamId:e,reason:on(u)})});break;case Ze.ENQUEUE:if(Ne(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(t.chunk);break;case Ze.CLOSE:if(Ne(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),b(this,mr,n0).call(this,o,e);break;case Ze.ERROR:Ne(o,"error should have stream controller"),o.controller.error(on(t.reason)),b(this,mr,n0).call(this,o,e);break;case Ze.CANCEL_COMPLETE:t.success?o.cancelCall.resolve():o.cancelCall.reject(on(t.reason)),b(this,mr,n0).call(this,o,e);break;case Ze.CANCEL:if(!l)break;let c=on(t.reason);Promise.try(l.onCancel||cC,c).then(function(){s.postMessage({sourceName:i,targetName:n,stream:Ze.CANCEL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:Ze.CANCEL_COMPLETE,streamId:e,reason:on(u)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},n0=async function(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]};z0=class{constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:i=null}){x(this,bx,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:ie(`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,bx)[t]} data at: ${n}`)})}async _fetch(t,e){ie("Abstract method `_fetch` called.")}};bx=new WeakMap;j0=class extends z0{async _fetch(t,e){let i=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",n=await Lx(t,i);return n instanceof Uint8Array?n:Px(n)}},H0=class{constructor({enableHWA:t=!1}){x(this,Ip,!1);p(this,Ip,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,Ip)})}}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){ie("Abstract method `_createCanvas` called.")}};Ip=new WeakMap;zb=class extends H0{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}},G0=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){}},jb=class extends G0{constructor({docId:e,ownerDocument:i=globalThis.document}){super();x(this,yt);x(this,Hl);x(this,ph);x(this,ra);x(this,sa);x(this,Bi);x(this,Gl);x(this,$l,0);p(this,sa,e),p(this,Bi,i)}addFilter(e){if(!e)return"none";let i=a(this,yt,Fi).get(e);if(i)return i;let[n,s,o]=b(this,yt,r0).call(this,e),l=e.length===1?n:`${n}${s}${o}`;if(i=a(this,yt,Fi).get(l),i)return a(this,yt,Fi).set(e,i),i;let c=`g_${a(this,sa)}_transfer_map_${Ye(this,$l)._++}`,u=b(this,yt,Tu).call(this,c);a(this,yt,Fi).set(e,u),a(this,yt,Fi).set(l,u);let h=b(this,yt,Su).call(this,c);return b(this,yt,xf).call(this,n,s,o,h),u}addHCMFilter(e,i){let n=`${e}-${i}`,s="base",o=a(this,yt,mf).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,yt,mf).set(s,o)),!e||!i))return o.url;let l=b(this,yt,yf).call(this,e);e=ht.makeHexColor(...l);let c=b(this,yt,yf).call(this,i);if(i=ht.makeHexColor(...c),a(this,yt,Cu).style.color="",e==="#000000"&&i==="#ffffff"||e===i)return o.url;let u=new Array(256);for(let y=0;y<=255;y++){let g=y/255;u[y]=g<=.03928?g/12.92:((g+.055)/1.055)**2.4}let h=u.join(","),d=`g_${a(this,sa)}_hcm_filter`,f=o.filter=b(this,yt,Su).call(this,d);b(this,yt,xf).call(this,h,h,h,f),b(this,yt,Hb).call(this,f);let m=(y,g)=>{let A=l[y]/255,w=c[y]/255,v=new Array(g+1);for(let T=0;T<=g;T++)v[T]=A+T/g*(w-A);return v.join(",")};return b(this,yt,xf).call(this,m(0,5),m(1,5),m(2,5),f),o.url=b(this,yt,Tu).call(this,d),o.url}addAlphaFilter(e){let i=a(this,yt,Fi).get(e);if(i)return i;let[n]=b(this,yt,r0).call(this,[e]),s=`alpha_${n}`;if(i=a(this,yt,Fi).get(s),i)return a(this,yt,Fi).set(e,i),i;let o=`g_${a(this,sa)}_alpha_map_${Ye(this,$l)._++}`,l=b(this,yt,Tu).call(this,o);a(this,yt,Fi).set(e,l),a(this,yt,Fi).set(s,l);let c=b(this,yt,Su).call(this,o);return b(this,yt,Gb).call(this,n,c),l}addLuminosityFilter(e){let i=a(this,yt,Fi).get(e||"luminosity");if(i)return i;let n,s;if(e?([n]=b(this,yt,r0).call(this,[e]),s=`luminosity_${n}`):s="luminosity",i=a(this,yt,Fi).get(s),i)return a(this,yt,Fi).set(e,i),i;let o=`g_${a(this,sa)}_luminosity_map_${Ye(this,$l)._++}`,l=b(this,yt,Tu).call(this,o);a(this,yt,Fi).set(e,l),a(this,yt,Fi).set(s,l);let c=b(this,yt,Su).call(this,o);return b(this,yt,mT).call(this,c),e&&b(this,yt,Gb).call(this,n,c),l}addHighlightHCMFilter(e,i,n,s,o){let l=`${i}-${n}-${s}-${o}`,c=a(this,yt,mf).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,yt,mf).set(e,c)),!i||!n))return c.url;let[u,h]=[i,n].map(b(this,yt,yf).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,y]=[s,o].map(b(this,yt,yf).bind(this));f{let _=new Array(256),F=(f-d)/I,L=v/255,Y=(T-v)/(255*I),q=0;for(let G=0;G<=I;G++){let j=Math.round(d+G*F),J=L+G*Y;for(let et=q;et<=j;et++)_[et]=J;q=j+1}for(let G=q;G<256;G++)_[G]=_[q-1];return _.join(",")},A=`g_${a(this,sa)}_hcm_${e}_filter`,w=c.filter=b(this,yt,Su).call(this,A);return b(this,yt,Hb).call(this,w),b(this,yt,xf).call(this,g(m[0],y[0],5),g(m[1],y[1],5),g(m[2],y[2],5),w),c.url=b(this,yt,Tu).call(this,A),c.url}destroy(e=!1){e&&a(this,Gl)?.size||(a(this,ra)?.parentNode.parentNode.remove(),p(this,ra,null),a(this,ph)?.clear(),p(this,ph,null),a(this,Gl)?.clear(),p(this,Gl,null),p(this,$l,0))}};Hl=new WeakMap,ph=new WeakMap,ra=new WeakMap,sa=new WeakMap,Bi=new WeakMap,Gl=new WeakMap,$l=new WeakMap,yt=new WeakSet,Fi=function(){return a(this,ph)||p(this,ph,new Map)},mf=function(){return a(this,Gl)||p(this,Gl,new Map)},Cu=function(){if(!a(this,ra)){let e=a(this,Bi).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,Bi).createElementNS(Us,"svg");n.setAttribute("width",0),n.setAttribute("height",0),p(this,ra,a(this,Bi).createElementNS(Us,"defs")),e.append(n),n.append(a(this,ra)),a(this,Bi).body.append(e)}return a(this,ra)},r0=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(",")]},Tu=function(e){if(a(this,Hl)===void 0){p(this,Hl,"");let i=a(this,Bi).URL;i!==a(this,Bi).baseURI&&(Gm(i)?Pt('#createUrl: ignore "data:"-URL for performance reasons.'):p(this,Hl,_w(i,"")))}return`url(${a(this,Hl)}#${e})`},mT=function(e){let i=a(this,Bi).createElementNS(Us,"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)},Hb=function(e){let i=a(this,Bi).createElementNS(Us,"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)},Su=function(e){let i=a(this,Bi).createElementNS(Us,"filter");return i.setAttribute("color-interpolation-filters","sRGB"),i.setAttribute("id",e),a(this,yt,Cu).append(i),i},gf=function(e,i,n){let s=a(this,Bi).createElementNS(Us,i);s.setAttribute("type","discrete"),s.setAttribute("tableValues",n),e.append(s)},xf=function(e,i,n,s){let o=a(this,Bi).createElementNS(Us,"feComponentTransfer");s.append(o),b(this,yt,gf).call(this,o,"feFuncR",e),b(this,yt,gf).call(this,o,"feFuncG",i),b(this,yt,gf).call(this,o,"feFuncB",n)},Gb=function(e,i){let n=a(this,Bi).createElementNS(Us,"feComponentTransfer");i.append(n),b(this,yt,gf).call(this,n,"feFuncA",e)},yf=function(e){return a(this,yt,Cu).style.color=e,Ad(getComputedStyle(a(this,yt,Cu)).getPropertyValue("color"))};Bn&&Pt("Please use the `legacy` build in Node.js environments.");$b=class extends G0{},Vb=class extends H0{_createCanvas(t,e){return it.default.getBuiltinModule("module").createRequire("")("@napi-rs/canvas").createCanvas(t,e)}},qb=class extends z0{async _fetch(t,e){return aM(t)}},oM=` struct Uniforms { offsetX : f32, offsetY : f32, @@ -55,47 +55,47 @@ fn vs_main(in : VertexInput) -> VertexOutput { fn fs_main(in : VertexOutput) -> @location(0) vec4 { return vec4(in.color, 1.0); } -`,Wb=class{constructor(){x(this,bd);x(this,_p,null);x(this,mh,null);x(this,gh,null);x(this,xh,null)}init(){a(this,_p)===null&&p(this,_p,b(this,bd,gT).call(this))}get isReady(){return a(this,mh)!==null}draw(t,e,i,n,s,o){let l=a(this,mh),{offsetX:c,offsetY:u,scaleX:h,scaleY:d}=e,{posData:f,colData:m,vertexCount:y}=b(this,bd,xT).call(this,t,e),g=l.createBuffer({size:Math.max(f.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});f.byteLength>0&&l.queue.writeBuffer(g,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,gh).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:w}}]}),T=new OffscreenCanvas(n,s),k=T.getContext("webgpu");k.configure({device:l,format:a(this,xh),alphaMode:i?"opaque":"premultiplied"});let N=i?{r:i[0]/255,g:i[1]/255,b:i[2]/255,a:1}:{r:0,g:0,b:0,a:0},F=l.createCommandEncoder(),L=F.beginRenderPass({colorAttachments:[{view:k.getCurrentTexture().createView(),clearValue:N,loadOp:"clear",storeOp:"store"}]});return y>0&&(L.setPipeline(a(this,gh)),L.setBindGroup(0,v),L.setVertexBuffer(0,g),L.setVertexBuffer(1,A),L.draw(y)),L.end(),l.queue.submit([F.finish()]),g.destroy(),A.destroy(),w.destroy(),T.transferToImageBitmap()}};_p=new WeakMap,mh=new WeakMap,gh=new WeakMap,xh=new WeakMap,bd=new WeakSet,gT=async function(){if(!globalThis.navigator?.gpu)return!1;try{let t=await navigator.gpu.requestAdapter();if(!t)return!1;p(this,xh,navigator.gpu.getPreferredCanvasFormat());let e=p(this,mh,await t.requestDevice()),i=e.createShaderModule({code:oM});return p(this,gh,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,xh)}]},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===ul.TRIANGLES)s+=f.length;else if(d.type===ul.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===ul.TRIANGLES)for(let y=0,g=f.length;ythis._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(),ht.applyTransform(n,e),ht.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);ht.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(),ht.applyTransform(i,e),ht.applyTransform(n,e));let s=this._r1,o=this._r0;if(e){let u=new Float32Array(2);ht.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===ki.STROKE||n===ki.FILL){if(this.isOriginBased()){let f=ht.transform(i,e.baseTransform);this.matrix&&(f=ht.transform(f,this.matrix));let m=.001,y=Math.hypot(f[0],f[1]),g=Math.hypot(f[2],f[3]),A=(f[0]*f[2]+f[1]*f[3])/(y*g);if(Math.abs(A)=tt?F=u:Y=!0,j>=et?L=h:q=!0;let _=this.getSizeAndScale(F,this.ctx.canvas.width,k),X=this.getSizeAndScale(L,this.ctx.canvas.height,N),O=t.canvasFactory.create(_.size,X.size),C=O.context,D=c.createCanvasGraphics(C,e);if(D.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(D,s,l),C.translate(-_.scale*d,-X.scale*f),D.transform(0,_.scale,0,0,X.scale,0,0),C.save(),D.dependencyTracker?.save(),this.clipBbox(D,d,f,m,y),D.baseTransform=Ie(D.ctx),D.executeOperatorList(n),D.endDrawing(),D.dependencyTracker?.restore(),C.restore(),Y||q){let E=O.canvas;Y&&(F=u),q&&(L=h);let S=this.getSizeAndScale(F,this.ctx.canvas.width,k),I=this.getSizeAndScale(L,this.ctx.canvas.height,N),M=S.size,P=I.size,B=t.canvasFactory.create(M,P),$=B.context,U=Y?Math.floor(g/u):0,V=q?Math.floor(A/h):0;for(let Z=0;Z<=U;Z++)for(let Q=0;Q<=V;Q++)$.drawImage(E,M*Z,P*Q,M,P,0,0,M,P);return t.canvasFactory.destroy(O),{canvas:B.canvas,canvasEntry:B,scaleX:S.scale,scaleY:I.scale,offsetX:d,offsetY:f}}return{canvas:O.canvas,canvasEntry:O,scaleX:_.scale,scaleY:X.scale,offsetX:d,offsetY:f}}getSizeAndScale(t,e,i){let n=Math.max(wx.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),ht.axialAlignedBoundingBox([e,i,n,s],Ie(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let n=t.ctx,s=t.current;switch(e){case uC.COLORED:let{fillStyle:o,strokeStyle:l}=this.ctx;n.fillStyle=s.fillColor=o,n.strokeStyle=s.strokeColor=l;break;case uC.UNCOLORED:n.fillStyle=n.strokeStyle=i,s.fillColor=s.strokeColor=i;break;default:throw new tb(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,n,s){let o=i;n!==ki.SHADING&&(o=ht.transform(o,e.baseTransform),this.matrix&&(o=ht.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}};z(wx,"MAX_PATTERN_SIZE",3e3);Zb=wx;hC=16,dC=100,pM=15,fC=10,pn=16,Ky=new DOMMatrix,Un=new Float32Array(2),Fu=new Float32Array([1/0,1/0,-1/0,-1/0]);$0=class{constructor(t,e){z(this,"alphaIsShape",!1);z(this,"fontSize",0);z(this,"fontSizeScale",1);z(this,"textMatrix",null);z(this,"textMatrixScale",1);z(this,"fontMatrix",Qy);z(this,"leading",0);z(this,"x",0);z(this,"y",0);z(this,"lineX",0);z(this,"lineY",0);z(this,"charSpacing",0);z(this,"wordSpacing",0);z(this,"textHScale",1);z(this,"textRenderingMode",ni.FILL);z(this,"textRise",0);z(this,"fillColor","#000000");z(this,"strokeColor","#000000");z(this,"patternFill",!1);z(this,"patternStroke",!1);z(this,"fillAlpha",1);z(this,"strokeAlpha",1);z(this,"lineWidth",1);z(this,"activeSMask",null);z(this,"transferMaps","none");z(this,"minMax",Fu.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=ki.FILL,e=null){let i=this.minMax.slice();if(t===ki.STROKE){e||ie("Stroke bounding box must include transform."),ht.singularValueDecompose2dScale(e,Un);let n=Un[0]*this.lineWidth/2,s=Un[1]*this.lineWidth/2;i[0]-=n,i[1]-=s,i[2]+=n,i[3]+=s}return i}updateClipFromPath(){let t=ht.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(Fu,0)}getClippedPathBoundingBox(t=ki.FILL,e=null){return ht.intersect(this.clipBox,this.getPathBoundingBox(t,e))}};gM=["butt","round","square"],xM=["miter","round","bevel"],yM={},xC={},Bw=class Bw{constructor(t,e,i,n,s,{optionalContentConfig:o,markedContentStack:l=null},c,u,h,d){x(this,Br);this.ctx=t,this.current=new $0(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(...Ie(this.compositeCtx))}this.ctx.save(),zg(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=Ie(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>fC&&typeof i=="function",d=h?Date.now()+pM:0,f=0,m=this.commonObjs,y=this.objs,g,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(g=l[c],A=o[c]??null,g!==hd.dependency)A===null?this[g](c):this[g](c,...A);else for(let w of A){this.dependencyTracker?.recordNamedData(w,c);let v=w.startsWith("g_")?m:y;if(!v.has(w))return v.get(w,i),c}if(c++,c===u)return c;if(h&&++f>fC){if(Date.now()>d)return i(),c;f=0}}}endDrawing(){b(this,Br,Qb).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,Br,Jb).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],T=this.canvasFactory.create(w,v);return T.context.drawImage(t,0,0,i,n,0,0,w,v),{img:T.canvas,paintWidth:w,paintHeight:v,tmpCanvas:T}}let f=this.canvasFactory.create(1,1),m=this.canvasFactory.create(1,1),y=i,g=n,A=t;for(let{newWidth:w,newHeight:v}of l)this.canvasFactory.reset(m,w,v),m.context.drawImage(A,0,0,y,g,0,0,w,v),[f,m]=[m,f],A=f.canvas,y=w,g=v;return this.canvasFactory.destroy(m),{img:f.canvas,paintWidth:y,paintHeight:g,tmpCanvas:f}}_createMaskCanvas(t,e){let i=this.ctx,{width:n,height:s}=e,o=this.current.fillColor,l=this.current.patternFill,c=Ie(i),u,h,d,f;if((e.bitmap||e.data)&&e.count>1){let j=e.bitmap||e.data.buffer;h=JSON.stringify(l?c:[c.slice(0,4),o]),u=this._cachedBitmapsMap.getOrInsertComputed(j,Rx);let tt=u.get(h);if(tt&&!l){let et=Math.round(Math.min(c[0],c[2])+c[4]),_=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(t,Qn.transformAndFill),{canvas:tt,offsetX:et,offsetY:_}}d=tt}d||(f=this.canvasFactory.create(n,s),mC(f.context,e));let m=ht.transform(c,[1/n,0,0,-1/s,0,0]);m=ht.transform(m,[1,0,0,1,0,-s]);let y=Fu.slice();ht.axialAlignedBoundingBox([0,0,n,s],m,y);let[g,A,w,v]=y,T=Math.round(w-g)||1,k=Math.round(v-A)||1,N=this.canvasFactory.create(T,k),F=N.context,L=g,Y=A;F.translate(-L,-Y),F.transform(...m);let q=null;if(!d){let j=this._scaleImage(f.canvas,Zr(F));d=j.img,q=j.tmpCanvas,d!==f.canvas&&(this.canvasFactory.destroy(f),f=null),u&&l&&(u.set(h,d),q=null,f=null)}F.imageSmoothingEnabled=gC(Ie(F),e.interpolate),Ug(F,d,0,0,d.width,d.height,0,0,n,s),q&&this.canvasFactory.destroy(q),f&&this.canvasFactory.destroy(f),F.globalCompositeOperation="source-in";let G=ht.transform(Zr(F),[1,0,0,1,-L,-Y]);return F.fillStyle=l?o.getPattern(i,this,G,ki.FILL,t):o,F.fillRect(0,0,n,s),u&&!l&&u.set(h,N.canvas),this.dependencyTracker?.recordDependencies(t,Qn.transformAndFill),{canvas:N.canvas,canvasEntry:u&&!l?null:N,offsetX:Math.round(L),offsetY:Math.round(Y)}}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=gM[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=xM[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()),sf(this.suspendedCtx,s),mM(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(),sf(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,y=u-d,g=null;if(o)if(m<0||y<0||m+i>f.width||y+n>f.height){g=this.canvasFactory.create(i,n);let w=g.context;w.drawImage(f,-m,-y),w.globalCompositeOperation="destination-atop",w.fillStyle=o,w.fillRect(0,0,i,n),w.globalCompositeOperation="source-over",f=g.canvas,m=y=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let w=new Path2D;w.rect(m,y,i,n),t.clip(w),t.globalCompositeOperation="destination-atop",t.fillStyle=o,t.fillRect(m,y,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,y,i,n,c,u,i,n),e.restore(),g&&this.canvasFactory.destroy(g)}save(t){this.inSMaskMode&&sf(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&&sf(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===hd.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]=NC(s)),ht.axialAlignedBoundingBox(n,Ie(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,Zr(n),ki.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,Qn.stroke),i&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(ki.STROKE,Ie(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,Zr(n),ki.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,Qn.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,Qn.rawFillPath).recordOperation(t)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=yM}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||Qy,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&Mt("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;idC&&(h=dC),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&ni.FILL_STROKE_MASK,m=!!(h&ni.ADD_TO_PATH_FLAG),y=c.patternFill&&!u.missingFile,g=c.patternStroke&&!u.missingFile,A;if((u.disableFontFace||m||y||g)&&!u.missingFile&&(A=u.getPathGenerator(this.commonObjs,e)),A&&(u.disableFontFace||y||g)){l.save(),l.translate(i,n),l.scale(d,-d),this.dependencyTracker?.recordCharacterBBox(t,l,u);let w;if(f===ni.FILL||f===ni.FILL_STROKE)if(s){w=l.getTransform(),l.setTransform(...s);let v=b(this,Br,t2).call(this,A,w,s);l.fill(v)}else l.fill(A);if(f===ni.STROKE||f===ni.FILL_STROKE)if(o){w||(w=l.getTransform()),l.setTransform(...o);let{a:v,b:T,c:k,d:N}=w,F=ht.inverseTransform(o),L=ht.transform([v,T,k,N,0,0],F);ht.singularValueDecompose2dScale(L,Un),l.lineWidth*=Math.max(Un[0],Un[1])/d,l.stroke(b(this,Br,t2).call(this,A,w,o))}else l.lineWidth/=d,l.stroke(A);l.restore()}else(f===ni.FILL||f===ni.FILL_STROKE)&&(l.fillText(e,i,n),this.dependencyTracker?.recordCharacterBBox(t,l,u,d,i,n,()=>l.measureText(e))),(f===ni.STROKE||f===ni.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,l,u,d,i,n,()=>l.measureText(e)).recordDependencies(t,Qn.stroke),l.strokeText(e,i,n));m&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Ie(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;s0&&i[s]<255){n=!0;break}return _t(this,"isFontSubpixelAAEnabled",n)}showText(t,e){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,Qn.showText).resetBBox(t),this.current.textRenderingMode&ni.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,y=m?1:-1,g=n.defaultVMetrics,A=s*i.fontMatrix[0],w=i.textRenderingMode===ni.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,T,k=i.textRenderingMode&ni.FILL_STROKE_MASK,N=k===ni.FILL||k===ni.FILL_STROKE,F=k===ni.STROKE||k===ni.FILL_STROKE;if(N&&i.patternFill){o.save();let j=i.fillColor.getPattern(o,this,Zr(o),ki.FILL,t);v=Ie(o),o.restore(),o.fillStyle=j}if(F&&i.patternStroke){o.save();let j=i.strokeColor.getPattern(o,this,Zr(o),ki.STROKE,t);T=Ie(o),o.restore(),o.strokeStyle=j}let L=i.lineWidth,Y=i.textMatrixScale;if(Y===0||L===0?F&&(L=this.getSinglePixelWidth()):L/=Y,l!==1&&(o.scale(l,l),L/=l),o.lineWidth=L,n.isInvalidPDFjsFont){let j=[],tt=0;for(let _ of e)j.push(_.unicode),tt+=_.width;let et=j.join("");if(o.fillText(et,0,0),this.dependencyTracker!==null){let _=o.measureText(et);this.dependencyTracker.recordBBox(t,this.ctx,-_.actualBoundingBoxLeft,_.actualBoundingBoxRight,-_.actualBoundingBoxAscent,_.actualBoundingBoxDescent).recordShowTextOperation(t)}i.x+=tt*A*d,o.restore(),this.compose();return}let q=0,G;for(G=0;G0){E=o.measureText(_);let I=E.width*1e3/s*l;if(DE??o.measureText(_));else if(this.paintChar(t,_,O,C,v,T),X){let I=O+s*X.offset.x/l,M=C-s*X.offset.y/l;this.paintChar(t,X.fontChar,I,M,v,T)}}let S=m?D*A-et*h:D*A+et*h;q+=S,tt&&o.restore()}m?i.y-=q:i.x+=q*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||Qy,m=e.length,y=n.textRenderingMode===ni.INVISIBLE,g,A,w,v;if(y||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 T=this.dependencyTracker;for(this.dependencyTracker=T?new U0(T,t):null,g=0;gnew Bw(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new U0(this.dependencyTracker,l,!0):null)};i=new Zb(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=dM(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,Zr(i),ki.SHADING,t);let s=Zr(i);if(s){let{width:o,height:l}=i.canvas,c=Fu.slice();ht.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,Qn.transform).recordDependencies(t,Qn.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){ie("Should not call beginInlineImage")}beginImageData(){ie("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=Ie(this.ctx),i)){ht.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||Fx("TODO: Support non-isolated groups."),e.knockout&&Mt("Knockout groups not supported.");let n=Ie(i);e.matrix&&i.transform(...e.matrix);let s=[0,0,i.canvas.width,i.canvas.height],o;e.bbox?(o=Fu.slice(),ht.axialAlignedBoundingBox(e.bbox,Ie(i),o),o=ht.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,[y,g,A,w]=e.bbox;if(m.rect(y,g,A-y,w-g),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()),sf(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=Ie(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...s);let o=Fu.slice();ht.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,Br,Qb).call(this),zg(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,ht.singularValueDecompose2dScale(Ie(this.ctx),Un);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(Un[0],0,0,-Un[1],0,c*Un[1]),zg(this.ctx)}else{zg(this.ctx),this.endPath(t);let u=new Path2D;u.rect(i[0],i[1],l,c),this.ctx.clip(u)}}this.current=new $0(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,Br,Jb).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=Ie(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;dd?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),Ky.a=1/s,Ky.d=1/o;let c=new Path2D;if(c.addPath(t,Ky),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}};Br=new WeakSet,Qb=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)},Jb=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}}},t2=function(t,e,i){let n=new Path2D;return n.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),n};Ru=Bw;for(let r in hd)Ru.prototype[r]!==void 0&&(Ru.prototype[hd[r]]=Ru.prototype[r]);pd=class{constructor(t,e,i){x(this,Np,null);x(this,Mp,null);z(this,"_fullReader",null);z(this,"_rangeReaders",new Set);z(this,"_source",null);this._source=t,p(this,Np,e),p(this,Mp,i)}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return _e(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(a(this,Np))(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new(a(this,Mp))(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)}};Np=new WeakMap,Mp=new WeakMap;md=class{constructor(t){z(this,"onProgress",null);z(this,"_contentLength",0);z(this,"_filename",null);z(this,"_headersCapability",Promise.withResolvers());z(this,"_isRangeSupported",!1);z(this,"_isStreamingSupported",!1);z(this,"_loaded",0);z(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(){ie("Abstract method `read` called")}cancel(t){ie("Abstract method `cancel` called")}},gd=class{constructor(t,e,i){z(this,"_stream",null);this._stream=t}async read(){ie("Abstract method `read` called")}cancel(t){ie("Abstract method `cancel` called")}};e2=class extends pd{constructor(e){super(e,i2,n2);z(this,"_responseOrigin",null);let{httpHeaders:i,url:n}=e;_e(/https?:/.test(n.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=yT(!0,i)}},i2=class extends md{constructor(e){super(e);z(this,"_abortController",new AbortController);z(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);vT(o,c,l,this._abortController).then(u=>{e._responseOrigin=Ux(u.url),ET(u.status,o),this._reader=u.body.getReader();let h=u.headers,{contentLength:d,isRangeSupported:f}=bT({responseHeaders:h,isHttp:!0,rangeChunkSize:s,disableRange:i});this._contentLength=d,this._isRangeSupported=f,this._filename=wT(h),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Lr("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:jx(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},n2=class extends gd{constructor(e,i,n){super(e,i,n);z(this,"_abortController",new AbortController);z(this,"_readCapability",Promise.withResolvers());z(this,"_reader",null);let{url:s,withCredentials:o}=e._source,l=new Headers(e.headers);l.append("Range",`bytes=${i}-${n-1}`),vT(s,l,o,this._abortController).then(c=>{let u=Ux(c.url);AT(u,e._responseOrigin),ET(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:jx(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}};r2=class extends pd{constructor(e){super(e,a2,o2);x(this,Fp);z(this,"_progressiveDone",!1);z(this,"_queuedChunks",[]);let{pdfDataRangeTransport:i}=e,{initialData:n,progressiveDone:s}=i;if(n?.length>0){let o=yC(n);this._queuedChunks.push(o)}this._progressiveDone=s,i.addRangeListener((o,l)=>{b(this,Fp,s2).call(this,o,l)}),i.addProgressiveReadListener(o=>{b(this,Fp,s2).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()}};Fp=new WeakSet,s2=function(e,i){let n=yC(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);_e(s,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),s._enqueue(n)}};a2=class extends md{constructor(e){super(e);x(this,Pp,Hx.bind(this));z(this,"_done",!1);z(this,"_queuedChunks",null);z(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,Bx(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,Pp).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&a(this,Pp).call(this)}};Pp=new WeakMap;o2=class extends gd{constructor(e,i,n){super(e,i,n);x(this,Op,Hx.bind(this));z(this,"onDone",null);z(this,"_begin",-1);z(this,"_done",!1);z(this,"_queuedChunk",null);z(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,Op).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,Op).call(this),this.onDone?.()}};Op=new WeakMap;Zy=200,bC=206;l2=class extends pd{constructor(e){super(e,c2,u2);x(this,wd);x(this,us,new WeakMap);z(this,"_responseOrigin",null);let{httpHeaders:i,url:n}=e;this.url=n,this.isHttp=/https?:/.test(n.protocol),this.headers=yT(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,us).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===bC||s===Zy):n.validateStatus=s=>s===Zy,i.responseType="arraybuffer",_e(e.onError,"Expected `onError` callback to be provided."),i.onerror=()=>e.onError(i.status),i.onreadystatechange=b(this,wd,TT).bind(this,i),i.onprogress=b(this,wd,CT).bind(this,i),i.send(null),i}_abortRequest(e){a(this,us).has(e)&&(a(this,us).delete(e),e.abort())}getRangeReader(e,i){let n=super.getRangeReader(e,i);return n&&(n.onClosed=()=>this._rangeReaders.delete(n)),n}};us=new WeakMap,wd=new WeakSet,CT=function(e,i){a(this,us).get(e)?.onProgress?.(i)},TT=function(e,i){let n=a(this,us).get(e);if(!n||(e.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),e.readyState!==4)||!a(this,us).has(e))return;if(a(this,us).delete(e),e.status===0&&this.isHttp){n.onError(e.status);return}let s=e.status||Zy;if(!n.validateStatus(s)){n.onError(e.status);return}let o=wM(e.response);if(s===bC){let l=e.getResponseHeader("Content-Range");/bytes (\d+)-(\d+)\/(\d+)/.test(l)?n.onDone(o):(Mt('Missing or invalid "Content-Range" header.'),n.onError(0))}else o?n.onDone(o):n.onError(e.status)};c2=class extends md{constructor(e){super(e);x(this,Cs);x(this,Rp,Hx.bind(this));z(this,"_cachedChunks",[]);z(this,"_done",!1);z(this,"_requests",[]);z(this,"_storedError",null);this._fullRequestXhr=e._request({onHeadersReceived:b(this,Cs,ST).bind(this),onDone:b(this,Cs,DT).bind(this),onError:b(this,Cs,IT).bind(this),onProgress:b(this,Cs,kT).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,Rp).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}};Rp=new WeakMap,Cs=new WeakSet,ST=function(){let e=this._stream,{disableRange:i,rangeChunkSize:n}=e._source,s=this._fullRequestXhr;e._responseOrigin=Ux(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}=bT({responseHeaders:l,isHttp:e.isHttp,rangeChunkSize:n,disableRange:i});this._contentLength=c,this._isRangeSupported=u,this._filename=wT(l),this._isRangeSupported&&e._abortRequest(s),this._headersCapability.resolve()},DT=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,Rp).call(this)},IT=function(e){this._storedError=zx(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},kT=function(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})};u2=class extends gd{constructor(e,i,n){super(e,i,n);x(this,_a);x(this,Lp,Hx.bind(this));z(this,"onClosed",null);z(this,"_done",!1);z(this,"_queuedChunk",null);z(this,"_requests",[]);z(this,"_storedError",null);this._requestXhr=e._request({begin:i,end:n,onHeadersReceived:b(this,_a,_T).bind(this),onDone:b(this,_a,NT).bind(this),onError:b(this,_a,h2).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,Lp).call(this),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};Lp=new WeakMap,_a=new WeakSet,_T=function(){let e=Ux(this._requestXhr?.responseURL);try{AT(e,this._stream._responseOrigin)}catch(i){this._storedError=i,b(this,_a,h2).call(this,0)}},NT=function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,a(this,Lp).call(this),this.onClosed?.()},h2=function(e){this._storedError??(this._storedError=zx(e,this._stream.url));for(let i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};d2=class extends pd{constructor(t){super(t,f2,p2);let{url:e}=t;_e(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}},f2=class extends md{constructor(e){super(e);z(this,"_reader",null);let{disableRange:i,disableStream:n,rangeChunkSize:s,url:o}=e._source;this._isStreamingSupported=!n;let l=it.default.getBuiltinModule("fs");l.promises.lstat(o).then(c=>{let u=l.createReadStream(o),h=MT(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 Lr("Streaming is disabled.")),this._headersCapability.resolve()}).catch(c=>{c.code==="ENOENT"&&(c=zx(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:jx(e),done:!1})}cancel(e){this._reader?.cancel(e)}},p2=class extends gd{constructor(e,i,n){super(e,i,n);z(this,"_readCapability",Promise.withResolvers());z(this,"_reader",null);let{url:s}=e._source,o=it.default.getBuiltinModule("fs");try{let l=o.createReadStream(s,{start:i,end:n-1}),c=MT(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:jx(e),done:!1}}cancel(e){this._reader?.cancel(e)}};dr=class{static get workerPort(){return a(this,Bp)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");p(this,Bp,t)}static get workerSrc(){return a(this,Up)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");p(this,Up,t)}};Bp=new WeakMap,Up=new WeakMap,x(dr,Bp,null),x(dr,Up,"");m2=class{constructor({parsedData:t,rawData:e}){x(this,yh);x(this,zp);p(this,yh,t),p(this,zp,e)}getRaw(){return a(this,zp)}get(t){return a(this,yh).get(t)??null}[Symbol.iterator](){return a(this,yh).entries()}};yh=new WeakMap,zp=new WeakMap;Du=Symbol("INTERNAL"),g2=class{constructor(t,{name:e,intent:i,usage:n,rbGroups:s}){x(this,jp,!1);x(this,Hp,!1);x(this,Gp,!1);x(this,bh,!0);p(this,jp,!!(t&Ln.DISPLAY)),p(this,Hp,!!(t&Ln.PRINT)),this.name=e,this.intent=i,this.usage=n,this.rbGroups=s}get visible(){if(a(this,Gp))return a(this,bh);if(!a(this,bh))return!1;let{print:t,view:e}=this.usage;return a(this,jp)?e?.viewState!=="OFF":a(this,Hp)?t?.printState!=="OFF":!0}_setVisible(t,e,i=!1){t!==Du&&ie("Internal method `_setVisible` called."),p(this,Gp,i),p(this,bh,e)}};jp=new WeakMap,Hp=new WeakMap,Gp=new WeakMap,bh=new WeakMap;x2=class{constructor(t,e=Ln.DISPLAY){x(this,$p);x(this,fo,null);x(this,pe,new Map);x(this,wh,null);x(this,Ah,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,p(this,Ah,t.order);for(let i of t.groups)a(this,pe).set(i.id,new g2(e,i));if(t.baseState==="OFF")for(let i of a(this,pe).values())i._setVisible(Du,!1);for(let i of t.on)a(this,pe).get(i)._setVisible(Du,!0);for(let i of t.off)a(this,pe).get(i)._setVisible(Du,!1);p(this,wh,this.getHash())}}isVisible(t){if(a(this,pe).size===0)return!0;if(!t)return Fx("Optional content group not defined."),!0;if(t.type==="OCG")return a(this,pe).has(t.id)?a(this,pe).get(t.id).visible:(Mt(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return b(this,$p,y2).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(let e of t.ids){if(!a(this,pe).has(e))return Mt(`Optional content group not found: ${e}`),!0;if(a(this,pe).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(let e of t.ids){if(!a(this,pe).has(e))return Mt(`Optional content group not found: ${e}`),!0;if(!a(this,pe).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(let e of t.ids){if(!a(this,pe).has(e))return Mt(`Optional content group not found: ${e}`),!0;if(!a(this,pe).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(let e of t.ids){if(!a(this,pe).has(e))return Mt(`Optional content group not found: ${e}`),!0;if(a(this,pe).get(e).visible)return!1}return!0}return Mt(`Unknown optional content policy ${t.policy}.`),!0}return Mt(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,i=!0){let n=a(this,pe).get(t);if(!n){Mt(`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,pe).get(o)?._setVisible(Du,!1,!0);n._setVisible(Du,!!e,!0),p(this,fo,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,pe).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,fo,null)}get hasInitialVisibility(){return a(this,wh)===null||this.getHash()===a(this,wh)}getOrder(){return a(this,pe).size?a(this,Ah)?a(this,Ah).slice():[...a(this,pe).keys()]:null}getGroup(t){return a(this,pe).get(t)||null}getHash(){if(a(this,fo)!==null)return a(this,fo);let t=new L0;for(let[e,i]of a(this,pe))t.update(`${e}:${i.visible}`);return p(this,fo,t.hexdigest())}[Symbol.iterator](){return a(this,pe).entries()}};fo=new WeakMap,pe=new WeakMap,wh=new WeakMap,Ah=new WeakMap,$p=new WeakSet,y2=function(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let n=1;nf===m+1)&&p(this,We,null)}deletePages(t){b(this,zi,bf).call(this);let e=a(this,We),i=b(this,zi,wf).call(this);p(this,hs,{pageNumberToId:e.slice(),pagesNumber:a(this,Si),prevPageNumbers:a(this,Sr).slice()});let n=a(this,Si)-t.length;p(this,Si,n);let s=p(this,We,new Uint32Array(n));p(this,Sr,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}oa(this,We)[e-1])})}cancelCopy(){p(this,Vl,null)}pastePages(t){b(this,zi,bf).call(this);let e=a(this,We),i=b(this,zi,wf).call(this),{pageNumbers:n,pageIds:s}=a(this,Vl),o=a(this,Si)+n.length;p(this,Si,o);let l=p(this,We,new Uint32Array(o));p(this,Sr,new Int32Array(o)),l.set(e.subarray(0,t),0),l.set(s,t),l.set(e.subarray(t),t+n.length),b(this,zi,a0).call(this,i,null,t,n),p(this,Vl,null)}hasBeenAltered(){return a(this,We)!==null}getPageMappingForSaving(t=null){t??(t=b(this,zi,wf).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;no[0]-l[0]);for(let o=0,l=n.length;oi-n);let e=new Map;for(let i=0,n=t.length;i=i&&u({...Promise.withResolvers(),data:Iu}),V0=class{constructor(){x(this,lr,new Map)}get(t,e=null){if(e){let n=a(this,lr).getOrInsertComputed(t,wC);return n.promise.then(()=>e(n.data)),null}let i=a(this,lr).get(t);if(!i||i.data===Iu)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){let e=a(this,lr).get(t);return!!e&&e.data!==Iu}delete(t){let e=a(this,lr).get(t);return!e||e.data===Iu?!1:(a(this,lr).delete(t),!0)}resolve(t,e=null){let i=a(this,lr).getOrInsertComputed(t,wC);if(i.data!==Iu)throw new Error(`Object already resolved ${t}.`);i.data=e,i.resolve()}clear(){for(let{data:t}of a(this,lr).values())t?.bitmap?.close();a(this,lr).clear()}*[Symbol.iterator](){for(let[t,{data:e}]of a(this,lr))e!==Iu&&(yield[t,e])}};lr=new WeakMap;vM=1e5,AC=30,vi=class vi{constructor({textContentSource:t,images:e,container:i,viewport:n}){x(this,Na);x(this,po,Promise.withResolvers());x(this,Wi,null);x(this,Vp,!1);x(this,qp,!!globalThis.FontInspector?.enabled);x(this,vh,null);x(this,ql,null);x(this,aa,null);x(this,Wp,0);x(this,Xp,0);x(this,Wl,null);x(this,Yp,null);x(this,Eh,0);x(this,mo,0);x(this,Ch,Object.create(null));x(this,Kp,[]);x(this,Th,null);x(this,Xl,[]);x(this,Zp,new WeakMap);x(this,Qp,null);var u;if(t instanceof ReadableStream)p(this,Th,t);else if(typeof t=="object")p(this,Th,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');p(this,Wi,p(this,Yp,i)),p(this,vh,e),p(this,mo,n.scale*Es.pixelRatio),p(this,Eh,n.rotation),p(this,aa,{div:null,properties:null,ctx:null});let{pageWidth:s,pageHeight:o,pageX:l,pageY:c}=n.rawDims;p(this,Qp,[1,0,0,-1,-l,c+o]),p(this,Xp,s),p(this,Wp,o),b(u=vi,jn,OT).call(u),i.style.setProperty("--min-font-size",a(vi,Dh)),Ro(i,n),a(this,po).promise.finally(()=>{a(vi,Ih).delete(this),p(this,aa,null),p(this,Ch,null)}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=Be.platform;return _t(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){a(this,vh)&&a(this,Wi).append(a(this,vh).render());let t=()=>{a(this,Wl).read().then(({value:e,done:i})=>{if(i){a(this,po).resolve();return}a(this,ql)??p(this,ql,e.lang),Object.assign(a(this,Ch),e.styles),b(this,Na,FT).call(this,e.items),t()},a(this,po).reject)};return p(this,Wl,a(this,Th).getReader()),a(vi,Ih).add(this),t(),a(this,po).promise}update({viewport:t,onBefore:e=null}){var s;let i=t.scale*Es.pixelRatio,n=t.rotation;if(n!==a(this,Eh)&&(e?.(),p(this,Eh,n),Ro(a(this,Yp),{rotation:n})),i!==a(this,mo)){e?.(),p(this,mo,i);let o={div:null,properties:null,ctx:b(s=vi,jn,o0).call(s,a(this,ql))};for(let l of a(this,Xl))o.properties=a(this,Zp).get(l),o.div=l,b(this,Na,w2).call(this,o)}}cancel(){let t=new Lr("TextLayer task cancelled.");a(this,Wl)?.cancel(t).catch(()=>{}),p(this,Wl,null),a(this,po).reject(t)}get textDivs(){return a(this,Xl)}get textContentItemsStr(){return a(this,Kp)}static cleanup(){if(!(a(this,Ih).size>0)){a(this,Sh).clear();for(let{canvas:t}of a(this,Yl).values())t.remove();a(this,Yl).clear()}}};po=new WeakMap,Wi=new WeakMap,Vp=new WeakMap,qp=new WeakMap,vh=new WeakMap,ql=new WeakMap,aa=new WeakMap,Wp=new WeakMap,Xp=new WeakMap,Wl=new WeakMap,Yp=new WeakMap,Eh=new WeakMap,mo=new WeakMap,Ch=new WeakMap,Kp=new WeakMap,Th=new WeakMap,Xl=new WeakMap,Zp=new WeakMap,Qp=new WeakMap,Sh=new WeakMap,Yl=new WeakMap,Jp=new WeakMap,Dh=new WeakMap,Ih=new WeakMap,Na=new WeakSet,FT=function(t){var n,s;if(a(this,Vp))return;(s=a(this,aa)).ctx??(s.ctx=b(n=vi,jn,o0).call(n,a(this,ql)));let e=a(this,Xl),i=a(this,Kp);for(let o of t){if(e.length>vM){Mt("Ignoring additional textDivs for performance reasons."),p(this,Vp,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){let l=a(this,Wi);p(this,Wi,document.createElement("span")),a(this,Wi).classList.add("markedContent"),o.id&&a(this,Wi).setAttribute("id",`${o.id}`),o.tag==="Artifact"&&(a(this,Wi).ariaHidden=!0),l.append(a(this,Wi))}else o.type==="endMarkedContent"&&p(this,Wi,a(this,Wi).parentNode);continue}i.push(o.str),b(this,Na,PT).call(this,o)}},PT=function(t){var y;let e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};a(this,Xl).push(e);let n=ht.transform(a(this,Qp),t.transform),s=Math.atan2(n[1],n[0]),o=a(this,Ch)[t.fontName];o.vertical&&(s+=Math.PI/2);let l=a(this,qp)&&o.fontSubstitution||o.fontFamily;l=vi.fontFamilyMap.get(l)||l;let c=Math.hypot(n[2],n[3]),u=c*b(y=vi,jn,RT).call(y,l,o,a(this,ql)),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,Xp)).toFixed(2)}%`,f.top=`${(100*d/a(this,Wp)).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,qp)&&(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 g=Math.abs(t.transform[0]),A=Math.abs(t.transform[3]);g!==A&&Math.max(g,A)/Math.min(g,A)>1.5&&(m=!0)}if(m&&(i.canvasWidth=o.vertical?t.height:t.width),a(this,Zp).set(e,i),a(this,aa).div=e,a(this,aa).properties=i,b(this,Na,w2).call(this,a(this,aa)),i.hasText&&a(this,Wi).append(e),i.hasEOL){let g=document.createElement("br");g.setAttribute("role","presentation"),a(this,Wi).append(g)}},w2=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=vi,jn,A2).call(o,n,u*a(this,mo),l);let{width:h}=n.measureText(e.textContent);h>0&&s.setProperty("--scale-x",c*a(this,mo)/h)}i.angle!==0&&s.setProperty("--rotate",`${i.angle}deg`)},jn=new WeakSet,o0=function(t=null){let e=a(this,Yl).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,Yl).set(t,e),a(this,Jp).set(e,{size:0,family:""})}return e},A2=function(t,e,i){let n=a(this,Jp).get(t);e===n.size&&i===n.family||(t.font=`${e}px ${i}`,n.size=e,n.family=i)},OT=function(){if(a(this,Dh)!==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,Dh,t.getBoundingClientRect().height),t.remove()},RT=function(t,e,i){let n=a(this,Sh).get(t);if(n)return n;let s=b(this,jn,o0).call(this,i);s.canvas.width=s.canvas.height=AC,b(this,jn,A2).call(this,s,AC,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):(Be.platform.isFirefox&&Mt("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,Sh).set(t,u),u},x(vi,jn),x(vi,Sh,new Map),x(vi,Yl,new Map),x(vi,Jp,new WeakMap),x(vi,Dh,null),x(vi,Ih,new Set);xd=vi,EM=100;vx=class vx{constructor(){z(this,"_capability",Promise.withResolvers());z(this,"_transport",null);z(this,"_worker",null);z(this,"docId",`d${Ye(vx,Ax)._++}`);z(this,"destroyed",!1);z(this,"onPassword",null);z(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()}};Ax=new WeakMap,x(vx,Ax,0);v2=vx,$f=class{constructor(t,e,i=!1,n=null){x(this,kh,Promise.withResolvers());x(this,tm,[]);x(this,em,[]);x(this,im,[]);this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=n,Object.defineProperty(this,"onDataProgress",{value:()=>{eM("`PDFDataRangeTransport.prototype.onDataProgress` - method was removed, since loading progress is now reported automatically through the `PDFDataTransportStream` class (and related code).")}})}addRangeListener(t){a(this,im).push(t)}addProgressiveReadListener(t){a(this,em).push(t)}addProgressiveDoneListener(t){a(this,tm).push(t)}onDataRange(t,e){for(let i of a(this,im))i(t,e)}onDataProgressiveRead(t){a(this,kh).promise.then(()=>{for(let e of a(this,em))e(t)})}onDataProgressiveDone(){a(this,kh).promise.then(()=>{for(let t of a(this,tm))t()})}transportReady(){a(this,kh).resolve()}requestDataRange(t,e){ie("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};kh=new WeakMap,tm=new WeakMap,em=new WeakMap,im=new WeakMap;E2=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 _t(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()}},Uw=class Uw{constructor(t,e,i,n,s=!1){x(this,Zl);x(this,oa,!1);x(this,Kl,null);this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new F0:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new V0,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,p(this,Kl,n),this.imageCoordinates=null}clone(t){let e=new Uw(t,this._pageInfo,this._transport,a(this,Kl),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 Uf({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 _t(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=Ea.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:y=!1,operationsFilter:g=null}){this._stats?.time("Overall");let A=this._transport.getRenderingIntent(n,s,d,f),{renderingIntent:w,cacheKey:v}=A;p(this,oa,!1),c||(c=this._transport.getOptionalContentConfig(w));let T=this._intentStates.getOrInsertComputed(v,M0);T.streamReaderCancelTimeout&&(clearTimeout(T.streamReaderCancelTimeout),T.streamReaderCancelTimeout=null);let k=!!(w&Ln.PRINT);T.displayReadyCapability||(T.displayReadyCapability=Promise.withResolvers(),T.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(A));let N=!!(this._pdfBug&&globalThis.StepperManager?.enabled),F=!!e&&!this.recordedBBoxes&&(y||N),L=!!e&&!this.imageCoordinates&&m,Y=et=>{if(T.renderTasks.delete(j),F){let _=j.gfx?.dependencyTracker.take();_&&(j.stepper?.setOperatorBBoxes(_,j.gfx.dependencyTracker.takeDebugMetadata()),y&&(this.recordedBBoxes=_))}L&&!et&&(this.imageCoordinates=j.gfx?.imagesTracker.take()),k&&p(this,oa,!0),b(this,Zl,Af).call(this),et?(j.capability.reject(et),this._abortOperatorList({intentState:T,reason:et instanceof Error?et:new Error(et)})):j.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},q=null,G=null;(F||L)&&(G=new Sb(e,T.operatorList.length)),F&&(q=new Ib(G,N));let j=new D2({callback:Y,params:{canvas:e,canvasContext:t,dependencyTracker:q??G,imagesTracker:L?new kb(e):null,viewport:i,transform:o,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:T.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!k,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:g});(T.renderTasks||(T.renderTasks=new Set)).add(j);let tt=j.task;return Promise.all([T.displayReadyCapability.promise,c]).then(([et,_])=>{if(this.destroyed){Y();return}if(this._stats?.time("Rendering"),!(_.renderingIntent&w))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");j.initializeGraphics({transparency:et,optionalContentConfig:_}),j.operatorListChanged()}).catch(Y),tt}getOperatorList({intent:t="display",annotationMode:e=Ea.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,M0),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,Kl).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=>Lf.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,oa,!1),Promise.all(t)}cleanup(t=!1){p(this,oa,!0);let e=b(this,Zl,Af).call(this);return t&&e&&this._stats&&(this._stats=new F0),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{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,Zl,Af).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 fd){let n=EM;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 Lr(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}};oa=new WeakMap,Kl=new WeakMap,Zl=new WeakSet,Af=function(){if(!a(this,oa)||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,oa,!1),!0};C2=Uw,Fe=class Fe{constructor({name:t=null,port:e=null,verbosity:i=WN()}={}){x(this,Zi);x(this,go,Promise.withResolvers());x(this,Dr,null);x(this,la,null);x(this,Ql,null);if(this.name=t,this.destroyed=!1,this.verbosity=i,e){if(a(Fe,tc).has(e))throw new Error("Cannot use more than one PDFWorker per port.");a(Fe,tc).set(e,this),b(this,Zi,BT).call(this,e)}else b(this,Zi,UT).call(this)}get promise(){return a(this,go).promise}get port(){return a(this,la)}get messageHandler(){return a(this,Dr)}destroy(){this.destroyed=!0,a(this,Ql)?.terminate(),p(this,Ql,null),a(Fe,tc).delete(a(this,la)),p(this,la,null),a(this,Dr)?.destroy(),p(this,Dr,null)}static create(t){let e=a(this,tc).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 Fe(t)}static get workerSrc(){if(dr.workerSrc)return dr.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return _t(this,"_setupFakeWorkerGlobal",(async()=>a(this,_h,c0)?a(this,_h,c0):(await import(/* @vite-ignore */ this.workerSrc)).WorkerMessageHandler)())}};go=new WeakMap,Dr=new WeakMap,la=new WeakMap,Ql=new WeakMap,Ex=new WeakMap,Jl=new WeakMap,tc=new WeakMap,Zi=new WeakSet,l0=function(){a(this,go).resolve(),a(this,Dr).send("configure",{verbosity:this.verbosity})},BT=function(t){p(this,la,t),p(this,Dr,new hl("main","worker",t)),a(this,Dr).on("ready",()=>{}),b(this,Zi,l0).call(this)},UT=function(){if(a(Fe,Jl)||a(Fe,_h,c0)){b(this,Zi,vf).call(this);return}let{workerSrc:t}=Fe;try{Fe._isSameOrigin(window.location,t)||(t=Fe._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new hl("main","worker",e),n=()=>{s.abort(),i.destroy(),e.terminate(),this.destroyed?a(this,go).reject(new Error("Worker was destroyed")):b(this,Zi,vf).call(this)},s=new AbortController;e.addEventListener("error",()=>{a(this,Ql)||n()},{signal:s.signal}),i.on("test",l=>{if(s.abort(),this.destroyed||!l){n();return}p(this,Dr,i),p(this,la,e),p(this,Ql,e),b(this,Zi,l0).call(this)}),i.on("ready",l=>{if(s.abort(),this.destroyed){n();return}try{o()}catch{b(this,Zi,vf).call(this)}});let o=()=>{let l=new Uint8Array;i.send("test",l,[l.buffer])};o();return}catch{Fx("The worker has been disabled.")}b(this,Zi,vf).call(this)},vf=function(){a(Fe,Jl)||(Mt("Setting up fake worker."),p(Fe,Jl,!0)),Fe._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){a(this,go).reject(new Error("Worker was destroyed"));return}let e=new Ub;p(this,la,e);let i=`fake${Ye(Fe,Ex)._++}`,n=new hl(i+"_worker",i,e);t.setup(n,e),p(this,Dr,new hl(i,i+"_worker",e)),b(this,Zi,l0).call(this)}).catch(t=>{a(this,go).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},_h=new WeakSet,c0=function(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}},x(Fe,_h),x(Fe,Ex,0),x(Fe,Jl,!1),x(Fe,tc,new WeakMap),Bn&&(p(Fe,Jl,!0),dr.workerSrc||(dr.workerSrc="./pdf.worker.mjs")),Fe._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},Fe._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};yd=Fe,T2=class{constructor(t,e,i,n,s,o){x(this,Rr);z(this,"downloadInfoCapability",Promise.withResolvers());x(this,En,null);x(this,ec,new Map);x(this,ca,null);x(this,Ir,new Map);x(this,ic,new Map);x(this,Nh,new Map);x(this,ua,null);this.messageHandler=t,this.loadingTask=e,p(this,ca,i),this.commonObjs=new V0,this.fontLoader=new _b({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,Ir).set(e,t),a(this,ic).set(e,Promise.resolve(t))}get annotationStorage(){return _t(this,"annotationStorage",new Hf)}getRenderingIntent(t,e=Ea.ENABLE,i=null,n=!1,s=!1){let o=Ln.DISPLAY,l=jf;switch(t){case"any":o=Ln.ANY;break;case"display":break;case"print":o=Ln.PRINT;break;default:Mt(`getRenderingIntent - invalid intent: ${t}`)}let c=o&Ln.PRINT&&i instanceof B0?i:this.annotationStorage;switch(e){case Ea.DISABLE:o+=Ln.ANNOTATIONS_DISABLE;break;case Ea.ENABLE:break;case Ea.ENABLE_FORMS:o+=Ln.ANNOTATIONS_FORMS;break;case Ea.ENABLE_STORAGE:o+=Ln.ANNOTATIONS_STORAGE,l=c.serializable;break;default:Mt(`getRenderingIntent - invalid annotationMode: ${e}`)}n&&(o+=Ln.IS_EDITING),s&&(o+=Ln.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,ua)?.reject(new Error("Worker was destroyed during onPassword callback"));let t=[];for(let i of a(this,Ir).values())t.push(i._destroy());a(this,Ir).clear(),a(this,ic).clear(),a(this,Nh).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,ec).clear(),this.filterFactory.destroy(),xd.cleanup(),a(this,ca)?.cancelAllRequests(new Lr("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)=>{_e(a(this,ca),"GetReader - no `BasePDFStream` instance available."),p(this,En,a(this,ca).getFullReader()),a(this,En).onProgress=s=>b(this,Rr,u0).call(this,s),n.onPull=()=>{a(this,En).read().then(function({value:s,done:o}){if(o){n.close();return}_e(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{n.error(s)})},n.onCancel=s=>{a(this,En).cancel(s),n.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("ReaderHeadersReady",async i=>{await a(this,En).headersReady;let{isStreamingSupported:n,isRangeSupported:s,contentLength:o}=a(this,En);return n&&s&&(a(this,En).onProgress=null),{isStreamingSupported:n,isRangeSupported:s,contentLength:o}}),t.on("GetRangeReader",(i,n)=>{_e(a(this,ca),"GetRangeReader - no `BasePDFStream` instance available.");let s=a(this,ca).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}_e(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 E2(i,this))}),t.on("DocException",i=>{e._capability.reject(on(i))}),t.on("PasswordRequest",i=>{p(this,ua,Promise.withResolvers());try{if(!e.onPassword)throw on(i);let n=s=>{s instanceof Error?a(this,ua).reject(s):a(this,ua).resolve({password:s})};e.onPassword(n,i.code)}catch(n){a(this,ua).reject(n)}return a(this,ua).promise}),t.on("DataLoaded",i=>{b(this,Rr,u0).call(this,{loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)}),t.on("StartRenderPage",i=>{if(this.destroyed)return;a(this,Ir).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;Mt(`Error during font loading: ${d}`),this.commonObjs.resolve(i,d);break}let o=new Pb(s),l=this._params.pdfBug&&globalThis.FontInspector?.enabled?(d,f)=>globalThis.FontInspector.fontAdded(d,f):null,c=new Nb(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;_e(u,"The imageRef must be defined.");for(let d of a(this,Ir).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 Lb(s));break;case"Image":this.commonObjs.resolve(i,s);break;case"Pattern":let h=new Rb(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,Ir).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,Rr,u0).call(this,i)}),t.on("PrepareWebGPU",()=>{this.destroyed||lM()}),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&&Mt("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,En)?.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,ic).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,Nh).set(o.refStr,i);let l=new C2(e,o,this,this.pagesMapper,this._params.pdfBug);return a(this,Ir).set(e,l),l});return a(this,ic).set(e,s),s}async getPageIndex(t){if(!Bb(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,Rr,Ef).call(this,"GetFieldObjects")}hasJSActions(){return b(this,Rr,Ef).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,Rr,Ef).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,Rr,Ef).call(this,"GetOptionalContentConfig").then(e=>new x2(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata";return a(this,ec).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(e=>({info:e[0],metadata:e[1]?new m2(e[1]):null,contentDispositionFilename:a(this,En)?.filename??null,contentLength:a(this,En)?.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,Ir).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),a(this,ec).clear(),this.filterFactory.destroy(!0),xd.cleanup()}}cachedPageNumber(t){if(!Bb(t))return null;let e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,i=a(this,Nh).get(e);if(i>=0){let n=this.pagesMapper.getPageNumber(i+1);if(n!==0)return n}return null}};En=new WeakMap,ec=new WeakMap,ca=new WeakMap,Ir=new WeakMap,ic=new WeakMap,Nh=new WeakMap,ua=new WeakMap,Rr=new WeakSet,Ef=function(t,e=null){return a(this,ec).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))},u0=function({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:e?ai(Math.round(t/e*100),0,100):NaN})};S2=class{constructor(t){z(this,"_internalRenderTask",null);z(this,"onContinue",null);z(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}},ll=class ll{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:y=null}){x(this,xo,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 S2(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=y}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(a(ll,nc).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(ll,nc).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 Ru(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,xo)&&(window.cancelAnimationFrame(a(this,xo)),p(this,xo,null)),a(ll,nc).delete(this._canvas),t||(t=new fd(`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,xo,window.requestAnimationFrame(()=>{p(this,xo,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(ll,nc).delete(this._canvas),this.callback())))}};xo=new WeakMap,nc=new WeakMap,x(ll,nc,new WeakSet);D2=ll,zT="5.6.205",jT="ada343803",ln=class ln{constructor({editor:t=null,uiManager:e=null}){x(this,me);x(this,Cn,null);x(this,rc,null);x(this,Mh);x(this,si,null);x(this,nm,!1);x(this,Fh,!1);x(this,ha,null);x(this,rm);x(this,yo,null);x(this,kr,null);t?(p(this,Fh,!1),p(this,ha,t)):p(this,Fh,!0),p(this,kr,t?._uiManager||e),p(this,rm,a(this,kr)._eventBus),p(this,Mh,t?.color?.toUpperCase()||a(this,kr)?.highlightColors.values().next().value||"#FFFF98"),a(ln,sm)||p(ln,sm,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 _t(this,"_keyboardManager",new Fc([[["Escape","mac+Escape"],ln.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],ln.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],ln.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],ln.prototype._moveToPrevious],[["Home","mac+Home"],ln.prototype._moveToBeginning],[["End","mac+End"],ln.prototype._moveToEnd]]))}renderButton(){let t=p(this,Cn,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",a(this,ha)&&(t.ariaControls=`${a(this,ha).id}_colorpicker_dropdown`);let e=a(this,kr)._signal;t.addEventListener("click",b(this,me,rl).bind(this),{signal:e}),t.addEventListener("keydown",b(this,me,_2).bind(this),{signal:e});let i=p(this,rc,document.createElement("span"));return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=a(this,Mh),t.append(i),t}renderMainDropdown(){let t=p(this,si,b(this,me,I2).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===a(this,Cn)){b(this,me,rl).call(this,t);return}let e=t.target.getAttribute("data-color");e&&b(this,me,k2).call(this,e,t)}_moveToNext(t){if(!a(this,me,za)){b(this,me,rl).call(this,t);return}if(t.target===a(this,Cn)){a(this,si).firstElementChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===a(this,si)?.firstElementChild||t.target===a(this,Cn)){a(this,me,za)&&this._hideDropdownFromKeyboard();return}a(this,me,za)||b(this,me,rl).call(this,t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!a(this,me,za)){b(this,me,rl).call(this,t);return}a(this,si).firstElementChild?.focus()}_moveToEnd(t){if(!a(this,me,za)){b(this,me,rl).call(this,t);return}a(this,si).lastElementChild?.focus()}hideDropdown(){a(this,si)?.classList.add("hidden"),a(this,Cn).ariaExpanded="false",a(this,yo)?.abort(),p(this,yo,null)}_hideDropdownFromKeyboard(){if(!a(this,Fh)){if(!a(this,me,za)){a(this,ha)?.unselect();return}this.hideDropdown(),a(this,Cn).focus({preventScroll:!0,focusVisible:a(this,nm)})}}updateColor(t){if(a(this,rc)&&(a(this,rc).style.backgroundColor=t),!a(this,si))return;let e=a(this,kr).highlightColors.values();for(let i of a(this,si).children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){a(this,Cn)?.remove(),p(this,Cn,null),p(this,rc,null),a(this,si)?.remove(),p(this,si,null)}};Cn=new WeakMap,rc=new WeakMap,Mh=new WeakMap,si=new WeakMap,nm=new WeakMap,Fh=new WeakMap,ha=new WeakMap,rm=new WeakMap,yo=new WeakMap,kr=new WeakMap,sm=new WeakMap,me=new WeakSet,I2=function(){let t=document.createElement("div"),e=a(this,kr)._signal;t.addEventListener("contextmenu",Hn,{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,ha)&&(t.id=`${a(this,ha).id}_colorpicker_dropdown`);for(let[i,n]of a(this,kr).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(ln,sm)[i]);let o=document.createElement("span");s.append(o),o.className="swatch",o.style.backgroundColor=n,s.ariaSelected=n===a(this,Mh),s.addEventListener("click",b(this,me,k2).bind(this,n),{signal:e}),t.append(s)}return t.addEventListener("keydown",b(this,me,_2).bind(this),{signal:e}),t},k2=function(t,e){e.stopPropagation(),a(this,rm).dispatch("switchannotationeditorparams",{source:this,type:Ht.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)},_2=function(t){ln._keyboardManager.exec(this,t)},rl=function(t){if(a(this,me,za)){this.hideDropdown();return}if(p(this,nm,t.detail===0),a(this,yo)||(p(this,yo,new AbortController),window.addEventListener("pointerdown",b(this,me,HT).bind(this),{signal:a(this,kr).combinedSignal(a(this,yo))})),a(this,Cn).ariaExpanded="true",a(this,si)){a(this,si).classList.remove("hidden");return}let e=p(this,si,b(this,me,I2).call(this));a(this,Cn).append(e)},HT=function(t){a(this,si)?.contains(t.target)||this.hideDropdown()},za=function(){return a(this,si)&&!a(this,si).classList.contains("hidden")},x(ln,sm,null);Vf=ln,cl=class cl{constructor(t){x(this,ds,null);x(this,am,null);x(this,Ph,null);p(this,am,t),p(this,Ph,t._uiManager),a(cl,om)||p(cl,om,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(a(this,ds))return a(this,ds);let{editorType:t,colorType:e,color:i}=a(this,am),n=p(this,ds,document.createElement("input"));return n.type="color",n.value=i||"#000000",n.className="basicColorPicker",n.tabIndex=0,n.setAttribute("data-l10n-id",a(cl,om)[t]),n.addEventListener("input",()=>{a(this,Ph).updateParams(e,n.value)},{signal:a(this,Ph)._signal}),n}update(t){a(this,ds)&&(a(this,ds).value=t)}destroy(){a(this,ds)?.remove(),p(this,ds,null)}hideDropdown(){}};ds=new WeakMap,am=new WeakMap,Ph=new WeakMap,om=new WeakMap,x(cl,om,null);q0=cl;W0=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=af(t),[t,t,t]}static G_HTML([t]){let e=vC(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(af)}static RGB_HTML(t){return`#${t.map(vC).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[af(1-Math.min(1,t+n)),af(1-Math.min(1,i+n)),af(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]}},N2=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){ie("Abstract method `_createSVG` called.")}},Pc=class extends N2{_createSVG(t){return document.createElementNS(Us,t)}},CM=9,Oc=new WeakSet,TM=new Date().getTimezoneOffset()*60*1e3,Ff=class{static create(t){switch(t.data.annotationType){case $e.LINK:return new qf(t);case $e.TEXT:return new P2(t);case $e.WIDGET:switch(t.data.fieldType){case"Tx":return new O2(t);case"Btn":return t.data.radioButton?new X0(t):t.data.checkBox?new L2(t):new B2(t);case"Ch":return new U2(t);case"Sig":return new R2(t)}return new Ia(t);case $e.POPUP:return new Wf(t);case $e.FREETEXT:return new Y0(t);case $e.LINE:return new W2(t);case $e.SQUARE:return new X2(t);case $e.CIRCLE:return new Y2(t);case $e.POLYLINE:return new K0(t);case $e.CARET:return new Z2(t);case $e.INK:return new Xf(t);case $e.POLYGON:return new K2(t);case $e.HIGHLIGHT:return new Z0(t);case $e.UNDERLINE:return new J2(t);case $e.SQUIGGLY:return new tw(t);case $e.STRIKEOUT:return new ew(t);case $e.STAMP:return new Q0(t);case $e.FILEATTACHMENT:return new iw(t);default:return new Ne(t)}}},zw=class zw{constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}={}){x(this,lm);x(this,sc,null);x(this,Oh,!1);x(this,cr,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 zw._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;lo?(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;co?(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(`${Rf}${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(`${Rf}${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,cr)?.popup||this.popup)?.remove(),p(this,cr,this.popup=null)}updateEdited(t){if(!this.container)return;t.rect&&(a(this,sc)||p(this,sc,{rect:this.data.rect.slice(0)}));let{rect:e,popup:i}=t;e&&b(this,lm,M2).call(this,e);let n=a(this,cr)?.popup||this.popup;!n&&i?.text&&(this._createPopup(i),n=a(this,cr).popup),n&&(n.updateEdited(t),i?.deleted&&(n.remove(),p(this,cr,null),this.popup=null))}resetEdited(){a(this,sc)&&(b(this,lm,M2).call(this,a(this,sc).rect),a(this,cr)?.popup.resetEdited(),p(this,sc,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 Ia)&&!(this instanceof qf)&&(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 Wf){let{rotation:g}=e;return!e.hasOwnCanvas&&g!==0&&this.setRotation(g,s),s}let{width:l,height:c}=this;if(!t&&e.borderStyle.width>0){o.borderWidth=`${e.borderStyle.width}px`;let g=e.borderStyle.horizontalCornerRadius,A=e.borderStyle.verticalCornerRadius;if(g>0||A>0){let v=`calc(${g}px * var(--total-scale-factor)) / calc(${A}px * var(--total-scale-factor))`;o.borderRadius=v}else if(this instanceof X0){let v=`calc(${l}px * var(--total-scale-factor)) / calc(${c}px * var(--total-scale-factor))`;o.borderRadius=v}switch(e.borderStyle.style){case vu.SOLID:o.borderStyle="solid";break;case vu.DASHED:o.borderStyle="dashed";break;case vu.BEVELED:Mt("Unimplemented border style: beveled");break;case vu.INSET:Mt("Unimplemented border style: inset");break;case vu.UNDERLINE:o.borderBottomStyle="solid";break;default:break}let w=e.borderColor||null;w?(p(this,Oh,!0),o.borderColor=ht.makeHexColor(w[0]|0,w[1]|0,w[2]|0)):o.borderWidth=0}let u=ht.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:y}=e;return e.hasOwnCanvas||y===0?(o.width=`${100*l/h}%`,o.height=`${100*c/d}%`):this.setRotation(y,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]=W0[`${o}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[i]:W0[`${o}_rgb`](l)})};return _t(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(g=>Math.fround(g));if(t.length===8){let[g,A,w,v]=t.subarray(2,6);if(n===g&&s===A&&e===w&&i===v)return}let{style:o}=this.container,l;if(a(this,Oh)){let{borderColor:g,borderWidth:A}=o;o.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'',``],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"),y=`clippath_${this.data.id}`;m.setAttribute("id",y),m.setAttribute("clipPathUnits","objectBoundingBox"),f.append(m);for(let g=2,A=t.length;g`)}a(this,Oh)&&(l.push("')"),o.backgroundImage=l.join("")),this.container.append(d),this.container.style.clipPath=`url(#${y})`}_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,cr,new Wf({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,cr)||this.popup||this.data.popupRef)}get extraPopupElement(){return a(this,cr)}render(){ie("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&&!Oc.has(u)){Mt(`_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&&Oc.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]}};sc=new WeakMap,Oh=new WeakMap,cr=new WeakMap,lm=new WeakSet,M2=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)};Ne=zw,F2=class extends Ne{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()}},qf=class extends Ne{constructor(e,i=null){super(e,{isRenderable:!0,ignoreBorder:!!i?.ignoreBorder,createQuadrilaterals:!0});x(this,zn);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,zn,GT).call(this,n,e.attachment,e.overlaidText,e.attachmentDest),s=!0):e.setOCGState?(b(this,zn,$T).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,zn,sl).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,zn,sl).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,zn,sl).call(this)}_bindResetFormAction(e,i){let n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl("")),b(this,zn,sl).call(this),!this._fieldObjects){Mt('_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:y}of m)d.add(y)}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 y=d.defaultValue||"";u.setValue(f,{value:y});break}case"checkbox":case"radiobutton":{let y=d.defaultValue===d.exportValues;u.setValue(f,{value:y});break}case"combobox":case"listbox":{let y=d.defaultValue||"";u.setValue(f,{value:y});break}default:continue}let m=document.querySelector(`[data-element-id="${f}"]`);if(m){if(!Oc.has(m)){Mt(`_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}}};zn=new WeakSet,sl=function(){this.container.setAttribute("data-internal-link","")},GT=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,zn,sl).call(this)},$T=function(e,i,n=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(i),!1),n&&(e.title=n),b(this,zn,sl).call(this)};P2=class extends Ne{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}},Ia=class extends Ne{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Be.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":ht.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||CM,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/(Vg*n))||1,d=u/h;o=Math.min(n,c(d/Vg))}else{let u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);o=Math.min(n,c(u/Vg))}s.fontSize=`calc(${o}px * var(--total-scale-factor))`,s.color=ht.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)}},O2=class extends Ia{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(` -`)||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),Oc.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",y=>{t.setValue(e,{value:y.target.value}),this.setPropertyOnSiblings(i,"value",y.target.value,"value"),c.formattedValue=null}),i.addEventListener("resetform",y=>{let g=this.data.defaultFieldValue??"";i.value=c.userValue=g,c.formattedValue=null});let m=y=>{let{formattedValue:g}=c;g!=null&&(y.target.value=g),y.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",g=>{if(c.focused)return;let{target:A}=g;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),T=[v.getHours(),v.getMinutes(),v.getSeconds()];A.value=T.map(k=>k.toString().padStart(2,"0")).join(":")}else A.value=new Date(w-TM).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",g=>{this.showElementAndHideCanvas(g.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 T={formattedValue:v};f&&(T.value=v),t.setValue(e,T)},selRange(w){w.target.setSelectionRange(...w.detail.selRange)},charLimit:w=>{let{charLimit:v}=w.detail,{target:T}=w;if(v===0){T.removeAttribute("maxLength");return}T.setAttribute("maxLength",v);let k=c.userValue;!k||k.length<=v||(k=k.slice(0,v),T.value=c.userValue=k,t.setValue(e,{value:k}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:k,willCommit:!0,commitKey:1,selStart:T.selectionStart,selEnd:T.selectionEnd}}))}};this._dispatchEventFromSandbox(A,g)}),i.addEventListener("keydown",g=>{c.commitKey=1;let A=-1;if(g.key==="Escape"?A=0:g.key==="Enter"&&!this.data.multiLine?A=2:g.key==="Tab"&&(c.commitKey=3),A===-1)return;let{value:w}=g.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:g.target.selectionStart,selEnd:g.target.selectionEnd}}))});let y=m;m=null,i.addEventListener("blur",g=>{if(!c.focused||!g.relatedTarget)return;this.data.actions?.Blur||(c.focused=!1);let{target:A}=g,{value:w}=A;if(f){if(w&&h==="time"){let v=w.split(":").map(T=>parseInt(T,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:g.target.selectionStart,selEnd:g.target.selectionEnd}}),y(g)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",g=>{c.lastCommittedValue=null;let{data:A,target:w}=g,{value:v,selectionStart:T,selectionEnd:k}=w,N=T,F=k;switch(g.inputType){case"deleteWordBackward":{let L=v.substring(0,T).match(/\w*[^\w]*$/);L&&(N-=L[0].length);break}case"deleteWordForward":{let L=v.substring(T).match(/^[^\w]*\w*/);L&&(F+=L[0].length);break}case"deleteContentBackward":T===k&&(N-=1);break;case"deleteContentForward":T===k&&(F+=1);break}g.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:v,change:A||"",willCommit:!1,selStart:N,selEnd:F}})}),this._setEventListeners(i,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],g=>g.target.value)}if(m&&i.addEventListener("blur",m),this.data.comb){let g=(this.data.rect[2]-this.data.rect[0])/o;i.classList.add("comb"),i.style.letterSpacing=`calc(${g}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}},R2=class extends Ia{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}},L2=class extends Ia{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 Oc.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}},X0=class extends Ia{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(Oc.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}},B2=class extends qf{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}},U2=class extends Ia{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");Oc.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:y}=n;return y?Array.prototype.filter.call(m,g=>g.selected).map(g=>g[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 y=m.detail.value,g=new Set(Array.isArray(y)?y:[y]);for(let A of n.options)A.selected=g.has(A.value);t.setValue(e,{value:c(!0)}),u=c(!1)},multipleSelection(m){n.multiple=!0},remove(m){let y=n.options,g=m.detail.remove;y[g].selected=!1,n.remove(g),y.length>0&&Array.prototype.findIndex.call(y,w=>w.selected)===-1&&(y[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:y,displayValue:g,exportValue:A}=m.detail.insert,w=n.children[y],v=document.createElement("option");o(v,g),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:y}=m.detail;for(;n.length!==0;)n.remove(0);for(let g of y){let{displayValue:A,exportValue:w}=g,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 y=new Set(m.detail.indices);for(let g of m.target.options)g.selected=y.has(g.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}},Wf=class extends Ne{constructor(e){let{data:i,elements:n,parent:s}=e,o=!!s._commentManager;super(e,{isRenderable:!o&&Ne._hasPopupData(i)});x(this,cm);if(this.elements=n,o&&Ne._hasPopupData(i)){let l=this.popup=b(this,cm,z2).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,cm,z2).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=>`${Nu}${s}`).join(",")),this.container}};cm=new WeakSet,z2=function(){return new j2({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})};j2=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}){x(this,Ot);x(this,Tn,null);x(this,bo,b(this,Ot,WT).bind(this));x(this,Cx,b(this,Ot,q2).bind(this));x(this,Tx,b(this,Ot,p0).bind(this));x(this,Rh,b(this,Ot,f0).bind(this));x(this,Lh,null);x(this,Re,null);x(this,fs,null);x(this,wo,null);x(this,ac,null);x(this,Bh,null);x(this,Uh,null);x(this,ps,!1);x(this,Sn,null);x(this,da,null);x(this,fa,null);x(this,Le,null);x(this,pa,null);x(this,Ao,null);x(this,um,null);x(this,ma,null);x(this,zh,null);x(this,oc,null);x(this,vo,!1);x(this,di,null);x(this,Eo,null);p(this,Re,t),p(this,zh,n),p(this,fs,o),p(this,ma,l),p(this,Bh,c),p(this,Lh,e),p(this,um,u),p(this,Uh,h),p(this,ac,i),p(this,Tn,f),p(this,di,i[0]),p(this,wo,Nc.toDateObject(s)),this.trigger=i.flatMap(m=>m.getElementsToTriggerPopup()),f||(b(this,Ot,h0).call(this),a(this,Re).hidden=!0,d&&b(this,Ot,f0).call(this))}renderCommentButton(){if(a(this,Le)){a(this,Le).parentNode||a(this,di).container.after(a(this,Le));return}if(a(this,pa)||b(this,Ot,H2).call(this),!a(this,pa))return;let{signal:t}=p(this,da,new AbortController),e=a(this,di).hasOwnCommentButton,i=()=>{a(this,Tn).toggleCommentPopup(this,!0,void 0,!e)},n=()=>{a(this,Tn).toggleCommentPopup(this,!1,!0,!e)},s=()=>{a(this,Tn).toggleCommentPopup(this,!1,!1)};if(e){p(this,Le,a(this,di).container);for(let o of this.trigger)o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.addEventListener("keydown",a(this,bo),{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,Le,document.createElement("button"));o.className="annotationCommentButton";let l=a(this,di).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,Ot,$2).call(this),b(this,Ot,G2).call(this),o.addEventListener("keydown",a(this,bo),{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,di).commentData;return t?a(this,Bh)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{a(this,Le)?.focus()},0)}getData(){let{richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}=a(this,di).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}}get elementBeforePopup(){return a(this,Le)}get comment(){return a(this,Eo)||p(this,Eo,a(this,di).commentText),a(this,Eo)}set comment(t){t!==this.comment&&(a(this,di).commentText=p(this,Eo,t))}focus(){a(this,di).container?.focus()}get parentBoundingClientRect(){return a(this,di).layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){a(this,Le)&&(a(this,Le).classList.toggle("selected",t),a(this,Le).ariaExpanded=e)}setSelectedCommentButton(t){a(this,Le).classList.toggle("selected",t)}get commentPopupPosition(){if(a(this,Ao))return a(this,Ao);let{x:t,y:e,height:i}=a(this,Le).getBoundingClientRect(),{x:n,y:s,width:o,height:l}=a(this,di).layer.getBoundingClientRect();return[(t-n)/o,(e+i-s)/l]}set commentPopupPosition(t){p(this,Ao,t)}hasDefaultPopupPosition(){return a(this,Ao)===null}get commentButtonPosition(){return a(this,pa)}get commentButtonWidth(){return a(this,Le).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,i]=a(this,Ao)||this.commentButtonPosition.map(u=>u/100),n=this.parentBoundingClientRect,{x:s,y:o,width:l,height:c}=n;a(this,Tn).showDialog(null,this,s+e*l,o+i*c,{...t,parentDimensions:n})}render(){if(a(this,Sn))return;let t=p(this,Sn,document.createElement("div"));if(t.className="popup",a(this,Lh)){let i=t.style.outlineColor=ht.makeHexColor(...a(this,Lh));t.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`}let e=document.createElement("span");if(e.className="header",a(this,zh)?.str){let i=document.createElement("span");i.className="title",e.append(i),{dir:i.dir,str:i.textContent}=a(this,zh)}if(t.append(e),a(this,wo)){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,wo).valueOf()})),i.dateTime=a(this,wo).toISOString(),e.append(i)}Fw({html:a(this,Ot,d0)||a(this,fs).str,dir:a(this,fs)?.dir,className:"popupContent"},t),a(this,Re).append(t)}updateEdited({rect:t,popup:e,deleted:i}){if(a(this,Tn)){i?(this.remove(),p(this,Eo,null)):e&&(e.deleted?this.remove():(b(this,Ot,$2).call(this),p(this,Eo,e.text))),t&&(p(this,pa,null),b(this,Ot,H2).call(this),b(this,Ot,G2).call(this));return}if(i||e?.deleted){this.remove();return}b(this,Ot,h0).call(this),a(this,oc)||p(this,oc,{contentsObj:a(this,fs),richText:a(this,ma)}),t&&p(this,fa,null),e&&e.text&&(p(this,ma,b(this,Ot,qT).call(this,e.text)),p(this,wo,Nc.toDateObject(e.date)),p(this,fs,null)),a(this,Sn)?.remove(),p(this,Sn,null)}resetEdited(){a(this,oc)&&({contentsObj:Ye(this,fs)._,richText:Ye(this,ma)._}=a(this,oc),p(this,oc,null),a(this,Sn)?.remove(),p(this,Sn,null),p(this,fa,null))}remove(){if(a(this,da)?.abort(),p(this,da,null),a(this,Sn)?.remove(),p(this,Sn,null),p(this,vo,!1),p(this,ps,!1),a(this,Le)?.remove(),p(this,Le,null),this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}forceHide(){p(this,vo,this.isVisible),a(this,vo)&&(a(this,Re).hidden=!0)}maybeShow(){a(this,Tn)||(b(this,Ot,h0).call(this),a(this,vo)&&(a(this,Sn)||b(this,Ot,p0).call(this),p(this,vo,!1),a(this,Re).hidden=!1))}get isVisible(){return a(this,Tn)?!1:a(this,Re).hidden===!1}};Tn=new WeakMap,bo=new WeakMap,Cx=new WeakMap,Tx=new WeakMap,Rh=new WeakMap,Lh=new WeakMap,Re=new WeakMap,fs=new WeakMap,wo=new WeakMap,ac=new WeakMap,Bh=new WeakMap,Uh=new WeakMap,ps=new WeakMap,Sn=new WeakMap,da=new WeakMap,fa=new WeakMap,Le=new WeakMap,pa=new WeakMap,Ao=new WeakMap,um=new WeakMap,ma=new WeakMap,zh=new WeakMap,oc=new WeakMap,vo=new WeakMap,di=new WeakMap,Eo=new WeakMap,Ot=new WeakSet,h0=function(){if(a(this,da))return;p(this,da,new AbortController);let{signal:t}=a(this,da);for(let e of this.trigger)e.addEventListener("click",a(this,Rh),{signal:t}),e.addEventListener("pointerenter",a(this,Tx),{signal:t}),e.addEventListener("pointerleave",a(this,Cx),{signal:t}),e.classList.add("popupTriggerArea");for(let e of a(this,ac))e.container?.addEventListener("keydown",a(this,bo),{signal:t})},H2=function(){let t=a(this,ac).find(e=>e.hasCommentButton);t&&p(this,pa,t._normalizePoint(t.commentButtonPosition))},G2=function(){if(a(this,di).extraPopupElement&&!a(this,di).editor)return;a(this,Le)||this.renderCommentButton();let[t,e]=a(this,pa),{style:i}=a(this,Le);i.left=`calc(${t}%)`,i.top=`calc(${e}% - var(--comment-button-dim))`},$2=function(){a(this,di).extraPopupElement||(a(this,Le)||this.renderCommentButton(),a(this,Le).style.backgroundColor=this.commentButtonColor||"")},d0=function(){let t=a(this,ma),e=a(this,fs);return t?.str&&(!e?.str||e.str===t.str)&&a(this,ma).html||null},V2=function(){return a(this,Ot,d0)?.attributes?.style?.fontSize||0},VT=function(){return a(this,Ot,d0)?.attributes?.style?.color||null},qT=function(t){let e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},n={style:{color:a(this,Ot,VT),fontSize:a(this,Ot,V2)?`calc(${a(this,Ot,V2)}px * var(--total-scale-factor))`:""}};for(let s of t.split(` -`))e.push({name:"span",value:s,attributes:n});return i},WT=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&a(this,ps))&&b(this,Ot,f0).call(this)},XT=function(){if(a(this,fa)!==null)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:s}}}=a(this,Bh),o=!!a(this,Uh),l=o?a(this,Uh):a(this,um);for(let y of a(this,ac))if(!l||ht.intersect(y.data.rect,l)!==null){l=y.data.rect,o=!0;break}let c=ht.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,fa,[100*(d-n)/e,100*(f-s)/i]);let{style:m}=a(this,Re);m.left=`${a(this,fa)[0]}%`,m.top=`${a(this,fa)[1]}%`},f0=function(){if(a(this,Tn)){a(this,Tn).toggleCommentPopup(this,!1);return}p(this,ps,!a(this,ps)),a(this,ps)?(b(this,Ot,p0).call(this),a(this,Re).addEventListener("click",a(this,Rh)),a(this,Re).addEventListener("keydown",a(this,bo))):(b(this,Ot,q2).call(this),a(this,Re).removeEventListener("click",a(this,Rh)),a(this,Re).removeEventListener("keydown",a(this,bo)))},p0=function(){a(this,Sn)||this.render(),this.isVisible?a(this,ps)&&a(this,Re).classList.add("focused"):(b(this,Ot,XT).call(this),a(this,Re).hidden=!1,a(this,Re).style.zIndex=parseInt(a(this,Re).style.zIndex)+1e3)},q2=function(){a(this,Re).classList.remove("focused"),!(a(this,ps)||!this.isVisible)&&(a(this,Re).hidden=!0,a(this,Re).style.zIndex=parseInt(a(this,Re).style.zIndex)-1e3)};Y0=class extends Ne{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=kt.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}},W2=class extends Ne{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,hm,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,hm,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,hm)}addHighlightArea(){this.container.classList.add("highlightArea")}};hm=new WeakMap;X2=class extends Ne{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,dm,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,dm,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,dm)}addHighlightArea(){this.container.classList.add("highlightArea")}};dm=new WeakMap;Y2=class extends Ne{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,fm,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,fm,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,fm)}addHighlightArea(){this.container.classList.add("highlightArea")}};fm=new WeakMap;K0=class extends Ne{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,pm,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=0&&o.setAttribute("stroke-width",i||1),n)for(let l=0,c=a(this,lc).length;l{o.key==="Enter"&&(s?o.metaKey:o.ctrlKey)&&b(this,ym,nw).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,ym=new WeakSet,nw=function(){this.downloadManager?.openOrDownloadData(this.content,this.filename)};jw=class jw{constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:n,page:s,viewport:o,structTreeLayer:l,commentManager:c,linkService:u,annotationStorage:h}){x(this,Ta);x(this,cc,null);x(this,uc,null);x(this,jh,null);x(this,Co,new Map);x(this,bm,null);x(this,hc,null);x(this,Dn,[]);x(this,wm,!1);this.div=t,p(this,cc,e),p(this,uc,i),p(this,bm,l||null),p(this,hc,u||null),p(this,jh,h||new Hf),this.page=s,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=n,this._commentManager=c||null}hasEditableAnnotations(){return a(this,Co).size>0}async render(t){let{annotations:e}=t,i=this.div;Ro(i,this.viewport);let n=new Map,s=[],o={data:null,layer:i,linkService:a(this,hc),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Pc,annotationStorage:a(this,jh),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===$e.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=Ff.create(o);if(!u.isRenderable)continue;c||(a(this,Dn).push(u),l.popupRef&&n.getOrInsertComputed(l.popupRef,Ox).push(u));let h=u.render();l.hidden&&(h.style.visibility="hidden"),u._isEditable&&(a(this,Co).set(u.data.id,u),this._annotationEditorUIManager?.renderAnnotationElement(u))}await b(this,Ta,m0).call(this);for(let l of s){let c=o.elements=n.get(l.id);o.data=l;let u=Ff.create(o);if(!u.isRenderable)continue;let h=u.render();u.contentElement.id=`${Nu}${l.id}`,l.hidden&&(h.style.visibility="hidden"),c.at(-1).container.after(h)}b(this,Ta,rw).call(this)}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:a(this,hc),svgFactory:new Pc,parent:this};for(let i of t){i.borderStyle||(i.borderStyle=jw._defaultBorderStyle),e.data=i;let n=Ff.create(e);n.isRenderable&&(n.render(),n.contentElement.id=`${Nu}${i.id}`,a(this,Dn).push(n))}await b(this,Ta,m0).call(this)}update({viewport:t}){let e=this.div;this.viewport=t,Ro(e,{rotation:t.rotation}),b(this,Ta,rw).call(this),e.hidden=!1}getEditableAnnotations(){return a(this,Co).values()}getEditableAnnotation(t){return a(this,Co).get(t)}addFakeAnnotation(t){let{div:e}=this,{id:i,rotation:n}=t,s=new F2({data:{id:i,rect:t.getPDFRect(),rotation:n},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:a(this,hc),annotationStorage:a(this,jh)});return s.render(),s.contentElement.id=`${Nu}${i}`,s.createOrUpdatePopup(),a(this,Dn).push(s),s}removeAnnotation(t){let e=a(this,Dn).findIndex(n=>n.data.id===t);if(e<0)return;let[i]=a(this,Dn).splice(e,1);a(this,cc)?.removePointerInTextLayer(i.contentElement)}updateFakeAnnotations(t){if(t.length!==0){for(let e of t)e.updateFakeAnnotationElement(this);b(this,Ta,m0).call(this)}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return _t(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:vu.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};cc=new WeakMap,uc=new WeakMap,jh=new WeakMap,Co=new WeakMap,bm=new WeakMap,hc=new WeakMap,Dn=new WeakMap,wm=new WeakMap,Ta=new WeakSet,m0=async function(){if(a(this,Dn).length===0)return;this.div.replaceChildren();let t=[];if(!a(this,wm)){p(this,wm,!0);for(let{contentElement:i,data:{id:n}}of a(this,Dn)){let s=i.id=`${Nu}${n}`;t.push(a(this,bm)?.getAriaAttributes(s).then(o=>{if(o)for(let[l,c]of o)i.setAttribute(l,c)}))}}a(this,Dn).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,y=h,g=c,A=(c+h)/2;if(m>=y&&A<=f)return-1;if(A>=d&&m<=g)return 1;let w=(i+s)/2,v=(l+u)/2;return w-v});let e=document.createDocumentFragment();for(let i of a(this,Dn))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,cc))for(let i of a(this,Dn))a(this,cc).addPointerInTextLayer(i.contentElement,!1)},rw=function(){if(!a(this,uc))return;let t=this.div;for(let[e,i]of a(this,uc)){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,Co).get(e);o&&(o._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,n.id,i),o._hasNoCanvas=!1):o.canvas=i)}a(this,uc).clear()};J0=jw,jg=/\r\n?|\n/g,Ae=class Ae extends be{constructor(e){super({...e,name:"freeTextEditor"});x(this,Je);x(this,In,"");x(this,Am,`${this.id}-editor`);x(this,dc,null);x(this,kn);z(this,"_colorPicker",null);this.color=e.color||Ae._defaultColor||be._defaultLineColor,p(this,kn,e.fontSize||Ae._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static get _keyboardManager(){let e=Ae.prototype,i=o=>o.isEmpty(),n=Lo.TRANSLATE_SMALL,s=Lo.TRANSLATE_BIG;return _t(this,"_keyboardManager",new Fc([[["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){be.initialize(e,i);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,i){switch(e){case Ht.FREETEXT_SIZE:Ae._defaultFontSize=i;break;case Ht.FREETEXT_COLOR:Ae._defaultColor=i;break}}updateParams(e,i){switch(e){case Ht.FREETEXT_SIZE:b(this,Je,YT).call(this,i);break;case Ht.FREETEXT_COLOR:b(this,Je,KT).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[Ht.FREETEXT_SIZE,Ae._defaultFontSize],[Ht.FREETEXT_COLOR,Ae._defaultColor||be._defaultLineColor]]}get propertiesToUpdate(){return[[Ht.FREETEXT_SIZE,a(this,kn)],[Ht.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new q0(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Ht.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[-Ae._internalPadding*e,-(Ae._internalPadding+a(this,kn))*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,dc,new AbortController);let e=this._uiManager.combinedSignal(a(this,dc));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,Am)),this._isDraggable=!0,a(this,dc)?.abort(),p(this,dc,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,In),i=p(this,In,b(this,Je,ZT).call(this).trimEnd());if(e===i)return;let n=s=>{if(p(this,In,s),!s){this.remove();return}b(this,Je,y0).call(this),this._uiManager.rebuild(this),b(this,Je,g0).call(this)};this.addCommands({cmd:()=>{n(i)},undo:()=>{n(e)},mustExec:!1}),b(this,Je,g0).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){Ae._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,Am)),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,kn)}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,y,g;switch(this.rotation){case 0:y=e+(l[0]-f)/h,g=i+this.height-(l[1]-m)/d;break;case 90:y=e+(l[0]-f)/h,g=i-(l[1]-m)/d,[c,u]=[u,-c];break;case 180:y=e-this.width+(l[0]-f)/h,g=i-(l[1]-m)/d,[c,u]=[-c,-u];break;case 270:y=e+(l[0]-f-this.height*d)/h,g=i+(l[1]-m-this.width*h)/d,[c,u]=[-u,c];break}this.setAt(y*s,g*o,c,u)}else this._moveAfterPaste(e,i);b(this,Je,y0).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var y,g,A;let i=e.clipboardData||window.clipboardData,{types:n}=i;if(n.length===1&&n[0]==="text/plain")return;e.preventDefault();let s=b(y=Ae,Sa,aw).call(y,i.getData("text")||"").replaceAll(jg,` +`,Wb=class{constructor(){x(this,bd);x(this,Np,null);x(this,mh,null);x(this,gh,null);x(this,xh,null)}init(){a(this,Np)===null&&p(this,Np,b(this,bd,gT).call(this))}get isReady(){return a(this,mh)!==null}draw(t,e,i,n,s,o){let l=a(this,mh),{offsetX:c,offsetY:u,scaleX:h,scaleY:d}=e,{posData:f,colData:m,vertexCount:y}=b(this,bd,xT).call(this,t,e),g=l.createBuffer({size:Math.max(f.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});f.byteLength>0&&l.queue.writeBuffer(g,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,gh).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:w}}]}),T=new OffscreenCanvas(n,s),I=T.getContext("webgpu");I.configure({device:l,format:a(this,xh),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},F=l.createCommandEncoder(),L=F.beginRenderPass({colorAttachments:[{view:I.getCurrentTexture().createView(),clearValue:_,loadOp:"clear",storeOp:"store"}]});return y>0&&(L.setPipeline(a(this,gh)),L.setBindGroup(0,v),L.setVertexBuffer(0,g),L.setVertexBuffer(1,A),L.draw(y)),L.end(),l.queue.submit([F.finish()]),g.destroy(),A.destroy(),w.destroy(),T.transferToImageBitmap()}};Np=new WeakMap,mh=new WeakMap,gh=new WeakMap,xh=new WeakMap,bd=new WeakSet,gT=async function(){if(!globalThis.navigator?.gpu)return!1;try{let t=await navigator.gpu.requestAdapter();if(!t)return!1;p(this,xh,navigator.gpu.getPreferredCanvasFormat());let e=p(this,mh,await t.requestDevice()),i=e.createShaderModule({code:oM});return p(this,gh,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,xh)}]},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===ul.TRIANGLES)s+=f.length;else if(d.type===ul.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===ul.TRIANGLES)for(let y=0,g=f.length;ythis._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(),ht.applyTransform(n,e),ht.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);ht.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(),ht.applyTransform(i,e),ht.applyTransform(n,e));let s=this._r1,o=this._r0;if(e){let u=new Float32Array(2);ht.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===ki.STROKE||n===ki.FILL){if(this.isOriginBased()){let f=ht.transform(i,e.baseTransform);this.matrix&&(f=ht.transform(f,this.matrix));let m=.001,y=Math.hypot(f[0],f[1]),g=Math.hypot(f[2],f[3]),A=(f[0]*f[2]+f[1]*f[3])/(y*g);if(Math.abs(A)=J?F=u:Y=!0,j>=et?L=h:q=!0;let N=this.getSizeAndScale(F,this.ctx.canvas.width,I),X=this.getSizeAndScale(L,this.ctx.canvas.height,_),O=t.canvasFactory.create(N.size,X.size),C=O.context,D=c.createCanvasGraphics(C,e);if(D.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(D,s,l),C.translate(-N.scale*d,-X.scale*f),D.transform(0,N.scale,0,0,X.scale,0,0),C.save(),D.dependencyTracker?.save(),this.clipBbox(D,d,f,m,y),D.baseTransform=ke(D.ctx),D.executeOperatorList(n),D.endDrawing(),D.dependencyTracker?.restore(),C.restore(),Y||q){let E=O.canvas;Y&&(F=u),q&&(L=h);let S=this.getSizeAndScale(F,this.ctx.canvas.width,I),k=this.getSizeAndScale(L,this.ctx.canvas.height,_),M=S.size,P=k.size,B=t.canvasFactory.create(M,P),$=B.context,U=Y?Math.floor(g/u):0,V=q?Math.floor(A/h):0;for(let Z=0;Z<=U;Z++)for(let Q=0;Q<=V;Q++)$.drawImage(E,M*Z,P*Q,M,P,0,0,M,P);return t.canvasFactory.destroy(O),{canvas:B.canvas,canvasEntry:B,scaleX:S.scale,scaleY:k.scale,offsetX:d,offsetY:f}}return{canvas:O.canvas,canvasEntry:O,scaleX:N.scale,scaleY:X.scale,offsetX:d,offsetY:f}}getSizeAndScale(t,e,i){let n=Math.max(wx.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),ht.axialAlignedBoundingBox([e,i,n,s],ke(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let n=t.ctx,s=t.current;switch(e){case uC.COLORED:let{fillStyle:o,strokeStyle:l}=this.ctx;n.fillStyle=s.fillColor=o,n.strokeStyle=s.strokeColor=l;break;case uC.UNCOLORED:n.fillStyle=n.strokeStyle=i,s.fillColor=s.strokeColor=i;break;default:throw new tb(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,n,s){let o=i;n!==ki.SHADING&&(o=ht.transform(o,e.baseTransform),this.matrix&&(o=ht.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}};z(wx,"MAX_PATTERN_SIZE",3e3);Zb=wx;hC=16,dC=100,pM=15,fC=10,pn=16,Ky=new DOMMatrix,Un=new Float32Array(2),Fu=new Float32Array([1/0,1/0,-1/0,-1/0]);$0=class{constructor(t,e){z(this,"alphaIsShape",!1);z(this,"fontSize",0);z(this,"fontSizeScale",1);z(this,"textMatrix",null);z(this,"textMatrixScale",1);z(this,"fontMatrix",Qy);z(this,"leading",0);z(this,"x",0);z(this,"y",0);z(this,"lineX",0);z(this,"lineY",0);z(this,"charSpacing",0);z(this,"wordSpacing",0);z(this,"textHScale",1);z(this,"textRenderingMode",ri.FILL);z(this,"textRise",0);z(this,"fillColor","#000000");z(this,"strokeColor","#000000");z(this,"patternFill",!1);z(this,"patternStroke",!1);z(this,"fillAlpha",1);z(this,"strokeAlpha",1);z(this,"lineWidth",1);z(this,"activeSMask",null);z(this,"transferMaps","none");z(this,"minMax",Fu.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=ki.FILL,e=null){let i=this.minMax.slice();if(t===ki.STROKE){e||ie("Stroke bounding box must include transform."),ht.singularValueDecompose2dScale(e,Un);let n=Un[0]*this.lineWidth/2,s=Un[1]*this.lineWidth/2;i[0]-=n,i[1]-=s,i[2]+=n,i[3]+=s}return i}updateClipFromPath(){let t=ht.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(Fu,0)}getClippedPathBoundingBox(t=ki.FILL,e=null){return ht.intersect(this.clipBox,this.getPathBoundingBox(t,e))}};gM=["butt","round","square"],xM=["miter","round","bevel"],yM={},xC={},Bw=class Bw{constructor(t,e,i,n,s,{optionalContentConfig:o,markedContentStack:l=null},c,u,h,d){x(this,Br);this.ctx=t,this.current=new $0(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(...ke(this.compositeCtx))}this.ctx.save(),zg(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=ke(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>fC&&typeof i=="function",d=h?Date.now()+pM:0,f=0,m=this.commonObjs,y=this.objs,g,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(g=l[c],A=o[c]??null,g!==hd.dependency)A===null?this[g](c):this[g](c,...A);else for(let w of A){this.dependencyTracker?.recordNamedData(w,c);let v=w.startsWith("g_")?m:y;if(!v.has(w))return v.get(w,i),c}if(c++,c===u)return c;if(h&&++f>fC){if(Date.now()>d)return i(),c;f=0}}}endDrawing(){b(this,Br,Qb).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,Br,Jb).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],T=this.canvasFactory.create(w,v);return T.context.drawImage(t,0,0,i,n,0,0,w,v),{img:T.canvas,paintWidth:w,paintHeight:v,tmpCanvas:T}}let f=this.canvasFactory.create(1,1),m=this.canvasFactory.create(1,1),y=i,g=n,A=t;for(let{newWidth:w,newHeight:v}of l)this.canvasFactory.reset(m,w,v),m.context.drawImage(A,0,0,y,g,0,0,w,v),[f,m]=[m,f],A=f.canvas,y=w,g=v;return this.canvasFactory.destroy(m),{img:f.canvas,paintWidth:y,paintHeight:g,tmpCanvas:f}}_createMaskCanvas(t,e){let i=this.ctx,{width:n,height:s}=e,o=this.current.fillColor,l=this.current.patternFill,c=ke(i),u,h,d,f;if((e.bitmap||e.data)&&e.count>1){let j=e.bitmap||e.data.buffer;h=JSON.stringify(l?c:[c.slice(0,4),o]),u=this._cachedBitmapsMap.getOrInsertComputed(j,Rx);let J=u.get(h);if(J&&!l){let et=Math.round(Math.min(c[0],c[2])+c[4]),N=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(t,Qn.transformAndFill),{canvas:J,offsetX:et,offsetY:N}}d=J}d||(f=this.canvasFactory.create(n,s),mC(f.context,e));let m=ht.transform(c,[1/n,0,0,-1/s,0,0]);m=ht.transform(m,[1,0,0,1,0,-s]);let y=Fu.slice();ht.axialAlignedBoundingBox([0,0,n,s],m,y);let[g,A,w,v]=y,T=Math.round(w-g)||1,I=Math.round(v-A)||1,_=this.canvasFactory.create(T,I),F=_.context,L=g,Y=A;F.translate(-L,-Y),F.transform(...m);let q=null;if(!d){let j=this._scaleImage(f.canvas,Zr(F));d=j.img,q=j.tmpCanvas,d!==f.canvas&&(this.canvasFactory.destroy(f),f=null),u&&l&&(u.set(h,d),q=null,f=null)}F.imageSmoothingEnabled=gC(ke(F),e.interpolate),Ug(F,d,0,0,d.width,d.height,0,0,n,s),q&&this.canvasFactory.destroy(q),f&&this.canvasFactory.destroy(f),F.globalCompositeOperation="source-in";let G=ht.transform(Zr(F),[1,0,0,1,-L,-Y]);return F.fillStyle=l?o.getPattern(i,this,G,ki.FILL,t):o,F.fillRect(0,0,n,s),u&&!l&&u.set(h,_.canvas),this.dependencyTracker?.recordDependencies(t,Qn.transformAndFill),{canvas:_.canvas,canvasEntry:u&&!l?null:_,offsetX:Math.round(L),offsetY:Math.round(Y)}}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=gM[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=xM[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()),sf(this.suspendedCtx,s),mM(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(),sf(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,y=u-d,g=null;if(o)if(m<0||y<0||m+i>f.width||y+n>f.height){g=this.canvasFactory.create(i,n);let w=g.context;w.drawImage(f,-m,-y),w.globalCompositeOperation="destination-atop",w.fillStyle=o,w.fillRect(0,0,i,n),w.globalCompositeOperation="source-over",f=g.canvas,m=y=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let w=new Path2D;w.rect(m,y,i,n),t.clip(w),t.globalCompositeOperation="destination-atop",t.fillStyle=o,t.fillRect(m,y,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,y,i,n,c,u,i,n),e.restore(),g&&this.canvasFactory.destroy(g)}save(t){this.inSMaskMode&&sf(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&&sf(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===hd.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]=_C(s)),ht.axialAlignedBoundingBox(n,ke(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,Zr(n),ki.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,Qn.stroke),i&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(ki.STROKE,ke(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,Zr(n),ki.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,Qn.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,Qn.rawFillPath).recordOperation(t)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=yM}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||Qy,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&Pt("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;idC&&(h=dC),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&ri.FILL_STROKE_MASK,m=!!(h&ri.ADD_TO_PATH_FLAG),y=c.patternFill&&!u.missingFile,g=c.patternStroke&&!u.missingFile,A;if((u.disableFontFace||m||y||g)&&!u.missingFile&&(A=u.getPathGenerator(this.commonObjs,e)),A&&(u.disableFontFace||y||g)){l.save(),l.translate(i,n),l.scale(d,-d),this.dependencyTracker?.recordCharacterBBox(t,l,u);let w;if(f===ri.FILL||f===ri.FILL_STROKE)if(s){w=l.getTransform(),l.setTransform(...s);let v=b(this,Br,t2).call(this,A,w,s);l.fill(v)}else l.fill(A);if(f===ri.STROKE||f===ri.FILL_STROKE)if(o){w||(w=l.getTransform()),l.setTransform(...o);let{a:v,b:T,c:I,d:_}=w,F=ht.inverseTransform(o),L=ht.transform([v,T,I,_,0,0],F);ht.singularValueDecompose2dScale(L,Un),l.lineWidth*=Math.max(Un[0],Un[1])/d,l.stroke(b(this,Br,t2).call(this,A,w,o))}else l.lineWidth/=d,l.stroke(A);l.restore()}else(f===ri.FILL||f===ri.FILL_STROKE)&&(l.fillText(e,i,n),this.dependencyTracker?.recordCharacterBBox(t,l,u,d,i,n,()=>l.measureText(e))),(f===ri.STROKE||f===ri.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,l,u,d,i,n,()=>l.measureText(e)).recordDependencies(t,Qn.stroke),l.strokeText(e,i,n));m&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:ke(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;s0&&i[s]<255){n=!0;break}return Mt(this,"isFontSubpixelAAEnabled",n)}showText(t,e){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,Qn.showText).resetBBox(t),this.current.textRenderingMode&ri.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,y=m?1:-1,g=n.defaultVMetrics,A=s*i.fontMatrix[0],w=i.textRenderingMode===ri.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,T,I=i.textRenderingMode&ri.FILL_STROKE_MASK,_=I===ri.FILL||I===ri.FILL_STROKE,F=I===ri.STROKE||I===ri.FILL_STROKE;if(_&&i.patternFill){o.save();let j=i.fillColor.getPattern(o,this,Zr(o),ki.FILL,t);v=ke(o),o.restore(),o.fillStyle=j}if(F&&i.patternStroke){o.save();let j=i.strokeColor.getPattern(o,this,Zr(o),ki.STROKE,t);T=ke(o),o.restore(),o.strokeStyle=j}let L=i.lineWidth,Y=i.textMatrixScale;if(Y===0||L===0?F&&(L=this.getSinglePixelWidth()):L/=Y,l!==1&&(o.scale(l,l),L/=l),o.lineWidth=L,n.isInvalidPDFjsFont){let j=[],J=0;for(let N of e)j.push(N.unicode),J+=N.width;let et=j.join("");if(o.fillText(et,0,0),this.dependencyTracker!==null){let N=o.measureText(et);this.dependencyTracker.recordBBox(t,this.ctx,-N.actualBoundingBoxLeft,N.actualBoundingBoxRight,-N.actualBoundingBoxAscent,N.actualBoundingBoxDescent).recordShowTextOperation(t)}i.x+=J*A*d,o.restore(),this.compose();return}let q=0,G;for(G=0;G0){E=o.measureText(N);let k=E.width*1e3/s*l;if(DE??o.measureText(N));else if(this.paintChar(t,N,O,C,v,T),X){let k=O+s*X.offset.x/l,M=C-s*X.offset.y/l;this.paintChar(t,X.fontChar,k,M,v,T)}}let S=m?D*A-et*h:D*A+et*h;q+=S,J&&o.restore()}m?i.y-=q:i.x+=q*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||Qy,m=e.length,y=n.textRenderingMode===ri.INVISIBLE,g,A,w,v;if(y||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 T=this.dependencyTracker;for(this.dependencyTracker=T?new U0(T,t):null,g=0;gnew Bw(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new U0(this.dependencyTracker,l,!0):null)};i=new Zb(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=dM(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,Zr(i),ki.SHADING,t);let s=Zr(i);if(s){let{width:o,height:l}=i.canvas,c=Fu.slice();ht.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,Qn.transform).recordDependencies(t,Qn.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){ie("Should not call beginInlineImage")}beginImageData(){ie("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=ke(this.ctx),i)){ht.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||Fx("TODO: Support non-isolated groups."),e.knockout&&Pt("Knockout groups not supported.");let n=ke(i);e.matrix&&i.transform(...e.matrix);let s=[0,0,i.canvas.width,i.canvas.height],o;e.bbox?(o=Fu.slice(),ht.axialAlignedBoundingBox(e.bbox,ke(i),o),o=ht.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,[y,g,A,w]=e.bbox;if(m.rect(y,g,A-y,w-g),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()),sf(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=ke(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...s);let o=Fu.slice();ht.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,Br,Qb).call(this),zg(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,ht.singularValueDecompose2dScale(ke(this.ctx),Un);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(Un[0],0,0,-Un[1],0,c*Un[1]),zg(this.ctx)}else{zg(this.ctx),this.endPath(t);let u=new Path2D;u.rect(i[0],i[1],l,c),this.ctx.clip(u)}}this.current=new $0(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,Br,Jb).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=ke(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;dd?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),Ky.a=1/s,Ky.d=1/o;let c=new Path2D;if(c.addPath(t,Ky),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}};Br=new WeakSet,Qb=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)},Jb=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}}},t2=function(t,e,i){let n=new Path2D;return n.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),n};Ru=Bw;for(let r in hd)Ru.prototype[r]!==void 0&&(Ru.prototype[hd[r]]=Ru.prototype[r]);pd=class{constructor(t,e,i){x(this,_p,null);x(this,Mp,null);z(this,"_fullReader",null);z(this,"_rangeReaders",new Set);z(this,"_source",null);this._source=t,p(this,_p,e),p(this,Mp,i)}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return Ne(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(a(this,_p))(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new(a(this,Mp))(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)}};_p=new WeakMap,Mp=new WeakMap;md=class{constructor(t){z(this,"onProgress",null);z(this,"_contentLength",0);z(this,"_filename",null);z(this,"_headersCapability",Promise.withResolvers());z(this,"_isRangeSupported",!1);z(this,"_isStreamingSupported",!1);z(this,"_loaded",0);z(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(){ie("Abstract method `read` called")}cancel(t){ie("Abstract method `cancel` called")}},gd=class{constructor(t,e,i){z(this,"_stream",null);this._stream=t}async read(){ie("Abstract method `read` called")}cancel(t){ie("Abstract method `cancel` called")}};e2=class extends pd{constructor(e){super(e,i2,n2);z(this,"_responseOrigin",null);let{httpHeaders:i,url:n}=e;Ne(/https?:/.test(n.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=yT(!0,i)}},i2=class extends md{constructor(e){super(e);z(this,"_abortController",new AbortController);z(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);vT(o,c,l,this._abortController).then(u=>{e._responseOrigin=Ux(u.url),ET(u.status,o),this._reader=u.body.getReader();let h=u.headers,{contentLength:d,isRangeSupported:f}=bT({responseHeaders:h,isHttp:!0,rangeChunkSize:s,disableRange:i});this._contentLength=d,this._isRangeSupported=f,this._filename=wT(h),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Lr("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:jx(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},n2=class extends gd{constructor(e,i,n){super(e,i,n);z(this,"_abortController",new AbortController);z(this,"_readCapability",Promise.withResolvers());z(this,"_reader",null);let{url:s,withCredentials:o}=e._source,l=new Headers(e.headers);l.append("Range",`bytes=${i}-${n-1}`),vT(s,l,o,this._abortController).then(c=>{let u=Ux(c.url);AT(u,e._responseOrigin),ET(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:jx(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}};r2=class extends pd{constructor(e){super(e,a2,o2);x(this,Fp);z(this,"_progressiveDone",!1);z(this,"_queuedChunks",[]);let{pdfDataRangeTransport:i}=e,{initialData:n,progressiveDone:s}=i;if(n?.length>0){let o=yC(n);this._queuedChunks.push(o)}this._progressiveDone=s,i.addRangeListener((o,l)=>{b(this,Fp,s2).call(this,o,l)}),i.addProgressiveReadListener(o=>{b(this,Fp,s2).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()}};Fp=new WeakSet,s2=function(e,i){let n=yC(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);Ne(s,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),s._enqueue(n)}};a2=class extends md{constructor(e){super(e);x(this,Pp,Hx.bind(this));z(this,"_done",!1);z(this,"_queuedChunks",null);z(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,Bx(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,Pp).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&a(this,Pp).call(this)}};Pp=new WeakMap;o2=class extends gd{constructor(e,i,n){super(e,i,n);x(this,Op,Hx.bind(this));z(this,"onDone",null);z(this,"_begin",-1);z(this,"_done",!1);z(this,"_queuedChunk",null);z(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,Op).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,Op).call(this),this.onDone?.()}};Op=new WeakMap;Zy=200,bC=206;l2=class extends pd{constructor(e){super(e,c2,u2);x(this,wd);x(this,us,new WeakMap);z(this,"_responseOrigin",null);let{httpHeaders:i,url:n}=e;this.url=n,this.isHttp=/https?:/.test(n.protocol),this.headers=yT(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,us).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===bC||s===Zy):n.validateStatus=s=>s===Zy,i.responseType="arraybuffer",Ne(e.onError,"Expected `onError` callback to be provided."),i.onerror=()=>e.onError(i.status),i.onreadystatechange=b(this,wd,TT).bind(this,i),i.onprogress=b(this,wd,CT).bind(this,i),i.send(null),i}_abortRequest(e){a(this,us).has(e)&&(a(this,us).delete(e),e.abort())}getRangeReader(e,i){let n=super.getRangeReader(e,i);return n&&(n.onClosed=()=>this._rangeReaders.delete(n)),n}};us=new WeakMap,wd=new WeakSet,CT=function(e,i){a(this,us).get(e)?.onProgress?.(i)},TT=function(e,i){let n=a(this,us).get(e);if(!n||(e.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),e.readyState!==4)||!a(this,us).has(e))return;if(a(this,us).delete(e),e.status===0&&this.isHttp){n.onError(e.status);return}let s=e.status||Zy;if(!n.validateStatus(s)){n.onError(e.status);return}let o=wM(e.response);if(s===bC){let l=e.getResponseHeader("Content-Range");/bytes (\d+)-(\d+)\/(\d+)/.test(l)?n.onDone(o):(Pt('Missing or invalid "Content-Range" header.'),n.onError(0))}else o?n.onDone(o):n.onError(e.status)};c2=class extends md{constructor(e){super(e);x(this,Cs);x(this,Rp,Hx.bind(this));z(this,"_cachedChunks",[]);z(this,"_done",!1);z(this,"_requests",[]);z(this,"_storedError",null);this._fullRequestXhr=e._request({onHeadersReceived:b(this,Cs,ST).bind(this),onDone:b(this,Cs,DT).bind(this),onError:b(this,Cs,kT).bind(this),onProgress:b(this,Cs,IT).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,Rp).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}};Rp=new WeakMap,Cs=new WeakSet,ST=function(){let e=this._stream,{disableRange:i,rangeChunkSize:n}=e._source,s=this._fullRequestXhr;e._responseOrigin=Ux(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}=bT({responseHeaders:l,isHttp:e.isHttp,rangeChunkSize:n,disableRange:i});this._contentLength=c,this._isRangeSupported=u,this._filename=wT(l),this._isRangeSupported&&e._abortRequest(s),this._headersCapability.resolve()},DT=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,Rp).call(this)},kT=function(e){this._storedError=zx(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},IT=function(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})};u2=class extends gd{constructor(e,i,n){super(e,i,n);x(this,Na);x(this,Lp,Hx.bind(this));z(this,"onClosed",null);z(this,"_done",!1);z(this,"_queuedChunk",null);z(this,"_requests",[]);z(this,"_storedError",null);this._requestXhr=e._request({begin:i,end:n,onHeadersReceived:b(this,Na,NT).bind(this),onDone:b(this,Na,_T).bind(this),onError:b(this,Na,h2).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,Lp).call(this),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};Lp=new WeakMap,Na=new WeakSet,NT=function(){let e=Ux(this._requestXhr?.responseURL);try{AT(e,this._stream._responseOrigin)}catch(i){this._storedError=i,b(this,Na,h2).call(this,0)}},_T=function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,a(this,Lp).call(this),this.onClosed?.()},h2=function(e){this._storedError??(this._storedError=zx(e,this._stream.url));for(let i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};d2=class extends pd{constructor(t){super(t,f2,p2);let{url:e}=t;Ne(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}},f2=class extends md{constructor(e){super(e);z(this,"_reader",null);let{disableRange:i,disableStream:n,rangeChunkSize:s,url:o}=e._source;this._isStreamingSupported=!n;let l=it.default.getBuiltinModule("fs");l.promises.lstat(o).then(c=>{let u=l.createReadStream(o),h=MT(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 Lr("Streaming is disabled.")),this._headersCapability.resolve()}).catch(c=>{c.code==="ENOENT"&&(c=zx(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:jx(e),done:!1})}cancel(e){this._reader?.cancel(e)}},p2=class extends gd{constructor(e,i,n){super(e,i,n);z(this,"_readCapability",Promise.withResolvers());z(this,"_reader",null);let{url:s}=e._source,o=it.default.getBuiltinModule("fs");try{let l=o.createReadStream(s,{start:i,end:n-1}),c=MT(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:jx(e),done:!1}}cancel(e){this._reader?.cancel(e)}};dr=class{static get workerPort(){return a(this,Bp)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");p(this,Bp,t)}static get workerSrc(){return a(this,Up)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");p(this,Up,t)}};Bp=new WeakMap,Up=new WeakMap,x(dr,Bp,null),x(dr,Up,"");m2=class{constructor({parsedData:t,rawData:e}){x(this,yh);x(this,zp);p(this,yh,t),p(this,zp,e)}getRaw(){return a(this,zp)}get(t){return a(this,yh).get(t)??null}[Symbol.iterator](){return a(this,yh).entries()}};yh=new WeakMap,zp=new WeakMap;Du=Symbol("INTERNAL"),g2=class{constructor(t,{name:e,intent:i,usage:n,rbGroups:s}){x(this,jp,!1);x(this,Hp,!1);x(this,Gp,!1);x(this,bh,!0);p(this,jp,!!(t&Ln.DISPLAY)),p(this,Hp,!!(t&Ln.PRINT)),this.name=e,this.intent=i,this.usage=n,this.rbGroups=s}get visible(){if(a(this,Gp))return a(this,bh);if(!a(this,bh))return!1;let{print:t,view:e}=this.usage;return a(this,jp)?e?.viewState!=="OFF":a(this,Hp)?t?.printState!=="OFF":!0}_setVisible(t,e,i=!1){t!==Du&&ie("Internal method `_setVisible` called."),p(this,Gp,i),p(this,bh,e)}};jp=new WeakMap,Hp=new WeakMap,Gp=new WeakMap,bh=new WeakMap;x2=class{constructor(t,e=Ln.DISPLAY){x(this,$p);x(this,fo,null);x(this,pe,new Map);x(this,wh,null);x(this,Ah,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,p(this,Ah,t.order);for(let i of t.groups)a(this,pe).set(i.id,new g2(e,i));if(t.baseState==="OFF")for(let i of a(this,pe).values())i._setVisible(Du,!1);for(let i of t.on)a(this,pe).get(i)._setVisible(Du,!0);for(let i of t.off)a(this,pe).get(i)._setVisible(Du,!1);p(this,wh,this.getHash())}}isVisible(t){if(a(this,pe).size===0)return!0;if(!t)return Fx("Optional content group not defined."),!0;if(t.type==="OCG")return a(this,pe).has(t.id)?a(this,pe).get(t.id).visible:(Pt(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return b(this,$p,y2).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(let e of t.ids){if(!a(this,pe).has(e))return Pt(`Optional content group not found: ${e}`),!0;if(a(this,pe).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(let e of t.ids){if(!a(this,pe).has(e))return Pt(`Optional content group not found: ${e}`),!0;if(!a(this,pe).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(let e of t.ids){if(!a(this,pe).has(e))return Pt(`Optional content group not found: ${e}`),!0;if(!a(this,pe).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(let e of t.ids){if(!a(this,pe).has(e))return Pt(`Optional content group not found: ${e}`),!0;if(a(this,pe).get(e).visible)return!1}return!0}return Pt(`Unknown optional content policy ${t.policy}.`),!0}return Pt(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,i=!0){let n=a(this,pe).get(t);if(!n){Pt(`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,pe).get(o)?._setVisible(Du,!1,!0);n._setVisible(Du,!!e,!0),p(this,fo,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,pe).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,fo,null)}get hasInitialVisibility(){return a(this,wh)===null||this.getHash()===a(this,wh)}getOrder(){return a(this,pe).size?a(this,Ah)?a(this,Ah).slice():[...a(this,pe).keys()]:null}getGroup(t){return a(this,pe).get(t)||null}getHash(){if(a(this,fo)!==null)return a(this,fo);let t=new L0;for(let[e,i]of a(this,pe))t.update(`${e}:${i.visible}`);return p(this,fo,t.hexdigest())}[Symbol.iterator](){return a(this,pe).entries()}};fo=new WeakMap,pe=new WeakMap,wh=new WeakMap,Ah=new WeakMap,$p=new WeakSet,y2=function(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let n=1;nf===m+1)&&p(this,We,null)}deletePages(t){b(this,zi,bf).call(this);let e=a(this,We),i=b(this,zi,wf).call(this);p(this,hs,{pageNumberToId:e.slice(),pagesNumber:a(this,Ti),prevPageNumbers:a(this,Sr).slice()});let n=a(this,Ti)-t.length;p(this,Ti,n);let s=p(this,We,new Uint32Array(n));p(this,Sr,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}oa(this,We)[e-1])})}cancelCopy(){p(this,Vl,null)}pastePages(t){b(this,zi,bf).call(this);let e=a(this,We),i=b(this,zi,wf).call(this),{pageNumbers:n,pageIds:s}=a(this,Vl),o=a(this,Ti)+n.length;p(this,Ti,o);let l=p(this,We,new Uint32Array(o));p(this,Sr,new Int32Array(o)),l.set(e.subarray(0,t),0),l.set(s,t),l.set(e.subarray(t),t+n.length),b(this,zi,a0).call(this,i,null,t,n),p(this,Vl,null)}hasBeenAltered(){return a(this,We)!==null}getPageMappingForSaving(t=null){t??(t=b(this,zi,wf).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;no[0]-l[0]);for(let o=0,l=n.length;oi-n);let e=new Map;for(let i=0,n=t.length;i=i&&u({...Promise.withResolvers(),data:ku}),V0=class{constructor(){x(this,lr,new Map)}get(t,e=null){if(e){let n=a(this,lr).getOrInsertComputed(t,wC);return n.promise.then(()=>e(n.data)),null}let i=a(this,lr).get(t);if(!i||i.data===ku)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){let e=a(this,lr).get(t);return!!e&&e.data!==ku}delete(t){let e=a(this,lr).get(t);return!e||e.data===ku?!1:(a(this,lr).delete(t),!0)}resolve(t,e=null){let i=a(this,lr).getOrInsertComputed(t,wC);if(i.data!==ku)throw new Error(`Object already resolved ${t}.`);i.data=e,i.resolve()}clear(){for(let{data:t}of a(this,lr).values())t?.bitmap?.close();a(this,lr).clear()}*[Symbol.iterator](){for(let[t,{data:e}]of a(this,lr))e!==ku&&(yield[t,e])}};lr=new WeakMap;vM=1e5,AC=30,Ai=class Ai{constructor({textContentSource:t,images:e,container:i,viewport:n}){x(this,_a);x(this,po,Promise.withResolvers());x(this,Wi,null);x(this,Vp,!1);x(this,qp,!!globalThis.FontInspector?.enabled);x(this,vh,null);x(this,ql,null);x(this,aa,null);x(this,Wp,0);x(this,Xp,0);x(this,Wl,null);x(this,Yp,null);x(this,Eh,0);x(this,mo,0);x(this,Ch,Object.create(null));x(this,Kp,[]);x(this,Th,null);x(this,Xl,[]);x(this,Zp,new WeakMap);x(this,Qp,null);var u;if(t instanceof ReadableStream)p(this,Th,t);else if(typeof t=="object")p(this,Th,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');p(this,Wi,p(this,Yp,i)),p(this,vh,e),p(this,mo,n.scale*Es.pixelRatio),p(this,Eh,n.rotation),p(this,aa,{div:null,properties:null,ctx:null});let{pageWidth:s,pageHeight:o,pageX:l,pageY:c}=n.rawDims;p(this,Qp,[1,0,0,-1,-l,c+o]),p(this,Xp,s),p(this,Wp,o),b(u=Ai,jn,OT).call(u),i.style.setProperty("--min-font-size",a(Ai,Dh)),Ro(i,n),a(this,po).promise.finally(()=>{a(Ai,kh).delete(this),p(this,aa,null),p(this,Ch,null)}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=Be.platform;return Mt(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){a(this,vh)&&a(this,Wi).append(a(this,vh).render());let t=()=>{a(this,Wl).read().then(({value:e,done:i})=>{if(i){a(this,po).resolve();return}a(this,ql)??p(this,ql,e.lang),Object.assign(a(this,Ch),e.styles),b(this,_a,FT).call(this,e.items),t()},a(this,po).reject)};return p(this,Wl,a(this,Th).getReader()),a(Ai,kh).add(this),t(),a(this,po).promise}update({viewport:t,onBefore:e=null}){var s;let i=t.scale*Es.pixelRatio,n=t.rotation;if(n!==a(this,Eh)&&(e?.(),p(this,Eh,n),Ro(a(this,Yp),{rotation:n})),i!==a(this,mo)){e?.(),p(this,mo,i);let o={div:null,properties:null,ctx:b(s=Ai,jn,o0).call(s,a(this,ql))};for(let l of a(this,Xl))o.properties=a(this,Zp).get(l),o.div=l,b(this,_a,w2).call(this,o)}}cancel(){let t=new Lr("TextLayer task cancelled.");a(this,Wl)?.cancel(t).catch(()=>{}),p(this,Wl,null),a(this,po).reject(t)}get textDivs(){return a(this,Xl)}get textContentItemsStr(){return a(this,Kp)}static cleanup(){if(!(a(this,kh).size>0)){a(this,Sh).clear();for(let{canvas:t}of a(this,Yl).values())t.remove();a(this,Yl).clear()}}};po=new WeakMap,Wi=new WeakMap,Vp=new WeakMap,qp=new WeakMap,vh=new WeakMap,ql=new WeakMap,aa=new WeakMap,Wp=new WeakMap,Xp=new WeakMap,Wl=new WeakMap,Yp=new WeakMap,Eh=new WeakMap,mo=new WeakMap,Ch=new WeakMap,Kp=new WeakMap,Th=new WeakMap,Xl=new WeakMap,Zp=new WeakMap,Qp=new WeakMap,Sh=new WeakMap,Yl=new WeakMap,Jp=new WeakMap,Dh=new WeakMap,kh=new WeakMap,_a=new WeakSet,FT=function(t){var n,s;if(a(this,Vp))return;(s=a(this,aa)).ctx??(s.ctx=b(n=Ai,jn,o0).call(n,a(this,ql)));let e=a(this,Xl),i=a(this,Kp);for(let o of t){if(e.length>vM){Pt("Ignoring additional textDivs for performance reasons."),p(this,Vp,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){let l=a(this,Wi);p(this,Wi,document.createElement("span")),a(this,Wi).classList.add("markedContent"),o.id&&a(this,Wi).setAttribute("id",`${o.id}`),o.tag==="Artifact"&&(a(this,Wi).ariaHidden=!0),l.append(a(this,Wi))}else o.type==="endMarkedContent"&&p(this,Wi,a(this,Wi).parentNode);continue}i.push(o.str),b(this,_a,PT).call(this,o)}},PT=function(t){var y;let e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};a(this,Xl).push(e);let n=ht.transform(a(this,Qp),t.transform),s=Math.atan2(n[1],n[0]),o=a(this,Ch)[t.fontName];o.vertical&&(s+=Math.PI/2);let l=a(this,qp)&&o.fontSubstitution||o.fontFamily;l=Ai.fontFamilyMap.get(l)||l;let c=Math.hypot(n[2],n[3]),u=c*b(y=Ai,jn,RT).call(y,l,o,a(this,ql)),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,Xp)).toFixed(2)}%`,f.top=`${(100*d/a(this,Wp)).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,qp)&&(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 g=Math.abs(t.transform[0]),A=Math.abs(t.transform[3]);g!==A&&Math.max(g,A)/Math.min(g,A)>1.5&&(m=!0)}if(m&&(i.canvasWidth=o.vertical?t.height:t.width),a(this,Zp).set(e,i),a(this,aa).div=e,a(this,aa).properties=i,b(this,_a,w2).call(this,a(this,aa)),i.hasText&&a(this,Wi).append(e),i.hasEOL){let g=document.createElement("br");g.setAttribute("role","presentation"),a(this,Wi).append(g)}},w2=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=Ai,jn,A2).call(o,n,u*a(this,mo),l);let{width:h}=n.measureText(e.textContent);h>0&&s.setProperty("--scale-x",c*a(this,mo)/h)}i.angle!==0&&s.setProperty("--rotate",`${i.angle}deg`)},jn=new WeakSet,o0=function(t=null){let e=a(this,Yl).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,Yl).set(t,e),a(this,Jp).set(e,{size:0,family:""})}return e},A2=function(t,e,i){let n=a(this,Jp).get(t);e===n.size&&i===n.family||(t.font=`${e}px ${i}`,n.size=e,n.family=i)},OT=function(){if(a(this,Dh)!==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,Dh,t.getBoundingClientRect().height),t.remove()},RT=function(t,e,i){let n=a(this,Sh).get(t);if(n)return n;let s=b(this,jn,o0).call(this,i);s.canvas.width=s.canvas.height=AC,b(this,jn,A2).call(this,s,AC,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):(Be.platform.isFirefox&&Pt("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,Sh).set(t,u),u},x(Ai,jn),x(Ai,Sh,new Map),x(Ai,Yl,new Map),x(Ai,Jp,new WeakMap),x(Ai,Dh,null),x(Ai,kh,new Set);xd=Ai,EM=100;vx=class vx{constructor(){z(this,"_capability",Promise.withResolvers());z(this,"_transport",null);z(this,"_worker",null);z(this,"docId",`d${Ye(vx,Ax)._++}`);z(this,"destroyed",!1);z(this,"onPassword",null);z(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()}};Ax=new WeakMap,x(vx,Ax,0);v2=vx,$f=class{constructor(t,e,i=!1,n=null){x(this,Ih,Promise.withResolvers());x(this,tm,[]);x(this,em,[]);x(this,im,[]);this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=n,Object.defineProperty(this,"onDataProgress",{value:()=>{eM("`PDFDataRangeTransport.prototype.onDataProgress` - method was removed, since loading progress is now reported automatically through the `PDFDataTransportStream` class (and related code).")}})}addRangeListener(t){a(this,im).push(t)}addProgressiveReadListener(t){a(this,em).push(t)}addProgressiveDoneListener(t){a(this,tm).push(t)}onDataRange(t,e){for(let i of a(this,im))i(t,e)}onDataProgressiveRead(t){a(this,Ih).promise.then(()=>{for(let e of a(this,em))e(t)})}onDataProgressiveDone(){a(this,Ih).promise.then(()=>{for(let t of a(this,tm))t()})}transportReady(){a(this,Ih).resolve()}requestDataRange(t,e){ie("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};Ih=new WeakMap,tm=new WeakMap,em=new WeakMap,im=new WeakMap;E2=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 Mt(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()}},Uw=class Uw{constructor(t,e,i,n,s=!1){x(this,Zl);x(this,oa,!1);x(this,Kl,null);this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new F0:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new V0,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,p(this,Kl,n),this.imageCoordinates=null}clone(t){let e=new Uw(t,this._pageInfo,this._transport,a(this,Kl),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 Uf({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 Mt(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=Ea.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:y=!1,operationsFilter:g=null}){this._stats?.time("Overall");let A=this._transport.getRenderingIntent(n,s,d,f),{renderingIntent:w,cacheKey:v}=A;p(this,oa,!1),c||(c=this._transport.getOptionalContentConfig(w));let T=this._intentStates.getOrInsertComputed(v,M0);T.streamReaderCancelTimeout&&(clearTimeout(T.streamReaderCancelTimeout),T.streamReaderCancelTimeout=null);let I=!!(w&Ln.PRINT);T.displayReadyCapability||(T.displayReadyCapability=Promise.withResolvers(),T.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(A));let _=!!(this._pdfBug&&globalThis.StepperManager?.enabled),F=!!e&&!this.recordedBBoxes&&(y||_),L=!!e&&!this.imageCoordinates&&m,Y=et=>{if(T.renderTasks.delete(j),F){let N=j.gfx?.dependencyTracker.take();N&&(j.stepper?.setOperatorBBoxes(N,j.gfx.dependencyTracker.takeDebugMetadata()),y&&(this.recordedBBoxes=N))}L&&!et&&(this.imageCoordinates=j.gfx?.imagesTracker.take()),I&&p(this,oa,!0),b(this,Zl,Af).call(this),et?(j.capability.reject(et),this._abortOperatorList({intentState:T,reason:et instanceof Error?et:new Error(et)})):j.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},q=null,G=null;(F||L)&&(G=new Sb(e,T.operatorList.length)),F&&(q=new kb(G,_));let j=new D2({callback:Y,params:{canvas:e,canvasContext:t,dependencyTracker:q??G,imagesTracker:L?new Ib(e):null,viewport:i,transform:o,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:T.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!I,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:g});(T.renderTasks||(T.renderTasks=new Set)).add(j);let J=j.task;return Promise.all([T.displayReadyCapability.promise,c]).then(([et,N])=>{if(this.destroyed){Y();return}if(this._stats?.time("Rendering"),!(N.renderingIntent&w))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");j.initializeGraphics({transparency:et,optionalContentConfig:N}),j.operatorListChanged()}).catch(Y),J}getOperatorList({intent:t="display",annotationMode:e=Ea.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,M0),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,Kl).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=>Lf.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,oa,!1),Promise.all(t)}cleanup(t=!1){p(this,oa,!0);let e=b(this,Zl,Af).call(this);return t&&e&&this._stats&&(this._stats=new F0),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{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,Zl,Af).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 fd){let n=EM;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 Lr(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}};oa=new WeakMap,Kl=new WeakMap,Zl=new WeakSet,Af=function(){if(!a(this,oa)||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,oa,!1),!0};C2=Uw,Fe=class Fe{constructor({name:t=null,port:e=null,verbosity:i=W_()}={}){x(this,Zi);x(this,go,Promise.withResolvers());x(this,Dr,null);x(this,la,null);x(this,Ql,null);if(this.name=t,this.destroyed=!1,this.verbosity=i,e){if(a(Fe,tc).has(e))throw new Error("Cannot use more than one PDFWorker per port.");a(Fe,tc).set(e,this),b(this,Zi,BT).call(this,e)}else b(this,Zi,UT).call(this)}get promise(){return a(this,go).promise}get port(){return a(this,la)}get messageHandler(){return a(this,Dr)}destroy(){this.destroyed=!0,a(this,Ql)?.terminate(),p(this,Ql,null),a(Fe,tc).delete(a(this,la)),p(this,la,null),a(this,Dr)?.destroy(),p(this,Dr,null)}static create(t){let e=a(this,tc).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 Fe(t)}static get workerSrc(){if(dr.workerSrc)return dr.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Mt(this,"_setupFakeWorkerGlobal",(async()=>a(this,Nh,c0)?a(this,Nh,c0):(await import(/* @vite-ignore */ this.workerSrc)).WorkerMessageHandler)())}};go=new WeakMap,Dr=new WeakMap,la=new WeakMap,Ql=new WeakMap,Ex=new WeakMap,Jl=new WeakMap,tc=new WeakMap,Zi=new WeakSet,l0=function(){a(this,go).resolve(),a(this,Dr).send("configure",{verbosity:this.verbosity})},BT=function(t){p(this,la,t),p(this,Dr,new hl("main","worker",t)),a(this,Dr).on("ready",()=>{}),b(this,Zi,l0).call(this)},UT=function(){if(a(Fe,Jl)||a(Fe,Nh,c0)){b(this,Zi,vf).call(this);return}let{workerSrc:t}=Fe;try{Fe._isSameOrigin(window.location,t)||(t=Fe._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new hl("main","worker",e),n=()=>{s.abort(),i.destroy(),e.terminate(),this.destroyed?a(this,go).reject(new Error("Worker was destroyed")):b(this,Zi,vf).call(this)},s=new AbortController;e.addEventListener("error",()=>{a(this,Ql)||n()},{signal:s.signal}),i.on("test",l=>{if(s.abort(),this.destroyed||!l){n();return}p(this,Dr,i),p(this,la,e),p(this,Ql,e),b(this,Zi,l0).call(this)}),i.on("ready",l=>{if(s.abort(),this.destroyed){n();return}try{o()}catch{b(this,Zi,vf).call(this)}});let o=()=>{let l=new Uint8Array;i.send("test",l,[l.buffer])};o();return}catch{Fx("The worker has been disabled.")}b(this,Zi,vf).call(this)},vf=function(){a(Fe,Jl)||(Pt("Setting up fake worker."),p(Fe,Jl,!0)),Fe._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){a(this,go).reject(new Error("Worker was destroyed"));return}let e=new Ub;p(this,la,e);let i=`fake${Ye(Fe,Ex)._++}`,n=new hl(i+"_worker",i,e);t.setup(n,e),p(this,Dr,new hl(i,i+"_worker",e)),b(this,Zi,l0).call(this)}).catch(t=>{a(this,go).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},Nh=new WeakSet,c0=function(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}},x(Fe,Nh),x(Fe,Ex,0),x(Fe,Jl,!1),x(Fe,tc,new WeakMap),Bn&&(p(Fe,Jl,!0),dr.workerSrc||(dr.workerSrc="./pdf.worker.mjs")),Fe._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},Fe._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};yd=Fe,T2=class{constructor(t,e,i,n,s,o){x(this,Rr);z(this,"downloadInfoCapability",Promise.withResolvers());x(this,En,null);x(this,ec,new Map);x(this,ca,null);x(this,kr,new Map);x(this,ic,new Map);x(this,_h,new Map);x(this,ua,null);this.messageHandler=t,this.loadingTask=e,p(this,ca,i),this.commonObjs=new V0,this.fontLoader=new Nb({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,kr).set(e,t),a(this,ic).set(e,Promise.resolve(t))}get annotationStorage(){return Mt(this,"annotationStorage",new Hf)}getRenderingIntent(t,e=Ea.ENABLE,i=null,n=!1,s=!1){let o=Ln.DISPLAY,l=jf;switch(t){case"any":o=Ln.ANY;break;case"display":break;case"print":o=Ln.PRINT;break;default:Pt(`getRenderingIntent - invalid intent: ${t}`)}let c=o&Ln.PRINT&&i instanceof B0?i:this.annotationStorage;switch(e){case Ea.DISABLE:o+=Ln.ANNOTATIONS_DISABLE;break;case Ea.ENABLE:break;case Ea.ENABLE_FORMS:o+=Ln.ANNOTATIONS_FORMS;break;case Ea.ENABLE_STORAGE:o+=Ln.ANNOTATIONS_STORAGE,l=c.serializable;break;default:Pt(`getRenderingIntent - invalid annotationMode: ${e}`)}n&&(o+=Ln.IS_EDITING),s&&(o+=Ln.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,ua)?.reject(new Error("Worker was destroyed during onPassword callback"));let t=[];for(let i of a(this,kr).values())t.push(i._destroy());a(this,kr).clear(),a(this,ic).clear(),a(this,_h).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,ec).clear(),this.filterFactory.destroy(),xd.cleanup(),a(this,ca)?.cancelAllRequests(new Lr("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)=>{Ne(a(this,ca),"GetReader - no `BasePDFStream` instance available."),p(this,En,a(this,ca).getFullReader()),a(this,En).onProgress=s=>b(this,Rr,u0).call(this,s),n.onPull=()=>{a(this,En).read().then(function({value:s,done:o}){if(o){n.close();return}Ne(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{n.error(s)})},n.onCancel=s=>{a(this,En).cancel(s),n.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("ReaderHeadersReady",async i=>{await a(this,En).headersReady;let{isStreamingSupported:n,isRangeSupported:s,contentLength:o}=a(this,En);return n&&s&&(a(this,En).onProgress=null),{isStreamingSupported:n,isRangeSupported:s,contentLength:o}}),t.on("GetRangeReader",(i,n)=>{Ne(a(this,ca),"GetRangeReader - no `BasePDFStream` instance available.");let s=a(this,ca).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}Ne(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 E2(i,this))}),t.on("DocException",i=>{e._capability.reject(on(i))}),t.on("PasswordRequest",i=>{p(this,ua,Promise.withResolvers());try{if(!e.onPassword)throw on(i);let n=s=>{s instanceof Error?a(this,ua).reject(s):a(this,ua).resolve({password:s})};e.onPassword(n,i.code)}catch(n){a(this,ua).reject(n)}return a(this,ua).promise}),t.on("DataLoaded",i=>{b(this,Rr,u0).call(this,{loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)}),t.on("StartRenderPage",i=>{if(this.destroyed)return;a(this,kr).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;Pt(`Error during font loading: ${d}`),this.commonObjs.resolve(i,d);break}let o=new Pb(s),l=this._params.pdfBug&&globalThis.FontInspector?.enabled?(d,f)=>globalThis.FontInspector.fontAdded(d,f):null,c=new _b(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;Ne(u,"The imageRef must be defined.");for(let d of a(this,kr).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 Lb(s));break;case"Image":this.commonObjs.resolve(i,s);break;case"Pattern":let h=new Rb(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,kr).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,Rr,u0).call(this,i)}),t.on("PrepareWebGPU",()=>{this.destroyed||lM()}),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&&Pt("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,En)?.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,ic).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,_h).set(o.refStr,i);let l=new C2(e,o,this,this.pagesMapper,this._params.pdfBug);return a(this,kr).set(e,l),l});return a(this,ic).set(e,s),s}async getPageIndex(t){if(!Bb(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,Rr,Ef).call(this,"GetFieldObjects")}hasJSActions(){return b(this,Rr,Ef).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,Rr,Ef).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,Rr,Ef).call(this,"GetOptionalContentConfig").then(e=>new x2(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata";return a(this,ec).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(e=>({info:e[0],metadata:e[1]?new m2(e[1]):null,contentDispositionFilename:a(this,En)?.filename??null,contentLength:a(this,En)?.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,kr).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),a(this,ec).clear(),this.filterFactory.destroy(!0),xd.cleanup()}}cachedPageNumber(t){if(!Bb(t))return null;let e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,i=a(this,_h).get(e);if(i>=0){let n=this.pagesMapper.getPageNumber(i+1);if(n!==0)return n}return null}};En=new WeakMap,ec=new WeakMap,ca=new WeakMap,kr=new WeakMap,ic=new WeakMap,_h=new WeakMap,ua=new WeakMap,Rr=new WeakSet,Ef=function(t,e=null){return a(this,ec).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))},u0=function({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:e?oi(Math.round(t/e*100),0,100):NaN})};S2=class{constructor(t){z(this,"_internalRenderTask",null);z(this,"onContinue",null);z(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}},ll=class ll{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:y=null}){x(this,xo,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 S2(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=y}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(a(ll,nc).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(ll,nc).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 Ru(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,xo)&&(window.cancelAnimationFrame(a(this,xo)),p(this,xo,null)),a(ll,nc).delete(this._canvas),t||(t=new fd(`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,xo,window.requestAnimationFrame(()=>{p(this,xo,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(ll,nc).delete(this._canvas),this.callback())))}};xo=new WeakMap,nc=new WeakMap,x(ll,nc,new WeakSet);D2=ll,zT="5.6.205",jT="ada343803",ln=class ln{constructor({editor:t=null,uiManager:e=null}){x(this,me);x(this,Cn,null);x(this,rc,null);x(this,Mh);x(this,ai,null);x(this,nm,!1);x(this,Fh,!1);x(this,ha,null);x(this,rm);x(this,yo,null);x(this,Ir,null);t?(p(this,Fh,!1),p(this,ha,t)):p(this,Fh,!0),p(this,Ir,t?._uiManager||e),p(this,rm,a(this,Ir)._eventBus),p(this,Mh,t?.color?.toUpperCase()||a(this,Ir)?.highlightColors.values().next().value||"#FFFF98"),a(ln,sm)||p(ln,sm,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 Mt(this,"_keyboardManager",new Fc([[["Escape","mac+Escape"],ln.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],ln.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],ln.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],ln.prototype._moveToPrevious],[["Home","mac+Home"],ln.prototype._moveToBeginning],[["End","mac+End"],ln.prototype._moveToEnd]]))}renderButton(){let t=p(this,Cn,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",a(this,ha)&&(t.ariaControls=`${a(this,ha).id}_colorpicker_dropdown`);let e=a(this,Ir)._signal;t.addEventListener("click",b(this,me,rl).bind(this),{signal:e}),t.addEventListener("keydown",b(this,me,N2).bind(this),{signal:e});let i=p(this,rc,document.createElement("span"));return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=a(this,Mh),t.append(i),t}renderMainDropdown(){let t=p(this,ai,b(this,me,k2).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===a(this,Cn)){b(this,me,rl).call(this,t);return}let e=t.target.getAttribute("data-color");e&&b(this,me,I2).call(this,e,t)}_moveToNext(t){if(!a(this,me,za)){b(this,me,rl).call(this,t);return}if(t.target===a(this,Cn)){a(this,ai).firstElementChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===a(this,ai)?.firstElementChild||t.target===a(this,Cn)){a(this,me,za)&&this._hideDropdownFromKeyboard();return}a(this,me,za)||b(this,me,rl).call(this,t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!a(this,me,za)){b(this,me,rl).call(this,t);return}a(this,ai).firstElementChild?.focus()}_moveToEnd(t){if(!a(this,me,za)){b(this,me,rl).call(this,t);return}a(this,ai).lastElementChild?.focus()}hideDropdown(){a(this,ai)?.classList.add("hidden"),a(this,Cn).ariaExpanded="false",a(this,yo)?.abort(),p(this,yo,null)}_hideDropdownFromKeyboard(){if(!a(this,Fh)){if(!a(this,me,za)){a(this,ha)?.unselect();return}this.hideDropdown(),a(this,Cn).focus({preventScroll:!0,focusVisible:a(this,nm)})}}updateColor(t){if(a(this,rc)&&(a(this,rc).style.backgroundColor=t),!a(this,ai))return;let e=a(this,Ir).highlightColors.values();for(let i of a(this,ai).children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){a(this,Cn)?.remove(),p(this,Cn,null),p(this,rc,null),a(this,ai)?.remove(),p(this,ai,null)}};Cn=new WeakMap,rc=new WeakMap,Mh=new WeakMap,ai=new WeakMap,nm=new WeakMap,Fh=new WeakMap,ha=new WeakMap,rm=new WeakMap,yo=new WeakMap,Ir=new WeakMap,sm=new WeakMap,me=new WeakSet,k2=function(){let t=document.createElement("div"),e=a(this,Ir)._signal;t.addEventListener("contextmenu",Hn,{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,ha)&&(t.id=`${a(this,ha).id}_colorpicker_dropdown`);for(let[i,n]of a(this,Ir).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(ln,sm)[i]);let o=document.createElement("span");s.append(o),o.className="swatch",o.style.backgroundColor=n,s.ariaSelected=n===a(this,Mh),s.addEventListener("click",b(this,me,I2).bind(this,n),{signal:e}),t.append(s)}return t.addEventListener("keydown",b(this,me,N2).bind(this),{signal:e}),t},I2=function(t,e){e.stopPropagation(),a(this,rm).dispatch("switchannotationeditorparams",{source:this,type:Gt.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)},N2=function(t){ln._keyboardManager.exec(this,t)},rl=function(t){if(a(this,me,za)){this.hideDropdown();return}if(p(this,nm,t.detail===0),a(this,yo)||(p(this,yo,new AbortController),window.addEventListener("pointerdown",b(this,me,HT).bind(this),{signal:a(this,Ir).combinedSignal(a(this,yo))})),a(this,Cn).ariaExpanded="true",a(this,ai)){a(this,ai).classList.remove("hidden");return}let e=p(this,ai,b(this,me,k2).call(this));a(this,Cn).append(e)},HT=function(t){a(this,ai)?.contains(t.target)||this.hideDropdown()},za=function(){return a(this,ai)&&!a(this,ai).classList.contains("hidden")},x(ln,sm,null);Vf=ln,cl=class cl{constructor(t){x(this,ds,null);x(this,am,null);x(this,Ph,null);p(this,am,t),p(this,Ph,t._uiManager),a(cl,om)||p(cl,om,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(a(this,ds))return a(this,ds);let{editorType:t,colorType:e,color:i}=a(this,am),n=p(this,ds,document.createElement("input"));return n.type="color",n.value=i||"#000000",n.className="basicColorPicker",n.tabIndex=0,n.setAttribute("data-l10n-id",a(cl,om)[t]),n.addEventListener("input",()=>{a(this,Ph).updateParams(e,n.value)},{signal:a(this,Ph)._signal}),n}update(t){a(this,ds)&&(a(this,ds).value=t)}destroy(){a(this,ds)?.remove(),p(this,ds,null)}hideDropdown(){}};ds=new WeakMap,am=new WeakMap,Ph=new WeakMap,om=new WeakMap,x(cl,om,null);q0=cl;W0=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=af(t),[t,t,t]}static G_HTML([t]){let e=vC(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(af)}static RGB_HTML(t){return`#${t.map(vC).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[af(1-Math.min(1,t+n)),af(1-Math.min(1,i+n)),af(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]}},_2=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){ie("Abstract method `_createSVG` called.")}},Pc=class extends _2{_createSVG(t){return document.createElementNS(Us,t)}},CM=9,Oc=new WeakSet,TM=new Date().getTimezoneOffset()*60*1e3,Ff=class{static create(t){switch(t.data.annotationType){case $e.LINK:return new qf(t);case $e.TEXT:return new P2(t);case $e.WIDGET:switch(t.data.fieldType){case"Tx":return new O2(t);case"Btn":return t.data.radioButton?new X0(t):t.data.checkBox?new L2(t):new B2(t);case"Ch":return new U2(t);case"Sig":return new R2(t)}return new ka(t);case $e.POPUP:return new Wf(t);case $e.FREETEXT:return new Y0(t);case $e.LINE:return new W2(t);case $e.SQUARE:return new X2(t);case $e.CIRCLE:return new Y2(t);case $e.POLYLINE:return new K0(t);case $e.CARET:return new Z2(t);case $e.INK:return new Xf(t);case $e.POLYGON:return new K2(t);case $e.HIGHLIGHT:return new Z0(t);case $e.UNDERLINE:return new J2(t);case $e.SQUIGGLY:return new tw(t);case $e.STRIKEOUT:return new ew(t);case $e.STAMP:return new Q0(t);case $e.FILEATTACHMENT:return new iw(t);default:return new _e(t)}}},zw=class zw{constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}={}){x(this,lm);x(this,sc,null);x(this,Oh,!1);x(this,cr,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 zw._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;lo?(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;co?(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(`${Rf}${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(`${Rf}${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,cr)?.popup||this.popup)?.remove(),p(this,cr,this.popup=null)}updateEdited(t){if(!this.container)return;t.rect&&(a(this,sc)||p(this,sc,{rect:this.data.rect.slice(0)}));let{rect:e,popup:i}=t;e&&b(this,lm,M2).call(this,e);let n=a(this,cr)?.popup||this.popup;!n&&i?.text&&(this._createPopup(i),n=a(this,cr).popup),n&&(n.updateEdited(t),i?.deleted&&(n.remove(),p(this,cr,null),this.popup=null))}resetEdited(){a(this,sc)&&(b(this,lm,M2).call(this,a(this,sc).rect),a(this,cr)?.popup.resetEdited(),p(this,sc,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 ka)&&!(this instanceof qf)&&(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 Wf){let{rotation:g}=e;return!e.hasOwnCanvas&&g!==0&&this.setRotation(g,s),s}let{width:l,height:c}=this;if(!t&&e.borderStyle.width>0){o.borderWidth=`${e.borderStyle.width}px`;let g=e.borderStyle.horizontalCornerRadius,A=e.borderStyle.verticalCornerRadius;if(g>0||A>0){let v=`calc(${g}px * var(--total-scale-factor)) / calc(${A}px * var(--total-scale-factor))`;o.borderRadius=v}else if(this instanceof X0){let v=`calc(${l}px * var(--total-scale-factor)) / calc(${c}px * var(--total-scale-factor))`;o.borderRadius=v}switch(e.borderStyle.style){case vu.SOLID:o.borderStyle="solid";break;case vu.DASHED:o.borderStyle="dashed";break;case vu.BEVELED:Pt("Unimplemented border style: beveled");break;case vu.INSET:Pt("Unimplemented border style: inset");break;case vu.UNDERLINE:o.borderBottomStyle="solid";break;default:break}let w=e.borderColor||null;w?(p(this,Oh,!0),o.borderColor=ht.makeHexColor(w[0]|0,w[1]|0,w[2]|0)):o.borderWidth=0}let u=ht.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:y}=e;return e.hasOwnCanvas||y===0?(o.width=`${100*l/h}%`,o.height=`${100*c/d}%`):this.setRotation(y,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]=W0[`${o}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[i]:W0[`${o}_rgb`](l)})};return Mt(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(g=>Math.fround(g));if(t.length===8){let[g,A,w,v]=t.subarray(2,6);if(n===g&&s===A&&e===w&&i===v)return}let{style:o}=this.container,l;if(a(this,Oh)){let{borderColor:g,borderWidth:A}=o;o.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'',``],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"),y=`clippath_${this.data.id}`;m.setAttribute("id",y),m.setAttribute("clipPathUnits","objectBoundingBox"),f.append(m);for(let g=2,A=t.length;g`)}a(this,Oh)&&(l.push("')"),o.backgroundImage=l.join("")),this.container.append(d),this.container.style.clipPath=`url(#${y})`}_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,cr,new Wf({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,cr)||this.popup||this.data.popupRef)}get extraPopupElement(){return a(this,cr)}render(){ie("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&&!Oc.has(u)){Pt(`_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&&Oc.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]}};sc=new WeakMap,Oh=new WeakMap,cr=new WeakMap,lm=new WeakSet,M2=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)};_e=zw,F2=class extends _e{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()}},qf=class extends _e{constructor(e,i=null){super(e,{isRenderable:!0,ignoreBorder:!!i?.ignoreBorder,createQuadrilaterals:!0});x(this,zn);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,zn,GT).call(this,n,e.attachment,e.overlaidText,e.attachmentDest),s=!0):e.setOCGState?(b(this,zn,$T).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,zn,sl).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,zn,sl).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,zn,sl).call(this)}_bindResetFormAction(e,i){let n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl("")),b(this,zn,sl).call(this),!this._fieldObjects){Pt('_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:y}of m)d.add(y)}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 y=d.defaultValue||"";u.setValue(f,{value:y});break}case"checkbox":case"radiobutton":{let y=d.defaultValue===d.exportValues;u.setValue(f,{value:y});break}case"combobox":case"listbox":{let y=d.defaultValue||"";u.setValue(f,{value:y});break}default:continue}let m=document.querySelector(`[data-element-id="${f}"]`);if(m){if(!Oc.has(m)){Pt(`_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}}};zn=new WeakSet,sl=function(){this.container.setAttribute("data-internal-link","")},GT=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,zn,sl).call(this)},$T=function(e,i,n=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(i),!1),n&&(e.title=n),b(this,zn,sl).call(this)};P2=class extends _e{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}},ka=class extends _e{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Be.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":ht.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||CM,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/(Vg*n))||1,d=u/h;o=Math.min(n,c(d/Vg))}else{let u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);o=Math.min(n,c(u/Vg))}s.fontSize=`calc(${o}px * var(--total-scale-factor))`,s.color=ht.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)}},O2=class extends ka{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(` +`)||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),Oc.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",y=>{t.setValue(e,{value:y.target.value}),this.setPropertyOnSiblings(i,"value",y.target.value,"value"),c.formattedValue=null}),i.addEventListener("resetform",y=>{let g=this.data.defaultFieldValue??"";i.value=c.userValue=g,c.formattedValue=null});let m=y=>{let{formattedValue:g}=c;g!=null&&(y.target.value=g),y.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",g=>{if(c.focused)return;let{target:A}=g;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),T=[v.getHours(),v.getMinutes(),v.getSeconds()];A.value=T.map(I=>I.toString().padStart(2,"0")).join(":")}else A.value=new Date(w-TM).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",g=>{this.showElementAndHideCanvas(g.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 T={formattedValue:v};f&&(T.value=v),t.setValue(e,T)},selRange(w){w.target.setSelectionRange(...w.detail.selRange)},charLimit:w=>{let{charLimit:v}=w.detail,{target:T}=w;if(v===0){T.removeAttribute("maxLength");return}T.setAttribute("maxLength",v);let I=c.userValue;!I||I.length<=v||(I=I.slice(0,v),T.value=c.userValue=I,t.setValue(e,{value:I}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:I,willCommit:!0,commitKey:1,selStart:T.selectionStart,selEnd:T.selectionEnd}}))}};this._dispatchEventFromSandbox(A,g)}),i.addEventListener("keydown",g=>{c.commitKey=1;let A=-1;if(g.key==="Escape"?A=0:g.key==="Enter"&&!this.data.multiLine?A=2:g.key==="Tab"&&(c.commitKey=3),A===-1)return;let{value:w}=g.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:g.target.selectionStart,selEnd:g.target.selectionEnd}}))});let y=m;m=null,i.addEventListener("blur",g=>{if(!c.focused||!g.relatedTarget)return;this.data.actions?.Blur||(c.focused=!1);let{target:A}=g,{value:w}=A;if(f){if(w&&h==="time"){let v=w.split(":").map(T=>parseInt(T,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:g.target.selectionStart,selEnd:g.target.selectionEnd}}),y(g)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",g=>{c.lastCommittedValue=null;let{data:A,target:w}=g,{value:v,selectionStart:T,selectionEnd:I}=w,_=T,F=I;switch(g.inputType){case"deleteWordBackward":{let L=v.substring(0,T).match(/\w*[^\w]*$/);L&&(_-=L[0].length);break}case"deleteWordForward":{let L=v.substring(T).match(/^[^\w]*\w*/);L&&(F+=L[0].length);break}case"deleteContentBackward":T===I&&(_-=1);break;case"deleteContentForward":T===I&&(F+=1);break}g.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:v,change:A||"",willCommit:!1,selStart:_,selEnd:F}})}),this._setEventListeners(i,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],g=>g.target.value)}if(m&&i.addEventListener("blur",m),this.data.comb){let g=(this.data.rect[2]-this.data.rect[0])/o;i.classList.add("comb"),i.style.letterSpacing=`calc(${g}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}},R2=class extends ka{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}},L2=class extends ka{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 Oc.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}},X0=class extends ka{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(Oc.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}},B2=class extends qf{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}},U2=class extends ka{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");Oc.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:y}=n;return y?Array.prototype.filter.call(m,g=>g.selected).map(g=>g[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 y=m.detail.value,g=new Set(Array.isArray(y)?y:[y]);for(let A of n.options)A.selected=g.has(A.value);t.setValue(e,{value:c(!0)}),u=c(!1)},multipleSelection(m){n.multiple=!0},remove(m){let y=n.options,g=m.detail.remove;y[g].selected=!1,n.remove(g),y.length>0&&Array.prototype.findIndex.call(y,w=>w.selected)===-1&&(y[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:y,displayValue:g,exportValue:A}=m.detail.insert,w=n.children[y],v=document.createElement("option");o(v,g),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:y}=m.detail;for(;n.length!==0;)n.remove(0);for(let g of y){let{displayValue:A,exportValue:w}=g,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 y=new Set(m.detail.indices);for(let g of m.target.options)g.selected=y.has(g.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}},Wf=class extends _e{constructor(e){let{data:i,elements:n,parent:s}=e,o=!!s._commentManager;super(e,{isRenderable:!o&&_e._hasPopupData(i)});x(this,cm);if(this.elements=n,o&&_e._hasPopupData(i)){let l=this.popup=b(this,cm,z2).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,cm,z2).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=>`${_u}${s}`).join(",")),this.container}};cm=new WeakSet,z2=function(){return new j2({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})};j2=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}){x(this,Lt);x(this,Tn,null);x(this,bo,b(this,Lt,WT).bind(this));x(this,Cx,b(this,Lt,q2).bind(this));x(this,Tx,b(this,Lt,p0).bind(this));x(this,Rh,b(this,Lt,f0).bind(this));x(this,Lh,null);x(this,Re,null);x(this,fs,null);x(this,wo,null);x(this,ac,null);x(this,Bh,null);x(this,Uh,null);x(this,ps,!1);x(this,Sn,null);x(this,da,null);x(this,fa,null);x(this,Le,null);x(this,pa,null);x(this,Ao,null);x(this,um,null);x(this,ma,null);x(this,zh,null);x(this,oc,null);x(this,vo,!1);x(this,di,null);x(this,Eo,null);p(this,Re,t),p(this,zh,n),p(this,fs,o),p(this,ma,l),p(this,Bh,c),p(this,Lh,e),p(this,um,u),p(this,Uh,h),p(this,ac,i),p(this,Tn,f),p(this,di,i[0]),p(this,wo,_c.toDateObject(s)),this.trigger=i.flatMap(m=>m.getElementsToTriggerPopup()),f||(b(this,Lt,h0).call(this),a(this,Re).hidden=!0,d&&b(this,Lt,f0).call(this))}renderCommentButton(){if(a(this,Le)){a(this,Le).parentNode||a(this,di).container.after(a(this,Le));return}if(a(this,pa)||b(this,Lt,H2).call(this),!a(this,pa))return;let{signal:t}=p(this,da,new AbortController),e=a(this,di).hasOwnCommentButton,i=()=>{a(this,Tn).toggleCommentPopup(this,!0,void 0,!e)},n=()=>{a(this,Tn).toggleCommentPopup(this,!1,!0,!e)},s=()=>{a(this,Tn).toggleCommentPopup(this,!1,!1)};if(e){p(this,Le,a(this,di).container);for(let o of this.trigger)o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.addEventListener("keydown",a(this,bo),{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,Le,document.createElement("button"));o.className="annotationCommentButton";let l=a(this,di).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,Lt,$2).call(this),b(this,Lt,G2).call(this),o.addEventListener("keydown",a(this,bo),{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,di).commentData;return t?a(this,Bh)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{a(this,Le)?.focus()},0)}getData(){let{richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}=a(this,di).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}}get elementBeforePopup(){return a(this,Le)}get comment(){return a(this,Eo)||p(this,Eo,a(this,di).commentText),a(this,Eo)}set comment(t){t!==this.comment&&(a(this,di).commentText=p(this,Eo,t))}focus(){a(this,di).container?.focus()}get parentBoundingClientRect(){return a(this,di).layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){a(this,Le)&&(a(this,Le).classList.toggle("selected",t),a(this,Le).ariaExpanded=e)}setSelectedCommentButton(t){a(this,Le).classList.toggle("selected",t)}get commentPopupPosition(){if(a(this,Ao))return a(this,Ao);let{x:t,y:e,height:i}=a(this,Le).getBoundingClientRect(),{x:n,y:s,width:o,height:l}=a(this,di).layer.getBoundingClientRect();return[(t-n)/o,(e+i-s)/l]}set commentPopupPosition(t){p(this,Ao,t)}hasDefaultPopupPosition(){return a(this,Ao)===null}get commentButtonPosition(){return a(this,pa)}get commentButtonWidth(){return a(this,Le).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,i]=a(this,Ao)||this.commentButtonPosition.map(u=>u/100),n=this.parentBoundingClientRect,{x:s,y:o,width:l,height:c}=n;a(this,Tn).showDialog(null,this,s+e*l,o+i*c,{...t,parentDimensions:n})}render(){if(a(this,Sn))return;let t=p(this,Sn,document.createElement("div"));if(t.className="popup",a(this,Lh)){let i=t.style.outlineColor=ht.makeHexColor(...a(this,Lh));t.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`}let e=document.createElement("span");if(e.className="header",a(this,zh)?.str){let i=document.createElement("span");i.className="title",e.append(i),{dir:i.dir,str:i.textContent}=a(this,zh)}if(t.append(e),a(this,wo)){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,wo).valueOf()})),i.dateTime=a(this,wo).toISOString(),e.append(i)}Fw({html:a(this,Lt,d0)||a(this,fs).str,dir:a(this,fs)?.dir,className:"popupContent"},t),a(this,Re).append(t)}updateEdited({rect:t,popup:e,deleted:i}){if(a(this,Tn)){i?(this.remove(),p(this,Eo,null)):e&&(e.deleted?this.remove():(b(this,Lt,$2).call(this),p(this,Eo,e.text))),t&&(p(this,pa,null),b(this,Lt,H2).call(this),b(this,Lt,G2).call(this));return}if(i||e?.deleted){this.remove();return}b(this,Lt,h0).call(this),a(this,oc)||p(this,oc,{contentsObj:a(this,fs),richText:a(this,ma)}),t&&p(this,fa,null),e&&e.text&&(p(this,ma,b(this,Lt,qT).call(this,e.text)),p(this,wo,_c.toDateObject(e.date)),p(this,fs,null)),a(this,Sn)?.remove(),p(this,Sn,null)}resetEdited(){a(this,oc)&&({contentsObj:Ye(this,fs)._,richText:Ye(this,ma)._}=a(this,oc),p(this,oc,null),a(this,Sn)?.remove(),p(this,Sn,null),p(this,fa,null))}remove(){if(a(this,da)?.abort(),p(this,da,null),a(this,Sn)?.remove(),p(this,Sn,null),p(this,vo,!1),p(this,ps,!1),a(this,Le)?.remove(),p(this,Le,null),this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}forceHide(){p(this,vo,this.isVisible),a(this,vo)&&(a(this,Re).hidden=!0)}maybeShow(){a(this,Tn)||(b(this,Lt,h0).call(this),a(this,vo)&&(a(this,Sn)||b(this,Lt,p0).call(this),p(this,vo,!1),a(this,Re).hidden=!1))}get isVisible(){return a(this,Tn)?!1:a(this,Re).hidden===!1}};Tn=new WeakMap,bo=new WeakMap,Cx=new WeakMap,Tx=new WeakMap,Rh=new WeakMap,Lh=new WeakMap,Re=new WeakMap,fs=new WeakMap,wo=new WeakMap,ac=new WeakMap,Bh=new WeakMap,Uh=new WeakMap,ps=new WeakMap,Sn=new WeakMap,da=new WeakMap,fa=new WeakMap,Le=new WeakMap,pa=new WeakMap,Ao=new WeakMap,um=new WeakMap,ma=new WeakMap,zh=new WeakMap,oc=new WeakMap,vo=new WeakMap,di=new WeakMap,Eo=new WeakMap,Lt=new WeakSet,h0=function(){if(a(this,da))return;p(this,da,new AbortController);let{signal:t}=a(this,da);for(let e of this.trigger)e.addEventListener("click",a(this,Rh),{signal:t}),e.addEventListener("pointerenter",a(this,Tx),{signal:t}),e.addEventListener("pointerleave",a(this,Cx),{signal:t}),e.classList.add("popupTriggerArea");for(let e of a(this,ac))e.container?.addEventListener("keydown",a(this,bo),{signal:t})},H2=function(){let t=a(this,ac).find(e=>e.hasCommentButton);t&&p(this,pa,t._normalizePoint(t.commentButtonPosition))},G2=function(){if(a(this,di).extraPopupElement&&!a(this,di).editor)return;a(this,Le)||this.renderCommentButton();let[t,e]=a(this,pa),{style:i}=a(this,Le);i.left=`calc(${t}%)`,i.top=`calc(${e}% - var(--comment-button-dim))`},$2=function(){a(this,di).extraPopupElement||(a(this,Le)||this.renderCommentButton(),a(this,Le).style.backgroundColor=this.commentButtonColor||"")},d0=function(){let t=a(this,ma),e=a(this,fs);return t?.str&&(!e?.str||e.str===t.str)&&a(this,ma).html||null},V2=function(){return a(this,Lt,d0)?.attributes?.style?.fontSize||0},VT=function(){return a(this,Lt,d0)?.attributes?.style?.color||null},qT=function(t){let e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},n={style:{color:a(this,Lt,VT),fontSize:a(this,Lt,V2)?`calc(${a(this,Lt,V2)}px * var(--total-scale-factor))`:""}};for(let s of t.split(` +`))e.push({name:"span",value:s,attributes:n});return i},WT=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&a(this,ps))&&b(this,Lt,f0).call(this)},XT=function(){if(a(this,fa)!==null)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:s}}}=a(this,Bh),o=!!a(this,Uh),l=o?a(this,Uh):a(this,um);for(let y of a(this,ac))if(!l||ht.intersect(y.data.rect,l)!==null){l=y.data.rect,o=!0;break}let c=ht.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,fa,[100*(d-n)/e,100*(f-s)/i]);let{style:m}=a(this,Re);m.left=`${a(this,fa)[0]}%`,m.top=`${a(this,fa)[1]}%`},f0=function(){if(a(this,Tn)){a(this,Tn).toggleCommentPopup(this,!1);return}p(this,ps,!a(this,ps)),a(this,ps)?(b(this,Lt,p0).call(this),a(this,Re).addEventListener("click",a(this,Rh)),a(this,Re).addEventListener("keydown",a(this,bo))):(b(this,Lt,q2).call(this),a(this,Re).removeEventListener("click",a(this,Rh)),a(this,Re).removeEventListener("keydown",a(this,bo)))},p0=function(){a(this,Sn)||this.render(),this.isVisible?a(this,ps)&&a(this,Re).classList.add("focused"):(b(this,Lt,XT).call(this),a(this,Re).hidden=!1,a(this,Re).style.zIndex=parseInt(a(this,Re).style.zIndex)+1e3)},q2=function(){a(this,Re).classList.remove("focused"),!(a(this,ps)||!this.isVisible)&&(a(this,Re).hidden=!0,a(this,Re).style.zIndex=parseInt(a(this,Re).style.zIndex)-1e3)};Y0=class extends _e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=_t.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}},W2=class extends _e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,hm,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,hm,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,hm)}addHighlightArea(){this.container.classList.add("highlightArea")}};hm=new WeakMap;X2=class extends _e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,dm,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,dm,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,dm)}addHighlightArea(){this.container.classList.add("highlightArea")}};dm=new WeakMap;Y2=class extends _e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,fm,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,fm,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,fm)}addHighlightArea(){this.container.classList.add("highlightArea")}};fm=new WeakMap;K0=class extends _e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,pm,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=0&&o.setAttribute("stroke-width",i||1),n)for(let l=0,c=a(this,lc).length;l{o.key==="Enter"&&(s?o.metaKey:o.ctrlKey)&&b(this,ym,nw).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,ym=new WeakSet,nw=function(){this.downloadManager?.openOrDownloadData(this.content,this.filename)};jw=class jw{constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:n,page:s,viewport:o,structTreeLayer:l,commentManager:c,linkService:u,annotationStorage:h}){x(this,Ta);x(this,cc,null);x(this,uc,null);x(this,jh,null);x(this,Co,new Map);x(this,bm,null);x(this,hc,null);x(this,Dn,[]);x(this,wm,!1);this.div=t,p(this,cc,e),p(this,uc,i),p(this,bm,l||null),p(this,hc,u||null),p(this,jh,h||new Hf),this.page=s,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=n,this._commentManager=c||null}hasEditableAnnotations(){return a(this,Co).size>0}async render(t){let{annotations:e}=t,i=this.div;Ro(i,this.viewport);let n=new Map,s=[],o={data:null,layer:i,linkService:a(this,hc),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Pc,annotationStorage:a(this,jh),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===$e.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=Ff.create(o);if(!u.isRenderable)continue;c||(a(this,Dn).push(u),l.popupRef&&n.getOrInsertComputed(l.popupRef,Ox).push(u));let h=u.render();l.hidden&&(h.style.visibility="hidden"),u._isEditable&&(a(this,Co).set(u.data.id,u),this._annotationEditorUIManager?.renderAnnotationElement(u))}await b(this,Ta,m0).call(this);for(let l of s){let c=o.elements=n.get(l.id);o.data=l;let u=Ff.create(o);if(!u.isRenderable)continue;let h=u.render();u.contentElement.id=`${_u}${l.id}`,l.hidden&&(h.style.visibility="hidden"),c.at(-1).container.after(h)}b(this,Ta,rw).call(this)}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:a(this,hc),svgFactory:new Pc,parent:this};for(let i of t){i.borderStyle||(i.borderStyle=jw._defaultBorderStyle),e.data=i;let n=Ff.create(e);n.isRenderable&&(n.render(),n.contentElement.id=`${_u}${i.id}`,a(this,Dn).push(n))}await b(this,Ta,m0).call(this)}update({viewport:t}){let e=this.div;this.viewport=t,Ro(e,{rotation:t.rotation}),b(this,Ta,rw).call(this),e.hidden=!1}getEditableAnnotations(){return a(this,Co).values()}getEditableAnnotation(t){return a(this,Co).get(t)}addFakeAnnotation(t){let{div:e}=this,{id:i,rotation:n}=t,s=new F2({data:{id:i,rect:t.getPDFRect(),rotation:n},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:a(this,hc),annotationStorage:a(this,jh)});return s.render(),s.contentElement.id=`${_u}${i}`,s.createOrUpdatePopup(),a(this,Dn).push(s),s}removeAnnotation(t){let e=a(this,Dn).findIndex(n=>n.data.id===t);if(e<0)return;let[i]=a(this,Dn).splice(e,1);a(this,cc)?.removePointerInTextLayer(i.contentElement)}updateFakeAnnotations(t){if(t.length!==0){for(let e of t)e.updateFakeAnnotationElement(this);b(this,Ta,m0).call(this)}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return Mt(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:vu.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};cc=new WeakMap,uc=new WeakMap,jh=new WeakMap,Co=new WeakMap,bm=new WeakMap,hc=new WeakMap,Dn=new WeakMap,wm=new WeakMap,Ta=new WeakSet,m0=async function(){if(a(this,Dn).length===0)return;this.div.replaceChildren();let t=[];if(!a(this,wm)){p(this,wm,!0);for(let{contentElement:i,data:{id:n}}of a(this,Dn)){let s=i.id=`${_u}${n}`;t.push(a(this,bm)?.getAriaAttributes(s).then(o=>{if(o)for(let[l,c]of o)i.setAttribute(l,c)}))}}a(this,Dn).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,y=h,g=c,A=(c+h)/2;if(m>=y&&A<=f)return-1;if(A>=d&&m<=g)return 1;let w=(i+s)/2,v=(l+u)/2;return w-v});let e=document.createDocumentFragment();for(let i of a(this,Dn))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,cc))for(let i of a(this,Dn))a(this,cc).addPointerInTextLayer(i.contentElement,!1)},rw=function(){if(!a(this,uc))return;let t=this.div;for(let[e,i]of a(this,uc)){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,Co).get(e);o&&(o._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,n.id,i),o._hasNoCanvas=!1):o.canvas=i)}a(this,uc).clear()};J0=jw,jg=/\r\n?|\n/g,Ae=class Ae extends be{constructor(e){super({...e,name:"freeTextEditor"});x(this,Je);x(this,kn,"");x(this,Am,`${this.id}-editor`);x(this,dc,null);x(this,In);z(this,"_colorPicker",null);this.color=e.color||Ae._defaultColor||be._defaultLineColor,p(this,In,e.fontSize||Ae._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static get _keyboardManager(){let e=Ae.prototype,i=o=>o.isEmpty(),n=Lo.TRANSLATE_SMALL,s=Lo.TRANSLATE_BIG;return Mt(this,"_keyboardManager",new Fc([[["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){be.initialize(e,i);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,i){switch(e){case Gt.FREETEXT_SIZE:Ae._defaultFontSize=i;break;case Gt.FREETEXT_COLOR:Ae._defaultColor=i;break}}updateParams(e,i){switch(e){case Gt.FREETEXT_SIZE:b(this,Je,YT).call(this,i);break;case Gt.FREETEXT_COLOR:b(this,Je,KT).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[Gt.FREETEXT_SIZE,Ae._defaultFontSize],[Gt.FREETEXT_COLOR,Ae._defaultColor||be._defaultLineColor]]}get propertiesToUpdate(){return[[Gt.FREETEXT_SIZE,a(this,In)],[Gt.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new q0(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Gt.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[-Ae._internalPadding*e,-(Ae._internalPadding+a(this,In))*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,dc,new AbortController);let e=this._uiManager.combinedSignal(a(this,dc));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,Am)),this._isDraggable=!0,a(this,dc)?.abort(),p(this,dc,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,kn),i=p(this,kn,b(this,Je,ZT).call(this).trimEnd());if(e===i)return;let n=s=>{if(p(this,kn,s),!s){this.remove();return}b(this,Je,y0).call(this),this._uiManager.rebuild(this),b(this,Je,g0).call(this)};this.addCommands({cmd:()=>{n(i)},undo:()=>{n(e)},mustExec:!1}),b(this,Je,g0).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){Ae._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,Am)),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,In)}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,y,g;switch(this.rotation){case 0:y=e+(l[0]-f)/h,g=i+this.height-(l[1]-m)/d;break;case 90:y=e+(l[0]-f)/h,g=i-(l[1]-m)/d,[c,u]=[u,-c];break;case 180:y=e-this.width+(l[0]-f)/h,g=i-(l[1]-m)/d,[c,u]=[-c,-u];break;case 270:y=e+(l[0]-f-this.height*d)/h,g=i+(l[1]-m-this.width*h)/d,[c,u]=[-u,c];break}this.setAt(y*s,g*o,c,u)}else this._moveAfterPaste(e,i);b(this,Je,y0).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var y,g,A;let i=e.clipboardData||window.clipboardData,{types:n}=i;if(n.length===1&&n[0]==="text/plain")return;e.preventDefault();let s=b(y=Ae,Sa,aw).call(y,i.getData("text")||"").replaceAll(jg,` `);if(!s)return;let o=window.getSelection();if(!o.rangeCount)return;this.editorDiv.normalize(),o.deleteFromDocument();let l=o.getRangeAt(0);if(!s.includes(` -`)){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(jg,"")),w!==this.editorDiv){let v=h;for(let T of this.editorDiv.childNodes){if(T===w){v=d;continue}v.push(b(g=Ae,Sa,x0).call(g,T))}}h.push(c.nodeValue.slice(0,u).replaceAll(jg,""))}else if(c===this.editorDiv){let w=h,v=0;for(let T of this.editorDiv.childNodes)v++===u&&(w=d),w.push(b(A=Ae,Sa,x0).call(A,T))}p(this,In,`${h.join(` +`)){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(jg,"")),w!==this.editorDiv){let v=h;for(let T of this.editorDiv.childNodes){if(T===w){v=d;continue}v.push(b(g=Ae,Sa,x0).call(g,T))}}h.push(c.nodeValue.slice(0,u).replaceAll(jg,""))}else if(c===this.editorDiv){let w=h,v=0;for(let T of this.editorDiv.childNodes)v++===u&&(w=d),w.push(b(A=Ae,Sa,x0).call(A,T))}p(this,kn,`${h.join(` `)}${s}${d.join(` -`)}`),b(this,Je,y0).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=Ae._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,i,n){var l;let s=null;if(e instanceof Y0){let{data:{defaultAppearanceData:{fontSize:c,fontColor:u},rect:h,rotation:d,id:f,popupRef:m,richText:y,contentsObj:g,creationDate:A,modificationDate:w},textContent:v,textPosition:T,parent:{page:{pageNumber:k}}}=e;if(!v||v.length===0)return null;s=e={annotationType:kt.FREETEXT,color:Array.from(u),fontSize:c,value:v.join(` -`),position:T,pageIndex:k-1,rect:h.slice(0),rotation:d,annotationElementId:f,id:f,deleted:!1,popupRef:m,comment:g?.str||null,richText:y,creationDate:A,modificationDate:w}}let o=await super.deserialize(e,i,n);return p(o,kn,e.fontSize),o.color=ht.makeHexColor(...e.color),p(o,In,b(l=Ae,Sa,aw).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=be._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(e),{color:i,fontSize:a(this,kn),value:b(this,Je,QT).call(this)});return this.addComment(n),e?(n.isCopy=!0,n):this.annotationElementId&&!b(this,Je,JT).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,kn)}px * var(--total-scale-factor))`,n.color=this.color,i.replaceChildren();for(let s of a(this,In).split(` -`)){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,In)}}),i}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};In=new WeakMap,Am=new WeakMap,dc=new WeakMap,kn=new WeakMap,Je=new WeakSet,YT=function(e){let i=s=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-a(this,kn))*this.parentScale),p(this,kn,s),b(this,Je,g0).call(this)},n=a(this,kn);this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ht.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},KT=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:Ht.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},ZT=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=Ae,Sa,x0).call(n,s)),i=s);return e.join(` -`)},g0=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()},Sa=new WeakSet,x0=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(jg,"")},y0=function(){if(this.editorDiv.replaceChildren(),!!a(this,In))for(let e of a(this,In).split(` -`)){let i=document.createElement("div");i.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(i)}},QT=function(){return a(this,In).replaceAll("\xA0"," ")},aw=function(e){return e.replaceAll(" ","\xA0")},JT=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},x(Ae,Sa),z(Ae,"_freeTextDefaultContent",""),z(Ae,"_internalPadding",0),z(Ae,"_defaultColor",null),z(Ae,"_defaultFontSize",10),z(Ae,"_type","freetext"),z(Ae,"_editorType",kt.FREETEXT);sw=Ae,xt=class{toSVGPath(){ie("Abstract method `toSVGPath` must be implemented.")}get box(){ie("Abstract getter `box` must be implemented.")}serialize(t,e){ie("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=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,oi,eS).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,n,s,o){return new ex(t,e,i,n,s,o)}getOutlines(){let t=a(this,ms),e=a(this,_r),i=a(this,Lt),[n,s,o,l]=a(this,_n),c=new Float32Array((a(this,To)?.length??0)+2);for(let d=0,f=c.length-2;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,oi,rS).call(this,u,h),this.newFreeDrawOutline(u,c,a(this,_n),a(this,$h),a(this,Hh),a(this,Gh))}};_n=new WeakMap,_r=new WeakMap,Hh=new WeakMap,Gh=new WeakMap,ms=new WeakMap,Lt=new WeakMap,fc=new WeakMap,pc=new WeakMap,vm=new WeakMap,Em=new WeakMap,$h=new WeakMap,Vh=new WeakMap,To=new WeakMap,Cm=new WeakMap,Sx=new WeakMap,Dx=new WeakMap,oi=new WeakSet,Cf=function(){let t=a(this,Lt).subarray(4,6),e=a(this,Lt).subarray(16,18),[i,n,s,o]=a(this,_n);return[(a(this,fc)+(t[0]-e[0])/2-i)/s,(a(this,pc)+(t[1]-e[1])/2-n)/o,(a(this,fc)+(e[0]-t[0])/2-i)/s,(a(this,pc)+(e[1]-t[1])/2-n)/o]},tS=function(){let[t,e,i,n]=a(this,_n),[s,o,l,c]=b(this,oi,Cf).call(this);return`M${(a(this,Lt)[2]-t)/i} ${(a(this,Lt)[3]-e)/n} L${(a(this,Lt)[4]-t)/i} ${(a(this,Lt)[5]-e)/n} L${s} ${o} L${l} ${c} L${(a(this,Lt)[16]-t)/i} ${(a(this,Lt)[17]-e)/n} L${(a(this,Lt)[14]-t)/i} ${(a(this,Lt)[15]-e)/n} Z`},eS=function(t){let e=a(this,_r);t.push(`L${e[4]} ${e[5]} Z`)},iS=function(t){let[e,i,n,s]=a(this,_n),o=a(this,Lt).subarray(4,6),l=a(this,Lt).subarray(16,18),[c,u,h,d]=b(this,oi,Cf).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}`)},nS=function(t){let e=a(this,Lt),[i,n,s,o]=a(this,_n),[l,c,u,h]=b(this,oi,Cf).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,_n),a(this,$h),a(this,Hh),a(this,Gh))},rS=function(t,e){let i=a(this,_r);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+=6},sS=function(t,e){let i=a(this,Lt).subarray(4,6),n=a(this,Lt).subarray(16,18),[s,o,l,c]=a(this,_n),[u,h,d,f]=b(this,oi,Cf).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},x(Gs,Cm,8),x(Gs,Sx,2),x(Gs,Dx,a(Gs,Cm)+a(Gs,Sx));tx=Gs,ex=class extends xt{constructor(e,i,n,s,o,l){super();x(this,Ix);x(this,qh);x(this,mc,new Float32Array(4));x(this,ga);x(this,Tm);x(this,Nn);x(this,Sm);x(this,Xe);p(this,Xe,e),p(this,Nn,i),p(this,qh,n),p(this,Sm,s),p(this,ga,o),p(this,Tm,l),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],b(this,Ix,aS).call(this,l);let[c,u,h,d]=a(this,mc);for(let f=0,m=e.length;fw?(l=A,c=w):c===w&&(l=d(l,A)),hf[1]?(l=f[0],c=f[1]):c===f[1]&&(l=d(l,f[0])),he[0]-i[0]||e[1]-i[1]||e[2]-i[2]);let t=[];for(let e of a(this,So))e[3]?(t.push(...b(this,Qi,ow).call(this,e)),b(this,Qi,lS).call(this,e)):(b(this,Qi,cS).call(this,e),t.push(...b(this,Qi,ow).call(this,e)));return b(this,Qi,oS).call(this,t)}};Dm=new WeakMap,Im=new WeakMap,km=new WeakMap,So=new WeakMap,Nr=new WeakMap,Qi=new WeakSet,oS=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;o0;){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 y;if(i.has(h))y=h;else if(i.has(d))y=d;else break;i.delete(y),[l,c,u,h,d]=y,f!==l&&(s.push(f,m,l,m===c?c:u),f=l),m=m===c?u:c}s.push(f,m)}return new lw(n,a(this,Dm),a(this,Im),a(this,km))},b0=function(t){let e=a(this,Nr),i=0,n=e.length-1;for(;i<=n;){let s=i+n>>1,o=e[s][0];if(o===t)return s;o=0;n--){let[s,o]=a(this,Nr)[n];if(s!==t)break;if(s===t&&o===e){a(this,Nr).splice(n,1);return}}},ow=function(t){let[e,i,n]=t,s=[[e,i,n]],o=b(this,Qi,b0).call(this,n);for(let l=0;l=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};lw=class extends xt{constructor(e,i,n,s){super();x(this,_m);x(this,Wh);p(this,Wh,e),p(this,_m,i),this.firstPoint=n,this.lastPoint=s}toSVGPath(){let e=[];for(let i of a(this,Wh)){let[n,s]=i;e.push(`M${n} ${s}`);for(let o=2;o-1?(p(this,Di,!0),b(this,Pt,w0).call(this,e),b(this,Pt,al).call(this)):a(this,xa)&&(p(this,Xh,e.anchorNode),p(this,Nm,e.anchorOffset),p(this,Fm,e.focusNode),p(this,Pm,e.focusOffset),b(this,Pt,uw).call(this),b(this,Pt,al).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){let e=te.prototype;return _t(this,"_keyboardManager",new Fc([[["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,Di)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:a(this,ur),methodOfCreation:a(this,Om)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,i){be.initialize(e,i),te._defaultColor||(te._defaultColor=i.highlightColors?.values().next().value||"#fff066")}static updateDefaultParams(e,i){switch(e){case Ht.HIGHLIGHT_COLOR:te._defaultColor=i;break;case Ht.HIGHLIGHT_THICKNESS:te._defaultThickness=i;break}}translateInPage(e,i){}get toolbarPosition(){return a(this,Kh)}get commentButtonPosition(){return a(this,Yh)}updateParams(e,i){switch(e){case Ht.HIGHLIGHT_COLOR:b(this,Pt,uS).call(this,i);break;case Ht.HIGHLIGHT_THICKNESS:b(this,Pt,hS).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[Ht.HIGHLIGHT_COLOR,te._defaultColor],[Ht.HIGHLIGHT_THICKNESS,te._defaultThickness]]}get propertiesToUpdate(){return[[Ht.HIGHLIGHT_COLOR,this.color||te._defaultColor],[Ht.HIGHLIGHT_THICKNESS,a(this,ur)||te._defaultThickness],[Ht.HIGHLIGHT_FREE,a(this,Di)]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(a(this,Fn),{root:{fill:this.color,"fill-opacity":this.opacity}}),a(this,Mm)?.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",p(this,Mm,new Vf({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,Pt,v0).call(this))}getBaseTranslation(){return[0,0]}getRect(e,i){return super.getRect(e,i,b(this,Pt,v0).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){b(this,Pt,hw).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Pt,al).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let i=!1;this.parent&&!e?b(this,Pt,hw).call(this):e&&(b(this,Pt,al).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,Di)?(e=(e-this.rotation+360)%360,n=b(s=te,pr,ku).call(s,a(this,Mn).box,e)):n=b(o=te,pr,ku).call(o,[this.x,this.y,this.width,this.height],e),i.updateProperties(a(this,Fn),{bbox:n,root:{"data-main-rotation":e}}),i.updateProperties(a(this,Ui),{bbox:b(l=te,pr,ku).call(l,a(this,dn).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;let e=super.render();a(this,Zh)&&(e.setAttribute("aria-label",a(this,Zh)),e.setAttribute("role","mark")),a(this,Di)?e.classList.add("free"):this.div.addEventListener("keydown",b(this,Pt,fS).bind(this),{signal:this._uiManager._signal});let i=p(this,xc,document.createElement("div"));return e.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",i.style.clipPath=a(this,gc),this.setDims(),LC(this,a(this,xc),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{hovered:!1}})}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:b(this,Pt,A0).call(this,!0);break;case 1:case 3:b(this,Pt,A0).call(this,!1);break}}select(){super.select(),a(this,Ui)&&this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),a(this,Ui)&&(this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{selected:!1}}),a(this,Di)||b(this,Pt,A0).call(this,!1))}get _mustFixPosition(){return!a(this,Di)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(a(this,Fn),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(a(this,Ui),{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=y=>{d.abort(),b(this,pr,xS).call(this,e,y)};window.addEventListener("blur",m,{signal:f}),window.addEventListener("pointerup",m,{signal:f}),window.addEventListener("pointerdown",ke,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Hn,{signal:f}),n.addEventListener("pointermove",b(this,pr,gS).bind(this,e),{signal:f}),this._freeHighlight=new Kf({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,T;let s=null;if(e instanceof Z0){let{data:{quadPoints:k,rect:N,rotation:F,id:L,color:Y,opacity:q,popupRef:G,richText:j,contentsObj:tt,creationDate:et,modificationDate:_},parent:{page:{pageNumber:X}}}=e;s=e={annotationType:kt.HIGHLIGHT,color:Array.from(Y),opacity:q,quadPoints:k,boxes:null,pageIndex:X-1,rect:N.slice(0),rotation:F,annotationElementId:L,id:L,deleted:!1,popupRef:G,richText:j,comment:tt?.str||null,creationDate:et,modificationDate:_}}else if(e instanceof Xf){let{data:{inkLists:k,rect:N,rotation:F,id:L,color:Y,borderStyle:{rawWidth:q},popupRef:G,richText:j,contentsObj:tt,creationDate:et,modificationDate:_},parent:{page:{pageNumber:X}}}=e;s=e={annotationType:kt.HIGHLIGHT,color:Array.from(Y),thickness:q,inkLists:k,boxes:null,pageIndex:X-1,rect:N.slice(0),rotation:F,annotationElementId:L,id:L,deleted:!1,popupRef:G,richText:j,comment:tt?.str||null,creationDate:et,modificationDate:_}}let{color:o,quadPoints:l,inkLists:c,outlines:u,opacity:h}=e,d=await super.deserialize(e,i,n);d.color=ht.makeHexColor(...o),d.opacity=h||1,c&&p(d,ur,e.thickness),d._initialData=s,e.comment&&d.setCommentData(e);let[f,m]=d.pageDimensions,[y,g]=d.pageTranslation;if(l){let k=p(d,xa,[]);for(let N=0;N=0)p(this,Fn,i),p(this,gc,n),this.parent.drawLayer.finalizeDraw(i,{bbox:e.box,path:{d:e.toSVGPath()}}),p(this,Ui,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:a(this,dn).box,path:{d:a(this,dn).toSVGPath()}},!0));else if(this.parent){let y=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(a(this,Fn),{bbox:b(f=te,pr,ku).call(f,a(this,Mn).box,(y-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(a(this,Ui),{bbox:b(m=te,pr,ku).call(m,a(this,dn).box,y),path:{d:a(this,dn).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[y,g]=this.parentDimensions;this.x=l,this.y=1-o,this.width=c*g/y,this.height=u*y/g;break}case 180:this.x=1-o,this.y=1-l,this.width=c,this.height=u;break;case 270:{let[y,g]=this.parentDimensions;this.x=1-l,this.y=o,this.width=c*g/y,this.height=u*y/g;break}}let{firstPoint:h}=e;p(this,Yh,[(h[0]-o)/c,(h[1]-l)/u]);let{lastPoint:d}=a(this,dn);p(this,Kh,[(d[0]-o)/c,(d[1]-l)/u])},uS=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,te._defaultOpacity),undo:i.bind(this,n,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ht.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)},hS=function(e){let i=a(this,ur),n=s=>{p(this,ur,s),b(this,Pt,dS).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:Ht.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},dS=function(e){a(this,Di)&&(b(this,Pt,w0).call(this,{highlightOutlines:a(this,Mn).getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims())},hw=function(){a(this,Fn)===null||!this.parent||(this.parent.drawLayer.remove(a(this,Fn)),p(this,Fn,null),this.parent.drawLayer.remove(a(this,Ui)),p(this,Ui,null))},al=function(e=this.parent){a(this,Fn)===null&&({id:Ye(this,Fn)._,clipPathId:Ye(this,gc)._}=e.drawLayer.draw({bbox:a(this,Mn).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:a(this,Di)},path:{d:a(this,Mn).toSVGPath()}},!1,!0),p(this,Ui,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:a(this,Di)},bbox:a(this,dn).box,path:{d:a(this,dn).toSVGPath()}},a(this,Di))),a(this,xc)&&(a(this,xc).style.clipPath=a(this,gc)))},pr=new WeakSet,ku=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]},fS=function(e){te._keyboardManager.exec(this,e)},A0=function(e){if(!a(this,Xh))return;let i=window.getSelection();e?i.setPosition(a(this,Xh),a(this,Nm)):i.setPosition(a(this,Fm),a(this,Pm))},v0=function(){return a(this,Di)?this.rotation:0},pS=function(){if(a(this,Di))return null;let[e,i]=this.pageDimensions,[n,s]=this.pageTranslation,o=a(this,xa),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,y=(1-h)*i+s;l[c]=l[c+4]=m,l[c+1]=l[c+3]=y,l[c+2]=l[c+6]=m+d*e,l[c+5]=l[c+7]=y-f*i,c+=8}return l},mS=function(e){return a(this,Mn).serialize(e,b(this,Pt,v0).call(this))},gS=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=""},yS=function(e){let{color:i}=this._initialData;return this.hasEditedComment||e.color.some((n,s)=>n!==i[s])},x(te,pr),z(te,"_defaultColor",null),z(te,"_defaultOpacity",1),z(te,"_defaultThickness",12),z(te,"_type","highlight"),z(te,"_editorType",kt.HIGHLIGHT),z(te,"_freeHighlightId",-1),z(te,"_freeHighlight",null),z(te,"_freeHighlightClipId","");ix=te,nx=class{constructor(){x(this,yc,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,yc)[t]=e}toSVGProperties(){let t=a(this,yc);return p(this,yc,Object.create(null)),{root:t}}reset(){p(this,yc,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){ie("Not implemented")}};yc=new WeakMap;jt=class jt extends be{constructor(e){super(e);x(this,Wt);x(this,Pn,null);x(this,Qh);z(this,"_colorPicker",null);z(this,"_drawId",null);p(this,Qh,e.mustBeCommitted||!1),this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(e){e.drawOutlines&&(b(this,Wt,dw).call(this,e),b(this,Wt,Tf).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){ie("Not implemented")}static get typesMap(){ie("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(jt,fi).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,Pn).updateProperty(i,c);u&&b(this,Wt,Sf).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,jt._mergeSVGProperties(a(this,Pn).getPathResizingSVGProperties(b(this,Wt,E0).call(this)),{bbox:b(this,Wt,_u).call(this)}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,jt._mergeSVGProperties(a(this,Pn).getPathResizedSVGProperties(b(this,Wt,E0).call(this)),{bbox:b(this,Wt,_u).call(this)}))}_onTranslating(e,i){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:b(this,Wt,_u).call(this)})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,jt._mergeSVGProperties(a(this,Pn).getPathTranslatedSVGProperties(b(this,Wt,E0).call(this),this.parentDimensions),{bbox:b(this,Wt,_u).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,Qh)&&(p(this,Qh,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){b(this,Wt,pw).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Wt,Tf).call(this),b(this,Wt,Sf).call(this,a(this,Pn).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let i=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),b(this,Wt,pw).call(this)):e&&(this._uiManager.addShouldRescale(this),b(this,Wt,Tf).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,jt._mergeSVGProperties({bbox:b(this,Wt,_u).call(this)},a(this,Pn).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&b(this,Wt,Sf).call(this,a(this,Pn).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){ie("Not implemented")}static startDrawing(e,i,n,s){let{target:o,offsetX:l,offsetY:c,pointerId:u,pointerType:h}=s;if(Oi.isInitializedAndDifferentPointerType(h))return;let{viewport:{rotation:d}}=e,{width:f,height:m}=o.getBoundingClientRect(),y=p(jt,bc,new AbortController),g=e.combinedSignal(y);if(Oi.setPointer(h,u),window.addEventListener("pointerup",A=>{Oi.isSamePointerIdOrRemove(A.pointerId)&&this._endDraw(A)},{signal:g}),window.addEventListener("pointercancel",A=>{Oi.isSamePointerIdOrRemove(A.pointerId)&&this._currentParent.endDrawingSession()},{signal:g}),window.addEventListener("pointerdown",A=>{Oi.isSamePointerType(A.pointerType)&&(Oi.initializeAndAddPointerId(A.pointerId),a(jt,fi).isCancellable()&&(a(jt,fi).removeLastElement(),a(jt,fi).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:g}),window.addEventListener("contextmenu",Hn,{signal:g}),o.addEventListener("pointermove",this._drawMove.bind(this),{signal:g}),o.addEventListener("touchmove",A=>{Oi.isSameTimeStamp(A.timeStamp)&&ke(A)},{signal:g}),e.toggleDrawing(),i._editorUndoBar?.hide(),a(jt,fi)){e.drawLayer.updateProperties(this._currentDrawId,a(jt,fi).startNew(l,c,f,m,d));return}i.updateUIForDefaultProperties(this),p(jt,fi,this.createDrawerInstance(l,c,f,m,d)),p(jt,wc,this.getDefaultDrawingOptions()),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(a(jt,wc).toSVGProperties(),a(jt,fi).defaultSVGProperties),!0,!1)}static _drawMove(e){if(Oi.isSameTimeStamp(e.timeStamp),!a(jt,fi))return;let{offsetX:i,offsetY:n,pointerId:s}=e;if(Oi.isSamePointerId(s)){if(Oi.isUsingMultiplePointers()){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,a(jt,fi).add(i,n)),Oi.setTimeStamp(e.timeStamp),ke(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,p(jt,fi,null),p(jt,wc,null),Oi.clearTimeStamp()),a(jt,bc)&&(a(jt,bc).abort(),p(jt,bc,null),Oi.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(jt,fi).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){let n=a(jt,fi),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:Ht.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){let i=this._currentParent;if(!i)return null;if(i.toggleDrawing(!0),i.cleanUndoStack(Ht.DRAW_STEP),!a(jt,fi).isEmpty()){let{pageDimensions:[n,s],scale:o}=i,l=i.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:a(jt,fi).getOutlines(n*o,s*o,o,this._INNER_MARGIN),drawingOptions:a(jt,wc),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){ie("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,Wt,dw).call(d,{drawOutlines:u}),b(f=h,Wt,Tf).call(f),h.onScaleChanging(),h.rotate(),h}serializeDraw(e){let[i,n]=this.pageTranslation,[s,o]=this.pageDimensions;return a(this,Pn).serialize([i,n,s,o],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};Pn=new WeakMap,Qh=new WeakMap,fi=new WeakMap,bc=new WeakMap,wc=new WeakMap,Wt=new WeakSet,dw=function({drawOutlines:e,drawId:i,drawingOptions:n}){p(this,Pn,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,Wt,fw).call(this,e,this.parent),b(this,Wt,Sf).call(this,e.box)},fw=function(e,i){let{id:n}=i.drawLayer.draw(jt._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n},pw=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},Tf=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,Wt,fw).call(this,a(this,Pn),e)}},bS=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]}},E0=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]}},Sf=function(e){[this.x,this.y,this.width,this.height]=b(this,Wt,bS).call(this,e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},_u=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]}},z(jt,"_currentDrawId",-1),z(jt,"_currentParent",null),x(jt,fi,null),x(jt,bc,null),x(jt,wc,null),z(jt,"_INNER_MARGIN",3);rx=jt,mw=class{constructor(t,e,i,n,s,o){x(this,td);x(this,gs,new Float64Array(6));x(this,pi);x(this,mi);x(this,Ac);x(this,Jh);x(this,Xi);x(this,Ii,"");x(this,hr,0);x(this,vc,new Rc);x(this,Ec);x(this,Cc);p(this,Ec,i),p(this,Cc,n),p(this,Ac,s),p(this,Jh,o),[t,e]=b(this,td,C0).call(this,t,e);let l=p(this,pi,[NaN,NaN,NaN,NaN,t,e]);p(this,Xi,[t,e]),p(this,mi,[{line:l,points:a(this,Xi)}]),a(this,gs).set(l,0)}updateProperty(t,e){t==="stroke-width"&&p(this,Jh,e)}isEmpty(){return!a(this,mi)||a(this,mi).length===0}isCancellable(){return a(this,Xi).length<=10}add(t,e){[t,e]=b(this,td,C0).call(this,t,e);let[i,n,s,o]=a(this,gs).subarray(2,6),l=t-s,c=e-o;return Math.hypot(a(this,Ec)*l,a(this,Cc)*c)<=2?null:(a(this,Xi).push(t,e),isNaN(i)?(a(this,gs).set([s,o,t,e],2),a(this,pi).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(a(this,gs)[0])&&a(this,pi).splice(6,6),a(this,gs).set([i,n,s,o,t,e],0),a(this,pi).push(...xt.createBezierPoints(i,n,s,o,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){let i=this.add(t,e);return i||(a(this,Xi).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,n,s){p(this,Ec,i),p(this,Cc,n),p(this,Ac,s),[t,e]=b(this,td,C0).call(this,t,e);let o=p(this,pi,[NaN,NaN,NaN,NaN,t,e]);p(this,Xi,[t,e]);let l=a(this,mi).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),a(this,mi).push({line:o,points:a(this,Xi)}),a(this,gs).set(o,0),p(this,hr,0),this.toSVGPath(),null}getLastElement(){return a(this,mi).at(-1)}setLastElement(t){return a(this,mi)?(a(this,mi).push(t),p(this,pi,t.line),p(this,Xi,t.points),p(this,hr,0),{path:{d:this.toSVGPath()}}):a(this,vc).setLastElement(t)}removeLastElement(){if(!a(this,mi))return a(this,vc).removeLastElement();a(this,mi).pop(),p(this,Ii,"");for(let t=0,e=a(this,mi).length;tk??NaN),f,m,y,g),points:A(c[v].map(k=>k??NaN),f,m,y,g)});let w=new this.prototype.constructor;return w.build(d,n,s,1,u,h,o),w}get box(){return a(this,Yi)}updateProperty(e,i){return e==="stroke-width"?b(this,_i,vS).call(this,i):null}updateParentDimensions([e,i],n){let[s,o]=b(this,_i,js).call(this);p(this,xs,e),p(this,ys,i),p(this,ed,n);let[l,c]=b(this,_i,js).call(this),u=l-s,h=c-o,d=a(this,Yi);return d[0]-=u,d[1]-=h,d[2]+=2*u,d[3]+=2*h,d}updateRotation(e){return p(this,Rm,e),{path:{transform:this.rotationTransform}}}get viewBox(){return a(this,Yi).map(xt.svgRound).join(" ")}get defaultProperties(){let[e,i]=a(this,Yi);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`}}}get rotationTransform(){let[,,e,i]=a(this,Yi),n=0,s=0,o=0,l=0,c=0,u=0;switch(a(this,Rm)){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} ${xt.svgRound(c)} ${xt.svgRound(u)})`}getPathResizingSVGProperties([e,i,n,s]){let[o,l]=b(this,_i,js).call(this),[c,u,h,d]=a(this,Yi);if(Math.abs(h-o)<=xt.PRECISION||Math.abs(d-l)<=xt.PRECISION){let A=e+n/2-(c+h/2),w=i+s/2-(u+d/2);return{path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`,transform:`${this.rotationTransform} translate(${A} ${w})`}}}let f=(n-2*o)/(h-2*o),m=(s-2*l)/(d-2*l),y=h/n,g=d/s;return{path:{"transform-origin":`${xt.svgRound(c)} ${xt.svgRound(u)}`,transform:`${this.rotationTransform} scale(${y} ${g}) translate(${xt.svgRound(o)} ${xt.svgRound(l)}) scale(${f} ${m}) translate(${xt.svgRound(-o)} ${xt.svgRound(-l)})`}}}getPathResizedSVGProperties([e,i,n,s]){let[o,l]=b(this,_i,js).call(this),c=a(this,Yi),[u,h,d,f]=c;if(c[0]=e,c[1]=i,c[2]=n,c[3]=s,Math.abs(d-o)<=xt.PRECISION||Math.abs(f-l)<=xt.PRECISION){let w=e+n/2-(u+d/2),v=i+s/2-(h+f/2);for(let{line:T,points:k}of a(this,On))xt._translate(T,w,v,T),xt._translate(k,w,v,k);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let m=(n-2*o)/(d-2*o),y=(s-2*l)/(f-2*l),g=-m*(u+o)+e+o,A=-y*(h+l)+i+l;if(m!==1||y!==1||g!==0||A!==0)for(let{line:w,points:v}of a(this,On))xt._rescale(w,g,A,m,y,w),xt._rescale(v,g,A,m,y,v);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,i],n){let[s,o]=n,l=a(this,Yi),c=e-l[0],u=i-l[1];if(a(this,xs)===s&&a(this,ys)===o)for(let{line:h,points:d}of a(this,On))xt._translate(h,c,u,h),xt._translate(d,c,u,d);else{let h=a(this,xs)/s,d=a(this,ys)/o;p(this,xs,s),p(this,ys,o);for(let{line:f,points:m}of a(this,On))xt._rescale(f,c,u,h,d,f),xt._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":`${xt.svgRound(e)} ${xt.svgRound(i)}`}}}get defaultSVGProperties(){let e=a(this,Yi);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${xt.svgRound(e[0])} ${xt.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}};Yi=new WeakMap,Rm=new WeakMap,Lm=new WeakMap,On=new WeakMap,xs=new WeakMap,ys=new WeakMap,ed=new WeakMap,id=new WeakMap,Tc=new WeakMap,_i=new WeakSet,js=function(e=a(this,Tc)){let i=a(this,Lm)+e/2*a(this,ed);return a(this,id)%180===0?[i/a(this,xs),i/a(this,ys)]:[i/a(this,ys),i/a(this,xs)]},wS=function(){let[e,i,n,s]=a(this,Yi),[o,l]=b(this,_i,js).call(this,0);return[e+o,i+l,n-2*o,s-2*l]},AS=function(){let e=p(this,Yi,new Float32Array([1/0,1/0,-1/0,-1/0]));for(let{line:s}of a(this,On)){if(s.length<=12){for(let c=4,u=s.length;cl!==i[c])||e.thickness!==n||e.opacity!==s||e.pageIndex!==o},z(Ou,"_type","ink"),z(Ou,"_editorType",kt.INK),z(Ou,"_defaultDrawingOptions",null);gw=Ou,Zf=class extends Rc{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}},Hg=8,of=3,fr=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:y,actualBoundingBoxAscent:g,actualBoundingBoxDescent:A,fontBoundingBoxAscent:w,fontBoundingBoxDescent:v,width:T}=h.measureText(t),k=1.5,N=Math.ceil(Math.max(Math.abs(m)+Math.abs(y)||0,T)*k),F=Math.ceil(Math.max(Math.abs(g)+Math.abs(A)||d,Math.abs(w)+Math.abs(v)||d)*k);u=new OffscreenCanvas(N,F),h=u.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=f,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,N,F),h.fillStyle="black",h.fillText(t,N*(k-1)/2,F*(3-k)/2);let L=b(this,ne,bw).call(this,h.getImageData(0,0,N,F).data),Y=b(this,ne,IS).call(this,L),q=b(this,ne,ww).call(this,Y),G=b(this,ne,yw).call(this,L,N,F,q);return this.processDrawnLines({lines:{curves:G,width:N,height:F},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,ne,kS).call(this,t),[u,h]=b(this,ne,DS).call(this,o,l,c,Math.hypot(l,c)*a(this,Sc).sigmaSFactor,a(this,Sc).sigmaR,a(this,Sc).kernelSize),d=b(this,ne,ww).call(this,h),f=b(this,ne,yw).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),y=m/e,g=m/i,A=[];for(let{points:v}of c){let T=o?b(this,ne,SS).call(this,v):v;if(!T)continue;A.push(T);let k=T.length,N=new Float32Array(k),F=new Float32Array(3*(k===2?2:k-2));if(f.push({line:F,points:N}),k===2){N[0]=T[0]*y,N[1]=T[1]*g,F.set([NaN,NaN,NaN,NaN,N[0],N[1]],0);continue}let[L,Y,q,G]=T;L*=y,Y*=g,q*=y,G*=g,N.set([L,Y,q,G],0),F.set([NaN,NaN,NaN,NaN,L,Y],0);for(let j=4;j=-128&&l<=127?u=Int8Array:o>=-32768&&l<=32767?u=Int16Array:u=Int32Array;let h=t.length,d=Hg+of*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 y=new CompressionStream("deflate-raw"),g=y.writable.getWriter();await g.ready,g.write(f);let A=u.prototype.constructor;for(let v of t){let T=new A(v.length-2);for(let k=2,N=v.length;k{await s.ready,await s.close()}).catch(()=>{});let o=null,l=0;for await(let T of i)o||(o=new Uint8Array(new Uint32Array(T.buffer,0,4)[0])),o.set(T,l),l+=T.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],y=c[6],g=c[7],A=[],w=(Hg+of*y)*Uint32Array.BYTES_PER_ELEMENT,v;switch(g){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 T=0;T0?0:4:i===1?n+6:2-n},Mr=new WeakMap,CS=function(t,e,i,n,s,o,l){let c=b(this,ne,xw).call(this,i,n,s,o);for(let u=0;u<8;u++){let h=(-u+c-l+16)%8,d=a(this,Mr)[2*h],f=a(this,Mr)[2*h+1];if(t[(i+d)*e+(n+f)]!==0)return h}return-1},TS=function(t,e,i,n,s,o,l){let c=b(this,ne,xw).call(this,i,n,s,o);for(let u=0;u<8;u++){let h=(u+c+l+16)%8,d=a(this,Mr)[2*h],f=a(this,Mr)[2*h+1];if(t[(i+d)*e+(n+f)]!==0)return h}return-1},yw=function(t,e,i,n){let s=t.length,o=new Int32Array(s);for(let h=0;h=1&&o[f+1]===0)l+=1,g+=1,m>1&&(c=m);else{m!==1&&(c=Math.abs(m));continue}let A=[d,h],w=g===d+1,v={isHole:w,points:A,id:l,parent:0};u.push(v);let T;for(let j of u)if(j.id===c){T=j;break}T?T.isHole?v.parent=w?T.parent:c:v.parent=w?c:T.parent:v.parent=w?c:0;let k=b(this,ne,CS).call(this,o,e,h,d,y,g,0);if(k===-1){o[f]=-l,o[f]!==1&&(c=Math.abs(o[f]));continue}let N=a(this,Mr)[2*k],F=a(this,Mr)[2*k+1],L=h+N,Y=d+F;y=L,g=Y;let q=h,G=d;for(;;){let j=b(this,ne,TS).call(this,o,e,q,G,y,g,1);N=a(this,Mr)[2*j],F=a(this,Mr)[2*j+1];let tt=q+N,et=G+F;A.push(et,tt);let _=q*e+G;if(o[_+1]===0?o[_]=-l:o[_]===1&&(o[_]=l),tt===h&&et===d&&q===L&&G===Y){o[f]!==1&&(c=Math.abs(o[f]));break}else y=q,g=G,q=tt,G=et}}}return u},T0=function(t,e,i,n){if(i-e<=4){for(let L=e;LN&&(F=L,N=Y)}N>(u*k)**2?(b(this,ne,T0).call(this,t,e,F+2,n),b(this,ne,T0).call(this,t,F,i,n)):n.push(s,o)},SS=function(t){let e=[],i=t.length;return b(this,ne,T0).call(this,t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e},DS=function(t,e,i,n,s,o){let l=new Float32Array(o**2),c=-2*n**2,u=o>>1;for(let g=0;g=i))for(let Y=0;Y=e)continue;let G=t[L*e+q],j=l[F*o+Y]*h[Math.abs(G-v)];T+=G*j,k+=j}}let N=m[w]=Math.round(T/k);y[N]++}return[m,y]},IS=function(t){let e=new Uint32Array(256);for(let i of t)e[i]++;return e},bw=function(t){let e=t.length,i=new Uint8ClampedArray(e>>2),n=-1/0,s=1/0;for(let l=0,c=i.length;lc!==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},kS=function(t){let e=t,{width:i,height:n}=t,{maxDim:s}=a(this,Sc),o=i,l=n;if(i>s||n>s){let f=i,m=n,y=Math.log2(Math.max(i,n)/s),g=Math.floor(y);y=y===g?g-1:g;for(let w=0;w{i?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:i,thickness:n,width:s,height:o}=a(this,Io),l=Math.max(s,o),c=fr.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,Io,e);p(this,Do,c instanceof Zf),this.description=n;let u;a(this,Do)?u=bn.getDefaultDrawingOptions():(u=bn._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 fr.process(e,i,n,s,bn._INNER_MARGIN)}getFromText(e,i){let{rawDims:{pageWidth:n,pageHeight:s},rotation:o}=this.parent.viewport;return fr.extractContoursFromText(e,i,n,s,o,bn._INNER_MARGIN)}getDrawnSignature(e){let{rawDims:{pageWidth:i,pageHeight:n},rotation:s}=this.parent.viewport;return fr.processDrawnLines({lines:e,pageWidth:i,pageHeight:n,rotation:s,innerMargin:bn._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:i}){e?this._drawingOptions=bn.getDefaultDrawingOptions():(this._drawingOptions=bn._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,Do),color:[0,0,0],thickness:a(this,Do)?0:s});return this.addComment(o),e?(o.paths={lines:i,points:n},o.uuid=a(this,Dc),o.isCopy=!0):o.lines=i,a(this,bs)&&(o.accessibilityData={type:"Figure",alt:a(this,bs)}),o}static deserializeDraw(e,i,n,s,o,l){return l.areContours?Zf.deserialize(e,i,n,s,o,l):Rc.deserialize(e,i,n,s,o,l)}static async deserialize(e,i,n){let s=await super.deserialize(e,i,n);return p(s,Do,e.areContours),s.description=e.accessibilityData?.alt||"",p(s,Dc,e.uuid),s}};Do=new WeakMap,bs=new WeakMap,Io=new WeakMap,Dc=new WeakMap,z(bn,"_type","signature"),z(bn,"_editorType",kt.SIGNATURE),z(bn,"_defaultDrawingOptions",null);Ew=bn,Df=class extends be{constructor(e){super({...e,name:"stampEditor"});x(this,Xt);x(this,Ee,null);x(this,gi,null);x(this,ko,null);x(this,ya,null);x(this,_o,null);x(this,nd,"");x(this,ba,null);x(this,Ic,!1);x(this,ws,null);x(this,Rn,!1);x(this,rd,!1);p(this,ya,e.bitmapUrl),p(this,_o,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,i){be.initialize(e,i)}static isHandlingMimeForPasting(e){return P0.includes(e)}static paste(e,i){i.pasteEditor({mode:kt.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,gi)&&(p(this,Ee,null),this._uiManager.imageManager.deleteId(a(this,gi)),a(this,ba)?.remove(),p(this,ba,null),a(this,ws)&&(clearTimeout(a(this,ws)),p(this,ws,null))),super.remove()}rebuild(){if(!this.parent){a(this,gi)&&b(this,Xt,S0).call(this);return}super.rebuild(),this.div!==null&&(a(this,gi)&&a(this,ba)===null&&b(this,Xt,S0).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(a(this,ko)||a(this,Ee)||a(this,ya)||a(this,_o)||a(this,gi)||a(this,Ic))}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,Ic)||(a(this,Ee)?b(this,Xt,D0).call(this):b(this,Xt,S0).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,gi,n),s&&p(this,Ee,s),p(this,Ic,!1),b(this,Xt,D0).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;a(this,ws)!==null&&clearTimeout(a(this,ws)),p(this,ws,setTimeout(()=>{p(this,ws,null),b(this,Xt,Cw).call(this)},200))}copyCanvas(e,i,n=!1){e||(e=224);let{width:s,height:o}=a(this,Ee),l=new Es,c=a(this,Ee),u=s,h=o,d=null;if(i){if(s>i||o>i){let L=Math.min(i/s,i/o);u=Math.floor(s*L),h=Math.floor(o*L)}d=document.createElement("canvas");let m=d.width=Math.ceil(u*l.sx),y=d.height=Math.ceil(h*l.sy);a(this,Rn)||(c=b(this,Xt,I0).call(this,m,y));let g=d.getContext("2d");g.filter=this._uiManager.hcmFilter;let A="white",w="#cfcfd8";this._uiManager.hcmFilter!=="none"?w="black":ib.isDarkMode&&(A="#8f8f9d",w="#42414d");let v=15,T=v*l.sx,k=v*l.sy,N=new OffscreenCanvas(T*2,k*2),F=N.getContext("2d");F.fillStyle=A,F.fillRect(0,0,T*2,k*2),F.fillStyle=w,F.fillRect(0,0,T,k),F.fillRect(T,k,T,k),g.fillStyle=g.createPattern(N,"repeat"),g.fillRect(0,0,m,y),g.drawImage(c,0,0,c.width,c.height,0,0,m,y)}let f=null;if(n){let m,y;if(l.symmetric&&c.widthe||o>e){let w=Math.min(e/s,e/o);m=Math.floor(s*w),y=Math.floor(o*w),a(this,Rn)||(c=b(this,Xt,I0).call(this,m,y))}let A=new OffscreenCanvas(m,y).getContext("2d",{willReadFrequently:!0});A.drawImage(c,0,0,c.width,c.height,0,0,m,y),f={width:m,height:y,data:A.getImageData(0,0,m,y).data}}return{canvas:d,width:u,height:h,imageData:f}}static async deserialize(e,i,n){let s=null,o=!1;if(e instanceof Q0){let{data:{rect:A,rotation:w,id:v,structParent:T,popupRef:k,richText:N,contentsObj:F,creationDate:L,modificationDate:Y},container:q,parent:{page:{pageNumber:G}},canvas:j}=e,tt,et;j?(delete e.canvas,{id:tt,bitmap:et}=n.imageManager.getFromCanvas(q.id,j),j.remove()):(o=!0,e._hasNoCanvas=!0);let _=(await i._structTree.getAriaAttributes(`${Nu}${v}`))?.get("aria-label")||"";s=e={annotationType:kt.STAMP,bitmapId:tt,bitmap:et,pageIndex:G-1,rect:A.slice(0),rotation:w,annotationElementId:v,id:v,deleted:!1,accessibilityData:{decorative:!1,altText:_},isSvg:!1,structParent:T,popupRef:k,richText:N,comment:F?.str||null,creationDate:L,modificationDate:Y}}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,Ic,!0)):d&&n.imageManager.isValidId(d)?(p(l,gi,d),u&&p(l,Ee,u)):p(l,ya,h),p(l,Rn,f);let[y,g]=l.pageDimensions;return l.width=(c[2]-c[0])/y,l.height=(c[3]-c[1])/g,m&&(l.altTextData=m),l._initialData=s,e.comment&&l.setCommentData(e),p(l,rd,!!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,gi),isSvg:a(this,Rn)});if(this.addComment(n),e)return n.bitmapUrl=b(this,Xt,k0).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,Xt,_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,Rn)?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!i.stamps.has(a(this,gi)))i.stamps.set(a(this,gi),{area:l,serialized:n}),n.bitmap=b(this,Xt,k0).call(this,!1);else if(a(this,Rn)){let c=i.stamps.get(a(this,gi));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=b(this,Xt,k0).call(this,!1))}return n}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}};Ee=new WeakMap,gi=new WeakMap,ko=new WeakMap,ya=new WeakMap,_o=new WeakMap,nd=new WeakMap,ba=new WeakMap,Ic=new WeakMap,ws=new WeakMap,Rn=new WeakMap,rd=new WeakMap,Xt=new WeakSet,If=function(e,i=!1){if(!e){this.remove();return}p(this,Ee,e.bitmap),i||(p(this,gi,e.id),p(this,Rn,e.isSvg)),e.file&&p(this,nd,e.file.name),b(this,Xt,D0).call(this)},kf=function(){if(p(this,ko,null),this._uiManager.enableWaiting(!1),!!a(this,ba)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,Ee)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,Ee)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},S0=function(){if(a(this,gi)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(a(this,gi)).then(n=>b(this,Xt,If).call(this,n,!0)).finally(()=>b(this,Xt,kf).call(this));return}if(a(this,ya)){let n=a(this,ya);p(this,ya,null),this._uiManager.enableWaiting(!0),p(this,ko,this._uiManager.imageManager.getFromUrl(n).then(s=>b(this,Xt,If).call(this,s)).finally(()=>b(this,Xt,kf).call(this)));return}if(a(this,_o)){let n=a(this,_o);p(this,_o,null),this._uiManager.enableWaiting(!0),p(this,ko,this._uiManager.imageManager.getFromFile(n).then(s=>b(this,Xt,If).call(this,s)).finally(()=>b(this,Xt,kf).call(this)));return}let e=document.createElement("input");e.type="file",e.accept=P0.join(",");let i=this._uiManager._signal;p(this,ko,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,Xt,If).call(this,s)}n()},{signal:i}),e.addEventListener("cancel",()=>{this.remove(),n()},{signal:i})}).finally(()=>b(this,Xt,kf).call(this))),e.click()},D0=function(){let{div:e}=this,{width:i,height:n}=a(this,Ee),[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,ba,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,Xt,Cw).call(this),a(this,rd)||(this.parent.addUndoableEditor(this),p(this,rd,!0)),this._reportTelemetry({action:"inserted_image"}),a(this,nd)&&this.div.setAttribute("aria-description",a(this,nd)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},I0=function(e,i){let{width:n,height:s}=a(this,Ee),o=n,l=s,c=a(this,Ee);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},Cw=function(){let[e,i]=this.parentDimensions,{width:n,height:s}=this,o=new Es,l=Math.ceil(n*e*o.sx),c=Math.ceil(s*i*o.sy),u=a(this,ba);if(!u||u.width===l&&u.height===c)return;u.width=l,u.height=c;let h=a(this,Rn)?a(this,Ee):b(this,Xt,I0).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)},k0=function(e){if(e){if(a(this,Rn)){let s=this._uiManager.imageManager.getSvgUrl(a(this,gi));if(s)return s}let i=document.createElement("canvas");return{width:i.width,height:i.height}=a(this,Ee),i.getContext("2d").drawImage(a(this,Ee),0,0),i.toDataURL()}if(a(this,Rn)){let[i,n]=this.pageDimensions,s=Math.round(this.width*i*Da.PDF_TO_CSS_UNITS),o=Math.round(this.height*n*Da.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(s,o);return l.getContext("2d").drawImage(a(this,Ee),0,0,a(this,Ee).width,a(this,Ee).height,0,0,s,o),l.transferToImageBitmap()}return structuredClone(a(this,Ee))},_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}},z(Df,"_type","stamp"),z(Df,"_editorType",kt.STAMP);wr=class wr{constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:n,accessibilityManager:s,annotationLayer:o,drawLayer:l,textLayer:c,viewport:u,l10n:h}){x(this,ge);x(this,kc);x(this,sd,!1);x(this,No,null);x(this,Mo,null);x(this,wa,null);x(this,fn,new Map);x(this,Fo,!1);x(this,ad,!1);x(this,od,!1);x(this,Fr,null);x(this,Aa,null);x(this,xi,null);x(this,va,null);x(this,Po,null);x(this,ld,-1);x(this,wt);let d=[...a(wr,Oo).values()];if(!wr._initialized){wr._initialized=!0;for(let f of d)f.initialize(h,t)}t.registerEditorTypes(d),p(this,wt,t),this.pageIndex=e,this.div=i,p(this,kc,s),p(this,No,o),this.viewport=u,p(this,xi,c),this.drawLayer=l,this._structTree=n,a(this,wt).addLayer(this)}get isEmpty(){return a(this,fn).size===0}get isInvisible(){return this.isEmpty&&a(this,wt).getMode()===kt.NONE}updateToolbar(t){a(this,wt).updateToolbar(t)}updateMode(t=a(this,wt).getMode()){switch(b(this,ge,_0).call(this),t){case kt.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case kt.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case kt.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===kt.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(let i of a(wr,Oo).values())e.toggle(`${i._type}Editing`,t===i._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===a(this,xi)?.div}setEditingState(t){a(this,wt).setEditingState(t)}addCommands(t){a(this,wt).addCommands(t)}cleanUndoStack(t){a(this,wt).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,No)?.togglePointerEvents(t)}async enable(){p(this,od,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),a(this,Po)?.abort(),p(this,Po,null);let t=new Set;for(let i of a(this,ge,Tw))i.enableEditing(),i.show(!0),i.annotationElementId&&(a(this,wt).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));let e=a(this,No);if(e)for(let i of e.getEditableAnnotations()){if(i.hide(),a(this,wt).isDeletedAnnotationElement(i.data.id)||t.has(i.data.id))continue;let n=await this.deserialize(i);n&&(this.addOrRebuild(n),n.enableEditing())}p(this,od,!1),a(this,wt)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(p(this,ad,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),a(this,xi)&&!a(this,Po)){p(this,Po,new AbortController);let n=a(this,wt).combinedSignal(a(this,Po));a(this,xi).div.addEventListener("pointerdown",s=>{let{clientX:l,clientY:c,timeStamp:u}=s,h=a(this,ld);if(u-h>500){p(this,ld,u);return}p(this,ld,-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,y=new RegExp(`^${Rf}[0-9]+$`);for(let A of f)if(y.test(A.id)){m=A.id;break}if(!m)return;let g=a(this,fn).get(m);g?.annotationElementId===null&&(s.stopPropagation(),s.preventDefault(),g.dblclick(s))},{signal:n,capture:!0})}let t=a(this,No),e=[];if(t){let n=new Map,s=new Map;for(let o of a(this,ge,Tw)){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,wt).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,wt).addChangedExistingAnnotation(c),c.renderAnnotationElement(o)&&c.show(!1)),o.show()}}b(this,ge,_0).call(this),this.isEmpty&&(this.div.hidden=!0);let{classList:i}=this.div;for(let n of a(wr,Oo).values())i.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),p(this,ad,!1)}getEditableAnnotation(t){return a(this,No)?.getEditableAnnotation(t)||null}setActiveEditor(t){a(this,wt).getActive()!==t&&a(this,wt).setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,a(this,xi)?.div&&!a(this,va)){p(this,va,new AbortController);let t=a(this,wt).combinedSignal(a(this,va));a(this,xi).div.addEventListener("pointerdown",b(this,ge,NS).bind(this),{signal:t}),a(this,xi).div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,a(this,xi)?.div&&a(this,va)&&(a(this,va).abort(),p(this,va,null),a(this,xi).div.classList.remove("highlighting"))}enableClick(){if(a(this,Mo))return;p(this,Mo,new AbortController);let t=a(this,wt).combinedSignal(a(this,Mo));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,Mo)?.abort(),p(this,Mo,null)}attach(t){a(this,fn).set(t.id,t);let{annotationElementId:e}=t;e&&a(this,wt).isDeletedAnnotationElement(e)&&a(this,wt).removeDeletedAnnotationElement(t)}detach(t){a(this,fn).delete(t.id),a(this,kc)?.removePointerInTextLayer(t.contentDiv),!a(this,ad)&&t.annotationElementId&&a(this,wt).addDeletedAnnotationElement(t)}remove(t){this.detach(t),a(this,wt).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(a(this,wt).addDeletedAnnotationElement(t),be.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,wt).addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!a(this,od)),a(this,wt).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!a(this,wa)&&(t._focusEventsAllowed=!1,p(this,wa,setTimeout(()=>{p(this,wa,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:a(this,wt)._signal}),e.focus())},0))),t._structTreeParentId=a(this,kc)?.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,fn).values())if(e.uid===t)return e;return null}combinedSignal(t){return a(this,wt).combinedSignal(t)}canCreateNewEmptyEditor(){return a(this,ge,Jr)?.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await a(this,wt).updateMode(t.mode);let{offsetX:i,offsetY:n}=b(this,ge,Dw).call(this),s=a(this,wt).getId(),o=b(this,ge,Sw).call(this,{parent:this,id:s,x:i,y:n,uiManager:a(this,wt),isCentered:!0,...e});o&&this.add(o)}async deserialize(t){return await a(wr,Oo).get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,a(this,wt))||null}createAndAddNewEditor(t,e,i={}){let n=a(this,wt).getId(),s=b(this,ge,Sw).call(this,{parent:this,id:n,x:t.offsetX,y:t.offsetY,uiManager:a(this,wt),isCentered:e,...i});return s&&this.add(s),s}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(t={}){this.createAndAddNewEditor(b(this,ge,Dw).call(this),!0,t)}setSelected(t){a(this,wt).setSelected(t)}toggleSelected(t){a(this,wt).toggleSelected(t)}unselect(t){a(this,wt).unselect(t)}pointerup(t){let{isMac:e}=Be.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!a(this,Fo)||(p(this,Fo,!1),a(this,ge,Jr)?.isDrawer&&a(this,ge,Jr).supportMultipleDrawings))return;if(!a(this,sd)){p(this,sd,!0);return}let i=a(this,wt).getMode();if(i===kt.STAMP||i===kt.POPUP||i===kt.SIGNATURE){a(this,wt).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(a(this,wt).getMode()===kt.HIGHLIGHT&&this.enableTextSelection(),a(this,Fo)){p(this,Fo,!1);return}let{isMac:e}=Be.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(p(this,Fo,!0),a(this,ge,Jr)?.isDrawer){this.startDrawingSession(t);return}let i=a(this,wt).getActive();p(this,sd,!i||i.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),a(this,Fr)){a(this,ge,Jr).startDrawing(this,a(this,wt),!1,t);return}a(this,wt).setCurrentDrawingSession(this),p(this,Fr,new AbortController);let e=a(this,wt).combinedSignal(a(this,Fr));this.div.addEventListener("blur",({relatedTarget:i})=>{i&&!this.div.contains(i)&&(p(this,Aa,null),this.commitOrRemove())},{signal:e}),a(this,ge,Jr).startDrawing(this,a(this,wt),!1,t)}pause(t){if(t){let{activeElement:e}=document;this.div.contains(e)&&p(this,Aa,e);return}a(this,Aa)&&setTimeout(()=>{a(this,Aa)?.focus(),p(this,Aa,null)},0)}endDrawingSession(t=!1){return a(this,Fr)?(a(this,wt).setCurrentDrawingSession(null),a(this,Fr).abort(),p(this,Fr,null),p(this,Aa,null),a(this,ge,Jr).endDrawing(t)):null}findNewParent(t,e,i){let n=a(this,wt).findParent(e,i);return n===null||n===this?!1:(n.changeParent(t),!0)}commitOrRemove(){return a(this,Fr)?(this.endDrawingSession(),!0):!1}onScaleChanging(){a(this,Fr)&&a(this,ge,Jr).onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),a(this,wt).getActive()?.parent===this&&(a(this,wt).commitOrRemove(),a(this,wt).setActiveEditor(null)),a(this,wa)&&(clearTimeout(a(this,wa)),p(this,wa,null));for(let t of a(this,fn).values())a(this,kc)?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,a(this,fn).clear(),a(this,wt).removeLayer(this)}async render({viewport:t}){this.viewport=t,Ro(this.div,t);for(let e of a(this,wt).getEditors(this.pageIndex))this.add(e),e.rebuild();await a(this,wt).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){a(this,wt).commitOrRemove(),b(this,ge,_0).call(this);let e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,Ro(this.div,{rotation:i}),e!==i)for(let n of a(this,fn).values())n.rotate(i)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return a(this,wt).viewParameters.realScale}};kc=new WeakMap,sd=new WeakMap,No=new WeakMap,Mo=new WeakMap,wa=new WeakMap,fn=new WeakMap,Fo=new WeakMap,ad=new WeakMap,od=new WeakMap,Fr=new WeakMap,Aa=new WeakMap,xi=new WeakMap,va=new WeakMap,Po=new WeakMap,ld=new WeakMap,wt=new WeakMap,Oo=new WeakMap,ge=new WeakSet,Tw=function(){return a(this,fn).size!==0?a(this,fn).values():a(this,wt).getEditors(this.pageIndex)},NS=function(t){a(this,wt).unselectAll();let{target:e}=t;if(e===a(this,xi).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&a(this,xi).div.contains(e)){let{isMac:i}=Be.platform;if(t.button!==0||t.ctrlKey&&i)return;a(this,wt).showAllEditors("highlight",!0,!0),a(this,xi).div.classList.add("free"),this.toggleDrawing(),ix.startHighlighting(this,a(this,wt).direction==="ltr",{target:a(this,xi).div,x:t.x,y:t.y}),a(this,xi).div.addEventListener("pointerup",()=>{a(this,xi).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:a(this,wt)._signal}),t.preventDefault()}},Jr=function(){return a(wr,Oo).get(a(this,wt).getMode())},Sw=function(t){let e=a(this,ge,Jr);return e?new e.prototype.constructor(t):null},Dw=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}},_0=function(){for(let t of a(this,fn).values())t.isEmpty()&&t.remove()},z(wr,"_initialized",!1),x(wr,Oo,new Map([sw,gw,Df,ix,Ew].map(t=>[t._editorType,t])));ax=wr,ri=class ri{constructor(){x(this,Ts);x(this,Pr,null);x(this,Ki,new Map);x(this,_c,new Map)}setParent(t){if(!a(this,Pr)){p(this,Pr,t);return}if(a(this,Pr)!==t){if(a(this,Ki).size>0)for(let e of a(this,Ki).values())e.remove(),t.append(e);p(this,Pr,t)}}static get _svgFactory(){return _t(this,"_svgFactory",new Pc)}draw(t,e=!1,i=!1){let n=Ye(ri,Bm)._++,s=b(this,Ts,Iw).call(this),o=ri._svgFactory.createElement("defs");s.append(o);let l=ri._svgFactory.createElement("path");o.append(l);let c=`path_${n}`;l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),e&&a(this,_c).set(n,l);let u=i?b(this,Ts,FS).call(this,o,c):null,h=ri._svgFactory.createElement("use");return s.append(h),h.setAttribute("href",`#${c}`),this.updateProperties(s,t),a(this,Ki).set(n,s),{id:n,clipPathId:`url(#${u})`}}drawOutline(t,e){let i=Ye(ri,Bm)._++,n=b(this,Ts,Iw).call(this),s=ri._svgFactory.createElement("defs");n.append(s);let o=ri._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=ri._svgFactory.createElement("mask");s.append(d),c=`mask_${i}`,d.setAttribute("id",c),d.setAttribute("maskUnits","objectBoundingBox");let f=ri._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");let m=ri._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=ri._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,Ki).set(i,n),i}finalizeDraw(t,e){a(this,_c).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,Ki).get(t):t;if(l){if(i&&b(this,Ts,kw).call(this,l,i),n&&b(c=ri,_x,MS).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,Ts,kw).call(this,h,o)}}}updateParent(t,e){if(e===this)return;let i=a(this,Ki).get(t);i&&(a(e,Pr).append(i),a(this,Ki).delete(t),a(e,Ki).set(t,i))}remove(t){a(this,_c).delete(t),a(this,Pr)!==null&&(a(this,Ki).get(t).remove(),a(this,Ki).delete(t))}destroy(){p(this,Pr,null);for(let t of a(this,Ki).values())t.remove();a(this,Ki).clear(),a(this,_c).clear()}};Pr=new WeakMap,Ki=new WeakMap,_c=new WeakMap,Bm=new WeakMap,_x=new WeakSet,MS=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}%`},Ts=new WeakSet,Iw=function(){let t=ri._svgFactory.create(1,1,!0);return a(this,Pr).append(t),t.setAttribute("aria-hidden",!0),t},FS=function(t,e){let i=ri._svgFactory.createElement("clipPath");t.append(i);let n=`clip_${e}`;i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");let s=ri._svgFactory.createElement("use");return i.append(s),s.setAttribute("href",`#${e}`),s.classList.add("clip"),n},kw=function(t,e){for(let[i,n]of Object.entries(e))n===null?t.removeAttribute(i):t.setAttribute(i,n)},x(ri,_x),x(ri,Bm,0);ox=ri;Of=class Of{constructor(t,e,i,n){x(this,Nx);x(this,cd,[]);x(this,Um,new Map);x(this,zm,null);x(this,ud,0);x(this,As,0);x(this,vs,0);p(this,ud,t),p(this,cd,e),p(this,As,i.rawDims.pageWidth),p(this,vs,i.rawDims.pageHeight),p(this,zm,n)}render(){let t=document.createElement("div");t.className="textLayerImages";for(let e=0;e{if(!(e.target instanceof HTMLCanvasElement))return;let i=e.target,n=a(this,Um).get(i);if(!n)return;let s=a(Of,jm)?.deref();if(s===i)return;s&&(s.width=0,s.height=0),p(Of,jm,new WeakRef(i));let{inverseTransform:o,x1:l,y1:c,width:u,height:h}=n,d=a(this,zm).call(this),f=Math.ceil(l*d.width),m=Math.ceil(c*d.height),y=Math.floor((l+u/a(this,As))*d.width),g=Math.floor((c+h/a(this,vs))*d.height);i.width=y-f,i.height=g-m;let A=i.getContext("2d");A.setTransform(...o),A.translate(-f,-m),A.drawImage(d,0,0)}),t}};cd=new WeakMap,Um=new WeakMap,zm=new WeakMap,ud=new WeakMap,As=new WeakMap,vs=new WeakMap,jm=new WeakMap,Nx=new WeakSet,PS=function([t,e,i,n,s,o]){let l=Math.hypot((s-t)*a(this,As),(o-e)*a(this,vs)),c=Math.hypot((i-t)*a(this,As),(n-e)*a(this,vs));if(lBM,existsSync:()=>VS,lstatSync:()=>WS,mkdirSync:()=>YS,readFile:()=>$S,readFileSync:()=>GS,readdirSync:()=>XS,statSync:()=>qS,writeFileSync:()=>KS});function Bc(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 GS,$S,VS,qS,WS,XS,YS,KS,BM,QS=Kt(()=>{"use strict";H();GS=r=>Bc("readFileSync"),$S=(r,t)=>Bc("readFile"),VS=r=>!1,qS=r=>Bc("statSync"),WS=r=>Bc("lstatSync"),XS=r=>Bc("readdirSync"),YS=r=>Bc("mkdirSync"),KS=(r,t)=>Bc("writeFileSync"),BM={readFileSync:GS,readFile:$S,existsSync:VS,statSync:qS,lstatSync:WS,readdirSync:XS,mkdirSync:YS,writeFileSync:KS,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."))}}});var HM={};qm(HM,{OfficeParser:()=>Uc,default:()=>jM,parseOffice:()=>UM,terminateOcr:()=>zM});H();H();H();var Xc=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 Zm(r){if(Xc)throw new Error(`officeparser: '${jD[r]}' is not supported in the browser. Browser users must pass file content as Buffer or ArrayBuffer directly.`)}function xA(){typeof window<"u"&&!window.DOMMatrix&&(window.DOMMatrix=class{constructor(t){z(this,"a");z(this,"b");z(this,"c");z(this,"d");z(this,"e");z(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 mg=Hc(Iv());H();function Wr(r){if(r)try{if(r.startsWith("D:"))return _k(r);let t=new Date(r);return isNaN(t.getTime())?void 0:t}catch{return}}function _k(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 ci=r=>r.nodeType===1,Zt=(r,t={})=>{let e=new mg.DOMParser(t),i=r.charCodeAt(0)===65279?r.slice(1):r.trim();return e.parseFromString(i,"text/xml")},J=(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},gg=(r,t={})=>new mg.XMLSerializer().serializeToString(r),Nk=(r,t)=>{if(!r||typeof r.lineNumber!="number"||typeof r.columnNumber!="number")return;let e=t.split(` -`),i=0;for(let n=0;n`,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{if(e.serializeRawContent===!1){let i=Nk(r,t);if(i)return i}return gg(r,{preserveWhitespace:e.preserveXmlWhitespace})},ut=(r,t)=>{let e=r.getElementsByTagName(t);if(e&&e.length>0)return e[0]};var He=(r,t)=>{let e=[];if(!r.childNodes)return e;for(let i=0;i{let t=Zt(r),e={},i=J(t,"cp:coreProperties")[0];if(i){let s=J(i,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let o=J(i,"dc:creator")[0];o&&o.textContent&&(e.author=o.textContent);let l=J(i,"cp:lastModifiedBy")[0];l&&l.textContent&&(e.lastModifiedBy=l.textContent);let c=J(i,"dcterms:created")[0];c&&c.textContent&&(e.created=Wr(c.textContent));let u=J(i,"dcterms:modified")[0];u&&u.textContent&&(e.modified=Wr(u.textContent));let h=J(i,"dc:description")[0];h&&h.textContent&&(e.description=h.textContent);let d=J(i,"dc:subject")[0];return d&&d.textContent&&(e.subject=d.textContent),e}let n=J(t,"office:meta")[0];if(n){let s=J(n,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let o=J(n,"dc:creator")[0];o&&o.textContent&&(e.author=o.textContent);let l=J(n,"dc:description")[0];l&&l.textContent&&(e.description=l.textContent);let c=J(n,"dc:subject")[0];c&&c.textContent&&(e.subject=c.textContent);let u=J(n,"meta:creation-date")[0];u&&u.textContent&&(e.created=Wr(u.textContent));let h=J(n,"dc:date")[0];h&&h.textContent&&(e.modified=Wr(h.textContent));let d=J(n,"meta:user-defined");if(d.length>0){let f={};for(let m of d){let y=m.getAttribute("meta:name");if(!y||!m.textContent)continue;let g=m.getAttribute("meta:value-type")||"string",A=m.textContent;if(g==="boolean")f[y]=A.toLowerCase()==="true";else if(g==="float"){let w=Number(A);isNaN(w)||(f[y]=w)}else if(g==="date"||g==="time"){let w=Wr(A);w?f[y]=w:f[y]=A}else f[y]=A}Object.keys(f).length>0&&(e.customProperties=f)}}return e},hu=r=>{let t=Zt(r),e={},i=J(t,"property");for(let n of i){let s=n.getAttribute("name");if(s)for(let o=0;o{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{let t=r.toString("utf8"),i=Zt(t).documentElement;if(!i)return{title:void 0,xAxisTitle:void 0,yAxisTitle:void 0,dataSets:[],labels:[],rawTexts:[]};let n=qd(i,"c:title"),s,o,l=i.getElementsByTagName("c:catAx");l.length>0&&(s=qd(l[0],"c:title"));let c=i.getElementsByTagName("c:valAx");c.length>0&&(o=qd(c[0],"c:title"));let u=i.getElementsByTagName("c:ser"),h=[],d=[];for(let m=0;m0&&d.length===0&&d.push(...F)}h.push({name:g,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}},Fk=r=>{let t=r.toString("utf8"),e=Zt(t),i=J(e,"chart:chart")[0]||e.documentElement,n=J(i,"chart:title")[0],s=n&&J(n,"text:p")[0]?.textContent||void 0,o=J(i,"table:table")[0],l=[],c=[],u=[];if(o){let m=[],y=He(o,"table:table-header-rows")[0];if(y&&m.push(...He(y,"table:table-row")),m.push(...He(o,"table:table-row")),m.length>0){let g=He(m[0],"table:table-cell");for(let A=1;A0){let v=He(w[0],"text:p")[0]?.textContent||void 0;v&&c.push(v);let T=0;for(let k=1;k0&&(v=T[0].textContent||void 0),!v&&A&&(v=`Series ${A.split(".").pop()?.replace(/\$/g,"")||A}`);let k={name:v,values:[],pointLabels:[]};w&&k.values.push(`[${w}]`),l.push(k)}let y=J(i,"chart:categories")[0];if(y){let g=y.getAttribute("table:cell-range-address");g&&c.push(`[${g}]`)}}let h=J(e,"chart:axis"),d,f;for(let m of h){let y=m.getAttribute("chart:dimension"),g=J(m,"chart:title")[0],A=g&&J(g,"text:p")[0]?.textContent||void 0;y==="x"?d=A:y==="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}},Xo=r=>r.toString("utf8",0,500).includes("urn:oasis:names:tc:opendocument:xmlns:chart:1.0")?Fk(r):Mk(r);H();var du="[OfficeParser]: ";var Pk={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.'},kv=(r,t)=>{let e=Pk[r];return typeof e=="function"?e(t):e},Ms=(r,t,e)=>{let i=kv(r,e);return t.outputErrorToConsole&&console.error(du+i),new Error(du+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=kv("FILE_CORRUPTED",e)),t.outputErrorToConsole&&console.error(du+i),new Error(du+i)},rn=(r,t,e)=>{t.outputErrorToConsole&&(e?console.warn(du+r,e):console.warn(du+r))};H();var Ok=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"}},Rk=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"}},gr=(r,t)=>{let e=r.split(".").pop()||"",i=Rk(t);return i||(i=Ok(e)),{type:"image",mimeType:i,data:t.toString("base64"),name:r,extension:e}};H();var Ba=class Ba{constructor(){z(this,"pool",[]);z(this,"queue",[]);z(this,"MAX_WORKERS",4);z(this,"idleTimeout",1e4);z(this,"timeoutId",null)}static getInstance(){return Ba.instance||(Ba.instance=new Ba),Ba.instance}static hasInstance(){return!!Ba.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.lengthHc(bE())),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.lastUsede.worker.terminate());await Promise.all(t),this.pool=[]}};z(Ba,"instance");var Xd=Ba,Xn=async(r,t)=>{let e=r;return typeof window<"u"&&typeof Blob<"u"&&st.Buffer.isBuffer(r)&&(e=new Blob([r],{type:"image/bmp"})),await Xd.getInstance().recognize(e,t)},wE=async()=>{Xd.hasInstance()&&await Xd.getInstance().terminate()};H();H();var AE={},f_=(function(r,t,e,i,n){var s=new Worker(AE[t]||(AE[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}),Gi=Uint8Array,Ko=Uint16Array,CE=Int32Array,My=new Gi([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]),Fy=new Gi([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]),TE=new Gi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),SE=function(r,t){for(var e=new Ko(31),i=0;i<31;++i)e[i]=t+=1<>1|(Jt&21845)<<1,Fs=(Fs&52428)>>2|(Fs&13107)<<2,Fs=(Fs&61680)>>4|(Fs&3855)<<4,Eg[Jt]=((Fs&65280)>>8|(Fs&255)<<8)>>1;var Fs,Jt,fu=(function(r,t,e){for(var i=r.length,n=0,s=new Ko(t);n>c]=u}else for(l=new Ko(i),n=0;n>15-r[n]);return l}),Yd=new Gi(288);for(Jt=0;Jt<144;++Jt)Yd[Jt]=8;var Jt;for(Jt=144;Jt<256;++Jt)Yd[Jt]=9;var Jt;for(Jt=256;Jt<280;++Jt)Yd[Jt]=7;var Jt;for(Jt=280;Jt<288;++Jt)Yd[Jt]=8;var Jt,_E=new Gi(32);for(Jt=0;Jt<32;++Jt)_E[Jt]=5;var Jt;var NE=fu(Yd,9,1);var ME=fu(_E,5,1),Ag=function(r){for(var t=r[0],e=1;et&&(t=r[e]);return t},Yn=function(r,t,e){var i=t/8|0;return(r[i]|r[i+1]<<8)>>(t&7)&e},vg=function(r,t){var e=t/8|0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>(t&7)},FE=function(r){return(r+7)/8|0},Cg=function(r,t,e){return(t==null||t<0)&&(t=0),(e==null||e>r.length)&&(e=r.length),new Gi(r.subarray(t,e))};var PE=["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"],Hi=function(r,t,e){var i=new Error(t||PE[r]);if(i.code=r,Error.captureStackTrace&&Error.captureStackTrace(i,Hi),!e)throw i;return i},OE=function(r,t,e,i){var n=r.length,s=i?i.length:0;if(!n||t.f&&!t.l)return e||new Gi(0);var o=!e,l=o||t.i!=2,c=t.i;o&&(e=new Gi(n*3));var u=function(at){var dt=e.length;if(at>dt){var ot=new Gi(Math.max(dt*2,at));ot.set(e),e=ot}},h=t.f||0,d=t.p||0,f=t.b||0,m=t.l,y=t.d,g=t.m,A=t.n,w=n*8;do{if(!m){h=Yn(r,d,1);var v=Yn(r,d+1,3);if(d+=3,v)if(v==1)m=NE,y=ME,g=9,A=5;else if(v==2){var F=Yn(r,d,31)+257,L=Yn(r,d+10,15)+4,Y=F+Yn(r,d+5,31)+1;d+=14;for(var q=new Gi(Y),G=new Gi(19),j=0;j>4;if(T<16)q[j++]=T;else{var O=0,C=0;for(T==16?(C=3+Yn(r,d,3),d+=2,O=q[j-1]):T==17?(C=3+Yn(r,d,7),d+=3):T==18&&(C=11+Yn(r,d,127),d+=7);C--;)q[j++]=O}}var D=q.subarray(0,F),E=q.subarray(F);g=Ag(D),A=Ag(E),m=fu(D,g,1),y=fu(E,A,1)}else Hi(1);else{var T=FE(d)+4,k=r[T-4]|r[T-3]<<8,N=T+k;if(N>n){c&&Hi(0);break}l&&u(f+k),e.set(r.subarray(T,N),f),t.b=f+=k,t.p=d=N*8,t.f=h;continue}if(d>w){c&&Hi(0);break}}l&&u(f+131072);for(var S=(1<>4;if(d+=O&15,d>w){c&&Hi(0);break}if(O||Hi(2),P<256)e[f++]=P;else if(P==256){M=d,m=null;break}else{var B=P-254;if(P>264){var j=P-257,$=My[j];B=Yn(r,d,(1<<$)-1)+Py[j],d+=$}var U=y[vg(r,d)&I],V=U>>4;U||Hi(3),d+=U&15;var E=kE[V];if(V>3){var $=Fy[V];E+=vg(r,d)&(1<<$)-1,d+=$}if(d>w){c&&Hi(0);break}l&&u(f+131072);var Z=f+B;if(f>>0},_y=function(r,t){return xr(r,t)+xr(r,t+4)*4294967296};function A_(r,t,e){return e||(e=t,t={}),typeof e!="function"&&Hi(7),w_(r,t,[b_],function(i){return RE(Oy(i.data[0],LE(i.data[1])))},1,e)}function Oy(r,t){return OE(r,{i:2},t&&t.out,t&&t.dictionary)}var Ny=typeof TextDecoder<"u"&&new TextDecoder,v_=0;try{Ny.decode(m_,{stream:!0}),v_=1}catch{}var E_=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:Cg(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 C_(r,t){if(t){for(var e="",i=0;i65558)return o(Hi(13,0,1),null),n;var c=Yr(r,l+8);if(c){var u=c,h=xr(r,l+16),d=h==4294967295||u==65535;if(d){var f=xr(r,l-12);d=xr(r,f)==101075792,d&&(u=c=xr(r,f+32),h=xr(r,f+48))}for(var m=t&&t.filter,y=function(A){var w=S_(r,h,d),v=w[0],T=w[1],k=w[2],N=w[3],F=w[4],L=w[5],Y=T_(r,L);h=F;var q=function(j,tt){j?(n(),o(j,null)):(tt&&(s[N]=tt),--c||o(null,s))};if(!m||m({name:N,size:T,originalSize:k,compression:v}))if(!v)q(null,Cg(r,Y,Y+T));else if(v==8){var G=r.subarray(Y,Y+T);if(k<524288||T>.8*k)try{q(null,Oy(G,{out:new Gi(k)}))}catch(j){q(j,null)}else i.push(A_(G,{size:k},q))}else q(Hi(14,"unknown compression type "+v,1),null);else q(null,null)},g=0;gnew Promise((e,i)=>{BE(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:st.Buffer.from(l)})))})});var UE=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 Ua(r,_=>!!_.match(e)||!!_.match(i)||!!_.match(n)||_===s||_==="xl/styles.xml"||_==="xl/workbook.xml"||_==="xl/_rels/workbook.xml.rels"||!!_.match(l)||!!_.match(c)||!!t.extractAttachments&&(!!_.match(o)||!!_.match(u)||!!_.match(h))),f=d.find(_=>_.path===s),m=[];if(f){let _=Zt(f.content.toString()),X=J(_,"si");for(let O of X){let C=J(O,"r");if(C.length>0){let D=[];for(let E of C){let S=J(E,"t")[0];if(S){let I=S.textContent||"",M=J(E,"rPr")[0],P={};if(M){J(M,"b").length>0&&(P.bold=!0),J(M,"i").length>0&&(P.italic=!0),J(M,"u").length>0&&(P.underline=!0),J(M,"strike").length>0&&(P.strikethrough=!0);let B=J(M,"sz")[0];B&&(P.size=B.getAttribute("val")+"pt");let $=J(M,"color")[0];if($){let Z=$.getAttribute("rgb");Z&&(P.color="#"+Z.substring(2))}let U=J(M,"rFont")[0];U&&(P.font=U.getAttribute("val")||void 0);let V=J(M,"vertAlign")[0];if(V){let Z=V.getAttribute("val");Z==="subscript"&&(P.subscript=!0),Z==="superscript"&&(P.superscript=!0)}}D.push({type:"text",text:I,formatting:Object.keys(P).length>0?P:void 0})}}m.push(D)}else{let D=J(O,"t"),E="";for(let S of D)E+=S.textContent||"";m.push(E)}}}let y=d.find(_=>_.path==="xl/styles.xml"),g={};if(y){let _=Zt(y.content.toString()),X=J(_,"fonts")[0],O=[];if(X){let S=J(X,"font");for(let I of S){let M={};J(I,"b").length>0&&(M.bold=!0),J(I,"i").length>0&&(M.italic=!0),J(I,"u").length>0&&(M.underline=!0),J(I,"strike").length>0&&(M.strikethrough=!0);let P=J(I,"sz")[0];if(P){let V=P.getAttribute("val");V&&(M.size=V+"pt")}let B=J(I,"color")[0];if(B){let V=B.getAttribute("rgb");V&&(M.color="#"+V.substring(2))}let $=J(I,"name")[0];if($){let V=$.getAttribute("val");V&&(M.font=V)}let U=J(I,"vertAlign")[0];if(U){let V=U.getAttribute("val");V==="subscript"&&(M.subscript=!0),V==="superscript"&&(M.superscript=!0)}O.push(M)}}let C=J(_,"fills")[0],D=[];if(C){let S=J(C,"fill");for(let I of S){let M={},P=J(I,"patternFill")[0];if(P){let B=J(P,"fgColor")[0];if(B){let $=B.getAttribute("rgb"),U=B.getAttribute("theme");if($&&$!=="00000000")M.backgroundColor="#"+$.substring(2);else if(U){let V=parseInt(U);V===0?M.backgroundColor="#FFFFFF":V===1?M.backgroundColor="#000000":V===2?M.backgroundColor="#EEECE1":V===3&&(M.backgroundColor="#1F497D")}}}D.push(M)}}let E=J(_,"cellXfs")[0];if(E){let S=J(E,"xf");for(let I=0;I_.path.match(/xl\/media\/.*/)),v=d.filter(_=>_.path.match(n)),T={};if(t.extractAttachments){let _=d.filter(O=>O.path.match(h));for(let O of _){let D=`xl/drawings/${O.path.split("/").pop()?.replace(".rels","")||""}`,E=Zt(O.content.toString()),S=J(E,"Relationship");T[D]||(T[D]={});for(let I of S){let M=I.getAttribute("Id"),P=I.getAttribute("Target");if(M&&P&&P.includes("media/")){let B="xl/"+P.replace("../","");T[D][M]={path:B}}}}let X=d.filter(O=>O.path.match(i));for(let O of X){let C=Zt(O.content.toString()),D=J(C,"xdr:pic"),E=T[O.path]||{};for(let S of D){let I=J(S,"xdr:blipFill")[0],M=I?J(I,"a:blip")[0]:null,P=M?M.getAttribute("r:embed"):null,B=J(S,"xdr:nvPicPr")[0],$=B?J(B,"xdr:cNvPr")[0]:null,U=$?$.getAttribute("descr")||$.getAttribute("name"):void 0;P&&E[P]&&(E[P].altText=U||"")}}for(let O of w){let C=gr(O.path.split("/").pop()||"image",O.content),D="";for(let E in T){for(let S in T[E])if(T[E][S].path===O.path){D=T[E][S].altText||"";break}if(D)break}if(D&&(C.altText=D),A.push(C),t.ocr&&C.mimeType.startsWith("image/"))try{let E=(await Xn(O.content,{language:t.ocrLanguage,...t.ocrConfig})).trim();E&&(C.ocrText=E)}catch(E){rn(`OCR failed for ${C.name}:`,t,E)}}for(let O of v){let C={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:O.content.toString("base64"),name:O.path.split("/").pop()||"",extension:"xml"};try{let D=Xo(O.content);C.chartData=D}catch(D){rn(`Failed to extract chart data from ${O.path}:`,t,D)}A.push(C)}}let k={};if(t.extractAttachments){let _=d.filter(X=>X.path.match(h));for(let X of _){let C=`xl/drawings/${X.path.split("/").pop()?.replace(".rels","")||""}`,D=Zt(X.content.toString()),E=J(D,"Relationship");k[C]||(k[C]={});for(let S of E){let I=S.getAttribute("Id"),M=S.getAttribute("Target"),P=S.getAttribute("Type");if(I&&M&&P&&P.includes("chart")){let B=M.split("/").pop()||"";k[C][I]=B}}}}let N={},F=d.find(_=>_.path==="xl/workbook.xml"),L=d.find(_=>_.path==="xl/_rels/workbook.xml.rels");if(F&&L){let _=Zt(L.content.toString()),X=J(_,"Relationship"),O={};for(let E of X){let S=E.getAttribute("Id"),I=E.getAttribute("Target");if(S&&I){let M=I.split("/").pop()||"";O[S]=M}}let C=Zt(F.content.toString()),D=J(C,"sheet");for(let E of D){let S=E.getAttribute("name"),I=E.getAttribute("r:id");S&&I&&O[I]&&(N[O[I]]=S)}}let Y=[],q=[];for(let _ of d)if(!_.path.match(o)&&_.path!==s&&_.path!=="xl/styles.xml"&&!_.path.match(i)&&!_.path.match(n)&&!_.path.match(u)&&!_.path.match(h)&&_.path.match(e)){t.includeRawContent&&q.push(_.content.toString());let X=[],O=/[\s\S]*?<\/row>/g,C=_.content.toString().match(O);if(C)for(let S of C){let I=[],M=/[\s\S]*?<\/c>/g,P=S.match(M),B=S.match(/r="(\d+)"/),$=B?parseInt(B[1])-1:0;if(P)for(let U of P){let V=U.match(/t="([a-z]+)"/),Z=V?V[1]:"n",Q=U.match(/(.*?)<\/v>/),nt=U.match(/(.*?)<\/t>/),at="",dt=[];if(Z==="s"&&Q){let lt=parseInt(Q[1]),ct=m[lt];Array.isArray(ct)?(dt=JSON.parse(JSON.stringify(ct)),at=dt.map(rt=>rt.text).join("")):at=ct||""}else Z==="inlineStr"&&nt?at=nt[1]:Q&&(at=Q[1]);let ot=U.match(/r="([A-Z]+)(\d+)"/),ft=(ot?ot[1]:"").charCodeAt(0)-65;if(at||dt.length>0){let lt=U.match(/s="(\d+)"/),ct=lt?parseInt(lt[1]):void 0,rt=ct!==void 0&&g[ct]?g[ct]:{};if(dt.length>0)for(let bt of dt)bt.formatting||(bt.formatting={}),rt.backgroundColor&&(bt.formatting.backgroundColor=rt.backgroundColor),rt.alignment&&(bt.formatting.alignment=rt.alignment),!bt.formatting.font&&rt.font&&(bt.formatting.font=rt.font),!bt.formatting.size&&rt.size&&(bt.formatting.size=rt.size);else dt.push({type:"text",text:at,formatting:rt});let gt={type:"cell",text:at,children:dt,metadata:{row:$,col:ft}};t.includeRawContent&&(gt.rawContent=U),I.push(gt)}}if(I.length>0){let U={type:"row",children:I,metadata:void 0};t.includeRawContent&&(U.rawContent=S),X.push(U)}}if(t.extractAttachments){let I=`xl/worksheets/_rels/${_.path.split("/").pop()||""}.rels`,M=d.find($=>$.path===I),P={};if(M){let $=Zt(M.content.toString()),U=J($,"Relationship");for(let V of U){let Z=V.getAttribute("Id"),Q=V.getAttribute("Target"),nt=V.getAttribute("Type");Z&&Q&&nt&&nt.includes("drawing")&&(P[Z]="xl/drawings/"+Q.replace("../drawings/",""))}}let B=_.content.toString().match(/pt.name===dt.path.split("/").pop());if(ot){let pt={type:"image",text:"",children:[],metadata:{attachmentName:ot.name||"unknown",altText:dt.altText||void 0}};X.push(pt)}}let nt=k[Z];if(nt)for(let at in nt){let dt=nt[at];if(A.find(pt=>pt.name===dt)){let pt={type:"chart",text:"",children:[],metadata:{attachmentName:dt}};X.push(pt)}}}}}let D=_.path.split("/").pop()||"Sheet",E=N[D]||D;Y.push({type:"sheet",children:X,metadata:{sheetName:E},rawContent:t.includeRawContent?_.content.toString():void 0})}let G=d.find(_=>_.path.match(l)),j=G?La(G.content.toString()):{},tt=d.find(_=>_.path.match(c));if(tt){let _=hu(tt.content.toString());Object.keys(_).length>0&&(j.customProperties=_)}let et=_=>{for(let X of _){if("attachmentName"in(X.metadata||{})){let O=X.metadata,C=A.find(D=>D.name===O.attachmentName);C&&(X.type==="image"&&(C.ocrText&&(X.text=C.ocrText),O.altText&&(C.altText=O.altText)),X.type==="chart"&&C.chartData&&(X.text=C.chartData.rawTexts.join(t.newlineDelimiter||` -`)))}X.children&&et(X.children)}};return et(Y),{type:"xlsx",metadata:j,content:Y,attachments:A,toText:()=>Y.map(_=>{let X=O=>{let C="";return O.children?C+=O.children.map(X).filter(D=>D!="").join(O.children[0]?.children?t.newlineDelimiter??` -`:""):C+=O.text||"",C};return X(_)}).filter(_=>_!="").join(t.newlineDelimiter??` -`)}};H();var zE=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 Ua(r,_=>!!_.match(e)||!!_.match(i)||!!_.match(s)||!!_.match(o)||!!_.match(l)||!!t.extractAttachments&&!!_.match(n)),u=c.find(_=>_.path==="mimetype"),h="odt";if(u){let _=u.content.toString().trim();_.includes("spreadsheet")?h="ods":_.includes("presentation")?h="odp":_.includes("text")&&(h="odt")}let d=c.find(_=>_.path==="content.xml")||c.find(_=>_.path.match(e)),f=c.find(_=>_.path==="styles.xml"),m=[],y=[],g={},A={},w={};f&&(_=>{let X=Zt(_),O=J(X,"style:style");for(let C of O){let D=C.getAttribute("style:name");if(!D)continue;let E={},S=ut(C,"style:paragraph-properties");if(S){let B=S.getAttribute("fo:text-align");if(B){let U={start:"left",left:"left",center:"center",end:"right",right:"right",justify:"justify"};U[B]&&(E.alignment=U[B])}ut(S,"style:drop-cap")&&(E.dropCap=!0)}Object.keys(E).length>0&&(A[D]=E);let I=ut(C,"style:text-properties"),M=ut(C,"style:table-cell-properties"),P={};if(M){let B=M.getAttribute("fo:background-color");B&&B!=="transparent"&&(P.backgroundColor=B)}if(I){(I.getAttribute("fo:font-weight")==="bold"||I.getAttribute("style:font-weight-asian")==="bold")&&(P.bold=!0),(I.getAttribute("fo:font-style")==="italic"||I.getAttribute("style:font-style-asian")==="italic")&&(P.italic=!0),I.getAttribute("style:text-underline-style")==="solid"&&(P.underline=!0),I.getAttribute("style:text-line-through-style")==="solid"&&(P.strikethrough=!0);let B=I.getAttribute("fo:font-size")||I.getAttribute("style:font-size-asian");B&&(P.size=B);let $=I.getAttribute("fo:color");$&&(P.color=$);let U=I.getAttribute("fo:background-color");U&&U!=="transparent"&&(P.backgroundColor=U);let V=I.getAttribute("style:font-name")||I.getAttribute("fo:font-family");V&&(P.font=V);let Z=I.getAttribute("style:text-position");Z&&(Z.startsWith("sub")&&(P.subscript=!0),Z.startsWith("super")&&(P.superscript=!0)),Object.keys(P).length>0&&(g[D]=P)}}})(f.content.toString());let T=(_,X,O,C,D,E={},S,I="")=>{let M=[],P="";if(!_.childNodes)return{text:"",children:[]};for(let B=0;B<_.childNodes.length;B++){let $=_.childNodes[B];if($.nodeType===3){let U=$.textContent||"";U&&(P+=U,M.push({type:"text",text:U,formatting:E,metadata:S?{...S}:void 0}))}else if(ci($)){let U=$,V=U.tagName;if(V==="text:s"){let Z=parseInt(U.getAttribute("text:c")||"1"),Q=" ".repeat(Z);P+=Q,M.push({type:"text",text:Q,formatting:E,metadata:S?{...S}:void 0})}else if(V==="text:tab")P+=" ",M.push({type:"text",text:" ",formatting:E,metadata:S?{...S}:void 0});else if(V==="text:line-break")P+=` +`)}`),b(this,Je,y0).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=Ae._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,i,n){var l;let s=null;if(e instanceof Y0){let{data:{defaultAppearanceData:{fontSize:c,fontColor:u},rect:h,rotation:d,id:f,popupRef:m,richText:y,contentsObj:g,creationDate:A,modificationDate:w},textContent:v,textPosition:T,parent:{page:{pageNumber:I}}}=e;if(!v||v.length===0)return null;s=e={annotationType:_t.FREETEXT,color:Array.from(u),fontSize:c,value:v.join(` +`),position:T,pageIndex:I-1,rect:h.slice(0),rotation:d,annotationElementId:f,id:f,deleted:!1,popupRef:m,comment:g?.str||null,richText:y,creationDate:A,modificationDate:w}}let o=await super.deserialize(e,i,n);return p(o,In,e.fontSize),o.color=ht.makeHexColor(...e.color),p(o,kn,b(l=Ae,Sa,aw).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=be._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(e),{color:i,fontSize:a(this,In),value:b(this,Je,QT).call(this)});return this.addComment(n),e?(n.isCopy=!0,n):this.annotationElementId&&!b(this,Je,JT).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,In)}px * var(--total-scale-factor))`,n.color=this.color,i.replaceChildren();for(let s of a(this,kn).split(` +`)){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,kn)}}),i}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};kn=new WeakMap,Am=new WeakMap,dc=new WeakMap,In=new WeakMap,Je=new WeakSet,YT=function(e){let i=s=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-a(this,In))*this.parentScale),p(this,In,s),b(this,Je,g0).call(this)},n=a(this,In);this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Gt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},KT=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:Gt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},ZT=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=Ae,Sa,x0).call(n,s)),i=s);return e.join(` +`)},g0=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()},Sa=new WeakSet,x0=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(jg,"")},y0=function(){if(this.editorDiv.replaceChildren(),!!a(this,kn))for(let e of a(this,kn).split(` +`)){let i=document.createElement("div");i.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(i)}},QT=function(){return a(this,kn).replaceAll("\xA0"," ")},aw=function(e){return e.replaceAll(" ","\xA0")},JT=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},x(Ae,Sa),z(Ae,"_freeTextDefaultContent",""),z(Ae,"_internalPadding",0),z(Ae,"_defaultColor",null),z(Ae,"_defaultFontSize",10),z(Ae,"_type","freetext"),z(Ae,"_editorType",_t.FREETEXT);sw=Ae,xt=class{toSVGPath(){ie("Abstract method `toSVGPath` must be implemented.")}get box(){ie("Abstract getter `box` must be implemented.")}serialize(t,e){ie("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=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,li,eS).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,n,s,o){return new ex(t,e,i,n,s,o)}getOutlines(){let t=a(this,ms),e=a(this,Nr),i=a(this,Ut),[n,s,o,l]=a(this,Nn),c=new Float32Array((a(this,To)?.length??0)+2);for(let d=0,f=c.length-2;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,li,rS).call(this,u,h),this.newFreeDrawOutline(u,c,a(this,Nn),a(this,$h),a(this,Hh),a(this,Gh))}};Nn=new WeakMap,Nr=new WeakMap,Hh=new WeakMap,Gh=new WeakMap,ms=new WeakMap,Ut=new WeakMap,fc=new WeakMap,pc=new WeakMap,vm=new WeakMap,Em=new WeakMap,$h=new WeakMap,Vh=new WeakMap,To=new WeakMap,Cm=new WeakMap,Sx=new WeakMap,Dx=new WeakMap,li=new WeakSet,Cf=function(){let t=a(this,Ut).subarray(4,6),e=a(this,Ut).subarray(16,18),[i,n,s,o]=a(this,Nn);return[(a(this,fc)+(t[0]-e[0])/2-i)/s,(a(this,pc)+(t[1]-e[1])/2-n)/o,(a(this,fc)+(e[0]-t[0])/2-i)/s,(a(this,pc)+(e[1]-t[1])/2-n)/o]},tS=function(){let[t,e,i,n]=a(this,Nn),[s,o,l,c]=b(this,li,Cf).call(this);return`M${(a(this,Ut)[2]-t)/i} ${(a(this,Ut)[3]-e)/n} L${(a(this,Ut)[4]-t)/i} ${(a(this,Ut)[5]-e)/n} L${s} ${o} L${l} ${c} L${(a(this,Ut)[16]-t)/i} ${(a(this,Ut)[17]-e)/n} L${(a(this,Ut)[14]-t)/i} ${(a(this,Ut)[15]-e)/n} Z`},eS=function(t){let e=a(this,Nr);t.push(`L${e[4]} ${e[5]} Z`)},iS=function(t){let[e,i,n,s]=a(this,Nn),o=a(this,Ut).subarray(4,6),l=a(this,Ut).subarray(16,18),[c,u,h,d]=b(this,li,Cf).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}`)},nS=function(t){let e=a(this,Ut),[i,n,s,o]=a(this,Nn),[l,c,u,h]=b(this,li,Cf).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,Nn),a(this,$h),a(this,Hh),a(this,Gh))},rS=function(t,e){let i=a(this,Nr);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+=6},sS=function(t,e){let i=a(this,Ut).subarray(4,6),n=a(this,Ut).subarray(16,18),[s,o,l,c]=a(this,Nn),[u,h,d,f]=b(this,li,Cf).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},x(Gs,Cm,8),x(Gs,Sx,2),x(Gs,Dx,a(Gs,Cm)+a(Gs,Sx));tx=Gs,ex=class extends xt{constructor(e,i,n,s,o,l){super();x(this,kx);x(this,qh);x(this,mc,new Float32Array(4));x(this,ga);x(this,Tm);x(this,_n);x(this,Sm);x(this,Xe);p(this,Xe,e),p(this,_n,i),p(this,qh,n),p(this,Sm,s),p(this,ga,o),p(this,Tm,l),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],b(this,kx,aS).call(this,l);let[c,u,h,d]=a(this,mc);for(let f=0,m=e.length;fw?(l=A,c=w):c===w&&(l=d(l,A)),hf[1]?(l=f[0],c=f[1]):c===f[1]&&(l=d(l,f[0])),he[0]-i[0]||e[1]-i[1]||e[2]-i[2]);let t=[];for(let e of a(this,So))e[3]?(t.push(...b(this,Qi,ow).call(this,e)),b(this,Qi,lS).call(this,e)):(b(this,Qi,cS).call(this,e),t.push(...b(this,Qi,ow).call(this,e)));return b(this,Qi,oS).call(this,t)}};Dm=new WeakMap,km=new WeakMap,Im=new WeakMap,So=new WeakMap,_r=new WeakMap,Qi=new WeakSet,oS=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;o0;){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 y;if(i.has(h))y=h;else if(i.has(d))y=d;else break;i.delete(y),[l,c,u,h,d]=y,f!==l&&(s.push(f,m,l,m===c?c:u),f=l),m=m===c?u:c}s.push(f,m)}return new lw(n,a(this,Dm),a(this,km),a(this,Im))},b0=function(t){let e=a(this,_r),i=0,n=e.length-1;for(;i<=n;){let s=i+n>>1,o=e[s][0];if(o===t)return s;o=0;n--){let[s,o]=a(this,_r)[n];if(s!==t)break;if(s===t&&o===e){a(this,_r).splice(n,1);return}}},ow=function(t){let[e,i,n]=t,s=[[e,i,n]],o=b(this,Qi,b0).call(this,n);for(let l=0;l=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};lw=class extends xt{constructor(e,i,n,s){super();x(this,Nm);x(this,Wh);p(this,Wh,e),p(this,Nm,i),this.firstPoint=n,this.lastPoint=s}toSVGPath(){let e=[];for(let i of a(this,Wh)){let[n,s]=i;e.push(`M${n} ${s}`);for(let o=2;o-1?(p(this,Si,!0),b(this,Rt,w0).call(this,e),b(this,Rt,al).call(this)):a(this,xa)&&(p(this,Xh,e.anchorNode),p(this,_m,e.anchorOffset),p(this,Fm,e.focusNode),p(this,Pm,e.focusOffset),b(this,Rt,uw).call(this),b(this,Rt,al).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){let e=te.prototype;return Mt(this,"_keyboardManager",new Fc([[["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,Si)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:a(this,ur),methodOfCreation:a(this,Om)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,i){be.initialize(e,i),te._defaultColor||(te._defaultColor=i.highlightColors?.values().next().value||"#fff066")}static updateDefaultParams(e,i){switch(e){case Gt.HIGHLIGHT_COLOR:te._defaultColor=i;break;case Gt.HIGHLIGHT_THICKNESS:te._defaultThickness=i;break}}translateInPage(e,i){}get toolbarPosition(){return a(this,Kh)}get commentButtonPosition(){return a(this,Yh)}updateParams(e,i){switch(e){case Gt.HIGHLIGHT_COLOR:b(this,Rt,uS).call(this,i);break;case Gt.HIGHLIGHT_THICKNESS:b(this,Rt,hS).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[Gt.HIGHLIGHT_COLOR,te._defaultColor],[Gt.HIGHLIGHT_THICKNESS,te._defaultThickness]]}get propertiesToUpdate(){return[[Gt.HIGHLIGHT_COLOR,this.color||te._defaultColor],[Gt.HIGHLIGHT_THICKNESS,a(this,ur)||te._defaultThickness],[Gt.HIGHLIGHT_FREE,a(this,Si)]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(a(this,Fn),{root:{fill:this.color,"fill-opacity":this.opacity}}),a(this,Mm)?.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",p(this,Mm,new Vf({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,Rt,v0).call(this))}getBaseTranslation(){return[0,0]}getRect(e,i){return super.getRect(e,i,b(this,Rt,v0).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){b(this,Rt,hw).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Rt,al).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let i=!1;this.parent&&!e?b(this,Rt,hw).call(this):e&&(b(this,Rt,al).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,Si)?(e=(e-this.rotation+360)%360,n=b(s=te,pr,Iu).call(s,a(this,Mn).box,e)):n=b(o=te,pr,Iu).call(o,[this.x,this.y,this.width,this.height],e),i.updateProperties(a(this,Fn),{bbox:n,root:{"data-main-rotation":e}}),i.updateProperties(a(this,Ui),{bbox:b(l=te,pr,Iu).call(l,a(this,dn).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;let e=super.render();a(this,Zh)&&(e.setAttribute("aria-label",a(this,Zh)),e.setAttribute("role","mark")),a(this,Si)?e.classList.add("free"):this.div.addEventListener("keydown",b(this,Rt,fS).bind(this),{signal:this._uiManager._signal});let i=p(this,xc,document.createElement("div"));return e.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",i.style.clipPath=a(this,gc),this.setDims(),LC(this,a(this,xc),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{hovered:!1}})}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:b(this,Rt,A0).call(this,!0);break;case 1:case 3:b(this,Rt,A0).call(this,!1);break}}select(){super.select(),a(this,Ui)&&this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),a(this,Ui)&&(this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{selected:!1}}),a(this,Si)||b(this,Rt,A0).call(this,!1))}get _mustFixPosition(){return!a(this,Si)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(a(this,Fn),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(a(this,Ui),{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=y=>{d.abort(),b(this,pr,xS).call(this,e,y)};window.addEventListener("blur",m,{signal:f}),window.addEventListener("pointerup",m,{signal:f}),window.addEventListener("pointerdown",Ie,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Hn,{signal:f}),n.addEventListener("pointermove",b(this,pr,gS).bind(this,e),{signal:f}),this._freeHighlight=new Kf({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,T;let s=null;if(e instanceof Z0){let{data:{quadPoints:I,rect:_,rotation:F,id:L,color:Y,opacity:q,popupRef:G,richText:j,contentsObj:J,creationDate:et,modificationDate:N},parent:{page:{pageNumber:X}}}=e;s=e={annotationType:_t.HIGHLIGHT,color:Array.from(Y),opacity:q,quadPoints:I,boxes:null,pageIndex:X-1,rect:_.slice(0),rotation:F,annotationElementId:L,id:L,deleted:!1,popupRef:G,richText:j,comment:J?.str||null,creationDate:et,modificationDate:N}}else if(e instanceof Xf){let{data:{inkLists:I,rect:_,rotation:F,id:L,color:Y,borderStyle:{rawWidth:q},popupRef:G,richText:j,contentsObj:J,creationDate:et,modificationDate:N},parent:{page:{pageNumber:X}}}=e;s=e={annotationType:_t.HIGHLIGHT,color:Array.from(Y),thickness:q,inkLists:I,boxes:null,pageIndex:X-1,rect:_.slice(0),rotation:F,annotationElementId:L,id:L,deleted:!1,popupRef:G,richText:j,comment:J?.str||null,creationDate:et,modificationDate:N}}let{color:o,quadPoints:l,inkLists:c,outlines:u,opacity:h}=e,d=await super.deserialize(e,i,n);d.color=ht.makeHexColor(...o),d.opacity=h||1,c&&p(d,ur,e.thickness),d._initialData=s,e.comment&&d.setCommentData(e);let[f,m]=d.pageDimensions,[y,g]=d.pageTranslation;if(l){let I=p(d,xa,[]);for(let _=0;_=0)p(this,Fn,i),p(this,gc,n),this.parent.drawLayer.finalizeDraw(i,{bbox:e.box,path:{d:e.toSVGPath()}}),p(this,Ui,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:a(this,dn).box,path:{d:a(this,dn).toSVGPath()}},!0));else if(this.parent){let y=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(a(this,Fn),{bbox:b(f=te,pr,Iu).call(f,a(this,Mn).box,(y-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(a(this,Ui),{bbox:b(m=te,pr,Iu).call(m,a(this,dn).box,y),path:{d:a(this,dn).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[y,g]=this.parentDimensions;this.x=l,this.y=1-o,this.width=c*g/y,this.height=u*y/g;break}case 180:this.x=1-o,this.y=1-l,this.width=c,this.height=u;break;case 270:{let[y,g]=this.parentDimensions;this.x=1-l,this.y=o,this.width=c*g/y,this.height=u*y/g;break}}let{firstPoint:h}=e;p(this,Yh,[(h[0]-o)/c,(h[1]-l)/u]);let{lastPoint:d}=a(this,dn);p(this,Kh,[(d[0]-o)/c,(d[1]-l)/u])},uS=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,te._defaultOpacity),undo:i.bind(this,n,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Gt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)},hS=function(e){let i=a(this,ur),n=s=>{p(this,ur,s),b(this,Rt,dS).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:Gt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},dS=function(e){a(this,Si)&&(b(this,Rt,w0).call(this,{highlightOutlines:a(this,Mn).getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims())},hw=function(){a(this,Fn)===null||!this.parent||(this.parent.drawLayer.remove(a(this,Fn)),p(this,Fn,null),this.parent.drawLayer.remove(a(this,Ui)),p(this,Ui,null))},al=function(e=this.parent){a(this,Fn)===null&&({id:Ye(this,Fn)._,clipPathId:Ye(this,gc)._}=e.drawLayer.draw({bbox:a(this,Mn).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:a(this,Si)},path:{d:a(this,Mn).toSVGPath()}},!1,!0),p(this,Ui,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:a(this,Si)},bbox:a(this,dn).box,path:{d:a(this,dn).toSVGPath()}},a(this,Si))),a(this,xc)&&(a(this,xc).style.clipPath=a(this,gc)))},pr=new WeakSet,Iu=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]},fS=function(e){te._keyboardManager.exec(this,e)},A0=function(e){if(!a(this,Xh))return;let i=window.getSelection();e?i.setPosition(a(this,Xh),a(this,_m)):i.setPosition(a(this,Fm),a(this,Pm))},v0=function(){return a(this,Si)?this.rotation:0},pS=function(){if(a(this,Si))return null;let[e,i]=this.pageDimensions,[n,s]=this.pageTranslation,o=a(this,xa),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,y=(1-h)*i+s;l[c]=l[c+4]=m,l[c+1]=l[c+3]=y,l[c+2]=l[c+6]=m+d*e,l[c+5]=l[c+7]=y-f*i,c+=8}return l},mS=function(e){return a(this,Mn).serialize(e,b(this,Rt,v0).call(this))},gS=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=""},yS=function(e){let{color:i}=this._initialData;return this.hasEditedComment||e.color.some((n,s)=>n!==i[s])},x(te,pr),z(te,"_defaultColor",null),z(te,"_defaultOpacity",1),z(te,"_defaultThickness",12),z(te,"_type","highlight"),z(te,"_editorType",_t.HIGHLIGHT),z(te,"_freeHighlightId",-1),z(te,"_freeHighlight",null),z(te,"_freeHighlightClipId","");ix=te,nx=class{constructor(){x(this,yc,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,yc)[t]=e}toSVGProperties(){let t=a(this,yc);return p(this,yc,Object.create(null)),{root:t}}reset(){p(this,yc,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){ie("Not implemented")}};yc=new WeakMap;Ht=class Ht extends be{constructor(e){super(e);x(this,Wt);x(this,Pn,null);x(this,Qh);z(this,"_colorPicker",null);z(this,"_drawId",null);p(this,Qh,e.mustBeCommitted||!1),this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(e){e.drawOutlines&&(b(this,Wt,dw).call(this,e),b(this,Wt,Tf).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){ie("Not implemented")}static get typesMap(){ie("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(Ht,fi).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,Pn).updateProperty(i,c);u&&b(this,Wt,Sf).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,Ht._mergeSVGProperties(a(this,Pn).getPathResizingSVGProperties(b(this,Wt,E0).call(this)),{bbox:b(this,Wt,Nu).call(this)}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,Ht._mergeSVGProperties(a(this,Pn).getPathResizedSVGProperties(b(this,Wt,E0).call(this)),{bbox:b(this,Wt,Nu).call(this)}))}_onTranslating(e,i){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:b(this,Wt,Nu).call(this)})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,Ht._mergeSVGProperties(a(this,Pn).getPathTranslatedSVGProperties(b(this,Wt,E0).call(this),this.parentDimensions),{bbox:b(this,Wt,Nu).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,Qh)&&(p(this,Qh,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){b(this,Wt,pw).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Wt,Tf).call(this),b(this,Wt,Sf).call(this,a(this,Pn).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let i=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),b(this,Wt,pw).call(this)):e&&(this._uiManager.addShouldRescale(this),b(this,Wt,Tf).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,Ht._mergeSVGProperties({bbox:b(this,Wt,Nu).call(this)},a(this,Pn).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&b(this,Wt,Sf).call(this,a(this,Pn).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){ie("Not implemented")}static startDrawing(e,i,n,s){let{target:o,offsetX:l,offsetY:c,pointerId:u,pointerType:h}=s;if(Oi.isInitializedAndDifferentPointerType(h))return;let{viewport:{rotation:d}}=e,{width:f,height:m}=o.getBoundingClientRect(),y=p(Ht,bc,new AbortController),g=e.combinedSignal(y);if(Oi.setPointer(h,u),window.addEventListener("pointerup",A=>{Oi.isSamePointerIdOrRemove(A.pointerId)&&this._endDraw(A)},{signal:g}),window.addEventListener("pointercancel",A=>{Oi.isSamePointerIdOrRemove(A.pointerId)&&this._currentParent.endDrawingSession()},{signal:g}),window.addEventListener("pointerdown",A=>{Oi.isSamePointerType(A.pointerType)&&(Oi.initializeAndAddPointerId(A.pointerId),a(Ht,fi).isCancellable()&&(a(Ht,fi).removeLastElement(),a(Ht,fi).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:g}),window.addEventListener("contextmenu",Hn,{signal:g}),o.addEventListener("pointermove",this._drawMove.bind(this),{signal:g}),o.addEventListener("touchmove",A=>{Oi.isSameTimeStamp(A.timeStamp)&&Ie(A)},{signal:g}),e.toggleDrawing(),i._editorUndoBar?.hide(),a(Ht,fi)){e.drawLayer.updateProperties(this._currentDrawId,a(Ht,fi).startNew(l,c,f,m,d));return}i.updateUIForDefaultProperties(this),p(Ht,fi,this.createDrawerInstance(l,c,f,m,d)),p(Ht,wc,this.getDefaultDrawingOptions()),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(a(Ht,wc).toSVGProperties(),a(Ht,fi).defaultSVGProperties),!0,!1)}static _drawMove(e){if(Oi.isSameTimeStamp(e.timeStamp),!a(Ht,fi))return;let{offsetX:i,offsetY:n,pointerId:s}=e;if(Oi.isSamePointerId(s)){if(Oi.isUsingMultiplePointers()){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,a(Ht,fi).add(i,n)),Oi.setTimeStamp(e.timeStamp),Ie(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,p(Ht,fi,null),p(Ht,wc,null),Oi.clearTimeStamp()),a(Ht,bc)&&(a(Ht,bc).abort(),p(Ht,bc,null),Oi.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(Ht,fi).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){let n=a(Ht,fi),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:Gt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){let i=this._currentParent;if(!i)return null;if(i.toggleDrawing(!0),i.cleanUndoStack(Gt.DRAW_STEP),!a(Ht,fi).isEmpty()){let{pageDimensions:[n,s],scale:o}=i,l=i.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:a(Ht,fi).getOutlines(n*o,s*o,o,this._INNER_MARGIN),drawingOptions:a(Ht,wc),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){ie("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,Wt,dw).call(d,{drawOutlines:u}),b(f=h,Wt,Tf).call(f),h.onScaleChanging(),h.rotate(),h}serializeDraw(e){let[i,n]=this.pageTranslation,[s,o]=this.pageDimensions;return a(this,Pn).serialize([i,n,s,o],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};Pn=new WeakMap,Qh=new WeakMap,fi=new WeakMap,bc=new WeakMap,wc=new WeakMap,Wt=new WeakSet,dw=function({drawOutlines:e,drawId:i,drawingOptions:n}){p(this,Pn,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,Wt,fw).call(this,e,this.parent),b(this,Wt,Sf).call(this,e.box)},fw=function(e,i){let{id:n}=i.drawLayer.draw(Ht._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n},pw=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},Tf=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,Wt,fw).call(this,a(this,Pn),e)}},bS=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]}},E0=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]}},Sf=function(e){[this.x,this.y,this.width,this.height]=b(this,Wt,bS).call(this,e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},Nu=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]}},z(Ht,"_currentDrawId",-1),z(Ht,"_currentParent",null),x(Ht,fi,null),x(Ht,bc,null),x(Ht,wc,null),z(Ht,"_INNER_MARGIN",3);rx=Ht,mw=class{constructor(t,e,i,n,s,o){x(this,td);x(this,gs,new Float64Array(6));x(this,pi);x(this,mi);x(this,Ac);x(this,Jh);x(this,Xi);x(this,Di,"");x(this,hr,0);x(this,vc,new Rc);x(this,Ec);x(this,Cc);p(this,Ec,i),p(this,Cc,n),p(this,Ac,s),p(this,Jh,o),[t,e]=b(this,td,C0).call(this,t,e);let l=p(this,pi,[NaN,NaN,NaN,NaN,t,e]);p(this,Xi,[t,e]),p(this,mi,[{line:l,points:a(this,Xi)}]),a(this,gs).set(l,0)}updateProperty(t,e){t==="stroke-width"&&p(this,Jh,e)}isEmpty(){return!a(this,mi)||a(this,mi).length===0}isCancellable(){return a(this,Xi).length<=10}add(t,e){[t,e]=b(this,td,C0).call(this,t,e);let[i,n,s,o]=a(this,gs).subarray(2,6),l=t-s,c=e-o;return Math.hypot(a(this,Ec)*l,a(this,Cc)*c)<=2?null:(a(this,Xi).push(t,e),isNaN(i)?(a(this,gs).set([s,o,t,e],2),a(this,pi).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(a(this,gs)[0])&&a(this,pi).splice(6,6),a(this,gs).set([i,n,s,o,t,e],0),a(this,pi).push(...xt.createBezierPoints(i,n,s,o,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){let i=this.add(t,e);return i||(a(this,Xi).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,n,s){p(this,Ec,i),p(this,Cc,n),p(this,Ac,s),[t,e]=b(this,td,C0).call(this,t,e);let o=p(this,pi,[NaN,NaN,NaN,NaN,t,e]);p(this,Xi,[t,e]);let l=a(this,mi).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),a(this,mi).push({line:o,points:a(this,Xi)}),a(this,gs).set(o,0),p(this,hr,0),this.toSVGPath(),null}getLastElement(){return a(this,mi).at(-1)}setLastElement(t){return a(this,mi)?(a(this,mi).push(t),p(this,pi,t.line),p(this,Xi,t.points),p(this,hr,0),{path:{d:this.toSVGPath()}}):a(this,vc).setLastElement(t)}removeLastElement(){if(!a(this,mi))return a(this,vc).removeLastElement();a(this,mi).pop(),p(this,Di,"");for(let t=0,e=a(this,mi).length;tI??NaN),f,m,y,g),points:A(c[v].map(I=>I??NaN),f,m,y,g)});let w=new this.prototype.constructor;return w.build(d,n,s,1,u,h,o),w}get box(){return a(this,Yi)}updateProperty(e,i){return e==="stroke-width"?b(this,Ii,vS).call(this,i):null}updateParentDimensions([e,i],n){let[s,o]=b(this,Ii,js).call(this);p(this,xs,e),p(this,ys,i),p(this,ed,n);let[l,c]=b(this,Ii,js).call(this),u=l-s,h=c-o,d=a(this,Yi);return d[0]-=u,d[1]-=h,d[2]+=2*u,d[3]+=2*h,d}updateRotation(e){return p(this,Rm,e),{path:{transform:this.rotationTransform}}}get viewBox(){return a(this,Yi).map(xt.svgRound).join(" ")}get defaultProperties(){let[e,i]=a(this,Yi);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`}}}get rotationTransform(){let[,,e,i]=a(this,Yi),n=0,s=0,o=0,l=0,c=0,u=0;switch(a(this,Rm)){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} ${xt.svgRound(c)} ${xt.svgRound(u)})`}getPathResizingSVGProperties([e,i,n,s]){let[o,l]=b(this,Ii,js).call(this),[c,u,h,d]=a(this,Yi);if(Math.abs(h-o)<=xt.PRECISION||Math.abs(d-l)<=xt.PRECISION){let A=e+n/2-(c+h/2),w=i+s/2-(u+d/2);return{path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`,transform:`${this.rotationTransform} translate(${A} ${w})`}}}let f=(n-2*o)/(h-2*o),m=(s-2*l)/(d-2*l),y=h/n,g=d/s;return{path:{"transform-origin":`${xt.svgRound(c)} ${xt.svgRound(u)}`,transform:`${this.rotationTransform} scale(${y} ${g}) translate(${xt.svgRound(o)} ${xt.svgRound(l)}) scale(${f} ${m}) translate(${xt.svgRound(-o)} ${xt.svgRound(-l)})`}}}getPathResizedSVGProperties([e,i,n,s]){let[o,l]=b(this,Ii,js).call(this),c=a(this,Yi),[u,h,d,f]=c;if(c[0]=e,c[1]=i,c[2]=n,c[3]=s,Math.abs(d-o)<=xt.PRECISION||Math.abs(f-l)<=xt.PRECISION){let w=e+n/2-(u+d/2),v=i+s/2-(h+f/2);for(let{line:T,points:I}of a(this,On))xt._translate(T,w,v,T),xt._translate(I,w,v,I);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let m=(n-2*o)/(d-2*o),y=(s-2*l)/(f-2*l),g=-m*(u+o)+e+o,A=-y*(h+l)+i+l;if(m!==1||y!==1||g!==0||A!==0)for(let{line:w,points:v}of a(this,On))xt._rescale(w,g,A,m,y,w),xt._rescale(v,g,A,m,y,v);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,i],n){let[s,o]=n,l=a(this,Yi),c=e-l[0],u=i-l[1];if(a(this,xs)===s&&a(this,ys)===o)for(let{line:h,points:d}of a(this,On))xt._translate(h,c,u,h),xt._translate(d,c,u,d);else{let h=a(this,xs)/s,d=a(this,ys)/o;p(this,xs,s),p(this,ys,o);for(let{line:f,points:m}of a(this,On))xt._rescale(f,c,u,h,d,f),xt._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":`${xt.svgRound(e)} ${xt.svgRound(i)}`}}}get defaultSVGProperties(){let e=a(this,Yi);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${xt.svgRound(e[0])} ${xt.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}};Yi=new WeakMap,Rm=new WeakMap,Lm=new WeakMap,On=new WeakMap,xs=new WeakMap,ys=new WeakMap,ed=new WeakMap,id=new WeakMap,Tc=new WeakMap,Ii=new WeakSet,js=function(e=a(this,Tc)){let i=a(this,Lm)+e/2*a(this,ed);return a(this,id)%180===0?[i/a(this,xs),i/a(this,ys)]:[i/a(this,ys),i/a(this,xs)]},wS=function(){let[e,i,n,s]=a(this,Yi),[o,l]=b(this,Ii,js).call(this,0);return[e+o,i+l,n-2*o,s-2*l]},AS=function(){let e=p(this,Yi,new Float32Array([1/0,1/0,-1/0,-1/0]));for(let{line:s}of a(this,On)){if(s.length<=12){for(let c=4,u=s.length;cl!==i[c])||e.thickness!==n||e.opacity!==s||e.pageIndex!==o},z(Ou,"_type","ink"),z(Ou,"_editorType",_t.INK),z(Ou,"_defaultDrawingOptions",null);gw=Ou,Zf=class extends Rc{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}},Hg=8,of=3,fr=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:y,actualBoundingBoxAscent:g,actualBoundingBoxDescent:A,fontBoundingBoxAscent:w,fontBoundingBoxDescent:v,width:T}=h.measureText(t),I=1.5,_=Math.ceil(Math.max(Math.abs(m)+Math.abs(y)||0,T)*I),F=Math.ceil(Math.max(Math.abs(g)+Math.abs(A)||d,Math.abs(w)+Math.abs(v)||d)*I);u=new OffscreenCanvas(_,F),h=u.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=f,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,_,F),h.fillStyle="black",h.fillText(t,_*(I-1)/2,F*(3-I)/2);let L=b(this,ne,bw).call(this,h.getImageData(0,0,_,F).data),Y=b(this,ne,kS).call(this,L),q=b(this,ne,ww).call(this,Y),G=b(this,ne,yw).call(this,L,_,F,q);return this.processDrawnLines({lines:{curves:G,width:_,height:F},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,ne,IS).call(this,t),[u,h]=b(this,ne,DS).call(this,o,l,c,Math.hypot(l,c)*a(this,Sc).sigmaSFactor,a(this,Sc).sigmaR,a(this,Sc).kernelSize),d=b(this,ne,ww).call(this,h),f=b(this,ne,yw).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),y=m/e,g=m/i,A=[];for(let{points:v}of c){let T=o?b(this,ne,SS).call(this,v):v;if(!T)continue;A.push(T);let I=T.length,_=new Float32Array(I),F=new Float32Array(3*(I===2?2:I-2));if(f.push({line:F,points:_}),I===2){_[0]=T[0]*y,_[1]=T[1]*g,F.set([NaN,NaN,NaN,NaN,_[0],_[1]],0);continue}let[L,Y,q,G]=T;L*=y,Y*=g,q*=y,G*=g,_.set([L,Y,q,G],0),F.set([NaN,NaN,NaN,NaN,L,Y],0);for(let j=4;j=-128&&l<=127?u=Int8Array:o>=-32768&&l<=32767?u=Int16Array:u=Int32Array;let h=t.length,d=Hg+of*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 y=new CompressionStream("deflate-raw"),g=y.writable.getWriter();await g.ready,g.write(f);let A=u.prototype.constructor;for(let v of t){let T=new A(v.length-2);for(let I=2,_=v.length;I<_;I++)T[I-2]=v[I]-v[I-2];g.write(T)}return g.close(),(await new Response(y.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 T of i)o||(o=new Uint8Array(new Uint32Array(T.buffer,0,4)[0])),o.set(T,l),l+=T.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],y=c[6],g=c[7],A=[],w=(Hg+of*y)*Uint32Array.BYTES_PER_ELEMENT,v;switch(g){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 T=0;T0?0:4:i===1?n+6:2-n},Mr=new WeakMap,CS=function(t,e,i,n,s,o,l){let c=b(this,ne,xw).call(this,i,n,s,o);for(let u=0;u<8;u++){let h=(-u+c-l+16)%8,d=a(this,Mr)[2*h],f=a(this,Mr)[2*h+1];if(t[(i+d)*e+(n+f)]!==0)return h}return-1},TS=function(t,e,i,n,s,o,l){let c=b(this,ne,xw).call(this,i,n,s,o);for(let u=0;u<8;u++){let h=(u+c+l+16)%8,d=a(this,Mr)[2*h],f=a(this,Mr)[2*h+1];if(t[(i+d)*e+(n+f)]!==0)return h}return-1},yw=function(t,e,i,n){let s=t.length,o=new Int32Array(s);for(let h=0;h=1&&o[f+1]===0)l+=1,g+=1,m>1&&(c=m);else{m!==1&&(c=Math.abs(m));continue}let A=[d,h],w=g===d+1,v={isHole:w,points:A,id:l,parent:0};u.push(v);let T;for(let j of u)if(j.id===c){T=j;break}T?T.isHole?v.parent=w?T.parent:c:v.parent=w?c:T.parent:v.parent=w?c:0;let I=b(this,ne,CS).call(this,o,e,h,d,y,g,0);if(I===-1){o[f]=-l,o[f]!==1&&(c=Math.abs(o[f]));continue}let _=a(this,Mr)[2*I],F=a(this,Mr)[2*I+1],L=h+_,Y=d+F;y=L,g=Y;let q=h,G=d;for(;;){let j=b(this,ne,TS).call(this,o,e,q,G,y,g,1);_=a(this,Mr)[2*j],F=a(this,Mr)[2*j+1];let J=q+_,et=G+F;A.push(et,J);let N=q*e+G;if(o[N+1]===0?o[N]=-l:o[N]===1&&(o[N]=l),J===h&&et===d&&q===L&&G===Y){o[f]!==1&&(c=Math.abs(o[f]));break}else y=q,g=G,q=J,G=et}}}return u},T0=function(t,e,i,n){if(i-e<=4){for(let L=e;L_&&(F=L,_=Y)}_>(u*I)**2?(b(this,ne,T0).call(this,t,e,F+2,n),b(this,ne,T0).call(this,t,F,i,n)):n.push(s,o)},SS=function(t){let e=[],i=t.length;return b(this,ne,T0).call(this,t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e},DS=function(t,e,i,n,s,o){let l=new Float32Array(o**2),c=-2*n**2,u=o>>1;for(let g=0;g=i))for(let Y=0;Y=e)continue;let G=t[L*e+q],j=l[F*o+Y]*h[Math.abs(G-v)];T+=G*j,I+=j}}let _=m[w]=Math.round(T/I);y[_]++}return[m,y]},kS=function(t){let e=new Uint32Array(256);for(let i of t)e[i]++;return e},bw=function(t){let e=t.length,i=new Uint8ClampedArray(e>>2),n=-1/0,s=1/0;for(let l=0,c=i.length;lc!==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},IS=function(t){let e=t,{width:i,height:n}=t,{maxDim:s}=a(this,Sc),o=i,l=n;if(i>s||n>s){let f=i,m=n,y=Math.log2(Math.max(i,n)/s),g=Math.floor(y);y=y===g?g-1:g;for(let w=0;w{i?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:i,thickness:n,width:s,height:o}=a(this,ko),l=Math.max(s,o),c=fr.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,ko,e);p(this,Do,c instanceof Zf),this.description=n;let u;a(this,Do)?u=bn.getDefaultDrawingOptions():(u=bn._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 fr.process(e,i,n,s,bn._INNER_MARGIN)}getFromText(e,i){let{rawDims:{pageWidth:n,pageHeight:s},rotation:o}=this.parent.viewport;return fr.extractContoursFromText(e,i,n,s,o,bn._INNER_MARGIN)}getDrawnSignature(e){let{rawDims:{pageWidth:i,pageHeight:n},rotation:s}=this.parent.viewport;return fr.processDrawnLines({lines:e,pageWidth:i,pageHeight:n,rotation:s,innerMargin:bn._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:i}){e?this._drawingOptions=bn.getDefaultDrawingOptions():(this._drawingOptions=bn._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,Do),color:[0,0,0],thickness:a(this,Do)?0:s});return this.addComment(o),e?(o.paths={lines:i,points:n},o.uuid=a(this,Dc),o.isCopy=!0):o.lines=i,a(this,bs)&&(o.accessibilityData={type:"Figure",alt:a(this,bs)}),o}static deserializeDraw(e,i,n,s,o,l){return l.areContours?Zf.deserialize(e,i,n,s,o,l):Rc.deserialize(e,i,n,s,o,l)}static async deserialize(e,i,n){let s=await super.deserialize(e,i,n);return p(s,Do,e.areContours),s.description=e.accessibilityData?.alt||"",p(s,Dc,e.uuid),s}};Do=new WeakMap,bs=new WeakMap,ko=new WeakMap,Dc=new WeakMap,z(bn,"_type","signature"),z(bn,"_editorType",_t.SIGNATURE),z(bn,"_defaultDrawingOptions",null);Ew=bn,Df=class extends be{constructor(e){super({...e,name:"stampEditor"});x(this,Xt);x(this,Ee,null);x(this,gi,null);x(this,Io,null);x(this,ya,null);x(this,No,null);x(this,nd,"");x(this,ba,null);x(this,kc,!1);x(this,ws,null);x(this,Rn,!1);x(this,rd,!1);p(this,ya,e.bitmapUrl),p(this,No,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,i){be.initialize(e,i)}static isHandlingMimeForPasting(e){return P0.includes(e)}static paste(e,i){i.pasteEditor({mode:_t.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,gi)&&(p(this,Ee,null),this._uiManager.imageManager.deleteId(a(this,gi)),a(this,ba)?.remove(),p(this,ba,null),a(this,ws)&&(clearTimeout(a(this,ws)),p(this,ws,null))),super.remove()}rebuild(){if(!this.parent){a(this,gi)&&b(this,Xt,S0).call(this);return}super.rebuild(),this.div!==null&&(a(this,gi)&&a(this,ba)===null&&b(this,Xt,S0).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(a(this,Io)||a(this,Ee)||a(this,ya)||a(this,No)||a(this,gi)||a(this,kc))}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,kc)||(a(this,Ee)?b(this,Xt,D0).call(this):b(this,Xt,S0).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,gi,n),s&&p(this,Ee,s),p(this,kc,!1),b(this,Xt,D0).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;a(this,ws)!==null&&clearTimeout(a(this,ws)),p(this,ws,setTimeout(()=>{p(this,ws,null),b(this,Xt,Cw).call(this)},200))}copyCanvas(e,i,n=!1){e||(e=224);let{width:s,height:o}=a(this,Ee),l=new Es,c=a(this,Ee),u=s,h=o,d=null;if(i){if(s>i||o>i){let L=Math.min(i/s,i/o);u=Math.floor(s*L),h=Math.floor(o*L)}d=document.createElement("canvas");let m=d.width=Math.ceil(u*l.sx),y=d.height=Math.ceil(h*l.sy);a(this,Rn)||(c=b(this,Xt,k0).call(this,m,y));let g=d.getContext("2d");g.filter=this._uiManager.hcmFilter;let A="white",w="#cfcfd8";this._uiManager.hcmFilter!=="none"?w="black":ib.isDarkMode&&(A="#8f8f9d",w="#42414d");let v=15,T=v*l.sx,I=v*l.sy,_=new OffscreenCanvas(T*2,I*2),F=_.getContext("2d");F.fillStyle=A,F.fillRect(0,0,T*2,I*2),F.fillStyle=w,F.fillRect(0,0,T,I),F.fillRect(T,I,T,I),g.fillStyle=g.createPattern(_,"repeat"),g.fillRect(0,0,m,y),g.drawImage(c,0,0,c.width,c.height,0,0,m,y)}let f=null;if(n){let m,y;if(l.symmetric&&c.widthe||o>e){let w=Math.min(e/s,e/o);m=Math.floor(s*w),y=Math.floor(o*w),a(this,Rn)||(c=b(this,Xt,k0).call(this,m,y))}let A=new OffscreenCanvas(m,y).getContext("2d",{willReadFrequently:!0});A.drawImage(c,0,0,c.width,c.height,0,0,m,y),f={width:m,height:y,data:A.getImageData(0,0,m,y).data}}return{canvas:d,width:u,height:h,imageData:f}}static async deserialize(e,i,n){let s=null,o=!1;if(e instanceof Q0){let{data:{rect:A,rotation:w,id:v,structParent:T,popupRef:I,richText:_,contentsObj:F,creationDate:L,modificationDate:Y},container:q,parent:{page:{pageNumber:G}},canvas:j}=e,J,et;j?(delete e.canvas,{id:J,bitmap:et}=n.imageManager.getFromCanvas(q.id,j),j.remove()):(o=!0,e._hasNoCanvas=!0);let N=(await i._structTree.getAriaAttributes(`${_u}${v}`))?.get("aria-label")||"";s=e={annotationType:_t.STAMP,bitmapId:J,bitmap:et,pageIndex:G-1,rect:A.slice(0),rotation:w,annotationElementId:v,id:v,deleted:!1,accessibilityData:{decorative:!1,altText:N},isSvg:!1,structParent:T,popupRef:I,richText:_,comment:F?.str||null,creationDate:L,modificationDate:Y}}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,kc,!0)):d&&n.imageManager.isValidId(d)?(p(l,gi,d),u&&p(l,Ee,u)):p(l,ya,h),p(l,Rn,f);let[y,g]=l.pageDimensions;return l.width=(c[2]-c[0])/y,l.height=(c[3]-c[1])/g,m&&(l.altTextData=m),l._initialData=s,e.comment&&l.setCommentData(e),p(l,rd,!!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,gi),isSvg:a(this,Rn)});if(this.addComment(n),e)return n.bitmapUrl=b(this,Xt,I0).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,Xt,NS).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,Rn)?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!i.stamps.has(a(this,gi)))i.stamps.set(a(this,gi),{area:l,serialized:n}),n.bitmap=b(this,Xt,I0).call(this,!1);else if(a(this,Rn)){let c=i.stamps.get(a(this,gi));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=b(this,Xt,I0).call(this,!1))}return n}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}};Ee=new WeakMap,gi=new WeakMap,Io=new WeakMap,ya=new WeakMap,No=new WeakMap,nd=new WeakMap,ba=new WeakMap,kc=new WeakMap,ws=new WeakMap,Rn=new WeakMap,rd=new WeakMap,Xt=new WeakSet,kf=function(e,i=!1){if(!e){this.remove();return}p(this,Ee,e.bitmap),i||(p(this,gi,e.id),p(this,Rn,e.isSvg)),e.file&&p(this,nd,e.file.name),b(this,Xt,D0).call(this)},If=function(){if(p(this,Io,null),this._uiManager.enableWaiting(!1),!!a(this,ba)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,Ee)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,Ee)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},S0=function(){if(a(this,gi)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(a(this,gi)).then(n=>b(this,Xt,kf).call(this,n,!0)).finally(()=>b(this,Xt,If).call(this));return}if(a(this,ya)){let n=a(this,ya);p(this,ya,null),this._uiManager.enableWaiting(!0),p(this,Io,this._uiManager.imageManager.getFromUrl(n).then(s=>b(this,Xt,kf).call(this,s)).finally(()=>b(this,Xt,If).call(this)));return}if(a(this,No)){let n=a(this,No);p(this,No,null),this._uiManager.enableWaiting(!0),p(this,Io,this._uiManager.imageManager.getFromFile(n).then(s=>b(this,Xt,kf).call(this,s)).finally(()=>b(this,Xt,If).call(this)));return}let e=document.createElement("input");e.type="file",e.accept=P0.join(",");let i=this._uiManager._signal;p(this,Io,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,Xt,kf).call(this,s)}n()},{signal:i}),e.addEventListener("cancel",()=>{this.remove(),n()},{signal:i})}).finally(()=>b(this,Xt,If).call(this))),e.click()},D0=function(){let{div:e}=this,{width:i,height:n}=a(this,Ee),[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,ba,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,Xt,Cw).call(this),a(this,rd)||(this.parent.addUndoableEditor(this),p(this,rd,!0)),this._reportTelemetry({action:"inserted_image"}),a(this,nd)&&this.div.setAttribute("aria-description",a(this,nd)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},k0=function(e,i){let{width:n,height:s}=a(this,Ee),o=n,l=s,c=a(this,Ee);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},Cw=function(){let[e,i]=this.parentDimensions,{width:n,height:s}=this,o=new Es,l=Math.ceil(n*e*o.sx),c=Math.ceil(s*i*o.sy),u=a(this,ba);if(!u||u.width===l&&u.height===c)return;u.width=l,u.height=c;let h=a(this,Rn)?a(this,Ee):b(this,Xt,k0).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)},I0=function(e){if(e){if(a(this,Rn)){let s=this._uiManager.imageManager.getSvgUrl(a(this,gi));if(s)return s}let i=document.createElement("canvas");return{width:i.width,height:i.height}=a(this,Ee),i.getContext("2d").drawImage(a(this,Ee),0,0),i.toDataURL()}if(a(this,Rn)){let[i,n]=this.pageDimensions,s=Math.round(this.width*i*Da.PDF_TO_CSS_UNITS),o=Math.round(this.height*n*Da.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(s,o);return l.getContext("2d").drawImage(a(this,Ee),0,0,a(this,Ee).width,a(this,Ee).height,0,0,s,o),l.transferToImageBitmap()}return structuredClone(a(this,Ee))},NS=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}},z(Df,"_type","stamp"),z(Df,"_editorType",_t.STAMP);wr=class wr{constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:n,accessibilityManager:s,annotationLayer:o,drawLayer:l,textLayer:c,viewport:u,l10n:h}){x(this,ge);x(this,Ic);x(this,sd,!1);x(this,_o,null);x(this,Mo,null);x(this,wa,null);x(this,fn,new Map);x(this,Fo,!1);x(this,ad,!1);x(this,od,!1);x(this,Fr,null);x(this,Aa,null);x(this,xi,null);x(this,va,null);x(this,Po,null);x(this,ld,-1);x(this,vt);let d=[...a(wr,Oo).values()];if(!wr._initialized){wr._initialized=!0;for(let f of d)f.initialize(h,t)}t.registerEditorTypes(d),p(this,vt,t),this.pageIndex=e,this.div=i,p(this,Ic,s),p(this,_o,o),this.viewport=u,p(this,xi,c),this.drawLayer=l,this._structTree=n,a(this,vt).addLayer(this)}get isEmpty(){return a(this,fn).size===0}get isInvisible(){return this.isEmpty&&a(this,vt).getMode()===_t.NONE}updateToolbar(t){a(this,vt).updateToolbar(t)}updateMode(t=a(this,vt).getMode()){switch(b(this,ge,N0).call(this),t){case _t.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case _t.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case _t.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===_t.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(let i of a(wr,Oo).values())e.toggle(`${i._type}Editing`,t===i._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===a(this,xi)?.div}setEditingState(t){a(this,vt).setEditingState(t)}addCommands(t){a(this,vt).addCommands(t)}cleanUndoStack(t){a(this,vt).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,_o)?.togglePointerEvents(t)}async enable(){p(this,od,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),a(this,Po)?.abort(),p(this,Po,null);let t=new Set;for(let i of a(this,ge,Tw))i.enableEditing(),i.show(!0),i.annotationElementId&&(a(this,vt).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));let e=a(this,_o);if(e)for(let i of e.getEditableAnnotations()){if(i.hide(),a(this,vt).isDeletedAnnotationElement(i.data.id)||t.has(i.data.id))continue;let n=await this.deserialize(i);n&&(this.addOrRebuild(n),n.enableEditing())}p(this,od,!1),a(this,vt)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(p(this,ad,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),a(this,xi)&&!a(this,Po)){p(this,Po,new AbortController);let n=a(this,vt).combinedSignal(a(this,Po));a(this,xi).div.addEventListener("pointerdown",s=>{let{clientX:l,clientY:c,timeStamp:u}=s,h=a(this,ld);if(u-h>500){p(this,ld,u);return}p(this,ld,-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,y=new RegExp(`^${Rf}[0-9]+$`);for(let A of f)if(y.test(A.id)){m=A.id;break}if(!m)return;let g=a(this,fn).get(m);g?.annotationElementId===null&&(s.stopPropagation(),s.preventDefault(),g.dblclick(s))},{signal:n,capture:!0})}let t=a(this,_o),e=[];if(t){let n=new Map,s=new Map;for(let o of a(this,ge,Tw)){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,vt).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,vt).addChangedExistingAnnotation(c),c.renderAnnotationElement(o)&&c.show(!1)),o.show()}}b(this,ge,N0).call(this),this.isEmpty&&(this.div.hidden=!0);let{classList:i}=this.div;for(let n of a(wr,Oo).values())i.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),p(this,ad,!1)}getEditableAnnotation(t){return a(this,_o)?.getEditableAnnotation(t)||null}setActiveEditor(t){a(this,vt).getActive()!==t&&a(this,vt).setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,a(this,xi)?.div&&!a(this,va)){p(this,va,new AbortController);let t=a(this,vt).combinedSignal(a(this,va));a(this,xi).div.addEventListener("pointerdown",b(this,ge,_S).bind(this),{signal:t}),a(this,xi).div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,a(this,xi)?.div&&a(this,va)&&(a(this,va).abort(),p(this,va,null),a(this,xi).div.classList.remove("highlighting"))}enableClick(){if(a(this,Mo))return;p(this,Mo,new AbortController);let t=a(this,vt).combinedSignal(a(this,Mo));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,Mo)?.abort(),p(this,Mo,null)}attach(t){a(this,fn).set(t.id,t);let{annotationElementId:e}=t;e&&a(this,vt).isDeletedAnnotationElement(e)&&a(this,vt).removeDeletedAnnotationElement(t)}detach(t){a(this,fn).delete(t.id),a(this,Ic)?.removePointerInTextLayer(t.contentDiv),!a(this,ad)&&t.annotationElementId&&a(this,vt).addDeletedAnnotationElement(t)}remove(t){this.detach(t),a(this,vt).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(a(this,vt).addDeletedAnnotationElement(t),be.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,vt).addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!a(this,od)),a(this,vt).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!a(this,wa)&&(t._focusEventsAllowed=!1,p(this,wa,setTimeout(()=>{p(this,wa,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:a(this,vt)._signal}),e.focus())},0))),t._structTreeParentId=a(this,Ic)?.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,fn).values())if(e.uid===t)return e;return null}combinedSignal(t){return a(this,vt).combinedSignal(t)}canCreateNewEmptyEditor(){return a(this,ge,Jr)?.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await a(this,vt).updateMode(t.mode);let{offsetX:i,offsetY:n}=b(this,ge,Dw).call(this),s=a(this,vt).getId(),o=b(this,ge,Sw).call(this,{parent:this,id:s,x:i,y:n,uiManager:a(this,vt),isCentered:!0,...e});o&&this.add(o)}async deserialize(t){return await a(wr,Oo).get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,a(this,vt))||null}createAndAddNewEditor(t,e,i={}){let n=a(this,vt).getId(),s=b(this,ge,Sw).call(this,{parent:this,id:n,x:t.offsetX,y:t.offsetY,uiManager:a(this,vt),isCentered:e,...i});return s&&this.add(s),s}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(t={}){this.createAndAddNewEditor(b(this,ge,Dw).call(this),!0,t)}setSelected(t){a(this,vt).setSelected(t)}toggleSelected(t){a(this,vt).toggleSelected(t)}unselect(t){a(this,vt).unselect(t)}pointerup(t){let{isMac:e}=Be.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!a(this,Fo)||(p(this,Fo,!1),a(this,ge,Jr)?.isDrawer&&a(this,ge,Jr).supportMultipleDrawings))return;if(!a(this,sd)){p(this,sd,!0);return}let i=a(this,vt).getMode();if(i===_t.STAMP||i===_t.POPUP||i===_t.SIGNATURE){a(this,vt).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(a(this,vt).getMode()===_t.HIGHLIGHT&&this.enableTextSelection(),a(this,Fo)){p(this,Fo,!1);return}let{isMac:e}=Be.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(p(this,Fo,!0),a(this,ge,Jr)?.isDrawer){this.startDrawingSession(t);return}let i=a(this,vt).getActive();p(this,sd,!i||i.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),a(this,Fr)){a(this,ge,Jr).startDrawing(this,a(this,vt),!1,t);return}a(this,vt).setCurrentDrawingSession(this),p(this,Fr,new AbortController);let e=a(this,vt).combinedSignal(a(this,Fr));this.div.addEventListener("blur",({relatedTarget:i})=>{i&&!this.div.contains(i)&&(p(this,Aa,null),this.commitOrRemove())},{signal:e}),a(this,ge,Jr).startDrawing(this,a(this,vt),!1,t)}pause(t){if(t){let{activeElement:e}=document;this.div.contains(e)&&p(this,Aa,e);return}a(this,Aa)&&setTimeout(()=>{a(this,Aa)?.focus(),p(this,Aa,null)},0)}endDrawingSession(t=!1){return a(this,Fr)?(a(this,vt).setCurrentDrawingSession(null),a(this,Fr).abort(),p(this,Fr,null),p(this,Aa,null),a(this,ge,Jr).endDrawing(t)):null}findNewParent(t,e,i){let n=a(this,vt).findParent(e,i);return n===null||n===this?!1:(n.changeParent(t),!0)}commitOrRemove(){return a(this,Fr)?(this.endDrawingSession(),!0):!1}onScaleChanging(){a(this,Fr)&&a(this,ge,Jr).onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),a(this,vt).getActive()?.parent===this&&(a(this,vt).commitOrRemove(),a(this,vt).setActiveEditor(null)),a(this,wa)&&(clearTimeout(a(this,wa)),p(this,wa,null));for(let t of a(this,fn).values())a(this,Ic)?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,a(this,fn).clear(),a(this,vt).removeLayer(this)}async render({viewport:t}){this.viewport=t,Ro(this.div,t);for(let e of a(this,vt).getEditors(this.pageIndex))this.add(e),e.rebuild();await a(this,vt).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){a(this,vt).commitOrRemove(),b(this,ge,N0).call(this);let e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,Ro(this.div,{rotation:i}),e!==i)for(let n of a(this,fn).values())n.rotate(i)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return a(this,vt).viewParameters.realScale}};Ic=new WeakMap,sd=new WeakMap,_o=new WeakMap,Mo=new WeakMap,wa=new WeakMap,fn=new WeakMap,Fo=new WeakMap,ad=new WeakMap,od=new WeakMap,Fr=new WeakMap,Aa=new WeakMap,xi=new WeakMap,va=new WeakMap,Po=new WeakMap,ld=new WeakMap,vt=new WeakMap,Oo=new WeakMap,ge=new WeakSet,Tw=function(){return a(this,fn).size!==0?a(this,fn).values():a(this,vt).getEditors(this.pageIndex)},_S=function(t){a(this,vt).unselectAll();let{target:e}=t;if(e===a(this,xi).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&a(this,xi).div.contains(e)){let{isMac:i}=Be.platform;if(t.button!==0||t.ctrlKey&&i)return;a(this,vt).showAllEditors("highlight",!0,!0),a(this,xi).div.classList.add("free"),this.toggleDrawing(),ix.startHighlighting(this,a(this,vt).direction==="ltr",{target:a(this,xi).div,x:t.x,y:t.y}),a(this,xi).div.addEventListener("pointerup",()=>{a(this,xi).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:a(this,vt)._signal}),t.preventDefault()}},Jr=function(){return a(wr,Oo).get(a(this,vt).getMode())},Sw=function(t){let e=a(this,ge,Jr);return e?new e.prototype.constructor(t):null},Dw=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}},N0=function(){for(let t of a(this,fn).values())t.isEmpty()&&t.remove()},z(wr,"_initialized",!1),x(wr,Oo,new Map([sw,gw,Df,ix,Ew].map(t=>[t._editorType,t])));ax=wr,si=class si{constructor(){x(this,Ts);x(this,Pr,null);x(this,Ki,new Map);x(this,Nc,new Map)}setParent(t){if(!a(this,Pr)){p(this,Pr,t);return}if(a(this,Pr)!==t){if(a(this,Ki).size>0)for(let e of a(this,Ki).values())e.remove(),t.append(e);p(this,Pr,t)}}static get _svgFactory(){return Mt(this,"_svgFactory",new Pc)}draw(t,e=!1,i=!1){let n=Ye(si,Bm)._++,s=b(this,Ts,kw).call(this),o=si._svgFactory.createElement("defs");s.append(o);let l=si._svgFactory.createElement("path");o.append(l);let c=`path_${n}`;l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),e&&a(this,Nc).set(n,l);let u=i?b(this,Ts,FS).call(this,o,c):null,h=si._svgFactory.createElement("use");return s.append(h),h.setAttribute("href",`#${c}`),this.updateProperties(s,t),a(this,Ki).set(n,s),{id:n,clipPathId:`url(#${u})`}}drawOutline(t,e){let i=Ye(si,Bm)._++,n=b(this,Ts,kw).call(this),s=si._svgFactory.createElement("defs");n.append(s);let o=si._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=si._svgFactory.createElement("mask");s.append(d),c=`mask_${i}`,d.setAttribute("id",c),d.setAttribute("maskUnits","objectBoundingBox");let f=si._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");let m=si._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=si._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,Ki).set(i,n),i}finalizeDraw(t,e){a(this,Nc).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,Ki).get(t):t;if(l){if(i&&b(this,Ts,Iw).call(this,l,i),n&&b(c=si,Nx,MS).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,Ts,Iw).call(this,h,o)}}}updateParent(t,e){if(e===this)return;let i=a(this,Ki).get(t);i&&(a(e,Pr).append(i),a(this,Ki).delete(t),a(e,Ki).set(t,i))}remove(t){a(this,Nc).delete(t),a(this,Pr)!==null&&(a(this,Ki).get(t).remove(),a(this,Ki).delete(t))}destroy(){p(this,Pr,null);for(let t of a(this,Ki).values())t.remove();a(this,Ki).clear(),a(this,Nc).clear()}};Pr=new WeakMap,Ki=new WeakMap,Nc=new WeakMap,Bm=new WeakMap,Nx=new WeakSet,MS=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}%`},Ts=new WeakSet,kw=function(){let t=si._svgFactory.create(1,1,!0);return a(this,Pr).append(t),t.setAttribute("aria-hidden",!0),t},FS=function(t,e){let i=si._svgFactory.createElement("clipPath");t.append(i);let n=`clip_${e}`;i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");let s=si._svgFactory.createElement("use");return i.append(s),s.setAttribute("href",`#${e}`),s.classList.add("clip"),n},Iw=function(t,e){for(let[i,n]of Object.entries(e))n===null?t.removeAttribute(i):t.setAttribute(i,n)},x(si,Nx),x(si,Bm,0);ox=si;Of=class Of{constructor(t,e,i,n){x(this,_x);x(this,cd,[]);x(this,Um,new Map);x(this,zm,null);x(this,ud,0);x(this,As,0);x(this,vs,0);p(this,ud,t),p(this,cd,e),p(this,As,i.rawDims.pageWidth),p(this,vs,i.rawDims.pageHeight),p(this,zm,n)}render(){let t=document.createElement("div");t.className="textLayerImages";for(let e=0;e{if(!(e.target instanceof HTMLCanvasElement))return;let i=e.target,n=a(this,Um).get(i);if(!n)return;let s=a(Of,jm)?.deref();if(s===i)return;s&&(s.width=0,s.height=0),p(Of,jm,new WeakRef(i));let{inverseTransform:o,x1:l,y1:c,width:u,height:h}=n,d=a(this,zm).call(this),f=Math.ceil(l*d.width),m=Math.ceil(c*d.height),y=Math.floor((l+u/a(this,As))*d.width),g=Math.floor((c+h/a(this,vs))*d.height);i.width=y-f,i.height=g-m;let A=i.getContext("2d");A.setTransform(...o),A.translate(-f,-m),A.drawImage(d,0,0)}),t}};cd=new WeakMap,Um=new WeakMap,zm=new WeakMap,ud=new WeakMap,As=new WeakMap,vs=new WeakMap,jm=new WeakMap,_x=new WeakSet,PS=function([t,e,i,n,s,o]){let l=Math.hypot((s-t)*a(this,As),(o-e)*a(this,vs)),c=Math.hypot((i-t)*a(this,As),(n-e)*a(this,vs));if(lBM,existsSync:()=>VS,lstatSync:()=>WS,mkdirSync:()=>YS,readFile:()=>$S,readFileSync:()=>GS,readdirSync:()=>XS,statSync:()=>qS,writeFileSync:()=>KS});function Bc(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 GS,$S,VS,qS,WS,XS,YS,KS,BM,QS=Kt(()=>{"use strict";H();GS=r=>Bc("readFileSync"),$S=(r,t)=>Bc("readFile"),VS=r=>!1,qS=r=>Bc("statSync"),WS=r=>Bc("lstatSync"),XS=r=>Bc("readdirSync"),YS=r=>Bc("mkdirSync"),KS=(r,t)=>Bc("writeFileSync"),BM={readFileSync:GS,readFile:$S,existsSync:VS,statSync:qS,lstatSync:WS,readdirSync:XS,mkdirSync:YS,writeFileSync:KS,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."))}}});var HM={};qm(HM,{OfficeParser:()=>Uc,default:()=>jM,parseOffice:()=>UM,terminateOcr:()=>zM});H();H();H();var Xc=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 Zm(r){if(Xc)throw new Error(`officeparser: '${jD[r]}' is not supported in the browser. Browser users must pass file content as Buffer or ArrayBuffer directly.`)}function xA(){typeof window<"u"&&!window.DOMMatrix&&(window.DOMMatrix=class{constructor(t){z(this,"a");z(this,"b");z(this,"c");z(this,"d");z(this,"e");z(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 mg=Hc(kv());H();function Wr(r){if(r)try{if(r.startsWith("D:"))return NI(r);let t=new Date(r);return isNaN(t.getTime())?void 0:t}catch{return}}function NI(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 ni=r=>r.nodeType===1,Zt=(r,t={})=>{let e=new mg.DOMParser(t),i=r.charCodeAt(0)===65279?r.slice(1):r.trim();return e.parseFromString(i,"text/xml")},tt=(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},gg=(r,t={})=>new mg.XMLSerializer().serializeToString(r),_I=(r,t)=>{if(!r||typeof r.lineNumber!="number"||typeof r.columnNumber!="number")return;let e=t.split(` +`),i=0;for(let n=0;n`,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{if(e.serializeRawContent===!1){let i=_I(r,t);if(i)return i}return gg(r,{preserveWhitespace:e.preserveXmlWhitespace})},ut=(r,t)=>{let e=r.getElementsByTagName(t);if(e&&e.length>0)return e[0]};var He=(r,t)=>{let e=[];if(!r.childNodes)return e;for(let i=0;i{let t=Zt(r),e={},i=tt(t,"cp:coreProperties")[0];if(i){let s=tt(i,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let o=tt(i,"dc:creator")[0];o&&o.textContent&&(e.author=o.textContent);let l=tt(i,"cp:lastModifiedBy")[0];l&&l.textContent&&(e.lastModifiedBy=l.textContent);let c=tt(i,"dcterms:created")[0];c&&c.textContent&&(e.created=Wr(c.textContent));let u=tt(i,"dcterms:modified")[0];u&&u.textContent&&(e.modified=Wr(u.textContent));let h=tt(i,"dc:description")[0];h&&h.textContent&&(e.description=h.textContent);let d=tt(i,"dc:subject")[0];return d&&d.textContent&&(e.subject=d.textContent),e}let n=tt(t,"office:meta")[0];if(n){let s=tt(n,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let o=tt(n,"dc:creator")[0];o&&o.textContent&&(e.author=o.textContent);let l=tt(n,"dc:description")[0];l&&l.textContent&&(e.description=l.textContent);let c=tt(n,"dc:subject")[0];c&&c.textContent&&(e.subject=c.textContent);let u=tt(n,"meta:creation-date")[0];u&&u.textContent&&(e.created=Wr(u.textContent));let h=tt(n,"dc:date")[0];h&&h.textContent&&(e.modified=Wr(h.textContent));let d=tt(n,"meta:user-defined");if(d.length>0){let f={};for(let m of d){let y=m.getAttribute("meta:name");if(!y||!m.textContent)continue;let g=m.getAttribute("meta:value-type")||"string",A=m.textContent;if(g==="boolean")f[y]=A.toLowerCase()==="true";else if(g==="float"){let w=Number(A);isNaN(w)||(f[y]=w)}else if(g==="date"||g==="time"){let w=Wr(A);w?f[y]=w:f[y]=A}else f[y]=A}Object.keys(f).length>0&&(e.customProperties=f)}}return e},hu=r=>{let t=Zt(r),e={},i=tt(t,"property");for(let n of i){let s=n.getAttribute("name");if(s)for(let o=0;o{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{let t=r.toString("utf8"),i=Zt(t).documentElement;if(!i)return{title:void 0,xAxisTitle:void 0,yAxisTitle:void 0,dataSets:[],labels:[],rawTexts:[]};let n=qd(i,"c:title"),s,o,l=i.getElementsByTagName("c:catAx");l.length>0&&(s=qd(l[0],"c:title"));let c=i.getElementsByTagName("c:valAx");c.length>0&&(o=qd(c[0],"c:title"));let u=i.getElementsByTagName("c:ser"),h=[],d=[];for(let m=0;m0&&d.length===0&&d.push(...F)}h.push({name:g,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}},FI=r=>{let t=r.toString("utf8"),e=Zt(t),i=tt(e,"chart:chart")[0]||e.documentElement,n=tt(i,"chart:title")[0],s=n&&tt(n,"text:p")[0]?.textContent||void 0,o=tt(i,"table:table")[0],l=[],c=[],u=[];if(o){let m=[],y=He(o,"table:table-header-rows")[0];if(y&&m.push(...He(y,"table:table-row")),m.push(...He(o,"table:table-row")),m.length>0){let g=He(m[0],"table:table-cell");for(let A=1;A0){let v=He(w[0],"text:p")[0]?.textContent||void 0;v&&c.push(v);let T=0;for(let I=1;I0&&(v=T[0].textContent||void 0),!v&&A&&(v=`Series ${A.split(".").pop()?.replace(/\$/g,"")||A}`);let I={name:v,values:[],pointLabels:[]};w&&I.values.push(`[${w}]`),l.push(I)}let y=tt(i,"chart:categories")[0];if(y){let g=y.getAttribute("table:cell-range-address");g&&c.push(`[${g}]`)}}let h=tt(e,"chart:axis"),d,f;for(let m of h){let y=m.getAttribute("chart:dimension"),g=tt(m,"chart:title")[0],A=g&&tt(g,"text:p")[0]?.textContent||void 0;y==="x"?d=A:y==="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}},Xo=r=>r.toString("utf8",0,500).includes("urn:oasis:names:tc:opendocument:xmlns:chart:1.0")?FI(r):MI(r);H();var du="[OfficeParser]: ";var PI={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.'},Iv=(r,t)=>{let e=PI[r];return typeof e=="function"?e(t):e},Ms=(r,t,e)=>{let i=Iv(r,e);return t.outputErrorToConsole&&console.error(du+i),new Error(du+i)},Nv=(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=Iv("FILE_CORRUPTED",e)),t.outputErrorToConsole&&console.error(du+i),new Error(du+i)},rn=(r,t,e)=>{t.outputErrorToConsole&&(e?console.warn(du+r,e):console.warn(du+r))};H();var OI=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"}},RI=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"}},gr=(r,t)=>{let e=r.split(".").pop()||"",i=RI(t);return i||(i=OI(e)),{type:"image",mimeType:i,data:t.toString("base64"),name:r,extension:e}};H();var Ba=class Ba{constructor(){z(this,"pool",[]);z(this,"queue",[]);z(this,"MAX_WORKERS",4);z(this,"idleTimeout",1e4);z(this,"timeoutId",null)}static getInstance(){return Ba.instance||(Ba.instance=new Ba),Ba.instance}static hasInstance(){return!!Ba.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.lengthHc(bE())),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.lastUsede.worker.terminate());await Promise.all(t),this.pool=[]}};z(Ba,"instance");var Xd=Ba,Xn=async(r,t)=>{let e=r;return typeof window<"u"&&typeof Blob<"u"&&st.Buffer.isBuffer(r)&&(e=new Blob([r],{type:"image/bmp"})),await Xd.getInstance().recognize(e,t)},wE=async()=>{Xd.hasInstance()&&await Xd.getInstance().terminate()};H();H();var AE={},fN=(function(r,t,e,i,n){var s=new Worker(AE[t]||(AE[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}),Gi=Uint8Array,Ko=Uint16Array,CE=Int32Array,My=new Gi([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]),Fy=new Gi([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]),TE=new Gi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),SE=function(r,t){for(var e=new Ko(31),i=0;i<31;++i)e[i]=t+=1<>1|(Jt&21845)<<1,Fs=(Fs&52428)>>2|(Fs&13107)<<2,Fs=(Fs&61680)>>4|(Fs&3855)<<4,Eg[Jt]=((Fs&65280)>>8|(Fs&255)<<8)>>1;var Fs,Jt,fu=(function(r,t,e){for(var i=r.length,n=0,s=new Ko(t);n>c]=u}else for(l=new Ko(i),n=0;n>15-r[n]);return l}),Yd=new Gi(288);for(Jt=0;Jt<144;++Jt)Yd[Jt]=8;var Jt;for(Jt=144;Jt<256;++Jt)Yd[Jt]=9;var Jt;for(Jt=256;Jt<280;++Jt)Yd[Jt]=7;var Jt;for(Jt=280;Jt<288;++Jt)Yd[Jt]=8;var Jt,NE=new Gi(32);for(Jt=0;Jt<32;++Jt)NE[Jt]=5;var Jt;var _E=fu(Yd,9,1);var ME=fu(NE,5,1),Ag=function(r){for(var t=r[0],e=1;et&&(t=r[e]);return t},Yn=function(r,t,e){var i=t/8|0;return(r[i]|r[i+1]<<8)>>(t&7)&e},vg=function(r,t){var e=t/8|0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>(t&7)},FE=function(r){return(r+7)/8|0},Cg=function(r,t,e){return(t==null||t<0)&&(t=0),(e==null||e>r.length)&&(e=r.length),new Gi(r.subarray(t,e))};var PE=["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"],Hi=function(r,t,e){var i=new Error(t||PE[r]);if(i.code=r,Error.captureStackTrace&&Error.captureStackTrace(i,Hi),!e)throw i;return i},OE=function(r,t,e,i){var n=r.length,s=i?i.length:0;if(!n||t.f&&!t.l)return e||new Gi(0);var o=!e,l=o||t.i!=2,c=t.i;o&&(e=new Gi(n*3));var u=function(ot){var dt=e.length;if(ot>dt){var at=new Gi(Math.max(dt*2,ot));at.set(e),e=at}},h=t.f||0,d=t.p||0,f=t.b||0,m=t.l,y=t.d,g=t.m,A=t.n,w=n*8;do{if(!m){h=Yn(r,d,1);var v=Yn(r,d+1,3);if(d+=3,v)if(v==1)m=_E,y=ME,g=9,A=5;else if(v==2){var F=Yn(r,d,31)+257,L=Yn(r,d+10,15)+4,Y=F+Yn(r,d+5,31)+1;d+=14;for(var q=new Gi(Y),G=new Gi(19),j=0;j>4;if(T<16)q[j++]=T;else{var O=0,C=0;for(T==16?(C=3+Yn(r,d,3),d+=2,O=q[j-1]):T==17?(C=3+Yn(r,d,7),d+=3):T==18&&(C=11+Yn(r,d,127),d+=7);C--;)q[j++]=O}}var D=q.subarray(0,F),E=q.subarray(F);g=Ag(D),A=Ag(E),m=fu(D,g,1),y=fu(E,A,1)}else Hi(1);else{var T=FE(d)+4,I=r[T-4]|r[T-3]<<8,_=T+I;if(_>n){c&&Hi(0);break}l&&u(f+I),e.set(r.subarray(T,_),f),t.b=f+=I,t.p=d=_*8,t.f=h;continue}if(d>w){c&&Hi(0);break}}l&&u(f+131072);for(var S=(1<>4;if(d+=O&15,d>w){c&&Hi(0);break}if(O||Hi(2),P<256)e[f++]=P;else if(P==256){M=d,m=null;break}else{var B=P-254;if(P>264){var j=P-257,$=My[j];B=Yn(r,d,(1<<$)-1)+Py[j],d+=$}var U=y[vg(r,d)&k],V=U>>4;U||Hi(3),d+=U&15;var E=IE[V];if(V>3){var $=Fy[V];E+=vg(r,d)&(1<<$)-1,d+=$}if(d>w){c&&Hi(0);break}l&&u(f+131072);var Z=f+B;if(f>>0},Ny=function(r,t){return xr(r,t)+xr(r,t+4)*4294967296};function AN(r,t,e){return e||(e=t,t={}),typeof e!="function"&&Hi(7),wN(r,t,[bN],function(i){return RE(Oy(i.data[0],LE(i.data[1])))},1,e)}function Oy(r,t){return OE(r,{i:2},t&&t.out,t&&t.dictionary)}var _y=typeof TextDecoder<"u"&&new TextDecoder,vN=0;try{_y.decode(mN,{stream:!0}),vN=1}catch{}var EN=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:Cg(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 CN(r,t){if(t){for(var e="",i=0;i65558)return o(Hi(13,0,1),null),n;var c=Yr(r,l+8);if(c){var u=c,h=xr(r,l+16),d=h==4294967295||u==65535;if(d){var f=xr(r,l-12);d=xr(r,f)==101075792,d&&(u=c=xr(r,f+32),h=xr(r,f+48))}for(var m=t&&t.filter,y=function(A){var w=SN(r,h,d),v=w[0],T=w[1],I=w[2],_=w[3],F=w[4],L=w[5],Y=TN(r,L);h=F;var q=function(j,J){j?(n(),o(j,null)):(J&&(s[_]=J),--c||o(null,s))};if(!m||m({name:_,size:T,originalSize:I,compression:v}))if(!v)q(null,Cg(r,Y,Y+T));else if(v==8){var G=r.subarray(Y,Y+T);if(I<524288||T>.8*I)try{q(null,Oy(G,{out:new Gi(I)}))}catch(j){q(j,null)}else i.push(AN(G,{size:I},q))}else q(Hi(14,"unknown compression type "+v,1),null);else q(null,null)},g=0;gnew Promise((e,i)=>{BE(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:st.Buffer.from(l)})))})});var UE=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 Ua(r,N=>!!N.match(e)||!!N.match(i)||!!N.match(n)||N===s||N==="xl/styles.xml"||N==="xl/workbook.xml"||N==="xl/_rels/workbook.xml.rels"||!!N.match(l)||!!N.match(c)||!!t.extractAttachments&&(!!N.match(o)||!!N.match(u)||!!N.match(h))),f=d.find(N=>N.path===s),m=[];if(f){let N=Zt(f.content.toString()),X=tt(N,"si");for(let O of X){let C=tt(O,"r");if(C.length>0){let D=[];for(let E of C){let S=tt(E,"t")[0];if(S){let k=S.textContent||"",M=tt(E,"rPr")[0],P={};if(M){tt(M,"b").length>0&&(P.bold=!0),tt(M,"i").length>0&&(P.italic=!0),tt(M,"u").length>0&&(P.underline=!0),tt(M,"strike").length>0&&(P.strikethrough=!0);let B=tt(M,"sz")[0];B&&(P.size=B.getAttribute("val")+"pt");let $=tt(M,"color")[0];if($){let Z=$.getAttribute("rgb");Z&&(P.color="#"+Z.substring(2))}let U=tt(M,"rFont")[0];U&&(P.font=U.getAttribute("val")||void 0);let V=tt(M,"vertAlign")[0];if(V){let Z=V.getAttribute("val");Z==="subscript"&&(P.subscript=!0),Z==="superscript"&&(P.superscript=!0)}}D.push({type:"text",text:k,formatting:Object.keys(P).length>0?P:void 0})}}m.push(D)}else{let D=tt(O,"t"),E="";for(let S of D)E+=S.textContent||"";m.push(E)}}}let y=d.find(N=>N.path==="xl/styles.xml"),g={};if(y){let N=Zt(y.content.toString()),X=tt(N,"fonts")[0],O=[];if(X){let S=tt(X,"font");for(let k of S){let M={};tt(k,"b").length>0&&(M.bold=!0),tt(k,"i").length>0&&(M.italic=!0),tt(k,"u").length>0&&(M.underline=!0),tt(k,"strike").length>0&&(M.strikethrough=!0);let P=tt(k,"sz")[0];if(P){let V=P.getAttribute("val");V&&(M.size=V+"pt")}let B=tt(k,"color")[0];if(B){let V=B.getAttribute("rgb");V&&(M.color="#"+V.substring(2))}let $=tt(k,"name")[0];if($){let V=$.getAttribute("val");V&&(M.font=V)}let U=tt(k,"vertAlign")[0];if(U){let V=U.getAttribute("val");V==="subscript"&&(M.subscript=!0),V==="superscript"&&(M.superscript=!0)}O.push(M)}}let C=tt(N,"fills")[0],D=[];if(C){let S=tt(C,"fill");for(let k of S){let M={},P=tt(k,"patternFill")[0];if(P){let B=tt(P,"fgColor")[0];if(B){let $=B.getAttribute("rgb"),U=B.getAttribute("theme");if($&&$!=="00000000")M.backgroundColor="#"+$.substring(2);else if(U){let V=parseInt(U);V===0?M.backgroundColor="#FFFFFF":V===1?M.backgroundColor="#000000":V===2?M.backgroundColor="#EEECE1":V===3&&(M.backgroundColor="#1F497D")}}}D.push(M)}}let E=tt(N,"cellXfs")[0];if(E){let S=tt(E,"xf");for(let k=0;kN.path.match(/xl\/media\/.*/)),v=d.filter(N=>N.path.match(n)),T={};if(t.extractAttachments){let N=d.filter(O=>O.path.match(h));for(let O of N){let D=`xl/drawings/${O.path.split("/").pop()?.replace(".rels","")||""}`,E=Zt(O.content.toString()),S=tt(E,"Relationship");T[D]||(T[D]={});for(let k of S){let M=k.getAttribute("Id"),P=k.getAttribute("Target");if(M&&P&&P.includes("media/")){let B="xl/"+P.replace("../","");T[D][M]={path:B}}}}let X=d.filter(O=>O.path.match(i));for(let O of X){let C=Zt(O.content.toString()),D=tt(C,"xdr:pic"),E=T[O.path]||{};for(let S of D){let k=tt(S,"xdr:blipFill")[0],M=k?tt(k,"a:blip")[0]:null,P=M?M.getAttribute("r:embed"):null,B=tt(S,"xdr:nvPicPr")[0],$=B?tt(B,"xdr:cNvPr")[0]:null,U=$?$.getAttribute("descr")||$.getAttribute("name"):void 0;P&&E[P]&&(E[P].altText=U||"")}}for(let O of w){let C=gr(O.path.split("/").pop()||"image",O.content),D="";for(let E in T){for(let S in T[E])if(T[E][S].path===O.path){D=T[E][S].altText||"";break}if(D)break}if(D&&(C.altText=D),A.push(C),t.ocr&&C.mimeType.startsWith("image/"))try{let E=(await Xn(O.content,{language:t.ocrLanguage,...t.ocrConfig})).trim();E&&(C.ocrText=E)}catch(E){rn(`OCR failed for ${C.name}:`,t,E)}}for(let O of v){let C={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:O.content.toString("base64"),name:O.path.split("/").pop()||"",extension:"xml"};try{let D=Xo(O.content);C.chartData=D}catch(D){rn(`Failed to extract chart data from ${O.path}:`,t,D)}A.push(C)}}let I={};if(t.extractAttachments){let N=d.filter(X=>X.path.match(h));for(let X of N){let C=`xl/drawings/${X.path.split("/").pop()?.replace(".rels","")||""}`,D=Zt(X.content.toString()),E=tt(D,"Relationship");I[C]||(I[C]={});for(let S of E){let k=S.getAttribute("Id"),M=S.getAttribute("Target"),P=S.getAttribute("Type");if(k&&M&&P&&P.includes("chart")){let B=M.split("/").pop()||"";I[C][k]=B}}}}let _={},F=d.find(N=>N.path==="xl/workbook.xml"),L=d.find(N=>N.path==="xl/_rels/workbook.xml.rels");if(F&&L){let N=Zt(L.content.toString()),X=tt(N,"Relationship"),O={};for(let E of X){let S=E.getAttribute("Id"),k=E.getAttribute("Target");if(S&&k){let M=k.split("/").pop()||"";O[S]=M}}let C=Zt(F.content.toString()),D=tt(C,"sheet");for(let E of D){let S=E.getAttribute("name"),k=E.getAttribute("r:id");S&&k&&O[k]&&(_[O[k]]=S)}}let Y=[],q=[];for(let N of d)if(!N.path.match(o)&&N.path!==s&&N.path!=="xl/styles.xml"&&!N.path.match(i)&&!N.path.match(n)&&!N.path.match(u)&&!N.path.match(h)&&N.path.match(e)){t.includeRawContent&&q.push(N.content.toString());let X=[],O=/[\s\S]*?<\/row>/g,C=N.content.toString().match(O);if(C)for(let S of C){let k=[],M=/[\s\S]*?<\/c>/g,P=S.match(M),B=S.match(/r="(\d+)"/),$=B?parseInt(B[1])-1:0;if(P)for(let U of P){let V=U.match(/t="([a-z]+)"/),Z=V?V[1]:"n",Q=U.match(/(.*?)<\/v>/),nt=U.match(/(.*?)<\/t>/),ot="",dt=[];if(Z==="s"&&Q){let lt=parseInt(Q[1]),ct=m[lt];Array.isArray(ct)?(dt=JSON.parse(JSON.stringify(ct)),ot=dt.map(rt=>rt.text).join("")):ot=ct||""}else Z==="inlineStr"&&nt?ot=nt[1]:Q&&(ot=Q[1]);let at=U.match(/r="([A-Z]+)(\d+)"/),ft=(at?at[1]:"").charCodeAt(0)-65;if(ot||dt.length>0){let lt=U.match(/s="(\d+)"/),ct=lt?parseInt(lt[1]):void 0,rt=ct!==void 0&&g[ct]?g[ct]:{};if(dt.length>0)for(let wt of dt)wt.formatting||(wt.formatting={}),rt.backgroundColor&&(wt.formatting.backgroundColor=rt.backgroundColor),rt.alignment&&(wt.formatting.alignment=rt.alignment),!wt.formatting.font&&rt.font&&(wt.formatting.font=rt.font),!wt.formatting.size&&rt.size&&(wt.formatting.size=rt.size);else dt.push({type:"text",text:ot,formatting:rt});let gt={type:"cell",text:ot,children:dt,metadata:{row:$,col:ft}};t.includeRawContent&&(gt.rawContent=U),k.push(gt)}}if(k.length>0){let U={type:"row",children:k,metadata:void 0};t.includeRawContent&&(U.rawContent=S),X.push(U)}}if(t.extractAttachments){let k=`xl/worksheets/_rels/${N.path.split("/").pop()||""}.rels`,M=d.find($=>$.path===k),P={};if(M){let $=Zt(M.content.toString()),U=tt($,"Relationship");for(let V of U){let Z=V.getAttribute("Id"),Q=V.getAttribute("Target"),nt=V.getAttribute("Type");Z&&Q&&nt&&nt.includes("drawing")&&(P[Z]="xl/drawings/"+Q.replace("../drawings/",""))}}let B=N.content.toString().match(/pt.name===dt.path.split("/").pop());if(at){let pt={type:"image",text:"",children:[],metadata:{attachmentName:at.name||"unknown",altText:dt.altText||void 0}};X.push(pt)}}let nt=I[Z];if(nt)for(let ot in nt){let dt=nt[ot];if(A.find(pt=>pt.name===dt)){let pt={type:"chart",text:"",children:[],metadata:{attachmentName:dt}};X.push(pt)}}}}}let D=N.path.split("/").pop()||"Sheet",E=_[D]||D;Y.push({type:"sheet",children:X,metadata:{sheetName:E},rawContent:t.includeRawContent?N.content.toString():void 0})}let G=d.find(N=>N.path.match(l)),j=G?La(G.content.toString()):{},J=d.find(N=>N.path.match(c));if(J){let N=hu(J.content.toString());Object.keys(N).length>0&&(j.customProperties=N)}let et=N=>{for(let X of N){if("attachmentName"in(X.metadata||{})){let O=X.metadata,C=A.find(D=>D.name===O.attachmentName);C&&(X.type==="image"&&(C.ocrText&&(X.text=C.ocrText),O.altText&&(C.altText=O.altText)),X.type==="chart"&&C.chartData&&(X.text=C.chartData.rawTexts.join(t.newlineDelimiter||` +`)))}X.children&&et(X.children)}};return et(Y),{type:"xlsx",metadata:j,content:Y,attachments:A,toText:()=>Y.map(N=>{let X=O=>{let C="";return O.children?C+=O.children.map(X).filter(D=>D!="").join(O.children[0]?.children?t.newlineDelimiter??` +`:""):C+=O.text||"",C};return X(N)}).filter(N=>N!="").join(t.newlineDelimiter??` +`)}};H();var zE=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 Ua(r,N=>!!N.match(e)||!!N.match(i)||!!N.match(s)||!!N.match(o)||!!N.match(l)||!!t.extractAttachments&&!!N.match(n)),u=c.find(N=>N.path==="mimetype"),h="odt";if(u){let N=u.content.toString().trim();N.includes("spreadsheet")?h="ods":N.includes("presentation")?h="odp":N.includes("text")&&(h="odt")}let d=c.find(N=>N.path==="content.xml")||c.find(N=>N.path.match(e)),f=c.find(N=>N.path==="styles.xml"),m=[],y=[],g={},A={},w={};f&&(N=>{let X=Zt(N),O=tt(X,"style:style");for(let C of O){let D=C.getAttribute("style:name");if(!D)continue;let E={},S=ut(C,"style:paragraph-properties");if(S){let B=S.getAttribute("fo:text-align");if(B){let U={start:"left",left:"left",center:"center",end:"right",right:"right",justify:"justify"};U[B]&&(E.alignment=U[B])}ut(S,"style:drop-cap")&&(E.dropCap=!0)}Object.keys(E).length>0&&(A[D]=E);let k=ut(C,"style:text-properties"),M=ut(C,"style:table-cell-properties"),P={};if(M){let B=M.getAttribute("fo:background-color");B&&B!=="transparent"&&(P.backgroundColor=B)}if(k){(k.getAttribute("fo:font-weight")==="bold"||k.getAttribute("style:font-weight-asian")==="bold")&&(P.bold=!0),(k.getAttribute("fo:font-style")==="italic"||k.getAttribute("style:font-style-asian")==="italic")&&(P.italic=!0),k.getAttribute("style:text-underline-style")==="solid"&&(P.underline=!0),k.getAttribute("style:text-line-through-style")==="solid"&&(P.strikethrough=!0);let B=k.getAttribute("fo:font-size")||k.getAttribute("style:font-size-asian");B&&(P.size=B);let $=k.getAttribute("fo:color");$&&(P.color=$);let U=k.getAttribute("fo:background-color");U&&U!=="transparent"&&(P.backgroundColor=U);let V=k.getAttribute("style:font-name")||k.getAttribute("fo:font-family");V&&(P.font=V);let Z=k.getAttribute("style:text-position");Z&&(Z.startsWith("sub")&&(P.subscript=!0),Z.startsWith("super")&&(P.superscript=!0)),Object.keys(P).length>0&&(g[D]=P)}}})(f.content.toString());let T=(N,X,O,C,D,E={},S,k="")=>{let M=[],P="";if(!N.childNodes)return{text:"",children:[]};for(let B=0;B0&&(dt=ot[0].getAttribute("xlink:href")||"",dt)){let ft=dt.split("/");dt=ft[ft.length-1]}let pt={type:"image",text:"",children:[],metadata:{attachmentName:dt,...Q?{altText:Q}:{}}};O.includeRawContent&&(pt.rawContent=Qt(Z,I,O)),M.push(pt)}}}return{text:P,children:M}},k=(_,X,O,C,D)=>{let E=_.getAttribute("text:style-name"),S=E?X[E]:void 0,I=S?.alignment,M=S?.dropCap,P=T(_,O,C,y,X,{},void 0,D);if(E&&P.children.forEach(B=>{if(B.type==="text"){B.metadata||(B.metadata={});let $=B.metadata;$.style||($.style=E)}}),P.children.length===0&&_.textContent){let B=_.textContent;B.trim()&&(P.text=B,P.children.push({type:"text",text:B}))}if(M&&P.children.length>0){let B=P.children[0];if(B.type==="text"&&B.text)if(B.text.length===1)B.formatting={...B.formatting,size:"58.5pt"};else{let $=B.text[0],U=B.text.substring(1),V={type:"text",text:$,formatting:{...B.formatting,size:"58.5pt"},metadata:B.metadata};B.text=U,P.children.unshift(V)}}return{text:P.text,children:P.children,alignment:I,style:E||void 0}},N=(_,X,O,C,D)=>{let E=[],S=He(_,"table:table-row"),I=0;for(let M of S){let P=[],B=He(M,"table:table-cell"),$=parseInt(M.getAttribute("table:number-rows-repeated")||"1"),U=0;for(let V of B){let Z=[],Q={value:""},nt=parseInt(V.getAttribute("table:number-columns-repeated")||"1"),at=parseInt(V.getAttribute("table:number-columns-spanned")||"1"),dt=parseInt(V.getAttribute("table:number-rows-spanned")||"1"),ot=ft=>{if(ft.childNodes)for(let lt=0;lt0&&(dt=at[0].getAttribute("xlink:href")||"",dt)){let ft=dt.split("/");dt=ft[ft.length-1]}let pt={type:"image",text:"",children:[],metadata:{attachmentName:dt,...Q?{altText:Q}:{}}};O.includeRawContent&&(pt.rawContent=Qt(Z,k,O)),M.push(pt)}}}return{text:P,children:M}},I=(N,X,O,C,D)=>{let E=N.getAttribute("text:style-name"),S=E?X[E]:void 0,k=S?.alignment,M=S?.dropCap,P=T(N,O,C,y,X,{},void 0,D);if(E&&P.children.forEach(B=>{if(B.type==="text"){B.metadata||(B.metadata={});let $=B.metadata;$.style||($.style=E)}}),P.children.length===0&&N.textContent){let B=N.textContent;B.trim()&&(P.text=B,P.children.push({type:"text",text:B}))}if(M&&P.children.length>0){let B=P.children[0];if(B.type==="text"&&B.text)if(B.text.length===1)B.formatting={...B.formatting,size:"58.5pt"};else{let $=B.text[0],U=B.text.substring(1),V={type:"text",text:$,formatting:{...B.formatting,size:"58.5pt"},metadata:B.metadata};B.text=U,P.children.unshift(V)}}return{text:P.text,children:P.children,alignment:k,style:E||void 0}},_=(N,X,O,C,D)=>{let E=[],S=He(N,"table:table-row"),k=0;for(let M of S){let P=[],B=He(M,"table:table-cell"),$=parseInt(M.getAttribute("table:number-rows-repeated")||"1"),U=0;for(let V of B){let Z=[],Q={value:""},nt=parseInt(V.getAttribute("table:number-columns-repeated")||"1"),ot=parseInt(V.getAttribute("table:number-columns-spanned")||"1"),dt=parseInt(V.getAttribute("table:number-rows-spanned")||"1"),at=ft=>{if(ft.childNodes)for(let lt=0;lt0?ft===0?Z:JSON.parse(JSON.stringify(Z)):[],metadata:{row:I,col:U}},ct=lt.metadata;at>1&&(ct.colSpan=at),dt>1&&(ct.rowSpan=dt),C.includeRawContent&&(lt.rawContent=Qt(V,D,C)),P.push(lt),U++}}for(let V=0;V<$;V++){let Z={type:"row",children:V===0?P:JSON.parse(JSON.stringify(P))};V>0&&Z.children?.forEach(Q=>{Q.metadata&&"row"in Q.metadata&&(Q.metadata.row=I)}),C.includeRawContent&&(Z.rawContent=Qt(M,D,C)),E.push(Z),I++}}return{type:"table",children:E}};d&&(_=>{let X=Zt(_,{locator:t.includeRawContent}),O=ut(X,"office:body");if(!O)return;let C=ut(X,"office:automatic-styles");if(C){let S=J(C,"style:style");for(let I of S){let M=I.getAttribute("style:name");if(!M)continue;let P=ut(I,"style:paragraph-properties"),B={};if(P){let U=P.getAttribute("fo:text-align");if(U){let Z={start:"left",left:"left",center:"center",end:"right",right:"right",justify:"justify"};Z[U]&&(B.alignment=Z[U])}ut(P,"style:drop-cap")&&(B.dropCap=!0)}Object.keys(B).length>0&&(A[M]=B);let $=ut(I,"style:text-properties");if($){let U={};($.getAttribute("fo:font-weight")==="bold"||$.getAttribute("style:font-weight-asian")==="bold")&&(U.bold=!0),($.getAttribute("fo:font-style")==="italic"||$.getAttribute("style:font-style-asian")==="italic")&&(U.italic=!0),$.getAttribute("style:text-underline-style")==="solid"&&(U.underline=!0),$.getAttribute("style:text-line-through-style")==="solid"&&(U.strikethrough=!0);let V=$.getAttribute("fo:font-size")||$.getAttribute("style:font-size-asian");V&&(U.size=V);let Z=$.getAttribute("fo:color");Z&&(U.color=Z);let Q=$.getAttribute("fo:background-color");Q&&Q!=="transparent"&&(U.backgroundColor=Q);let nt=$.getAttribute("style:font-name")||$.getAttribute("fo:font-family");nt&&(U.font=nt);let at=$.getAttribute("style:text-position");at&&(at.startsWith("sub")&&(U.subscript=!0),at.startsWith("super")&&(U.superscript=!0)),Object.keys(U).length>0&&(g[M]=U)}}}let D=ut(X,"office:body");if(D){let S=He(D,"office:text")[0]||He(D,"office:presentation")[0]||He(D,"office:spreadsheet")[0];if(S){let I=He(S,"*");for(let M of I)E(M,m,!1,_)}}function E(S,I,M=!1,P){if(S.tagName==="text:p"){let B=k(S,A,g,t,P),$=M||(S.getAttribute("text:style-name")||"").toLowerCase().includes("title")?"heading":"paragraph",U={type:$,text:B.text,children:B.children,metadata:{...B.alignment?{alignment:B.alignment}:{},...B.style?{style:B.style}:{}}};$==="heading"&&U.metadata&&(U.metadata.level=U.metadata.level||1),Object.keys(U.metadata||{}).length===0&&delete U.metadata,t.includeRawContent&&(U.rawContent=Qt(S,P,t)),I.push(U)}else if(S.tagName==="text:h"){let B=parseInt(S.getAttribute("text:outline-level")||"1"),$=k(S,A,g,t,P),U={type:"heading",text:$.text,children:$.children,metadata:{level:B,...$.alignment?{alignment:$.alignment}:{},...$.style?{style:$.style}:{}}};t.includeRawContent&&(U.rawContent=Qt(S,P,t)),I.push(U)}else if(S.tagName==="table:table"){let B=N(S,A,g,t,P);t.includeRawContent&&(B.rawContent=Qt(S,P,t)),I.push(B)}else if(S.tagName==="text:list"){let B=He(S,"text:list-item"),$=S.getAttribute("text:style-name")||S.getAttribute("xml:id"),U=$||`list-${I.length}`,V="unordered",Z=!1,Q=$;if(!Q){let ot=S.parentNode;for(;ot&&!Q&&!(ot.nodeName==="text:list"&&(Q=ot.getAttribute("text:style-name"),Q));)ot=ot.parentNode}if(Q){let ot=ut(Zt(d?.content.toString()||""),"office:automatic-styles");if(ot){let pt=J(ot,"text:list-style");for(let ft of pt)if(ft.getAttribute("style:name")===Q){let lt=J(ft,"text:list-level-style-bullet"),ct=J(ft,"text:list-level-style-number"),rt=J(ft,"text:list-level-style-image");ct.length>0?(V="ordered",Z=ct.some(gt=>!!gt.getAttribute("style:num-format"))):lt.length>0&&(V="unordered",Z=lt.some(gt=>!!gt.getAttribute("text:bullet-char"))),rt.length>0&&(Z=!0);break}}if(f&&!Z){let pt=Zt(f.content.toString()),ft=J(pt,"text:list-style");for(let lt of ft)if(lt.getAttribute("style:name")===Q){let ct=J(lt,"text:list-level-style-bullet"),rt=J(lt,"text:list-level-style-number"),gt=J(lt,"text:list-level-style-image");rt.length>0?(V="ordered",Z=rt.some(bt=>!!bt.getAttribute("style:num-format"))):ct.length>0&&(V="unordered",Z=ct.some(bt=>!!bt.getAttribute("text:bullet-char"))),gt.length>0&&(Z=!0);break}}}if(!Z){for(let ot=0;otpt.path===dt||pt.path.endsWith(dt));if(ot){let pt=Xo(ot.content),ft={type:"chart",text:pt.rawTexts.join(" "),metadata:{attachmentName:at,chartData:pt}};t.includeRawContent&&(ft.rawContent=Qt(S,P,t)),I.push(ft)}else{let pt={type:"chart",text:"",metadata:{attachmentName:at}};t.includeRawContent&&(pt.rawContent=Qt(S,P,t)),I.push(pt)}}}}else if(S.childNodes)for(let B=0;B0)for(let Dt of Bt){let Gt=Dt.getAttribute("text:style-name"),bi=Gt?g[Gt]:{},R=Dt.textContent||"";rt+=R;let W={type:"text",text:R,formatting:bi};gt.push(W)}else{let Dt=At.textContent||"";if(rt+=Dt,Dt.trim()){let Gt={type:"text",text:Dt,formatting:{}};gt.push(Gt)}}Yt0){let Ct=bi[0].getAttribute("xlink:href");if(Ct){let vt=Ct.split("/");Gt=vt[vt.length-1]}}let R="",W=J(Yt,"draw:object");if(W.length>0){let Ct=W[0].getAttribute("xlink:href");Ct&&(R=Ct.split("/")[0])}if(bi.length>0){let Ct={type:"image",text:"",children:[],metadata:{attachmentName:Gt,...At?{altText:At}:{}}};t.includeRawContent&&(Ct.rawContent=Qt(Yt,_,t)),gt.push(Ct)}else if(R){let Ct={type:"chart",text:"",children:[],metadata:{attachmentName:R}};gt.push(Ct)}}for(let Yt=0;Yt0||h!=="ods"){let At={type:"cell",text:rt,children:gt,metadata:{row:V,col:ot}};t.includeRawContent&&(At.rawContent=Qt(lt,_,t)),at.push(At)}ot++}}if(at.length>0)for(let ft=0;ft0&<.children?.forEach(ct=>{ct.metadata&&"row"in ct.metadata&&(ct.metadata.row=V)}),t.includeRawContent&&(lt.rawContent=Qt(nt,_,t)),$.push(lt),V++}else V+=pt}let Z={type:"sheet",children:$,metadata:{sheetName:B}};t.includeRawContent&&(Z.rawContent=Qt(P,_,t)),m.push(Z)}}}else if(h==="odp"){let S=ut(O,"office:presentation");if(S){let I=He(S,"draw:page"),M=[];for(let P=0;P0&&(t.putNotesAtLast?M.push(U):m.push(U))}M.length>0&&m.push(...M)}}else{let S=ut(O,"office:text");S&&E(S,m,!1,_)}})(d.content.toString());let L=[],Y=c.filter(_=>_.path.match(/(Pictures|media)\/.*/));if(t.extractAttachments){let _=c.filter(X=>X.path.match(/Object \d+\/content\.xml/));for(let X of _){let O=Zt(X.content.toString());if(J(O,"chart:chart").length>0){let D=X.path.split("/")[0],E={type:"chart",mimeType:"application/vnd.oasis.opendocument.chart",data:X.content.toString("base64"),name:D,extension:"xml"},S=Xo(X.content);S.rawTexts.length>0&&(E.chartData=S),L.push(E)}}}if(t.extractAttachments)for(let _ of Y){let X=gr(_.path.split("/").pop()||"image",_.content);if(L.push(X),t.ocr&&X.mimeType.startsWith("image/"))try{X.ocrText=(await Xn(_.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(O){rn(`OCR failed for ${X.name}:`,t,O)}}let q=c.find(_=>_.path.match(s)),G=q?La(q.content.toString()):{},j=(_,X)=>{let O=D=>{let E=D.replace(/^\[|\]$/g,""),[S,I]=E.split(":"),M=S.lastIndexOf(".");if(M===-1)return[D];let P=S.substring(0,M).replace(/^'|'$/g,""),B=S.substring(M+1).replace(/\$/g,""),$=B;if(I)if(I.startsWith("."))$=I.substring(1).replace(/\$/g,"");else{let at=I.lastIndexOf(".");$=I.substring(at+1).replace(/\$/g,"")}let U=at=>{let dt=at.match(/[A-Z]+/),ot=at.match(/\d+/);if(!dt||!ot)return null;let pt=dt[0],ft=0;for(let ct=0;ctat.type==="sheet"&&at.metadata?.sheetName===P);if(!Q||!Q.children)return[D];let nt=[];for(let at of Q.children)if(at.children)for(let dt of at.children){let ot=dt.metadata;ot&&ot.row>=V.r&&ot.row<=Z.r&&ot.col>=V.c&&ot.col<=Z.c&&nt.push(dt.text||"")}return nt.length>0?nt:[]};for(let D of _.dataSets){let E=[];for(let S of D.values)S.startsWith("[")?E.push(...O(S)):E.push(S);D.values=E}let C=[];for(let D of _.labels)D.startsWith("[")?C.push(...O(D)):C.push(D);_.labels=C,_.rawTexts=[],_.title&&_.rawTexts.push(_.title);for(let D of _.dataSets)D.name&&_.rawTexts.push(D.name),_.rawTexts.push(..._.labels),_.rawTexts.push(...D.values)};for(let _ of L)_.type==="chart"&&_.chartData&&j(_.chartData,m);(_=>{let X=new Set,O=S=>{for(let I of S){if(I.metadata&&"attachmentName"in I.metadata){let M=I.metadata.attachmentName;M&&X.add(M)}I.children&&O(I.children)}};O(_);let C=L.filter(S=>S.type==="image"&&S.name&&!X.has(S.name)),D=0,E=S=>{if((S.type==="image"||S.type==="chart")&&S.metadata&&"attachmentName"in S.metadata){let I=S.metadata.attachmentName;if(!I&&S.type==="image"&&DP.name===I);M&&(M.ocrText&&(S.text=M.ocrText),M.chartData&&S.type==="chart"&&(S.text=M.chartData.rawTexts.join(t.newlineDelimiter??` -`)))}}S.children&&S.children.forEach(E)};_.forEach(E)})(m);let et={};for(let _ in g)et[_]={formatting:g[_],alignment:A[_]?.alignment};for(let _ in A)et[_]||(et[_]={formatting:{},alignment:A[_]?.alignment});return t.putNotesAtLast&&y.length>0&&m.push(...y),{type:h,metadata:{...G,styleMap:et},content:m,attachments:L,toText:()=>m.map(_=>{let X=O=>{let C="";if(O.children&&O.children.length>0){let E=O.children.some(S=>S.children&&S.children.length>0)?t.newlineDelimiter??` -`:"";C+=O.children.map(X).filter(S=>S!="").join(E)}else C+=O.text||"";return C};return X(_)}).filter(_=>_!="").join(t.newlineDelimiter??` -`)}};H();H();async function Hw(r){return new Function("s","return import(s)")(r)}async function LS(){return Xc?Promise.resolve().then(()=>(Q1(),Z1)):Hw("file-type")}async function BS(){if(!Xc){xA();try{return await Hw("pdfjs-dist/legacy/build/pdf.mjs")}catch{return await Hw("pdfjs-dist")}}return Promise.resolve().then(()=>(RS(),OS))}function DM(r){return r&&typeof r.str=="string"&&Array.isArray(r.transform)&&r.transform.length>=6}function IM(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 kM(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 _M(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),y=Math.max(c,h);if(ed&&nm)return o}}function NM(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=st.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{let e=await BS();if(t.pdfWorkerSrc)e.GlobalWorkerOptions.workerSrc=t.pdfWorkerSrc;else if(Xc)e.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${e.version}/build/pdf.worker.min.mjs`;else{Zm("pdf-worker-auto-resolution");try{let g=Vm.resolve("pdfjs-dist/legacy/build/pdf.worker.mjs");e.GlobalWorkerOptions.workerSrc=g}catch(g){t.outputErrorToConsole&&console.warn("[PdfParser] Could not auto-resolve local worker path:",g)}}let i=new Uint8Array(r),n=e.getDocument({data:i,verbosity:0}),s;try{s=await n.promise}catch(g){let A=g instanceof Error?g.message:String(g);throw A.includes("workerSrc")||A.includes('No "GlobalWorkerOptions.workerSrc" specified')?Ms("PDF_WORKER_MISSING",t):g}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:Wr(d?.CreationDate),modified:Wr(d?.ModDate)},m=new Set(["Title","Author","Subject","Keywords","Creator","Producer","CreationDate","ModDate","Trapped","IsAcroFormPresent","IsXFAPresent","IsCollectionPresent","IsSignaturesPresent","PDFFormatVersion"]);if(d){let g={};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,T]of Object.entries(w))T!=null&&(typeof T=="string"||typeof T=="number"||typeof T=="boolean"||T instanceof Date)&&(g[v]=T);continue}(typeof w=="string"||typeof w=="number"||typeof w=="boolean"||w instanceof Date)&&(g[A]=w)}}Object.keys(g).length>0&&(f.customProperties=g)}try{let g=await s.getAttachments();if(g&&t.extractAttachments)for(let A in g){let w=g[A],v=st.Buffer.from(w.content),T=gr(w.filename,v);l.push(T)}}catch(g){t.outputErrorToConsole&&console.error("Error extracting embedded attachments:",g)}for(let g=1;g<=c;g++){let A,w,v=[];try{A=await s.getPage(g),w=await A.getTextContent()}catch(k){t.outputErrorToConsole&&console.warn(`[PdfParser] Error loading page ${g}:`,k),u.push(v);continue}let T=A.commonObjs;for(let k of w.items){if(!DM(k))continue;let N=k,F=N.transform,L=F[4],Y=F[5],q=N.width||0,G=N.height||Math.abs(F[3])||12,j={},tt;if(N.fontName&&T)try{if(T.has(N.fontName)){let et=await new Promise(_=>{T.get(N.fontName,X=>_(X))});if(et?.name&&typeof et.name=="string"){tt=et.name.replace(/^[A-Z]{6}\+/,""),j.font=tt;let _=et.name.toLowerCase();_.includes("bold")&&(j.bold=!0),(_.includes("italic")||_.includes("oblique"))&&(j.italic=!0)}}}catch{}G>0&&(j.size=Math.round(G).toString()),v.push({type:"text",x:L,y:Y,width:q,height:G,text:N.str,fontName:tt,formatting:j})}if(t.extractAttachments||t.ocr)try{let k=await A.getOperatorList(),N=k.fnArray,F=k.argsArray;for(let L=0;L{let tt=setTimeout(()=>{j()},500);A.objs.get(G,et=>{clearTimeout(tt),j()})})}catch(j){t.outputErrorToConsole&&console.error(`[PdfParser] Failed to load dependency ${G}:`,j)}}if(Y===e.OPS.paintImageXObject||Y===e.OPS.paintXObject){let q=F[L][0];try{let G=A.objs.has(q),j=A.objs;if(!G&&A.commonObjs.has(q)&&(G=!0,j=A.commonObjs),G){let tt=await new Promise(et=>{j.get(q,_=>et(_))});if(typeof window<"u"&&!tt.data&&tt.bitmap)try{let et=document.createElement("canvas");et.width=tt.width,et.height=tt.height;let _=et.getContext("2d");_&&(_.drawImage(tt.bitmap,0,0),tt.data=_.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,_=0;for(let X=L-1;X>=0;X--)if(N[X]===e.OPS.transform){et=F[X][4],_=F[X][5];break}v.push({type:"image",x:et,y:_,name:q,data:tt.data,width:tt.width,height:tt.height,kind:tt.kind})}}}catch{}}}}catch(k){t.outputErrorToConsole&&console.error(`Error extracting images from page ${g}:`,k)}u.push(v)}let y=IM(u);for(let g=0;gMath.abs(j.y-G.y)>7?j.y-G.y:G.x-j.x);let F=null,L=0,Y=-1,q=0;for(let G of v)if(G.type==="text"){let j=G.text;if(!j)continue;if(Y!==-1&&Math.abs(G.y-Y)>5&&F&&((F.text||"").trim().length>0&&T.push(F),F=null),!F&&j.trim().length===0){Y=G.y;continue}let et=kM(G.height,y);if(F||(et>0?F={type:"heading",text:"",children:[],metadata:{level:et}}:F={type:"paragraph",text:"",children:[]},L=G.height),j.trim().length===0){if(F.children&&F.children.length>0){let C=F.children[F.children.length-1];C.type==="text"&&C.text&&(C.text+=j,F.text+=j)}Y=G.y;continue}if(F.text&&F.text.length>0&&!F.text.endsWith(" ")&&(F.text+=" ",F.children&&F.children.length>0)){let C=F.children[F.children.length-1];C.type==="text"&&C.text&&(C.text+=" ")}F.text+=j;let _=_M(G,k);_&&N.add(_);let X;_&&(_.url?X={link:_.url,linkType:_.url.startsWith("#")?"internal":"external"}:_.dest&&(X={link:typeof _.dest=="string"?`#${_.dest}`:"#internal",linkType:"internal"}));let O=!1;if(F.children&&F.children.length>0&&!X){let C=F.children[F.children.length-1];C.type==="text"&&FM(C.formatting,G.formatting)&&!C.metadata&&(C.text=(C.text||"")+j,O=!0)}if(!O){let C={type:"text",text:j,formatting:Object.keys(G.formatting).length>0?G.formatting:void 0};X&&(C.metadata=X),F.children?.push(C)}Y=G.y}else if(G.type==="image"){F&&((F.text||"").trim().length>0&&T.push(F),F=null),q++;let j=`pdf_image_p${A}_${q}.bmp`;if(t.extractAttachments)try{let tt=MM(G.data,G.width,G.height,G.kind),et=NM(G.width,G.height,new Uint8Array(tt)),_=gr(j,et);if(_.mimeType="image/bmp",t.ocr)try{G.width>=10&&G.height>=10&&(_.ocrText=(await Xn(et,{language:t.ocrLanguage,...t.ocrConfig})).trim())}catch(O){t.outputErrorToConsole&&console.error(`OCR failed for ${j}:`,O)}l.push(_);let X={attachmentName:j};T.push({type:"image",text:_.ocrText||"",metadata:{...X}})}catch(tt){rn(`Failed to process image ${j}:`,t,tt)}}F&&(F.text||"").trim().length>0&&T.push(F),o.push({type:"page",children:T,text:T.map(G=>G.text).join(t.newlineDelimiter??` +`)}else if(rt.tagName==="table:table"){let gt=_(rt,X,O,C,D);Z.push(gt)}else(rt.tagName==="draw:frame"||rt.tagName==="draw:text-box")&&at(rt)}}};at(V);let pt=Q.value;pt.endsWith(` +`)&&(pt=pt.slice(0,-1));for(let ft=0;ft0?ft===0?Z:JSON.parse(JSON.stringify(Z)):[],metadata:{row:k,col:U}},ct=lt.metadata;ot>1&&(ct.colSpan=ot),dt>1&&(ct.rowSpan=dt),C.includeRawContent&&(lt.rawContent=Qt(V,D,C)),P.push(lt),U++}}for(let V=0;V<$;V++){let Z={type:"row",children:V===0?P:JSON.parse(JSON.stringify(P))};V>0&&Z.children?.forEach(Q=>{Q.metadata&&"row"in Q.metadata&&(Q.metadata.row=k)}),C.includeRawContent&&(Z.rawContent=Qt(M,D,C)),E.push(Z),k++}}return{type:"table",children:E}};d&&(N=>{let X=Zt(N,{locator:t.includeRawContent}),O=ut(X,"office:body");if(!O)return;let C=ut(X,"office:automatic-styles");if(C){let S=tt(C,"style:style");for(let k of S){let M=k.getAttribute("style:name");if(!M)continue;let P=ut(k,"style:paragraph-properties"),B={};if(P){let U=P.getAttribute("fo:text-align");if(U){let Z={start:"left",left:"left",center:"center",end:"right",right:"right",justify:"justify"};Z[U]&&(B.alignment=Z[U])}ut(P,"style:drop-cap")&&(B.dropCap=!0)}Object.keys(B).length>0&&(A[M]=B);let $=ut(k,"style:text-properties");if($){let U={};($.getAttribute("fo:font-weight")==="bold"||$.getAttribute("style:font-weight-asian")==="bold")&&(U.bold=!0),($.getAttribute("fo:font-style")==="italic"||$.getAttribute("style:font-style-asian")==="italic")&&(U.italic=!0),$.getAttribute("style:text-underline-style")==="solid"&&(U.underline=!0),$.getAttribute("style:text-line-through-style")==="solid"&&(U.strikethrough=!0);let V=$.getAttribute("fo:font-size")||$.getAttribute("style:font-size-asian");V&&(U.size=V);let Z=$.getAttribute("fo:color");Z&&(U.color=Z);let Q=$.getAttribute("fo:background-color");Q&&Q!=="transparent"&&(U.backgroundColor=Q);let nt=$.getAttribute("style:font-name")||$.getAttribute("fo:font-family");nt&&(U.font=nt);let ot=$.getAttribute("style:text-position");ot&&(ot.startsWith("sub")&&(U.subscript=!0),ot.startsWith("super")&&(U.superscript=!0)),Object.keys(U).length>0&&(g[M]=U)}}}let D=ut(X,"office:body");if(D){let S=He(D,"office:text")[0]||He(D,"office:presentation")[0]||He(D,"office:spreadsheet")[0];if(S){let k=He(S,"*");for(let M of k)E(M,m,!1,N)}}function E(S,k,M=!1,P){if(S.tagName==="text:p"){let B=I(S,A,g,t,P),$=M||(S.getAttribute("text:style-name")||"").toLowerCase().includes("title")?"heading":"paragraph",U={type:$,text:B.text,children:B.children,metadata:{...B.alignment?{alignment:B.alignment}:{},...B.style?{style:B.style}:{}}};$==="heading"&&U.metadata&&(U.metadata.level=U.metadata.level||1),Object.keys(U.metadata||{}).length===0&&delete U.metadata,t.includeRawContent&&(U.rawContent=Qt(S,P,t)),k.push(U)}else if(S.tagName==="text:h"){let B=parseInt(S.getAttribute("text:outline-level")||"1"),$=I(S,A,g,t,P),U={type:"heading",text:$.text,children:$.children,metadata:{level:B,...$.alignment?{alignment:$.alignment}:{},...$.style?{style:$.style}:{}}};t.includeRawContent&&(U.rawContent=Qt(S,P,t)),k.push(U)}else if(S.tagName==="table:table"){let B=_(S,A,g,t,P);t.includeRawContent&&(B.rawContent=Qt(S,P,t)),k.push(B)}else if(S.tagName==="text:list"){let B=He(S,"text:list-item"),$=S.getAttribute("text:style-name")||S.getAttribute("xml:id"),U=$||`list-${k.length}`,V="unordered",Z=!1,Q=$;if(!Q){let at=S.parentNode;for(;at&&!Q&&!(at.nodeName==="text:list"&&(Q=at.getAttribute("text:style-name"),Q));)at=at.parentNode}if(Q){let at=ut(Zt(d?.content.toString()||""),"office:automatic-styles");if(at){let pt=tt(at,"text:list-style");for(let ft of pt)if(ft.getAttribute("style:name")===Q){let lt=tt(ft,"text:list-level-style-bullet"),ct=tt(ft,"text:list-level-style-number"),rt=tt(ft,"text:list-level-style-image");ct.length>0?(V="ordered",Z=ct.some(gt=>!!gt.getAttribute("style:num-format"))):lt.length>0&&(V="unordered",Z=lt.some(gt=>!!gt.getAttribute("text:bullet-char"))),rt.length>0&&(Z=!0);break}}if(f&&!Z){let pt=Zt(f.content.toString()),ft=tt(pt,"text:list-style");for(let lt of ft)if(lt.getAttribute("style:name")===Q){let ct=tt(lt,"text:list-level-style-bullet"),rt=tt(lt,"text:list-level-style-number"),gt=tt(lt,"text:list-level-style-image");rt.length>0?(V="ordered",Z=rt.some(wt=>!!wt.getAttribute("style:num-format"))):ct.length>0&&(V="unordered",Z=ct.some(wt=>!!wt.getAttribute("text:bullet-char"))),gt.length>0&&(Z=!0);break}}}if(!Z){for(let at=0;atpt.path===dt||pt.path.endsWith(dt));if(at){let pt=Xo(at.content),ft={type:"chart",text:pt.rawTexts.join(" "),metadata:{attachmentName:ot,chartData:pt}};t.includeRawContent&&(ft.rawContent=Qt(S,P,t)),k.push(ft)}else{let pt={type:"chart",text:"",metadata:{attachmentName:ot}};t.includeRawContent&&(pt.rawContent=Qt(S,P,t)),k.push(pt)}}}}else if(S.childNodes)for(let B=0;B0)for(let kt of Nt){let Yt=kt.getAttribute("text:style-name"),ti=Yt?g[Yt]:{},R=kt.textContent||"";rt+=R;let W={type:"text",text:R,formatting:ti};gt.push(W)}else{let kt=At.textContent||"";if(rt+=kt,kt.trim()){let Yt={type:"text",text:kt,formatting:{}};gt.push(Yt)}}Tt0){let Ct=ti[0].getAttribute("xlink:href");if(Ct){let bt=Ct.split("/");Yt=bt[bt.length-1]}}let R="",W=tt(Tt,"draw:object");if(W.length>0){let Ct=W[0].getAttribute("xlink:href");Ct&&(R=Ct.split("/")[0])}if(ti.length>0){let Ct={type:"image",text:"",children:[],metadata:{attachmentName:Yt,...At?{altText:At}:{}}};t.includeRawContent&&(Ct.rawContent=Qt(Tt,N,t)),gt.push(Ct)}else if(R){let Ct={type:"chart",text:"",children:[],metadata:{attachmentName:R}};gt.push(Ct)}}for(let Tt=0;Tt0||h!=="ods"){let At={type:"cell",text:rt,children:gt,metadata:{row:V,col:at}};t.includeRawContent&&(At.rawContent=Qt(lt,N,t)),ot.push(At)}at++}}if(ot.length>0)for(let ft=0;ft0&<.children?.forEach(ct=>{ct.metadata&&"row"in ct.metadata&&(ct.metadata.row=V)}),t.includeRawContent&&(lt.rawContent=Qt(nt,N,t)),$.push(lt),V++}else V+=pt}let Z={type:"sheet",children:$,metadata:{sheetName:B}};t.includeRawContent&&(Z.rawContent=Qt(P,N,t)),m.push(Z)}}}else if(h==="odp"){let S=ut(O,"office:presentation");if(S){let k=He(S,"draw:page"),M=[];for(let P=0;P0&&(t.putNotesAtLast?M.push(U):m.push(U))}M.length>0&&m.push(...M)}}else{let S=ut(O,"office:text");S&&E(S,m,!1,N)}})(d.content.toString());let L=[],Y=c.filter(N=>N.path.match(/(Pictures|media)\/.*/));if(t.extractAttachments){let N=c.filter(X=>X.path.match(/Object \d+\/content\.xml/));for(let X of N){let O=Zt(X.content.toString());if(tt(O,"chart:chart").length>0){let D=X.path.split("/")[0],E={type:"chart",mimeType:"application/vnd.oasis.opendocument.chart",data:X.content.toString("base64"),name:D,extension:"xml"},S=Xo(X.content);S.rawTexts.length>0&&(E.chartData=S),L.push(E)}}}if(t.extractAttachments)for(let N of Y){let X=gr(N.path.split("/").pop()||"image",N.content);if(L.push(X),t.ocr&&X.mimeType.startsWith("image/"))try{X.ocrText=(await Xn(N.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(O){rn(`OCR failed for ${X.name}:`,t,O)}}let q=c.find(N=>N.path.match(s)),G=q?La(q.content.toString()):{},j=(N,X)=>{let O=D=>{let E=D.replace(/^\[|\]$/g,""),[S,k]=E.split(":"),M=S.lastIndexOf(".");if(M===-1)return[D];let P=S.substring(0,M).replace(/^'|'$/g,""),B=S.substring(M+1).replace(/\$/g,""),$=B;if(k)if(k.startsWith("."))$=k.substring(1).replace(/\$/g,"");else{let ot=k.lastIndexOf(".");$=k.substring(ot+1).replace(/\$/g,"")}let U=ot=>{let dt=ot.match(/[A-Z]+/),at=ot.match(/\d+/);if(!dt||!at)return null;let pt=dt[0],ft=0;for(let ct=0;ctot.type==="sheet"&&ot.metadata?.sheetName===P);if(!Q||!Q.children)return[D];let nt=[];for(let ot of Q.children)if(ot.children)for(let dt of ot.children){let at=dt.metadata;at&&at.row>=V.r&&at.row<=Z.r&&at.col>=V.c&&at.col<=Z.c&&nt.push(dt.text||"")}return nt.length>0?nt:[]};for(let D of N.dataSets){let E=[];for(let S of D.values)S.startsWith("[")?E.push(...O(S)):E.push(S);D.values=E}let C=[];for(let D of N.labels)D.startsWith("[")?C.push(...O(D)):C.push(D);N.labels=C,N.rawTexts=[],N.title&&N.rawTexts.push(N.title);for(let D of N.dataSets)D.name&&N.rawTexts.push(D.name),N.rawTexts.push(...N.labels),N.rawTexts.push(...D.values)};for(let N of L)N.type==="chart"&&N.chartData&&j(N.chartData,m);(N=>{let X=new Set,O=S=>{for(let k of S){if(k.metadata&&"attachmentName"in k.metadata){let M=k.metadata.attachmentName;M&&X.add(M)}k.children&&O(k.children)}};O(N);let C=L.filter(S=>S.type==="image"&&S.name&&!X.has(S.name)),D=0,E=S=>{if((S.type==="image"||S.type==="chart")&&S.metadata&&"attachmentName"in S.metadata){let k=S.metadata.attachmentName;if(!k&&S.type==="image"&&DP.name===k);M&&(M.ocrText&&(S.text=M.ocrText),M.chartData&&S.type==="chart"&&(S.text=M.chartData.rawTexts.join(t.newlineDelimiter??` +`)))}}S.children&&S.children.forEach(E)};N.forEach(E)})(m);let et={};for(let N in g)et[N]={formatting:g[N],alignment:A[N]?.alignment};for(let N in A)et[N]||(et[N]={formatting:{},alignment:A[N]?.alignment});return t.putNotesAtLast&&y.length>0&&m.push(...y),{type:h,metadata:{...G,styleMap:et},content:m,attachments:L,toText:()=>m.map(N=>{let X=O=>{let C="";if(O.children&&O.children.length>0){let E=O.children.some(S=>S.children&&S.children.length>0)?t.newlineDelimiter??` +`:"";C+=O.children.map(X).filter(S=>S!="").join(E)}else C+=O.text||"";return C};return X(N)}).filter(N=>N!="").join(t.newlineDelimiter??` +`)}};H();H();async function Hw(r){return new Function("s","return import(s)")(r)}async function LS(){return Xc?Promise.resolve().then(()=>(Q1(),Z1)):Hw("file-type")}async function BS(){if(!Xc){xA();try{return await Hw("pdfjs-dist/legacy/build/pdf.mjs")}catch{return await Hw("pdfjs-dist")}}return Promise.resolve().then(()=>(RS(),OS))}function DM(r){return r&&typeof r.str=="string"&&Array.isArray(r.transform)&&r.transform.length>=6}function kM(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 IM(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 NM(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),y=Math.max(c,h);if(ed&&nm)return o}}function _M(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=st.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{let e=await BS();if(t.pdfWorkerSrc)e.GlobalWorkerOptions.workerSrc=t.pdfWorkerSrc;else if(Xc)e.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${e.version}/build/pdf.worker.min.mjs`;else{Zm("pdf-worker-auto-resolution");try{let g=Vm.resolve("pdfjs-dist/legacy/build/pdf.worker.mjs");e.GlobalWorkerOptions.workerSrc=g}catch(g){t.outputErrorToConsole&&console.warn("[PdfParser] Could not auto-resolve local worker path:",g)}}let i=new Uint8Array(r),n=e.getDocument({data:i,verbosity:0}),s;try{s=await n.promise}catch(g){let A=g instanceof Error?g.message:String(g);throw A.includes("workerSrc")||A.includes('No "GlobalWorkerOptions.workerSrc" specified')?Ms("PDF_WORKER_MISSING",t):g}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:Wr(d?.CreationDate),modified:Wr(d?.ModDate)},m=new Set(["Title","Author","Subject","Keywords","Creator","Producer","CreationDate","ModDate","Trapped","IsAcroFormPresent","IsXFAPresent","IsCollectionPresent","IsSignaturesPresent","PDFFormatVersion"]);if(d){let g={};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,T]of Object.entries(w))T!=null&&(typeof T=="string"||typeof T=="number"||typeof T=="boolean"||T instanceof Date)&&(g[v]=T);continue}(typeof w=="string"||typeof w=="number"||typeof w=="boolean"||w instanceof Date)&&(g[A]=w)}}Object.keys(g).length>0&&(f.customProperties=g)}try{let g=await s.getAttachments();if(g&&t.extractAttachments)for(let A in g){let w=g[A],v=st.Buffer.from(w.content),T=gr(w.filename,v);l.push(T)}}catch(g){t.outputErrorToConsole&&console.error("Error extracting embedded attachments:",g)}for(let g=1;g<=c;g++){let A,w,v=[];try{A=await s.getPage(g),w=await A.getTextContent()}catch(I){t.outputErrorToConsole&&console.warn(`[PdfParser] Error loading page ${g}:`,I),u.push(v);continue}let T=A.commonObjs;for(let I of w.items){if(!DM(I))continue;let _=I,F=_.transform,L=F[4],Y=F[5],q=_.width||0,G=_.height||Math.abs(F[3])||12,j={},J;if(_.fontName&&T)try{if(T.has(_.fontName)){let et=await new Promise(N=>{T.get(_.fontName,X=>N(X))});if(et?.name&&typeof et.name=="string"){J=et.name.replace(/^[A-Z]{6}\+/,""),j.font=J;let N=et.name.toLowerCase();N.includes("bold")&&(j.bold=!0),(N.includes("italic")||N.includes("oblique"))&&(j.italic=!0)}}}catch{}G>0&&(j.size=Math.round(G).toString()),v.push({type:"text",x:L,y:Y,width:q,height:G,text:_.str,fontName:J,formatting:j})}if(t.extractAttachments||t.ocr)try{let I=await A.getOperatorList(),_=I.fnArray,F=I.argsArray;for(let L=0;L<_.length;L++){let Y=_[L];if(Y===e.OPS.dependency){let q=F[L];for(let G of q)try{if(A.objs.has(G))continue;await new Promise(j=>{let J=setTimeout(()=>{j()},500);A.objs.get(G,et=>{clearTimeout(J),j()})})}catch(j){t.outputErrorToConsole&&console.error(`[PdfParser] Failed to load dependency ${G}:`,j)}}if(Y===e.OPS.paintImageXObject||Y===e.OPS.paintXObject){let q=F[L][0];try{let G=A.objs.has(q),j=A.objs;if(!G&&A.commonObjs.has(q)&&(G=!0,j=A.commonObjs),G){let J=await new Promise(et=>{j.get(q,N=>et(N))});if(typeof window<"u"&&!J.data&&J.bitmap)try{let et=document.createElement("canvas");et.width=J.width,et.height=J.height;let N=et.getContext("2d");N&&(N.drawImage(J.bitmap,0,0),J.data=N.getImageData(0,0,J.width,J.height).data,J.kind=3)}catch(et){t.outputErrorToConsole&&console.error("[PdfParser] Failed to extract from ImageBitmap:",et)}if(J?.data&&J.width>0&&J.height>0){let et=0,N=0;for(let X=L-1;X>=0;X--)if(_[X]===e.OPS.transform){et=F[X][4],N=F[X][5];break}v.push({type:"image",x:et,y:N,name:q,data:J.data,width:J.width,height:J.height,kind:J.kind})}}}catch{}}}}catch(I){t.outputErrorToConsole&&console.error(`Error extracting images from page ${g}:`,I)}u.push(v)}let y=kM(u);for(let g=0;gMath.abs(j.y-G.y)>7?j.y-G.y:G.x-j.x);let F=null,L=0,Y=-1,q=0;for(let G of v)if(G.type==="text"){let j=G.text;if(!j)continue;if(Y!==-1&&Math.abs(G.y-Y)>5&&F&&((F.text||"").trim().length>0&&T.push(F),F=null),!F&&j.trim().length===0){Y=G.y;continue}let et=IM(G.height,y);if(F||(et>0?F={type:"heading",text:"",children:[],metadata:{level:et}}:F={type:"paragraph",text:"",children:[]},L=G.height),j.trim().length===0){if(F.children&&F.children.length>0){let C=F.children[F.children.length-1];C.type==="text"&&C.text&&(C.text+=j,F.text+=j)}Y=G.y;continue}if(F.text&&F.text.length>0&&!F.text.endsWith(" ")&&(F.text+=" ",F.children&&F.children.length>0)){let C=F.children[F.children.length-1];C.type==="text"&&C.text&&(C.text+=" ")}F.text+=j;let N=NM(G,I);N&&_.add(N);let X;N&&(N.url?X={link:N.url,linkType:N.url.startsWith("#")?"internal":"external"}:N.dest&&(X={link:typeof N.dest=="string"?`#${N.dest}`:"#internal",linkType:"internal"}));let O=!1;if(F.children&&F.children.length>0&&!X){let C=F.children[F.children.length-1];C.type==="text"&&FM(C.formatting,G.formatting)&&!C.metadata&&(C.text=(C.text||"")+j,O=!0)}if(!O){let C={type:"text",text:j,formatting:Object.keys(G.formatting).length>0?G.formatting:void 0};X&&(C.metadata=X),F.children?.push(C)}Y=G.y}else if(G.type==="image"){F&&((F.text||"").trim().length>0&&T.push(F),F=null),q++;let j=`pdf_image_p${A}_${q}.bmp`;if(t.extractAttachments)try{let J=MM(G.data,G.width,G.height,G.kind),et=_M(G.width,G.height,new Uint8Array(J)),N=gr(j,et);if(N.mimeType="image/bmp",t.ocr)try{G.width>=10&&G.height>=10&&(N.ocrText=(await Xn(et,{language:t.ocrLanguage,...t.ocrConfig})).trim())}catch(O){t.outputErrorToConsole&&console.error(`OCR failed for ${j}:`,O)}l.push(N);let X={attachmentName:j};T.push({type:"image",text:N.ocrText||"",metadata:{...X}})}catch(J){rn(`Failed to process image ${j}:`,t,J)}}F&&(F.text||"").trim().length>0&&T.push(F),o.push({type:"page",children:T,text:T.map(G=>G.text).join(t.newlineDelimiter??` `),metadata:{pageNumber:A}})}return{type:"pdf",metadata:f,content:o,attachments:l,toText:()=>o.map(g=>g.text).join(t.newlineDelimiter??` -`)}};function FM(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{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 Ua(r,O=>!!O.match(t.ignoreNotes?i:e)||!!O.match(c)||!!O.match(u)||!!O.match(n)||!!t.extractAttachments&&(!!O.match(o)||!!O.match(l))),d=h.find(O=>O.path.match(c)),f=d?La(d.content.toString()):{},m=h.find(O=>O.path.match(u));if(m){let O=hu(m.content.toString());Object.keys(O).length>0&&(f.customProperties=O)}h.sort((O,C)=>{let D=O.path.match(s),E=C.path.match(s),S=D?parseInt(D[1]):0,I=E?parseInt(E[1]):0;return S-I});let y=[],g=[],A={},w=0,v=0,T=!1,k=null,N=0,F={},L=(O,C)=>{let D=[],E=J(O,"a:tr");for(let S=0;S{let E=ut(O,"a:blip");if(!E)return null;let S=E.getAttribute("r:embed");if(!S)return null;let I=A[C]?.[S];if(!I||I.type!=="image")return null;let M=I.target,P=ut(O,"p:nvPicPr"),$=(P?ut(P,"p:cNvPr"):null)?.getAttribute("descr")||void 0;return{type:"image",text:"",metadata:{attachmentName:M,altText:$}}},q=(O,C,D)=>{let E=ut(O,"a:graphicData");if(!E||!(E.getAttribute("uri")==="http://schemas.openxmlformats.org/drawingml/2006/chart"))return null;let M=ut(E,"c:chart");if(!M)return null;let P=M.getAttribute("r:id");if(!P)return null;let B=A[C]?.[P];if(!B||B.type!=="chart")return null;let U={type:"chart",text:"",metadata:{attachmentName:B.target}};return t.includeRawContent&&(U.rawContent=Qt(O,D,t)),U},G=(O,C,D)=>{let E=ut(O,"a:tbl");if(E){let S=L(E,D);if(t.includeRawContent&&(S.rawContent=Qt(O,D,t)),S.children&&S.children.length>0)return S}if(O.getElementsByTagName("c:chart").length>0){let S=q(O,C,D);if(S)return S}return null},j=(O,C,D)=>{let E=[],S=ut(O,"p:nvSpPr"),I=S?ut(S,"p:nvPr"):null,M=I?ut(I,"p:ph"):null,P=M?M.getAttribute("type"):"body",B=P==="title"||P==="ctrTitle",$=ut(O,"p:txBody");if($){let U=J($,"a:p");for(let V=0;VN)v=0,F[ft]=0;else if(ftft&&delete F[gt]}v=(F[ft]||0)+1,F[ft]=v}else v=(F[ft]||0)+1,F[ft]=v;T=!0,k=dt,N=ft,Q.metadata={...Q.metadata,listType:dt,indentation:ft,listId:w.toString(),itemIndex:v,alignment:Q.metadata?.alignment||"left"}}else T=!1,k=null,N=0;B&&(Q.metadata={...Q.metadata,level:1}),t.includeRawContent&&(Q.rawContent=Qt(Z,D,t));let pt=J(Z,"a:r");for(let ft=0;ft0&&(bt.superscript=!0)}}let xe={type:"text",text:rt,formatting:bt},Yt=ut(lt,"a:hlinkClick");if(Yt){let At=Yt.getAttribute("r:id"),Bt=Yt.getAttribute("action"),Dt,Gt;At&&A[C]&&A[C][At]&&A[C][At].type==="hyperlink"?(Dt=A[C][At].target,Gt="external"):At&&A[C]&&A[C][At]&&A[C][At].type==="slide"?(Dt=A[C][At].target,Gt="internal"):Bt&&(Dt=Bt,Gt="internal"),Dt&&(xe.metadata={link:Dt,linkType:Gt})}Q.children?.push(xe)}}Q.text&&E.push(Q)}}return E};function tt(O,C,D){let E=[];for(let S of Array.from(O?.childNodes||[])){if(!ci(S))continue;let I=S,M=I.tagName;if(M==="p:sp")E.push(...j(I,C,D));else if(M==="p:pic"){let P=Y(I,C,D);P&&E.push(P)}else if(M==="p:graphicFrame"){let P=G(I,C,D);P&&E.push(P)}else if(M==="p:grpSp"){let P=ut(I,"p:spTree");P&&E.push(...tt(P,C,D))}}return E}for(let O of h)if(O.path.match(n)){let C=O.path.match(/slide(\d+)\.xml\.rels/);if(C){let D=parseInt(C[1]);A[D]={};let E=Zt(O.content.toString()),S=J(E,"Relationship");for(let I=0;I0&&y.push(M)}let et=[],_=h.filter(O=>O.path.match(/ppt\/media\/.*/)),X=h.filter(O=>O.path.match(/ppt\/charts\/chart\d+\.xml/));if(t.extractAttachments){for(let C of _){let D=gr(C.path.split("/").pop()||"image",C.content);if(et.push(D),t.ocr&&D.mimeType.startsWith("image/"))try{D.ocrText=(await Xn(C.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(E){rn(`OCR failed for ${D.name}:`,t,E)}}for(let C of X){let D={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:C.content.toString("base64"),name:C.path.split("/").pop()||"",extension:"xml"};et.push(D);try{let E=await Xo(C.content);D.chartData=E}catch(E){rn(`Failed to extract text from chart ${C.path}:`,t,E)}}let O=C=>{for(let D of C){if("attachmentName"in(D.metadata||{})){let E=D.metadata,S=et.find(I=>I.name===E.attachmentName);S&&(D.type==="image"&&(S.altText=E.altText,S.ocrText&&(D.text=S.ocrText)),D.type==="chart"&&(D.text=S.chartData?.rawTexts.join(t.newlineDelimiter||` +`)}};function FM(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{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 Ua(r,O=>!!O.match(t.ignoreNotes?i:e)||!!O.match(c)||!!O.match(u)||!!O.match(n)||!!t.extractAttachments&&(!!O.match(o)||!!O.match(l))),d=h.find(O=>O.path.match(c)),f=d?La(d.content.toString()):{},m=h.find(O=>O.path.match(u));if(m){let O=hu(m.content.toString());Object.keys(O).length>0&&(f.customProperties=O)}h.sort((O,C)=>{let D=O.path.match(s),E=C.path.match(s),S=D?parseInt(D[1]):0,k=E?parseInt(E[1]):0;return S-k});let y=[],g=[],A={},w=0,v=0,T=!1,I=null,_=0,F={},L=(O,C)=>{let D=[],E=tt(O,"a:tr");for(let S=0;S{let E=ut(O,"a:blip");if(!E)return null;let S=E.getAttribute("r:embed");if(!S)return null;let k=A[C]?.[S];if(!k||k.type!=="image")return null;let M=k.target,P=ut(O,"p:nvPicPr"),$=(P?ut(P,"p:cNvPr"):null)?.getAttribute("descr")||void 0;return{type:"image",text:"",metadata:{attachmentName:M,altText:$}}},q=(O,C,D)=>{let E=ut(O,"a:graphicData");if(!E||!(E.getAttribute("uri")==="http://schemas.openxmlformats.org/drawingml/2006/chart"))return null;let M=ut(E,"c:chart");if(!M)return null;let P=M.getAttribute("r:id");if(!P)return null;let B=A[C]?.[P];if(!B||B.type!=="chart")return null;let U={type:"chart",text:"",metadata:{attachmentName:B.target}};return t.includeRawContent&&(U.rawContent=Qt(O,D,t)),U},G=(O,C,D)=>{let E=ut(O,"a:tbl");if(E){let S=L(E,D);if(t.includeRawContent&&(S.rawContent=Qt(O,D,t)),S.children&&S.children.length>0)return S}if(O.getElementsByTagName("c:chart").length>0){let S=q(O,C,D);if(S)return S}return null},j=(O,C,D)=>{let E=[],S=ut(O,"p:nvSpPr"),k=S?ut(S,"p:nvPr"):null,M=k?ut(k,"p:ph"):null,P=M?M.getAttribute("type"):"body",B=P==="title"||P==="ctrTitle",$=ut(O,"p:txBody");if($){let U=tt($,"a:p");for(let V=0;V_)v=0,F[ft]=0;else if(ft<_){for(let rt in F){let gt=parseInt(rt);gt>ft&&delete F[gt]}v=(F[ft]||0)+1,F[ft]=v}else v=(F[ft]||0)+1,F[ft]=v;T=!0,I=dt,_=ft,Q.metadata={...Q.metadata,listType:dt,indentation:ft,listId:w.toString(),itemIndex:v,alignment:Q.metadata?.alignment||"left"}}else T=!1,I=null,_=0;B&&(Q.metadata={...Q.metadata,level:1}),t.includeRawContent&&(Q.rawContent=Qt(Z,D,t));let pt=tt(Z,"a:r");for(let ft=0;ft0&&(wt.superscript=!0)}}let xe={type:"text",text:rt,formatting:wt},Tt=ut(lt,"a:hlinkClick");if(Tt){let At=Tt.getAttribute("r:id"),Nt=Tt.getAttribute("action"),kt,Yt;At&&A[C]&&A[C][At]&&A[C][At].type==="hyperlink"?(kt=A[C][At].target,Yt="external"):At&&A[C]&&A[C][At]&&A[C][At].type==="slide"?(kt=A[C][At].target,Yt="internal"):Nt&&(kt=Nt,Yt="internal"),kt&&(xe.metadata={link:kt,linkType:Yt})}Q.children?.push(xe)}}Q.text&&E.push(Q)}}return E};function J(O,C,D){let E=[];for(let S of Array.from(O?.childNodes||[])){if(!ni(S))continue;let k=S,M=k.tagName;if(M==="p:sp")E.push(...j(k,C,D));else if(M==="p:pic"){let P=Y(k,C,D);P&&E.push(P)}else if(M==="p:graphicFrame"){let P=G(k,C,D);P&&E.push(P)}else if(M==="p:grpSp"){let P=ut(k,"p:spTree");P&&E.push(...J(P,C,D))}}return E}for(let O of h)if(O.path.match(n)){let C=O.path.match(/slide(\d+)\.xml\.rels/);if(C){let D=parseInt(C[1]);A[D]={};let E=Zt(O.content.toString()),S=tt(E,"Relationship");for(let k=0;k0&&y.push(M)}let et=[],N=h.filter(O=>O.path.match(/ppt\/media\/.*/)),X=h.filter(O=>O.path.match(/ppt\/charts\/chart\d+\.xml/));if(t.extractAttachments){for(let C of N){let D=gr(C.path.split("/").pop()||"image",C.content);if(et.push(D),t.ocr&&D.mimeType.startsWith("image/"))try{D.ocrText=(await Xn(C.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(E){rn(`OCR failed for ${D.name}:`,t,E)}}for(let C of X){let D={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:C.content.toString("base64"),name:C.path.split("/").pop()||"",extension:"xml"};et.push(D);try{let E=await Xo(C.content);D.chartData=E}catch(E){rn(`Failed to extract text from chart ${C.path}:`,t,E)}}let O=C=>{for(let D of C){if("attachmentName"in(D.metadata||{})){let E=D.metadata,S=et.find(k=>k.name===E.attachmentName);S&&(D.type==="image"&&(S.altText=E.altText,S.ocrText&&(D.text=S.ocrText)),D.type==="chart"&&(D.text=S.chartData?.rawTexts.join(t.newlineDelimiter||` `)))}D.children&&O(D.children)}};O(y)}return!t.ignoreNotes&&t.putNotesAtLast&&y.sort((O,C)=>{let D=O.type==="note"?1:0,E=C.type==="note"?1:0;return D-E}),{type:"pptx",metadata:f,content:y,attachments:et,toText:()=>y.map(O=>{let C=D=>{let E="";return D.children?E+=D.children.map(C).filter(S=>S!="").join(D.children[0]?.children?t.newlineDelimiter??` `:""):E+=D.text||"",E};return C(O)}).filter(O=>O!="").join(t.newlineDelimiter??` -`)}};H();var PM={pngblip:"png",jpegblip:"jpeg",gifblip:"gif",tiffblip:"tiff",dibitmap:"bmp",wbitmap:"bmp"},OM={png:"image/png",jpeg:"image/jpeg",gif:"image/gif",tiff:"image/tiff",bmp:"image/bmp"},Gw=class{constructor(t){z(this,"index",0);z(this,"buffer");z(this,"length");this.buffer=t,this.length=t.length}parse(){let t={type:"group",content:[]},e=[t];for(;this.index1&&e.pop()):i===92?(this.index++,this.parseControl(n)):i===13||i===10?this.index++:this.parseText(n)}return t}parseControl(t){if(this.index>=this.length)return;let e=this.buffer[this.index];if(e===123||e===125||e===92){t.content.push({type:"text",value:String.fromCharCode(e)}),this.index++;return}if(e===39){if(this.index++,this.index+1=97&&l<=122||l>=65&&l<=90)i+=String.fromCharCode(l),this.index++;else break}let n,s=!1,o="";for(this.index=48&&l<=57)o+=String.fromCharCode(l),this.index++,s=!0;else break}if(s&&(n=parseInt(o,10)),this.index0){this.index+=n;return}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){let e="";for(;this.index0&&t.content.push({type:"text",value:e})}},jS=async(r,t)=>{try{let i=new Gw(r).parse(),n=RM(i),s=LM(i),o=[],l=[],c=[],u="",h=[],d="",f="",m={},y=o,g=0,A="left",w=!1,v,T,k,N,F,L=[],Y=0,q=0,G=()=>L.length>0?L[L.length-1]:void 0,j=()=>{L.length===0&&L.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})},tt=!1,et=!1,_=0,X=[],O={isMergedContinuation:!1},C=0,D=0,E={},S=!1,I=!1,M,P,B={},$=!1,U,V,Z={},Q={},nt,at=(R,W)=>R.bold!==W.bold||R.italic!==W.italic||R.underline!==W.underline||R.strikethrough!==W.strikethrough||R.size!==W.size||R.font!==W.font||R.color!==W.color||R.backgroundColor!==W.backgroundColor||R.subscript!==W.subscript||R.superscript!==W.superscript,dt=()=>{if(f){let R={type:"text",text:f,formatting:{...m}};nt&&(R.metadata={link:nt,linkType:gt(nt)}),h.push(R),u+=f,f=""}},ot=!1,pt=()=>{dt();let R=u||h.length>0;if(tt&&!et&&!ot&&R){let W=u,Ct=[...h],vt=d;u="",h=[],d="",ct(),u=W,h=Ct,d=vt}if(R){let W="paragraph",Ct;if(T!==void 0&&T>0)W="heading",Ct={level:T},N=void 0,F=void 0;else if(w){W="list";let Et=k||N,re=v||F||"unordered",ti=0;Et&&(Q[Et]||(Q[Et]={}),Q[Et][g]===void 0?Q[Et][g]=0:Q[Et][g]++,ti=Q[Et][g]),Ct={listType:re,indentation:g,listId:Et||"",itemIndex:ti,alignment:A},Et&&(N=Et),re&&(F=re)}let vt={type:W,text:u,children:h,formatting:void 0,metadata:Ct};t.includeRawContent&&d&&(vt.rawContent=d),tt&&et?(j(),G().currentCellContent.push(vt)):y.push(vt),u="",h=[],d="",g=0,w=!1,v=void 0,T=void 0,k=void 0}},ft=R=>{pt();let W=R||G();if(!W)return;let Ct={type:"cell",text:W.currentCellContent.map(vt=>vt.text).join(` -`),children:[...W.currentCellContent],metadata:{row:W.rowIndex,col:W.currentCells.length}};return W.currentCellContent=[],Ct},lt=R=>{let W=R||G();if(!W)return;let Ct=ft(W);if(Ct&&(Ct.children&&Ct.children.length>0||Ct.text)&&W.currentCells.push(Ct),W.currentCells.length>0){let vt={type:"row",text:W.currentCells.map(Et=>Et.text).filter(Et=>Et!=="").join(t.newlineDelimiter??` -`),children:[...W.currentCells]};W.rows.push(vt),W.currentCells=[],W.rowIndex++}},ct=()=>{if(ot)return;ot=!0;let R=G();if(!R){ot=!1;return}if(lt(R),R.rows.length>0){_++;let W={type:"table",text:R.rows.map(Ct=>Ct.text).join(` -`),children:[...R.rows]};L.length>1?L[L.length-2].currentCellContent.push(W):y.push(W)}L.pop(),L.length===0&&(tt=!1,et=!1),ot=!1},rt=R=>{let W,Ct=vt=>{if(vt.type==="text"){let Et=vt.value,re=Et.match(/HYPERLINK\s+"([^"]+)"/i);if(re)return re[1];let ti=Et.match(/"(https?:\/\/[^"]+|mailto:[^"]+|#[^"]+)"/);if(ti)return ti[1]}else if(vt.type==="group"){let Et=!1,re;for(let ti of vt.content)if(ti.type==="text"){ti.value.toUpperCase().includes("HYPERLINK")&&(Et=!0);let $m=ti.value.match(/"([^"]+)"/);$m&&Et&&(re=$m[1])}else if(ti.type==="group"){let zc=Ct(ti);zc&&(re=zc)}if(re)return re}};for(let vt of R.content)if(vt.type==="group"){let Et=Ct(vt);if(Et)return Et}return W},gt=R=>{let W=R.trim();return W.startsWith("#")||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(W)?"internal":"external"},bt=R=>{let W="",Ct=vt=>{if(vt.type==="text")W+=vt.value;else if(vt.type==="group")for(let Et of vt.content)Ct(Et)};for(let vt of R.content)Ct(vt);return W},xe=R=>{let W,Ct="";for(let Et of R.content)if(Et.type==="control"){let re=PM[Et.value];re&&(W=re)}else Et.type==="text"?Ct+=Et.value.replace(/[^0-9a-fA-F]/g,""):Et.type;if(!W||Ct.length===0)return;let vt=OM[W];if(vt)try{let Et=st.Buffer.from(Ct,"hex"),re=W,ti=`image_${c.length+1}.${re}`;return{type:"image",mimeType:vt,data:Et.toString("base64"),name:ti,extension:re}}catch{return}},Yt=R=>{if(!/^[a-zA-Z]/.test(R.value))return`\\${R.value}`;let W=`\\${R.value}`;return R.param!==void 0&&(W+=R.param),W+=" ",W},At=R=>R.value.replace(/([\\{}])/g,"\\$1"),Bt=(R,W,Ct=0)=>{if(R.type==="group"){let vt=["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"],Et=!1,re=!1,ti=!1,zc=!1;if(R.destination){if(R.destination==="footnote")re=!0;else if(R.destination==="field"){let Ue=rt(R);Ue&&(dt(),ti=!0,nt=Ue)}else if(R.destination==="listtable")S=!0;else if(S&&R.destination==="list")I=!0,M=void 0,P=void 0;else if(R.destination==="listoverridetable")$=!0;else if($&&R.destination==="listoverride")U=void 0,V=void 0;else if(R.destination==="pict")t.extractAttachments?zc=!0:Et=!0;else if(vt.includes(R.destination))Et=!0;else if(R.content.length>0&&R.content[0].type==="control"&&R.content[0].value==="*"){let Ue=["fldinst","nesttableprops"];t.extractAttachments&&Ue.push("shppict","listpicture"),Ue.includes(R.destination||"")||(Et=!0)}}if(R.destination==="listtext"||R.destination==="pntext"){w||(g=0),w=!0;let Ue=bt(R);if(Ue){let wi=Ue.trim();["\xB7","\u2022","o","\xA7","\u25A0","\u25A1","\u25CF","\u25CB","\u25C6","\u25C7","\u25BA","\u25B8","\xB7","\u2022","\u25CF","\u25CB"].some(Ma=>wi.includes(Ma))||wi.length===1&&!/[0-9a-zA-Z]/.test(wi)?v="unordered":(/^[0-9ivxlcdm]+[\.\)]/i.test(wi)||/^[a-z][\.\)]/i.test(wi))&&(v="ordered")}Et=!0}if(Et)return;if(d+="{",zc){let Ue=xe(R);Ue&&(c.push(Ue),!S&&!I&&(pt(),y.push({type:"image",text:"",metadata:{attachmentName:Ue.name||`image_${c.length}`}})));for(let wi of R.content)if(wi.type==="control")d+=Yt(wi);else if(wi.type==="text")d+=At(wi);else if(wi.type==="group"){let jc=Gn=>{for(let Ma of Gn.content)Ma.type==="control"?d+=Yt(Ma):Ma.type==="text"?d+=At(Ma):Ma.type==="group"&&(d+="{",jc(Ma),d+="}")};jc(R)}d+="}";return}let $m=y;if(re){if(t.ignoreNotes)return;pt(),Y++;let Ue="footnote";q===1?Ue="endnote":q===2&&(Ue=R.content.some(Gn=>Gn.type==="control"&&Gn.value==="ftnalt")?"endnote":"footnote");let wi={type:"note",children:[],metadata:{noteId:Y.toString(),noteType:Ue}};l.push(wi),y=wi.children}let JS={...W};for(let Ue of R.content){if(Ue.type==="group"&&Ue.destination==="fldinst"){d+="{";let wi=jc=>{for(let Gn of jc.content)Gn.type==="control"?d+=Yt(Gn):Gn.type==="text"?d+=At(Gn):Gn.type==="group"&&(d+="{",wi(Gn),d+="}")};wi(Ue),d+="}";continue}Bt(Ue,JS,Ct+1)}R.destination==="listtable"?S=!1:R.destination==="list"?(I=!1,M!==void 0&&P!==void 0&&(B[M]=P)):R.destination==="listoverridetable"?$=!1:$&&R.destination==="listoverride"&&V!==void 0&&U!==void 0&&(Z[V]=U),re&&(pt(),y=$m),ti&&(dt(),nt=void 0),d+="}"}else if(R.type==="text"){if(S||$){d+=At(R);return}at(m,W)&&(dt(),m={...W}),f+=R.value,d+=At(R)}else if(R.type==="control"){if(d+=Yt(R),S){if(R.value==="listid")M=R.param;else if(R.value==="levelnfc"||R.value==="levelnfcn"){let vt=R.param!==void 0&&(R.param===0||R.param>=0&&R.param<=4);(!P||P==="unordered"&&vt)&&(P=vt?"ordered":"unordered")}return}if($){R.value==="listid"?U=R.param:R.value==="ls"&&(V=R.param);return}if(R.value==="par")pt(),m={...W};else if(R.value==="trowd"){let vt=G();tt&&vt&&vt.currentCellContent.length>0?(j(),L.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})):tt||(tt=!0,j()),et=!0,X=[],O={isMergedContinuation:!1},C=0}else if(R.value==="clvmrg")O.isMergedContinuation=!0;else if(R.value==="clmgf")O.isMergedContinuation=!1;else if(R.value==="cellx")X.push({...O}),O={isMergedContinuation:!1};else if(R.value==="cell"){et=!0;let vt=!1;C1){let Et=G();Et&&(Et.rows.length>0||Et.currentCells.length>0)&&ct()}et=!0;let vt=ft();if(vt){let Et=G();Et&&Et.currentCells.push(vt)}m={...W}}else if(R.value==="row")lt(),m={...W},C=0,et=!1;else if(R.value==="nestrow")L.length>1&&ct(),lt(),m={...W},C=0;else if(R.value==="intbl")tt=!0,et=!0,j();else if(R.value==="pard")et=!1,g=0,A="left",w=!1,v=void 0,T=void 0,k=void 0,W.backgroundColor=void 0;else if(R.value==="tab")at(m,W)&&(dt(),m={...W}),f+=" ";else if(R.value==="line")at(m,W)&&(dt(),m={...W}),f+=` -`;else if(R.value==="lquote")at(m,W)&&(dt(),m={...W}),f+="\u2018";else if(R.value==="rquote")at(m,W)&&(dt(),m={...W}),f+="\u2019";else if(R.value==="ldblquote")at(m,W)&&(dt(),m={...W}),f+="\u201C";else if(R.value==="rdblquote")at(m,W)&&(dt(),m={...W}),f+="\u201D";else if(R.value==="u"){if(R.param!==void 0){let vt=R.param;vt<0&&(vt+=65536),at(m,W)&&(dt(),m={...W}),f+=String.fromCharCode(vt)}}else if(R.value==="b")W.bold=R.param!==0;else if(R.value==="i")W.italic=R.param!==0;else if(R.value==="ul")W.underline=R.param!==0;else if(R.value==="ulnone")W.underline=!1;else if(R.value==="strike")W.strikethrough=R.param!==0;else if(R.value==="plain")W.bold=!1,W.italic=!1,W.underline=!1,W.strikethrough=!1,W.subscript=!1,W.superscript=!1,W.size=void 0,W.font=void 0,W.color=void 0,W.backgroundColor=void 0;else if(R.value==="fs")R.param!==void 0&&(W.size=(R.param/2).toString()+"pt");else if(R.value==="f")R.param!==void 0&&n[R.param]&&(W.font=n[R.param]);else if(R.value==="cf")R.param!==void 0&&s[R.param]&&(W.color=s[R.param]);else if(R.value==="fet")R.param!==void 0&&(q=R.param);else if(R.value==="cb"||R.value==="highlight"||R.value==="chcbpat"||R.value==="cbpat")R.param!==void 0&&s[R.param]&&(W.backgroundColor=s[R.param]);else if(R.value==="sub")W.subscript=!0,W.superscript=!1;else if(R.value==="super")W.superscript=!0,W.subscript=!1;else if(R.value==="nosupersub")W.subscript=!1,W.superscript=!1;else if(R.value==="li")R.param!==void 0&&(g=Math.floor(R.param/360));else if(R.value==="ls"){if(R.param!==void 0){w||(g=0),w=!0,E[R.param]||(D++,E[R.param]=`rtf-list-${D}`),k=E[R.param];let vt=Z[R.param]!==void 0?Z[R.param]:R.param;B[vt]&&(v=B[vt])}}else R.value==="ilvl"?R.param!==void 0&&(w=!0,g=R.param):R.value==="pnlvl"?(w=!0,R.param!==void 0&&(g=R.param)):R.value==="levelnfc"||R.value==="pnf"?R.param!==void 0&&(w=!0,R.param===23?v="unordered":v="ordered"):R.value==="pndec"||R.value==="pnord"||R.value==="pnlcltr"||R.value==="pnucltr"?(w||(g=0),w=!0,v="ordered"):R.value==="pnbullet"||R.value==="pncard"?(w||(g=0),w=!0,v="unordered"):R.value==="s"?R.param!==void 0&&R.param>=1&&R.param<=9&&(T=R.param):R.value==="ql"?A="left":R.value==="qc"?A="center":R.value==="qr"?A="right":R.value==="qj"&&(A="justify")}};Bt(i,{});let Dt=G();if((tt||Dt&&(Dt.rows.length>0||Dt.currentCells.length>0))&&ct(),pt(),!t.putNotesAtLast&&l.length>0&&(o.push(...l),l.length=0),t.ocr&&t.extractAttachments){for(let W of c)if(W.mimeType.startsWith("image/"))try{let Ct=st.Buffer.from(W.data,"base64");W.ocrText=(await Xn(Ct,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(Ct){rn(`OCR failed for ${W.name}:`,t,Ct)}let R=W=>{for(let Ct of W){if(Ct.type==="image"&&Ct.metadata&&"attachmentName"in Ct.metadata){let vt=Ct.metadata,Et=c.find(re=>re.name===vt.attachmentName);Et&&(Et.ocrText&&(Ct.text=Et.ocrText),Et.altText&&(vt.altText=Et.altText))}Ct.children&&R(Ct.children)}};R(o)}let Gt=R=>{for(let W of R){if(W.type==="note"&&W.children){let Ct=vt=>vt.children&&vt.children.length>0?vt.children.map(Ct).join(""):vt.text||"";W.text=W.children.map(Ct).join("").trim()}W.children&&Gt(W.children)}};Gt(o),Gt(l);let bi={type:"rtf",metadata:{},content:o,attachments:c,toText:()=>{let R=o.map(W=>W.text).join(t.newlineDelimiter??` +`)}};H();var PM={pngblip:"png",jpegblip:"jpeg",gifblip:"gif",tiffblip:"tiff",dibitmap:"bmp",wbitmap:"bmp"},OM={png:"image/png",jpeg:"image/jpeg",gif:"image/gif",tiff:"image/tiff",bmp:"image/bmp"},Gw=class{constructor(t){z(this,"index",0);z(this,"buffer");z(this,"length");this.buffer=t,this.length=t.length}parse(){let t={type:"group",content:[]},e=[t];for(;this.index1&&e.pop()):i===92?(this.index++,this.parseControl(n)):i===13||i===10?this.index++:this.parseText(n)}return t}parseControl(t){if(this.index>=this.length)return;let e=this.buffer[this.index];if(e===123||e===125||e===92){t.content.push({type:"text",value:String.fromCharCode(e)}),this.index++;return}if(e===39){if(this.index++,this.index+1=97&&l<=122||l>=65&&l<=90)i+=String.fromCharCode(l),this.index++;else break}let n,s=!1,o="";for(this.index=48&&l<=57)o+=String.fromCharCode(l),this.index++,s=!0;else break}if(s&&(n=parseInt(o,10)),this.index0){this.index+=n;return}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){let e="";for(;this.index0&&t.content.push({type:"text",value:e})}},jS=async(r,t)=>{try{let i=new Gw(r).parse(),n=RM(i),s=LM(i),o=[],l=[],c=[],u="",h=[],d="",f="",m={},y=o,g=0,A="left",w=!1,v,T,I,_,F,L=[],Y=0,q=0,G=()=>L.length>0?L[L.length-1]:void 0,j=()=>{L.length===0&&L.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})},J=!1,et=!1,N=0,X=[],O={isMergedContinuation:!1},C=0,D=0,E={},S=!1,k=!1,M,P,B={},$=!1,U,V,Z={},Q={},nt,ot=(R,W)=>R.bold!==W.bold||R.italic!==W.italic||R.underline!==W.underline||R.strikethrough!==W.strikethrough||R.size!==W.size||R.font!==W.font||R.color!==W.color||R.backgroundColor!==W.backgroundColor||R.subscript!==W.subscript||R.superscript!==W.superscript,dt=()=>{if(f){let R={type:"text",text:f,formatting:{...m}};nt&&(R.metadata={link:nt,linkType:gt(nt)}),h.push(R),u+=f,f=""}},at=!1,pt=()=>{dt();let R=u||h.length>0;if(J&&!et&&!at&&R){let W=u,Ct=[...h],bt=d;u="",h=[],d="",ct(),u=W,h=Ct,d=bt}if(R){let W="paragraph",Ct;if(T!==void 0&&T>0)W="heading",Ct={level:T},_=void 0,F=void 0;else if(w){W="list";let Et=I||_,re=v||F||"unordered",_i=0;Et&&(Q[Et]||(Q[Et]={}),Q[Et][g]===void 0?Q[Et][g]=0:Q[Et][g]++,_i=Q[Et][g]),Ct={listType:re,indentation:g,listId:Et||"",itemIndex:_i,alignment:A},Et&&(_=Et),re&&(F=re)}let bt={type:W,text:u,children:h,formatting:void 0,metadata:Ct};t.includeRawContent&&d&&(bt.rawContent=d),J&&et?(j(),G().currentCellContent.push(bt)):y.push(bt),u="",h=[],d="",g=0,w=!1,v=void 0,T=void 0,I=void 0}},ft=R=>{pt();let W=R||G();if(!W)return;let Ct={type:"cell",text:W.currentCellContent.map(bt=>bt.text).join(` +`),children:[...W.currentCellContent],metadata:{row:W.rowIndex,col:W.currentCells.length}};return W.currentCellContent=[],Ct},lt=R=>{let W=R||G();if(!W)return;let Ct=ft(W);if(Ct&&(Ct.children&&Ct.children.length>0||Ct.text)&&W.currentCells.push(Ct),W.currentCells.length>0){let bt={type:"row",text:W.currentCells.map(Et=>Et.text).filter(Et=>Et!=="").join(t.newlineDelimiter??` +`),children:[...W.currentCells]};W.rows.push(bt),W.currentCells=[],W.rowIndex++}},ct=()=>{if(at)return;at=!0;let R=G();if(!R){at=!1;return}if(lt(R),R.rows.length>0){N++;let W={type:"table",text:R.rows.map(Ct=>Ct.text).join(` +`),children:[...R.rows]};L.length>1?L[L.length-2].currentCellContent.push(W):y.push(W)}L.pop(),L.length===0&&(J=!1,et=!1),at=!1},rt=R=>{let W,Ct=bt=>{if(bt.type==="text"){let Et=bt.value,re=Et.match(/HYPERLINK\s+"([^"]+)"/i);if(re)return re[1];let _i=Et.match(/"(https?:\/\/[^"]+|mailto:[^"]+|#[^"]+)"/);if(_i)return _i[1]}else if(bt.type==="group"){let Et=!1,re;for(let _i of bt.content)if(_i.type==="text"){_i.value.toUpperCase().includes("HYPERLINK")&&(Et=!0);let $m=_i.value.match(/"([^"]+)"/);$m&&Et&&(re=$m[1])}else if(_i.type==="group"){let zc=Ct(_i);zc&&(re=zc)}if(re)return re}};for(let bt of R.content)if(bt.type==="group"){let Et=Ct(bt);if(Et)return Et}return W},gt=R=>{let W=R.trim();return W.startsWith("#")||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(W)?"internal":"external"},wt=R=>{let W="",Ct=bt=>{if(bt.type==="text")W+=bt.value;else if(bt.type==="group")for(let Et of bt.content)Ct(Et)};for(let bt of R.content)Ct(bt);return W},xe=R=>{let W,Ct="";for(let Et of R.content)if(Et.type==="control"){let re=PM[Et.value];re&&(W=re)}else Et.type==="text"?Ct+=Et.value.replace(/[^0-9a-fA-F]/g,""):Et.type;if(!W||Ct.length===0)return;let bt=OM[W];if(bt)try{let Et=st.Buffer.from(Ct,"hex"),re=W,_i=`image_${c.length+1}.${re}`;return{type:"image",mimeType:bt,data:Et.toString("base64"),name:_i,extension:re}}catch{return}},Tt=R=>{if(!/^[a-zA-Z]/.test(R.value))return`\\${R.value}`;let W=`\\${R.value}`;return R.param!==void 0&&(W+=R.param),W+=" ",W},At=R=>R.value.replace(/([\\{}])/g,"\\$1"),Nt=(R,W,Ct=0)=>{if(R.type==="group"){let bt=["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"],Et=!1,re=!1,_i=!1,zc=!1;if(R.destination){if(R.destination==="footnote")re=!0;else if(R.destination==="field"){let Ue=rt(R);Ue&&(dt(),_i=!0,nt=Ue)}else if(R.destination==="listtable")S=!0;else if(S&&R.destination==="list")k=!0,M=void 0,P=void 0;else if(R.destination==="listoverridetable")$=!0;else if($&&R.destination==="listoverride")U=void 0,V=void 0;else if(R.destination==="pict")t.extractAttachments?zc=!0:Et=!0;else if(bt.includes(R.destination))Et=!0;else if(R.content.length>0&&R.content[0].type==="control"&&R.content[0].value==="*"){let Ue=["fldinst","nesttableprops"];t.extractAttachments&&Ue.push("shppict","listpicture"),Ue.includes(R.destination||"")||(Et=!0)}}if(R.destination==="listtext"||R.destination==="pntext"){w||(g=0),w=!0;let Ue=wt(R);if(Ue){let bi=Ue.trim();["\xB7","\u2022","o","\xA7","\u25A0","\u25A1","\u25CF","\u25CB","\u25C6","\u25C7","\u25BA","\u25B8","\xB7","\u2022","\u25CF","\u25CB"].some(Ma=>bi.includes(Ma))||bi.length===1&&!/[0-9a-zA-Z]/.test(bi)?v="unordered":(/^[0-9ivxlcdm]+[\.\)]/i.test(bi)||/^[a-z][\.\)]/i.test(bi))&&(v="ordered")}Et=!0}if(Et)return;if(d+="{",zc){let Ue=xe(R);Ue&&(c.push(Ue),!S&&!k&&(pt(),y.push({type:"image",text:"",metadata:{attachmentName:Ue.name||`image_${c.length}`}})));for(let bi of R.content)if(bi.type==="control")d+=Tt(bi);else if(bi.type==="text")d+=At(bi);else if(bi.type==="group"){let jc=Gn=>{for(let Ma of Gn.content)Ma.type==="control"?d+=Tt(Ma):Ma.type==="text"?d+=At(Ma):Ma.type==="group"&&(d+="{",jc(Ma),d+="}")};jc(R)}d+="}";return}let $m=y;if(re){if(t.ignoreNotes)return;pt(),Y++;let Ue="footnote";q===1?Ue="endnote":q===2&&(Ue=R.content.some(Gn=>Gn.type==="control"&&Gn.value==="ftnalt")?"endnote":"footnote");let bi={type:"note",children:[],metadata:{noteId:Y.toString(),noteType:Ue}};l.push(bi),y=bi.children}let JS={...W};for(let Ue of R.content){if(Ue.type==="group"&&Ue.destination==="fldinst"){d+="{";let bi=jc=>{for(let Gn of jc.content)Gn.type==="control"?d+=Tt(Gn):Gn.type==="text"?d+=At(Gn):Gn.type==="group"&&(d+="{",bi(Gn),d+="}")};bi(Ue),d+="}";continue}Nt(Ue,JS,Ct+1)}R.destination==="listtable"?S=!1:R.destination==="list"?(k=!1,M!==void 0&&P!==void 0&&(B[M]=P)):R.destination==="listoverridetable"?$=!1:$&&R.destination==="listoverride"&&V!==void 0&&U!==void 0&&(Z[V]=U),re&&(pt(),y=$m),_i&&(dt(),nt=void 0),d+="}"}else if(R.type==="text"){if(S||$){d+=At(R);return}ot(m,W)&&(dt(),m={...W}),f+=R.value,d+=At(R)}else if(R.type==="control"){if(d+=Tt(R),S){if(R.value==="listid")M=R.param;else if(R.value==="levelnfc"||R.value==="levelnfcn"){let bt=R.param!==void 0&&(R.param===0||R.param>=0&&R.param<=4);(!P||P==="unordered"&&bt)&&(P=bt?"ordered":"unordered")}return}if($){R.value==="listid"?U=R.param:R.value==="ls"&&(V=R.param);return}if(R.value==="par")pt(),m={...W};else if(R.value==="trowd"){let bt=G();J&&bt&&bt.currentCellContent.length>0?(j(),L.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})):J||(J=!0,j()),et=!0,X=[],O={isMergedContinuation:!1},C=0}else if(R.value==="clvmrg")O.isMergedContinuation=!0;else if(R.value==="clmgf")O.isMergedContinuation=!1;else if(R.value==="cellx")X.push({...O}),O={isMergedContinuation:!1};else if(R.value==="cell"){et=!0;let bt=!1;C1){let Et=G();Et&&(Et.rows.length>0||Et.currentCells.length>0)&&ct()}et=!0;let bt=ft();if(bt){let Et=G();Et&&Et.currentCells.push(bt)}m={...W}}else if(R.value==="row")lt(),m={...W},C=0,et=!1;else if(R.value==="nestrow")L.length>1&&ct(),lt(),m={...W},C=0;else if(R.value==="intbl")J=!0,et=!0,j();else if(R.value==="pard")et=!1,g=0,A="left",w=!1,v=void 0,T=void 0,I=void 0,W.backgroundColor=void 0;else if(R.value==="tab")ot(m,W)&&(dt(),m={...W}),f+=" ";else if(R.value==="line")ot(m,W)&&(dt(),m={...W}),f+=` +`;else if(R.value==="lquote")ot(m,W)&&(dt(),m={...W}),f+="\u2018";else if(R.value==="rquote")ot(m,W)&&(dt(),m={...W}),f+="\u2019";else if(R.value==="ldblquote")ot(m,W)&&(dt(),m={...W}),f+="\u201C";else if(R.value==="rdblquote")ot(m,W)&&(dt(),m={...W}),f+="\u201D";else if(R.value==="u"){if(R.param!==void 0){let bt=R.param;bt<0&&(bt+=65536),ot(m,W)&&(dt(),m={...W}),f+=String.fromCharCode(bt)}}else if(R.value==="b")W.bold=R.param!==0;else if(R.value==="i")W.italic=R.param!==0;else if(R.value==="ul")W.underline=R.param!==0;else if(R.value==="ulnone")W.underline=!1;else if(R.value==="strike")W.strikethrough=R.param!==0;else if(R.value==="plain")W.bold=!1,W.italic=!1,W.underline=!1,W.strikethrough=!1,W.subscript=!1,W.superscript=!1,W.size=void 0,W.font=void 0,W.color=void 0,W.backgroundColor=void 0;else if(R.value==="fs")R.param!==void 0&&(W.size=(R.param/2).toString()+"pt");else if(R.value==="f")R.param!==void 0&&n[R.param]&&(W.font=n[R.param]);else if(R.value==="cf")R.param!==void 0&&s[R.param]&&(W.color=s[R.param]);else if(R.value==="fet")R.param!==void 0&&(q=R.param);else if(R.value==="cb"||R.value==="highlight"||R.value==="chcbpat"||R.value==="cbpat")R.param!==void 0&&s[R.param]&&(W.backgroundColor=s[R.param]);else if(R.value==="sub")W.subscript=!0,W.superscript=!1;else if(R.value==="super")W.superscript=!0,W.subscript=!1;else if(R.value==="nosupersub")W.subscript=!1,W.superscript=!1;else if(R.value==="li")R.param!==void 0&&(g=Math.floor(R.param/360));else if(R.value==="ls"){if(R.param!==void 0){w||(g=0),w=!0,E[R.param]||(D++,E[R.param]=`rtf-list-${D}`),I=E[R.param];let bt=Z[R.param]!==void 0?Z[R.param]:R.param;B[bt]&&(v=B[bt])}}else R.value==="ilvl"?R.param!==void 0&&(w=!0,g=R.param):R.value==="pnlvl"?(w=!0,R.param!==void 0&&(g=R.param)):R.value==="levelnfc"||R.value==="pnf"?R.param!==void 0&&(w=!0,R.param===23?v="unordered":v="ordered"):R.value==="pndec"||R.value==="pnord"||R.value==="pnlcltr"||R.value==="pnucltr"?(w||(g=0),w=!0,v="ordered"):R.value==="pnbullet"||R.value==="pncard"?(w||(g=0),w=!0,v="unordered"):R.value==="s"?R.param!==void 0&&R.param>=1&&R.param<=9&&(T=R.param):R.value==="ql"?A="left":R.value==="qc"?A="center":R.value==="qr"?A="right":R.value==="qj"&&(A="justify")}};Nt(i,{});let kt=G();if((J||kt&&(kt.rows.length>0||kt.currentCells.length>0))&&ct(),pt(),!t.putNotesAtLast&&l.length>0&&(o.push(...l),l.length=0),t.ocr&&t.extractAttachments){for(let W of c)if(W.mimeType.startsWith("image/"))try{let Ct=st.Buffer.from(W.data,"base64");W.ocrText=(await Xn(Ct,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(Ct){rn(`OCR failed for ${W.name}:`,t,Ct)}let R=W=>{for(let Ct of W){if(Ct.type==="image"&&Ct.metadata&&"attachmentName"in Ct.metadata){let bt=Ct.metadata,Et=c.find(re=>re.name===bt.attachmentName);Et&&(Et.ocrText&&(Ct.text=Et.ocrText),Et.altText&&(bt.altText=Et.altText))}Ct.children&&R(Ct.children)}};R(o)}let Yt=R=>{for(let W of R){if(W.type==="note"&&W.children){let Ct=bt=>bt.children&&bt.children.length>0?bt.children.map(Ct).join(""):bt.text||"";W.text=W.children.map(Ct).join("").trim()}W.children&&Yt(W.children)}};Yt(o),Yt(l);let ti={type:"rtf",metadata:{},content:o,attachments:c,toText:()=>{let R=o.map(W=>W.text).join(t.newlineDelimiter??` `);return t.putNotesAtLast&&l.length>0&&(R+=(t.newlineDelimiter??` `)+l.map(W=>W.text).join(t.newlineDelimiter??` -`)),R}};return t.putNotesAtLast&&l.length>0&&o.push(...l),bi}catch(e){throw e}};function RM(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 LM(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 HS=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={},I=gg(E),M=(pt,ft)=>{let lt=new RegExp(`<${ft}(?:\\s+w:val="([^"]+)")?\\s*\\/?>`),ct=pt.match(lt);if(ct){let rt=ct[1];return rt===void 0?!0:rt==="1"||rt==="true"||rt==="on"}return null},P=M(I,"w:b");P!==null&&(S.bold=P);let B=M(I,"w:i");B!==null&&(S.italic=B);let $=I.match(//);if($){let pt=$[1];(!pt||pt!=="none")&&(S.underline=!0)}let U=M(I,"w:strike"),V=M(I,"w:dstrike");U!==null?S.strikethrough=U:V!==null&&(S.strikethrough=V);let Z=I.match(/]*w:fill="([^"]+)"/);nt&&nt[1]!=="auto"&&(S.backgroundColor="#"+nt[1]);let at=I.match(/]*w:ascii="([^"]+)"/);if(dt)S.font=dt[1];else{let pt=I.match(/]*w:hAnsi="([^"]+)"/);pt&&(S.font=pt[1])}let ot=I.match(/!!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)),m=f.find(E=>E.path.match(l)),y=m?La(m.content.toString()):{},g=f.find(E=>E.path.match(c));if(g){let E=hu(g.content.toString());Object.keys(E).length>0&&(y.customProperties=E)}let A=new Map,w=new Map,v=[],T=[],k=f.filter(E=>E.path.match(o)),N=f.find(E=>E.path.match(u)),F={};if(N){let E=Zt(N.content.toString()),S=J(E,"Relationship");for(let I of S){let M=I.getAttribute("Id"),P=I.getAttribute("Target");M&&P&&(F[M]=P)}}let L=f.find(E=>E.path.match(s)),Y={};if(L){let E=Zt(L.content.toString()),S=J(E,"w:num"),I=J(E,"w:abstractNum"),M={};for(let P of I){let B=P.getAttribute("w:abstractNumId");B&&(M[B]=P)}for(let P of S){let B=P.getAttribute("w:numId"),U=ut(P,"w:abstractNumId")?.getAttribute("w:val");if(B&&U&&M[U]){Y[B]={};let V=J(M[U],"w:lvl");for(let Z of V){let Q=Z.getAttribute("w:ilvl"),nt=ut(Z,"w:numFmt"),at=ut(Z,"w:lvlText");Q&&(Y[B][Q]={numFmt:nt?.getAttribute("w:val")||"decimal",lvlText:at?.getAttribute("w:val")||""})}}}}let q=f.find(E=>E.path.match(h)),G={};if(q){let E=Zt(q.content.toString()),S=J(E,"w:style");for(let I of S){let M=I.getAttribute("w:styleId");if(M){let P=ut(I,"w:rPr"),B=ut(I,"w:pPr"),$=P?d(P):{},U,V;if(B){let Z=ut(B,"w:jc");if(Z){let nt=Z.getAttribute("w:val");(nt==="left"||nt==="center"||nt==="right"||nt==="justify")&&(U=nt)}let Q=ut(B,"w:shd");if(Q){let nt=Q.getAttribute("w:fill");nt&&nt!=="auto"&&(V="#"+nt)}}G[M]={formatting:$,alignment:U,backgroundColor:V}}}}let j={};if(q){let E=Zt(q.content.toString()),S=ut(E,"w:docDefaults");if(S){let I=ut(S,"w:rPrDefault");if(I){let M=ut(I,"w:rPr");M&&(j=d(M))}}}let tt;if(q){let E=Zt(q.content.toString()),S=J(E,"w:style");for(let I of S){let M=I.getAttribute("w:type"),P=I.getAttribute("w:default"),B=I.getAttribute("w:styleId");if(M==="paragraph"&&P==="1"&&B){tt=B;break}}!tt&&G.Normal&&(tt="Normal")}let et=[],_=[],X={},O={},C=(E,S)=>{let I=E.toString(),M=ut(E,"w:numPr"),P=!!M,B=ut(E,"w:pPr"),U=(B?ut(B,"w:pStyle"):null)?.getAttribute("w:val"),V=U?U.startsWith("Heading")||U==="Title":!1,Z=U&&G[U]?G[U]:{formatting:{}},Q=Z.alignment;if(B){let lt=ut(B,"w:jc");if(lt){let ct=lt.getAttribute("w:val");(ct==="left"||ct==="center"||ct==="right"||ct==="justify")&&(Q=ct)}}let nt=Z.backgroundColor;if(B){let lt=ut(B,"w:shd");if(lt){let ct=lt.getAttribute("w:fill");ct&&ct!=="auto"&&(nt="#"+ct)}}let at={...Z.formatting};if(B){let lt=ut(B,"w:rPr");if(lt){let ct=d(lt);for(let rt in ct){let gt=ct[rt];gt===!1?delete at[rt]:gt!==void 0&&(at[rt]=gt)}}}let dt="",ot=[],pt=lt=>{if(ci(lt)&<.nodeName==="w:r"){let ct=lt,rt=ut(ct,"w:rPr"),gt={};for(let At in at)gt[At]=at[At];let bt=rt?ut(rt,"w:rStyle"):null,xe=bt?bt.getAttribute("w:val"):U;if(xe&&G[xe])for(let At in G[xe].formatting)gt[At]=G[xe].formatting[At];if(rt){let At=d(rt);for(let Bt in At){let Dt=At[Bt];Dt===!1?delete gt[Bt]:Dt!==void 0&&(gt[Bt]=Dt)}}!gt.backgroundColor&&nt&&(gt.backgroundColor=nt);let Yt=J(ct,"w:t");for(let At of Yt){let Bt=At.textContent||"";dt+=Bt;let Dt={type:"text",text:Bt,formatting:gt};t.includeRawContent&&(Dt.rawContent=Qt(At,S,t));let Gt=xe||U||tt;Gt&&(Dt.metadata={style:Gt}),ot.push(Dt)}if(t.extractAttachments){let At=J(ct,"w:drawing"),Bt=J(ct,"w:pict"),Dt=[...At,...Bt];for(let Gt of Dt){let bi=gg(Gt),R="",W=ut(Gt,"wp:docPr");W&&(R=W.getAttribute("descr")||W.getAttribute("title")||"");let Ct="",vt=ut(Gt,"a:blip");if(vt)Ct=vt.getAttribute("r:embed")||"";else{let Et=ut(Gt,"v:imagedata");Et&&(Ct=Et.getAttribute("r:id")||"")}if(Ct&&F[Ct]){let re=F[Ct].split("/").pop();if(re){let ti={type:"image",text:"",metadata:{attachmentName:re,altText:R}};t.includeRawContent&&(ti.rawContent=Qt(Gt,S,t)),ot.push(ti)}}else{let Et={type:"image",text:""};t.includeRawContent&&(Et.rawContent=Qt(Gt,S,t)),ot.push(Et)}}}if(!t.ignoreNotes){let At=ut(ct,"w:footnoteReference");if(At){let Dt=At.getAttribute("w:id");if(Dt&&A.has(Dt)){let Gt=A.get(Dt),bi={type:"note",text:Gt.map(R=>R.text).join(" "),children:Gt,metadata:{noteType:"footnote",noteId:Dt}};t.putNotesAtLast?v.push(bi):ot.push(bi)}}let Bt=ut(ct,"w:endnoteReference");if(Bt){let Dt=Bt.getAttribute("w:id");if(Dt&&w.has(Dt)){let Gt=w.get(Dt),bi={type:"note",text:Gt.map(R=>R.text).join(" "),children:Gt,metadata:{noteType:"endnote",noteId:Dt}};t.putNotesAtLast?v.push(bi):ot.push(bi)}}}}else if(ci(lt)&<.nodeName==="w:hyperlink"){let ct=lt,rt=ct.getAttribute("r:id"),gt=ct.getAttribute("w:anchor"),bt;gt?bt={link:"#"+gt,linkType:"internal"}:rt&&F[rt]&&(bt={link:F[rt],linkType:"external"});let xe=Array.from(ct.childNodes);for(let Yt of xe){let At=ot.length;if(pt(Yt),bt)for(let Bt=At;Bt{let I=[],M=He(E,"w:tr");for(let P=0;PI.path.match(i));if(E){let I=Zt(E.content.toString()),M=E.content.toString(),P=J(I,"w:footnote");for(let B of P){let $=B.getAttribute("w:id");if(!$||$==="-1"||$==="0")continue;let U=J(B,"w:p");A.set($,U.map(V=>C(V,M)))}}let S=f.find(I=>I.path.match(n));if(S){let I=Zt(S.content.toString()),M=S.content.toString(),P=J(I,"w:endnote");for(let B of P){let $=B.getAttribute("w:id");if(!$||$==="-1"||$==="0")continue;let U=J(B,"w:p");w.set($,U.map(V=>C(V,M)))}}}for(let E of f){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&&_.push(S);let I=Zt(S,{locator:t.includeRawContent}),M=ut(I,"w:body");if(M){let P=Array.from(M.childNodes);for(let B of P)ci(B)&&B.nodeName==="w:p"?et.push(C(B,S)):ci(B)&&B.nodeName==="w:tbl"&&et.push(D(B,S))}}if(t.extractAttachments){for(let E of k){let S=gr(E.path.split("/").pop()||"image",E.content);if(T.push(S),t.ocr&&S.mimeType.startsWith("image/"))try{S.ocrText=(await Xn(E.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(I){rn(`OCR failed for ${S.name}:`,t,I)}}if(t.ocr){let E=S=>{for(let I of S){if(I.type==="image"&&"attachmentName"in(I.metadata||{})){let M=I.metadata,P=T.find(B=>B.name===M.attachmentName);P&&P.ocrText&&(I.text=P.ocrText,P.altText=M.altText)}I.children&&E(I.children)}};E(et)}}return t.putNotesAtLast&&v.length>0&&et.push(...v),{type:"docx",metadata:{...y,formatting:j,styleMap:G},content:et,attachments:T,toText:()=>et.map(E=>{let S=I=>{let M="";return I.children?M+=I.children.map(S).filter(P=>P!="").join(I.children[0]?.children?t.newlineDelimiter??` -`:""):M+=I.text||"",M};return S(E)}).filter(E=>E!="").join(t.newlineDelimiter??` +`)),R}};return t.putNotesAtLast&&l.length>0&&o.push(...l),ti}catch(e){throw e}};function RM(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 LM(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 HS=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={},k=gg(E),M=(pt,ft)=>{let lt=new RegExp(`<${ft}(?:\\s+w:val="([^"]+)")?\\s*\\/?>`),ct=pt.match(lt);if(ct){let rt=ct[1];return rt===void 0?!0:rt==="1"||rt==="true"||rt==="on"}return null},P=M(k,"w:b");P!==null&&(S.bold=P);let B=M(k,"w:i");B!==null&&(S.italic=B);let $=k.match(//);if($){let pt=$[1];(!pt||pt!=="none")&&(S.underline=!0)}let U=M(k,"w:strike"),V=M(k,"w:dstrike");U!==null?S.strikethrough=U:V!==null&&(S.strikethrough=V);let Z=k.match(/]*w:fill="([^"]+)"/);nt&&nt[1]!=="auto"&&(S.backgroundColor="#"+nt[1]);let ot=k.match(/]*w:ascii="([^"]+)"/);if(dt)S.font=dt[1];else{let pt=k.match(/]*w:hAnsi="([^"]+)"/);pt&&(S.font=pt[1])}let at=k.match(/!!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)),m=f.find(E=>E.path.match(l)),y=m?La(m.content.toString()):{},g=f.find(E=>E.path.match(c));if(g){let E=hu(g.content.toString());Object.keys(E).length>0&&(y.customProperties=E)}let A=new Map,w=new Map,v=[],T=[],I=f.filter(E=>E.path.match(o)),_=f.find(E=>E.path.match(u)),F={};if(_){let E=Zt(_.content.toString()),S=tt(E,"Relationship");for(let k of S){let M=k.getAttribute("Id"),P=k.getAttribute("Target");M&&P&&(F[M]=P)}}let L=f.find(E=>E.path.match(s)),Y={};if(L){let E=Zt(L.content.toString()),S=tt(E,"w:num"),k=tt(E,"w:abstractNum"),M={};for(let P of k){let B=P.getAttribute("w:abstractNumId");B&&(M[B]=P)}for(let P of S){let B=P.getAttribute("w:numId"),U=ut(P,"w:abstractNumId")?.getAttribute("w:val");if(B&&U&&M[U]){Y[B]={};let V=tt(M[U],"w:lvl");for(let Z of V){let Q=Z.getAttribute("w:ilvl"),nt=ut(Z,"w:numFmt"),ot=ut(Z,"w:lvlText");Q&&(Y[B][Q]={numFmt:nt?.getAttribute("w:val")||"decimal",lvlText:ot?.getAttribute("w:val")||""})}}}}let q=f.find(E=>E.path.match(h)),G={};if(q){let E=Zt(q.content.toString()),S=tt(E,"w:style");for(let k of S){let M=k.getAttribute("w:styleId");if(M){let P=ut(k,"w:rPr"),B=ut(k,"w:pPr"),$=P?d(P):{},U,V;if(B){let Z=ut(B,"w:jc");if(Z){let nt=Z.getAttribute("w:val");(nt==="left"||nt==="center"||nt==="right"||nt==="justify")&&(U=nt)}let Q=ut(B,"w:shd");if(Q){let nt=Q.getAttribute("w:fill");nt&&nt!=="auto"&&(V="#"+nt)}}G[M]={formatting:$,alignment:U,backgroundColor:V}}}}let j={};if(q){let E=Zt(q.content.toString()),S=ut(E,"w:docDefaults");if(S){let k=ut(S,"w:rPrDefault");if(k){let M=ut(k,"w:rPr");M&&(j=d(M))}}}let J;if(q){let E=Zt(q.content.toString()),S=tt(E,"w:style");for(let k of S){let M=k.getAttribute("w:type"),P=k.getAttribute("w:default"),B=k.getAttribute("w:styleId");if(M==="paragraph"&&P==="1"&&B){J=B;break}}!J&&G.Normal&&(J="Normal")}let et=[],N=[],X={},O={},C=(E,S)=>{let k=E.toString(),M=ut(E,"w:numPr"),P=!!M,B=ut(E,"w:pPr"),U=(B?ut(B,"w:pStyle"):null)?.getAttribute("w:val"),V=U?U.startsWith("Heading")||U==="Title":!1,Z=U&&G[U]?G[U]:{formatting:{}},Q=Z.alignment;if(B){let lt=ut(B,"w:jc");if(lt){let ct=lt.getAttribute("w:val");(ct==="left"||ct==="center"||ct==="right"||ct==="justify")&&(Q=ct)}}let nt=Z.backgroundColor;if(B){let lt=ut(B,"w:shd");if(lt){let ct=lt.getAttribute("w:fill");ct&&ct!=="auto"&&(nt="#"+ct)}}let ot={...Z.formatting};if(B){let lt=ut(B,"w:rPr");if(lt){let ct=d(lt);for(let rt in ct){let gt=ct[rt];gt===!1?delete ot[rt]:gt!==void 0&&(ot[rt]=gt)}}}let dt="",at=[],pt=lt=>{if(ni(lt)&<.nodeName==="w:r"){let ct=lt,rt=ut(ct,"w:rPr"),gt={};for(let Tt in ot)gt[Tt]=ot[Tt];let wt=rt?ut(rt,"w:rStyle"):null,xe=wt?wt.getAttribute("w:val"):U;if(xe&&G[xe])for(let Tt in G[xe].formatting)gt[Tt]=G[xe].formatting[Tt];if(rt){let Tt=d(rt);for(let At in Tt){let Nt=Tt[At];Nt===!1?delete gt[At]:Nt!==void 0&&(gt[At]=Nt)}}!gt.backgroundColor&&nt&&(gt.backgroundColor=nt);for(let Tt of ct.childNodes)if(ni(Tt)){if(Tt.tagName==="w:t"||Tt.tagName==="t"){let At=Tt,Nt=At.textContent||"";dt+=Nt;let kt={type:"text",text:Nt,formatting:gt};t.includeRawContent&&(kt.rawContent=Qt(At,S,t));let Yt=xe||U||J;Yt&&(kt.metadata={style:Yt}),at.push(kt)}else if(t.includeBreakNodes&&(Tt.tagName==="w:br"||Tt.tagName==="br"||Tt.tagName==="w:cr"||Tt.tagName==="cr")){let At=Tt,Nt=At.getAttribute("w:type"),kt="textWrapping";Nt!==null&&(kt=Nt);let Yt;kt==="textWrapping"&&At.getAttribute("w:clear")!==null&&(Yt=At.getAttribute("w:clear"));let ti={type:"break",metadata:{breakType:kt,clear:Yt}};at.push(ti)}else if(t.includeBreakNodes&&(Tt.tagName==="w:lastRenderedPageBreak"||Tt.tagName==="lastRenderedPageBreak")){let At={type:"break",metadata:{breakType:"lastRenderedPage"}};at.push(At)}}if(t.extractAttachments){let Tt=tt(ct,"w:drawing"),At=tt(ct,"w:pict"),Nt=[...Tt,...At];for(let kt of Nt){let Yt=gg(kt),ti="",R=ut(kt,"wp:docPr");R&&(ti=R.getAttribute("descr")||R.getAttribute("title")||"");let W="",Ct=ut(kt,"a:blip");if(Ct)W=Ct.getAttribute("r:embed")||"";else{let bt=ut(kt,"v:imagedata");bt&&(W=bt.getAttribute("r:id")||"")}if(W&&F[W]){let Et=F[W].split("/").pop();if(Et){let re={type:"image",text:"",metadata:{attachmentName:Et,altText:ti}};t.includeRawContent&&(re.rawContent=Qt(kt,S,t)),at.push(re)}}else{let bt={type:"image",text:""};t.includeRawContent&&(bt.rawContent=Qt(kt,S,t)),at.push(bt)}}}if(!t.ignoreNotes){let Tt=ut(ct,"w:footnoteReference");if(Tt){let Nt=Tt.getAttribute("w:id");if(Nt&&A.has(Nt)){let kt=A.get(Nt),Yt={type:"note",text:kt.map(ti=>ti.text).join(" "),children:kt,metadata:{noteType:"footnote",noteId:Nt}};t.putNotesAtLast?v.push(Yt):at.push(Yt)}}let At=ut(ct,"w:endnoteReference");if(At){let Nt=At.getAttribute("w:id");if(Nt&&w.has(Nt)){let kt=w.get(Nt),Yt={type:"note",text:kt.map(ti=>ti.text).join(" "),children:kt,metadata:{noteType:"endnote",noteId:Nt}};t.putNotesAtLast?v.push(Yt):at.push(Yt)}}}}else if(ni(lt)&<.nodeName==="w:hyperlink"){let ct=lt,rt=ct.getAttribute("r:id"),gt=ct.getAttribute("w:anchor"),wt;gt?wt={link:"#"+gt,linkType:"internal"}:rt&&F[rt]&&(wt={link:F[rt],linkType:"external"});let xe=Array.from(ct.childNodes);for(let Tt of xe){let At=at.length;if(pt(Tt),wt)for(let Nt=At;Nt{let k=[],M=He(E,"w:tr");for(let P=0;Pk.path.match(i));if(E){let k=Zt(E.content.toString()),M=E.content.toString(),P=tt(k,"w:footnote");for(let B of P){let $=B.getAttribute("w:id");if(!$||$==="-1"||$==="0")continue;let U=tt(B,"w:p");A.set($,U.map(V=>C(V,M)))}}let S=f.find(k=>k.path.match(n));if(S){let k=Zt(S.content.toString()),M=S.content.toString(),P=tt(k,"w:endnote");for(let B of P){let $=B.getAttribute("w:id");if(!$||$==="-1"||$==="0")continue;let U=tt(B,"w:p");w.set($,U.map(V=>C(V,M)))}}}for(let E of f){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&&N.push(S);let k=Zt(S,{locator:t.includeRawContent}),M=ut(k,"w:body");if(M){let P=Array.from(M.childNodes);for(let B of P)ni(B)&&B.nodeName==="w:p"?et.push(C(B,S)):ni(B)&&B.nodeName==="w:tbl"&&et.push(D(B,S))}}if(t.extractAttachments){for(let E of I){let S=gr(E.path.split("/").pop()||"image",E.content);if(T.push(S),t.ocr&&S.mimeType.startsWith("image/"))try{S.ocrText=(await Xn(E.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(k){rn(`OCR failed for ${S.name}:`,t,k)}}if(t.ocr){let E=S=>{for(let k of S){if(k.type==="image"&&"attachmentName"in(k.metadata||{})){let M=k.metadata,P=T.find(B=>B.name===M.attachmentName);P&&P.ocrText&&(k.text=P.ocrText,P.altText=M.altText)}k.children&&E(k.children)}};E(et)}}return t.putNotesAtLast&&v.length>0&&et.push(...v),{type:"docx",metadata:{...y,formatting:j,styleMap:G},content:et,attachments:T,toText:()=>et.map(E=>{let S=k=>{let M="";return k.children?M+=k.children.map(S).filter(P=>P!="").join(k.children[0]?.children?t.newlineDelimiter??` +`:""):M+=k.text||"",M};return S(E)}).filter(E=>E!="").join(t.newlineDelimiter??` `)}};var Uc=class{static async parseOffice(t,e,i){let n,s={};typeof e=="function"?(n=e,s=i||{}):s=e||{};let o={ignoreNotes:!1,newlineDelimiter:` -`,putNotesAtLast:!1,outputErrorToConsole:!1,extractAttachments:!1,ocr:!1,ocrLanguage:"eng",includeRawContent:!1,serializeRawContent:!0,preserveXmlWhitespace:!1,pdfWorkerSrc:"",ocrConfig:{},...s},l=st.Buffer.alloc(0),c="",u;try{if(!t)throw Ms("IMPROPER_ARGUMENTS",o);if(t instanceof ArrayBuffer)l=st.Buffer.from(t);else if(st.Buffer.isBuffer(t))l=t;else if(typeof t=="string"){u=t,Zm("path-parsing");let d=await Promise.resolve().then(()=>(QS(),ZS));if(!d.existsSync(t))throw Ms("FILE_DOES_NOT_EXIST",o,t);if(d.lstatSync(t).isDirectory())throw Ms("LOCATION_NOT_FOUND",o,t);l=d.readFileSync(t),c=t.split(".").pop()?.toLowerCase()||""}else throw Ms("INVALID_INPUT",o);if(!c){let{fileTypeFromBuffer:d}=await LS(),f=await d(l);if(f)c=f.ext.toLowerCase();else throw Ms("IMPROPER_BUFFERS",o)}let h;switch(c){case"docx":h=await HS(l,o);break;case"pptx":h=await zS(l,o);break;case"xlsx":h=await UE(l,o);break;case"odt":case"odp":case"ods":h=await zE(l,o);break;case"pdf":h=await US(l,o);break;case"rtf":h=await jS(l,o);break;default:throw Ms("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 wE()}};var UM=Uc.parseOffice,zM=Uc.terminateOcr;var jM=Uc;return aD(HM);})(); +`,putNotesAtLast:!1,outputErrorToConsole:!1,extractAttachments:!1,ocr:!1,ocrLanguage:"eng",includeRawContent:!1,serializeRawContent:!0,preserveXmlWhitespace:!1,pdfWorkerSrc:"",ocrConfig:{},includeBreakNodes:!1,...s},l=st.Buffer.alloc(0),c="",u;try{if(!t)throw Ms("IMPROPER_ARGUMENTS",o);if(t instanceof ArrayBuffer)l=st.Buffer.from(t);else if(st.Buffer.isBuffer(t))l=t;else if(typeof t=="string"){u=t,Zm("path-parsing");let d=await Promise.resolve().then(()=>(QS(),ZS));if(!d.existsSync(t))throw Ms("FILE_DOES_NOT_EXIST",o,t);if(d.lstatSync(t).isDirectory())throw Ms("LOCATION_NOT_FOUND",o,t);l=d.readFileSync(t),c=t.split(".").pop()?.toLowerCase()||""}else throw Ms("INVALID_INPUT",o);if(!c){let{fileTypeFromBuffer:d}=await LS(),f=await d(l);if(f)c=f.ext.toLowerCase();else throw Ms("IMPROPER_BUFFERS",o)}let h;switch(c){case"docx":h=await HS(l,o);break;case"pptx":h=await zS(l,o);break;case"xlsx":h=await UE(l,o);break;case"odt":case"odp":case"ods":h=await zE(l,o);break;case"pdf":h=await US(l,o);break;case"rtf":h=await jS(l,o);break;default:throw Ms("EXTENSION_UNSUPPORTED",o,c)}return n&&n(h),h}catch(h){let d=Nv(h,o,u);throw n&&n(void 0,d),d}}static async terminateOcr(){await wE()}};var UM=Uc.parseOffice,zM=Uc.terminateOcr;var jM=Uc;return aD(HM);})(); /*! Bundled license information: ieee754/index.js: diff --git a/docs/dist/officeparser.browser.mjs b/docs/dist/officeparser.browser.mjs index d585c5b..f74b489 100644 --- a/docs/dist/officeparser.browser.mjs +++ b/docs/dist/officeparser.browser.mjs @@ -3,16 +3,16 @@ if (typeof setImmediate === 'undefined') { window.setImmediate = function(callback) { return setTimeout(callback, 0); }; } -var JS=Object.create;var $m=Object.defineProperty;var tD=Object.getOwnPropertyDescriptor;var eD=Object.getOwnPropertyNames;var iD=Object.getPrototypeOf,nD=Object.prototype.hasOwnProperty;var $w=r=>{throw TypeError(r)};var rD=(r,t,e)=>t in r?$m(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Vm=(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 Kt=(r,t)=>()=>(r&&(t=r(r=0)),t);var Ut=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Hx=(r,t)=>{for(var e in t)$m(r,e,{get:t[e],enumerable:!0})},sD=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of eD(t))!nD.call(r,n)&&n!==e&&$m(r,n,{get:()=>t[n],enumerable:!(i=tD(t,n))||i.enumerable});return r};var jc=(r,t,e)=>(e=r!=null?JS(iD(r)):{},sD(t||!r||!r.__esModule?$m(e,"default",{value:r,enumerable:!0}):e,r));var z=(r,t,e)=>rD(r,typeof t!="symbol"?t+"":t,e),Gx=(r,t,e)=>t.has(r)||$w("Cannot "+e);var a=(r,t,e)=>(Gx(r,t,"read from private field"),e?e.call(r):t.get(r)),x=(r,t,e)=>t.has(r)?$w("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),p=(r,t,e,i)=>(Gx(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e),b=(r,t,e)=>(Gx(r,t,"access private method"),e);var Ye=(r,t,e,i)=>({set _(n){p(r,t,n,e)},get _(){return a(r,t,i)}});var Ww=Ut(qm=>{"use strict";H();qm.byteLength=oD;qm.toByteArray=cD;qm.fromByteArray=dD;var Ur=[],$n=[],aD=typeof Uint8Array<"u"?Uint8Array:Array,$x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Uo=0,Vw=$x.length;Uo0)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 oD(r){var t=qw(r),e=t[0],i=t[1];return(e+i)*3/4-i}function lD(r,t,e){return(t+e)*3/4-e}function cD(r){var t,e=qw(r),i=e[0],n=e[1],s=new aD(lD(r,i,n)),o=0,l=n>0?i-4:i,c;for(c=0;c>16&255,s[o++]=t>>8&255,s[o++]=t&255;return n===2&&(t=$n[r.charCodeAt(c)]<<2|$n[r.charCodeAt(c+1)]>>4,s[o++]=t&255),n===1&&(t=$n[r.charCodeAt(c)]<<10|$n[r.charCodeAt(c+1)]<<4|$n[r.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function uD(r){return Ur[r>>18&63]+Ur[r>>12&63]+Ur[r>>6&63]+Ur[r&63]}function hD(r,t,e){for(var i,n=[],s=t;sl?l:o+s));return i===1?(t=r[e-1],n.push(Ur[t>>2]+Ur[t<<4&63]+"==")):i===2&&(t=(r[e-2]<<8)+r[e-1],n.push(Ur[t>>10]+Ur[t>>4&63]+Ur[t<<2&63]+"=")),n.join("")}});var qx=Ut(Vx=>{H();Vx.read=function(r,t,e,i,n){var s,o,l=n*8-i-1,c=(1<>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)};Vx.write=function(r,t,e,i,n,s){var o,l,c,u=s*8-n-1,h=(1<>1,f=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=i?0:s-1,y=i?1:-1,g=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+=y,l/=256,n-=8);for(o=o<0;r[e+m]=o&255,m+=y,o/=256,u-=8);r[e+m-y]|=g*128}});var uA=Ut(Vc=>{"use strict";H();var Wx=Ww(),Gc=qx(),Xw=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Vc.Buffer=K;Vc.SlowBuffer=yD;Vc.INSPECT_MAX_BYTES=50;var Wm=2147483647;Vc.kMaxLength=Wm;K.TYPED_ARRAY_SUPPORT=fD();!K.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 fD(){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(K.prototype,"parent",{enumerable:!0,get:function(){if(K.isBuffer(this))return this.buffer}});Object.defineProperty(K.prototype,"offset",{enumerable:!0,get:function(){if(K.isBuffer(this))return this.byteOffset}});function Ss(r){if(r>Wm)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,K.prototype),t}function K(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 Zx(r)}return Qw(r,t,e)}K.poolSize=8192;function Qw(r,t,e){if(typeof r=="string")return mD(r,t);if(ArrayBuffer.isView(r))return gD(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(zr(r,ArrayBuffer)||r&&zr(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(zr(r,SharedArrayBuffer)||r&&zr(r.buffer,SharedArrayBuffer)))return Yx(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 K.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 K.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)}K.from=function(r,t,e){return Qw(r,t,e)};Object.setPrototypeOf(K.prototype,Uint8Array.prototype);Object.setPrototypeOf(K,Uint8Array);function Jw(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 pD(r,t,e){return Jw(r),r<=0?Ss(r):t!==void 0?typeof e=="string"?Ss(r).fill(t,e):Ss(r).fill(t):Ss(r)}K.alloc=function(r,t,e){return pD(r,t,e)};function Zx(r){return Jw(r),Ss(r<0?0:Qx(r)|0)}K.allocUnsafe=function(r){return Zx(r)};K.allocUnsafeSlow=function(r){return Zx(r)};function mD(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!K.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=tA(r,t)|0,i=Ss(e),n=i.write(r,t);return n!==e&&(i=i.slice(0,n)),i}function Xx(r){let t=r.length<0?0:Qx(r.length)|0,e=Ss(t);for(let i=0;i=Wm)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Wm.toString(16)+" bytes");return r|0}function yD(r){return+r!=r&&(r=0),K.alloc(+r)}K.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==K.prototype};K.compare=function(t,e){if(zr(t,Uint8Array)&&(t=K.from(t,t.offset,t.byteLength)),zr(e,Uint8Array)&&(e=K.from(e,e.offset,e.byteLength)),!K.isBuffer(t)||!K.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);sn.length?(K.isBuffer(o)||(o=K.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(K.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function tA(r,t){if(K.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||zr(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 Kx(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return cA(r).length;default:if(n)return i?-1:Kx(r).length;t=(""+t).toLowerCase(),n=!0}}K.byteLength=tA;function bD(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 kD(this,t,e);case"utf8":case"utf-8":return iA(this,t,e);case"ascii":return DD(this,t,e);case"latin1":case"binary":return ID(this,t,e);case"base64":return TD(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}}K.prototype._isBuffer=!0;function zo(r,t,e){let i=r[t];r[t]=r[e],r[e]=i}K.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;ee&&(t+=" ... "),""};Xw&&(K.prototype[Xw]=K.prototype.inspect);K.prototype.compare=function(t,e,i,n,s){if(zr(t,Uint8Array)&&(t=K.from(t,t.offset,t.byteLength)),!K.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;d2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,ty(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=K.from(t,i)),K.isBuffer(t))return t.length===0?-1:Yw(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):Yw(r,[t],e,i,n);throw new TypeError("val must be string, number or Buffer")}function Yw(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;uo&&(e=o-l),u=e;u>=0;u--){let h=!0;for(let d=0;dn&&(i=n)):i=n;let s=t.length;i>s/2&&(i=s/2);let o;for(o=0;o>>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 wD(this,t,e,i);case"utf8":case"utf-8":return AD(this,t,e,i);case"ascii":case"latin1":case"binary":return vD(this,t,e,i);case"base64":return ED(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return CD(this,t,e,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};K.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function TD(r,t,e){return t===0&&e===r.length?Wx.fromByteArray(r):Wx.fromByteArray(r.slice(t,e))}function iA(r,t,e){e=Math.min(r.length,e);let i=[],n=t;for(;n239?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 SD(i)}var Kw=4096;function SD(r){let t=r.length;if(t<=Kw)return String.fromCharCode.apply(String,r);let e="",i=0;for(;ii)&&(e=i);let n="";for(let s=t;si&&(t=i),e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),ee)throw new RangeError("Trying to access beyond buffer length")}K.prototype.readUintLE=K.prototype.readUIntLE=function(t,e,i){t=t>>>0,e=e>>>0,i||li(t,e,this.length);let n=this[t],s=1,o=0;for(;++o>>0,e=e>>>0,i||li(t,e,this.length);let n=this[t+--e],s=1;for(;e>0&&(s*=256);)n+=this[t+--e]*s;return n};K.prototype.readUint8=K.prototype.readUInt8=function(t,e){return t=t>>>0,e||li(t,1,this.length),this[t]};K.prototype.readUint16LE=K.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||li(t,2,this.length),this[t]|this[t+1]<<8};K.prototype.readUint16BE=K.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||li(t,2,this.length),this[t]<<8|this[t+1]};K.prototype.readUint32LE=K.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||li(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};K.prototype.readUint32BE=K.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||li(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};K.prototype.readBigUInt64LE=Fa(function(t){t=t>>>0,$c(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&vd(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)<>>0,$c(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&vd(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)<>>0,e=e>>>0,i||li(t,e,this.length);let n=this[t],s=1,o=0;for(;++o=s&&(n-=Math.pow(2,8*e)),n};K.prototype.readIntBE=function(t,e,i){t=t>>>0,e=e>>>0,i||li(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};K.prototype.readInt8=function(t,e){return t=t>>>0,e||li(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};K.prototype.readInt16LE=function(t,e){t=t>>>0,e||li(t,2,this.length);let i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};K.prototype.readInt16BE=function(t,e){t=t>>>0,e||li(t,2,this.length);let i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};K.prototype.readInt32LE=function(t,e){return t=t>>>0,e||li(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};K.prototype.readInt32BE=function(t,e){return t=t>>>0,e||li(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};K.prototype.readBigInt64LE=Fa(function(t){t=t>>>0,$c(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&vd(t,this.length-8);let n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(i<<24);return(BigInt(n)<>>0,$c(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&vd(t,this.length-8);let n=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<>>0,e||li(t,4,this.length),Gc.read(this,t,!0,23,4)};K.prototype.readFloatBE=function(t,e){return t=t>>>0,e||li(t,4,this.length),Gc.read(this,t,!1,23,4)};K.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||li(t,8,this.length),Gc.read(this,t,!0,52,8)};K.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||li(t,8,this.length),Gc.read(this,t,!1,52,8)};function Ji(r,t,e,i,n,s){if(!K.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||tr.length)throw new RangeError("Index out of range")}K.prototype.writeUintLE=K.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;Ji(this,t,e,i,l,0)}let s=1,o=0;for(this[e]=t&255;++o>>0,i=i>>>0,!n){let l=Math.pow(2,8*i)-1;Ji(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};K.prototype.writeUint8=K.prototype.writeUInt8=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,1,255,0),this[e]=t&255,e+1};K.prototype.writeUint16LE=K.prototype.writeUInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};K.prototype.writeUint16BE=K.prototype.writeUInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};K.prototype.writeUint32LE=K.prototype.writeUInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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};K.prototype.writeUint32BE=K.prototype.writeUInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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 nA(r,t,e,i,n){lA(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 rA(r,t,e,i,n){lA(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}K.prototype.writeBigUInt64LE=Fa(function(t,e=0){return nA(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});K.prototype.writeBigUInt64BE=Fa(function(t,e=0){return rA(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});K.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e=e>>>0,!n){let c=Math.pow(2,8*i-1);Ji(this,t,e,i,c-1,-c)}let s=0,o=1,l=0;for(this[e]=t&255;++s>0)-l&255;return e+i};K.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e=e>>>0,!n){let c=Math.pow(2,8*i-1);Ji(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};K.prototype.writeInt8=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};K.prototype.writeInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};K.prototype.writeInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};K.prototype.writeInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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};K.prototype.writeInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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};K.prototype.writeBigInt64LE=Fa(function(t,e=0){return nA(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});K.prototype.writeBigInt64BE=Fa(function(t,e=0){return rA(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function sA(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 aA(r,t,e,i,n){return t=+t,e=e>>>0,n||sA(r,t,e,4,34028234663852886e22,-34028234663852886e22),Gc.write(r,t,e,i,23,4),e+4}K.prototype.writeFloatLE=function(t,e,i){return aA(this,t,e,!0,i)};K.prototype.writeFloatBE=function(t,e,i){return aA(this,t,e,!1,i)};function oA(r,t,e,i,n){return t=+t,e=e>>>0,n||sA(r,t,e,8,17976931348623157e292,-17976931348623157e292),Gc.write(r,t,e,i,52,8),e+8}K.prototype.writeDoubleLE=function(t,e,i){return oA(this,t,e,!0,i)};K.prototype.writeDoubleBE=function(t,e,i){return oA(this,t,e,!1,i)};K.prototype.copy=function(t,e,i,n){if(!K.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=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>>0,i=i===void 0?this.length:i>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s2**32?n=Zw(String(e)):typeof e=="bigint"&&(n=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(n=Zw(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i},RangeError);function Zw(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 ND(r,t,e){$c(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&vd(t,r.length-(e+1))}function lA(r,t,e,i,n,s){if(r>e||r3?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 Hc.ERR_OUT_OF_RANGE("value",l,r)}ND(i,n,s)}function $c(r,t){if(typeof r!="number")throw new Hc.ERR_INVALID_ARG_TYPE(t,"number",r)}function vd(r,t,e){throw Math.floor(r)!==r?($c(r,e),new Hc.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new Hc.ERR_BUFFER_OUT_OF_BOUNDS:new Hc.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}var MD=/[^+/0-9A-Za-z-_]/g;function FD(r){if(r=r.split("=")[0],r=r.trim().replace(MD,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Kx(r,t){t=t||1/0;let e,i=r.length,n=null,s=[];for(let o=0;o55295&&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 PD(r){let t=[];for(let e=0;e>8,n=e%256,s.push(n),s.push(i);return s}function cA(r){return Wx.toByteArray(FD(r))}function Xm(r,t,e,i){let n;for(n=0;n=t.length||n>=r.length);++n)t[n+e]=r[n];return n}function zr(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function ty(r){return r!==r}var RD=(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 Fa(r){return typeof BigInt>"u"?LD:r}function LD(){throw new Error("BigInt not supported")}});var mA=Ut((qM,pA)=>{H();var ze=pA.exports={},jr,Hr;function ey(){throw new Error("setTimeout has not been defined")}function iy(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?jr=setTimeout:jr=ey}catch{jr=ey}try{typeof clearTimeout=="function"?Hr=clearTimeout:Hr=iy}catch{Hr=iy}})();function hA(r){if(jr===setTimeout)return setTimeout(r,0);if((jr===ey||!jr)&&setTimeout)return jr=setTimeout,setTimeout(r,0);try{return jr(r,0)}catch{try{return jr.call(null,r,0)}catch{return jr.call(this,r,0)}}}function BD(r){if(Hr===clearTimeout)return clearTimeout(r);if((Hr===iy||!Hr)&&clearTimeout)return Hr=clearTimeout,clearTimeout(r);try{return Hr(r)}catch{try{return Hr.call(null,r)}catch{return Hr.call(this,r)}}}var Ds=[],qc=!1,jo,Ym=-1;function UD(){!qc||!jo||(qc=!1,jo.length?Ds=jo.concat(Ds):Ym=-1,Ds.length&&dA())}function dA(){if(!qc){var r=hA(UD);qc=!0;for(var t=Ds.length;t;){for(jo=Ds,Ds=[];++Ym1)for(var e=1;e{"use strict";st=jc(uA()),it=jc(mA()),ny=[typeof globalThis<"u"?globalThis:null,typeof window<"u"?window:null,typeof self<"u"?self:null,typeof window<"u"?window:null].filter(Boolean);ny.forEach(r=>{r.Buffer||(r.Buffer=st.Buffer),r.process||(r.process=it.default)});typeof it.default<"u"&&!it.default.env&&(it.default.env={NODE_ENV:"production"});if(typeof ny[0]<"u"){let r=ny[0];r.util||(r.util={debuglog:()=>()=>{},inspect:t=>JSON.stringify(t)})}});var Go=Ut(Ai=>{"use strict";H();function jD(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-1}var KD=Xc({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/"});Ai.assign=HD;Ai.find=jD;Ai.freeze=Xc;Ai.HTML_BOOLEAN_ATTRIBUTES=xA;Ai.HTML_RAW_TEXT_ELEMENTS=Ed;Ai.HTML_VOID_ELEMENTS=yA;Ai.hasDefaultHTMLNamespace=WD;Ai.hasOwn=Ho;Ai.isHTMLBooleanAttribute=GD;Ai.isHTMLRawTextElement=VD;Ai.isHTMLEscapableRawTextElement=qD;Ai.isHTMLMimeType=bA;Ai.isHTMLVoidElement=$D;Ai.isValidMimeType=YD;Ai.MIME_TYPE=Cd;Ai.NAMESPACE=KD});var kd=Ut(Id=>{"use strict";H();var ZD=Go();function AA(r,t){r.prototype=Object.create(Error.prototype,{constructor:{value:r},name:{value:r.name,enumerable:!0,writable:t}})}var Sd=ZD.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"}),vA=Object.keys(Sd);function EA(r){return typeof r=="number"&&r>=1&&r<=25}function QD(r){return typeof r=="string"&&r.substring(r.length-Sd.Error.length)===Sd.Error}function Dd(r,t){EA(r)?(this.name=vA[r],this.message=t||""):(this.message=r,this.name=QD(t)?t:Sd.Error),Error.captureStackTrace&&Error.captureStackTrace(this,Dd)}AA(Dd,!0);Object.defineProperties(Dd.prototype,{code:{enumerable:!0,get:function(){var r=vA.indexOf(this.name);return EA(r)?r:0}}});var CA={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},ry=Object.entries(CA);for(Td=0;Td{"use strict";H();function NA(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 Pd=NA();function $o(r){if(r.source[0]!=="[")throw new Error(r+" can not be used with chars");return r.source.slice(1,r.source.lastIndexOf("]"))}function Yc(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,""),Pd?"u":"")}function zt(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(""),Pd?"mu":"m")}function It(r){if(arguments.length===0)throw new Error("no parameters provided");return zt.apply(It,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var JD="\uFFFD",Vo=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;Pd&&(Vo=zt("[",$o(Vo),"\\u{10000}-\\u{10FFFF}","]"));var oy=/[\x20\x09\x0D\x0A]/,tI=$o(oy),se=zt(oy,"+"),Ce=zt(oy,"*"),_d=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;Pd&&(_d=zt("[",$o(_d),"\\u{10000}-\\u{10FFFF}","]"));var eI=$o(_d),ly=zt("[",eI,$o(/[-.0-9\xB7]/),$o(/[\u0300-\u036F\u203F-\u2040]/),"]"),Vn=zt(_d,ly,"*"),TA=zt(ly,"+"),iI=zt("&",Vn,";"),nI=It(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),Nd=It(iI,"|",nI),Md=zt("%",Vn,";"),cy=It(zt('"',It(/[^%&"]/,"|",Md,"|",Nd),"*",'"'),"|",zt("'",It(/[^%&']/,"|",Md,"|",Nd),"*","'")),rI=It('"',It(/[^<&"]/,"|",Nd),"*",'"',"|","'",It(/[^<&']/,"|",Nd),"*","'"),sI=Yc(_d,":"),aI=Yc(ly,":"),SA=zt(sI,aI,"*"),Od=zt(SA,It(":",SA),"?"),oI=zt("^",Od,"$"),lI=zt("(",Od,")"),Fd=It(/"[^"]*"|'[^']*'/),cI=zt(/^<\?/,"(",Vn,")",It(se,"(",Vo,"*?)"),"?",/\?>/),DA=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Zm=It('"',DA,'*"',"|","'",Yc(DA,"'"),"*'"),MA="",uI=zt(MA,It(Yc(Vo,"-"),"|",zt("-",Yc(Vo,"-"))),"*",FA),IA="#PCDATA",hI=It(zt(/\(/,Ce,IA,It(Ce,/\|/,Ce,Od),"*",Ce,/\)\*/),"|",zt(/\(/,Ce,IA,Ce,/\)/)),dI=/[?*+]?/,fI=zt(/\([^>]+\)/,dI),pI=It("EMPTY","|","ANY","|",hI,"|",fI),mI=""),xI=zt("NOTATION",se,/\(/,Ce,Vn,It(Ce,/\|/,Ce,Vn),"*",Ce,/\)/),yI=zt(/\(/,Ce,TA,It(Ce,/\|/,Ce,TA),"*",Ce,/\)/),bI=It(xI,"|",yI),wI=It(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",bI),AI=It(/#REQUIRED|#IMPLIED/,"|",It(It("#FIXED",se),"?",rI)),vI=It(se,Vn,se,wI,se,AI),EI=""),ay="about:legacy-compat",TI=It('"'+ay+'"',"|","'"+ay+"'"),uy="SYSTEM",Qm="PUBLIC",Jm=It(It(uy,se,Fd),"|",It(Qm,se,Zm,se,Fd)),SI=zt("^",It(It(uy,se,"(?",Fd,")"),"|",It(Qm,se,"(?",Zm,")",se,"(?",Fd,")"))),DI=It(se,"NDATA",se,Vn),II=It(cy,"|",It(Jm,DI,"?")),PA=""),_I=It(cy,"|",Jm),NI=zt(PA,se,"%",se,Vn,se,_I,Ce,">"),MI=It(kI,"|",NI),FI=zt(Qm,se,Zm),PI=zt(""),hy=zt(Ce,"=",Ce),kA=/1[.]\d+/,OI=zt(se,"version",hy,It("'",kA,"'","|",'"',kA,'"')),_A=/[A-Za-z][-A-Za-z0-9._]*/,RI=It(se,"encoding",hy,It('"',_A,'"',"|","'",_A,"'")),LI=It(se,"standalone",hy,It("'",It("yes","|","no"),"'","|",'"',It("yes","|","no"),'"')),BI=zt(/^<\?xml/,OI,RI,"?",LI,"?",Ce,/\?>/),UI="",HI=//,$I=zt(Vo,"*?",GI),VI=zt(HI,$I);Rt.chars=$o;Rt.chars_without=Yc;Rt.detectUnicodeSupport=NA;Rt.reg=zt;Rt.regg=It;Rt.ABOUT_LEGACY_COMPAT=ay;Rt.ABOUT_LEGACY_COMPAT_SystemLiteral=TI;Rt.AttlistDecl=CI;Rt.CDATA_START=zI;Rt.CDATA_END=jI;Rt.CDSect=VI;Rt.Char=Vo;Rt.Comment=uI;Rt.COMMENT_START=MA;Rt.COMMENT_END=FA;Rt.DOCTYPE_DECL_START=UI;Rt.elementdecl=gI;Rt.EntityDecl=MI;Rt.EntityValue=cy;Rt.ExternalID=Jm;Rt.ExternalID_match=SI;Rt.Name=Vn;Rt.NotationDecl=PI;Rt.Reference=Nd;Rt.PEReference=Md;Rt.PI=cI;Rt.PUBLIC=Qm;Rt.PubidLiteral=Zm;Rt.QName=Od;Rt.QName_exact=oI;Rt.QName_group=lI;Rt.S=se;Rt.SChar_s=tI;Rt.S_OPT=Ce;Rt.SYSTEM=uy;Rt.SystemLiteral=Fd;Rt.UNICODE_REPLACEMENT_CHARACTER=JD;Rt.UNICODE_SUPPORT=Pd;Rt.XMLDecl=BI});var by=Ut(je=>{"use strict";H();var Wn=Go(),Vr=Wn.find,qI=Wn.hasDefaultHTMLNamespace,Zc=Wn.hasOwn,WI=Wn.isHTMLMimeType,XI=Wn.isHTMLRawTextElement,YI=Wn.isHTMLVoidElement,Rd=Wn.MIME_TYPE,qr=Wn.NAMESPACE,ji=Symbol(),jA=kd(),Tt=jA.DOMException,KI=jA.DOMExceptionName,Gr=dy();function tn(r){if(r!==ji)throw new TypeError("Illegal constructor")}function ZI(r){return r!==""}function QI(r){return r?r.split(/[\t\n\f\r ]+/).filter(ZI):[]}function JI(r,t){return Zc(r,t)||(r[t]=!0),r}function OA(r){if(!r)return[];var t=QI(r);return Object.keys(t.reduce(JI,{}))}function tk(r){return function(t){return r&&r.indexOf(t)!==-1}}function HA(r){if(!Gr.QName_exact.test(r))throw new Tt(Tt.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+r+'"')}function my(r,t){HA(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 Tt(Tt.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(e==="xml"&&r!==Wn.NAMESPACE.XML)throw new Tt(Tt.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((e==="xmlns"||t==="xmlns")&&r!==Wn.NAMESPACE.XMLNS)throw new Tt(Tt.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(r===Wn.NAMESPACE.XMLNS&&e!=="xmlns"&&t!=="xmlns")throw new Tt(Tt.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[r,e,i]}function tu(r,t){for(var e in r)Zc(r,e)&&(t[e]=r[e])}function en(r,t){var e=r.prototype;if(!(e instanceof t)){let i=function(){};i.prototype=t.prototype,i=new i,tu(e,i),r.prototype=e=i}e.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),e.constructor=r)}var nn={},qn=nn.ELEMENT_NODE=1,Qc=nn.ATTRIBUTE_NODE=2,tg=nn.TEXT_NODE=3,GA=nn.CDATA_SECTION_NODE=4,$A=nn.ENTITY_REFERENCE_NODE=5,ek=nn.ENTITY_NODE=6,VA=nn.PROCESSING_INSTRUCTION_NODE=7,qA=nn.COMMENT_NODE=8,Bd=nn.DOCUMENT_NODE=9,WA=nn.DOCUMENT_TYPE_NODE=10,Pa=nn.DOCUMENT_FRAGMENT_NODE=11,ik=nn.NOTATION_NODE=12,Me=Wn.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 XA(r,t){if(t.length=0&&r=0){for(var n=t.length-1;i<=n;)t[i]=t[++i];if(t.length=n,r){var s=r.ownerDocument;s&&QA(s,r,e),e.ownerElement=null}}}Jc.prototype={length:0,item:ei.prototype.item,getNamedItem:function(r){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());for(var t=0;tRA(t.ownerDocument)?Me.DOCUMENT_POSITION_FOLLOWING:Me.DOCUMENT_POSITION_PRECEDING);if(n&&t===e)return Me.DOCUMENT_POSITION_CONTAINS+Me.DOCUMENT_POSITION_PRECEDING;if(i&&t===e)return Me.DOCUMENT_POSITION_CONTAINED_BY+Me.DOCUMENT_POSITION_FOLLOWING;for(var l=[],c=t.parentNode;c;){if(!n&&c===e)return Me.DOCUMENT_POSITION_CONTAINED_BY+Me.DOCUMENT_POSITION_FOLLOWING;l.push(c),c=c.parentNode}l.reverse();for(var u=[],h=e.parentNode;h;){if(!i&&h===t)return Me.DOCUMENT_POSITION_CONTAINS+Me.DOCUMENT_POSITION_PRECEDING;u.push(h),h=h.parentNode}u.reverse();var d=XA(l,u);for(var f in d.childNodes){var m=d.childNodes[f];if(m===e)return Me.DOCUMENT_POSITION_FOLLOWING;if(m===t)return Me.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(m)>=0)return Me.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(m)>=0)return Me.DOCUMENT_POSITION_PRECEDING}return 0}};function ZA(r){return r=="<"&&"<"||r==">"&&">"||r=="&"&&"&"||r=='"'&&"""||"&#"+r.charCodeAt()+";"}tu(nn,Vt);tu(nn,Vt.prototype);tu(Me,Vt);tu(Me,Vt.prototype);function Ld(r,t){if(t(r))return!0;if(r=r.firstChild)do if(Ld(r,t))return!0;while(r=r.nextSibling)}function _s(r,t){tn(r);var e=t||{};this.ownerDocument=this,this.contentType=e.contentType||Rd.XML_APPLICATION,this.type=WI(this.contentType)?"html":"xml"}function rk(r,t,e){r&&r._inc++;var i=e.namespaceURI;i===qr.XMLNS&&(t._nsMap[e.prefix?e.localName:""]=e.value)}function QA(r,t,e,i){r&&r._inc++;var n=e.namespaceURI;n===qr.XMLNS&&delete t._nsMap[e.prefix?e.localName:""]}function JA(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 tv(r,t){if(r!==t.parentNode)throw new Tt(Tt.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,JA(r.ownerDocument,r),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}function sk(r){return r&&(r.nodeType===Vt.DOCUMENT_NODE||r.nodeType===Vt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Vt.ELEMENT_NODE)}function ak(r){return r&&(r.nodeType===Vt.CDATA_SECTION_NODE||r.nodeType===Vt.COMMENT_NODE||r.nodeType===Vt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Vt.DOCUMENT_TYPE_NODE||r.nodeType===Vt.ELEMENT_NODE||r.nodeType===Vt.PROCESSING_INSTRUCTION_NODE||r.nodeType===Vt.TEXT_NODE)}function Oa(r){return r&&r.nodeType===Vt.DOCUMENT_TYPE_NODE}function ks(r){return r&&r.nodeType===Vt.ELEMENT_NODE}function ev(r){return r&&r.nodeType===Vt.TEXT_NODE}function BA(r,t){var e=r.childNodes||[];if(Vr(e,ks)||Oa(t))return!1;var i=Vr(e,Oa);return!(t&&i&&e.indexOf(i)>e.indexOf(t))}function UA(r,t){var e=r.childNodes||[];function i(s){return ks(s)&&s!==t}if(Vr(e,i))return!1;var n=Vr(e,Oa);return!(t&&n&&e.indexOf(n)>e.indexOf(t))}function ok(r,t,e){if(!sk(r))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+r.nodeType);if(e&&e.parentNode!==r)throw new Tt(Tt.NOT_FOUND_ERR,"child not in parent");if(!ak(t)||Oa(t)&&r.nodeType!==Vt.DOCUMENT_NODE)throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+r.nodeType)}function lk(r,t,e){var i=r.childNodes||[],n=t.childNodes||[];if(t.nodeType===Vt.DOCUMENT_FRAGMENT_NODE){var s=n.filter(ks);if(s.length>1||Vr(n,ev))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!BA(r,e))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ks(t)&&!BA(r,e))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Oa(t)){if(Vr(i,Oa))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Vr(i,ks);if(e&&i.indexOf(o)1||Vr(n,ev))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!UA(r,e))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(ks(t)&&!UA(r,e))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Oa(t)){if(Vr(i,function(c){return Oa(c)&&c!==e}))throw new Tt(Tt.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Vr(i,ks);if(e&&i.indexOf(o)")!==-1)throw new Tt(Tt.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new rg(ji);return t.ownerDocument=this,t.childNodes=new ei,t.appendData(r),t},createProcessingInstruction:function(r,t){var e=new og(ji);return e.ownerDocument=this,e.childNodes=new ei,e.nodeName=e.target=r,e.nodeValue=e.data=t,e},createAttribute:function(r){if(!Gr.QName_exact.test(r))throw new Tt(Tt.INVALID_CHARACTER_ERR,'invalid character in name "'+r+'"');return this.type==="html"&&(r=r.toLowerCase()),this._createAttribute(r)},_createAttribute:function(r){var t=new qo(ji);return t.ownerDocument=this,t.childNodes=new ei,t.name=r,t.nodeName=r,t.localName=r,t.specified=!0,t},createEntityReference:function(r){if(!Gr.Name.test(r))throw new Tt(Tt.INVALID_CHARACTER_ERR,'not a valid xml name "'+r+'"');if(this.type==="html")throw new Tt("document is an html document",KI.NotSupportedError);var t=new ag(ji);return t.ownerDocument=this,t.childNodes=new ei,t.nodeName=r,t},createElementNS:function(r,t){var e=my(r,t),i=new Ns(ji),n=i.attributes=new Jc;return i.childNodes=new ei,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=my(r,t),i=new qo(ji);return i.ownerDocument=this,i.childNodes=new ei,i.nodeName=t,i.name=t,i.specified=!0,i.namespaceURI=e[0],i.prefix=e[1],i.localName=e[2],i}};en(_s,Vt);function Ns(r){tn(r),this._nsMap=Object.create(null)}Ns.prototype={nodeType:qn,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===qr.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=my(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=OA(r);return new $r(this,function(e){var i=[];return t.length>0&&Ld(e,function(n){if(n!==e&&n.nodeType===qn){var s=n.getAttribute("class");if(s){var o=r===s;if(!o){var l=OA(s);o=t.every(tk(l))}o&&i.push(n)}}}),i})},getElementsByTagName:function(r){var t=(this.nodeType===Bd?this:this.ownerDocument).type==="html",e=r.toLowerCase();return new $r(this,function(i){var n=[];return Ld(i,function(s){if(!(s===i||s.nodeType!==qn))if(r==="*")n.push(s);else{var o=s.getQualifiedName(),l=t&&s.namespaceURI===qr.HTML?e:r;o===l&&n.push(s)}}),n})},getElementsByTagNameNS:function(r,t){return new $r(this,function(e){var i=[];return Ld(e,function(n){n!==e&&n.nodeType===qn&&(r==="*"||n.namespaceURI===r)&&(t==="*"||n.localName==t)&&i.push(n)}),i})}};_s.prototype.getElementsByClassName=Ns.prototype.getElementsByClassName;_s.prototype.getElementsByTagName=Ns.prototype.getElementsByTagName;_s.prototype.getElementsByTagNameNS=Ns.prototype.getElementsByTagNameNS;en(Ns,Vt);function qo(r){tn(r),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}qo.prototype.nodeType=Qc;en(qo,Vt);function eu(r){tn(r)}eu.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}};en(eu,Vt);function Ud(r){tn(r)}Ud.prototype={nodeName:"#text",nodeType:tg,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}};en(Ud,eu);function ng(r){tn(r)}ng.prototype={nodeName:"#comment",nodeType:qA};en(ng,eu);function rg(r){tn(r)}rg.prototype={nodeName:"#cdata-section",nodeType:GA};en(rg,Ud);function sg(r){tn(r)}sg.prototype.nodeType=WA;en(sg,Vt);function xy(r){tn(r)}xy.prototype.nodeType=ik;en(xy,Vt);function yy(r){tn(r)}yy.prototype.nodeType=ek;en(yy,Vt);function ag(r){tn(r)}ag.prototype.nodeType=$A;en(ag,Vt);function iu(r){tn(r)}iu.prototype.nodeName="#document-fragment";iu.prototype.nodeType=Pa;en(iu,Vt);function og(r){tn(r)}og.prototype.nodeType=VA;en(og,eu);function nv(){}nv.prototype.serializeToString=function(r,t){return rv.call(r,t)};Vt.prototype.toString=rv;function rv(r){var t=[],e=this.nodeType===Bd&&this.documentElement||this,i=e.prefix,n=e.namespaceURI;if(n&&i==null){var i=e.lookupPrefix(n);if(i==null)var s=[{namespace:n,prefix:null}]}return Kc(this,t,r,s),t.join("")}function zA(r,t,e){var i=r.prefix||"",n=r.namespaceURI;if(!n||i==="xml"&&n===qr.XML||n===qr.XMLNS)return!1;for(var s=e.length;s--;){var o=e[s];if(o.prefix===i)return o.namespace!==n}return!0}function fy(r,t,e){r.push(" ",t,'="',e.replace(/[<>&"\t\n\r]/g,ZA),'"')}function Kc(r,t,e,i){i||(i=[]);var n=r.nodeType===Bd?r:r.ownerDocument,s=n.type==="html";if(e)if(r=e(r),r){if(typeof r=="string"){t.push(r);return}}else return;switch(r.nodeType){case qn:var o=r.attributes,l=o.length,T=r.firstChild,c=r.tagName,u=c;if(!s&&!r.prefix&&r.namespaceURI){for(var h,d=0;d=0;f--){var m=i[f];if(m.prefix===""&&m.namespace===r.namespaceURI){h=m.namespace;break}}if(h!==r.namespaceURI)for(var f=i.length-1;f>=0;f--){var m=i[f];if(m.namespace===r.namespaceURI){m.prefix&&(u=m.prefix+":"+c);break}}}t.push("<",u);for(var y=0;y");else{if(t.push(">"),s&&XI(c))for(;T;)T.data?t.push(T.data):Kc(T,t,e,i.slice()),T=T.nextSibling;else for(;T;)Kc(T,t,e,i.slice()),T=T.nextSibling;t.push("")}return;case Bd:case Pa:for(var T=r.firstChild;T;)Kc(T,t,e,i.slice()),T=T.nextSibling;return;case Qc:return fy(t,r.name,r.value);case tg:return t.push(r.data.replace(/[<&>]/g,ZA));case GA:return t.push(Gr.CDATA_START,r.data.replace(/]]>/g,"]]]]>"),Gr.CDATA_END);case qA:return t.push(Gr.COMMENT_START,r.data,Gr.COMMENT_END);case WA:var k=r.publicId,N=r.systemId;t.push(Gr.DOCTYPE_DECL_START," ",r.name),k?(t.push(" ",Gr.PUBLIC," ",k),N&&N!=="."&&t.push(" ",N)):N&&N!=="."&&t.push(" ",Gr.SYSTEM," ",N),r.internalSubset&&t.push(" [",r.internalSubset,"]"),t.push(">");return;case VA:return t.push("");case $A:return t.push("&",r.nodeName,";");default:t.push("??",r.nodeName)}}function sv(r,t,e){var i;switch(t.nodeType){case qn:i=t.cloneNode(!1),i.ownerDocument=r;case Pa:break;case Qc:e=!0;break}if(i||(i=t.cloneNode(!1)),i.ownerDocument=r,i.parentNode=null,e)for(var n=t.firstChild;n;)i.appendChild(sv(r,n,e)),n=n.nextSibling;return i}function gy(r,t,e){var i=new t.constructor(ji);for(var n in t)if(Zc(t,n)){var s=t[n];typeof s!="object"&&s!=i[n]&&(i[n]=s)}switch(t.childNodes&&(i.childNodes=new ei),i.ownerDocument=r,i.nodeType){case qn:var o=t.attributes,l=i.attributes=new Jc,c=o.length;l._ownerElement=i;for(var u=0;u{"use strict";H();var ov=Go().freeze;zd.XML_ENTITIES=ov({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});zd.HTML_ENTITIES=ov({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:` -`,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"});zd.entityMap=zd.HTML_ENTITIES});var bv=Ut(cg=>{"use strict";H();var au=Go(),Ft=dy(),fv=kd(),ck=au.isHTMLEscapableRawTextElement,uk=au.isHTMLMimeType,hk=au.isHTMLRawTextElement,$d=au.hasOwn,cv=au.NAMESPACE,uv=fv.ParseError,dk=fv.DOMException,jd=0,Ra=1,nu=2,Hd=3,ru=4,su=5,Gd=6,lg=7;function pv(){}pv.prototype={parse:function(r,t,e){var i=this.domBuilder;i.startDocument(),mv(t,t=Object.create(null)),fk(r,t,e,i,this.errorHandler),i.endDocument()}};var wy=/&#?\w+;?/g;function fk(r,t,e,i,n){var s=uk(i.mimeType);r.indexOf(Ft.UNICODE_REPLACEMENT_CHARACTER)>=0&&n.warning("Unicode replacement character detected, source encoding issues?");function o(E){if(E>65535){E-=65536;var S=55296+(E>>10),I=56320+(E&1023);return String.fromCharCode(S,I)}else return String.fromCharCode(E)}function l(E){var S=E[E.length-1]===";"?E:E+";";if(!s&&S!==E)return n.error("EntityRef: expecting ;"),E;var I=Ft.Reference.exec(S);if(!I||I[0].length!==S.length)return n.error("entity not matching Reference production: "+E),E;var M=S.slice(1,-1);return $d(e,M)?e[M]:M.charAt(0)==="#"?o(parseInt(M.substring(1).replace("x","0x"))):(n.error("entity not found:"+E),E)}function c(E){if(E>A){var S=r.substring(A,E).replace(wy,l);f&&m(A),i.characters(S,0,E-A),A=E}}var u=0,h=0,d=/\r\n?|\n|$/g,f=i.locator;function m(E,S){for(;E>=h&&(S=d.exec(r));)u=h,h=S.index+S[0].length,f.lineNumber++;f.columnNumber=E-u+1}for(var y=[{currentNSMap:t}],g=[],A=0;;){try{var w=r.indexOf("<",A);if(w<0){if(!s&&g.length>0)return n.fatalError("unclosed xml tag(s): "+g.join(", "));if(!r.substring(A).match(/^\s*$/)){var v=i.doc,T=v.createTextNode(r.substring(A));if(v.documentElement)return n.error("Extra content at the end of the document");v.appendChild(T),i.currentElement=T}return}if(w>A){var k=r.substring(A,w);!s&&g.length===0&&(k=k.replace(new RegExp(Ft.S_OPT.source,"g"),""),k&&n.error("Unexpected content outside root element: '"+k+"'")),c(w)}switch(r.charAt(w+1)){case"/":var _=r.indexOf(">",w+2),N=r.substring(w+2,_>0?_:void 0);if(!N)return n.fatalError("end tag name missing");var F=_>0&&Ft.reg("^",Ft.QName_group,Ft.S_OPT,"$").exec(N);if(!F)return n.fatalError('end tag name contains invalid characters: "'+N+'"');if(!i.currentElement&&!i.doc.documentElement)return;var L=g[g.length-1]||i.currentElement.tagName||i.doc.documentElement.tagName||"";if(L!==F[1]){var Y=F[1].toLowerCase();if(!s||L.toLowerCase()!==Y)return n.fatalError('Opening and ending tag mismatch: "'+L+'" != "'+N+'"')}var q=y.pop();g.pop();var G=q.localNSMap;if(i.endElement(q.uri,q.localName,L),G)for(var j in G)$d(G,j)&&i.endPrefixMapping(j);_++;break;case"?":f&&m(w),_=xk(r,w,i,n);break;case"!":f&&m(w),_=xv(r,w,i,n,s);break;default:f&&m(w);var tt=new yv,et=y[y.length-1].currentNSMap,_=pk(r,w,tt,et,l,n,s),X=tt.length;if(tt.closed||(s&&au.isHTMLVoidElement(tt.tagName)?tt.closed=!0:g.push(tt.tagName)),f&&X){for(var O=hv(f,{}),C=0;CA?A=_:c(Math.max(w,A)+1)}}function hv(r,t){return t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber,t}function pk(r,t,e,i,n,s,o){function l(m,y,g){if($d(e.attributeNames,m))return s.fatalError("Attribute "+m+" redefined");if(!o&&y.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");e.addValue(m,y.replace(/[\t\n\r]/g," ").replace(wy,n),g)}for(var c,u,h=++t,d=jd;;){var f=r.charAt(h);switch(f){case"=":if(d===Ra)c=r.slice(t,h),d=Hd;else if(d===nu)d=Hd;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===Hd||d===Ra)if(d===Ra&&(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=su;else throw new Error("attribute value no end '"+f+"' match");else if(d==ru)u=r.slice(t,h),l(c,u,t),s.warning('attribute "'+c+'" missed start quot('+f+")!!"),t=h+1,d=su;else throw new Error('attribute value must after "="');break;case"/":switch(d){case jd:e.setTagName(r.slice(t,h));case su:case Gd:case lg:d=lg,e.closed=!0;case ru:case Ra:break;case nu:e.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==jd&&e.setTagName(r.slice(t,h)),h;case">":switch(d){case jd:e.setTagName(r.slice(t,h));case su:case Gd:case lg:break;case ru:case Ra:u=r.slice(t,h),u.slice(-1)==="/"&&(e.closed=!0,u=u.slice(0,-1));case nu:d===nu&&(u=c),d==ru?(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 Hd:if(!o)return s.fatalError(`AttValue: ' or " expected`)}return h;case"\x80":f=" ";default:if(f<=" ")switch(d){case jd:e.setTagName(r.slice(t,h)),d=Gd;break;case Ra:c=r.slice(t,h),d=nu;break;case ru:var u=r.slice(t,h);s.warning('attribute "'+u+'" missed quot(")!!'),l(c,u,t);case su:d=Gd;break}else switch(d){case nu:o||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),l(c,c,t),t=h,d=Ra;break;case su:s.warning('attribute space is required"'+c+'"!!');case Gd:d=Ra,t=h;break;case Hd:d=ru,t=h;break;case lg:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function dv(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),mv(e,e=Object.create(null))),e[h]=n[h]=l,s.uri=cv.XMLNS,t.startPrefixMapping(h,l))}for(var d=r.length;d--;)s=r[d],s.prefix&&(s.prefix==="xml"&&(s.uri=cv.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)$d(n,c)&&t.endPrefixMapping(c)}else return r.currentNSMap=e,r.localNSMap=n,!0}function mk(r,t,e,i,n){var s=ck(e);if(s||hk(e)){var o=r.indexOf("",t),l=r.substring(t+1,o);return s&&(l=l.replace(wy,i)),n.characters(l,0,l.length),o}return t+1}function mv(r,t){for(var e in r)$d(r,e)&&(t[e]=r[e])}function gv(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"?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 "0)return i.fatalError("processing instruction at position "+t+" is an xml declaration which is only at the start of the document");if(!Ft.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 yv(){this.attributeNames=Object.create(null)}yv.prototype={setTagName:function(r){if(!Ft.QName_exact.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,t,e){if(!Ft.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}};cg.XMLReader=pv;cg.parseUtils=gv;cg.parseDoctypeCommentOrCData=xv});var Sv=Ut(lu=>{"use strict";H();var Wo=Go(),yk=by(),bk=kd(),wv=lv(),wk=bv(),Ak=yk.DOMImplementation,vk=Wo.hasDefaultHTMLNamespace,Ek=Wo.isHTMLMimeType,Ck=Wo.isValidMimeType,Ev=Wo.MIME_TYPE,Ay=Wo.NAMESPACE,Av=bk.ParseError,Tk=wk.XMLReader;function Cv(r){return r.replace(/\r[\n\u0085]/g,` +var JS=Object.create;var $m=Object.defineProperty;var tD=Object.getOwnPropertyDescriptor;var eD=Object.getOwnPropertyNames;var iD=Object.getPrototypeOf,nD=Object.prototype.hasOwnProperty;var $w=r=>{throw TypeError(r)};var rD=(r,t,e)=>t in r?$m(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Vm=(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 Kt=(r,t)=>()=>(r&&(t=r(r=0)),t);var zt=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Hx=(r,t)=>{for(var e in t)$m(r,e,{get:t[e],enumerable:!0})},sD=(r,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of eD(t))!nD.call(r,n)&&n!==e&&$m(r,n,{get:()=>t[n],enumerable:!(i=tD(t,n))||i.enumerable});return r};var jc=(r,t,e)=>(e=r!=null?JS(iD(r)):{},sD(t||!r||!r.__esModule?$m(e,"default",{value:r,enumerable:!0}):e,r));var z=(r,t,e)=>rD(r,typeof t!="symbol"?t+"":t,e),Gx=(r,t,e)=>t.has(r)||$w("Cannot "+e);var a=(r,t,e)=>(Gx(r,t,"read from private field"),e?e.call(r):t.get(r)),x=(r,t,e)=>t.has(r)?$w("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(r):t.set(r,e),p=(r,t,e,i)=>(Gx(r,t,"write to private field"),i?i.call(r,e):t.set(r,e),e),b=(r,t,e)=>(Gx(r,t,"access private method"),e);var Ye=(r,t,e,i)=>({set _(n){p(r,t,n,e)},get _(){return a(r,t,i)}});var Ww=zt(qm=>{"use strict";H();qm.byteLength=oD;qm.toByteArray=cD;qm.fromByteArray=dD;var Ur=[],$n=[],aD=typeof Uint8Array<"u"?Uint8Array:Array,$x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Uo=0,Vw=$x.length;Uo0)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 oD(r){var t=qw(r),e=t[0],i=t[1];return(e+i)*3/4-i}function lD(r,t,e){return(t+e)*3/4-e}function cD(r){var t,e=qw(r),i=e[0],n=e[1],s=new aD(lD(r,i,n)),o=0,l=n>0?i-4:i,c;for(c=0;c>16&255,s[o++]=t>>8&255,s[o++]=t&255;return n===2&&(t=$n[r.charCodeAt(c)]<<2|$n[r.charCodeAt(c+1)]>>4,s[o++]=t&255),n===1&&(t=$n[r.charCodeAt(c)]<<10|$n[r.charCodeAt(c+1)]<<4|$n[r.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function uD(r){return Ur[r>>18&63]+Ur[r>>12&63]+Ur[r>>6&63]+Ur[r&63]}function hD(r,t,e){for(var i,n=[],s=t;sl?l:o+s));return i===1?(t=r[e-1],n.push(Ur[t>>2]+Ur[t<<4&63]+"==")):i===2&&(t=(r[e-2]<<8)+r[e-1],n.push(Ur[t>>10]+Ur[t>>4&63]+Ur[t<<2&63]+"=")),n.join("")}});var qx=zt(Vx=>{H();Vx.read=function(r,t,e,i,n){var s,o,l=n*8-i-1,c=(1<>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)};Vx.write=function(r,t,e,i,n,s){var o,l,c,u=s*8-n-1,h=(1<>1,f=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=i?0:s-1,y=i?1:-1,g=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+=y,l/=256,n-=8);for(o=o<0;r[e+m]=o&255,m+=y,o/=256,u-=8);r[e+m-y]|=g*128}});var uA=zt(Vc=>{"use strict";H();var Wx=Ww(),Gc=qx(),Xw=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Vc.Buffer=K;Vc.SlowBuffer=yD;Vc.INSPECT_MAX_BYTES=50;var Wm=2147483647;Vc.kMaxLength=Wm;K.TYPED_ARRAY_SUPPORT=fD();!K.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 fD(){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(K.prototype,"parent",{enumerable:!0,get:function(){if(K.isBuffer(this))return this.buffer}});Object.defineProperty(K.prototype,"offset",{enumerable:!0,get:function(){if(K.isBuffer(this))return this.byteOffset}});function Ss(r){if(r>Wm)throw new RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,K.prototype),t}function K(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 Zx(r)}return Qw(r,t,e)}K.poolSize=8192;function Qw(r,t,e){if(typeof r=="string")return mD(r,t);if(ArrayBuffer.isView(r))return gD(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(zr(r,ArrayBuffer)||r&&zr(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(zr(r,SharedArrayBuffer)||r&&zr(r.buffer,SharedArrayBuffer)))return Yx(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 K.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 K.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)}K.from=function(r,t,e){return Qw(r,t,e)};Object.setPrototypeOf(K.prototype,Uint8Array.prototype);Object.setPrototypeOf(K,Uint8Array);function Jw(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 pD(r,t,e){return Jw(r),r<=0?Ss(r):t!==void 0?typeof e=="string"?Ss(r).fill(t,e):Ss(r).fill(t):Ss(r)}K.alloc=function(r,t,e){return pD(r,t,e)};function Zx(r){return Jw(r),Ss(r<0?0:Qx(r)|0)}K.allocUnsafe=function(r){return Zx(r)};K.allocUnsafeSlow=function(r){return Zx(r)};function mD(r,t){if((typeof t!="string"||t==="")&&(t="utf8"),!K.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let e=tA(r,t)|0,i=Ss(e),n=i.write(r,t);return n!==e&&(i=i.slice(0,n)),i}function Xx(r){let t=r.length<0?0:Qx(r.length)|0,e=Ss(t);for(let i=0;i=Wm)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Wm.toString(16)+" bytes");return r|0}function yD(r){return+r!=r&&(r=0),K.alloc(+r)}K.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==K.prototype};K.compare=function(t,e){if(zr(t,Uint8Array)&&(t=K.from(t,t.offset,t.byteLength)),zr(e,Uint8Array)&&(e=K.from(e,e.offset,e.byteLength)),!K.isBuffer(t)||!K.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);sn.length?(K.isBuffer(o)||(o=K.from(o)),o.copy(n,s)):Uint8Array.prototype.set.call(n,o,s);else if(K.isBuffer(o))o.copy(n,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return n};function tA(r,t){if(K.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||zr(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 Kx(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return cA(r).length;default:if(n)return i?-1:Kx(r).length;t=(""+t).toLowerCase(),n=!0}}K.byteLength=tA;function bD(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 ID(this,t,e);case"utf8":case"utf-8":return iA(this,t,e);case"ascii":return DD(this,t,e);case"latin1":case"binary":return kD(this,t,e);case"base64":return TD(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ND(this,t,e);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}K.prototype._isBuffer=!0;function zo(r,t,e){let i=r[t];r[t]=r[e],r[e]=i}K.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;ee&&(t+=" ... "),""};Xw&&(K.prototype[Xw]=K.prototype.inspect);K.prototype.compare=function(t,e,i,n,s){if(zr(t,Uint8Array)&&(t=K.from(t,t.offset,t.byteLength)),!K.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;d2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,ty(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=K.from(t,i)),K.isBuffer(t))return t.length===0?-1:Yw(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):Yw(r,[t],e,i,n);throw new TypeError("val must be string, number or Buffer")}function Yw(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;uo&&(e=o-l),u=e;u>=0;u--){let h=!0;for(let d=0;dn&&(i=n)):i=n;let s=t.length;i>s/2&&(i=s/2);let o;for(o=0;o>>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 wD(this,t,e,i);case"utf8":case"utf-8":return AD(this,t,e,i);case"ascii":case"latin1":case"binary":return vD(this,t,e,i);case"base64":return ED(this,t,e,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return CD(this,t,e,i);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}};K.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function TD(r,t,e){return t===0&&e===r.length?Wx.fromByteArray(r):Wx.fromByteArray(r.slice(t,e))}function iA(r,t,e){e=Math.min(r.length,e);let i=[],n=t;for(;n239?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 SD(i)}var Kw=4096;function SD(r){let t=r.length;if(t<=Kw)return String.fromCharCode.apply(String,r);let e="",i=0;for(;ii)&&(e=i);let n="";for(let s=t;si&&(t=i),e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),ee)throw new RangeError("Trying to access beyond buffer length")}K.prototype.readUintLE=K.prototype.readUIntLE=function(t,e,i){t=t>>>0,e=e>>>0,i||ci(t,e,this.length);let n=this[t],s=1,o=0;for(;++o>>0,e=e>>>0,i||ci(t,e,this.length);let n=this[t+--e],s=1;for(;e>0&&(s*=256);)n+=this[t+--e]*s;return n};K.prototype.readUint8=K.prototype.readUInt8=function(t,e){return t=t>>>0,e||ci(t,1,this.length),this[t]};K.prototype.readUint16LE=K.prototype.readUInt16LE=function(t,e){return t=t>>>0,e||ci(t,2,this.length),this[t]|this[t+1]<<8};K.prototype.readUint16BE=K.prototype.readUInt16BE=function(t,e){return t=t>>>0,e||ci(t,2,this.length),this[t]<<8|this[t+1]};K.prototype.readUint32LE=K.prototype.readUInt32LE=function(t,e){return t=t>>>0,e||ci(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};K.prototype.readUint32BE=K.prototype.readUInt32BE=function(t,e){return t=t>>>0,e||ci(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};K.prototype.readBigUInt64LE=Fa(function(t){t=t>>>0,$c(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&vd(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)<>>0,$c(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&vd(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)<>>0,e=e>>>0,i||ci(t,e,this.length);let n=this[t],s=1,o=0;for(;++o=s&&(n-=Math.pow(2,8*e)),n};K.prototype.readIntBE=function(t,e,i){t=t>>>0,e=e>>>0,i||ci(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};K.prototype.readInt8=function(t,e){return t=t>>>0,e||ci(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};K.prototype.readInt16LE=function(t,e){t=t>>>0,e||ci(t,2,this.length);let i=this[t]|this[t+1]<<8;return i&32768?i|4294901760:i};K.prototype.readInt16BE=function(t,e){t=t>>>0,e||ci(t,2,this.length);let i=this[t+1]|this[t]<<8;return i&32768?i|4294901760:i};K.prototype.readInt32LE=function(t,e){return t=t>>>0,e||ci(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};K.prototype.readInt32BE=function(t,e){return t=t>>>0,e||ci(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};K.prototype.readBigInt64LE=Fa(function(t){t=t>>>0,$c(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&vd(t,this.length-8);let n=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(i<<24);return(BigInt(n)<>>0,$c(t,"offset");let e=this[t],i=this[t+7];(e===void 0||i===void 0)&&vd(t,this.length-8);let n=(e<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(n)<>>0,e||ci(t,4,this.length),Gc.read(this,t,!0,23,4)};K.prototype.readFloatBE=function(t,e){return t=t>>>0,e||ci(t,4,this.length),Gc.read(this,t,!1,23,4)};K.prototype.readDoubleLE=function(t,e){return t=t>>>0,e||ci(t,8,this.length),Gc.read(this,t,!0,52,8)};K.prototype.readDoubleBE=function(t,e){return t=t>>>0,e||ci(t,8,this.length),Gc.read(this,t,!1,52,8)};function Ji(r,t,e,i,n,s){if(!K.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||tr.length)throw new RangeError("Index out of range")}K.prototype.writeUintLE=K.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;Ji(this,t,e,i,l,0)}let s=1,o=0;for(this[e]=t&255;++o>>0,i=i>>>0,!n){let l=Math.pow(2,8*i)-1;Ji(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};K.prototype.writeUint8=K.prototype.writeUInt8=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,1,255,0),this[e]=t&255,e+1};K.prototype.writeUint16LE=K.prototype.writeUInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,65535,0),this[e]=t&255,this[e+1]=t>>>8,e+2};K.prototype.writeUint16BE=K.prototype.writeUInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=t&255,e+2};K.prototype.writeUint32LE=K.prototype.writeUInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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};K.prototype.writeUint32BE=K.prototype.writeUInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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 nA(r,t,e,i,n){lA(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 rA(r,t,e,i,n){lA(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}K.prototype.writeBigUInt64LE=Fa(function(t,e=0){return nA(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});K.prototype.writeBigUInt64BE=Fa(function(t,e=0){return rA(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))});K.prototype.writeIntLE=function(t,e,i,n){if(t=+t,e=e>>>0,!n){let c=Math.pow(2,8*i-1);Ji(this,t,e,i,c-1,-c)}let s=0,o=1,l=0;for(this[e]=t&255;++s>0)-l&255;return e+i};K.prototype.writeIntBE=function(t,e,i,n){if(t=+t,e=e>>>0,!n){let c=Math.pow(2,8*i-1);Ji(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};K.prototype.writeInt8=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=t&255,e+1};K.prototype.writeInt16LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,32767,-32768),this[e]=t&255,this[e+1]=t>>>8,e+2};K.prototype.writeInt16BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=t&255,e+2};K.prototype.writeInt32LE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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};K.prototype.writeInt32BE=function(t,e,i){return t=+t,e=e>>>0,i||Ji(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};K.prototype.writeBigInt64LE=Fa(function(t,e=0){return nA(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});K.prototype.writeBigInt64BE=Fa(function(t,e=0){return rA(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function sA(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 aA(r,t,e,i,n){return t=+t,e=e>>>0,n||sA(r,t,e,4,34028234663852886e22,-34028234663852886e22),Gc.write(r,t,e,i,23,4),e+4}K.prototype.writeFloatLE=function(t,e,i){return aA(this,t,e,!0,i)};K.prototype.writeFloatBE=function(t,e,i){return aA(this,t,e,!1,i)};function oA(r,t,e,i,n){return t=+t,e=e>>>0,n||sA(r,t,e,8,17976931348623157e292,-17976931348623157e292),Gc.write(r,t,e,i,52,8),e+8}K.prototype.writeDoubleLE=function(t,e,i){return oA(this,t,e,!0,i)};K.prototype.writeDoubleBE=function(t,e,i){return oA(this,t,e,!1,i)};K.prototype.copy=function(t,e,i,n){if(!K.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=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>>0,i=i===void 0?this.length:i>>>0,t||(t=0);let s;if(typeof t=="number")for(s=e;s2**32?n=Zw(String(e)):typeof e=="bigint"&&(n=String(e),(e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))&&(n=Zw(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i},RangeError);function Zw(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 _D(r,t,e){$c(t,"offset"),(r[t]===void 0||r[t+e]===void 0)&&vd(t,r.length-(e+1))}function lA(r,t,e,i,n,s){if(r>e||r3?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 Hc.ERR_OUT_OF_RANGE("value",l,r)}_D(i,n,s)}function $c(r,t){if(typeof r!="number")throw new Hc.ERR_INVALID_ARG_TYPE(t,"number",r)}function vd(r,t,e){throw Math.floor(r)!==r?($c(r,e),new Hc.ERR_OUT_OF_RANGE(e||"offset","an integer",r)):t<0?new Hc.ERR_BUFFER_OUT_OF_BOUNDS:new Hc.ERR_OUT_OF_RANGE(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}var MD=/[^+/0-9A-Za-z-_]/g;function FD(r){if(r=r.split("=")[0],r=r.trim().replace(MD,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Kx(r,t){t=t||1/0;let e,i=r.length,n=null,s=[];for(let o=0;o55295&&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 PD(r){let t=[];for(let e=0;e>8,n=e%256,s.push(n),s.push(i);return s}function cA(r){return Wx.toByteArray(FD(r))}function Xm(r,t,e,i){let n;for(n=0;n=t.length||n>=r.length);++n)t[n+e]=r[n];return n}function zr(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function ty(r){return r!==r}var RD=(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 Fa(r){return typeof BigInt>"u"?LD:r}function LD(){throw new Error("BigInt not supported")}});var mA=zt((qM,pA)=>{H();var ze=pA.exports={},jr,Hr;function ey(){throw new Error("setTimeout has not been defined")}function iy(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?jr=setTimeout:jr=ey}catch{jr=ey}try{typeof clearTimeout=="function"?Hr=clearTimeout:Hr=iy}catch{Hr=iy}})();function hA(r){if(jr===setTimeout)return setTimeout(r,0);if((jr===ey||!jr)&&setTimeout)return jr=setTimeout,setTimeout(r,0);try{return jr(r,0)}catch{try{return jr.call(null,r,0)}catch{return jr.call(this,r,0)}}}function BD(r){if(Hr===clearTimeout)return clearTimeout(r);if((Hr===iy||!Hr)&&clearTimeout)return Hr=clearTimeout,clearTimeout(r);try{return Hr(r)}catch{try{return Hr.call(null,r)}catch{return Hr.call(this,r)}}}var Ds=[],qc=!1,jo,Ym=-1;function UD(){!qc||!jo||(qc=!1,jo.length?Ds=jo.concat(Ds):Ym=-1,Ds.length&&dA())}function dA(){if(!qc){var r=hA(UD);qc=!0;for(var t=Ds.length;t;){for(jo=Ds,Ds=[];++Ym1)for(var e=1;e{"use strict";st=jc(uA()),it=jc(mA()),ny=[typeof globalThis<"u"?globalThis:null,typeof window<"u"?window:null,typeof self<"u"?self:null,typeof window<"u"?window:null].filter(Boolean);ny.forEach(r=>{r.Buffer||(r.Buffer=st.Buffer),r.process||(r.process=it.default)});typeof it.default<"u"&&!it.default.env&&(it.default.env={NODE_ENV:"production"});if(typeof ny[0]<"u"){let r=ny[0];r.util||(r.util={debuglog:()=>()=>{},inspect:t=>JSON.stringify(t)})}});var Go=zt(wi=>{"use strict";H();function jD(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-1}var KD=Xc({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/"});wi.assign=HD;wi.find=jD;wi.freeze=Xc;wi.HTML_BOOLEAN_ATTRIBUTES=xA;wi.HTML_RAW_TEXT_ELEMENTS=Ed;wi.HTML_VOID_ELEMENTS=yA;wi.hasDefaultHTMLNamespace=WD;wi.hasOwn=Ho;wi.isHTMLBooleanAttribute=GD;wi.isHTMLRawTextElement=VD;wi.isHTMLEscapableRawTextElement=qD;wi.isHTMLMimeType=bA;wi.isHTMLVoidElement=$D;wi.isValidMimeType=YD;wi.MIME_TYPE=Cd;wi.NAMESPACE=KD});var Id=zt(kd=>{"use strict";H();var ZD=Go();function AA(r,t){r.prototype=Object.create(Error.prototype,{constructor:{value:r},name:{value:r.name,enumerable:!0,writable:t}})}var Sd=ZD.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"}),vA=Object.keys(Sd);function EA(r){return typeof r=="number"&&r>=1&&r<=25}function QD(r){return typeof r=="string"&&r.substring(r.length-Sd.Error.length)===Sd.Error}function Dd(r,t){EA(r)?(this.name=vA[r],this.message=t||""):(this.message=r,this.name=QD(t)?t:Sd.Error),Error.captureStackTrace&&Error.captureStackTrace(this,Dd)}AA(Dd,!0);Object.defineProperties(Dd.prototype,{code:{enumerable:!0,get:function(){var r=vA.indexOf(this.name);return EA(r)?r:0}}});var CA={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},ry=Object.entries(CA);for(Td=0;Td{"use strict";H();function _A(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 Pd=_A();function $o(r){if(r.source[0]!=="[")throw new Error(r+" can not be used with chars");return r.source.slice(1,r.source.lastIndexOf("]"))}function Yc(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,""),Pd?"u":"")}function jt(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(""),Pd?"mu":"m")}function It(r){if(arguments.length===0)throw new Error("no parameters provided");return jt.apply(It,["(?:"].concat(Array.prototype.slice.call(arguments),[")"]))}var JD="\uFFFD",Vo=/[-\x09\x0A\x0D\x20-\x2C\x2E-\uD7FF\uE000-\uFFFD]/;Pd&&(Vo=jt("[",$o(Vo),"\\u{10000}-\\u{10FFFF}","]"));var oy=/[\x20\x09\x0D\x0A]/,tk=$o(oy),se=jt(oy,"+"),Ce=jt(oy,"*"),Nd=/[:_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;Pd&&(Nd=jt("[",$o(Nd),"\\u{10000}-\\u{10FFFF}","]"));var ek=$o(Nd),ly=jt("[",ek,$o(/[-.0-9\xB7]/),$o(/[\u0300-\u036F\u203F-\u2040]/),"]"),Vn=jt(Nd,ly,"*"),TA=jt(ly,"+"),ik=jt("&",Vn,";"),nk=It(/&#[0-9]+;|&#x[0-9a-fA-F]+;/),_d=It(ik,"|",nk),Md=jt("%",Vn,";"),cy=It(jt('"',It(/[^%&"]/,"|",Md,"|",_d),"*",'"'),"|",jt("'",It(/[^%&']/,"|",Md,"|",_d),"*","'")),rk=It('"',It(/[^<&"]/,"|",_d),"*",'"',"|","'",It(/[^<&']/,"|",_d),"*","'"),sk=Yc(Nd,":"),ak=Yc(ly,":"),SA=jt(sk,ak,"*"),Od=jt(SA,It(":",SA),"?"),ok=jt("^",Od,"$"),lk=jt("(",Od,")"),Fd=It(/"[^"]*"|'[^']*'/),ck=jt(/^<\?/,"(",Vn,")",It(se,"(",Vo,"*?)"),"?",/\?>/),DA=/[\x20\x0D\x0Aa-zA-Z0-9-'()+,./:=?;!*#@$_%]/,Zm=It('"',DA,'*"',"|","'",Yc(DA,"'"),"*'"),MA="",uk=jt(MA,It(Yc(Vo,"-"),"|",jt("-",Yc(Vo,"-"))),"*",FA),kA="#PCDATA",hk=It(jt(/\(/,Ce,kA,It(Ce,/\|/,Ce,Od),"*",Ce,/\)\*/),"|",jt(/\(/,Ce,kA,Ce,/\)/)),dk=/[?*+]?/,fk=jt(/\([^>]+\)/,dk),pk=It("EMPTY","|","ANY","|",hk,"|",fk),mk=""),xk=jt("NOTATION",se,/\(/,Ce,Vn,It(Ce,/\|/,Ce,Vn),"*",Ce,/\)/),yk=jt(/\(/,Ce,TA,It(Ce,/\|/,Ce,TA),"*",Ce,/\)/),bk=It(xk,"|",yk),wk=It(/CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS/,"|",bk),Ak=It(/#REQUIRED|#IMPLIED/,"|",It(It("#FIXED",se),"?",rk)),vk=It(se,Vn,se,wk,se,Ak),Ek=""),ay="about:legacy-compat",Tk=It('"'+ay+'"',"|","'"+ay+"'"),uy="SYSTEM",Qm="PUBLIC",Jm=It(It(uy,se,Fd),"|",It(Qm,se,Zm,se,Fd)),Sk=jt("^",It(It(uy,se,"(?",Fd,")"),"|",It(Qm,se,"(?",Zm,")",se,"(?",Fd,")"))),Dk=It(se,"NDATA",se,Vn),kk=It(cy,"|",It(Jm,Dk,"?")),PA=""),Nk=It(cy,"|",Jm),_k=jt(PA,se,"%",se,Vn,se,Nk,Ce,">"),Mk=It(Ik,"|",_k),Fk=jt(Qm,se,Zm),Pk=jt(""),hy=jt(Ce,"=",Ce),IA=/1[.]\d+/,Ok=jt(se,"version",hy,It("'",IA,"'","|",'"',IA,'"')),NA=/[A-Za-z][-A-Za-z0-9._]*/,Rk=It(se,"encoding",hy,It('"',NA,'"',"|","'",NA,"'")),Lk=It(se,"standalone",hy,It("'",It("yes","|","no"),"'","|",'"',It("yes","|","no"),'"')),Bk=jt(/^<\?xml/,Ok,Rk,"?",Lk,"?",Ce,/\?>/),Uk="",Hk=//,$k=jt(Vo,"*?",Gk),Vk=jt(Hk,$k);Bt.chars=$o;Bt.chars_without=Yc;Bt.detectUnicodeSupport=_A;Bt.reg=jt;Bt.regg=It;Bt.ABOUT_LEGACY_COMPAT=ay;Bt.ABOUT_LEGACY_COMPAT_SystemLiteral=Tk;Bt.AttlistDecl=Ck;Bt.CDATA_START=zk;Bt.CDATA_END=jk;Bt.CDSect=Vk;Bt.Char=Vo;Bt.Comment=uk;Bt.COMMENT_START=MA;Bt.COMMENT_END=FA;Bt.DOCTYPE_DECL_START=Uk;Bt.elementdecl=gk;Bt.EntityDecl=Mk;Bt.EntityValue=cy;Bt.ExternalID=Jm;Bt.ExternalID_match=Sk;Bt.Name=Vn;Bt.NotationDecl=Pk;Bt.Reference=_d;Bt.PEReference=Md;Bt.PI=ck;Bt.PUBLIC=Qm;Bt.PubidLiteral=Zm;Bt.QName=Od;Bt.QName_exact=ok;Bt.QName_group=lk;Bt.S=se;Bt.SChar_s=tk;Bt.S_OPT=Ce;Bt.SYSTEM=uy;Bt.SystemLiteral=Fd;Bt.UNICODE_REPLACEMENT_CHARACTER=JD;Bt.UNICODE_SUPPORT=Pd;Bt.XMLDecl=Bk});var by=zt(je=>{"use strict";H();var Wn=Go(),Vr=Wn.find,qk=Wn.hasDefaultHTMLNamespace,Zc=Wn.hasOwn,Wk=Wn.isHTMLMimeType,Xk=Wn.isHTMLRawTextElement,Yk=Wn.isHTMLVoidElement,Rd=Wn.MIME_TYPE,qr=Wn.NAMESPACE,ji=Symbol(),jA=Id(),St=jA.DOMException,Kk=jA.DOMExceptionName,Gr=dy();function tn(r){if(r!==ji)throw new TypeError("Illegal constructor")}function Zk(r){return r!==""}function Qk(r){return r?r.split(/[\t\n\f\r ]+/).filter(Zk):[]}function Jk(r,t){return Zc(r,t)||(r[t]=!0),r}function OA(r){if(!r)return[];var t=Qk(r);return Object.keys(t.reduce(Jk,{}))}function tI(r){return function(t){return r&&r.indexOf(t)!==-1}}function HA(r){if(!Gr.QName_exact.test(r))throw new St(St.INVALID_CHARACTER_ERR,'invalid character in qualified name "'+r+'"')}function my(r,t){HA(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 St(St.NAMESPACE_ERR,"prefix is non-null and namespace is null");if(e==="xml"&&r!==Wn.NAMESPACE.XML)throw new St(St.NAMESPACE_ERR,'prefix is "xml" and namespace is not the XML namespace');if((e==="xmlns"||t==="xmlns")&&r!==Wn.NAMESPACE.XMLNS)throw new St(St.NAMESPACE_ERR,'either qualifiedName or prefix is "xmlns" and namespace is not the XMLNS namespace');if(r===Wn.NAMESPACE.XMLNS&&e!=="xmlns"&&t!=="xmlns")throw new St(St.NAMESPACE_ERR,'namespace is the XMLNS namespace and neither qualifiedName nor prefix is "xmlns"');return[r,e,i]}function tu(r,t){for(var e in r)Zc(r,e)&&(t[e]=r[e])}function en(r,t){var e=r.prototype;if(!(e instanceof t)){let i=function(){};i.prototype=t.prototype,i=new i,tu(e,i),r.prototype=e=i}e.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),e.constructor=r)}var nn={},qn=nn.ELEMENT_NODE=1,Qc=nn.ATTRIBUTE_NODE=2,tg=nn.TEXT_NODE=3,GA=nn.CDATA_SECTION_NODE=4,$A=nn.ENTITY_REFERENCE_NODE=5,eI=nn.ENTITY_NODE=6,VA=nn.PROCESSING_INSTRUCTION_NODE=7,qA=nn.COMMENT_NODE=8,Bd=nn.DOCUMENT_NODE=9,WA=nn.DOCUMENT_TYPE_NODE=10,Pa=nn.DOCUMENT_FRAGMENT_NODE=11,iI=nn.NOTATION_NODE=12,Me=Wn.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 XA(r,t){if(t.length=0&&r=0){for(var n=t.length-1;i<=n;)t[i]=t[++i];if(t.length=n,r){var s=r.ownerDocument;s&&QA(s,r,e),e.ownerElement=null}}}Jc.prototype={length:0,item:ei.prototype.item,getNamedItem:function(r){this._ownerElement&&this._ownerElement._isInHTMLDocumentAndNamespace()&&(r=r.toLowerCase());for(var t=0;tRA(t.ownerDocument)?Me.DOCUMENT_POSITION_FOLLOWING:Me.DOCUMENT_POSITION_PRECEDING);if(n&&t===e)return Me.DOCUMENT_POSITION_CONTAINS+Me.DOCUMENT_POSITION_PRECEDING;if(i&&t===e)return Me.DOCUMENT_POSITION_CONTAINED_BY+Me.DOCUMENT_POSITION_FOLLOWING;for(var l=[],c=t.parentNode;c;){if(!n&&c===e)return Me.DOCUMENT_POSITION_CONTAINED_BY+Me.DOCUMENT_POSITION_FOLLOWING;l.push(c),c=c.parentNode}l.reverse();for(var u=[],h=e.parentNode;h;){if(!i&&h===t)return Me.DOCUMENT_POSITION_CONTAINS+Me.DOCUMENT_POSITION_PRECEDING;u.push(h),h=h.parentNode}u.reverse();var d=XA(l,u);for(var f in d.childNodes){var m=d.childNodes[f];if(m===e)return Me.DOCUMENT_POSITION_FOLLOWING;if(m===t)return Me.DOCUMENT_POSITION_PRECEDING;if(u.indexOf(m)>=0)return Me.DOCUMENT_POSITION_FOLLOWING;if(l.indexOf(m)>=0)return Me.DOCUMENT_POSITION_PRECEDING}return 0}};function ZA(r){return r=="<"&&"<"||r==">"&&">"||r=="&"&&"&"||r=='"'&&"""||"&#"+r.charCodeAt()+";"}tu(nn,Vt);tu(nn,Vt.prototype);tu(Me,Vt);tu(Me,Vt.prototype);function Ld(r,t){if(t(r))return!0;if(r=r.firstChild)do if(Ld(r,t))return!0;while(r=r.nextSibling)}function Ns(r,t){tn(r);var e=t||{};this.ownerDocument=this,this.contentType=e.contentType||Rd.XML_APPLICATION,this.type=Wk(this.contentType)?"html":"xml"}function rI(r,t,e){r&&r._inc++;var i=e.namespaceURI;i===qr.XMLNS&&(t._nsMap[e.prefix?e.localName:""]=e.value)}function QA(r,t,e,i){r&&r._inc++;var n=e.namespaceURI;n===qr.XMLNS&&delete t._nsMap[e.prefix?e.localName:""]}function JA(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 tv(r,t){if(r!==t.parentNode)throw new St(St.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,JA(r.ownerDocument,r),t.parentNode=null,t.previousSibling=null,t.nextSibling=null,t}function sI(r){return r&&(r.nodeType===Vt.DOCUMENT_NODE||r.nodeType===Vt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Vt.ELEMENT_NODE)}function aI(r){return r&&(r.nodeType===Vt.CDATA_SECTION_NODE||r.nodeType===Vt.COMMENT_NODE||r.nodeType===Vt.DOCUMENT_FRAGMENT_NODE||r.nodeType===Vt.DOCUMENT_TYPE_NODE||r.nodeType===Vt.ELEMENT_NODE||r.nodeType===Vt.PROCESSING_INSTRUCTION_NODE||r.nodeType===Vt.TEXT_NODE)}function Oa(r){return r&&r.nodeType===Vt.DOCUMENT_TYPE_NODE}function Is(r){return r&&r.nodeType===Vt.ELEMENT_NODE}function ev(r){return r&&r.nodeType===Vt.TEXT_NODE}function BA(r,t){var e=r.childNodes||[];if(Vr(e,Is)||Oa(t))return!1;var i=Vr(e,Oa);return!(t&&i&&e.indexOf(i)>e.indexOf(t))}function UA(r,t){var e=r.childNodes||[];function i(s){return Is(s)&&s!==t}if(Vr(e,i))return!1;var n=Vr(e,Oa);return!(t&&n&&e.indexOf(n)>e.indexOf(t))}function oI(r,t,e){if(!sI(r))throw new St(St.HIERARCHY_REQUEST_ERR,"Unexpected parent node type "+r.nodeType);if(e&&e.parentNode!==r)throw new St(St.NOT_FOUND_ERR,"child not in parent");if(!aI(t)||Oa(t)&&r.nodeType!==Vt.DOCUMENT_NODE)throw new St(St.HIERARCHY_REQUEST_ERR,"Unexpected node type "+t.nodeType+" for parent node type "+r.nodeType)}function lI(r,t,e){var i=r.childNodes||[],n=t.childNodes||[];if(t.nodeType===Vt.DOCUMENT_FRAGMENT_NODE){var s=n.filter(Is);if(s.length>1||Vr(n,ev))throw new St(St.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!BA(r,e))throw new St(St.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Is(t)&&!BA(r,e))throw new St(St.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Oa(t)){if(Vr(i,Oa))throw new St(St.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Vr(i,Is);if(e&&i.indexOf(o)1||Vr(n,ev))throw new St(St.HIERARCHY_REQUEST_ERR,"More than one element or text in fragment");if(s.length===1&&!UA(r,e))throw new St(St.HIERARCHY_REQUEST_ERR,"Element in fragment can not be inserted before doctype")}if(Is(t)&&!UA(r,e))throw new St(St.HIERARCHY_REQUEST_ERR,"Only one element can be added and only after doctype");if(Oa(t)){if(Vr(i,function(c){return Oa(c)&&c!==e}))throw new St(St.HIERARCHY_REQUEST_ERR,"Only one doctype is allowed");var o=Vr(i,Is);if(e&&i.indexOf(o)")!==-1)throw new St(St.INVALID_CHARACTER_ERR,'data contains "]]>"');var t=new rg(ji);return t.ownerDocument=this,t.childNodes=new ei,t.appendData(r),t},createProcessingInstruction:function(r,t){var e=new og(ji);return e.ownerDocument=this,e.childNodes=new ei,e.nodeName=e.target=r,e.nodeValue=e.data=t,e},createAttribute:function(r){if(!Gr.QName_exact.test(r))throw new St(St.INVALID_CHARACTER_ERR,'invalid character in name "'+r+'"');return this.type==="html"&&(r=r.toLowerCase()),this._createAttribute(r)},_createAttribute:function(r){var t=new qo(ji);return t.ownerDocument=this,t.childNodes=new ei,t.name=r,t.nodeName=r,t.localName=r,t.specified=!0,t},createEntityReference:function(r){if(!Gr.Name.test(r))throw new St(St.INVALID_CHARACTER_ERR,'not a valid xml name "'+r+'"');if(this.type==="html")throw new St("document is an html document",Kk.NotSupportedError);var t=new ag(ji);return t.ownerDocument=this,t.childNodes=new ei,t.nodeName=r,t},createElementNS:function(r,t){var e=my(r,t),i=new _s(ji),n=i.attributes=new Jc;return i.childNodes=new ei,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=my(r,t),i=new qo(ji);return i.ownerDocument=this,i.childNodes=new ei,i.nodeName=t,i.name=t,i.specified=!0,i.namespaceURI=e[0],i.prefix=e[1],i.localName=e[2],i}};en(Ns,Vt);function _s(r){tn(r),this._nsMap=Object.create(null)}_s.prototype={nodeType:qn,attributes:null,getQualifiedName:function(){return this.prefix?this.prefix+":"+this.localName:this.localName},_isInHTMLDocumentAndNamespace:function(){return this.ownerDocument.type==="html"&&this.namespaceURI===qr.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=my(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=OA(r);return new $r(this,function(e){var i=[];return t.length>0&&Ld(e,function(n){if(n!==e&&n.nodeType===qn){var s=n.getAttribute("class");if(s){var o=r===s;if(!o){var l=OA(s);o=t.every(tI(l))}o&&i.push(n)}}}),i})},getElementsByTagName:function(r){var t=(this.nodeType===Bd?this:this.ownerDocument).type==="html",e=r.toLowerCase();return new $r(this,function(i){var n=[];return Ld(i,function(s){if(!(s===i||s.nodeType!==qn))if(r==="*")n.push(s);else{var o=s.getQualifiedName(),l=t&&s.namespaceURI===qr.HTML?e:r;o===l&&n.push(s)}}),n})},getElementsByTagNameNS:function(r,t){return new $r(this,function(e){var i=[];return Ld(e,function(n){n!==e&&n.nodeType===qn&&(r==="*"||n.namespaceURI===r)&&(t==="*"||n.localName==t)&&i.push(n)}),i})}};Ns.prototype.getElementsByClassName=_s.prototype.getElementsByClassName;Ns.prototype.getElementsByTagName=_s.prototype.getElementsByTagName;Ns.prototype.getElementsByTagNameNS=_s.prototype.getElementsByTagNameNS;en(_s,Vt);function qo(r){tn(r),this.namespaceURI=null,this.prefix=null,this.ownerElement=null}qo.prototype.nodeType=Qc;en(qo,Vt);function eu(r){tn(r)}eu.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}};en(eu,Vt);function Ud(r){tn(r)}Ud.prototype={nodeName:"#text",nodeType:tg,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}};en(Ud,eu);function ng(r){tn(r)}ng.prototype={nodeName:"#comment",nodeType:qA};en(ng,eu);function rg(r){tn(r)}rg.prototype={nodeName:"#cdata-section",nodeType:GA};en(rg,Ud);function sg(r){tn(r)}sg.prototype.nodeType=WA;en(sg,Vt);function xy(r){tn(r)}xy.prototype.nodeType=iI;en(xy,Vt);function yy(r){tn(r)}yy.prototype.nodeType=eI;en(yy,Vt);function ag(r){tn(r)}ag.prototype.nodeType=$A;en(ag,Vt);function iu(r){tn(r)}iu.prototype.nodeName="#document-fragment";iu.prototype.nodeType=Pa;en(iu,Vt);function og(r){tn(r)}og.prototype.nodeType=VA;en(og,eu);function nv(){}nv.prototype.serializeToString=function(r,t){return rv.call(r,t)};Vt.prototype.toString=rv;function rv(r){var t=[],e=this.nodeType===Bd&&this.documentElement||this,i=e.prefix,n=e.namespaceURI;if(n&&i==null){var i=e.lookupPrefix(n);if(i==null)var s=[{namespace:n,prefix:null}]}return Kc(this,t,r,s),t.join("")}function zA(r,t,e){var i=r.prefix||"",n=r.namespaceURI;if(!n||i==="xml"&&n===qr.XML||n===qr.XMLNS)return!1;for(var s=e.length;s--;){var o=e[s];if(o.prefix===i)return o.namespace!==n}return!0}function fy(r,t,e){r.push(" ",t,'="',e.replace(/[<>&"\t\n\r]/g,ZA),'"')}function Kc(r,t,e,i){i||(i=[]);var n=r.nodeType===Bd?r:r.ownerDocument,s=n.type==="html";if(e)if(r=e(r),r){if(typeof r=="string"){t.push(r);return}}else return;switch(r.nodeType){case qn:var o=r.attributes,l=o.length,T=r.firstChild,c=r.tagName,u=c;if(!s&&!r.prefix&&r.namespaceURI){for(var h,d=0;d=0;f--){var m=i[f];if(m.prefix===""&&m.namespace===r.namespaceURI){h=m.namespace;break}}if(h!==r.namespaceURI)for(var f=i.length-1;f>=0;f--){var m=i[f];if(m.namespace===r.namespaceURI){m.prefix&&(u=m.prefix+":"+c);break}}}t.push("<",u);for(var y=0;y");else{if(t.push(">"),s&&Xk(c))for(;T;)T.data?t.push(T.data):Kc(T,t,e,i.slice()),T=T.nextSibling;else for(;T;)Kc(T,t,e,i.slice()),T=T.nextSibling;t.push("")}return;case Bd:case Pa:for(var T=r.firstChild;T;)Kc(T,t,e,i.slice()),T=T.nextSibling;return;case Qc:return fy(t,r.name,r.value);case tg:return t.push(r.data.replace(/[<&>]/g,ZA));case GA:return t.push(Gr.CDATA_START,r.data.replace(/]]>/g,"]]]]>"),Gr.CDATA_END);case qA:return t.push(Gr.COMMENT_START,r.data,Gr.COMMENT_END);case WA:var I=r.publicId,_=r.systemId;t.push(Gr.DOCTYPE_DECL_START," ",r.name),I?(t.push(" ",Gr.PUBLIC," ",I),_&&_!=="."&&t.push(" ",_)):_&&_!=="."&&t.push(" ",Gr.SYSTEM," ",_),r.internalSubset&&t.push(" [",r.internalSubset,"]"),t.push(">");return;case VA:return t.push("");case $A:return t.push("&",r.nodeName,";");default:t.push("??",r.nodeName)}}function sv(r,t,e){var i;switch(t.nodeType){case qn:i=t.cloneNode(!1),i.ownerDocument=r;case Pa:break;case Qc:e=!0;break}if(i||(i=t.cloneNode(!1)),i.ownerDocument=r,i.parentNode=null,e)for(var n=t.firstChild;n;)i.appendChild(sv(r,n,e)),n=n.nextSibling;return i}function gy(r,t,e){var i=new t.constructor(ji);for(var n in t)if(Zc(t,n)){var s=t[n];typeof s!="object"&&s!=i[n]&&(i[n]=s)}switch(t.childNodes&&(i.childNodes=new ei),i.ownerDocument=r,i.nodeType){case qn:var o=t.attributes,l=i.attributes=new Jc,c=o.length;l._ownerElement=i;for(var u=0;u{"use strict";H();var ov=Go().freeze;zd.XML_ENTITIES=ov({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'});zd.HTML_ENTITIES=ov({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:` +`,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"});zd.entityMap=zd.HTML_ENTITIES});var bv=zt(cg=>{"use strict";H();var au=Go(),Ot=dy(),fv=Id(),cI=au.isHTMLEscapableRawTextElement,uI=au.isHTMLMimeType,hI=au.isHTMLRawTextElement,$d=au.hasOwn,cv=au.NAMESPACE,uv=fv.ParseError,dI=fv.DOMException,jd=0,Ra=1,nu=2,Hd=3,ru=4,su=5,Gd=6,lg=7;function pv(){}pv.prototype={parse:function(r,t,e){var i=this.domBuilder;i.startDocument(),mv(t,t=Object.create(null)),fI(r,t,e,i,this.errorHandler),i.endDocument()}};var wy=/&#?\w+;?/g;function fI(r,t,e,i,n){var s=uI(i.mimeType);r.indexOf(Ot.UNICODE_REPLACEMENT_CHARACTER)>=0&&n.warning("Unicode replacement character detected, source encoding issues?");function o(E){if(E>65535){E-=65536;var S=55296+(E>>10),k=56320+(E&1023);return String.fromCharCode(S,k)}else return String.fromCharCode(E)}function l(E){var S=E[E.length-1]===";"?E:E+";";if(!s&&S!==E)return n.error("EntityRef: expecting ;"),E;var k=Ot.Reference.exec(S);if(!k||k[0].length!==S.length)return n.error("entity not matching Reference production: "+E),E;var M=S.slice(1,-1);return $d(e,M)?e[M]:M.charAt(0)==="#"?o(parseInt(M.substring(1).replace("x","0x"))):(n.error("entity not found:"+E),E)}function c(E){if(E>A){var S=r.substring(A,E).replace(wy,l);f&&m(A),i.characters(S,0,E-A),A=E}}var u=0,h=0,d=/\r\n?|\n|$/g,f=i.locator;function m(E,S){for(;E>=h&&(S=d.exec(r));)u=h,h=S.index+S[0].length,f.lineNumber++;f.columnNumber=E-u+1}for(var y=[{currentNSMap:t}],g=[],A=0;;){try{var w=r.indexOf("<",A);if(w<0){if(!s&&g.length>0)return n.fatalError("unclosed xml tag(s): "+g.join(", "));if(!r.substring(A).match(/^\s*$/)){var v=i.doc,T=v.createTextNode(r.substring(A));if(v.documentElement)return n.error("Extra content at the end of the document");v.appendChild(T),i.currentElement=T}return}if(w>A){var I=r.substring(A,w);!s&&g.length===0&&(I=I.replace(new RegExp(Ot.S_OPT.source,"g"),""),I&&n.error("Unexpected content outside root element: '"+I+"'")),c(w)}switch(r.charAt(w+1)){case"/":var N=r.indexOf(">",w+2),_=r.substring(w+2,N>0?N:void 0);if(!_)return n.fatalError("end tag name missing");var F=N>0&&Ot.reg("^",Ot.QName_group,Ot.S_OPT,"$").exec(_);if(!F)return n.fatalError('end tag name contains invalid characters: "'+_+'"');if(!i.currentElement&&!i.doc.documentElement)return;var L=g[g.length-1]||i.currentElement.tagName||i.doc.documentElement.tagName||"";if(L!==F[1]){var Y=F[1].toLowerCase();if(!s||L.toLowerCase()!==Y)return n.fatalError('Opening and ending tag mismatch: "'+L+'" != "'+_+'"')}var q=y.pop();g.pop();var G=q.localNSMap;if(i.endElement(q.uri,q.localName,L),G)for(var j in G)$d(G,j)&&i.endPrefixMapping(j);N++;break;case"?":f&&m(w),N=xI(r,w,i,n);break;case"!":f&&m(w),N=xv(r,w,i,n,s);break;default:f&&m(w);var J=new yv,et=y[y.length-1].currentNSMap,N=pI(r,w,J,et,l,n,s),X=J.length;if(J.closed||(s&&au.isHTMLVoidElement(J.tagName)?J.closed=!0:g.push(J.tagName)),f&&X){for(var O=hv(f,{}),C=0;CA?A=N:c(Math.max(w,A)+1)}}function hv(r,t){return t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber,t}function pI(r,t,e,i,n,s,o){function l(m,y,g){if($d(e.attributeNames,m))return s.fatalError("Attribute "+m+" redefined");if(!o&&y.indexOf("<")>=0)return s.fatalError("Unescaped '<' not allowed in attributes values");e.addValue(m,y.replace(/[\t\n\r]/g," ").replace(wy,n),g)}for(var c,u,h=++t,d=jd;;){var f=r.charAt(h);switch(f){case"=":if(d===Ra)c=r.slice(t,h),d=Hd;else if(d===nu)d=Hd;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(d===Hd||d===Ra)if(d===Ra&&(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=su;else throw new Error("attribute value no end '"+f+"' match");else if(d==ru)u=r.slice(t,h),l(c,u,t),s.warning('attribute "'+c+'" missed start quot('+f+")!!"),t=h+1,d=su;else throw new Error('attribute value must after "="');break;case"/":switch(d){case jd:e.setTagName(r.slice(t,h));case su:case Gd:case lg:d=lg,e.closed=!0;case ru:case Ra:break;case nu:e.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),d==jd&&e.setTagName(r.slice(t,h)),h;case">":switch(d){case jd:e.setTagName(r.slice(t,h));case su:case Gd:case lg:break;case ru:case Ra:u=r.slice(t,h),u.slice(-1)==="/"&&(e.closed=!0,u=u.slice(0,-1));case nu:d===nu&&(u=c),d==ru?(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 Hd:if(!o)return s.fatalError(`AttValue: ' or " expected`)}return h;case"\x80":f=" ";default:if(f<=" ")switch(d){case jd:e.setTagName(r.slice(t,h)),d=Gd;break;case Ra:c=r.slice(t,h),d=nu;break;case ru:var u=r.slice(t,h);s.warning('attribute "'+u+'" missed quot(")!!'),l(c,u,t);case su:d=Gd;break}else switch(d){case nu:o||s.warning('attribute "'+c+'" missed value!! "'+c+'" instead2!!'),l(c,c,t),t=h,d=Ra;break;case su:s.warning('attribute space is required"'+c+'"!!');case Gd:d=Ra,t=h;break;case Hd:d=ru,t=h;break;case lg:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function dv(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),mv(e,e=Object.create(null))),e[h]=n[h]=l,s.uri=cv.XMLNS,t.startPrefixMapping(h,l))}for(var d=r.length;d--;)s=r[d],s.prefix&&(s.prefix==="xml"&&(s.uri=cv.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)$d(n,c)&&t.endPrefixMapping(c)}else return r.currentNSMap=e,r.localNSMap=n,!0}function mI(r,t,e,i,n){var s=cI(e);if(s||hI(e)){var o=r.indexOf("",t),l=r.substring(t+1,o);return s&&(l=l.replace(wy,i)),n.characters(l,0,l.length),o}return t+1}function mv(r,t){for(var e in r)$d(r,e)&&(t[e]=r[e])}function gv(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"?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 "0)return i.fatalError("processing instruction at position "+t+" is an xml declaration which is only at the start of the document");if(!Ot.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 yv(){this.attributeNames=Object.create(null)}yv.prototype={setTagName:function(r){if(!Ot.QName_exact.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,t,e){if(!Ot.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}};cg.XMLReader=pv;cg.parseUtils=gv;cg.parseDoctypeCommentOrCData=xv});var Sv=zt(lu=>{"use strict";H();var Wo=Go(),yI=by(),bI=Id(),wv=lv(),wI=bv(),AI=yI.DOMImplementation,vI=Wo.hasDefaultHTMLNamespace,EI=Wo.isHTMLMimeType,CI=Wo.isValidMimeType,Ev=Wo.MIME_TYPE,Ay=Wo.NAMESPACE,Av=bI.ParseError,TI=wI.XMLReader;function Cv(r){return r.replace(/\r[\n\u0085]/g,` `).replace(/[\r\u0085\u2028\u2029]/g,` -`)}function Tv(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||Wo.assign,this.domHandler=r.domHandler||hg,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||Cv,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}Tv.prototype.parseFromString=function(r,t){if(!Ck(t))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+t+'" is not valid.');var e=this.assign(Object.create(null),this.xmlns),i=wv.XML_ENTITIES,n=e[""]||null;vk(t)?(i=wv.HTML_ENTITIES,n=Ay.HTML):t===Ev.XML_SVG_IMAGE&&(n=Ay.SVG),e[""]=n,e.xml=e.xml||Ay.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 Tk;l.errorHandler=s,l.domBuilder=s;var c=!Wo.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 hg(r){var t=r||{};this.mimeType=t.mimeType||Ev.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 ou(r,t){t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber}hg.prototype={startDocument:function(){var r=new Ak;this.doc=Ek(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;ug(this,s),this.currentElement=s,this.locator&&ou(this.locator,s);for(var l=0;l=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){hg.prototype[r]=function(){return null}});function ug(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}function Dk(r){if(r==="error")throw"onErrorStopParsing"}function Ik(){throw"onWarningStopParsing"}lu.__DOMHandler=hg;lu.DOMParser=Tv;lu.normalizeLineEndings=Cv;lu.onErrorStopParsing=Dk;lu.onWarningStopParsing=Ik});var Dv=Ut(qt=>{"use strict";H();var cu=Go();qt.assign=cu.assign;qt.hasDefaultHTMLNamespace=cu.hasDefaultHTMLNamespace;qt.isHTMLMimeType=cu.isHTMLMimeType;qt.isValidMimeType=cu.isValidMimeType;qt.MIME_TYPE=cu.MIME_TYPE;qt.NAMESPACE=cu.NAMESPACE;var dg=kd();qt.DOMException=dg.DOMException;qt.DOMExceptionName=dg.DOMExceptionName;qt.ExceptionCode=dg.ExceptionCode;qt.ParseError=dg.ParseError;var ii=by();qt.Attr=ii.Attr;qt.CDATASection=ii.CDATASection;qt.CharacterData=ii.CharacterData;qt.Comment=ii.Comment;qt.Document=ii.Document;qt.DocumentFragment=ii.DocumentFragment;qt.DocumentType=ii.DocumentType;qt.DOMImplementation=ii.DOMImplementation;qt.Element=ii.Element;qt.Entity=ii.Entity;qt.EntityReference=ii.EntityReference;qt.LiveNodeList=ii.LiveNodeList;qt.NamedNodeMap=ii.NamedNodeMap;qt.Node=ii.Node;qt.NodeList=ii.NodeList;qt.Notation=ii.Notation;qt.ProcessingInstruction=ii.ProcessingInstruction;qt.Text=ii.Text;qt.XMLSerializer=ii.XMLSerializer;var fg=Sv();qt.DOMParser=fg.DOMParser;qt.normalizeLineEndings=fg.normalizeLineEndings;qt.onErrorStopParsing=fg.onErrorStopParsing;qt.onWarningStopParsing=fg.onWarningStopParsing});var _v=Ut((DF,Ey)=>{H();var vy=(function(r){"use strict";var t=Object.prototype,e=t.hasOwnProperty,i=Object.defineProperty||function(C,D,E){C[D]=E.value},n,s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function u(C,D,E){return Object.defineProperty(C,D,{value:E,enumerable:!0,configurable:!0,writable:!0}),C[D]}try{u({},"")}catch{u=function(D,E,S){return D[E]=S}}function h(C,D,E,S){var I=D&&D.prototype instanceof w?D:w,M=Object.create(I.prototype),P=new _(S||[]);return i(M,"_invoke",{value:G(C,E,P)}),M}r.wrap=h;function d(C,D,E){try{return{type:"normal",arg:C.call(D,E)}}catch(S){return{type:"throw",arg:S}}}var f="suspendedStart",m="suspendedYield",y="executing",g="completed",A={};function w(){}function v(){}function T(){}var k={};u(k,o,function(){return this});var N=Object.getPrototypeOf,F=N&&N(N(X([])));F&&F!==t&&e.call(F,o)&&(k=F);var L=T.prototype=w.prototype=Object.create(k);v.prototype=T,i(L,"constructor",{value:T,configurable:!0}),i(T,"constructor",{value:v,configurable:!0}),v.displayName=u(T,c,"GeneratorFunction");function Y(C){["next","throw","return"].forEach(function(D){u(C,D,function(E){return this._invoke(D,E)})})}r.isGeneratorFunction=function(C){var D=typeof C=="function"&&C.constructor;return D?D===v||(D.displayName||D.name)==="GeneratorFunction":!1},r.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,T):(C.__proto__=T,u(C,c,"GeneratorFunction")),C.prototype=Object.create(L),C},r.awrap=function(C){return{__await:C}};function q(C,D){function E(M,P,B,$){var U=d(C[M],C,P);if(U.type==="throw")$(U.arg);else{var V=U.arg,Z=V.value;return Z&&typeof Z=="object"&&e.call(Z,"__await")?D.resolve(Z.__await).then(function(Q){E("next",Q,B,$)},function(Q){E("throw",Q,B,$)}):D.resolve(Z).then(function(Q){V.value=Q,B(V)},function(Q){return E("throw",Q,B,$)})}}var S;function I(M,P){function B(){return new D(function($,U){E(M,P,$,U)})}return S=S?S.then(B,B):B()}i(this,"_invoke",{value:I})}Y(q.prototype),u(q.prototype,l,function(){return this}),r.AsyncIterator=q,r.async=function(C,D,E,S,I){I===void 0&&(I=Promise);var M=new q(h(C,D,E,S),I);return r.isGeneratorFunction(D)?M:M.next().then(function(P){return P.done?P.value:M.next()})};function G(C,D,E){var S=f;return function(M,P){if(S===y)throw new Error("Generator is already running");if(S===g){if(M==="throw")throw P;return O()}for(E.method=M,E.arg=P;;){var B=E.delegate;if(B){var $=j(B,E);if($){if($===A)continue;return $}}if(E.method==="next")E.sent=E._sent=E.arg;else if(E.method==="throw"){if(S===f)throw S=g,E.arg;E.dispatchException(E.arg)}else E.method==="return"&&E.abrupt("return",E.arg);S=y;var U=d(C,D,E);if(U.type==="normal"){if(S=E.done?g:m,U.arg===A)continue;return{value:U.arg,done:E.done}}else U.type==="throw"&&(S=g,E.method="throw",E.arg=U.arg)}}}function j(C,D){var E=D.method,S=C.iterator[E];if(S===n)return D.delegate=null,E==="throw"&&C.iterator.return&&(D.method="return",D.arg=n,j(C,D),D.method==="throw")||E!=="return"&&(D.method="throw",D.arg=new TypeError("The iterator does not provide a '"+E+"' method")),A;var I=d(S,C.iterator,D.arg);if(I.type==="throw")return D.method="throw",D.arg=I.arg,D.delegate=null,A;var M=I.arg;if(!M)return D.method="throw",D.arg=new TypeError("iterator result is not an object"),D.delegate=null,A;if(M.done)D[C.resultName]=M.value,D.next=C.nextLoc,D.method!=="return"&&(D.method="next",D.arg=n);else return M;return D.delegate=null,A}Y(L),u(L,c,"Generator"),u(L,o,function(){return this}),u(L,"toString",function(){return"[object Generator]"});function tt(C){var D={tryLoc:C[0]};1 in C&&(D.catchLoc=C[1]),2 in C&&(D.finallyLoc=C[2],D.afterLoc=C[3]),this.tryEntries.push(D)}function et(C){var D=C.completion||{};D.type="normal",delete D.arg,C.completion=D}function _(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(tt,this),this.reset(!0)}r.keys=function(C){var D=Object(C),E=[];for(var S in D)E.push(S);return E.reverse(),function I(){for(;E.length;){var M=E.pop();if(M in D)return I.value=M,I.done=!1,I}return I.done=!0,I}};function X(C){if(C){var D=C[o];if(D)return D.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var E=-1,S=function I(){for(;++E=0;--S){var I=this.tryEntries[S],M=I.completion;if(I.tryLoc==="root")return E("end");if(I.tryLoc<=this.prev){var P=e.call(I,"catchLoc"),B=e.call(I,"finallyLoc");if(P&&B){if(this.prev=0;--E){var S=this.tryEntries[E];if(S.tryLoc<=this.prev&&e.call(S,"finallyLoc")&&this.prev=0;--D){var E=this.tryEntries[D];if(E.finallyLoc===C)return this.complete(E.completion,E.afterLoc),et(E),A}},catch:function(C){for(var D=this.tryEntries.length-1;D>=0;--D){var E=this.tryEntries[D];if(E.tryLoc===C){var S=E.completion;if(S.type==="throw"){var I=S.arg;et(E)}return I}}throw new Error("illegal catch attempt")},delegateYield:function(C,D,E){return this.delegate={iterator:X(C),resultName:D,nextLoc:E},this.method==="next"&&(this.arg=n),A}},r})(typeof Ey=="object"?Ey.exports:{});try{regeneratorRuntime=vy}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=vy:Function("r","regeneratorRuntime = r")(vy)}});var gg=Ut((kF,Nv)=>{"use strict";H();Nv.exports=(r,t)=>`${r}-${t}-${Math.random().toString(16).slice(3,8)}`});var Cy=Ut((NF,Fv)=>{"use strict";H();var Rk=gg(),Mv=0;Fv.exports=({id:r,action:t,payload:e={}})=>{let i=r;return typeof i>"u"&&(i=Rk("Job",Mv),Mv+=1),{id:i,action:t,payload:e}}});var xg=Ut(qd=>{"use strict";H();var Ty=!1;qd.logging=Ty;qd.setLogging=r=>{Ty=r};qd.log=(...r)=>Ty?console.log.apply(qd,r):null});var Lv=Ut((Ov,Rv)=>{"use strict";H();var Lk=Cy(),{log:yg}=xg(),Bk=gg(),Pv=0;Rv.exports=()=>{let r=Bk("Scheduler",Pv),t={},e={},i=[];Pv+=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"u"){i[0](t[d[f]]);break}}},l=(d,f)=>new Promise((m,y)=>{let g=Lk({action:d,payload:f});i.push(async A=>{i.shift(),e[A.id]=g;try{m(await A[d].apply(Ov,[...f,g.id]))}catch(w){y(w)}finally{delete e[A.id],o()}}),yg(`[${r}]: Add ${g.id} to JobQueue`),yg(`[${r}]: JobQueue length=${i.length}`),o()});return{addWorker:d=>(t[d.id]=d,yg(`[${r}]: Add ${d.id}`),yg(`[${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 Uv=Ut((RF,Bv)=>{"use strict";H();Bv.exports=r=>{let t={};return typeof WorkerGlobalScope<"u"?t.type="webworker":typeof document=="object"?t.type="browser":typeof it.default=="object"&&typeof Vm=="function"&&(t.type="node"),typeof r>"u"?t:t[r]}});var jv=Ut((UF,zv)=>{"use strict";H();var Uk=Uv()("type")==="browser",zk=Uk?r=>new URL(r,window.location.href).href:r=>r;zv.exports=r=>{let t={...r};return["corePath","workerPath","langPath"].forEach(e=>{r[e]&&(t[e]=zk(t[e]))}),t}});var Sy=Ut((jF,Hv)=>{"use strict";H();Hv.exports={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}});var Gv=Ut((GF,jk)=>{jk.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 Vv=Ut(($F,$v)=>{"use strict";H();$v.exports={workerBlobURL:!0,logger:()=>{}}});var Wv=Ut((qF,qv)=>{"use strict";H();var Hk=Gv().version,Gk=Vv();qv.exports={...Gk,workerPath:`https://cdn.jsdelivr.net/npm/tesseract.js@v${Hk}/dist/worker.min.js`}});var Yv=Ut((XF,Xv)=>{"use strict";H();Xv.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 Zv=Ut((KF,Kv)=>{"use strict";H();Kv.exports=r=>{r.terminate()}});var Jv=Ut((QF,Qv)=>{"use strict";H();Qv.exports=(r,t)=>{r.onmessage=({data:e})=>{t(e)}}});var eE=Ut((tP,tE)=>{"use strict";H();tE.exports=async(r,t)=>{r.postMessage(t)}});var nE=Ut((iP,iE)=>{"use strict";H();var Dy=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)}),Iy=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 Iy(r.src)),r.tagName==="VIDEO"&&(t=await Iy(r.poster)),r.tagName==="CANVAS"&&await new Promise(e=>{r.toBlob(async i=>{t=await Dy(i),e()})});else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas){let e=await r.convertToBlob();t=await Dy(e)}else(r instanceof File||r instanceof Blob)&&(t=await Dy(r));return new Uint8Array(t)};iE.exports=Iy});var sE=Ut((rP,rE)=>{"use strict";H();var $k=Wv(),Vk=Yv(),qk=Zv(),Wk=Jv(),Xk=eE(),Yk=nE();rE.exports={defaultOptions:$k,spawnWorker:Vk,terminateWorker:qk,onMessage:Wk,send:Xk,loadImage:Yk}});var ky=Ut((aP,cE)=>{"use strict";H();var Kk=jv(),Xr=Cy(),{log:aE}=xg(),Zk=gg(),Yo=Sy(),{defaultOptions:Qk,spawnWorker:Jk,terminateWorker:t_,onMessage:e_,loadImage:oE,send:i_}=sE(),lE=0;cE.exports=async(r="eng",t=Yo.LSTM_ONLY,e={},i={})=>{let n=Zk("Worker",lE),{logger:s,errorHandler:o,...l}=Kk({...Qk,...e}),c={},u=typeof r=="string"?r.split("+"):r,h=t,d=i,f=[Yo.DEFAULT,Yo.LSTM_ONLY].includes(t)&&!l.legacyCore,m,y,g=new Promise((C,D)=>{y=C,m=D}),A=C=>{m(C.message)},w=Jk(l);w.onerror=A,lE+=1;let v=({id:C,action:D,payload:E})=>new Promise((S,I)=>{aE(`[${n}]: Start ${C}, action=${D}`);let M=`${D}-${C}`;c[M]={resolve:S,reject:I},i_(w,{workerId:n,jobId:C,action:D,payload:E})}),T=()=>console.warn("`load` is depreciated and should be removed from code (workers now come pre-loaded)"),k=C=>v(Xr({id:C,action:"load",payload:{options:{lstmOnly:f,corePath:l.corePath,logging:l.logging}}})),N=(C,D,E)=>v(Xr({id:E,action:"FS",payload:{method:"writeFile",args:[C,D]}})),F=(C,D)=>v(Xr({id:D,action:"FS",payload:{method:"readFile",args:[C,{encoding:"utf8"}]}})),L=(C,D)=>v(Xr({id:D,action:"FS",payload:{method:"unlink",args:[C]}})),Y=(C,D,E)=>v(Xr({id:E,action:"FS",payload:{method:C,args:D}})),q=(C,D)=>v(Xr({id:D,action:"loadLanguage",payload:{langs:C,options:{langPath:l.langPath,dataPath:l.dataPath,cachePath:l.cachePath,cacheMethod:l.cacheMethod,gzip:l.gzip,lstmOnly:[Yo.DEFAULT,Yo.LSTM_ONLY].includes(h)&&!l.legacyLang}}})),G=(C,D,E,S)=>v(Xr({id:S,action:"initialize",payload:{langs:C,oem:D,config:E}})),j=(C="eng",D,E,S)=>{if(f&&[Yo.TESSERACT_ONLY,Yo.TESSERACT_LSTM_COMBINED].includes(D))throw Error("Legacy model requested but code missing.");let I=D||h;h=I;let M=E||d;d=M;let B=(typeof C=="string"?C.split("+"):C).filter($=>!u.includes($));return u.push(...B),B.length>0?q(B,S).then(()=>G(C,I,M,S)):G(C,I,M,S)},tt=(C={},D)=>v(Xr({id:D,action:"setParameters",payload:{params:C}})),et=async(C,D={},E={text:!0},S)=>v(Xr({id:S,action:"recognize",payload:{image:await oE(C),options:D,output:E}})),_=async(C,D)=>{if(f)throw Error("`worker.detect` requires Legacy model, which was not loaded.");return v(Xr({id:D,action:"detect",payload:{image:await oE(C)}}))},X=async()=>(w!==null&&(t_(w),w=null),Promise.resolve());e_(w,({workerId:C,jobId:D,status:E,action:S,data:I})=>{let M=`${S}-${D}`;if(E==="resolve")aE(`[${C}]: Complete ${D}`),c[M].resolve({jobId:D,data:I}),delete c[M];else if(E==="reject")if(c[M].reject(I),delete c[M],S==="load"&&m(I),o)o(I);else throw Error(I);else E==="progress"&&s({...I,userJobId:D})});let O={id:n,worker:w,load:T,writeText:N,readText:F,removeFile:L,FS:Y,reinitialize:j,setParameters:tt,recognize:et,detect:_,terminate:X};return k().then(()=>q(r)).then(()=>G(r,t,i)).then(()=>y(O)).catch(()=>{}),g}});var dE=Ut((lP,hE)=>{"use strict";H();var uE=ky(),n_=async(r,t,e)=>{let i=await uE(t,1,e);return i.recognize(r).finally(async()=>{await i.terminate()})},r_=async(r,t)=>{let e=await uE("osd",0,t);return e.detect(r).finally(async()=>{await e.terminate()})};hE.exports={recognize:n_,detect:r_}});var pE=Ut((uP,fE)=>{"use strict";H();fE.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 gE=Ut((dP,mE)=>{"use strict";H();mE.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 yE=Ut((pP,xE)=>{"use strict";H();_v();var s_=Lv(),a_=ky(),o_=dE(),l_=pE(),c_=Sy(),u_=gE(),{setLogging:h_}=xg();xE.exports={languages:l_,OEM:c_,PSM:u_,createScheduler:s_,createWorker:a_,setLogging:h_,...o_}});function I_(){if(!(typeof globalThis.TextDecoder>"u"))return Cg??(Cg=new globalThis.TextDecoder("utf-8"))}function jE(r,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let e=I_();return e?e.decode(r):__(r)}case"utf-16le":return N_(r);case"us-ascii":case"ascii":return M_(r);case"latin1":case"iso-8859-1":return F_(r);case"windows-1252":return P_(r);default:throw new RangeError(`Encoding '${t}' not supported`)}}function Ry(r,t){t.length!==0&&(r.push(String.fromCharCode.apply(null,t)),t.length=0)}function Ke(r,t,e){t.push(e),t.length>=fu&&Ry(r,t)}function k_(r,t,e){if(e<=65535){Ke(r,t,e);return}e-=65536,Ke(r,t,55296+(e>>10)),Ke(r,t,56320+(e&1023))}function __(r){let t=[],e=[],i=0;for(r.length>=3&&r[0]===239&&r[1]===187&&r[2]===191&&(i=3);i244){Ke(t,e,yr),i++;continue}if(n<=223){if(i+1>=r.length){Ke(t,e,yr),i++;continue}let h=r[i+1];if((h&192)!==128){Ke(t,e,yr),i++;continue}let d=(n&31)<<6|h&63;Ke(t,e,d),i+=2;continue}if(n<=239){if(i+2>=r.length){Ke(t,e,yr),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))){Ke(t,e,yr),i++;continue}let m=(n&15)<<12|(h&63)<<6|d&63;Ke(t,e,m),i+=3;continue}if(i+3>=r.length){Ke(t,e,yr),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))){Ke(t,e,yr),i++;continue}let u=(n&7)<<18|(s&63)<<12|(o&63)<<6|l&63;k_(t,e,u),i+=4}return Ry(t,e),t.join("")}function N_(r){let t=[],e=[],i=r.length,n=0;for(;n+1=55296&&s<=56319){if(n+1=56320&&o<=57343?(Ke(t,e,s),Ke(t,e,o),n+=2):Ke(t,e,yr)}else Ke(t,e,yr);continue}if(s>=56320&&s<=57343){Ke(t,e,yr);continue}Ke(t,e,s)}return n=128&&n<=159?zE[n]:void 0;e+=s??String.fromCharCode(n),e.length>=fu&&(t.push(e),e="")}return e&&t.push(e),t.join("")}var zE,D_,Cg,fu,yr,HE=Kt(()=>{H();zE={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"},D_={};for(let[r,t]of Object.entries(zE))D_[t]=Number.parseInt(r,10);fu=32*1024,yr=65533});function sn(r){return new DataView(r.buffer,r.byteOffset)}var GE,$E,Te,Zo,we,Ly,VE,qE,Mi,Ps=Kt(()=>{H();GE=jc(qx(),1);HE();$E={len:1,get(r,t){return sn(r).getUint8(t)},put(r,t,e){return sn(r).setUint8(t,e),t+1}},Te={len:2,get(r,t){return sn(r).getUint16(t,!0)},put(r,t,e){return sn(r).setUint16(t,e,!0),t+2}},Zo={len:2,get(r,t){return sn(r).getUint16(t)},put(r,t,e){return sn(r).setUint16(t,e),t+2}},we={len:4,get(r,t){return sn(r).getUint32(t,!0)},put(r,t,e){return sn(r).setUint32(t,e,!0),t+4}},Ly={len:4,get(r,t){return sn(r).getUint32(t)},put(r,t,e){return sn(r).setUint32(t,e),t+4}},VE={len:4,get(r,t){return sn(r).getInt32(t)},put(r,t,e){return sn(r).setInt32(t,e),t+4}},qE={len:8,get(r,t){return sn(r).getBigUint64(t,!0)},put(r,t,e){return sn(r).setBigUint64(t,e,!0),t+8}},Mi=class{constructor(t,e){this.len=t,this.encoding=e}get(t,e=0){let i=t.subarray(e,e+this.len);return jE(i,this.encoding)}}});var O_,$t,Qo,Kd=Kt(()=>{H();O_="End-Of-Stream",$t=class extends Error{constructor(){super(O_),this.name="EndOfStreamError"}},Qo=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var WE=Kt(()=>{H()});var Jo,Tg=Kt(()=>{H();Kd();Jo=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 $t;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{H();Kd();WE();Tg()});var Sg,YE=Kt(()=>{H();Tg();Sg=class extends Jo{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var Zd,By=Kt(()=>{H();YE();Zd=class extends Sg{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 pu,Uy=Kt(()=>{H();Kd();Tg();pu=class extends Jo{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{H();By();Uy()});var tl=Kt(()=>{H();Kd();XE();By();Uy();KE()});var Os,Qd=Kt(()=>{H();tl();Os=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})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{H();Qd();tl();L_=256e3,Dg=class extends Os{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)&&s0){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 $t)return 0;throw s}if(!i.mayBeLess&&n{H();tl();Qd();Ig=class extends Os{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{H();tl();Qd();kg=class extends Os{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{if(await e.close(),n)return n()},new Dg(e,i)}function e1(r,t){return new Ig(r,t)}function i1(r,t){return new kg(r,t)}var Jd=Kt(()=>{H();tl();ZE();QE();JE();tl();Qd()});var r1=Ut((XO,n1)=>{H();var mu=1e3,gu=mu*60,xu=gu*60,el=xu*24,B_=el*7,U_=el*365.25;n1.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return z_(r);if(e==="number"&&isFinite(r))return t.long?H_(r):j_(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function z_(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*U_;case"weeks":case"week":case"w":return e*B_;case"days":case"day":case"d":return e*el;case"hours":case"hour":case"hrs":case"hr":case"h":return e*xu;case"minutes":case"minute":case"mins":case"min":case"m":return e*gu;case"seconds":case"second":case"secs":case"sec":case"s":return e*mu;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function j_(r){var t=Math.abs(r);return t>=el?Math.round(r/el)+"d":t>=xu?Math.round(r/xu)+"h":t>=gu?Math.round(r/gu)+"m":t>=mu?Math.round(r/mu)+"s":r+"ms"}function H_(r){var t=Math.abs(r);return t>=el?Ng(r,t,el,"day"):t>=xu?Ng(r,t,xu,"hour"):t>=gu?Ng(r,t,gu,"minute"):t>=mu?Ng(r,t,mu,"second"):r+" ms"}function Ng(r,t,e,i){var n=t>=e*1.5;return Math.round(r/e)+" "+i+(n?"s":"")}});var a1=Ut((KO,s1)=>{H();function G_(r){e.debug=e,e.default=e,e.coerce=c,e.disable=o,e.enable=n,e.enabled=l,e.humanize=r1(),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{if(F==="%%")return"%";k++;let Y=e.formatters[L];if(typeof Y=="function"){let q=A[k];F=Y.call(w,q),A.splice(k,1),k--}return F}),e.formatArgs.call(w,A),(w.log||e.log).apply(w,A)}return g.namespace=h,g.useColors=e.useColors(),g.color=e.selectColor(h),g.extend=i,g.destroy=e.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==e.namespaces&&(m=e.namespaces,y=e.enabled(h)),y),set:A=>{f=A}}),typeof e.init=="function"&&e.init(g),g}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,y=-1,g=0;for(;f"-"+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}s1.exports=G_});var o1=Ut((an,Mg)=>{H();an.formatArgs=V_;an.save=q_;an.load=W_;an.useColors=$_;an.storage=X_();an.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`."))}})();an.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 $_(){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 V_(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Mg.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)}an.log=console.debug||console.log||(()=>{});function q_(r){try{r?an.storage.setItem("debug",r):an.storage.removeItem("debug")}catch{}}function W_(){let r;try{r=an.storage.getItem("debug")||an.storage.getItem("DEBUG")}catch{}return!r&&typeof it.default<"u"&&"env"in it.default&&(r=it.default.env.DEBUG),r}function X_(){try{return localStorage}catch{}}Mg.exports=a1()(an);var{formatters:Y_}=Mg.exports;Y_.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var il,jy,l1,c1,u1,h1=Kt(()=>{H();Ps();il={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},jy={get(r){return{signature:we.get(r,0),compressedSize:we.get(r,8),uncompressedSize:we.get(r,12)}},len:16},l1={get(r){let t=Te.get(r,6);return{signature:we.get(r,0),minVersion:Te.get(r,4),dataDescriptor:!!(t&8),compressedMethod:Te.get(r,8),compressedSize:we.get(r,18),uncompressedSize:we.get(r,22),filenameLength:Te.get(r,26),extraFieldLength:Te.get(r,28),filename:null}},len:30},c1={get(r){return{signature:we.get(r,0),nrOfThisDisk:Te.get(r,4),nrOfThisDiskWithTheStart:Te.get(r,6),nrOfEntriesOnThisDisk:Te.get(r,8),nrOfEntriesOfSize:Te.get(r,10),sizeOfCd:we.get(r,12),offsetOfStartOfCd:we.get(r,16),zipFileCommentLength:Te.get(r,20)}},len:22},u1={get(r){let t=Te.get(r,8);return{signature:we.get(r,0),minVersion:Te.get(r,6),dataDescriptor:!!(t&8),compressedMethod:Te.get(r,10),compressedSize:we.get(r,20),uncompressedSize:we.get(r,24),filenameLength:Te.get(r,28),extraFieldLength:Te.get(r,30),fileCommentLength:Te.get(r,32),relativeOffsetOfLocalHeader:we.get(r,42),filename:null}},len:46}});function f1(r){let t=new Uint8Array(we.len);return we.put(t,0,r),t}function Z_(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;on+s.length,0),e=new Uint8Array(t),i=0;for(let n of r)e.set(n,i),i+=n.length;return e}var d1,Kr,Hy,K_,Fg,nl,p1=Kt(()=>{H();Ps();d1=jc(o1(),1);h1();Kr=(0,d1.default)("tokenizer:inflate"),Hy=256*1024,K_=f1(il.DataDescriptor),Fg=f1(il.EndOfCentralDirectory),nl=class r{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Hy)}async isZip(){return await this.peekSignature()===il.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(we)}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]===Fg[0]&&i[n+1]===Fg[1]&&i[n+2]===Fg[2]&&i[n+3]===Fg[3])return t.fileInfo.size-e+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){Kr("Cannot reading central-directory without random-read support");return}Kr("Reading central-directory...");let t=this.tokenizer.position,e=await this.findEndOfCentralDirectoryLocator();if(e>0){Kr("Central-directory 32-bit signature found");let i=await this.tokenizer.readToken(c1,e),n=[];this.tokenizer.setPosition(i.offsetOfStartOfCd);for(let s=0;s=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)}Kr(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(n,Q_(l),s.handler)}else s.handler?(Kr(`Reading compressed-file-data: ${n.compressedSize} bytes`),o=new Uint8Array(n.compressedSize),await this.tokenizer.readBuffer(o),await this.inflate(n,o,s.handler)):(Kr(`Ignoring compressed-file-data: ${n.compressedSize} bytes`),await this.tokenizer.ignore(n.compressedSize));if(Kr(`Reading data-descriptor at pos=${this.tokenizer.position}`),n.dataDescriptor&&(await this.tokenizer.readToken(jy)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-jy.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}`);Kr(`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(we);if(t===il.LocalFileHeader){let e=await this.tokenizer.readToken(l1);return e.filename=await this.tokenizer.readToken(new Mi(e.filenameLength,"utf-8")),e}if(t===il.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var tf,m1=Kt(()=>{H();tf=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 Gy=Kt(()=>{H();p1();m1()});function eN(r,t,e){return r?r.constructor===t?!0:J_.call(r)===e:!1}function iN(r){return eN(r,Uint8Array,tN)}function nN(r){if(!iN(r))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof r}\``)}function g1(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)nN(n),e.set(n,i),i+=n.length;return e}function $y(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 J_,tN,dR,fR,pR,Vy=Kt(()=>{H();J_=Object.prototype.toString,tN="[object Uint8Array]";dR={utf8:new globalThis.TextDecoder("utf8")},fR=new globalThis.TextEncoder,pR=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"))});function x1(r,t){if(t==="utf-16le"){let e=[];for(let i=0;i>8&255)}return e}if(t==="utf-16be"){let e=[];for(let i=0;i>8&255,n&255)}return e}return[...r].map(e=>e.charCodeAt(0))}function y1(r,t=0){let e=Number.parseInt(new Mi(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{H();Ps();b1={get:(r,t)=>r[t+3]&127|(r[t+2]&127)<<7|(r[t+1]&127)<<14|(r[t]&127)<<21,len:4}});var A1,v1,E1=Kt(()=>{H();A1=["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"],v1=["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 Pg(r,t,e){if(!Number.isFinite(r)||r<0||r>t)throw new mn(`${e} has invalid size ${r} (maximum ${t} bytes)`);return r}async function gn(r,t,{maximumLength:e=16777216,reason:i="skip"}={}){let n=Pg(t,e,i);await r.ignore(n)}async function ef(r,t,e,{maximumLength:i=t.length,reason:n="read"}={}){let s=e?.length??t.length,o=Pg(s,i,n);return r.readBuffer(t,{...e,length:o})}function Kn(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 Ge(r){let t=r.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Rs(r,t,e){return Ge(r)&&r.position-t>e}var mn,yu=Kt(()=>{H();mn=class extends Error{}});async function lN(r,{maximumLength:t=Ls}={}){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 cN(r,t){let e=new Uint8Array(t),i=0;for(let n of r)e.set(n,i),i+=n.length;return e}function uN(r){let t=r.fileInfo.size,e=Number.isFinite(t)?Math.max(0,t-r.position):Number.MAX_SAFE_INTEGER;return Math.min(e,rN)}function hN(r){if(r instanceof $t||r instanceof mn)return!0;if(!(r instanceof Error))return!1;if(sN.has(r.message)||oN.has(r.code))return!0;for(let t of aN)if(r.message.startsWith(t))return!0;return!1}function S1(r,t=Ls){let e=[r.compressedSize,r.uncompressedSize];for(let i of e)if(!Number.isFinite(i)||i<0||i>t)return!1;return!0}function dN(){return{hasDocumentEntry:!1,hasMasterSlideEntry:!1,hasTablesEntry:!1,hasCalculationEngineEntry:!1}}function fN(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 D1(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 I1(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 pN(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function mN(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 _1(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 k1(r){if(!(!r.hasContentTypesEntry||r.hasUnparseableContentTypes||r.isParsingContentTypes||r.hasParsedContentTypesEntry))return _1(r)}function gN(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 yN(r,t){if(r.length=0?0:l===n?Math.min(xN,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(Ge(r.tokenizer)||(r.knownSizeDescriptorScannedBytes+=o),!!t)return cN(s,o)}function wN(r,t){return Ge(r.tokenizer)?Math.max(0,16777216-(r.tokenizer.position-t)):Math.max(0,Ls-r.knownSizeDescriptorScannedBytes)}async function AN(r,t,{shouldBuffer:e,maximumDescriptorLength:i=Ls}={}){if(t.dataDescriptor&&t.compressedSize===0)return bN(r,{shouldBuffer:e,maximumLength:i});if(!e){await gn(r.tokenizer,t.compressedSize,{maximumLength:Ge(r.tokenizer)?Ls:r.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let n=uN(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 M1(r){let t,e=pN(),i=dN();try{await new nl(r).unzip(s=>{if(mN(e,s.filename),fN(i,s.filename),i.hasDocumentEntry&&(i.hasMasterSlideEntry||i.hasTablesEntry))return t=D1(i),{stop:!0};let o=s.filename==="[Content_Types].xml",l=k1(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 S1(s,T1)?{async handler(c){let u=new TextDecoder("utf-8").decode(c).trim();t=I1(u)},stop:!0}:{};case"[Content_Types].xml":return e.hasContentTypesEntry=!0,S1(s,T1)?(e.isParsingContentTypes=!0,{async handler(c){let u=new TextDecoder("utf-8").decode(c),h=gN(u);h&&(t=I1(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(!hN(s))throw s;e.isParsingContentTypes&&(e.isParsingContentTypes=!1,e.hasUnparseableContentTypes=!0),!t&&s instanceof $t&&!e.hasContentTypesEntry&&(t=_1(e))}let n=Ge(r)&&i.hasDocumentEntry&&!i.hasMasterSlideEntry&&!i.hasTablesEntry&&!i.hasCalculationEngineEntry?void 0:D1(i);return t??k1(e)??n??{ext:"zip",mime:"application/zip"}}var Ls,C1,rN,T1,sN,aN,oN,N1,Og,xN,F1=Kt(()=>{H();Ps();Jd();Gy();yu();Ls=1024*1024,C1=1024,rN=2**31-1,T1=Ls,sN=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),aN=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],oN=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);N1=134695760,Og=16,xN=Og-1;nl.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 lN(t,{maximumLength:Ls});return e(i)};nl.prototype.unzip=async function(r){let t=!1,e=0,i=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Rs(this.tokenizer,i,16777216))throw new mn(`ZIP stream probing exceeds ${16777216} bytes`);let n=await this.readLocalFileHeader();if(!n)break;if(e++,e>C1)throw new Error(`ZIP entry count exceeds ${C1}`);let s=r(n);t=!!s.stop,await this.tokenizer.ignore(n.extraFieldLength);let o=await AN(this,n,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(Ls,wN(this,i))});if(s.handler&&await this.inflate(n,o,s.handler),n.dataDescriptor){let l=new Uint8Array(Og);if(await this.tokenizer.readBuffer(l),we.get(l,0)!==N1)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Rs(this.tokenizer,i,16777216))throw new mn(`ZIP stream probing exceeds ${16777216} bytes`)}while(!t)}});async function R1(r){async function t(){let l=await r.peekNumber($E),c=128,u=0;for(;(l&c)===0&&c!==0;)++u,c>>=1;let h=new Uint8Array(u+1);return await ef(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:$y(h),len:$y(d)}}async function i(l){let c=0;for(;l>0;){if(c++,c>vN||Rs(r,s,16777216))return;let u=r.position,h=await e();if(h.id===17026){if(h.len>P1)return;let d=Pg(h.len,P1,"EBML DocType");return(await r.readToken(new Mi(d))).replaceAll(new RegExp("\\0.*$","gv"),"")}if(Ge(r)&&(!Number.isFinite(h.len)||h.len<0||h.len>O1)||(await gn(r,h.len,{maximumLength:Ge(r)?O1: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 P1,O1,vN,L1=Kt(()=>{H();Ps();Vy();yu();P1=64,O1=1024*1024,vN=256});function TN(r){return(r.codePointAt(0)&32)!==0}async function U1(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(VE),type:await r.readToken(new Mi(4,"latin1"))}}let n=Ge(r),s=r.position,o=0,l=!1;do{if(o++,o>EN||Rs(r,s,CN))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>B1)return l&&TN(u.type)?t:void 0;try{await gn(r,u.length+4,{maximumLength:n?B1+4:r.fileInfo.size,reason:"PNG chunk payload"})}catch(h){if(!n&&(h instanceof mn||h instanceof $t))return t;throw h}}if(r.position<=c)break}while(r.position+8{H();Ps();Jd();yu();EN=512,CN=16*1024*1024,B1=1024*1024});async function H1(r){let t=!1;try{async function e(){let o=new Uint8Array(16);return await ef(r,o,void 0,{maximumLength:o.length,reason:"ASF header GUID"}),{id:o,size:Number(await r.readToken(qE))}}await gn(r,30,{maximumLength:30,reason:"ASF header prelude"});let i=Ge(r),n=r.position,s=0;for(;r.position+24SN||Rs(r,n,16777216)));){let o=r.position,l=await e(),c=l.size-24;if(!Number.isFinite(c)||c<0){t=!0;break}if(Kn(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 ef(r,u,void 0,{maximumLength:u.length,reason:"ASF stream type GUID"}),Kn(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(Kn(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>j1){t=!0;break}if(await gn(r,c,{maximumLength:i?j1:r.fileInfo.size,reason:"ASF header payload"}),r.position<=o){t=!0;break}}}catch(e){if(e instanceof $t||e instanceof mn)Ge(r)&&(t=!0);else throw e}if(!t)return{ext:"asf",mime:"application/vnd.ms-asf"}}var SN,j1,G1=Kt(()=>{H();Ps();Jd();yu();SN=512,j1=1024*1024});var K1={};Hx(K1,{FileTypeParser:()=>Bs,fileTypeFromBlob:()=>BN,fileTypeFromBuffer:()=>LN,fileTypeFromFile:()=>GN,fileTypeFromStream:()=>RN,fileTypeFromTokenizer:()=>UN,fileTypeStream:()=>zN,normalizeSampleSize:()=>Y1,reasonableDetectionSizeInBytes:()=>bu,supportedExtensions:()=>jN,supportedMimeTypes:()=>HN});function Y1(r){return Number.isFinite(r)?Math.max(1,Math.trunc(r)):bu}function MN(r){return Number.isFinite(r)?Math.max(0,Math.min(DN,Math.trunc(r))):0}function FN(r){return Number.isFinite(r)?Math.max(0,r):Number.MAX_SAFE_INTEGER}function W1(r){return import(r)}function PN(r){return r.pipeThrough(new TransformStream)}function X1(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 ON(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 RN(r,t){return new Bs(t).fromStream(r)}async function LN(r,t){return new Bs(t).fromBuffer(r)}async function BN(r,t){return new Bs(t).fromBlob(r)}async function UN(r,t){return new Bs(t).fromTokenizer(r)}async function zN(r,t){return new Bs(t).toDetectionStream(r,t)}async function GN(r,t){return new Bs(t).fromFile(r)}var bu,DN,IN,kN,$1,qy,_N,V1,NN,q1,Bs,jN,HN,Z1=Kt(()=>{H();Ps();Jd();Gy();Vy();w1();E1();yu();F1();L1();z1();G1();bu=4100,DN=bu-2,IN=16777216,kN=1,$1=100,qy=16777216,_N=512,V1=256,NN=1024*1024,q1=16777216;Bs=class r{constructor(t){z(this,"detectConfident",async t=>{if(this.buffer=new Uint8Array(bu),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,Ge(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>=V1?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 gn(t,6,{maximumLength:6,reason:"ID3 header prefix"});let e=await t.readToken(b1),i=Ge(t);if(!Number.isFinite(e)||e<0||i&&(e>qy||t.position+e>qy))return;if(t.position+e>t.fileInfo.size)return i?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await gn(t,e,{maximumLength:i?qy:t.fileInfo.size,reason:"ID3 payload"})}catch(n){if(n instanceof $t)return;throw n}return this.detectionReentryCount>=V1?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 M1(t);if(this.checkString("OggS")){await t.ignore(28);let e=new Uint8Array(8);return await t.readBuffer(e),Kn(e,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:Kn(e,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Kn(e,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Kn(e,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Kn(e,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Kn(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 R1(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=Ly.get(this.buffer,4),i=Zo.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("=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("!"))return await t.ignore(8),await t.readToken(new Mi(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[` +`)}function Tv(r){if(r=r||{},r.locator===void 0&&(r.locator=!0),this.assign=r.assign||Wo.assign,this.domHandler=r.domHandler||hg,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||Cv,this.locator=!!r.locator,this.xmlns=this.assign(Object.create(null),r.xmlns)}Tv.prototype.parseFromString=function(r,t){if(!CI(t))throw new TypeError('DOMParser.parseFromString: the provided mimeType "'+t+'" is not valid.');var e=this.assign(Object.create(null),this.xmlns),i=wv.XML_ENTITIES,n=e[""]||null;vI(t)?(i=wv.HTML_ENTITIES,n=Ay.HTML):t===Ev.XML_SVG_IMAGE&&(n=Ay.SVG),e[""]=n,e.xml=e.xml||Ay.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 TI;l.errorHandler=s,l.domBuilder=s;var c=!Wo.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 hg(r){var t=r||{};this.mimeType=t.mimeType||Ev.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 ou(r,t){t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber}hg.prototype={startDocument:function(){var r=new AI;this.doc=EI(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;ug(this,s),this.currentElement=s,this.locator&&ou(this.locator,s);for(var l=0;l=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){hg.prototype[r]=function(){return null}});function ug(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}function DI(r){if(r==="error")throw"onErrorStopParsing"}function kI(){throw"onWarningStopParsing"}lu.__DOMHandler=hg;lu.DOMParser=Tv;lu.normalizeLineEndings=Cv;lu.onErrorStopParsing=DI;lu.onWarningStopParsing=kI});var Dv=zt(qt=>{"use strict";H();var cu=Go();qt.assign=cu.assign;qt.hasDefaultHTMLNamespace=cu.hasDefaultHTMLNamespace;qt.isHTMLMimeType=cu.isHTMLMimeType;qt.isValidMimeType=cu.isValidMimeType;qt.MIME_TYPE=cu.MIME_TYPE;qt.NAMESPACE=cu.NAMESPACE;var dg=Id();qt.DOMException=dg.DOMException;qt.DOMExceptionName=dg.DOMExceptionName;qt.ExceptionCode=dg.ExceptionCode;qt.ParseError=dg.ParseError;var ii=by();qt.Attr=ii.Attr;qt.CDATASection=ii.CDATASection;qt.CharacterData=ii.CharacterData;qt.Comment=ii.Comment;qt.Document=ii.Document;qt.DocumentFragment=ii.DocumentFragment;qt.DocumentType=ii.DocumentType;qt.DOMImplementation=ii.DOMImplementation;qt.Element=ii.Element;qt.Entity=ii.Entity;qt.EntityReference=ii.EntityReference;qt.LiveNodeList=ii.LiveNodeList;qt.NamedNodeMap=ii.NamedNodeMap;qt.Node=ii.Node;qt.NodeList=ii.NodeList;qt.Notation=ii.Notation;qt.ProcessingInstruction=ii.ProcessingInstruction;qt.Text=ii.Text;qt.XMLSerializer=ii.XMLSerializer;var fg=Sv();qt.DOMParser=fg.DOMParser;qt.normalizeLineEndings=fg.normalizeLineEndings;qt.onErrorStopParsing=fg.onErrorStopParsing;qt.onWarningStopParsing=fg.onWarningStopParsing});var Nv=zt((DF,Ey)=>{H();var vy=(function(r){"use strict";var t=Object.prototype,e=t.hasOwnProperty,i=Object.defineProperty||function(C,D,E){C[D]=E.value},n,s=typeof Symbol=="function"?Symbol:{},o=s.iterator||"@@iterator",l=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag";function u(C,D,E){return Object.defineProperty(C,D,{value:E,enumerable:!0,configurable:!0,writable:!0}),C[D]}try{u({},"")}catch{u=function(D,E,S){return D[E]=S}}function h(C,D,E,S){var k=D&&D.prototype instanceof w?D:w,M=Object.create(k.prototype),P=new N(S||[]);return i(M,"_invoke",{value:G(C,E,P)}),M}r.wrap=h;function d(C,D,E){try{return{type:"normal",arg:C.call(D,E)}}catch(S){return{type:"throw",arg:S}}}var f="suspendedStart",m="suspendedYield",y="executing",g="completed",A={};function w(){}function v(){}function T(){}var I={};u(I,o,function(){return this});var _=Object.getPrototypeOf,F=_&&_(_(X([])));F&&F!==t&&e.call(F,o)&&(I=F);var L=T.prototype=w.prototype=Object.create(I);v.prototype=T,i(L,"constructor",{value:T,configurable:!0}),i(T,"constructor",{value:v,configurable:!0}),v.displayName=u(T,c,"GeneratorFunction");function Y(C){["next","throw","return"].forEach(function(D){u(C,D,function(E){return this._invoke(D,E)})})}r.isGeneratorFunction=function(C){var D=typeof C=="function"&&C.constructor;return D?D===v||(D.displayName||D.name)==="GeneratorFunction":!1},r.mark=function(C){return Object.setPrototypeOf?Object.setPrototypeOf(C,T):(C.__proto__=T,u(C,c,"GeneratorFunction")),C.prototype=Object.create(L),C},r.awrap=function(C){return{__await:C}};function q(C,D){function E(M,P,B,$){var U=d(C[M],C,P);if(U.type==="throw")$(U.arg);else{var V=U.arg,Z=V.value;return Z&&typeof Z=="object"&&e.call(Z,"__await")?D.resolve(Z.__await).then(function(Q){E("next",Q,B,$)},function(Q){E("throw",Q,B,$)}):D.resolve(Z).then(function(Q){V.value=Q,B(V)},function(Q){return E("throw",Q,B,$)})}}var S;function k(M,P){function B(){return new D(function($,U){E(M,P,$,U)})}return S=S?S.then(B,B):B()}i(this,"_invoke",{value:k})}Y(q.prototype),u(q.prototype,l,function(){return this}),r.AsyncIterator=q,r.async=function(C,D,E,S,k){k===void 0&&(k=Promise);var M=new q(h(C,D,E,S),k);return r.isGeneratorFunction(D)?M:M.next().then(function(P){return P.done?P.value:M.next()})};function G(C,D,E){var S=f;return function(M,P){if(S===y)throw new Error("Generator is already running");if(S===g){if(M==="throw")throw P;return O()}for(E.method=M,E.arg=P;;){var B=E.delegate;if(B){var $=j(B,E);if($){if($===A)continue;return $}}if(E.method==="next")E.sent=E._sent=E.arg;else if(E.method==="throw"){if(S===f)throw S=g,E.arg;E.dispatchException(E.arg)}else E.method==="return"&&E.abrupt("return",E.arg);S=y;var U=d(C,D,E);if(U.type==="normal"){if(S=E.done?g:m,U.arg===A)continue;return{value:U.arg,done:E.done}}else U.type==="throw"&&(S=g,E.method="throw",E.arg=U.arg)}}}function j(C,D){var E=D.method,S=C.iterator[E];if(S===n)return D.delegate=null,E==="throw"&&C.iterator.return&&(D.method="return",D.arg=n,j(C,D),D.method==="throw")||E!=="return"&&(D.method="throw",D.arg=new TypeError("The iterator does not provide a '"+E+"' method")),A;var k=d(S,C.iterator,D.arg);if(k.type==="throw")return D.method="throw",D.arg=k.arg,D.delegate=null,A;var M=k.arg;if(!M)return D.method="throw",D.arg=new TypeError("iterator result is not an object"),D.delegate=null,A;if(M.done)D[C.resultName]=M.value,D.next=C.nextLoc,D.method!=="return"&&(D.method="next",D.arg=n);else return M;return D.delegate=null,A}Y(L),u(L,c,"Generator"),u(L,o,function(){return this}),u(L,"toString",function(){return"[object Generator]"});function J(C){var D={tryLoc:C[0]};1 in C&&(D.catchLoc=C[1]),2 in C&&(D.finallyLoc=C[2],D.afterLoc=C[3]),this.tryEntries.push(D)}function et(C){var D=C.completion||{};D.type="normal",delete D.arg,C.completion=D}function N(C){this.tryEntries=[{tryLoc:"root"}],C.forEach(J,this),this.reset(!0)}r.keys=function(C){var D=Object(C),E=[];for(var S in D)E.push(S);return E.reverse(),function k(){for(;E.length;){var M=E.pop();if(M in D)return k.value=M,k.done=!1,k}return k.done=!0,k}};function X(C){if(C){var D=C[o];if(D)return D.call(C);if(typeof C.next=="function")return C;if(!isNaN(C.length)){var E=-1,S=function k(){for(;++E=0;--S){var k=this.tryEntries[S],M=k.completion;if(k.tryLoc==="root")return E("end");if(k.tryLoc<=this.prev){var P=e.call(k,"catchLoc"),B=e.call(k,"finallyLoc");if(P&&B){if(this.prev=0;--E){var S=this.tryEntries[E];if(S.tryLoc<=this.prev&&e.call(S,"finallyLoc")&&this.prev=0;--D){var E=this.tryEntries[D];if(E.finallyLoc===C)return this.complete(E.completion,E.afterLoc),et(E),A}},catch:function(C){for(var D=this.tryEntries.length-1;D>=0;--D){var E=this.tryEntries[D];if(E.tryLoc===C){var S=E.completion;if(S.type==="throw"){var k=S.arg;et(E)}return k}}throw new Error("illegal catch attempt")},delegateYield:function(C,D,E){return this.delegate={iterator:X(C),resultName:D,nextLoc:E},this.method==="next"&&(this.arg=n),A}},r})(typeof Ey=="object"?Ey.exports:{});try{regeneratorRuntime=vy}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=vy:Function("r","regeneratorRuntime = r")(vy)}});var gg=zt((IF,_v)=>{"use strict";H();_v.exports=(r,t)=>`${r}-${t}-${Math.random().toString(16).slice(3,8)}`});var Cy=zt((_F,Fv)=>{"use strict";H();var RI=gg(),Mv=0;Fv.exports=({id:r,action:t,payload:e={}})=>{let i=r;return typeof i>"u"&&(i=RI("Job",Mv),Mv+=1),{id:i,action:t,payload:e}}});var xg=zt(qd=>{"use strict";H();var Ty=!1;qd.logging=Ty;qd.setLogging=r=>{Ty=r};qd.log=(...r)=>Ty?console.log.apply(qd,r):null});var Lv=zt((Ov,Rv)=>{"use strict";H();var LI=Cy(),{log:yg}=xg(),BI=gg(),Pv=0;Rv.exports=()=>{let r=BI("Scheduler",Pv),t={},e={},i=[];Pv+=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"u"){i[0](t[d[f]]);break}}},l=(d,f)=>new Promise((m,y)=>{let g=LI({action:d,payload:f});i.push(async A=>{i.shift(),e[A.id]=g;try{m(await A[d].apply(Ov,[...f,g.id]))}catch(w){y(w)}finally{delete e[A.id],o()}}),yg(`[${r}]: Add ${g.id} to JobQueue`),yg(`[${r}]: JobQueue length=${i.length}`),o()});return{addWorker:d=>(t[d.id]=d,yg(`[${r}]: Add ${d.id}`),yg(`[${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 Uv=zt((RF,Bv)=>{"use strict";H();Bv.exports=r=>{let t={};return typeof WorkerGlobalScope<"u"?t.type="webworker":typeof document=="object"?t.type="browser":typeof it.default=="object"&&typeof Vm=="function"&&(t.type="node"),typeof r>"u"?t:t[r]}});var jv=zt((UF,zv)=>{"use strict";H();var UI=Uv()("type")==="browser",zI=UI?r=>new URL(r,window.location.href).href:r=>r;zv.exports=r=>{let t={...r};return["corePath","workerPath","langPath"].forEach(e=>{r[e]&&(t[e]=zI(t[e]))}),t}});var Sy=zt((jF,Hv)=>{"use strict";H();Hv.exports={TESSERACT_ONLY:0,LSTM_ONLY:1,TESSERACT_LSTM_COMBINED:2,DEFAULT:3}});var Gv=zt((GF,jI)=>{jI.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 Vv=zt(($F,$v)=>{"use strict";H();$v.exports={workerBlobURL:!0,logger:()=>{}}});var Wv=zt((qF,qv)=>{"use strict";H();var HI=Gv().version,GI=Vv();qv.exports={...GI,workerPath:`https://cdn.jsdelivr.net/npm/tesseract.js@v${HI}/dist/worker.min.js`}});var Yv=zt((XF,Xv)=>{"use strict";H();Xv.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 Zv=zt((KF,Kv)=>{"use strict";H();Kv.exports=r=>{r.terminate()}});var Jv=zt((QF,Qv)=>{"use strict";H();Qv.exports=(r,t)=>{r.onmessage=({data:e})=>{t(e)}}});var eE=zt((tP,tE)=>{"use strict";H();tE.exports=async(r,t)=>{r.postMessage(t)}});var nE=zt((iP,iE)=>{"use strict";H();var Dy=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)}),ky=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 ky(r.src)),r.tagName==="VIDEO"&&(t=await ky(r.poster)),r.tagName==="CANVAS"&&await new Promise(e=>{r.toBlob(async i=>{t=await Dy(i),e()})});else if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas){let e=await r.convertToBlob();t=await Dy(e)}else(r instanceof File||r instanceof Blob)&&(t=await Dy(r));return new Uint8Array(t)};iE.exports=ky});var sE=zt((rP,rE)=>{"use strict";H();var $I=Wv(),VI=Yv(),qI=Zv(),WI=Jv(),XI=eE(),YI=nE();rE.exports={defaultOptions:$I,spawnWorker:VI,terminateWorker:qI,onMessage:WI,send:XI,loadImage:YI}});var Iy=zt((aP,cE)=>{"use strict";H();var KI=jv(),Xr=Cy(),{log:aE}=xg(),ZI=gg(),Yo=Sy(),{defaultOptions:QI,spawnWorker:JI,terminateWorker:tN,onMessage:eN,loadImage:oE,send:iN}=sE(),lE=0;cE.exports=async(r="eng",t=Yo.LSTM_ONLY,e={},i={})=>{let n=ZI("Worker",lE),{logger:s,errorHandler:o,...l}=KI({...QI,...e}),c={},u=typeof r=="string"?r.split("+"):r,h=t,d=i,f=[Yo.DEFAULT,Yo.LSTM_ONLY].includes(t)&&!l.legacyCore,m,y,g=new Promise((C,D)=>{y=C,m=D}),A=C=>{m(C.message)},w=JI(l);w.onerror=A,lE+=1;let v=({id:C,action:D,payload:E})=>new Promise((S,k)=>{aE(`[${n}]: Start ${C}, action=${D}`);let M=`${D}-${C}`;c[M]={resolve:S,reject:k},iN(w,{workerId:n,jobId:C,action:D,payload:E})}),T=()=>console.warn("`load` is depreciated and should be removed from code (workers now come pre-loaded)"),I=C=>v(Xr({id:C,action:"load",payload:{options:{lstmOnly:f,corePath:l.corePath,logging:l.logging}}})),_=(C,D,E)=>v(Xr({id:E,action:"FS",payload:{method:"writeFile",args:[C,D]}})),F=(C,D)=>v(Xr({id:D,action:"FS",payload:{method:"readFile",args:[C,{encoding:"utf8"}]}})),L=(C,D)=>v(Xr({id:D,action:"FS",payload:{method:"unlink",args:[C]}})),Y=(C,D,E)=>v(Xr({id:E,action:"FS",payload:{method:C,args:D}})),q=(C,D)=>v(Xr({id:D,action:"loadLanguage",payload:{langs:C,options:{langPath:l.langPath,dataPath:l.dataPath,cachePath:l.cachePath,cacheMethod:l.cacheMethod,gzip:l.gzip,lstmOnly:[Yo.DEFAULT,Yo.LSTM_ONLY].includes(h)&&!l.legacyLang}}})),G=(C,D,E,S)=>v(Xr({id:S,action:"initialize",payload:{langs:C,oem:D,config:E}})),j=(C="eng",D,E,S)=>{if(f&&[Yo.TESSERACT_ONLY,Yo.TESSERACT_LSTM_COMBINED].includes(D))throw Error("Legacy model requested but code missing.");let k=D||h;h=k;let M=E||d;d=M;let B=(typeof C=="string"?C.split("+"):C).filter($=>!u.includes($));return u.push(...B),B.length>0?q(B,S).then(()=>G(C,k,M,S)):G(C,k,M,S)},J=(C={},D)=>v(Xr({id:D,action:"setParameters",payload:{params:C}})),et=async(C,D={},E={text:!0},S)=>v(Xr({id:S,action:"recognize",payload:{image:await oE(C),options:D,output:E}})),N=async(C,D)=>{if(f)throw Error("`worker.detect` requires Legacy model, which was not loaded.");return v(Xr({id:D,action:"detect",payload:{image:await oE(C)}}))},X=async()=>(w!==null&&(tN(w),w=null),Promise.resolve());eN(w,({workerId:C,jobId:D,status:E,action:S,data:k})=>{let M=`${S}-${D}`;if(E==="resolve")aE(`[${C}]: Complete ${D}`),c[M].resolve({jobId:D,data:k}),delete c[M];else if(E==="reject")if(c[M].reject(k),delete c[M],S==="load"&&m(k),o)o(k);else throw Error(k);else E==="progress"&&s({...k,userJobId:D})});let O={id:n,worker:w,load:T,writeText:_,readText:F,removeFile:L,FS:Y,reinitialize:j,setParameters:J,recognize:et,detect:N,terminate:X};return I().then(()=>q(r)).then(()=>G(r,t,i)).then(()=>y(O)).catch(()=>{}),g}});var dE=zt((lP,hE)=>{"use strict";H();var uE=Iy(),nN=async(r,t,e)=>{let i=await uE(t,1,e);return i.recognize(r).finally(async()=>{await i.terminate()})},rN=async(r,t)=>{let e=await uE("osd",0,t);return e.detect(r).finally(async()=>{await e.terminate()})};hE.exports={recognize:nN,detect:rN}});var pE=zt((uP,fE)=>{"use strict";H();fE.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 gE=zt((dP,mE)=>{"use strict";H();mE.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 yE=zt((pP,xE)=>{"use strict";H();Nv();var sN=Lv(),aN=Iy(),oN=dE(),lN=pE(),cN=Sy(),uN=gE(),{setLogging:hN}=xg();xE.exports={languages:lN,OEM:cN,PSM:uN,createScheduler:sN,createWorker:aN,setLogging:hN,...oN}});function kN(){if(!(typeof globalThis.TextDecoder>"u"))return Cg??(Cg=new globalThis.TextDecoder("utf-8"))}function jE(r,t="utf-8"){switch(t.toLowerCase()){case"utf-8":case"utf8":{let e=kN();return e?e.decode(r):NN(r)}case"utf-16le":return _N(r);case"us-ascii":case"ascii":return MN(r);case"latin1":case"iso-8859-1":return FN(r);case"windows-1252":return PN(r);default:throw new RangeError(`Encoding '${t}' not supported`)}}function Ry(r,t){t.length!==0&&(r.push(String.fromCharCode.apply(null,t)),t.length=0)}function Ke(r,t,e){t.push(e),t.length>=fu&&Ry(r,t)}function IN(r,t,e){if(e<=65535){Ke(r,t,e);return}e-=65536,Ke(r,t,55296+(e>>10)),Ke(r,t,56320+(e&1023))}function NN(r){let t=[],e=[],i=0;for(r.length>=3&&r[0]===239&&r[1]===187&&r[2]===191&&(i=3);i244){Ke(t,e,yr),i++;continue}if(n<=223){if(i+1>=r.length){Ke(t,e,yr),i++;continue}let h=r[i+1];if((h&192)!==128){Ke(t,e,yr),i++;continue}let d=(n&31)<<6|h&63;Ke(t,e,d),i+=2;continue}if(n<=239){if(i+2>=r.length){Ke(t,e,yr),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))){Ke(t,e,yr),i++;continue}let m=(n&15)<<12|(h&63)<<6|d&63;Ke(t,e,m),i+=3;continue}if(i+3>=r.length){Ke(t,e,yr),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))){Ke(t,e,yr),i++;continue}let u=(n&7)<<18|(s&63)<<12|(o&63)<<6|l&63;IN(t,e,u),i+=4}return Ry(t,e),t.join("")}function _N(r){let t=[],e=[],i=r.length,n=0;for(;n+1=55296&&s<=56319){if(n+1=56320&&o<=57343?(Ke(t,e,s),Ke(t,e,o),n+=2):Ke(t,e,yr)}else Ke(t,e,yr);continue}if(s>=56320&&s<=57343){Ke(t,e,yr);continue}Ke(t,e,s)}return n=128&&n<=159?zE[n]:void 0;e+=s??String.fromCharCode(n),e.length>=fu&&(t.push(e),e="")}return e&&t.push(e),t.join("")}var zE,DN,Cg,fu,yr,HE=Kt(()=>{H();zE={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"},DN={};for(let[r,t]of Object.entries(zE))DN[t]=Number.parseInt(r,10);fu=32*1024,yr=65533});function sn(r){return new DataView(r.buffer,r.byteOffset)}var GE,$E,Te,Zo,we,Ly,VE,qE,Mi,Ps=Kt(()=>{H();GE=jc(qx(),1);HE();$E={len:1,get(r,t){return sn(r).getUint8(t)},put(r,t,e){return sn(r).setUint8(t,e),t+1}},Te={len:2,get(r,t){return sn(r).getUint16(t,!0)},put(r,t,e){return sn(r).setUint16(t,e,!0),t+2}},Zo={len:2,get(r,t){return sn(r).getUint16(t)},put(r,t,e){return sn(r).setUint16(t,e),t+2}},we={len:4,get(r,t){return sn(r).getUint32(t,!0)},put(r,t,e){return sn(r).setUint32(t,e,!0),t+4}},Ly={len:4,get(r,t){return sn(r).getUint32(t)},put(r,t,e){return sn(r).setUint32(t,e),t+4}},VE={len:4,get(r,t){return sn(r).getInt32(t)},put(r,t,e){return sn(r).setInt32(t,e),t+4}},qE={len:8,get(r,t){return sn(r).getBigUint64(t,!0)},put(r,t,e){return sn(r).setBigUint64(t,e,!0),t+8}},Mi=class{constructor(t,e){this.len=t,this.encoding=e}get(t,e=0){let i=t.subarray(e,e+this.len);return jE(i,this.encoding)}}});var ON,$t,Qo,Kd=Kt(()=>{H();ON="End-Of-Stream",$t=class extends Error{constructor(){super(ON),this.name="EndOfStreamError"}},Qo=class extends Error{constructor(t="The operation was aborted"){super(t),this.name="AbortError"}}});var WE=Kt(()=>{H()});var Jo,Tg=Kt(()=>{H();Kd();Jo=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 $t;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{H();Kd();WE();Tg()});var Sg,YE=Kt(()=>{H();Tg();Sg=class extends Jo{constructor(t){super(),this.reader=t}async abort(){return this.close()}async close(){this.reader.releaseLock()}}});var Zd,By=Kt(()=>{H();YE();Zd=class extends Sg{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 pu,Uy=Kt(()=>{H();Kd();Tg();pu=class extends Jo{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{H();By();Uy()});var tl=Kt(()=>{H();Kd();XE();By();Uy();KE()});var Os,Qd=Kt(()=>{H();tl();Os=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})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{H();Qd();tl();LN=256e3,Dg=class extends Os{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)&&s0){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 $t)return 0;throw s}if(!i.mayBeLess&&n{H();tl();Qd();kg=class extends Os{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{H();tl();Qd();Ig=class extends Os{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{if(await e.close(),n)return n()},new Dg(e,i)}function e1(r,t){return new kg(r,t)}function i1(r,t){return new Ig(r,t)}var Jd=Kt(()=>{H();tl();ZE();QE();JE();tl();Qd()});var r1=zt((XO,n1)=>{H();var mu=1e3,gu=mu*60,xu=gu*60,el=xu*24,BN=el*7,UN=el*365.25;n1.exports=function(r,t){t=t||{};var e=typeof r;if(e==="string"&&r.length>0)return zN(r);if(e==="number"&&isFinite(r))return t.long?HN(r):jN(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function zN(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*UN;case"weeks":case"week":case"w":return e*BN;case"days":case"day":case"d":return e*el;case"hours":case"hour":case"hrs":case"hr":case"h":return e*xu;case"minutes":case"minute":case"mins":case"min":case"m":return e*gu;case"seconds":case"second":case"secs":case"sec":case"s":return e*mu;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return e;default:return}}}}function jN(r){var t=Math.abs(r);return t>=el?Math.round(r/el)+"d":t>=xu?Math.round(r/xu)+"h":t>=gu?Math.round(r/gu)+"m":t>=mu?Math.round(r/mu)+"s":r+"ms"}function HN(r){var t=Math.abs(r);return t>=el?_g(r,t,el,"day"):t>=xu?_g(r,t,xu,"hour"):t>=gu?_g(r,t,gu,"minute"):t>=mu?_g(r,t,mu,"second"):r+" ms"}function _g(r,t,e,i){var n=t>=e*1.5;return Math.round(r/e)+" "+i+(n?"s":"")}});var a1=zt((KO,s1)=>{H();function GN(r){e.debug=e,e.default=e,e.coerce=c,e.disable=o,e.enable=n,e.enabled=l,e.humanize=r1(),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{if(F==="%%")return"%";I++;let Y=e.formatters[L];if(typeof Y=="function"){let q=A[I];F=Y.call(w,q),A.splice(I,1),I--}return F}),e.formatArgs.call(w,A),(w.log||e.log).apply(w,A)}return g.namespace=h,g.useColors=e.useColors(),g.color=e.selectColor(h),g.extend=i,g.destroy=e.destroy,Object.defineProperty(g,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==e.namespaces&&(m=e.namespaces,y=e.enabled(h)),y),set:A=>{f=A}}),typeof e.init=="function"&&e.init(g),g}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,y=-1,g=0;for(;f"-"+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}s1.exports=GN});var o1=zt((an,Mg)=>{H();an.formatArgs=VN;an.save=qN;an.load=WN;an.useColors=$N;an.storage=XN();an.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`."))}})();an.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 $N(){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 VN(r){if(r[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+r[0]+(this.useColors?"%c ":" ")+"+"+Mg.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)}an.log=console.debug||console.log||(()=>{});function qN(r){try{r?an.storage.setItem("debug",r):an.storage.removeItem("debug")}catch{}}function WN(){let r;try{r=an.storage.getItem("debug")||an.storage.getItem("DEBUG")}catch{}return!r&&typeof it.default<"u"&&"env"in it.default&&(r=it.default.env.DEBUG),r}function XN(){try{return localStorage}catch{}}Mg.exports=a1()(an);var{formatters:YN}=Mg.exports;YN.j=function(r){try{return JSON.stringify(r)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}}});var il,jy,l1,c1,u1,h1=Kt(()=>{H();Ps();il={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},jy={get(r){return{signature:we.get(r,0),compressedSize:we.get(r,8),uncompressedSize:we.get(r,12)}},len:16},l1={get(r){let t=Te.get(r,6);return{signature:we.get(r,0),minVersion:Te.get(r,4),dataDescriptor:!!(t&8),compressedMethod:Te.get(r,8),compressedSize:we.get(r,18),uncompressedSize:we.get(r,22),filenameLength:Te.get(r,26),extraFieldLength:Te.get(r,28),filename:null}},len:30},c1={get(r){return{signature:we.get(r,0),nrOfThisDisk:Te.get(r,4),nrOfThisDiskWithTheStart:Te.get(r,6),nrOfEntriesOnThisDisk:Te.get(r,8),nrOfEntriesOfSize:Te.get(r,10),sizeOfCd:we.get(r,12),offsetOfStartOfCd:we.get(r,16),zipFileCommentLength:Te.get(r,20)}},len:22},u1={get(r){let t=Te.get(r,8);return{signature:we.get(r,0),minVersion:Te.get(r,6),dataDescriptor:!!(t&8),compressedMethod:Te.get(r,10),compressedSize:we.get(r,20),uncompressedSize:we.get(r,24),filenameLength:Te.get(r,28),extraFieldLength:Te.get(r,30),fileCommentLength:Te.get(r,32),relativeOffsetOfLocalHeader:we.get(r,42),filename:null}},len:46}});function f1(r){let t=new Uint8Array(we.len);return we.put(t,0,r),t}function ZN(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;on+s.length,0),e=new Uint8Array(t),i=0;for(let n of r)e.set(n,i),i+=n.length;return e}var d1,Kr,Hy,KN,Fg,nl,p1=Kt(()=>{H();Ps();d1=jc(o1(),1);h1();Kr=(0,d1.default)("tokenizer:inflate"),Hy=256*1024,KN=f1(il.DataDescriptor),Fg=f1(il.EndOfCentralDirectory),nl=class r{constructor(t){this.tokenizer=t,this.syncBuffer=new Uint8Array(Hy)}async isZip(){return await this.peekSignature()===il.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(we)}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]===Fg[0]&&i[n+1]===Fg[1]&&i[n+2]===Fg[2]&&i[n+3]===Fg[3])return t.fileInfo.size-e+n;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){Kr("Cannot reading central-directory without random-read support");return}Kr("Reading central-directory...");let t=this.tokenizer.position,e=await this.findEndOfCentralDirectoryLocator();if(e>0){Kr("Central-directory 32-bit signature found");let i=await this.tokenizer.readToken(c1,e),n=[];this.tokenizer.setPosition(i.offsetOfStartOfCd);for(let s=0;s=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)}Kr(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),s.handler&&await this.inflate(n,QN(l),s.handler)}else s.handler?(Kr(`Reading compressed-file-data: ${n.compressedSize} bytes`),o=new Uint8Array(n.compressedSize),await this.tokenizer.readBuffer(o),await this.inflate(n,o,s.handler)):(Kr(`Ignoring compressed-file-data: ${n.compressedSize} bytes`),await this.tokenizer.ignore(n.compressedSize));if(Kr(`Reading data-descriptor at pos=${this.tokenizer.position}`),n.dataDescriptor&&(await this.tokenizer.readToken(jy)).signature!==134695760)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-jy.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}`);Kr(`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(we);if(t===il.LocalFileHeader){let e=await this.tokenizer.readToken(l1);return e.filename=await this.tokenizer.readToken(new Mi(e.filenameLength,"utf-8")),e}if(t===il.CentralFileHeader)return!1;throw t===3759263696?new Error("Encrypted ZIP"):new Error("Unexpected signature")}}});var tf,m1=Kt(()=>{H();tf=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 Gy=Kt(()=>{H();p1();m1()});function e_(r,t,e){return r?r.constructor===t?!0:JN.call(r)===e:!1}function i_(r){return e_(r,Uint8Array,t_)}function n_(r){if(!i_(r))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof r}\``)}function g1(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)n_(n),e.set(n,i),i+=n.length;return e}function $y(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 JN,t_,dR,fR,pR,Vy=Kt(()=>{H();JN=Object.prototype.toString,t_="[object Uint8Array]";dR={utf8:new globalThis.TextDecoder("utf8")},fR=new globalThis.TextEncoder,pR=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"))});function x1(r,t){if(t==="utf-16le"){let e=[];for(let i=0;i>8&255)}return e}if(t==="utf-16be"){let e=[];for(let i=0;i>8&255,n&255)}return e}return[...r].map(e=>e.charCodeAt(0))}function y1(r,t=0){let e=Number.parseInt(new Mi(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{H();Ps();b1={get:(r,t)=>r[t+3]&127|(r[t+2]&127)<<7|(r[t+1]&127)<<14|(r[t]&127)<<21,len:4}});var A1,v1,E1=Kt(()=>{H();A1=["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"],v1=["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 Pg(r,t,e){if(!Number.isFinite(r)||r<0||r>t)throw new mn(`${e} has invalid size ${r} (maximum ${t} bytes)`);return r}async function gn(r,t,{maximumLength:e=16777216,reason:i="skip"}={}){let n=Pg(t,e,i);await r.ignore(n)}async function ef(r,t,e,{maximumLength:i=t.length,reason:n="read"}={}){let s=e?.length??t.length,o=Pg(s,i,n);return r.readBuffer(t,{...e,length:o})}function Kn(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 Ge(r){let t=r.fileInfo.size;return!Number.isFinite(t)||t===Number.MAX_SAFE_INTEGER}function Rs(r,t,e){return Ge(r)&&r.position-t>e}var mn,yu=Kt(()=>{H();mn=class extends Error{}});async function l_(r,{maximumLength:t=Ls}={}){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 c_(r,t){let e=new Uint8Array(t),i=0;for(let n of r)e.set(n,i),i+=n.length;return e}function u_(r){let t=r.fileInfo.size,e=Number.isFinite(t)?Math.max(0,t-r.position):Number.MAX_SAFE_INTEGER;return Math.min(e,r_)}function h_(r){if(r instanceof $t||r instanceof mn)return!0;if(!(r instanceof Error))return!1;if(s_.has(r.message)||o_.has(r.code))return!0;for(let t of a_)if(r.message.startsWith(t))return!0;return!1}function S1(r,t=Ls){let e=[r.compressedSize,r.uncompressedSize];for(let i of e)if(!Number.isFinite(i)||i<0||i>t)return!1;return!0}function d_(){return{hasDocumentEntry:!1,hasMasterSlideEntry:!1,hasTablesEntry:!1,hasCalculationEngineEntry:!1}}function f_(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 D1(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 k1(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 p_(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function m_(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 N1(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 I1(r){if(!(!r.hasContentTypesEntry||r.hasUnparseableContentTypes||r.isParsingContentTypes||r.hasParsedContentTypesEntry))return N1(r)}function g_(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 y_(r,t){if(r.length=0?0:l===n?Math.min(x_,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(Ge(r.tokenizer)||(r.knownSizeDescriptorScannedBytes+=o),!!t)return c_(s,o)}function w_(r,t){return Ge(r.tokenizer)?Math.max(0,16777216-(r.tokenizer.position-t)):Math.max(0,Ls-r.knownSizeDescriptorScannedBytes)}async function A_(r,t,{shouldBuffer:e,maximumDescriptorLength:i=Ls}={}){if(t.dataDescriptor&&t.compressedSize===0)return b_(r,{shouldBuffer:e,maximumLength:i});if(!e){await gn(r.tokenizer,t.compressedSize,{maximumLength:Ge(r.tokenizer)?Ls:r.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let n=u_(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 M1(r){let t,e=p_(),i=d_();try{await new nl(r).unzip(s=>{if(m_(e,s.filename),f_(i,s.filename),i.hasDocumentEntry&&(i.hasMasterSlideEntry||i.hasTablesEntry))return t=D1(i),{stop:!0};let o=s.filename==="[Content_Types].xml",l=I1(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 S1(s,T1)?{async handler(c){let u=new TextDecoder("utf-8").decode(c).trim();t=k1(u)},stop:!0}:{};case"[Content_Types].xml":return e.hasContentTypesEntry=!0,S1(s,T1)?(e.isParsingContentTypes=!0,{async handler(c){let u=new TextDecoder("utf-8").decode(c),h=g_(u);h&&(t=k1(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(!h_(s))throw s;e.isParsingContentTypes&&(e.isParsingContentTypes=!1,e.hasUnparseableContentTypes=!0),!t&&s instanceof $t&&!e.hasContentTypesEntry&&(t=N1(e))}let n=Ge(r)&&i.hasDocumentEntry&&!i.hasMasterSlideEntry&&!i.hasTablesEntry&&!i.hasCalculationEngineEntry?void 0:D1(i);return t??I1(e)??n??{ext:"zip",mime:"application/zip"}}var Ls,C1,r_,T1,s_,a_,o_,_1,Og,x_,F1=Kt(()=>{H();Ps();Jd();Gy();yu();Ls=1024*1024,C1=1024,r_=2**31-1,T1=Ls,s_=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),a_=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],o_=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);_1=134695760,Og=16,x_=Og-1;nl.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 l_(t,{maximumLength:Ls});return e(i)};nl.prototype.unzip=async function(r){let t=!1,e=0,i=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(Rs(this.tokenizer,i,16777216))throw new mn(`ZIP stream probing exceeds ${16777216} bytes`);let n=await this.readLocalFileHeader();if(!n)break;if(e++,e>C1)throw new Error(`ZIP entry count exceeds ${C1}`);let s=r(n);t=!!s.stop,await this.tokenizer.ignore(n.extraFieldLength);let o=await A_(this,n,{shouldBuffer:!!s.handler,maximumDescriptorLength:Math.min(Ls,w_(this,i))});if(s.handler&&await this.inflate(n,o,s.handler),n.dataDescriptor){let l=new Uint8Array(Og);if(await this.tokenizer.readBuffer(l),we.get(l,0)!==_1)throw new Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-l.length}`)}if(Rs(this.tokenizer,i,16777216))throw new mn(`ZIP stream probing exceeds ${16777216} bytes`)}while(!t)}});async function R1(r){async function t(){let l=await r.peekNumber($E),c=128,u=0;for(;(l&c)===0&&c!==0;)++u,c>>=1;let h=new Uint8Array(u+1);return await ef(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:$y(h),len:$y(d)}}async function i(l){let c=0;for(;l>0;){if(c++,c>v_||Rs(r,s,16777216))return;let u=r.position,h=await e();if(h.id===17026){if(h.len>P1)return;let d=Pg(h.len,P1,"EBML DocType");return(await r.readToken(new Mi(d))).replaceAll(new RegExp("\\0.*$","gv"),"")}if(Ge(r)&&(!Number.isFinite(h.len)||h.len<0||h.len>O1)||(await gn(r,h.len,{maximumLength:Ge(r)?O1: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 P1,O1,v_,L1=Kt(()=>{H();Ps();Vy();yu();P1=64,O1=1024*1024,v_=256});function T_(r){return(r.codePointAt(0)&32)!==0}async function U1(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(VE),type:await r.readToken(new Mi(4,"latin1"))}}let n=Ge(r),s=r.position,o=0,l=!1;do{if(o++,o>E_||Rs(r,s,C_))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>B1)return l&&T_(u.type)?t:void 0;try{await gn(r,u.length+4,{maximumLength:n?B1+4:r.fileInfo.size,reason:"PNG chunk payload"})}catch(h){if(!n&&(h instanceof mn||h instanceof $t))return t;throw h}}if(r.position<=c)break}while(r.position+8{H();Ps();Jd();yu();E_=512,C_=16*1024*1024,B1=1024*1024});async function H1(r){let t=!1;try{async function e(){let o=new Uint8Array(16);return await ef(r,o,void 0,{maximumLength:o.length,reason:"ASF header GUID"}),{id:o,size:Number(await r.readToken(qE))}}await gn(r,30,{maximumLength:30,reason:"ASF header prelude"});let i=Ge(r),n=r.position,s=0;for(;r.position+24S_||Rs(r,n,16777216)));){let o=r.position,l=await e(),c=l.size-24;if(!Number.isFinite(c)||c<0){t=!0;break}if(Kn(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 ef(r,u,void 0,{maximumLength:u.length,reason:"ASF stream type GUID"}),Kn(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(Kn(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>j1){t=!0;break}if(await gn(r,c,{maximumLength:i?j1:r.fileInfo.size,reason:"ASF header payload"}),r.position<=o){t=!0;break}}}catch(e){if(e instanceof $t||e instanceof mn)Ge(r)&&(t=!0);else throw e}if(!t)return{ext:"asf",mime:"application/vnd.ms-asf"}}var S_,j1,G1=Kt(()=>{H();Ps();Jd();yu();S_=512,j1=1024*1024});var K1={};Hx(K1,{FileTypeParser:()=>Bs,fileTypeFromBlob:()=>B_,fileTypeFromBuffer:()=>L_,fileTypeFromFile:()=>G_,fileTypeFromStream:()=>R_,fileTypeFromTokenizer:()=>U_,fileTypeStream:()=>z_,normalizeSampleSize:()=>Y1,reasonableDetectionSizeInBytes:()=>bu,supportedExtensions:()=>j_,supportedMimeTypes:()=>H_});function Y1(r){return Number.isFinite(r)?Math.max(1,Math.trunc(r)):bu}function M_(r){return Number.isFinite(r)?Math.max(0,Math.min(D_,Math.trunc(r))):0}function F_(r){return Number.isFinite(r)?Math.max(0,r):Number.MAX_SAFE_INTEGER}function W1(r){return import(r)}function P_(r){return r.pipeThrough(new TransformStream)}function X1(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 O_(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 R_(r,t){return new Bs(t).fromStream(r)}async function L_(r,t){return new Bs(t).fromBuffer(r)}async function B_(r,t){return new Bs(t).fromBlob(r)}async function U_(r,t){return new Bs(t).fromTokenizer(r)}async function z_(r,t){return new Bs(t).toDetectionStream(r,t)}async function G_(r,t){return new Bs(t).fromFile(r)}var bu,D_,k_,I_,$1,qy,N_,V1,__,q1,Bs,j_,H_,Z1=Kt(()=>{H();Ps();Jd();Gy();Vy();w1();E1();yu();F1();L1();z1();G1();bu=4100,D_=bu-2,k_=16777216,I_=1,$1=100,qy=16777216,N_=512,V1=256,__=1024*1024,q1=16777216;Bs=class r{constructor(t){z(this,"detectConfident",async t=>{if(this.buffer=new Uint8Array(bu),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,Ge(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>=V1?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 gn(t,6,{maximumLength:6,reason:"ID3 header prefix"});let e=await t.readToken(b1),i=Ge(t);if(!Number.isFinite(e)||e<0||i&&(e>qy||t.position+e>qy))return;if(t.position+e>t.fileInfo.size)return i?void 0:{ext:"mp3",mime:"audio/mpeg"};try{await gn(t,e,{maximumLength:i?qy:t.fileInfo.size,reason:"ID3 payload"})}catch(n){if(n instanceof $t)return;throw n}return this.detectionReentryCount>=V1?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 M1(t);if(this.checkString("OggS")){await t.ignore(28);let e=new Uint8Array(8);return await t.readBuffer(e),Kn(e,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/ogg; codecs=opus"}:Kn(e,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:Kn(e,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:Kn(e,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:Kn(e,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:Kn(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 R1(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=Ly.get(this.buffer,4),i=Zo.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("=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("!"))return await t.ignore(8),await t.readToken(new Mi(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("WEBVTT")&&[` `,"\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 U1(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 Mi(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 `))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 H1(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 Mi(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("=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})&&y1(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){let e="utf-16le";return this.checkString("{this.buffer=new Uint8Array(bu);let e=FN(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=MN(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 t1(PN(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 $t||o instanceof mn)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(e1(e,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let e=i1(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([W1("node:fs/promises"),W1("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=Y1(e?.sampleSize??bu),n,s=!1,o=t.getReader(),l=[],c=0;try{for(;c0){let d=l.length===1?l[0]:g1(l);try{n=await this.fromBuffer(d.subarray(0,i))}catch(f){if(!(f instanceof $t))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>=kN)return{ext:"gz",mime:"application/gzip"};let e=new tf(t),i=ON(e.inflate(),IN),n=Ge(t),s,o,l,c;if(n){let u=new AbortController;s=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${$1} ms`,"TimeoutError"))},$1),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 Kn(this.buffer,t,e)}checkString(t,e){return this.check(x1(t,e?.encoding),e)}async readTiffTag(t){let e=await this.tokenizer.readToken(t?Zo:Te);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?Zo:Te);if(!(e>_N)&&!(Ge(this.tokenizer)&&2+e*12>q1))for(let i=0;i=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(n>=8){let l=(t?Zo:Te).get(this.buffer,8),c=(t?Zo:Te).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(Ge(this.tokenizer)&&n>NN)return e;let s=Ge(this.tokenizer)?q1:this.tokenizer.fileInfo.size;try{await gn(this.tokenizer,n,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof $t)return;throw l}let o;try{o=await this.readTiffIFD(t)}catch(l){if(l instanceof $t)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"}}}},jN=new Set(A1),HN=new Set(v1)});var PS={};Hx(PS,{AbortException:()=>Lr,AnnotationEditorLayer:()=>sx,AnnotationEditorParamsType:()=>Ht,AnnotationEditorType:()=>kt,AnnotationEditorUIManager:()=>Lo,AnnotationLayer:()=>Q0,AnnotationMode:()=>Ea,AnnotationType:()=>$e,CSSConstants:()=>P0,ColorPicker:()=>$f,DOMSVGFactory:()=>Pc,DrawLayer:()=>ax,FeatureTest:()=>Be,GlobalWorkerOptions:()=>dr,ImageKind:()=>kf,InvalidPDFException:()=>hd,MathClamp:()=>ai,OPS:()=>ud,OutputScale:()=>Es,PDFDataRangeTransport:()=>Gf,PDFDateString:()=>Nc,PDFWorker:()=>xd,PasswordResponses:()=>EC,PermissionFlag:()=>vC,PixelsPerInch:()=>Da,RenderingCancelledException:()=>dd,ResponseException:()=>Mc,SignatureExtractor:()=>fr,SupportedImageMimeTypes:()=>F0,TextLayer:()=>gd,TextLayerImages:()=>ox,TouchManager:()=>Uf,Util:()=>ht,VerbosityLevel:()=>jm,XfaLayer:()=>Lf,applyOpacity:()=>IC,build:()=>zT,createValidAbsoluteUrl:()=>_w,fetchData:()=>Rx,findContrastColor:()=>kC,getDocument:()=>RT,getFilenameFromUrl:()=>TC,getPdfFilenameFromUrl:()=>SC,getRGB:()=>wd,getUuid:()=>Mw,getXfaPageViewport:()=>DC,isDataScheme:()=>Hm,isPdfFile:()=>Lx,isValidExplicitDest:()=>uT,makeArr:()=>Px,makeMap:()=>Ox,makeObj:()=>N0,noContextMenu:()=>Hn,normalizeUnicode:()=>CC,renderRichText:()=>Fw,setLayerDimensions:()=>Ro,shadow:()=>_t,stopEvent:()=>ke,updateUrlHash:()=>Nw,version:()=>UT});function VN(r){Number.isInteger(r)&&(Nx=r)}function qN(){return Nx}function Mx(r){Nx>=jm.INFOS&&console.info(`Info: ${r}`)}function Mt(r){Nx>=jm.WARNINGS&&console.warn(`Warning: ${r}`)}function ie(r){throw new Error(r)}function _e(r,t){r||ie(t)}function WN(r){switch(r?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function _w(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=QN(r)}catch{}let i=t?URL.parse(r,t):URL.parse(r);return WN(i)?i:null}function Nw(r,t,e=!1){let i=URL.parse(r);return i?(i.hash=t,i.href):e&&_w(r,"http://example.com")?r.split("#",1)[0]+`${t?`#${t}`:""}`:""}function Jy(r){return r.substring(r.lastIndexOf("/")+1)}function _t(r,t,e,i=!1){return Object.defineProperty(r,t,{value:e,enumerable:!i,configurable:!0,writable:!1}),e}function XN(r){(typeof r!="object"||r?.length===void 0)&&ie("Invalid argument for bytesToString");let t=r.length,e=8192;if(t>24&255,r>>16&255,r>>8&255,r&255)}function KN(){let r=new Uint8Array(4);return r[0]=1,new Uint32Array(r.buffer,0,1)[0]===1}function ZN(){try{return new Function(""),!0}catch{return!1}}function QN(r){return decodeURIComponent(escape(r))}function CC(r){return Xy||(Xy=/([\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,Q1=new Map([["\uFB05","\u017Ft"]])),r.replaceAll(Xy,(t,e,i)=>e?e.normalize("NFKC"):Q1.get(i))}function Mw(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let r=new Uint8Array(32);return crypto.getRandomValues(r),XN(r)}function JN(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 ai(r,t,e){return Math.min(Math.max(r,t),e)}async function Rx(r,t="text"){if(Nf(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 Hm(r){let t=r.length,e=0;for(;e{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=Jy(c),/^\.pdf$/i.test(c))?l:c}catch{return l}},s=/\.pdf$/i,o=Jy(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 Nf(r,t){let e=t?URL.parse(r,t):URL.parse(r);return/https?:/.test(e?.protocol??"")}function Hn(r){r.preventDefault()}function ke(r){r.preventDefault(),r.stopPropagation()}function tM(r){console.log("Deprecated API usage: "+r)}function DC(r,{scale:t=1,rotation:e=0}){let{width:i,height:n}=r.attributes.style,s=[0,0,parseInt(i),parseInt(n)];return new Bf({viewBox:s,userUnit:1,scale:t,rotation:e})}function wd(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)):(Mt(`Not a valid color format: "${r}"`),[0,0,0])}function eM(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,wd(i))}t.remove()}function Ie(r){let{a:t,b:e,c:i,d:n,e:s,f:o}=r.getTransform();return[t,e,i,n,s,o]}function Zr(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 Ro(r,t,e=!1,i=!0){if(t instanceof Bf){let{pageWidth:n,pageHeight:s}=t.rawDims,{style:o}=r,l=Be.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 IC(r,t){t=ai(t??1,0,1);let e=255*(1-t);return r.map(i=>Math.round(i*t+e))}function J1(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+(in?(i+.05)/(n+.05):(n+.05)/(i+.05)}function kC(r,t){let e=r[0]+r[1]*256+r[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,i=iC.get(e);if(i)return i;let n=new Float32Array(9),s=n.subarray(0,3),o=n.subarray(3,6);J1(r,o);let l=n.subarray(6,9);J1(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]),eC(o,l,s)f;){let m=o[2]=(h+d)/2;c===eC(o,l,s)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,y=(c[e*2+1]+t.offsetY)*t.scaleY,g=(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(y>=v)return;let T=u[s*4],k=u[s*4+1],N=u[s*4+2],F=u[o*4],L=u[o*4+1],Y=u[o*4+2],q=u[l*4],G=u[l*4+1],j=u[l*4+2],tt=Math.round(y),et=Math.round(v),_,X,O,C,D,E,S,I;for(let M=tt;M<=et;M++){if(Mv?V=1:A===v?V=0:V=(A-M)/(A-v),_=g-(g-w)*V,X=F-(F-q)*V,O=L-(L-G)*V,C=Y-(Y-j)*V}let P;Mv?P=1:P=(y-M)/(y-v),D=m-(m-w)*P,E=T-(T-q)*P,S=k-(k-G)*P,I=N-(N-j)*P;let B=Math.round(Math.min(_,D)),$=Math.round(Math.max(_,D)),U=d*M+B*4;for(let V=B;V<=$;V++)P=(_-V)/(_-D),P<0?P=0:P>1&&(P=1),h[U++]=X-(X-E)*P|0,h[U++]=O-(O-S)*P|0,h[U++]=C-(C-I)*P|0,h[U++]=255}}function uM(r,t,e){let i=t.coords,n=t.colors,s,o;switch(t.type){case ul.LATTICE:let l=t.verticesPerRow,c=Math.floor(i.length/l)-1,u=l-1;for(s=0;s>3,d=i&7,f=c^u,m=r.length;e=new Uint32Array(e.buffer);let y=0;for(let g=0;g>7&1)&f,e[y+1]=c^-(v>>6&1)&f,e[y+2]=c^-(v>>5&1)&f,e[y+3]=c^-(v>>4&1)&f,e[y+4]=c^-(v>>3&1)&f,e[y+5]=c^-(v>>2&1)&f,e[y+6]=c^-(v>>1&1)&f,e[y+7]=c^-(v&1)&f}if(d===0)continue;let A=t>7-w&1)&f}return{srcPos:t,destPos:y}}function pM(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 Bg(r,t,e,i,n,s,o,l,c,u){let[h,d,f,m,y,g]=Ie(r);if(d===0&&f===0){let v=o*h+y,T=Math.round(v),k=l*m+g,N=Math.round(k),F=(o+c)*h+y,L=Math.abs(Math.round(F)-T)||1,Y=(l+u)*m+g,q=Math.abs(Math.round(Y)-N)||1;return r.setTransform(Math.sign(h),0,0,Math.sign(m),T,N),r.drawImage(t,e,i,n,s,0,0,L,q),r.setTransform(h,d,f,m,y,g),[L,q]}if(h===0&&m===0){let v=l*f+y,T=Math.round(v),k=o*d+g,N=Math.round(k),F=(l+u)*f+y,L=Math.abs(Math.round(F)-T)||1,Y=(o+c)*d+g,q=Math.abs(Math.round(Y)-N)||1;return r.setTransform(0,Math.sign(d),Math.sign(f),0,T,N),r.drawImage(t,e,i,n,s,0,0,q,L),r.setTransform(h,d,f,m,y,g),[q,L]}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 fC(r,t){if(t instanceof ImageData){r.putImageData(t,0,0);return}let e=t.height,i=t.width,n=e%pn,s=(e-n)/pn,o=n===0?s:s+1,l=r.createImageData(i,pn),c=0,u,h=t.data,d=l.data,f,m,y,g;if(t.kind===kf.GRAYSCALE_1BPP){let A=h.byteLength,w=new Uint32Array(d.buffer,0,d.byteLength>>2),v=w.length,T=i+7>>3,k=4294967295,N=Be.isLittleEndian?4278190080:255;for(f=0;fT?i:F*8-7,q=Y&-8,G=0,j=0;for(;L>=1}for(;u=s&&(y=n,g=i*y),u=0,m=g;m--;)d[u++]=h[c++],d[u++]=h[c++],d[u++]=h[c++],d[u++]=255;r.putImageData(l,0,f*pn)}else throw new Error(`bad image kind: ${t.kind}`)}function pC(r,t){if(t.bitmap){r.drawImage(t.bitmap,0,0);return}let e=t.height,i=t.width,n=e%pn,s=(e-n)/pn,o=n===0?s:s+1,l=r.createImageData(i,pn),c=0,u=t.data,h=l.data;for(let d=0;d0?r.rangeChunkSize:2**16,h=r.worker instanceof xd?r.worker:null,d=r.verbosity,f=typeof r.docBaseUrl=="string"&&!Hm(r.docBaseUrl)?r.docBaseUrl:null,m=Rg(r.cMapUrl),y=r.cMapPacked!==!1,g=Rg(r.iccUrl),A=Rg(r.standardFontDataUrl),w=Rg(r.wasmUrl),v=r.stopAtErrors!==!0,T=Number.isInteger(r.maxImageSize)&&r.maxImageSize>-1?r.maxImageSize:-1,k=r.isEvalSupported!==!1,N=typeof r.isOffscreenCanvasSupported=="boolean"?r.isOffscreenCanvasSupported:!Bn,F=typeof r.isImageDecoderSupported=="boolean"?r.isImageDecoderSupported:!Bn&&(Be.platform.isFirefox||!globalThis.chrome),L=Number.isInteger(r.canvasMaxAreaInBytes)?r.canvasMaxAreaInBytes:-1,Y=typeof r.disableFontFace=="boolean"?r.disableFontFace:Bn,q=r.fontExtraProperties===!0,G=r.enableXfa===!0,j=r.ownerDocument||globalThis.document,tt=r.disableRange===!0,et=r.disableStream===!0,_=r.disableAutoFetch===!0,X=r.pdfBug===!0,O=r.CanvasFactory||(Bn?Vb:zb),C=r.FilterFactory||(Bn?$b:jb),D=r.BinaryDataFactory||(Bn?qb:z0),E=r.enableHWA===!0,S=r.enableWebGPU===!0,I=r.useWasm!==!1,M=r.pagesMapper||new b2,P=typeof r.useSystemFonts=="boolean"?r.useSystemFonts:!Bn&&!Y,B=typeof r.useWorkerFetch=="boolean"?r.useWorkerFetch:!!(D===z0&&m&&y&&A&&w&&Nf(m,document.baseURI)&&Nf(A,document.baseURI)&&Nf(w,document.baseURI)),$=null;VN(d);let U={canvasFactory:new O({ownerDocument:j,enableHWA:E}),filterFactory:new C({docId:e,ownerDocument:j}),binaryDataFactory:B?null:new D({cMapUrl:m,standardFontDataUrl:A,wasmUrl:w})};h||(h=xd.create({verbosity:d,port:dr.workerPort}),t._worker=h);let V={docId:e,apiVersion:"5.6.205",data:n,password:l,disableAutoFetch:_,rangeChunkSize:u,docBaseUrl:f,enableXfa:G,evaluatorOptions:{maxImageSize:T,disableFontFace:Y,ignoreErrors:v,isEvalSupported:k,isOffscreenCanvasSupported:N,isImageDecoderSupported:F,canvasMaxAreaInBytes:L,fontExtraProperties:q,useSystemFonts:P,useWasm:I,useWorkerFetch:B,cMapUrl:m,cMapPacked:y,iccUrl:g,standardFontDataUrl:A,wasmUrl:w,enableWebGPU:S}},Z={ownerDocument:j,pdfBug:X,styleElement:$,enableHWA:E,loadingParams:{disableAutoFetch:_,enableXfa:G}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let Q=h.messageHandler.sendWithPromise("GetDocRequest",V,n?[n.buffer]:null),nt;if(!n)if(c)nt=new r2({pdfDataRangeTransport:c,disableRange:tt,disableStream:et});else if(i){let at=wM(i);nt=new at({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 Q.then(at=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let dt=new hl(e,at,h.port),ot=new T2(dt,t,nt,Z,U,M);t._transport=ot,dt.send("Ready",null)})}).catch(t._capability.reject),t}function AC(r){return Math.floor(Math.max(0,Math.min(1,r))*255).toString(16).padStart(2,"0")}function sf(r){return Math.max(0,Math.min(255,255*r))}function Hg(r){return`${(r*100).toFixed(2)}%`}var Gg,Bn,Qy,$g,$N,YR,Ln,Ea,Of,kt,Ht,vC,ul,ni,kf,$e,Au,jm,ud,nf,EC,Nx,Lc,_0,_f,hd,Mc,tb,Lr,Be,Wy,Ca,Vg,eb,ht,Xy,Q1,_u,Px,Ox,N0,Rf,Lf,Us,ol,Da,Bf,dd,ja,M0,Zf,Nc,Es,F0,ib,P0,iC,Ha,Ga,Jn,tr,Qf,$a,Ru,Lu,Jf,lx,NC,Ni,MC,FC,vu,of,Hs,rb,tp,dl,$s,ka,PC,OC,ab,sb,fl,pl,Bu,ml,ce,Oi,cx,ob,Uu,ep,Ri,zu,qg,Ow,lb,Ve,Va,ip,Se,cb,ux,LC,Fc,hx,ub,ju,wn,Hu,Pe,De,Gu,$u,qi,Vu,er,ui,qa,Wa,Xa,Ya,ts,ir,gl,np,rp,qu,sp,es,Ka,Wu,Za,is,dx,Vs,Xu,ap,Qa,xl,Yu,Ja,op,Qe,ae,qs,to,eo,lp,Ku,cp,io,ns,Ws,up,hp,nr,mt,Wg,hb,BC,UC,zC,lf,jC,HC,GC,db,$C,VC,qC,WC,$i,zs,XC,YC,fb,KC,cf,pb,Fu,Lo,hi,rs,Ar,Zu,ss,An,Qu,as,cn,Xs,yl,os,no,Or,uf,Xg,Vi,O0,Ei,rr,bl,ye,dp,ro,sr,so,ao,wl,fp,mb,Nu,Ju,Al,pp,mp,gp,xp,yp,Ys,vl,Ks,El,Zs,Bo,ZC,QC,JC,Rw,Uf,Cl,vr,ve,oe,Qs,th,oo,bp,Ci,Tl,Js,ar,lo,wp,Sl,vn,Ap,Dl,ta,ls,eh,ih,or,Il,vp,fx,St,gb,Ep,xb,Yg,tT,eT,yb,Kg,bb,iT,nT,rT,wb,sT,Ab,aT,oT,lT,vb,hf,Nt,be,Eb,nC,Zn,Qr,R0,zf,kl,_l,ea,Ti,px,cT,jf,Cp,L0,wu,rC,sC,Cb,nh,co,Tb,oC,ia,ee,ue,Nl,Ml,Fl,Li,Tp,Db,Sb,un,hn,Pl,Er,rh,uo,ho,he,Ib,de,Oe,Cr,sh,ah,Lw,B0,Qn,Ol,Rl,Ll,Bl,Ul,Sp,Ff,kb,oh,_b,fe,Nb,Zg,Qg,Pi,yn,yi,Dp,mx,lh,ch,Jg,Mb,zl,uh,cs,jl,df,Fb,Tr,gx,qe,le,br,t0,e0,ff,Ob,Pb,Rb,hh,Lb,Bb,rM,uT,na,xx,Ub,Lg,Ze,dh,mr,hT,dT,fT,i0,hl,yx,U0,z0,Ip,j0,zb,H0,Hl,fh,ra,sa,Bi,Gl,$l,yt,Fi,pf,Eu,n0,Cu,pT,Hb,Tu,mf,gf,Gb,xf,jb,$b,Vb,qb,aM,kp,ph,mh,gh,yd,mT,gT,Wb,Pw,ki,Hf,Xb,Yb,Kb,cC,bx,Zb,uC,hC,fM,dC,pn,Ky,Un,Mu,G0,mM,gM,xM,gC,Br,Qb,Jb,t2,Bw,Ou,_p,Np,fd,pd,md,e2,i2,n2,Mp,s2,r2,Fp,a2,Pp,o2,Zy,yC,us,bd,ET,CT,l2,Op,Cs,TT,ST,DT,IT,c2,Rp,_a,kT,_T,h2,u2,d2,f2,p2,Lp,Bp,dr,xh,Up,m2,Su,zp,jp,Hp,yh,g2,fo,pe,bh,wh,Gp,y2,x2,We,Sr,Si,Vl,hs,zi,yf,bf,s0,b2,Du,bC,lr,$0,AM,wC,po,Wi,$p,Vp,Ah,ql,aa,qp,Wp,Wl,Xp,vh,mo,Eh,Yp,Ch,Xl,Kp,Zp,Th,Yl,Qp,Sh,Dh,Na,MT,FT,w2,jn,a0,A2,PT,OT,vi,gd,vM,wx,Ax,v2,Ih,Jp,tm,em,Gf,E2,oa,Kl,Zl,wf,Uw,C2,go,Dr,la,Ql,vx,Jl,tc,Zi,o0,LT,BT,Af,kh,l0,Fe,xd,En,ec,ca,Ir,ic,_h,ua,Rr,vf,c0,T2,S2,xo,nc,ll,D2,UT,zT,Cn,rc,Nh,si,im,Mh,ha,nm,yo,kr,rm,me,I2,k2,_2,rl,jT,za,ln,$f,ds,sm,Fh,am,cl,V0,q0,N2,Pc,EM,Oc,CM,Mf,sc,Ph,cr,om,M2,zw,Ne,F2,zn,sl,HT,GT,Vf,P2,Ia,O2,R2,L2,W0,B2,U2,lm,z2,qf,Tn,bo,Ex,Cx,Oh,Rh,Re,fs,wo,ac,Lh,Bh,ps,Sn,da,fa,Le,pa,Ao,cm,ma,Uh,oc,vo,di,Eo,Ot,u0,H2,G2,$2,h0,V2,$T,VT,qT,WT,d0,f0,q2,j2,X0,um,W2,hm,X2,dm,Y2,fm,Y0,K2,Z2,pm,lc,mm,Q2,Wf,K0,J2,tw,ew,Z0,gm,xm,nw,iw,cc,uc,zh,Co,ym,hc,Dn,bm,Ta,p0,rw,jw,Q0,zg,In,wm,dc,kn,Je,XT,YT,KT,m0,Sa,g0,x0,ZT,aw,QT,Ae,sw,xt,_n,_r,jh,Hh,ms,Lt,fc,pc,Am,vm,Gh,$h,To,Em,Tx,Sx,oi,Ef,JT,tS,eS,iS,nS,rS,Gs,J0,Vh,mc,ga,Cm,Nn,Tm,Xe,Dx,sS,tx,Sm,Dm,Im,So,Nr,Qi,aS,y0,oS,lS,ow,Xf,km,qh,lw,Yf,cw,Wh,_m,xa,gc,Nm,dn,Mm,Fm,xc,Mn,Fn,Di,Xh,Yh,Ui,Kh,ur,Pm,Pt,uw,b0,cS,uS,hS,hw,al,pr,Iu,dS,w0,A0,fS,pS,mS,gS,xS,te,ex,yc,ix,Pn,Zh,fi,bc,wc,Wt,dw,fw,pw,Cf,yS,v0,Tf,ku,jt,nx,gs,pi,mi,Ac,Qh,Xi,Ii,hr,vc,Ec,Cc,Jh,E0,mw,Yi,Om,Rm,On,xs,ys,td,ed,Tc,_i,js,bS,wS,AS,Rc,rx,Ix,vS,Pu,gw,Kf,jg,af,Sc,ne,xw,Mr,ES,CS,yw,C0,TS,SS,DS,bw,ww,IS,fr,Aw,vw,Do,bs,Io,Dc,bn,Ew,Ee,gi,ko,ya,_o,id,ba,Ic,ws,Rn,nd,Xt,Df,If,T0,S0,D0,Cw,I0,kS,Sf,kc,rd,No,Mo,wa,fn,Fo,sd,ad,Fr,Aa,xi,va,Po,od,wt,Oo,ge,Tw,_S,Jr,Sw,Dw,k0,wr,sx,Pr,Ki,_c,Lm,kx,NS,Ts,Iw,MS,kw,ri,ax,ld,Bm,Um,cd,As,vs,zm,_x,FS,Pf,ox,OS=Kt(()=>{H();Gg={};Gg.d=(r,t)=>{for(var e in t)Gg.o(t,e)&&!Gg.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})};Gg.o=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);Bn=typeof it.default=="object"&&it.default+""=="[object process]"&&!it.default.versions.nw&&!(it.default.versions.electron&&it.default.type&&it.default.type!=="browser"),Qy=[.001,0,0,.001,0,0],$g=1.35,$N=.35,YR=$N/$g,Ln={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ea={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Of="pdfjs_internal_editor_",kt={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},Ht={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},vC={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},ul={TRIANGLES:1,LATTICE:2,PATCH:3},ni={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},kf={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},$e={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},Au={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},jm={ERRORS:0,WARNINGS:1,INFOS:5},ud={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},nf={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},EC={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},Nx=jm.WARNINGS;Lc=(function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t})(),_0=class extends Lc{constructor(t,e){super(t,"PasswordException"),this.code=e}},_f=class extends Lc{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},hd=class extends Lc{constructor(t){super(t,"InvalidPDFException")}},Mc=class extends Lc{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}},tb=class extends Lc{constructor(t){super(t,"FormatError")}},Lr=class extends Lc{constructor(t){super(t,"AbortException")}};Be=class{static get isLittleEndian(){return _t(this,"isLittleEndian",KN())}static get isEvalSupported(){return _t(this,"isEvalSupported",ZN())}static get isOffscreenCanvasSupported(){return _t(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return _t(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return _t(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return _t(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:t,userAgent:e}=navigator;return _t(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 _t(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}},Wy=Array.from(Array(256).keys(),r=>r.toString(16).padStart(2,"0")),ht=class{static makeHexColor(t,e,i){return`#${Wy[t]}${Wy[e]}${Wy[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],y=n*h+c,g=y,A=n*f+c,w=A,v=l*d+u,T=v,k=l*m+u,N=k;if(s!==0||o!==0){let F=s*h,L=s*f,Y=o*d,q=o*m;y+=Y,w+=Y,A+=q,g+=q,v+=F,N+=F,k+=L,T+=L}i[0]=Math.min(i[0],y,A,g,w),i[1]=Math.min(i[1],v,k,T,N),i[2]=Math.max(i[2],y,A,g,w),i[3]=Math.max(i[3],v,k,T,N)}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,Ca,eb).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,Ca,eb).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)}};Ca=new WeakSet,Vg=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,y=d*(d*(d*t+3*u*e)+3*f*i)+m*n,g=d*(d*(d*s+3*u*o)+3*f*l)+m*c;h[0]=Math.min(h[0],y),h[1]=Math.min(h[1],g),h[2]=Math.max(h[2],y),h[3]=Math.max(h[3],g)},eb=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,Ca,Vg).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 y=Math.sqrt(m),g=2*u;b(this,Ca,Vg).call(this,t,e,i,n,s,o,l,c,(-h+y)/g,f),b(this,Ca,Vg).call(this,t,e,i,n,s,o,l,c,(-h-y)/g,f)},x(ht,Ca);Xy=null,Q1=null;_u="pdfjs_internal_id_";Px=()=>[],Ox=()=>new Map,N0=()=>Object.create(null);typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(r){return r.reduce((t,e)=>t+e,0)});Rf=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")}},Lf=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&&Rf.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 y=d.children[++h.at(-1)[1]];if(y===null)continue;let{name:g}=y;if(g==="#text"){let w=document.createTextNode(y.value);u.push(w),m.append(w);continue}let A=y?.attributes?.xmlns?document.createElementNS(y.attributes.xmlns,g):document.createElement(g);if(m.append(A),y.attributes&&this.setAttributes({html:A,element:y,storage:e,intent:s,linkService:i}),y.children?.length>0)h.push([y,-1,A]);else if(y.value){let w=document.createTextNode(y.value);l&&Rf.shouldBuildText(g)&&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}},Us="http://www.w3.org/2000/svg",ol=class ol{};z(ol,"CSS",96),z(ol,"PDF",72),z(ol,"PDF_TO_CSS_UNITS",ol.CSS/ol.PDF);Da=ol;Bf=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 y,g,A,w;h===0?(y=Math.abs(u-t[1])*i+s,g=Math.abs(c-t[0])*i+o,A=(t[3]-t[1])*i,w=(t[2]-t[0])*i):(y=Math.abs(c-t[0])*i+s,g=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,y-h*i*c-f*i*u,g-d*i*c-m*i*u],this.width=A,this.height=w}get rawDims(){let t=this.viewBox;return _t(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 ht.applyTransform(i,this.transform),i}convertToViewportRectangle(t){let e=[t[0],t[1]];ht.applyTransform(e,this.transform);let i=[t[2],t[3]];return ht.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){let i=[t,e];return ht.applyInverseTransform(i,this.transform),i}},dd=class extends Lc{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};M0=class{constructor(){x(this,ja,new Map);z(this,"times",[])}time(t){a(this,ja).has(t)&&Mt(`Timer is already running for ${t}`),a(this,ja).set(t,Date.now())}timeEnd(t){a(this,ja).has(t)||Mt(`Timer has not been started for ${t}`),this.times.push({name:t,start:a(this,ja).get(t),end:Date.now()}),a(this,ja).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 -`).join("")}};ja=new WeakMap;Nc=class{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;a(this,Zf)||p(this,Zf,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));let e=a(this,Zf).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))}};Zf=new WeakMap,x(Nc,Zf);Es=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}},F0=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],ib=class{static get isDarkMode(){return _t(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}},P0=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(),_t(this,"commentForegroundColor",wd(i))}};iC=new Map;Hs=class Hs{constructor(t){x(this,Ni);x(this,Ha,null);x(this,Ga,null);x(this,Jn);x(this,tr,null);x(this,Qf,null);x(this,$a,null);x(this,Ru,null);x(this,Lu,null);p(this,Jn,t),a(Hs,Jf)||p(Hs,Jf,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,Ha,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=a(this,Jn)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",Hn,{signal:e}),t.addEventListener("pointerdown",b(Hs,lx,NC),{signal:e}));let i=p(this,tr,document.createElement("div"));i.className="buttons",t.append(i);let n=a(this,Jn).toolbarPosition;if(n){let{style:s}=t,o=a(this,Jn)._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,Ha)}hide(){a(this,Ha).classList.add("hidden"),a(this,Ga)?.hideDropdown()}show(){a(this,Ha).classList.remove("hidden"),a(this,Qf)?.shown(),a(this,$a)?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=a(this,Jn),i=document.createElement("button");i.classList.add("basic","deleteButton"),i.tabIndex=0,i.setAttribute("data-l10n-id",a(Hs,Jf)[t]),b(this,Ni,vu).call(this,i)&&i.addEventListener("click",n=>{e.delete()},{signal:e._signal}),a(this,tr).append(i)}async addAltText(t){let e=await t.render();b(this,Ni,vu).call(this,e),a(this,tr).append(e,a(this,Ni,of)),p(this,Qf,t)}addComment(t,e=null){if(a(this,$a))return;let i=t.renderForToolbar();if(!i)return;b(this,Ni,vu).call(this,i);let n=p(this,Ru,a(this,Ni,of));e?(a(this,tr).insertBefore(i,e),a(this,tr).insertBefore(n,e)):a(this,tr).append(i,n),p(this,$a,t),t.toolbar=this}addColorPicker(t){if(a(this,Ga))return;p(this,Ga,t);let e=t.renderButton();b(this,Ni,vu).call(this,e),a(this,tr).append(e,a(this,Ni,of))}async addEditSignatureButton(t){let e=p(this,Lu,await t.renderEditButton(a(this,Jn)));b(this,Ni,vu).call(this,e),a(this,tr).append(e,a(this,Ni,of))}removeButton(t){t==="comment"&&(a(this,$a)?.removeToolbarCommentButton(),p(this,$a,null),a(this,Ru)?.remove(),p(this,Ru,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,tr).querySelector(i);n&&t==="comment"&&this.addComment(e,n)}updateEditSignatureButton(t){a(this,Lu)&&(a(this,Lu).title=t)}remove(){a(this,Ha).remove(),a(this,Ga)?.destroy(),p(this,Ga,null)}};Ha=new WeakMap,Ga=new WeakMap,Jn=new WeakMap,tr=new WeakMap,Qf=new WeakMap,$a=new WeakMap,Ru=new WeakMap,Lu=new WeakMap,Jf=new WeakMap,lx=new WeakSet,NC=function(t){t.stopPropagation()},Ni=new WeakSet,MC=function(t){a(this,Jn)._focusEventsAllowed=!1,ke(t)},FC=function(t){a(this,Jn)._focusEventsAllowed=!0,ke(t)},vu=function(t){let e=a(this,Jn)._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",b(this,Ni,MC).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",b(this,Ni,FC).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Hn,{signal:e}),!0)},of=function(){let t=document.createElement("div");return t.className="divider",t},x(Hs,lx),x(Hs,Jf,null);rb=Hs,sb=class{constructor(t){x(this,ka);x(this,tp,null);x(this,dl,null);x(this,$s);p(this,$s,t)}show(t,e,i){let[n,s]=b(this,ka,OC).call(this,e,i),{style:o}=a(this,dl)||p(this,dl,b(this,ka,PC).call(this));t.append(a(this,dl)),o.insetInlineEnd=`${100*n}%`,o.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){a(this,dl).remove()}};tp=new WeakMap,dl=new WeakMap,$s=new WeakMap,ka=new WeakSet,PC=function(){let t=p(this,dl,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");let e=a(this,$s)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",Hn,{signal:e});let i=p(this,tp,document.createElement("div"));return i.className="buttons",t.append(i),a(this,$s).hasCommentManager()&&b(this,ka,ab).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{a(this,$s).commentSelection("floating_button")}),b(this,ka,ab).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{a(this,$s).highlightSelection("floating_button")}),t},OC=function(t,e){let i=0,n=0;for(let s of t){let o=s.y+s.height;if(oi){n=l,i=o;continue}e?l>n&&(n=l):l=1}static clearPointerType(){p(ce,ml,null)}static clearPointerIds(){p(ce,fl,NaN),p(ce,pl,null)}static clearTimeStamp(){p(ce,Bu,NaN)}};fl=new WeakMap,pl=new WeakMap,Bu=new WeakMap,ml=new WeakMap,x(ce,fl,NaN),x(ce,pl,null),x(ce,Bu,NaN),x(ce,ml,null);Oi=ce,ob=class{constructor(){x(this,cx,0)}get id(){return`${Of}${Ye(this,cx)._++}`}};cx=new WeakMap;Ow=class Ow{constructor(){x(this,zu);x(this,Uu,Mw());x(this,ep,0);x(this,Ri,null)}static get _isSVGFittingCanvas(){let t='data:image/svg+xml;charset=UTF-8,',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 _t(this,"_isSVGFittingCanvas",s)}async getFromFile(t){let{lastModified:e,name:i,size:n,type:s}=t;return b(this,zu,qg).call(this,`${e}_${i}_${n}_${s}`,t)}async getFromUrl(t){return b(this,zu,qg).call(this,t,t)}async getFromBlob(t,e){let i=await e;return b(this,zu,qg).call(this,t,i)}async getFromId(t){a(this,Ri)||p(this,Ri,new Map);let e=a(this,Ri).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,Ri)||p(this,Ri,new Map);let i=a(this,Ri).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,Uu)}_${Ye(this,ep)._++}`,refCounter:1,isSvg:!1},a(this,Ri).set(t,i),a(this,Ri).set(i.id,i),i}getSvgUrl(t){let e=a(this,Ri).get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){a(this,Ri)||p(this,Ri,new Map);let e=a(this,Ri).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,Uu)}_`)}};Uu=new WeakMap,ep=new WeakMap,Ri=new WeakMap,zu=new WeakSet,qg=async function(t,e){a(this,Ri)||p(this,Ri,new Map);let i=a(this,Ri).get(t);if(i===null)return null;if(i?.bitmap)return i.refCounter+=1,i;try{i||(i={bitmap:null,id:`image_${a(this,Uu)}_${Ye(this,ep)._++}`,refCounter:0,isSvg:!1});let n;if(typeof e=="string"?(i.url=e,n=await Rx(e,"blob")):e instanceof File?n=i.file=e:e instanceof Blob&&(n=e),n.type==="image/svg+xml"){let s=Ow._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){Mt(n),i=null}return a(this,Ri).set(t,i),i&&a(this,Ri).set(i.id,i),i};lb=Ow,cb=class{constructor(t=128){x(this,Ve,[]);x(this,Va,!1);x(this,ip);x(this,Se,-1);p(this,ip,t)}add({cmd:t,undo:e,post:i,mustExec:n,type:s=NaN,overwriteIfSameType:o=!1,keepUndo:l=!1}){if(n&&t(),a(this,Va))return;let c={cmd:t,undo:e,post:i,type:s};if(a(this,Se)===-1){a(this,Ve).length>0&&(a(this,Ve).length=0),p(this,Se,0),a(this,Ve).push(c);return}if(o&&a(this,Ve)[a(this,Se)].type===s){l&&(c.undo=a(this,Ve)[a(this,Se)].undo),a(this,Ve)[a(this,Se)]=c;return}let u=a(this,Se)+1;u===a(this,ip)?a(this,Ve).splice(0,1):(p(this,Se,u),u=0;e--)if(a(this,Ve)[e].type!==t){a(this,Ve).splice(e+1,a(this,Se)-e),p(this,Se,e);return}a(this,Ve).length=0,p(this,Se,-1)}}destroy(){p(this,Ve,null)}};Ve=new WeakMap,Va=new WeakMap,ip=new WeakMap,Se=new WeakMap;Fc=class{constructor(t){x(this,ux);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=Be.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,ux,LC).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||ke(e))}};ux=new WeakSet,LC=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};hx=class hx{get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return eM(t),_t(this,"_colors",t)}convert(t){let e=wd(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 hx._colorsMapping.get(i);return e}getHexCode(t){let e=this._colors.get(t);return e?ht.makeHexColor(...e):t}};z(hx,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));ub=hx,Fu=class Fu{constructor(t,e,i,n,s,o,l,c,u,h,d,f,m,y,g,A){x(this,mt);x(this,ju,new AbortController);x(this,wn,null);x(this,Hu,null);x(this,Pe,new Map);x(this,De,new Map);x(this,Gu,null);x(this,$u,null);x(this,qi,null);x(this,Vu,null);x(this,er,new cb);x(this,ui,null);x(this,qa,null);x(this,Wa,null);x(this,Xa,0);x(this,Ya,new Set);x(this,ts,null);x(this,ir,null);x(this,gl,new Set);z(this,"_editorUndoBar",null);x(this,np,!1);x(this,rp,!1);x(this,qu,!1);x(this,sp,null);x(this,es,null);x(this,Ka,null);x(this,Wu,null);x(this,Za,!1);x(this,is,null);x(this,dx,new ob);x(this,Vs,!1);x(this,Xu,!1);x(this,ap,!1);x(this,Qa,null);x(this,xl,null);x(this,Yu,null);x(this,Ja,null);x(this,op,null);x(this,Qe,kt.NONE);x(this,ae,new Set);x(this,qs,null);x(this,to,null);x(this,eo,null);x(this,lp,null);x(this,Ku,null);x(this,cp,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});x(this,io,[0,0]);x(this,ns,null);x(this,Ws,null);x(this,up,null);x(this,hp,null);x(this,nr,null);let w=this._signal=a(this,ju).signal;p(this,Ws,t),p(this,up,e),p(this,hp,i),p(this,$u,n),p(this,ui,s),p(this,to,o),p(this,Ku,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,Xu,!0)},{capture:!0,signal:w}),window.addEventListener("pointerup",()=>{p(this,Xu,!1)},{capture:!0,signal:w}),window.addEventListener("beforeunload",b(this,mt,BC).bind(this),{capture:!0,signal:w}),b(this,mt,jC).call(this),b(this,mt,WC).call(this),b(this,mt,db).call(this),p(this,qi,c.annotationStorage),p(this,sp,c.filterFactory),p(this,eo,u),p(this,Wu,h||null),p(this,np,d),p(this,rp,f),p(this,qu,m),p(this,op,y||null),this.viewParameters={realScale:Da.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=g||null,this._supportsPinchToZoom=A!==!1,s?.setSidebarUiManager(this)}static get _keyboardManager(){let t=Fu.prototype,e=o=>a(o,Ws).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 _t(this,"_keyboardManager",new Fc([[["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,Ws).contains(l)&&!o.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&a(o,Ws).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,nr)?.resolve(),p(this,nr,null),a(this,ju)?.abort(),p(this,ju,null),this._signal=null;for(let t of a(this,De).values())t.destroy();a(this,De).clear(),a(this,Pe).clear(),a(this,gl).clear(),a(this,Ja)?.clear(),p(this,wn,null),a(this,ae).clear(),a(this,er).destroy(),a(this,$u)?.destroy(),a(this,ui)?.destroy(),a(this,to)?.destroy(),a(this,is)?.hide(),p(this,is,null),a(this,Yu)?.destroy(),p(this,Yu,null),p(this,Hu,null),a(this,es)&&(clearTimeout(a(this,es)),p(this,es,null)),a(this,ns)&&(clearTimeout(a(this,ns)),p(this,ns,null)),this._editorUndoBar?.destroy(),p(this,Ku,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return a(this,op)}get useNewAltTextFlow(){return a(this,rp)}get useNewAltTextWhenAddingImage(){return a(this,qu)}get hcmFilter(){return _t(this,"hcmFilter",a(this,eo)?a(this,sp).addHCMFilter(a(this,eo).foreground,a(this,eo).background):"none")}get direction(){return _t(this,"direction",getComputedStyle(a(this,Ws)).direction)}get _highlightColors(){return _t(this,"_highlightColors",a(this,Wu)?new Map(a(this,Wu).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 _t(this,"highlightColors",null);let e=new Map,i=!!a(this,eo);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 _t(this,"highlightColors",e)}get highlightColorNames(){return _t(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,Wa,t)}setMainHighlightColorPicker(t){p(this,Yu,t)}editAltText(t,e=!1){a(this,$u)?.editAltText(this,t,e)}hasCommentManager(){return!!a(this,ui)}editComment(t,e,i,n){a(this,ui)?.showDialog(this,t,e,i,n)}selectComment(t,e){a(this,De).get(t)?.getEditorByUID(e)?.toggleComment(!0,!0)}updateComment(t){a(this,ui)?.updateComment(t.getData())}updatePopupColor(t){a(this,ui)?.updatePopupColor(t)}removeComment(t){a(this,ui)?.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,ui)?.toggleCommentPopup(t,e,i)}makeCommentColor(t,e){return t&&a(this,ui)?.makeCommentColor(t,e)||null}getCommentDialogElement(){return a(this,ui)?.dialogElement||null}async waitForEditorsRendered(t){if(a(this,De).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,to)?.getSignature({uiManager:this,editor:t})}get signatureManager(){return a(this,to)}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,qu,e)}onPageChanging({pageNumber:t}){p(this,Xa,t-1)}deletePage(t){for(let e of this.getEditors(t))e.remove();a(this,De).delete(t),a(this,Xa)===t&&p(this,Xa,0)}focusMainContainer(){a(this,Ws).focus()}findParent(t,e){for(let i of a(this,De).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,up).classList.toggle("noUserSelect",t)}addShouldRescale(t){a(this,gl).add(t)}removeShouldRescale(t){a(this,gl).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Da.PDF_TO_CSS_UNITS;for(let e of a(this,gl))e.onScaleChanging();a(this,Wa)?.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,mt,Wg).call(this,i).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;i.empty();let f=b(this,mt,hb).call(this,h),m=a(this,Qe)===kt.NONE,y=()=>{let g=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&&g?.editComment()};if(m){this.switchToMode(kt.HIGHLIGHT,y);return}y()}commentSelection(t=""){this.highlightSelection(t,!0)}getAndRemoveDataFromAnnotationStorage(t){if(!a(this,qi))return null;let e=`${Of}${t}`,i=a(this,qi).getRawValue(e);return i&&a(this,qi).remove(e),i}addToAnnotationStorage(t){!t.isEmpty()&&a(this,qi)&&!a(this,qi).has(t.id)&&a(this,qi).setValue(t.id,t)}a11yAlert(t,e=null){let i=a(this,hp);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,Za)&&(p(this,Za,!1),b(this,mt,lf).call(this,"main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of a(this,ae))if(e.div.contains(t)){p(this,xl,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!a(this,xl))return;let[t,e]=a(this,xl);p(this,xl,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){b(this,mt,db).call(this),this.setEditingState(!0)}removeEditListeners(){b(this,mt,$C).call(this),this.setEditingState(!1)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let i of a(this,ir))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,ir))if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),a(this,wn)?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let i of a(this,ae)){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,ir))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){Mt(`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,mt,fb).call(this,c);b(this,mt,pb).call(this,s)},l=()=>{for(let c of s)c.remove()};this.addCommands({cmd:o,undo:l,mustExec:!0})}catch(s){Mt(`paste: "${s.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),a(this,Qe)!==kt.NONE&&!this.isEditorHandlingKeyboard&&Fu._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,a(this,Za)&&(p(this,Za,!1),b(this,mt,lf).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,Gu).get(t);i&&(i.pageIndex=e,a(this,De).set(e,i),a(this,Vs)?i.enable():i.disable())}startUpdatePages(){p(this,Gu,new Map(a(this,De))),a(this,De).clear()}endUpdatePages(){p(this,Gu,null)}clonePage(t,e){for(let i of this.getEditors(t)){let n=i.serialize(i.mode!==kt.HIGHLIGHT);n&&(n.pageIndex=e,n.id=this.getId(),n.isClone=!0,delete n.popupRef,a(this,qi).setValue(n.id,n))}}findClonesForPage(t){let e=[],{pageIndex:i}=t;for(let[n,s]of a(this,qi))s.pageIndex===i&&s.isClone&&(a(this,qi).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,mt,HC).call(this),b(this,mt,VC).call(this),b(this,mt,$i).call(this,{isEditing:a(this,Qe)!==kt.NONE,isEmpty:b(this,mt,cf).call(this),hasSomethingToUndo:a(this,er).hasSomethingToUndo(),hasSomethingToRedo:a(this,er).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,mt,GC).call(this),b(this,mt,qC).call(this),b(this,mt,$i).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!a(this,ir)){p(this,ir,t);for(let e of a(this,ir))b(this,mt,zs).call(this,e.defaultPropertiesToUpdate)}}getId(){return a(this,dx).id}get currentLayer(){return a(this,De).get(a(this,Xa))}getLayer(t){return a(this,De).get(t)}get currentPageIndex(){return a(this,Xa)}addLayer(t){a(this,De).set(t.pageIndex,t),a(this,Vs)?t.enable():t.disable()}removeLayer(t){a(this,De).delete(t.pageIndex)}async updateMode(t,e=null,i=!1,n=!1,s=!1,o=!1){if(a(this,Qe)!==t&&!(a(this,nr)&&(await a(this,nr).promise,!a(this,nr)))){if(p(this,nr,Promise.withResolvers()),a(this,Wa)?.commitOrRemove(),a(this,Qe)===kt.POPUP&&a(this,ui)?.hideSidebar(),a(this,ui)?.destroyPopup(),p(this,Qe,t),t===kt.NONE){this.setEditingState(!1),b(this,mt,YC).call(this);for(let l of a(this,Pe).values())l.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),a(this,nr).resolve();return}for(let l of a(this,Pe).values())l.addStandaloneCommentButton();t===kt.SIGNATURE&&await a(this,to)?.loadSignatures(),i&&Oi.clearPointerType(),this.setEditingState(!0),await b(this,mt,XC).call(this),this.unselectAll();for(let l of a(this,De).values())l.updateMode(t);if(t===kt.POPUP){a(this,Hu)||p(this,Hu,await a(this,Ku).getAnnotationsByType(new Set(a(this,ir).map(u=>u._editorType))));let l=new Set,c=[];for(let u of a(this,Pe).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,Hu)){let{id:h,popupRef:d,contentsObj:f}=u;d&&f?.str&&!l.has(h)&&!a(this,Ya).has(h)&&c.push(u)}a(this,ui)?.showSidebar(c)}if(!e){n&&this.addNewEditorFromKeyboard(),a(this,nr).resolve();return}for(let l of a(this,Pe).values())l.uid===e?(this.setSelected(l),o?l.editComment():s?l.enterInEditMode():l.focus()):l.unselect();a(this,nr).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==a(this,Qe)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(a(this,ir)){switch(t){case Ht.CREATE:this.currentLayer.addNewEditor(e);return;case Ht.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(a(this,lp)||p(this,lp,new Map)).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(let i of a(this,ae))i.updateParams(t,e);else for(let i of a(this,ir))i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){for(let s of a(this,Pe).values())s.editorType===t&&s.show(e);(a(this,lp)?.get(Ht.HIGHLIGHT_SHOW_ALL)??!0)!==e&&b(this,mt,zs).call(this,[[Ht.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(a(this,ap)!==t){p(this,ap,t);for(let e of a(this,De).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(let e of a(this,Pe).values())e.pageIndex===t&&(yield e)}getEditor(t){return a(this,Pe).get(t)}addEditor(t){a(this,Pe).set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(a(this,es)&&clearTimeout(a(this,es)),p(this,es,setTimeout(()=>{this.focusMainContainer(),p(this,es,null)},0))),a(this,Pe).delete(t.id),t.annotationElementId&&a(this,Ja)?.delete(t.annotationElementId),this.unselect(t),(!t.annotationElementId||!a(this,Ya).has(t.annotationElementId))&&a(this,qi)?.remove(t.id)}addDeletedAnnotationElement(t){a(this,Ya).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return a(this,Ya).has(t)}removeDeletedAnnotationElement(t){a(this,Ya).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){a(this,wn)!==t&&(p(this,wn,t),t&&b(this,mt,zs).call(this,t.propertiesToUpdate))}updateUI(t){a(this,mt,KC)===t&&b(this,mt,zs).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){b(this,mt,zs).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(a(this,ae).has(t)){a(this,ae).delete(t),t.unselect(),b(this,mt,$i).call(this,{hasSelectedEditor:this.hasSelection});return}a(this,ae).add(t),t.select(),b(this,mt,zs).call(this,t.propertiesToUpdate),b(this,mt,$i).call(this,{hasSelectedEditor:!0})}setSelected(t){this.updateToolbar({mode:t.mode,editId:t.uid}),a(this,Wa)?.commitOrRemove();for(let e of a(this,ae))e!==t&&e.unselect();a(this,ui)?.destroyPopup(),a(this,ae).clear(),a(this,ae).add(t),t.select(),b(this,mt,zs).call(this,t.propertiesToUpdate),b(this,mt,$i).call(this,{hasSelectedEditor:!0})}isSelected(t){return a(this,ae).has(t)}get firstSelectedEditor(){return a(this,ae).values().next().value}unselect(t){t.unselect(),a(this,ae).delete(t),b(this,mt,$i).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return a(this,ae).size!==0}get isEnterHandled(){return a(this,ae).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){a(this,er).undo(),b(this,mt,$i).call(this,{hasSomethingToUndo:a(this,er).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,mt,cf).call(this)}),this._editorUndoBar?.hide()}redo(){a(this,er).redo(),b(this,mt,$i).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:a(this,er).hasSomethingToRedo(),isEmpty:b(this,mt,cf).call(this)})}addCommands(t){a(this,er).add(t),b(this,mt,$i).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,mt,cf).call(this)})}cleanUndoStack(t){a(this,er).cleanType(t)}delete(){this.commitOrRemove();let t=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let e=t?[t]:[...a(this,ae)],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,mt,fb).call(this,s)};this.addCommands({cmd:i,undo:n,mustExec:!0})}commitOrRemove(){a(this,wn)?.commitOrRemove()}hasSomethingToControl(){return a(this,wn)||this.hasSelection}selectAll(){for(let t of a(this,ae))t.commit();b(this,mt,pb).call(this,a(this,Pe).values())}unselectAll(){if(!(a(this,wn)&&(a(this,wn).commitOrRemove(),a(this,Qe)!==kt.NONE))&&!a(this,Wa)?.commitOrRemove()&&(a(this,ui)?.destroyPopup(),!!this.hasSelection)){for(let t of a(this,ae))t.unselect();a(this,ae).clear(),b(this,mt,$i).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;a(this,io)[0]+=t,a(this,io)[1]+=e;let[n,s]=a(this,io),o=[...a(this,ae)],l=1e3;a(this,ns)&&clearTimeout(a(this,ns)),p(this,ns,setTimeout(()=>{p(this,ns,null),a(this,io)[0]=a(this,io)[1]=0,this.addCommands({cmd:()=>{for(let c of o)a(this,Pe).has(c.id)&&(c.translateInPage(n,s),c.translationDone())},undo:()=>{for(let c of o)a(this,Pe).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,ts,new Map);for(let t of a(this,ae))a(this,ts).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!a(this,ts))return!1;this.disableUserSelect(!1);let t=a(this,ts);p(this,ts,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,Pe).has(n.id)){let c=a(this,De).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,ts))for(let i of a(this,ts).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,ae).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return a(this,wn)===t}getActive(){return a(this,wn)}getMode(){return a(this,Qe)}isEditingMode(){return a(this,Qe)!==kt.NONE}get imageManager(){return _t(this,"imageManager",new lb)}getSelectionBoxes(t){if(!t)return null;let e=document.getSelection();for(let u=0,h=e.rangeCount;u({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{u.type==="pointerup"&&u.button!==0||(o.abort(),s?.toggleDrawing(!0),u.type==="pointerup"&&b(this,mt,lf).call(this,"main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}else s?.toggleDrawing(!0),b(this,mt,lf).call(this,"main_toolbar")}},lf=function(t=""){a(this,Qe)===kt.HIGHLIGHT?this.highlightSelection(t):a(this,np)&&b(this,mt,UC).call(this)},jC=function(){document.addEventListener("selectionchange",b(this,mt,zC).bind(this),{signal:this._signal})},HC=function(){if(a(this,Ka))return;p(this,Ka,new AbortController);let t=this.combinedSignal(a(this,Ka));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},GC=function(){a(this,Ka)?.abort(),p(this,Ka,null)},db=function(){if(a(this,Qa))return;p(this,Qa,new AbortController);let t=this.combinedSignal(a(this,Qa));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},$C=function(){a(this,Qa)?.abort(),p(this,Qa,null)},VC=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})},qC=function(){a(this,qa)?.abort(),p(this,qa,null)},WC=function(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},$i=function(t){Object.entries(t).some(([i,n])=>a(this,cp)[i]!==n)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(a(this,cp),t)}),a(this,Qe)===kt.HIGHLIGHT&&t.hasSelectedEditor===!1&&b(this,mt,zs).call(this,[[Ht.HIGHLIGHT_FREE,!0]]))},zs=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},XC=async function(){if(!a(this,Vs)){p(this,Vs,!0);let t=[];for(let e of a(this,De).values())t.push(e.enable());await Promise.all(t);for(let e of a(this,Pe).values())e.enable()}},YC=function(){if(this.unselectAll(),a(this,Vs)){p(this,Vs,!1);for(let t of a(this,De).values())t.disable();for(let t of a(this,Pe).values())t.disable()}},fb=function(t){let e=a(this,De).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},KC=function(){let t=null;for(t of a(this,ae));return t},cf=function(){if(a(this,Pe).size===0)return!0;if(a(this,Pe).size===1)for(let t of a(this,Pe).values())return t.isEmpty();return!1},pb=function(t){for(let e of a(this,ae))e.unselect();a(this,ae).clear();for(let e of t)e.isEmpty()||(a(this,ae).add(e),e.select());b(this,mt,$i).call(this,{hasSelectedEditor:this.hasSelection})},z(Fu,"TRANSLATE_SMALL",1),z(Fu,"TRANSLATE_BIG",10);Lo=Fu,Vi=class Vi{constructor(t){x(this,Or);x(this,hi,null);x(this,rs,!1);x(this,Ar,null);x(this,Zu,null);x(this,ss,null);x(this,An,null);x(this,Qu,!1);x(this,as,null);x(this,cn,null);x(this,Xs,null);x(this,yl,null);x(this,os,!1);p(this,cn,t),p(this,os,t._uiManager.useNewAltTextFlow),a(Vi,no)||p(Vi,no,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){Vi._l10n??(Vi._l10n=t)}async render(){let t=p(this,Ar,document.createElement("button"));t.className="altText",t.tabIndex="0";let e=p(this,Zu,document.createElement("span"));t.append(e),a(this,os)?(t.classList.add("new"),t.setAttribute("data-l10n-id",a(Vi,no).missing),e.setAttribute("data-l10n-id",a(Vi,no)["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,cn)._uiManager._signal;t.addEventListener("contextmenu",Hn,{signal:i}),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:i});let n=s=>{s.preventDefault(),a(this,cn)._uiManager.editAltText(a(this,cn)),a(this,os)&&a(this,cn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:a(this,Or,uf)}})};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(p(this,Qu,!0),n(s))},{signal:i}),await b(this,Or,Xg).call(this),t}finish(){a(this,Ar)&&(a(this,Ar).focus({focusVisible:a(this,Qu)}),p(this,Qu,!1))}isEmpty(){return a(this,os)?a(this,hi)===null:!a(this,hi)&&!a(this,rs)}hasData(){return a(this,os)?a(this,hi)!==null||!!a(this,Xs):this.isEmpty()}get guessedText(){return a(this,Xs)}async setGuessedText(t){a(this,hi)===null&&(p(this,Xs,t),p(this,yl,await Vi._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),b(this,Or,Xg).call(this))}toggleAltTextBadge(t=!1){if(!a(this,os)||a(this,hi)){a(this,as)?.remove(),p(this,as,null);return}if(!a(this,as)){let e=p(this,as,document.createElement("div"));e.className="noAltTextBadge",a(this,cn).div.append(e)}a(this,as).classList.toggle("hidden",!t)}serialize(t){let e=a(this,hi);return!t&&a(this,Xs)===e&&(e=a(this,yl)),{altText:e,decorative:a(this,rs),guessedText:a(this,Xs),textWithDisclaimer:a(this,yl)}}get data(){return{altText:a(this,hi),decorative:a(this,rs)}}set data({altText:t,decorative:e,guessedText:i,textWithDisclaimer:n,cancel:s=!1}){i&&(p(this,Xs,i),p(this,yl,n)),!(a(this,hi)===t&&a(this,rs)===e)&&(s||(p(this,hi,t),p(this,rs,e)),b(this,Or,Xg).call(this))}toggle(t=!1){a(this,Ar)&&(!t&&a(this,An)&&(clearTimeout(a(this,An)),p(this,An,null)),a(this,Ar).disabled=!t)}shown(){a(this,cn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:a(this,Or,uf)}})}destroy(){a(this,Ar)?.remove(),p(this,Ar,null),p(this,Zu,null),p(this,ss,null),a(this,as)?.remove(),p(this,as,null)}};hi=new WeakMap,rs=new WeakMap,Ar=new WeakMap,Zu=new WeakMap,ss=new WeakMap,An=new WeakMap,Qu=new WeakMap,as=new WeakMap,cn=new WeakMap,Xs=new WeakMap,yl=new WeakMap,os=new WeakMap,no=new WeakMap,Or=new WeakSet,uf=function(){return a(this,hi)&&"added"||a(this,hi)===null&&this.guessedText&&"review"||"missing"},Xg=async function(){let t=a(this,Ar);if(!t)return;if(a(this,os)){if(t.classList.toggle("done",!!a(this,hi)),t.setAttribute("data-l10n-id",a(Vi,no)[a(this,Or,uf)]),a(this,Zu)?.setAttribute("data-l10n-id",a(Vi,no)[`${a(this,Or,uf)}-label`]),!a(this,hi)){a(this,ss)?.remove();return}}else{if(!a(this,hi)&&!a(this,rs)){t.classList.remove("done"),a(this,ss)?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=a(this,ss);if(!e){p(this,ss,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${a(this,cn).id}`;let n=100,s=a(this,cn)._uiManager._signal;s.addEventListener("abort",()=>{clearTimeout(a(this,An)),p(this,An,null)},{once:!0}),t.addEventListener("mouseenter",()=>{p(this,An,setTimeout(()=>{p(this,An,null),a(this,ss).classList.add("show"),a(this,cn)._reportTelemetry({action:"alt_text_tooltip"})},n))},{signal:s}),t.addEventListener("mouseleave",()=>{a(this,An)&&(clearTimeout(a(this,An)),p(this,An,null)),a(this,ss)?.classList.remove("show")},{signal:s})}a(this,rs)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=a(this,hi)),e.parentNode||t.append(e),a(this,cn).getElementForAltText()?.setAttribute("aria-describedby",e.id)},x(Vi,no,null),z(Vi,"_l10n",null);O0=Vi,Nu=class{constructor(t){x(this,fp);x(this,Ei,null);x(this,rr,null);x(this,bl,!1);x(this,ye,null);x(this,dp,null);x(this,ro,null);x(this,sr,null);x(this,so,null);x(this,ao,!1);x(this,wl,null);p(this,ye,t)}renderForToolbar(){let t=p(this,rr,document.createElement("button"));return t.className="comment",b(this,fp,mb).call(this,t,!1)}renderForStandalone(){let t=p(this,Ei,document.createElement("button"));t.className="annotationCommentButton";let e=a(this,ye).commentButtonPosition;if(e){let{style:i}=t;i.insetInlineEnd=`calc(${100*(a(this,ye)._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,ye).commentButtonColor;n&&(i.backgroundColor=n)}return b(this,fp,mb).call(this,t,!0)}focusButton(){setTimeout(()=>{(a(this,Ei)??a(this,rr))?.focus()},0)}onUpdatedColor(){if(!a(this,Ei))return;let t=a(this,ye).commentButtonColor;t&&(a(this,Ei).style.backgroundColor=t),a(this,ye)._uiManager.updatePopupColor(a(this,ye))}get commentButtonWidth(){return(a(this,Ei)?.getBoundingClientRect().width??0)/a(this,ye).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(a(this,wl))return a(this,wl);if(!a(this,Ei))return null;let{x:t,y:e,height:i}=a(this,Ei).getBoundingClientRect(),{x:n,y:s,width:o,height:l}=a(this,ye).parent.boundingClientRect;return[(t-n)/o,(e+i-s)/l]}set commentPopupPositionInLayer(t){p(this,wl,t)}hasDefaultPopupPosition(){return a(this,wl)===null}removeStandaloneCommentButton(){a(this,Ei)?.remove(),p(this,Ei,null)}removeToolbarCommentButton(){a(this,rr)?.remove(),p(this,rr,null)}setCommentButtonStates({selected:t,hasPopup:e}){a(this,Ei)&&(a(this,Ei).classList.toggle("selected",t),a(this,Ei).ariaExpanded=e)}edit(t){let e=this.commentPopupPositionInLayer,i,n;if(e)[i,n]=e;else{[i,n]=a(this,ye).commentButtonPosition;let{width:h,height:d,x:f,y:m}=a(this,ye);i=f+i*h,n=m+n*d}let s=a(this,ye).parent.boundingClientRect,{x:o,y:l,width:c,height:u}=s;a(this,ye)._uiManager.editComment(a(this,ye),o+i*c,l+n*u,{...t,parentDimensions:s})}finish(){a(this,rr)&&(a(this,rr).focus({focusVisible:a(this,bl)}),p(this,bl,!1))}isDeleted(){return a(this,ao)||a(this,sr)===""}isEmpty(){return a(this,sr)===null}hasBeenEdited(){return this.isDeleted()||a(this,sr)!==a(this,dp)}serialize(){return this.data}get data(){return{text:a(this,sr),richText:a(this,ro),date:a(this,so),deleted:this.isDeleted()}}set data(t){if(t!==a(this,sr)&&p(this,ro,null),t===null){p(this,sr,""),p(this,ao,!0);return}p(this,sr,t),p(this,so,new Date),p(this,ao,!1)}restoreData({text:t,richText:e,date:i}){p(this,sr,t),p(this,ro,e),p(this,so,i),p(this,ao,!1)}setInitialText(t,e=null){p(this,dp,t),this.data=t,p(this,so,null),p(this,ro,e)}shown(){}destroy(){a(this,rr)?.remove(),p(this,rr,null),a(this,Ei)?.remove(),p(this,Ei,null),p(this,sr,""),p(this,ro,null),p(this,so,null),p(this,ye,null),p(this,bl,!1),p(this,ao,!1)}};Ei=new WeakMap,rr=new WeakMap,bl=new WeakMap,ye=new WeakMap,dp=new WeakMap,ro=new WeakMap,sr=new WeakMap,so=new WeakMap,ao=new WeakMap,wl=new WeakMap,fp=new WeakSet,mb=function(t,e){if(!a(this,ye)._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,ye)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let i=a(this,ye)._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",Hn,{signal:i}),e&&(t.addEventListener("focusin",s=>{a(this,ye)._focusEventsAllowed=!1,ke(s)},{capture:!0,signal:i}),t.addEventListener("focusout",s=>{a(this,ye)._focusEventsAllowed=!0,ke(s)},{capture:!0,signal:i})),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:i});let n=s=>{s.preventDefault(),t===a(this,rr)?this.edit():a(this,ye).toggleComment(!0)};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(p(this,bl,!0),n(s))},{signal:i}),t.addEventListener("pointerenter",()=>{a(this,ye).toggleComment(!1,!0)},{signal:i}),t.addEventListener("pointerleave",()=>{a(this,ye).toggleComment(!1,!1)},{signal:i}),t};Rw=class Rw{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:n=null,onPinching:s=null,onPinchEnd:o=null,signal:l}){x(this,Bo);x(this,Ju);x(this,Al,!1);x(this,pp,null);x(this,mp);x(this,gp);x(this,xp);x(this,yp);x(this,Ys,null);x(this,vl);x(this,Ks,null);x(this,El);x(this,Zs,null);p(this,Ju,t),p(this,pp,i),p(this,mp,e),p(this,gp,n),p(this,xp,s),p(this,yp,o),p(this,El,new AbortController),p(this,vl,AbortSignal.any([l,a(this,El).signal])),t.addEventListener("touchstart",b(this,Bo,ZC).bind(this),{passive:!1,signal:a(this,vl)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Es.pixelRatio}destroy(){a(this,El)?.abort(),p(this,El,null),a(this,Ys)?.abort(),p(this,Ys,null)}};Ju=new WeakMap,Al=new WeakMap,pp=new WeakMap,mp=new WeakMap,gp=new WeakMap,xp=new WeakMap,yp=new WeakMap,Ys=new WeakMap,vl=new WeakMap,Ks=new WeakMap,El=new WeakMap,Zs=new WeakMap,Bo=new WeakSet,ZC=function(t){var n,s,o;if((n=a(this,mp))!=null&&n.call(this))return;if(t.touches.length===1){if(a(this,Ys))return;let l=p(this,Ys,new AbortController),c=AbortSignal.any([a(this,vl),l.signal]),u=a(this,Ju),h={capture:!0,signal:c,passive:!1},d=f=>{f.pointerType==="touch"&&(a(this,Ys)?.abort(),p(this,Ys,null))};u.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(ke(f),d(f))},h),u.addEventListener("pointerup",d,h),u.addEventListener("pointercancel",d,h);return}if(!a(this,Zs)){p(this,Zs,new AbortController);let l=AbortSignal.any([a(this,vl),a(this,Zs).signal]),c=a(this,Ju),u={signal:l,capture:!1,passive:!1};c.addEventListener("touchmove",b(this,Bo,QC).bind(this),u);let h=b(this,Bo,JC).bind(this);c.addEventListener("touchend",h,u),c.addEventListener("touchcancel",h,u),u.capture=!0,c.addEventListener("pointerdown",ke,u),c.addEventListener("pointermove",ke,u),c.addEventListener("pointercancel",ke,u),c.addEventListener("pointerup",ke,u),(s=a(this,gp))==null||s.call(this)}if(ke(t),t.touches.length!==2||(o=a(this,pp))!=null&&o.call(this)){p(this,Ks,null);return}let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]),p(this,Ks,{touch0X:e.screenX,touch0Y:e.screenY,touch1X:i.screenX,touch1Y:i.screenY})},QC=function(t){var k;if(!a(this,Ks)||t.touches.length!==2)return;ke(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,Ks),{touch0X:u,touch0Y:h,touch1X:d,touch1Y:f}=c,m=d-u,y=f-h,g=o-n,A=l-s,w=Math.hypot(g,A)||1,v=Math.hypot(m,y)||1;if(!a(this,Al)&&Math.abs(v-w)<=Rw.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=n,c.touch0Y=s,c.touch1X=o,c.touch1Y=l,!a(this,Al)){p(this,Al,!0);return}let T=[(n+o)/2,(s+l)/2];(k=a(this,xp))==null||k.call(this,T,v,w)},JC=function(t){var e;t.touches.length>=2||(a(this,Zs)&&(a(this,Zs).abort(),p(this,Zs,null),(e=a(this,yp))==null||e.call(this)),a(this,Ks)&&(ke(t),p(this,Ks,null),p(this,Al,!1)))};Uf=Rw,Nt=class Nt{constructor(t){x(this,St);x(this,Cl,null);x(this,vr,null);x(this,ve,null);x(this,oe,null);x(this,Qs,null);x(this,th,!1);x(this,oo,null);x(this,bp,"");x(this,Ci,null);x(this,Tl,null);x(this,Js,null);x(this,ar,null);x(this,lo,null);x(this,wp,"");x(this,Sl,!1);x(this,vn,null);x(this,Ap,!1);x(this,Dl,!1);x(this,ta,!1);x(this,ls,null);x(this,eh,0);x(this,ih,0);x(this,or,null);x(this,Il,null);z(this,"isSelected",!1);z(this,"_isCopy",!1);z(this,"_editToolbar",null);z(this,"_initialOptions",Object.create(null));z(this,"_initialData",null);z(this,"_isVisible",!0);z(this,"_uiManager",null);z(this,"_focusEventsAllowed",!0);x(this,vp,!1);x(this,fx,Nt._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=Nt.prototype._resizeWithKeyboard,e=Lo.TRANSLATE_SMALL,i=Lo.TRANSLATE_BIG;return _t(this,"_resizerKeyboardManager",new Fc([[["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"],Nt.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 _t(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new Eb({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(Nt._l10n??(Nt._l10n=t),Nt._l10nResizer||(Nt._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"})),Nt._borderLineWidth!==-1)return;let i=getComputedStyle(document.documentElement);Nt._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){ie("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return a(this,vp)}set _isDraggable(t){p(this,vp,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,fx)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(b(this,St,hf).call(this),a(this,ar)?.remove(),p(this,ar,null)),this.parent=t}focusin(t){this._focusEventsAllowed&&(a(this,Sl)?p(this,Sl,!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,St,gb).call(this,this.parentDimensions,t,e)}translateInPage(t,e){a(this,vn)||p(this,vn,[this.x,this.y,this.width,this.height]),b(this,St,gb).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){a(this,vn)||p(this,vn,[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,vn)&&(a(this,vn)[0]!==this.x||a(this,vn)[1]!==this.y)}get _hasBeenResized(){return!!a(this,vn)&&(a(this,vn)[2]!==this.width||a(this,vn)[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=Nt,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=ai(s,0,i-l),o=ai(o,0,n-c);break;case 90:s=ai(s,0,i-c),o=ai(o,l,n);break;case 180:s=ai(s,l,i),o=ai(o,c,n);break;case 270:s=ai(s,c,i),o=ai(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=Nt,Ep,xb).call(i,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var i;return b(i=Nt,Ep,xb).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,ve)?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||a(this,Dl))return this._editToolbar;this._editToolbar=new rb(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,ve)?.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,ve)||(O0.initialize(Nt._l10n),p(this,ve,new O0(this)),a(this,Cl)&&(a(this,ve).data=a(this,Cl),p(this,Cl,null))),a(this,ve)}get altTextData(){return a(this,ve)?.data}set altTextData(t){a(this,ve)&&(a(this,ve).data=t)}get guessedAltText(){return a(this,ve)?.guessedText}async setGuessedAltText(t){await a(this,ve)?.setGuessedText(t)}serializeAltText(t){return a(this,ve)?.serialize(t)}hasAltText(){return!!a(this,ve)&&!a(this,ve).isEmpty()}hasAltTextData(){return a(this,ve)?.hasData()??!1}focusCommentButton(){a(this,oe)?.focusButton()}addCommentButton(){return this.canAddComment?a(this,oe)||p(this,oe,new Nu(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(a(this,Qs)){this._uiManager.isEditingMode()&&a(this,Qs).classList.remove("hidden");return}this.hasComment&&(p(this,Qs,a(this,oe).renderForStandalone()),this.div.append(a(this,Qs)))}}removeStandaloneCommentButton(){a(this,oe).removeStandaloneCommentButton(),p(this,Qs,null)}hideStandaloneCommentButton(){a(this,Qs)?.classList.add("hidden")}get comment(){if(!a(this,oe))return null;let{data:{richText:t,text:e,date:i,deleted:n}}=a(this,oe);return{text:e,richText:t,date:i,deleted:n,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){a(this,oe)||p(this,oe,new Nu(this)),typeof t=="object"&&t!==null?a(this,oe).restoreData(t):a(this,oe).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,oe)||p(this,oe,new Nu(this)),a(this,oe).setInitialText(t,i),!this.annotationElementId))return;let n=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);n&&this.updateFromAnnotationLayer(n)}get hasEditedComment(){return a(this,oe)?.hasBeenEdited()}get hasDeletedComment(){return a(this,oe)?.isDeleted()}get hasComment(){return!!a(this,oe)&&!a(this,oe).isEmpty()&&!a(this,oe).isDeleted()}async editComment(t){a(this,oe)||p(this,oe,new Nu(this)),a(this,oe).edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){a(this,oe).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,oe).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,th)?-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,St,Ab).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),RC(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(a(this,Il)||p(this,Il,new Uf({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:b(this,St,iT).bind(this),onPinching:b(this,St,nT).bind(this),onPinchEnd:b(this,St,rT).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}pointerdown(t){let{isMac:e}=Be.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(p(this,Sl,!0),this._isDraggable){b(this,St,sT).call(this,t);return}b(this,St,wb).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){a(this,ls)&&clearTimeout(a(this,ls)),p(this,ls,setTimeout(()=>{p(this,ls,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,y=this.height*o;switch(i){case 0:return[d+u+l,o-f-h-y+c,d+u+m+l,o-f-h+c];case 90:return[d+h+l,o-f+u+c,d+h+y+l,o-f+u+m+c];case 180:return[d-u-m+l,o-f+h+c,d-u+l,o-f+h+y+c];case 270:return[d-h-y+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&&Nt._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){a(this,oe)?.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,Dl,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),p(this,Dl,!1),!0):!1}isInEditMode(){return a(this,Dl)}shouldGetKeyboardEvents(){return a(this,ta)}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 e0&&t0}rebuild(){b(this,St,Ab).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,Cl,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,lo)?.abort(),p(this,lo,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),a(this,ls)&&(clearTimeout(a(this,ls)),p(this,ls,null)),b(this,St,hf).call(this),this.removeEditToolbar(),a(this,or)){for(let t of a(this,or).values())clearTimeout(t);p(this,or,null)}this.parent=null,a(this,Il)?.destroy(),p(this,Il,null),a(this,ar)?.remove(),p(this,ar,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,St,tT).call(this),a(this,Ci).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[Nt._round(i+(s-i)*t),Nt._round(n+(o-n)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return a(this,oe).commentPopupPositionInLayer}set commentPopupPosition(t){a(this,oe).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return a(this,oe).hasDefaultPopupPosition()}get commentButtonWidth(){return a(this,oe).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){a(this,oe)?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),p(this,Js,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let e=a(this,Ci).children;if(!a(this,vr)){p(this,vr,Array.from(e));let o=b(this,St,aT).bind(this),l=b(this,St,oT).bind(this),c=this._uiManager._signal;for(let u of a(this,vr)){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,St,lT).bind(this,h),{signal:c}),u.setAttribute("data-l10n-id",Nt._l10nResizer[h])}}let i=a(this,vr)[0],n=0;for(let o of e){if(o===i)break;n++}let s=(360-this.rotation+this.parentRotation)%360/90*(a(this,vr).length/4);if(s!==n){if(sn)for(let l=0;l{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),a(this,ve)?.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,Ci)?.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,ve)?.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,Ap)}set isEditing(t){p(this,Ap,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,or)||p(this,or,new Map);let{action:i}=t,n=a(this,or).get(i);n&&clearTimeout(n),n=setTimeout(()=>{this._reportTelemetry(t),a(this,or).delete(i),a(this,or).size===0&&p(this,or,null)},Nt._telemetryTimeout),a(this,or).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,th,!1)}disable(){this.div&&(this.div.tabIndex=-1),p(this,th,!0)}updateFakeAnnotationElement(t){if(!a(this,ar)&&!this.deleted){p(this,ar,t.addFakeAnnotation(this));return}if(this.deleted){a(this,ar).remove(),p(this,ar,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&a(this,ar).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()}};Cl=new WeakMap,vr=new WeakMap,ve=new WeakMap,oe=new WeakMap,Qs=new WeakMap,th=new WeakMap,oo=new WeakMap,bp=new WeakMap,Ci=new WeakMap,Tl=new WeakMap,Js=new WeakMap,ar=new WeakMap,lo=new WeakMap,wp=new WeakMap,Sl=new WeakMap,vn=new WeakMap,Ap=new WeakMap,Dl=new WeakMap,ta=new WeakMap,ls=new WeakMap,eh=new WeakMap,ih=new WeakMap,or=new WeakMap,Il=new WeakMap,vp=new WeakMap,fx=new WeakMap,St=new WeakSet,gb=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()},Ep=new WeakSet,xb=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]}},Yg=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]}},tT=function(){if(a(this,Ci))return;p(this,Ci,document.createElement("div")),a(this,Ci).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,Ci).append(n),n.classList.add("resizer",i),n.setAttribute("data-resizer-name",i),n.addEventListener("pointerdown",b(this,St,eT).bind(this,i),{signal:e}),n.addEventListener("contextmenu",Hn,{signal:e}),n.tabIndex=-1}this.div.prepend(a(this,Ci))},eT=function(t,e){e.preventDefault();let{isMac:i}=Be.platform;if(e.button!==0||e.ctrlKey&&i)return;a(this,ve)?.toggle(!1);let n=this._isDraggable;this._isDraggable=!1,p(this,Tl,[e.screenX,e.screenY]);let s=new AbortController,o=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,St,bb).bind(this,t),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",ke,{passive:!1,signal:o}),window.addEventListener("contextmenu",Hn,{signal:o}),p(this,Js,{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,ve)?.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=l,this.div.style.cursor=c,b(this,St,Kg).call(this)};window.addEventListener("pointerup",u,{signal:o}),window.addEventListener("blur",u,{signal:o})},yb=function(t,e,i,n){this.width=i,this.height=n,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()},Kg=function(){if(!a(this,Js))return;let{savedX:t,savedY:e,savedWidth:i,savedHeight:n}=a(this,Js);p(this,Js,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,St,yb).bind(this,s,o,l,c),undo:b(this,St,yb).bind(this,t,e,i,n),mustExec:!0})},bb=function(t,e){let[i,n]=this.parentDimensions,s=this.x,o=this.y,l=this.width,c=this.height,u=Nt.MIN_SIZE/i,h=Nt.MIN_SIZE/n,d=b(this,St,Yg).call(this,this.rotation),f=(O,C)=>[d[0]*O+d[2]*C,d[1]*O+d[3]*C],m=b(this,St,Yg).call(this,360-this.rotation),y=(O,C)=>[m[0]*O+m[2]*C,m[1]*O+m[3]*C],g,A,w=!1,v=!1;switch(t){case"topLeft":w=!0,g=(O,C)=>[0,0],A=(O,C)=>[O,C];break;case"topMiddle":g=(O,C)=>[O/2,0],A=(O,C)=>[O/2,C];break;case"topRight":w=!0,g=(O,C)=>[O,0],A=(O,C)=>[0,C];break;case"middleRight":v=!0,g=(O,C)=>[O,C/2],A=(O,C)=>[0,C/2];break;case"bottomRight":w=!0,g=(O,C)=>[O,C],A=(O,C)=>[0,0];break;case"bottomMiddle":g=(O,C)=>[O/2,C],A=(O,C)=>[O/2,0];break;case"bottomLeft":w=!0,g=(O,C)=>[0,C],A=(O,C)=>[O,0];break;case"middleLeft":v=!0,g=(O,C)=>[0,C/2],A=(O,C)=>[O,C/2];break}let T=g(l,c),k=A(l,c),N=f(...k),F=Nt._round(s+N[0]),L=Nt._round(o+N[1]),Y=1,q=1,G,j;if(e.fromKeyboard)({deltaX:G,deltaY:j}=e);else{let{screenX:O,screenY:C}=e,[D,E]=a(this,Tl);[G,j]=this.screenToPageTranslation(O-D,C-E),a(this,Tl)[0]=O,a(this,Tl)[1]=C}if([G,j]=y(G/i,j/n),w){let O=Math.hypot(l,c);Y=q=Math.max(Math.min(Math.hypot(k[0]-T[0]-G,k[1]-T[1]-j)/O,1/l,1/c),u/l,h/c)}else v?Y=ai(Math.abs(k[0]-T[0]-G),u,1)/l:q=ai(Math.abs(k[1]-T[1]-j),h,1)/c;let tt=Nt._round(l*Y),et=Nt._round(c*q);N=f(...A(tt,et));let _=F-N[0],X=L-N[1];a(this,vn)||p(this,vn,[this.x,this.y,this.width,this.height]),this.width=tt,this.height=et,this.x=_,this.y=X,this.setDims(),this.fixAndSetPosition(),this._onResizing()},iT=function(){p(this,Js,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),a(this,ve)?.toggle(!1),this.parent.togglePointerEvents(!1)},nT=function(t,e,i){let s=.7*(i/e)+1-.7;if(s===1)return;let o=b(this,St,Yg).call(this,this.rotation),l=(F,L)=>[o[0]*F+o[2]*L,o[1]*F+o[3]*L],[c,u]=this.parentDimensions,h=this.x,d=this.y,f=this.width,m=this.height,y=Nt.MIN_SIZE/c,g=Nt.MIN_SIZE/u;s=Math.max(Math.min(s,1/f,1/m),y/f,g/m);let A=Nt._round(f*s),w=Nt._round(m*s);if(A===f&&w===m)return;a(this,vn)||p(this,vn,[h,d,f,m]);let v=l(f/2,m/2),T=Nt._round(h+v[0]),k=Nt._round(d+v[1]),N=l(A/2,w/2);this.x=T-N[0],this.y=k-N[1],this.width=A,this.height=w,this.setDims(),this.fixAndSetPosition(),this._onResizing()},rT=function(){a(this,ve)?.toggle(!0),this.parent.togglePointerEvents(!0),b(this,St,Kg).call(this)},wb=function(t){let{isMac:e}=Be.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},sT=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,oo,null),p(this,Sl,!1),this._uiManager.endDragSession()||b(this,St,wb).call(this,u),i&&this._onStopDragging()};e&&(p(this,eh,t.clientX),p(this,ih,t.clientY),p(this,oo,t.pointerId),p(this,bp,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,oo)){ke(u);return}let[m,y]=this.screenToPageTranslation(h-a(this,eh),d-a(this,ih));p(this,eh,h),p(this,ih,d),this._uiManager.dragSelectedEditors(m,y)},o),window.addEventListener("touchmove",ke,o),window.addEventListener("pointerdown",u=>{u.pointerType===a(this,bp)&&(a(this,Il)||u.isPrimary)&&l(u),ke(u)},o));let c=u=>{if(!a(this,oo)||a(this,oo)===u.pointerId){l(u);return}ke(u)};window.addEventListener("pointerup",c,{signal:s}),window.addEventListener("blur",c,{signal:s})},Ab=function(){if(a(this,lo)||!this.div)return;p(this,lo,new AbortController);let t=this._uiManager.combinedSignal(a(this,lo));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},aT=function(t){Nt._resizerKeyboardManager.exec(this,t)},oT=function(t){a(this,ta)&&t.relatedTarget?.parentNode!==a(this,Ci)&&b(this,St,hf).call(this)},lT=function(t){p(this,wp,a(this,ta)?t:"")},vb=function(t){if(a(this,vr))for(let e of a(this,vr))e.tabIndex=t},hf=function(){p(this,ta,!1),b(this,St,vb).call(this,-1),b(this,St,Kg).call(this)},x(Nt,Ep),z(Nt,"_l10n",null),z(Nt,"_l10nResizer",null),z(Nt,"_borderLineWidth",-1),z(Nt,"_colorManager",new ub),z(Nt,"_zIndex",1),z(Nt,"_telemetryTimeout",1e3);be=Nt,Eb=class extends be{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},nC=3285377520,Zn=4294901760,Qr=65535,R0=class{constructor(t){this.h1=t?t&4294967295:nC,this.h2=t?t&4294967295:nC}update(t){let e,i;if(typeof t=="string"){e=new Uint8Array(t.length*2),i=0;for(let g=0,A=t.length;g>>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&Qr,y=f&Qr;for(let g=0;g>>17,l=l*f&Zn|l*y&Qr,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=o[g],c=c*d&Zn|c*m&Qr,c=c<<15|c>>>17,c=c*f&Zn|c*y&Qr,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&Zn|l*m&Qr,l=l<<15|l>>>17,l=l*f&Zn|l*y&Qr,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&Zn|t*36045&Qr,e=e*4283543511&Zn|((e<<16|t>>>16)*2950163797&Zn)>>>16,t^=e>>>1,t=t*444984403&Zn|t*60499&Qr,e=e*3301882366&Zn|((e<<16|t>>>16)*3120437893&Zn)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}},zf=Object.freeze({map:null,hash:"",transfer:void 0}),jf=class{constructor(){x(this,px);x(this,kl,!1);x(this,_l,null);x(this,ea,null);x(this,Ti,new Map);z(this,"onSetModified",null);z(this,"onResetModified",null);z(this,"onAnnotationEditor",null)}getValue(t,e){let i=a(this,Ti).get(t);return i===void 0?e:Object.assign(e,i)}getRawValue(t){return a(this,Ti).get(t)}remove(t){let e=a(this,Ti).get(t);e!==void 0&&(e instanceof be&&a(this,ea).delete(e.annotationElementId),a(this,Ti).delete(t),a(this,Ti).size===0&&this.resetModified(),!a(this,Ti).values().some(i=>i instanceof be)&&this.onAnnotationEditor?.(null))}setValue(t,e){let i=a(this,Ti).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,Ti).set(t,e);n&&b(this,px,cT).call(this),e instanceof be&&((a(this,ea)||p(this,ea,new Map)).set(e.annotationElementId,e),this.onAnnotationEditor?.(e.constructor._type))}has(t){return a(this,Ti).has(t)}get size(){return a(this,Ti).size}resetModified(){a(this,kl)&&(p(this,kl,!1),this.onResetModified?.())}get print(){return new L0(this)}get serializable(){if(a(this,Ti).size===0)return zf;let t=new Map,e=new R0,i=[],n=Object.create(null),s=!1;for(let[o,l]of a(this,Ti)){let c=l instanceof be?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}:zf}get editorStats(){let t=null,e=new Map,i=0,n=0;for(let s of a(this,Ti).values()){if(!(s instanceof be)){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,Ox);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,_l,null)}updateEditor(t,e){let i=a(this,ea)?.get(t);return i?(i.updateFromAnnotationLayer(e),!0):!1}getEditor(t){return a(this,ea)?.get(t)||null}get modifiedIds(){if(a(this,_l))return a(this,_l);let t=[];if(a(this,ea))for(let e of a(this,ea).values())e.serialize()&&t.push(e.annotationElementId);return p(this,_l,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return a(this,Ti).entries()}};kl=new WeakMap,_l=new WeakMap,ea=new WeakMap,Ti=new WeakMap,px=new WeakSet,cT=function(){a(this,kl)||(p(this,kl,!0),this.onSetModified?.())};L0=class extends jf{constructor(e){super();x(this,Cp,zf);let{serializable:i}=e;if(i===zf)return;let{map:n,hash:s,transfer:o}=i,l=structuredClone(n,o?{transfer:o}:null);p(this,Cp,{map:l,hash:s,transfer:[]})}get print(){ie("Should not call PrintAnnotationStorage.print")}get serializable(){return a(this,Cp)}get modifiedIds(){return _t(this,"modifiedIds",{ids:new Set,hash:""})}};Cp=new WeakMap;wu="__forcedDependency",{floor:rC,ceil:sC}=Math;Cb=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],Tb=class{constructor(t,e){x(this,nh);x(this,co);p(this,nh,t),p(this,co,e)}get length(){return a(this,nh).length}isEmpty(t){return a(this,nh)[t]===Cb}minX(t){return a(this,co)[t*4+0]/256}minY(t){return a(this,co)[t*4+1]/256}maxX(t){return(a(this,co)[t*4+2]+1)/256}maxY(t){return(a(this,co)[t*4+3]+1)/256}};nh=new WeakMap,co=new WeakMap;oC=(r,t)=>r?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),Sb=class{constructor(t,e){x(this,Tp);x(this,ia,[[1,0,0,1,0,0]]);x(this,ee,[-1/0,-1/0,1/0,1/0]);x(this,ue,new Float64Array([1/0,1/0,-1/0,-1/0]));z(this,"_pendingBBoxIdx",-1);x(this,Nl);x(this,Ml);x(this,Fl);x(this,Li);z(this,"_savesStack",[]);z(this,"_markedContentStack",[]);p(this,Nl,t.width),p(this,Ml,t.height),b(this,Tp,Db).call(this,e)}growOperationsCount(t){t>=a(this,Li).length&&b(this,Tp,Db).call(this,t,a(this,Li))}get clipBox(){return a(this,ee)}save(t){return p(this,ee,{__proto__:a(this,ee)}),this._savesStack.push(t),this}restore(t,e){let i=Object.getPrototypeOf(a(this,ee));if(i===null)return this;p(this,ee,i);let n=this._savesStack.pop();return n!==void 0&&(e?.(n,t),a(this,Li)[t]=a(this,Li)[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,Li)[t]=a(this,Li)[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,Li)[t]=a(this,Li)[i]),this}pushBaseTransform(t){return a(this,ia).push(ht.multiplyByDOMMatrix(a(this,ia).at(-1),t.getTransform())),this}popBaseTransform(){return a(this,ia).length>1&&a(this,ia).pop(),this}resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,a(this,ue)[0]=1/0,a(this,ue)[1]=1/0,a(this,ue)[2]=-1/0,a(this,ue)[3]=-1/0),this}recordClipBox(t,e,i,n,s,o){let l=ht.multiplyByDOMMatrix(a(this,ia).at(-1),e.getTransform()),c=[1/0,1/0,-1/0,-1/0];ht.axialAlignedBoundingBox([i,s,n,o],l,c);let u=ht.intersect(a(this,ee),c);return u?(a(this,ee)[0]=u[0],a(this,ee)[1]=u[1],a(this,ee)[2]=u[2],a(this,ee)[3]=u[3]):(a(this,ee)[0]=a(this,ee)[1]=1/0,a(this,ee)[2]=a(this,ee)[3]=-1/0),this}recordBBox(t,e,i,n,s,o){let l=a(this,ee);if(l[0]===1/0)return this;let c=ht.multiplyByDOMMatrix(a(this,ia).at(-1),e.getTransform());if(l[0]===-1/0)return ht.axialAlignedBoundingBox([i,s,n,o],c,a(this,ue)),this;let u=[1/0,1/0,-1/0,-1/0];return ht.axialAlignedBoundingBox([i,s,n,o],c,u),a(this,ue)[0]=Math.min(a(this,ue)[0],Math.max(u[0],l[0])),a(this,ue)[1]=Math.min(a(this,ue)[1],Math.max(u[1],l[1])),a(this,ue)[2]=Math.max(a(this,ue)[2],Math.min(u[2],l[2])),a(this,ue)[3]=Math.max(a(this,ue)[3],Math.min(u[3],l[3])),this}recordFullPageBBox(t){return a(this,ue)[0]=Math.max(0,a(this,ee)[0]),a(this,ue)[1]=Math.max(0,a(this,ee)[1]),a(this,ue)[2]=Math.min(a(this,Nl),a(this,ee)[2]),a(this,ue)[3]=Math.min(a(this,Ml),a(this,ee)[3]),this}recordOperation(t,e=!1,i){if(this._pendingBBoxIdx!==t)return this;let n=rC(a(this,ue)[0]*256/a(this,Nl)),s=rC(a(this,ue)[1]*256/a(this,Ml)),o=sC(a(this,ue)[2]*256/a(this,Nl)),l=sC(a(this,ue)[3]*256/a(this,Ml));if(aC(a(this,Fl),t,n,s,o,l),i)for(let c of i)for(let u of c)u!==t&&aC(a(this,Fl),u,n,s,o,l);return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,a(this,ee)[0]=Math.max(a(this,ee)[0],a(this,ue)[0]),a(this,ee)[1]=Math.max(a(this,ee)[1],a(this,ue)[1]),a(this,ee)[2]=Math.min(a(this,ee)[2],a(this,ue)[2]),a(this,ee)[3]=Math.min(a(this,ee)[3],a(this,ue)[3])),this}take(){return new Tb(a(this,Li),a(this,Fl))}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}};ia=new WeakMap,ee=new WeakMap,ue=new WeakMap,Nl=new WeakMap,Ml=new WeakMap,Fl=new WeakMap,Li=new WeakMap,Tp=new WeakSet,Db=function(t,e){let i=new ArrayBuffer(t*4);p(this,Fl,new Uint8ClampedArray(i)),p(this,Li,new Uint32Array(i)),e&&e.length>0?(a(this,Li).set(e),a(this,Li).fill(Cb,e.length)):a(this,Li).fill(Cb)};Ib=class{constructor(t,e=!1){x(this,un,{__proto__:null});x(this,hn,{__proto__:null,transform:[],moveText:[],sameLineText:[],[wu]:[]});x(this,Pl,new Map);x(this,Er,new Set);x(this,rh,new Map);x(this,uo);x(this,ho);x(this,he);p(this,he,t),e&&(p(this,uo,new Map),p(this,ho,(i,n)=>{oC(a(this,uo),n).dependencies.add(i)}))}get clipBox(){return a(this,he).clipBox}growOperationsCount(t){a(this,he).growOperationsCount(t)}save(t){return p(this,un,{__proto__:a(this,un)}),p(this,hn,{__proto__:a(this,hn),transform:{__proto__:a(this,hn).transform},moveText:{__proto__:a(this,hn).moveText},sameLineText:{__proto__:a(this,hn).sameLineText},[wu]:{__proto__:a(this,hn)[wu]}}),a(this,he).save(t),this}restore(t){a(this,he).restore(t,a(this,ho));let e=Object.getPrototypeOf(a(this,un));return e===null?this:(p(this,un,e),p(this,hn,Object.getPrototypeOf(a(this,hn))),this)}recordOpenMarker(t){return a(this,he).recordOpenMarker(t,a(this,ho)),this}getOpenMarker(){return a(this,he).getOpenMarker()}recordCloseMarker(t){return a(this,he).recordCloseMarker(t,a(this,ho)),this}beginMarkedContent(t){return a(this,he).beginMarkedContent(t),this}endMarkedContent(t){return a(this,he).endMarkedContent(t,a(this,ho)),this}pushBaseTransform(t){return a(this,he).pushBaseTransform(t),this}popBaseTransform(){return a(this,he).popBaseTransform(),this}recordSimpleData(t,e){return a(this,un)[t]=e,this}recordIncrementalData(t,e){return a(this,hn)[t].push(e),this}resetIncrementalData(t,e){return a(this,hn)[t].length=0,this}recordNamedData(t,e){return a(this,Pl).set(t,e),this}recordSimpleDataFromNamed(t,e,i){a(this,un)[t]=a(this,Pl).get(e)??i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(wu,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(let e of t)e in a(this,un)&&this.recordFutureForcedDependency(e,a(this,un)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let t of a(this,Er))this.recordFutureForcedDependency(wu,t);return this}resetBBox(t){return a(this,he).resetBBox(t),this}recordClipBox(t,e,i,n,s,o){return a(this,he).recordClipBox(t,e,i,n,s,o),this}recordBBox(t,e,i,n,s,o){return a(this,he).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,rh).get(i),u!==!1&&(h=[0,0,0,0],ht.axialAlignedBoundingBox(c,i.fontMatrix,h),(n!==1||s!==0||o!==0)&&ht.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,rh).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,he).recordFullPageBBox(t),this}getSimpleIndex(t){return a(this,un)[t]}recordDependencies(t,e){let i=a(this,Er),n=a(this,un),s=a(this,hn);for(let o of e)o in a(this,un)?i.add(n[o]):o in s&&s[o].forEach(i.add,i);return this}recordNamedDependency(t,e){return a(this,Pl).has(e)&&a(this,Er).add(a(this,Pl).get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[wu]),a(this,uo)){let n=oC(a(this,uo),t),{dependencies:s}=n;a(this,Er).forEach(s.add,s),a(this,he)._savesStack.forEach(s.add,s),a(this,he)._markedContentStack.forEach(s.add,s),s.delete(t),n.isRenderingOperation=!0}let i=!e&&t===a(this,he)._pendingBBoxIdx;return a(this,he).recordOperation(t,e,[a(this,Er),a(this,he)._savesStack,a(this,he)._markedContentStack]),i&&a(this,Er).clear(),this}recordShowTextOperation(t,e=!1){let i=Array.from(a(this,Er));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,he)._pendingBBoxIdx;return a(this,he).bboxToClipBoxDropOperation(t),i&&a(this,Er).clear(),this}take(){return a(this,rh).clear(),a(this,he).take()}takeDebugMetadata(){return a(this,uo)}};un=new WeakMap,hn=new WeakMap,Pl=new WeakMap,Er=new WeakMap,rh=new WeakMap,uo=new WeakMap,ho=new WeakMap,he=new WeakMap;Lw=class Lw{constructor(t,e,i){x(this,de);x(this,Oe);x(this,Cr);x(this,sh,0);x(this,ah,0);if(t instanceof Lw&&a(t,Cr)===!!i)return t;p(this,de,t),p(this,Oe,e),p(this,Cr,!!i)}get clipBox(){return a(this,de).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(t){return Ye(this,ah)._++,a(this,de).save(a(this,Oe)),this}restore(t){return a(this,ah)>0&&(a(this,de).restore(a(this,Oe)),Ye(this,ah)._--),this}recordOpenMarker(t){return Ye(this,sh)._++,this}getOpenMarker(){return a(this,sh)>0?a(this,Oe):a(this,de).getOpenMarker()}recordCloseMarker(t){return Ye(this,sh)._--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return a(this,de).pushBaseTransform(t),this}popBaseTransform(){return a(this,de).popBaseTransform(),this}recordSimpleData(t,e){return a(this,de).recordSimpleData(t,a(this,Oe)),this}recordIncrementalData(t,e){return a(this,de).recordIncrementalData(t,a(this,Oe)),this}resetIncrementalData(t,e){return a(this,de).resetIncrementalData(t,a(this,Oe)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return a(this,de).recordSimpleDataFromNamed(t,e,a(this,Oe)),this}recordFutureForcedDependency(t,e){return a(this,de).recordFutureForcedDependency(t,a(this,Oe)),this}inheritSimpleDataAsFutureForcedDependencies(t){return a(this,de).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return a(this,de).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return a(this,Cr)||a(this,de).resetBBox(a(this,Oe)),this}recordClipBox(t,e,i,n,s,o){return a(this,Cr)||a(this,de).recordClipBox(a(this,Oe),e,i,n,s,o),this}recordBBox(t,e,i,n,s,o){return a(this,Cr)||a(this,de).recordBBox(a(this,Oe),e,i,n,s,o),this}recordCharacterBBox(t,e,i,n,s,o,l){return a(this,Cr)||a(this,de).recordCharacterBBox(a(this,Oe),e,i,n,s,o,l),this}recordFullPageBBox(t){return a(this,Cr)||a(this,de).recordFullPageBBox(a(this,Oe)),this}getSimpleIndex(t){return a(this,de).getSimpleIndex(t)}recordDependencies(t,e){return a(this,de).recordDependencies(a(this,Oe),e),this}recordNamedDependency(t,e){return a(this,de).recordNamedDependency(a(this,Oe),e),this}recordOperation(t){return a(this,de).recordOperation(a(this,Oe),!0),this}recordShowTextOperation(t){return a(this,de).recordShowTextOperation(a(this,Oe),!0),this}bboxToClipBoxDropOperation(t){return a(this,Cr)||a(this,de).bboxToClipBoxDropOperation(a(this,Oe),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};de=new WeakMap,Oe=new WeakMap,Cr=new WeakMap,sh=new WeakMap,ah=new WeakMap;B0=Lw,Qn={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"]},Ff=class Ff{constructor(t){x(this,Ol);x(this,Rl);x(this,Ll,4);x(this,Bl,0);x(this,Ul,new(a(Ff,Sp))(a(this,Ll)*6));p(this,Ol,t.width),p(this,Rl,t.height)}record(t,e,i,n){if(a(this,Bl)===a(this,Ll)){p(this,Ll,a(this,Ll)*2);let l=new(a(Ff,Sp))(a(this,Ll)*6);l.set(a(this,Ul)),p(this,Ul,l)}let s=ht.domMatrixToTransform(t.getTransform()),o;if(n[0]!==1/0){let l=[1/0,1/0,-1/0,-1/0];ht.axialAlignedBoundingBox([0,-i,e,0],s,l);let c=ht.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]),y=Math.abs(Math.sin(m)),g=Math.abs(Math.cos(m));if(y<1e-6||g<1e-6||Math.abs(y-g)<1e-6)o=[u,h,u,f,d,h];else{let A=d-u,w=f-h,v=y*y,T=g*g,k=g*y,N=T-v,F=(w*T-A*k)/N,L=(w*k-A*v)/N;o=[u+L,h,u,h+F,d,f-F]}}}o||(o=[0,-i,0,0,e,-i],ht.applyTransform(o,s,0),ht.applyTransform(o,s,2),ht.applyTransform(o,s,4)),o[0]/=a(this,Ol),o[1]/=a(this,Rl),o[2]/=a(this,Ol),o[3]/=a(this,Rl),o[4]/=a(this,Ol),o[5]/=a(this,Rl),a(this,Ul).set(o,a(this,Bl)*6),Ye(this,Bl)._++}take(){return a(this,Ul).subarray(0,a(this,Bl)*6)}};Ol=new WeakMap,Rl=new WeakMap,Ll=new WeakMap,Bl=new WeakMap,Ul=new WeakMap,Sp=new WeakMap,x(Ff,Sp,Be.isFloat16ArraySupported?Float16Array:Float32Array);kb=Ff,_b=class{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){x(this,oh,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,oh).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:i}){if(!(!t||a(this,oh).has(t.loadedName))){if(_e(!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,oh).add(n),i?.(t)}catch{Mt(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}ie("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 Mt(`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 _t(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return _t(this,"isSyncFontLoadingSupported",Bn||Be.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(_e(!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 _t(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function i(k,N){return k.charCodeAt(N)<<24|k.charCodeAt(N+1)<<16|k.charCodeAt(N+2)<<8|k.charCodeAt(N+3)&255}function n(k,N,F,L){let Y=k.substring(0,N),q=k.substring(N+F);return Y+L+q}let s,o,l=this._document.createElement("canvas");l.width=1,l.height=1;let c=l.getContext("2d"),u=0;function h(k,N){if(++u>30){Mt("Load test font never loaded."),N();return}if(c.font="30px "+k,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){N();return}setTimeout(h.bind(null,k,N))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=n(f,976,d.length,d);let y=16,g=1482184792,A=i(f,y);for(s=0,o=d.length-3;s{T.remove(),e.complete()})}};oh=new WeakMap;Nb=class{constructor(t,e=null,i,n){z(this,"compiledGlyphs",Object.create(null));x(this,fe);p(this,fe,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){Mt(`getPathGenerator - ignoring character: "${o}".`)}let s=_C(n?.path);return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=s}get black(){return a(this,fe).black}get bold(){return a(this,fe).bold}get disableFontFace(){return a(this,fe).disableFontFace}set disableFontFace(t){_t(this,"disableFontFace",!!t)}get fontExtraProperties(){return a(this,fe).fontExtraProperties}get isInvalidPDFjsFont(){return a(this,fe).isInvalidPDFjsFont}get isType3Font(){return a(this,fe).isType3Font}get italic(){return a(this,fe).italic}get missingFile(){return a(this,fe).missingFile}get remeasure(){return a(this,fe).remeasure}get vertical(){return a(this,fe).vertical}get ascent(){return a(this,fe).ascent}get defaultWidth(){return a(this,fe).defaultWidth}get descent(){return a(this,fe).descent}get bbox(){return a(this,fe).bbox}get fontMatrix(){return a(this,fe).fontMatrix}get fallbackName(){return a(this,fe).fallbackName}get loadedName(){return a(this,fe).loadedName}get mimetype(){return a(this,fe).mimetype}get name(){return a(this,fe).name}get data(){return a(this,fe).data}clearData(){a(this,fe).clearData()}get cssFontInfo(){return a(this,fe).cssFontInfo}get systemFontInfo(){return a(this,fe).systemFontInfo}get defaultVMetrics(){return a(this,fe).defaultVMetrics}};fe=new WeakMap;Zg=class{};z(Zg,"strings",["fontFamily","fontWeight","italicAngle"]);Qg=class{};z(Qg,"strings",["css","loadedName","baseFontName","src"]);Pi=class Pi{};z(Pi,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),z(Pi,"numbers",["ascent","defaultWidth","descent"]),z(Pi,"strings",["fallbackName","loadedName","mimetype","name"]),z(Pi,"OFFSET_NUMBERS",Math.ceil(Pi.bools.length*2/8)),z(Pi,"OFFSET_BBOX",Pi.OFFSET_NUMBERS+Pi.numbers.length*8),z(Pi,"OFFSET_FONT_MATRIX",Pi.OFFSET_BBOX+1+8),z(Pi,"OFFSET_DEFAULT_VMETRICS",Pi.OFFSET_FONT_MATRIX+1+48),z(Pi,"OFFSET_STRINGS",Pi.OFFSET_DEFAULT_VMETRICS+1+6);yn=Pi,yi=class{};z(yi,"KIND",0),z(yi,"HAS_BBOX",1),z(yi,"HAS_BACKGROUND",2),z(yi,"SHADING_TYPE",3),z(yi,"N_COORD",4),z(yi,"N_COLOR",8),z(yi,"N_STOP",12),z(yi,"N_FIGURES",16);Mb=class{constructor(t){x(this,ch);x(this,Dp);x(this,mx,new TextDecoder);x(this,lh);p(this,Dp,t),p(this,lh,new DataView(t))}get fontFamily(){return b(this,ch,Jg).call(this,0)}get fontWeight(){return b(this,ch,Jg).call(this,1)}get italicAngle(){return b(this,ch,Jg).call(this,2)}};Dp=new WeakMap,mx=new WeakMap,lh=new WeakMap,ch=new WeakSet,Jg=function(t){_e(t>i&3;return n===0?void 0:n===2},t0=function(t){return _e(t0){w=[1/0,1/0,-1/0,-1/0];for(let v=0,T=h.length;vtypeof r=="object"&&Number.isInteger(r?.num)&&r.num>=0&&Number.isInteger(r?.gen)&&r.gen>=0,rM=r=>typeof r=="object"&&typeof r?.name=="string",uT=JN.bind(null,Bb,rM),Ub=class{constructor(){x(this,na,new Map);x(this,xx,Promise.resolve())}postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};a(this,xx).then(()=>{for(let[n]of a(this,na))n.call(this,i)})}addEventListener(t,e,i=null){let n=null;if(i?.signal instanceof AbortSignal){let{signal:s}=i;if(s.aborted){Mt("LoopbackPort - cannot use an `aborted` signal.");return}let o=()=>this.removeEventListener(t,e);n=()=>s.removeEventListener("abort",o),s.addEventListener("abort",o)}a(this,na).set(e,n)}removeEventListener(t,e){a(this,na).get(e)?.(),a(this,na).delete(e)}terminate(){for(let[,t]of a(this,na))t?.();a(this,na).clear()}};na=new WeakMap,xx=new WeakMap;Lg={DATA:1,ERROR:2},Ze={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};hl=class{constructor(t,e,i){x(this,mr);x(this,dh,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,mr,hT).bind(this),{signal:a(this,dh).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:Ze.PULL,streamId:s,desiredSize:u.desiredSize}),h.promise},cancel:u=>{_e(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:Ze.CANCEL,streamId:s,reason:on(u)}),h.promise}},i)}destroy(){a(this,dh)?.abort(),p(this,dh,null)}};dh=new WeakMap,mr=new WeakSet,hT=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){b(this,mr,fT).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===Lg.DATA)n.resolve(t.data);else if(t.callback===Lg.ERROR)n.reject(on(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:Lg.DATA,callbackId:t.callbackId,data:o})},function(o){s.postMessage({sourceName:i,targetName:n,callback:Lg.ERROR,callbackId:t.callbackId,reason:on(o)})});return}if(t.streamId){b(this,mr,dT).call(this,t);return}e(t.data)},dT=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:Ze.ENQUEUE,streamId:e,chunk:u},d)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:Ze.CLOSE,streamId:e}),delete o.streamSinks[e])},error(u){_e(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:Ze.ERROR,streamId:e,reason:on(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:Ze.START_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:Ze.START_COMPLETE,streamId:e,reason:on(u)})})},fT=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 Ze.START_COMPLETE:t.success?o.startCall.resolve():o.startCall.reject(on(t.reason));break;case Ze.PULL_COMPLETE:t.success?o.pullCall.resolve():o.pullCall.reject(on(t.reason));break;case Ze.PULL:if(!l){s.postMessage({sourceName:i,targetName:n,stream:Ze.PULL_COMPLETE,streamId:e,success:!0});break}l.desiredSize<=0&&t.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=t.desiredSize,Promise.try(l.onPull||lC).then(function(){s.postMessage({sourceName:i,targetName:n,stream:Ze.PULL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:Ze.PULL_COMPLETE,streamId:e,reason:on(u)})});break;case Ze.ENQUEUE:if(_e(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(t.chunk);break;case Ze.CLOSE:if(_e(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),b(this,mr,i0).call(this,o,e);break;case Ze.ERROR:_e(o,"error should have stream controller"),o.controller.error(on(t.reason)),b(this,mr,i0).call(this,o,e);break;case Ze.CANCEL_COMPLETE:t.success?o.cancelCall.resolve():o.cancelCall.reject(on(t.reason)),b(this,mr,i0).call(this,o,e);break;case Ze.CANCEL:if(!l)break;let c=on(t.reason);Promise.try(l.onCancel||lC,c).then(function(){s.postMessage({sourceName:i,targetName:n,stream:Ze.CANCEL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:Ze.CANCEL_COMPLETE,streamId:e,reason:on(u)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},i0=async function(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]};U0=class{constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:i=null}){x(this,yx,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:ie(`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,yx)[t]} data at: ${n}`)})}async _fetch(t,e){ie("Abstract method `_fetch` called.")}};yx=new WeakMap;z0=class extends U0{async _fetch(t,e){let i=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",n=await Rx(t,i);return n instanceof Uint8Array?n:Fx(n)}},j0=class{constructor({enableHWA:t=!1}){x(this,Ip,!1);p(this,Ip,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,Ip)})}}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){ie("Abstract method `_createCanvas` called.")}};Ip=new WeakMap;zb=class extends j0{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}},H0=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){}},jb=class extends H0{constructor({docId:e,ownerDocument:i=globalThis.document}){super();x(this,yt);x(this,Hl);x(this,fh);x(this,ra);x(this,sa);x(this,Bi);x(this,Gl);x(this,$l,0);p(this,sa,e),p(this,Bi,i)}addFilter(e){if(!e)return"none";let i=a(this,yt,Fi).get(e);if(i)return i;let[n,s,o]=b(this,yt,n0).call(this,e),l=e.length===1?n:`${n}${s}${o}`;if(i=a(this,yt,Fi).get(l),i)return a(this,yt,Fi).set(e,i),i;let c=`g_${a(this,sa)}_transfer_map_${Ye(this,$l)._++}`,u=b(this,yt,Cu).call(this,c);a(this,yt,Fi).set(e,u),a(this,yt,Fi).set(l,u);let h=b(this,yt,Tu).call(this,c);return b(this,yt,gf).call(this,n,s,o,h),u}addHCMFilter(e,i){let n=`${e}-${i}`,s="base",o=a(this,yt,pf).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,yt,pf).set(s,o)),!e||!i))return o.url;let l=b(this,yt,xf).call(this,e);e=ht.makeHexColor(...l);let c=b(this,yt,xf).call(this,i);if(i=ht.makeHexColor(...c),a(this,yt,Eu).style.color="",e==="#000000"&&i==="#ffffff"||e===i)return o.url;let u=new Array(256);for(let y=0;y<=255;y++){let g=y/255;u[y]=g<=.03928?g/12.92:((g+.055)/1.055)**2.4}let h=u.join(","),d=`g_${a(this,sa)}_hcm_filter`,f=o.filter=b(this,yt,Tu).call(this,d);b(this,yt,gf).call(this,h,h,h,f),b(this,yt,Hb).call(this,f);let m=(y,g)=>{let A=l[y]/255,w=c[y]/255,v=new Array(g+1);for(let T=0;T<=g;T++)v[T]=A+T/g*(w-A);return v.join(",")};return b(this,yt,gf).call(this,m(0,5),m(1,5),m(2,5),f),o.url=b(this,yt,Cu).call(this,d),o.url}addAlphaFilter(e){let i=a(this,yt,Fi).get(e);if(i)return i;let[n]=b(this,yt,n0).call(this,[e]),s=`alpha_${n}`;if(i=a(this,yt,Fi).get(s),i)return a(this,yt,Fi).set(e,i),i;let o=`g_${a(this,sa)}_alpha_map_${Ye(this,$l)._++}`,l=b(this,yt,Cu).call(this,o);a(this,yt,Fi).set(e,l),a(this,yt,Fi).set(s,l);let c=b(this,yt,Tu).call(this,o);return b(this,yt,Gb).call(this,n,c),l}addLuminosityFilter(e){let i=a(this,yt,Fi).get(e||"luminosity");if(i)return i;let n,s;if(e?([n]=b(this,yt,n0).call(this,[e]),s=`luminosity_${n}`):s="luminosity",i=a(this,yt,Fi).get(s),i)return a(this,yt,Fi).set(e,i),i;let o=`g_${a(this,sa)}_luminosity_map_${Ye(this,$l)._++}`,l=b(this,yt,Cu).call(this,o);a(this,yt,Fi).set(e,l),a(this,yt,Fi).set(s,l);let c=b(this,yt,Tu).call(this,o);return b(this,yt,pT).call(this,c),e&&b(this,yt,Gb).call(this,n,c),l}addHighlightHCMFilter(e,i,n,s,o){let l=`${i}-${n}-${s}-${o}`,c=a(this,yt,pf).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,yt,pf).set(e,c)),!i||!n))return c.url;let[u,h]=[i,n].map(b(this,yt,xf).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,y]=[s,o].map(b(this,yt,xf).bind(this));f{let N=new Array(256),F=(f-d)/k,L=v/255,Y=(T-v)/(255*k),q=0;for(let G=0;G<=k;G++){let j=Math.round(d+G*F),tt=L+G*Y;for(let et=q;et<=j;et++)N[et]=tt;q=j+1}for(let G=q;G<256;G++)N[G]=N[q-1];return N.join(",")},A=`g_${a(this,sa)}_hcm_${e}_filter`,w=c.filter=b(this,yt,Tu).call(this,A);return b(this,yt,Hb).call(this,w),b(this,yt,gf).call(this,g(m[0],y[0],5),g(m[1],y[1],5),g(m[2],y[2],5),w),c.url=b(this,yt,Cu).call(this,A),c.url}destroy(e=!1){e&&a(this,Gl)?.size||(a(this,ra)?.parentNode.parentNode.remove(),p(this,ra,null),a(this,fh)?.clear(),p(this,fh,null),a(this,Gl)?.clear(),p(this,Gl,null),p(this,$l,0))}};Hl=new WeakMap,fh=new WeakMap,ra=new WeakMap,sa=new WeakMap,Bi=new WeakMap,Gl=new WeakMap,$l=new WeakMap,yt=new WeakSet,Fi=function(){return a(this,fh)||p(this,fh,new Map)},pf=function(){return a(this,Gl)||p(this,Gl,new Map)},Eu=function(){if(!a(this,ra)){let e=a(this,Bi).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,Bi).createElementNS(Us,"svg");n.setAttribute("width",0),n.setAttribute("height",0),p(this,ra,a(this,Bi).createElementNS(Us,"defs")),e.append(n),n.append(a(this,ra)),a(this,Bi).body.append(e)}return a(this,ra)},n0=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(",")]},Cu=function(e){if(a(this,Hl)===void 0){p(this,Hl,"");let i=a(this,Bi).URL;i!==a(this,Bi).baseURI&&(Hm(i)?Mt('#createUrl: ignore "data:"-URL for performance reasons.'):p(this,Hl,Nw(i,"")))}return`url(${a(this,Hl)}#${e})`},pT=function(e){let i=a(this,Bi).createElementNS(Us,"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)},Hb=function(e){let i=a(this,Bi).createElementNS(Us,"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)},Tu=function(e){let i=a(this,Bi).createElementNS(Us,"filter");return i.setAttribute("color-interpolation-filters","sRGB"),i.setAttribute("id",e),a(this,yt,Eu).append(i),i},mf=function(e,i,n){let s=a(this,Bi).createElementNS(Us,i);s.setAttribute("type","discrete"),s.setAttribute("tableValues",n),e.append(s)},gf=function(e,i,n,s){let o=a(this,Bi).createElementNS(Us,"feComponentTransfer");s.append(o),b(this,yt,mf).call(this,o,"feFuncR",e),b(this,yt,mf).call(this,o,"feFuncG",i),b(this,yt,mf).call(this,o,"feFuncB",n)},Gb=function(e,i){let n=a(this,Bi).createElementNS(Us,"feComponentTransfer");i.append(n),b(this,yt,mf).call(this,n,"feFuncA",e)},xf=function(e){return a(this,yt,Eu).style.color=e,wd(getComputedStyle(a(this,yt,Eu)).getPropertyValue("color"))};Bn&&Mt("Please use the `legacy` build in Node.js environments.");$b=class extends H0{},Vb=class extends j0{_createCanvas(t,e){return it.default.getBuiltinModule("module").createRequire("")("@napi-rs/canvas").createCanvas(t,e)}},qb=class extends U0{async _fetch(t,e){return sM(t)}},aM=` +`,{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"}});z(this,"detectImprecise",async t=>{this.buffer=new Uint8Array(bu);let e=F_(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=M_(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 t1(P_(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 $t||o instanceof mn)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(e1(e,this.getTokenizerOptions()))}async fromBlob(t){this.options.signal?.throwIfAborted();let e=i1(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([W1("node:fs/promises"),W1("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=Y1(e?.sampleSize??bu),n,s=!1,o=t.getReader(),l=[],c=0;try{for(;c0){let d=l.length===1?l[0]:g1(l);try{n=await this.fromBuffer(d.subarray(0,i))}catch(f){if(!(f instanceof $t))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>=I_)return{ext:"gz",mime:"application/gzip"};let e=new tf(t),i=O_(e.inflate(),k_),n=Ge(t),s,o,l,c;if(n){let u=new AbortController;s=setTimeout(()=>{u.abort(new DOMException(`Operation timed out after ${$1} ms`,"TimeoutError"))},$1),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 Kn(this.buffer,t,e)}checkString(t,e){return this.check(x1(t,e?.encoding),e)}async readTiffTag(t){let e=await this.tokenizer.readToken(t?Zo:Te);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?Zo:Te);if(!(e>N_)&&!(Ge(this.tokenizer)&&2+e*12>q1))for(let i=0;i=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(n>=8){let l=(t?Zo:Te).get(this.buffer,8),c=(t?Zo:Te).get(this.buffer,10);if(l===28&&c===254||l===31&&c===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(Ge(this.tokenizer)&&n>__)return e;let s=Ge(this.tokenizer)?q1:this.tokenizer.fileInfo.size;try{await gn(this.tokenizer,n,{maximumLength:s,reason:"TIFF IFD offset"})}catch(l){if(l instanceof $t)return;throw l}let o;try{o=await this.readTiffIFD(t)}catch(l){if(l instanceof $t)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"}}}},j_=new Set(A1),H_=new Set(v1)});var PS={};Hx(PS,{AbortException:()=>Lr,AnnotationEditorLayer:()=>sx,AnnotationEditorParamsType:()=>Gt,AnnotationEditorType:()=>_t,AnnotationEditorUIManager:()=>Lo,AnnotationLayer:()=>Q0,AnnotationMode:()=>Ea,AnnotationType:()=>$e,CSSConstants:()=>P0,ColorPicker:()=>$f,DOMSVGFactory:()=>Pc,DrawLayer:()=>ax,FeatureTest:()=>Be,GlobalWorkerOptions:()=>dr,ImageKind:()=>If,InvalidPDFException:()=>hd,MathClamp:()=>oi,OPS:()=>ud,OutputScale:()=>Es,PDFDataRangeTransport:()=>Gf,PDFDateString:()=>_c,PDFWorker:()=>xd,PasswordResponses:()=>EC,PermissionFlag:()=>vC,PixelsPerInch:()=>Da,RenderingCancelledException:()=>dd,ResponseException:()=>Mc,SignatureExtractor:()=>fr,SupportedImageMimeTypes:()=>F0,TextLayer:()=>gd,TextLayerImages:()=>ox,TouchManager:()=>Uf,Util:()=>ht,VerbosityLevel:()=>jm,XfaLayer:()=>Lf,applyOpacity:()=>kC,build:()=>zT,createValidAbsoluteUrl:()=>Nw,fetchData:()=>Rx,findContrastColor:()=>IC,getDocument:()=>RT,getFilenameFromUrl:()=>TC,getPdfFilenameFromUrl:()=>SC,getRGB:()=>wd,getUuid:()=>Mw,getXfaPageViewport:()=>DC,isDataScheme:()=>Hm,isPdfFile:()=>Lx,isValidExplicitDest:()=>uT,makeArr:()=>Px,makeMap:()=>Ox,makeObj:()=>_0,noContextMenu:()=>Hn,normalizeUnicode:()=>CC,renderRichText:()=>Fw,setLayerDimensions:()=>Ro,shadow:()=>Mt,stopEvent:()=>Ie,updateUrlHash:()=>_w,version:()=>UT});function V_(r){Number.isInteger(r)&&(_x=r)}function q_(){return _x}function Mx(r){_x>=jm.INFOS&&console.info(`Info: ${r}`)}function Pt(r){_x>=jm.WARNINGS&&console.warn(`Warning: ${r}`)}function ie(r){throw new Error(r)}function Ne(r,t){r||ie(t)}function W_(r){switch(r?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Nw(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=Q_(r)}catch{}let i=t?URL.parse(r,t):URL.parse(r);return W_(i)?i:null}function _w(r,t,e=!1){let i=URL.parse(r);return i?(i.hash=t,i.href):e&&Nw(r,"http://example.com")?r.split("#",1)[0]+`${t?`#${t}`:""}`:""}function Jy(r){return r.substring(r.lastIndexOf("/")+1)}function Mt(r,t,e,i=!1){return Object.defineProperty(r,t,{value:e,enumerable:!i,configurable:!0,writable:!1}),e}function X_(r){(typeof r!="object"||r?.length===void 0)&&ie("Invalid argument for bytesToString");let t=r.length,e=8192;if(t>24&255,r>>16&255,r>>8&255,r&255)}function K_(){let r=new Uint8Array(4);return r[0]=1,new Uint32Array(r.buffer,0,1)[0]===1}function Z_(){try{return new Function(""),!0}catch{return!1}}function Q_(r){return decodeURIComponent(escape(r))}function CC(r){return Xy||(Xy=/([\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,Q1=new Map([["\uFB05","\u017Ft"]])),r.replaceAll(Xy,(t,e,i)=>e?e.normalize("NFKC"):Q1.get(i))}function Mw(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();let r=new Uint8Array(32);return crypto.getRandomValues(r),X_(r)}function J_(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 oi(r,t,e){return Math.min(Math.max(r,t),e)}async function Rx(r,t="text"){if(_f(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 Hm(r){let t=r.length,e=0;for(;e{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=Jy(c),/^\.pdf$/i.test(c))?l:c}catch{return l}},s=/\.pdf$/i,o=Jy(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 _f(r,t){let e=t?URL.parse(r,t):URL.parse(r);return/https?:/.test(e?.protocol??"")}function Hn(r){r.preventDefault()}function Ie(r){r.preventDefault(),r.stopPropagation()}function tM(r){console.log("Deprecated API usage: "+r)}function DC(r,{scale:t=1,rotation:e=0}){let{width:i,height:n}=r.attributes.style,s=[0,0,parseInt(i),parseInt(n)];return new Bf({viewBox:s,userUnit:1,scale:t,rotation:e})}function wd(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)):(Pt(`Not a valid color format: "${r}"`),[0,0,0])}function eM(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,wd(i))}t.remove()}function ke(r){let{a:t,b:e,c:i,d:n,e:s,f:o}=r.getTransform();return[t,e,i,n,s,o]}function Zr(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 Ro(r,t,e=!1,i=!0){if(t instanceof Bf){let{pageWidth:n,pageHeight:s}=t.rawDims,{style:o}=r,l=Be.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 kC(r,t){t=oi(t??1,0,1);let e=255*(1-t);return r.map(i=>Math.round(i*t+e))}function J1(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+(in?(i+.05)/(n+.05):(n+.05)/(i+.05)}function IC(r,t){let e=r[0]+r[1]*256+r[2]*65536+t[0]*16777216+t[1]*4294967296+t[2]*1099511627776,i=iC.get(e);if(i)return i;let n=new Float32Array(9),s=n.subarray(0,3),o=n.subarray(3,6);J1(r,o);let l=n.subarray(6,9);J1(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]),eC(o,l,s)f;){let m=o[2]=(h+d)/2;c===eC(o,l,s)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,y=(c[e*2+1]+t.offsetY)*t.scaleY,g=(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(y>=v)return;let T=u[s*4],I=u[s*4+1],_=u[s*4+2],F=u[o*4],L=u[o*4+1],Y=u[o*4+2],q=u[l*4],G=u[l*4+1],j=u[l*4+2],J=Math.round(y),et=Math.round(v),N,X,O,C,D,E,S,k;for(let M=J;M<=et;M++){if(Mv?V=1:A===v?V=0:V=(A-M)/(A-v),N=g-(g-w)*V,X=F-(F-q)*V,O=L-(L-G)*V,C=Y-(Y-j)*V}let P;Mv?P=1:P=(y-M)/(y-v),D=m-(m-w)*P,E=T-(T-q)*P,S=I-(I-G)*P,k=_-(_-j)*P;let B=Math.round(Math.min(N,D)),$=Math.round(Math.max(N,D)),U=d*M+B*4;for(let V=B;V<=$;V++)P=(N-V)/(N-D),P<0?P=0:P>1&&(P=1),h[U++]=X-(X-E)*P|0,h[U++]=O-(O-S)*P|0,h[U++]=C-(C-k)*P|0,h[U++]=255}}function uM(r,t,e){let i=t.coords,n=t.colors,s,o;switch(t.type){case ul.LATTICE:let l=t.verticesPerRow,c=Math.floor(i.length/l)-1,u=l-1;for(s=0;s>3,d=i&7,f=c^u,m=r.length;e=new Uint32Array(e.buffer);let y=0;for(let g=0;g>7&1)&f,e[y+1]=c^-(v>>6&1)&f,e[y+2]=c^-(v>>5&1)&f,e[y+3]=c^-(v>>4&1)&f,e[y+4]=c^-(v>>3&1)&f,e[y+5]=c^-(v>>2&1)&f,e[y+6]=c^-(v>>1&1)&f,e[y+7]=c^-(v&1)&f}if(d===0)continue;let A=t>7-w&1)&f}return{srcPos:t,destPos:y}}function pM(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 Bg(r,t,e,i,n,s,o,l,c,u){let[h,d,f,m,y,g]=ke(r);if(d===0&&f===0){let v=o*h+y,T=Math.round(v),I=l*m+g,_=Math.round(I),F=(o+c)*h+y,L=Math.abs(Math.round(F)-T)||1,Y=(l+u)*m+g,q=Math.abs(Math.round(Y)-_)||1;return r.setTransform(Math.sign(h),0,0,Math.sign(m),T,_),r.drawImage(t,e,i,n,s,0,0,L,q),r.setTransform(h,d,f,m,y,g),[L,q]}if(h===0&&m===0){let v=l*f+y,T=Math.round(v),I=o*d+g,_=Math.round(I),F=(l+u)*f+y,L=Math.abs(Math.round(F)-T)||1,Y=(o+c)*d+g,q=Math.abs(Math.round(Y)-_)||1;return r.setTransform(0,Math.sign(d),Math.sign(f),0,T,_),r.drawImage(t,e,i,n,s,0,0,q,L),r.setTransform(h,d,f,m,y,g),[q,L]}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 fC(r,t){if(t instanceof ImageData){r.putImageData(t,0,0);return}let e=t.height,i=t.width,n=e%pn,s=(e-n)/pn,o=n===0?s:s+1,l=r.createImageData(i,pn),c=0,u,h=t.data,d=l.data,f,m,y,g;if(t.kind===If.GRAYSCALE_1BPP){let A=h.byteLength,w=new Uint32Array(d.buffer,0,d.byteLength>>2),v=w.length,T=i+7>>3,I=4294967295,_=Be.isLittleEndian?4278190080:255;for(f=0;fT?i:F*8-7,q=Y&-8,G=0,j=0;for(;L>=1}for(;u=s&&(y=n,g=i*y),u=0,m=g;m--;)d[u++]=h[c++],d[u++]=h[c++],d[u++]=h[c++],d[u++]=255;r.putImageData(l,0,f*pn)}else throw new Error(`bad image kind: ${t.kind}`)}function pC(r,t){if(t.bitmap){r.drawImage(t.bitmap,0,0);return}let e=t.height,i=t.width,n=e%pn,s=(e-n)/pn,o=n===0?s:s+1,l=r.createImageData(i,pn),c=0,u=t.data,h=l.data;for(let d=0;d0?r.rangeChunkSize:2**16,h=r.worker instanceof xd?r.worker:null,d=r.verbosity,f=typeof r.docBaseUrl=="string"&&!Hm(r.docBaseUrl)?r.docBaseUrl:null,m=Rg(r.cMapUrl),y=r.cMapPacked!==!1,g=Rg(r.iccUrl),A=Rg(r.standardFontDataUrl),w=Rg(r.wasmUrl),v=r.stopAtErrors!==!0,T=Number.isInteger(r.maxImageSize)&&r.maxImageSize>-1?r.maxImageSize:-1,I=r.isEvalSupported!==!1,_=typeof r.isOffscreenCanvasSupported=="boolean"?r.isOffscreenCanvasSupported:!Bn,F=typeof r.isImageDecoderSupported=="boolean"?r.isImageDecoderSupported:!Bn&&(Be.platform.isFirefox||!globalThis.chrome),L=Number.isInteger(r.canvasMaxAreaInBytes)?r.canvasMaxAreaInBytes:-1,Y=typeof r.disableFontFace=="boolean"?r.disableFontFace:Bn,q=r.fontExtraProperties===!0,G=r.enableXfa===!0,j=r.ownerDocument||globalThis.document,J=r.disableRange===!0,et=r.disableStream===!0,N=r.disableAutoFetch===!0,X=r.pdfBug===!0,O=r.CanvasFactory||(Bn?Vb:zb),C=r.FilterFactory||(Bn?$b:jb),D=r.BinaryDataFactory||(Bn?qb:z0),E=r.enableHWA===!0,S=r.enableWebGPU===!0,k=r.useWasm!==!1,M=r.pagesMapper||new b2,P=typeof r.useSystemFonts=="boolean"?r.useSystemFonts:!Bn&&!Y,B=typeof r.useWorkerFetch=="boolean"?r.useWorkerFetch:!!(D===z0&&m&&y&&A&&w&&_f(m,document.baseURI)&&_f(A,document.baseURI)&&_f(w,document.baseURI)),$=null;V_(d);let U={canvasFactory:new O({ownerDocument:j,enableHWA:E}),filterFactory:new C({docId:e,ownerDocument:j}),binaryDataFactory:B?null:new D({cMapUrl:m,standardFontDataUrl:A,wasmUrl:w})};h||(h=xd.create({verbosity:d,port:dr.workerPort}),t._worker=h);let V={docId:e,apiVersion:"5.6.205",data:n,password:l,disableAutoFetch:N,rangeChunkSize:u,docBaseUrl:f,enableXfa:G,evaluatorOptions:{maxImageSize:T,disableFontFace:Y,ignoreErrors:v,isEvalSupported:I,isOffscreenCanvasSupported:_,isImageDecoderSupported:F,canvasMaxAreaInBytes:L,fontExtraProperties:q,useSystemFonts:P,useWasm:k,useWorkerFetch:B,cMapUrl:m,cMapPacked:y,iccUrl:g,standardFontDataUrl:A,wasmUrl:w,enableWebGPU:S}},Z={ownerDocument:j,pdfBug:X,styleElement:$,enableHWA:E,loadingParams:{disableAutoFetch:N,enableXfa:G}};return h.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let Q=h.messageHandler.sendWithPromise("GetDocRequest",V,n?[n.buffer]:null),nt;if(!n)if(c)nt=new r2({pdfDataRangeTransport:c,disableRange:J,disableStream:et});else if(i){let ot=wM(i);nt=new ot({url:i,httpHeaders:s,withCredentials:o,rangeChunkSize:u,disableRange:J,disableStream:et})}else throw new Error("getDocument - expected either `data`, `range`, or `url` parameter.");return Q.then(ot=>{if(t.destroyed)throw new Error("Loading aborted");if(h.destroyed)throw new Error("Worker was destroyed");let dt=new hl(e,ot,h.port),at=new T2(dt,t,nt,Z,U,M);t._transport=at,dt.send("Ready",null)})}).catch(t._capability.reject),t}function AC(r){return Math.floor(Math.max(0,Math.min(1,r))*255).toString(16).padStart(2,"0")}function sf(r){return Math.max(0,Math.min(255,255*r))}function Hg(r){return`${(r*100).toFixed(2)}%`}var Gg,Bn,Qy,$g,$_,YR,Ln,Ea,Of,_t,Gt,vC,ul,ri,If,$e,Au,jm,ud,nf,EC,_x,Lc,N0,Nf,hd,Mc,tb,Lr,Be,Wy,Ca,Vg,eb,ht,Xy,Q1,Nu,Px,Ox,_0,Rf,Lf,Us,ol,Da,Bf,dd,ja,M0,Zf,_c,Es,F0,ib,P0,iC,Ha,Ga,Jn,tr,Qf,$a,Ru,Lu,Jf,lx,_C,Ni,MC,FC,vu,of,Hs,rb,tp,dl,$s,Ia,PC,OC,ab,sb,fl,pl,Bu,ml,ce,Oi,cx,ob,Uu,ep,Ri,zu,qg,Ow,lb,Ve,Va,ip,Se,cb,ux,LC,Fc,hx,ub,ju,wn,Hu,Pe,De,Gu,$u,qi,Vu,er,ui,qa,Wa,Xa,Ya,ts,ir,gl,np,rp,qu,sp,es,Ka,Wu,Za,is,dx,Vs,Xu,ap,Qa,xl,Yu,Ja,op,Qe,ae,qs,to,eo,lp,Ku,cp,io,ns,Ws,up,hp,nr,mt,Wg,hb,BC,UC,zC,lf,jC,HC,GC,db,$C,VC,qC,WC,$i,zs,XC,YC,fb,KC,cf,pb,Fu,Lo,hi,rs,Ar,Zu,ss,An,Qu,as,cn,Xs,yl,os,no,Or,uf,Xg,Vi,O0,vi,rr,bl,ye,dp,ro,sr,so,ao,wl,fp,mb,_u,Ju,Al,pp,mp,gp,xp,yp,Ys,vl,Ks,El,Zs,Bo,ZC,QC,JC,Rw,Uf,Cl,vr,ve,oe,Qs,th,oo,bp,Ei,Tl,Js,ar,lo,wp,Sl,vn,Ap,Dl,ta,ls,eh,ih,or,kl,vp,fx,Dt,gb,Ep,xb,Yg,tT,eT,yb,Kg,bb,iT,nT,rT,wb,sT,Ab,aT,oT,lT,vb,hf,Ft,be,Eb,nC,Zn,Qr,R0,zf,Il,Nl,ea,Ci,px,cT,jf,Cp,L0,wu,rC,sC,Cb,nh,co,Tb,oC,ia,ee,ue,_l,Ml,Fl,Li,Tp,Db,Sb,un,hn,Pl,Er,rh,uo,ho,he,kb,de,Oe,Cr,sh,ah,Lw,B0,Qn,Ol,Rl,Ll,Bl,Ul,Sp,Ff,Ib,oh,Nb,fe,_b,Zg,Qg,Pi,yn,yi,Dp,mx,lh,ch,Jg,Mb,zl,uh,cs,jl,df,Fb,Tr,gx,qe,le,br,t0,e0,ff,Ob,Pb,Rb,hh,Lb,Bb,rM,uT,na,xx,Ub,Lg,Ze,dh,mr,hT,dT,fT,i0,hl,yx,U0,z0,kp,j0,zb,H0,Hl,fh,ra,sa,Bi,Gl,$l,yt,Fi,pf,Eu,n0,Cu,pT,Hb,Tu,mf,gf,Gb,xf,jb,$b,Vb,qb,aM,Ip,ph,mh,gh,yd,mT,gT,Wb,Pw,ki,Hf,Xb,Yb,Kb,cC,bx,Zb,uC,hC,fM,dC,pn,Ky,Un,Mu,G0,mM,gM,xM,gC,Br,Qb,Jb,t2,Bw,Ou,Np,_p,fd,pd,md,e2,i2,n2,Mp,s2,r2,Fp,a2,Pp,o2,Zy,yC,us,bd,ET,CT,l2,Op,Cs,TT,ST,DT,kT,c2,Rp,Na,IT,NT,h2,u2,d2,f2,p2,Lp,Bp,dr,xh,Up,m2,Su,zp,jp,Hp,yh,g2,fo,pe,bh,wh,Gp,y2,x2,We,Sr,Ti,Vl,hs,zi,yf,bf,s0,b2,Du,bC,lr,$0,AM,wC,po,Wi,$p,Vp,Ah,ql,aa,qp,Wp,Wl,Xp,vh,mo,Eh,Yp,Ch,Xl,Kp,Zp,Th,Yl,Qp,Sh,Dh,_a,MT,FT,w2,jn,a0,A2,PT,OT,Ai,gd,vM,wx,Ax,v2,kh,Jp,tm,em,Gf,E2,oa,Kl,Zl,wf,Uw,C2,go,Dr,la,Ql,vx,Jl,tc,Zi,o0,LT,BT,Af,Ih,l0,Fe,xd,En,ec,ca,kr,ic,Nh,ua,Rr,vf,c0,T2,S2,xo,nc,ll,D2,UT,zT,Cn,rc,_h,ai,im,Mh,ha,nm,yo,Ir,rm,me,k2,I2,N2,rl,jT,za,ln,$f,ds,sm,Fh,am,cl,V0,q0,_2,Pc,EM,Oc,CM,Mf,sc,Ph,cr,om,M2,zw,_e,F2,zn,sl,HT,GT,Vf,P2,ka,O2,R2,L2,W0,B2,U2,lm,z2,qf,Tn,bo,Ex,Cx,Oh,Rh,Re,fs,wo,ac,Lh,Bh,ps,Sn,da,fa,Le,pa,Ao,cm,ma,Uh,oc,vo,di,Eo,Lt,u0,H2,G2,$2,h0,V2,$T,VT,qT,WT,d0,f0,q2,j2,X0,um,W2,hm,X2,dm,Y2,fm,Y0,K2,Z2,pm,lc,mm,Q2,Wf,K0,J2,tw,ew,Z0,gm,xm,nw,iw,cc,uc,zh,Co,ym,hc,Dn,bm,Ta,p0,rw,jw,Q0,zg,kn,wm,dc,In,Je,XT,YT,KT,m0,Sa,g0,x0,ZT,aw,QT,Ae,sw,xt,Nn,Nr,jh,Hh,ms,Ut,fc,pc,Am,vm,Gh,$h,To,Em,Tx,Sx,li,Ef,JT,tS,eS,iS,nS,rS,Gs,J0,Vh,mc,ga,Cm,_n,Tm,Xe,Dx,sS,tx,Sm,Dm,km,So,_r,Qi,aS,y0,oS,lS,ow,Xf,Im,qh,lw,Yf,cw,Wh,Nm,xa,gc,_m,dn,Mm,Fm,xc,Mn,Fn,Si,Xh,Yh,Ui,Kh,ur,Pm,Rt,uw,b0,cS,uS,hS,hw,al,pr,ku,dS,w0,A0,fS,pS,mS,gS,xS,te,ex,yc,ix,Pn,Zh,fi,bc,wc,Wt,dw,fw,pw,Cf,yS,v0,Tf,Iu,Ht,nx,gs,pi,mi,Ac,Qh,Xi,Di,hr,vc,Ec,Cc,Jh,E0,mw,Yi,Om,Rm,On,xs,ys,td,ed,Tc,Ii,js,bS,wS,AS,Rc,rx,kx,vS,Pu,gw,Kf,jg,af,Sc,ne,xw,Mr,ES,CS,yw,C0,TS,SS,DS,bw,ww,kS,fr,Aw,vw,Do,bs,ko,Dc,bn,Ew,Ee,gi,Io,ya,No,id,ba,kc,ws,Rn,nd,Xt,Df,kf,T0,S0,D0,Cw,k0,IS,Sf,Ic,rd,_o,Mo,wa,fn,Fo,sd,ad,Fr,Aa,xi,va,Po,od,vt,Oo,ge,Tw,NS,Jr,Sw,Dw,I0,wr,sx,Pr,Ki,Nc,Lm,Ix,_S,Ts,kw,MS,Iw,si,ax,ld,Bm,Um,cd,As,vs,zm,Nx,FS,Pf,ox,OS=Kt(()=>{H();Gg={};Gg.d=(r,t)=>{for(var e in t)Gg.o(t,e)&&!Gg.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})};Gg.o=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);Bn=typeof it.default=="object"&&it.default+""=="[object process]"&&!it.default.versions.nw&&!(it.default.versions.electron&&it.default.type&&it.default.type!=="browser"),Qy=[.001,0,0,.001,0,0],$g=1.35,$_=.35,YR=$_/$g,Ln={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ea={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},Of="pdfjs_internal_editor_",_t={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},Gt={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},vC={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},ul={TRIANGLES:1,LATTICE:2,PATCH:3},ri={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},If={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},$e={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},Au={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},jm={ERRORS:0,WARNINGS:1,INFOS:5},ud={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},nf={moveTo:0,lineTo:1,curveTo:2,quadraticCurveTo:3,closePath:4},EC={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},_x=jm.WARNINGS;Lc=(function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t})(),N0=class extends Lc{constructor(t,e){super(t,"PasswordException"),this.code=e}},Nf=class extends Lc{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},hd=class extends Lc{constructor(t){super(t,"InvalidPDFException")}},Mc=class extends Lc{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}},tb=class extends Lc{constructor(t){super(t,"FormatError")}},Lr=class extends Lc{constructor(t){super(t,"AbortException")}};Be=class{static get isLittleEndian(){return Mt(this,"isLittleEndian",K_())}static get isEvalSupported(){return Mt(this,"isEvalSupported",Z_())}static get isOffscreenCanvasSupported(){return Mt(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return Mt(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get isFloat16ArraySupported(){return Mt(this,"isFloat16ArraySupported",typeof Float16Array<"u")}static get isSanitizerSupported(){return Mt(this,"isSanitizerSupported",typeof Sanitizer<"u")}static get platform(){let{platform:t,userAgent:e}=navigator;return Mt(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 Mt(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}},Wy=Array.from(Array(256).keys(),r=>r.toString(16).padStart(2,"0")),ht=class{static makeHexColor(t,e,i){return`#${Wy[t]}${Wy[e]}${Wy[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],y=n*h+c,g=y,A=n*f+c,w=A,v=l*d+u,T=v,I=l*m+u,_=I;if(s!==0||o!==0){let F=s*h,L=s*f,Y=o*d,q=o*m;y+=Y,w+=Y,A+=q,g+=q,v+=F,_+=F,I+=L,T+=L}i[0]=Math.min(i[0],y,A,g,w),i[1]=Math.min(i[1],v,I,T,_),i[2]=Math.max(i[2],y,A,g,w),i[3]=Math.max(i[3],v,I,T,_)}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,Ca,eb).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,Ca,eb).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)}};Ca=new WeakSet,Vg=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,y=d*(d*(d*t+3*u*e)+3*f*i)+m*n,g=d*(d*(d*s+3*u*o)+3*f*l)+m*c;h[0]=Math.min(h[0],y),h[1]=Math.min(h[1],g),h[2]=Math.max(h[2],y),h[3]=Math.max(h[3],g)},eb=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,Ca,Vg).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 y=Math.sqrt(m),g=2*u;b(this,Ca,Vg).call(this,t,e,i,n,s,o,l,c,(-h+y)/g,f),b(this,Ca,Vg).call(this,t,e,i,n,s,o,l,c,(-h-y)/g,f)},x(ht,Ca);Xy=null,Q1=null;Nu="pdfjs_internal_id_";Px=()=>[],Ox=()=>new Map,_0=()=>Object.create(null);typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(r){return r.reduce((t,e)=>t+e,0)});Rf=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")}},Lf=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&&Rf.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 y=d.children[++h.at(-1)[1]];if(y===null)continue;let{name:g}=y;if(g==="#text"){let w=document.createTextNode(y.value);u.push(w),m.append(w);continue}let A=y?.attributes?.xmlns?document.createElementNS(y.attributes.xmlns,g):document.createElement(g);if(m.append(A),y.attributes&&this.setAttributes({html:A,element:y,storage:e,intent:s,linkService:i}),y.children?.length>0)h.push([y,-1,A]);else if(y.value){let w=document.createTextNode(y.value);l&&Rf.shouldBuildText(g)&&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}},Us="http://www.w3.org/2000/svg",ol=class ol{};z(ol,"CSS",96),z(ol,"PDF",72),z(ol,"PDF_TO_CSS_UNITS",ol.CSS/ol.PDF);Da=ol;Bf=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 y,g,A,w;h===0?(y=Math.abs(u-t[1])*i+s,g=Math.abs(c-t[0])*i+o,A=(t[3]-t[1])*i,w=(t[2]-t[0])*i):(y=Math.abs(c-t[0])*i+s,g=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,y-h*i*c-f*i*u,g-d*i*c-m*i*u],this.width=A,this.height=w}get rawDims(){let t=this.viewBox;return Mt(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 ht.applyTransform(i,this.transform),i}convertToViewportRectangle(t){let e=[t[0],t[1]];ht.applyTransform(e,this.transform);let i=[t[2],t[3]];return ht.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){let i=[t,e];return ht.applyInverseTransform(i,this.transform),i}},dd=class extends Lc{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};M0=class{constructor(){x(this,ja,new Map);z(this,"times",[])}time(t){a(this,ja).has(t)&&Pt(`Timer is already running for ${t}`),a(this,ja).set(t,Date.now())}timeEnd(t){a(this,ja).has(t)||Pt(`Timer has not been started for ${t}`),this.times.push({name:t,start:a(this,ja).get(t),end:Date.now()}),a(this,ja).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 +`).join("")}};ja=new WeakMap;_c=class{static toDateObject(t){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;a(this,Zf)||p(this,Zf,new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));let e=a(this,Zf).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))}};Zf=new WeakMap,x(_c,Zf);Es=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}},F0=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"],ib=class{static get isDarkMode(){return Mt(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}},P0=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(),Mt(this,"commentForegroundColor",wd(i))}};iC=new Map;Hs=class Hs{constructor(t){x(this,Ni);x(this,Ha,null);x(this,Ga,null);x(this,Jn);x(this,tr,null);x(this,Qf,null);x(this,$a,null);x(this,Ru,null);x(this,Lu,null);p(this,Jn,t),a(Hs,Jf)||p(Hs,Jf,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,Ha,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=a(this,Jn)._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",Hn,{signal:e}),t.addEventListener("pointerdown",b(Hs,lx,_C),{signal:e}));let i=p(this,tr,document.createElement("div"));i.className="buttons",t.append(i);let n=a(this,Jn).toolbarPosition;if(n){let{style:s}=t,o=a(this,Jn)._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,Ha)}hide(){a(this,Ha).classList.add("hidden"),a(this,Ga)?.hideDropdown()}show(){a(this,Ha).classList.remove("hidden"),a(this,Qf)?.shown(),a(this,$a)?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=a(this,Jn),i=document.createElement("button");i.classList.add("basic","deleteButton"),i.tabIndex=0,i.setAttribute("data-l10n-id",a(Hs,Jf)[t]),b(this,Ni,vu).call(this,i)&&i.addEventListener("click",n=>{e.delete()},{signal:e._signal}),a(this,tr).append(i)}async addAltText(t){let e=await t.render();b(this,Ni,vu).call(this,e),a(this,tr).append(e,a(this,Ni,of)),p(this,Qf,t)}addComment(t,e=null){if(a(this,$a))return;let i=t.renderForToolbar();if(!i)return;b(this,Ni,vu).call(this,i);let n=p(this,Ru,a(this,Ni,of));e?(a(this,tr).insertBefore(i,e),a(this,tr).insertBefore(n,e)):a(this,tr).append(i,n),p(this,$a,t),t.toolbar=this}addColorPicker(t){if(a(this,Ga))return;p(this,Ga,t);let e=t.renderButton();b(this,Ni,vu).call(this,e),a(this,tr).append(e,a(this,Ni,of))}async addEditSignatureButton(t){let e=p(this,Lu,await t.renderEditButton(a(this,Jn)));b(this,Ni,vu).call(this,e),a(this,tr).append(e,a(this,Ni,of))}removeButton(t){t==="comment"&&(a(this,$a)?.removeToolbarCommentButton(),p(this,$a,null),a(this,Ru)?.remove(),p(this,Ru,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,tr).querySelector(i);n&&t==="comment"&&this.addComment(e,n)}updateEditSignatureButton(t){a(this,Lu)&&(a(this,Lu).title=t)}remove(){a(this,Ha).remove(),a(this,Ga)?.destroy(),p(this,Ga,null)}};Ha=new WeakMap,Ga=new WeakMap,Jn=new WeakMap,tr=new WeakMap,Qf=new WeakMap,$a=new WeakMap,Ru=new WeakMap,Lu=new WeakMap,Jf=new WeakMap,lx=new WeakSet,_C=function(t){t.stopPropagation()},Ni=new WeakSet,MC=function(t){a(this,Jn)._focusEventsAllowed=!1,Ie(t)},FC=function(t){a(this,Jn)._focusEventsAllowed=!0,Ie(t)},vu=function(t){let e=a(this,Jn)._uiManager._signal;return!(e instanceof AbortSignal)||e.aborted?!1:(t.addEventListener("focusin",b(this,Ni,MC).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",b(this,Ni,FC).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Hn,{signal:e}),!0)},of=function(){let t=document.createElement("div");return t.className="divider",t},x(Hs,lx),x(Hs,Jf,null);rb=Hs,sb=class{constructor(t){x(this,Ia);x(this,tp,null);x(this,dl,null);x(this,$s);p(this,$s,t)}show(t,e,i){let[n,s]=b(this,Ia,OC).call(this,e,i),{style:o}=a(this,dl)||p(this,dl,b(this,Ia,PC).call(this));t.append(a(this,dl)),o.insetInlineEnd=`${100*n}%`,o.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){a(this,dl).remove()}};tp=new WeakMap,dl=new WeakMap,$s=new WeakMap,Ia=new WeakSet,PC=function(){let t=p(this,dl,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar");let e=a(this,$s)._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",Hn,{signal:e});let i=p(this,tp,document.createElement("div"));return i.className="buttons",t.append(i),a(this,$s).hasCommentManager()&&b(this,Ia,ab).call(this,"commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{a(this,$s).commentSelection("floating_button")}),b(this,Ia,ab).call(this,"highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{a(this,$s).highlightSelection("floating_button")}),t},OC=function(t,e){let i=0,n=0;for(let s of t){let o=s.y+s.height;if(oi){n=l,i=o;continue}e?l>n&&(n=l):l=1}static clearPointerType(){p(ce,ml,null)}static clearPointerIds(){p(ce,fl,NaN),p(ce,pl,null)}static clearTimeStamp(){p(ce,Bu,NaN)}};fl=new WeakMap,pl=new WeakMap,Bu=new WeakMap,ml=new WeakMap,x(ce,fl,NaN),x(ce,pl,null),x(ce,Bu,NaN),x(ce,ml,null);Oi=ce,ob=class{constructor(){x(this,cx,0)}get id(){return`${Of}${Ye(this,cx)._++}`}};cx=new WeakMap;Ow=class Ow{constructor(){x(this,zu);x(this,Uu,Mw());x(this,ep,0);x(this,Ri,null)}static get _isSVGFittingCanvas(){let t='data:image/svg+xml;charset=UTF-8,',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 Mt(this,"_isSVGFittingCanvas",s)}async getFromFile(t){let{lastModified:e,name:i,size:n,type:s}=t;return b(this,zu,qg).call(this,`${e}_${i}_${n}_${s}`,t)}async getFromUrl(t){return b(this,zu,qg).call(this,t,t)}async getFromBlob(t,e){let i=await e;return b(this,zu,qg).call(this,t,i)}async getFromId(t){a(this,Ri)||p(this,Ri,new Map);let e=a(this,Ri).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,Ri)||p(this,Ri,new Map);let i=a(this,Ri).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,Uu)}_${Ye(this,ep)._++}`,refCounter:1,isSvg:!1},a(this,Ri).set(t,i),a(this,Ri).set(i.id,i),i}getSvgUrl(t){let e=a(this,Ri).get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){a(this,Ri)||p(this,Ri,new Map);let e=a(this,Ri).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,Uu)}_`)}};Uu=new WeakMap,ep=new WeakMap,Ri=new WeakMap,zu=new WeakSet,qg=async function(t,e){a(this,Ri)||p(this,Ri,new Map);let i=a(this,Ri).get(t);if(i===null)return null;if(i?.bitmap)return i.refCounter+=1,i;try{i||(i={bitmap:null,id:`image_${a(this,Uu)}_${Ye(this,ep)._++}`,refCounter:0,isSvg:!1});let n;if(typeof e=="string"?(i.url=e,n=await Rx(e,"blob")):e instanceof File?n=i.file=e:e instanceof Blob&&(n=e),n.type==="image/svg+xml"){let s=Ow._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){Pt(n),i=null}return a(this,Ri).set(t,i),i&&a(this,Ri).set(i.id,i),i};lb=Ow,cb=class{constructor(t=128){x(this,Ve,[]);x(this,Va,!1);x(this,ip);x(this,Se,-1);p(this,ip,t)}add({cmd:t,undo:e,post:i,mustExec:n,type:s=NaN,overwriteIfSameType:o=!1,keepUndo:l=!1}){if(n&&t(),a(this,Va))return;let c={cmd:t,undo:e,post:i,type:s};if(a(this,Se)===-1){a(this,Ve).length>0&&(a(this,Ve).length=0),p(this,Se,0),a(this,Ve).push(c);return}if(o&&a(this,Ve)[a(this,Se)].type===s){l&&(c.undo=a(this,Ve)[a(this,Se)].undo),a(this,Ve)[a(this,Se)]=c;return}let u=a(this,Se)+1;u===a(this,ip)?a(this,Ve).splice(0,1):(p(this,Se,u),u=0;e--)if(a(this,Ve)[e].type!==t){a(this,Ve).splice(e+1,a(this,Se)-e),p(this,Se,e);return}a(this,Ve).length=0,p(this,Se,-1)}}destroy(){p(this,Ve,null)}};Ve=new WeakMap,Va=new WeakMap,ip=new WeakMap,Se=new WeakMap;Fc=class{constructor(t){x(this,ux);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=Be.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,ux,LC).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||Ie(e))}};ux=new WeakSet,LC=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};hx=class hx{get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return eM(t),Mt(this,"_colors",t)}convert(t){let e=wd(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 hx._colorsMapping.get(i);return e}getHexCode(t){let e=this._colors.get(t);return e?ht.makeHexColor(...e):t}};z(hx,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));ub=hx,Fu=class Fu{constructor(t,e,i,n,s,o,l,c,u,h,d,f,m,y,g,A){x(this,mt);x(this,ju,new AbortController);x(this,wn,null);x(this,Hu,null);x(this,Pe,new Map);x(this,De,new Map);x(this,Gu,null);x(this,$u,null);x(this,qi,null);x(this,Vu,null);x(this,er,new cb);x(this,ui,null);x(this,qa,null);x(this,Wa,null);x(this,Xa,0);x(this,Ya,new Set);x(this,ts,null);x(this,ir,null);x(this,gl,new Set);z(this,"_editorUndoBar",null);x(this,np,!1);x(this,rp,!1);x(this,qu,!1);x(this,sp,null);x(this,es,null);x(this,Ka,null);x(this,Wu,null);x(this,Za,!1);x(this,is,null);x(this,dx,new ob);x(this,Vs,!1);x(this,Xu,!1);x(this,ap,!1);x(this,Qa,null);x(this,xl,null);x(this,Yu,null);x(this,Ja,null);x(this,op,null);x(this,Qe,_t.NONE);x(this,ae,new Set);x(this,qs,null);x(this,to,null);x(this,eo,null);x(this,lp,null);x(this,Ku,null);x(this,cp,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1});x(this,io,[0,0]);x(this,ns,null);x(this,Ws,null);x(this,up,null);x(this,hp,null);x(this,nr,null);let w=this._signal=a(this,ju).signal;p(this,Ws,t),p(this,up,e),p(this,hp,i),p(this,$u,n),p(this,ui,s),p(this,to,o),p(this,Ku,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,Xu,!0)},{capture:!0,signal:w}),window.addEventListener("pointerup",()=>{p(this,Xu,!1)},{capture:!0,signal:w}),window.addEventListener("beforeunload",b(this,mt,BC).bind(this),{capture:!0,signal:w}),b(this,mt,jC).call(this),b(this,mt,WC).call(this),b(this,mt,db).call(this),p(this,qi,c.annotationStorage),p(this,sp,c.filterFactory),p(this,eo,u),p(this,Wu,h||null),p(this,np,d),p(this,rp,f),p(this,qu,m),p(this,op,y||null),this.viewParameters={realScale:Da.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=g||null,this._supportsPinchToZoom=A!==!1,s?.setSidebarUiManager(this)}static get _keyboardManager(){let t=Fu.prototype,e=o=>a(o,Ws).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 Mt(this,"_keyboardManager",new Fc([[["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,Ws).contains(l)&&!o.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(o,{target:l})=>!(l instanceof HTMLButtonElement)&&a(o,Ws).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,nr)?.resolve(),p(this,nr,null),a(this,ju)?.abort(),p(this,ju,null),this._signal=null;for(let t of a(this,De).values())t.destroy();a(this,De).clear(),a(this,Pe).clear(),a(this,gl).clear(),a(this,Ja)?.clear(),p(this,wn,null),a(this,ae).clear(),a(this,er).destroy(),a(this,$u)?.destroy(),a(this,ui)?.destroy(),a(this,to)?.destroy(),a(this,is)?.hide(),p(this,is,null),a(this,Yu)?.destroy(),p(this,Yu,null),p(this,Hu,null),a(this,es)&&(clearTimeout(a(this,es)),p(this,es,null)),a(this,ns)&&(clearTimeout(a(this,ns)),p(this,ns,null)),this._editorUndoBar?.destroy(),p(this,Ku,null)}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return a(this,op)}get useNewAltTextFlow(){return a(this,rp)}get useNewAltTextWhenAddingImage(){return a(this,qu)}get hcmFilter(){return Mt(this,"hcmFilter",a(this,eo)?a(this,sp).addHCMFilter(a(this,eo).foreground,a(this,eo).background):"none")}get direction(){return Mt(this,"direction",getComputedStyle(a(this,Ws)).direction)}get _highlightColors(){return Mt(this,"_highlightColors",a(this,Wu)?new Map(a(this,Wu).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 Mt(this,"highlightColors",null);let e=new Map,i=!!a(this,eo);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 Mt(this,"highlightColors",e)}get highlightColorNames(){return Mt(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,Wa,t)}setMainHighlightColorPicker(t){p(this,Yu,t)}editAltText(t,e=!1){a(this,$u)?.editAltText(this,t,e)}hasCommentManager(){return!!a(this,ui)}editComment(t,e,i,n){a(this,ui)?.showDialog(this,t,e,i,n)}selectComment(t,e){a(this,De).get(t)?.getEditorByUID(e)?.toggleComment(!0,!0)}updateComment(t){a(this,ui)?.updateComment(t.getData())}updatePopupColor(t){a(this,ui)?.updatePopupColor(t)}removeComment(t){a(this,ui)?.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,ui)?.toggleCommentPopup(t,e,i)}makeCommentColor(t,e){return t&&a(this,ui)?.makeCommentColor(t,e)||null}getCommentDialogElement(){return a(this,ui)?.dialogElement||null}async waitForEditorsRendered(t){if(a(this,De).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,to)?.getSignature({uiManager:this,editor:t})}get signatureManager(){return a(this,to)}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,qu,e)}onPageChanging({pageNumber:t}){p(this,Xa,t-1)}deletePage(t){for(let e of this.getEditors(t))e.remove();a(this,De).delete(t),a(this,Xa)===t&&p(this,Xa,0)}focusMainContainer(){a(this,Ws).focus()}findParent(t,e){for(let i of a(this,De).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,up).classList.toggle("noUserSelect",t)}addShouldRescale(t){a(this,gl).add(t)}removeShouldRescale(t){a(this,gl).delete(t)}onScaleChanging({scale:t}){this.commitOrRemove(),this.viewParameters.realScale=t*Da.PDF_TO_CSS_UNITS;for(let e of a(this,gl))e.onScaleChanging();a(this,Wa)?.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,mt,Wg).call(this,i).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;i.empty();let f=b(this,mt,hb).call(this,h),m=a(this,Qe)===_t.NONE,y=()=>{let g=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&&g?.editComment()};if(m){this.switchToMode(_t.HIGHLIGHT,y);return}y()}commentSelection(t=""){this.highlightSelection(t,!0)}getAndRemoveDataFromAnnotationStorage(t){if(!a(this,qi))return null;let e=`${Of}${t}`,i=a(this,qi).getRawValue(e);return i&&a(this,qi).remove(e),i}addToAnnotationStorage(t){!t.isEmpty()&&a(this,qi)&&!a(this,qi).has(t.id)&&a(this,qi).setValue(t.id,t)}a11yAlert(t,e=null){let i=a(this,hp);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,Za)&&(p(this,Za,!1),b(this,mt,lf).call(this,"main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of a(this,ae))if(e.div.contains(t)){p(this,xl,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!a(this,xl))return;let[t,e]=a(this,xl);p(this,xl,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){b(this,mt,db).call(this),this.setEditingState(!0)}removeEditListeners(){b(this,mt,$C).call(this),this.setEditingState(!1)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let i of a(this,ir))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,ir))if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),a(this,wn)?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let i of a(this,ae)){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,ir))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){Pt(`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,mt,fb).call(this,c);b(this,mt,pb).call(this,s)},l=()=>{for(let c of s)c.remove()};this.addCommands({cmd:o,undo:l,mustExec:!0})}catch(s){Pt(`paste: "${s.message}".`)}}keydown(t){!this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!0),a(this,Qe)!==_t.NONE&&!this.isEditorHandlingKeyboard&&Fu._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&t.key==="Shift"&&(this.isShiftKeyDown=!1,a(this,Za)&&(p(this,Za,!1),b(this,mt,lf).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,Gu).get(t);i&&(i.pageIndex=e,a(this,De).set(e,i),a(this,Vs)?i.enable():i.disable())}startUpdatePages(){p(this,Gu,new Map(a(this,De))),a(this,De).clear()}endUpdatePages(){p(this,Gu,null)}clonePage(t,e){for(let i of this.getEditors(t)){let n=i.serialize(i.mode!==_t.HIGHLIGHT);n&&(n.pageIndex=e,n.id=this.getId(),n.isClone=!0,delete n.popupRef,a(this,qi).setValue(n.id,n))}}findClonesForPage(t){let e=[],{pageIndex:i}=t;for(let[n,s]of a(this,qi))s.pageIndex===i&&s.isClone&&(a(this,qi).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,mt,HC).call(this),b(this,mt,VC).call(this),b(this,mt,$i).call(this,{isEditing:a(this,Qe)!==_t.NONE,isEmpty:b(this,mt,cf).call(this),hasSomethingToUndo:a(this,er).hasSomethingToUndo(),hasSomethingToRedo:a(this,er).hasSomethingToRedo(),hasSelectedEditor:!1})):(b(this,mt,GC).call(this),b(this,mt,qC).call(this),b(this,mt,$i).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!a(this,ir)){p(this,ir,t);for(let e of a(this,ir))b(this,mt,zs).call(this,e.defaultPropertiesToUpdate)}}getId(){return a(this,dx).id}get currentLayer(){return a(this,De).get(a(this,Xa))}getLayer(t){return a(this,De).get(t)}get currentPageIndex(){return a(this,Xa)}addLayer(t){a(this,De).set(t.pageIndex,t),a(this,Vs)?t.enable():t.disable()}removeLayer(t){a(this,De).delete(t.pageIndex)}async updateMode(t,e=null,i=!1,n=!1,s=!1,o=!1){if(a(this,Qe)!==t&&!(a(this,nr)&&(await a(this,nr).promise,!a(this,nr)))){if(p(this,nr,Promise.withResolvers()),a(this,Wa)?.commitOrRemove(),a(this,Qe)===_t.POPUP&&a(this,ui)?.hideSidebar(),a(this,ui)?.destroyPopup(),p(this,Qe,t),t===_t.NONE){this.setEditingState(!1),b(this,mt,YC).call(this);for(let l of a(this,Pe).values())l.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),a(this,nr).resolve();return}for(let l of a(this,Pe).values())l.addStandaloneCommentButton();t===_t.SIGNATURE&&await a(this,to)?.loadSignatures(),i&&Oi.clearPointerType(),this.setEditingState(!0),await b(this,mt,XC).call(this),this.unselectAll();for(let l of a(this,De).values())l.updateMode(t);if(t===_t.POPUP){a(this,Hu)||p(this,Hu,await a(this,Ku).getAnnotationsByType(new Set(a(this,ir).map(u=>u._editorType))));let l=new Set,c=[];for(let u of a(this,Pe).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,Hu)){let{id:h,popupRef:d,contentsObj:f}=u;d&&f?.str&&!l.has(h)&&!a(this,Ya).has(h)&&c.push(u)}a(this,ui)?.showSidebar(c)}if(!e){n&&this.addNewEditorFromKeyboard(),a(this,nr).resolve();return}for(let l of a(this,Pe).values())l.uid===e?(this.setSelected(l),o?l.editComment():s?l.enterInEditMode():l.focus()):l.unselect();a(this,nr).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==a(this,Qe)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(a(this,ir)){switch(t){case Gt.CREATE:this.currentLayer.addNewEditor(e);return;case Gt.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(a(this,lp)||p(this,lp,new Map)).set(t,e),this.showAllEditors("highlight",e);break}if(this.hasSelection)for(let i of a(this,ae))i.updateParams(t,e);else for(let i of a(this,ir))i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){for(let s of a(this,Pe).values())s.editorType===t&&s.show(e);(a(this,lp)?.get(Gt.HIGHLIGHT_SHOW_ALL)??!0)!==e&&b(this,mt,zs).call(this,[[Gt.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(a(this,ap)!==t){p(this,ap,t);for(let e of a(this,De).values())t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}}*getEditors(t){for(let e of a(this,Pe).values())e.pageIndex===t&&(yield e)}getEditor(t){return a(this,Pe).get(t)}addEditor(t){a(this,Pe).set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(a(this,es)&&clearTimeout(a(this,es)),p(this,es,setTimeout(()=>{this.focusMainContainer(),p(this,es,null)},0))),a(this,Pe).delete(t.id),t.annotationElementId&&a(this,Ja)?.delete(t.annotationElementId),this.unselect(t),(!t.annotationElementId||!a(this,Ya).has(t.annotationElementId))&&a(this,qi)?.remove(t.id)}addDeletedAnnotationElement(t){a(this,Ya).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return a(this,Ya).has(t)}removeDeletedAnnotationElement(t){a(this,Ya).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){a(this,wn)!==t&&(p(this,wn,t),t&&b(this,mt,zs).call(this,t.propertiesToUpdate))}updateUI(t){a(this,mt,KC)===t&&b(this,mt,zs).call(this,t.propertiesToUpdate)}updateUIForDefaultProperties(t){b(this,mt,zs).call(this,t.defaultPropertiesToUpdate)}toggleSelected(t){if(a(this,ae).has(t)){a(this,ae).delete(t),t.unselect(),b(this,mt,$i).call(this,{hasSelectedEditor:this.hasSelection});return}a(this,ae).add(t),t.select(),b(this,mt,zs).call(this,t.propertiesToUpdate),b(this,mt,$i).call(this,{hasSelectedEditor:!0})}setSelected(t){this.updateToolbar({mode:t.mode,editId:t.uid}),a(this,Wa)?.commitOrRemove();for(let e of a(this,ae))e!==t&&e.unselect();a(this,ui)?.destroyPopup(),a(this,ae).clear(),a(this,ae).add(t),t.select(),b(this,mt,zs).call(this,t.propertiesToUpdate),b(this,mt,$i).call(this,{hasSelectedEditor:!0})}isSelected(t){return a(this,ae).has(t)}get firstSelectedEditor(){return a(this,ae).values().next().value}unselect(t){t.unselect(),a(this,ae).delete(t),b(this,mt,$i).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return a(this,ae).size!==0}get isEnterHandled(){return a(this,ae).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){a(this,er).undo(),b(this,mt,$i).call(this,{hasSomethingToUndo:a(this,er).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:b(this,mt,cf).call(this)}),this._editorUndoBar?.hide()}redo(){a(this,er).redo(),b(this,mt,$i).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:a(this,er).hasSomethingToRedo(),isEmpty:b(this,mt,cf).call(this)})}addCommands(t){a(this,er).add(t),b(this,mt,$i).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:b(this,mt,cf).call(this)})}cleanUndoStack(t){a(this,er).cleanType(t)}delete(){this.commitOrRemove();let t=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let e=t?[t]:[...a(this,ae)],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,mt,fb).call(this,s)};this.addCommands({cmd:i,undo:n,mustExec:!0})}commitOrRemove(){a(this,wn)?.commitOrRemove()}hasSomethingToControl(){return a(this,wn)||this.hasSelection}selectAll(){for(let t of a(this,ae))t.commit();b(this,mt,pb).call(this,a(this,Pe).values())}unselectAll(){if(!(a(this,wn)&&(a(this,wn).commitOrRemove(),a(this,Qe)!==_t.NONE))&&!a(this,Wa)?.commitOrRemove()&&(a(this,ui)?.destroyPopup(),!!this.hasSelection)){for(let t of a(this,ae))t.unselect();a(this,ae).clear(),b(this,mt,$i).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;a(this,io)[0]+=t,a(this,io)[1]+=e;let[n,s]=a(this,io),o=[...a(this,ae)],l=1e3;a(this,ns)&&clearTimeout(a(this,ns)),p(this,ns,setTimeout(()=>{p(this,ns,null),a(this,io)[0]=a(this,io)[1]=0,this.addCommands({cmd:()=>{for(let c of o)a(this,Pe).has(c.id)&&(c.translateInPage(n,s),c.translationDone())},undo:()=>{for(let c of o)a(this,Pe).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,ts,new Map);for(let t of a(this,ae))a(this,ts).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!a(this,ts))return!1;this.disableUserSelect(!1);let t=a(this,ts);p(this,ts,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,Pe).has(n.id)){let c=a(this,De).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,ts))for(let i of a(this,ts).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,ae).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return a(this,wn)===t}getActive(){return a(this,wn)}getMode(){return a(this,Qe)}isEditingMode(){return a(this,Qe)!==_t.NONE}get imageManager(){return Mt(this,"imageManager",new lb)}getSelectionBoxes(t){if(!t)return null;let e=document.getSelection();for(let u=0,h=e.rangeCount;u({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{u.type==="pointerup"&&u.button!==0||(o.abort(),s?.toggleDrawing(!0),u.type==="pointerup"&&b(this,mt,lf).call(this,"main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}else s?.toggleDrawing(!0),b(this,mt,lf).call(this,"main_toolbar")}},lf=function(t=""){a(this,Qe)===_t.HIGHLIGHT?this.highlightSelection(t):a(this,np)&&b(this,mt,UC).call(this)},jC=function(){document.addEventListener("selectionchange",b(this,mt,zC).bind(this),{signal:this._signal})},HC=function(){if(a(this,Ka))return;p(this,Ka,new AbortController);let t=this.combinedSignal(a(this,Ka));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},GC=function(){a(this,Ka)?.abort(),p(this,Ka,null)},db=function(){if(a(this,Qa))return;p(this,Qa,new AbortController);let t=this.combinedSignal(a(this,Qa));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},$C=function(){a(this,Qa)?.abort(),p(this,Qa,null)},VC=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})},qC=function(){a(this,qa)?.abort(),p(this,qa,null)},WC=function(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},$i=function(t){Object.entries(t).some(([i,n])=>a(this,cp)[i]!==n)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(a(this,cp),t)}),a(this,Qe)===_t.HIGHLIGHT&&t.hasSelectedEditor===!1&&b(this,mt,zs).call(this,[[Gt.HIGHLIGHT_FREE,!0]]))},zs=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},XC=async function(){if(!a(this,Vs)){p(this,Vs,!0);let t=[];for(let e of a(this,De).values())t.push(e.enable());await Promise.all(t);for(let e of a(this,Pe).values())e.enable()}},YC=function(){if(this.unselectAll(),a(this,Vs)){p(this,Vs,!1);for(let t of a(this,De).values())t.disable();for(let t of a(this,Pe).values())t.disable()}},fb=function(t){let e=a(this,De).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},KC=function(){let t=null;for(t of a(this,ae));return t},cf=function(){if(a(this,Pe).size===0)return!0;if(a(this,Pe).size===1)for(let t of a(this,Pe).values())return t.isEmpty();return!1},pb=function(t){for(let e of a(this,ae))e.unselect();a(this,ae).clear();for(let e of t)e.isEmpty()||(a(this,ae).add(e),e.select());b(this,mt,$i).call(this,{hasSelectedEditor:this.hasSelection})},z(Fu,"TRANSLATE_SMALL",1),z(Fu,"TRANSLATE_BIG",10);Lo=Fu,Vi=class Vi{constructor(t){x(this,Or);x(this,hi,null);x(this,rs,!1);x(this,Ar,null);x(this,Zu,null);x(this,ss,null);x(this,An,null);x(this,Qu,!1);x(this,as,null);x(this,cn,null);x(this,Xs,null);x(this,yl,null);x(this,os,!1);p(this,cn,t),p(this,os,t._uiManager.useNewAltTextFlow),a(Vi,no)||p(Vi,no,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){Vi._l10n??(Vi._l10n=t)}async render(){let t=p(this,Ar,document.createElement("button"));t.className="altText",t.tabIndex="0";let e=p(this,Zu,document.createElement("span"));t.append(e),a(this,os)?(t.classList.add("new"),t.setAttribute("data-l10n-id",a(Vi,no).missing),e.setAttribute("data-l10n-id",a(Vi,no)["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,cn)._uiManager._signal;t.addEventListener("contextmenu",Hn,{signal:i}),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:i});let n=s=>{s.preventDefault(),a(this,cn)._uiManager.editAltText(a(this,cn)),a(this,os)&&a(this,cn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:a(this,Or,uf)}})};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(p(this,Qu,!0),n(s))},{signal:i}),await b(this,Or,Xg).call(this),t}finish(){a(this,Ar)&&(a(this,Ar).focus({focusVisible:a(this,Qu)}),p(this,Qu,!1))}isEmpty(){return a(this,os)?a(this,hi)===null:!a(this,hi)&&!a(this,rs)}hasData(){return a(this,os)?a(this,hi)!==null||!!a(this,Xs):this.isEmpty()}get guessedText(){return a(this,Xs)}async setGuessedText(t){a(this,hi)===null&&(p(this,Xs,t),p(this,yl,await Vi._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),b(this,Or,Xg).call(this))}toggleAltTextBadge(t=!1){if(!a(this,os)||a(this,hi)){a(this,as)?.remove(),p(this,as,null);return}if(!a(this,as)){let e=p(this,as,document.createElement("div"));e.className="noAltTextBadge",a(this,cn).div.append(e)}a(this,as).classList.toggle("hidden",!t)}serialize(t){let e=a(this,hi);return!t&&a(this,Xs)===e&&(e=a(this,yl)),{altText:e,decorative:a(this,rs),guessedText:a(this,Xs),textWithDisclaimer:a(this,yl)}}get data(){return{altText:a(this,hi),decorative:a(this,rs)}}set data({altText:t,decorative:e,guessedText:i,textWithDisclaimer:n,cancel:s=!1}){i&&(p(this,Xs,i),p(this,yl,n)),!(a(this,hi)===t&&a(this,rs)===e)&&(s||(p(this,hi,t),p(this,rs,e)),b(this,Or,Xg).call(this))}toggle(t=!1){a(this,Ar)&&(!t&&a(this,An)&&(clearTimeout(a(this,An)),p(this,An,null)),a(this,Ar).disabled=!t)}shown(){a(this,cn)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:a(this,Or,uf)}})}destroy(){a(this,Ar)?.remove(),p(this,Ar,null),p(this,Zu,null),p(this,ss,null),a(this,as)?.remove(),p(this,as,null)}};hi=new WeakMap,rs=new WeakMap,Ar=new WeakMap,Zu=new WeakMap,ss=new WeakMap,An=new WeakMap,Qu=new WeakMap,as=new WeakMap,cn=new WeakMap,Xs=new WeakMap,yl=new WeakMap,os=new WeakMap,no=new WeakMap,Or=new WeakSet,uf=function(){return a(this,hi)&&"added"||a(this,hi)===null&&this.guessedText&&"review"||"missing"},Xg=async function(){let t=a(this,Ar);if(!t)return;if(a(this,os)){if(t.classList.toggle("done",!!a(this,hi)),t.setAttribute("data-l10n-id",a(Vi,no)[a(this,Or,uf)]),a(this,Zu)?.setAttribute("data-l10n-id",a(Vi,no)[`${a(this,Or,uf)}-label`]),!a(this,hi)){a(this,ss)?.remove();return}}else{if(!a(this,hi)&&!a(this,rs)){t.classList.remove("done"),a(this,ss)?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=a(this,ss);if(!e){p(this,ss,e=document.createElement("span")),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${a(this,cn).id}`;let n=100,s=a(this,cn)._uiManager._signal;s.addEventListener("abort",()=>{clearTimeout(a(this,An)),p(this,An,null)},{once:!0}),t.addEventListener("mouseenter",()=>{p(this,An,setTimeout(()=>{p(this,An,null),a(this,ss).classList.add("show"),a(this,cn)._reportTelemetry({action:"alt_text_tooltip"})},n))},{signal:s}),t.addEventListener("mouseleave",()=>{a(this,An)&&(clearTimeout(a(this,An)),p(this,An,null)),a(this,ss)?.classList.remove("show")},{signal:s})}a(this,rs)?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=a(this,hi)),e.parentNode||t.append(e),a(this,cn).getElementForAltText()?.setAttribute("aria-describedby",e.id)},x(Vi,no,null),z(Vi,"_l10n",null);O0=Vi,_u=class{constructor(t){x(this,fp);x(this,vi,null);x(this,rr,null);x(this,bl,!1);x(this,ye,null);x(this,dp,null);x(this,ro,null);x(this,sr,null);x(this,so,null);x(this,ao,!1);x(this,wl,null);p(this,ye,t)}renderForToolbar(){let t=p(this,rr,document.createElement("button"));return t.className="comment",b(this,fp,mb).call(this,t,!1)}renderForStandalone(){let t=p(this,vi,document.createElement("button"));t.className="annotationCommentButton";let e=a(this,ye).commentButtonPosition;if(e){let{style:i}=t;i.insetInlineEnd=`calc(${100*(a(this,ye)._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,ye).commentButtonColor;n&&(i.backgroundColor=n)}return b(this,fp,mb).call(this,t,!0)}focusButton(){setTimeout(()=>{(a(this,vi)??a(this,rr))?.focus()},0)}onUpdatedColor(){if(!a(this,vi))return;let t=a(this,ye).commentButtonColor;t&&(a(this,vi).style.backgroundColor=t),a(this,ye)._uiManager.updatePopupColor(a(this,ye))}get commentButtonWidth(){return(a(this,vi)?.getBoundingClientRect().width??0)/a(this,ye).parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(a(this,wl))return a(this,wl);if(!a(this,vi))return null;let{x:t,y:e,height:i}=a(this,vi).getBoundingClientRect(),{x:n,y:s,width:o,height:l}=a(this,ye).parent.boundingClientRect;return[(t-n)/o,(e+i-s)/l]}set commentPopupPositionInLayer(t){p(this,wl,t)}hasDefaultPopupPosition(){return a(this,wl)===null}removeStandaloneCommentButton(){a(this,vi)?.remove(),p(this,vi,null)}removeToolbarCommentButton(){a(this,rr)?.remove(),p(this,rr,null)}setCommentButtonStates({selected:t,hasPopup:e}){a(this,vi)&&(a(this,vi).classList.toggle("selected",t),a(this,vi).ariaExpanded=e)}edit(t){let e=this.commentPopupPositionInLayer,i,n;if(e)[i,n]=e;else{[i,n]=a(this,ye).commentButtonPosition;let{width:h,height:d,x:f,y:m}=a(this,ye);i=f+i*h,n=m+n*d}let s=a(this,ye).parent.boundingClientRect,{x:o,y:l,width:c,height:u}=s;a(this,ye)._uiManager.editComment(a(this,ye),o+i*c,l+n*u,{...t,parentDimensions:s})}finish(){a(this,rr)&&(a(this,rr).focus({focusVisible:a(this,bl)}),p(this,bl,!1))}isDeleted(){return a(this,ao)||a(this,sr)===""}isEmpty(){return a(this,sr)===null}hasBeenEdited(){return this.isDeleted()||a(this,sr)!==a(this,dp)}serialize(){return this.data}get data(){return{text:a(this,sr),richText:a(this,ro),date:a(this,so),deleted:this.isDeleted()}}set data(t){if(t!==a(this,sr)&&p(this,ro,null),t===null){p(this,sr,""),p(this,ao,!0);return}p(this,sr,t),p(this,so,new Date),p(this,ao,!1)}restoreData({text:t,richText:e,date:i}){p(this,sr,t),p(this,ro,e),p(this,so,i),p(this,ao,!1)}setInitialText(t,e=null){p(this,dp,t),this.data=t,p(this,so,null),p(this,ro,e)}shown(){}destroy(){a(this,rr)?.remove(),p(this,rr,null),a(this,vi)?.remove(),p(this,vi,null),p(this,sr,""),p(this,ro,null),p(this,so,null),p(this,ye,null),p(this,bl,!1),p(this,ao,!1)}};vi=new WeakMap,rr=new WeakMap,bl=new WeakMap,ye=new WeakMap,dp=new WeakMap,ro=new WeakMap,sr=new WeakMap,so=new WeakMap,ao=new WeakMap,wl=new WeakMap,fp=new WeakSet,mb=function(t,e){if(!a(this,ye)._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,ye)._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let i=a(this,ye)._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",Hn,{signal:i}),e&&(t.addEventListener("focusin",s=>{a(this,ye)._focusEventsAllowed=!1,Ie(s)},{capture:!0,signal:i}),t.addEventListener("focusout",s=>{a(this,ye)._focusEventsAllowed=!0,Ie(s)},{capture:!0,signal:i})),t.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:i});let n=s=>{s.preventDefault(),t===a(this,rr)?this.edit():a(this,ye).toggleComment(!0)};return t.addEventListener("click",n,{capture:!0,signal:i}),t.addEventListener("keydown",s=>{s.target===t&&s.key==="Enter"&&(p(this,bl,!0),n(s))},{signal:i}),t.addEventListener("pointerenter",()=>{a(this,ye).toggleComment(!1,!0)},{signal:i}),t.addEventListener("pointerleave",()=>{a(this,ye).toggleComment(!1,!1)},{signal:i}),t};Rw=class Rw{constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:n=null,onPinching:s=null,onPinchEnd:o=null,signal:l}){x(this,Bo);x(this,Ju);x(this,Al,!1);x(this,pp,null);x(this,mp);x(this,gp);x(this,xp);x(this,yp);x(this,Ys,null);x(this,vl);x(this,Ks,null);x(this,El);x(this,Zs,null);p(this,Ju,t),p(this,pp,i),p(this,mp,e),p(this,gp,n),p(this,xp,s),p(this,yp,o),p(this,El,new AbortController),p(this,vl,AbortSignal.any([l,a(this,El).signal])),t.addEventListener("touchstart",b(this,Bo,ZC).bind(this),{passive:!1,signal:a(this,vl)})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Es.pixelRatio}destroy(){a(this,El)?.abort(),p(this,El,null),a(this,Ys)?.abort(),p(this,Ys,null)}};Ju=new WeakMap,Al=new WeakMap,pp=new WeakMap,mp=new WeakMap,gp=new WeakMap,xp=new WeakMap,yp=new WeakMap,Ys=new WeakMap,vl=new WeakMap,Ks=new WeakMap,El=new WeakMap,Zs=new WeakMap,Bo=new WeakSet,ZC=function(t){var n,s,o;if((n=a(this,mp))!=null&&n.call(this))return;if(t.touches.length===1){if(a(this,Ys))return;let l=p(this,Ys,new AbortController),c=AbortSignal.any([a(this,vl),l.signal]),u=a(this,Ju),h={capture:!0,signal:c,passive:!1},d=f=>{f.pointerType==="touch"&&(a(this,Ys)?.abort(),p(this,Ys,null))};u.addEventListener("pointerdown",f=>{f.pointerType==="touch"&&(Ie(f),d(f))},h),u.addEventListener("pointerup",d,h),u.addEventListener("pointercancel",d,h);return}if(!a(this,Zs)){p(this,Zs,new AbortController);let l=AbortSignal.any([a(this,vl),a(this,Zs).signal]),c=a(this,Ju),u={signal:l,capture:!1,passive:!1};c.addEventListener("touchmove",b(this,Bo,QC).bind(this),u);let h=b(this,Bo,JC).bind(this);c.addEventListener("touchend",h,u),c.addEventListener("touchcancel",h,u),u.capture=!0,c.addEventListener("pointerdown",Ie,u),c.addEventListener("pointermove",Ie,u),c.addEventListener("pointercancel",Ie,u),c.addEventListener("pointerup",Ie,u),(s=a(this,gp))==null||s.call(this)}if(Ie(t),t.touches.length!==2||(o=a(this,pp))!=null&&o.call(this)){p(this,Ks,null);return}let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]),p(this,Ks,{touch0X:e.screenX,touch0Y:e.screenY,touch1X:i.screenX,touch1Y:i.screenY})},QC=function(t){var I;if(!a(this,Ks)||t.touches.length!==2)return;Ie(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,Ks),{touch0X:u,touch0Y:h,touch1X:d,touch1Y:f}=c,m=d-u,y=f-h,g=o-n,A=l-s,w=Math.hypot(g,A)||1,v=Math.hypot(m,y)||1;if(!a(this,Al)&&Math.abs(v-w)<=Rw.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(c.touch0X=n,c.touch0Y=s,c.touch1X=o,c.touch1Y=l,!a(this,Al)){p(this,Al,!0);return}let T=[(n+o)/2,(s+l)/2];(I=a(this,xp))==null||I.call(this,T,v,w)},JC=function(t){var e;t.touches.length>=2||(a(this,Zs)&&(a(this,Zs).abort(),p(this,Zs,null),(e=a(this,yp))==null||e.call(this)),a(this,Ks)&&(Ie(t),p(this,Ks,null),p(this,Al,!1)))};Uf=Rw,Ft=class Ft{constructor(t){x(this,Dt);x(this,Cl,null);x(this,vr,null);x(this,ve,null);x(this,oe,null);x(this,Qs,null);x(this,th,!1);x(this,oo,null);x(this,bp,"");x(this,Ei,null);x(this,Tl,null);x(this,Js,null);x(this,ar,null);x(this,lo,null);x(this,wp,"");x(this,Sl,!1);x(this,vn,null);x(this,Ap,!1);x(this,Dl,!1);x(this,ta,!1);x(this,ls,null);x(this,eh,0);x(this,ih,0);x(this,or,null);x(this,kl,null);z(this,"isSelected",!1);z(this,"_isCopy",!1);z(this,"_editToolbar",null);z(this,"_initialOptions",Object.create(null));z(this,"_initialData",null);z(this,"_isVisible",!0);z(this,"_uiManager",null);z(this,"_focusEventsAllowed",!0);x(this,vp,!1);x(this,fx,Ft._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=Ft.prototype._resizeWithKeyboard,e=Lo.TRANSLATE_SMALL,i=Lo.TRANSLATE_BIG;return Mt(this,"_resizerKeyboardManager",new Fc([[["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"],Ft.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 Mt(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new Eb({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(Ft._l10n??(Ft._l10n=t),Ft._l10nResizer||(Ft._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"})),Ft._borderLineWidth!==-1)return;let i=getComputedStyle(document.documentElement);Ft._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){ie("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return a(this,vp)}set _isDraggable(t){p(this,vp,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,fx)}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(b(this,Dt,hf).call(this),a(this,ar)?.remove(),p(this,ar,null)),this.parent=t}focusin(t){this._focusEventsAllowed&&(a(this,Sl)?p(this,Sl,!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,Dt,gb).call(this,this.parentDimensions,t,e)}translateInPage(t,e){a(this,vn)||p(this,vn,[this.x,this.y,this.width,this.height]),b(this,Dt,gb).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){a(this,vn)||p(this,vn,[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,vn)&&(a(this,vn)[0]!==this.x||a(this,vn)[1]!==this.y)}get _hasBeenResized(){return!!a(this,vn)&&(a(this,vn)[2]!==this.width||a(this,vn)[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=Ft,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=oi(s,0,i-l),o=oi(o,0,n-c);break;case 90:s=oi(s,0,i-c),o=oi(o,l,n);break;case 180:s=oi(s,l,i),o=oi(o,c,n);break;case 270:s=oi(s,c,i),o=oi(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=Ft,Ep,xb).call(i,t,e,this.parentRotation)}pageTranslationToScreen(t,e){var i;return b(i=Ft,Ep,xb).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,ve)?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||a(this,Dl))return this._editToolbar;this._editToolbar=new rb(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,ve)?.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,ve)||(O0.initialize(Ft._l10n),p(this,ve,new O0(this)),a(this,Cl)&&(a(this,ve).data=a(this,Cl),p(this,Cl,null))),a(this,ve)}get altTextData(){return a(this,ve)?.data}set altTextData(t){a(this,ve)&&(a(this,ve).data=t)}get guessedAltText(){return a(this,ve)?.guessedText}async setGuessedAltText(t){await a(this,ve)?.setGuessedText(t)}serializeAltText(t){return a(this,ve)?.serialize(t)}hasAltText(){return!!a(this,ve)&&!a(this,ve).isEmpty()}hasAltTextData(){return a(this,ve)?.hasData()??!1}focusCommentButton(){a(this,oe)?.focusButton()}addCommentButton(){return this.canAddComment?a(this,oe)||p(this,oe,new _u(this)):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(a(this,Qs)){this._uiManager.isEditingMode()&&a(this,Qs).classList.remove("hidden");return}this.hasComment&&(p(this,Qs,a(this,oe).renderForStandalone()),this.div.append(a(this,Qs)))}}removeStandaloneCommentButton(){a(this,oe).removeStandaloneCommentButton(),p(this,Qs,null)}hideStandaloneCommentButton(){a(this,Qs)?.classList.add("hidden")}get comment(){if(!a(this,oe))return null;let{data:{richText:t,text:e,date:i,deleted:n}}=a(this,oe);return{text:e,richText:t,date:i,deleted:n,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){a(this,oe)||p(this,oe,new _u(this)),typeof t=="object"&&t!==null?a(this,oe).restoreData(t):a(this,oe).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,oe)||p(this,oe,new _u(this)),a(this,oe).setInitialText(t,i),!this.annotationElementId))return;let n=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);n&&this.updateFromAnnotationLayer(n)}get hasEditedComment(){return a(this,oe)?.hasBeenEdited()}get hasDeletedComment(){return a(this,oe)?.isDeleted()}get hasComment(){return!!a(this,oe)&&!a(this,oe).isEmpty()&&!a(this,oe).isDeleted()}async editComment(t){a(this,oe)||p(this,oe,new _u(this)),a(this,oe).edit(t)}toggleComment(t,e=void 0){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){a(this,oe).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,oe).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,th)?-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,Dt,Ab).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),RC(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(a(this,kl)||p(this,kl,new Uf({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:b(this,Dt,iT).bind(this),onPinching:b(this,Dt,nT).bind(this),onPinchEnd:b(this,Dt,rT).bind(this),signal:this._uiManager._signal}))),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}pointerdown(t){let{isMac:e}=Be.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(p(this,Sl,!0),this._isDraggable){b(this,Dt,sT).call(this,t);return}b(this,Dt,wb).call(this,t)}_onStartDragging(){}_onStopDragging(){}moveInDOM(){a(this,ls)&&clearTimeout(a(this,ls)),p(this,ls,setTimeout(()=>{p(this,ls,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,y=this.height*o;switch(i){case 0:return[d+u+l,o-f-h-y+c,d+u+m+l,o-f-h+c];case 90:return[d+h+l,o-f+u+c,d+h+y+l,o-f+u+m+c];case 180:return[d-u-m+l,o-f+h+c,d-u+l,o-f+h+y+c];case 270:return[d-h-y+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&&Ft._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){a(this,oe)?.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,Dl,!0),!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),p(this,Dl,!1),!0):!1}isInEditMode(){return a(this,Dl)}shouldGetKeyboardEvents(){return a(this,ta)}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 e0&&t0}rebuild(){b(this,Dt,Ab).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,Cl,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,lo)?.abort(),p(this,lo,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),a(this,ls)&&(clearTimeout(a(this,ls)),p(this,ls,null)),b(this,Dt,hf).call(this),this.removeEditToolbar(),a(this,or)){for(let t of a(this,or).values())clearTimeout(t);p(this,or,null)}this.parent=null,a(this,kl)?.destroy(),p(this,kl,null),a(this,ar)?.remove(),p(this,ar,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(b(this,Dt,tT).call(this),a(this,Ei).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[Ft._round(i+(s-i)*t),Ft._round(n+(o-n)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return a(this,oe).commentPopupPositionInLayer}set commentPopupPosition(t){a(this,oe).commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return a(this,oe).hasDefaultPopupPosition()}get commentButtonWidth(){return a(this,oe).commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){a(this,oe)?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),p(this,Js,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let e=a(this,Ei).children;if(!a(this,vr)){p(this,vr,Array.from(e));let o=b(this,Dt,aT).bind(this),l=b(this,Dt,oT).bind(this),c=this._uiManager._signal;for(let u of a(this,vr)){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,Dt,lT).bind(this,h),{signal:c}),u.setAttribute("data-l10n-id",Ft._l10nResizer[h])}}let i=a(this,vr)[0],n=0;for(let o of e){if(o===i)break;n++}let s=(360-this.rotation+this.parentRotation)%360/90*(a(this,vr).length/4);if(s!==n){if(sn)for(let l=0;l{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),a(this,ve)?.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,Ei)?.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,ve)?.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,Ap)}set isEditing(t){p(this,Ap,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,or)||p(this,or,new Map);let{action:i}=t,n=a(this,or).get(i);n&&clearTimeout(n),n=setTimeout(()=>{this._reportTelemetry(t),a(this,or).delete(i),a(this,or).size===0&&p(this,or,null)},Ft._telemetryTimeout),a(this,or).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,th,!1)}disable(){this.div&&(this.div.tabIndex=-1),p(this,th,!0)}updateFakeAnnotationElement(t){if(!a(this,ar)&&!this.deleted){p(this,ar,t.addFakeAnnotation(this));return}if(this.deleted){a(this,ar).remove(),p(this,ar,null);return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&a(this,ar).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()}};Cl=new WeakMap,vr=new WeakMap,ve=new WeakMap,oe=new WeakMap,Qs=new WeakMap,th=new WeakMap,oo=new WeakMap,bp=new WeakMap,Ei=new WeakMap,Tl=new WeakMap,Js=new WeakMap,ar=new WeakMap,lo=new WeakMap,wp=new WeakMap,Sl=new WeakMap,vn=new WeakMap,Ap=new WeakMap,Dl=new WeakMap,ta=new WeakMap,ls=new WeakMap,eh=new WeakMap,ih=new WeakMap,or=new WeakMap,kl=new WeakMap,vp=new WeakMap,fx=new WeakMap,Dt=new WeakSet,gb=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()},Ep=new WeakSet,xb=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]}},Yg=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]}},tT=function(){if(a(this,Ei))return;p(this,Ei,document.createElement("div")),a(this,Ei).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,Ei).append(n),n.classList.add("resizer",i),n.setAttribute("data-resizer-name",i),n.addEventListener("pointerdown",b(this,Dt,eT).bind(this,i),{signal:e}),n.addEventListener("contextmenu",Hn,{signal:e}),n.tabIndex=-1}this.div.prepend(a(this,Ei))},eT=function(t,e){e.preventDefault();let{isMac:i}=Be.platform;if(e.button!==0||e.ctrlKey&&i)return;a(this,ve)?.toggle(!1);let n=this._isDraggable;this._isDraggable=!1,p(this,Tl,[e.screenX,e.screenY]);let s=new AbortController,o=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",b(this,Dt,bb).bind(this,t),{passive:!0,capture:!0,signal:o}),window.addEventListener("touchmove",Ie,{passive:!1,signal:o}),window.addEventListener("contextmenu",Hn,{signal:o}),p(this,Js,{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,ve)?.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=l,this.div.style.cursor=c,b(this,Dt,Kg).call(this)};window.addEventListener("pointerup",u,{signal:o}),window.addEventListener("blur",u,{signal:o})},yb=function(t,e,i,n){this.width=i,this.height=n,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()},Kg=function(){if(!a(this,Js))return;let{savedX:t,savedY:e,savedWidth:i,savedHeight:n}=a(this,Js);p(this,Js,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,Dt,yb).bind(this,s,o,l,c),undo:b(this,Dt,yb).bind(this,t,e,i,n),mustExec:!0})},bb=function(t,e){let[i,n]=this.parentDimensions,s=this.x,o=this.y,l=this.width,c=this.height,u=Ft.MIN_SIZE/i,h=Ft.MIN_SIZE/n,d=b(this,Dt,Yg).call(this,this.rotation),f=(O,C)=>[d[0]*O+d[2]*C,d[1]*O+d[3]*C],m=b(this,Dt,Yg).call(this,360-this.rotation),y=(O,C)=>[m[0]*O+m[2]*C,m[1]*O+m[3]*C],g,A,w=!1,v=!1;switch(t){case"topLeft":w=!0,g=(O,C)=>[0,0],A=(O,C)=>[O,C];break;case"topMiddle":g=(O,C)=>[O/2,0],A=(O,C)=>[O/2,C];break;case"topRight":w=!0,g=(O,C)=>[O,0],A=(O,C)=>[0,C];break;case"middleRight":v=!0,g=(O,C)=>[O,C/2],A=(O,C)=>[0,C/2];break;case"bottomRight":w=!0,g=(O,C)=>[O,C],A=(O,C)=>[0,0];break;case"bottomMiddle":g=(O,C)=>[O/2,C],A=(O,C)=>[O/2,0];break;case"bottomLeft":w=!0,g=(O,C)=>[0,C],A=(O,C)=>[O,0];break;case"middleLeft":v=!0,g=(O,C)=>[0,C/2],A=(O,C)=>[O,C/2];break}let T=g(l,c),I=A(l,c),_=f(...I),F=Ft._round(s+_[0]),L=Ft._round(o+_[1]),Y=1,q=1,G,j;if(e.fromKeyboard)({deltaX:G,deltaY:j}=e);else{let{screenX:O,screenY:C}=e,[D,E]=a(this,Tl);[G,j]=this.screenToPageTranslation(O-D,C-E),a(this,Tl)[0]=O,a(this,Tl)[1]=C}if([G,j]=y(G/i,j/n),w){let O=Math.hypot(l,c);Y=q=Math.max(Math.min(Math.hypot(I[0]-T[0]-G,I[1]-T[1]-j)/O,1/l,1/c),u/l,h/c)}else v?Y=oi(Math.abs(I[0]-T[0]-G),u,1)/l:q=oi(Math.abs(I[1]-T[1]-j),h,1)/c;let J=Ft._round(l*Y),et=Ft._round(c*q);_=f(...A(J,et));let N=F-_[0],X=L-_[1];a(this,vn)||p(this,vn,[this.x,this.y,this.width,this.height]),this.width=J,this.height=et,this.x=N,this.y=X,this.setDims(),this.fixAndSetPosition(),this._onResizing()},iT=function(){p(this,Js,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height}),a(this,ve)?.toggle(!1),this.parent.togglePointerEvents(!1)},nT=function(t,e,i){let s=.7*(i/e)+1-.7;if(s===1)return;let o=b(this,Dt,Yg).call(this,this.rotation),l=(F,L)=>[o[0]*F+o[2]*L,o[1]*F+o[3]*L],[c,u]=this.parentDimensions,h=this.x,d=this.y,f=this.width,m=this.height,y=Ft.MIN_SIZE/c,g=Ft.MIN_SIZE/u;s=Math.max(Math.min(s,1/f,1/m),y/f,g/m);let A=Ft._round(f*s),w=Ft._round(m*s);if(A===f&&w===m)return;a(this,vn)||p(this,vn,[h,d,f,m]);let v=l(f/2,m/2),T=Ft._round(h+v[0]),I=Ft._round(d+v[1]),_=l(A/2,w/2);this.x=T-_[0],this.y=I-_[1],this.width=A,this.height=w,this.setDims(),this.fixAndSetPosition(),this._onResizing()},rT=function(){a(this,ve)?.toggle(!0),this.parent.togglePointerEvents(!0),b(this,Dt,Kg).call(this)},wb=function(t){let{isMac:e}=Be.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},sT=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,oo,null),p(this,Sl,!1),this._uiManager.endDragSession()||b(this,Dt,wb).call(this,u),i&&this._onStopDragging()};e&&(p(this,eh,t.clientX),p(this,ih,t.clientY),p(this,oo,t.pointerId),p(this,bp,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,oo)){Ie(u);return}let[m,y]=this.screenToPageTranslation(h-a(this,eh),d-a(this,ih));p(this,eh,h),p(this,ih,d),this._uiManager.dragSelectedEditors(m,y)},o),window.addEventListener("touchmove",Ie,o),window.addEventListener("pointerdown",u=>{u.pointerType===a(this,bp)&&(a(this,kl)||u.isPrimary)&&l(u),Ie(u)},o));let c=u=>{if(!a(this,oo)||a(this,oo)===u.pointerId){l(u);return}Ie(u)};window.addEventListener("pointerup",c,{signal:s}),window.addEventListener("blur",c,{signal:s})},Ab=function(){if(a(this,lo)||!this.div)return;p(this,lo,new AbortController);let t=this._uiManager.combinedSignal(a(this,lo));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},aT=function(t){Ft._resizerKeyboardManager.exec(this,t)},oT=function(t){a(this,ta)&&t.relatedTarget?.parentNode!==a(this,Ei)&&b(this,Dt,hf).call(this)},lT=function(t){p(this,wp,a(this,ta)?t:"")},vb=function(t){if(a(this,vr))for(let e of a(this,vr))e.tabIndex=t},hf=function(){p(this,ta,!1),b(this,Dt,vb).call(this,-1),b(this,Dt,Kg).call(this)},x(Ft,Ep),z(Ft,"_l10n",null),z(Ft,"_l10nResizer",null),z(Ft,"_borderLineWidth",-1),z(Ft,"_colorManager",new ub),z(Ft,"_zIndex",1),z(Ft,"_telemetryTimeout",1e3);be=Ft,Eb=class extends be{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},nC=3285377520,Zn=4294901760,Qr=65535,R0=class{constructor(t){this.h1=t?t&4294967295:nC,this.h2=t?t&4294967295:nC}update(t){let e,i;if(typeof t=="string"){e=new Uint8Array(t.length*2),i=0;for(let g=0,A=t.length;g>>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&Qr,y=f&Qr;for(let g=0;g>>17,l=l*f&Zn|l*y&Qr,u^=l,u=u<<13|u>>>19,u=u*5+3864292196):(c=o[g],c=c*d&Zn|c*m&Qr,c=c<<15|c>>>17,c=c*f&Zn|c*y&Qr,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&Zn|l*m&Qr,l=l<<15|l>>>17,l=l*f&Zn|l*y&Qr,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&Zn|t*36045&Qr,e=e*4283543511&Zn|((e<<16|t>>>16)*2950163797&Zn)>>>16,t^=e>>>1,t=t*444984403&Zn|t*60499&Qr,e=e*3301882366&Zn|((e<<16|t>>>16)*3120437893&Zn)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}},zf=Object.freeze({map:null,hash:"",transfer:void 0}),jf=class{constructor(){x(this,px);x(this,Il,!1);x(this,Nl,null);x(this,ea,null);x(this,Ci,new Map);z(this,"onSetModified",null);z(this,"onResetModified",null);z(this,"onAnnotationEditor",null)}getValue(t,e){let i=a(this,Ci).get(t);return i===void 0?e:Object.assign(e,i)}getRawValue(t){return a(this,Ci).get(t)}remove(t){let e=a(this,Ci).get(t);e!==void 0&&(e instanceof be&&a(this,ea).delete(e.annotationElementId),a(this,Ci).delete(t),a(this,Ci).size===0&&this.resetModified(),!a(this,Ci).values().some(i=>i instanceof be)&&this.onAnnotationEditor?.(null))}setValue(t,e){let i=a(this,Ci).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,Ci).set(t,e);n&&b(this,px,cT).call(this),e instanceof be&&((a(this,ea)||p(this,ea,new Map)).set(e.annotationElementId,e),this.onAnnotationEditor?.(e.constructor._type))}has(t){return a(this,Ci).has(t)}get size(){return a(this,Ci).size}resetModified(){a(this,Il)&&(p(this,Il,!1),this.onResetModified?.())}get print(){return new L0(this)}get serializable(){if(a(this,Ci).size===0)return zf;let t=new Map,e=new R0,i=[],n=Object.create(null),s=!1;for(let[o,l]of a(this,Ci)){let c=l instanceof be?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}:zf}get editorStats(){let t=null,e=new Map,i=0,n=0;for(let s of a(this,Ci).values()){if(!(s instanceof be)){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,Ox);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,Nl,null)}updateEditor(t,e){let i=a(this,ea)?.get(t);return i?(i.updateFromAnnotationLayer(e),!0):!1}getEditor(t){return a(this,ea)?.get(t)||null}get modifiedIds(){if(a(this,Nl))return a(this,Nl);let t=[];if(a(this,ea))for(let e of a(this,ea).values())e.serialize()&&t.push(e.annotationElementId);return p(this,Nl,{ids:new Set(t),hash:t.join(",")})}[Symbol.iterator](){return a(this,Ci).entries()}};Il=new WeakMap,Nl=new WeakMap,ea=new WeakMap,Ci=new WeakMap,px=new WeakSet,cT=function(){a(this,Il)||(p(this,Il,!0),this.onSetModified?.())};L0=class extends jf{constructor(e){super();x(this,Cp,zf);let{serializable:i}=e;if(i===zf)return;let{map:n,hash:s,transfer:o}=i,l=structuredClone(n,o?{transfer:o}:null);p(this,Cp,{map:l,hash:s,transfer:[]})}get print(){ie("Should not call PrintAnnotationStorage.print")}get serializable(){return a(this,Cp)}get modifiedIds(){return Mt(this,"modifiedIds",{ids:new Set,hash:""})}};Cp=new WeakMap;wu="__forcedDependency",{floor:rC,ceil:sC}=Math;Cb=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0],Tb=class{constructor(t,e){x(this,nh);x(this,co);p(this,nh,t),p(this,co,e)}get length(){return a(this,nh).length}isEmpty(t){return a(this,nh)[t]===Cb}minX(t){return a(this,co)[t*4+0]/256}minY(t){return a(this,co)[t*4+1]/256}maxX(t){return(a(this,co)[t*4+2]+1)/256}maxY(t){return(a(this,co)[t*4+3]+1)/256}};nh=new WeakMap,co=new WeakMap;oC=(r,t)=>r?.getOrInsertComputed(t,()=>({dependencies:new Set,isRenderingOperation:!1})),Sb=class{constructor(t,e){x(this,Tp);x(this,ia,[[1,0,0,1,0,0]]);x(this,ee,[-1/0,-1/0,1/0,1/0]);x(this,ue,new Float64Array([1/0,1/0,-1/0,-1/0]));z(this,"_pendingBBoxIdx",-1);x(this,_l);x(this,Ml);x(this,Fl);x(this,Li);z(this,"_savesStack",[]);z(this,"_markedContentStack",[]);p(this,_l,t.width),p(this,Ml,t.height),b(this,Tp,Db).call(this,e)}growOperationsCount(t){t>=a(this,Li).length&&b(this,Tp,Db).call(this,t,a(this,Li))}get clipBox(){return a(this,ee)}save(t){return p(this,ee,{__proto__:a(this,ee)}),this._savesStack.push(t),this}restore(t,e){let i=Object.getPrototypeOf(a(this,ee));if(i===null)return this;p(this,ee,i);let n=this._savesStack.pop();return n!==void 0&&(e?.(n,t),a(this,Li)[t]=a(this,Li)[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,Li)[t]=a(this,Li)[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,Li)[t]=a(this,Li)[i]),this}pushBaseTransform(t){return a(this,ia).push(ht.multiplyByDOMMatrix(a(this,ia).at(-1),t.getTransform())),this}popBaseTransform(){return a(this,ia).length>1&&a(this,ia).pop(),this}resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,a(this,ue)[0]=1/0,a(this,ue)[1]=1/0,a(this,ue)[2]=-1/0,a(this,ue)[3]=-1/0),this}recordClipBox(t,e,i,n,s,o){let l=ht.multiplyByDOMMatrix(a(this,ia).at(-1),e.getTransform()),c=[1/0,1/0,-1/0,-1/0];ht.axialAlignedBoundingBox([i,s,n,o],l,c);let u=ht.intersect(a(this,ee),c);return u?(a(this,ee)[0]=u[0],a(this,ee)[1]=u[1],a(this,ee)[2]=u[2],a(this,ee)[3]=u[3]):(a(this,ee)[0]=a(this,ee)[1]=1/0,a(this,ee)[2]=a(this,ee)[3]=-1/0),this}recordBBox(t,e,i,n,s,o){let l=a(this,ee);if(l[0]===1/0)return this;let c=ht.multiplyByDOMMatrix(a(this,ia).at(-1),e.getTransform());if(l[0]===-1/0)return ht.axialAlignedBoundingBox([i,s,n,o],c,a(this,ue)),this;let u=[1/0,1/0,-1/0,-1/0];return ht.axialAlignedBoundingBox([i,s,n,o],c,u),a(this,ue)[0]=Math.min(a(this,ue)[0],Math.max(u[0],l[0])),a(this,ue)[1]=Math.min(a(this,ue)[1],Math.max(u[1],l[1])),a(this,ue)[2]=Math.max(a(this,ue)[2],Math.min(u[2],l[2])),a(this,ue)[3]=Math.max(a(this,ue)[3],Math.min(u[3],l[3])),this}recordFullPageBBox(t){return a(this,ue)[0]=Math.max(0,a(this,ee)[0]),a(this,ue)[1]=Math.max(0,a(this,ee)[1]),a(this,ue)[2]=Math.min(a(this,_l),a(this,ee)[2]),a(this,ue)[3]=Math.min(a(this,Ml),a(this,ee)[3]),this}recordOperation(t,e=!1,i){if(this._pendingBBoxIdx!==t)return this;let n=rC(a(this,ue)[0]*256/a(this,_l)),s=rC(a(this,ue)[1]*256/a(this,Ml)),o=sC(a(this,ue)[2]*256/a(this,_l)),l=sC(a(this,ue)[3]*256/a(this,Ml));if(aC(a(this,Fl),t,n,s,o,l),i)for(let c of i)for(let u of c)u!==t&&aC(a(this,Fl),u,n,s,o,l);return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,a(this,ee)[0]=Math.max(a(this,ee)[0],a(this,ue)[0]),a(this,ee)[1]=Math.max(a(this,ee)[1],a(this,ue)[1]),a(this,ee)[2]=Math.min(a(this,ee)[2],a(this,ue)[2]),a(this,ee)[3]=Math.min(a(this,ee)[3],a(this,ue)[3])),this}take(){return new Tb(a(this,Li),a(this,Fl))}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}};ia=new WeakMap,ee=new WeakMap,ue=new WeakMap,_l=new WeakMap,Ml=new WeakMap,Fl=new WeakMap,Li=new WeakMap,Tp=new WeakSet,Db=function(t,e){let i=new ArrayBuffer(t*4);p(this,Fl,new Uint8ClampedArray(i)),p(this,Li,new Uint32Array(i)),e&&e.length>0?(a(this,Li).set(e),a(this,Li).fill(Cb,e.length)):a(this,Li).fill(Cb)};kb=class{constructor(t,e=!1){x(this,un,{__proto__:null});x(this,hn,{__proto__:null,transform:[],moveText:[],sameLineText:[],[wu]:[]});x(this,Pl,new Map);x(this,Er,new Set);x(this,rh,new Map);x(this,uo);x(this,ho);x(this,he);p(this,he,t),e&&(p(this,uo,new Map),p(this,ho,(i,n)=>{oC(a(this,uo),n).dependencies.add(i)}))}get clipBox(){return a(this,he).clipBox}growOperationsCount(t){a(this,he).growOperationsCount(t)}save(t){return p(this,un,{__proto__:a(this,un)}),p(this,hn,{__proto__:a(this,hn),transform:{__proto__:a(this,hn).transform},moveText:{__proto__:a(this,hn).moveText},sameLineText:{__proto__:a(this,hn).sameLineText},[wu]:{__proto__:a(this,hn)[wu]}}),a(this,he).save(t),this}restore(t){a(this,he).restore(t,a(this,ho));let e=Object.getPrototypeOf(a(this,un));return e===null?this:(p(this,un,e),p(this,hn,Object.getPrototypeOf(a(this,hn))),this)}recordOpenMarker(t){return a(this,he).recordOpenMarker(t,a(this,ho)),this}getOpenMarker(){return a(this,he).getOpenMarker()}recordCloseMarker(t){return a(this,he).recordCloseMarker(t,a(this,ho)),this}beginMarkedContent(t){return a(this,he).beginMarkedContent(t),this}endMarkedContent(t){return a(this,he).endMarkedContent(t,a(this,ho)),this}pushBaseTransform(t){return a(this,he).pushBaseTransform(t),this}popBaseTransform(){return a(this,he).popBaseTransform(),this}recordSimpleData(t,e){return a(this,un)[t]=e,this}recordIncrementalData(t,e){return a(this,hn)[t].push(e),this}resetIncrementalData(t,e){return a(this,hn)[t].length=0,this}recordNamedData(t,e){return a(this,Pl).set(t,e),this}recordSimpleDataFromNamed(t,e,i){a(this,un)[t]=a(this,Pl).get(e)??i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(wu,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(let e of t)e in a(this,un)&&this.recordFutureForcedDependency(e,a(this,un)[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let t of a(this,Er))this.recordFutureForcedDependency(wu,t);return this}resetBBox(t){return a(this,he).resetBBox(t),this}recordClipBox(t,e,i,n,s,o){return a(this,he).recordClipBox(t,e,i,n,s,o),this}recordBBox(t,e,i,n,s,o){return a(this,he).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,rh).get(i),u!==!1&&(h=[0,0,0,0],ht.axialAlignedBoundingBox(c,i.fontMatrix,h),(n!==1||s!==0||o!==0)&&ht.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,rh).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,he).recordFullPageBBox(t),this}getSimpleIndex(t){return a(this,un)[t]}recordDependencies(t,e){let i=a(this,Er),n=a(this,un),s=a(this,hn);for(let o of e)o in a(this,un)?i.add(n[o]):o in s&&s[o].forEach(i.add,i);return this}recordNamedDependency(t,e){return a(this,Pl).has(e)&&a(this,Er).add(a(this,Pl).get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[wu]),a(this,uo)){let n=oC(a(this,uo),t),{dependencies:s}=n;a(this,Er).forEach(s.add,s),a(this,he)._savesStack.forEach(s.add,s),a(this,he)._markedContentStack.forEach(s.add,s),s.delete(t),n.isRenderingOperation=!0}let i=!e&&t===a(this,he)._pendingBBoxIdx;return a(this,he).recordOperation(t,e,[a(this,Er),a(this,he)._savesStack,a(this,he)._markedContentStack]),i&&a(this,Er).clear(),this}recordShowTextOperation(t,e=!1){let i=Array.from(a(this,Er));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,he)._pendingBBoxIdx;return a(this,he).bboxToClipBoxDropOperation(t),i&&a(this,Er).clear(),this}take(){return a(this,rh).clear(),a(this,he).take()}takeDebugMetadata(){return a(this,uo)}};un=new WeakMap,hn=new WeakMap,Pl=new WeakMap,Er=new WeakMap,rh=new WeakMap,uo=new WeakMap,ho=new WeakMap,he=new WeakMap;Lw=class Lw{constructor(t,e,i){x(this,de);x(this,Oe);x(this,Cr);x(this,sh,0);x(this,ah,0);if(t instanceof Lw&&a(t,Cr)===!!i)return t;p(this,de,t),p(this,Oe,e),p(this,Cr,!!i)}get clipBox(){return a(this,de).clipBox}growOperationsCount(){throw new Error("Unreachable")}save(t){return Ye(this,ah)._++,a(this,de).save(a(this,Oe)),this}restore(t){return a(this,ah)>0&&(a(this,de).restore(a(this,Oe)),Ye(this,ah)._--),this}recordOpenMarker(t){return Ye(this,sh)._++,this}getOpenMarker(){return a(this,sh)>0?a(this,Oe):a(this,de).getOpenMarker()}recordCloseMarker(t){return Ye(this,sh)._--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return a(this,de).pushBaseTransform(t),this}popBaseTransform(){return a(this,de).popBaseTransform(),this}recordSimpleData(t,e){return a(this,de).recordSimpleData(t,a(this,Oe)),this}recordIncrementalData(t,e){return a(this,de).recordIncrementalData(t,a(this,Oe)),this}resetIncrementalData(t,e){return a(this,de).resetIncrementalData(t,a(this,Oe)),this}recordNamedData(t,e){return this}recordSimpleDataFromNamed(t,e,i){return a(this,de).recordSimpleDataFromNamed(t,e,a(this,Oe)),this}recordFutureForcedDependency(t,e){return a(this,de).recordFutureForcedDependency(t,a(this,Oe)),this}inheritSimpleDataAsFutureForcedDependencies(t){return a(this,de).inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return a(this,de).inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return a(this,Cr)||a(this,de).resetBBox(a(this,Oe)),this}recordClipBox(t,e,i,n,s,o){return a(this,Cr)||a(this,de).recordClipBox(a(this,Oe),e,i,n,s,o),this}recordBBox(t,e,i,n,s,o){return a(this,Cr)||a(this,de).recordBBox(a(this,Oe),e,i,n,s,o),this}recordCharacterBBox(t,e,i,n,s,o,l){return a(this,Cr)||a(this,de).recordCharacterBBox(a(this,Oe),e,i,n,s,o,l),this}recordFullPageBBox(t){return a(this,Cr)||a(this,de).recordFullPageBBox(a(this,Oe)),this}getSimpleIndex(t){return a(this,de).getSimpleIndex(t)}recordDependencies(t,e){return a(this,de).recordDependencies(a(this,Oe),e),this}recordNamedDependency(t,e){return a(this,de).recordNamedDependency(a(this,Oe),e),this}recordOperation(t){return a(this,de).recordOperation(a(this,Oe),!0),this}recordShowTextOperation(t){return a(this,de).recordShowTextOperation(a(this,Oe),!0),this}bboxToClipBoxDropOperation(t){return a(this,Cr)||a(this,de).bboxToClipBoxDropOperation(a(this,Oe),!0),this}take(){throw new Error("Unreachable")}takeDebugMetadata(){throw new Error("Unreachable")}};de=new WeakMap,Oe=new WeakMap,Cr=new WeakMap,sh=new WeakMap,ah=new WeakMap;B0=Lw,Qn={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"]},Ff=class Ff{constructor(t){x(this,Ol);x(this,Rl);x(this,Ll,4);x(this,Bl,0);x(this,Ul,new(a(Ff,Sp))(a(this,Ll)*6));p(this,Ol,t.width),p(this,Rl,t.height)}record(t,e,i,n){if(a(this,Bl)===a(this,Ll)){p(this,Ll,a(this,Ll)*2);let l=new(a(Ff,Sp))(a(this,Ll)*6);l.set(a(this,Ul)),p(this,Ul,l)}let s=ht.domMatrixToTransform(t.getTransform()),o;if(n[0]!==1/0){let l=[1/0,1/0,-1/0,-1/0];ht.axialAlignedBoundingBox([0,-i,e,0],s,l);let c=ht.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]),y=Math.abs(Math.sin(m)),g=Math.abs(Math.cos(m));if(y<1e-6||g<1e-6||Math.abs(y-g)<1e-6)o=[u,h,u,f,d,h];else{let A=d-u,w=f-h,v=y*y,T=g*g,I=g*y,_=T-v,F=(w*T-A*I)/_,L=(w*I-A*v)/_;o=[u+L,h,u,h+F,d,f-F]}}}o||(o=[0,-i,0,0,e,-i],ht.applyTransform(o,s,0),ht.applyTransform(o,s,2),ht.applyTransform(o,s,4)),o[0]/=a(this,Ol),o[1]/=a(this,Rl),o[2]/=a(this,Ol),o[3]/=a(this,Rl),o[4]/=a(this,Ol),o[5]/=a(this,Rl),a(this,Ul).set(o,a(this,Bl)*6),Ye(this,Bl)._++}take(){return a(this,Ul).subarray(0,a(this,Bl)*6)}};Ol=new WeakMap,Rl=new WeakMap,Ll=new WeakMap,Bl=new WeakMap,Ul=new WeakMap,Sp=new WeakMap,x(Ff,Sp,Be.isFloat16ArraySupported?Float16Array:Float32Array);Ib=Ff,Nb=class{constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){x(this,oh,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,oh).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:i}){if(!(!t||a(this,oh).has(t.loadedName))){if(Ne(!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,oh).add(n),i?.(t)}catch{Pt(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(l)}return}ie("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 Pt(`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 Mt(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){return Mt(this,"isSyncFontLoadingSupported",Bn||Be.platform.isFirefox)}_queueLoadingCallback(t){function e(){for(Ne(!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 Mt(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function i(I,_){return I.charCodeAt(_)<<24|I.charCodeAt(_+1)<<16|I.charCodeAt(_+2)<<8|I.charCodeAt(_+3)&255}function n(I,_,F,L){let Y=I.substring(0,_),q=I.substring(_+F);return Y+L+q}let s,o,l=this._document.createElement("canvas");l.width=1,l.height=1;let c=l.getContext("2d"),u=0;function h(I,_){if(++u>30){Pt("Load test font never loaded."),_();return}if(c.font="30px "+I,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0){_();return}setTimeout(h.bind(null,I,_))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=n(f,976,d.length,d);let y=16,g=1482184792,A=i(f,y);for(s=0,o=d.length-3;s{T.remove(),e.complete()})}};oh=new WeakMap;_b=class{constructor(t,e=null,i,n){z(this,"compiledGlyphs",Object.create(null));x(this,fe);p(this,fe,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){Pt(`getPathGenerator - ignoring character: "${o}".`)}let s=NC(n?.path);return this.fontExtraProperties||t.delete(i),this.compiledGlyphs[e]=s}get black(){return a(this,fe).black}get bold(){return a(this,fe).bold}get disableFontFace(){return a(this,fe).disableFontFace}set disableFontFace(t){Mt(this,"disableFontFace",!!t)}get fontExtraProperties(){return a(this,fe).fontExtraProperties}get isInvalidPDFjsFont(){return a(this,fe).isInvalidPDFjsFont}get isType3Font(){return a(this,fe).isType3Font}get italic(){return a(this,fe).italic}get missingFile(){return a(this,fe).missingFile}get remeasure(){return a(this,fe).remeasure}get vertical(){return a(this,fe).vertical}get ascent(){return a(this,fe).ascent}get defaultWidth(){return a(this,fe).defaultWidth}get descent(){return a(this,fe).descent}get bbox(){return a(this,fe).bbox}get fontMatrix(){return a(this,fe).fontMatrix}get fallbackName(){return a(this,fe).fallbackName}get loadedName(){return a(this,fe).loadedName}get mimetype(){return a(this,fe).mimetype}get name(){return a(this,fe).name}get data(){return a(this,fe).data}clearData(){a(this,fe).clearData()}get cssFontInfo(){return a(this,fe).cssFontInfo}get systemFontInfo(){return a(this,fe).systemFontInfo}get defaultVMetrics(){return a(this,fe).defaultVMetrics}};fe=new WeakMap;Zg=class{};z(Zg,"strings",["fontFamily","fontWeight","italicAngle"]);Qg=class{};z(Qg,"strings",["css","loadedName","baseFontName","src"]);Pi=class Pi{};z(Pi,"bools",["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"]),z(Pi,"numbers",["ascent","defaultWidth","descent"]),z(Pi,"strings",["fallbackName","loadedName","mimetype","name"]),z(Pi,"OFFSET_NUMBERS",Math.ceil(Pi.bools.length*2/8)),z(Pi,"OFFSET_BBOX",Pi.OFFSET_NUMBERS+Pi.numbers.length*8),z(Pi,"OFFSET_FONT_MATRIX",Pi.OFFSET_BBOX+1+8),z(Pi,"OFFSET_DEFAULT_VMETRICS",Pi.OFFSET_FONT_MATRIX+1+48),z(Pi,"OFFSET_STRINGS",Pi.OFFSET_DEFAULT_VMETRICS+1+6);yn=Pi,yi=class{};z(yi,"KIND",0),z(yi,"HAS_BBOX",1),z(yi,"HAS_BACKGROUND",2),z(yi,"SHADING_TYPE",3),z(yi,"N_COORD",4),z(yi,"N_COLOR",8),z(yi,"N_STOP",12),z(yi,"N_FIGURES",16);Mb=class{constructor(t){x(this,ch);x(this,Dp);x(this,mx,new TextDecoder);x(this,lh);p(this,Dp,t),p(this,lh,new DataView(t))}get fontFamily(){return b(this,ch,Jg).call(this,0)}get fontWeight(){return b(this,ch,Jg).call(this,1)}get italicAngle(){return b(this,ch,Jg).call(this,2)}};Dp=new WeakMap,mx=new WeakMap,lh=new WeakMap,ch=new WeakSet,Jg=function(t){Ne(t>i&3;return n===0?void 0:n===2},t0=function(t){return Ne(t0){w=[1/0,1/0,-1/0,-1/0];for(let v=0,T=h.length;vtypeof r=="object"&&Number.isInteger(r?.num)&&r.num>=0&&Number.isInteger(r?.gen)&&r.gen>=0,rM=r=>typeof r=="object"&&typeof r?.name=="string",uT=J_.bind(null,Bb,rM),Ub=class{constructor(){x(this,na,new Map);x(this,xx,Promise.resolve())}postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};a(this,xx).then(()=>{for(let[n]of a(this,na))n.call(this,i)})}addEventListener(t,e,i=null){let n=null;if(i?.signal instanceof AbortSignal){let{signal:s}=i;if(s.aborted){Pt("LoopbackPort - cannot use an `aborted` signal.");return}let o=()=>this.removeEventListener(t,e);n=()=>s.removeEventListener("abort",o),s.addEventListener("abort",o)}a(this,na).set(e,n)}removeEventListener(t,e){a(this,na).get(e)?.(),a(this,na).delete(e)}terminate(){for(let[,t]of a(this,na))t?.();a(this,na).clear()}};na=new WeakMap,xx=new WeakMap;Lg={DATA:1,ERROR:2},Ze={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};hl=class{constructor(t,e,i){x(this,mr);x(this,dh,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,mr,hT).bind(this),{signal:a(this,dh).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:Ze.PULL,streamId:s,desiredSize:u.desiredSize}),h.promise},cancel:u=>{Ne(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:Ze.CANCEL,streamId:s,reason:on(u)}),h.promise}},i)}destroy(){a(this,dh)?.abort(),p(this,dh,null)}};dh=new WeakMap,mr=new WeakSet,hT=function({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){b(this,mr,fT).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===Lg.DATA)n.resolve(t.data);else if(t.callback===Lg.ERROR)n.reject(on(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:Lg.DATA,callbackId:t.callbackId,data:o})},function(o){s.postMessage({sourceName:i,targetName:n,callback:Lg.ERROR,callbackId:t.callbackId,reason:on(o)})});return}if(t.streamId){b(this,mr,dT).call(this,t);return}e(t.data)},dT=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:Ze.ENQUEUE,streamId:e,chunk:u},d)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:Ze.CLOSE,streamId:e}),delete o.streamSinks[e])},error(u){Ne(u instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:Ze.ERROR,streamId:e,reason:on(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:Ze.START_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:Ze.START_COMPLETE,streamId:e,reason:on(u)})})},fT=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 Ze.START_COMPLETE:t.success?o.startCall.resolve():o.startCall.reject(on(t.reason));break;case Ze.PULL_COMPLETE:t.success?o.pullCall.resolve():o.pullCall.reject(on(t.reason));break;case Ze.PULL:if(!l){s.postMessage({sourceName:i,targetName:n,stream:Ze.PULL_COMPLETE,streamId:e,success:!0});break}l.desiredSize<=0&&t.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=t.desiredSize,Promise.try(l.onPull||lC).then(function(){s.postMessage({sourceName:i,targetName:n,stream:Ze.PULL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:Ze.PULL_COMPLETE,streamId:e,reason:on(u)})});break;case Ze.ENQUEUE:if(Ne(o,"enqueue should have stream controller"),o.isClosed)break;o.controller.enqueue(t.chunk);break;case Ze.CLOSE:if(Ne(o,"close should have stream controller"),o.isClosed)break;o.isClosed=!0,o.controller.close(),b(this,mr,i0).call(this,o,e);break;case Ze.ERROR:Ne(o,"error should have stream controller"),o.controller.error(on(t.reason)),b(this,mr,i0).call(this,o,e);break;case Ze.CANCEL_COMPLETE:t.success?o.cancelCall.resolve():o.cancelCall.reject(on(t.reason)),b(this,mr,i0).call(this,o,e);break;case Ze.CANCEL:if(!l)break;let c=on(t.reason);Promise.try(l.onCancel||lC,c).then(function(){s.postMessage({sourceName:i,targetName:n,stream:Ze.CANCEL_COMPLETE,streamId:e,success:!0})},function(u){s.postMessage({sourceName:i,targetName:n,stream:Ze.CANCEL_COMPLETE,streamId:e,reason:on(u)})}),l.sinkCapability.reject(c),l.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},i0=async function(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]};U0=class{constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:i=null}){x(this,yx,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:ie(`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,yx)[t]} data at: ${n}`)})}async _fetch(t,e){ie("Abstract method `_fetch` called.")}};yx=new WeakMap;z0=class extends U0{async _fetch(t,e){let i=e==="cMapUrl"&&!t.endsWith(".bcmap")?"text":"bytes",n=await Rx(t,i);return n instanceof Uint8Array?n:Fx(n)}},j0=class{constructor({enableHWA:t=!1}){x(this,kp,!1);p(this,kp,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,kp)})}}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){ie("Abstract method `_createCanvas` called.")}};kp=new WeakMap;zb=class extends j0{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}},H0=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){}},jb=class extends H0{constructor({docId:e,ownerDocument:i=globalThis.document}){super();x(this,yt);x(this,Hl);x(this,fh);x(this,ra);x(this,sa);x(this,Bi);x(this,Gl);x(this,$l,0);p(this,sa,e),p(this,Bi,i)}addFilter(e){if(!e)return"none";let i=a(this,yt,Fi).get(e);if(i)return i;let[n,s,o]=b(this,yt,n0).call(this,e),l=e.length===1?n:`${n}${s}${o}`;if(i=a(this,yt,Fi).get(l),i)return a(this,yt,Fi).set(e,i),i;let c=`g_${a(this,sa)}_transfer_map_${Ye(this,$l)._++}`,u=b(this,yt,Cu).call(this,c);a(this,yt,Fi).set(e,u),a(this,yt,Fi).set(l,u);let h=b(this,yt,Tu).call(this,c);return b(this,yt,gf).call(this,n,s,o,h),u}addHCMFilter(e,i){let n=`${e}-${i}`,s="base",o=a(this,yt,pf).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,yt,pf).set(s,o)),!e||!i))return o.url;let l=b(this,yt,xf).call(this,e);e=ht.makeHexColor(...l);let c=b(this,yt,xf).call(this,i);if(i=ht.makeHexColor(...c),a(this,yt,Eu).style.color="",e==="#000000"&&i==="#ffffff"||e===i)return o.url;let u=new Array(256);for(let y=0;y<=255;y++){let g=y/255;u[y]=g<=.03928?g/12.92:((g+.055)/1.055)**2.4}let h=u.join(","),d=`g_${a(this,sa)}_hcm_filter`,f=o.filter=b(this,yt,Tu).call(this,d);b(this,yt,gf).call(this,h,h,h,f),b(this,yt,Hb).call(this,f);let m=(y,g)=>{let A=l[y]/255,w=c[y]/255,v=new Array(g+1);for(let T=0;T<=g;T++)v[T]=A+T/g*(w-A);return v.join(",")};return b(this,yt,gf).call(this,m(0,5),m(1,5),m(2,5),f),o.url=b(this,yt,Cu).call(this,d),o.url}addAlphaFilter(e){let i=a(this,yt,Fi).get(e);if(i)return i;let[n]=b(this,yt,n0).call(this,[e]),s=`alpha_${n}`;if(i=a(this,yt,Fi).get(s),i)return a(this,yt,Fi).set(e,i),i;let o=`g_${a(this,sa)}_alpha_map_${Ye(this,$l)._++}`,l=b(this,yt,Cu).call(this,o);a(this,yt,Fi).set(e,l),a(this,yt,Fi).set(s,l);let c=b(this,yt,Tu).call(this,o);return b(this,yt,Gb).call(this,n,c),l}addLuminosityFilter(e){let i=a(this,yt,Fi).get(e||"luminosity");if(i)return i;let n,s;if(e?([n]=b(this,yt,n0).call(this,[e]),s=`luminosity_${n}`):s="luminosity",i=a(this,yt,Fi).get(s),i)return a(this,yt,Fi).set(e,i),i;let o=`g_${a(this,sa)}_luminosity_map_${Ye(this,$l)._++}`,l=b(this,yt,Cu).call(this,o);a(this,yt,Fi).set(e,l),a(this,yt,Fi).set(s,l);let c=b(this,yt,Tu).call(this,o);return b(this,yt,pT).call(this,c),e&&b(this,yt,Gb).call(this,n,c),l}addHighlightHCMFilter(e,i,n,s,o){let l=`${i}-${n}-${s}-${o}`,c=a(this,yt,pf).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,yt,pf).set(e,c)),!i||!n))return c.url;let[u,h]=[i,n].map(b(this,yt,xf).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,y]=[s,o].map(b(this,yt,xf).bind(this));f{let _=new Array(256),F=(f-d)/I,L=v/255,Y=(T-v)/(255*I),q=0;for(let G=0;G<=I;G++){let j=Math.round(d+G*F),J=L+G*Y;for(let et=q;et<=j;et++)_[et]=J;q=j+1}for(let G=q;G<256;G++)_[G]=_[q-1];return _.join(",")},A=`g_${a(this,sa)}_hcm_${e}_filter`,w=c.filter=b(this,yt,Tu).call(this,A);return b(this,yt,Hb).call(this,w),b(this,yt,gf).call(this,g(m[0],y[0],5),g(m[1],y[1],5),g(m[2],y[2],5),w),c.url=b(this,yt,Cu).call(this,A),c.url}destroy(e=!1){e&&a(this,Gl)?.size||(a(this,ra)?.parentNode.parentNode.remove(),p(this,ra,null),a(this,fh)?.clear(),p(this,fh,null),a(this,Gl)?.clear(),p(this,Gl,null),p(this,$l,0))}};Hl=new WeakMap,fh=new WeakMap,ra=new WeakMap,sa=new WeakMap,Bi=new WeakMap,Gl=new WeakMap,$l=new WeakMap,yt=new WeakSet,Fi=function(){return a(this,fh)||p(this,fh,new Map)},pf=function(){return a(this,Gl)||p(this,Gl,new Map)},Eu=function(){if(!a(this,ra)){let e=a(this,Bi).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,Bi).createElementNS(Us,"svg");n.setAttribute("width",0),n.setAttribute("height",0),p(this,ra,a(this,Bi).createElementNS(Us,"defs")),e.append(n),n.append(a(this,ra)),a(this,Bi).body.append(e)}return a(this,ra)},n0=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(",")]},Cu=function(e){if(a(this,Hl)===void 0){p(this,Hl,"");let i=a(this,Bi).URL;i!==a(this,Bi).baseURI&&(Hm(i)?Pt('#createUrl: ignore "data:"-URL for performance reasons.'):p(this,Hl,_w(i,"")))}return`url(${a(this,Hl)}#${e})`},pT=function(e){let i=a(this,Bi).createElementNS(Us,"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)},Hb=function(e){let i=a(this,Bi).createElementNS(Us,"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)},Tu=function(e){let i=a(this,Bi).createElementNS(Us,"filter");return i.setAttribute("color-interpolation-filters","sRGB"),i.setAttribute("id",e),a(this,yt,Eu).append(i),i},mf=function(e,i,n){let s=a(this,Bi).createElementNS(Us,i);s.setAttribute("type","discrete"),s.setAttribute("tableValues",n),e.append(s)},gf=function(e,i,n,s){let o=a(this,Bi).createElementNS(Us,"feComponentTransfer");s.append(o),b(this,yt,mf).call(this,o,"feFuncR",e),b(this,yt,mf).call(this,o,"feFuncG",i),b(this,yt,mf).call(this,o,"feFuncB",n)},Gb=function(e,i){let n=a(this,Bi).createElementNS(Us,"feComponentTransfer");i.append(n),b(this,yt,mf).call(this,n,"feFuncA",e)},xf=function(e){return a(this,yt,Eu).style.color=e,wd(getComputedStyle(a(this,yt,Eu)).getPropertyValue("color"))};Bn&&Pt("Please use the `legacy` build in Node.js environments.");$b=class extends H0{},Vb=class extends j0{_createCanvas(t,e){return it.default.getBuiltinModule("module").createRequire("")("@napi-rs/canvas").createCanvas(t,e)}},qb=class extends U0{async _fetch(t,e){return sM(t)}},aM=` struct Uniforms { offsetX : f32, offsetY : f32, @@ -55,47 +55,47 @@ fn vs_main(in : VertexInput) -> VertexOutput { fn fs_main(in : VertexOutput) -> @location(0) vec4 { return vec4(in.color, 1.0); } -`,Wb=class{constructor(){x(this,yd);x(this,kp,null);x(this,ph,null);x(this,mh,null);x(this,gh,null)}init(){a(this,kp)===null&&p(this,kp,b(this,yd,mT).call(this))}get isReady(){return a(this,ph)!==null}draw(t,e,i,n,s,o){let l=a(this,ph),{offsetX:c,offsetY:u,scaleX:h,scaleY:d}=e,{posData:f,colData:m,vertexCount:y}=b(this,yd,gT).call(this,t,e),g=l.createBuffer({size:Math.max(f.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});f.byteLength>0&&l.queue.writeBuffer(g,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,mh).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:w}}]}),T=new OffscreenCanvas(n,s),k=T.getContext("webgpu");k.configure({device:l,format:a(this,gh),alphaMode:i?"opaque":"premultiplied"});let N=i?{r:i[0]/255,g:i[1]/255,b:i[2]/255,a:1}:{r:0,g:0,b:0,a:0},F=l.createCommandEncoder(),L=F.beginRenderPass({colorAttachments:[{view:k.getCurrentTexture().createView(),clearValue:N,loadOp:"clear",storeOp:"store"}]});return y>0&&(L.setPipeline(a(this,mh)),L.setBindGroup(0,v),L.setVertexBuffer(0,g),L.setVertexBuffer(1,A),L.draw(y)),L.end(),l.queue.submit([F.finish()]),g.destroy(),A.destroy(),w.destroy(),T.transferToImageBitmap()}};kp=new WeakMap,ph=new WeakMap,mh=new WeakMap,gh=new WeakMap,yd=new WeakSet,mT=async function(){if(!globalThis.navigator?.gpu)return!1;try{let t=await navigator.gpu.requestAdapter();if(!t)return!1;p(this,gh,navigator.gpu.getPreferredCanvasFormat());let e=p(this,ph,await t.requestDevice()),i=e.createShaderModule({code:aM});return p(this,mh,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,gh)}]},primitive:{topology:"triangle-list"}})),!0}catch{return!1}},gT=function(t,e){let{coords:i,colors:n}=e,s=0;for(let d of t){let f=d.coords;if(d.type===ul.TRIANGLES)s+=f.length;else if(d.type===ul.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===ul.TRIANGLES)for(let y=0,g=f.length;ythis._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(),ht.applyTransform(n,e),ht.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);ht.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(),ht.applyTransform(i,e),ht.applyTransform(n,e));let s=this._r1,o=this._r0;if(e){let u=new Float32Array(2);ht.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===ki.STROKE||n===ki.FILL){if(this.isOriginBased()){let f=ht.transform(i,e.baseTransform);this.matrix&&(f=ht.transform(f,this.matrix));let m=.001,y=Math.hypot(f[0],f[1]),g=Math.hypot(f[2],f[3]),A=(f[0]*f[2]+f[1]*f[3])/(y*g);if(Math.abs(A)=tt?F=u:Y=!0,j>=et?L=h:q=!0;let _=this.getSizeAndScale(F,this.ctx.canvas.width,k),X=this.getSizeAndScale(L,this.ctx.canvas.height,N),O=t.canvasFactory.create(_.size,X.size),C=O.context,D=c.createCanvasGraphics(C,e);if(D.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(D,s,l),C.translate(-_.scale*d,-X.scale*f),D.transform(0,_.scale,0,0,X.scale,0,0),C.save(),D.dependencyTracker?.save(),this.clipBbox(D,d,f,m,y),D.baseTransform=Ie(D.ctx),D.executeOperatorList(n),D.endDrawing(),D.dependencyTracker?.restore(),C.restore(),Y||q){let E=O.canvas;Y&&(F=u),q&&(L=h);let S=this.getSizeAndScale(F,this.ctx.canvas.width,k),I=this.getSizeAndScale(L,this.ctx.canvas.height,N),M=S.size,P=I.size,B=t.canvasFactory.create(M,P),$=B.context,U=Y?Math.floor(g/u):0,V=q?Math.floor(A/h):0;for(let Z=0;Z<=U;Z++)for(let Q=0;Q<=V;Q++)$.drawImage(E,M*Z,P*Q,M,P,0,0,M,P);return t.canvasFactory.destroy(O),{canvas:B.canvas,canvasEntry:B,scaleX:S.scale,scaleY:I.scale,offsetX:d,offsetY:f}}return{canvas:O.canvas,canvasEntry:O,scaleX:_.scale,scaleY:X.scale,offsetX:d,offsetY:f}}getSizeAndScale(t,e,i){let n=Math.max(bx.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),ht.axialAlignedBoundingBox([e,i,n,s],Ie(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let n=t.ctx,s=t.current;switch(e){case cC.COLORED:let{fillStyle:o,strokeStyle:l}=this.ctx;n.fillStyle=s.fillColor=o,n.strokeStyle=s.strokeColor=l;break;case cC.UNCOLORED:n.fillStyle=n.strokeStyle=i,s.fillColor=s.strokeColor=i;break;default:throw new tb(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,n,s){let o=i;n!==ki.SHADING&&(o=ht.transform(o,e.baseTransform),this.matrix&&(o=ht.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}};z(bx,"MAX_PATTERN_SIZE",3e3);Zb=bx;uC=16,hC=100,fM=15,dC=10,pn=16,Ky=new DOMMatrix,Un=new Float32Array(2),Mu=new Float32Array([1/0,1/0,-1/0,-1/0]);G0=class{constructor(t,e){z(this,"alphaIsShape",!1);z(this,"fontSize",0);z(this,"fontSizeScale",1);z(this,"textMatrix",null);z(this,"textMatrixScale",1);z(this,"fontMatrix",Qy);z(this,"leading",0);z(this,"x",0);z(this,"y",0);z(this,"lineX",0);z(this,"lineY",0);z(this,"charSpacing",0);z(this,"wordSpacing",0);z(this,"textHScale",1);z(this,"textRenderingMode",ni.FILL);z(this,"textRise",0);z(this,"fillColor","#000000");z(this,"strokeColor","#000000");z(this,"patternFill",!1);z(this,"patternStroke",!1);z(this,"fillAlpha",1);z(this,"strokeAlpha",1);z(this,"lineWidth",1);z(this,"activeSMask",null);z(this,"transferMaps","none");z(this,"minMax",Mu.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=ki.FILL,e=null){let i=this.minMax.slice();if(t===ki.STROKE){e||ie("Stroke bounding box must include transform."),ht.singularValueDecompose2dScale(e,Un);let n=Un[0]*this.lineWidth/2,s=Un[1]*this.lineWidth/2;i[0]-=n,i[1]-=s,i[2]+=n,i[3]+=s}return i}updateClipFromPath(){let t=ht.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(Mu,0)}getClippedPathBoundingBox(t=ki.FILL,e=null){return ht.intersect(this.clipBox,this.getPathBoundingBox(t,e))}};mM=["butt","round","square"],gM=["miter","round","bevel"],xM={},gC={},Bw=class Bw{constructor(t,e,i,n,s,{optionalContentConfig:o,markedContentStack:l=null},c,u,h,d){x(this,Br);this.ctx=t,this.current=new G0(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(...Ie(this.compositeCtx))}this.ctx.save(),Ug(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=Ie(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>dC&&typeof i=="function",d=h?Date.now()+fM:0,f=0,m=this.commonObjs,y=this.objs,g,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(g=l[c],A=o[c]??null,g!==ud.dependency)A===null?this[g](c):this[g](c,...A);else for(let w of A){this.dependencyTracker?.recordNamedData(w,c);let v=w.startsWith("g_")?m:y;if(!v.has(w))return v.get(w,i),c}if(c++,c===u)return c;if(h&&++f>dC){if(Date.now()>d)return i(),c;f=0}}}endDrawing(){b(this,Br,Qb).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,Br,Jb).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],T=this.canvasFactory.create(w,v);return T.context.drawImage(t,0,0,i,n,0,0,w,v),{img:T.canvas,paintWidth:w,paintHeight:v,tmpCanvas:T}}let f=this.canvasFactory.create(1,1),m=this.canvasFactory.create(1,1),y=i,g=n,A=t;for(let{newWidth:w,newHeight:v}of l)this.canvasFactory.reset(m,w,v),m.context.drawImage(A,0,0,y,g,0,0,w,v),[f,m]=[m,f],A=f.canvas,y=w,g=v;return this.canvasFactory.destroy(m),{img:f.canvas,paintWidth:y,paintHeight:g,tmpCanvas:f}}_createMaskCanvas(t,e){let i=this.ctx,{width:n,height:s}=e,o=this.current.fillColor,l=this.current.patternFill,c=Ie(i),u,h,d,f;if((e.bitmap||e.data)&&e.count>1){let j=e.bitmap||e.data.buffer;h=JSON.stringify(l?c:[c.slice(0,4),o]),u=this._cachedBitmapsMap.getOrInsertComputed(j,Ox);let tt=u.get(h);if(tt&&!l){let et=Math.round(Math.min(c[0],c[2])+c[4]),_=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(t,Qn.transformAndFill),{canvas:tt,offsetX:et,offsetY:_}}d=tt}d||(f=this.canvasFactory.create(n,s),pC(f.context,e));let m=ht.transform(c,[1/n,0,0,-1/s,0,0]);m=ht.transform(m,[1,0,0,1,0,-s]);let y=Mu.slice();ht.axialAlignedBoundingBox([0,0,n,s],m,y);let[g,A,w,v]=y,T=Math.round(w-g)||1,k=Math.round(v-A)||1,N=this.canvasFactory.create(T,k),F=N.context,L=g,Y=A;F.translate(-L,-Y),F.transform(...m);let q=null;if(!d){let j=this._scaleImage(f.canvas,Zr(F));d=j.img,q=j.tmpCanvas,d!==f.canvas&&(this.canvasFactory.destroy(f),f=null),u&&l&&(u.set(h,d),q=null,f=null)}F.imageSmoothingEnabled=mC(Ie(F),e.interpolate),Bg(F,d,0,0,d.width,d.height,0,0,n,s),q&&this.canvasFactory.destroy(q),f&&this.canvasFactory.destroy(f),F.globalCompositeOperation="source-in";let G=ht.transform(Zr(F),[1,0,0,1,-L,-Y]);return F.fillStyle=l?o.getPattern(i,this,G,ki.FILL,t):o,F.fillRect(0,0,n,s),u&&!l&&u.set(h,N.canvas),this.dependencyTracker?.recordDependencies(t,Qn.transformAndFill),{canvas:N.canvas,canvasEntry:u&&!l?null:N,offsetX:Math.round(L),offsetY:Math.round(Y)}}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=mM[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=gM[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()),rf(this.suspendedCtx,s),pM(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(),rf(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,y=u-d,g=null;if(o)if(m<0||y<0||m+i>f.width||y+n>f.height){g=this.canvasFactory.create(i,n);let w=g.context;w.drawImage(f,-m,-y),w.globalCompositeOperation="destination-atop",w.fillStyle=o,w.fillRect(0,0,i,n),w.globalCompositeOperation="source-over",f=g.canvas,m=y=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let w=new Path2D;w.rect(m,y,i,n),t.clip(w),t.globalCompositeOperation="destination-atop",t.fillStyle=o,t.fillRect(m,y,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,y,i,n,c,u,i,n),e.restore(),g&&this.canvasFactory.destroy(g)}save(t){this.inSMaskMode&&rf(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&&rf(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===ud.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]=_C(s)),ht.axialAlignedBoundingBox(n,Ie(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,Zr(n),ki.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,Qn.stroke),i&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(ki.STROKE,Ie(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,Zr(n),ki.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,Qn.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,Qn.rawFillPath).recordOperation(t)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=xM}eoClip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=gC}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||Qy,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&Mt("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;ihC&&(h=hC),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&ni.FILL_STROKE_MASK,m=!!(h&ni.ADD_TO_PATH_FLAG),y=c.patternFill&&!u.missingFile,g=c.patternStroke&&!u.missingFile,A;if((u.disableFontFace||m||y||g)&&!u.missingFile&&(A=u.getPathGenerator(this.commonObjs,e)),A&&(u.disableFontFace||y||g)){l.save(),l.translate(i,n),l.scale(d,-d),this.dependencyTracker?.recordCharacterBBox(t,l,u);let w;if(f===ni.FILL||f===ni.FILL_STROKE)if(s){w=l.getTransform(),l.setTransform(...s);let v=b(this,Br,t2).call(this,A,w,s);l.fill(v)}else l.fill(A);if(f===ni.STROKE||f===ni.FILL_STROKE)if(o){w||(w=l.getTransform()),l.setTransform(...o);let{a:v,b:T,c:k,d:N}=w,F=ht.inverseTransform(o),L=ht.transform([v,T,k,N,0,0],F);ht.singularValueDecompose2dScale(L,Un),l.lineWidth*=Math.max(Un[0],Un[1])/d,l.stroke(b(this,Br,t2).call(this,A,w,o))}else l.lineWidth/=d,l.stroke(A);l.restore()}else(f===ni.FILL||f===ni.FILL_STROKE)&&(l.fillText(e,i,n),this.dependencyTracker?.recordCharacterBBox(t,l,u,d,i,n,()=>l.measureText(e))),(f===ni.STROKE||f===ni.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,l,u,d,i,n,()=>l.measureText(e)).recordDependencies(t,Qn.stroke),l.strokeText(e,i,n));m&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Ie(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;s0&&i[s]<255){n=!0;break}return _t(this,"isFontSubpixelAAEnabled",n)}showText(t,e){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,Qn.showText).resetBBox(t),this.current.textRenderingMode&ni.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,y=m?1:-1,g=n.defaultVMetrics,A=s*i.fontMatrix[0],w=i.textRenderingMode===ni.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,T,k=i.textRenderingMode&ni.FILL_STROKE_MASK,N=k===ni.FILL||k===ni.FILL_STROKE,F=k===ni.STROKE||k===ni.FILL_STROKE;if(N&&i.patternFill){o.save();let j=i.fillColor.getPattern(o,this,Zr(o),ki.FILL,t);v=Ie(o),o.restore(),o.fillStyle=j}if(F&&i.patternStroke){o.save();let j=i.strokeColor.getPattern(o,this,Zr(o),ki.STROKE,t);T=Ie(o),o.restore(),o.strokeStyle=j}let L=i.lineWidth,Y=i.textMatrixScale;if(Y===0||L===0?F&&(L=this.getSinglePixelWidth()):L/=Y,l!==1&&(o.scale(l,l),L/=l),o.lineWidth=L,n.isInvalidPDFjsFont){let j=[],tt=0;for(let _ of e)j.push(_.unicode),tt+=_.width;let et=j.join("");if(o.fillText(et,0,0),this.dependencyTracker!==null){let _=o.measureText(et);this.dependencyTracker.recordBBox(t,this.ctx,-_.actualBoundingBoxLeft,_.actualBoundingBoxRight,-_.actualBoundingBoxAscent,_.actualBoundingBoxDescent).recordShowTextOperation(t)}i.x+=tt*A*d,o.restore(),this.compose();return}let q=0,G;for(G=0;G0){E=o.measureText(_);let I=E.width*1e3/s*l;if(DE??o.measureText(_));else if(this.paintChar(t,_,O,C,v,T),X){let I=O+s*X.offset.x/l,M=C-s*X.offset.y/l;this.paintChar(t,X.fontChar,I,M,v,T)}}let S=m?D*A-et*h:D*A+et*h;q+=S,tt&&o.restore()}m?i.y-=q:i.x+=q*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||Qy,m=e.length,y=n.textRenderingMode===ni.INVISIBLE,g,A,w,v;if(y||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 T=this.dependencyTracker;for(this.dependencyTracker=T?new B0(T,t):null,g=0;gnew Bw(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new B0(this.dependencyTracker,l,!0):null)};i=new Zb(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=hM(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,Zr(i),ki.SHADING,t);let s=Zr(i);if(s){let{width:o,height:l}=i.canvas,c=Mu.slice();ht.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,Qn.transform).recordDependencies(t,Qn.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){ie("Should not call beginInlineImage")}beginImageData(){ie("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=Ie(this.ctx),i)){ht.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||Mx("TODO: Support non-isolated groups."),e.knockout&&Mt("Knockout groups not supported.");let n=Ie(i);e.matrix&&i.transform(...e.matrix);let s=[0,0,i.canvas.width,i.canvas.height],o;e.bbox?(o=Mu.slice(),ht.axialAlignedBoundingBox(e.bbox,Ie(i),o),o=ht.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,[y,g,A,w]=e.bbox;if(m.rect(y,g,A-y,w-g),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()),rf(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=Ie(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...s);let o=Mu.slice();ht.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,Br,Qb).call(this),Ug(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,ht.singularValueDecompose2dScale(Ie(this.ctx),Un);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(Un[0],0,0,-Un[1],0,c*Un[1]),Ug(this.ctx)}else{Ug(this.ctx),this.endPath(t);let u=new Path2D;u.rect(i[0],i[1],l,c),this.ctx.clip(u)}}this.current=new G0(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,Br,Jb).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=Ie(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;dd?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),Ky.a=1/s,Ky.d=1/o;let c=new Path2D;if(c.addPath(t,Ky),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}};Br=new WeakSet,Qb=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)},Jb=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}}},t2=function(t,e,i){let n=new Path2D;return n.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),n};Ou=Bw;for(let r in ud)Ou.prototype[r]!==void 0&&(Ou.prototype[ud[r]]=Ou.prototype[r]);fd=class{constructor(t,e,i){x(this,_p,null);x(this,Np,null);z(this,"_fullReader",null);z(this,"_rangeReaders",new Set);z(this,"_source",null);this._source=t,p(this,_p,e),p(this,Np,i)}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return _e(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(a(this,_p))(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new(a(this,Np))(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)}};_p=new WeakMap,Np=new WeakMap;pd=class{constructor(t){z(this,"onProgress",null);z(this,"_contentLength",0);z(this,"_filename",null);z(this,"_headersCapability",Promise.withResolvers());z(this,"_isRangeSupported",!1);z(this,"_isStreamingSupported",!1);z(this,"_loaded",0);z(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(){ie("Abstract method `read` called")}cancel(t){ie("Abstract method `cancel` called")}},md=class{constructor(t,e,i){z(this,"_stream",null);this._stream=t}async read(){ie("Abstract method `read` called")}cancel(t){ie("Abstract method `cancel` called")}};e2=class extends fd{constructor(e){super(e,i2,n2);z(this,"_responseOrigin",null);let{httpHeaders:i,url:n}=e;_e(/https?:/.test(n.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=xT(!0,i)}},i2=class extends pd{constructor(e){super(e);z(this,"_abortController",new AbortController);z(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);AT(o,c,l,this._abortController).then(u=>{e._responseOrigin=Bx(u.url),vT(u.status,o),this._reader=u.body.getReader();let h=u.headers,{contentLength:d,isRangeSupported:f}=yT({responseHeaders:h,isHttp:!0,rangeChunkSize:s,disableRange:i});this._contentLength=d,this._isRangeSupported=f,this._filename=bT(h),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Lr("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:zx(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},n2=class extends md{constructor(e,i,n){super(e,i,n);z(this,"_abortController",new AbortController);z(this,"_readCapability",Promise.withResolvers());z(this,"_reader",null);let{url:s,withCredentials:o}=e._source,l=new Headers(e.headers);l.append("Range",`bytes=${i}-${n-1}`),AT(s,l,o,this._abortController).then(c=>{let u=Bx(c.url);wT(u,e._responseOrigin),vT(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:zx(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}};r2=class extends fd{constructor(e){super(e,a2,o2);x(this,Mp);z(this,"_progressiveDone",!1);z(this,"_queuedChunks",[]);let{pdfDataRangeTransport:i}=e,{initialData:n,progressiveDone:s}=i;if(n?.length>0){let o=xC(n);this._queuedChunks.push(o)}this._progressiveDone=s,i.addRangeListener((o,l)=>{b(this,Mp,s2).call(this,o,l)}),i.addProgressiveReadListener(o=>{b(this,Mp,s2).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()}};Mp=new WeakSet,s2=function(e,i){let n=xC(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);_e(s,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),s._enqueue(n)}};a2=class extends pd{constructor(e){super(e);x(this,Fp,jx.bind(this));z(this,"_done",!1);z(this,"_queuedChunks",null);z(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,Lx(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,Fp).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&a(this,Fp).call(this)}};Fp=new WeakMap;o2=class extends md{constructor(e,i,n){super(e,i,n);x(this,Pp,jx.bind(this));z(this,"onDone",null);z(this,"_begin",-1);z(this,"_done",!1);z(this,"_queuedChunk",null);z(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,Pp).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,Pp).call(this),this.onDone?.()}};Pp=new WeakMap;Zy=200,yC=206;l2=class extends fd{constructor(e){super(e,c2,u2);x(this,bd);x(this,us,new WeakMap);z(this,"_responseOrigin",null);let{httpHeaders:i,url:n}=e;this.url=n,this.isHttp=/https?:/.test(n.protocol),this.headers=xT(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,us).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===yC||s===Zy):n.validateStatus=s=>s===Zy,i.responseType="arraybuffer",_e(e.onError,"Expected `onError` callback to be provided."),i.onerror=()=>e.onError(i.status),i.onreadystatechange=b(this,bd,CT).bind(this,i),i.onprogress=b(this,bd,ET).bind(this,i),i.send(null),i}_abortRequest(e){a(this,us).has(e)&&(a(this,us).delete(e),e.abort())}getRangeReader(e,i){let n=super.getRangeReader(e,i);return n&&(n.onClosed=()=>this._rangeReaders.delete(n)),n}};us=new WeakMap,bd=new WeakSet,ET=function(e,i){a(this,us).get(e)?.onProgress?.(i)},CT=function(e,i){let n=a(this,us).get(e);if(!n||(e.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),e.readyState!==4)||!a(this,us).has(e))return;if(a(this,us).delete(e),e.status===0&&this.isHttp){n.onError(e.status);return}let s=e.status||Zy;if(!n.validateStatus(s)){n.onError(e.status);return}let o=bM(e.response);if(s===yC){let l=e.getResponseHeader("Content-Range");/bytes (\d+)-(\d+)\/(\d+)/.test(l)?n.onDone(o):(Mt('Missing or invalid "Content-Range" header.'),n.onError(0))}else o?n.onDone(o):n.onError(e.status)};c2=class extends pd{constructor(e){super(e);x(this,Cs);x(this,Op,jx.bind(this));z(this,"_cachedChunks",[]);z(this,"_done",!1);z(this,"_requests",[]);z(this,"_storedError",null);this._fullRequestXhr=e._request({onHeadersReceived:b(this,Cs,TT).bind(this),onDone:b(this,Cs,ST).bind(this),onError:b(this,Cs,DT).bind(this),onProgress:b(this,Cs,IT).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,Op).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}};Op=new WeakMap,Cs=new WeakSet,TT=function(){let e=this._stream,{disableRange:i,rangeChunkSize:n}=e._source,s=this._fullRequestXhr;e._responseOrigin=Bx(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}=yT({responseHeaders:l,isHttp:e.isHttp,rangeChunkSize:n,disableRange:i});this._contentLength=c,this._isRangeSupported=u,this._filename=bT(l),this._isRangeSupported&&e._abortRequest(s),this._headersCapability.resolve()},ST=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,Op).call(this)},DT=function(e){this._storedError=Ux(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},IT=function(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})};u2=class extends md{constructor(e,i,n){super(e,i,n);x(this,_a);x(this,Rp,jx.bind(this));z(this,"onClosed",null);z(this,"_done",!1);z(this,"_queuedChunk",null);z(this,"_requests",[]);z(this,"_storedError",null);this._requestXhr=e._request({begin:i,end:n,onHeadersReceived:b(this,_a,kT).bind(this),onDone:b(this,_a,_T).bind(this),onError:b(this,_a,h2).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,Rp).call(this),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};Rp=new WeakMap,_a=new WeakSet,kT=function(){let e=Bx(this._requestXhr?.responseURL);try{wT(e,this._stream._responseOrigin)}catch(i){this._storedError=i,b(this,_a,h2).call(this,0)}},_T=function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,a(this,Rp).call(this),this.onClosed?.()},h2=function(e){this._storedError??(this._storedError=Ux(e,this._stream.url));for(let i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};d2=class extends fd{constructor(t){super(t,f2,p2);let{url:e}=t;_e(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}},f2=class extends pd{constructor(e){super(e);z(this,"_reader",null);let{disableRange:i,disableStream:n,rangeChunkSize:s,url:o}=e._source;this._isStreamingSupported=!n;let l=it.default.getBuiltinModule("fs");l.promises.lstat(o).then(c=>{let u=l.createReadStream(o),h=NT(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 Lr("Streaming is disabled.")),this._headersCapability.resolve()}).catch(c=>{c.code==="ENOENT"&&(c=Ux(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:zx(e),done:!1})}cancel(e){this._reader?.cancel(e)}},p2=class extends md{constructor(e,i,n){super(e,i,n);z(this,"_readCapability",Promise.withResolvers());z(this,"_reader",null);let{url:s}=e._source,o=it.default.getBuiltinModule("fs");try{let l=o.createReadStream(s,{start:i,end:n-1}),c=NT(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:zx(e),done:!1}}cancel(e){this._reader?.cancel(e)}};dr=class{static get workerPort(){return a(this,Lp)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");p(this,Lp,t)}static get workerSrc(){return a(this,Bp)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");p(this,Bp,t)}};Lp=new WeakMap,Bp=new WeakMap,x(dr,Lp,null),x(dr,Bp,"");m2=class{constructor({parsedData:t,rawData:e}){x(this,xh);x(this,Up);p(this,xh,t),p(this,Up,e)}getRaw(){return a(this,Up)}get(t){return a(this,xh).get(t)??null}[Symbol.iterator](){return a(this,xh).entries()}};xh=new WeakMap,Up=new WeakMap;Su=Symbol("INTERNAL"),g2=class{constructor(t,{name:e,intent:i,usage:n,rbGroups:s}){x(this,zp,!1);x(this,jp,!1);x(this,Hp,!1);x(this,yh,!0);p(this,zp,!!(t&Ln.DISPLAY)),p(this,jp,!!(t&Ln.PRINT)),this.name=e,this.intent=i,this.usage=n,this.rbGroups=s}get visible(){if(a(this,Hp))return a(this,yh);if(!a(this,yh))return!1;let{print:t,view:e}=this.usage;return a(this,zp)?e?.viewState!=="OFF":a(this,jp)?t?.printState!=="OFF":!0}_setVisible(t,e,i=!1){t!==Su&&ie("Internal method `_setVisible` called."),p(this,Hp,i),p(this,yh,e)}};zp=new WeakMap,jp=new WeakMap,Hp=new WeakMap,yh=new WeakMap;x2=class{constructor(t,e=Ln.DISPLAY){x(this,Gp);x(this,fo,null);x(this,pe,new Map);x(this,bh,null);x(this,wh,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,p(this,wh,t.order);for(let i of t.groups)a(this,pe).set(i.id,new g2(e,i));if(t.baseState==="OFF")for(let i of a(this,pe).values())i._setVisible(Su,!1);for(let i of t.on)a(this,pe).get(i)._setVisible(Su,!0);for(let i of t.off)a(this,pe).get(i)._setVisible(Su,!1);p(this,bh,this.getHash())}}isVisible(t){if(a(this,pe).size===0)return!0;if(!t)return Mx("Optional content group not defined."),!0;if(t.type==="OCG")return a(this,pe).has(t.id)?a(this,pe).get(t.id).visible:(Mt(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return b(this,Gp,y2).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(let e of t.ids){if(!a(this,pe).has(e))return Mt(`Optional content group not found: ${e}`),!0;if(a(this,pe).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(let e of t.ids){if(!a(this,pe).has(e))return Mt(`Optional content group not found: ${e}`),!0;if(!a(this,pe).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(let e of t.ids){if(!a(this,pe).has(e))return Mt(`Optional content group not found: ${e}`),!0;if(!a(this,pe).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(let e of t.ids){if(!a(this,pe).has(e))return Mt(`Optional content group not found: ${e}`),!0;if(a(this,pe).get(e).visible)return!1}return!0}return Mt(`Unknown optional content policy ${t.policy}.`),!0}return Mt(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,i=!0){let n=a(this,pe).get(t);if(!n){Mt(`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,pe).get(o)?._setVisible(Su,!1,!0);n._setVisible(Su,!!e,!0),p(this,fo,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,pe).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,fo,null)}get hasInitialVisibility(){return a(this,bh)===null||this.getHash()===a(this,bh)}getOrder(){return a(this,pe).size?a(this,wh)?a(this,wh).slice():[...a(this,pe).keys()]:null}getGroup(t){return a(this,pe).get(t)||null}getHash(){if(a(this,fo)!==null)return a(this,fo);let t=new R0;for(let[e,i]of a(this,pe))t.update(`${e}:${i.visible}`);return p(this,fo,t.hexdigest())}[Symbol.iterator](){return a(this,pe).entries()}};fo=new WeakMap,pe=new WeakMap,bh=new WeakMap,wh=new WeakMap,Gp=new WeakSet,y2=function(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let n=1;nf===m+1)&&p(this,We,null)}deletePages(t){b(this,zi,yf).call(this);let e=a(this,We),i=b(this,zi,bf).call(this);p(this,hs,{pageNumberToId:e.slice(),pagesNumber:a(this,Si),prevPageNumbers:a(this,Sr).slice()});let n=a(this,Si)-t.length;p(this,Si,n);let s=p(this,We,new Uint32Array(n));p(this,Sr,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}oa(this,We)[e-1])})}cancelCopy(){p(this,Vl,null)}pastePages(t){b(this,zi,yf).call(this);let e=a(this,We),i=b(this,zi,bf).call(this),{pageNumbers:n,pageIds:s}=a(this,Vl),o=a(this,Si)+n.length;p(this,Si,o);let l=p(this,We,new Uint32Array(o));p(this,Sr,new Int32Array(o)),l.set(e.subarray(0,t),0),l.set(s,t),l.set(e.subarray(t),t+n.length),b(this,zi,s0).call(this,i,null,t,n),p(this,Vl,null)}hasBeenAltered(){return a(this,We)!==null}getPageMappingForSaving(t=null){t??(t=b(this,zi,bf).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;no[0]-l[0]);for(let o=0,l=n.length;oi-n);let e=new Map;for(let i=0,n=t.length;i=i&&u({...Promise.withResolvers(),data:Du}),$0=class{constructor(){x(this,lr,new Map)}get(t,e=null){if(e){let n=a(this,lr).getOrInsertComputed(t,bC);return n.promise.then(()=>e(n.data)),null}let i=a(this,lr).get(t);if(!i||i.data===Du)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){let e=a(this,lr).get(t);return!!e&&e.data!==Du}delete(t){let e=a(this,lr).get(t);return!e||e.data===Du?!1:(a(this,lr).delete(t),!0)}resolve(t,e=null){let i=a(this,lr).getOrInsertComputed(t,bC);if(i.data!==Du)throw new Error(`Object already resolved ${t}.`);i.data=e,i.resolve()}clear(){for(let{data:t}of a(this,lr).values())t?.bitmap?.close();a(this,lr).clear()}*[Symbol.iterator](){for(let[t,{data:e}]of a(this,lr))e!==Du&&(yield[t,e])}};lr=new WeakMap;AM=1e5,wC=30,vi=class vi{constructor({textContentSource:t,images:e,container:i,viewport:n}){x(this,Na);x(this,po,Promise.withResolvers());x(this,Wi,null);x(this,$p,!1);x(this,Vp,!!globalThis.FontInspector?.enabled);x(this,Ah,null);x(this,ql,null);x(this,aa,null);x(this,qp,0);x(this,Wp,0);x(this,Wl,null);x(this,Xp,null);x(this,vh,0);x(this,mo,0);x(this,Eh,Object.create(null));x(this,Yp,[]);x(this,Ch,null);x(this,Xl,[]);x(this,Kp,new WeakMap);x(this,Zp,null);var u;if(t instanceof ReadableStream)p(this,Ch,t);else if(typeof t=="object")p(this,Ch,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');p(this,Wi,p(this,Xp,i)),p(this,Ah,e),p(this,mo,n.scale*Es.pixelRatio),p(this,vh,n.rotation),p(this,aa,{div:null,properties:null,ctx:null});let{pageWidth:s,pageHeight:o,pageX:l,pageY:c}=n.rawDims;p(this,Zp,[1,0,0,-1,-l,c+o]),p(this,Wp,s),p(this,qp,o),b(u=vi,jn,PT).call(u),i.style.setProperty("--min-font-size",a(vi,Sh)),Ro(i,n),a(this,po).promise.finally(()=>{a(vi,Dh).delete(this),p(this,aa,null),p(this,Eh,null)}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=Be.platform;return _t(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){a(this,Ah)&&a(this,Wi).append(a(this,Ah).render());let t=()=>{a(this,Wl).read().then(({value:e,done:i})=>{if(i){a(this,po).resolve();return}a(this,ql)??p(this,ql,e.lang),Object.assign(a(this,Eh),e.styles),b(this,Na,MT).call(this,e.items),t()},a(this,po).reject)};return p(this,Wl,a(this,Ch).getReader()),a(vi,Dh).add(this),t(),a(this,po).promise}update({viewport:t,onBefore:e=null}){var s;let i=t.scale*Es.pixelRatio,n=t.rotation;if(n!==a(this,vh)&&(e?.(),p(this,vh,n),Ro(a(this,Xp),{rotation:n})),i!==a(this,mo)){e?.(),p(this,mo,i);let o={div:null,properties:null,ctx:b(s=vi,jn,a0).call(s,a(this,ql))};for(let l of a(this,Xl))o.properties=a(this,Kp).get(l),o.div=l,b(this,Na,w2).call(this,o)}}cancel(){let t=new Lr("TextLayer task cancelled.");a(this,Wl)?.cancel(t).catch(()=>{}),p(this,Wl,null),a(this,po).reject(t)}get textDivs(){return a(this,Xl)}get textContentItemsStr(){return a(this,Yp)}static cleanup(){if(!(a(this,Dh).size>0)){a(this,Th).clear();for(let{canvas:t}of a(this,Yl).values())t.remove();a(this,Yl).clear()}}};po=new WeakMap,Wi=new WeakMap,$p=new WeakMap,Vp=new WeakMap,Ah=new WeakMap,ql=new WeakMap,aa=new WeakMap,qp=new WeakMap,Wp=new WeakMap,Wl=new WeakMap,Xp=new WeakMap,vh=new WeakMap,mo=new WeakMap,Eh=new WeakMap,Yp=new WeakMap,Ch=new WeakMap,Xl=new WeakMap,Kp=new WeakMap,Zp=new WeakMap,Th=new WeakMap,Yl=new WeakMap,Qp=new WeakMap,Sh=new WeakMap,Dh=new WeakMap,Na=new WeakSet,MT=function(t){var n,s;if(a(this,$p))return;(s=a(this,aa)).ctx??(s.ctx=b(n=vi,jn,a0).call(n,a(this,ql)));let e=a(this,Xl),i=a(this,Yp);for(let o of t){if(e.length>AM){Mt("Ignoring additional textDivs for performance reasons."),p(this,$p,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){let l=a(this,Wi);p(this,Wi,document.createElement("span")),a(this,Wi).classList.add("markedContent"),o.id&&a(this,Wi).setAttribute("id",`${o.id}`),o.tag==="Artifact"&&(a(this,Wi).ariaHidden=!0),l.append(a(this,Wi))}else o.type==="endMarkedContent"&&p(this,Wi,a(this,Wi).parentNode);continue}i.push(o.str),b(this,Na,FT).call(this,o)}},FT=function(t){var y;let e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};a(this,Xl).push(e);let n=ht.transform(a(this,Zp),t.transform),s=Math.atan2(n[1],n[0]),o=a(this,Eh)[t.fontName];o.vertical&&(s+=Math.PI/2);let l=a(this,Vp)&&o.fontSubstitution||o.fontFamily;l=vi.fontFamilyMap.get(l)||l;let c=Math.hypot(n[2],n[3]),u=c*b(y=vi,jn,OT).call(y,l,o,a(this,ql)),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,Wp)).toFixed(2)}%`,f.top=`${(100*d/a(this,qp)).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,Vp)&&(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 g=Math.abs(t.transform[0]),A=Math.abs(t.transform[3]);g!==A&&Math.max(g,A)/Math.min(g,A)>1.5&&(m=!0)}if(m&&(i.canvasWidth=o.vertical?t.height:t.width),a(this,Kp).set(e,i),a(this,aa).div=e,a(this,aa).properties=i,b(this,Na,w2).call(this,a(this,aa)),i.hasText&&a(this,Wi).append(e),i.hasEOL){let g=document.createElement("br");g.setAttribute("role","presentation"),a(this,Wi).append(g)}},w2=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=vi,jn,A2).call(o,n,u*a(this,mo),l);let{width:h}=n.measureText(e.textContent);h>0&&s.setProperty("--scale-x",c*a(this,mo)/h)}i.angle!==0&&s.setProperty("--rotate",`${i.angle}deg`)},jn=new WeakSet,a0=function(t=null){let e=a(this,Yl).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,Yl).set(t,e),a(this,Qp).set(e,{size:0,family:""})}return e},A2=function(t,e,i){let n=a(this,Qp).get(t);e===n.size&&i===n.family||(t.font=`${e}px ${i}`,n.size=e,n.family=i)},PT=function(){if(a(this,Sh)!==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,Sh,t.getBoundingClientRect().height),t.remove()},OT=function(t,e,i){let n=a(this,Th).get(t);if(n)return n;let s=b(this,jn,a0).call(this,i);s.canvas.width=s.canvas.height=wC,b(this,jn,A2).call(this,s,wC,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):(Be.platform.isFirefox&&Mt("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,Th).set(t,u),u},x(vi,jn),x(vi,Th,new Map),x(vi,Yl,new Map),x(vi,Qp,new WeakMap),x(vi,Sh,null),x(vi,Dh,new Set);gd=vi,vM=100;Ax=class Ax{constructor(){z(this,"_capability",Promise.withResolvers());z(this,"_transport",null);z(this,"_worker",null);z(this,"docId",`d${Ye(Ax,wx)._++}`);z(this,"destroyed",!1);z(this,"onPassword",null);z(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()}};wx=new WeakMap,x(Ax,wx,0);v2=Ax,Gf=class{constructor(t,e,i=!1,n=null){x(this,Ih,Promise.withResolvers());x(this,Jp,[]);x(this,tm,[]);x(this,em,[]);this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=n,Object.defineProperty(this,"onDataProgress",{value:()=>{tM("`PDFDataRangeTransport.prototype.onDataProgress` - method was removed, since loading progress is now reported automatically through the `PDFDataTransportStream` class (and related code).")}})}addRangeListener(t){a(this,em).push(t)}addProgressiveReadListener(t){a(this,tm).push(t)}addProgressiveDoneListener(t){a(this,Jp).push(t)}onDataRange(t,e){for(let i of a(this,em))i(t,e)}onDataProgressiveRead(t){a(this,Ih).promise.then(()=>{for(let e of a(this,tm))e(t)})}onDataProgressiveDone(){a(this,Ih).promise.then(()=>{for(let t of a(this,Jp))t()})}transportReady(){a(this,Ih).resolve()}requestDataRange(t,e){ie("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};Ih=new WeakMap,Jp=new WeakMap,tm=new WeakMap,em=new WeakMap;E2=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 _t(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()}},Uw=class Uw{constructor(t,e,i,n,s=!1){x(this,Zl);x(this,oa,!1);x(this,Kl,null);this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new M0:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new $0,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,p(this,Kl,n),this.imageCoordinates=null}clone(t){let e=new Uw(t,this._pageInfo,this._transport,a(this,Kl),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 Bf({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 _t(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=Ea.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:y=!1,operationsFilter:g=null}){this._stats?.time("Overall");let A=this._transport.getRenderingIntent(n,s,d,f),{renderingIntent:w,cacheKey:v}=A;p(this,oa,!1),c||(c=this._transport.getOptionalContentConfig(w));let T=this._intentStates.getOrInsertComputed(v,N0);T.streamReaderCancelTimeout&&(clearTimeout(T.streamReaderCancelTimeout),T.streamReaderCancelTimeout=null);let k=!!(w&Ln.PRINT);T.displayReadyCapability||(T.displayReadyCapability=Promise.withResolvers(),T.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(A));let N=!!(this._pdfBug&&globalThis.StepperManager?.enabled),F=!!e&&!this.recordedBBoxes&&(y||N),L=!!e&&!this.imageCoordinates&&m,Y=et=>{if(T.renderTasks.delete(j),F){let _=j.gfx?.dependencyTracker.take();_&&(j.stepper?.setOperatorBBoxes(_,j.gfx.dependencyTracker.takeDebugMetadata()),y&&(this.recordedBBoxes=_))}L&&!et&&(this.imageCoordinates=j.gfx?.imagesTracker.take()),k&&p(this,oa,!0),b(this,Zl,wf).call(this),et?(j.capability.reject(et),this._abortOperatorList({intentState:T,reason:et instanceof Error?et:new Error(et)})):j.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},q=null,G=null;(F||L)&&(G=new Sb(e,T.operatorList.length)),F&&(q=new Ib(G,N));let j=new D2({callback:Y,params:{canvas:e,canvasContext:t,dependencyTracker:q??G,imagesTracker:L?new kb(e):null,viewport:i,transform:o,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:T.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!k,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:g});(T.renderTasks||(T.renderTasks=new Set)).add(j);let tt=j.task;return Promise.all([T.displayReadyCapability.promise,c]).then(([et,_])=>{if(this.destroyed){Y();return}if(this._stats?.time("Rendering"),!(_.renderingIntent&w))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");j.initializeGraphics({transparency:et,optionalContentConfig:_}),j.operatorListChanged()}).catch(Y),tt}getOperatorList({intent:t="display",annotationMode:e=Ea.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,N0),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,Kl).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=>Rf.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,oa,!1),Promise.all(t)}cleanup(t=!1){p(this,oa,!0);let e=b(this,Zl,wf).call(this);return t&&e&&this._stats&&(this._stats=new M0),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{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,Zl,wf).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 dd){let n=vM;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 Lr(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}};oa=new WeakMap,Kl=new WeakMap,Zl=new WeakSet,wf=function(){if(!a(this,oa)||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,oa,!1),!0};C2=Uw,Fe=class Fe{constructor({name:t=null,port:e=null,verbosity:i=qN()}={}){x(this,Zi);x(this,go,Promise.withResolvers());x(this,Dr,null);x(this,la,null);x(this,Ql,null);if(this.name=t,this.destroyed=!1,this.verbosity=i,e){if(a(Fe,tc).has(e))throw new Error("Cannot use more than one PDFWorker per port.");a(Fe,tc).set(e,this),b(this,Zi,LT).call(this,e)}else b(this,Zi,BT).call(this)}get promise(){return a(this,go).promise}get port(){return a(this,la)}get messageHandler(){return a(this,Dr)}destroy(){this.destroyed=!0,a(this,Ql)?.terminate(),p(this,Ql,null),a(Fe,tc).delete(a(this,la)),p(this,la,null),a(this,Dr)?.destroy(),p(this,Dr,null)}static create(t){let e=a(this,tc).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 Fe(t)}static get workerSrc(){if(dr.workerSrc)return dr.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return _t(this,"_setupFakeWorkerGlobal",(async()=>a(this,kh,l0)?a(this,kh,l0):(await import(/* @vite-ignore */ this.workerSrc)).WorkerMessageHandler)())}};go=new WeakMap,Dr=new WeakMap,la=new WeakMap,Ql=new WeakMap,vx=new WeakMap,Jl=new WeakMap,tc=new WeakMap,Zi=new WeakSet,o0=function(){a(this,go).resolve(),a(this,Dr).send("configure",{verbosity:this.verbosity})},LT=function(t){p(this,la,t),p(this,Dr,new hl("main","worker",t)),a(this,Dr).on("ready",()=>{}),b(this,Zi,o0).call(this)},BT=function(){if(a(Fe,Jl)||a(Fe,kh,l0)){b(this,Zi,Af).call(this);return}let{workerSrc:t}=Fe;try{Fe._isSameOrigin(window.location,t)||(t=Fe._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new hl("main","worker",e),n=()=>{s.abort(),i.destroy(),e.terminate(),this.destroyed?a(this,go).reject(new Error("Worker was destroyed")):b(this,Zi,Af).call(this)},s=new AbortController;e.addEventListener("error",()=>{a(this,Ql)||n()},{signal:s.signal}),i.on("test",l=>{if(s.abort(),this.destroyed||!l){n();return}p(this,Dr,i),p(this,la,e),p(this,Ql,e),b(this,Zi,o0).call(this)}),i.on("ready",l=>{if(s.abort(),this.destroyed){n();return}try{o()}catch{b(this,Zi,Af).call(this)}});let o=()=>{let l=new Uint8Array;i.send("test",l,[l.buffer])};o();return}catch{Mx("The worker has been disabled.")}b(this,Zi,Af).call(this)},Af=function(){a(Fe,Jl)||(Mt("Setting up fake worker."),p(Fe,Jl,!0)),Fe._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){a(this,go).reject(new Error("Worker was destroyed"));return}let e=new Ub;p(this,la,e);let i=`fake${Ye(Fe,vx)._++}`,n=new hl(i+"_worker",i,e);t.setup(n,e),p(this,Dr,new hl(i,i+"_worker",e)),b(this,Zi,o0).call(this)}).catch(t=>{a(this,go).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},kh=new WeakSet,l0=function(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}},x(Fe,kh),x(Fe,vx,0),x(Fe,Jl,!1),x(Fe,tc,new WeakMap),Bn&&(p(Fe,Jl,!0),dr.workerSrc||(dr.workerSrc="./pdf.worker.mjs")),Fe._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},Fe._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};xd=Fe,T2=class{constructor(t,e,i,n,s,o){x(this,Rr);z(this,"downloadInfoCapability",Promise.withResolvers());x(this,En,null);x(this,ec,new Map);x(this,ca,null);x(this,Ir,new Map);x(this,ic,new Map);x(this,_h,new Map);x(this,ua,null);this.messageHandler=t,this.loadingTask=e,p(this,ca,i),this.commonObjs=new $0,this.fontLoader=new _b({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,Ir).set(e,t),a(this,ic).set(e,Promise.resolve(t))}get annotationStorage(){return _t(this,"annotationStorage",new jf)}getRenderingIntent(t,e=Ea.ENABLE,i=null,n=!1,s=!1){let o=Ln.DISPLAY,l=zf;switch(t){case"any":o=Ln.ANY;break;case"display":break;case"print":o=Ln.PRINT;break;default:Mt(`getRenderingIntent - invalid intent: ${t}`)}let c=o&Ln.PRINT&&i instanceof L0?i:this.annotationStorage;switch(e){case Ea.DISABLE:o+=Ln.ANNOTATIONS_DISABLE;break;case Ea.ENABLE:break;case Ea.ENABLE_FORMS:o+=Ln.ANNOTATIONS_FORMS;break;case Ea.ENABLE_STORAGE:o+=Ln.ANNOTATIONS_STORAGE,l=c.serializable;break;default:Mt(`getRenderingIntent - invalid annotationMode: ${e}`)}n&&(o+=Ln.IS_EDITING),s&&(o+=Ln.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,ua)?.reject(new Error("Worker was destroyed during onPassword callback"));let t=[];for(let i of a(this,Ir).values())t.push(i._destroy());a(this,Ir).clear(),a(this,ic).clear(),a(this,_h).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,ec).clear(),this.filterFactory.destroy(),gd.cleanup(),a(this,ca)?.cancelAllRequests(new Lr("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)=>{_e(a(this,ca),"GetReader - no `BasePDFStream` instance available."),p(this,En,a(this,ca).getFullReader()),a(this,En).onProgress=s=>b(this,Rr,c0).call(this,s),n.onPull=()=>{a(this,En).read().then(function({value:s,done:o}){if(o){n.close();return}_e(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{n.error(s)})},n.onCancel=s=>{a(this,En).cancel(s),n.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("ReaderHeadersReady",async i=>{await a(this,En).headersReady;let{isStreamingSupported:n,isRangeSupported:s,contentLength:o}=a(this,En);return n&&s&&(a(this,En).onProgress=null),{isStreamingSupported:n,isRangeSupported:s,contentLength:o}}),t.on("GetRangeReader",(i,n)=>{_e(a(this,ca),"GetRangeReader - no `BasePDFStream` instance available.");let s=a(this,ca).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}_e(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 E2(i,this))}),t.on("DocException",i=>{e._capability.reject(on(i))}),t.on("PasswordRequest",i=>{p(this,ua,Promise.withResolvers());try{if(!e.onPassword)throw on(i);let n=s=>{s instanceof Error?a(this,ua).reject(s):a(this,ua).resolve({password:s})};e.onPassword(n,i.code)}catch(n){a(this,ua).reject(n)}return a(this,ua).promise}),t.on("DataLoaded",i=>{b(this,Rr,c0).call(this,{loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)}),t.on("StartRenderPage",i=>{if(this.destroyed)return;a(this,Ir).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;Mt(`Error during font loading: ${d}`),this.commonObjs.resolve(i,d);break}let o=new Pb(s),l=this._params.pdfBug&&globalThis.FontInspector?.enabled?(d,f)=>globalThis.FontInspector.fontAdded(d,f):null,c=new Nb(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;_e(u,"The imageRef must be defined.");for(let d of a(this,Ir).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 Lb(s));break;case"Image":this.commonObjs.resolve(i,s);break;case"Pattern":let h=new Rb(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,Ir).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,Rr,c0).call(this,i)}),t.on("PrepareWebGPU",()=>{this.destroyed||oM()}),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&&Mt("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,En)?.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,ic).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,_h).set(o.refStr,i);let l=new C2(e,o,this,this.pagesMapper,this._params.pdfBug);return a(this,Ir).set(e,l),l});return a(this,ic).set(e,s),s}async getPageIndex(t){if(!Bb(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,Rr,vf).call(this,"GetFieldObjects")}hasJSActions(){return b(this,Rr,vf).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,Rr,vf).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,Rr,vf).call(this,"GetOptionalContentConfig").then(e=>new x2(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata";return a(this,ec).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(e=>({info:e[0],metadata:e[1]?new m2(e[1]):null,contentDispositionFilename:a(this,En)?.filename??null,contentLength:a(this,En)?.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,Ir).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),a(this,ec).clear(),this.filterFactory.destroy(!0),gd.cleanup()}}cachedPageNumber(t){if(!Bb(t))return null;let e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,i=a(this,_h).get(e);if(i>=0){let n=this.pagesMapper.getPageNumber(i+1);if(n!==0)return n}return null}};En=new WeakMap,ec=new WeakMap,ca=new WeakMap,Ir=new WeakMap,ic=new WeakMap,_h=new WeakMap,ua=new WeakMap,Rr=new WeakSet,vf=function(t,e=null){return a(this,ec).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))},c0=function({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:e?ai(Math.round(t/e*100),0,100):NaN})};S2=class{constructor(t){z(this,"_internalRenderTask",null);z(this,"onContinue",null);z(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}},ll=class ll{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:y=null}){x(this,xo,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 S2(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=y}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(a(ll,nc).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(ll,nc).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 Ou(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,xo)&&(window.cancelAnimationFrame(a(this,xo)),p(this,xo,null)),a(ll,nc).delete(this._canvas),t||(t=new dd(`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,xo,window.requestAnimationFrame(()=>{p(this,xo,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(ll,nc).delete(this._canvas),this.callback())))}};xo=new WeakMap,nc=new WeakMap,x(ll,nc,new WeakSet);D2=ll,UT="5.6.205",zT="ada343803",ln=class ln{constructor({editor:t=null,uiManager:e=null}){x(this,me);x(this,Cn,null);x(this,rc,null);x(this,Nh);x(this,si,null);x(this,im,!1);x(this,Mh,!1);x(this,ha,null);x(this,nm);x(this,yo,null);x(this,kr,null);t?(p(this,Mh,!1),p(this,ha,t)):p(this,Mh,!0),p(this,kr,t?._uiManager||e),p(this,nm,a(this,kr)._eventBus),p(this,Nh,t?.color?.toUpperCase()||a(this,kr)?.highlightColors.values().next().value||"#FFFF98"),a(ln,rm)||p(ln,rm,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 _t(this,"_keyboardManager",new Fc([[["Escape","mac+Escape"],ln.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],ln.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],ln.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],ln.prototype._moveToPrevious],[["Home","mac+Home"],ln.prototype._moveToBeginning],[["End","mac+End"],ln.prototype._moveToEnd]]))}renderButton(){let t=p(this,Cn,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",a(this,ha)&&(t.ariaControls=`${a(this,ha).id}_colorpicker_dropdown`);let e=a(this,kr)._signal;t.addEventListener("click",b(this,me,rl).bind(this),{signal:e}),t.addEventListener("keydown",b(this,me,_2).bind(this),{signal:e});let i=p(this,rc,document.createElement("span"));return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=a(this,Nh),t.append(i),t}renderMainDropdown(){let t=p(this,si,b(this,me,I2).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===a(this,Cn)){b(this,me,rl).call(this,t);return}let e=t.target.getAttribute("data-color");e&&b(this,me,k2).call(this,e,t)}_moveToNext(t){if(!a(this,me,za)){b(this,me,rl).call(this,t);return}if(t.target===a(this,Cn)){a(this,si).firstElementChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===a(this,si)?.firstElementChild||t.target===a(this,Cn)){a(this,me,za)&&this._hideDropdownFromKeyboard();return}a(this,me,za)||b(this,me,rl).call(this,t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!a(this,me,za)){b(this,me,rl).call(this,t);return}a(this,si).firstElementChild?.focus()}_moveToEnd(t){if(!a(this,me,za)){b(this,me,rl).call(this,t);return}a(this,si).lastElementChild?.focus()}hideDropdown(){a(this,si)?.classList.add("hidden"),a(this,Cn).ariaExpanded="false",a(this,yo)?.abort(),p(this,yo,null)}_hideDropdownFromKeyboard(){if(!a(this,Mh)){if(!a(this,me,za)){a(this,ha)?.unselect();return}this.hideDropdown(),a(this,Cn).focus({preventScroll:!0,focusVisible:a(this,im)})}}updateColor(t){if(a(this,rc)&&(a(this,rc).style.backgroundColor=t),!a(this,si))return;let e=a(this,kr).highlightColors.values();for(let i of a(this,si).children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){a(this,Cn)?.remove(),p(this,Cn,null),p(this,rc,null),a(this,si)?.remove(),p(this,si,null)}};Cn=new WeakMap,rc=new WeakMap,Nh=new WeakMap,si=new WeakMap,im=new WeakMap,Mh=new WeakMap,ha=new WeakMap,nm=new WeakMap,yo=new WeakMap,kr=new WeakMap,rm=new WeakMap,me=new WeakSet,I2=function(){let t=document.createElement("div"),e=a(this,kr)._signal;t.addEventListener("contextmenu",Hn,{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,ha)&&(t.id=`${a(this,ha).id}_colorpicker_dropdown`);for(let[i,n]of a(this,kr).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(ln,rm)[i]);let o=document.createElement("span");s.append(o),o.className="swatch",o.style.backgroundColor=n,s.ariaSelected=n===a(this,Nh),s.addEventListener("click",b(this,me,k2).bind(this,n),{signal:e}),t.append(s)}return t.addEventListener("keydown",b(this,me,_2).bind(this),{signal:e}),t},k2=function(t,e){e.stopPropagation(),a(this,nm).dispatch("switchannotationeditorparams",{source:this,type:Ht.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)},_2=function(t){ln._keyboardManager.exec(this,t)},rl=function(t){if(a(this,me,za)){this.hideDropdown();return}if(p(this,im,t.detail===0),a(this,yo)||(p(this,yo,new AbortController),window.addEventListener("pointerdown",b(this,me,jT).bind(this),{signal:a(this,kr).combinedSignal(a(this,yo))})),a(this,Cn).ariaExpanded="true",a(this,si)){a(this,si).classList.remove("hidden");return}let e=p(this,si,b(this,me,I2).call(this));a(this,Cn).append(e)},jT=function(t){a(this,si)?.contains(t.target)||this.hideDropdown()},za=function(){return a(this,si)&&!a(this,si).classList.contains("hidden")},x(ln,rm,null);$f=ln,cl=class cl{constructor(t){x(this,ds,null);x(this,sm,null);x(this,Fh,null);p(this,sm,t),p(this,Fh,t._uiManager),a(cl,am)||p(cl,am,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(a(this,ds))return a(this,ds);let{editorType:t,colorType:e,color:i}=a(this,sm),n=p(this,ds,document.createElement("input"));return n.type="color",n.value=i||"#000000",n.className="basicColorPicker",n.tabIndex=0,n.setAttribute("data-l10n-id",a(cl,am)[t]),n.addEventListener("input",()=>{a(this,Fh).updateParams(e,n.value)},{signal:a(this,Fh)._signal}),n}update(t){a(this,ds)&&(a(this,ds).value=t)}destroy(){a(this,ds)?.remove(),p(this,ds,null)}hideDropdown(){}};ds=new WeakMap,sm=new WeakMap,Fh=new WeakMap,am=new WeakMap,x(cl,am,null);V0=cl;q0=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=sf(t),[t,t,t]}static G_HTML([t]){let e=AC(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(sf)}static RGB_HTML(t){return`#${t.map(AC).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[sf(1-Math.min(1,t+n)),sf(1-Math.min(1,i+n)),sf(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]}},N2=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){ie("Abstract method `_createSVG` called.")}},Pc=class extends N2{_createSVG(t){return document.createElementNS(Us,t)}},EM=9,Oc=new WeakSet,CM=new Date().getTimezoneOffset()*60*1e3,Mf=class{static create(t){switch(t.data.annotationType){case $e.LINK:return new Vf(t);case $e.TEXT:return new P2(t);case $e.WIDGET:switch(t.data.fieldType){case"Tx":return new O2(t);case"Btn":return t.data.radioButton?new W0(t):t.data.checkBox?new L2(t):new B2(t);case"Ch":return new U2(t);case"Sig":return new R2(t)}return new Ia(t);case $e.POPUP:return new qf(t);case $e.FREETEXT:return new X0(t);case $e.LINE:return new W2(t);case $e.SQUARE:return new X2(t);case $e.CIRCLE:return new Y2(t);case $e.POLYLINE:return new Y0(t);case $e.CARET:return new Z2(t);case $e.INK:return new Wf(t);case $e.POLYGON:return new K2(t);case $e.HIGHLIGHT:return new K0(t);case $e.UNDERLINE:return new J2(t);case $e.SQUIGGLY:return new tw(t);case $e.STRIKEOUT:return new ew(t);case $e.STAMP:return new Z0(t);case $e.FILEATTACHMENT:return new iw(t);default:return new Ne(t)}}},zw=class zw{constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}={}){x(this,om);x(this,sc,null);x(this,Ph,!1);x(this,cr,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 zw._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;lo?(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;co?(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(`${Of}${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(`${Of}${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,cr)?.popup||this.popup)?.remove(),p(this,cr,this.popup=null)}updateEdited(t){if(!this.container)return;t.rect&&(a(this,sc)||p(this,sc,{rect:this.data.rect.slice(0)}));let{rect:e,popup:i}=t;e&&b(this,om,M2).call(this,e);let n=a(this,cr)?.popup||this.popup;!n&&i?.text&&(this._createPopup(i),n=a(this,cr).popup),n&&(n.updateEdited(t),i?.deleted&&(n.remove(),p(this,cr,null),this.popup=null))}resetEdited(){a(this,sc)&&(b(this,om,M2).call(this,a(this,sc).rect),a(this,cr)?.popup.resetEdited(),p(this,sc,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 Ia)&&!(this instanceof Vf)&&(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 qf){let{rotation:g}=e;return!e.hasOwnCanvas&&g!==0&&this.setRotation(g,s),s}let{width:l,height:c}=this;if(!t&&e.borderStyle.width>0){o.borderWidth=`${e.borderStyle.width}px`;let g=e.borderStyle.horizontalCornerRadius,A=e.borderStyle.verticalCornerRadius;if(g>0||A>0){let v=`calc(${g}px * var(--total-scale-factor)) / calc(${A}px * var(--total-scale-factor))`;o.borderRadius=v}else if(this instanceof W0){let v=`calc(${l}px * var(--total-scale-factor)) / calc(${c}px * var(--total-scale-factor))`;o.borderRadius=v}switch(e.borderStyle.style){case Au.SOLID:o.borderStyle="solid";break;case Au.DASHED:o.borderStyle="dashed";break;case Au.BEVELED:Mt("Unimplemented border style: beveled");break;case Au.INSET:Mt("Unimplemented border style: inset");break;case Au.UNDERLINE:o.borderBottomStyle="solid";break;default:break}let w=e.borderColor||null;w?(p(this,Ph,!0),o.borderColor=ht.makeHexColor(w[0]|0,w[1]|0,w[2]|0)):o.borderWidth=0}let u=ht.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:y}=e;return e.hasOwnCanvas||y===0?(o.width=`${100*l/h}%`,o.height=`${100*c/d}%`):this.setRotation(y,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]=q0[`${o}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[i]:q0[`${o}_rgb`](l)})};return _t(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(g=>Math.fround(g));if(t.length===8){let[g,A,w,v]=t.subarray(2,6);if(n===g&&s===A&&e===w&&i===v)return}let{style:o}=this.container,l;if(a(this,Ph)){let{borderColor:g,borderWidth:A}=o;o.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'',``],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"),y=`clippath_${this.data.id}`;m.setAttribute("id",y),m.setAttribute("clipPathUnits","objectBoundingBox"),f.append(m);for(let g=2,A=t.length;g`)}a(this,Ph)&&(l.push("')"),o.backgroundImage=l.join("")),this.container.append(d),this.container.style.clipPath=`url(#${y})`}_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,cr,new qf({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,cr)||this.popup||this.data.popupRef)}get extraPopupElement(){return a(this,cr)}render(){ie("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&&!Oc.has(u)){Mt(`_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&&Oc.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]}};sc=new WeakMap,Ph=new WeakMap,cr=new WeakMap,om=new WeakSet,M2=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)};Ne=zw,F2=class extends Ne{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()}},Vf=class extends Ne{constructor(e,i=null){super(e,{isRenderable:!0,ignoreBorder:!!i?.ignoreBorder,createQuadrilaterals:!0});x(this,zn);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,zn,HT).call(this,n,e.attachment,e.overlaidText,e.attachmentDest),s=!0):e.setOCGState?(b(this,zn,GT).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,zn,sl).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,zn,sl).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,zn,sl).call(this)}_bindResetFormAction(e,i){let n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl("")),b(this,zn,sl).call(this),!this._fieldObjects){Mt('_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:y}of m)d.add(y)}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 y=d.defaultValue||"";u.setValue(f,{value:y});break}case"checkbox":case"radiobutton":{let y=d.defaultValue===d.exportValues;u.setValue(f,{value:y});break}case"combobox":case"listbox":{let y=d.defaultValue||"";u.setValue(f,{value:y});break}default:continue}let m=document.querySelector(`[data-element-id="${f}"]`);if(m){if(!Oc.has(m)){Mt(`_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}}};zn=new WeakSet,sl=function(){this.container.setAttribute("data-internal-link","")},HT=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,zn,sl).call(this)},GT=function(e,i,n=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(i),!1),n&&(e.title=n),b(this,zn,sl).call(this)};P2=class extends Ne{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}},Ia=class extends Ne{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Be.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":ht.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||EM,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/($g*n))||1,d=u/h;o=Math.min(n,c(d/$g))}else{let u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);o=Math.min(n,c(u/$g))}s.fontSize=`calc(${o}px * var(--total-scale-factor))`,s.color=ht.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)}},O2=class extends Ia{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(` -`)||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),Oc.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",y=>{t.setValue(e,{value:y.target.value}),this.setPropertyOnSiblings(i,"value",y.target.value,"value"),c.formattedValue=null}),i.addEventListener("resetform",y=>{let g=this.data.defaultFieldValue??"";i.value=c.userValue=g,c.formattedValue=null});let m=y=>{let{formattedValue:g}=c;g!=null&&(y.target.value=g),y.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",g=>{if(c.focused)return;let{target:A}=g;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),T=[v.getHours(),v.getMinutes(),v.getSeconds()];A.value=T.map(k=>k.toString().padStart(2,"0")).join(":")}else A.value=new Date(w-CM).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",g=>{this.showElementAndHideCanvas(g.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 T={formattedValue:v};f&&(T.value=v),t.setValue(e,T)},selRange(w){w.target.setSelectionRange(...w.detail.selRange)},charLimit:w=>{let{charLimit:v}=w.detail,{target:T}=w;if(v===0){T.removeAttribute("maxLength");return}T.setAttribute("maxLength",v);let k=c.userValue;!k||k.length<=v||(k=k.slice(0,v),T.value=c.userValue=k,t.setValue(e,{value:k}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:k,willCommit:!0,commitKey:1,selStart:T.selectionStart,selEnd:T.selectionEnd}}))}};this._dispatchEventFromSandbox(A,g)}),i.addEventListener("keydown",g=>{c.commitKey=1;let A=-1;if(g.key==="Escape"?A=0:g.key==="Enter"&&!this.data.multiLine?A=2:g.key==="Tab"&&(c.commitKey=3),A===-1)return;let{value:w}=g.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:g.target.selectionStart,selEnd:g.target.selectionEnd}}))});let y=m;m=null,i.addEventListener("blur",g=>{if(!c.focused||!g.relatedTarget)return;this.data.actions?.Blur||(c.focused=!1);let{target:A}=g,{value:w}=A;if(f){if(w&&h==="time"){let v=w.split(":").map(T=>parseInt(T,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:g.target.selectionStart,selEnd:g.target.selectionEnd}}),y(g)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",g=>{c.lastCommittedValue=null;let{data:A,target:w}=g,{value:v,selectionStart:T,selectionEnd:k}=w,N=T,F=k;switch(g.inputType){case"deleteWordBackward":{let L=v.substring(0,T).match(/\w*[^\w]*$/);L&&(N-=L[0].length);break}case"deleteWordForward":{let L=v.substring(T).match(/^[^\w]*\w*/);L&&(F+=L[0].length);break}case"deleteContentBackward":T===k&&(N-=1);break;case"deleteContentForward":T===k&&(F+=1);break}g.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:v,change:A||"",willCommit:!1,selStart:N,selEnd:F}})}),this._setEventListeners(i,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],g=>g.target.value)}if(m&&i.addEventListener("blur",m),this.data.comb){let g=(this.data.rect[2]-this.data.rect[0])/o;i.classList.add("comb"),i.style.letterSpacing=`calc(${g}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}},R2=class extends Ia{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}},L2=class extends Ia{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 Oc.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}},W0=class extends Ia{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(Oc.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}},B2=class extends Vf{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}},U2=class extends Ia{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");Oc.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:y}=n;return y?Array.prototype.filter.call(m,g=>g.selected).map(g=>g[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 y=m.detail.value,g=new Set(Array.isArray(y)?y:[y]);for(let A of n.options)A.selected=g.has(A.value);t.setValue(e,{value:c(!0)}),u=c(!1)},multipleSelection(m){n.multiple=!0},remove(m){let y=n.options,g=m.detail.remove;y[g].selected=!1,n.remove(g),y.length>0&&Array.prototype.findIndex.call(y,w=>w.selected)===-1&&(y[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:y,displayValue:g,exportValue:A}=m.detail.insert,w=n.children[y],v=document.createElement("option");o(v,g),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:y}=m.detail;for(;n.length!==0;)n.remove(0);for(let g of y){let{displayValue:A,exportValue:w}=g,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 y=new Set(m.detail.indices);for(let g of m.target.options)g.selected=y.has(g.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}},qf=class extends Ne{constructor(e){let{data:i,elements:n,parent:s}=e,o=!!s._commentManager;super(e,{isRenderable:!o&&Ne._hasPopupData(i)});x(this,lm);if(this.elements=n,o&&Ne._hasPopupData(i)){let l=this.popup=b(this,lm,z2).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,lm,z2).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=>`${_u}${s}`).join(",")),this.container}};lm=new WeakSet,z2=function(){return new j2({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})};j2=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}){x(this,Ot);x(this,Tn,null);x(this,bo,b(this,Ot,qT).bind(this));x(this,Ex,b(this,Ot,q2).bind(this));x(this,Cx,b(this,Ot,f0).bind(this));x(this,Oh,b(this,Ot,d0).bind(this));x(this,Rh,null);x(this,Re,null);x(this,fs,null);x(this,wo,null);x(this,ac,null);x(this,Lh,null);x(this,Bh,null);x(this,ps,!1);x(this,Sn,null);x(this,da,null);x(this,fa,null);x(this,Le,null);x(this,pa,null);x(this,Ao,null);x(this,cm,null);x(this,ma,null);x(this,Uh,null);x(this,oc,null);x(this,vo,!1);x(this,di,null);x(this,Eo,null);p(this,Re,t),p(this,Uh,n),p(this,fs,o),p(this,ma,l),p(this,Lh,c),p(this,Rh,e),p(this,cm,u),p(this,Bh,h),p(this,ac,i),p(this,Tn,f),p(this,di,i[0]),p(this,wo,Nc.toDateObject(s)),this.trigger=i.flatMap(m=>m.getElementsToTriggerPopup()),f||(b(this,Ot,u0).call(this),a(this,Re).hidden=!0,d&&b(this,Ot,d0).call(this))}renderCommentButton(){if(a(this,Le)){a(this,Le).parentNode||a(this,di).container.after(a(this,Le));return}if(a(this,pa)||b(this,Ot,H2).call(this),!a(this,pa))return;let{signal:t}=p(this,da,new AbortController),e=a(this,di).hasOwnCommentButton,i=()=>{a(this,Tn).toggleCommentPopup(this,!0,void 0,!e)},n=()=>{a(this,Tn).toggleCommentPopup(this,!1,!0,!e)},s=()=>{a(this,Tn).toggleCommentPopup(this,!1,!1)};if(e){p(this,Le,a(this,di).container);for(let o of this.trigger)o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.addEventListener("keydown",a(this,bo),{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,Le,document.createElement("button"));o.className="annotationCommentButton";let l=a(this,di).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,Ot,$2).call(this),b(this,Ot,G2).call(this),o.addEventListener("keydown",a(this,bo),{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,di).commentData;return t?a(this,Lh)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{a(this,Le)?.focus()},0)}getData(){let{richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}=a(this,di).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}}get elementBeforePopup(){return a(this,Le)}get comment(){return a(this,Eo)||p(this,Eo,a(this,di).commentText),a(this,Eo)}set comment(t){t!==this.comment&&(a(this,di).commentText=p(this,Eo,t))}focus(){a(this,di).container?.focus()}get parentBoundingClientRect(){return a(this,di).layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){a(this,Le)&&(a(this,Le).classList.toggle("selected",t),a(this,Le).ariaExpanded=e)}setSelectedCommentButton(t){a(this,Le).classList.toggle("selected",t)}get commentPopupPosition(){if(a(this,Ao))return a(this,Ao);let{x:t,y:e,height:i}=a(this,Le).getBoundingClientRect(),{x:n,y:s,width:o,height:l}=a(this,di).layer.getBoundingClientRect();return[(t-n)/o,(e+i-s)/l]}set commentPopupPosition(t){p(this,Ao,t)}hasDefaultPopupPosition(){return a(this,Ao)===null}get commentButtonPosition(){return a(this,pa)}get commentButtonWidth(){return a(this,Le).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,i]=a(this,Ao)||this.commentButtonPosition.map(u=>u/100),n=this.parentBoundingClientRect,{x:s,y:o,width:l,height:c}=n;a(this,Tn).showDialog(null,this,s+e*l,o+i*c,{...t,parentDimensions:n})}render(){if(a(this,Sn))return;let t=p(this,Sn,document.createElement("div"));if(t.className="popup",a(this,Rh)){let i=t.style.outlineColor=ht.makeHexColor(...a(this,Rh));t.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`}let e=document.createElement("span");if(e.className="header",a(this,Uh)?.str){let i=document.createElement("span");i.className="title",e.append(i),{dir:i.dir,str:i.textContent}=a(this,Uh)}if(t.append(e),a(this,wo)){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,wo).valueOf()})),i.dateTime=a(this,wo).toISOString(),e.append(i)}Fw({html:a(this,Ot,h0)||a(this,fs).str,dir:a(this,fs)?.dir,className:"popupContent"},t),a(this,Re).append(t)}updateEdited({rect:t,popup:e,deleted:i}){if(a(this,Tn)){i?(this.remove(),p(this,Eo,null)):e&&(e.deleted?this.remove():(b(this,Ot,$2).call(this),p(this,Eo,e.text))),t&&(p(this,pa,null),b(this,Ot,H2).call(this),b(this,Ot,G2).call(this));return}if(i||e?.deleted){this.remove();return}b(this,Ot,u0).call(this),a(this,oc)||p(this,oc,{contentsObj:a(this,fs),richText:a(this,ma)}),t&&p(this,fa,null),e&&e.text&&(p(this,ma,b(this,Ot,VT).call(this,e.text)),p(this,wo,Nc.toDateObject(e.date)),p(this,fs,null)),a(this,Sn)?.remove(),p(this,Sn,null)}resetEdited(){a(this,oc)&&({contentsObj:Ye(this,fs)._,richText:Ye(this,ma)._}=a(this,oc),p(this,oc,null),a(this,Sn)?.remove(),p(this,Sn,null),p(this,fa,null))}remove(){if(a(this,da)?.abort(),p(this,da,null),a(this,Sn)?.remove(),p(this,Sn,null),p(this,vo,!1),p(this,ps,!1),a(this,Le)?.remove(),p(this,Le,null),this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}forceHide(){p(this,vo,this.isVisible),a(this,vo)&&(a(this,Re).hidden=!0)}maybeShow(){a(this,Tn)||(b(this,Ot,u0).call(this),a(this,vo)&&(a(this,Sn)||b(this,Ot,f0).call(this),p(this,vo,!1),a(this,Re).hidden=!1))}get isVisible(){return a(this,Tn)?!1:a(this,Re).hidden===!1}};Tn=new WeakMap,bo=new WeakMap,Ex=new WeakMap,Cx=new WeakMap,Oh=new WeakMap,Rh=new WeakMap,Re=new WeakMap,fs=new WeakMap,wo=new WeakMap,ac=new WeakMap,Lh=new WeakMap,Bh=new WeakMap,ps=new WeakMap,Sn=new WeakMap,da=new WeakMap,fa=new WeakMap,Le=new WeakMap,pa=new WeakMap,Ao=new WeakMap,cm=new WeakMap,ma=new WeakMap,Uh=new WeakMap,oc=new WeakMap,vo=new WeakMap,di=new WeakMap,Eo=new WeakMap,Ot=new WeakSet,u0=function(){if(a(this,da))return;p(this,da,new AbortController);let{signal:t}=a(this,da);for(let e of this.trigger)e.addEventListener("click",a(this,Oh),{signal:t}),e.addEventListener("pointerenter",a(this,Cx),{signal:t}),e.addEventListener("pointerleave",a(this,Ex),{signal:t}),e.classList.add("popupTriggerArea");for(let e of a(this,ac))e.container?.addEventListener("keydown",a(this,bo),{signal:t})},H2=function(){let t=a(this,ac).find(e=>e.hasCommentButton);t&&p(this,pa,t._normalizePoint(t.commentButtonPosition))},G2=function(){if(a(this,di).extraPopupElement&&!a(this,di).editor)return;a(this,Le)||this.renderCommentButton();let[t,e]=a(this,pa),{style:i}=a(this,Le);i.left=`calc(${t}%)`,i.top=`calc(${e}% - var(--comment-button-dim))`},$2=function(){a(this,di).extraPopupElement||(a(this,Le)||this.renderCommentButton(),a(this,Le).style.backgroundColor=this.commentButtonColor||"")},h0=function(){let t=a(this,ma),e=a(this,fs);return t?.str&&(!e?.str||e.str===t.str)&&a(this,ma).html||null},V2=function(){return a(this,Ot,h0)?.attributes?.style?.fontSize||0},$T=function(){return a(this,Ot,h0)?.attributes?.style?.color||null},VT=function(t){let e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},n={style:{color:a(this,Ot,$T),fontSize:a(this,Ot,V2)?`calc(${a(this,Ot,V2)}px * var(--total-scale-factor))`:""}};for(let s of t.split(` -`))e.push({name:"span",value:s,attributes:n});return i},qT=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&a(this,ps))&&b(this,Ot,d0).call(this)},WT=function(){if(a(this,fa)!==null)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:s}}}=a(this,Lh),o=!!a(this,Bh),l=o?a(this,Bh):a(this,cm);for(let y of a(this,ac))if(!l||ht.intersect(y.data.rect,l)!==null){l=y.data.rect,o=!0;break}let c=ht.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,fa,[100*(d-n)/e,100*(f-s)/i]);let{style:m}=a(this,Re);m.left=`${a(this,fa)[0]}%`,m.top=`${a(this,fa)[1]}%`},d0=function(){if(a(this,Tn)){a(this,Tn).toggleCommentPopup(this,!1);return}p(this,ps,!a(this,ps)),a(this,ps)?(b(this,Ot,f0).call(this),a(this,Re).addEventListener("click",a(this,Oh)),a(this,Re).addEventListener("keydown",a(this,bo))):(b(this,Ot,q2).call(this),a(this,Re).removeEventListener("click",a(this,Oh)),a(this,Re).removeEventListener("keydown",a(this,bo)))},f0=function(){a(this,Sn)||this.render(),this.isVisible?a(this,ps)&&a(this,Re).classList.add("focused"):(b(this,Ot,WT).call(this),a(this,Re).hidden=!1,a(this,Re).style.zIndex=parseInt(a(this,Re).style.zIndex)+1e3)},q2=function(){a(this,Re).classList.remove("focused"),!(a(this,ps)||!this.isVisible)&&(a(this,Re).hidden=!0,a(this,Re).style.zIndex=parseInt(a(this,Re).style.zIndex)-1e3)};X0=class extends Ne{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=kt.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}},W2=class extends Ne{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,um,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,um,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,um)}addHighlightArea(){this.container.classList.add("highlightArea")}};um=new WeakMap;X2=class extends Ne{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,hm,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,hm,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,hm)}addHighlightArea(){this.container.classList.add("highlightArea")}};hm=new WeakMap;Y2=class extends Ne{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,dm,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,dm,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,dm)}addHighlightArea(){this.container.classList.add("highlightArea")}};dm=new WeakMap;Y0=class extends Ne{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,fm,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=0&&o.setAttribute("stroke-width",i||1),n)for(let l=0,c=a(this,lc).length;l{o.key==="Enter"&&(s?o.metaKey:o.ctrlKey)&&b(this,xm,nw).call(this)}),!i.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):n.classList.add("popupTriggerArea"),e.append(n),e}getElementsToTriggerPopup(){return a(this,gm)}addHighlightArea(){this.container.classList.add("highlightArea")}};gm=new WeakMap,xm=new WeakSet,nw=function(){this.downloadManager?.openOrDownloadData(this.content,this.filename)};jw=class jw{constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:n,page:s,viewport:o,structTreeLayer:l,commentManager:c,linkService:u,annotationStorage:h}){x(this,Ta);x(this,cc,null);x(this,uc,null);x(this,zh,null);x(this,Co,new Map);x(this,ym,null);x(this,hc,null);x(this,Dn,[]);x(this,bm,!1);this.div=t,p(this,cc,e),p(this,uc,i),p(this,ym,l||null),p(this,hc,u||null),p(this,zh,h||new jf),this.page=s,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=n,this._commentManager=c||null}hasEditableAnnotations(){return a(this,Co).size>0}async render(t){let{annotations:e}=t,i=this.div;Ro(i,this.viewport);let n=new Map,s=[],o={data:null,layer:i,linkService:a(this,hc),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Pc,annotationStorage:a(this,zh),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===$e.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=Mf.create(o);if(!u.isRenderable)continue;c||(a(this,Dn).push(u),l.popupRef&&n.getOrInsertComputed(l.popupRef,Px).push(u));let h=u.render();l.hidden&&(h.style.visibility="hidden"),u._isEditable&&(a(this,Co).set(u.data.id,u),this._annotationEditorUIManager?.renderAnnotationElement(u))}await b(this,Ta,p0).call(this);for(let l of s){let c=o.elements=n.get(l.id);o.data=l;let u=Mf.create(o);if(!u.isRenderable)continue;let h=u.render();u.contentElement.id=`${_u}${l.id}`,l.hidden&&(h.style.visibility="hidden"),c.at(-1).container.after(h)}b(this,Ta,rw).call(this)}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:a(this,hc),svgFactory:new Pc,parent:this};for(let i of t){i.borderStyle||(i.borderStyle=jw._defaultBorderStyle),e.data=i;let n=Mf.create(e);n.isRenderable&&(n.render(),n.contentElement.id=`${_u}${i.id}`,a(this,Dn).push(n))}await b(this,Ta,p0).call(this)}update({viewport:t}){let e=this.div;this.viewport=t,Ro(e,{rotation:t.rotation}),b(this,Ta,rw).call(this),e.hidden=!1}getEditableAnnotations(){return a(this,Co).values()}getEditableAnnotation(t){return a(this,Co).get(t)}addFakeAnnotation(t){let{div:e}=this,{id:i,rotation:n}=t,s=new F2({data:{id:i,rect:t.getPDFRect(),rotation:n},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:a(this,hc),annotationStorage:a(this,zh)});return s.render(),s.contentElement.id=`${_u}${i}`,s.createOrUpdatePopup(),a(this,Dn).push(s),s}removeAnnotation(t){let e=a(this,Dn).findIndex(n=>n.data.id===t);if(e<0)return;let[i]=a(this,Dn).splice(e,1);a(this,cc)?.removePointerInTextLayer(i.contentElement)}updateFakeAnnotations(t){if(t.length!==0){for(let e of t)e.updateFakeAnnotationElement(this);b(this,Ta,p0).call(this)}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return _t(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Au.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};cc=new WeakMap,uc=new WeakMap,zh=new WeakMap,Co=new WeakMap,ym=new WeakMap,hc=new WeakMap,Dn=new WeakMap,bm=new WeakMap,Ta=new WeakSet,p0=async function(){if(a(this,Dn).length===0)return;this.div.replaceChildren();let t=[];if(!a(this,bm)){p(this,bm,!0);for(let{contentElement:i,data:{id:n}}of a(this,Dn)){let s=i.id=`${_u}${n}`;t.push(a(this,ym)?.getAriaAttributes(s).then(o=>{if(o)for(let[l,c]of o)i.setAttribute(l,c)}))}}a(this,Dn).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,y=h,g=c,A=(c+h)/2;if(m>=y&&A<=f)return-1;if(A>=d&&m<=g)return 1;let w=(i+s)/2,v=(l+u)/2;return w-v});let e=document.createDocumentFragment();for(let i of a(this,Dn))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,cc))for(let i of a(this,Dn))a(this,cc).addPointerInTextLayer(i.contentElement,!1)},rw=function(){if(!a(this,uc))return;let t=this.div;for(let[e,i]of a(this,uc)){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,Co).get(e);o&&(o._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,n.id,i),o._hasNoCanvas=!1):o.canvas=i)}a(this,uc).clear()};Q0=jw,zg=/\r\n?|\n/g,Ae=class Ae extends be{constructor(e){super({...e,name:"freeTextEditor"});x(this,Je);x(this,In,"");x(this,wm,`${this.id}-editor`);x(this,dc,null);x(this,kn);z(this,"_colorPicker",null);this.color=e.color||Ae._defaultColor||be._defaultLineColor,p(this,kn,e.fontSize||Ae._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static get _keyboardManager(){let e=Ae.prototype,i=o=>o.isEmpty(),n=Lo.TRANSLATE_SMALL,s=Lo.TRANSLATE_BIG;return _t(this,"_keyboardManager",new Fc([[["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){be.initialize(e,i);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,i){switch(e){case Ht.FREETEXT_SIZE:Ae._defaultFontSize=i;break;case Ht.FREETEXT_COLOR:Ae._defaultColor=i;break}}updateParams(e,i){switch(e){case Ht.FREETEXT_SIZE:b(this,Je,XT).call(this,i);break;case Ht.FREETEXT_COLOR:b(this,Je,YT).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[Ht.FREETEXT_SIZE,Ae._defaultFontSize],[Ht.FREETEXT_COLOR,Ae._defaultColor||be._defaultLineColor]]}get propertiesToUpdate(){return[[Ht.FREETEXT_SIZE,a(this,kn)],[Ht.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new V0(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Ht.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[-Ae._internalPadding*e,-(Ae._internalPadding+a(this,kn))*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,dc,new AbortController);let e=this._uiManager.combinedSignal(a(this,dc));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,wm)),this._isDraggable=!0,a(this,dc)?.abort(),p(this,dc,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,In),i=p(this,In,b(this,Je,KT).call(this).trimEnd());if(e===i)return;let n=s=>{if(p(this,In,s),!s){this.remove();return}b(this,Je,x0).call(this),this._uiManager.rebuild(this),b(this,Je,m0).call(this)};this.addCommands({cmd:()=>{n(i)},undo:()=>{n(e)},mustExec:!1}),b(this,Je,m0).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){Ae._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,wm)),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,kn)}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,y,g;switch(this.rotation){case 0:y=e+(l[0]-f)/h,g=i+this.height-(l[1]-m)/d;break;case 90:y=e+(l[0]-f)/h,g=i-(l[1]-m)/d,[c,u]=[u,-c];break;case 180:y=e-this.width+(l[0]-f)/h,g=i-(l[1]-m)/d,[c,u]=[-c,-u];break;case 270:y=e+(l[0]-f-this.height*d)/h,g=i+(l[1]-m-this.width*h)/d,[c,u]=[-u,c];break}this.setAt(y*s,g*o,c,u)}else this._moveAfterPaste(e,i);b(this,Je,x0).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var y,g,A;let i=e.clipboardData||window.clipboardData,{types:n}=i;if(n.length===1&&n[0]==="text/plain")return;e.preventDefault();let s=b(y=Ae,Sa,aw).call(y,i.getData("text")||"").replaceAll(zg,` +`,Wb=class{constructor(){x(this,yd);x(this,Ip,null);x(this,ph,null);x(this,mh,null);x(this,gh,null)}init(){a(this,Ip)===null&&p(this,Ip,b(this,yd,mT).call(this))}get isReady(){return a(this,ph)!==null}draw(t,e,i,n,s,o){let l=a(this,ph),{offsetX:c,offsetY:u,scaleX:h,scaleY:d}=e,{posData:f,colData:m,vertexCount:y}=b(this,yd,gT).call(this,t,e),g=l.createBuffer({size:Math.max(f.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});f.byteLength>0&&l.queue.writeBuffer(g,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,mh).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:w}}]}),T=new OffscreenCanvas(n,s),I=T.getContext("webgpu");I.configure({device:l,format:a(this,gh),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},F=l.createCommandEncoder(),L=F.beginRenderPass({colorAttachments:[{view:I.getCurrentTexture().createView(),clearValue:_,loadOp:"clear",storeOp:"store"}]});return y>0&&(L.setPipeline(a(this,mh)),L.setBindGroup(0,v),L.setVertexBuffer(0,g),L.setVertexBuffer(1,A),L.draw(y)),L.end(),l.queue.submit([F.finish()]),g.destroy(),A.destroy(),w.destroy(),T.transferToImageBitmap()}};Ip=new WeakMap,ph=new WeakMap,mh=new WeakMap,gh=new WeakMap,yd=new WeakSet,mT=async function(){if(!globalThis.navigator?.gpu)return!1;try{let t=await navigator.gpu.requestAdapter();if(!t)return!1;p(this,gh,navigator.gpu.getPreferredCanvasFormat());let e=p(this,ph,await t.requestDevice()),i=e.createShaderModule({code:aM});return p(this,mh,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,gh)}]},primitive:{topology:"triangle-list"}})),!0}catch{return!1}},gT=function(t,e){let{coords:i,colors:n}=e,s=0;for(let d of t){let f=d.coords;if(d.type===ul.TRIANGLES)s+=f.length;else if(d.type===ul.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===ul.TRIANGLES)for(let y=0,g=f.length;ythis._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(),ht.applyTransform(n,e),ht.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);ht.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(),ht.applyTransform(i,e),ht.applyTransform(n,e));let s=this._r1,o=this._r0;if(e){let u=new Float32Array(2);ht.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===ki.STROKE||n===ki.FILL){if(this.isOriginBased()){let f=ht.transform(i,e.baseTransform);this.matrix&&(f=ht.transform(f,this.matrix));let m=.001,y=Math.hypot(f[0],f[1]),g=Math.hypot(f[2],f[3]),A=(f[0]*f[2]+f[1]*f[3])/(y*g);if(Math.abs(A)=J?F=u:Y=!0,j>=et?L=h:q=!0;let N=this.getSizeAndScale(F,this.ctx.canvas.width,I),X=this.getSizeAndScale(L,this.ctx.canvas.height,_),O=t.canvasFactory.create(N.size,X.size),C=O.context,D=c.createCanvasGraphics(C,e);if(D.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(D,s,l),C.translate(-N.scale*d,-X.scale*f),D.transform(0,N.scale,0,0,X.scale,0,0),C.save(),D.dependencyTracker?.save(),this.clipBbox(D,d,f,m,y),D.baseTransform=ke(D.ctx),D.executeOperatorList(n),D.endDrawing(),D.dependencyTracker?.restore(),C.restore(),Y||q){let E=O.canvas;Y&&(F=u),q&&(L=h);let S=this.getSizeAndScale(F,this.ctx.canvas.width,I),k=this.getSizeAndScale(L,this.ctx.canvas.height,_),M=S.size,P=k.size,B=t.canvasFactory.create(M,P),$=B.context,U=Y?Math.floor(g/u):0,V=q?Math.floor(A/h):0;for(let Z=0;Z<=U;Z++)for(let Q=0;Q<=V;Q++)$.drawImage(E,M*Z,P*Q,M,P,0,0,M,P);return t.canvasFactory.destroy(O),{canvas:B.canvas,canvasEntry:B,scaleX:S.scale,scaleY:k.scale,offsetX:d,offsetY:f}}return{canvas:O.canvas,canvasEntry:O,scaleX:N.scale,scaleY:X.scale,offsetX:d,offsetY:f}}getSizeAndScale(t,e,i){let n=Math.max(bx.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),ht.axialAlignedBoundingBox([e,i,n,s],ke(t.ctx),t.current.minMax),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let n=t.ctx,s=t.current;switch(e){case cC.COLORED:let{fillStyle:o,strokeStyle:l}=this.ctx;n.fillStyle=s.fillColor=o,n.strokeStyle=s.strokeColor=l;break;case cC.UNCOLORED:n.fillStyle=n.strokeStyle=i,s.fillColor=s.strokeColor=i;break;default:throw new tb(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,n,s){let o=i;n!==ki.SHADING&&(o=ht.transform(o,e.baseTransform),this.matrix&&(o=ht.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}};z(bx,"MAX_PATTERN_SIZE",3e3);Zb=bx;uC=16,hC=100,fM=15,dC=10,pn=16,Ky=new DOMMatrix,Un=new Float32Array(2),Mu=new Float32Array([1/0,1/0,-1/0,-1/0]);G0=class{constructor(t,e){z(this,"alphaIsShape",!1);z(this,"fontSize",0);z(this,"fontSizeScale",1);z(this,"textMatrix",null);z(this,"textMatrixScale",1);z(this,"fontMatrix",Qy);z(this,"leading",0);z(this,"x",0);z(this,"y",0);z(this,"lineX",0);z(this,"lineY",0);z(this,"charSpacing",0);z(this,"wordSpacing",0);z(this,"textHScale",1);z(this,"textRenderingMode",ri.FILL);z(this,"textRise",0);z(this,"fillColor","#000000");z(this,"strokeColor","#000000");z(this,"patternFill",!1);z(this,"patternStroke",!1);z(this,"fillAlpha",1);z(this,"strokeAlpha",1);z(this,"lineWidth",1);z(this,"activeSMask",null);z(this,"transferMaps","none");z(this,"minMax",Mu.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=ki.FILL,e=null){let i=this.minMax.slice();if(t===ki.STROKE){e||ie("Stroke bounding box must include transform."),ht.singularValueDecompose2dScale(e,Un);let n=Un[0]*this.lineWidth/2,s=Un[1]*this.lineWidth/2;i[0]-=n,i[1]-=s,i[2]+=n,i[3]+=s}return i}updateClipFromPath(){let t=ht.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(Mu,0)}getClippedPathBoundingBox(t=ki.FILL,e=null){return ht.intersect(this.clipBox,this.getPathBoundingBox(t,e))}};mM=["butt","round","square"],gM=["miter","round","bevel"],xM={},gC={},Bw=class Bw{constructor(t,e,i,n,s,{optionalContentConfig:o,markedContentStack:l=null},c,u,h,d){x(this,Br);this.ctx=t,this.current=new G0(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(...ke(this.compositeCtx))}this.ctx.save(),Ug(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=ke(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>dC&&typeof i=="function",d=h?Date.now()+fM:0,f=0,m=this.commonObjs,y=this.objs,g,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(g=l[c],A=o[c]??null,g!==ud.dependency)A===null?this[g](c):this[g](c,...A);else for(let w of A){this.dependencyTracker?.recordNamedData(w,c);let v=w.startsWith("g_")?m:y;if(!v.has(w))return v.get(w,i),c}if(c++,c===u)return c;if(h&&++f>dC){if(Date.now()>d)return i(),c;f=0}}}endDrawing(){b(this,Br,Qb).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,Br,Jb).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],T=this.canvasFactory.create(w,v);return T.context.drawImage(t,0,0,i,n,0,0,w,v),{img:T.canvas,paintWidth:w,paintHeight:v,tmpCanvas:T}}let f=this.canvasFactory.create(1,1),m=this.canvasFactory.create(1,1),y=i,g=n,A=t;for(let{newWidth:w,newHeight:v}of l)this.canvasFactory.reset(m,w,v),m.context.drawImage(A,0,0,y,g,0,0,w,v),[f,m]=[m,f],A=f.canvas,y=w,g=v;return this.canvasFactory.destroy(m),{img:f.canvas,paintWidth:y,paintHeight:g,tmpCanvas:f}}_createMaskCanvas(t,e){let i=this.ctx,{width:n,height:s}=e,o=this.current.fillColor,l=this.current.patternFill,c=ke(i),u,h,d,f;if((e.bitmap||e.data)&&e.count>1){let j=e.bitmap||e.data.buffer;h=JSON.stringify(l?c:[c.slice(0,4),o]),u=this._cachedBitmapsMap.getOrInsertComputed(j,Ox);let J=u.get(h);if(J&&!l){let et=Math.round(Math.min(c[0],c[2])+c[4]),N=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(t,Qn.transformAndFill),{canvas:J,offsetX:et,offsetY:N}}d=J}d||(f=this.canvasFactory.create(n,s),pC(f.context,e));let m=ht.transform(c,[1/n,0,0,-1/s,0,0]);m=ht.transform(m,[1,0,0,1,0,-s]);let y=Mu.slice();ht.axialAlignedBoundingBox([0,0,n,s],m,y);let[g,A,w,v]=y,T=Math.round(w-g)||1,I=Math.round(v-A)||1,_=this.canvasFactory.create(T,I),F=_.context,L=g,Y=A;F.translate(-L,-Y),F.transform(...m);let q=null;if(!d){let j=this._scaleImage(f.canvas,Zr(F));d=j.img,q=j.tmpCanvas,d!==f.canvas&&(this.canvasFactory.destroy(f),f=null),u&&l&&(u.set(h,d),q=null,f=null)}F.imageSmoothingEnabled=mC(ke(F),e.interpolate),Bg(F,d,0,0,d.width,d.height,0,0,n,s),q&&this.canvasFactory.destroy(q),f&&this.canvasFactory.destroy(f),F.globalCompositeOperation="source-in";let G=ht.transform(Zr(F),[1,0,0,1,-L,-Y]);return F.fillStyle=l?o.getPattern(i,this,G,ki.FILL,t):o,F.fillRect(0,0,n,s),u&&!l&&u.set(h,_.canvas),this.dependencyTracker?.recordDependencies(t,Qn.transformAndFill),{canvas:_.canvas,canvasEntry:u&&!l?null:_,offsetX:Math.round(L),offsetY:Math.round(Y)}}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=mM[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=gM[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()),rf(this.suspendedCtx,s),pM(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(),rf(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,y=u-d,g=null;if(o)if(m<0||y<0||m+i>f.width||y+n>f.height){g=this.canvasFactory.create(i,n);let w=g.context;w.drawImage(f,-m,-y),w.globalCompositeOperation="destination-atop",w.fillStyle=o,w.fillRect(0,0,i,n),w.globalCompositeOperation="source-over",f=g.canvas,m=y=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let w=new Path2D;w.rect(m,y,i,n),t.clip(w),t.globalCompositeOperation="destination-atop",t.fillStyle=o,t.fillRect(m,y,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,y,i,n,c,u,i,n),e.restore(),g&&this.canvasFactory.destroy(g)}save(t){this.inSMaskMode&&rf(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&&rf(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===ud.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]=NC(s)),ht.axialAlignedBoundingBox(n,ke(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,Zr(n),ki.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,Qn.stroke),i&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(ki.STROKE,ke(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,Zr(n),ki.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,Qn.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,Qn.rawFillPath).recordOperation(t)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=xM}eoClip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=gC}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||Qy,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&Pt("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;ihC&&(h=hC),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&ri.FILL_STROKE_MASK,m=!!(h&ri.ADD_TO_PATH_FLAG),y=c.patternFill&&!u.missingFile,g=c.patternStroke&&!u.missingFile,A;if((u.disableFontFace||m||y||g)&&!u.missingFile&&(A=u.getPathGenerator(this.commonObjs,e)),A&&(u.disableFontFace||y||g)){l.save(),l.translate(i,n),l.scale(d,-d),this.dependencyTracker?.recordCharacterBBox(t,l,u);let w;if(f===ri.FILL||f===ri.FILL_STROKE)if(s){w=l.getTransform(),l.setTransform(...s);let v=b(this,Br,t2).call(this,A,w,s);l.fill(v)}else l.fill(A);if(f===ri.STROKE||f===ri.FILL_STROKE)if(o){w||(w=l.getTransform()),l.setTransform(...o);let{a:v,b:T,c:I,d:_}=w,F=ht.inverseTransform(o),L=ht.transform([v,T,I,_,0,0],F);ht.singularValueDecompose2dScale(L,Un),l.lineWidth*=Math.max(Un[0],Un[1])/d,l.stroke(b(this,Br,t2).call(this,A,w,o))}else l.lineWidth/=d,l.stroke(A);l.restore()}else(f===ri.FILL||f===ri.FILL_STROKE)&&(l.fillText(e,i,n),this.dependencyTracker?.recordCharacterBBox(t,l,u,d,i,n,()=>l.measureText(e))),(f===ri.STROKE||f===ri.FILL_STROKE)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,l,u,d,i,n,()=>l.measureText(e)).recordDependencies(t,Qn.stroke),l.strokeText(e,i,n));m&&((this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:ke(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;s0&&i[s]<255){n=!0;break}return Mt(this,"isFontSubpixelAAEnabled",n)}showText(t,e){this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,Qn.showText).resetBBox(t),this.current.textRenderingMode&ri.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,y=m?1:-1,g=n.defaultVMetrics,A=s*i.fontMatrix[0],w=i.textRenderingMode===ri.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,T,I=i.textRenderingMode&ri.FILL_STROKE_MASK,_=I===ri.FILL||I===ri.FILL_STROKE,F=I===ri.STROKE||I===ri.FILL_STROKE;if(_&&i.patternFill){o.save();let j=i.fillColor.getPattern(o,this,Zr(o),ki.FILL,t);v=ke(o),o.restore(),o.fillStyle=j}if(F&&i.patternStroke){o.save();let j=i.strokeColor.getPattern(o,this,Zr(o),ki.STROKE,t);T=ke(o),o.restore(),o.strokeStyle=j}let L=i.lineWidth,Y=i.textMatrixScale;if(Y===0||L===0?F&&(L=this.getSinglePixelWidth()):L/=Y,l!==1&&(o.scale(l,l),L/=l),o.lineWidth=L,n.isInvalidPDFjsFont){let j=[],J=0;for(let N of e)j.push(N.unicode),J+=N.width;let et=j.join("");if(o.fillText(et,0,0),this.dependencyTracker!==null){let N=o.measureText(et);this.dependencyTracker.recordBBox(t,this.ctx,-N.actualBoundingBoxLeft,N.actualBoundingBoxRight,-N.actualBoundingBoxAscent,N.actualBoundingBoxDescent).recordShowTextOperation(t)}i.x+=J*A*d,o.restore(),this.compose();return}let q=0,G;for(G=0;G0){E=o.measureText(N);let k=E.width*1e3/s*l;if(DE??o.measureText(N));else if(this.paintChar(t,N,O,C,v,T),X){let k=O+s*X.offset.x/l,M=C-s*X.offset.y/l;this.paintChar(t,X.fontChar,k,M,v,T)}}let S=m?D*A-et*h:D*A+et*h;q+=S,J&&o.restore()}m?i.y-=q:i.x+=q*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||Qy,m=e.length,y=n.textRenderingMode===ri.INVISIBLE,g,A,w,v;if(y||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 T=this.dependencyTracker;for(this.dependencyTracker=T?new B0(T,t):null,g=0;gnew Bw(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new B0(this.dependencyTracker,l,!0):null)};i=new Zb(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=hM(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,Zr(i),ki.SHADING,t);let s=Zr(i);if(s){let{width:o,height:l}=i.canvas,c=Mu.slice();ht.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,Qn.transform).recordDependencies(t,Qn.fill).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){ie("Should not call beginInlineImage")}beginImageData(){ie("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=ke(this.ctx),i)){ht.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||Mx("TODO: Support non-isolated groups."),e.knockout&&Pt("Knockout groups not supported.");let n=ke(i);e.matrix&&i.transform(...e.matrix);let s=[0,0,i.canvas.width,i.canvas.height],o;e.bbox?(o=Mu.slice(),ht.axialAlignedBoundingBox(e.bbox,ke(i),o),o=ht.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,[y,g,A,w]=e.bbox;if(m.rect(y,g,A-y,w-g),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()),rf(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=ke(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...s);let o=Mu.slice();ht.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,Br,Qb).call(this),Ug(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,ht.singularValueDecompose2dScale(ke(this.ctx),Un);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(Un[0],0,0,-Un[1],0,c*Un[1]),Ug(this.ctx)}else{Ug(this.ctx),this.endPath(t);let u=new Path2D;u.rect(i[0],i[1],l,c),this.ctx.clip(u)}}this.current=new G0(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,Br,Jb).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=ke(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;dd?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),Ky.a=1/s,Ky.d=1/o;let c=new Path2D;if(c.addPath(t,Ky),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}};Br=new WeakSet,Qb=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)},Jb=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}}},t2=function(t,e,i){let n=new Path2D;return n.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),n};Ou=Bw;for(let r in ud)Ou.prototype[r]!==void 0&&(Ou.prototype[ud[r]]=Ou.prototype[r]);fd=class{constructor(t,e,i){x(this,Np,null);x(this,_p,null);z(this,"_fullReader",null);z(this,"_rangeReaders",new Set);z(this,"_source",null);this._source=t,p(this,Np,e),p(this,_p,i)}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return Ne(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new(a(this,Np))(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new(a(this,_p))(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)}};Np=new WeakMap,_p=new WeakMap;pd=class{constructor(t){z(this,"onProgress",null);z(this,"_contentLength",0);z(this,"_filename",null);z(this,"_headersCapability",Promise.withResolvers());z(this,"_isRangeSupported",!1);z(this,"_isStreamingSupported",!1);z(this,"_loaded",0);z(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(){ie("Abstract method `read` called")}cancel(t){ie("Abstract method `cancel` called")}},md=class{constructor(t,e,i){z(this,"_stream",null);this._stream=t}async read(){ie("Abstract method `read` called")}cancel(t){ie("Abstract method `cancel` called")}};e2=class extends fd{constructor(e){super(e,i2,n2);z(this,"_responseOrigin",null);let{httpHeaders:i,url:n}=e;Ne(/https?:/.test(n.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=xT(!0,i)}},i2=class extends pd{constructor(e){super(e);z(this,"_abortController",new AbortController);z(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);AT(o,c,l,this._abortController).then(u=>{e._responseOrigin=Bx(u.url),vT(u.status,o),this._reader=u.body.getReader();let h=u.headers,{contentLength:d,isRangeSupported:f}=yT({responseHeaders:h,isHttp:!0,rangeChunkSize:s,disableRange:i});this._contentLength=d,this._isRangeSupported=f,this._filename=bT(h),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Lr("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:zx(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}},n2=class extends md{constructor(e,i,n){super(e,i,n);z(this,"_abortController",new AbortController);z(this,"_readCapability",Promise.withResolvers());z(this,"_reader",null);let{url:s,withCredentials:o}=e._source,l=new Headers(e.headers);l.append("Range",`bytes=${i}-${n-1}`),AT(s,l,o,this._abortController).then(c=>{let u=Bx(c.url);wT(u,e._responseOrigin),vT(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:zx(e),done:!1}}cancel(e){this._reader?.cancel(e),this._abortController.abort()}};r2=class extends fd{constructor(e){super(e,a2,o2);x(this,Mp);z(this,"_progressiveDone",!1);z(this,"_queuedChunks",[]);let{pdfDataRangeTransport:i}=e,{initialData:n,progressiveDone:s}=i;if(n?.length>0){let o=xC(n);this._queuedChunks.push(o)}this._progressiveDone=s,i.addRangeListener((o,l)=>{b(this,Mp,s2).call(this,o,l)}),i.addProgressiveReadListener(o=>{b(this,Mp,s2).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()}};Mp=new WeakSet,s2=function(e,i){let n=xC(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);Ne(s,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),s._enqueue(n)}};a2=class extends pd{constructor(e){super(e);x(this,Fp,jx.bind(this));z(this,"_done",!1);z(this,"_queuedChunks",null);z(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,Lx(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,Fp).call(this)}progressiveDone(){this._done||(this._done=!0),this._queuedChunks.length===0&&a(this,Fp).call(this)}};Fp=new WeakMap;o2=class extends md{constructor(e,i,n){super(e,i,n);x(this,Pp,jx.bind(this));z(this,"onDone",null);z(this,"_begin",-1);z(this,"_done",!1);z(this,"_queuedChunk",null);z(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,Pp).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,Pp).call(this),this.onDone?.()}};Pp=new WeakMap;Zy=200,yC=206;l2=class extends fd{constructor(e){super(e,c2,u2);x(this,bd);x(this,us,new WeakMap);z(this,"_responseOrigin",null);let{httpHeaders:i,url:n}=e;this.url=n,this.isHttp=/https?:/.test(n.protocol),this.headers=xT(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,us).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===yC||s===Zy):n.validateStatus=s=>s===Zy,i.responseType="arraybuffer",Ne(e.onError,"Expected `onError` callback to be provided."),i.onerror=()=>e.onError(i.status),i.onreadystatechange=b(this,bd,CT).bind(this,i),i.onprogress=b(this,bd,ET).bind(this,i),i.send(null),i}_abortRequest(e){a(this,us).has(e)&&(a(this,us).delete(e),e.abort())}getRangeReader(e,i){let n=super.getRangeReader(e,i);return n&&(n.onClosed=()=>this._rangeReaders.delete(n)),n}};us=new WeakMap,bd=new WeakSet,ET=function(e,i){a(this,us).get(e)?.onProgress?.(i)},CT=function(e,i){let n=a(this,us).get(e);if(!n||(e.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),e.readyState!==4)||!a(this,us).has(e))return;if(a(this,us).delete(e),e.status===0&&this.isHttp){n.onError(e.status);return}let s=e.status||Zy;if(!n.validateStatus(s)){n.onError(e.status);return}let o=bM(e.response);if(s===yC){let l=e.getResponseHeader("Content-Range");/bytes (\d+)-(\d+)\/(\d+)/.test(l)?n.onDone(o):(Pt('Missing or invalid "Content-Range" header.'),n.onError(0))}else o?n.onDone(o):n.onError(e.status)};c2=class extends pd{constructor(e){super(e);x(this,Cs);x(this,Op,jx.bind(this));z(this,"_cachedChunks",[]);z(this,"_done",!1);z(this,"_requests",[]);z(this,"_storedError",null);this._fullRequestXhr=e._request({onHeadersReceived:b(this,Cs,TT).bind(this),onDone:b(this,Cs,ST).bind(this),onError:b(this,Cs,DT).bind(this),onProgress:b(this,Cs,kT).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,Op).call(this),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}};Op=new WeakMap,Cs=new WeakSet,TT=function(){let e=this._stream,{disableRange:i,rangeChunkSize:n}=e._source,s=this._fullRequestXhr;e._responseOrigin=Bx(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}=yT({responseHeaders:l,isHttp:e.isHttp,rangeChunkSize:n,disableRange:i});this._contentLength=c,this._isRangeSupported=u,this._filename=bT(l),this._isRangeSupported&&e._abortRequest(s),this._headersCapability.resolve()},ST=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,Op).call(this)},DT=function(e){this._storedError=Ux(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},kT=function(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})};u2=class extends md{constructor(e,i,n){super(e,i,n);x(this,Na);x(this,Rp,jx.bind(this));z(this,"onClosed",null);z(this,"_done",!1);z(this,"_queuedChunk",null);z(this,"_requests",[]);z(this,"_storedError",null);this._requestXhr=e._request({begin:i,end:n,onHeadersReceived:b(this,Na,IT).bind(this),onDone:b(this,Na,NT).bind(this),onError:b(this,Na,h2).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,Rp).call(this),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}};Rp=new WeakMap,Na=new WeakSet,IT=function(){let e=Bx(this._requestXhr?.responseURL);try{wT(e,this._stream._responseOrigin)}catch(i){this._storedError=i,b(this,Na,h2).call(this,0)}},NT=function(e){this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,a(this,Rp).call(this),this.onClosed?.()},h2=function(e){this._storedError??(this._storedError=Ux(e,this._stream.url));for(let i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null};d2=class extends fd{constructor(t){super(t,f2,p2);let{url:e}=t;Ne(e.protocol==="file:","PDFNodeStream only supports file:// URLs.")}},f2=class extends pd{constructor(e){super(e);z(this,"_reader",null);let{disableRange:i,disableStream:n,rangeChunkSize:s,url:o}=e._source;this._isStreamingSupported=!n;let l=it.default.getBuiltinModule("fs");l.promises.lstat(o).then(c=>{let u=l.createReadStream(o),h=_T(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 Lr("Streaming is disabled.")),this._headersCapability.resolve()}).catch(c=>{c.code==="ENOENT"&&(c=Ux(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:zx(e),done:!1})}cancel(e){this._reader?.cancel(e)}},p2=class extends md{constructor(e,i,n){super(e,i,n);z(this,"_readCapability",Promise.withResolvers());z(this,"_reader",null);let{url:s}=e._source,o=it.default.getBuiltinModule("fs");try{let l=o.createReadStream(s,{start:i,end:n-1}),c=_T(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:zx(e),done:!1}}cancel(e){this._reader?.cancel(e)}};dr=class{static get workerPort(){return a(this,Lp)}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");p(this,Lp,t)}static get workerSrc(){return a(this,Bp)}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");p(this,Bp,t)}};Lp=new WeakMap,Bp=new WeakMap,x(dr,Lp,null),x(dr,Bp,"");m2=class{constructor({parsedData:t,rawData:e}){x(this,xh);x(this,Up);p(this,xh,t),p(this,Up,e)}getRaw(){return a(this,Up)}get(t){return a(this,xh).get(t)??null}[Symbol.iterator](){return a(this,xh).entries()}};xh=new WeakMap,Up=new WeakMap;Su=Symbol("INTERNAL"),g2=class{constructor(t,{name:e,intent:i,usage:n,rbGroups:s}){x(this,zp,!1);x(this,jp,!1);x(this,Hp,!1);x(this,yh,!0);p(this,zp,!!(t&Ln.DISPLAY)),p(this,jp,!!(t&Ln.PRINT)),this.name=e,this.intent=i,this.usage=n,this.rbGroups=s}get visible(){if(a(this,Hp))return a(this,yh);if(!a(this,yh))return!1;let{print:t,view:e}=this.usage;return a(this,zp)?e?.viewState!=="OFF":a(this,jp)?t?.printState!=="OFF":!0}_setVisible(t,e,i=!1){t!==Su&&ie("Internal method `_setVisible` called."),p(this,Hp,i),p(this,yh,e)}};zp=new WeakMap,jp=new WeakMap,Hp=new WeakMap,yh=new WeakMap;x2=class{constructor(t,e=Ln.DISPLAY){x(this,Gp);x(this,fo,null);x(this,pe,new Map);x(this,bh,null);x(this,wh,null);if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,p(this,wh,t.order);for(let i of t.groups)a(this,pe).set(i.id,new g2(e,i));if(t.baseState==="OFF")for(let i of a(this,pe).values())i._setVisible(Su,!1);for(let i of t.on)a(this,pe).get(i)._setVisible(Su,!0);for(let i of t.off)a(this,pe).get(i)._setVisible(Su,!1);p(this,bh,this.getHash())}}isVisible(t){if(a(this,pe).size===0)return!0;if(!t)return Mx("Optional content group not defined."),!0;if(t.type==="OCG")return a(this,pe).has(t.id)?a(this,pe).get(t.id).visible:(Pt(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return b(this,Gp,y2).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(let e of t.ids){if(!a(this,pe).has(e))return Pt(`Optional content group not found: ${e}`),!0;if(a(this,pe).get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(let e of t.ids){if(!a(this,pe).has(e))return Pt(`Optional content group not found: ${e}`),!0;if(!a(this,pe).get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(let e of t.ids){if(!a(this,pe).has(e))return Pt(`Optional content group not found: ${e}`),!0;if(!a(this,pe).get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(let e of t.ids){if(!a(this,pe).has(e))return Pt(`Optional content group not found: ${e}`),!0;if(a(this,pe).get(e).visible)return!1}return!0}return Pt(`Unknown optional content policy ${t.policy}.`),!0}return Pt(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,i=!0){let n=a(this,pe).get(t);if(!n){Pt(`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,pe).get(o)?._setVisible(Su,!1,!0);n._setVisible(Su,!!e,!0),p(this,fo,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,pe).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,fo,null)}get hasInitialVisibility(){return a(this,bh)===null||this.getHash()===a(this,bh)}getOrder(){return a(this,pe).size?a(this,wh)?a(this,wh).slice():[...a(this,pe).keys()]:null}getGroup(t){return a(this,pe).get(t)||null}getHash(){if(a(this,fo)!==null)return a(this,fo);let t=new R0;for(let[e,i]of a(this,pe))t.update(`${e}:${i.visible}`);return p(this,fo,t.hexdigest())}[Symbol.iterator](){return a(this,pe).entries()}};fo=new WeakMap,pe=new WeakMap,bh=new WeakMap,wh=new WeakMap,Gp=new WeakSet,y2=function(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let n=1;nf===m+1)&&p(this,We,null)}deletePages(t){b(this,zi,yf).call(this);let e=a(this,We),i=b(this,zi,bf).call(this);p(this,hs,{pageNumberToId:e.slice(),pagesNumber:a(this,Ti),prevPageNumbers:a(this,Sr).slice()});let n=a(this,Ti)-t.length;p(this,Ti,n);let s=p(this,We,new Uint32Array(n));p(this,Sr,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}oa(this,We)[e-1])})}cancelCopy(){p(this,Vl,null)}pastePages(t){b(this,zi,yf).call(this);let e=a(this,We),i=b(this,zi,bf).call(this),{pageNumbers:n,pageIds:s}=a(this,Vl),o=a(this,Ti)+n.length;p(this,Ti,o);let l=p(this,We,new Uint32Array(o));p(this,Sr,new Int32Array(o)),l.set(e.subarray(0,t),0),l.set(s,t),l.set(e.subarray(t),t+n.length),b(this,zi,s0).call(this,i,null,t,n),p(this,Vl,null)}hasBeenAltered(){return a(this,We)!==null}getPageMappingForSaving(t=null){t??(t=b(this,zi,bf).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;no[0]-l[0]);for(let o=0,l=n.length;oi-n);let e=new Map;for(let i=0,n=t.length;i=i&&u({...Promise.withResolvers(),data:Du}),$0=class{constructor(){x(this,lr,new Map)}get(t,e=null){if(e){let n=a(this,lr).getOrInsertComputed(t,bC);return n.promise.then(()=>e(n.data)),null}let i=a(this,lr).get(t);if(!i||i.data===Du)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){let e=a(this,lr).get(t);return!!e&&e.data!==Du}delete(t){let e=a(this,lr).get(t);return!e||e.data===Du?!1:(a(this,lr).delete(t),!0)}resolve(t,e=null){let i=a(this,lr).getOrInsertComputed(t,bC);if(i.data!==Du)throw new Error(`Object already resolved ${t}.`);i.data=e,i.resolve()}clear(){for(let{data:t}of a(this,lr).values())t?.bitmap?.close();a(this,lr).clear()}*[Symbol.iterator](){for(let[t,{data:e}]of a(this,lr))e!==Du&&(yield[t,e])}};lr=new WeakMap;AM=1e5,wC=30,Ai=class Ai{constructor({textContentSource:t,images:e,container:i,viewport:n}){x(this,_a);x(this,po,Promise.withResolvers());x(this,Wi,null);x(this,$p,!1);x(this,Vp,!!globalThis.FontInspector?.enabled);x(this,Ah,null);x(this,ql,null);x(this,aa,null);x(this,qp,0);x(this,Wp,0);x(this,Wl,null);x(this,Xp,null);x(this,vh,0);x(this,mo,0);x(this,Eh,Object.create(null));x(this,Yp,[]);x(this,Ch,null);x(this,Xl,[]);x(this,Kp,new WeakMap);x(this,Zp,null);var u;if(t instanceof ReadableStream)p(this,Ch,t);else if(typeof t=="object")p(this,Ch,new ReadableStream({start(h){h.enqueue(t),h.close()}}));else throw new Error('No "textContentSource" parameter specified.');p(this,Wi,p(this,Xp,i)),p(this,Ah,e),p(this,mo,n.scale*Es.pixelRatio),p(this,vh,n.rotation),p(this,aa,{div:null,properties:null,ctx:null});let{pageWidth:s,pageHeight:o,pageX:l,pageY:c}=n.rawDims;p(this,Zp,[1,0,0,-1,-l,c+o]),p(this,Wp,s),p(this,qp,o),b(u=Ai,jn,PT).call(u),i.style.setProperty("--min-font-size",a(Ai,Sh)),Ro(i,n),a(this,po).promise.finally(()=>{a(Ai,Dh).delete(this),p(this,aa,null),p(this,Eh,null)}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=Be.platform;return Mt(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){a(this,Ah)&&a(this,Wi).append(a(this,Ah).render());let t=()=>{a(this,Wl).read().then(({value:e,done:i})=>{if(i){a(this,po).resolve();return}a(this,ql)??p(this,ql,e.lang),Object.assign(a(this,Eh),e.styles),b(this,_a,MT).call(this,e.items),t()},a(this,po).reject)};return p(this,Wl,a(this,Ch).getReader()),a(Ai,Dh).add(this),t(),a(this,po).promise}update({viewport:t,onBefore:e=null}){var s;let i=t.scale*Es.pixelRatio,n=t.rotation;if(n!==a(this,vh)&&(e?.(),p(this,vh,n),Ro(a(this,Xp),{rotation:n})),i!==a(this,mo)){e?.(),p(this,mo,i);let o={div:null,properties:null,ctx:b(s=Ai,jn,a0).call(s,a(this,ql))};for(let l of a(this,Xl))o.properties=a(this,Kp).get(l),o.div=l,b(this,_a,w2).call(this,o)}}cancel(){let t=new Lr("TextLayer task cancelled.");a(this,Wl)?.cancel(t).catch(()=>{}),p(this,Wl,null),a(this,po).reject(t)}get textDivs(){return a(this,Xl)}get textContentItemsStr(){return a(this,Yp)}static cleanup(){if(!(a(this,Dh).size>0)){a(this,Th).clear();for(let{canvas:t}of a(this,Yl).values())t.remove();a(this,Yl).clear()}}};po=new WeakMap,Wi=new WeakMap,$p=new WeakMap,Vp=new WeakMap,Ah=new WeakMap,ql=new WeakMap,aa=new WeakMap,qp=new WeakMap,Wp=new WeakMap,Wl=new WeakMap,Xp=new WeakMap,vh=new WeakMap,mo=new WeakMap,Eh=new WeakMap,Yp=new WeakMap,Ch=new WeakMap,Xl=new WeakMap,Kp=new WeakMap,Zp=new WeakMap,Th=new WeakMap,Yl=new WeakMap,Qp=new WeakMap,Sh=new WeakMap,Dh=new WeakMap,_a=new WeakSet,MT=function(t){var n,s;if(a(this,$p))return;(s=a(this,aa)).ctx??(s.ctx=b(n=Ai,jn,a0).call(n,a(this,ql)));let e=a(this,Xl),i=a(this,Yp);for(let o of t){if(e.length>AM){Pt("Ignoring additional textDivs for performance reasons."),p(this,$p,!0);return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){let l=a(this,Wi);p(this,Wi,document.createElement("span")),a(this,Wi).classList.add("markedContent"),o.id&&a(this,Wi).setAttribute("id",`${o.id}`),o.tag==="Artifact"&&(a(this,Wi).ariaHidden=!0),l.append(a(this,Wi))}else o.type==="endMarkedContent"&&p(this,Wi,a(this,Wi).parentNode);continue}i.push(o.str),b(this,_a,FT).call(this,o)}},FT=function(t){var y;let e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};a(this,Xl).push(e);let n=ht.transform(a(this,Zp),t.transform),s=Math.atan2(n[1],n[0]),o=a(this,Eh)[t.fontName];o.vertical&&(s+=Math.PI/2);let l=a(this,Vp)&&o.fontSubstitution||o.fontFamily;l=Ai.fontFamilyMap.get(l)||l;let c=Math.hypot(n[2],n[3]),u=c*b(y=Ai,jn,OT).call(y,l,o,a(this,ql)),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,Wp)).toFixed(2)}%`,f.top=`${(100*d/a(this,qp)).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,Vp)&&(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 g=Math.abs(t.transform[0]),A=Math.abs(t.transform[3]);g!==A&&Math.max(g,A)/Math.min(g,A)>1.5&&(m=!0)}if(m&&(i.canvasWidth=o.vertical?t.height:t.width),a(this,Kp).set(e,i),a(this,aa).div=e,a(this,aa).properties=i,b(this,_a,w2).call(this,a(this,aa)),i.hasText&&a(this,Wi).append(e),i.hasEOL){let g=document.createElement("br");g.setAttribute("role","presentation"),a(this,Wi).append(g)}},w2=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=Ai,jn,A2).call(o,n,u*a(this,mo),l);let{width:h}=n.measureText(e.textContent);h>0&&s.setProperty("--scale-x",c*a(this,mo)/h)}i.angle!==0&&s.setProperty("--rotate",`${i.angle}deg`)},jn=new WeakSet,a0=function(t=null){let e=a(this,Yl).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,Yl).set(t,e),a(this,Qp).set(e,{size:0,family:""})}return e},A2=function(t,e,i){let n=a(this,Qp).get(t);e===n.size&&i===n.family||(t.font=`${e}px ${i}`,n.size=e,n.family=i)},PT=function(){if(a(this,Sh)!==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,Sh,t.getBoundingClientRect().height),t.remove()},OT=function(t,e,i){let n=a(this,Th).get(t);if(n)return n;let s=b(this,jn,a0).call(this,i);s.canvas.width=s.canvas.height=wC,b(this,jn,A2).call(this,s,wC,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):(Be.platform.isFirefox&&Pt("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,Th).set(t,u),u},x(Ai,jn),x(Ai,Th,new Map),x(Ai,Yl,new Map),x(Ai,Qp,new WeakMap),x(Ai,Sh,null),x(Ai,Dh,new Set);gd=Ai,vM=100;Ax=class Ax{constructor(){z(this,"_capability",Promise.withResolvers());z(this,"_transport",null);z(this,"_worker",null);z(this,"docId",`d${Ye(Ax,wx)._++}`);z(this,"destroyed",!1);z(this,"onPassword",null);z(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()}};wx=new WeakMap,x(Ax,wx,0);v2=Ax,Gf=class{constructor(t,e,i=!1,n=null){x(this,kh,Promise.withResolvers());x(this,Jp,[]);x(this,tm,[]);x(this,em,[]);this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=n,Object.defineProperty(this,"onDataProgress",{value:()=>{tM("`PDFDataRangeTransport.prototype.onDataProgress` - method was removed, since loading progress is now reported automatically through the `PDFDataTransportStream` class (and related code).")}})}addRangeListener(t){a(this,em).push(t)}addProgressiveReadListener(t){a(this,tm).push(t)}addProgressiveDoneListener(t){a(this,Jp).push(t)}onDataRange(t,e){for(let i of a(this,em))i(t,e)}onDataProgressiveRead(t){a(this,kh).promise.then(()=>{for(let e of a(this,tm))e(t)})}onDataProgressiveDone(){a(this,kh).promise.then(()=>{for(let t of a(this,Jp))t()})}transportReady(){a(this,kh).resolve()}requestDataRange(t,e){ie("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};kh=new WeakMap,Jp=new WeakMap,tm=new WeakMap,em=new WeakMap;E2=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 Mt(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()}},Uw=class Uw{constructor(t,e,i,n,s=!1){x(this,Zl);x(this,oa,!1);x(this,Kl,null);this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new M0:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new $0,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,p(this,Kl,n),this.imageCoordinates=null}clone(t){let e=new Uw(t,this._pageInfo,this._transport,a(this,Kl),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 Bf({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 Mt(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=Ea.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:y=!1,operationsFilter:g=null}){this._stats?.time("Overall");let A=this._transport.getRenderingIntent(n,s,d,f),{renderingIntent:w,cacheKey:v}=A;p(this,oa,!1),c||(c=this._transport.getOptionalContentConfig(w));let T=this._intentStates.getOrInsertComputed(v,_0);T.streamReaderCancelTimeout&&(clearTimeout(T.streamReaderCancelTimeout),T.streamReaderCancelTimeout=null);let I=!!(w&Ln.PRINT);T.displayReadyCapability||(T.displayReadyCapability=Promise.withResolvers(),T.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(A));let _=!!(this._pdfBug&&globalThis.StepperManager?.enabled),F=!!e&&!this.recordedBBoxes&&(y||_),L=!!e&&!this.imageCoordinates&&m,Y=et=>{if(T.renderTasks.delete(j),F){let N=j.gfx?.dependencyTracker.take();N&&(j.stepper?.setOperatorBBoxes(N,j.gfx.dependencyTracker.takeDebugMetadata()),y&&(this.recordedBBoxes=N))}L&&!et&&(this.imageCoordinates=j.gfx?.imagesTracker.take()),I&&p(this,oa,!0),b(this,Zl,wf).call(this),et?(j.capability.reject(et),this._abortOperatorList({intentState:T,reason:et instanceof Error?et:new Error(et)})):j.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},q=null,G=null;(F||L)&&(G=new Sb(e,T.operatorList.length)),F&&(q=new kb(G,_));let j=new D2({callback:Y,params:{canvas:e,canvasContext:t,dependencyTracker:q??G,imagesTracker:L?new Ib(e):null,viewport:i,transform:o,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:u,operatorList:T.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!I,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:g});(T.renderTasks||(T.renderTasks=new Set)).add(j);let J=j.task;return Promise.all([T.displayReadyCapability.promise,c]).then(([et,N])=>{if(this.destroyed){Y();return}if(this._stats?.time("Rendering"),!(N.renderingIntent&w))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");j.initializeGraphics({transparency:et,optionalContentConfig:N}),j.operatorListChanged()}).catch(Y),J}getOperatorList({intent:t="display",annotationMode:e=Ea.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,_0),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,Kl).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=>Rf.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,oa,!1),Promise.all(t)}cleanup(t=!1){p(this,oa,!0);let e=b(this,Zl,wf).call(this);return t&&e&&this._stats&&(this._stats=new M0),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{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,Zl,wf).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 dd){let n=vM;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 Lr(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}};oa=new WeakMap,Kl=new WeakMap,Zl=new WeakSet,wf=function(){if(!a(this,oa)||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,oa,!1),!0};C2=Uw,Fe=class Fe{constructor({name:t=null,port:e=null,verbosity:i=q_()}={}){x(this,Zi);x(this,go,Promise.withResolvers());x(this,Dr,null);x(this,la,null);x(this,Ql,null);if(this.name=t,this.destroyed=!1,this.verbosity=i,e){if(a(Fe,tc).has(e))throw new Error("Cannot use more than one PDFWorker per port.");a(Fe,tc).set(e,this),b(this,Zi,LT).call(this,e)}else b(this,Zi,BT).call(this)}get promise(){return a(this,go).promise}get port(){return a(this,la)}get messageHandler(){return a(this,Dr)}destroy(){this.destroyed=!0,a(this,Ql)?.terminate(),p(this,Ql,null),a(Fe,tc).delete(a(this,la)),p(this,la,null),a(this,Dr)?.destroy(),p(this,Dr,null)}static create(t){let e=a(this,tc).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 Fe(t)}static get workerSrc(){if(dr.workerSrc)return dr.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return Mt(this,"_setupFakeWorkerGlobal",(async()=>a(this,Ih,l0)?a(this,Ih,l0):(await import(/* @vite-ignore */ this.workerSrc)).WorkerMessageHandler)())}};go=new WeakMap,Dr=new WeakMap,la=new WeakMap,Ql=new WeakMap,vx=new WeakMap,Jl=new WeakMap,tc=new WeakMap,Zi=new WeakSet,o0=function(){a(this,go).resolve(),a(this,Dr).send("configure",{verbosity:this.verbosity})},LT=function(t){p(this,la,t),p(this,Dr,new hl("main","worker",t)),a(this,Dr).on("ready",()=>{}),b(this,Zi,o0).call(this)},BT=function(){if(a(Fe,Jl)||a(Fe,Ih,l0)){b(this,Zi,Af).call(this);return}let{workerSrc:t}=Fe;try{Fe._isSameOrigin(window.location,t)||(t=Fe._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new hl("main","worker",e),n=()=>{s.abort(),i.destroy(),e.terminate(),this.destroyed?a(this,go).reject(new Error("Worker was destroyed")):b(this,Zi,Af).call(this)},s=new AbortController;e.addEventListener("error",()=>{a(this,Ql)||n()},{signal:s.signal}),i.on("test",l=>{if(s.abort(),this.destroyed||!l){n();return}p(this,Dr,i),p(this,la,e),p(this,Ql,e),b(this,Zi,o0).call(this)}),i.on("ready",l=>{if(s.abort(),this.destroyed){n();return}try{o()}catch{b(this,Zi,Af).call(this)}});let o=()=>{let l=new Uint8Array;i.send("test",l,[l.buffer])};o();return}catch{Mx("The worker has been disabled.")}b(this,Zi,Af).call(this)},Af=function(){a(Fe,Jl)||(Pt("Setting up fake worker."),p(Fe,Jl,!0)),Fe._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){a(this,go).reject(new Error("Worker was destroyed"));return}let e=new Ub;p(this,la,e);let i=`fake${Ye(Fe,vx)._++}`,n=new hl(i+"_worker",i,e);t.setup(n,e),p(this,Dr,new hl(i,i+"_worker",e)),b(this,Zi,o0).call(this)}).catch(t=>{a(this,go).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},Ih=new WeakSet,l0=function(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}},x(Fe,Ih),x(Fe,vx,0),x(Fe,Jl,!1),x(Fe,tc,new WeakMap),Bn&&(p(Fe,Jl,!0),dr.workerSrc||(dr.workerSrc="./pdf.worker.mjs")),Fe._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},Fe._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};xd=Fe,T2=class{constructor(t,e,i,n,s,o){x(this,Rr);z(this,"downloadInfoCapability",Promise.withResolvers());x(this,En,null);x(this,ec,new Map);x(this,ca,null);x(this,kr,new Map);x(this,ic,new Map);x(this,Nh,new Map);x(this,ua,null);this.messageHandler=t,this.loadingTask=e,p(this,ca,i),this.commonObjs=new $0,this.fontLoader=new Nb({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,kr).set(e,t),a(this,ic).set(e,Promise.resolve(t))}get annotationStorage(){return Mt(this,"annotationStorage",new jf)}getRenderingIntent(t,e=Ea.ENABLE,i=null,n=!1,s=!1){let o=Ln.DISPLAY,l=zf;switch(t){case"any":o=Ln.ANY;break;case"display":break;case"print":o=Ln.PRINT;break;default:Pt(`getRenderingIntent - invalid intent: ${t}`)}let c=o&Ln.PRINT&&i instanceof L0?i:this.annotationStorage;switch(e){case Ea.DISABLE:o+=Ln.ANNOTATIONS_DISABLE;break;case Ea.ENABLE:break;case Ea.ENABLE_FORMS:o+=Ln.ANNOTATIONS_FORMS;break;case Ea.ENABLE_STORAGE:o+=Ln.ANNOTATIONS_STORAGE,l=c.serializable;break;default:Pt(`getRenderingIntent - invalid annotationMode: ${e}`)}n&&(o+=Ln.IS_EDITING),s&&(o+=Ln.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,ua)?.reject(new Error("Worker was destroyed during onPassword callback"));let t=[];for(let i of a(this,kr).values())t.push(i._destroy());a(this,kr).clear(),a(this,ic).clear(),a(this,Nh).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,ec).clear(),this.filterFactory.destroy(),gd.cleanup(),a(this,ca)?.cancelAllRequests(new Lr("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)=>{Ne(a(this,ca),"GetReader - no `BasePDFStream` instance available."),p(this,En,a(this,ca).getFullReader()),a(this,En).onProgress=s=>b(this,Rr,c0).call(this,s),n.onPull=()=>{a(this,En).read().then(function({value:s,done:o}){if(o){n.close();return}Ne(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),n.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{n.error(s)})},n.onCancel=s=>{a(this,En).cancel(s),n.ready.catch(o=>{if(!this.destroyed)throw o})}}),t.on("ReaderHeadersReady",async i=>{await a(this,En).headersReady;let{isStreamingSupported:n,isRangeSupported:s,contentLength:o}=a(this,En);return n&&s&&(a(this,En).onProgress=null),{isStreamingSupported:n,isRangeSupported:s,contentLength:o}}),t.on("GetRangeReader",(i,n)=>{Ne(a(this,ca),"GetRangeReader - no `BasePDFStream` instance available.");let s=a(this,ca).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}Ne(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 E2(i,this))}),t.on("DocException",i=>{e._capability.reject(on(i))}),t.on("PasswordRequest",i=>{p(this,ua,Promise.withResolvers());try{if(!e.onPassword)throw on(i);let n=s=>{s instanceof Error?a(this,ua).reject(s):a(this,ua).resolve({password:s})};e.onPassword(n,i.code)}catch(n){a(this,ua).reject(n)}return a(this,ua).promise}),t.on("DataLoaded",i=>{b(this,Rr,c0).call(this,{loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)}),t.on("StartRenderPage",i=>{if(this.destroyed)return;a(this,kr).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;Pt(`Error during font loading: ${d}`),this.commonObjs.resolve(i,d);break}let o=new Pb(s),l=this._params.pdfBug&&globalThis.FontInspector?.enabled?(d,f)=>globalThis.FontInspector.fontAdded(d,f):null,c=new _b(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;Ne(u,"The imageRef must be defined.");for(let d of a(this,kr).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 Lb(s));break;case"Image":this.commonObjs.resolve(i,s);break;case"Pattern":let h=new Rb(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,kr).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,Rr,c0).call(this,i)}),t.on("PrepareWebGPU",()=>{this.destroyed||oM()}),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&&Pt("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,En)?.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,ic).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,Nh).set(o.refStr,i);let l=new C2(e,o,this,this.pagesMapper,this._params.pdfBug);return a(this,kr).set(e,l),l});return a(this,ic).set(e,s),s}async getPageIndex(t){if(!Bb(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,Rr,vf).call(this,"GetFieldObjects")}hasJSActions(){return b(this,Rr,vf).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,Rr,vf).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,Rr,vf).call(this,"GetOptionalContentConfig").then(e=>new x2(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata";return a(this,ec).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(e=>({info:e[0],metadata:e[1]?new m2(e[1]):null,contentDispositionFilename:a(this,En)?.filename??null,contentLength:a(this,En)?.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,kr).values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),a(this,ec).clear(),this.filterFactory.destroy(!0),gd.cleanup()}}cachedPageNumber(t){if(!Bb(t))return null;let e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`,i=a(this,Nh).get(e);if(i>=0){let n=this.pagesMapper.getPageNumber(i+1);if(n!==0)return n}return null}};En=new WeakMap,ec=new WeakMap,ca=new WeakMap,kr=new WeakMap,ic=new WeakMap,Nh=new WeakMap,ua=new WeakMap,Rr=new WeakSet,vf=function(t,e=null){return a(this,ec).getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))},c0=function({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:e?oi(Math.round(t/e*100),0,100):NaN})};S2=class{constructor(t){z(this,"_internalRenderTask",null);z(this,"onContinue",null);z(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}},ll=class ll{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:y=null}){x(this,xo,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 S2(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=y}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(a(ll,nc).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(ll,nc).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 Ou(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,xo)&&(window.cancelAnimationFrame(a(this,xo)),p(this,xo,null)),a(ll,nc).delete(this._canvas),t||(t=new dd(`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,xo,window.requestAnimationFrame(()=>{p(this,xo,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(ll,nc).delete(this._canvas),this.callback())))}};xo=new WeakMap,nc=new WeakMap,x(ll,nc,new WeakSet);D2=ll,UT="5.6.205",zT="ada343803",ln=class ln{constructor({editor:t=null,uiManager:e=null}){x(this,me);x(this,Cn,null);x(this,rc,null);x(this,_h);x(this,ai,null);x(this,im,!1);x(this,Mh,!1);x(this,ha,null);x(this,nm);x(this,yo,null);x(this,Ir,null);t?(p(this,Mh,!1),p(this,ha,t)):p(this,Mh,!0),p(this,Ir,t?._uiManager||e),p(this,nm,a(this,Ir)._eventBus),p(this,_h,t?.color?.toUpperCase()||a(this,Ir)?.highlightColors.values().next().value||"#FFFF98"),a(ln,rm)||p(ln,rm,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 Mt(this,"_keyboardManager",new Fc([[["Escape","mac+Escape"],ln.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],ln.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],ln.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],ln.prototype._moveToPrevious],[["Home","mac+Home"],ln.prototype._moveToBeginning],[["End","mac+End"],ln.prototype._moveToEnd]]))}renderButton(){let t=p(this,Cn,document.createElement("button"));t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",a(this,ha)&&(t.ariaControls=`${a(this,ha).id}_colorpicker_dropdown`);let e=a(this,Ir)._signal;t.addEventListener("click",b(this,me,rl).bind(this),{signal:e}),t.addEventListener("keydown",b(this,me,N2).bind(this),{signal:e});let i=p(this,rc,document.createElement("span"));return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=a(this,_h),t.append(i),t}renderMainDropdown(){let t=p(this,ai,b(this,me,k2).call(this));return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}_colorSelectFromKeyboard(t){if(t.target===a(this,Cn)){b(this,me,rl).call(this,t);return}let e=t.target.getAttribute("data-color");e&&b(this,me,I2).call(this,e,t)}_moveToNext(t){if(!a(this,me,za)){b(this,me,rl).call(this,t);return}if(t.target===a(this,Cn)){a(this,ai).firstElementChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===a(this,ai)?.firstElementChild||t.target===a(this,Cn)){a(this,me,za)&&this._hideDropdownFromKeyboard();return}a(this,me,za)||b(this,me,rl).call(this,t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!a(this,me,za)){b(this,me,rl).call(this,t);return}a(this,ai).firstElementChild?.focus()}_moveToEnd(t){if(!a(this,me,za)){b(this,me,rl).call(this,t);return}a(this,ai).lastElementChild?.focus()}hideDropdown(){a(this,ai)?.classList.add("hidden"),a(this,Cn).ariaExpanded="false",a(this,yo)?.abort(),p(this,yo,null)}_hideDropdownFromKeyboard(){if(!a(this,Mh)){if(!a(this,me,za)){a(this,ha)?.unselect();return}this.hideDropdown(),a(this,Cn).focus({preventScroll:!0,focusVisible:a(this,im)})}}updateColor(t){if(a(this,rc)&&(a(this,rc).style.backgroundColor=t),!a(this,ai))return;let e=a(this,Ir).highlightColors.values();for(let i of a(this,ai).children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){a(this,Cn)?.remove(),p(this,Cn,null),p(this,rc,null),a(this,ai)?.remove(),p(this,ai,null)}};Cn=new WeakMap,rc=new WeakMap,_h=new WeakMap,ai=new WeakMap,im=new WeakMap,Mh=new WeakMap,ha=new WeakMap,nm=new WeakMap,yo=new WeakMap,Ir=new WeakMap,rm=new WeakMap,me=new WeakSet,k2=function(){let t=document.createElement("div"),e=a(this,Ir)._signal;t.addEventListener("contextmenu",Hn,{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,ha)&&(t.id=`${a(this,ha).id}_colorpicker_dropdown`);for(let[i,n]of a(this,Ir).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(ln,rm)[i]);let o=document.createElement("span");s.append(o),o.className="swatch",o.style.backgroundColor=n,s.ariaSelected=n===a(this,_h),s.addEventListener("click",b(this,me,I2).bind(this,n),{signal:e}),t.append(s)}return t.addEventListener("keydown",b(this,me,N2).bind(this),{signal:e}),t},I2=function(t,e){e.stopPropagation(),a(this,nm).dispatch("switchannotationeditorparams",{source:this,type:Gt.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)},N2=function(t){ln._keyboardManager.exec(this,t)},rl=function(t){if(a(this,me,za)){this.hideDropdown();return}if(p(this,im,t.detail===0),a(this,yo)||(p(this,yo,new AbortController),window.addEventListener("pointerdown",b(this,me,jT).bind(this),{signal:a(this,Ir).combinedSignal(a(this,yo))})),a(this,Cn).ariaExpanded="true",a(this,ai)){a(this,ai).classList.remove("hidden");return}let e=p(this,ai,b(this,me,k2).call(this));a(this,Cn).append(e)},jT=function(t){a(this,ai)?.contains(t.target)||this.hideDropdown()},za=function(){return a(this,ai)&&!a(this,ai).classList.contains("hidden")},x(ln,rm,null);$f=ln,cl=class cl{constructor(t){x(this,ds,null);x(this,sm,null);x(this,Fh,null);p(this,sm,t),p(this,Fh,t._uiManager),a(cl,am)||p(cl,am,Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"}))}renderButton(){if(a(this,ds))return a(this,ds);let{editorType:t,colorType:e,color:i}=a(this,sm),n=p(this,ds,document.createElement("input"));return n.type="color",n.value=i||"#000000",n.className="basicColorPicker",n.tabIndex=0,n.setAttribute("data-l10n-id",a(cl,am)[t]),n.addEventListener("input",()=>{a(this,Fh).updateParams(e,n.value)},{signal:a(this,Fh)._signal}),n}update(t){a(this,ds)&&(a(this,ds).value=t)}destroy(){a(this,ds)?.remove(),p(this,ds,null)}hideDropdown(){}};ds=new WeakMap,sm=new WeakMap,Fh=new WeakMap,am=new WeakMap,x(cl,am,null);V0=cl;q0=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=sf(t),[t,t,t]}static G_HTML([t]){let e=AC(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(sf)}static RGB_HTML(t){return`#${t.map(AC).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[sf(1-Math.min(1,t+n)),sf(1-Math.min(1,i+n)),sf(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]}},_2=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){ie("Abstract method `_createSVG` called.")}},Pc=class extends _2{_createSVG(t){return document.createElementNS(Us,t)}},EM=9,Oc=new WeakSet,CM=new Date().getTimezoneOffset()*60*1e3,Mf=class{static create(t){switch(t.data.annotationType){case $e.LINK:return new Vf(t);case $e.TEXT:return new P2(t);case $e.WIDGET:switch(t.data.fieldType){case"Tx":return new O2(t);case"Btn":return t.data.radioButton?new W0(t):t.data.checkBox?new L2(t):new B2(t);case"Ch":return new U2(t);case"Sig":return new R2(t)}return new ka(t);case $e.POPUP:return new qf(t);case $e.FREETEXT:return new X0(t);case $e.LINE:return new W2(t);case $e.SQUARE:return new X2(t);case $e.CIRCLE:return new Y2(t);case $e.POLYLINE:return new Y0(t);case $e.CARET:return new Z2(t);case $e.INK:return new Wf(t);case $e.POLYGON:return new K2(t);case $e.HIGHLIGHT:return new K0(t);case $e.UNDERLINE:return new J2(t);case $e.SQUIGGLY:return new tw(t);case $e.STRIKEOUT:return new ew(t);case $e.STAMP:return new Z0(t);case $e.FILEATTACHMENT:return new iw(t);default:return new _e(t)}}},zw=class zw{constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}={}){x(this,om);x(this,sc,null);x(this,Ph,!1);x(this,cr,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 zw._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;lo?(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;co?(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(`${Of}${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(`${Of}${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,cr)?.popup||this.popup)?.remove(),p(this,cr,this.popup=null)}updateEdited(t){if(!this.container)return;t.rect&&(a(this,sc)||p(this,sc,{rect:this.data.rect.slice(0)}));let{rect:e,popup:i}=t;e&&b(this,om,M2).call(this,e);let n=a(this,cr)?.popup||this.popup;!n&&i?.text&&(this._createPopup(i),n=a(this,cr).popup),n&&(n.updateEdited(t),i?.deleted&&(n.remove(),p(this,cr,null),this.popup=null))}resetEdited(){a(this,sc)&&(b(this,om,M2).call(this,a(this,sc).rect),a(this,cr)?.popup.resetEdited(),p(this,sc,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 ka)&&!(this instanceof Vf)&&(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 qf){let{rotation:g}=e;return!e.hasOwnCanvas&&g!==0&&this.setRotation(g,s),s}let{width:l,height:c}=this;if(!t&&e.borderStyle.width>0){o.borderWidth=`${e.borderStyle.width}px`;let g=e.borderStyle.horizontalCornerRadius,A=e.borderStyle.verticalCornerRadius;if(g>0||A>0){let v=`calc(${g}px * var(--total-scale-factor)) / calc(${A}px * var(--total-scale-factor))`;o.borderRadius=v}else if(this instanceof W0){let v=`calc(${l}px * var(--total-scale-factor)) / calc(${c}px * var(--total-scale-factor))`;o.borderRadius=v}switch(e.borderStyle.style){case Au.SOLID:o.borderStyle="solid";break;case Au.DASHED:o.borderStyle="dashed";break;case Au.BEVELED:Pt("Unimplemented border style: beveled");break;case Au.INSET:Pt("Unimplemented border style: inset");break;case Au.UNDERLINE:o.borderBottomStyle="solid";break;default:break}let w=e.borderColor||null;w?(p(this,Ph,!0),o.borderColor=ht.makeHexColor(w[0]|0,w[1]|0,w[2]|0)):o.borderWidth=0}let u=ht.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:y}=e;return e.hasOwnCanvas||y===0?(o.width=`${100*l/h}%`,o.height=`${100*c/d}%`):this.setRotation(y,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]=q0[`${o}_HTML`](l),this.annotationStorage.setValue(this.data.id,{[i]:q0[`${o}_rgb`](l)})};return Mt(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(g=>Math.fround(g));if(t.length===8){let[g,A,w,v]=t.subarray(2,6);if(n===g&&s===A&&e===w&&i===v)return}let{style:o}=this.container,l;if(a(this,Ph)){let{borderColor:g,borderWidth:A}=o;o.borderWidth=0,l=["url('data:image/svg+xml;utf8,",'',``],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"),y=`clippath_${this.data.id}`;m.setAttribute("id",y),m.setAttribute("clipPathUnits","objectBoundingBox"),f.append(m);for(let g=2,A=t.length;g`)}a(this,Ph)&&(l.push("')"),o.backgroundImage=l.join("")),this.container.append(d),this.container.style.clipPath=`url(#${y})`}_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,cr,new qf({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,cr)||this.popup||this.data.popupRef)}get extraPopupElement(){return a(this,cr)}render(){ie("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&&!Oc.has(u)){Pt(`_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&&Oc.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]}};sc=new WeakMap,Ph=new WeakMap,cr=new WeakMap,om=new WeakSet,M2=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)};_e=zw,F2=class extends _e{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()}},Vf=class extends _e{constructor(e,i=null){super(e,{isRenderable:!0,ignoreBorder:!!i?.ignoreBorder,createQuadrilaterals:!0});x(this,zn);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,zn,HT).call(this,n,e.attachment,e.overlaidText,e.attachmentDest),s=!0):e.setOCGState?(b(this,zn,GT).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,zn,sl).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,zn,sl).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,zn,sl).call(this)}_bindResetFormAction(e,i){let n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl("")),b(this,zn,sl).call(this),!this._fieldObjects){Pt('_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:y}of m)d.add(y)}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 y=d.defaultValue||"";u.setValue(f,{value:y});break}case"checkbox":case"radiobutton":{let y=d.defaultValue===d.exportValues;u.setValue(f,{value:y});break}case"combobox":case"listbox":{let y=d.defaultValue||"";u.setValue(f,{value:y});break}default:continue}let m=document.querySelector(`[data-element-id="${f}"]`);if(m){if(!Oc.has(m)){Pt(`_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}}};zn=new WeakSet,sl=function(){this.container.setAttribute("data-internal-link","")},HT=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,zn,sl).call(this)},GT=function(e,i,n=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(i),!1),n&&(e.title=n),b(this,zn,sl).call(this)};P2=class extends _e{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}},ka=class extends _e{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return Be.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":ht.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||EM,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/($g*n))||1,d=u/h;o=Math.min(n,c(d/$g))}else{let u=Math.abs(this.data.rect[3]-this.data.rect[1]-l);o=Math.min(n,c(u/$g))}s.fontSize=`calc(${o}px * var(--total-scale-factor))`,s.color=ht.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)}},O2=class extends ka{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(` +`)||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),Oc.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",y=>{t.setValue(e,{value:y.target.value}),this.setPropertyOnSiblings(i,"value",y.target.value,"value"),c.formattedValue=null}),i.addEventListener("resetform",y=>{let g=this.data.defaultFieldValue??"";i.value=c.userValue=g,c.formattedValue=null});let m=y=>{let{formattedValue:g}=c;g!=null&&(y.target.value=g),y.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",g=>{if(c.focused)return;let{target:A}=g;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),T=[v.getHours(),v.getMinutes(),v.getSeconds()];A.value=T.map(I=>I.toString().padStart(2,"0")).join(":")}else A.value=new Date(w-CM).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",g=>{this.showElementAndHideCanvas(g.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 T={formattedValue:v};f&&(T.value=v),t.setValue(e,T)},selRange(w){w.target.setSelectionRange(...w.detail.selRange)},charLimit:w=>{let{charLimit:v}=w.detail,{target:T}=w;if(v===0){T.removeAttribute("maxLength");return}T.setAttribute("maxLength",v);let I=c.userValue;!I||I.length<=v||(I=I.slice(0,v),T.value=c.userValue=I,t.setValue(e,{value:I}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:I,willCommit:!0,commitKey:1,selStart:T.selectionStart,selEnd:T.selectionEnd}}))}};this._dispatchEventFromSandbox(A,g)}),i.addEventListener("keydown",g=>{c.commitKey=1;let A=-1;if(g.key==="Escape"?A=0:g.key==="Enter"&&!this.data.multiLine?A=2:g.key==="Tab"&&(c.commitKey=3),A===-1)return;let{value:w}=g.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:g.target.selectionStart,selEnd:g.target.selectionEnd}}))});let y=m;m=null,i.addEventListener("blur",g=>{if(!c.focused||!g.relatedTarget)return;this.data.actions?.Blur||(c.focused=!1);let{target:A}=g,{value:w}=A;if(f){if(w&&h==="time"){let v=w.split(":").map(T=>parseInt(T,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:g.target.selectionStart,selEnd:g.target.selectionEnd}}),y(g)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",g=>{c.lastCommittedValue=null;let{data:A,target:w}=g,{value:v,selectionStart:T,selectionEnd:I}=w,_=T,F=I;switch(g.inputType){case"deleteWordBackward":{let L=v.substring(0,T).match(/\w*[^\w]*$/);L&&(_-=L[0].length);break}case"deleteWordForward":{let L=v.substring(T).match(/^[^\w]*\w*/);L&&(F+=L[0].length);break}case"deleteContentBackward":T===I&&(_-=1);break;case"deleteContentForward":T===I&&(F+=1);break}g.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:v,change:A||"",willCommit:!1,selStart:_,selEnd:F}})}),this._setEventListeners(i,c,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],g=>g.target.value)}if(m&&i.addEventListener("blur",m),this.data.comb){let g=(this.data.rect[2]-this.data.rect[0])/o;i.classList.add("comb"),i.style.letterSpacing=`calc(${g}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}},R2=class extends ka{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}},L2=class extends ka{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 Oc.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}},W0=class extends ka{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(Oc.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}},B2=class extends Vf{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}},U2=class extends ka{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");Oc.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:y}=n;return y?Array.prototype.filter.call(m,g=>g.selected).map(g=>g[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 y=m.detail.value,g=new Set(Array.isArray(y)?y:[y]);for(let A of n.options)A.selected=g.has(A.value);t.setValue(e,{value:c(!0)}),u=c(!1)},multipleSelection(m){n.multiple=!0},remove(m){let y=n.options,g=m.detail.remove;y[g].selected=!1,n.remove(g),y.length>0&&Array.prototype.findIndex.call(y,w=>w.selected)===-1&&(y[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:y,displayValue:g,exportValue:A}=m.detail.insert,w=n.children[y],v=document.createElement("option");o(v,g),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:y}=m.detail;for(;n.length!==0;)n.remove(0);for(let g of y){let{displayValue:A,exportValue:w}=g,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 y=new Set(m.detail.indices);for(let g of m.target.options)g.selected=y.has(g.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}},qf=class extends _e{constructor(e){let{data:i,elements:n,parent:s}=e,o=!!s._commentManager;super(e,{isRenderable:!o&&_e._hasPopupData(i)});x(this,lm);if(this.elements=n,o&&_e._hasPopupData(i)){let l=this.popup=b(this,lm,z2).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,lm,z2).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=>`${Nu}${s}`).join(",")),this.container}};lm=new WeakSet,z2=function(){return new j2({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})};j2=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}){x(this,Lt);x(this,Tn,null);x(this,bo,b(this,Lt,qT).bind(this));x(this,Ex,b(this,Lt,q2).bind(this));x(this,Cx,b(this,Lt,f0).bind(this));x(this,Oh,b(this,Lt,d0).bind(this));x(this,Rh,null);x(this,Re,null);x(this,fs,null);x(this,wo,null);x(this,ac,null);x(this,Lh,null);x(this,Bh,null);x(this,ps,!1);x(this,Sn,null);x(this,da,null);x(this,fa,null);x(this,Le,null);x(this,pa,null);x(this,Ao,null);x(this,cm,null);x(this,ma,null);x(this,Uh,null);x(this,oc,null);x(this,vo,!1);x(this,di,null);x(this,Eo,null);p(this,Re,t),p(this,Uh,n),p(this,fs,o),p(this,ma,l),p(this,Lh,c),p(this,Rh,e),p(this,cm,u),p(this,Bh,h),p(this,ac,i),p(this,Tn,f),p(this,di,i[0]),p(this,wo,_c.toDateObject(s)),this.trigger=i.flatMap(m=>m.getElementsToTriggerPopup()),f||(b(this,Lt,u0).call(this),a(this,Re).hidden=!0,d&&b(this,Lt,d0).call(this))}renderCommentButton(){if(a(this,Le)){a(this,Le).parentNode||a(this,di).container.after(a(this,Le));return}if(a(this,pa)||b(this,Lt,H2).call(this),!a(this,pa))return;let{signal:t}=p(this,da,new AbortController),e=a(this,di).hasOwnCommentButton,i=()=>{a(this,Tn).toggleCommentPopup(this,!0,void 0,!e)},n=()=>{a(this,Tn).toggleCommentPopup(this,!1,!0,!e)},s=()=>{a(this,Tn).toggleCommentPopup(this,!1,!1)};if(e){p(this,Le,a(this,di).container);for(let o of this.trigger)o.ariaHasPopup="dialog",o.ariaControls="commentPopup",o.addEventListener("keydown",a(this,bo),{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,Le,document.createElement("button"));o.className="annotationCommentButton";let l=a(this,di).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,Lt,$2).call(this),b(this,Lt,G2).call(this),o.addEventListener("keydown",a(this,bo),{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,di).commentData;return t?a(this,Lh)._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{a(this,Le)?.focus()},0)}getData(){let{richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}=a(this,di).commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:n,modificationDate:s}}get elementBeforePopup(){return a(this,Le)}get comment(){return a(this,Eo)||p(this,Eo,a(this,di).commentText),a(this,Eo)}set comment(t){t!==this.comment&&(a(this,di).commentText=p(this,Eo,t))}focus(){a(this,di).container?.focus()}get parentBoundingClientRect(){return a(this,di).layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){a(this,Le)&&(a(this,Le).classList.toggle("selected",t),a(this,Le).ariaExpanded=e)}setSelectedCommentButton(t){a(this,Le).classList.toggle("selected",t)}get commentPopupPosition(){if(a(this,Ao))return a(this,Ao);let{x:t,y:e,height:i}=a(this,Le).getBoundingClientRect(),{x:n,y:s,width:o,height:l}=a(this,di).layer.getBoundingClientRect();return[(t-n)/o,(e+i-s)/l]}set commentPopupPosition(t){p(this,Ao,t)}hasDefaultPopupPosition(){return a(this,Ao)===null}get commentButtonPosition(){return a(this,pa)}get commentButtonWidth(){return a(this,Le).getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,i]=a(this,Ao)||this.commentButtonPosition.map(u=>u/100),n=this.parentBoundingClientRect,{x:s,y:o,width:l,height:c}=n;a(this,Tn).showDialog(null,this,s+e*l,o+i*c,{...t,parentDimensions:n})}render(){if(a(this,Sn))return;let t=p(this,Sn,document.createElement("div"));if(t.className="popup",a(this,Rh)){let i=t.style.outlineColor=ht.makeHexColor(...a(this,Rh));t.style.backgroundColor=`color-mix(in srgb, ${i} 30%, white)`}let e=document.createElement("span");if(e.className="header",a(this,Uh)?.str){let i=document.createElement("span");i.className="title",e.append(i),{dir:i.dir,str:i.textContent}=a(this,Uh)}if(t.append(e),a(this,wo)){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,wo).valueOf()})),i.dateTime=a(this,wo).toISOString(),e.append(i)}Fw({html:a(this,Lt,h0)||a(this,fs).str,dir:a(this,fs)?.dir,className:"popupContent"},t),a(this,Re).append(t)}updateEdited({rect:t,popup:e,deleted:i}){if(a(this,Tn)){i?(this.remove(),p(this,Eo,null)):e&&(e.deleted?this.remove():(b(this,Lt,$2).call(this),p(this,Eo,e.text))),t&&(p(this,pa,null),b(this,Lt,H2).call(this),b(this,Lt,G2).call(this));return}if(i||e?.deleted){this.remove();return}b(this,Lt,u0).call(this),a(this,oc)||p(this,oc,{contentsObj:a(this,fs),richText:a(this,ma)}),t&&p(this,fa,null),e&&e.text&&(p(this,ma,b(this,Lt,VT).call(this,e.text)),p(this,wo,_c.toDateObject(e.date)),p(this,fs,null)),a(this,Sn)?.remove(),p(this,Sn,null)}resetEdited(){a(this,oc)&&({contentsObj:Ye(this,fs)._,richText:Ye(this,ma)._}=a(this,oc),p(this,oc,null),a(this,Sn)?.remove(),p(this,Sn,null),p(this,fa,null))}remove(){if(a(this,da)?.abort(),p(this,da,null),a(this,Sn)?.remove(),p(this,Sn,null),p(this,vo,!1),p(this,ps,!1),a(this,Le)?.remove(),p(this,Le,null),this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}forceHide(){p(this,vo,this.isVisible),a(this,vo)&&(a(this,Re).hidden=!0)}maybeShow(){a(this,Tn)||(b(this,Lt,u0).call(this),a(this,vo)&&(a(this,Sn)||b(this,Lt,f0).call(this),p(this,vo,!1),a(this,Re).hidden=!1))}get isVisible(){return a(this,Tn)?!1:a(this,Re).hidden===!1}};Tn=new WeakMap,bo=new WeakMap,Ex=new WeakMap,Cx=new WeakMap,Oh=new WeakMap,Rh=new WeakMap,Re=new WeakMap,fs=new WeakMap,wo=new WeakMap,ac=new WeakMap,Lh=new WeakMap,Bh=new WeakMap,ps=new WeakMap,Sn=new WeakMap,da=new WeakMap,fa=new WeakMap,Le=new WeakMap,pa=new WeakMap,Ao=new WeakMap,cm=new WeakMap,ma=new WeakMap,Uh=new WeakMap,oc=new WeakMap,vo=new WeakMap,di=new WeakMap,Eo=new WeakMap,Lt=new WeakSet,u0=function(){if(a(this,da))return;p(this,da,new AbortController);let{signal:t}=a(this,da);for(let e of this.trigger)e.addEventListener("click",a(this,Oh),{signal:t}),e.addEventListener("pointerenter",a(this,Cx),{signal:t}),e.addEventListener("pointerleave",a(this,Ex),{signal:t}),e.classList.add("popupTriggerArea");for(let e of a(this,ac))e.container?.addEventListener("keydown",a(this,bo),{signal:t})},H2=function(){let t=a(this,ac).find(e=>e.hasCommentButton);t&&p(this,pa,t._normalizePoint(t.commentButtonPosition))},G2=function(){if(a(this,di).extraPopupElement&&!a(this,di).editor)return;a(this,Le)||this.renderCommentButton();let[t,e]=a(this,pa),{style:i}=a(this,Le);i.left=`calc(${t}%)`,i.top=`calc(${e}% - var(--comment-button-dim))`},$2=function(){a(this,di).extraPopupElement||(a(this,Le)||this.renderCommentButton(),a(this,Le).style.backgroundColor=this.commentButtonColor||"")},h0=function(){let t=a(this,ma),e=a(this,fs);return t?.str&&(!e?.str||e.str===t.str)&&a(this,ma).html||null},V2=function(){return a(this,Lt,h0)?.attributes?.style?.fontSize||0},$T=function(){return a(this,Lt,h0)?.attributes?.style?.color||null},VT=function(t){let e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},n={style:{color:a(this,Lt,$T),fontSize:a(this,Lt,V2)?`calc(${a(this,Lt,V2)}px * var(--total-scale-factor))`:""}};for(let s of t.split(` +`))e.push({name:"span",value:s,attributes:n});return i},qT=function(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&a(this,ps))&&b(this,Lt,d0).call(this)},WT=function(){if(a(this,fa)!==null)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:s}}}=a(this,Lh),o=!!a(this,Bh),l=o?a(this,Bh):a(this,cm);for(let y of a(this,ac))if(!l||ht.intersect(y.data.rect,l)!==null){l=y.data.rect,o=!0;break}let c=ht.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,fa,[100*(d-n)/e,100*(f-s)/i]);let{style:m}=a(this,Re);m.left=`${a(this,fa)[0]}%`,m.top=`${a(this,fa)[1]}%`},d0=function(){if(a(this,Tn)){a(this,Tn).toggleCommentPopup(this,!1);return}p(this,ps,!a(this,ps)),a(this,ps)?(b(this,Lt,f0).call(this),a(this,Re).addEventListener("click",a(this,Oh)),a(this,Re).addEventListener("keydown",a(this,bo))):(b(this,Lt,q2).call(this),a(this,Re).removeEventListener("click",a(this,Oh)),a(this,Re).removeEventListener("keydown",a(this,bo)))},f0=function(){a(this,Sn)||this.render(),this.isVisible?a(this,ps)&&a(this,Re).classList.add("focused"):(b(this,Lt,WT).call(this),a(this,Re).hidden=!1,a(this,Re).style.zIndex=parseInt(a(this,Re).style.zIndex)+1e3)},q2=function(){a(this,Re).classList.remove("focused"),!(a(this,ps)||!this.isVisible)&&(a(this,Re).hidden=!0,a(this,Re).style.zIndex=parseInt(a(this,Re).style.zIndex)-1e3)};X0=class extends _e{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=_t.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}},W2=class extends _e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,um,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,um,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,um)}addHighlightArea(){this.container.classList.add("highlightArea")}};um=new WeakMap;X2=class extends _e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,hm,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,hm,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,hm)}addHighlightArea(){this.container.classList.add("highlightArea")}};hm=new WeakMap;Y2=class extends _e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,dm,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,dm,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,dm)}addHighlightArea(){this.container.classList.add("highlightArea")}};dm=new WeakMap;Y0=class extends _e{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0});x(this,fm,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=0&&o.setAttribute("stroke-width",i||1),n)for(let l=0,c=a(this,lc).length;l{o.key==="Enter"&&(s?o.metaKey:o.ctrlKey)&&b(this,xm,nw).call(this)}),!i.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):n.classList.add("popupTriggerArea"),e.append(n),e}getElementsToTriggerPopup(){return a(this,gm)}addHighlightArea(){this.container.classList.add("highlightArea")}};gm=new WeakMap,xm=new WeakSet,nw=function(){this.downloadManager?.openOrDownloadData(this.content,this.filename)};jw=class jw{constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:n,page:s,viewport:o,structTreeLayer:l,commentManager:c,linkService:u,annotationStorage:h}){x(this,Ta);x(this,cc,null);x(this,uc,null);x(this,zh,null);x(this,Co,new Map);x(this,ym,null);x(this,hc,null);x(this,Dn,[]);x(this,bm,!1);this.div=t,p(this,cc,e),p(this,uc,i),p(this,ym,l||null),p(this,hc,u||null),p(this,zh,h||new jf),this.page=s,this.viewport=o,this.zIndex=0,this._annotationEditorUIManager=n,this._commentManager=c||null}hasEditableAnnotations(){return a(this,Co).size>0}async render(t){let{annotations:e}=t,i=this.div;Ro(i,this.viewport);let n=new Map,s=[],o={data:null,layer:i,linkService:a(this,hc),downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Pc,annotationStorage:a(this,zh),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===$e.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=Mf.create(o);if(!u.isRenderable)continue;c||(a(this,Dn).push(u),l.popupRef&&n.getOrInsertComputed(l.popupRef,Px).push(u));let h=u.render();l.hidden&&(h.style.visibility="hidden"),u._isEditable&&(a(this,Co).set(u.data.id,u),this._annotationEditorUIManager?.renderAnnotationElement(u))}await b(this,Ta,p0).call(this);for(let l of s){let c=o.elements=n.get(l.id);o.data=l;let u=Mf.create(o);if(!u.isRenderable)continue;let h=u.render();u.contentElement.id=`${Nu}${l.id}`,l.hidden&&(h.style.visibility="hidden"),c.at(-1).container.after(h)}b(this,Ta,rw).call(this)}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:a(this,hc),svgFactory:new Pc,parent:this};for(let i of t){i.borderStyle||(i.borderStyle=jw._defaultBorderStyle),e.data=i;let n=Mf.create(e);n.isRenderable&&(n.render(),n.contentElement.id=`${Nu}${i.id}`,a(this,Dn).push(n))}await b(this,Ta,p0).call(this)}update({viewport:t}){let e=this.div;this.viewport=t,Ro(e,{rotation:t.rotation}),b(this,Ta,rw).call(this),e.hidden=!1}getEditableAnnotations(){return a(this,Co).values()}getEditableAnnotation(t){return a(this,Co).get(t)}addFakeAnnotation(t){let{div:e}=this,{id:i,rotation:n}=t,s=new F2({data:{id:i,rect:t.getPDFRect(),rotation:n},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:a(this,hc),annotationStorage:a(this,zh)});return s.render(),s.contentElement.id=`${Nu}${i}`,s.createOrUpdatePopup(),a(this,Dn).push(s),s}removeAnnotation(t){let e=a(this,Dn).findIndex(n=>n.data.id===t);if(e<0)return;let[i]=a(this,Dn).splice(e,1);a(this,cc)?.removePointerInTextLayer(i.contentElement)}updateFakeAnnotations(t){if(t.length!==0){for(let e of t)e.updateFakeAnnotationElement(this);b(this,Ta,p0).call(this)}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return Mt(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:Au.SOLID,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}};cc=new WeakMap,uc=new WeakMap,zh=new WeakMap,Co=new WeakMap,ym=new WeakMap,hc=new WeakMap,Dn=new WeakMap,bm=new WeakMap,Ta=new WeakSet,p0=async function(){if(a(this,Dn).length===0)return;this.div.replaceChildren();let t=[];if(!a(this,bm)){p(this,bm,!0);for(let{contentElement:i,data:{id:n}}of a(this,Dn)){let s=i.id=`${Nu}${n}`;t.push(a(this,ym)?.getAriaAttributes(s).then(o=>{if(o)for(let[l,c]of o)i.setAttribute(l,c)}))}}a(this,Dn).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,y=h,g=c,A=(c+h)/2;if(m>=y&&A<=f)return-1;if(A>=d&&m<=g)return 1;let w=(i+s)/2,v=(l+u)/2;return w-v});let e=document.createDocumentFragment();for(let i of a(this,Dn))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,cc))for(let i of a(this,Dn))a(this,cc).addPointerInTextLayer(i.contentElement,!1)},rw=function(){if(!a(this,uc))return;let t=this.div;for(let[e,i]of a(this,uc)){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,Co).get(e);o&&(o._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,n.id,i),o._hasNoCanvas=!1):o.canvas=i)}a(this,uc).clear()};Q0=jw,zg=/\r\n?|\n/g,Ae=class Ae extends be{constructor(e){super({...e,name:"freeTextEditor"});x(this,Je);x(this,kn,"");x(this,wm,`${this.id}-editor`);x(this,dc,null);x(this,In);z(this,"_colorPicker",null);this.color=e.color||Ae._defaultColor||be._defaultLineColor,p(this,In,e.fontSize||Ae._defaultFontSize),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static get _keyboardManager(){let e=Ae.prototype,i=o=>o.isEmpty(),n=Lo.TRANSLATE_SMALL,s=Lo.TRANSLATE_BIG;return Mt(this,"_keyboardManager",new Fc([[["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){be.initialize(e,i);let n=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(n.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,i){switch(e){case Gt.FREETEXT_SIZE:Ae._defaultFontSize=i;break;case Gt.FREETEXT_COLOR:Ae._defaultColor=i;break}}updateParams(e,i){switch(e){case Gt.FREETEXT_SIZE:b(this,Je,XT).call(this,i);break;case Gt.FREETEXT_COLOR:b(this,Je,YT).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[Gt.FREETEXT_SIZE,Ae._defaultFontSize],[Gt.FREETEXT_COLOR,Ae._defaultColor||be._defaultLineColor]]}get propertiesToUpdate(){return[[Gt.FREETEXT_SIZE,a(this,In)],[Gt.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||(this._colorPicker=new V0(this)),[["colorPicker",this._colorPicker]]}get colorType(){return Gt.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[-Ae._internalPadding*e,-(Ae._internalPadding+a(this,In))*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,dc,new AbortController);let e=this._uiManager.combinedSignal(a(this,dc));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,wm)),this._isDraggable=!0,a(this,dc)?.abort(),p(this,dc,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,kn),i=p(this,kn,b(this,Je,KT).call(this).trimEnd());if(e===i)return;let n=s=>{if(p(this,kn,s),!s){this.remove();return}b(this,Je,x0).call(this),this._uiManager.rebuild(this),b(this,Je,m0).call(this)};this.addCommands({cmd:()=>{n(i)},undo:()=>{n(e)},mustExec:!1}),b(this,Je,m0).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){Ae._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,wm)),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,In)}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,y,g;switch(this.rotation){case 0:y=e+(l[0]-f)/h,g=i+this.height-(l[1]-m)/d;break;case 90:y=e+(l[0]-f)/h,g=i-(l[1]-m)/d,[c,u]=[u,-c];break;case 180:y=e-this.width+(l[0]-f)/h,g=i-(l[1]-m)/d,[c,u]=[-c,-u];break;case 270:y=e+(l[0]-f-this.height*d)/h,g=i+(l[1]-m-this.width*h)/d,[c,u]=[-u,c];break}this.setAt(y*s,g*o,c,u)}else this._moveAfterPaste(e,i);b(this,Je,x0).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(e){var y,g,A;let i=e.clipboardData||window.clipboardData,{types:n}=i;if(n.length===1&&n[0]==="text/plain")return;e.preventDefault();let s=b(y=Ae,Sa,aw).call(y,i.getData("text")||"").replaceAll(zg,` `);if(!s)return;let o=window.getSelection();if(!o.rangeCount)return;this.editorDiv.normalize(),o.deleteFromDocument();let l=o.getRangeAt(0);if(!s.includes(` -`)){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(zg,"")),w!==this.editorDiv){let v=h;for(let T of this.editorDiv.childNodes){if(T===w){v=d;continue}v.push(b(g=Ae,Sa,g0).call(g,T))}}h.push(c.nodeValue.slice(0,u).replaceAll(zg,""))}else if(c===this.editorDiv){let w=h,v=0;for(let T of this.editorDiv.childNodes)v++===u&&(w=d),w.push(b(A=Ae,Sa,g0).call(A,T))}p(this,In,`${h.join(` +`)){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(zg,"")),w!==this.editorDiv){let v=h;for(let T of this.editorDiv.childNodes){if(T===w){v=d;continue}v.push(b(g=Ae,Sa,g0).call(g,T))}}h.push(c.nodeValue.slice(0,u).replaceAll(zg,""))}else if(c===this.editorDiv){let w=h,v=0;for(let T of this.editorDiv.childNodes)v++===u&&(w=d),w.push(b(A=Ae,Sa,g0).call(A,T))}p(this,kn,`${h.join(` `)}${s}${d.join(` -`)}`),b(this,Je,x0).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=Ae._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,i,n){var l;let s=null;if(e instanceof X0){let{data:{defaultAppearanceData:{fontSize:c,fontColor:u},rect:h,rotation:d,id:f,popupRef:m,richText:y,contentsObj:g,creationDate:A,modificationDate:w},textContent:v,textPosition:T,parent:{page:{pageNumber:k}}}=e;if(!v||v.length===0)return null;s=e={annotationType:kt.FREETEXT,color:Array.from(u),fontSize:c,value:v.join(` -`),position:T,pageIndex:k-1,rect:h.slice(0),rotation:d,annotationElementId:f,id:f,deleted:!1,popupRef:m,comment:g?.str||null,richText:y,creationDate:A,modificationDate:w}}let o=await super.deserialize(e,i,n);return p(o,kn,e.fontSize),o.color=ht.makeHexColor(...e.color),p(o,In,b(l=Ae,Sa,aw).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=be._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(e),{color:i,fontSize:a(this,kn),value:b(this,Je,ZT).call(this)});return this.addComment(n),e?(n.isCopy=!0,n):this.annotationElementId&&!b(this,Je,QT).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,kn)}px * var(--total-scale-factor))`,n.color=this.color,i.replaceChildren();for(let s of a(this,In).split(` -`)){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,In)}}),i}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};In=new WeakMap,wm=new WeakMap,dc=new WeakMap,kn=new WeakMap,Je=new WeakSet,XT=function(e){let i=s=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-a(this,kn))*this.parentScale),p(this,kn,s),b(this,Je,m0).call(this)},n=a(this,kn);this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ht.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},YT=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:Ht.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},KT=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=Ae,Sa,g0).call(n,s)),i=s);return e.join(` -`)},m0=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()},Sa=new WeakSet,g0=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(zg,"")},x0=function(){if(this.editorDiv.replaceChildren(),!!a(this,In))for(let e of a(this,In).split(` -`)){let i=document.createElement("div");i.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(i)}},ZT=function(){return a(this,In).replaceAll("\xA0"," ")},aw=function(e){return e.replaceAll(" ","\xA0")},QT=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},x(Ae,Sa),z(Ae,"_freeTextDefaultContent",""),z(Ae,"_internalPadding",0),z(Ae,"_defaultColor",null),z(Ae,"_defaultFontSize",10),z(Ae,"_type","freetext"),z(Ae,"_editorType",kt.FREETEXT);sw=Ae,xt=class{toSVGPath(){ie("Abstract method `toSVGPath` must be implemented.")}get box(){ie("Abstract getter `box` must be implemented.")}serialize(t,e){ie("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=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,oi,tS).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,n,s,o){return new tx(t,e,i,n,s,o)}getOutlines(){let t=a(this,ms),e=a(this,_r),i=a(this,Lt),[n,s,o,l]=a(this,_n),c=new Float32Array((a(this,To)?.length??0)+2);for(let d=0,f=c.length-2;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,oi,nS).call(this,u,h),this.newFreeDrawOutline(u,c,a(this,_n),a(this,Gh),a(this,jh),a(this,Hh))}};_n=new WeakMap,_r=new WeakMap,jh=new WeakMap,Hh=new WeakMap,ms=new WeakMap,Lt=new WeakMap,fc=new WeakMap,pc=new WeakMap,Am=new WeakMap,vm=new WeakMap,Gh=new WeakMap,$h=new WeakMap,To=new WeakMap,Em=new WeakMap,Tx=new WeakMap,Sx=new WeakMap,oi=new WeakSet,Ef=function(){let t=a(this,Lt).subarray(4,6),e=a(this,Lt).subarray(16,18),[i,n,s,o]=a(this,_n);return[(a(this,fc)+(t[0]-e[0])/2-i)/s,(a(this,pc)+(t[1]-e[1])/2-n)/o,(a(this,fc)+(e[0]-t[0])/2-i)/s,(a(this,pc)+(e[1]-t[1])/2-n)/o]},JT=function(){let[t,e,i,n]=a(this,_n),[s,o,l,c]=b(this,oi,Ef).call(this);return`M${(a(this,Lt)[2]-t)/i} ${(a(this,Lt)[3]-e)/n} L${(a(this,Lt)[4]-t)/i} ${(a(this,Lt)[5]-e)/n} L${s} ${o} L${l} ${c} L${(a(this,Lt)[16]-t)/i} ${(a(this,Lt)[17]-e)/n} L${(a(this,Lt)[14]-t)/i} ${(a(this,Lt)[15]-e)/n} Z`},tS=function(t){let e=a(this,_r);t.push(`L${e[4]} ${e[5]} Z`)},eS=function(t){let[e,i,n,s]=a(this,_n),o=a(this,Lt).subarray(4,6),l=a(this,Lt).subarray(16,18),[c,u,h,d]=b(this,oi,Ef).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}`)},iS=function(t){let e=a(this,Lt),[i,n,s,o]=a(this,_n),[l,c,u,h]=b(this,oi,Ef).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,_n),a(this,Gh),a(this,jh),a(this,Hh))},nS=function(t,e){let i=a(this,_r);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+=6},rS=function(t,e){let i=a(this,Lt).subarray(4,6),n=a(this,Lt).subarray(16,18),[s,o,l,c]=a(this,_n),[u,h,d,f]=b(this,oi,Ef).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},x(Gs,Em,8),x(Gs,Tx,2),x(Gs,Sx,a(Gs,Em)+a(Gs,Tx));J0=Gs,tx=class extends xt{constructor(e,i,n,s,o,l){super();x(this,Dx);x(this,Vh);x(this,mc,new Float32Array(4));x(this,ga);x(this,Cm);x(this,Nn);x(this,Tm);x(this,Xe);p(this,Xe,e),p(this,Nn,i),p(this,Vh,n),p(this,Tm,s),p(this,ga,o),p(this,Cm,l),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],b(this,Dx,sS).call(this,l);let[c,u,h,d]=a(this,mc);for(let f=0,m=e.length;fw?(l=A,c=w):c===w&&(l=d(l,A)),hf[1]?(l=f[0],c=f[1]):c===f[1]&&(l=d(l,f[0])),he[0]-i[0]||e[1]-i[1]||e[2]-i[2]);let t=[];for(let e of a(this,So))e[3]?(t.push(...b(this,Qi,ow).call(this,e)),b(this,Qi,oS).call(this,e)):(b(this,Qi,lS).call(this,e),t.push(...b(this,Qi,ow).call(this,e)));return b(this,Qi,aS).call(this,t)}};Sm=new WeakMap,Dm=new WeakMap,Im=new WeakMap,So=new WeakMap,Nr=new WeakMap,Qi=new WeakSet,aS=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;o0;){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 y;if(i.has(h))y=h;else if(i.has(d))y=d;else break;i.delete(y),[l,c,u,h,d]=y,f!==l&&(s.push(f,m,l,m===c?c:u),f=l),m=m===c?u:c}s.push(f,m)}return new lw(n,a(this,Sm),a(this,Dm),a(this,Im))},y0=function(t){let e=a(this,Nr),i=0,n=e.length-1;for(;i<=n;){let s=i+n>>1,o=e[s][0];if(o===t)return s;o=0;n--){let[s,o]=a(this,Nr)[n];if(s!==t)break;if(s===t&&o===e){a(this,Nr).splice(n,1);return}}},ow=function(t){let[e,i,n]=t,s=[[e,i,n]],o=b(this,Qi,y0).call(this,n);for(let l=0;l=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};lw=class extends xt{constructor(e,i,n,s){super();x(this,km);x(this,qh);p(this,qh,e),p(this,km,i),this.firstPoint=n,this.lastPoint=s}toSVGPath(){let e=[];for(let i of a(this,qh)){let[n,s]=i;e.push(`M${n} ${s}`);for(let o=2;o-1?(p(this,Di,!0),b(this,Pt,b0).call(this,e),b(this,Pt,al).call(this)):a(this,xa)&&(p(this,Wh,e.anchorNode),p(this,_m,e.anchorOffset),p(this,Mm,e.focusNode),p(this,Fm,e.focusOffset),b(this,Pt,uw).call(this),b(this,Pt,al).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){let e=te.prototype;return _t(this,"_keyboardManager",new Fc([[["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,Di)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:a(this,ur),methodOfCreation:a(this,Pm)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,i){be.initialize(e,i),te._defaultColor||(te._defaultColor=i.highlightColors?.values().next().value||"#fff066")}static updateDefaultParams(e,i){switch(e){case Ht.HIGHLIGHT_COLOR:te._defaultColor=i;break;case Ht.HIGHLIGHT_THICKNESS:te._defaultThickness=i;break}}translateInPage(e,i){}get toolbarPosition(){return a(this,Yh)}get commentButtonPosition(){return a(this,Xh)}updateParams(e,i){switch(e){case Ht.HIGHLIGHT_COLOR:b(this,Pt,cS).call(this,i);break;case Ht.HIGHLIGHT_THICKNESS:b(this,Pt,uS).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[Ht.HIGHLIGHT_COLOR,te._defaultColor],[Ht.HIGHLIGHT_THICKNESS,te._defaultThickness]]}get propertiesToUpdate(){return[[Ht.HIGHLIGHT_COLOR,this.color||te._defaultColor],[Ht.HIGHLIGHT_THICKNESS,a(this,ur)||te._defaultThickness],[Ht.HIGHLIGHT_FREE,a(this,Di)]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(a(this,Fn),{root:{fill:this.color,"fill-opacity":this.opacity}}),a(this,Nm)?.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",p(this,Nm,new $f({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,Pt,A0).call(this))}getBaseTranslation(){return[0,0]}getRect(e,i){return super.getRect(e,i,b(this,Pt,A0).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){b(this,Pt,hw).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Pt,al).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let i=!1;this.parent&&!e?b(this,Pt,hw).call(this):e&&(b(this,Pt,al).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,Di)?(e=(e-this.rotation+360)%360,n=b(s=te,pr,Iu).call(s,a(this,Mn).box,e)):n=b(o=te,pr,Iu).call(o,[this.x,this.y,this.width,this.height],e),i.updateProperties(a(this,Fn),{bbox:n,root:{"data-main-rotation":e}}),i.updateProperties(a(this,Ui),{bbox:b(l=te,pr,Iu).call(l,a(this,dn).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;let e=super.render();a(this,Kh)&&(e.setAttribute("aria-label",a(this,Kh)),e.setAttribute("role","mark")),a(this,Di)?e.classList.add("free"):this.div.addEventListener("keydown",b(this,Pt,dS).bind(this),{signal:this._uiManager._signal});let i=p(this,xc,document.createElement("div"));return e.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",i.style.clipPath=a(this,gc),this.setDims(),RC(this,a(this,xc),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{hovered:!1}})}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:b(this,Pt,w0).call(this,!0);break;case 1:case 3:b(this,Pt,w0).call(this,!1);break}}select(){super.select(),a(this,Ui)&&this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),a(this,Ui)&&(this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{selected:!1}}),a(this,Di)||b(this,Pt,w0).call(this,!1))}get _mustFixPosition(){return!a(this,Di)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(a(this,Fn),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(a(this,Ui),{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=y=>{d.abort(),b(this,pr,gS).call(this,e,y)};window.addEventListener("blur",m,{signal:f}),window.addEventListener("pointerup",m,{signal:f}),window.addEventListener("pointerdown",ke,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Hn,{signal:f}),n.addEventListener("pointermove",b(this,pr,mS).bind(this,e),{signal:f}),this._freeHighlight=new Yf({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,T;let s=null;if(e instanceof K0){let{data:{quadPoints:k,rect:N,rotation:F,id:L,color:Y,opacity:q,popupRef:G,richText:j,contentsObj:tt,creationDate:et,modificationDate:_},parent:{page:{pageNumber:X}}}=e;s=e={annotationType:kt.HIGHLIGHT,color:Array.from(Y),opacity:q,quadPoints:k,boxes:null,pageIndex:X-1,rect:N.slice(0),rotation:F,annotationElementId:L,id:L,deleted:!1,popupRef:G,richText:j,comment:tt?.str||null,creationDate:et,modificationDate:_}}else if(e instanceof Wf){let{data:{inkLists:k,rect:N,rotation:F,id:L,color:Y,borderStyle:{rawWidth:q},popupRef:G,richText:j,contentsObj:tt,creationDate:et,modificationDate:_},parent:{page:{pageNumber:X}}}=e;s=e={annotationType:kt.HIGHLIGHT,color:Array.from(Y),thickness:q,inkLists:k,boxes:null,pageIndex:X-1,rect:N.slice(0),rotation:F,annotationElementId:L,id:L,deleted:!1,popupRef:G,richText:j,comment:tt?.str||null,creationDate:et,modificationDate:_}}let{color:o,quadPoints:l,inkLists:c,outlines:u,opacity:h}=e,d=await super.deserialize(e,i,n);d.color=ht.makeHexColor(...o),d.opacity=h||1,c&&p(d,ur,e.thickness),d._initialData=s,e.comment&&d.setCommentData(e);let[f,m]=d.pageDimensions,[y,g]=d.pageTranslation;if(l){let k=p(d,xa,[]);for(let N=0;N=0)p(this,Fn,i),p(this,gc,n),this.parent.drawLayer.finalizeDraw(i,{bbox:e.box,path:{d:e.toSVGPath()}}),p(this,Ui,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:a(this,dn).box,path:{d:a(this,dn).toSVGPath()}},!0));else if(this.parent){let y=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(a(this,Fn),{bbox:b(f=te,pr,Iu).call(f,a(this,Mn).box,(y-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(a(this,Ui),{bbox:b(m=te,pr,Iu).call(m,a(this,dn).box,y),path:{d:a(this,dn).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[y,g]=this.parentDimensions;this.x=l,this.y=1-o,this.width=c*g/y,this.height=u*y/g;break}case 180:this.x=1-o,this.y=1-l,this.width=c,this.height=u;break;case 270:{let[y,g]=this.parentDimensions;this.x=1-l,this.y=o,this.width=c*g/y,this.height=u*y/g;break}}let{firstPoint:h}=e;p(this,Xh,[(h[0]-o)/c,(h[1]-l)/u]);let{lastPoint:d}=a(this,dn);p(this,Yh,[(d[0]-o)/c,(d[1]-l)/u])},cS=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,te._defaultOpacity),undo:i.bind(this,n,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Ht.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)},uS=function(e){let i=a(this,ur),n=s=>{p(this,ur,s),b(this,Pt,hS).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:Ht.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},hS=function(e){a(this,Di)&&(b(this,Pt,b0).call(this,{highlightOutlines:a(this,Mn).getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims())},hw=function(){a(this,Fn)===null||!this.parent||(this.parent.drawLayer.remove(a(this,Fn)),p(this,Fn,null),this.parent.drawLayer.remove(a(this,Ui)),p(this,Ui,null))},al=function(e=this.parent){a(this,Fn)===null&&({id:Ye(this,Fn)._,clipPathId:Ye(this,gc)._}=e.drawLayer.draw({bbox:a(this,Mn).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:a(this,Di)},path:{d:a(this,Mn).toSVGPath()}},!1,!0),p(this,Ui,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:a(this,Di)},bbox:a(this,dn).box,path:{d:a(this,dn).toSVGPath()}},a(this,Di))),a(this,xc)&&(a(this,xc).style.clipPath=a(this,gc)))},pr=new WeakSet,Iu=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]},dS=function(e){te._keyboardManager.exec(this,e)},w0=function(e){if(!a(this,Wh))return;let i=window.getSelection();e?i.setPosition(a(this,Wh),a(this,_m)):i.setPosition(a(this,Mm),a(this,Fm))},A0=function(){return a(this,Di)?this.rotation:0},fS=function(){if(a(this,Di))return null;let[e,i]=this.pageDimensions,[n,s]=this.pageTranslation,o=a(this,xa),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,y=(1-h)*i+s;l[c]=l[c+4]=m,l[c+1]=l[c+3]=y,l[c+2]=l[c+6]=m+d*e,l[c+5]=l[c+7]=y-f*i,c+=8}return l},pS=function(e){return a(this,Mn).serialize(e,b(this,Pt,A0).call(this))},mS=function(e,i){this._freeHighlight.add(i)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},gS=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=""},xS=function(e){let{color:i}=this._initialData;return this.hasEditedComment||e.color.some((n,s)=>n!==i[s])},x(te,pr),z(te,"_defaultColor",null),z(te,"_defaultOpacity",1),z(te,"_defaultThickness",12),z(te,"_type","highlight"),z(te,"_editorType",kt.HIGHLIGHT),z(te,"_freeHighlightId",-1),z(te,"_freeHighlight",null),z(te,"_freeHighlightClipId","");ex=te,ix=class{constructor(){x(this,yc,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,yc)[t]=e}toSVGProperties(){let t=a(this,yc);return p(this,yc,Object.create(null)),{root:t}}reset(){p(this,yc,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){ie("Not implemented")}};yc=new WeakMap;jt=class jt extends be{constructor(e){super(e);x(this,Wt);x(this,Pn,null);x(this,Zh);z(this,"_colorPicker",null);z(this,"_drawId",null);p(this,Zh,e.mustBeCommitted||!1),this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(e){e.drawOutlines&&(b(this,Wt,dw).call(this,e),b(this,Wt,Cf).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){ie("Not implemented")}static get typesMap(){ie("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(jt,fi).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,Pn).updateProperty(i,c);u&&b(this,Wt,Tf).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,jt._mergeSVGProperties(a(this,Pn).getPathResizingSVGProperties(b(this,Wt,v0).call(this)),{bbox:b(this,Wt,ku).call(this)}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,jt._mergeSVGProperties(a(this,Pn).getPathResizedSVGProperties(b(this,Wt,v0).call(this)),{bbox:b(this,Wt,ku).call(this)}))}_onTranslating(e,i){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:b(this,Wt,ku).call(this)})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,jt._mergeSVGProperties(a(this,Pn).getPathTranslatedSVGProperties(b(this,Wt,v0).call(this),this.parentDimensions),{bbox:b(this,Wt,ku).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,Zh)&&(p(this,Zh,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){b(this,Wt,pw).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Wt,Cf).call(this),b(this,Wt,Tf).call(this,a(this,Pn).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let i=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),b(this,Wt,pw).call(this)):e&&(this._uiManager.addShouldRescale(this),b(this,Wt,Cf).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,jt._mergeSVGProperties({bbox:b(this,Wt,ku).call(this)},a(this,Pn).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&b(this,Wt,Tf).call(this,a(this,Pn).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){ie("Not implemented")}static startDrawing(e,i,n,s){let{target:o,offsetX:l,offsetY:c,pointerId:u,pointerType:h}=s;if(Oi.isInitializedAndDifferentPointerType(h))return;let{viewport:{rotation:d}}=e,{width:f,height:m}=o.getBoundingClientRect(),y=p(jt,bc,new AbortController),g=e.combinedSignal(y);if(Oi.setPointer(h,u),window.addEventListener("pointerup",A=>{Oi.isSamePointerIdOrRemove(A.pointerId)&&this._endDraw(A)},{signal:g}),window.addEventListener("pointercancel",A=>{Oi.isSamePointerIdOrRemove(A.pointerId)&&this._currentParent.endDrawingSession()},{signal:g}),window.addEventListener("pointerdown",A=>{Oi.isSamePointerType(A.pointerType)&&(Oi.initializeAndAddPointerId(A.pointerId),a(jt,fi).isCancellable()&&(a(jt,fi).removeLastElement(),a(jt,fi).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:g}),window.addEventListener("contextmenu",Hn,{signal:g}),o.addEventListener("pointermove",this._drawMove.bind(this),{signal:g}),o.addEventListener("touchmove",A=>{Oi.isSameTimeStamp(A.timeStamp)&&ke(A)},{signal:g}),e.toggleDrawing(),i._editorUndoBar?.hide(),a(jt,fi)){e.drawLayer.updateProperties(this._currentDrawId,a(jt,fi).startNew(l,c,f,m,d));return}i.updateUIForDefaultProperties(this),p(jt,fi,this.createDrawerInstance(l,c,f,m,d)),p(jt,wc,this.getDefaultDrawingOptions()),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(a(jt,wc).toSVGProperties(),a(jt,fi).defaultSVGProperties),!0,!1)}static _drawMove(e){if(Oi.isSameTimeStamp(e.timeStamp),!a(jt,fi))return;let{offsetX:i,offsetY:n,pointerId:s}=e;if(Oi.isSamePointerId(s)){if(Oi.isUsingMultiplePointers()){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,a(jt,fi).add(i,n)),Oi.setTimeStamp(e.timeStamp),ke(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,p(jt,fi,null),p(jt,wc,null),Oi.clearTimeStamp()),a(jt,bc)&&(a(jt,bc).abort(),p(jt,bc,null),Oi.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(jt,fi).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){let n=a(jt,fi),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:Ht.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){let i=this._currentParent;if(!i)return null;if(i.toggleDrawing(!0),i.cleanUndoStack(Ht.DRAW_STEP),!a(jt,fi).isEmpty()){let{pageDimensions:[n,s],scale:o}=i,l=i.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:a(jt,fi).getOutlines(n*o,s*o,o,this._INNER_MARGIN),drawingOptions:a(jt,wc),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){ie("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,Wt,dw).call(d,{drawOutlines:u}),b(f=h,Wt,Cf).call(f),h.onScaleChanging(),h.rotate(),h}serializeDraw(e){let[i,n]=this.pageTranslation,[s,o]=this.pageDimensions;return a(this,Pn).serialize([i,n,s,o],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};Pn=new WeakMap,Zh=new WeakMap,fi=new WeakMap,bc=new WeakMap,wc=new WeakMap,Wt=new WeakSet,dw=function({drawOutlines:e,drawId:i,drawingOptions:n}){p(this,Pn,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,Wt,fw).call(this,e,this.parent),b(this,Wt,Tf).call(this,e.box)},fw=function(e,i){let{id:n}=i.drawLayer.draw(jt._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n},pw=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},Cf=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,Wt,fw).call(this,a(this,Pn),e)}},yS=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]}},v0=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]}},Tf=function(e){[this.x,this.y,this.width,this.height]=b(this,Wt,yS).call(this,e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},ku=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]}},z(jt,"_currentDrawId",-1),z(jt,"_currentParent",null),x(jt,fi,null),x(jt,bc,null),x(jt,wc,null),z(jt,"_INNER_MARGIN",3);nx=jt,mw=class{constructor(t,e,i,n,s,o){x(this,Jh);x(this,gs,new Float64Array(6));x(this,pi);x(this,mi);x(this,Ac);x(this,Qh);x(this,Xi);x(this,Ii,"");x(this,hr,0);x(this,vc,new Rc);x(this,Ec);x(this,Cc);p(this,Ec,i),p(this,Cc,n),p(this,Ac,s),p(this,Qh,o),[t,e]=b(this,Jh,E0).call(this,t,e);let l=p(this,pi,[NaN,NaN,NaN,NaN,t,e]);p(this,Xi,[t,e]),p(this,mi,[{line:l,points:a(this,Xi)}]),a(this,gs).set(l,0)}updateProperty(t,e){t==="stroke-width"&&p(this,Qh,e)}isEmpty(){return!a(this,mi)||a(this,mi).length===0}isCancellable(){return a(this,Xi).length<=10}add(t,e){[t,e]=b(this,Jh,E0).call(this,t,e);let[i,n,s,o]=a(this,gs).subarray(2,6),l=t-s,c=e-o;return Math.hypot(a(this,Ec)*l,a(this,Cc)*c)<=2?null:(a(this,Xi).push(t,e),isNaN(i)?(a(this,gs).set([s,o,t,e],2),a(this,pi).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(a(this,gs)[0])&&a(this,pi).splice(6,6),a(this,gs).set([i,n,s,o,t,e],0),a(this,pi).push(...xt.createBezierPoints(i,n,s,o,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){let i=this.add(t,e);return i||(a(this,Xi).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,n,s){p(this,Ec,i),p(this,Cc,n),p(this,Ac,s),[t,e]=b(this,Jh,E0).call(this,t,e);let o=p(this,pi,[NaN,NaN,NaN,NaN,t,e]);p(this,Xi,[t,e]);let l=a(this,mi).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),a(this,mi).push({line:o,points:a(this,Xi)}),a(this,gs).set(o,0),p(this,hr,0),this.toSVGPath(),null}getLastElement(){return a(this,mi).at(-1)}setLastElement(t){return a(this,mi)?(a(this,mi).push(t),p(this,pi,t.line),p(this,Xi,t.points),p(this,hr,0),{path:{d:this.toSVGPath()}}):a(this,vc).setLastElement(t)}removeLastElement(){if(!a(this,mi))return a(this,vc).removeLastElement();a(this,mi).pop(),p(this,Ii,"");for(let t=0,e=a(this,mi).length;tk??NaN),f,m,y,g),points:A(c[v].map(k=>k??NaN),f,m,y,g)});let w=new this.prototype.constructor;return w.build(d,n,s,1,u,h,o),w}get box(){return a(this,Yi)}updateProperty(e,i){return e==="stroke-width"?b(this,_i,AS).call(this,i):null}updateParentDimensions([e,i],n){let[s,o]=b(this,_i,js).call(this);p(this,xs,e),p(this,ys,i),p(this,td,n);let[l,c]=b(this,_i,js).call(this),u=l-s,h=c-o,d=a(this,Yi);return d[0]-=u,d[1]-=h,d[2]+=2*u,d[3]+=2*h,d}updateRotation(e){return p(this,Om,e),{path:{transform:this.rotationTransform}}}get viewBox(){return a(this,Yi).map(xt.svgRound).join(" ")}get defaultProperties(){let[e,i]=a(this,Yi);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`}}}get rotationTransform(){let[,,e,i]=a(this,Yi),n=0,s=0,o=0,l=0,c=0,u=0;switch(a(this,Om)){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} ${xt.svgRound(c)} ${xt.svgRound(u)})`}getPathResizingSVGProperties([e,i,n,s]){let[o,l]=b(this,_i,js).call(this),[c,u,h,d]=a(this,Yi);if(Math.abs(h-o)<=xt.PRECISION||Math.abs(d-l)<=xt.PRECISION){let A=e+n/2-(c+h/2),w=i+s/2-(u+d/2);return{path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`,transform:`${this.rotationTransform} translate(${A} ${w})`}}}let f=(n-2*o)/(h-2*o),m=(s-2*l)/(d-2*l),y=h/n,g=d/s;return{path:{"transform-origin":`${xt.svgRound(c)} ${xt.svgRound(u)}`,transform:`${this.rotationTransform} scale(${y} ${g}) translate(${xt.svgRound(o)} ${xt.svgRound(l)}) scale(${f} ${m}) translate(${xt.svgRound(-o)} ${xt.svgRound(-l)})`}}}getPathResizedSVGProperties([e,i,n,s]){let[o,l]=b(this,_i,js).call(this),c=a(this,Yi),[u,h,d,f]=c;if(c[0]=e,c[1]=i,c[2]=n,c[3]=s,Math.abs(d-o)<=xt.PRECISION||Math.abs(f-l)<=xt.PRECISION){let w=e+n/2-(u+d/2),v=i+s/2-(h+f/2);for(let{line:T,points:k}of a(this,On))xt._translate(T,w,v,T),xt._translate(k,w,v,k);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let m=(n-2*o)/(d-2*o),y=(s-2*l)/(f-2*l),g=-m*(u+o)+e+o,A=-y*(h+l)+i+l;if(m!==1||y!==1||g!==0||A!==0)for(let{line:w,points:v}of a(this,On))xt._rescale(w,g,A,m,y,w),xt._rescale(v,g,A,m,y,v);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,i],n){let[s,o]=n,l=a(this,Yi),c=e-l[0],u=i-l[1];if(a(this,xs)===s&&a(this,ys)===o)for(let{line:h,points:d}of a(this,On))xt._translate(h,c,u,h),xt._translate(d,c,u,d);else{let h=a(this,xs)/s,d=a(this,ys)/o;p(this,xs,s),p(this,ys,o);for(let{line:f,points:m}of a(this,On))xt._rescale(f,c,u,h,d,f),xt._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":`${xt.svgRound(e)} ${xt.svgRound(i)}`}}}get defaultSVGProperties(){let e=a(this,Yi);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${xt.svgRound(e[0])} ${xt.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}};Yi=new WeakMap,Om=new WeakMap,Rm=new WeakMap,On=new WeakMap,xs=new WeakMap,ys=new WeakMap,td=new WeakMap,ed=new WeakMap,Tc=new WeakMap,_i=new WeakSet,js=function(e=a(this,Tc)){let i=a(this,Rm)+e/2*a(this,td);return a(this,ed)%180===0?[i/a(this,xs),i/a(this,ys)]:[i/a(this,ys),i/a(this,xs)]},bS=function(){let[e,i,n,s]=a(this,Yi),[o,l]=b(this,_i,js).call(this,0);return[e+o,i+l,n-2*o,s-2*l]},wS=function(){let e=p(this,Yi,new Float32Array([1/0,1/0,-1/0,-1/0]));for(let{line:s}of a(this,On)){if(s.length<=12){for(let c=4,u=s.length;cl!==i[c])||e.thickness!==n||e.opacity!==s||e.pageIndex!==o},z(Pu,"_type","ink"),z(Pu,"_editorType",kt.INK),z(Pu,"_defaultDrawingOptions",null);gw=Pu,Kf=class extends Rc{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}},jg=8,af=3,fr=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:y,actualBoundingBoxAscent:g,actualBoundingBoxDescent:A,fontBoundingBoxAscent:w,fontBoundingBoxDescent:v,width:T}=h.measureText(t),k=1.5,N=Math.ceil(Math.max(Math.abs(m)+Math.abs(y)||0,T)*k),F=Math.ceil(Math.max(Math.abs(g)+Math.abs(A)||d,Math.abs(w)+Math.abs(v)||d)*k);u=new OffscreenCanvas(N,F),h=u.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=f,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,N,F),h.fillStyle="black",h.fillText(t,N*(k-1)/2,F*(3-k)/2);let L=b(this,ne,bw).call(this,h.getImageData(0,0,N,F).data),Y=b(this,ne,DS).call(this,L),q=b(this,ne,ww).call(this,Y),G=b(this,ne,yw).call(this,L,N,F,q);return this.processDrawnLines({lines:{curves:G,width:N,height:F},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,ne,IS).call(this,t),[u,h]=b(this,ne,SS).call(this,o,l,c,Math.hypot(l,c)*a(this,Sc).sigmaSFactor,a(this,Sc).sigmaR,a(this,Sc).kernelSize),d=b(this,ne,ww).call(this,h),f=b(this,ne,yw).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),y=m/e,g=m/i,A=[];for(let{points:v}of c){let T=o?b(this,ne,TS).call(this,v):v;if(!T)continue;A.push(T);let k=T.length,N=new Float32Array(k),F=new Float32Array(3*(k===2?2:k-2));if(f.push({line:F,points:N}),k===2){N[0]=T[0]*y,N[1]=T[1]*g,F.set([NaN,NaN,NaN,NaN,N[0],N[1]],0);continue}let[L,Y,q,G]=T;L*=y,Y*=g,q*=y,G*=g,N.set([L,Y,q,G],0),F.set([NaN,NaN,NaN,NaN,L,Y],0);for(let j=4;j=-128&&l<=127?u=Int8Array:o>=-32768&&l<=32767?u=Int16Array:u=Int32Array;let h=t.length,d=jg+af*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 y=new CompressionStream("deflate-raw"),g=y.writable.getWriter();await g.ready,g.write(f);let A=u.prototype.constructor;for(let v of t){let T=new A(v.length-2);for(let k=2,N=v.length;k{await s.ready,await s.close()}).catch(()=>{});let o=null,l=0;for await(let T of i)o||(o=new Uint8Array(new Uint32Array(T.buffer,0,4)[0])),o.set(T,l),l+=T.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],y=c[6],g=c[7],A=[],w=(jg+af*y)*Uint32Array.BYTES_PER_ELEMENT,v;switch(g){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 T=0;T0?0:4:i===1?n+6:2-n},Mr=new WeakMap,ES=function(t,e,i,n,s,o,l){let c=b(this,ne,xw).call(this,i,n,s,o);for(let u=0;u<8;u++){let h=(-u+c-l+16)%8,d=a(this,Mr)[2*h],f=a(this,Mr)[2*h+1];if(t[(i+d)*e+(n+f)]!==0)return h}return-1},CS=function(t,e,i,n,s,o,l){let c=b(this,ne,xw).call(this,i,n,s,o);for(let u=0;u<8;u++){let h=(u+c+l+16)%8,d=a(this,Mr)[2*h],f=a(this,Mr)[2*h+1];if(t[(i+d)*e+(n+f)]!==0)return h}return-1},yw=function(t,e,i,n){let s=t.length,o=new Int32Array(s);for(let h=0;h=1&&o[f+1]===0)l+=1,g+=1,m>1&&(c=m);else{m!==1&&(c=Math.abs(m));continue}let A=[d,h],w=g===d+1,v={isHole:w,points:A,id:l,parent:0};u.push(v);let T;for(let j of u)if(j.id===c){T=j;break}T?T.isHole?v.parent=w?T.parent:c:v.parent=w?c:T.parent:v.parent=w?c:0;let k=b(this,ne,ES).call(this,o,e,h,d,y,g,0);if(k===-1){o[f]=-l,o[f]!==1&&(c=Math.abs(o[f]));continue}let N=a(this,Mr)[2*k],F=a(this,Mr)[2*k+1],L=h+N,Y=d+F;y=L,g=Y;let q=h,G=d;for(;;){let j=b(this,ne,CS).call(this,o,e,q,G,y,g,1);N=a(this,Mr)[2*j],F=a(this,Mr)[2*j+1];let tt=q+N,et=G+F;A.push(et,tt);let _=q*e+G;if(o[_+1]===0?o[_]=-l:o[_]===1&&(o[_]=l),tt===h&&et===d&&q===L&&G===Y){o[f]!==1&&(c=Math.abs(o[f]));break}else y=q,g=G,q=tt,G=et}}}return u},C0=function(t,e,i,n){if(i-e<=4){for(let L=e;LN&&(F=L,N=Y)}N>(u*k)**2?(b(this,ne,C0).call(this,t,e,F+2,n),b(this,ne,C0).call(this,t,F,i,n)):n.push(s,o)},TS=function(t){let e=[],i=t.length;return b(this,ne,C0).call(this,t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e},SS=function(t,e,i,n,s,o){let l=new Float32Array(o**2),c=-2*n**2,u=o>>1;for(let g=0;g=i))for(let Y=0;Y=e)continue;let G=t[L*e+q],j=l[F*o+Y]*h[Math.abs(G-v)];T+=G*j,k+=j}}let N=m[w]=Math.round(T/k);y[N]++}return[m,y]},DS=function(t){let e=new Uint32Array(256);for(let i of t)e[i]++;return e},bw=function(t){let e=t.length,i=new Uint8ClampedArray(e>>2),n=-1/0,s=1/0;for(let l=0,c=i.length;lc!==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},IS=function(t){let e=t,{width:i,height:n}=t,{maxDim:s}=a(this,Sc),o=i,l=n;if(i>s||n>s){let f=i,m=n,y=Math.log2(Math.max(i,n)/s),g=Math.floor(y);y=y===g?g-1:g;for(let w=0;w{i?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:i,thickness:n,width:s,height:o}=a(this,Io),l=Math.max(s,o),c=fr.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,Io,e);p(this,Do,c instanceof Kf),this.description=n;let u;a(this,Do)?u=bn.getDefaultDrawingOptions():(u=bn._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 fr.process(e,i,n,s,bn._INNER_MARGIN)}getFromText(e,i){let{rawDims:{pageWidth:n,pageHeight:s},rotation:o}=this.parent.viewport;return fr.extractContoursFromText(e,i,n,s,o,bn._INNER_MARGIN)}getDrawnSignature(e){let{rawDims:{pageWidth:i,pageHeight:n},rotation:s}=this.parent.viewport;return fr.processDrawnLines({lines:e,pageWidth:i,pageHeight:n,rotation:s,innerMargin:bn._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:i}){e?this._drawingOptions=bn.getDefaultDrawingOptions():(this._drawingOptions=bn._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,Do),color:[0,0,0],thickness:a(this,Do)?0:s});return this.addComment(o),e?(o.paths={lines:i,points:n},o.uuid=a(this,Dc),o.isCopy=!0):o.lines=i,a(this,bs)&&(o.accessibilityData={type:"Figure",alt:a(this,bs)}),o}static deserializeDraw(e,i,n,s,o,l){return l.areContours?Kf.deserialize(e,i,n,s,o,l):Rc.deserialize(e,i,n,s,o,l)}static async deserialize(e,i,n){let s=await super.deserialize(e,i,n);return p(s,Do,e.areContours),s.description=e.accessibilityData?.alt||"",p(s,Dc,e.uuid),s}};Do=new WeakMap,bs=new WeakMap,Io=new WeakMap,Dc=new WeakMap,z(bn,"_type","signature"),z(bn,"_editorType",kt.SIGNATURE),z(bn,"_defaultDrawingOptions",null);Ew=bn,Sf=class extends be{constructor(e){super({...e,name:"stampEditor"});x(this,Xt);x(this,Ee,null);x(this,gi,null);x(this,ko,null);x(this,ya,null);x(this,_o,null);x(this,id,"");x(this,ba,null);x(this,Ic,!1);x(this,ws,null);x(this,Rn,!1);x(this,nd,!1);p(this,ya,e.bitmapUrl),p(this,_o,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,i){be.initialize(e,i)}static isHandlingMimeForPasting(e){return F0.includes(e)}static paste(e,i){i.pasteEditor({mode:kt.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,gi)&&(p(this,Ee,null),this._uiManager.imageManager.deleteId(a(this,gi)),a(this,ba)?.remove(),p(this,ba,null),a(this,ws)&&(clearTimeout(a(this,ws)),p(this,ws,null))),super.remove()}rebuild(){if(!this.parent){a(this,gi)&&b(this,Xt,T0).call(this);return}super.rebuild(),this.div!==null&&(a(this,gi)&&a(this,ba)===null&&b(this,Xt,T0).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(a(this,ko)||a(this,Ee)||a(this,ya)||a(this,_o)||a(this,gi)||a(this,Ic))}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,Ic)||(a(this,Ee)?b(this,Xt,S0).call(this):b(this,Xt,T0).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,gi,n),s&&p(this,Ee,s),p(this,Ic,!1),b(this,Xt,S0).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;a(this,ws)!==null&&clearTimeout(a(this,ws)),p(this,ws,setTimeout(()=>{p(this,ws,null),b(this,Xt,Cw).call(this)},200))}copyCanvas(e,i,n=!1){e||(e=224);let{width:s,height:o}=a(this,Ee),l=new Es,c=a(this,Ee),u=s,h=o,d=null;if(i){if(s>i||o>i){let L=Math.min(i/s,i/o);u=Math.floor(s*L),h=Math.floor(o*L)}d=document.createElement("canvas");let m=d.width=Math.ceil(u*l.sx),y=d.height=Math.ceil(h*l.sy);a(this,Rn)||(c=b(this,Xt,D0).call(this,m,y));let g=d.getContext("2d");g.filter=this._uiManager.hcmFilter;let A="white",w="#cfcfd8";this._uiManager.hcmFilter!=="none"?w="black":ib.isDarkMode&&(A="#8f8f9d",w="#42414d");let v=15,T=v*l.sx,k=v*l.sy,N=new OffscreenCanvas(T*2,k*2),F=N.getContext("2d");F.fillStyle=A,F.fillRect(0,0,T*2,k*2),F.fillStyle=w,F.fillRect(0,0,T,k),F.fillRect(T,k,T,k),g.fillStyle=g.createPattern(N,"repeat"),g.fillRect(0,0,m,y),g.drawImage(c,0,0,c.width,c.height,0,0,m,y)}let f=null;if(n){let m,y;if(l.symmetric&&c.widthe||o>e){let w=Math.min(e/s,e/o);m=Math.floor(s*w),y=Math.floor(o*w),a(this,Rn)||(c=b(this,Xt,D0).call(this,m,y))}let A=new OffscreenCanvas(m,y).getContext("2d",{willReadFrequently:!0});A.drawImage(c,0,0,c.width,c.height,0,0,m,y),f={width:m,height:y,data:A.getImageData(0,0,m,y).data}}return{canvas:d,width:u,height:h,imageData:f}}static async deserialize(e,i,n){let s=null,o=!1;if(e instanceof Z0){let{data:{rect:A,rotation:w,id:v,structParent:T,popupRef:k,richText:N,contentsObj:F,creationDate:L,modificationDate:Y},container:q,parent:{page:{pageNumber:G}},canvas:j}=e,tt,et;j?(delete e.canvas,{id:tt,bitmap:et}=n.imageManager.getFromCanvas(q.id,j),j.remove()):(o=!0,e._hasNoCanvas=!0);let _=(await i._structTree.getAriaAttributes(`${_u}${v}`))?.get("aria-label")||"";s=e={annotationType:kt.STAMP,bitmapId:tt,bitmap:et,pageIndex:G-1,rect:A.slice(0),rotation:w,annotationElementId:v,id:v,deleted:!1,accessibilityData:{decorative:!1,altText:_},isSvg:!1,structParent:T,popupRef:k,richText:N,comment:F?.str||null,creationDate:L,modificationDate:Y}}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,Ic,!0)):d&&n.imageManager.isValidId(d)?(p(l,gi,d),u&&p(l,Ee,u)):p(l,ya,h),p(l,Rn,f);let[y,g]=l.pageDimensions;return l.width=(c[2]-c[0])/y,l.height=(c[3]-c[1])/g,m&&(l.altTextData=m),l._initialData=s,e.comment&&l.setCommentData(e),p(l,nd,!!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,gi),isSvg:a(this,Rn)});if(this.addComment(n),e)return n.bitmapUrl=b(this,Xt,I0).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,Xt,kS).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,Rn)?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!i.stamps.has(a(this,gi)))i.stamps.set(a(this,gi),{area:l,serialized:n}),n.bitmap=b(this,Xt,I0).call(this,!1);else if(a(this,Rn)){let c=i.stamps.get(a(this,gi));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=b(this,Xt,I0).call(this,!1))}return n}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}};Ee=new WeakMap,gi=new WeakMap,ko=new WeakMap,ya=new WeakMap,_o=new WeakMap,id=new WeakMap,ba=new WeakMap,Ic=new WeakMap,ws=new WeakMap,Rn=new WeakMap,nd=new WeakMap,Xt=new WeakSet,Df=function(e,i=!1){if(!e){this.remove();return}p(this,Ee,e.bitmap),i||(p(this,gi,e.id),p(this,Rn,e.isSvg)),e.file&&p(this,id,e.file.name),b(this,Xt,S0).call(this)},If=function(){if(p(this,ko,null),this._uiManager.enableWaiting(!1),!!a(this,ba)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,Ee)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,Ee)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},T0=function(){if(a(this,gi)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(a(this,gi)).then(n=>b(this,Xt,Df).call(this,n,!0)).finally(()=>b(this,Xt,If).call(this));return}if(a(this,ya)){let n=a(this,ya);p(this,ya,null),this._uiManager.enableWaiting(!0),p(this,ko,this._uiManager.imageManager.getFromUrl(n).then(s=>b(this,Xt,Df).call(this,s)).finally(()=>b(this,Xt,If).call(this)));return}if(a(this,_o)){let n=a(this,_o);p(this,_o,null),this._uiManager.enableWaiting(!0),p(this,ko,this._uiManager.imageManager.getFromFile(n).then(s=>b(this,Xt,Df).call(this,s)).finally(()=>b(this,Xt,If).call(this)));return}let e=document.createElement("input");e.type="file",e.accept=F0.join(",");let i=this._uiManager._signal;p(this,ko,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,Xt,Df).call(this,s)}n()},{signal:i}),e.addEventListener("cancel",()=>{this.remove(),n()},{signal:i})}).finally(()=>b(this,Xt,If).call(this))),e.click()},S0=function(){let{div:e}=this,{width:i,height:n}=a(this,Ee),[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,ba,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,Xt,Cw).call(this),a(this,nd)||(this.parent.addUndoableEditor(this),p(this,nd,!0)),this._reportTelemetry({action:"inserted_image"}),a(this,id)&&this.div.setAttribute("aria-description",a(this,id)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},D0=function(e,i){let{width:n,height:s}=a(this,Ee),o=n,l=s,c=a(this,Ee);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},Cw=function(){let[e,i]=this.parentDimensions,{width:n,height:s}=this,o=new Es,l=Math.ceil(n*e*o.sx),c=Math.ceil(s*i*o.sy),u=a(this,ba);if(!u||u.width===l&&u.height===c)return;u.width=l,u.height=c;let h=a(this,Rn)?a(this,Ee):b(this,Xt,D0).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)},I0=function(e){if(e){if(a(this,Rn)){let s=this._uiManager.imageManager.getSvgUrl(a(this,gi));if(s)return s}let i=document.createElement("canvas");return{width:i.width,height:i.height}=a(this,Ee),i.getContext("2d").drawImage(a(this,Ee),0,0),i.toDataURL()}if(a(this,Rn)){let[i,n]=this.pageDimensions,s=Math.round(this.width*i*Da.PDF_TO_CSS_UNITS),o=Math.round(this.height*n*Da.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(s,o);return l.getContext("2d").drawImage(a(this,Ee),0,0,a(this,Ee).width,a(this,Ee).height,0,0,s,o),l.transferToImageBitmap()}return structuredClone(a(this,Ee))},kS=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}},z(Sf,"_type","stamp"),z(Sf,"_editorType",kt.STAMP);wr=class wr{constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:n,accessibilityManager:s,annotationLayer:o,drawLayer:l,textLayer:c,viewport:u,l10n:h}){x(this,ge);x(this,kc);x(this,rd,!1);x(this,No,null);x(this,Mo,null);x(this,wa,null);x(this,fn,new Map);x(this,Fo,!1);x(this,sd,!1);x(this,ad,!1);x(this,Fr,null);x(this,Aa,null);x(this,xi,null);x(this,va,null);x(this,Po,null);x(this,od,-1);x(this,wt);let d=[...a(wr,Oo).values()];if(!wr._initialized){wr._initialized=!0;for(let f of d)f.initialize(h,t)}t.registerEditorTypes(d),p(this,wt,t),this.pageIndex=e,this.div=i,p(this,kc,s),p(this,No,o),this.viewport=u,p(this,xi,c),this.drawLayer=l,this._structTree=n,a(this,wt).addLayer(this)}get isEmpty(){return a(this,fn).size===0}get isInvisible(){return this.isEmpty&&a(this,wt).getMode()===kt.NONE}updateToolbar(t){a(this,wt).updateToolbar(t)}updateMode(t=a(this,wt).getMode()){switch(b(this,ge,k0).call(this),t){case kt.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case kt.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case kt.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===kt.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(let i of a(wr,Oo).values())e.toggle(`${i._type}Editing`,t===i._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===a(this,xi)?.div}setEditingState(t){a(this,wt).setEditingState(t)}addCommands(t){a(this,wt).addCommands(t)}cleanUndoStack(t){a(this,wt).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,No)?.togglePointerEvents(t)}async enable(){p(this,ad,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),a(this,Po)?.abort(),p(this,Po,null);let t=new Set;for(let i of a(this,ge,Tw))i.enableEditing(),i.show(!0),i.annotationElementId&&(a(this,wt).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));let e=a(this,No);if(e)for(let i of e.getEditableAnnotations()){if(i.hide(),a(this,wt).isDeletedAnnotationElement(i.data.id)||t.has(i.data.id))continue;let n=await this.deserialize(i);n&&(this.addOrRebuild(n),n.enableEditing())}p(this,ad,!1),a(this,wt)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(p(this,sd,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),a(this,xi)&&!a(this,Po)){p(this,Po,new AbortController);let n=a(this,wt).combinedSignal(a(this,Po));a(this,xi).div.addEventListener("pointerdown",s=>{let{clientX:l,clientY:c,timeStamp:u}=s,h=a(this,od);if(u-h>500){p(this,od,u);return}p(this,od,-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,y=new RegExp(`^${Of}[0-9]+$`);for(let A of f)if(y.test(A.id)){m=A.id;break}if(!m)return;let g=a(this,fn).get(m);g?.annotationElementId===null&&(s.stopPropagation(),s.preventDefault(),g.dblclick(s))},{signal:n,capture:!0})}let t=a(this,No),e=[];if(t){let n=new Map,s=new Map;for(let o of a(this,ge,Tw)){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,wt).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,wt).addChangedExistingAnnotation(c),c.renderAnnotationElement(o)&&c.show(!1)),o.show()}}b(this,ge,k0).call(this),this.isEmpty&&(this.div.hidden=!0);let{classList:i}=this.div;for(let n of a(wr,Oo).values())i.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),p(this,sd,!1)}getEditableAnnotation(t){return a(this,No)?.getEditableAnnotation(t)||null}setActiveEditor(t){a(this,wt).getActive()!==t&&a(this,wt).setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,a(this,xi)?.div&&!a(this,va)){p(this,va,new AbortController);let t=a(this,wt).combinedSignal(a(this,va));a(this,xi).div.addEventListener("pointerdown",b(this,ge,_S).bind(this),{signal:t}),a(this,xi).div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,a(this,xi)?.div&&a(this,va)&&(a(this,va).abort(),p(this,va,null),a(this,xi).div.classList.remove("highlighting"))}enableClick(){if(a(this,Mo))return;p(this,Mo,new AbortController);let t=a(this,wt).combinedSignal(a(this,Mo));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,Mo)?.abort(),p(this,Mo,null)}attach(t){a(this,fn).set(t.id,t);let{annotationElementId:e}=t;e&&a(this,wt).isDeletedAnnotationElement(e)&&a(this,wt).removeDeletedAnnotationElement(t)}detach(t){a(this,fn).delete(t.id),a(this,kc)?.removePointerInTextLayer(t.contentDiv),!a(this,sd)&&t.annotationElementId&&a(this,wt).addDeletedAnnotationElement(t)}remove(t){this.detach(t),a(this,wt).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(a(this,wt).addDeletedAnnotationElement(t),be.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,wt).addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!a(this,ad)),a(this,wt).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!a(this,wa)&&(t._focusEventsAllowed=!1,p(this,wa,setTimeout(()=>{p(this,wa,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:a(this,wt)._signal}),e.focus())},0))),t._structTreeParentId=a(this,kc)?.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,fn).values())if(e.uid===t)return e;return null}combinedSignal(t){return a(this,wt).combinedSignal(t)}canCreateNewEmptyEditor(){return a(this,ge,Jr)?.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await a(this,wt).updateMode(t.mode);let{offsetX:i,offsetY:n}=b(this,ge,Dw).call(this),s=a(this,wt).getId(),o=b(this,ge,Sw).call(this,{parent:this,id:s,x:i,y:n,uiManager:a(this,wt),isCentered:!0,...e});o&&this.add(o)}async deserialize(t){return await a(wr,Oo).get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,a(this,wt))||null}createAndAddNewEditor(t,e,i={}){let n=a(this,wt).getId(),s=b(this,ge,Sw).call(this,{parent:this,id:n,x:t.offsetX,y:t.offsetY,uiManager:a(this,wt),isCentered:e,...i});return s&&this.add(s),s}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(t={}){this.createAndAddNewEditor(b(this,ge,Dw).call(this),!0,t)}setSelected(t){a(this,wt).setSelected(t)}toggleSelected(t){a(this,wt).toggleSelected(t)}unselect(t){a(this,wt).unselect(t)}pointerup(t){let{isMac:e}=Be.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!a(this,Fo)||(p(this,Fo,!1),a(this,ge,Jr)?.isDrawer&&a(this,ge,Jr).supportMultipleDrawings))return;if(!a(this,rd)){p(this,rd,!0);return}let i=a(this,wt).getMode();if(i===kt.STAMP||i===kt.POPUP||i===kt.SIGNATURE){a(this,wt).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(a(this,wt).getMode()===kt.HIGHLIGHT&&this.enableTextSelection(),a(this,Fo)){p(this,Fo,!1);return}let{isMac:e}=Be.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(p(this,Fo,!0),a(this,ge,Jr)?.isDrawer){this.startDrawingSession(t);return}let i=a(this,wt).getActive();p(this,rd,!i||i.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),a(this,Fr)){a(this,ge,Jr).startDrawing(this,a(this,wt),!1,t);return}a(this,wt).setCurrentDrawingSession(this),p(this,Fr,new AbortController);let e=a(this,wt).combinedSignal(a(this,Fr));this.div.addEventListener("blur",({relatedTarget:i})=>{i&&!this.div.contains(i)&&(p(this,Aa,null),this.commitOrRemove())},{signal:e}),a(this,ge,Jr).startDrawing(this,a(this,wt),!1,t)}pause(t){if(t){let{activeElement:e}=document;this.div.contains(e)&&p(this,Aa,e);return}a(this,Aa)&&setTimeout(()=>{a(this,Aa)?.focus(),p(this,Aa,null)},0)}endDrawingSession(t=!1){return a(this,Fr)?(a(this,wt).setCurrentDrawingSession(null),a(this,Fr).abort(),p(this,Fr,null),p(this,Aa,null),a(this,ge,Jr).endDrawing(t)):null}findNewParent(t,e,i){let n=a(this,wt).findParent(e,i);return n===null||n===this?!1:(n.changeParent(t),!0)}commitOrRemove(){return a(this,Fr)?(this.endDrawingSession(),!0):!1}onScaleChanging(){a(this,Fr)&&a(this,ge,Jr).onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),a(this,wt).getActive()?.parent===this&&(a(this,wt).commitOrRemove(),a(this,wt).setActiveEditor(null)),a(this,wa)&&(clearTimeout(a(this,wa)),p(this,wa,null));for(let t of a(this,fn).values())a(this,kc)?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,a(this,fn).clear(),a(this,wt).removeLayer(this)}async render({viewport:t}){this.viewport=t,Ro(this.div,t);for(let e of a(this,wt).getEditors(this.pageIndex))this.add(e),e.rebuild();await a(this,wt).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){a(this,wt).commitOrRemove(),b(this,ge,k0).call(this);let e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,Ro(this.div,{rotation:i}),e!==i)for(let n of a(this,fn).values())n.rotate(i)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return a(this,wt).viewParameters.realScale}};kc=new WeakMap,rd=new WeakMap,No=new WeakMap,Mo=new WeakMap,wa=new WeakMap,fn=new WeakMap,Fo=new WeakMap,sd=new WeakMap,ad=new WeakMap,Fr=new WeakMap,Aa=new WeakMap,xi=new WeakMap,va=new WeakMap,Po=new WeakMap,od=new WeakMap,wt=new WeakMap,Oo=new WeakMap,ge=new WeakSet,Tw=function(){return a(this,fn).size!==0?a(this,fn).values():a(this,wt).getEditors(this.pageIndex)},_S=function(t){a(this,wt).unselectAll();let{target:e}=t;if(e===a(this,xi).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&a(this,xi).div.contains(e)){let{isMac:i}=Be.platform;if(t.button!==0||t.ctrlKey&&i)return;a(this,wt).showAllEditors("highlight",!0,!0),a(this,xi).div.classList.add("free"),this.toggleDrawing(),ex.startHighlighting(this,a(this,wt).direction==="ltr",{target:a(this,xi).div,x:t.x,y:t.y}),a(this,xi).div.addEventListener("pointerup",()=>{a(this,xi).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:a(this,wt)._signal}),t.preventDefault()}},Jr=function(){return a(wr,Oo).get(a(this,wt).getMode())},Sw=function(t){let e=a(this,ge,Jr);return e?new e.prototype.constructor(t):null},Dw=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}},k0=function(){for(let t of a(this,fn).values())t.isEmpty()&&t.remove()},z(wr,"_initialized",!1),x(wr,Oo,new Map([sw,gw,Sf,ex,Ew].map(t=>[t._editorType,t])));sx=wr,ri=class ri{constructor(){x(this,Ts);x(this,Pr,null);x(this,Ki,new Map);x(this,_c,new Map)}setParent(t){if(!a(this,Pr)){p(this,Pr,t);return}if(a(this,Pr)!==t){if(a(this,Ki).size>0)for(let e of a(this,Ki).values())e.remove(),t.append(e);p(this,Pr,t)}}static get _svgFactory(){return _t(this,"_svgFactory",new Pc)}draw(t,e=!1,i=!1){let n=Ye(ri,Lm)._++,s=b(this,Ts,Iw).call(this),o=ri._svgFactory.createElement("defs");s.append(o);let l=ri._svgFactory.createElement("path");o.append(l);let c=`path_${n}`;l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),e&&a(this,_c).set(n,l);let u=i?b(this,Ts,MS).call(this,o,c):null,h=ri._svgFactory.createElement("use");return s.append(h),h.setAttribute("href",`#${c}`),this.updateProperties(s,t),a(this,Ki).set(n,s),{id:n,clipPathId:`url(#${u})`}}drawOutline(t,e){let i=Ye(ri,Lm)._++,n=b(this,Ts,Iw).call(this),s=ri._svgFactory.createElement("defs");n.append(s);let o=ri._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=ri._svgFactory.createElement("mask");s.append(d),c=`mask_${i}`,d.setAttribute("id",c),d.setAttribute("maskUnits","objectBoundingBox");let f=ri._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");let m=ri._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=ri._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,Ki).set(i,n),i}finalizeDraw(t,e){a(this,_c).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,Ki).get(t):t;if(l){if(i&&b(this,Ts,kw).call(this,l,i),n&&b(c=ri,kx,NS).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,Ts,kw).call(this,h,o)}}}updateParent(t,e){if(e===this)return;let i=a(this,Ki).get(t);i&&(a(e,Pr).append(i),a(this,Ki).delete(t),a(e,Ki).set(t,i))}remove(t){a(this,_c).delete(t),a(this,Pr)!==null&&(a(this,Ki).get(t).remove(),a(this,Ki).delete(t))}destroy(){p(this,Pr,null);for(let t of a(this,Ki).values())t.remove();a(this,Ki).clear(),a(this,_c).clear()}};Pr=new WeakMap,Ki=new WeakMap,_c=new WeakMap,Lm=new WeakMap,kx=new WeakSet,NS=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}%`},Ts=new WeakSet,Iw=function(){let t=ri._svgFactory.create(1,1,!0);return a(this,Pr).append(t),t.setAttribute("aria-hidden",!0),t},MS=function(t,e){let i=ri._svgFactory.createElement("clipPath");t.append(i);let n=`clip_${e}`;i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");let s=ri._svgFactory.createElement("use");return i.append(s),s.setAttribute("href",`#${e}`),s.classList.add("clip"),n},kw=function(t,e){for(let[i,n]of Object.entries(e))n===null?t.removeAttribute(i):t.setAttribute(i,n)},x(ri,kx),x(ri,Lm,0);ax=ri;Pf=class Pf{constructor(t,e,i,n){x(this,_x);x(this,ld,[]);x(this,Bm,new Map);x(this,Um,null);x(this,cd,0);x(this,As,0);x(this,vs,0);p(this,cd,t),p(this,ld,e),p(this,As,i.rawDims.pageWidth),p(this,vs,i.rawDims.pageHeight),p(this,Um,n)}render(){let t=document.createElement("div");t.className="textLayerImages";for(let e=0;e{if(!(e.target instanceof HTMLCanvasElement))return;let i=e.target,n=a(this,Bm).get(i);if(!n)return;let s=a(Pf,zm)?.deref();if(s===i)return;s&&(s.width=0,s.height=0),p(Pf,zm,new WeakRef(i));let{inverseTransform:o,x1:l,y1:c,width:u,height:h}=n,d=a(this,Um).call(this),f=Math.ceil(l*d.width),m=Math.ceil(c*d.height),y=Math.floor((l+u/a(this,As))*d.width),g=Math.floor((c+h/a(this,vs))*d.height);i.width=y-f,i.height=g-m;let A=i.getContext("2d");A.setTransform(...o),A.translate(-f,-m),A.drawImage(d,0,0)}),t}};ld=new WeakMap,Bm=new WeakMap,Um=new WeakMap,cd=new WeakMap,As=new WeakMap,vs=new WeakMap,zm=new WeakMap,_x=new WeakSet,FS=function([t,e,i,n,s,o]){let l=Math.hypot((s-t)*a(this,As),(o-e)*a(this,vs)),c=Math.hypot((i-t)*a(this,As),(n-e)*a(this,vs));if(lLM,existsSync:()=>$S,lstatSync:()=>qS,mkdirSync:()=>XS,readFile:()=>GS,readFileSync:()=>HS,readdirSync:()=>WS,statSync:()=>VS,writeFileSync:()=>YS});function Bc(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 HS,GS,$S,VS,qS,WS,XS,YS,LM,ZS=Kt(()=>{"use strict";H();HS=r=>Bc("readFileSync"),GS=(r,t)=>Bc("readFile"),$S=r=>!1,VS=r=>Bc("statSync"),qS=r=>Bc("lstatSync"),WS=r=>Bc("readdirSync"),XS=r=>Bc("mkdirSync"),YS=(r,t)=>Bc("writeFileSync"),LM={readFileSync:HS,readFile:GS,existsSync:$S,statSync:VS,lstatSync:qS,readdirSync:WS,mkdirSync:XS,writeFileSync:YS,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 Wc=typeof window<"u"&&typeof window.document<"u",zD={fs:"direct file system access","path-parsing":"parsing from file path string","pdf-worker-auto-resolution":"automatic PDF worker resolution from node_modules"};function Km(r){if(Wc)throw new Error(`officeparser: '${zD[r]}' is not supported in the browser. Browser users must pass file content as Buffer or ArrayBuffer directly.`)}function gA(){typeof window<"u"&&!window.DOMMatrix&&(window.DOMMatrix=class{constructor(t){z(this,"a");z(this,"b");z(this,"c");z(this,"d");z(this,"e");z(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 pg=jc(Dv());H();function Wr(r){if(r)try{if(r.startsWith("D:"))return kk(r);let t=new Date(r);return isNaN(t.getTime())?void 0:t}catch{return}}function kk(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 ci=r=>r.nodeType===1,Zt=(r,t={})=>{let e=new pg.DOMParser(t),i=r.charCodeAt(0)===65279?r.slice(1):r.trim();return e.parseFromString(i,"text/xml")},J=(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},mg=(r,t={})=>new pg.XMLSerializer().serializeToString(r),_k=(r,t)=>{if(!r||typeof r.lineNumber!="number"||typeof r.columnNumber!="number")return;let e=t.split(` -`),i=0;for(let n=0;n`,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{if(e.serializeRawContent===!1){let i=_k(r,t);if(i)return i}return mg(r,{preserveWhitespace:e.preserveXmlWhitespace})},ut=(r,t)=>{let e=r.getElementsByTagName(t);if(e&&e.length>0)return e[0]};var He=(r,t)=>{let e=[];if(!r.childNodes)return e;for(let i=0;i{let t=Zt(r),e={},i=J(t,"cp:coreProperties")[0];if(i){let s=J(i,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let o=J(i,"dc:creator")[0];o&&o.textContent&&(e.author=o.textContent);let l=J(i,"cp:lastModifiedBy")[0];l&&l.textContent&&(e.lastModifiedBy=l.textContent);let c=J(i,"dcterms:created")[0];c&&c.textContent&&(e.created=Wr(c.textContent));let u=J(i,"dcterms:modified")[0];u&&u.textContent&&(e.modified=Wr(u.textContent));let h=J(i,"dc:description")[0];h&&h.textContent&&(e.description=h.textContent);let d=J(i,"dc:subject")[0];return d&&d.textContent&&(e.subject=d.textContent),e}let n=J(t,"office:meta")[0];if(n){let s=J(n,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let o=J(n,"dc:creator")[0];o&&o.textContent&&(e.author=o.textContent);let l=J(n,"dc:description")[0];l&&l.textContent&&(e.description=l.textContent);let c=J(n,"dc:subject")[0];c&&c.textContent&&(e.subject=c.textContent);let u=J(n,"meta:creation-date")[0];u&&u.textContent&&(e.created=Wr(u.textContent));let h=J(n,"dc:date")[0];h&&h.textContent&&(e.modified=Wr(h.textContent));let d=J(n,"meta:user-defined");if(d.length>0){let f={};for(let m of d){let y=m.getAttribute("meta:name");if(!y||!m.textContent)continue;let g=m.getAttribute("meta:value-type")||"string",A=m.textContent;if(g==="boolean")f[y]=A.toLowerCase()==="true";else if(g==="float"){let w=Number(A);isNaN(w)||(f[y]=w)}else if(g==="date"||g==="time"){let w=Wr(A);w?f[y]=w:f[y]=A}else f[y]=A}Object.keys(f).length>0&&(e.customProperties=f)}}return e},uu=r=>{let t=Zt(r),e={},i=J(t,"property");for(let n of i){let s=n.getAttribute("name");if(s)for(let o=0;o{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{let t=r.toString("utf8"),i=Zt(t).documentElement;if(!i)return{title:void 0,xAxisTitle:void 0,yAxisTitle:void 0,dataSets:[],labels:[],rawTexts:[]};let n=Vd(i,"c:title"),s,o,l=i.getElementsByTagName("c:catAx");l.length>0&&(s=Vd(l[0],"c:title"));let c=i.getElementsByTagName("c:valAx");c.length>0&&(o=Vd(c[0],"c:title"));let u=i.getElementsByTagName("c:ser"),h=[],d=[];for(let m=0;m0&&d.length===0&&d.push(...F)}h.push({name:g,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}},Mk=r=>{let t=r.toString("utf8"),e=Zt(t),i=J(e,"chart:chart")[0]||e.documentElement,n=J(i,"chart:title")[0],s=n&&J(n,"text:p")[0]?.textContent||void 0,o=J(i,"table:table")[0],l=[],c=[],u=[];if(o){let m=[],y=He(o,"table:table-header-rows")[0];if(y&&m.push(...He(y,"table:table-row")),m.push(...He(o,"table:table-row")),m.length>0){let g=He(m[0],"table:table-cell");for(let A=1;A0){let v=He(w[0],"text:p")[0]?.textContent||void 0;v&&c.push(v);let T=0;for(let k=1;k0&&(v=T[0].textContent||void 0),!v&&A&&(v=`Series ${A.split(".").pop()?.replace(/\$/g,"")||A}`);let k={name:v,values:[],pointLabels:[]};w&&k.values.push(`[${w}]`),l.push(k)}let y=J(i,"chart:categories")[0];if(y){let g=y.getAttribute("table:cell-range-address");g&&c.push(`[${g}]`)}}let h=J(e,"chart:axis"),d,f;for(let m of h){let y=m.getAttribute("chart:dimension"),g=J(m,"chart:title")[0],A=g&&J(g,"text:p")[0]?.textContent||void 0;y==="x"?d=A:y==="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}},Xo=r=>r.toString("utf8",0,500).includes("urn:oasis:names:tc:opendocument:xmlns:chart:1.0")?Mk(r):Nk(r);H();var hu="[OfficeParser]: ";var Fk={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.'},Iv=(r,t)=>{let e=Fk[r];return typeof e=="function"?e(t):e},Ms=(r,t,e)=>{let i=Iv(r,e);return t.outputErrorToConsole&&console.error(hu+i),new Error(hu+i)},kv=(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=Iv("FILE_CORRUPTED",e)),t.outputErrorToConsole&&console.error(hu+i),new Error(hu+i)},rn=(r,t,e)=>{t.outputErrorToConsole&&(e?console.warn(hu+r,e):console.warn(hu+r))};H();var Pk=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"}},Ok=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"}},gr=(r,t)=>{let e=r.split(".").pop()||"",i=Ok(t);return i||(i=Pk(e)),{type:"image",mimeType:i,data:t.toString("base64"),name:r,extension:e}};H();var Ba=class Ba{constructor(){z(this,"pool",[]);z(this,"queue",[]);z(this,"MAX_WORKERS",4);z(this,"idleTimeout",1e4);z(this,"timeoutId",null)}static getInstance(){return Ba.instance||(Ba.instance=new Ba),Ba.instance}static hasInstance(){return!!Ba.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.lengthjc(yE())),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.lastUsede.worker.terminate());await Promise.all(t),this.pool=[]}};z(Ba,"instance");var Wd=Ba,Xn=async(r,t)=>{let e=r;return typeof window<"u"&&typeof Blob<"u"&&st.Buffer.isBuffer(r)&&(e=new Blob([r],{type:"image/bmp"})),await Wd.getInstance().recognize(e,t)},bE=async()=>{Wd.hasInstance()&&await Wd.getInstance().terminate()};H();H();var wE={},d_=(function(r,t,e,i,n){var s=new Worker(wE[t]||(wE[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}),Gi=Uint8Array,Ko=Uint16Array,EE=Int32Array,My=new Gi([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]),Fy=new Gi([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]),CE=new Gi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),TE=function(r,t){for(var e=new Ko(31),i=0;i<31;++i)e[i]=t+=1<>1|(Jt&21845)<<1,Fs=(Fs&52428)>>2|(Fs&13107)<<2,Fs=(Fs&61680)>>4|(Fs&3855)<<4,vg[Jt]=((Fs&65280)>>8|(Fs&255)<<8)>>1;var Fs,Jt,du=(function(r,t,e){for(var i=r.length,n=0,s=new Ko(t);n>c]=u}else for(l=new Ko(i),n=0;n>15-r[n]);return l}),Xd=new Gi(288);for(Jt=0;Jt<144;++Jt)Xd[Jt]=8;var Jt;for(Jt=144;Jt<256;++Jt)Xd[Jt]=9;var Jt;for(Jt=256;Jt<280;++Jt)Xd[Jt]=7;var Jt;for(Jt=280;Jt<288;++Jt)Xd[Jt]=8;var Jt,kE=new Gi(32);for(Jt=0;Jt<32;++Jt)kE[Jt]=5;var Jt;var _E=du(Xd,9,1);var NE=du(kE,5,1),wg=function(r){for(var t=r[0],e=1;et&&(t=r[e]);return t},Yn=function(r,t,e){var i=t/8|0;return(r[i]|r[i+1]<<8)>>(t&7)&e},Ag=function(r,t){var e=t/8|0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>(t&7)},ME=function(r){return(r+7)/8|0},Eg=function(r,t,e){return(t==null||t<0)&&(t=0),(e==null||e>r.length)&&(e=r.length),new Gi(r.subarray(t,e))};var FE=["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"],Hi=function(r,t,e){var i=new Error(t||FE[r]);if(i.code=r,Error.captureStackTrace&&Error.captureStackTrace(i,Hi),!e)throw i;return i},PE=function(r,t,e,i){var n=r.length,s=i?i.length:0;if(!n||t.f&&!t.l)return e||new Gi(0);var o=!e,l=o||t.i!=2,c=t.i;o&&(e=new Gi(n*3));var u=function(at){var dt=e.length;if(at>dt){var ot=new Gi(Math.max(dt*2,at));ot.set(e),e=ot}},h=t.f||0,d=t.p||0,f=t.b||0,m=t.l,y=t.d,g=t.m,A=t.n,w=n*8;do{if(!m){h=Yn(r,d,1);var v=Yn(r,d+1,3);if(d+=3,v)if(v==1)m=_E,y=NE,g=9,A=5;else if(v==2){var F=Yn(r,d,31)+257,L=Yn(r,d+10,15)+4,Y=F+Yn(r,d+5,31)+1;d+=14;for(var q=new Gi(Y),G=new Gi(19),j=0;j>4;if(T<16)q[j++]=T;else{var O=0,C=0;for(T==16?(C=3+Yn(r,d,3),d+=2,O=q[j-1]):T==17?(C=3+Yn(r,d,7),d+=3):T==18&&(C=11+Yn(r,d,127),d+=7);C--;)q[j++]=O}}var D=q.subarray(0,F),E=q.subarray(F);g=wg(D),A=wg(E),m=du(D,g,1),y=du(E,A,1)}else Hi(1);else{var T=ME(d)+4,k=r[T-4]|r[T-3]<<8,N=T+k;if(N>n){c&&Hi(0);break}l&&u(f+k),e.set(r.subarray(T,N),f),t.b=f+=k,t.p=d=N*8,t.f=h;continue}if(d>w){c&&Hi(0);break}}l&&u(f+131072);for(var S=(1<>4;if(d+=O&15,d>w){c&&Hi(0);break}if(O||Hi(2),P<256)e[f++]=P;else if(P==256){M=d,m=null;break}else{var B=P-254;if(P>264){var j=P-257,$=My[j];B=Yn(r,d,(1<<$)-1)+Py[j],d+=$}var U=y[Ag(r,d)&I],V=U>>4;U||Hi(3),d+=U&15;var E=IE[V];if(V>3){var $=Fy[V];E+=Ag(r,d)&(1<<$)-1,d+=$}if(d>w){c&&Hi(0);break}l&&u(f+131072);var Z=f+B;if(f>>0},_y=function(r,t){return xr(r,t)+xr(r,t+4)*4294967296};function w_(r,t,e){return e||(e=t,t={}),typeof e!="function"&&Hi(7),b_(r,t,[y_],function(i){return OE(Oy(i.data[0],RE(i.data[1])))},1,e)}function Oy(r,t){return PE(r,{i:2},t&&t.out,t&&t.dictionary)}var Ny=typeof TextDecoder<"u"&&new TextDecoder,A_=0;try{Ny.decode(p_,{stream:!0}),A_=1}catch{}var v_=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:Eg(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 E_(r,t){if(t){for(var e="",i=0;i65558)return o(Hi(13,0,1),null),n;var c=Yr(r,l+8);if(c){var u=c,h=xr(r,l+16),d=h==4294967295||u==65535;if(d){var f=xr(r,l-12);d=xr(r,f)==101075792,d&&(u=c=xr(r,f+32),h=xr(r,f+48))}for(var m=t&&t.filter,y=function(A){var w=T_(r,h,d),v=w[0],T=w[1],k=w[2],N=w[3],F=w[4],L=w[5],Y=C_(r,L);h=F;var q=function(j,tt){j?(n(),o(j,null)):(tt&&(s[N]=tt),--c||o(null,s))};if(!m||m({name:N,size:T,originalSize:k,compression:v}))if(!v)q(null,Eg(r,Y,Y+T));else if(v==8){var G=r.subarray(Y,Y+T);if(k<524288||T>.8*k)try{q(null,Oy(G,{out:new Gi(k)}))}catch(j){q(j,null)}else i.push(w_(G,{size:k},q))}else q(Hi(14,"unknown compression type "+v,1),null);else q(null,null)},g=0;gnew Promise((e,i)=>{LE(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:st.Buffer.from(l)})))})});var BE=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 Ua(r,_=>!!_.match(e)||!!_.match(i)||!!_.match(n)||_===s||_==="xl/styles.xml"||_==="xl/workbook.xml"||_==="xl/_rels/workbook.xml.rels"||!!_.match(l)||!!_.match(c)||!!t.extractAttachments&&(!!_.match(o)||!!_.match(u)||!!_.match(h))),f=d.find(_=>_.path===s),m=[];if(f){let _=Zt(f.content.toString()),X=J(_,"si");for(let O of X){let C=J(O,"r");if(C.length>0){let D=[];for(let E of C){let S=J(E,"t")[0];if(S){let I=S.textContent||"",M=J(E,"rPr")[0],P={};if(M){J(M,"b").length>0&&(P.bold=!0),J(M,"i").length>0&&(P.italic=!0),J(M,"u").length>0&&(P.underline=!0),J(M,"strike").length>0&&(P.strikethrough=!0);let B=J(M,"sz")[0];B&&(P.size=B.getAttribute("val")+"pt");let $=J(M,"color")[0];if($){let Z=$.getAttribute("rgb");Z&&(P.color="#"+Z.substring(2))}let U=J(M,"rFont")[0];U&&(P.font=U.getAttribute("val")||void 0);let V=J(M,"vertAlign")[0];if(V){let Z=V.getAttribute("val");Z==="subscript"&&(P.subscript=!0),Z==="superscript"&&(P.superscript=!0)}}D.push({type:"text",text:I,formatting:Object.keys(P).length>0?P:void 0})}}m.push(D)}else{let D=J(O,"t"),E="";for(let S of D)E+=S.textContent||"";m.push(E)}}}let y=d.find(_=>_.path==="xl/styles.xml"),g={};if(y){let _=Zt(y.content.toString()),X=J(_,"fonts")[0],O=[];if(X){let S=J(X,"font");for(let I of S){let M={};J(I,"b").length>0&&(M.bold=!0),J(I,"i").length>0&&(M.italic=!0),J(I,"u").length>0&&(M.underline=!0),J(I,"strike").length>0&&(M.strikethrough=!0);let P=J(I,"sz")[0];if(P){let V=P.getAttribute("val");V&&(M.size=V+"pt")}let B=J(I,"color")[0];if(B){let V=B.getAttribute("rgb");V&&(M.color="#"+V.substring(2))}let $=J(I,"name")[0];if($){let V=$.getAttribute("val");V&&(M.font=V)}let U=J(I,"vertAlign")[0];if(U){let V=U.getAttribute("val");V==="subscript"&&(M.subscript=!0),V==="superscript"&&(M.superscript=!0)}O.push(M)}}let C=J(_,"fills")[0],D=[];if(C){let S=J(C,"fill");for(let I of S){let M={},P=J(I,"patternFill")[0];if(P){let B=J(P,"fgColor")[0];if(B){let $=B.getAttribute("rgb"),U=B.getAttribute("theme");if($&&$!=="00000000")M.backgroundColor="#"+$.substring(2);else if(U){let V=parseInt(U);V===0?M.backgroundColor="#FFFFFF":V===1?M.backgroundColor="#000000":V===2?M.backgroundColor="#EEECE1":V===3&&(M.backgroundColor="#1F497D")}}}D.push(M)}}let E=J(_,"cellXfs")[0];if(E){let S=J(E,"xf");for(let I=0;I_.path.match(/xl\/media\/.*/)),v=d.filter(_=>_.path.match(n)),T={};if(t.extractAttachments){let _=d.filter(O=>O.path.match(h));for(let O of _){let D=`xl/drawings/${O.path.split("/").pop()?.replace(".rels","")||""}`,E=Zt(O.content.toString()),S=J(E,"Relationship");T[D]||(T[D]={});for(let I of S){let M=I.getAttribute("Id"),P=I.getAttribute("Target");if(M&&P&&P.includes("media/")){let B="xl/"+P.replace("../","");T[D][M]={path:B}}}}let X=d.filter(O=>O.path.match(i));for(let O of X){let C=Zt(O.content.toString()),D=J(C,"xdr:pic"),E=T[O.path]||{};for(let S of D){let I=J(S,"xdr:blipFill")[0],M=I?J(I,"a:blip")[0]:null,P=M?M.getAttribute("r:embed"):null,B=J(S,"xdr:nvPicPr")[0],$=B?J(B,"xdr:cNvPr")[0]:null,U=$?$.getAttribute("descr")||$.getAttribute("name"):void 0;P&&E[P]&&(E[P].altText=U||"")}}for(let O of w){let C=gr(O.path.split("/").pop()||"image",O.content),D="";for(let E in T){for(let S in T[E])if(T[E][S].path===O.path){D=T[E][S].altText||"";break}if(D)break}if(D&&(C.altText=D),A.push(C),t.ocr&&C.mimeType.startsWith("image/"))try{let E=(await Xn(O.content,{language:t.ocrLanguage,...t.ocrConfig})).trim();E&&(C.ocrText=E)}catch(E){rn(`OCR failed for ${C.name}:`,t,E)}}for(let O of v){let C={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:O.content.toString("base64"),name:O.path.split("/").pop()||"",extension:"xml"};try{let D=Xo(O.content);C.chartData=D}catch(D){rn(`Failed to extract chart data from ${O.path}:`,t,D)}A.push(C)}}let k={};if(t.extractAttachments){let _=d.filter(X=>X.path.match(h));for(let X of _){let C=`xl/drawings/${X.path.split("/").pop()?.replace(".rels","")||""}`,D=Zt(X.content.toString()),E=J(D,"Relationship");k[C]||(k[C]={});for(let S of E){let I=S.getAttribute("Id"),M=S.getAttribute("Target"),P=S.getAttribute("Type");if(I&&M&&P&&P.includes("chart")){let B=M.split("/").pop()||"";k[C][I]=B}}}}let N={},F=d.find(_=>_.path==="xl/workbook.xml"),L=d.find(_=>_.path==="xl/_rels/workbook.xml.rels");if(F&&L){let _=Zt(L.content.toString()),X=J(_,"Relationship"),O={};for(let E of X){let S=E.getAttribute("Id"),I=E.getAttribute("Target");if(S&&I){let M=I.split("/").pop()||"";O[S]=M}}let C=Zt(F.content.toString()),D=J(C,"sheet");for(let E of D){let S=E.getAttribute("name"),I=E.getAttribute("r:id");S&&I&&O[I]&&(N[O[I]]=S)}}let Y=[],q=[];for(let _ of d)if(!_.path.match(o)&&_.path!==s&&_.path!=="xl/styles.xml"&&!_.path.match(i)&&!_.path.match(n)&&!_.path.match(u)&&!_.path.match(h)&&_.path.match(e)){t.includeRawContent&&q.push(_.content.toString());let X=[],O=/[\s\S]*?<\/row>/g,C=_.content.toString().match(O);if(C)for(let S of C){let I=[],M=/[\s\S]*?<\/c>/g,P=S.match(M),B=S.match(/r="(\d+)"/),$=B?parseInt(B[1])-1:0;if(P)for(let U of P){let V=U.match(/t="([a-z]+)"/),Z=V?V[1]:"n",Q=U.match(/(.*?)<\/v>/),nt=U.match(/(.*?)<\/t>/),at="",dt=[];if(Z==="s"&&Q){let lt=parseInt(Q[1]),ct=m[lt];Array.isArray(ct)?(dt=JSON.parse(JSON.stringify(ct)),at=dt.map(rt=>rt.text).join("")):at=ct||""}else Z==="inlineStr"&&nt?at=nt[1]:Q&&(at=Q[1]);let ot=U.match(/r="([A-Z]+)(\d+)"/),ft=(ot?ot[1]:"").charCodeAt(0)-65;if(at||dt.length>0){let lt=U.match(/s="(\d+)"/),ct=lt?parseInt(lt[1]):void 0,rt=ct!==void 0&&g[ct]?g[ct]:{};if(dt.length>0)for(let bt of dt)bt.formatting||(bt.formatting={}),rt.backgroundColor&&(bt.formatting.backgroundColor=rt.backgroundColor),rt.alignment&&(bt.formatting.alignment=rt.alignment),!bt.formatting.font&&rt.font&&(bt.formatting.font=rt.font),!bt.formatting.size&&rt.size&&(bt.formatting.size=rt.size);else dt.push({type:"text",text:at,formatting:rt});let gt={type:"cell",text:at,children:dt,metadata:{row:$,col:ft}};t.includeRawContent&&(gt.rawContent=U),I.push(gt)}}if(I.length>0){let U={type:"row",children:I,metadata:void 0};t.includeRawContent&&(U.rawContent=S),X.push(U)}}if(t.extractAttachments){let I=`xl/worksheets/_rels/${_.path.split("/").pop()||""}.rels`,M=d.find($=>$.path===I),P={};if(M){let $=Zt(M.content.toString()),U=J($,"Relationship");for(let V of U){let Z=V.getAttribute("Id"),Q=V.getAttribute("Target"),nt=V.getAttribute("Type");Z&&Q&&nt&&nt.includes("drawing")&&(P[Z]="xl/drawings/"+Q.replace("../drawings/",""))}}let B=_.content.toString().match(/pt.name===dt.path.split("/").pop());if(ot){let pt={type:"image",text:"",children:[],metadata:{attachmentName:ot.name||"unknown",altText:dt.altText||void 0}};X.push(pt)}}let nt=k[Z];if(nt)for(let at in nt){let dt=nt[at];if(A.find(pt=>pt.name===dt)){let pt={type:"chart",text:"",children:[],metadata:{attachmentName:dt}};X.push(pt)}}}}}let D=_.path.split("/").pop()||"Sheet",E=N[D]||D;Y.push({type:"sheet",children:X,metadata:{sheetName:E},rawContent:t.includeRawContent?_.content.toString():void 0})}let G=d.find(_=>_.path.match(l)),j=G?La(G.content.toString()):{},tt=d.find(_=>_.path.match(c));if(tt){let _=uu(tt.content.toString());Object.keys(_).length>0&&(j.customProperties=_)}let et=_=>{for(let X of _){if("attachmentName"in(X.metadata||{})){let O=X.metadata,C=A.find(D=>D.name===O.attachmentName);C&&(X.type==="image"&&(C.ocrText&&(X.text=C.ocrText),O.altText&&(C.altText=O.altText)),X.type==="chart"&&C.chartData&&(X.text=C.chartData.rawTexts.join(t.newlineDelimiter||` -`)))}X.children&&et(X.children)}};return et(Y),{type:"xlsx",metadata:j,content:Y,attachments:A,toText:()=>Y.map(_=>{let X=O=>{let C="";return O.children?C+=O.children.map(X).filter(D=>D!="").join(O.children[0]?.children?t.newlineDelimiter??` -`:""):C+=O.text||"",C};return X(_)}).filter(_=>_!="").join(t.newlineDelimiter??` -`)}};H();var UE=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 Ua(r,_=>!!_.match(e)||!!_.match(i)||!!_.match(s)||!!_.match(o)||!!_.match(l)||!!t.extractAttachments&&!!_.match(n)),u=c.find(_=>_.path==="mimetype"),h="odt";if(u){let _=u.content.toString().trim();_.includes("spreadsheet")?h="ods":_.includes("presentation")?h="odp":_.includes("text")&&(h="odt")}let d=c.find(_=>_.path==="content.xml")||c.find(_=>_.path.match(e)),f=c.find(_=>_.path==="styles.xml"),m=[],y=[],g={},A={},w={};f&&(_=>{let X=Zt(_),O=J(X,"style:style");for(let C of O){let D=C.getAttribute("style:name");if(!D)continue;let E={},S=ut(C,"style:paragraph-properties");if(S){let B=S.getAttribute("fo:text-align");if(B){let U={start:"left",left:"left",center:"center",end:"right",right:"right",justify:"justify"};U[B]&&(E.alignment=U[B])}ut(S,"style:drop-cap")&&(E.dropCap=!0)}Object.keys(E).length>0&&(A[D]=E);let I=ut(C,"style:text-properties"),M=ut(C,"style:table-cell-properties"),P={};if(M){let B=M.getAttribute("fo:background-color");B&&B!=="transparent"&&(P.backgroundColor=B)}if(I){(I.getAttribute("fo:font-weight")==="bold"||I.getAttribute("style:font-weight-asian")==="bold")&&(P.bold=!0),(I.getAttribute("fo:font-style")==="italic"||I.getAttribute("style:font-style-asian")==="italic")&&(P.italic=!0),I.getAttribute("style:text-underline-style")==="solid"&&(P.underline=!0),I.getAttribute("style:text-line-through-style")==="solid"&&(P.strikethrough=!0);let B=I.getAttribute("fo:font-size")||I.getAttribute("style:font-size-asian");B&&(P.size=B);let $=I.getAttribute("fo:color");$&&(P.color=$);let U=I.getAttribute("fo:background-color");U&&U!=="transparent"&&(P.backgroundColor=U);let V=I.getAttribute("style:font-name")||I.getAttribute("fo:font-family");V&&(P.font=V);let Z=I.getAttribute("style:text-position");Z&&(Z.startsWith("sub")&&(P.subscript=!0),Z.startsWith("super")&&(P.superscript=!0)),Object.keys(P).length>0&&(g[D]=P)}}})(f.content.toString());let T=(_,X,O,C,D,E={},S,I="")=>{let M=[],P="";if(!_.childNodes)return{text:"",children:[]};for(let B=0;B<_.childNodes.length;B++){let $=_.childNodes[B];if($.nodeType===3){let U=$.textContent||"";U&&(P+=U,M.push({type:"text",text:U,formatting:E,metadata:S?{...S}:void 0}))}else if(ci($)){let U=$,V=U.tagName;if(V==="text:s"){let Z=parseInt(U.getAttribute("text:c")||"1"),Q=" ".repeat(Z);P+=Q,M.push({type:"text",text:Q,formatting:E,metadata:S?{...S}:void 0})}else if(V==="text:tab")P+=" ",M.push({type:"text",text:" ",formatting:E,metadata:S?{...S}:void 0});else if(V==="text:line-break")P+=` +`)}`),b(this,Je,x0).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=Ae._internalPadding*this.parentScale;return this.getRect(e,e)}static async deserialize(e,i,n){var l;let s=null;if(e instanceof X0){let{data:{defaultAppearanceData:{fontSize:c,fontColor:u},rect:h,rotation:d,id:f,popupRef:m,richText:y,contentsObj:g,creationDate:A,modificationDate:w},textContent:v,textPosition:T,parent:{page:{pageNumber:I}}}=e;if(!v||v.length===0)return null;s=e={annotationType:_t.FREETEXT,color:Array.from(u),fontSize:c,value:v.join(` +`),position:T,pageIndex:I-1,rect:h.slice(0),rotation:d,annotationElementId:f,id:f,deleted:!1,popupRef:m,comment:g?.str||null,richText:y,creationDate:A,modificationDate:w}}let o=await super.deserialize(e,i,n);return p(o,In,e.fontSize),o.color=ht.makeHexColor(...e.color),p(o,kn,b(l=Ae,Sa,aw).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=be._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),n=Object.assign(super.serialize(e),{color:i,fontSize:a(this,In),value:b(this,Je,ZT).call(this)});return this.addComment(n),e?(n.isCopy=!0,n):this.annotationElementId&&!b(this,Je,QT).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,In)}px * var(--total-scale-factor))`,n.color=this.color,i.replaceChildren();for(let s of a(this,kn).split(` +`)){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,kn)}}),i}resetAnnotationElement(e){super.resetAnnotationElement(e),e.resetEdited()}};kn=new WeakMap,wm=new WeakMap,dc=new WeakMap,In=new WeakMap,Je=new WeakSet,XT=function(e){let i=s=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--total-scale-factor))`,this.translate(0,-(s-a(this,In))*this.parentScale),p(this,In,s),b(this,Je,m0).call(this)},n=a(this,In);this.addCommands({cmd:i.bind(this,e),undo:i.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Gt.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},YT=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:Gt.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},KT=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=Ae,Sa,g0).call(n,s)),i=s);return e.join(` +`)},m0=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()},Sa=new WeakSet,g0=function(e){return(e.nodeType===Node.TEXT_NODE?e.nodeValue:e.innerText).replaceAll(zg,"")},x0=function(){if(this.editorDiv.replaceChildren(),!!a(this,kn))for(let e of a(this,kn).split(` +`)){let i=document.createElement("div");i.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(i)}},ZT=function(){return a(this,kn).replaceAll("\xA0"," ")},aw=function(e){return e.replaceAll(" ","\xA0")},QT=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},x(Ae,Sa),z(Ae,"_freeTextDefaultContent",""),z(Ae,"_internalPadding",0),z(Ae,"_defaultColor",null),z(Ae,"_defaultFontSize",10),z(Ae,"_type","freetext"),z(Ae,"_editorType",_t.FREETEXT);sw=Ae,xt=class{toSVGPath(){ie("Abstract method `toSVGPath` must be implemented.")}get box(){ie("Abstract getter `box` must be implemented.")}serialize(t,e){ie("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=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,li,tS).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,n,s,o){return new tx(t,e,i,n,s,o)}getOutlines(){let t=a(this,ms),e=a(this,Nr),i=a(this,Ut),[n,s,o,l]=a(this,Nn),c=new Float32Array((a(this,To)?.length??0)+2);for(let d=0,f=c.length-2;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,li,nS).call(this,u,h),this.newFreeDrawOutline(u,c,a(this,Nn),a(this,Gh),a(this,jh),a(this,Hh))}};Nn=new WeakMap,Nr=new WeakMap,jh=new WeakMap,Hh=new WeakMap,ms=new WeakMap,Ut=new WeakMap,fc=new WeakMap,pc=new WeakMap,Am=new WeakMap,vm=new WeakMap,Gh=new WeakMap,$h=new WeakMap,To=new WeakMap,Em=new WeakMap,Tx=new WeakMap,Sx=new WeakMap,li=new WeakSet,Ef=function(){let t=a(this,Ut).subarray(4,6),e=a(this,Ut).subarray(16,18),[i,n,s,o]=a(this,Nn);return[(a(this,fc)+(t[0]-e[0])/2-i)/s,(a(this,pc)+(t[1]-e[1])/2-n)/o,(a(this,fc)+(e[0]-t[0])/2-i)/s,(a(this,pc)+(e[1]-t[1])/2-n)/o]},JT=function(){let[t,e,i,n]=a(this,Nn),[s,o,l,c]=b(this,li,Ef).call(this);return`M${(a(this,Ut)[2]-t)/i} ${(a(this,Ut)[3]-e)/n} L${(a(this,Ut)[4]-t)/i} ${(a(this,Ut)[5]-e)/n} L${s} ${o} L${l} ${c} L${(a(this,Ut)[16]-t)/i} ${(a(this,Ut)[17]-e)/n} L${(a(this,Ut)[14]-t)/i} ${(a(this,Ut)[15]-e)/n} Z`},tS=function(t){let e=a(this,Nr);t.push(`L${e[4]} ${e[5]} Z`)},eS=function(t){let[e,i,n,s]=a(this,Nn),o=a(this,Ut).subarray(4,6),l=a(this,Ut).subarray(16,18),[c,u,h,d]=b(this,li,Ef).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}`)},iS=function(t){let e=a(this,Ut),[i,n,s,o]=a(this,Nn),[l,c,u,h]=b(this,li,Ef).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,Nn),a(this,Gh),a(this,jh),a(this,Hh))},nS=function(t,e){let i=a(this,Nr);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+=6},rS=function(t,e){let i=a(this,Ut).subarray(4,6),n=a(this,Ut).subarray(16,18),[s,o,l,c]=a(this,Nn),[u,h,d,f]=b(this,li,Ef).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},x(Gs,Em,8),x(Gs,Tx,2),x(Gs,Sx,a(Gs,Em)+a(Gs,Tx));J0=Gs,tx=class extends xt{constructor(e,i,n,s,o,l){super();x(this,Dx);x(this,Vh);x(this,mc,new Float32Array(4));x(this,ga);x(this,Cm);x(this,_n);x(this,Tm);x(this,Xe);p(this,Xe,e),p(this,_n,i),p(this,Vh,n),p(this,Tm,s),p(this,ga,o),p(this,Cm,l),this.firstPoint=[NaN,NaN],this.lastPoint=[NaN,NaN],b(this,Dx,sS).call(this,l);let[c,u,h,d]=a(this,mc);for(let f=0,m=e.length;fw?(l=A,c=w):c===w&&(l=d(l,A)),hf[1]?(l=f[0],c=f[1]):c===f[1]&&(l=d(l,f[0])),he[0]-i[0]||e[1]-i[1]||e[2]-i[2]);let t=[];for(let e of a(this,So))e[3]?(t.push(...b(this,Qi,ow).call(this,e)),b(this,Qi,oS).call(this,e)):(b(this,Qi,lS).call(this,e),t.push(...b(this,Qi,ow).call(this,e)));return b(this,Qi,aS).call(this,t)}};Sm=new WeakMap,Dm=new WeakMap,km=new WeakMap,So=new WeakMap,_r=new WeakMap,Qi=new WeakSet,aS=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;o0;){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 y;if(i.has(h))y=h;else if(i.has(d))y=d;else break;i.delete(y),[l,c,u,h,d]=y,f!==l&&(s.push(f,m,l,m===c?c:u),f=l),m=m===c?u:c}s.push(f,m)}return new lw(n,a(this,Sm),a(this,Dm),a(this,km))},y0=function(t){let e=a(this,_r),i=0,n=e.length-1;for(;i<=n;){let s=i+n>>1,o=e[s][0];if(o===t)return s;o=0;n--){let[s,o]=a(this,_r)[n];if(s!==t)break;if(s===t&&o===e){a(this,_r).splice(n,1);return}}},ow=function(t){let[e,i,n]=t,s=[[e,i,n]],o=b(this,Qi,y0).call(this,n);for(let l=0;l=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};lw=class extends xt{constructor(e,i,n,s){super();x(this,Im);x(this,qh);p(this,qh,e),p(this,Im,i),this.firstPoint=n,this.lastPoint=s}toSVGPath(){let e=[];for(let i of a(this,qh)){let[n,s]=i;e.push(`M${n} ${s}`);for(let o=2;o-1?(p(this,Si,!0),b(this,Rt,b0).call(this,e),b(this,Rt,al).call(this)):a(this,xa)&&(p(this,Wh,e.anchorNode),p(this,Nm,e.anchorOffset),p(this,Mm,e.focusNode),p(this,Fm,e.focusOffset),b(this,Rt,uw).call(this),b(this,Rt,al).call(this),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}static get _keyboardManager(){let e=te.prototype;return Mt(this,"_keyboardManager",new Fc([[["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,Si)?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:a(this,ur),methodOfCreation:a(this,Pm)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(e){return{numberOfColors:e.get("color").size}}static initialize(e,i){be.initialize(e,i),te._defaultColor||(te._defaultColor=i.highlightColors?.values().next().value||"#fff066")}static updateDefaultParams(e,i){switch(e){case Gt.HIGHLIGHT_COLOR:te._defaultColor=i;break;case Gt.HIGHLIGHT_THICKNESS:te._defaultThickness=i;break}}translateInPage(e,i){}get toolbarPosition(){return a(this,Yh)}get commentButtonPosition(){return a(this,Xh)}updateParams(e,i){switch(e){case Gt.HIGHLIGHT_COLOR:b(this,Rt,cS).call(this,i);break;case Gt.HIGHLIGHT_THICKNESS:b(this,Rt,uS).call(this,i);break}}static get defaultPropertiesToUpdate(){return[[Gt.HIGHLIGHT_COLOR,te._defaultColor],[Gt.HIGHLIGHT_THICKNESS,te._defaultThickness]]}get propertiesToUpdate(){return[[Gt.HIGHLIGHT_COLOR,this.color||te._defaultColor],[Gt.HIGHLIGHT_THICKNESS,a(this,ur)||te._defaultThickness],[Gt.HIGHLIGHT_FREE,a(this,Si)]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(a(this,Fn),{root:{fill:this.color,"fill-opacity":this.opacity}}),a(this,_m)?.updateColor(this.color),super.onUpdatedColor()}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",p(this,_m,new $f({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,Rt,A0).call(this))}getBaseTranslation(){return[0,0]}getRect(e,i){return super.getRect(e,i,b(this,Rt,A0).call(this))}onceAdded(e){this.annotationElementId||this.parent.addUndoableEditor(this),e&&this.div.focus()}remove(){b(this,Rt,hw).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Rt,al).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let i=!1;this.parent&&!e?b(this,Rt,hw).call(this):e&&(b(this,Rt,al).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,Si)?(e=(e-this.rotation+360)%360,n=b(s=te,pr,ku).call(s,a(this,Mn).box,e)):n=b(o=te,pr,ku).call(o,[this.x,this.y,this.width,this.height],e),i.updateProperties(a(this,Fn),{bbox:n,root:{"data-main-rotation":e}}),i.updateProperties(a(this,Ui),{bbox:b(l=te,pr,ku).call(l,a(this,dn).box,e),root:{"data-main-rotation":e}})}render(){if(this.div)return this.div;let e=super.render();a(this,Kh)&&(e.setAttribute("aria-label",a(this,Kh)),e.setAttribute("role","mark")),a(this,Si)?e.classList.add("free"):this.div.addEventListener("keydown",b(this,Rt,dS).bind(this),{signal:this._uiManager._signal});let i=p(this,xc,document.createElement("div"));return e.append(i),i.setAttribute("aria-hidden","true"),i.className="internal",i.style.clipPath=a(this,gc),this.setDims(),RC(this,a(this,xc),["pointerover","pointerleave"]),this.enableEditing(),e}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{hovered:!1}})}_moveCaret(e){switch(this.parent.unselect(this),e){case 0:case 2:b(this,Rt,w0).call(this,!0);break;case 1:case 3:b(this,Rt,w0).call(this,!1);break}}select(){super.select(),a(this,Ui)&&this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),a(this,Ui)&&(this.parent?.drawLayer.updateProperties(a(this,Ui),{rootClass:{selected:!1}}),a(this,Si)||b(this,Rt,w0).call(this,!1))}get _mustFixPosition(){return!a(this,Si)}show(e=this._isVisible){super.show(e),this.parent&&(this.parent.drawLayer.updateProperties(a(this,Fn),{rootClass:{hidden:!e}}),this.parent.drawLayer.updateProperties(a(this,Ui),{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=y=>{d.abort(),b(this,pr,gS).call(this,e,y)};window.addEventListener("blur",m,{signal:f}),window.addEventListener("pointerup",m,{signal:f}),window.addEventListener("pointerdown",Ie,{capture:!0,passive:!1,signal:f}),window.addEventListener("contextmenu",Hn,{signal:f}),n.addEventListener("pointermove",b(this,pr,mS).bind(this,e),{signal:f}),this._freeHighlight=new Yf({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,T;let s=null;if(e instanceof K0){let{data:{quadPoints:I,rect:_,rotation:F,id:L,color:Y,opacity:q,popupRef:G,richText:j,contentsObj:J,creationDate:et,modificationDate:N},parent:{page:{pageNumber:X}}}=e;s=e={annotationType:_t.HIGHLIGHT,color:Array.from(Y),opacity:q,quadPoints:I,boxes:null,pageIndex:X-1,rect:_.slice(0),rotation:F,annotationElementId:L,id:L,deleted:!1,popupRef:G,richText:j,comment:J?.str||null,creationDate:et,modificationDate:N}}else if(e instanceof Wf){let{data:{inkLists:I,rect:_,rotation:F,id:L,color:Y,borderStyle:{rawWidth:q},popupRef:G,richText:j,contentsObj:J,creationDate:et,modificationDate:N},parent:{page:{pageNumber:X}}}=e;s=e={annotationType:_t.HIGHLIGHT,color:Array.from(Y),thickness:q,inkLists:I,boxes:null,pageIndex:X-1,rect:_.slice(0),rotation:F,annotationElementId:L,id:L,deleted:!1,popupRef:G,richText:j,comment:J?.str||null,creationDate:et,modificationDate:N}}let{color:o,quadPoints:l,inkLists:c,outlines:u,opacity:h}=e,d=await super.deserialize(e,i,n);d.color=ht.makeHexColor(...o),d.opacity=h||1,c&&p(d,ur,e.thickness),d._initialData=s,e.comment&&d.setCommentData(e);let[f,m]=d.pageDimensions,[y,g]=d.pageTranslation;if(l){let I=p(d,xa,[]);for(let _=0;_=0)p(this,Fn,i),p(this,gc,n),this.parent.drawLayer.finalizeDraw(i,{bbox:e.box,path:{d:e.toSVGPath()}}),p(this,Ui,this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:a(this,dn).box,path:{d:a(this,dn).toSVGPath()}},!0));else if(this.parent){let y=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(a(this,Fn),{bbox:b(f=te,pr,ku).call(f,a(this,Mn).box,(y-this.rotation+360)%360),path:{d:e.toSVGPath()}}),this.parent.drawLayer.updateProperties(a(this,Ui),{bbox:b(m=te,pr,ku).call(m,a(this,dn).box,y),path:{d:a(this,dn).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[y,g]=this.parentDimensions;this.x=l,this.y=1-o,this.width=c*g/y,this.height=u*y/g;break}case 180:this.x=1-o,this.y=1-l,this.width=c,this.height=u;break;case 270:{let[y,g]=this.parentDimensions;this.x=1-l,this.y=o,this.width=c*g/y,this.height=u*y/g;break}}let{firstPoint:h}=e;p(this,Xh,[(h[0]-o)/c,(h[1]-l)/u]);let{lastPoint:d}=a(this,dn);p(this,Yh,[(d[0]-o)/c,(d[1]-l)/u])},cS=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,te._defaultOpacity),undo:i.bind(this,n,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:Gt.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(e)},!0)},uS=function(e){let i=a(this,ur),n=s=>{p(this,ur,s),b(this,Rt,hS).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:Gt.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:e},!0)},hS=function(e){a(this,Si)&&(b(this,Rt,b0).call(this,{highlightOutlines:a(this,Mn).getNewOutline(e/2)}),this.fixAndSetPosition(),this.setDims())},hw=function(){a(this,Fn)===null||!this.parent||(this.parent.drawLayer.remove(a(this,Fn)),p(this,Fn,null),this.parent.drawLayer.remove(a(this,Ui)),p(this,Ui,null))},al=function(e=this.parent){a(this,Fn)===null&&({id:Ye(this,Fn)._,clipPathId:Ye(this,gc)._}=e.drawLayer.draw({bbox:a(this,Mn).box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:a(this,Si)},path:{d:a(this,Mn).toSVGPath()}},!1,!0),p(this,Ui,e.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:a(this,Si)},bbox:a(this,dn).box,path:{d:a(this,dn).toSVGPath()}},a(this,Si))),a(this,xc)&&(a(this,xc).style.clipPath=a(this,gc)))},pr=new WeakSet,ku=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]},dS=function(e){te._keyboardManager.exec(this,e)},w0=function(e){if(!a(this,Wh))return;let i=window.getSelection();e?i.setPosition(a(this,Wh),a(this,Nm)):i.setPosition(a(this,Mm),a(this,Fm))},A0=function(){return a(this,Si)?this.rotation:0},fS=function(){if(a(this,Si))return null;let[e,i]=this.pageDimensions,[n,s]=this.pageTranslation,o=a(this,xa),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,y=(1-h)*i+s;l[c]=l[c+4]=m,l[c+1]=l[c+3]=y,l[c+2]=l[c+6]=m+d*e,l[c+5]=l[c+7]=y-f*i,c+=8}return l},pS=function(e){return a(this,Mn).serialize(e,b(this,Rt,A0).call(this))},mS=function(e,i){this._freeHighlight.add(i)&&e.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})},gS=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=""},xS=function(e){let{color:i}=this._initialData;return this.hasEditedComment||e.color.some((n,s)=>n!==i[s])},x(te,pr),z(te,"_defaultColor",null),z(te,"_defaultOpacity",1),z(te,"_defaultThickness",12),z(te,"_type","highlight"),z(te,"_editorType",_t.HIGHLIGHT),z(te,"_freeHighlightId",-1),z(te,"_freeHighlight",null),z(te,"_freeHighlightClipId","");ex=te,ix=class{constructor(){x(this,yc,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,yc)[t]=e}toSVGProperties(){let t=a(this,yc);return p(this,yc,Object.create(null)),{root:t}}reset(){p(this,yc,Object.create(null))}updateAll(t=this){this.updateProperties(t)}clone(){ie("Not implemented")}};yc=new WeakMap;Ht=class Ht extends be{constructor(e){super(e);x(this,Wt);x(this,Pn,null);x(this,Zh);z(this,"_colorPicker",null);z(this,"_drawId",null);p(this,Zh,e.mustBeCommitted||!1),this._addOutlines(e)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}_addOutlines(e){e.drawOutlines&&(b(this,Wt,dw).call(this,e),b(this,Wt,Cf).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){ie("Not implemented")}static get typesMap(){ie("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(Ht,fi).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,Pn).updateProperty(i,c);u&&b(this,Wt,Tf).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,Ht._mergeSVGProperties(a(this,Pn).getPathResizingSVGProperties(b(this,Wt,v0).call(this)),{bbox:b(this,Wt,Iu).call(this)}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,Ht._mergeSVGProperties(a(this,Pn).getPathResizedSVGProperties(b(this,Wt,v0).call(this)),{bbox:b(this,Wt,Iu).call(this)}))}_onTranslating(e,i){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:b(this,Wt,Iu).call(this)})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,Ht._mergeSVGProperties(a(this,Pn).getPathTranslatedSVGProperties(b(this,Wt,v0).call(this),this.parentDimensions),{bbox:b(this,Wt,Iu).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,Zh)&&(p(this,Zh,!1),this.commit(),this.parent.setSelected(this),e&&this.isOnScreen&&this.div.focus())}remove(){b(this,Wt,pw).call(this),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(b(this,Wt,Cf).call(this),b(this,Wt,Tf).call(this,a(this,Pn).box),this.isAttachedToDOM||this.parent.add(this)))}setParent(e){let i=!1;this.parent&&!e?(this._uiManager.removeShouldRescale(this),b(this,Wt,pw).call(this)):e&&(this._uiManager.addShouldRescale(this),b(this,Wt,Cf).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,Ht._mergeSVGProperties({bbox:b(this,Wt,Iu).call(this)},a(this,Pn).updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&b(this,Wt,Tf).call(this,a(this,Pn).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){ie("Not implemented")}static startDrawing(e,i,n,s){let{target:o,offsetX:l,offsetY:c,pointerId:u,pointerType:h}=s;if(Oi.isInitializedAndDifferentPointerType(h))return;let{viewport:{rotation:d}}=e,{width:f,height:m}=o.getBoundingClientRect(),y=p(Ht,bc,new AbortController),g=e.combinedSignal(y);if(Oi.setPointer(h,u),window.addEventListener("pointerup",A=>{Oi.isSamePointerIdOrRemove(A.pointerId)&&this._endDraw(A)},{signal:g}),window.addEventListener("pointercancel",A=>{Oi.isSamePointerIdOrRemove(A.pointerId)&&this._currentParent.endDrawingSession()},{signal:g}),window.addEventListener("pointerdown",A=>{Oi.isSamePointerType(A.pointerType)&&(Oi.initializeAndAddPointerId(A.pointerId),a(Ht,fi).isCancellable()&&(a(Ht,fi).removeLastElement(),a(Ht,fi).isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:g}),window.addEventListener("contextmenu",Hn,{signal:g}),o.addEventListener("pointermove",this._drawMove.bind(this),{signal:g}),o.addEventListener("touchmove",A=>{Oi.isSameTimeStamp(A.timeStamp)&&Ie(A)},{signal:g}),e.toggleDrawing(),i._editorUndoBar?.hide(),a(Ht,fi)){e.drawLayer.updateProperties(this._currentDrawId,a(Ht,fi).startNew(l,c,f,m,d));return}i.updateUIForDefaultProperties(this),p(Ht,fi,this.createDrawerInstance(l,c,f,m,d)),p(Ht,wc,this.getDefaultDrawingOptions()),this._currentParent=e,{id:this._currentDrawId}=e.drawLayer.draw(this._mergeSVGProperties(a(Ht,wc).toSVGProperties(),a(Ht,fi).defaultSVGProperties),!0,!1)}static _drawMove(e){if(Oi.isSameTimeStamp(e.timeStamp),!a(Ht,fi))return;let{offsetX:i,offsetY:n,pointerId:s}=e;if(Oi.isSamePointerId(s)){if(Oi.isUsingMultiplePointers()){this._endDraw(e);return}this._currentParent.drawLayer.updateProperties(this._currentDrawId,a(Ht,fi).add(i,n)),Oi.setTimeStamp(e.timeStamp),Ie(e)}}static _cleanup(e){e&&(this._currentDrawId=-1,this._currentParent=null,p(Ht,fi,null),p(Ht,wc,null),Oi.clearTimeStamp()),a(Ht,bc)&&(a(Ht,bc).abort(),p(Ht,bc,null),Oi.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(Ht,fi).end(e.offsetX,e.offsetY)),this.supportMultipleDrawings){let n=a(Ht,fi),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:Gt.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(e){let i=this._currentParent;if(!i)return null;if(i.toggleDrawing(!0),i.cleanUndoStack(Gt.DRAW_STEP),!a(Ht,fi).isEmpty()){let{pageDimensions:[n,s],scale:o}=i,l=i.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:a(Ht,fi).getOutlines(n*o,s*o,o,this._INNER_MARGIN),drawingOptions:a(Ht,wc),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){ie("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,Wt,dw).call(d,{drawOutlines:u}),b(f=h,Wt,Cf).call(f),h.onScaleChanging(),h.rotate(),h}serializeDraw(e){let[i,n]=this.pageTranslation,[s,o]=this.pageDimensions;return a(this,Pn).serialize([i,n,s,o],e)}renderAnnotationElement(e){return e.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}};Pn=new WeakMap,Zh=new WeakMap,fi=new WeakMap,bc=new WeakMap,wc=new WeakMap,Wt=new WeakSet,dw=function({drawOutlines:e,drawId:i,drawingOptions:n}){p(this,Pn,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,Wt,fw).call(this,e,this.parent),b(this,Wt,Tf).call(this,e.box)},fw=function(e,i){let{id:n}=i.drawLayer.draw(Ht._mergeSVGProperties(this._drawingOptions.toSVGProperties(),e.defaultSVGProperties),!1,!1);return n},pw=function(){this._drawId===null||!this.parent||(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())},Cf=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,Wt,fw).call(this,a(this,Pn),e)}},yS=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]}},v0=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]}},Tf=function(e){[this.x,this.y,this.width,this.height]=b(this,Wt,yS).call(this,e),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()},Iu=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]}},z(Ht,"_currentDrawId",-1),z(Ht,"_currentParent",null),x(Ht,fi,null),x(Ht,bc,null),x(Ht,wc,null),z(Ht,"_INNER_MARGIN",3);nx=Ht,mw=class{constructor(t,e,i,n,s,o){x(this,Jh);x(this,gs,new Float64Array(6));x(this,pi);x(this,mi);x(this,Ac);x(this,Qh);x(this,Xi);x(this,Di,"");x(this,hr,0);x(this,vc,new Rc);x(this,Ec);x(this,Cc);p(this,Ec,i),p(this,Cc,n),p(this,Ac,s),p(this,Qh,o),[t,e]=b(this,Jh,E0).call(this,t,e);let l=p(this,pi,[NaN,NaN,NaN,NaN,t,e]);p(this,Xi,[t,e]),p(this,mi,[{line:l,points:a(this,Xi)}]),a(this,gs).set(l,0)}updateProperty(t,e){t==="stroke-width"&&p(this,Qh,e)}isEmpty(){return!a(this,mi)||a(this,mi).length===0}isCancellable(){return a(this,Xi).length<=10}add(t,e){[t,e]=b(this,Jh,E0).call(this,t,e);let[i,n,s,o]=a(this,gs).subarray(2,6),l=t-s,c=e-o;return Math.hypot(a(this,Ec)*l,a(this,Cc)*c)<=2?null:(a(this,Xi).push(t,e),isNaN(i)?(a(this,gs).set([s,o,t,e],2),a(this,pi).push(NaN,NaN,NaN,NaN,t,e),{path:{d:this.toSVGPath()}}):(isNaN(a(this,gs)[0])&&a(this,pi).splice(6,6),a(this,gs).set([i,n,s,o,t,e],0),a(this,pi).push(...xt.createBezierPoints(i,n,s,o,t,e)),{path:{d:this.toSVGPath()}}))}end(t,e){let i=this.add(t,e);return i||(a(this,Xi).length===2?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,n,s){p(this,Ec,i),p(this,Cc,n),p(this,Ac,s),[t,e]=b(this,Jh,E0).call(this,t,e);let o=p(this,pi,[NaN,NaN,NaN,NaN,t,e]);p(this,Xi,[t,e]);let l=a(this,mi).at(-1);return l&&(l.line=new Float32Array(l.line),l.points=new Float32Array(l.points)),a(this,mi).push({line:o,points:a(this,Xi)}),a(this,gs).set(o,0),p(this,hr,0),this.toSVGPath(),null}getLastElement(){return a(this,mi).at(-1)}setLastElement(t){return a(this,mi)?(a(this,mi).push(t),p(this,pi,t.line),p(this,Xi,t.points),p(this,hr,0),{path:{d:this.toSVGPath()}}):a(this,vc).setLastElement(t)}removeLastElement(){if(!a(this,mi))return a(this,vc).removeLastElement();a(this,mi).pop(),p(this,Di,"");for(let t=0,e=a(this,mi).length;tI??NaN),f,m,y,g),points:A(c[v].map(I=>I??NaN),f,m,y,g)});let w=new this.prototype.constructor;return w.build(d,n,s,1,u,h,o),w}get box(){return a(this,Yi)}updateProperty(e,i){return e==="stroke-width"?b(this,Ii,AS).call(this,i):null}updateParentDimensions([e,i],n){let[s,o]=b(this,Ii,js).call(this);p(this,xs,e),p(this,ys,i),p(this,td,n);let[l,c]=b(this,Ii,js).call(this),u=l-s,h=c-o,d=a(this,Yi);return d[0]-=u,d[1]-=h,d[2]+=2*u,d[3]+=2*h,d}updateRotation(e){return p(this,Om,e),{path:{transform:this.rotationTransform}}}get viewBox(){return a(this,Yi).map(xt.svgRound).join(" ")}get defaultProperties(){let[e,i]=a(this,Yi);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`}}}get rotationTransform(){let[,,e,i]=a(this,Yi),n=0,s=0,o=0,l=0,c=0,u=0;switch(a(this,Om)){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} ${xt.svgRound(c)} ${xt.svgRound(u)})`}getPathResizingSVGProperties([e,i,n,s]){let[o,l]=b(this,Ii,js).call(this),[c,u,h,d]=a(this,Yi);if(Math.abs(h-o)<=xt.PRECISION||Math.abs(d-l)<=xt.PRECISION){let A=e+n/2-(c+h/2),w=i+s/2-(u+d/2);return{path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`,transform:`${this.rotationTransform} translate(${A} ${w})`}}}let f=(n-2*o)/(h-2*o),m=(s-2*l)/(d-2*l),y=h/n,g=d/s;return{path:{"transform-origin":`${xt.svgRound(c)} ${xt.svgRound(u)}`,transform:`${this.rotationTransform} scale(${y} ${g}) translate(${xt.svgRound(o)} ${xt.svgRound(l)}) scale(${f} ${m}) translate(${xt.svgRound(-o)} ${xt.svgRound(-l)})`}}}getPathResizedSVGProperties([e,i,n,s]){let[o,l]=b(this,Ii,js).call(this),c=a(this,Yi),[u,h,d,f]=c;if(c[0]=e,c[1]=i,c[2]=n,c[3]=s,Math.abs(d-o)<=xt.PRECISION||Math.abs(f-l)<=xt.PRECISION){let w=e+n/2-(u+d/2),v=i+s/2-(h+f/2);for(let{line:T,points:I}of a(this,On))xt._translate(T,w,v,T),xt._translate(I,w,v,I);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let m=(n-2*o)/(d-2*o),y=(s-2*l)/(f-2*l),g=-m*(u+o)+e+o,A=-y*(h+l)+i+l;if(m!==1||y!==1||g!==0||A!==0)for(let{line:w,points:v}of a(this,On))xt._rescale(w,g,A,m,y,w),xt._rescale(v,g,A,m,y,v);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${xt.svgRound(e)} ${xt.svgRound(i)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([e,i],n){let[s,o]=n,l=a(this,Yi),c=e-l[0],u=i-l[1];if(a(this,xs)===s&&a(this,ys)===o)for(let{line:h,points:d}of a(this,On))xt._translate(h,c,u,h),xt._translate(d,c,u,d);else{let h=a(this,xs)/s,d=a(this,ys)/o;p(this,xs,s),p(this,ys,o);for(let{line:f,points:m}of a(this,On))xt._rescale(f,c,u,h,d,f),xt._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":`${xt.svgRound(e)} ${xt.svgRound(i)}`}}}get defaultSVGProperties(){let e=a(this,Yi);return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${xt.svgRound(e[0])} ${xt.svgRound(e[1])}`,transform:this.rotationTransform||null},bbox:e}}};Yi=new WeakMap,Om=new WeakMap,Rm=new WeakMap,On=new WeakMap,xs=new WeakMap,ys=new WeakMap,td=new WeakMap,ed=new WeakMap,Tc=new WeakMap,Ii=new WeakSet,js=function(e=a(this,Tc)){let i=a(this,Rm)+e/2*a(this,td);return a(this,ed)%180===0?[i/a(this,xs),i/a(this,ys)]:[i/a(this,ys),i/a(this,xs)]},bS=function(){let[e,i,n,s]=a(this,Yi),[o,l]=b(this,Ii,js).call(this,0);return[e+o,i+l,n-2*o,s-2*l]},wS=function(){let e=p(this,Yi,new Float32Array([1/0,1/0,-1/0,-1/0]));for(let{line:s}of a(this,On)){if(s.length<=12){for(let c=4,u=s.length;cl!==i[c])||e.thickness!==n||e.opacity!==s||e.pageIndex!==o},z(Pu,"_type","ink"),z(Pu,"_editorType",_t.INK),z(Pu,"_defaultDrawingOptions",null);gw=Pu,Kf=class extends Rc{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}},jg=8,af=3,fr=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:y,actualBoundingBoxAscent:g,actualBoundingBoxDescent:A,fontBoundingBoxAscent:w,fontBoundingBoxDescent:v,width:T}=h.measureText(t),I=1.5,_=Math.ceil(Math.max(Math.abs(m)+Math.abs(y)||0,T)*I),F=Math.ceil(Math.max(Math.abs(g)+Math.abs(A)||d,Math.abs(w)+Math.abs(v)||d)*I);u=new OffscreenCanvas(_,F),h=u.getContext("2d",{alpha:!0,willReadFrequently:!0}),h.font=f,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,_,F),h.fillStyle="black",h.fillText(t,_*(I-1)/2,F*(3-I)/2);let L=b(this,ne,bw).call(this,h.getImageData(0,0,_,F).data),Y=b(this,ne,DS).call(this,L),q=b(this,ne,ww).call(this,Y),G=b(this,ne,yw).call(this,L,_,F,q);return this.processDrawnLines({lines:{curves:G,width:_,height:F},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,ne,kS).call(this,t),[u,h]=b(this,ne,SS).call(this,o,l,c,Math.hypot(l,c)*a(this,Sc).sigmaSFactor,a(this,Sc).sigmaR,a(this,Sc).kernelSize),d=b(this,ne,ww).call(this,h),f=b(this,ne,yw).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),y=m/e,g=m/i,A=[];for(let{points:v}of c){let T=o?b(this,ne,TS).call(this,v):v;if(!T)continue;A.push(T);let I=T.length,_=new Float32Array(I),F=new Float32Array(3*(I===2?2:I-2));if(f.push({line:F,points:_}),I===2){_[0]=T[0]*y,_[1]=T[1]*g,F.set([NaN,NaN,NaN,NaN,_[0],_[1]],0);continue}let[L,Y,q,G]=T;L*=y,Y*=g,q*=y,G*=g,_.set([L,Y,q,G],0),F.set([NaN,NaN,NaN,NaN,L,Y],0);for(let j=4;j=-128&&l<=127?u=Int8Array:o>=-32768&&l<=32767?u=Int16Array:u=Int32Array;let h=t.length,d=jg+af*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 y=new CompressionStream("deflate-raw"),g=y.writable.getWriter();await g.ready,g.write(f);let A=u.prototype.constructor;for(let v of t){let T=new A(v.length-2);for(let I=2,_=v.length;I<_;I++)T[I-2]=v[I]-v[I-2];g.write(T)}return g.close(),(await new Response(y.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 T of i)o||(o=new Uint8Array(new Uint32Array(T.buffer,0,4)[0])),o.set(T,l),l+=T.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],y=c[6],g=c[7],A=[],w=(jg+af*y)*Uint32Array.BYTES_PER_ELEMENT,v;switch(g){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 T=0;T0?0:4:i===1?n+6:2-n},Mr=new WeakMap,ES=function(t,e,i,n,s,o,l){let c=b(this,ne,xw).call(this,i,n,s,o);for(let u=0;u<8;u++){let h=(-u+c-l+16)%8,d=a(this,Mr)[2*h],f=a(this,Mr)[2*h+1];if(t[(i+d)*e+(n+f)]!==0)return h}return-1},CS=function(t,e,i,n,s,o,l){let c=b(this,ne,xw).call(this,i,n,s,o);for(let u=0;u<8;u++){let h=(u+c+l+16)%8,d=a(this,Mr)[2*h],f=a(this,Mr)[2*h+1];if(t[(i+d)*e+(n+f)]!==0)return h}return-1},yw=function(t,e,i,n){let s=t.length,o=new Int32Array(s);for(let h=0;h=1&&o[f+1]===0)l+=1,g+=1,m>1&&(c=m);else{m!==1&&(c=Math.abs(m));continue}let A=[d,h],w=g===d+1,v={isHole:w,points:A,id:l,parent:0};u.push(v);let T;for(let j of u)if(j.id===c){T=j;break}T?T.isHole?v.parent=w?T.parent:c:v.parent=w?c:T.parent:v.parent=w?c:0;let I=b(this,ne,ES).call(this,o,e,h,d,y,g,0);if(I===-1){o[f]=-l,o[f]!==1&&(c=Math.abs(o[f]));continue}let _=a(this,Mr)[2*I],F=a(this,Mr)[2*I+1],L=h+_,Y=d+F;y=L,g=Y;let q=h,G=d;for(;;){let j=b(this,ne,CS).call(this,o,e,q,G,y,g,1);_=a(this,Mr)[2*j],F=a(this,Mr)[2*j+1];let J=q+_,et=G+F;A.push(et,J);let N=q*e+G;if(o[N+1]===0?o[N]=-l:o[N]===1&&(o[N]=l),J===h&&et===d&&q===L&&G===Y){o[f]!==1&&(c=Math.abs(o[f]));break}else y=q,g=G,q=J,G=et}}}return u},C0=function(t,e,i,n){if(i-e<=4){for(let L=e;L_&&(F=L,_=Y)}_>(u*I)**2?(b(this,ne,C0).call(this,t,e,F+2,n),b(this,ne,C0).call(this,t,F,i,n)):n.push(s,o)},TS=function(t){let e=[],i=t.length;return b(this,ne,C0).call(this,t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e},SS=function(t,e,i,n,s,o){let l=new Float32Array(o**2),c=-2*n**2,u=o>>1;for(let g=0;g=i))for(let Y=0;Y=e)continue;let G=t[L*e+q],j=l[F*o+Y]*h[Math.abs(G-v)];T+=G*j,I+=j}}let _=m[w]=Math.round(T/I);y[_]++}return[m,y]},DS=function(t){let e=new Uint32Array(256);for(let i of t)e[i]++;return e},bw=function(t){let e=t.length,i=new Uint8ClampedArray(e>>2),n=-1/0,s=1/0;for(let l=0,c=i.length;lc!==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},kS=function(t){let e=t,{width:i,height:n}=t,{maxDim:s}=a(this,Sc),o=i,l=n;if(i>s||n>s){let f=i,m=n,y=Math.log2(Math.max(i,n)/s),g=Math.floor(y);y=y===g?g-1:g;for(let w=0;w{i?.updateEditSignatureButton(e)}))}getSignaturePreview(){let{newCurves:e,areContours:i,thickness:n,width:s,height:o}=a(this,ko),l=Math.max(s,o),c=fr.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,ko,e);p(this,Do,c instanceof Kf),this.description=n;let u;a(this,Do)?u=bn.getDefaultDrawingOptions():(u=bn._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 fr.process(e,i,n,s,bn._INNER_MARGIN)}getFromText(e,i){let{rawDims:{pageWidth:n,pageHeight:s},rotation:o}=this.parent.viewport;return fr.extractContoursFromText(e,i,n,s,o,bn._INNER_MARGIN)}getDrawnSignature(e){let{rawDims:{pageWidth:i,pageHeight:n},rotation:s}=this.parent.viewport;return fr.processDrawnLines({lines:e,pageWidth:i,pageHeight:n,rotation:s,innerMargin:bn._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:e,thickness:i}){e?this._drawingOptions=bn.getDefaultDrawingOptions():(this._drawingOptions=bn._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,Do),color:[0,0,0],thickness:a(this,Do)?0:s});return this.addComment(o),e?(o.paths={lines:i,points:n},o.uuid=a(this,Dc),o.isCopy=!0):o.lines=i,a(this,bs)&&(o.accessibilityData={type:"Figure",alt:a(this,bs)}),o}static deserializeDraw(e,i,n,s,o,l){return l.areContours?Kf.deserialize(e,i,n,s,o,l):Rc.deserialize(e,i,n,s,o,l)}static async deserialize(e,i,n){let s=await super.deserialize(e,i,n);return p(s,Do,e.areContours),s.description=e.accessibilityData?.alt||"",p(s,Dc,e.uuid),s}};Do=new WeakMap,bs=new WeakMap,ko=new WeakMap,Dc=new WeakMap,z(bn,"_type","signature"),z(bn,"_editorType",_t.SIGNATURE),z(bn,"_defaultDrawingOptions",null);Ew=bn,Sf=class extends be{constructor(e){super({...e,name:"stampEditor"});x(this,Xt);x(this,Ee,null);x(this,gi,null);x(this,Io,null);x(this,ya,null);x(this,No,null);x(this,id,"");x(this,ba,null);x(this,kc,!1);x(this,ws,null);x(this,Rn,!1);x(this,nd,!1);p(this,ya,e.bitmapUrl),p(this,No,e.bitmapFile),this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(e,i){be.initialize(e,i)}static isHandlingMimeForPasting(e){return F0.includes(e)}static paste(e,i){i.pasteEditor({mode:_t.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,gi)&&(p(this,Ee,null),this._uiManager.imageManager.deleteId(a(this,gi)),a(this,ba)?.remove(),p(this,ba,null),a(this,ws)&&(clearTimeout(a(this,ws)),p(this,ws,null))),super.remove()}rebuild(){if(!this.parent){a(this,gi)&&b(this,Xt,T0).call(this);return}super.rebuild(),this.div!==null&&(a(this,gi)&&a(this,ba)===null&&b(this,Xt,T0).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(e){this._isDraggable=!0,e&&this.div.focus()}isEmpty(){return!(a(this,Io)||a(this,Ee)||a(this,ya)||a(this,No)||a(this,gi)||a(this,kc))}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,kc)||(a(this,Ee)?b(this,Xt,S0).call(this):b(this,Xt,T0).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,gi,n),s&&p(this,Ee,s),p(this,kc,!1),b(this,Xt,S0).call(this))}_onResized(){this.onScaleChanging()}onScaleChanging(){if(!this.parent)return;a(this,ws)!==null&&clearTimeout(a(this,ws)),p(this,ws,setTimeout(()=>{p(this,ws,null),b(this,Xt,Cw).call(this)},200))}copyCanvas(e,i,n=!1){e||(e=224);let{width:s,height:o}=a(this,Ee),l=new Es,c=a(this,Ee),u=s,h=o,d=null;if(i){if(s>i||o>i){let L=Math.min(i/s,i/o);u=Math.floor(s*L),h=Math.floor(o*L)}d=document.createElement("canvas");let m=d.width=Math.ceil(u*l.sx),y=d.height=Math.ceil(h*l.sy);a(this,Rn)||(c=b(this,Xt,D0).call(this,m,y));let g=d.getContext("2d");g.filter=this._uiManager.hcmFilter;let A="white",w="#cfcfd8";this._uiManager.hcmFilter!=="none"?w="black":ib.isDarkMode&&(A="#8f8f9d",w="#42414d");let v=15,T=v*l.sx,I=v*l.sy,_=new OffscreenCanvas(T*2,I*2),F=_.getContext("2d");F.fillStyle=A,F.fillRect(0,0,T*2,I*2),F.fillStyle=w,F.fillRect(0,0,T,I),F.fillRect(T,I,T,I),g.fillStyle=g.createPattern(_,"repeat"),g.fillRect(0,0,m,y),g.drawImage(c,0,0,c.width,c.height,0,0,m,y)}let f=null;if(n){let m,y;if(l.symmetric&&c.widthe||o>e){let w=Math.min(e/s,e/o);m=Math.floor(s*w),y=Math.floor(o*w),a(this,Rn)||(c=b(this,Xt,D0).call(this,m,y))}let A=new OffscreenCanvas(m,y).getContext("2d",{willReadFrequently:!0});A.drawImage(c,0,0,c.width,c.height,0,0,m,y),f={width:m,height:y,data:A.getImageData(0,0,m,y).data}}return{canvas:d,width:u,height:h,imageData:f}}static async deserialize(e,i,n){let s=null,o=!1;if(e instanceof Z0){let{data:{rect:A,rotation:w,id:v,structParent:T,popupRef:I,richText:_,contentsObj:F,creationDate:L,modificationDate:Y},container:q,parent:{page:{pageNumber:G}},canvas:j}=e,J,et;j?(delete e.canvas,{id:J,bitmap:et}=n.imageManager.getFromCanvas(q.id,j),j.remove()):(o=!0,e._hasNoCanvas=!0);let N=(await i._structTree.getAriaAttributes(`${Nu}${v}`))?.get("aria-label")||"";s=e={annotationType:_t.STAMP,bitmapId:J,bitmap:et,pageIndex:G-1,rect:A.slice(0),rotation:w,annotationElementId:v,id:v,deleted:!1,accessibilityData:{decorative:!1,altText:N},isSvg:!1,structParent:T,popupRef:I,richText:_,comment:F?.str||null,creationDate:L,modificationDate:Y}}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,kc,!0)):d&&n.imageManager.isValidId(d)?(p(l,gi,d),u&&p(l,Ee,u)):p(l,ya,h),p(l,Rn,f);let[y,g]=l.pageDimensions;return l.width=(c[2]-c[0])/y,l.height=(c[3]-c[1])/g,m&&(l.altTextData=m),l._initialData=s,e.comment&&l.setCommentData(e),p(l,nd,!!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,gi),isSvg:a(this,Rn)});if(this.addComment(n),e)return n.bitmapUrl=b(this,Xt,k0).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,Xt,IS).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,Rn)?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!i.stamps.has(a(this,gi)))i.stamps.set(a(this,gi),{area:l,serialized:n}),n.bitmap=b(this,Xt,k0).call(this,!1);else if(a(this,Rn)){let c=i.stamps.get(a(this,gi));l>c.area&&(c.area=l,c.serialized.bitmap.close(),c.serialized.bitmap=b(this,Xt,k0).call(this,!1))}return n}renderAnnotationElement(e){return this.deleted?(e.hide(),null):(e.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null)}};Ee=new WeakMap,gi=new WeakMap,Io=new WeakMap,ya=new WeakMap,No=new WeakMap,id=new WeakMap,ba=new WeakMap,kc=new WeakMap,ws=new WeakMap,Rn=new WeakMap,nd=new WeakMap,Xt=new WeakSet,Df=function(e,i=!1){if(!e){this.remove();return}p(this,Ee,e.bitmap),i||(p(this,gi,e.id),p(this,Rn,e.isSvg)),e.file&&p(this,id,e.file.name),b(this,Xt,S0).call(this)},kf=function(){if(p(this,Io,null),this._uiManager.enableWaiting(!1),!!a(this,ba)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,Ee)){this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&a(this,Ee)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}},T0=function(){if(a(this,gi)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(a(this,gi)).then(n=>b(this,Xt,Df).call(this,n,!0)).finally(()=>b(this,Xt,kf).call(this));return}if(a(this,ya)){let n=a(this,ya);p(this,ya,null),this._uiManager.enableWaiting(!0),p(this,Io,this._uiManager.imageManager.getFromUrl(n).then(s=>b(this,Xt,Df).call(this,s)).finally(()=>b(this,Xt,kf).call(this)));return}if(a(this,No)){let n=a(this,No);p(this,No,null),this._uiManager.enableWaiting(!0),p(this,Io,this._uiManager.imageManager.getFromFile(n).then(s=>b(this,Xt,Df).call(this,s)).finally(()=>b(this,Xt,kf).call(this)));return}let e=document.createElement("input");e.type="file",e.accept=F0.join(",");let i=this._uiManager._signal;p(this,Io,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,Xt,Df).call(this,s)}n()},{signal:i}),e.addEventListener("cancel",()=>{this.remove(),n()},{signal:i})}).finally(()=>b(this,Xt,kf).call(this))),e.click()},S0=function(){let{div:e}=this,{width:i,height:n}=a(this,Ee),[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,ba,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,Xt,Cw).call(this),a(this,nd)||(this.parent.addUndoableEditor(this),p(this,nd,!0)),this._reportTelemetry({action:"inserted_image"}),a(this,id)&&this.div.setAttribute("aria-description",a(this,id)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")},D0=function(e,i){let{width:n,height:s}=a(this,Ee),o=n,l=s,c=a(this,Ee);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},Cw=function(){let[e,i]=this.parentDimensions,{width:n,height:s}=this,o=new Es,l=Math.ceil(n*e*o.sx),c=Math.ceil(s*i*o.sy),u=a(this,ba);if(!u||u.width===l&&u.height===c)return;u.width=l,u.height=c;let h=a(this,Rn)?a(this,Ee):b(this,Xt,D0).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)},k0=function(e){if(e){if(a(this,Rn)){let s=this._uiManager.imageManager.getSvgUrl(a(this,gi));if(s)return s}let i=document.createElement("canvas");return{width:i.width,height:i.height}=a(this,Ee),i.getContext("2d").drawImage(a(this,Ee),0,0),i.toDataURL()}if(a(this,Rn)){let[i,n]=this.pageDimensions,s=Math.round(this.width*i*Da.PDF_TO_CSS_UNITS),o=Math.round(this.height*n*Da.PDF_TO_CSS_UNITS),l=new OffscreenCanvas(s,o);return l.getContext("2d").drawImage(a(this,Ee),0,0,a(this,Ee).width,a(this,Ee).height,0,0,s,o),l.transferToImageBitmap()}return structuredClone(a(this,Ee))},IS=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}},z(Sf,"_type","stamp"),z(Sf,"_editorType",_t.STAMP);wr=class wr{constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:n,accessibilityManager:s,annotationLayer:o,drawLayer:l,textLayer:c,viewport:u,l10n:h}){x(this,ge);x(this,Ic);x(this,rd,!1);x(this,_o,null);x(this,Mo,null);x(this,wa,null);x(this,fn,new Map);x(this,Fo,!1);x(this,sd,!1);x(this,ad,!1);x(this,Fr,null);x(this,Aa,null);x(this,xi,null);x(this,va,null);x(this,Po,null);x(this,od,-1);x(this,vt);let d=[...a(wr,Oo).values()];if(!wr._initialized){wr._initialized=!0;for(let f of d)f.initialize(h,t)}t.registerEditorTypes(d),p(this,vt,t),this.pageIndex=e,this.div=i,p(this,Ic,s),p(this,_o,o),this.viewport=u,p(this,xi,c),this.drawLayer=l,this._structTree=n,a(this,vt).addLayer(this)}get isEmpty(){return a(this,fn).size===0}get isInvisible(){return this.isEmpty&&a(this,vt).getMode()===_t.NONE}updateToolbar(t){a(this,vt).updateToolbar(t)}updateMode(t=a(this,vt).getMode()){switch(b(this,ge,I0).call(this),t){case _t.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case _t.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case _t.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===_t.POPUP)e.toggle("commentEditing",!0);else{e.toggle("commentEditing",!1);for(let i of a(wr,Oo).values())e.toggle(`${i._type}Editing`,t===i._editorType)}this.div.hidden=!1}hasTextLayer(t){return t===a(this,xi)?.div}setEditingState(t){a(this,vt).setEditingState(t)}addCommands(t){a(this,vt).addCommands(t)}cleanUndoStack(t){a(this,vt).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,_o)?.togglePointerEvents(t)}async enable(){p(this,ad,!0),this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),a(this,Po)?.abort(),p(this,Po,null);let t=new Set;for(let i of a(this,ge,Tw))i.enableEditing(),i.show(!0),i.annotationElementId&&(a(this,vt).removeChangedExistingAnnotation(i),t.add(i.annotationElementId));let e=a(this,_o);if(e)for(let i of e.getEditableAnnotations()){if(i.hide(),a(this,vt).isDeletedAnnotationElement(i.data.id)||t.has(i.data.id))continue;let n=await this.deserialize(i);n&&(this.addOrRebuild(n),n.enableEditing())}p(this,ad,!1),a(this,vt)._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(p(this,sd,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),a(this,xi)&&!a(this,Po)){p(this,Po,new AbortController);let n=a(this,vt).combinedSignal(a(this,Po));a(this,xi).div.addEventListener("pointerdown",s=>{let{clientX:l,clientY:c,timeStamp:u}=s,h=a(this,od);if(u-h>500){p(this,od,u);return}p(this,od,-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,y=new RegExp(`^${Of}[0-9]+$`);for(let A of f)if(y.test(A.id)){m=A.id;break}if(!m)return;let g=a(this,fn).get(m);g?.annotationElementId===null&&(s.stopPropagation(),s.preventDefault(),g.dblclick(s))},{signal:n,capture:!0})}let t=a(this,_o),e=[];if(t){let n=new Map,s=new Map;for(let o of a(this,ge,Tw)){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,vt).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,vt).addChangedExistingAnnotation(c),c.renderAnnotationElement(o)&&c.show(!1)),o.show()}}b(this,ge,I0).call(this),this.isEmpty&&(this.div.hidden=!0);let{classList:i}=this.div;for(let n of a(wr,Oo).values())i.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),p(this,sd,!1)}getEditableAnnotation(t){return a(this,_o)?.getEditableAnnotation(t)||null}setActiveEditor(t){a(this,vt).getActive()!==t&&a(this,vt).setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,a(this,xi)?.div&&!a(this,va)){p(this,va,new AbortController);let t=a(this,vt).combinedSignal(a(this,va));a(this,xi).div.addEventListener("pointerdown",b(this,ge,NS).bind(this),{signal:t}),a(this,xi).div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,a(this,xi)?.div&&a(this,va)&&(a(this,va).abort(),p(this,va,null),a(this,xi).div.classList.remove("highlighting"))}enableClick(){if(a(this,Mo))return;p(this,Mo,new AbortController);let t=a(this,vt).combinedSignal(a(this,Mo));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,Mo)?.abort(),p(this,Mo,null)}attach(t){a(this,fn).set(t.id,t);let{annotationElementId:e}=t;e&&a(this,vt).isDeletedAnnotationElement(e)&&a(this,vt).removeDeletedAnnotationElement(t)}detach(t){a(this,fn).delete(t.id),a(this,Ic)?.removePointerInTextLayer(t.contentDiv),!a(this,sd)&&t.annotationElementId&&a(this,vt).addDeletedAnnotationElement(t)}remove(t){this.detach(t),a(this,vt).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(a(this,vt).addDeletedAnnotationElement(t),be.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,vt).addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!a(this,ad)),a(this,vt).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!a(this,wa)&&(t._focusEventsAllowed=!1,p(this,wa,setTimeout(()=>{p(this,wa,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:a(this,vt)._signal}),e.focus())},0))),t._structTreeParentId=a(this,Ic)?.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,fn).values())if(e.uid===t)return e;return null}combinedSignal(t){return a(this,vt).combinedSignal(t)}canCreateNewEmptyEditor(){return a(this,ge,Jr)?.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await a(this,vt).updateMode(t.mode);let{offsetX:i,offsetY:n}=b(this,ge,Dw).call(this),s=a(this,vt).getId(),o=b(this,ge,Sw).call(this,{parent:this,id:s,x:i,y:n,uiManager:a(this,vt),isCentered:!0,...e});o&&this.add(o)}async deserialize(t){return await a(wr,Oo).get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,a(this,vt))||null}createAndAddNewEditor(t,e,i={}){let n=a(this,vt).getId(),s=b(this,ge,Sw).call(this,{parent:this,id:n,x:t.offsetX,y:t.offsetY,uiManager:a(this,vt),isCentered:e,...i});return s&&this.add(s),s}get boundingClientRect(){return this.div.getBoundingClientRect()}addNewEditor(t={}){this.createAndAddNewEditor(b(this,ge,Dw).call(this),!0,t)}setSelected(t){a(this,vt).setSelected(t)}toggleSelected(t){a(this,vt).toggleSelected(t)}unselect(t){a(this,vt).unselect(t)}pointerup(t){let{isMac:e}=Be.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div||!a(this,Fo)||(p(this,Fo,!1),a(this,ge,Jr)?.isDrawer&&a(this,ge,Jr).supportMultipleDrawings))return;if(!a(this,rd)){p(this,rd,!0);return}let i=a(this,vt).getMode();if(i===_t.STAMP||i===_t.POPUP||i===_t.SIGNATURE){a(this,vt).unselectAll();return}this.createAndAddNewEditor(t,!1)}pointerdown(t){if(a(this,vt).getMode()===_t.HIGHLIGHT&&this.enableTextSelection(),a(this,Fo)){p(this,Fo,!1);return}let{isMac:e}=Be.platform;if(t.button!==0||t.ctrlKey&&e||t.target!==this.div)return;if(p(this,Fo,!0),a(this,ge,Jr)?.isDrawer){this.startDrawingSession(t);return}let i=a(this,vt).getActive();p(this,rd,!i||i.isEmpty())}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),a(this,Fr)){a(this,ge,Jr).startDrawing(this,a(this,vt),!1,t);return}a(this,vt).setCurrentDrawingSession(this),p(this,Fr,new AbortController);let e=a(this,vt).combinedSignal(a(this,Fr));this.div.addEventListener("blur",({relatedTarget:i})=>{i&&!this.div.contains(i)&&(p(this,Aa,null),this.commitOrRemove())},{signal:e}),a(this,ge,Jr).startDrawing(this,a(this,vt),!1,t)}pause(t){if(t){let{activeElement:e}=document;this.div.contains(e)&&p(this,Aa,e);return}a(this,Aa)&&setTimeout(()=>{a(this,Aa)?.focus(),p(this,Aa,null)},0)}endDrawingSession(t=!1){return a(this,Fr)?(a(this,vt).setCurrentDrawingSession(null),a(this,Fr).abort(),p(this,Fr,null),p(this,Aa,null),a(this,ge,Jr).endDrawing(t)):null}findNewParent(t,e,i){let n=a(this,vt).findParent(e,i);return n===null||n===this?!1:(n.changeParent(t),!0)}commitOrRemove(){return a(this,Fr)?(this.endDrawingSession(),!0):!1}onScaleChanging(){a(this,Fr)&&a(this,ge,Jr).onScaleChangingWhenDrawing(this)}destroy(){this.commitOrRemove(),a(this,vt).getActive()?.parent===this&&(a(this,vt).commitOrRemove(),a(this,vt).setActiveEditor(null)),a(this,wa)&&(clearTimeout(a(this,wa)),p(this,wa,null));for(let t of a(this,fn).values())a(this,Ic)?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,a(this,fn).clear(),a(this,vt).removeLayer(this)}async render({viewport:t}){this.viewport=t,Ro(this.div,t);for(let e of a(this,vt).getEditors(this.pageIndex))this.add(e),e.rebuild();await a(this,vt).findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){a(this,vt).commitOrRemove(),b(this,ge,I0).call(this);let e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,Ro(this.div,{rotation:i}),e!==i)for(let n of a(this,fn).values())n.rotate(i)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return a(this,vt).viewParameters.realScale}};Ic=new WeakMap,rd=new WeakMap,_o=new WeakMap,Mo=new WeakMap,wa=new WeakMap,fn=new WeakMap,Fo=new WeakMap,sd=new WeakMap,ad=new WeakMap,Fr=new WeakMap,Aa=new WeakMap,xi=new WeakMap,va=new WeakMap,Po=new WeakMap,od=new WeakMap,vt=new WeakMap,Oo=new WeakMap,ge=new WeakSet,Tw=function(){return a(this,fn).size!==0?a(this,fn).values():a(this,vt).getEditors(this.pageIndex)},NS=function(t){a(this,vt).unselectAll();let{target:e}=t;if(e===a(this,xi).div||(e.getAttribute("role")==="img"||e.classList.contains("endOfContent"))&&a(this,xi).div.contains(e)){let{isMac:i}=Be.platform;if(t.button!==0||t.ctrlKey&&i)return;a(this,vt).showAllEditors("highlight",!0,!0),a(this,xi).div.classList.add("free"),this.toggleDrawing(),ex.startHighlighting(this,a(this,vt).direction==="ltr",{target:a(this,xi).div,x:t.x,y:t.y}),a(this,xi).div.addEventListener("pointerup",()=>{a(this,xi).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:a(this,vt)._signal}),t.preventDefault()}},Jr=function(){return a(wr,Oo).get(a(this,vt).getMode())},Sw=function(t){let e=a(this,ge,Jr);return e?new e.prototype.constructor(t):null},Dw=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}},I0=function(){for(let t of a(this,fn).values())t.isEmpty()&&t.remove()},z(wr,"_initialized",!1),x(wr,Oo,new Map([sw,gw,Sf,ex,Ew].map(t=>[t._editorType,t])));sx=wr,si=class si{constructor(){x(this,Ts);x(this,Pr,null);x(this,Ki,new Map);x(this,Nc,new Map)}setParent(t){if(!a(this,Pr)){p(this,Pr,t);return}if(a(this,Pr)!==t){if(a(this,Ki).size>0)for(let e of a(this,Ki).values())e.remove(),t.append(e);p(this,Pr,t)}}static get _svgFactory(){return Mt(this,"_svgFactory",new Pc)}draw(t,e=!1,i=!1){let n=Ye(si,Lm)._++,s=b(this,Ts,kw).call(this),o=si._svgFactory.createElement("defs");s.append(o);let l=si._svgFactory.createElement("path");o.append(l);let c=`path_${n}`;l.setAttribute("id",c),l.setAttribute("vector-effect","non-scaling-stroke"),e&&a(this,Nc).set(n,l);let u=i?b(this,Ts,MS).call(this,o,c):null,h=si._svgFactory.createElement("use");return s.append(h),h.setAttribute("href",`#${c}`),this.updateProperties(s,t),a(this,Ki).set(n,s),{id:n,clipPathId:`url(#${u})`}}drawOutline(t,e){let i=Ye(si,Lm)._++,n=b(this,Ts,kw).call(this),s=si._svgFactory.createElement("defs");n.append(s);let o=si._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=si._svgFactory.createElement("mask");s.append(d),c=`mask_${i}`,d.setAttribute("id",c),d.setAttribute("maskUnits","objectBoundingBox");let f=si._svgFactory.createElement("rect");d.append(f),f.setAttribute("width","1"),f.setAttribute("height","1"),f.setAttribute("fill","white");let m=si._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=si._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,Ki).set(i,n),i}finalizeDraw(t,e){a(this,Nc).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,Ki).get(t):t;if(l){if(i&&b(this,Ts,Iw).call(this,l,i),n&&b(c=si,Ix,_S).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,Ts,Iw).call(this,h,o)}}}updateParent(t,e){if(e===this)return;let i=a(this,Ki).get(t);i&&(a(e,Pr).append(i),a(this,Ki).delete(t),a(e,Ki).set(t,i))}remove(t){a(this,Nc).delete(t),a(this,Pr)!==null&&(a(this,Ki).get(t).remove(),a(this,Ki).delete(t))}destroy(){p(this,Pr,null);for(let t of a(this,Ki).values())t.remove();a(this,Ki).clear(),a(this,Nc).clear()}};Pr=new WeakMap,Ki=new WeakMap,Nc=new WeakMap,Lm=new WeakMap,Ix=new WeakSet,_S=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}%`},Ts=new WeakSet,kw=function(){let t=si._svgFactory.create(1,1,!0);return a(this,Pr).append(t),t.setAttribute("aria-hidden",!0),t},MS=function(t,e){let i=si._svgFactory.createElement("clipPath");t.append(i);let n=`clip_${e}`;i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");let s=si._svgFactory.createElement("use");return i.append(s),s.setAttribute("href",`#${e}`),s.classList.add("clip"),n},Iw=function(t,e){for(let[i,n]of Object.entries(e))n===null?t.removeAttribute(i):t.setAttribute(i,n)},x(si,Ix),x(si,Lm,0);ax=si;Pf=class Pf{constructor(t,e,i,n){x(this,Nx);x(this,ld,[]);x(this,Bm,new Map);x(this,Um,null);x(this,cd,0);x(this,As,0);x(this,vs,0);p(this,cd,t),p(this,ld,e),p(this,As,i.rawDims.pageWidth),p(this,vs,i.rawDims.pageHeight),p(this,Um,n)}render(){let t=document.createElement("div");t.className="textLayerImages";for(let e=0;e{if(!(e.target instanceof HTMLCanvasElement))return;let i=e.target,n=a(this,Bm).get(i);if(!n)return;let s=a(Pf,zm)?.deref();if(s===i)return;s&&(s.width=0,s.height=0),p(Pf,zm,new WeakRef(i));let{inverseTransform:o,x1:l,y1:c,width:u,height:h}=n,d=a(this,Um).call(this),f=Math.ceil(l*d.width),m=Math.ceil(c*d.height),y=Math.floor((l+u/a(this,As))*d.width),g=Math.floor((c+h/a(this,vs))*d.height);i.width=y-f,i.height=g-m;let A=i.getContext("2d");A.setTransform(...o),A.translate(-f,-m),A.drawImage(d,0,0)}),t}};ld=new WeakMap,Bm=new WeakMap,Um=new WeakMap,cd=new WeakMap,As=new WeakMap,vs=new WeakMap,zm=new WeakMap,Nx=new WeakSet,FS=function([t,e,i,n,s,o]){let l=Math.hypot((s-t)*a(this,As),(o-e)*a(this,vs)),c=Math.hypot((i-t)*a(this,As),(n-e)*a(this,vs));if(lLM,existsSync:()=>$S,lstatSync:()=>qS,mkdirSync:()=>XS,readFile:()=>GS,readFileSync:()=>HS,readdirSync:()=>WS,statSync:()=>VS,writeFileSync:()=>YS});function Bc(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 HS,GS,$S,VS,qS,WS,XS,YS,LM,ZS=Kt(()=>{"use strict";H();HS=r=>Bc("readFileSync"),GS=(r,t)=>Bc("readFile"),$S=r=>!1,VS=r=>Bc("statSync"),qS=r=>Bc("lstatSync"),WS=r=>Bc("readdirSync"),XS=r=>Bc("mkdirSync"),YS=(r,t)=>Bc("writeFileSync"),LM={readFileSync:HS,readFile:GS,existsSync:$S,statSync:VS,lstatSync:qS,readdirSync:WS,mkdirSync:XS,writeFileSync:YS,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 Wc=typeof window<"u"&&typeof window.document<"u",zD={fs:"direct file system access","path-parsing":"parsing from file path string","pdf-worker-auto-resolution":"automatic PDF worker resolution from node_modules"};function Km(r){if(Wc)throw new Error(`officeparser: '${zD[r]}' is not supported in the browser. Browser users must pass file content as Buffer or ArrayBuffer directly.`)}function gA(){typeof window<"u"&&!window.DOMMatrix&&(window.DOMMatrix=class{constructor(t){z(this,"a");z(this,"b");z(this,"c");z(this,"d");z(this,"e");z(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 pg=jc(Dv());H();function Wr(r){if(r)try{if(r.startsWith("D:"))return II(r);let t=new Date(r);return isNaN(t.getTime())?void 0:t}catch{return}}function II(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 ni=r=>r.nodeType===1,Zt=(r,t={})=>{let e=new pg.DOMParser(t),i=r.charCodeAt(0)===65279?r.slice(1):r.trim();return e.parseFromString(i,"text/xml")},tt=(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},mg=(r,t={})=>new pg.XMLSerializer().serializeToString(r),NI=(r,t)=>{if(!r||typeof r.lineNumber!="number"||typeof r.columnNumber!="number")return;let e=t.split(` +`),i=0;for(let n=0;n`,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{if(e.serializeRawContent===!1){let i=NI(r,t);if(i)return i}return mg(r,{preserveWhitespace:e.preserveXmlWhitespace})},ut=(r,t)=>{let e=r.getElementsByTagName(t);if(e&&e.length>0)return e[0]};var He=(r,t)=>{let e=[];if(!r.childNodes)return e;for(let i=0;i{let t=Zt(r),e={},i=tt(t,"cp:coreProperties")[0];if(i){let s=tt(i,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let o=tt(i,"dc:creator")[0];o&&o.textContent&&(e.author=o.textContent);let l=tt(i,"cp:lastModifiedBy")[0];l&&l.textContent&&(e.lastModifiedBy=l.textContent);let c=tt(i,"dcterms:created")[0];c&&c.textContent&&(e.created=Wr(c.textContent));let u=tt(i,"dcterms:modified")[0];u&&u.textContent&&(e.modified=Wr(u.textContent));let h=tt(i,"dc:description")[0];h&&h.textContent&&(e.description=h.textContent);let d=tt(i,"dc:subject")[0];return d&&d.textContent&&(e.subject=d.textContent),e}let n=tt(t,"office:meta")[0];if(n){let s=tt(n,"dc:title")[0];s&&s.textContent&&(e.title=s.textContent);let o=tt(n,"dc:creator")[0];o&&o.textContent&&(e.author=o.textContent);let l=tt(n,"dc:description")[0];l&&l.textContent&&(e.description=l.textContent);let c=tt(n,"dc:subject")[0];c&&c.textContent&&(e.subject=c.textContent);let u=tt(n,"meta:creation-date")[0];u&&u.textContent&&(e.created=Wr(u.textContent));let h=tt(n,"dc:date")[0];h&&h.textContent&&(e.modified=Wr(h.textContent));let d=tt(n,"meta:user-defined");if(d.length>0){let f={};for(let m of d){let y=m.getAttribute("meta:name");if(!y||!m.textContent)continue;let g=m.getAttribute("meta:value-type")||"string",A=m.textContent;if(g==="boolean")f[y]=A.toLowerCase()==="true";else if(g==="float"){let w=Number(A);isNaN(w)||(f[y]=w)}else if(g==="date"||g==="time"){let w=Wr(A);w?f[y]=w:f[y]=A}else f[y]=A}Object.keys(f).length>0&&(e.customProperties=f)}}return e},uu=r=>{let t=Zt(r),e={},i=tt(t,"property");for(let n of i){let s=n.getAttribute("name");if(s)for(let o=0;o{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{let t=r.toString("utf8"),i=Zt(t).documentElement;if(!i)return{title:void 0,xAxisTitle:void 0,yAxisTitle:void 0,dataSets:[],labels:[],rawTexts:[]};let n=Vd(i,"c:title"),s,o,l=i.getElementsByTagName("c:catAx");l.length>0&&(s=Vd(l[0],"c:title"));let c=i.getElementsByTagName("c:valAx");c.length>0&&(o=Vd(c[0],"c:title"));let u=i.getElementsByTagName("c:ser"),h=[],d=[];for(let m=0;m0&&d.length===0&&d.push(...F)}h.push({name:g,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}},MI=r=>{let t=r.toString("utf8"),e=Zt(t),i=tt(e,"chart:chart")[0]||e.documentElement,n=tt(i,"chart:title")[0],s=n&&tt(n,"text:p")[0]?.textContent||void 0,o=tt(i,"table:table")[0],l=[],c=[],u=[];if(o){let m=[],y=He(o,"table:table-header-rows")[0];if(y&&m.push(...He(y,"table:table-row")),m.push(...He(o,"table:table-row")),m.length>0){let g=He(m[0],"table:table-cell");for(let A=1;A0){let v=He(w[0],"text:p")[0]?.textContent||void 0;v&&c.push(v);let T=0;for(let I=1;I0&&(v=T[0].textContent||void 0),!v&&A&&(v=`Series ${A.split(".").pop()?.replace(/\$/g,"")||A}`);let I={name:v,values:[],pointLabels:[]};w&&I.values.push(`[${w}]`),l.push(I)}let y=tt(i,"chart:categories")[0];if(y){let g=y.getAttribute("table:cell-range-address");g&&c.push(`[${g}]`)}}let h=tt(e,"chart:axis"),d,f;for(let m of h){let y=m.getAttribute("chart:dimension"),g=tt(m,"chart:title")[0],A=g&&tt(g,"text:p")[0]?.textContent||void 0;y==="x"?d=A:y==="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}},Xo=r=>r.toString("utf8",0,500).includes("urn:oasis:names:tc:opendocument:xmlns:chart:1.0")?MI(r):_I(r);H();var hu="[OfficeParser]: ";var FI={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.'},kv=(r,t)=>{let e=FI[r];return typeof e=="function"?e(t):e},Ms=(r,t,e)=>{let i=kv(r,e);return t.outputErrorToConsole&&console.error(hu+i),new Error(hu+i)},Iv=(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=kv("FILE_CORRUPTED",e)),t.outputErrorToConsole&&console.error(hu+i),new Error(hu+i)},rn=(r,t,e)=>{t.outputErrorToConsole&&(e?console.warn(hu+r,e):console.warn(hu+r))};H();var PI=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"}},OI=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"}},gr=(r,t)=>{let e=r.split(".").pop()||"",i=OI(t);return i||(i=PI(e)),{type:"image",mimeType:i,data:t.toString("base64"),name:r,extension:e}};H();var Ba=class Ba{constructor(){z(this,"pool",[]);z(this,"queue",[]);z(this,"MAX_WORKERS",4);z(this,"idleTimeout",1e4);z(this,"timeoutId",null)}static getInstance(){return Ba.instance||(Ba.instance=new Ba),Ba.instance}static hasInstance(){return!!Ba.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.lengthjc(yE())),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.lastUsede.worker.terminate());await Promise.all(t),this.pool=[]}};z(Ba,"instance");var Wd=Ba,Xn=async(r,t)=>{let e=r;return typeof window<"u"&&typeof Blob<"u"&&st.Buffer.isBuffer(r)&&(e=new Blob([r],{type:"image/bmp"})),await Wd.getInstance().recognize(e,t)},bE=async()=>{Wd.hasInstance()&&await Wd.getInstance().terminate()};H();H();var wE={},dN=(function(r,t,e,i,n){var s=new Worker(wE[t]||(wE[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}),Gi=Uint8Array,Ko=Uint16Array,EE=Int32Array,My=new Gi([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]),Fy=new Gi([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]),CE=new Gi([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),TE=function(r,t){for(var e=new Ko(31),i=0;i<31;++i)e[i]=t+=1<>1|(Jt&21845)<<1,Fs=(Fs&52428)>>2|(Fs&13107)<<2,Fs=(Fs&61680)>>4|(Fs&3855)<<4,vg[Jt]=((Fs&65280)>>8|(Fs&255)<<8)>>1;var Fs,Jt,du=(function(r,t,e){for(var i=r.length,n=0,s=new Ko(t);n>c]=u}else for(l=new Ko(i),n=0;n>15-r[n]);return l}),Xd=new Gi(288);for(Jt=0;Jt<144;++Jt)Xd[Jt]=8;var Jt;for(Jt=144;Jt<256;++Jt)Xd[Jt]=9;var Jt;for(Jt=256;Jt<280;++Jt)Xd[Jt]=7;var Jt;for(Jt=280;Jt<288;++Jt)Xd[Jt]=8;var Jt,IE=new Gi(32);for(Jt=0;Jt<32;++Jt)IE[Jt]=5;var Jt;var NE=du(Xd,9,1);var _E=du(IE,5,1),wg=function(r){for(var t=r[0],e=1;et&&(t=r[e]);return t},Yn=function(r,t,e){var i=t/8|0;return(r[i]|r[i+1]<<8)>>(t&7)&e},Ag=function(r,t){var e=t/8|0;return(r[e]|r[e+1]<<8|r[e+2]<<16)>>(t&7)},ME=function(r){return(r+7)/8|0},Eg=function(r,t,e){return(t==null||t<0)&&(t=0),(e==null||e>r.length)&&(e=r.length),new Gi(r.subarray(t,e))};var FE=["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"],Hi=function(r,t,e){var i=new Error(t||FE[r]);if(i.code=r,Error.captureStackTrace&&Error.captureStackTrace(i,Hi),!e)throw i;return i},PE=function(r,t,e,i){var n=r.length,s=i?i.length:0;if(!n||t.f&&!t.l)return e||new Gi(0);var o=!e,l=o||t.i!=2,c=t.i;o&&(e=new Gi(n*3));var u=function(ot){var dt=e.length;if(ot>dt){var at=new Gi(Math.max(dt*2,ot));at.set(e),e=at}},h=t.f||0,d=t.p||0,f=t.b||0,m=t.l,y=t.d,g=t.m,A=t.n,w=n*8;do{if(!m){h=Yn(r,d,1);var v=Yn(r,d+1,3);if(d+=3,v)if(v==1)m=NE,y=_E,g=9,A=5;else if(v==2){var F=Yn(r,d,31)+257,L=Yn(r,d+10,15)+4,Y=F+Yn(r,d+5,31)+1;d+=14;for(var q=new Gi(Y),G=new Gi(19),j=0;j>4;if(T<16)q[j++]=T;else{var O=0,C=0;for(T==16?(C=3+Yn(r,d,3),d+=2,O=q[j-1]):T==17?(C=3+Yn(r,d,7),d+=3):T==18&&(C=11+Yn(r,d,127),d+=7);C--;)q[j++]=O}}var D=q.subarray(0,F),E=q.subarray(F);g=wg(D),A=wg(E),m=du(D,g,1),y=du(E,A,1)}else Hi(1);else{var T=ME(d)+4,I=r[T-4]|r[T-3]<<8,_=T+I;if(_>n){c&&Hi(0);break}l&&u(f+I),e.set(r.subarray(T,_),f),t.b=f+=I,t.p=d=_*8,t.f=h;continue}if(d>w){c&&Hi(0);break}}l&&u(f+131072);for(var S=(1<>4;if(d+=O&15,d>w){c&&Hi(0);break}if(O||Hi(2),P<256)e[f++]=P;else if(P==256){M=d,m=null;break}else{var B=P-254;if(P>264){var j=P-257,$=My[j];B=Yn(r,d,(1<<$)-1)+Py[j],d+=$}var U=y[Ag(r,d)&k],V=U>>4;U||Hi(3),d+=U&15;var E=kE[V];if(V>3){var $=Fy[V];E+=Ag(r,d)&(1<<$)-1,d+=$}if(d>w){c&&Hi(0);break}l&&u(f+131072);var Z=f+B;if(f>>0},Ny=function(r,t){return xr(r,t)+xr(r,t+4)*4294967296};function wN(r,t,e){return e||(e=t,t={}),typeof e!="function"&&Hi(7),bN(r,t,[yN],function(i){return OE(Oy(i.data[0],RE(i.data[1])))},1,e)}function Oy(r,t){return PE(r,{i:2},t&&t.out,t&&t.dictionary)}var _y=typeof TextDecoder<"u"&&new TextDecoder,AN=0;try{_y.decode(pN,{stream:!0}),AN=1}catch{}var vN=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:Eg(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 EN(r,t){if(t){for(var e="",i=0;i65558)return o(Hi(13,0,1),null),n;var c=Yr(r,l+8);if(c){var u=c,h=xr(r,l+16),d=h==4294967295||u==65535;if(d){var f=xr(r,l-12);d=xr(r,f)==101075792,d&&(u=c=xr(r,f+32),h=xr(r,f+48))}for(var m=t&&t.filter,y=function(A){var w=TN(r,h,d),v=w[0],T=w[1],I=w[2],_=w[3],F=w[4],L=w[5],Y=CN(r,L);h=F;var q=function(j,J){j?(n(),o(j,null)):(J&&(s[_]=J),--c||o(null,s))};if(!m||m({name:_,size:T,originalSize:I,compression:v}))if(!v)q(null,Eg(r,Y,Y+T));else if(v==8){var G=r.subarray(Y,Y+T);if(I<524288||T>.8*I)try{q(null,Oy(G,{out:new Gi(I)}))}catch(j){q(j,null)}else i.push(wN(G,{size:I},q))}else q(Hi(14,"unknown compression type "+v,1),null);else q(null,null)},g=0;gnew Promise((e,i)=>{LE(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:st.Buffer.from(l)})))})});var BE=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 Ua(r,N=>!!N.match(e)||!!N.match(i)||!!N.match(n)||N===s||N==="xl/styles.xml"||N==="xl/workbook.xml"||N==="xl/_rels/workbook.xml.rels"||!!N.match(l)||!!N.match(c)||!!t.extractAttachments&&(!!N.match(o)||!!N.match(u)||!!N.match(h))),f=d.find(N=>N.path===s),m=[];if(f){let N=Zt(f.content.toString()),X=tt(N,"si");for(let O of X){let C=tt(O,"r");if(C.length>0){let D=[];for(let E of C){let S=tt(E,"t")[0];if(S){let k=S.textContent||"",M=tt(E,"rPr")[0],P={};if(M){tt(M,"b").length>0&&(P.bold=!0),tt(M,"i").length>0&&(P.italic=!0),tt(M,"u").length>0&&(P.underline=!0),tt(M,"strike").length>0&&(P.strikethrough=!0);let B=tt(M,"sz")[0];B&&(P.size=B.getAttribute("val")+"pt");let $=tt(M,"color")[0];if($){let Z=$.getAttribute("rgb");Z&&(P.color="#"+Z.substring(2))}let U=tt(M,"rFont")[0];U&&(P.font=U.getAttribute("val")||void 0);let V=tt(M,"vertAlign")[0];if(V){let Z=V.getAttribute("val");Z==="subscript"&&(P.subscript=!0),Z==="superscript"&&(P.superscript=!0)}}D.push({type:"text",text:k,formatting:Object.keys(P).length>0?P:void 0})}}m.push(D)}else{let D=tt(O,"t"),E="";for(let S of D)E+=S.textContent||"";m.push(E)}}}let y=d.find(N=>N.path==="xl/styles.xml"),g={};if(y){let N=Zt(y.content.toString()),X=tt(N,"fonts")[0],O=[];if(X){let S=tt(X,"font");for(let k of S){let M={};tt(k,"b").length>0&&(M.bold=!0),tt(k,"i").length>0&&(M.italic=!0),tt(k,"u").length>0&&(M.underline=!0),tt(k,"strike").length>0&&(M.strikethrough=!0);let P=tt(k,"sz")[0];if(P){let V=P.getAttribute("val");V&&(M.size=V+"pt")}let B=tt(k,"color")[0];if(B){let V=B.getAttribute("rgb");V&&(M.color="#"+V.substring(2))}let $=tt(k,"name")[0];if($){let V=$.getAttribute("val");V&&(M.font=V)}let U=tt(k,"vertAlign")[0];if(U){let V=U.getAttribute("val");V==="subscript"&&(M.subscript=!0),V==="superscript"&&(M.superscript=!0)}O.push(M)}}let C=tt(N,"fills")[0],D=[];if(C){let S=tt(C,"fill");for(let k of S){let M={},P=tt(k,"patternFill")[0];if(P){let B=tt(P,"fgColor")[0];if(B){let $=B.getAttribute("rgb"),U=B.getAttribute("theme");if($&&$!=="00000000")M.backgroundColor="#"+$.substring(2);else if(U){let V=parseInt(U);V===0?M.backgroundColor="#FFFFFF":V===1?M.backgroundColor="#000000":V===2?M.backgroundColor="#EEECE1":V===3&&(M.backgroundColor="#1F497D")}}}D.push(M)}}let E=tt(N,"cellXfs")[0];if(E){let S=tt(E,"xf");for(let k=0;kN.path.match(/xl\/media\/.*/)),v=d.filter(N=>N.path.match(n)),T={};if(t.extractAttachments){let N=d.filter(O=>O.path.match(h));for(let O of N){let D=`xl/drawings/${O.path.split("/").pop()?.replace(".rels","")||""}`,E=Zt(O.content.toString()),S=tt(E,"Relationship");T[D]||(T[D]={});for(let k of S){let M=k.getAttribute("Id"),P=k.getAttribute("Target");if(M&&P&&P.includes("media/")){let B="xl/"+P.replace("../","");T[D][M]={path:B}}}}let X=d.filter(O=>O.path.match(i));for(let O of X){let C=Zt(O.content.toString()),D=tt(C,"xdr:pic"),E=T[O.path]||{};for(let S of D){let k=tt(S,"xdr:blipFill")[0],M=k?tt(k,"a:blip")[0]:null,P=M?M.getAttribute("r:embed"):null,B=tt(S,"xdr:nvPicPr")[0],$=B?tt(B,"xdr:cNvPr")[0]:null,U=$?$.getAttribute("descr")||$.getAttribute("name"):void 0;P&&E[P]&&(E[P].altText=U||"")}}for(let O of w){let C=gr(O.path.split("/").pop()||"image",O.content),D="";for(let E in T){for(let S in T[E])if(T[E][S].path===O.path){D=T[E][S].altText||"";break}if(D)break}if(D&&(C.altText=D),A.push(C),t.ocr&&C.mimeType.startsWith("image/"))try{let E=(await Xn(O.content,{language:t.ocrLanguage,...t.ocrConfig})).trim();E&&(C.ocrText=E)}catch(E){rn(`OCR failed for ${C.name}:`,t,E)}}for(let O of v){let C={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:O.content.toString("base64"),name:O.path.split("/").pop()||"",extension:"xml"};try{let D=Xo(O.content);C.chartData=D}catch(D){rn(`Failed to extract chart data from ${O.path}:`,t,D)}A.push(C)}}let I={};if(t.extractAttachments){let N=d.filter(X=>X.path.match(h));for(let X of N){let C=`xl/drawings/${X.path.split("/").pop()?.replace(".rels","")||""}`,D=Zt(X.content.toString()),E=tt(D,"Relationship");I[C]||(I[C]={});for(let S of E){let k=S.getAttribute("Id"),M=S.getAttribute("Target"),P=S.getAttribute("Type");if(k&&M&&P&&P.includes("chart")){let B=M.split("/").pop()||"";I[C][k]=B}}}}let _={},F=d.find(N=>N.path==="xl/workbook.xml"),L=d.find(N=>N.path==="xl/_rels/workbook.xml.rels");if(F&&L){let N=Zt(L.content.toString()),X=tt(N,"Relationship"),O={};for(let E of X){let S=E.getAttribute("Id"),k=E.getAttribute("Target");if(S&&k){let M=k.split("/").pop()||"";O[S]=M}}let C=Zt(F.content.toString()),D=tt(C,"sheet");for(let E of D){let S=E.getAttribute("name"),k=E.getAttribute("r:id");S&&k&&O[k]&&(_[O[k]]=S)}}let Y=[],q=[];for(let N of d)if(!N.path.match(o)&&N.path!==s&&N.path!=="xl/styles.xml"&&!N.path.match(i)&&!N.path.match(n)&&!N.path.match(u)&&!N.path.match(h)&&N.path.match(e)){t.includeRawContent&&q.push(N.content.toString());let X=[],O=/[\s\S]*?<\/row>/g,C=N.content.toString().match(O);if(C)for(let S of C){let k=[],M=/[\s\S]*?<\/c>/g,P=S.match(M),B=S.match(/r="(\d+)"/),$=B?parseInt(B[1])-1:0;if(P)for(let U of P){let V=U.match(/t="([a-z]+)"/),Z=V?V[1]:"n",Q=U.match(/(.*?)<\/v>/),nt=U.match(/(.*?)<\/t>/),ot="",dt=[];if(Z==="s"&&Q){let lt=parseInt(Q[1]),ct=m[lt];Array.isArray(ct)?(dt=JSON.parse(JSON.stringify(ct)),ot=dt.map(rt=>rt.text).join("")):ot=ct||""}else Z==="inlineStr"&&nt?ot=nt[1]:Q&&(ot=Q[1]);let at=U.match(/r="([A-Z]+)(\d+)"/),ft=(at?at[1]:"").charCodeAt(0)-65;if(ot||dt.length>0){let lt=U.match(/s="(\d+)"/),ct=lt?parseInt(lt[1]):void 0,rt=ct!==void 0&&g[ct]?g[ct]:{};if(dt.length>0)for(let wt of dt)wt.formatting||(wt.formatting={}),rt.backgroundColor&&(wt.formatting.backgroundColor=rt.backgroundColor),rt.alignment&&(wt.formatting.alignment=rt.alignment),!wt.formatting.font&&rt.font&&(wt.formatting.font=rt.font),!wt.formatting.size&&rt.size&&(wt.formatting.size=rt.size);else dt.push({type:"text",text:ot,formatting:rt});let gt={type:"cell",text:ot,children:dt,metadata:{row:$,col:ft}};t.includeRawContent&&(gt.rawContent=U),k.push(gt)}}if(k.length>0){let U={type:"row",children:k,metadata:void 0};t.includeRawContent&&(U.rawContent=S),X.push(U)}}if(t.extractAttachments){let k=`xl/worksheets/_rels/${N.path.split("/").pop()||""}.rels`,M=d.find($=>$.path===k),P={};if(M){let $=Zt(M.content.toString()),U=tt($,"Relationship");for(let V of U){let Z=V.getAttribute("Id"),Q=V.getAttribute("Target"),nt=V.getAttribute("Type");Z&&Q&&nt&&nt.includes("drawing")&&(P[Z]="xl/drawings/"+Q.replace("../drawings/",""))}}let B=N.content.toString().match(/pt.name===dt.path.split("/").pop());if(at){let pt={type:"image",text:"",children:[],metadata:{attachmentName:at.name||"unknown",altText:dt.altText||void 0}};X.push(pt)}}let nt=I[Z];if(nt)for(let ot in nt){let dt=nt[ot];if(A.find(pt=>pt.name===dt)){let pt={type:"chart",text:"",children:[],metadata:{attachmentName:dt}};X.push(pt)}}}}}let D=N.path.split("/").pop()||"Sheet",E=_[D]||D;Y.push({type:"sheet",children:X,metadata:{sheetName:E},rawContent:t.includeRawContent?N.content.toString():void 0})}let G=d.find(N=>N.path.match(l)),j=G?La(G.content.toString()):{},J=d.find(N=>N.path.match(c));if(J){let N=uu(J.content.toString());Object.keys(N).length>0&&(j.customProperties=N)}let et=N=>{for(let X of N){if("attachmentName"in(X.metadata||{})){let O=X.metadata,C=A.find(D=>D.name===O.attachmentName);C&&(X.type==="image"&&(C.ocrText&&(X.text=C.ocrText),O.altText&&(C.altText=O.altText)),X.type==="chart"&&C.chartData&&(X.text=C.chartData.rawTexts.join(t.newlineDelimiter||` +`)))}X.children&&et(X.children)}};return et(Y),{type:"xlsx",metadata:j,content:Y,attachments:A,toText:()=>Y.map(N=>{let X=O=>{let C="";return O.children?C+=O.children.map(X).filter(D=>D!="").join(O.children[0]?.children?t.newlineDelimiter??` +`:""):C+=O.text||"",C};return X(N)}).filter(N=>N!="").join(t.newlineDelimiter??` +`)}};H();var UE=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 Ua(r,N=>!!N.match(e)||!!N.match(i)||!!N.match(s)||!!N.match(o)||!!N.match(l)||!!t.extractAttachments&&!!N.match(n)),u=c.find(N=>N.path==="mimetype"),h="odt";if(u){let N=u.content.toString().trim();N.includes("spreadsheet")?h="ods":N.includes("presentation")?h="odp":N.includes("text")&&(h="odt")}let d=c.find(N=>N.path==="content.xml")||c.find(N=>N.path.match(e)),f=c.find(N=>N.path==="styles.xml"),m=[],y=[],g={},A={},w={};f&&(N=>{let X=Zt(N),O=tt(X,"style:style");for(let C of O){let D=C.getAttribute("style:name");if(!D)continue;let E={},S=ut(C,"style:paragraph-properties");if(S){let B=S.getAttribute("fo:text-align");if(B){let U={start:"left",left:"left",center:"center",end:"right",right:"right",justify:"justify"};U[B]&&(E.alignment=U[B])}ut(S,"style:drop-cap")&&(E.dropCap=!0)}Object.keys(E).length>0&&(A[D]=E);let k=ut(C,"style:text-properties"),M=ut(C,"style:table-cell-properties"),P={};if(M){let B=M.getAttribute("fo:background-color");B&&B!=="transparent"&&(P.backgroundColor=B)}if(k){(k.getAttribute("fo:font-weight")==="bold"||k.getAttribute("style:font-weight-asian")==="bold")&&(P.bold=!0),(k.getAttribute("fo:font-style")==="italic"||k.getAttribute("style:font-style-asian")==="italic")&&(P.italic=!0),k.getAttribute("style:text-underline-style")==="solid"&&(P.underline=!0),k.getAttribute("style:text-line-through-style")==="solid"&&(P.strikethrough=!0);let B=k.getAttribute("fo:font-size")||k.getAttribute("style:font-size-asian");B&&(P.size=B);let $=k.getAttribute("fo:color");$&&(P.color=$);let U=k.getAttribute("fo:background-color");U&&U!=="transparent"&&(P.backgroundColor=U);let V=k.getAttribute("style:font-name")||k.getAttribute("fo:font-family");V&&(P.font=V);let Z=k.getAttribute("style:text-position");Z&&(Z.startsWith("sub")&&(P.subscript=!0),Z.startsWith("super")&&(P.superscript=!0)),Object.keys(P).length>0&&(g[D]=P)}}})(f.content.toString());let T=(N,X,O,C,D,E={},S,k="")=>{let M=[],P="";if(!N.childNodes)return{text:"",children:[]};for(let B=0;B0&&(dt=ot[0].getAttribute("xlink:href")||"",dt)){let ft=dt.split("/");dt=ft[ft.length-1]}let pt={type:"image",text:"",children:[],metadata:{attachmentName:dt,...Q?{altText:Q}:{}}};O.includeRawContent&&(pt.rawContent=Qt(Z,I,O)),M.push(pt)}}}return{text:P,children:M}},k=(_,X,O,C,D)=>{let E=_.getAttribute("text:style-name"),S=E?X[E]:void 0,I=S?.alignment,M=S?.dropCap,P=T(_,O,C,y,X,{},void 0,D);if(E&&P.children.forEach(B=>{if(B.type==="text"){B.metadata||(B.metadata={});let $=B.metadata;$.style||($.style=E)}}),P.children.length===0&&_.textContent){let B=_.textContent;B.trim()&&(P.text=B,P.children.push({type:"text",text:B}))}if(M&&P.children.length>0){let B=P.children[0];if(B.type==="text"&&B.text)if(B.text.length===1)B.formatting={...B.formatting,size:"58.5pt"};else{let $=B.text[0],U=B.text.substring(1),V={type:"text",text:$,formatting:{...B.formatting,size:"58.5pt"},metadata:B.metadata};B.text=U,P.children.unshift(V)}}return{text:P.text,children:P.children,alignment:I,style:E||void 0}},N=(_,X,O,C,D)=>{let E=[],S=He(_,"table:table-row"),I=0;for(let M of S){let P=[],B=He(M,"table:table-cell"),$=parseInt(M.getAttribute("table:number-rows-repeated")||"1"),U=0;for(let V of B){let Z=[],Q={value:""},nt=parseInt(V.getAttribute("table:number-columns-repeated")||"1"),at=parseInt(V.getAttribute("table:number-columns-spanned")||"1"),dt=parseInt(V.getAttribute("table:number-rows-spanned")||"1"),ot=ft=>{if(ft.childNodes)for(let lt=0;lt0&&(dt=at[0].getAttribute("xlink:href")||"",dt)){let ft=dt.split("/");dt=ft[ft.length-1]}let pt={type:"image",text:"",children:[],metadata:{attachmentName:dt,...Q?{altText:Q}:{}}};O.includeRawContent&&(pt.rawContent=Qt(Z,k,O)),M.push(pt)}}}return{text:P,children:M}},I=(N,X,O,C,D)=>{let E=N.getAttribute("text:style-name"),S=E?X[E]:void 0,k=S?.alignment,M=S?.dropCap,P=T(N,O,C,y,X,{},void 0,D);if(E&&P.children.forEach(B=>{if(B.type==="text"){B.metadata||(B.metadata={});let $=B.metadata;$.style||($.style=E)}}),P.children.length===0&&N.textContent){let B=N.textContent;B.trim()&&(P.text=B,P.children.push({type:"text",text:B}))}if(M&&P.children.length>0){let B=P.children[0];if(B.type==="text"&&B.text)if(B.text.length===1)B.formatting={...B.formatting,size:"58.5pt"};else{let $=B.text[0],U=B.text.substring(1),V={type:"text",text:$,formatting:{...B.formatting,size:"58.5pt"},metadata:B.metadata};B.text=U,P.children.unshift(V)}}return{text:P.text,children:P.children,alignment:k,style:E||void 0}},_=(N,X,O,C,D)=>{let E=[],S=He(N,"table:table-row"),k=0;for(let M of S){let P=[],B=He(M,"table:table-cell"),$=parseInt(M.getAttribute("table:number-rows-repeated")||"1"),U=0;for(let V of B){let Z=[],Q={value:""},nt=parseInt(V.getAttribute("table:number-columns-repeated")||"1"),ot=parseInt(V.getAttribute("table:number-columns-spanned")||"1"),dt=parseInt(V.getAttribute("table:number-rows-spanned")||"1"),at=ft=>{if(ft.childNodes)for(let lt=0;lt0?ft===0?Z:JSON.parse(JSON.stringify(Z)):[],metadata:{row:I,col:U}},ct=lt.metadata;at>1&&(ct.colSpan=at),dt>1&&(ct.rowSpan=dt),C.includeRawContent&&(lt.rawContent=Qt(V,D,C)),P.push(lt),U++}}for(let V=0;V<$;V++){let Z={type:"row",children:V===0?P:JSON.parse(JSON.stringify(P))};V>0&&Z.children?.forEach(Q=>{Q.metadata&&"row"in Q.metadata&&(Q.metadata.row=I)}),C.includeRawContent&&(Z.rawContent=Qt(M,D,C)),E.push(Z),I++}}return{type:"table",children:E}};d&&(_=>{let X=Zt(_,{locator:t.includeRawContent}),O=ut(X,"office:body");if(!O)return;let C=ut(X,"office:automatic-styles");if(C){let S=J(C,"style:style");for(let I of S){let M=I.getAttribute("style:name");if(!M)continue;let P=ut(I,"style:paragraph-properties"),B={};if(P){let U=P.getAttribute("fo:text-align");if(U){let Z={start:"left",left:"left",center:"center",end:"right",right:"right",justify:"justify"};Z[U]&&(B.alignment=Z[U])}ut(P,"style:drop-cap")&&(B.dropCap=!0)}Object.keys(B).length>0&&(A[M]=B);let $=ut(I,"style:text-properties");if($){let U={};($.getAttribute("fo:font-weight")==="bold"||$.getAttribute("style:font-weight-asian")==="bold")&&(U.bold=!0),($.getAttribute("fo:font-style")==="italic"||$.getAttribute("style:font-style-asian")==="italic")&&(U.italic=!0),$.getAttribute("style:text-underline-style")==="solid"&&(U.underline=!0),$.getAttribute("style:text-line-through-style")==="solid"&&(U.strikethrough=!0);let V=$.getAttribute("fo:font-size")||$.getAttribute("style:font-size-asian");V&&(U.size=V);let Z=$.getAttribute("fo:color");Z&&(U.color=Z);let Q=$.getAttribute("fo:background-color");Q&&Q!=="transparent"&&(U.backgroundColor=Q);let nt=$.getAttribute("style:font-name")||$.getAttribute("fo:font-family");nt&&(U.font=nt);let at=$.getAttribute("style:text-position");at&&(at.startsWith("sub")&&(U.subscript=!0),at.startsWith("super")&&(U.superscript=!0)),Object.keys(U).length>0&&(g[M]=U)}}}let D=ut(X,"office:body");if(D){let S=He(D,"office:text")[0]||He(D,"office:presentation")[0]||He(D,"office:spreadsheet")[0];if(S){let I=He(S,"*");for(let M of I)E(M,m,!1,_)}}function E(S,I,M=!1,P){if(S.tagName==="text:p"){let B=k(S,A,g,t,P),$=M||(S.getAttribute("text:style-name")||"").toLowerCase().includes("title")?"heading":"paragraph",U={type:$,text:B.text,children:B.children,metadata:{...B.alignment?{alignment:B.alignment}:{},...B.style?{style:B.style}:{}}};$==="heading"&&U.metadata&&(U.metadata.level=U.metadata.level||1),Object.keys(U.metadata||{}).length===0&&delete U.metadata,t.includeRawContent&&(U.rawContent=Qt(S,P,t)),I.push(U)}else if(S.tagName==="text:h"){let B=parseInt(S.getAttribute("text:outline-level")||"1"),$=k(S,A,g,t,P),U={type:"heading",text:$.text,children:$.children,metadata:{level:B,...$.alignment?{alignment:$.alignment}:{},...$.style?{style:$.style}:{}}};t.includeRawContent&&(U.rawContent=Qt(S,P,t)),I.push(U)}else if(S.tagName==="table:table"){let B=N(S,A,g,t,P);t.includeRawContent&&(B.rawContent=Qt(S,P,t)),I.push(B)}else if(S.tagName==="text:list"){let B=He(S,"text:list-item"),$=S.getAttribute("text:style-name")||S.getAttribute("xml:id"),U=$||`list-${I.length}`,V="unordered",Z=!1,Q=$;if(!Q){let ot=S.parentNode;for(;ot&&!Q&&!(ot.nodeName==="text:list"&&(Q=ot.getAttribute("text:style-name"),Q));)ot=ot.parentNode}if(Q){let ot=ut(Zt(d?.content.toString()||""),"office:automatic-styles");if(ot){let pt=J(ot,"text:list-style");for(let ft of pt)if(ft.getAttribute("style:name")===Q){let lt=J(ft,"text:list-level-style-bullet"),ct=J(ft,"text:list-level-style-number"),rt=J(ft,"text:list-level-style-image");ct.length>0?(V="ordered",Z=ct.some(gt=>!!gt.getAttribute("style:num-format"))):lt.length>0&&(V="unordered",Z=lt.some(gt=>!!gt.getAttribute("text:bullet-char"))),rt.length>0&&(Z=!0);break}}if(f&&!Z){let pt=Zt(f.content.toString()),ft=J(pt,"text:list-style");for(let lt of ft)if(lt.getAttribute("style:name")===Q){let ct=J(lt,"text:list-level-style-bullet"),rt=J(lt,"text:list-level-style-number"),gt=J(lt,"text:list-level-style-image");rt.length>0?(V="ordered",Z=rt.some(bt=>!!bt.getAttribute("style:num-format"))):ct.length>0&&(V="unordered",Z=ct.some(bt=>!!bt.getAttribute("text:bullet-char"))),gt.length>0&&(Z=!0);break}}}if(!Z){for(let ot=0;otpt.path===dt||pt.path.endsWith(dt));if(ot){let pt=Xo(ot.content),ft={type:"chart",text:pt.rawTexts.join(" "),metadata:{attachmentName:at,chartData:pt}};t.includeRawContent&&(ft.rawContent=Qt(S,P,t)),I.push(ft)}else{let pt={type:"chart",text:"",metadata:{attachmentName:at}};t.includeRawContent&&(pt.rawContent=Qt(S,P,t)),I.push(pt)}}}}else if(S.childNodes)for(let B=0;B0)for(let Dt of Bt){let Gt=Dt.getAttribute("text:style-name"),bi=Gt?g[Gt]:{},R=Dt.textContent||"";rt+=R;let W={type:"text",text:R,formatting:bi};gt.push(W)}else{let Dt=At.textContent||"";if(rt+=Dt,Dt.trim()){let Gt={type:"text",text:Dt,formatting:{}};gt.push(Gt)}}Yt0){let Ct=bi[0].getAttribute("xlink:href");if(Ct){let vt=Ct.split("/");Gt=vt[vt.length-1]}}let R="",W=J(Yt,"draw:object");if(W.length>0){let Ct=W[0].getAttribute("xlink:href");Ct&&(R=Ct.split("/")[0])}if(bi.length>0){let Ct={type:"image",text:"",children:[],metadata:{attachmentName:Gt,...At?{altText:At}:{}}};t.includeRawContent&&(Ct.rawContent=Qt(Yt,_,t)),gt.push(Ct)}else if(R){let Ct={type:"chart",text:"",children:[],metadata:{attachmentName:R}};gt.push(Ct)}}for(let Yt=0;Yt0||h!=="ods"){let At={type:"cell",text:rt,children:gt,metadata:{row:V,col:ot}};t.includeRawContent&&(At.rawContent=Qt(lt,_,t)),at.push(At)}ot++}}if(at.length>0)for(let ft=0;ft0&<.children?.forEach(ct=>{ct.metadata&&"row"in ct.metadata&&(ct.metadata.row=V)}),t.includeRawContent&&(lt.rawContent=Qt(nt,_,t)),$.push(lt),V++}else V+=pt}let Z={type:"sheet",children:$,metadata:{sheetName:B}};t.includeRawContent&&(Z.rawContent=Qt(P,_,t)),m.push(Z)}}}else if(h==="odp"){let S=ut(O,"office:presentation");if(S){let I=He(S,"draw:page"),M=[];for(let P=0;P0&&(t.putNotesAtLast?M.push(U):m.push(U))}M.length>0&&m.push(...M)}}else{let S=ut(O,"office:text");S&&E(S,m,!1,_)}})(d.content.toString());let L=[],Y=c.filter(_=>_.path.match(/(Pictures|media)\/.*/));if(t.extractAttachments){let _=c.filter(X=>X.path.match(/Object \d+\/content\.xml/));for(let X of _){let O=Zt(X.content.toString());if(J(O,"chart:chart").length>0){let D=X.path.split("/")[0],E={type:"chart",mimeType:"application/vnd.oasis.opendocument.chart",data:X.content.toString("base64"),name:D,extension:"xml"},S=Xo(X.content);S.rawTexts.length>0&&(E.chartData=S),L.push(E)}}}if(t.extractAttachments)for(let _ of Y){let X=gr(_.path.split("/").pop()||"image",_.content);if(L.push(X),t.ocr&&X.mimeType.startsWith("image/"))try{X.ocrText=(await Xn(_.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(O){rn(`OCR failed for ${X.name}:`,t,O)}}let q=c.find(_=>_.path.match(s)),G=q?La(q.content.toString()):{},j=(_,X)=>{let O=D=>{let E=D.replace(/^\[|\]$/g,""),[S,I]=E.split(":"),M=S.lastIndexOf(".");if(M===-1)return[D];let P=S.substring(0,M).replace(/^'|'$/g,""),B=S.substring(M+1).replace(/\$/g,""),$=B;if(I)if(I.startsWith("."))$=I.substring(1).replace(/\$/g,"");else{let at=I.lastIndexOf(".");$=I.substring(at+1).replace(/\$/g,"")}let U=at=>{let dt=at.match(/[A-Z]+/),ot=at.match(/\d+/);if(!dt||!ot)return null;let pt=dt[0],ft=0;for(let ct=0;ctat.type==="sheet"&&at.metadata?.sheetName===P);if(!Q||!Q.children)return[D];let nt=[];for(let at of Q.children)if(at.children)for(let dt of at.children){let ot=dt.metadata;ot&&ot.row>=V.r&&ot.row<=Z.r&&ot.col>=V.c&&ot.col<=Z.c&&nt.push(dt.text||"")}return nt.length>0?nt:[]};for(let D of _.dataSets){let E=[];for(let S of D.values)S.startsWith("[")?E.push(...O(S)):E.push(S);D.values=E}let C=[];for(let D of _.labels)D.startsWith("[")?C.push(...O(D)):C.push(D);_.labels=C,_.rawTexts=[],_.title&&_.rawTexts.push(_.title);for(let D of _.dataSets)D.name&&_.rawTexts.push(D.name),_.rawTexts.push(..._.labels),_.rawTexts.push(...D.values)};for(let _ of L)_.type==="chart"&&_.chartData&&j(_.chartData,m);(_=>{let X=new Set,O=S=>{for(let I of S){if(I.metadata&&"attachmentName"in I.metadata){let M=I.metadata.attachmentName;M&&X.add(M)}I.children&&O(I.children)}};O(_);let C=L.filter(S=>S.type==="image"&&S.name&&!X.has(S.name)),D=0,E=S=>{if((S.type==="image"||S.type==="chart")&&S.metadata&&"attachmentName"in S.metadata){let I=S.metadata.attachmentName;if(!I&&S.type==="image"&&DP.name===I);M&&(M.ocrText&&(S.text=M.ocrText),M.chartData&&S.type==="chart"&&(S.text=M.chartData.rawTexts.join(t.newlineDelimiter??` -`)))}}S.children&&S.children.forEach(E)};_.forEach(E)})(m);let et={};for(let _ in g)et[_]={formatting:g[_],alignment:A[_]?.alignment};for(let _ in A)et[_]||(et[_]={formatting:{},alignment:A[_]?.alignment});return t.putNotesAtLast&&y.length>0&&m.push(...y),{type:h,metadata:{...G,styleMap:et},content:m,attachments:L,toText:()=>m.map(_=>{let X=O=>{let C="";if(O.children&&O.children.length>0){let E=O.children.some(S=>S.children&&S.children.length>0)?t.newlineDelimiter??` -`:"";C+=O.children.map(X).filter(S=>S!="").join(E)}else C+=O.text||"";return C};return X(_)}).filter(_=>_!="").join(t.newlineDelimiter??` -`)}};H();H();async function Hw(r){return new Function("s","return import(s)")(r)}async function RS(){return Wc?Promise.resolve().then(()=>(Z1(),K1)):Hw("file-type")}async function LS(){if(!Wc){gA();try{return await Hw("pdfjs-dist/legacy/build/pdf.mjs")}catch{return await Hw("pdfjs-dist")}}return Promise.resolve().then(()=>(OS(),PS))}function SM(r){return r&&typeof r.str=="string"&&Array.isArray(r.transform)&&r.transform.length>=6}function DM(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 IM(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 kM(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),y=Math.max(c,h);if(ed&&nm)return o}}function _M(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=st.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{let e=await LS();if(t.pdfWorkerSrc)e.GlobalWorkerOptions.workerSrc=t.pdfWorkerSrc;else if(Wc)e.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${e.version}/build/pdf.worker.min.mjs`;else{Km("pdf-worker-auto-resolution");try{let g=Vm.resolve("pdfjs-dist/legacy/build/pdf.worker.mjs");e.GlobalWorkerOptions.workerSrc=g}catch(g){t.outputErrorToConsole&&console.warn("[PdfParser] Could not auto-resolve local worker path:",g)}}let i=new Uint8Array(r),n=e.getDocument({data:i,verbosity:0}),s;try{s=await n.promise}catch(g){let A=g instanceof Error?g.message:String(g);throw A.includes("workerSrc")||A.includes('No "GlobalWorkerOptions.workerSrc" specified')?Ms("PDF_WORKER_MISSING",t):g}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:Wr(d?.CreationDate),modified:Wr(d?.ModDate)},m=new Set(["Title","Author","Subject","Keywords","Creator","Producer","CreationDate","ModDate","Trapped","IsAcroFormPresent","IsXFAPresent","IsCollectionPresent","IsSignaturesPresent","PDFFormatVersion"]);if(d){let g={};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,T]of Object.entries(w))T!=null&&(typeof T=="string"||typeof T=="number"||typeof T=="boolean"||T instanceof Date)&&(g[v]=T);continue}(typeof w=="string"||typeof w=="number"||typeof w=="boolean"||w instanceof Date)&&(g[A]=w)}}Object.keys(g).length>0&&(f.customProperties=g)}try{let g=await s.getAttachments();if(g&&t.extractAttachments)for(let A in g){let w=g[A],v=st.Buffer.from(w.content),T=gr(w.filename,v);l.push(T)}}catch(g){t.outputErrorToConsole&&console.error("Error extracting embedded attachments:",g)}for(let g=1;g<=c;g++){let A,w,v=[];try{A=await s.getPage(g),w=await A.getTextContent()}catch(k){t.outputErrorToConsole&&console.warn(`[PdfParser] Error loading page ${g}:`,k),u.push(v);continue}let T=A.commonObjs;for(let k of w.items){if(!SM(k))continue;let N=k,F=N.transform,L=F[4],Y=F[5],q=N.width||0,G=N.height||Math.abs(F[3])||12,j={},tt;if(N.fontName&&T)try{if(T.has(N.fontName)){let et=await new Promise(_=>{T.get(N.fontName,X=>_(X))});if(et?.name&&typeof et.name=="string"){tt=et.name.replace(/^[A-Z]{6}\+/,""),j.font=tt;let _=et.name.toLowerCase();_.includes("bold")&&(j.bold=!0),(_.includes("italic")||_.includes("oblique"))&&(j.italic=!0)}}}catch{}G>0&&(j.size=Math.round(G).toString()),v.push({type:"text",x:L,y:Y,width:q,height:G,text:N.str,fontName:tt,formatting:j})}if(t.extractAttachments||t.ocr)try{let k=await A.getOperatorList(),N=k.fnArray,F=k.argsArray;for(let L=0;L{let tt=setTimeout(()=>{j()},500);A.objs.get(G,et=>{clearTimeout(tt),j()})})}catch(j){t.outputErrorToConsole&&console.error(`[PdfParser] Failed to load dependency ${G}:`,j)}}if(Y===e.OPS.paintImageXObject||Y===e.OPS.paintXObject){let q=F[L][0];try{let G=A.objs.has(q),j=A.objs;if(!G&&A.commonObjs.has(q)&&(G=!0,j=A.commonObjs),G){let tt=await new Promise(et=>{j.get(q,_=>et(_))});if(typeof window<"u"&&!tt.data&&tt.bitmap)try{let et=document.createElement("canvas");et.width=tt.width,et.height=tt.height;let _=et.getContext("2d");_&&(_.drawImage(tt.bitmap,0,0),tt.data=_.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,_=0;for(let X=L-1;X>=0;X--)if(N[X]===e.OPS.transform){et=F[X][4],_=F[X][5];break}v.push({type:"image",x:et,y:_,name:q,data:tt.data,width:tt.width,height:tt.height,kind:tt.kind})}}}catch{}}}}catch(k){t.outputErrorToConsole&&console.error(`Error extracting images from page ${g}:`,k)}u.push(v)}let y=DM(u);for(let g=0;gMath.abs(j.y-G.y)>7?j.y-G.y:G.x-j.x);let F=null,L=0,Y=-1,q=0;for(let G of v)if(G.type==="text"){let j=G.text;if(!j)continue;if(Y!==-1&&Math.abs(G.y-Y)>5&&F&&((F.text||"").trim().length>0&&T.push(F),F=null),!F&&j.trim().length===0){Y=G.y;continue}let et=IM(G.height,y);if(F||(et>0?F={type:"heading",text:"",children:[],metadata:{level:et}}:F={type:"paragraph",text:"",children:[]},L=G.height),j.trim().length===0){if(F.children&&F.children.length>0){let C=F.children[F.children.length-1];C.type==="text"&&C.text&&(C.text+=j,F.text+=j)}Y=G.y;continue}if(F.text&&F.text.length>0&&!F.text.endsWith(" ")&&(F.text+=" ",F.children&&F.children.length>0)){let C=F.children[F.children.length-1];C.type==="text"&&C.text&&(C.text+=" ")}F.text+=j;let _=kM(G,k);_&&N.add(_);let X;_&&(_.url?X={link:_.url,linkType:_.url.startsWith("#")?"internal":"external"}:_.dest&&(X={link:typeof _.dest=="string"?`#${_.dest}`:"#internal",linkType:"internal"}));let O=!1;if(F.children&&F.children.length>0&&!X){let C=F.children[F.children.length-1];C.type==="text"&&MM(C.formatting,G.formatting)&&!C.metadata&&(C.text=(C.text||"")+j,O=!0)}if(!O){let C={type:"text",text:j,formatting:Object.keys(G.formatting).length>0?G.formatting:void 0};X&&(C.metadata=X),F.children?.push(C)}Y=G.y}else if(G.type==="image"){F&&((F.text||"").trim().length>0&&T.push(F),F=null),q++;let j=`pdf_image_p${A}_${q}.bmp`;if(t.extractAttachments)try{let tt=NM(G.data,G.width,G.height,G.kind),et=_M(G.width,G.height,new Uint8Array(tt)),_=gr(j,et);if(_.mimeType="image/bmp",t.ocr)try{G.width>=10&&G.height>=10&&(_.ocrText=(await Xn(et,{language:t.ocrLanguage,...t.ocrConfig})).trim())}catch(O){t.outputErrorToConsole&&console.error(`OCR failed for ${j}:`,O)}l.push(_);let X={attachmentName:j};T.push({type:"image",text:_.ocrText||"",metadata:{...X}})}catch(tt){rn(`Failed to process image ${j}:`,t,tt)}}F&&(F.text||"").trim().length>0&&T.push(F),o.push({type:"page",children:T,text:T.map(G=>G.text).join(t.newlineDelimiter??` +`)}else if(rt.tagName==="table:table"){let gt=_(rt,X,O,C,D);Z.push(gt)}else(rt.tagName==="draw:frame"||rt.tagName==="draw:text-box")&&at(rt)}}};at(V);let pt=Q.value;pt.endsWith(` +`)&&(pt=pt.slice(0,-1));for(let ft=0;ft0?ft===0?Z:JSON.parse(JSON.stringify(Z)):[],metadata:{row:k,col:U}},ct=lt.metadata;ot>1&&(ct.colSpan=ot),dt>1&&(ct.rowSpan=dt),C.includeRawContent&&(lt.rawContent=Qt(V,D,C)),P.push(lt),U++}}for(let V=0;V<$;V++){let Z={type:"row",children:V===0?P:JSON.parse(JSON.stringify(P))};V>0&&Z.children?.forEach(Q=>{Q.metadata&&"row"in Q.metadata&&(Q.metadata.row=k)}),C.includeRawContent&&(Z.rawContent=Qt(M,D,C)),E.push(Z),k++}}return{type:"table",children:E}};d&&(N=>{let X=Zt(N,{locator:t.includeRawContent}),O=ut(X,"office:body");if(!O)return;let C=ut(X,"office:automatic-styles");if(C){let S=tt(C,"style:style");for(let k of S){let M=k.getAttribute("style:name");if(!M)continue;let P=ut(k,"style:paragraph-properties"),B={};if(P){let U=P.getAttribute("fo:text-align");if(U){let Z={start:"left",left:"left",center:"center",end:"right",right:"right",justify:"justify"};Z[U]&&(B.alignment=Z[U])}ut(P,"style:drop-cap")&&(B.dropCap=!0)}Object.keys(B).length>0&&(A[M]=B);let $=ut(k,"style:text-properties");if($){let U={};($.getAttribute("fo:font-weight")==="bold"||$.getAttribute("style:font-weight-asian")==="bold")&&(U.bold=!0),($.getAttribute("fo:font-style")==="italic"||$.getAttribute("style:font-style-asian")==="italic")&&(U.italic=!0),$.getAttribute("style:text-underline-style")==="solid"&&(U.underline=!0),$.getAttribute("style:text-line-through-style")==="solid"&&(U.strikethrough=!0);let V=$.getAttribute("fo:font-size")||$.getAttribute("style:font-size-asian");V&&(U.size=V);let Z=$.getAttribute("fo:color");Z&&(U.color=Z);let Q=$.getAttribute("fo:background-color");Q&&Q!=="transparent"&&(U.backgroundColor=Q);let nt=$.getAttribute("style:font-name")||$.getAttribute("fo:font-family");nt&&(U.font=nt);let ot=$.getAttribute("style:text-position");ot&&(ot.startsWith("sub")&&(U.subscript=!0),ot.startsWith("super")&&(U.superscript=!0)),Object.keys(U).length>0&&(g[M]=U)}}}let D=ut(X,"office:body");if(D){let S=He(D,"office:text")[0]||He(D,"office:presentation")[0]||He(D,"office:spreadsheet")[0];if(S){let k=He(S,"*");for(let M of k)E(M,m,!1,N)}}function E(S,k,M=!1,P){if(S.tagName==="text:p"){let B=I(S,A,g,t,P),$=M||(S.getAttribute("text:style-name")||"").toLowerCase().includes("title")?"heading":"paragraph",U={type:$,text:B.text,children:B.children,metadata:{...B.alignment?{alignment:B.alignment}:{},...B.style?{style:B.style}:{}}};$==="heading"&&U.metadata&&(U.metadata.level=U.metadata.level||1),Object.keys(U.metadata||{}).length===0&&delete U.metadata,t.includeRawContent&&(U.rawContent=Qt(S,P,t)),k.push(U)}else if(S.tagName==="text:h"){let B=parseInt(S.getAttribute("text:outline-level")||"1"),$=I(S,A,g,t,P),U={type:"heading",text:$.text,children:$.children,metadata:{level:B,...$.alignment?{alignment:$.alignment}:{},...$.style?{style:$.style}:{}}};t.includeRawContent&&(U.rawContent=Qt(S,P,t)),k.push(U)}else if(S.tagName==="table:table"){let B=_(S,A,g,t,P);t.includeRawContent&&(B.rawContent=Qt(S,P,t)),k.push(B)}else if(S.tagName==="text:list"){let B=He(S,"text:list-item"),$=S.getAttribute("text:style-name")||S.getAttribute("xml:id"),U=$||`list-${k.length}`,V="unordered",Z=!1,Q=$;if(!Q){let at=S.parentNode;for(;at&&!Q&&!(at.nodeName==="text:list"&&(Q=at.getAttribute("text:style-name"),Q));)at=at.parentNode}if(Q){let at=ut(Zt(d?.content.toString()||""),"office:automatic-styles");if(at){let pt=tt(at,"text:list-style");for(let ft of pt)if(ft.getAttribute("style:name")===Q){let lt=tt(ft,"text:list-level-style-bullet"),ct=tt(ft,"text:list-level-style-number"),rt=tt(ft,"text:list-level-style-image");ct.length>0?(V="ordered",Z=ct.some(gt=>!!gt.getAttribute("style:num-format"))):lt.length>0&&(V="unordered",Z=lt.some(gt=>!!gt.getAttribute("text:bullet-char"))),rt.length>0&&(Z=!0);break}}if(f&&!Z){let pt=Zt(f.content.toString()),ft=tt(pt,"text:list-style");for(let lt of ft)if(lt.getAttribute("style:name")===Q){let ct=tt(lt,"text:list-level-style-bullet"),rt=tt(lt,"text:list-level-style-number"),gt=tt(lt,"text:list-level-style-image");rt.length>0?(V="ordered",Z=rt.some(wt=>!!wt.getAttribute("style:num-format"))):ct.length>0&&(V="unordered",Z=ct.some(wt=>!!wt.getAttribute("text:bullet-char"))),gt.length>0&&(Z=!0);break}}}if(!Z){for(let at=0;atpt.path===dt||pt.path.endsWith(dt));if(at){let pt=Xo(at.content),ft={type:"chart",text:pt.rawTexts.join(" "),metadata:{attachmentName:ot,chartData:pt}};t.includeRawContent&&(ft.rawContent=Qt(S,P,t)),k.push(ft)}else{let pt={type:"chart",text:"",metadata:{attachmentName:ot}};t.includeRawContent&&(pt.rawContent=Qt(S,P,t)),k.push(pt)}}}}else if(S.childNodes)for(let B=0;B0)for(let kt of Nt){let Yt=kt.getAttribute("text:style-name"),ti=Yt?g[Yt]:{},R=kt.textContent||"";rt+=R;let W={type:"text",text:R,formatting:ti};gt.push(W)}else{let kt=At.textContent||"";if(rt+=kt,kt.trim()){let Yt={type:"text",text:kt,formatting:{}};gt.push(Yt)}}Tt0){let Ct=ti[0].getAttribute("xlink:href");if(Ct){let bt=Ct.split("/");Yt=bt[bt.length-1]}}let R="",W=tt(Tt,"draw:object");if(W.length>0){let Ct=W[0].getAttribute("xlink:href");Ct&&(R=Ct.split("/")[0])}if(ti.length>0){let Ct={type:"image",text:"",children:[],metadata:{attachmentName:Yt,...At?{altText:At}:{}}};t.includeRawContent&&(Ct.rawContent=Qt(Tt,N,t)),gt.push(Ct)}else if(R){let Ct={type:"chart",text:"",children:[],metadata:{attachmentName:R}};gt.push(Ct)}}for(let Tt=0;Tt0||h!=="ods"){let At={type:"cell",text:rt,children:gt,metadata:{row:V,col:at}};t.includeRawContent&&(At.rawContent=Qt(lt,N,t)),ot.push(At)}at++}}if(ot.length>0)for(let ft=0;ft0&<.children?.forEach(ct=>{ct.metadata&&"row"in ct.metadata&&(ct.metadata.row=V)}),t.includeRawContent&&(lt.rawContent=Qt(nt,N,t)),$.push(lt),V++}else V+=pt}let Z={type:"sheet",children:$,metadata:{sheetName:B}};t.includeRawContent&&(Z.rawContent=Qt(P,N,t)),m.push(Z)}}}else if(h==="odp"){let S=ut(O,"office:presentation");if(S){let k=He(S,"draw:page"),M=[];for(let P=0;P0&&(t.putNotesAtLast?M.push(U):m.push(U))}M.length>0&&m.push(...M)}}else{let S=ut(O,"office:text");S&&E(S,m,!1,N)}})(d.content.toString());let L=[],Y=c.filter(N=>N.path.match(/(Pictures|media)\/.*/));if(t.extractAttachments){let N=c.filter(X=>X.path.match(/Object \d+\/content\.xml/));for(let X of N){let O=Zt(X.content.toString());if(tt(O,"chart:chart").length>0){let D=X.path.split("/")[0],E={type:"chart",mimeType:"application/vnd.oasis.opendocument.chart",data:X.content.toString("base64"),name:D,extension:"xml"},S=Xo(X.content);S.rawTexts.length>0&&(E.chartData=S),L.push(E)}}}if(t.extractAttachments)for(let N of Y){let X=gr(N.path.split("/").pop()||"image",N.content);if(L.push(X),t.ocr&&X.mimeType.startsWith("image/"))try{X.ocrText=(await Xn(N.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(O){rn(`OCR failed for ${X.name}:`,t,O)}}let q=c.find(N=>N.path.match(s)),G=q?La(q.content.toString()):{},j=(N,X)=>{let O=D=>{let E=D.replace(/^\[|\]$/g,""),[S,k]=E.split(":"),M=S.lastIndexOf(".");if(M===-1)return[D];let P=S.substring(0,M).replace(/^'|'$/g,""),B=S.substring(M+1).replace(/\$/g,""),$=B;if(k)if(k.startsWith("."))$=k.substring(1).replace(/\$/g,"");else{let ot=k.lastIndexOf(".");$=k.substring(ot+1).replace(/\$/g,"")}let U=ot=>{let dt=ot.match(/[A-Z]+/),at=ot.match(/\d+/);if(!dt||!at)return null;let pt=dt[0],ft=0;for(let ct=0;ctot.type==="sheet"&&ot.metadata?.sheetName===P);if(!Q||!Q.children)return[D];let nt=[];for(let ot of Q.children)if(ot.children)for(let dt of ot.children){let at=dt.metadata;at&&at.row>=V.r&&at.row<=Z.r&&at.col>=V.c&&at.col<=Z.c&&nt.push(dt.text||"")}return nt.length>0?nt:[]};for(let D of N.dataSets){let E=[];for(let S of D.values)S.startsWith("[")?E.push(...O(S)):E.push(S);D.values=E}let C=[];for(let D of N.labels)D.startsWith("[")?C.push(...O(D)):C.push(D);N.labels=C,N.rawTexts=[],N.title&&N.rawTexts.push(N.title);for(let D of N.dataSets)D.name&&N.rawTexts.push(D.name),N.rawTexts.push(...N.labels),N.rawTexts.push(...D.values)};for(let N of L)N.type==="chart"&&N.chartData&&j(N.chartData,m);(N=>{let X=new Set,O=S=>{for(let k of S){if(k.metadata&&"attachmentName"in k.metadata){let M=k.metadata.attachmentName;M&&X.add(M)}k.children&&O(k.children)}};O(N);let C=L.filter(S=>S.type==="image"&&S.name&&!X.has(S.name)),D=0,E=S=>{if((S.type==="image"||S.type==="chart")&&S.metadata&&"attachmentName"in S.metadata){let k=S.metadata.attachmentName;if(!k&&S.type==="image"&&DP.name===k);M&&(M.ocrText&&(S.text=M.ocrText),M.chartData&&S.type==="chart"&&(S.text=M.chartData.rawTexts.join(t.newlineDelimiter??` +`)))}}S.children&&S.children.forEach(E)};N.forEach(E)})(m);let et={};for(let N in g)et[N]={formatting:g[N],alignment:A[N]?.alignment};for(let N in A)et[N]||(et[N]={formatting:{},alignment:A[N]?.alignment});return t.putNotesAtLast&&y.length>0&&m.push(...y),{type:h,metadata:{...G,styleMap:et},content:m,attachments:L,toText:()=>m.map(N=>{let X=O=>{let C="";if(O.children&&O.children.length>0){let E=O.children.some(S=>S.children&&S.children.length>0)?t.newlineDelimiter??` +`:"";C+=O.children.map(X).filter(S=>S!="").join(E)}else C+=O.text||"";return C};return X(N)}).filter(N=>N!="").join(t.newlineDelimiter??` +`)}};H();H();async function Hw(r){return new Function("s","return import(s)")(r)}async function RS(){return Wc?Promise.resolve().then(()=>(Z1(),K1)):Hw("file-type")}async function LS(){if(!Wc){gA();try{return await Hw("pdfjs-dist/legacy/build/pdf.mjs")}catch{return await Hw("pdfjs-dist")}}return Promise.resolve().then(()=>(OS(),PS))}function SM(r){return r&&typeof r.str=="string"&&Array.isArray(r.transform)&&r.transform.length>=6}function DM(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 kM(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 IM(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),y=Math.max(c,h);if(ed&&nm)return o}}function NM(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=st.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{let e=await LS();if(t.pdfWorkerSrc)e.GlobalWorkerOptions.workerSrc=t.pdfWorkerSrc;else if(Wc)e.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${e.version}/build/pdf.worker.min.mjs`;else{Km("pdf-worker-auto-resolution");try{let g=Vm.resolve("pdfjs-dist/legacy/build/pdf.worker.mjs");e.GlobalWorkerOptions.workerSrc=g}catch(g){t.outputErrorToConsole&&console.warn("[PdfParser] Could not auto-resolve local worker path:",g)}}let i=new Uint8Array(r),n=e.getDocument({data:i,verbosity:0}),s;try{s=await n.promise}catch(g){let A=g instanceof Error?g.message:String(g);throw A.includes("workerSrc")||A.includes('No "GlobalWorkerOptions.workerSrc" specified')?Ms("PDF_WORKER_MISSING",t):g}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:Wr(d?.CreationDate),modified:Wr(d?.ModDate)},m=new Set(["Title","Author","Subject","Keywords","Creator","Producer","CreationDate","ModDate","Trapped","IsAcroFormPresent","IsXFAPresent","IsCollectionPresent","IsSignaturesPresent","PDFFormatVersion"]);if(d){let g={};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,T]of Object.entries(w))T!=null&&(typeof T=="string"||typeof T=="number"||typeof T=="boolean"||T instanceof Date)&&(g[v]=T);continue}(typeof w=="string"||typeof w=="number"||typeof w=="boolean"||w instanceof Date)&&(g[A]=w)}}Object.keys(g).length>0&&(f.customProperties=g)}try{let g=await s.getAttachments();if(g&&t.extractAttachments)for(let A in g){let w=g[A],v=st.Buffer.from(w.content),T=gr(w.filename,v);l.push(T)}}catch(g){t.outputErrorToConsole&&console.error("Error extracting embedded attachments:",g)}for(let g=1;g<=c;g++){let A,w,v=[];try{A=await s.getPage(g),w=await A.getTextContent()}catch(I){t.outputErrorToConsole&&console.warn(`[PdfParser] Error loading page ${g}:`,I),u.push(v);continue}let T=A.commonObjs;for(let I of w.items){if(!SM(I))continue;let _=I,F=_.transform,L=F[4],Y=F[5],q=_.width||0,G=_.height||Math.abs(F[3])||12,j={},J;if(_.fontName&&T)try{if(T.has(_.fontName)){let et=await new Promise(N=>{T.get(_.fontName,X=>N(X))});if(et?.name&&typeof et.name=="string"){J=et.name.replace(/^[A-Z]{6}\+/,""),j.font=J;let N=et.name.toLowerCase();N.includes("bold")&&(j.bold=!0),(N.includes("italic")||N.includes("oblique"))&&(j.italic=!0)}}}catch{}G>0&&(j.size=Math.round(G).toString()),v.push({type:"text",x:L,y:Y,width:q,height:G,text:_.str,fontName:J,formatting:j})}if(t.extractAttachments||t.ocr)try{let I=await A.getOperatorList(),_=I.fnArray,F=I.argsArray;for(let L=0;L<_.length;L++){let Y=_[L];if(Y===e.OPS.dependency){let q=F[L];for(let G of q)try{if(A.objs.has(G))continue;await new Promise(j=>{let J=setTimeout(()=>{j()},500);A.objs.get(G,et=>{clearTimeout(J),j()})})}catch(j){t.outputErrorToConsole&&console.error(`[PdfParser] Failed to load dependency ${G}:`,j)}}if(Y===e.OPS.paintImageXObject||Y===e.OPS.paintXObject){let q=F[L][0];try{let G=A.objs.has(q),j=A.objs;if(!G&&A.commonObjs.has(q)&&(G=!0,j=A.commonObjs),G){let J=await new Promise(et=>{j.get(q,N=>et(N))});if(typeof window<"u"&&!J.data&&J.bitmap)try{let et=document.createElement("canvas");et.width=J.width,et.height=J.height;let N=et.getContext("2d");N&&(N.drawImage(J.bitmap,0,0),J.data=N.getImageData(0,0,J.width,J.height).data,J.kind=3)}catch(et){t.outputErrorToConsole&&console.error("[PdfParser] Failed to extract from ImageBitmap:",et)}if(J?.data&&J.width>0&&J.height>0){let et=0,N=0;for(let X=L-1;X>=0;X--)if(_[X]===e.OPS.transform){et=F[X][4],N=F[X][5];break}v.push({type:"image",x:et,y:N,name:q,data:J.data,width:J.width,height:J.height,kind:J.kind})}}}catch{}}}}catch(I){t.outputErrorToConsole&&console.error(`Error extracting images from page ${g}:`,I)}u.push(v)}let y=DM(u);for(let g=0;gMath.abs(j.y-G.y)>7?j.y-G.y:G.x-j.x);let F=null,L=0,Y=-1,q=0;for(let G of v)if(G.type==="text"){let j=G.text;if(!j)continue;if(Y!==-1&&Math.abs(G.y-Y)>5&&F&&((F.text||"").trim().length>0&&T.push(F),F=null),!F&&j.trim().length===0){Y=G.y;continue}let et=kM(G.height,y);if(F||(et>0?F={type:"heading",text:"",children:[],metadata:{level:et}}:F={type:"paragraph",text:"",children:[]},L=G.height),j.trim().length===0){if(F.children&&F.children.length>0){let C=F.children[F.children.length-1];C.type==="text"&&C.text&&(C.text+=j,F.text+=j)}Y=G.y;continue}if(F.text&&F.text.length>0&&!F.text.endsWith(" ")&&(F.text+=" ",F.children&&F.children.length>0)){let C=F.children[F.children.length-1];C.type==="text"&&C.text&&(C.text+=" ")}F.text+=j;let N=IM(G,I);N&&_.add(N);let X;N&&(N.url?X={link:N.url,linkType:N.url.startsWith("#")?"internal":"external"}:N.dest&&(X={link:typeof N.dest=="string"?`#${N.dest}`:"#internal",linkType:"internal"}));let O=!1;if(F.children&&F.children.length>0&&!X){let C=F.children[F.children.length-1];C.type==="text"&&MM(C.formatting,G.formatting)&&!C.metadata&&(C.text=(C.text||"")+j,O=!0)}if(!O){let C={type:"text",text:j,formatting:Object.keys(G.formatting).length>0?G.formatting:void 0};X&&(C.metadata=X),F.children?.push(C)}Y=G.y}else if(G.type==="image"){F&&((F.text||"").trim().length>0&&T.push(F),F=null),q++;let j=`pdf_image_p${A}_${q}.bmp`;if(t.extractAttachments)try{let J=_M(G.data,G.width,G.height,G.kind),et=NM(G.width,G.height,new Uint8Array(J)),N=gr(j,et);if(N.mimeType="image/bmp",t.ocr)try{G.width>=10&&G.height>=10&&(N.ocrText=(await Xn(et,{language:t.ocrLanguage,...t.ocrConfig})).trim())}catch(O){t.outputErrorToConsole&&console.error(`OCR failed for ${j}:`,O)}l.push(N);let X={attachmentName:j};T.push({type:"image",text:N.ocrText||"",metadata:{...X}})}catch(J){rn(`Failed to process image ${j}:`,t,J)}}F&&(F.text||"").trim().length>0&&T.push(F),o.push({type:"page",children:T,text:T.map(G=>G.text).join(t.newlineDelimiter??` `),metadata:{pageNumber:A}})}return{type:"pdf",metadata:f,content:o,attachments:l,toText:()=>o.map(g=>g.text).join(t.newlineDelimiter??` -`)}};function MM(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{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 Ua(r,O=>!!O.match(t.ignoreNotes?i:e)||!!O.match(c)||!!O.match(u)||!!O.match(n)||!!t.extractAttachments&&(!!O.match(o)||!!O.match(l))),d=h.find(O=>O.path.match(c)),f=d?La(d.content.toString()):{},m=h.find(O=>O.path.match(u));if(m){let O=uu(m.content.toString());Object.keys(O).length>0&&(f.customProperties=O)}h.sort((O,C)=>{let D=O.path.match(s),E=C.path.match(s),S=D?parseInt(D[1]):0,I=E?parseInt(E[1]):0;return S-I});let y=[],g=[],A={},w=0,v=0,T=!1,k=null,N=0,F={},L=(O,C)=>{let D=[],E=J(O,"a:tr");for(let S=0;S{let E=ut(O,"a:blip");if(!E)return null;let S=E.getAttribute("r:embed");if(!S)return null;let I=A[C]?.[S];if(!I||I.type!=="image")return null;let M=I.target,P=ut(O,"p:nvPicPr"),$=(P?ut(P,"p:cNvPr"):null)?.getAttribute("descr")||void 0;return{type:"image",text:"",metadata:{attachmentName:M,altText:$}}},q=(O,C,D)=>{let E=ut(O,"a:graphicData");if(!E||!(E.getAttribute("uri")==="http://schemas.openxmlformats.org/drawingml/2006/chart"))return null;let M=ut(E,"c:chart");if(!M)return null;let P=M.getAttribute("r:id");if(!P)return null;let B=A[C]?.[P];if(!B||B.type!=="chart")return null;let U={type:"chart",text:"",metadata:{attachmentName:B.target}};return t.includeRawContent&&(U.rawContent=Qt(O,D,t)),U},G=(O,C,D)=>{let E=ut(O,"a:tbl");if(E){let S=L(E,D);if(t.includeRawContent&&(S.rawContent=Qt(O,D,t)),S.children&&S.children.length>0)return S}if(O.getElementsByTagName("c:chart").length>0){let S=q(O,C,D);if(S)return S}return null},j=(O,C,D)=>{let E=[],S=ut(O,"p:nvSpPr"),I=S?ut(S,"p:nvPr"):null,M=I?ut(I,"p:ph"):null,P=M?M.getAttribute("type"):"body",B=P==="title"||P==="ctrTitle",$=ut(O,"p:txBody");if($){let U=J($,"a:p");for(let V=0;VN)v=0,F[ft]=0;else if(ftft&&delete F[gt]}v=(F[ft]||0)+1,F[ft]=v}else v=(F[ft]||0)+1,F[ft]=v;T=!0,k=dt,N=ft,Q.metadata={...Q.metadata,listType:dt,indentation:ft,listId:w.toString(),itemIndex:v,alignment:Q.metadata?.alignment||"left"}}else T=!1,k=null,N=0;B&&(Q.metadata={...Q.metadata,level:1}),t.includeRawContent&&(Q.rawContent=Qt(Z,D,t));let pt=J(Z,"a:r");for(let ft=0;ft0&&(bt.superscript=!0)}}let xe={type:"text",text:rt,formatting:bt},Yt=ut(lt,"a:hlinkClick");if(Yt){let At=Yt.getAttribute("r:id"),Bt=Yt.getAttribute("action"),Dt,Gt;At&&A[C]&&A[C][At]&&A[C][At].type==="hyperlink"?(Dt=A[C][At].target,Gt="external"):At&&A[C]&&A[C][At]&&A[C][At].type==="slide"?(Dt=A[C][At].target,Gt="internal"):Bt&&(Dt=Bt,Gt="internal"),Dt&&(xe.metadata={link:Dt,linkType:Gt})}Q.children?.push(xe)}}Q.text&&E.push(Q)}}return E};function tt(O,C,D){let E=[];for(let S of Array.from(O?.childNodes||[])){if(!ci(S))continue;let I=S,M=I.tagName;if(M==="p:sp")E.push(...j(I,C,D));else if(M==="p:pic"){let P=Y(I,C,D);P&&E.push(P)}else if(M==="p:graphicFrame"){let P=G(I,C,D);P&&E.push(P)}else if(M==="p:grpSp"){let P=ut(I,"p:spTree");P&&E.push(...tt(P,C,D))}}return E}for(let O of h)if(O.path.match(n)){let C=O.path.match(/slide(\d+)\.xml\.rels/);if(C){let D=parseInt(C[1]);A[D]={};let E=Zt(O.content.toString()),S=J(E,"Relationship");for(let I=0;I0&&y.push(M)}let et=[],_=h.filter(O=>O.path.match(/ppt\/media\/.*/)),X=h.filter(O=>O.path.match(/ppt\/charts\/chart\d+\.xml/));if(t.extractAttachments){for(let C of _){let D=gr(C.path.split("/").pop()||"image",C.content);if(et.push(D),t.ocr&&D.mimeType.startsWith("image/"))try{D.ocrText=(await Xn(C.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(E){rn(`OCR failed for ${D.name}:`,t,E)}}for(let C of X){let D={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:C.content.toString("base64"),name:C.path.split("/").pop()||"",extension:"xml"};et.push(D);try{let E=await Xo(C.content);D.chartData=E}catch(E){rn(`Failed to extract text from chart ${C.path}:`,t,E)}}let O=C=>{for(let D of C){if("attachmentName"in(D.metadata||{})){let E=D.metadata,S=et.find(I=>I.name===E.attachmentName);S&&(D.type==="image"&&(S.altText=E.altText,S.ocrText&&(D.text=S.ocrText)),D.type==="chart"&&(D.text=S.chartData?.rawTexts.join(t.newlineDelimiter||` +`)}};function MM(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{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 Ua(r,O=>!!O.match(t.ignoreNotes?i:e)||!!O.match(c)||!!O.match(u)||!!O.match(n)||!!t.extractAttachments&&(!!O.match(o)||!!O.match(l))),d=h.find(O=>O.path.match(c)),f=d?La(d.content.toString()):{},m=h.find(O=>O.path.match(u));if(m){let O=uu(m.content.toString());Object.keys(O).length>0&&(f.customProperties=O)}h.sort((O,C)=>{let D=O.path.match(s),E=C.path.match(s),S=D?parseInt(D[1]):0,k=E?parseInt(E[1]):0;return S-k});let y=[],g=[],A={},w=0,v=0,T=!1,I=null,_=0,F={},L=(O,C)=>{let D=[],E=tt(O,"a:tr");for(let S=0;S{let E=ut(O,"a:blip");if(!E)return null;let S=E.getAttribute("r:embed");if(!S)return null;let k=A[C]?.[S];if(!k||k.type!=="image")return null;let M=k.target,P=ut(O,"p:nvPicPr"),$=(P?ut(P,"p:cNvPr"):null)?.getAttribute("descr")||void 0;return{type:"image",text:"",metadata:{attachmentName:M,altText:$}}},q=(O,C,D)=>{let E=ut(O,"a:graphicData");if(!E||!(E.getAttribute("uri")==="http://schemas.openxmlformats.org/drawingml/2006/chart"))return null;let M=ut(E,"c:chart");if(!M)return null;let P=M.getAttribute("r:id");if(!P)return null;let B=A[C]?.[P];if(!B||B.type!=="chart")return null;let U={type:"chart",text:"",metadata:{attachmentName:B.target}};return t.includeRawContent&&(U.rawContent=Qt(O,D,t)),U},G=(O,C,D)=>{let E=ut(O,"a:tbl");if(E){let S=L(E,D);if(t.includeRawContent&&(S.rawContent=Qt(O,D,t)),S.children&&S.children.length>0)return S}if(O.getElementsByTagName("c:chart").length>0){let S=q(O,C,D);if(S)return S}return null},j=(O,C,D)=>{let E=[],S=ut(O,"p:nvSpPr"),k=S?ut(S,"p:nvPr"):null,M=k?ut(k,"p:ph"):null,P=M?M.getAttribute("type"):"body",B=P==="title"||P==="ctrTitle",$=ut(O,"p:txBody");if($){let U=tt($,"a:p");for(let V=0;V_)v=0,F[ft]=0;else if(ft<_){for(let rt in F){let gt=parseInt(rt);gt>ft&&delete F[gt]}v=(F[ft]||0)+1,F[ft]=v}else v=(F[ft]||0)+1,F[ft]=v;T=!0,I=dt,_=ft,Q.metadata={...Q.metadata,listType:dt,indentation:ft,listId:w.toString(),itemIndex:v,alignment:Q.metadata?.alignment||"left"}}else T=!1,I=null,_=0;B&&(Q.metadata={...Q.metadata,level:1}),t.includeRawContent&&(Q.rawContent=Qt(Z,D,t));let pt=tt(Z,"a:r");for(let ft=0;ft0&&(wt.superscript=!0)}}let xe={type:"text",text:rt,formatting:wt},Tt=ut(lt,"a:hlinkClick");if(Tt){let At=Tt.getAttribute("r:id"),Nt=Tt.getAttribute("action"),kt,Yt;At&&A[C]&&A[C][At]&&A[C][At].type==="hyperlink"?(kt=A[C][At].target,Yt="external"):At&&A[C]&&A[C][At]&&A[C][At].type==="slide"?(kt=A[C][At].target,Yt="internal"):Nt&&(kt=Nt,Yt="internal"),kt&&(xe.metadata={link:kt,linkType:Yt})}Q.children?.push(xe)}}Q.text&&E.push(Q)}}return E};function J(O,C,D){let E=[];for(let S of Array.from(O?.childNodes||[])){if(!ni(S))continue;let k=S,M=k.tagName;if(M==="p:sp")E.push(...j(k,C,D));else if(M==="p:pic"){let P=Y(k,C,D);P&&E.push(P)}else if(M==="p:graphicFrame"){let P=G(k,C,D);P&&E.push(P)}else if(M==="p:grpSp"){let P=ut(k,"p:spTree");P&&E.push(...J(P,C,D))}}return E}for(let O of h)if(O.path.match(n)){let C=O.path.match(/slide(\d+)\.xml\.rels/);if(C){let D=parseInt(C[1]);A[D]={};let E=Zt(O.content.toString()),S=tt(E,"Relationship");for(let k=0;k0&&y.push(M)}let et=[],N=h.filter(O=>O.path.match(/ppt\/media\/.*/)),X=h.filter(O=>O.path.match(/ppt\/charts\/chart\d+\.xml/));if(t.extractAttachments){for(let C of N){let D=gr(C.path.split("/").pop()||"image",C.content);if(et.push(D),t.ocr&&D.mimeType.startsWith("image/"))try{D.ocrText=(await Xn(C.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(E){rn(`OCR failed for ${D.name}:`,t,E)}}for(let C of X){let D={type:"chart",mimeType:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:C.content.toString("base64"),name:C.path.split("/").pop()||"",extension:"xml"};et.push(D);try{let E=await Xo(C.content);D.chartData=E}catch(E){rn(`Failed to extract text from chart ${C.path}:`,t,E)}}let O=C=>{for(let D of C){if("attachmentName"in(D.metadata||{})){let E=D.metadata,S=et.find(k=>k.name===E.attachmentName);S&&(D.type==="image"&&(S.altText=E.altText,S.ocrText&&(D.text=S.ocrText)),D.type==="chart"&&(D.text=S.chartData?.rawTexts.join(t.newlineDelimiter||` `)))}D.children&&O(D.children)}};O(y)}return!t.ignoreNotes&&t.putNotesAtLast&&y.sort((O,C)=>{let D=O.type==="note"?1:0,E=C.type==="note"?1:0;return D-E}),{type:"pptx",metadata:f,content:y,attachments:et,toText:()=>y.map(O=>{let C=D=>{let E="";return D.children?E+=D.children.map(C).filter(S=>S!="").join(D.children[0]?.children?t.newlineDelimiter??` `:""):E+=D.text||"",E};return C(O)}).filter(O=>O!="").join(t.newlineDelimiter??` -`)}};H();var FM={pngblip:"png",jpegblip:"jpeg",gifblip:"gif",tiffblip:"tiff",dibitmap:"bmp",wbitmap:"bmp"},PM={png:"image/png",jpeg:"image/jpeg",gif:"image/gif",tiff:"image/tiff",bmp:"image/bmp"},Gw=class{constructor(t){z(this,"index",0);z(this,"buffer");z(this,"length");this.buffer=t,this.length=t.length}parse(){let t={type:"group",content:[]},e=[t];for(;this.index1&&e.pop()):i===92?(this.index++,this.parseControl(n)):i===13||i===10?this.index++:this.parseText(n)}return t}parseControl(t){if(this.index>=this.length)return;let e=this.buffer[this.index];if(e===123||e===125||e===92){t.content.push({type:"text",value:String.fromCharCode(e)}),this.index++;return}if(e===39){if(this.index++,this.index+1=97&&l<=122||l>=65&&l<=90)i+=String.fromCharCode(l),this.index++;else break}let n,s=!1,o="";for(this.index=48&&l<=57)o+=String.fromCharCode(l),this.index++,s=!0;else break}if(s&&(n=parseInt(o,10)),this.index0){this.index+=n;return}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){let e="";for(;this.index0&&t.content.push({type:"text",value:e})}},zS=async(r,t)=>{try{let i=new Gw(r).parse(),n=OM(i),s=RM(i),o=[],l=[],c=[],u="",h=[],d="",f="",m={},y=o,g=0,A="left",w=!1,v,T,k,N,F,L=[],Y=0,q=0,G=()=>L.length>0?L[L.length-1]:void 0,j=()=>{L.length===0&&L.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})},tt=!1,et=!1,_=0,X=[],O={isMergedContinuation:!1},C=0,D=0,E={},S=!1,I=!1,M,P,B={},$=!1,U,V,Z={},Q={},nt,at=(R,W)=>R.bold!==W.bold||R.italic!==W.italic||R.underline!==W.underline||R.strikethrough!==W.strikethrough||R.size!==W.size||R.font!==W.font||R.color!==W.color||R.backgroundColor!==W.backgroundColor||R.subscript!==W.subscript||R.superscript!==W.superscript,dt=()=>{if(f){let R={type:"text",text:f,formatting:{...m}};nt&&(R.metadata={link:nt,linkType:gt(nt)}),h.push(R),u+=f,f=""}},ot=!1,pt=()=>{dt();let R=u||h.length>0;if(tt&&!et&&!ot&&R){let W=u,Ct=[...h],vt=d;u="",h=[],d="",ct(),u=W,h=Ct,d=vt}if(R){let W="paragraph",Ct;if(T!==void 0&&T>0)W="heading",Ct={level:T},N=void 0,F=void 0;else if(w){W="list";let Et=k||N,re=v||F||"unordered",ti=0;Et&&(Q[Et]||(Q[Et]={}),Q[Et][g]===void 0?Q[Et][g]=0:Q[Et][g]++,ti=Q[Et][g]),Ct={listType:re,indentation:g,listId:Et||"",itemIndex:ti,alignment:A},Et&&(N=Et),re&&(F=re)}let vt={type:W,text:u,children:h,formatting:void 0,metadata:Ct};t.includeRawContent&&d&&(vt.rawContent=d),tt&&et?(j(),G().currentCellContent.push(vt)):y.push(vt),u="",h=[],d="",g=0,w=!1,v=void 0,T=void 0,k=void 0}},ft=R=>{pt();let W=R||G();if(!W)return;let Ct={type:"cell",text:W.currentCellContent.map(vt=>vt.text).join(` -`),children:[...W.currentCellContent],metadata:{row:W.rowIndex,col:W.currentCells.length}};return W.currentCellContent=[],Ct},lt=R=>{let W=R||G();if(!W)return;let Ct=ft(W);if(Ct&&(Ct.children&&Ct.children.length>0||Ct.text)&&W.currentCells.push(Ct),W.currentCells.length>0){let vt={type:"row",text:W.currentCells.map(Et=>Et.text).filter(Et=>Et!=="").join(t.newlineDelimiter??` -`),children:[...W.currentCells]};W.rows.push(vt),W.currentCells=[],W.rowIndex++}},ct=()=>{if(ot)return;ot=!0;let R=G();if(!R){ot=!1;return}if(lt(R),R.rows.length>0){_++;let W={type:"table",text:R.rows.map(Ct=>Ct.text).join(` -`),children:[...R.rows]};L.length>1?L[L.length-2].currentCellContent.push(W):y.push(W)}L.pop(),L.length===0&&(tt=!1,et=!1),ot=!1},rt=R=>{let W,Ct=vt=>{if(vt.type==="text"){let Et=vt.value,re=Et.match(/HYPERLINK\s+"([^"]+)"/i);if(re)return re[1];let ti=Et.match(/"(https?:\/\/[^"]+|mailto:[^"]+|#[^"]+)"/);if(ti)return ti[1]}else if(vt.type==="group"){let Et=!1,re;for(let ti of vt.content)if(ti.type==="text"){ti.value.toUpperCase().includes("HYPERLINK")&&(Et=!0);let Gm=ti.value.match(/"([^"]+)"/);Gm&&Et&&(re=Gm[1])}else if(ti.type==="group"){let Uc=Ct(ti);Uc&&(re=Uc)}if(re)return re}};for(let vt of R.content)if(vt.type==="group"){let Et=Ct(vt);if(Et)return Et}return W},gt=R=>{let W=R.trim();return W.startsWith("#")||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(W)?"internal":"external"},bt=R=>{let W="",Ct=vt=>{if(vt.type==="text")W+=vt.value;else if(vt.type==="group")for(let Et of vt.content)Ct(Et)};for(let vt of R.content)Ct(vt);return W},xe=R=>{let W,Ct="";for(let Et of R.content)if(Et.type==="control"){let re=FM[Et.value];re&&(W=re)}else Et.type==="text"?Ct+=Et.value.replace(/[^0-9a-fA-F]/g,""):Et.type;if(!W||Ct.length===0)return;let vt=PM[W];if(vt)try{let Et=st.Buffer.from(Ct,"hex"),re=W,ti=`image_${c.length+1}.${re}`;return{type:"image",mimeType:vt,data:Et.toString("base64"),name:ti,extension:re}}catch{return}},Yt=R=>{if(!/^[a-zA-Z]/.test(R.value))return`\\${R.value}`;let W=`\\${R.value}`;return R.param!==void 0&&(W+=R.param),W+=" ",W},At=R=>R.value.replace(/([\\{}])/g,"\\$1"),Bt=(R,W,Ct=0)=>{if(R.type==="group"){let vt=["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"],Et=!1,re=!1,ti=!1,Uc=!1;if(R.destination){if(R.destination==="footnote")re=!0;else if(R.destination==="field"){let Ue=rt(R);Ue&&(dt(),ti=!0,nt=Ue)}else if(R.destination==="listtable")S=!0;else if(S&&R.destination==="list")I=!0,M=void 0,P=void 0;else if(R.destination==="listoverridetable")$=!0;else if($&&R.destination==="listoverride")U=void 0,V=void 0;else if(R.destination==="pict")t.extractAttachments?Uc=!0:Et=!0;else if(vt.includes(R.destination))Et=!0;else if(R.content.length>0&&R.content[0].type==="control"&&R.content[0].value==="*"){let Ue=["fldinst","nesttableprops"];t.extractAttachments&&Ue.push("shppict","listpicture"),Ue.includes(R.destination||"")||(Et=!0)}}if(R.destination==="listtext"||R.destination==="pntext"){w||(g=0),w=!0;let Ue=bt(R);if(Ue){let wi=Ue.trim();["\xB7","\u2022","o","\xA7","\u25A0","\u25A1","\u25CF","\u25CB","\u25C6","\u25C7","\u25BA","\u25B8","\xB7","\u2022","\u25CF","\u25CB"].some(Ma=>wi.includes(Ma))||wi.length===1&&!/[0-9a-zA-Z]/.test(wi)?v="unordered":(/^[0-9ivxlcdm]+[\.\)]/i.test(wi)||/^[a-z][\.\)]/i.test(wi))&&(v="ordered")}Et=!0}if(Et)return;if(d+="{",Uc){let Ue=xe(R);Ue&&(c.push(Ue),!S&&!I&&(pt(),y.push({type:"image",text:"",metadata:{attachmentName:Ue.name||`image_${c.length}`}})));for(let wi of R.content)if(wi.type==="control")d+=Yt(wi);else if(wi.type==="text")d+=At(wi);else if(wi.type==="group"){let zc=Gn=>{for(let Ma of Gn.content)Ma.type==="control"?d+=Yt(Ma):Ma.type==="text"?d+=At(Ma):Ma.type==="group"&&(d+="{",zc(Ma),d+="}")};zc(R)}d+="}";return}let Gm=y;if(re){if(t.ignoreNotes)return;pt(),Y++;let Ue="footnote";q===1?Ue="endnote":q===2&&(Ue=R.content.some(Gn=>Gn.type==="control"&&Gn.value==="ftnalt")?"endnote":"footnote");let wi={type:"note",children:[],metadata:{noteId:Y.toString(),noteType:Ue}};l.push(wi),y=wi.children}let QS={...W};for(let Ue of R.content){if(Ue.type==="group"&&Ue.destination==="fldinst"){d+="{";let wi=zc=>{for(let Gn of zc.content)Gn.type==="control"?d+=Yt(Gn):Gn.type==="text"?d+=At(Gn):Gn.type==="group"&&(d+="{",wi(Gn),d+="}")};wi(Ue),d+="}";continue}Bt(Ue,QS,Ct+1)}R.destination==="listtable"?S=!1:R.destination==="list"?(I=!1,M!==void 0&&P!==void 0&&(B[M]=P)):R.destination==="listoverridetable"?$=!1:$&&R.destination==="listoverride"&&V!==void 0&&U!==void 0&&(Z[V]=U),re&&(pt(),y=Gm),ti&&(dt(),nt=void 0),d+="}"}else if(R.type==="text"){if(S||$){d+=At(R);return}at(m,W)&&(dt(),m={...W}),f+=R.value,d+=At(R)}else if(R.type==="control"){if(d+=Yt(R),S){if(R.value==="listid")M=R.param;else if(R.value==="levelnfc"||R.value==="levelnfcn"){let vt=R.param!==void 0&&(R.param===0||R.param>=0&&R.param<=4);(!P||P==="unordered"&&vt)&&(P=vt?"ordered":"unordered")}return}if($){R.value==="listid"?U=R.param:R.value==="ls"&&(V=R.param);return}if(R.value==="par")pt(),m={...W};else if(R.value==="trowd"){let vt=G();tt&&vt&&vt.currentCellContent.length>0?(j(),L.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})):tt||(tt=!0,j()),et=!0,X=[],O={isMergedContinuation:!1},C=0}else if(R.value==="clvmrg")O.isMergedContinuation=!0;else if(R.value==="clmgf")O.isMergedContinuation=!1;else if(R.value==="cellx")X.push({...O}),O={isMergedContinuation:!1};else if(R.value==="cell"){et=!0;let vt=!1;C1){let Et=G();Et&&(Et.rows.length>0||Et.currentCells.length>0)&&ct()}et=!0;let vt=ft();if(vt){let Et=G();Et&&Et.currentCells.push(vt)}m={...W}}else if(R.value==="row")lt(),m={...W},C=0,et=!1;else if(R.value==="nestrow")L.length>1&&ct(),lt(),m={...W},C=0;else if(R.value==="intbl")tt=!0,et=!0,j();else if(R.value==="pard")et=!1,g=0,A="left",w=!1,v=void 0,T=void 0,k=void 0,W.backgroundColor=void 0;else if(R.value==="tab")at(m,W)&&(dt(),m={...W}),f+=" ";else if(R.value==="line")at(m,W)&&(dt(),m={...W}),f+=` -`;else if(R.value==="lquote")at(m,W)&&(dt(),m={...W}),f+="\u2018";else if(R.value==="rquote")at(m,W)&&(dt(),m={...W}),f+="\u2019";else if(R.value==="ldblquote")at(m,W)&&(dt(),m={...W}),f+="\u201C";else if(R.value==="rdblquote")at(m,W)&&(dt(),m={...W}),f+="\u201D";else if(R.value==="u"){if(R.param!==void 0){let vt=R.param;vt<0&&(vt+=65536),at(m,W)&&(dt(),m={...W}),f+=String.fromCharCode(vt)}}else if(R.value==="b")W.bold=R.param!==0;else if(R.value==="i")W.italic=R.param!==0;else if(R.value==="ul")W.underline=R.param!==0;else if(R.value==="ulnone")W.underline=!1;else if(R.value==="strike")W.strikethrough=R.param!==0;else if(R.value==="plain")W.bold=!1,W.italic=!1,W.underline=!1,W.strikethrough=!1,W.subscript=!1,W.superscript=!1,W.size=void 0,W.font=void 0,W.color=void 0,W.backgroundColor=void 0;else if(R.value==="fs")R.param!==void 0&&(W.size=(R.param/2).toString()+"pt");else if(R.value==="f")R.param!==void 0&&n[R.param]&&(W.font=n[R.param]);else if(R.value==="cf")R.param!==void 0&&s[R.param]&&(W.color=s[R.param]);else if(R.value==="fet")R.param!==void 0&&(q=R.param);else if(R.value==="cb"||R.value==="highlight"||R.value==="chcbpat"||R.value==="cbpat")R.param!==void 0&&s[R.param]&&(W.backgroundColor=s[R.param]);else if(R.value==="sub")W.subscript=!0,W.superscript=!1;else if(R.value==="super")W.superscript=!0,W.subscript=!1;else if(R.value==="nosupersub")W.subscript=!1,W.superscript=!1;else if(R.value==="li")R.param!==void 0&&(g=Math.floor(R.param/360));else if(R.value==="ls"){if(R.param!==void 0){w||(g=0),w=!0,E[R.param]||(D++,E[R.param]=`rtf-list-${D}`),k=E[R.param];let vt=Z[R.param]!==void 0?Z[R.param]:R.param;B[vt]&&(v=B[vt])}}else R.value==="ilvl"?R.param!==void 0&&(w=!0,g=R.param):R.value==="pnlvl"?(w=!0,R.param!==void 0&&(g=R.param)):R.value==="levelnfc"||R.value==="pnf"?R.param!==void 0&&(w=!0,R.param===23?v="unordered":v="ordered"):R.value==="pndec"||R.value==="pnord"||R.value==="pnlcltr"||R.value==="pnucltr"?(w||(g=0),w=!0,v="ordered"):R.value==="pnbullet"||R.value==="pncard"?(w||(g=0),w=!0,v="unordered"):R.value==="s"?R.param!==void 0&&R.param>=1&&R.param<=9&&(T=R.param):R.value==="ql"?A="left":R.value==="qc"?A="center":R.value==="qr"?A="right":R.value==="qj"&&(A="justify")}};Bt(i,{});let Dt=G();if((tt||Dt&&(Dt.rows.length>0||Dt.currentCells.length>0))&&ct(),pt(),!t.putNotesAtLast&&l.length>0&&(o.push(...l),l.length=0),t.ocr&&t.extractAttachments){for(let W of c)if(W.mimeType.startsWith("image/"))try{let Ct=st.Buffer.from(W.data,"base64");W.ocrText=(await Xn(Ct,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(Ct){rn(`OCR failed for ${W.name}:`,t,Ct)}let R=W=>{for(let Ct of W){if(Ct.type==="image"&&Ct.metadata&&"attachmentName"in Ct.metadata){let vt=Ct.metadata,Et=c.find(re=>re.name===vt.attachmentName);Et&&(Et.ocrText&&(Ct.text=Et.ocrText),Et.altText&&(vt.altText=Et.altText))}Ct.children&&R(Ct.children)}};R(o)}let Gt=R=>{for(let W of R){if(W.type==="note"&&W.children){let Ct=vt=>vt.children&&vt.children.length>0?vt.children.map(Ct).join(""):vt.text||"";W.text=W.children.map(Ct).join("").trim()}W.children&&Gt(W.children)}};Gt(o),Gt(l);let bi={type:"rtf",metadata:{},content:o,attachments:c,toText:()=>{let R=o.map(W=>W.text).join(t.newlineDelimiter??` +`)}};H();var FM={pngblip:"png",jpegblip:"jpeg",gifblip:"gif",tiffblip:"tiff",dibitmap:"bmp",wbitmap:"bmp"},PM={png:"image/png",jpeg:"image/jpeg",gif:"image/gif",tiff:"image/tiff",bmp:"image/bmp"},Gw=class{constructor(t){z(this,"index",0);z(this,"buffer");z(this,"length");this.buffer=t,this.length=t.length}parse(){let t={type:"group",content:[]},e=[t];for(;this.index1&&e.pop()):i===92?(this.index++,this.parseControl(n)):i===13||i===10?this.index++:this.parseText(n)}return t}parseControl(t){if(this.index>=this.length)return;let e=this.buffer[this.index];if(e===123||e===125||e===92){t.content.push({type:"text",value:String.fromCharCode(e)}),this.index++;return}if(e===39){if(this.index++,this.index+1=97&&l<=122||l>=65&&l<=90)i+=String.fromCharCode(l),this.index++;else break}let n,s=!1,o="";for(this.index=48&&l<=57)o+=String.fromCharCode(l),this.index++,s=!0;else break}if(s&&(n=parseInt(o,10)),this.index0){this.index+=n;return}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){let e="";for(;this.index0&&t.content.push({type:"text",value:e})}},zS=async(r,t)=>{try{let i=new Gw(r).parse(),n=OM(i),s=RM(i),o=[],l=[],c=[],u="",h=[],d="",f="",m={},y=o,g=0,A="left",w=!1,v,T,I,_,F,L=[],Y=0,q=0,G=()=>L.length>0?L[L.length-1]:void 0,j=()=>{L.length===0&&L.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})},J=!1,et=!1,N=0,X=[],O={isMergedContinuation:!1},C=0,D=0,E={},S=!1,k=!1,M,P,B={},$=!1,U,V,Z={},Q={},nt,ot=(R,W)=>R.bold!==W.bold||R.italic!==W.italic||R.underline!==W.underline||R.strikethrough!==W.strikethrough||R.size!==W.size||R.font!==W.font||R.color!==W.color||R.backgroundColor!==W.backgroundColor||R.subscript!==W.subscript||R.superscript!==W.superscript,dt=()=>{if(f){let R={type:"text",text:f,formatting:{...m}};nt&&(R.metadata={link:nt,linkType:gt(nt)}),h.push(R),u+=f,f=""}},at=!1,pt=()=>{dt();let R=u||h.length>0;if(J&&!et&&!at&&R){let W=u,Ct=[...h],bt=d;u="",h=[],d="",ct(),u=W,h=Ct,d=bt}if(R){let W="paragraph",Ct;if(T!==void 0&&T>0)W="heading",Ct={level:T},_=void 0,F=void 0;else if(w){W="list";let Et=I||_,re=v||F||"unordered",_i=0;Et&&(Q[Et]||(Q[Et]={}),Q[Et][g]===void 0?Q[Et][g]=0:Q[Et][g]++,_i=Q[Et][g]),Ct={listType:re,indentation:g,listId:Et||"",itemIndex:_i,alignment:A},Et&&(_=Et),re&&(F=re)}let bt={type:W,text:u,children:h,formatting:void 0,metadata:Ct};t.includeRawContent&&d&&(bt.rawContent=d),J&&et?(j(),G().currentCellContent.push(bt)):y.push(bt),u="",h=[],d="",g=0,w=!1,v=void 0,T=void 0,I=void 0}},ft=R=>{pt();let W=R||G();if(!W)return;let Ct={type:"cell",text:W.currentCellContent.map(bt=>bt.text).join(` +`),children:[...W.currentCellContent],metadata:{row:W.rowIndex,col:W.currentCells.length}};return W.currentCellContent=[],Ct},lt=R=>{let W=R||G();if(!W)return;let Ct=ft(W);if(Ct&&(Ct.children&&Ct.children.length>0||Ct.text)&&W.currentCells.push(Ct),W.currentCells.length>0){let bt={type:"row",text:W.currentCells.map(Et=>Et.text).filter(Et=>Et!=="").join(t.newlineDelimiter??` +`),children:[...W.currentCells]};W.rows.push(bt),W.currentCells=[],W.rowIndex++}},ct=()=>{if(at)return;at=!0;let R=G();if(!R){at=!1;return}if(lt(R),R.rows.length>0){N++;let W={type:"table",text:R.rows.map(Ct=>Ct.text).join(` +`),children:[...R.rows]};L.length>1?L[L.length-2].currentCellContent.push(W):y.push(W)}L.pop(),L.length===0&&(J=!1,et=!1),at=!1},rt=R=>{let W,Ct=bt=>{if(bt.type==="text"){let Et=bt.value,re=Et.match(/HYPERLINK\s+"([^"]+)"/i);if(re)return re[1];let _i=Et.match(/"(https?:\/\/[^"]+|mailto:[^"]+|#[^"]+)"/);if(_i)return _i[1]}else if(bt.type==="group"){let Et=!1,re;for(let _i of bt.content)if(_i.type==="text"){_i.value.toUpperCase().includes("HYPERLINK")&&(Et=!0);let Gm=_i.value.match(/"([^"]+)"/);Gm&&Et&&(re=Gm[1])}else if(_i.type==="group"){let Uc=Ct(_i);Uc&&(re=Uc)}if(re)return re}};for(let bt of R.content)if(bt.type==="group"){let Et=Ct(bt);if(Et)return Et}return W},gt=R=>{let W=R.trim();return W.startsWith("#")||!/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(W)?"internal":"external"},wt=R=>{let W="",Ct=bt=>{if(bt.type==="text")W+=bt.value;else if(bt.type==="group")for(let Et of bt.content)Ct(Et)};for(let bt of R.content)Ct(bt);return W},xe=R=>{let W,Ct="";for(let Et of R.content)if(Et.type==="control"){let re=FM[Et.value];re&&(W=re)}else Et.type==="text"?Ct+=Et.value.replace(/[^0-9a-fA-F]/g,""):Et.type;if(!W||Ct.length===0)return;let bt=PM[W];if(bt)try{let Et=st.Buffer.from(Ct,"hex"),re=W,_i=`image_${c.length+1}.${re}`;return{type:"image",mimeType:bt,data:Et.toString("base64"),name:_i,extension:re}}catch{return}},Tt=R=>{if(!/^[a-zA-Z]/.test(R.value))return`\\${R.value}`;let W=`\\${R.value}`;return R.param!==void 0&&(W+=R.param),W+=" ",W},At=R=>R.value.replace(/([\\{}])/g,"\\$1"),Nt=(R,W,Ct=0)=>{if(R.type==="group"){let bt=["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"],Et=!1,re=!1,_i=!1,Uc=!1;if(R.destination){if(R.destination==="footnote")re=!0;else if(R.destination==="field"){let Ue=rt(R);Ue&&(dt(),_i=!0,nt=Ue)}else if(R.destination==="listtable")S=!0;else if(S&&R.destination==="list")k=!0,M=void 0,P=void 0;else if(R.destination==="listoverridetable")$=!0;else if($&&R.destination==="listoverride")U=void 0,V=void 0;else if(R.destination==="pict")t.extractAttachments?Uc=!0:Et=!0;else if(bt.includes(R.destination))Et=!0;else if(R.content.length>0&&R.content[0].type==="control"&&R.content[0].value==="*"){let Ue=["fldinst","nesttableprops"];t.extractAttachments&&Ue.push("shppict","listpicture"),Ue.includes(R.destination||"")||(Et=!0)}}if(R.destination==="listtext"||R.destination==="pntext"){w||(g=0),w=!0;let Ue=wt(R);if(Ue){let bi=Ue.trim();["\xB7","\u2022","o","\xA7","\u25A0","\u25A1","\u25CF","\u25CB","\u25C6","\u25C7","\u25BA","\u25B8","\xB7","\u2022","\u25CF","\u25CB"].some(Ma=>bi.includes(Ma))||bi.length===1&&!/[0-9a-zA-Z]/.test(bi)?v="unordered":(/^[0-9ivxlcdm]+[\.\)]/i.test(bi)||/^[a-z][\.\)]/i.test(bi))&&(v="ordered")}Et=!0}if(Et)return;if(d+="{",Uc){let Ue=xe(R);Ue&&(c.push(Ue),!S&&!k&&(pt(),y.push({type:"image",text:"",metadata:{attachmentName:Ue.name||`image_${c.length}`}})));for(let bi of R.content)if(bi.type==="control")d+=Tt(bi);else if(bi.type==="text")d+=At(bi);else if(bi.type==="group"){let zc=Gn=>{for(let Ma of Gn.content)Ma.type==="control"?d+=Tt(Ma):Ma.type==="text"?d+=At(Ma):Ma.type==="group"&&(d+="{",zc(Ma),d+="}")};zc(R)}d+="}";return}let Gm=y;if(re){if(t.ignoreNotes)return;pt(),Y++;let Ue="footnote";q===1?Ue="endnote":q===2&&(Ue=R.content.some(Gn=>Gn.type==="control"&&Gn.value==="ftnalt")?"endnote":"footnote");let bi={type:"note",children:[],metadata:{noteId:Y.toString(),noteType:Ue}};l.push(bi),y=bi.children}let QS={...W};for(let Ue of R.content){if(Ue.type==="group"&&Ue.destination==="fldinst"){d+="{";let bi=zc=>{for(let Gn of zc.content)Gn.type==="control"?d+=Tt(Gn):Gn.type==="text"?d+=At(Gn):Gn.type==="group"&&(d+="{",bi(Gn),d+="}")};bi(Ue),d+="}";continue}Nt(Ue,QS,Ct+1)}R.destination==="listtable"?S=!1:R.destination==="list"?(k=!1,M!==void 0&&P!==void 0&&(B[M]=P)):R.destination==="listoverridetable"?$=!1:$&&R.destination==="listoverride"&&V!==void 0&&U!==void 0&&(Z[V]=U),re&&(pt(),y=Gm),_i&&(dt(),nt=void 0),d+="}"}else if(R.type==="text"){if(S||$){d+=At(R);return}ot(m,W)&&(dt(),m={...W}),f+=R.value,d+=At(R)}else if(R.type==="control"){if(d+=Tt(R),S){if(R.value==="listid")M=R.param;else if(R.value==="levelnfc"||R.value==="levelnfcn"){let bt=R.param!==void 0&&(R.param===0||R.param>=0&&R.param<=4);(!P||P==="unordered"&&bt)&&(P=bt?"ordered":"unordered")}return}if($){R.value==="listid"?U=R.param:R.value==="ls"&&(V=R.param);return}if(R.value==="par")pt(),m={...W};else if(R.value==="trowd"){let bt=G();J&&bt&&bt.currentCellContent.length>0?(j(),L.push({rows:[],currentCells:[],currentCellContent:[],rowIndex:0})):J||(J=!0,j()),et=!0,X=[],O={isMergedContinuation:!1},C=0}else if(R.value==="clvmrg")O.isMergedContinuation=!0;else if(R.value==="clmgf")O.isMergedContinuation=!1;else if(R.value==="cellx")X.push({...O}),O={isMergedContinuation:!1};else if(R.value==="cell"){et=!0;let bt=!1;C1){let Et=G();Et&&(Et.rows.length>0||Et.currentCells.length>0)&&ct()}et=!0;let bt=ft();if(bt){let Et=G();Et&&Et.currentCells.push(bt)}m={...W}}else if(R.value==="row")lt(),m={...W},C=0,et=!1;else if(R.value==="nestrow")L.length>1&&ct(),lt(),m={...W},C=0;else if(R.value==="intbl")J=!0,et=!0,j();else if(R.value==="pard")et=!1,g=0,A="left",w=!1,v=void 0,T=void 0,I=void 0,W.backgroundColor=void 0;else if(R.value==="tab")ot(m,W)&&(dt(),m={...W}),f+=" ";else if(R.value==="line")ot(m,W)&&(dt(),m={...W}),f+=` +`;else if(R.value==="lquote")ot(m,W)&&(dt(),m={...W}),f+="\u2018";else if(R.value==="rquote")ot(m,W)&&(dt(),m={...W}),f+="\u2019";else if(R.value==="ldblquote")ot(m,W)&&(dt(),m={...W}),f+="\u201C";else if(R.value==="rdblquote")ot(m,W)&&(dt(),m={...W}),f+="\u201D";else if(R.value==="u"){if(R.param!==void 0){let bt=R.param;bt<0&&(bt+=65536),ot(m,W)&&(dt(),m={...W}),f+=String.fromCharCode(bt)}}else if(R.value==="b")W.bold=R.param!==0;else if(R.value==="i")W.italic=R.param!==0;else if(R.value==="ul")W.underline=R.param!==0;else if(R.value==="ulnone")W.underline=!1;else if(R.value==="strike")W.strikethrough=R.param!==0;else if(R.value==="plain")W.bold=!1,W.italic=!1,W.underline=!1,W.strikethrough=!1,W.subscript=!1,W.superscript=!1,W.size=void 0,W.font=void 0,W.color=void 0,W.backgroundColor=void 0;else if(R.value==="fs")R.param!==void 0&&(W.size=(R.param/2).toString()+"pt");else if(R.value==="f")R.param!==void 0&&n[R.param]&&(W.font=n[R.param]);else if(R.value==="cf")R.param!==void 0&&s[R.param]&&(W.color=s[R.param]);else if(R.value==="fet")R.param!==void 0&&(q=R.param);else if(R.value==="cb"||R.value==="highlight"||R.value==="chcbpat"||R.value==="cbpat")R.param!==void 0&&s[R.param]&&(W.backgroundColor=s[R.param]);else if(R.value==="sub")W.subscript=!0,W.superscript=!1;else if(R.value==="super")W.superscript=!0,W.subscript=!1;else if(R.value==="nosupersub")W.subscript=!1,W.superscript=!1;else if(R.value==="li")R.param!==void 0&&(g=Math.floor(R.param/360));else if(R.value==="ls"){if(R.param!==void 0){w||(g=0),w=!0,E[R.param]||(D++,E[R.param]=`rtf-list-${D}`),I=E[R.param];let bt=Z[R.param]!==void 0?Z[R.param]:R.param;B[bt]&&(v=B[bt])}}else R.value==="ilvl"?R.param!==void 0&&(w=!0,g=R.param):R.value==="pnlvl"?(w=!0,R.param!==void 0&&(g=R.param)):R.value==="levelnfc"||R.value==="pnf"?R.param!==void 0&&(w=!0,R.param===23?v="unordered":v="ordered"):R.value==="pndec"||R.value==="pnord"||R.value==="pnlcltr"||R.value==="pnucltr"?(w||(g=0),w=!0,v="ordered"):R.value==="pnbullet"||R.value==="pncard"?(w||(g=0),w=!0,v="unordered"):R.value==="s"?R.param!==void 0&&R.param>=1&&R.param<=9&&(T=R.param):R.value==="ql"?A="left":R.value==="qc"?A="center":R.value==="qr"?A="right":R.value==="qj"&&(A="justify")}};Nt(i,{});let kt=G();if((J||kt&&(kt.rows.length>0||kt.currentCells.length>0))&&ct(),pt(),!t.putNotesAtLast&&l.length>0&&(o.push(...l),l.length=0),t.ocr&&t.extractAttachments){for(let W of c)if(W.mimeType.startsWith("image/"))try{let Ct=st.Buffer.from(W.data,"base64");W.ocrText=(await Xn(Ct,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(Ct){rn(`OCR failed for ${W.name}:`,t,Ct)}let R=W=>{for(let Ct of W){if(Ct.type==="image"&&Ct.metadata&&"attachmentName"in Ct.metadata){let bt=Ct.metadata,Et=c.find(re=>re.name===bt.attachmentName);Et&&(Et.ocrText&&(Ct.text=Et.ocrText),Et.altText&&(bt.altText=Et.altText))}Ct.children&&R(Ct.children)}};R(o)}let Yt=R=>{for(let W of R){if(W.type==="note"&&W.children){let Ct=bt=>bt.children&&bt.children.length>0?bt.children.map(Ct).join(""):bt.text||"";W.text=W.children.map(Ct).join("").trim()}W.children&&Yt(W.children)}};Yt(o),Yt(l);let ti={type:"rtf",metadata:{},content:o,attachments:c,toText:()=>{let R=o.map(W=>W.text).join(t.newlineDelimiter??` `);return t.putNotesAtLast&&l.length>0&&(R+=(t.newlineDelimiter??` `)+l.map(W=>W.text).join(t.newlineDelimiter??` -`)),R}};return t.putNotesAtLast&&l.length>0&&o.push(...l),bi}catch(e){throw e}};function OM(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 RM(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 jS=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={},I=mg(E),M=(pt,ft)=>{let lt=new RegExp(`<${ft}(?:\\s+w:val="([^"]+)")?\\s*\\/?>`),ct=pt.match(lt);if(ct){let rt=ct[1];return rt===void 0?!0:rt==="1"||rt==="true"||rt==="on"}return null},P=M(I,"w:b");P!==null&&(S.bold=P);let B=M(I,"w:i");B!==null&&(S.italic=B);let $=I.match(//);if($){let pt=$[1];(!pt||pt!=="none")&&(S.underline=!0)}let U=M(I,"w:strike"),V=M(I,"w:dstrike");U!==null?S.strikethrough=U:V!==null&&(S.strikethrough=V);let Z=I.match(/]*w:fill="([^"]+)"/);nt&&nt[1]!=="auto"&&(S.backgroundColor="#"+nt[1]);let at=I.match(/]*w:ascii="([^"]+)"/);if(dt)S.font=dt[1];else{let pt=I.match(/]*w:hAnsi="([^"]+)"/);pt&&(S.font=pt[1])}let ot=I.match(/!!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)),m=f.find(E=>E.path.match(l)),y=m?La(m.content.toString()):{},g=f.find(E=>E.path.match(c));if(g){let E=uu(g.content.toString());Object.keys(E).length>0&&(y.customProperties=E)}let A=new Map,w=new Map,v=[],T=[],k=f.filter(E=>E.path.match(o)),N=f.find(E=>E.path.match(u)),F={};if(N){let E=Zt(N.content.toString()),S=J(E,"Relationship");for(let I of S){let M=I.getAttribute("Id"),P=I.getAttribute("Target");M&&P&&(F[M]=P)}}let L=f.find(E=>E.path.match(s)),Y={};if(L){let E=Zt(L.content.toString()),S=J(E,"w:num"),I=J(E,"w:abstractNum"),M={};for(let P of I){let B=P.getAttribute("w:abstractNumId");B&&(M[B]=P)}for(let P of S){let B=P.getAttribute("w:numId"),U=ut(P,"w:abstractNumId")?.getAttribute("w:val");if(B&&U&&M[U]){Y[B]={};let V=J(M[U],"w:lvl");for(let Z of V){let Q=Z.getAttribute("w:ilvl"),nt=ut(Z,"w:numFmt"),at=ut(Z,"w:lvlText");Q&&(Y[B][Q]={numFmt:nt?.getAttribute("w:val")||"decimal",lvlText:at?.getAttribute("w:val")||""})}}}}let q=f.find(E=>E.path.match(h)),G={};if(q){let E=Zt(q.content.toString()),S=J(E,"w:style");for(let I of S){let M=I.getAttribute("w:styleId");if(M){let P=ut(I,"w:rPr"),B=ut(I,"w:pPr"),$=P?d(P):{},U,V;if(B){let Z=ut(B,"w:jc");if(Z){let nt=Z.getAttribute("w:val");(nt==="left"||nt==="center"||nt==="right"||nt==="justify")&&(U=nt)}let Q=ut(B,"w:shd");if(Q){let nt=Q.getAttribute("w:fill");nt&&nt!=="auto"&&(V="#"+nt)}}G[M]={formatting:$,alignment:U,backgroundColor:V}}}}let j={};if(q){let E=Zt(q.content.toString()),S=ut(E,"w:docDefaults");if(S){let I=ut(S,"w:rPrDefault");if(I){let M=ut(I,"w:rPr");M&&(j=d(M))}}}let tt;if(q){let E=Zt(q.content.toString()),S=J(E,"w:style");for(let I of S){let M=I.getAttribute("w:type"),P=I.getAttribute("w:default"),B=I.getAttribute("w:styleId");if(M==="paragraph"&&P==="1"&&B){tt=B;break}}!tt&&G.Normal&&(tt="Normal")}let et=[],_=[],X={},O={},C=(E,S)=>{let I=E.toString(),M=ut(E,"w:numPr"),P=!!M,B=ut(E,"w:pPr"),U=(B?ut(B,"w:pStyle"):null)?.getAttribute("w:val"),V=U?U.startsWith("Heading")||U==="Title":!1,Z=U&&G[U]?G[U]:{formatting:{}},Q=Z.alignment;if(B){let lt=ut(B,"w:jc");if(lt){let ct=lt.getAttribute("w:val");(ct==="left"||ct==="center"||ct==="right"||ct==="justify")&&(Q=ct)}}let nt=Z.backgroundColor;if(B){let lt=ut(B,"w:shd");if(lt){let ct=lt.getAttribute("w:fill");ct&&ct!=="auto"&&(nt="#"+ct)}}let at={...Z.formatting};if(B){let lt=ut(B,"w:rPr");if(lt){let ct=d(lt);for(let rt in ct){let gt=ct[rt];gt===!1?delete at[rt]:gt!==void 0&&(at[rt]=gt)}}}let dt="",ot=[],pt=lt=>{if(ci(lt)&<.nodeName==="w:r"){let ct=lt,rt=ut(ct,"w:rPr"),gt={};for(let At in at)gt[At]=at[At];let bt=rt?ut(rt,"w:rStyle"):null,xe=bt?bt.getAttribute("w:val"):U;if(xe&&G[xe])for(let At in G[xe].formatting)gt[At]=G[xe].formatting[At];if(rt){let At=d(rt);for(let Bt in At){let Dt=At[Bt];Dt===!1?delete gt[Bt]:Dt!==void 0&&(gt[Bt]=Dt)}}!gt.backgroundColor&&nt&&(gt.backgroundColor=nt);let Yt=J(ct,"w:t");for(let At of Yt){let Bt=At.textContent||"";dt+=Bt;let Dt={type:"text",text:Bt,formatting:gt};t.includeRawContent&&(Dt.rawContent=Qt(At,S,t));let Gt=xe||U||tt;Gt&&(Dt.metadata={style:Gt}),ot.push(Dt)}if(t.extractAttachments){let At=J(ct,"w:drawing"),Bt=J(ct,"w:pict"),Dt=[...At,...Bt];for(let Gt of Dt){let bi=mg(Gt),R="",W=ut(Gt,"wp:docPr");W&&(R=W.getAttribute("descr")||W.getAttribute("title")||"");let Ct="",vt=ut(Gt,"a:blip");if(vt)Ct=vt.getAttribute("r:embed")||"";else{let Et=ut(Gt,"v:imagedata");Et&&(Ct=Et.getAttribute("r:id")||"")}if(Ct&&F[Ct]){let re=F[Ct].split("/").pop();if(re){let ti={type:"image",text:"",metadata:{attachmentName:re,altText:R}};t.includeRawContent&&(ti.rawContent=Qt(Gt,S,t)),ot.push(ti)}}else{let Et={type:"image",text:""};t.includeRawContent&&(Et.rawContent=Qt(Gt,S,t)),ot.push(Et)}}}if(!t.ignoreNotes){let At=ut(ct,"w:footnoteReference");if(At){let Dt=At.getAttribute("w:id");if(Dt&&A.has(Dt)){let Gt=A.get(Dt),bi={type:"note",text:Gt.map(R=>R.text).join(" "),children:Gt,metadata:{noteType:"footnote",noteId:Dt}};t.putNotesAtLast?v.push(bi):ot.push(bi)}}let Bt=ut(ct,"w:endnoteReference");if(Bt){let Dt=Bt.getAttribute("w:id");if(Dt&&w.has(Dt)){let Gt=w.get(Dt),bi={type:"note",text:Gt.map(R=>R.text).join(" "),children:Gt,metadata:{noteType:"endnote",noteId:Dt}};t.putNotesAtLast?v.push(bi):ot.push(bi)}}}}else if(ci(lt)&<.nodeName==="w:hyperlink"){let ct=lt,rt=ct.getAttribute("r:id"),gt=ct.getAttribute("w:anchor"),bt;gt?bt={link:"#"+gt,linkType:"internal"}:rt&&F[rt]&&(bt={link:F[rt],linkType:"external"});let xe=Array.from(ct.childNodes);for(let Yt of xe){let At=ot.length;if(pt(Yt),bt)for(let Bt=At;Bt{let I=[],M=He(E,"w:tr");for(let P=0;PI.path.match(i));if(E){let I=Zt(E.content.toString()),M=E.content.toString(),P=J(I,"w:footnote");for(let B of P){let $=B.getAttribute("w:id");if(!$||$==="-1"||$==="0")continue;let U=J(B,"w:p");A.set($,U.map(V=>C(V,M)))}}let S=f.find(I=>I.path.match(n));if(S){let I=Zt(S.content.toString()),M=S.content.toString(),P=J(I,"w:endnote");for(let B of P){let $=B.getAttribute("w:id");if(!$||$==="-1"||$==="0")continue;let U=J(B,"w:p");w.set($,U.map(V=>C(V,M)))}}}for(let E of f){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&&_.push(S);let I=Zt(S,{locator:t.includeRawContent}),M=ut(I,"w:body");if(M){let P=Array.from(M.childNodes);for(let B of P)ci(B)&&B.nodeName==="w:p"?et.push(C(B,S)):ci(B)&&B.nodeName==="w:tbl"&&et.push(D(B,S))}}if(t.extractAttachments){for(let E of k){let S=gr(E.path.split("/").pop()||"image",E.content);if(T.push(S),t.ocr&&S.mimeType.startsWith("image/"))try{S.ocrText=(await Xn(E.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(I){rn(`OCR failed for ${S.name}:`,t,I)}}if(t.ocr){let E=S=>{for(let I of S){if(I.type==="image"&&"attachmentName"in(I.metadata||{})){let M=I.metadata,P=T.find(B=>B.name===M.attachmentName);P&&P.ocrText&&(I.text=P.ocrText,P.altText=M.altText)}I.children&&E(I.children)}};E(et)}}return t.putNotesAtLast&&v.length>0&&et.push(...v),{type:"docx",metadata:{...y,formatting:j,styleMap:G},content:et,attachments:T,toText:()=>et.map(E=>{let S=I=>{let M="";return I.children?M+=I.children.map(S).filter(P=>P!="").join(I.children[0]?.children?t.newlineDelimiter??` -`:""):M+=I.text||"",M};return S(E)}).filter(E=>E!="").join(t.newlineDelimiter??` +`)),R}};return t.putNotesAtLast&&l.length>0&&o.push(...l),ti}catch(e){throw e}};function OM(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 RM(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 jS=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={},k=mg(E),M=(pt,ft)=>{let lt=new RegExp(`<${ft}(?:\\s+w:val="([^"]+)")?\\s*\\/?>`),ct=pt.match(lt);if(ct){let rt=ct[1];return rt===void 0?!0:rt==="1"||rt==="true"||rt==="on"}return null},P=M(k,"w:b");P!==null&&(S.bold=P);let B=M(k,"w:i");B!==null&&(S.italic=B);let $=k.match(//);if($){let pt=$[1];(!pt||pt!=="none")&&(S.underline=!0)}let U=M(k,"w:strike"),V=M(k,"w:dstrike");U!==null?S.strikethrough=U:V!==null&&(S.strikethrough=V);let Z=k.match(/]*w:fill="([^"]+)"/);nt&&nt[1]!=="auto"&&(S.backgroundColor="#"+nt[1]);let ot=k.match(/]*w:ascii="([^"]+)"/);if(dt)S.font=dt[1];else{let pt=k.match(/]*w:hAnsi="([^"]+)"/);pt&&(S.font=pt[1])}let at=k.match(/!!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)),m=f.find(E=>E.path.match(l)),y=m?La(m.content.toString()):{},g=f.find(E=>E.path.match(c));if(g){let E=uu(g.content.toString());Object.keys(E).length>0&&(y.customProperties=E)}let A=new Map,w=new Map,v=[],T=[],I=f.filter(E=>E.path.match(o)),_=f.find(E=>E.path.match(u)),F={};if(_){let E=Zt(_.content.toString()),S=tt(E,"Relationship");for(let k of S){let M=k.getAttribute("Id"),P=k.getAttribute("Target");M&&P&&(F[M]=P)}}let L=f.find(E=>E.path.match(s)),Y={};if(L){let E=Zt(L.content.toString()),S=tt(E,"w:num"),k=tt(E,"w:abstractNum"),M={};for(let P of k){let B=P.getAttribute("w:abstractNumId");B&&(M[B]=P)}for(let P of S){let B=P.getAttribute("w:numId"),U=ut(P,"w:abstractNumId")?.getAttribute("w:val");if(B&&U&&M[U]){Y[B]={};let V=tt(M[U],"w:lvl");for(let Z of V){let Q=Z.getAttribute("w:ilvl"),nt=ut(Z,"w:numFmt"),ot=ut(Z,"w:lvlText");Q&&(Y[B][Q]={numFmt:nt?.getAttribute("w:val")||"decimal",lvlText:ot?.getAttribute("w:val")||""})}}}}let q=f.find(E=>E.path.match(h)),G={};if(q){let E=Zt(q.content.toString()),S=tt(E,"w:style");for(let k of S){let M=k.getAttribute("w:styleId");if(M){let P=ut(k,"w:rPr"),B=ut(k,"w:pPr"),$=P?d(P):{},U,V;if(B){let Z=ut(B,"w:jc");if(Z){let nt=Z.getAttribute("w:val");(nt==="left"||nt==="center"||nt==="right"||nt==="justify")&&(U=nt)}let Q=ut(B,"w:shd");if(Q){let nt=Q.getAttribute("w:fill");nt&&nt!=="auto"&&(V="#"+nt)}}G[M]={formatting:$,alignment:U,backgroundColor:V}}}}let j={};if(q){let E=Zt(q.content.toString()),S=ut(E,"w:docDefaults");if(S){let k=ut(S,"w:rPrDefault");if(k){let M=ut(k,"w:rPr");M&&(j=d(M))}}}let J;if(q){let E=Zt(q.content.toString()),S=tt(E,"w:style");for(let k of S){let M=k.getAttribute("w:type"),P=k.getAttribute("w:default"),B=k.getAttribute("w:styleId");if(M==="paragraph"&&P==="1"&&B){J=B;break}}!J&&G.Normal&&(J="Normal")}let et=[],N=[],X={},O={},C=(E,S)=>{let k=E.toString(),M=ut(E,"w:numPr"),P=!!M,B=ut(E,"w:pPr"),U=(B?ut(B,"w:pStyle"):null)?.getAttribute("w:val"),V=U?U.startsWith("Heading")||U==="Title":!1,Z=U&&G[U]?G[U]:{formatting:{}},Q=Z.alignment;if(B){let lt=ut(B,"w:jc");if(lt){let ct=lt.getAttribute("w:val");(ct==="left"||ct==="center"||ct==="right"||ct==="justify")&&(Q=ct)}}let nt=Z.backgroundColor;if(B){let lt=ut(B,"w:shd");if(lt){let ct=lt.getAttribute("w:fill");ct&&ct!=="auto"&&(nt="#"+ct)}}let ot={...Z.formatting};if(B){let lt=ut(B,"w:rPr");if(lt){let ct=d(lt);for(let rt in ct){let gt=ct[rt];gt===!1?delete ot[rt]:gt!==void 0&&(ot[rt]=gt)}}}let dt="",at=[],pt=lt=>{if(ni(lt)&<.nodeName==="w:r"){let ct=lt,rt=ut(ct,"w:rPr"),gt={};for(let Tt in ot)gt[Tt]=ot[Tt];let wt=rt?ut(rt,"w:rStyle"):null,xe=wt?wt.getAttribute("w:val"):U;if(xe&&G[xe])for(let Tt in G[xe].formatting)gt[Tt]=G[xe].formatting[Tt];if(rt){let Tt=d(rt);for(let At in Tt){let Nt=Tt[At];Nt===!1?delete gt[At]:Nt!==void 0&&(gt[At]=Nt)}}!gt.backgroundColor&&nt&&(gt.backgroundColor=nt);for(let Tt of ct.childNodes)if(ni(Tt)){if(Tt.tagName==="w:t"||Tt.tagName==="t"){let At=Tt,Nt=At.textContent||"";dt+=Nt;let kt={type:"text",text:Nt,formatting:gt};t.includeRawContent&&(kt.rawContent=Qt(At,S,t));let Yt=xe||U||J;Yt&&(kt.metadata={style:Yt}),at.push(kt)}else if(t.includeBreakNodes&&(Tt.tagName==="w:br"||Tt.tagName==="br"||Tt.tagName==="w:cr"||Tt.tagName==="cr")){let At=Tt,Nt=At.getAttribute("w:type"),kt="textWrapping";Nt!==null&&(kt=Nt);let Yt;kt==="textWrapping"&&At.getAttribute("w:clear")!==null&&(Yt=At.getAttribute("w:clear"));let ti={type:"break",metadata:{breakType:kt,clear:Yt}};at.push(ti)}else if(t.includeBreakNodes&&(Tt.tagName==="w:lastRenderedPageBreak"||Tt.tagName==="lastRenderedPageBreak")){let At={type:"break",metadata:{breakType:"lastRenderedPage"}};at.push(At)}}if(t.extractAttachments){let Tt=tt(ct,"w:drawing"),At=tt(ct,"w:pict"),Nt=[...Tt,...At];for(let kt of Nt){let Yt=mg(kt),ti="",R=ut(kt,"wp:docPr");R&&(ti=R.getAttribute("descr")||R.getAttribute("title")||"");let W="",Ct=ut(kt,"a:blip");if(Ct)W=Ct.getAttribute("r:embed")||"";else{let bt=ut(kt,"v:imagedata");bt&&(W=bt.getAttribute("r:id")||"")}if(W&&F[W]){let Et=F[W].split("/").pop();if(Et){let re={type:"image",text:"",metadata:{attachmentName:Et,altText:ti}};t.includeRawContent&&(re.rawContent=Qt(kt,S,t)),at.push(re)}}else{let bt={type:"image",text:""};t.includeRawContent&&(bt.rawContent=Qt(kt,S,t)),at.push(bt)}}}if(!t.ignoreNotes){let Tt=ut(ct,"w:footnoteReference");if(Tt){let Nt=Tt.getAttribute("w:id");if(Nt&&A.has(Nt)){let kt=A.get(Nt),Yt={type:"note",text:kt.map(ti=>ti.text).join(" "),children:kt,metadata:{noteType:"footnote",noteId:Nt}};t.putNotesAtLast?v.push(Yt):at.push(Yt)}}let At=ut(ct,"w:endnoteReference");if(At){let Nt=At.getAttribute("w:id");if(Nt&&w.has(Nt)){let kt=w.get(Nt),Yt={type:"note",text:kt.map(ti=>ti.text).join(" "),children:kt,metadata:{noteType:"endnote",noteId:Nt}};t.putNotesAtLast?v.push(Yt):at.push(Yt)}}}}else if(ni(lt)&<.nodeName==="w:hyperlink"){let ct=lt,rt=ct.getAttribute("r:id"),gt=ct.getAttribute("w:anchor"),wt;gt?wt={link:"#"+gt,linkType:"internal"}:rt&&F[rt]&&(wt={link:F[rt],linkType:"external"});let xe=Array.from(ct.childNodes);for(let Tt of xe){let At=at.length;if(pt(Tt),wt)for(let Nt=At;Nt{let k=[],M=He(E,"w:tr");for(let P=0;Pk.path.match(i));if(E){let k=Zt(E.content.toString()),M=E.content.toString(),P=tt(k,"w:footnote");for(let B of P){let $=B.getAttribute("w:id");if(!$||$==="-1"||$==="0")continue;let U=tt(B,"w:p");A.set($,U.map(V=>C(V,M)))}}let S=f.find(k=>k.path.match(n));if(S){let k=Zt(S.content.toString()),M=S.content.toString(),P=tt(k,"w:endnote");for(let B of P){let $=B.getAttribute("w:id");if(!$||$==="-1"||$==="0")continue;let U=tt(B,"w:p");w.set($,U.map(V=>C(V,M)))}}}for(let E of f){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&&N.push(S);let k=Zt(S,{locator:t.includeRawContent}),M=ut(k,"w:body");if(M){let P=Array.from(M.childNodes);for(let B of P)ni(B)&&B.nodeName==="w:p"?et.push(C(B,S)):ni(B)&&B.nodeName==="w:tbl"&&et.push(D(B,S))}}if(t.extractAttachments){for(let E of I){let S=gr(E.path.split("/").pop()||"image",E.content);if(T.push(S),t.ocr&&S.mimeType.startsWith("image/"))try{S.ocrText=(await Xn(E.content,{language:t.ocrLanguage,...t.ocrConfig})).trim()}catch(k){rn(`OCR failed for ${S.name}:`,t,k)}}if(t.ocr){let E=S=>{for(let k of S){if(k.type==="image"&&"attachmentName"in(k.metadata||{})){let M=k.metadata,P=T.find(B=>B.name===M.attachmentName);P&&P.ocrText&&(k.text=P.ocrText,P.altText=M.altText)}k.children&&E(k.children)}};E(et)}}return t.putNotesAtLast&&v.length>0&&et.push(...v),{type:"docx",metadata:{...y,formatting:j,styleMap:G},content:et,attachments:T,toText:()=>et.map(E=>{let S=k=>{let M="";return k.children?M+=k.children.map(S).filter(P=>P!="").join(k.children[0]?.children?t.newlineDelimiter??` +`:""):M+=k.text||"",M};return S(E)}).filter(E=>E!="").join(t.newlineDelimiter??` `)}};var Ad=class{static async parseOffice(t,e,i){let n,s={};typeof e=="function"?(n=e,s=i||{}):s=e||{};let o={ignoreNotes:!1,newlineDelimiter:` -`,putNotesAtLast:!1,outputErrorToConsole:!1,extractAttachments:!1,ocr:!1,ocrLanguage:"eng",includeRawContent:!1,serializeRawContent:!0,preserveXmlWhitespace:!1,pdfWorkerSrc:"",ocrConfig:{},...s},l=st.Buffer.alloc(0),c="",u;try{if(!t)throw Ms("IMPROPER_ARGUMENTS",o);if(t instanceof ArrayBuffer)l=st.Buffer.from(t);else if(st.Buffer.isBuffer(t))l=t;else if(typeof t=="string"){u=t,Km("path-parsing");let d=await Promise.resolve().then(()=>(ZS(),KS));if(!d.existsSync(t))throw Ms("FILE_DOES_NOT_EXIST",o,t);if(d.lstatSync(t).isDirectory())throw Ms("LOCATION_NOT_FOUND",o,t);l=d.readFileSync(t),c=t.split(".").pop()?.toLowerCase()||""}else throw Ms("INVALID_INPUT",o);if(!c){let{fileTypeFromBuffer:d}=await RS(),f=await d(l);if(f)c=f.ext.toLowerCase();else throw Ms("IMPROPER_BUFFERS",o)}let h;switch(c){case"docx":h=await jS(l,o);break;case"pptx":h=await US(l,o);break;case"xlsx":h=await BE(l,o);break;case"odt":case"odp":case"ods":h=await UE(l,o);break;case"pdf":h=await BS(l,o);break;case"rtf":h=await zS(l,o);break;default:throw Ms("EXTENSION_UNSUPPORTED",o,c)}return n&&n(h),h}catch(h){let d=kv(h,o,u);throw n&&n(void 0,d),d}}static async terminateOcr(){await bE()}};var VL=Ad.parseOffice,qL=Ad.terminateOcr;var WL=Ad;export{Ad as OfficeParser,WL as default,VL as parseOffice,qL as terminateOcr}; +`,putNotesAtLast:!1,outputErrorToConsole:!1,extractAttachments:!1,ocr:!1,ocrLanguage:"eng",includeRawContent:!1,serializeRawContent:!0,preserveXmlWhitespace:!1,pdfWorkerSrc:"",ocrConfig:{},includeBreakNodes:!1,...s},l=st.Buffer.alloc(0),c="",u;try{if(!t)throw Ms("IMPROPER_ARGUMENTS",o);if(t instanceof ArrayBuffer)l=st.Buffer.from(t);else if(st.Buffer.isBuffer(t))l=t;else if(typeof t=="string"){u=t,Km("path-parsing");let d=await Promise.resolve().then(()=>(ZS(),KS));if(!d.existsSync(t))throw Ms("FILE_DOES_NOT_EXIST",o,t);if(d.lstatSync(t).isDirectory())throw Ms("LOCATION_NOT_FOUND",o,t);l=d.readFileSync(t),c=t.split(".").pop()?.toLowerCase()||""}else throw Ms("INVALID_INPUT",o);if(!c){let{fileTypeFromBuffer:d}=await RS(),f=await d(l);if(f)c=f.ext.toLowerCase();else throw Ms("IMPROPER_BUFFERS",o)}let h;switch(c){case"docx":h=await jS(l,o);break;case"pptx":h=await US(l,o);break;case"xlsx":h=await BE(l,o);break;case"odt":case"odp":case"ods":h=await UE(l,o);break;case"pdf":h=await BS(l,o);break;case"rtf":h=await zS(l,o);break;default:throw Ms("EXTENSION_UNSUPPORTED",o,c)}return n&&n(h),h}catch(h){let d=Iv(h,o,u);throw n&&n(void 0,d),d}}static async terminateOcr(){await bE()}};var VL=Ad.parseOffice,qL=Ad.terminateOcr;var WL=Ad;export{Ad as OfficeParser,WL as default,VL as parseOffice,qL as terminateOcr}; /*! Bundled license information: ieee754/index.js: diff --git a/docs/specs/ast_fragment.html b/docs/specs/ast_fragment.html index a440e84..ed19740 100644 --- a/docs/specs/ast_fragment.html +++ b/docs/specs/ast_fragment.html @@ -138,6 +138,11 @@

4. Rich Content

chartData in metadata if requested. +

5. Other

+
    +
  • break: Currently only available for Word documents. breakType in metadata can be used to differentiate between line, (soft) page and column breaks.
  • +
+

Text Formatting

Applied to text, paragraph, or heading nodes.

{
diff --git a/docs/specs/config_fragment.html b/docs/specs/config_fragment.html
index e11cb1e..c231fa1 100644
--- a/docs/specs/config_fragment.html
+++ b/docs/specs/config_fragment.html
@@ -121,6 +121,12 @@ 

OfficeParserConfig

undefined Offline Environments: Paths to Tesseract scripts and data files for air-gapped or customized installations. + + includeBreakNodes + boolean + false + Line/Page Break Parsing: Specifically targets Word documents (DOCX). When set to true, officeParser will also parse w:br, w:cr and w:lastRenderedPageBreak nodes. + diff --git a/src/OfficeParser.ts b/src/OfficeParser.ts index b7e379e..1c14f1c 100644 --- a/src/OfficeParser.ts +++ b/src/OfficeParser.ts @@ -121,6 +121,7 @@ export class OfficeParser { preserveXmlWhitespace: false, pdfWorkerSrc: '', ocrConfig: {}, + includeBreakNodes: false, ...actualConfig }; diff --git a/src/cli.ts b/src/cli.ts index c208108..71692f9 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -102,6 +102,7 @@ if (fileArg) { console.log(' --includeRawContent=true Include raw content in AST'); console.log(' --serializeRawContent=true Serialize raw XML content (default: true)'); console.log(' --preserveXmlWhitespace=true Preserve whitespace in serialized XML (default: false)'); + console.log(' --includeBreakNodes=false Include break nodes (DOCX only, default: false)'); console.log(' --verbose=true Show full error stack traces'); console.log(''); console.log('Examples:'); diff --git a/src/index.ts b/src/index.ts index d585336..da0b16b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -62,7 +62,8 @@ import { CellMetadata, ImageMetadata, PageMetadata, - ContentMetadata + ContentMetadata, + BreakMetadata, } from './types'; const parseOffice = OfficeParser.parseOffice; @@ -88,11 +89,9 @@ export { CellMetadata, ImageMetadata, PageMetadata, - ContentMetadata + ContentMetadata, + BreakMetadata, }; - - // Default export for backward compatibility export default OfficeParser; - diff --git a/src/parsers/WordParser.ts b/src/parsers/WordParser.ts index 47ae7ab..857bc83 100644 --- a/src/parsers/WordParser.ts +++ b/src/parsers/WordParser.ts @@ -34,17 +34,18 @@ * * * ``` - * + * * **Key OOXML Elements:** * - `` - Paragraph * - `` - Run (contiguous text with same formatting) * - `` - Text content + * - `` - Line or page break * - ``, ``, `` - Bold, italic, underline * - `` - Paragraph style (for headings) * - `` - List numbering properties * - `` - Table * - `` - Drawing/image - * + * * **Parsing Approach:** * 1. Extract ZIP contents * 2. Parse word/document.xml for structure and text @@ -53,13 +54,13 @@ * 5. Extract footnotes from word/footnotes.xml * 6. Process embedded images from word/media/* * 7. Parse metadata from docProps/core.xml - * + * * @module WordParser * @see https://www.ecma-international.org/publications-and-standards/standards/ecma-376/ OOXML Standard * @see https://learn.microsoft.com/en-us/openspecs/office_standards/ms-docx/ [MS-DOCX] Specification */ -import { ImageMetadata, ListMetadata, OfficeAttachment, OfficeContentNode, OfficeParserAST, OfficeParserConfig, TextFormatting, TextMetadata } from '../types.js'; +import { BreakMetadata, ImageMetadata, ListMetadata, OfficeAttachment, OfficeContentNode, OfficeParserAST, OfficeParserConfig, TextFormatting, TextMetadata } from '../types.js'; import { logWarning } from '../utils/errorUtils.js'; import { createAttachment } from '../utils/imageUtils.js'; import { performOcr } from '../utils/ocrUtils.js'; @@ -444,26 +445,70 @@ export const parseWord = async (buffer: Buffer, config: OfficeParserConfig): Pro formatting.backgroundColor = paraBackgroundColor; } - // Text content - const tNodes = getElementsByTagName(runNode, "w:t"); - for (const tNode of tNodes) { - const tContent = tNode.textContent || ''; - text += tContent; - const textNode: OfficeContentNode = { - type: 'text', - text: tContent, - formatting: formatting - }; - if (config.includeRawContent) { - textNode.rawContent = getRawContent(tNode, documentContent, config); + for (const child of runNode.childNodes) { + if (!isElement(child)) continue; + + // also handle unprefixed version (mirroring the behaviour of getElementsByTagName) + + // Text content + if (child.tagName === "w:t" || child.tagName === "t") { + const tNode = child; + + const tContent = tNode.textContent || ''; + text += tContent; + const textNode: OfficeContentNode = { + type: 'text', + text: tContent, + formatting: formatting + }; + if (config.includeRawContent) { + textNode.rawContent = getRawContent(tNode, documentContent, config); + } + // Always set a style: run style > paragraph style > detected default + // Use detected default style for international compatibility + const nodeStyle = rStyleVal || pStyleVal || defaultParaStyleId; + if (nodeStyle) { + textNode.metadata = { style: nodeStyle }; + } + children.push(textNode); } - // Always set a style: run style > paragraph style > detected default - // Use detected default style for international compatibility - const nodeStyle = rStyleVal || pStyleVal || defaultParaStyleId; - if (nodeStyle) { - textNode.metadata = { style: nodeStyle }; + // Break nodes + else if (config.includeBreakNodes && + (child.tagName === "w:br" + || child.tagName === "br" + || child.tagName === "w:cr" + || child.tagName === "cr") + ) { + const brNode = child; + + const nodeBreakType = brNode.getAttribute("w:type"); + + // 'textWrapping' is the default break type that should be + // used when w:type is not specified + let breakType: BreakMetadata['breakType'] = 'textWrapping'; + if (nodeBreakType !== null) { + breakType = nodeBreakType as BreakMetadata['breakType']; + } + + let breakClear: BreakMetadata["clear"] = undefined; + if (breakType === 'textWrapping' && brNode.getAttribute("w:clear") !== null) { + breakClear = brNode.getAttribute("w:clear") as BreakMetadata["clear"]; + } + + const breakNode: OfficeContentNode = { + type: 'break', + metadata: { breakType, clear: breakClear } + }; + + children.push(breakNode); + } else if (config.includeBreakNodes && (child.tagName === "w:lastRenderedPageBreak" || child.tagName === "lastRenderedPageBreak")) { + const breakNode: OfficeContentNode = { + type: 'break', + metadata: { breakType: 'lastRenderedPage' } + }; + + children.push(breakNode); } - children.push(textNode); } // Images/Drawings diff --git a/src/types.ts b/src/types.ts index c62818f..bc16334 100644 --- a/src/types.ts +++ b/src/types.ts @@ -112,12 +112,19 @@ export interface OfficeParserConfig { preserveXmlWhitespace?: boolean; /** * The URL/path to the PDF.js worker script. - * + * * **Mandatory** when using PDF parsing in browser environments to avoid worker configuration errors. * If not provided, it defaults to `https://unpkg.com/pdfjs-dist@5.6.205/build/pdf.worker.min.mjs`. * You can override this with your own local path or a different CDN link. */ pdfWorkerSrc?: string; + /** + * Flag to include break nodes in the AST. + * This is currently only supported for Word documents. (w:br nodes) + * + * Default is false + */ + includeBreakNodes?: boolean; } /** @@ -128,7 +135,7 @@ export type SupportedFileType = 'docx' | 'pptx' | 'xlsx' | 'odt' | 'odp' | 'ods' /** * Types of content nodes in the AST. */ -export type OfficeContentNodeType = 'paragraph' | 'heading' | 'table' | 'list' | 'text' | 'image' | 'chart' | 'drawing' | 'slide' | 'note' | 'sheet' | 'row' | 'cell' | 'page'; +export type OfficeContentNodeType = 'paragraph' | 'heading' | 'table' | 'list' | 'text' | 'image' | 'chart' | 'drawing' | 'slide' | 'note' | 'sheet' | 'row' | 'cell' | 'page' | 'break'; /** * Supported MIME types for attachments. @@ -438,10 +445,36 @@ export interface NoteMetadata { noteId?: string; } +/** + * Metadata for break nodes. + * Used in DOCX files to track line and page breaks. + */ +export interface BreakMetadata { + /** + * Type of break. The break type determines the next location where + * text shall be placed. + * - 'column': The next text will be placed in the next column. + * - 'page': The next text will be placed on the next page. + * - 'lastRenderedPage': The editing application has inserted a soft break on the last save. + * - 'textWrapping' (default, assumed when not specified): The next text will be placed on the next line. + */ + breakType: 'column' | 'page' | 'lastRenderedPage' | 'textWrapping'; + + /** + * Specifies the location which shall be used as the next available line when breakType + * has a value of 'textWrapping'. Should be ignored for other break types. + * - 'all': text wrapping break shall advance the text to the next line which spans the full width of the line + * - 'left': text wrapping break shall restart in next text region unblocked on the left + * - 'none': text wrapping break shall advance the text to the next line regardless of any floating objects + * - 'right': text wrapping break shall restart in next text region unblocked on the right + */ + clear?: 'all' | 'left' | 'none' | 'right'; +} + /** * Union type for content metadata. */ -export type ContentMetadata = SlideMetadata | SheetMetadata | HeadingMetadata | ListMetadata | CellMetadata | ImageMetadata | ChartMetadata | PageMetadata | ParagraphMetadata | TextMetadata | NoteMetadata | undefined; +export type ContentMetadata = SlideMetadata | SheetMetadata | HeadingMetadata | ListMetadata | CellMetadata | ImageMetadata | ChartMetadata | PageMetadata | ParagraphMetadata | TextMetadata | NoteMetadata | BreakMetadata | undefined; /** diff --git a/test/baseline/test.docx.json b/test/baseline/test.docx.json index 1bfc196..6d21b64 100644 --- a/test/baseline/test.docx.json +++ b/test/baseline/test.docx.json @@ -412,9 +412,16 @@ { "type": "paragraph", "text": "", - "children": [], + "children": [ + { + "type": "break", + "metadata": { + "breakType": "textWrapping" + } + } + ], "metadata": {}, - "rawContent": "" + "rawContent": "" }, { "type": "heading", @@ -477,10 +484,16 @@ "metadata": { "style": "Normal" } + }, + { + "type": "break", + "metadata": { + "breakType": "textWrapping" + } } ], "metadata": {}, - "rawContent": "Here, we demonstrate various types of inline text formatting and the use of embedded fonts." + "rawContent": "Here, we demonstrate various types of inline text formatting and the use of embedded fonts." }, { "type": "paragraph", diff --git a/test/files/test.docx b/test/files/test.docx index 27da513..a496d52 100644 Binary files a/test/files/test.docx and b/test/files/test.docx differ diff --git a/test/testOfficeParser.ts b/test/testOfficeParser.ts index e078e99..56129d8 100644 --- a/test/testOfficeParser.ts +++ b/test/testOfficeParser.ts @@ -49,7 +49,8 @@ const FULL_CONFIG: Required = { outputErrorToConsole: true, pdfWorkerSrc: '', serializeRawContent: true, - preserveXmlWhitespace: false + preserveXmlWhitespace: false, + includeBreakNodes: true }; /** Config permutations to test */