@pdfme/ui 5.5.8-dev.44 → 5.5.8-dev.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -56,7 +56,7 @@ Defaulting to 2020, but this will stop working in the future.`)),s.ecmaVersion=1
56
56
  `;break;default:a+=String.fromCharCode(c);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),s=this.pos}else++this.pos}},pp.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(types$1.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
57
57
  `&&++this.pos;case`
58
58
  `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")},pp.readEscapedChar=function(a){var s=this.input.charCodeAt(++this.pos);switch(++this.pos,s){case 110:return`
59
- `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),a){var c=this.pos-1;this.invalidStringToken(c,"Invalid escape sequence in template string")}default:if(s>=48&&s<=55){var u=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],d=parseInt(u,8);return d>255&&(u=u.slice(0,-1),d=parseInt(u,8)),this.pos+=u.length-1,s=this.input.charCodeAt(this.pos),(u!=="0"||s===56||s===57)&&(this.strict||a)&&this.invalidStringToken(this.pos-1-u.length,a?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(d)}return isNewLine(s)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(s)}},pp.readHexChar=function(a){var s=this.pos,c=this.readInt(16,a);return c===null&&this.invalidStringToken(s,"Bad character escape sequence"),c},pp.readWord1=function(){this.containsEsc=!1;for(var a="",s=!0,c=this.pos,u=this.options.ecmaVersion>=6;this.pos<this.input.length;){var d=this.fullCharCodeAtPos();if(isIdentifierChar(d,u))this.pos+=d<=65535?1:2;else if(d===92){this.containsEsc=!0,a+=this.input.slice(c,this.pos);var p=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var v=this.readCodePoint();(s?isIdentifierStart:isIdentifierChar)(v,u)||this.invalidStringToken(p,"Invalid Unicode escape"),a+=codePointToString(v),c=this.pos}else break;s=!1}return a+this.input.slice(c,this.pos)},pp.readWord=function(){var a=this.readWord1(),s=types$1.name;return this.keywords.test(a)&&(s=keywords[a]),this.finishToken(s,a)};var version$2="8.16.0";Parser.acorn={Parser,version:version$2,defaultOptions:defaultOptions$1,Position,SourceLocation,getLineInfo,Node,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types$2,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};function parseExpressionAt(a,s,c){return Parser.parseExpressionAt(a,s,c)}const expressionCache=new Map,parseDataCache=new Map,parseData=a=>{const s=JSON.stringify(a);if(parseDataCache.has(s))return parseDataCache.get(s);const c=Object.fromEntries(Object.entries(a).map(([u,d])=>{if(typeof d=="string")try{const p=JSON.parse(d);return[u,p]}catch{return[u,d]}return[u,d]}));return parseDataCache.set(s,c),c},padZero=a=>String(a).padStart(2,"0"),formatDate=a=>`${a.getFullYear()}/${padZero(a.getMonth()+1)}/${padZero(a.getDate())}`,formatDateTime=a=>`${formatDate(a)} ${padZero(a.getHours())}:${padZero(a.getMinutes())}`,safeAssign=(a,...s)=>{if(a==null)throw new TypeError("Cannot convert undefined or null to object");const c={...a};for(const u of s)if(u!=null)for(const d in u)d==="__proto__"||d==="constructor"||d==="prototype"||Object.prototype.hasOwnProperty.call(u,d)&&(c[d]=u[d]);return c},safeObject={keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,is:Object.is,hasOwnProperty:Object.hasOwnProperty,assign:safeAssign},allowedGlobals={Math,String,Number,Boolean,Array,Object:safeObject,Date,JSON,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent},validateAST=a=>{switch(a.type){case"Literal":case"Identifier":break;case"BinaryExpression":case"LogicalExpression":{const s=a;validateAST(s.left),validateAST(s.right);break}case"UnaryExpression":{validateAST(a.argument);break}case"ConditionalExpression":{const s=a;validateAST(s.test),validateAST(s.consequent),validateAST(s.alternate);break}case"MemberExpression":{const s=a;if(validateAST(s.object),s.computed)validateAST(s.property);else{const c=s.property.name;if(["constructor","__proto__","prototype"].includes(c))throw new Error("Access to prohibited property");if(["__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"].includes(c))throw new Error(`Access to prohibited method: ${c}`);if(typeof c=="string"&&["toLocaleString","valueOf"].includes(c))throw new Error(`Access to prohibited method: ${c}`)}break}case"CallExpression":{const s=a;validateAST(s.callee),s.arguments.forEach(validateAST);break}case"ArrayExpression":{a.elements.forEach(c=>{c&&validateAST(c)});break}case"ObjectExpression":{a.properties.forEach(c=>{const u=c;validateAST(u.key),validateAST(u.value)});break}case"ArrowFunctionExpression":{const s=a;s.params.forEach(c=>{if(c.type!=="Identifier")throw new Error("Only identifier parameters are supported in arrow functions");validateAST(c)}),validateAST(s.body);break}default:throw new Error(`Unsupported syntax in placeholder: ${a.type}`)}},evaluateAST=(a,s)=>{switch(a.type){case"Literal":return a.value;case"Identifier":{const c=a;if(Object.prototype.hasOwnProperty.call(s,c.name))return s[c.name];if(Object.prototype.hasOwnProperty.call(allowedGlobals,c.name))return allowedGlobals[c.name];throw new Error(`Undefined variable: ${c.name}`)}case"BinaryExpression":{const c=a,u=evaluateAST(c.left,s),d=evaluateAST(c.right,s);switch(c.operator){case"+":return u+d;case"-":return u-d;case"*":return u*d;case"/":return u/d;case"%":return u%d;case"**":return u**d;case"==":return u==d;case"!=":return u!=d;case"===":return u===d;case"!==":return u!==d;case"<":return u<d;case">":return u>d;case"<=":return u<=d;case">=":return u>=d;default:throw new Error(`Unsupported operator: ${c.operator}`)}}case"LogicalExpression":{const c=a,u=evaluateAST(c.left,s),d=evaluateAST(c.right,s);switch(c.operator){case"&&":return u&&d;case"||":return u||d;default:throw new Error(`Unsupported operator: ${c.operator}`)}}case"UnaryExpression":{const c=a,u=evaluateAST(c.argument,s);switch(c.operator){case"+":return+u;case"-":return-u;case"!":return!u;default:throw new Error(`Unsupported operator: ${c.operator}`)}}case"ConditionalExpression":{const c=a,u=evaluateAST(c.test,s);return evaluateAST(u?c.consequent:c.alternate,s)}case"MemberExpression":{const c=a,u=evaluateAST(c.object,s);let d;if(c.computed?d=evaluateAST(c.property,s):d=c.property.name,typeof d=="string"||typeof d=="number"){if(typeof d=="string"&&["constructor","__proto__","prototype"].includes(d))throw new Error("Access to prohibited property");if(typeof d=="string"&&["__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"].includes(d))throw new Error(`Access to prohibited method: ${d}`);return u[d]}else throw new Error("Invalid property access")}case"CallExpression":{const c=a,u=evaluateAST(c.callee,s),d=c.arguments.map(p=>evaluateAST(p,s));if(typeof u=="function")if(c.callee.type==="MemberExpression"){const p=c.callee,v=evaluateAST(p.object,s);if(v!==null&&(typeof v=="object"||typeof v=="number"||typeof v=="string"||typeof v=="boolean"))return u.call(v,...d);throw new Error("Invalid object in member function call")}else return u(...d);else throw new Error("Attempted to call a non-function")}case"ArrowFunctionExpression":{const c=a,u=c.params.map(p=>p.name),d=c.body;return(...p)=>{const v={...s};return u.forEach((A,x)=>{v[A]=p[x]}),evaluateAST(d,v)}}case"ArrayExpression":return a.elements.map(u=>u?evaluateAST(u,s):null);case"ObjectExpression":{const c=a,u={};return c.properties.forEach(d=>{const p=d;let v;if(p.key.type==="Identifier")v=p.key.name;else{const x=evaluateAST(p.key,s);if(typeof x!="string"&&typeof x!="number")throw new Error("Object property keys must be strings or numbers");v=String(x)}const A=evaluateAST(p.value,s);u[v]=A}),u}default:throw new Error(`Unsupported syntax in placeholder: ${a.type}`)}},evaluatePlaceholders=a=>{const{content:s,context:c}=a;let u="",d=0;for(;d<s.length;){const p=s.indexOf("{",d);if(p===-1){u+=s.slice(d);break}u+=s.slice(d,p);let v=1,A=p+1;for(;A<s.length&&v>0;)s[A]==="{"?v++:s[A]==="}"&&v--,A++;if(v===0){const x=s.slice(p+1,A-1).trim();if(expressionCache.has(x)){const g=expressionCache.get(x);try{const b=g(c);u+=String(b)}catch{u+=s.slice(p,A)}}else try{const g=parseExpressionAt(x,0,{ecmaVersion:"latest"});validateAST(g);const b=f=>evaluateAST(g,f);expressionCache.set(x,b);const y=b(c);u+=String(y)}catch{u+=s.slice(p,A)}d=A}else throw new Error("Invalid placeholder")}return u},replacePlaceholders=a=>{const{content:s,variables:c,schemas:u}=a;if(!s||typeof s!="string"||!s.includes("{")||!s.includes("}"))return s;const d=new Date,p=formatDate(d),v=formatDateTime(d),A={...Object.fromEntries(u.flat().map(b=>[b.name,b.readOnly&&b.content||""])),...c},x=parseData(A),g={date:p,dateTime:v,...x};return Object.entries(g).forEach(([b,y])=>{typeof y=="string"&&y.includes("{")&&y.includes("}")&&(g[b]=evaluatePlaceholders({content:y,context:g}))}),evaluatePlaceholders({content:s,context:g})},pluginRegistry=a=>({plugins:a,entries:()=>Object.entries(a),values:()=>Object.values(a),exists:()=>Object.values(a).length>0,findWithLabelByType(s){for(const[c,u]of Object.entries(this.plugins)){if(!u||typeof u!="object"||!u.propPanel||typeof u.propPanel!="object")continue;const d=u.propPanel.defaultSchema;if(d&&"type"in d&&d.type===s)return[c,u]}return["",void 0]},findByType(s){const[,c]=this.findWithLabelByType(s);return c}}),DEFAULT_LANG="en",DESTROYED_ERR_MSG="[@pdfme/ui] this instance is already destroyed",SELECTABLE_CLASSNAME="selectable",RULER_HEIGHT=30,PAGE_GAP=10,LEFT_SIDEBAR_WIDTH=45,RIGHT_SIDEBAR_WIDTH=400,BACKGROUND_COLOR="rgb(74, 74, 74)",DEFAULT_MAX_ZOOM=2,DESIGNER_CLASSNAME="pdfme-designer-",UI_CLASSNAME="pdfme-ui-",isff=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function addEvent$1(a,s,c,u){a.addEventListener?a.addEventListener(s,c,u):a.attachEvent&&a.attachEvent("on".concat(s),c)}function removeEvent$1(a,s,c,u){a.removeEventListener?a.removeEventListener(s,c,u):a.detachEvent&&a.detachEvent("on".concat(s),c)}function getMods(a,s){const c=s.slice(0,s.length-1);for(let u=0;u<c.length;u++)c[u]=a[c[u].toLowerCase()];return c}function getKeys$1(a){typeof a!="string"&&(a=""),a=a.replace(/\s/g,"");const s=a.split(",");let c=s.lastIndexOf("");for(;c>=0;)s[c-1]+=",",s.splice(c,1),c=s.lastIndexOf("");return s}function compareArray(a,s){const c=a.length>=s.length?a:s,u=a.length>=s.length?s:a;let d=!0;for(let p=0;p<c.length;p++)u.indexOf(c[p])===-1&&(d=!1);return d}const _keyMap={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":isff?173:189,"=":isff?61:187,";":isff?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},_modifier={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,meta:91,command:91},modifierMap={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},_mods={16:!1,18:!1,17:!1,91:!1},_handlers={};for(let a=1;a<20;a++)_keyMap["f".concat(a)]=111+a;let _downKeys=[],winListendFocus=null,_scope="all";const elementEventMap=new Map,code=a=>_keyMap[a.toLowerCase()]||_modifier[a.toLowerCase()]||a.toUpperCase().charCodeAt(0),getKey$3=a=>Object.keys(_keyMap).find(s=>_keyMap[s]===a),getModifier=a=>Object.keys(_modifier).find(s=>_modifier[s]===a);function setScope(a){_scope=a||"all"}function getScope(){return _scope||"all"}function getPressedKeyCodes(){return _downKeys.slice(0)}function getPressedKeyString(){return _downKeys.map(a=>getKey$3(a)||getModifier(a)||String.fromCharCode(a))}function getAllKeyCodes(){const a=[];return Object.keys(_handlers).forEach(s=>{_handlers[s].forEach(c=>{let{key:u,scope:d,mods:p,shortcut:v}=c;a.push({scope:d,shortcut:v,mods:p,keys:u.split("+").map(A=>code(A))})})}),a}function filter$1(a){const s=a.target||a.srcElement,{tagName:c}=s;let u=!0;const d=c==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(s.type);return(s.isContentEditable||(d||c==="TEXTAREA"||c==="SELECT")&&!s.readOnly)&&(u=!1),u}function isPressed(a){return typeof a=="string"&&(a=code(a)),_downKeys.indexOf(a)!==-1}function deleteScope(a,s){let c,u;a||(a=getScope());for(const d in _handlers)if(Object.prototype.hasOwnProperty.call(_handlers,d))for(c=_handlers[d],u=0;u<c.length;)c[u].scope===a?c.splice(u,1).forEach(v=>{let{element:A}=v;return removeKeyEvent(A)}):u++;getScope()===a&&setScope(s||"all")}function clearModifier(a){let s=a.keyCode||a.which||a.charCode;a.key&&a.key.toLowerCase()==="capslock"&&(s=code(a.key));const c=_downKeys.indexOf(s);if(c>=0&&_downKeys.splice(c,1),a.key&&a.key.toLowerCase()==="meta"&&_downKeys.splice(0,_downKeys.length),(s===93||s===224)&&(s=91),s in _mods){_mods[s]=!1;for(const u in _modifier)_modifier[u]===s&&(hotkeys$1[u]=!1)}}function unbind(a){if(typeof a>"u")Object.keys(_handlers).forEach(d=>{Array.isArray(_handlers[d])&&_handlers[d].forEach(p=>eachUnbind(p)),delete _handlers[d]}),removeKeyEvent(null);else if(Array.isArray(a))a.forEach(d=>{d.key&&eachUnbind(d)});else if(typeof a=="object")a.key&&eachUnbind(a);else if(typeof a=="string"){for(var s=arguments.length,c=new Array(s>1?s-1:0),u=1;u<s;u++)c[u-1]=arguments[u];let[d,p]=c;typeof d=="function"&&(p=d,d=""),eachUnbind({key:a,scope:d,method:p,splitKey:"+"})}}const eachUnbind=a=>{let{key:s,scope:c,method:u,splitKey:d="+"}=a;getKeys$1(s).forEach(v=>{const A=v.split(d),x=A.length,g=A[x-1],b=g==="*"?"*":code(g);if(!_handlers[b])return;c||(c=getScope());const y=x>1?getMods(_modifier,A):[],f=[];_handlers[b]=_handlers[b].filter(m=>{const w=(u?m.method===u:!0)&&m.scope===c&&compareArray(m.mods,y);return w&&f.push(m.element),!w}),f.forEach(m=>removeKeyEvent(m))})};function eventHandler(a,s,c,u){if(s.element!==u)return;let d;if(s.scope===c||s.scope==="all"){d=s.mods.length>0;for(const p in _mods)Object.prototype.hasOwnProperty.call(_mods,p)&&(!_mods[p]&&s.mods.indexOf(+p)>-1||_mods[p]&&s.mods.indexOf(+p)===-1)&&(d=!1);(s.mods.length===0&&!_mods[16]&&!_mods[18]&&!_mods[17]&&!_mods[91]||d||s.shortcut==="*")&&(s.keys=[],s.keys=s.keys.concat(_downKeys),s.method(a,s)===!1&&(a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.cancelBubble&&(a.cancelBubble=!0)))}}function dispatch(a,s){const c=_handlers["*"];let u=a.keyCode||a.which||a.charCode;if(a.key&&a.key.toLowerCase()==="capslock"||!hotkeys$1.filter.call(this,a))return;if((u===93||u===224)&&(u=91),_downKeys.indexOf(u)===-1&&u!==229&&_downKeys.push(u),["metaKey","ctrlKey","altKey","shiftKey"].forEach(A=>{const x=modifierMap[A];a[A]&&_downKeys.indexOf(x)===-1?_downKeys.push(x):!a[A]&&_downKeys.indexOf(x)>-1?_downKeys.splice(_downKeys.indexOf(x),1):A==="metaKey"&&a[A]&&(_downKeys=_downKeys.filter(g=>g in modifierMap||g===u))}),u in _mods){_mods[u]=!0;for(const A in _modifier)if(Object.prototype.hasOwnProperty.call(_modifier,A)){const x=modifierMap[_modifier[A]];hotkeys$1[A]=a[x]}if(!c)return}for(const A in _mods)Object.prototype.hasOwnProperty.call(_mods,A)&&(_mods[A]=a[modifierMap[A]]);a.getModifierState&&!(a.altKey&&!a.ctrlKey)&&a.getModifierState("AltGraph")&&(_downKeys.indexOf(17)===-1&&_downKeys.push(17),_downKeys.indexOf(18)===-1&&_downKeys.push(18),_mods[17]=!0,_mods[18]=!0);const d=getScope();if(c)for(let A=0;A<c.length;A++)c[A].scope===d&&(a.type==="keydown"&&c[A].keydown||a.type==="keyup"&&c[A].keyup)&&eventHandler(a,c[A],d,s);if(!(u in _handlers))return;const p=_handlers[u],v=p.length;for(let A=0;A<v;A++)if((a.type==="keydown"&&p[A].keydown||a.type==="keyup"&&p[A].keyup)&&p[A].key){const x=p[A],{splitKey:g}=x,b=x.key.split(g),y=[];for(let f=0;f<b.length;f++)y.push(code(b[f]));y.sort().join("")===_downKeys.sort().join("")&&eventHandler(a,x,d,s)}}function hotkeys$1(a,s,c){_downKeys=[];const u=getKeys$1(a);let d=[],p="all",v=document,A=0,x=!1,g=!0,b="+",y=!1,f=!1;for(c===void 0&&typeof s=="function"&&(c=s),Object.prototype.toString.call(s)==="[object Object]"&&(s.scope&&(p=s.scope),s.element&&(v=s.element),s.keyup&&(x=s.keyup),s.keydown!==void 0&&(g=s.keydown),s.capture!==void 0&&(y=s.capture),typeof s.splitKey=="string"&&(b=s.splitKey),s.single===!0&&(f=!0)),typeof s=="string"&&(p=s),f&&unbind(a,p);A<u.length;A++)a=u[A].split(b),d=[],a.length>1&&(d=getMods(_modifier,a)),a=a[a.length-1],a=a==="*"?"*":code(a),a in _handlers||(_handlers[a]=[]),_handlers[a].push({keyup:x,keydown:g,scope:p,mods:d,shortcut:u[A],method:c,key:u[A],splitKey:b,element:v});if(typeof v<"u"&&window){if(!elementEventMap.has(v)){const m=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;return dispatch(w,v)},E=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.event;dispatch(w,v),clearModifier(w)};elementEventMap.set(v,{keydownListener:m,keyupListenr:E,capture:y}),addEvent$1(v,"keydown",m,y),addEvent$1(v,"keyup",E,y)}if(!winListendFocus){const m=()=>{_downKeys=[]};winListendFocus={listener:m,capture:y},addEvent$1(window,"focus",m,y)}}}function trigger(a){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"all";Object.keys(_handlers).forEach(c=>{_handlers[c].filter(d=>d.scope===s&&d.shortcut===a).forEach(d=>{d&&d.method&&d.method()})})}function removeKeyEvent(a){const s=Object.values(_handlers).flat();if(s.findIndex(u=>{let{element:d}=u;return d===a})<0){const{keydownListener:u,keyupListenr:d,capture:p}=elementEventMap.get(a)||{};u&&d&&(removeEvent$1(a,"keyup",d,p),removeEvent$1(a,"keydown",u,p),elementEventMap.delete(a))}if((s.length<=0||elementEventMap.size<=0)&&(Object.keys(elementEventMap).forEach(d=>{const{keydownListener:p,keyupListenr:v,capture:A}=elementEventMap.get(d)||{};p&&v&&(removeEvent$1(d,"keyup",v,A),removeEvent$1(d,"keydown",p,A),elementEventMap.delete(d))}),elementEventMap.clear(),Object.keys(_handlers).forEach(d=>delete _handlers[d]),winListendFocus)){const{listener:d,capture:p}=winListendFocus;removeEvent$1(window,"focus",d,p),winListendFocus=null}}const _api={getPressedKeyString,setScope,getScope,deleteScope,getPressedKeyCodes,getAllKeyCodes,isPressed,filter:filter$1,trigger,unbind,keyMap:_keyMap,modifier:_modifier,modifierMap};for(const a in _api)Object.prototype.hasOwnProperty.call(_api,a)&&(hotkeys$1[a]=_api[a]);if(typeof window<"u"){const a=window.hotkeys;hotkeys$1.noConflict=s=>(s&&window.hotkeys===hotkeys$1&&(window.hotkeys=a),hotkeys$1),window.hotkeys=hotkeys$1}var reactExports=requireReact();const React=getDefaultExportFromCjs(reactExports),React$1=_mergeNamespaces({__proto__:null,default:React},[reactExports]);function commonjsRequire(a){throw new Error('Could not dynamically require "'+a+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf={exports:{}};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$5=getAugmentedNamespace(__viteBrowserExternal$1);var hasRequiredPdf;function requirePdf(){return hasRequiredPdf||(hasRequiredPdf=1,(function(module,exports$1){(function(s,c){module.exports=s.pdfjsLib=c()})(globalThis,()=>(()=>{var __webpack_modules__=[,((a,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.VerbosityLevel=s.Util=s.UnknownErrorException=s.UnexpectedResponseException=s.TextRenderingMode=s.RenderingIntentFlag=s.PromiseCapability=s.PermissionFlag=s.PasswordResponses=s.PasswordException=s.PageActionEventType=s.OPS=s.MissingPDFException=s.MAX_IMAGE_SIZE_TO_CACHE=s.LINE_FACTOR=s.LINE_DESCENT_FACTOR=s.InvalidPDFException=s.ImageKind=s.IDENTITY_MATRIX=s.FormatError=s.FeatureTest=s.FONT_IDENTITY_MATRIX=s.DocumentActionEventType=s.CMapCompressionType=s.BaseException=s.BASELINE_FACTOR=s.AnnotationType=s.AnnotationReplyType=s.AnnotationPrefix=s.AnnotationMode=s.AnnotationFlag=s.AnnotationFieldFlag=s.AnnotationEditorType=s.AnnotationEditorPrefix=s.AnnotationEditorParamsType=s.AnnotationBorderStyleType=s.AnnotationActionEventType=s.AbortException=void 0,s.assert=k,s.bytesToString=ae,s.createValidAbsoluteUrl=W,s.getModificationDate=Ae,s.getUuid=Te,s.getVerbosityLevel=U,s.info=M,s.isArrayBuffer=we,s.isArrayEqual=$e,s.isNodeJS=void 0,s.normalizeUnicode=Ie,s.objectFromMap=pe,s.objectSize=fe,s.setVerbosityLevel=G,s.shadow=J,s.string32=se,s.stringToBytes=oe,s.stringToPDFString=ye,s.stringToUTF8String=Ee,s.unreachable=R,s.utf8StringToString=xe,s.warn=N;const c=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");s.isNodeJS=c;const u=[1,0,0,1,0,0];s.IDENTITY_MATRIX=u;const d=[.001,0,0,.001,0,0];s.FONT_IDENTITY_MATRIX=d;const p=1e7;s.MAX_IMAGE_SIZE_TO_CACHE=p;const v=1.35;s.LINE_FACTOR=v;const A=.35;s.LINE_DESCENT_FACTOR=A;const x=A/v;s.BASELINE_FACTOR=x;const g={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};s.RenderingIntentFlag=g;const b={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};s.AnnotationMode=b;const y="pdfjs_internal_editor_";s.AnnotationEditorPrefix=y;const f={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15};s.AnnotationEditorType=f;const m={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23};s.AnnotationEditorParamsType=m;const E={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};s.PermissionFlag=E;const w={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};s.TextRenderingMode=w;const S={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};s.ImageKind=S;const $={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};s.AnnotationType=$;const T={GROUP:"Group",REPLY:"R"};s.AnnotationReplyType=T;const _={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};s.AnnotationFlag=_;const I={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};s.AnnotationFieldFlag=I;const C={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};s.AnnotationBorderStyleType=C;const P={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};s.AnnotationActionEventType=P;const O={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};s.DocumentActionEventType=O;const L={O:"PageOpen",C:"PageClose"};s.PageActionEventType=L;const B={ERRORS:0,WARNINGS:1,INFOS:5};s.VerbosityLevel=B;const F={NONE:0,BINARY:1};s.CMapCompressionType=F;const D={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};s.OPS=D;const V={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};s.PasswordResponses=V;let j=B.WARNINGS;function G(Re){Number.isInteger(Re)&&(j=Re)}function U(){return j}function M(Re){j>=B.INFOS&&console.log(`Info: ${Re}`)}function N(Re){j>=B.WARNINGS&&console.log(`Warning: ${Re}`)}function R(Re){throw new Error(Re)}function k(Re,Be){Re||R(Be)}function z(Re){switch(Re?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function W(Re,Be=null,Pe=null){if(!Re)return null;try{if(Pe&&typeof Re=="string"&&(Pe.addDefaultProtocol&&Re.startsWith("www.")&&Re.match(/\./g)?.length>=2&&(Re=`http://${Re}`),Pe.tryConvertEncoding))try{Re=Ee(Re)}catch{}const Me=Be?new URL(Re,Be):new URL(Re);if(z(Me))return Me}catch{}return null}function J(Re,Be,Pe,Me=!1){return Object.defineProperty(Re,Be,{value:Pe,enumerable:!Me,configurable:!0,writable:!1}),Pe}const re=(function(){function Be(Pe,Me){this.constructor===Be&&R("Cannot initialize BaseException."),this.message=Pe,this.name=Me}return Be.prototype=new Error,Be.constructor=Be,Be})();s.BaseException=re;class K extends re{constructor(Be,Pe){super(Be,"PasswordException"),this.code=Pe}}s.PasswordException=K;class q extends re{constructor(Be,Pe){super(Be,"UnknownErrorException"),this.details=Pe}}s.UnknownErrorException=q;class Q extends re{constructor(Be){super(Be,"InvalidPDFException")}}s.InvalidPDFException=Q;class ee extends re{constructor(Be){super(Be,"MissingPDFException")}}s.MissingPDFException=ee;class Y extends re{constructor(Be,Pe){super(Be,"UnexpectedResponseException"),this.status=Pe}}s.UnexpectedResponseException=Y;class Z extends re{constructor(Be){super(Be,"FormatError")}}s.FormatError=Z;class te extends re{constructor(Be){super(Be,"AbortException")}}s.AbortException=te;function ae(Re){(typeof Re!="object"||Re?.length===void 0)&&R("Invalid argument for bytesToString");const Be=Re.length,Pe=8192;if(Be<Pe)return String.fromCharCode.apply(null,Re);const Me=[];for(let Fe=0;Fe<Be;Fe+=Pe){const Ue=Math.min(Fe+Pe,Be),ze=Re.subarray(Fe,Ue);Me.push(String.fromCharCode.apply(null,ze))}return Me.join("")}function oe(Re){typeof Re!="string"&&R("Invalid argument for stringToBytes");const Be=Re.length,Pe=new Uint8Array(Be);for(let Me=0;Me<Be;++Me)Pe[Me]=Re.charCodeAt(Me)&255;return Pe}function se(Re){return String.fromCharCode(Re>>24&255,Re>>16&255,Re>>8&255,Re&255)}function fe(Re){return Object.keys(Re).length}function pe(Re){const Be=Object.create(null);for(const[Pe,Me]of Re)Be[Pe]=Me;return Be}function ge(){const Re=new Uint8Array(4);return Re[0]=1,new Uint32Array(Re.buffer,0,1)[0]===1}function me(){try{return new Function(""),!0}catch{return!1}}class be{static get isLittleEndian(){return J(this,"isLittleEndian",ge())}static get isEvalSupported(){return J(this,"isEvalSupported",me())}static get isOffscreenCanvasSupported(){return J(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?J(this,"platform",{isWin:!1,isMac:!1}):J(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){return J(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}s.FeatureTest=be;const le=[...Array(256).keys()].map(Re=>Re.toString(16).padStart(2,"0"));class ve{static makeHexColor(Be,Pe,Me){return`#${le[Be]}${le[Pe]}${le[Me]}`}static scaleMinMax(Be,Pe){let Me;Be[0]?(Be[0]<0&&(Me=Pe[0],Pe[0]=Pe[1],Pe[1]=Me),Pe[0]*=Be[0],Pe[1]*=Be[0],Be[3]<0&&(Me=Pe[2],Pe[2]=Pe[3],Pe[3]=Me),Pe[2]*=Be[3],Pe[3]*=Be[3]):(Me=Pe[0],Pe[0]=Pe[2],Pe[2]=Me,Me=Pe[1],Pe[1]=Pe[3],Pe[3]=Me,Be[1]<0&&(Me=Pe[2],Pe[2]=Pe[3],Pe[3]=Me),Pe[2]*=Be[1],Pe[3]*=Be[1],Be[2]<0&&(Me=Pe[0],Pe[0]=Pe[1],Pe[1]=Me),Pe[0]*=Be[2],Pe[1]*=Be[2]),Pe[0]+=Be[4],Pe[1]+=Be[4],Pe[2]+=Be[5],Pe[3]+=Be[5]}static transform(Be,Pe){return[Be[0]*Pe[0]+Be[2]*Pe[1],Be[1]*Pe[0]+Be[3]*Pe[1],Be[0]*Pe[2]+Be[2]*Pe[3],Be[1]*Pe[2]+Be[3]*Pe[3],Be[0]*Pe[4]+Be[2]*Pe[5]+Be[4],Be[1]*Pe[4]+Be[3]*Pe[5]+Be[5]]}static applyTransform(Be,Pe){const Me=Be[0]*Pe[0]+Be[1]*Pe[2]+Pe[4],Fe=Be[0]*Pe[1]+Be[1]*Pe[3]+Pe[5];return[Me,Fe]}static applyInverseTransform(Be,Pe){const Me=Pe[0]*Pe[3]-Pe[1]*Pe[2],Fe=(Be[0]*Pe[3]-Be[1]*Pe[2]+Pe[2]*Pe[5]-Pe[4]*Pe[3])/Me,Ue=(-Be[0]*Pe[1]+Be[1]*Pe[0]+Pe[4]*Pe[1]-Pe[5]*Pe[0])/Me;return[Fe,Ue]}static getAxialAlignedBoundingBox(Be,Pe){const Me=this.applyTransform(Be,Pe),Fe=this.applyTransform(Be.slice(2,4),Pe),Ue=this.applyTransform([Be[0],Be[3]],Pe),ze=this.applyTransform([Be[2],Be[1]],Pe);return[Math.min(Me[0],Fe[0],Ue[0],ze[0]),Math.min(Me[1],Fe[1],Ue[1],ze[1]),Math.max(Me[0],Fe[0],Ue[0],ze[0]),Math.max(Me[1],Fe[1],Ue[1],ze[1])]}static inverseTransform(Be){const Pe=Be[0]*Be[3]-Be[1]*Be[2];return[Be[3]/Pe,-Be[1]/Pe,-Be[2]/Pe,Be[0]/Pe,(Be[2]*Be[5]-Be[4]*Be[3])/Pe,(Be[4]*Be[1]-Be[5]*Be[0])/Pe]}static singularValueDecompose2dScale(Be){const Pe=[Be[0],Be[2],Be[1],Be[3]],Me=Be[0]*Pe[0]+Be[1]*Pe[2],Fe=Be[0]*Pe[1]+Be[1]*Pe[3],Ue=Be[2]*Pe[0]+Be[3]*Pe[2],ze=Be[2]*Pe[1]+Be[3]*Pe[3],Le=(Me+ze)/2,ke=Math.sqrt((Me+ze)**2-4*(Me*ze-Ue*Fe))/2,je=Le+ke||1,Xe=Le-ke||1;return[Math.sqrt(je),Math.sqrt(Xe)]}static normalizeRect(Be){const Pe=Be.slice(0);return Be[0]>Be[2]&&(Pe[0]=Be[2],Pe[2]=Be[0]),Be[1]>Be[3]&&(Pe[1]=Be[3],Pe[3]=Be[1]),Pe}static intersect(Be,Pe){const Me=Math.max(Math.min(Be[0],Be[2]),Math.min(Pe[0],Pe[2])),Fe=Math.min(Math.max(Be[0],Be[2]),Math.max(Pe[0],Pe[2]));if(Me>Fe)return null;const Ue=Math.max(Math.min(Be[1],Be[3]),Math.min(Pe[1],Pe[3])),ze=Math.min(Math.max(Be[1],Be[3]),Math.max(Pe[1],Pe[3]));return Ue>ze?null:[Me,Ue,Fe,ze]}static bezierBoundingBox(Be,Pe,Me,Fe,Ue,ze,Le,ke){const je=[],Xe=[[],[]];let it,tt,ht,ft,qe,Je,ct,ot;for(let yt=0;yt<2;++yt){if(yt===0?(tt=6*Be-12*Me+6*Ue,it=-3*Be+9*Me-9*Ue+3*Le,ht=3*Me-3*Be):(tt=6*Pe-12*Fe+6*ze,it=-3*Pe+9*Fe-9*ze+3*ke,ht=3*Fe-3*Pe),Math.abs(it)<1e-12){if(Math.abs(tt)<1e-12)continue;ft=-ht/tt,0<ft&&ft<1&&je.push(ft);continue}ct=tt*tt-4*ht*it,ot=Math.sqrt(ct),!(ct<0)&&(qe=(-tt+ot)/(2*it),0<qe&&qe<1&&je.push(qe),Je=(-tt-ot)/(2*it),0<Je&&Je<1&&je.push(Je))}let Ke=je.length,Ze;const st=Ke;for(;Ke--;)ft=je[Ke],Ze=1-ft,Xe[0][Ke]=Ze*Ze*Ze*Be+3*Ze*Ze*ft*Me+3*Ze*ft*ft*Ue+ft*ft*ft*Le,Xe[1][Ke]=Ze*Ze*Ze*Pe+3*Ze*Ze*ft*Fe+3*Ze*ft*ft*ze+ft*ft*ft*ke;return Xe[0][st]=Be,Xe[1][st]=Pe,Xe[0][st+1]=Le,Xe[1][st+1]=ke,Xe[0].length=Xe[1].length=st+2,[Math.min(...Xe[0]),Math.min(...Xe[1]),Math.max(...Xe[0]),Math.max(...Xe[1])]}}s.Util=ve;const he=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function ye(Re){if(Re[0]>="ï"){let Pe;if(Re[0]==="þ"&&Re[1]==="ÿ"?Pe="utf-16be":Re[0]==="ÿ"&&Re[1]==="þ"?Pe="utf-16le":Re[0]==="ï"&&Re[1]==="»"&&Re[2]==="¿"&&(Pe="utf-8"),Pe)try{const Me=new TextDecoder(Pe,{fatal:!0}),Fe=oe(Re);return Me.decode(Fe)}catch(Me){N(`stringToPDFString: "${Me}".`)}}const Be=[];for(let Pe=0,Me=Re.length;Pe<Me;Pe++){const Fe=he[Re.charCodeAt(Pe)];Be.push(Fe?String.fromCharCode(Fe):Re.charAt(Pe))}return Be.join("")}function Ee(Re){return decodeURIComponent(escape(Re))}function xe(Re){return unescape(encodeURIComponent(Re))}function we(Re){return typeof Re=="object"&&Re?.byteLength!==void 0}function $e(Re,Be){if(Re.length!==Be.length)return!1;for(let Pe=0,Me=Re.length;Pe<Me;Pe++)if(Re[Pe]!==Be[Pe])return!1;return!0}function Ae(Re=new Date){return[Re.getUTCFullYear().toString(),(Re.getUTCMonth()+1).toString().padStart(2,"0"),Re.getUTCDate().toString().padStart(2,"0"),Re.getUTCHours().toString().padStart(2,"0"),Re.getUTCMinutes().toString().padStart(2,"0"),Re.getUTCSeconds().toString().padStart(2,"0")].join("")}class ue{#e=!1;constructor(){this.promise=new Promise((Be,Pe)=>{this.resolve=Me=>{this.#e=!0,Be(Me)},this.reject=Me=>{this.#e=!0,Pe(Me)}})}get settled(){return this.#e}}s.PromiseCapability=ue;let ce=null,Ce=null;function Ie(Re){return ce||(ce=/([\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,Ce=new Map([["ſt","ſt"]])),Re.replaceAll(ce,(Be,Pe,Me)=>Pe?Pe.normalize("NFKC"):Ce.get(Me))}function Te(){if(typeof crypto<"u"&&typeof crypto?.randomUUID=="function")return crypto.randomUUID();const Re=new Uint8Array(32);if(typeof crypto<"u"&&typeof crypto?.getRandomValues=="function")crypto.getRandomValues(Re);else for(let Be=0;Be<32;Be++)Re[Be]=Math.floor(Math.random()*255);return ae(Re)}const De="pdfjs_internal_id_";s.AnnotationPrefix=De}),((__unused_webpack_module,exports$1,__w_pdfjs_require__)=>{Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.RenderTask=exports$1.PDFWorkerUtil=exports$1.PDFWorker=exports$1.PDFPageProxy=exports$1.PDFDocumentProxy=exports$1.PDFDocumentLoadingTask=exports$1.PDFDataRangeTransport=exports$1.LoopbackPort=exports$1.DefaultStandardFontDataFactory=exports$1.DefaultFilterFactory=exports$1.DefaultCanvasFactory=exports$1.DefaultCMapReaderFactory=void 0,Object.defineProperty(exports$1,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports$1.build=void 0,exports$1.getDocument=getDocument,exports$1.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports$1.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports$1.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports$1.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports$1.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;function getDocument(a){if(typeof a=="string"||a instanceof URL?a={url:a}:(0,_util.isArrayBuffer)(a)&&(a={data:a}),typeof a!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!a.url&&!a.data&&!a.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const s=new PDFDocumentLoadingTask,{docId:c}=s,u=a.url?getUrlProp(a.url):null,d=a.data?getDataProp(a.data):null,p=a.httpHeaders||null,v=a.withCredentials===!0,A=a.password??null,x=a.range instanceof PDFDataRangeTransport?a.range:null,g=Number.isInteger(a.rangeChunkSize)&&a.rangeChunkSize>0?a.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let b=a.worker instanceof PDFWorker?a.worker:null;const y=a.verbosity,f=typeof a.docBaseUrl=="string"&&!(0,_display_utils.isDataScheme)(a.docBaseUrl)?a.docBaseUrl:null,m=typeof a.cMapUrl=="string"?a.cMapUrl:null,E=a.cMapPacked!==!1,w=a.CMapReaderFactory||DefaultCMapReaderFactory,S=typeof a.standardFontDataUrl=="string"?a.standardFontDataUrl:null,$=a.StandardFontDataFactory||DefaultStandardFontDataFactory,T=a.stopAtErrors!==!0,_=Number.isInteger(a.maxImageSize)&&a.maxImageSize>-1?a.maxImageSize:-1,I=a.isEvalSupported!==!1,C=typeof a.isOffscreenCanvasSupported=="boolean"?a.isOffscreenCanvasSupported:!_util.isNodeJS,P=Number.isInteger(a.canvasMaxAreaInBytes)?a.canvasMaxAreaInBytes:-1,O=typeof a.disableFontFace=="boolean"?a.disableFontFace:_util.isNodeJS,L=a.fontExtraProperties===!0,B=a.enableXfa===!0,F=a.ownerDocument||globalThis.document,D=a.disableRange===!0,V=a.disableStream===!0,j=a.disableAutoFetch===!0,G=a.pdfBug===!0,U=x?x.length:a.length??NaN,M=typeof a.useSystemFonts=="boolean"?a.useSystemFonts:!_util.isNodeJS&&!O,N=typeof a.useWorkerFetch=="boolean"?a.useWorkerFetch:w===_display_utils.DOMCMapReaderFactory&&$===_display_utils.DOMStandardFontDataFactory&&m&&S&&(0,_display_utils.isValidFetchUrl)(m,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(S,document.baseURI),R=a.canvasFactory||new DefaultCanvasFactory({ownerDocument:F}),k=a.filterFactory||new DefaultFilterFactory({docId:c,ownerDocument:F}),z=null;(0,_util.setVerbosityLevel)(y);const W={canvasFactory:R,filterFactory:k};if(N||(W.cMapReaderFactory=new w({baseUrl:m,isCompressed:E}),W.standardFontDataFactory=new $({baseUrl:S})),!b){const K={verbosity:y,port:_worker_options.GlobalWorkerOptions.workerPort};b=K.port?PDFWorker.fromPort(K):new PDFWorker(K),s._worker=b}const J={docId:c,apiVersion:"3.11.174",data:d,password:A,disableAutoFetch:j,rangeChunkSize:g,length:U,docBaseUrl:f,enableXfa:B,evaluatorOptions:{maxImageSize:_,disableFontFace:O,ignoreErrors:T,isEvalSupported:I,isOffscreenCanvasSupported:C,canvasMaxAreaInBytes:P,fontExtraProperties:L,useSystemFonts:M,cMapUrl:N?m:null,standardFontDataUrl:N?S:null}},re={ignoreErrors:T,isEvalSupported:I,disableFontFace:O,fontExtraProperties:L,enableXfa:B,ownerDocument:F,disableAutoFetch:j,pdfBug:G,styleElement:z};return b.promise.then(function(){if(s.destroyed)throw new Error("Loading aborted");const K=_fetchDocument(b,J),q=new Promise(function(Q){let ee;x?ee=new _transport_stream.PDFDataTransportStream({length:U,initialData:x.initialData,progressiveDone:x.progressiveDone,contentDispositionFilename:x.contentDispositionFilename,disableRange:D,disableStream:V},x):d||(ee=(Z=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(Z):(0,_display_utils.isValidFetchUrl)(Z.url)?new _displayFetch_stream.PDFFetchStream(Z):new _displayNetwork.PDFNetworkStream(Z))({url:u,length:U,httpHeaders:p,withCredentials:v,rangeChunkSize:g,disableRange:D,disableStream:V})),Q(ee)});return Promise.all([K,q]).then(function([Q,ee]){if(s.destroyed)throw new Error("Loading aborted");const Y=new _message_handler.MessageHandler(c,Q,b.port),Z=new WorkerTransport(Y,s,ee,re,W);s._transport=Z,Y.send("Ready",null)})}).catch(s._capability.reject),s}async function _fetchDocument(a,s){if(a.destroyed)throw new Error("Worker was destroyed");const c=await a.messageHandler.sendWithPromise("GetDocRequest",s,s.data?[s.data.buffer]:null);if(a.destroyed)throw new Error("Worker was destroyed");return c}function getUrlProp(a){if(a instanceof URL)return a.href;try{return new URL(a,window.location).href}catch{if(_util.isNodeJS&&typeof a=="string")return a}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(a){if(_util.isNodeJS&&typeof Buffer<"u"&&a instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength)return a;if(typeof a=="string")return(0,_util.stringToBytes)(a);if(typeof a=="object"&&!isNaN(a?.length)||(0,_util.isArrayBuffer)(a))return new Uint8Array(a);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}class PDFDocumentLoadingTask{static#e=0;constructor(){this._capability=new _util.PromiseCapability,this._transport=null,this._worker=null,this.docId=`d${PDFDocumentLoadingTask.#e++}`,this.destroyed=!1,this.onPassword=null,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(s){throw this._worker?.port&&delete this._worker._pendingDestroy,s}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}exports$1.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(s,c,u=!1,d=null){this.length=s,this.initialData=c,this.progressiveDone=u,this.contentDispositionFilename=d,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(s){this._rangeListeners.push(s)}addProgressListener(s){this._progressListeners.push(s)}addProgressiveReadListener(s){this._progressiveReadListeners.push(s)}addProgressiveDoneListener(s){this._progressiveDoneListeners.push(s)}onDataRange(s,c){for(const u of this._rangeListeners)u(s,c)}onDataProgress(s,c){this._readyCapability.promise.then(()=>{for(const u of this._progressListeners)u(s,c)})}onDataProgressiveRead(s){this._readyCapability.promise.then(()=>{for(const c of this._progressiveReadListeners)c(s)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const s of this._progressiveDoneListeners)s()})}transportReady(){this._readyCapability.resolve()}requestDataRange(s,c){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports$1.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(s,c){this._pdfInfo=s,this._transport=c,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then(u=>{if(!u)return u;const d=[];for(const p in u)d.push(...u[p]);return d}))})}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(s){return this._transport.getPage(s)}getPageIndex(s){return this._transport.getPageIndex(s)}getDestinations(){return this._transport.getDestinations()}getDestination(s){return this._transport.getDestination(s)}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()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}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()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(s=!1){return this._transport.startCleanup(s||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}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()}}exports$1.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{#e=null;#t=!1;constructor(s,c,u,d=!1){this._pageIndex=s,this._pageInfo=c,this._transport=u,this._stats=d?new _display_utils.StatTimer:null,this._pdfBug=d,this.commonObjs=u.commonObjs,this.objs=new PDFObjects,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}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:s,rotation:c=this.rotate,offsetX:u=0,offsetY:d=0,dontFlip:p=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:s,rotation:c,offsetX:u,offsetY:d,dontFlip:p})}getAnnotations({intent:s="display"}={}){const c=this._transport.getRenderingIntent(s);return this._transport.getAnnotations(this._pageIndex,c.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:s,viewport:c,intent:u="display",annotationMode:d=_util.AnnotationMode.ENABLE,transform:p=null,background:v=null,optionalContentConfigPromise:A=null,annotationCanvasMap:x=null,pageColors:g=null,printAnnotationStorage:b=null}){this._stats?.time("Overall");const y=this._transport.getRenderingIntent(u,d,b);this.#t=!1,this.#n(),A||(A=this._transport.getOptionalContentConfig());let f=this._intentStates.get(y.cacheKey);f||(f=Object.create(null),this._intentStates.set(y.cacheKey,f)),f.streamReaderCancelTimeout&&(clearTimeout(f.streamReaderCancelTimeout),f.streamReaderCancelTimeout=null);const m=!!(y.renderingIntent&_util.RenderingIntentFlag.PRINT);f.displayReadyCapability||(f.displayReadyCapability=new _util.PromiseCapability,f.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(y));const E=$=>{f.renderTasks.delete(w),(this._maybeCleanupAfterRender||m)&&(this.#t=!0),this.#r(!m),$?(w.capability.reject($),this._abortOperatorList({intentState:f,reason:$ instanceof Error?$:new Error($)})):w.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},w=new InternalRenderTask({callback:E,params:{canvasContext:s,viewport:c,transform:p,background:v},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:x,operatorList:f.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!m,pdfBug:this._pdfBug,pageColors:g});(f.renderTasks||=new Set).add(w);const S=w.task;return Promise.all([f.displayReadyCapability.promise,A]).then(([$,T])=>{if(this.destroyed){E();return}this._stats?.time("Rendering"),w.initializeGraphics({transparency:$,optionalContentConfig:T}),w.operatorListChanged()}).catch(E),S}getOperatorList({intent:s="display",annotationMode:c=_util.AnnotationMode.ENABLE,printAnnotationStorage:u=null}={}){function d(){v.operatorList.lastChunk&&(v.opListReadCapability.resolve(v.operatorList),v.renderTasks.delete(A))}const p=this._transport.getRenderingIntent(s,c,u,!0);let v=this._intentStates.get(p.cacheKey);v||(v=Object.create(null),this._intentStates.set(p.cacheKey,v));let A;return v.opListReadCapability||(A=Object.create(null),A.operatorListChanged=d,v.opListReadCapability=new _util.PromiseCapability,(v.renderTasks||=new Set).add(A),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(p)),v.opListReadCapability.promise}streamTextContent({includeMarkedContent:s=!1,disableNormalization:c=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:s===!0,disableNormalization:c===!0},{highWaterMark:100,size(d){return d.items.length}})}getTextContent(s={}){if(this._transport._htmlForXfa)return this.getXfa().then(u=>_xfa_text.XfaText.textContent(u));const c=this.streamTextContent(s);return new Promise(function(u,d){function p(){v.read().then(function({value:x,done:g}){if(g){u(A);return}Object.assign(A.styles,x.styles),A.items.push(...x.items),p()},d)}const v=c.getReader(),A={items:[],styles:Object.create(null)};p()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const s=[];for(const c of this._intentStates.values())if(this._abortOperatorList({intentState:c,reason:new Error("Page was destroyed."),force:!0}),!c.opListReadCapability)for(const u of c.renderTasks)s.push(u.completed),u.cancel();return this.objs.clear(),this.#t=!1,this.#n(),Promise.all(s)}cleanup(s=!1){this.#t=!0;const c=this.#r(!1);return s&&c&&(this._stats&&=new _display_utils.StatTimer),c}#r(s=!1){if(this.#n(),!this.#t||this.destroyed)return!1;if(s)return this.#e=setTimeout(()=>{this.#e=null,this.#r(!1)},DELAYED_CLEANUP_TIMEOUT),!1;for(const{renderTasks:c,operatorList:u}of this._intentStates.values())if(c.size>0||!u.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}#n(){this.#e&&(clearTimeout(this.#e),this.#e=null)}_startRenderPage(s,c){const u=this._intentStates.get(c);u&&(this._stats?.timeEnd("Page Request"),u.displayReadyCapability?.resolve(s))}_renderPageChunk(s,c){for(let u=0,d=s.length;u<d;u++)c.operatorList.fnArray.push(s.fnArray[u]),c.operatorList.argsArray.push(s.argsArray[u]);c.operatorList.lastChunk=s.lastChunk,c.operatorList.separateAnnots=s.separateAnnots;for(const u of c.renderTasks)u.operatorListChanged();s.lastChunk&&this.#r(!0)}_pumpOperatorList({renderingIntent:s,cacheKey:c,annotationStorageSerializable:u}){const{map:d,transfers:p}=u,A=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:s,cacheKey:c,annotationStorage:d},p).getReader(),x=this._intentStates.get(c);x.streamReader=A;const g=()=>{A.read().then(({value:b,done:y})=>{if(y){x.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(b,x),g())},b=>{if(x.streamReader=null,!this._transport.destroyed){if(x.operatorList){x.operatorList.lastChunk=!0;for(const y of x.renderTasks)y.operatorListChanged();this.#r(!0)}if(x.displayReadyCapability)x.displayReadyCapability.reject(b);else if(x.opListReadCapability)x.opListReadCapability.reject(b);else throw b}})};g()}_abortOperatorList({intentState:s,reason:c,force:u=!1}){if(s.streamReader){if(s.streamReaderCancelTimeout&&(clearTimeout(s.streamReaderCancelTimeout),s.streamReaderCancelTimeout=null),!u){if(s.renderTasks.size>0)return;if(c instanceof _display_utils.RenderingCancelledException){let d=RENDERING_CANCELLED_TIMEOUT;c.extraDelay>0&&c.extraDelay<1e3&&(d+=c.extraDelay),s.streamReaderCancelTimeout=setTimeout(()=>{s.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:s,reason:c,force:!0})},d);return}}if(s.streamReader.cancel(new _util.AbortException(c.message)).catch(()=>{}),s.streamReader=null,!this._transport.destroyed){for(const[d,p]of this._intentStates)if(p===s){this._intentStates.delete(d);break}this.cleanup()}}}get stats(){return this._stats}}exports$1.PDFPageProxy=PDFPageProxy;class LoopbackPort{#e=new Set;#t=Promise.resolve();postMessage(s,c){const u={data:structuredClone(s,c?{transfer:c}:null)};this.#t.then(()=>{for(const d of this.#e)d.call(this,u)})}addEventListener(s,c){this.#e.add(c)}removeEventListener(s,c){this.#e.delete(c)}terminate(){this.#e.clear()}}exports$1.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports$1.PDFWorkerUtil=PDFWorkerUtil;{if(_util.isNodeJS&&typeof commonjsRequire=="function")PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if(typeof document=="object"){const a=document?.currentScript?.src;a&&(PDFWorkerUtil.fallbackWorkerSrc=a.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(a,s){let c;try{if(c=new URL(a),!c.origin||c.origin==="null")return!1}catch{return!1}const u=new URL(s,c);return c.origin===u.origin},PDFWorkerUtil.createCDNWrapper=function(a){const s=`importScripts("${a}");`;return URL.createObjectURL(new Blob([s]))}}class PDFWorker{static#workerPorts;constructor({name:a=null,port:s=null,verbosity:c=(0,_util.getVerbosityLevel)()}={}){if(this.name=a,this.destroyed=!1,this.verbosity=c,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,s){if(PDFWorker.#workerPorts?.has(s))throw new Error("Cannot use more than one PDFWorker per port.");(PDFWorker.#workerPorts||=new WeakMap).set(s,this),this._initializeFromPort(s);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(a){this._port=a,this._messageHandler=new _message_handler.MessageHandler("main","worker",a),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:a}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,a)||(a=PDFWorkerUtil.createCDNWrapper(new URL(a,window.location).href));const s=new Worker(a),c=new _message_handler.MessageHandler("main","worker",s),u=()=>{s.removeEventListener("error",d),c.destroy(),s.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},d=()=>{this._webWorker||u()};s.addEventListener("error",d),c.on("test",v=>{if(s.removeEventListener("error",d),this.destroyed){u();return}v?(this._messageHandler=c,this._port=s,this._webWorker=s,this._readyCapability.resolve(),c.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),c.destroy(),s.terminate())}),c.on("ready",v=>{if(s.removeEventListener("error",d),this.destroyed){u();return}try{p()}catch{this._setupFakeWorker()}});const p=()=>{const v=new Uint8Array;c.send("test",v,[v.buffer])};p();return}catch{(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),PDFWorker._setupFakeWorkerGlobal.then(a=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const s=new LoopbackPort;this._port=s;const c=`fake${PDFWorkerUtil.fakeWorkerId++}`,u=new _message_handler.MessageHandler(c+"_worker",c,s);a.setup(u,s);const d=new _message_handler.MessageHandler(c,c+"_worker",s);this._messageHandler=d,this._readyCapability.resolve(),d.send("configure",{verbosity:this.verbosity})}).catch(a=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${a.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),PDFWorker.#workerPorts?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(a){if(!a?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const s=this.#workerPorts?.get(a.port);if(s){if(s._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return s}return new PDFWorker(a)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _util.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS&&typeof commonjsRequire=="function"){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports$1.PDFWorker=PDFWorker;class WorkerTransport{#e=new Map;#t=new Map;#r=new Map;#n=null;constructor(s,c,u,d,p){this.messageHandler=s,this.loadingTask=c,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:d.ownerDocument,styleElement:d.styleElement}),this._params=d,this.canvasFactory=p.canvasFactory,this.filterFactory=p.filterFactory,this.cMapReaderFactory=p.cMapReaderFactory,this.standardFontDataFactory=p.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=u,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}#s(s,c=null){const u=this.#e.get(s);if(u)return u;const d=this.messageHandler.sendWithPromise(s,c);return this.#e.set(s,d),d}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(s,c=_util.AnnotationMode.ENABLE,u=null,d=!1){let p=_util.RenderingIntentFlag.DISPLAY,v=_annotation_storage.SerializableEmpty;switch(s){case"any":p=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":p=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${s}`)}switch(c){case _util.AnnotationMode.DISABLE:p+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:p+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:p+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,v=(p&_util.RenderingIntentFlag.PRINT&&u instanceof _annotation_storage.PrintAnnotationStorage?u:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${c}`)}return d&&(p+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:p,cacheKey:`${p}_${v.hash}`,annotationStorageSerializable:v}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,this.#n?.reject(new Error("Worker was destroyed during onPassword callback"));const s=[];for(const u of this.#t.values())s.push(u._destroy());this.#t.clear(),this.#r.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const c=this.messageHandler.sendWithPromise("Terminate",null);return s.push(c),Promise.all(s).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),this._networkStream?.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:s,loadingTask:c}=this;s.on("GetReader",(u,d)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=p=>{this._lastProgress={loaded:p.loaded,total:p.total}},d.onPull=()=>{this._fullReader.read().then(function({value:p,done:v}){if(v){d.close();return}(0,_util.assert)(p instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),d.enqueue(new Uint8Array(p),1,[p])}).catch(p=>{d.error(p)})},d.onCancel=p=>{this._fullReader.cancel(p),d.ready.catch(v=>{if(!this.destroyed)throw v})}}),s.on("ReaderHeadersReady",u=>{const d=new _util.PromiseCapability,p=this._fullReader;return p.headersReady.then(()=>{(!p.isStreamingSupported||!p.isRangeSupported)&&(this._lastProgress&&c.onProgress?.(this._lastProgress),p.onProgress=v=>{c.onProgress?.({loaded:v.loaded,total:v.total})}),d.resolve({isStreamingSupported:p.isStreamingSupported,isRangeSupported:p.isRangeSupported,contentLength:p.contentLength})},d.reject),d.promise}),s.on("GetRangeReader",(u,d)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const p=this._networkStream.getRangeReader(u.begin,u.end);if(!p){d.close();return}d.onPull=()=>{p.read().then(function({value:v,done:A}){if(A){d.close();return}(0,_util.assert)(v instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),d.enqueue(new Uint8Array(v),1,[v])}).catch(v=>{d.error(v)})},d.onCancel=v=>{p.cancel(v),d.ready.catch(A=>{if(!this.destroyed)throw A})}}),s.on("GetDoc",({pdfInfo:u})=>{this._numPages=u.numPages,this._htmlForXfa=u.htmlForXfa,delete u.htmlForXfa,c._capability.resolve(new PDFDocumentProxy(u,this))}),s.on("DocException",function(u){let d;switch(u.name){case"PasswordException":d=new _util.PasswordException(u.message,u.code);break;case"InvalidPDFException":d=new _util.InvalidPDFException(u.message);break;case"MissingPDFException":d=new _util.MissingPDFException(u.message);break;case"UnexpectedResponseException":d=new _util.UnexpectedResponseException(u.message,u.status);break;case"UnknownErrorException":d=new _util.UnknownErrorException(u.message,u.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}c._capability.reject(d)}),s.on("PasswordRequest",u=>{if(this.#n=new _util.PromiseCapability,c.onPassword){const d=p=>{p instanceof Error?this.#n.reject(p):this.#n.resolve({password:p})};try{c.onPassword(d,u.code)}catch(p){this.#n.reject(p)}}else this.#n.reject(new _util.PasswordException(u.message,u.code));return this.#n.promise}),s.on("DataLoaded",u=>{c.onProgress?.({loaded:u.length,total:u.length}),this.downloadInfoCapability.resolve(u)}),s.on("StartRenderPage",u=>{if(this.destroyed)return;this.#t.get(u.pageIndex)._startRenderPage(u.transparency,u.cacheKey)}),s.on("commonobj",([u,d,p])=>{if(!this.destroyed&&!this.commonObjs.has(u))switch(d){case"Font":const v=this._params;if("error"in p){const g=p.error;(0,_util.warn)(`Error during font loading: ${g}`),this.commonObjs.resolve(u,g);break}const A=v.pdfBug&&globalThis.FontInspector?.enabled?(g,b)=>globalThis.FontInspector.fontAdded(g,b):null,x=new _font_loader.FontFaceObject(p,{isEvalSupported:v.isEvalSupported,disableFontFace:v.disableFontFace,ignoreErrors:v.ignoreErrors,inspectFont:A});this.fontLoader.bind(x).catch(g=>s.sendWithPromise("FontFallback",{id:u})).finally(()=>{!v.fontExtraProperties&&x.data&&(x.data=null),this.commonObjs.resolve(u,x)});break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(u,p);break;default:throw new Error(`Got unknown common object type ${d}`)}}),s.on("obj",([u,d,p,v])=>{if(this.destroyed)return;const A=this.#t.get(d);if(!A.objs.has(u))switch(p){case"Image":if(A.objs.resolve(u,v),v){let x;if(v.bitmap){const{width:g,height:b}=v;x=g*b*4}else x=v.data?.length||0;x>_util.MAX_IMAGE_SIZE_TO_CACHE&&(A._maybeCleanupAfterRender=!0)}break;case"Pattern":A.objs.resolve(u,v);break;default:throw new Error(`Got unknown object type ${p}`)}}),s.on("DocProgress",u=>{this.destroyed||c.onProgress?.({loaded:u.loaded,total:u.total})}),s.on("FetchBuiltInCMap",u=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(u):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),s.on("FetchStandardFontData",u=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(u):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:s,transfers:c}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:s,filename:this._fullReader?.filename??null},c).finally(()=>{this.annotationStorage.resetModified()})}getPage(s){if(!Number.isInteger(s)||s<=0||s>this._numPages)return Promise.reject(new Error("Invalid page request."));const c=s-1,u=this.#r.get(c);if(u)return u;const d=this.messageHandler.sendWithPromise("GetPage",{pageIndex:c}).then(p=>{if(this.destroyed)throw new Error("Transport destroyed");const v=new PDFPageProxy(c,p,this,this._params.pdfBug);return this.#t.set(c,v),v});return this.#r.set(c,d),d}getPageIndex(s){return typeof s!="object"||s===null||!Number.isInteger(s.num)||s.num<0||!Number.isInteger(s.gen)||s.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:s.num,gen:s.gen})}getAnnotations(s,c){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:s,intent:c})}getFieldObjects(){return this.#s("GetFieldObjects")}hasJSActions(){return this.#s("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(s){return typeof s!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:s})}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)}getDocJSActions(){return this.#s("GetDocJSActions")}getPageJSActions(s){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:s})}getStructTree(s){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:s})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(s=>new _optional_content_config.OptionalContentConfig(s))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const s="GetMetadata",c=this.#e.get(s);if(c)return c;const u=this.messageHandler.sendWithPromise(s,null).then(d=>({info:d[0],metadata:d[1]?new _metadata.Metadata(d[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(s,u),u}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(s=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const c of this.#t.values())if(!c.cleanup())throw new Error(`startCleanup: Page ${c.pageNumber} is currently rendering.`);this.commonObjs.clear(),s||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:s,enableXfa:c}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:s,enableXfa:c})}}class PDFObjects{#e=Object.create(null);#t(s){return this.#e[s]||={capability:new _util.PromiseCapability,data:null}}get(s,c=null){if(c){const d=this.#t(s);return d.capability.promise.then(()=>c(d.data)),null}const u=this.#e[s];if(!u?.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${s}.`);return u.data}has(s){return this.#e[s]?.capability.settled||!1}resolve(s,c=null){const u=this.#t(s);u.data=c,u.capability.resolve()}clear(){for(const s in this.#e){const{data:c}=this.#e[s];c?.bitmap?.close()}this.#e=Object.create(null)}}class RenderTask{#e=null;constructor(s){this.#e=s,this.onContinue=null}get promise(){return this.#e.capability.promise}cancel(s=0){this.#e.cancel(null,s)}get separateAnnots(){const{separateAnnots:s}=this.#e.operatorList;if(!s)return!1;const{annotationCanvasMap:c}=this.#e;return s.form||s.canvas&&c?.size>0}}exports$1.RenderTask=RenderTask;class InternalRenderTask{static#e=new WeakSet;constructor({callback:s,params:c,objs:u,commonObjs:d,annotationCanvasMap:p,operatorList:v,pageIndex:A,canvasFactory:x,filterFactory:g,useRequestAnimationFrame:b=!1,pdfBug:y=!1,pageColors:f=null}){this.callback=s,this.params=c,this.objs=u,this.commonObjs=d,this.annotationCanvasMap=p,this.operatorListIdx=null,this.operatorList=v,this._pageIndex=A,this.canvasFactory=x,this.filterFactory=g,this._pdfBug=y,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=b===!0&&typeof window<"u",this.cancelled=!1,this.capability=new _util.PromiseCapability,this.task=new RenderTask(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=c.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:s=!1,optionalContentConfig:c}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#e.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.");InternalRenderTask.#e.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());const{canvasContext:u,viewport:d,transform:p,background:v}=this.params;this.gfx=new _canvas.CanvasGraphics(u,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:c},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:p,viewport:d,transparency:s,background:v}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(s=null,c=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),InternalRenderTask.#e.delete(this._canvas),this.callback(s||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,c))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}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?window.requestAnimationFrame(()=>{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.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),InternalRenderTask.#e.delete(this._canvas),this.callback())))}}const version="3.11.174";exports$1.version=version;const build="ce8716743";exports$1.build=build}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SerializableEmpty=s.PrintAnnotationStorage=s.AnnotationStorage=void 0;var u=c(1),d=c(4),p=c(8);const v=Object.freeze({map:null,hash:"",transfers:void 0});s.SerializableEmpty=v;class A{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(b,y){const f=this.#t.get(b);return f===void 0?y:Object.assign(y,f)}getRawValue(b){return this.#t.get(b)}remove(b){if(this.#t.delete(b),this.#t.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const y of this.#t.values())if(y instanceof d.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(b,y){const f=this.#t.get(b);let m=!1;if(f!==void 0)for(const[E,w]of Object.entries(y))f[E]!==w&&(m=!0,f[E]=w);else m=!0,this.#t.set(b,y);m&&this.#r(),y instanceof d.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(y.constructor._type)}has(b){return this.#t.has(b)}getAll(){return this.#t.size>0?(0,u.objectFromMap)(this.#t):null}setAll(b){for(const[y,f]of Object.entries(b))this.setValue(y,f)}get size(){return this.#t.size}#r(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new x(this)}get serializable(){if(this.#t.size===0)return v;const b=new Map,y=new p.MurmurHash3_64,f=[],m=Object.create(null);let E=!1;for(const[w,S]of this.#t){const $=S instanceof d.AnnotationEditor?S.serialize(!1,m):S;$&&(b.set(w,$),y.update(`${w}:${JSON.stringify($)}`),E||=!!$.bitmap)}if(E)for(const w of b.values())w.bitmap&&f.push(w.bitmap);return b.size>0?{map:b,hash:y.hexdigest(),transfers:f}:v}}s.AnnotationStorage=A;class x extends A{#e;constructor(b){super();const{map:y,hash:f,transfers:m}=b.serializable,E=structuredClone(y,m?{transfer:m}:null);this.#e={map:E,hash:f,transfers:m}}get print(){(0,u.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}}s.PrintAnnotationStorage=x}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AnnotationEditor=void 0;var u=c(5),d=c(1),p=c(6);class v{#e="";#t=!1;#r=null;#n=null;#s=null;#o=!1;#i=null;#l=this.focusin.bind(this);#c=this.focusout.bind(this);#a=!1;#p=!1;#d=!1;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#f=!1;#h=v._zIndex++;static _borderLineWidth=-1;static _colorManager=new u.ColorManager;static _zIndex=1;static SMALL_EDITOR_SIZE=0;constructor(g){this.constructor===v&&(0,d.unreachable)("Cannot initialize AnnotationEditor."),this.parent=g.parent,this.id=g.id,this.width=this.height=null,this.pageIndex=g.parent.pageIndex,this.name=g.name,this.div=null,this._uiManager=g.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=g.isCentered,this._structTreeParentId=null;const{rotation:b,rawDims:{pageWidth:y,pageHeight:f,pageX:m,pageY:E}}=this.parent.viewport;this.rotation=b,this.pageRotation=(360+b-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[y,f],this.pageTranslation=[m,E];const[w,S]=this.parentDimensions;this.x=g.x/w,this.y=g.y/S,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,d.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(g){const b=new A({id:g.parent.getNextId(),parent:g.parent,uiManager:g._uiManager});b.annotationElementId=g.annotationElementId,b.deleted=!0,b._uiManager.addToAnnotationStorage(b)}static initialize(g,b=null){if(v._l10nPromise||=new Map(["editor_alt_text_button_label","editor_alt_text_edit_button_label","editor_alt_text_decorative_tooltip"].map(f=>[f,g.get(f)])),b?.strings)for(const f of b.strings)v._l10nPromise.set(f,g.get(f));if(v._borderLineWidth!==-1)return;const y=getComputedStyle(document.documentElement);v._borderLineWidth=parseFloat(y.getPropertyValue("--outline-width"))||0}static updateDefaultParams(g,b){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(g){return!1}static paste(g,b){(0,d.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#f}set _isDraggable(g){this.#f=g,this.div?.classList.toggle("draggable",g)}center(){const[g,b]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*b/(g*2),this.y+=this.width*g/(b*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*b/(g*2),this.y-=this.width*g/(b*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(g){this._uiManager.addCommands(g)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#h}setParent(g){g!==null&&(this.pageIndex=g.pageIndex,this.pageDimensions=g.pageDimensions),this.parent=g}focusin(g){this._focusEventsAllowed&&(this.#a?this.#a=!1:this.parent.setSelected(this))}focusout(g){!this._focusEventsAllowed||!this.isAttachedToDOM||g.relatedTarget?.closest(`#${this.id}`)||(g.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(g,b,y,f){const[m,E]=this.parentDimensions;[y,f]=this.screenToPageTranslation(y,f),this.x=(g+y)/m,this.y=(b+f)/E,this.fixAndSetPosition()}#A([g,b],y,f){[y,f]=this.screenToPageTranslation(y,f),this.x+=y/g,this.y+=f/b,this.fixAndSetPosition()}translate(g,b){this.#A(this.parentDimensions,g,b)}translateInPage(g,b){this.#A(this.pageDimensions,g,b),this.div.scrollIntoView({block:"nearest"})}drag(g,b){const[y,f]=this.parentDimensions;if(this.x+=g/y,this.y+=b/f,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:$,y:T}=this.div.getBoundingClientRect();this.parent.findNewParent(this,$,T)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:m,y:E}=this;const[w,S]=this.#m();m+=w,E+=S,this.div.style.left=`${(100*m).toFixed(2)}%`,this.div.style.top=`${(100*E).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}#m(){const[g,b]=this.parentDimensions,{_borderLineWidth:y}=v,f=y/g,m=y/b;switch(this.rotation){case 90:return[-f,m];case 180:return[f,m];case 270:return[f,-m];default:return[-f,-m]}}fixAndSetPosition(){const[g,b]=this.pageDimensions;let{x:y,y:f,width:m,height:E}=this;switch(m*=g,E*=b,y*=g,f*=b,this.rotation){case 0:y=Math.max(0,Math.min(g-m,y)),f=Math.max(0,Math.min(b-E,f));break;case 90:y=Math.max(0,Math.min(g-E,y)),f=Math.min(b,Math.max(m,f));break;case 180:y=Math.min(g,Math.max(m,y)),f=Math.min(b,Math.max(E,f));break;case 270:y=Math.min(g,Math.max(E,y)),f=Math.max(0,Math.min(b-m,f));break}this.x=y/=g,this.y=f/=b;const[w,S]=this.#m();y+=w,f+=S;const{style:$}=this.div;$.left=`${(100*y).toFixed(2)}%`,$.top=`${(100*f).toFixed(2)}%`,this.moveInDOM()}static#g(g,b,y){switch(y){case 90:return[b,-g];case 180:return[-g,-b];case 270:return[-b,g];default:return[g,b]}}screenToPageTranslation(g,b){return v.#g(g,b,this.parentRotation)}pageTranslationToScreen(g,b){return v.#g(g,b,360-this.parentRotation)}#u(g){switch(g){case 90:{const[b,y]=this.pageDimensions;return[0,-b/y,y/b,0]}case 180:return[-1,0,0,-1];case 270:{const[b,y]=this.pageDimensions;return[0,b/y,-y/b,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:g,pageDimensions:[b,y]}=this,f=b*g,m=y*g;return d.FeatureTest.isCSSRoundSupported?[Math.round(f),Math.round(m)]:[f,m]}setDims(g,b){const[y,f]=this.parentDimensions;this.div.style.width=`${(100*g/y).toFixed(2)}%`,this.#o||(this.div.style.height=`${(100*b/f).toFixed(2)}%`),this.#r?.classList.toggle("small",g<v.SMALL_EDITOR_SIZE||b<v.SMALL_EDITOR_SIZE)}fixDims(){const{style:g}=this.div,{height:b,width:y}=g,f=y.endsWith("%"),m=!this.#o&&b.endsWith("%");if(f&&m)return;const[E,w]=this.parentDimensions;f||(g.width=`${(100*parseFloat(y)/E).toFixed(2)}%`),!this.#o&&!m&&(g.height=`${(100*parseFloat(b)/w).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#v(){if(this.#i)return;this.#i=document.createElement("div"),this.#i.classList.add("resizers");const g=["topLeft","topRight","bottomRight","bottomLeft"];this._willKeepAspectRatio||g.push("topMiddle","middleRight","bottomMiddle","middleLeft");for(const b of g){const y=document.createElement("div");this.#i.append(y),y.classList.add("resizer",b),y.addEventListener("pointerdown",this.#C.bind(this,b)),y.addEventListener("contextmenu",p.noContextMenu)}this.div.prepend(this.#i)}#C(g,b){b.preventDefault();const{isMac:y}=d.FeatureTest.platform;if(b.button!==0||b.ctrlKey&&y)return;const f=this.#E.bind(this,g),m=this._isDraggable;this._isDraggable=!1;const E={passive:!0,capture:!0};window.addEventListener("pointermove",f,E);const w=this.x,S=this.y,$=this.width,T=this.height,_=this.parent.div.style.cursor,I=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(b.target).cursor;const C=()=>{this._isDraggable=m,window.removeEventListener("pointerup",C),window.removeEventListener("blur",C),window.removeEventListener("pointermove",f,E),this.parent.div.style.cursor=_,this.div.style.cursor=I;const P=this.x,O=this.y,L=this.width,B=this.height;P===w&&O===S&&L===$&&B===T||this.addCommands({cmd:()=>{this.width=L,this.height=B,this.x=P,this.y=O;const[F,D]=this.parentDimensions;this.setDims(F*L,D*B),this.fixAndSetPosition()},undo:()=>{this.width=$,this.height=T,this.x=w,this.y=S;const[F,D]=this.parentDimensions;this.setDims(F*$,D*T),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener("pointerup",C),window.addEventListener("blur",C)}#E(g,b){const[y,f]=this.parentDimensions,m=this.x,E=this.y,w=this.width,S=this.height,$=v.MIN_SIZE/y,T=v.MIN_SIZE/f,_=q=>Math.round(q*1e4)/1e4,I=this.#u(this.rotation),C=(q,Q)=>[I[0]*q+I[2]*Q,I[1]*q+I[3]*Q],P=this.#u(360-this.rotation),O=(q,Q)=>[P[0]*q+P[2]*Q,P[1]*q+P[3]*Q];let L,B,F=!1,D=!1;switch(g){case"topLeft":F=!0,L=(q,Q)=>[0,0],B=(q,Q)=>[q,Q];break;case"topMiddle":L=(q,Q)=>[q/2,0],B=(q,Q)=>[q/2,Q];break;case"topRight":F=!0,L=(q,Q)=>[q,0],B=(q,Q)=>[0,Q];break;case"middleRight":D=!0,L=(q,Q)=>[q,Q/2],B=(q,Q)=>[0,Q/2];break;case"bottomRight":F=!0,L=(q,Q)=>[q,Q],B=(q,Q)=>[0,0];break;case"bottomMiddle":L=(q,Q)=>[q/2,Q],B=(q,Q)=>[q/2,0];break;case"bottomLeft":F=!0,L=(q,Q)=>[0,Q],B=(q,Q)=>[q,0];break;case"middleLeft":D=!0,L=(q,Q)=>[0,Q/2],B=(q,Q)=>[q,Q/2];break}const V=L(w,S),j=B(w,S);let G=C(...j);const U=_(m+G[0]),M=_(E+G[1]);let N=1,R=1,[k,z]=this.screenToPageTranslation(b.movementX,b.movementY);if([k,z]=O(k/y,z/f),F){const q=Math.hypot(w,S);N=R=Math.max(Math.min(Math.hypot(j[0]-V[0]-k,j[1]-V[1]-z)/q,1/w,1/S),$/w,T/S)}else D?N=Math.max($,Math.min(1,Math.abs(j[0]-V[0]-k)))/w:R=Math.max(T,Math.min(1,Math.abs(j[1]-V[1]-z)))/S;const W=_(w*N),J=_(S*R);G=C(...B(W,J));const re=U-G[0],K=M-G[1];this.width=W,this.height=J,this.x=re,this.y=K,this.setDims(y*W,f*J),this.fixAndSetPosition()}async addAltTextButton(){if(this.#r)return;const g=this.#r=document.createElement("button");g.className="altText";const b=await v._l10nPromise.get("editor_alt_text_button_label");g.textContent=b,g.setAttribute("aria-label",b),g.tabIndex="0",g.addEventListener("contextmenu",p.noContextMenu),g.addEventListener("pointerdown",y=>y.stopPropagation()),g.addEventListener("click",y=>{y.preventDefault(),this._uiManager.editAltText(this)},{capture:!0}),g.addEventListener("keydown",y=>{y.target===g&&y.key==="Enter"&&(y.preventDefault(),this._uiManager.editAltText(this))}),this.#$(),this.div.append(g),v.SMALL_EDITOR_SIZE||(v.SMALL_EDITOR_SIZE=Math.min(128,Math.round(g.getBoundingClientRect().width*1.4)))}async#$(){const g=this.#r;if(!g)return;if(!this.#e&&!this.#t){g.classList.remove("done"),this.#n?.remove();return}v._l10nPromise.get("editor_alt_text_edit_button_label").then(y=>{g.setAttribute("aria-label",y)});let b=this.#n;if(!b){this.#n=b=document.createElement("span"),b.className="tooltip",b.setAttribute("role","tooltip");const y=b.id=`alt-text-tooltip-${this.id}`;g.setAttribute("aria-describedby",y);const f=100;g.addEventListener("mouseenter",()=>{this.#s=setTimeout(()=>{this.#s=null,this.#n.classList.add("show"),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"alt_text_tooltip"}}})},f)}),g.addEventListener("mouseleave",()=>{clearTimeout(this.#s),this.#s=null,this.#n?.classList.remove("show")})}g.classList.add("done"),b.innerText=this.#t?await v._l10nPromise.get("editor_alt_text_decorative_tooltip"):this.#e,b.parentNode||g.append(b)}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:this.#e,decorative:this.#t}}set altTextData({altText:g,decorative:b}){this.#e===g&&this.#t===b||(this.#e=g,this.#t=b,this.#$())}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",this.#l),this.div.addEventListener("focusout",this.#c);const[g,b]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*b/g).toFixed(2)}%`,this.div.style.maxHeight=`${(100*g/b).toFixed(2)}%`);const[y,f]=this.getInitialTranslation();return this.translate(y,f),(0,u.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(g){const{isMac:b}=d.FeatureTest.platform;if(g.button!==0||g.ctrlKey&&b){g.preventDefault();return}this.#a=!0,this.#I(g)}#I(g){if(!this._isDraggable)return;const b=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let y,f;b&&(y={passive:!0,capture:!0},f=E=>{const[w,S]=this.screenToPageTranslation(E.movementX,E.movementY);this._uiManager.dragSelectedEditors(w,S)},window.addEventListener("pointermove",f,y));const m=()=>{if(window.removeEventListener("pointerup",m),window.removeEventListener("blur",m),b&&window.removeEventListener("pointermove",f,y),this.#a=!1,!this._uiManager.endDragSession()){const{isMac:E}=d.FeatureTest.platform;g.ctrlKey&&!E||g.shiftKey||g.metaKey&&E?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener("pointerup",m),window.addEventListener("blur",m)}moveInDOM(){this.parent?.moveEditorInDOM(this)}_setParentAndPosition(g,b,y){g.changeParent(this),this.x=b,this.y=y,this.fixAndSetPosition()}getRect(g,b){const y=this.parentScale,[f,m]=this.pageDimensions,[E,w]=this.pageTranslation,S=g/y,$=b/y,T=this.x*f,_=this.y*m,I=this.width*f,C=this.height*m;switch(this.rotation){case 0:return[T+S+E,m-_-$-C+w,T+S+I+E,m-_-$+w];case 90:return[T+$+E,m-_+S+w,T+$+C+E,m-_+S+I+w];case 180:return[T-S-I+E,m-_+$+w,T-S+E,m-_+$+C+w];case 270:return[T-$-C+E,m-_-S-I+w,T-$+E,m-_-S+w];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(g,b){const[y,f,m,E]=g,w=m-y,S=E-f;switch(this.rotation){case 0:return[y,b-E,w,S];case 90:return[y,b-f,S,w];case 180:return[m,b-f,w,S];case 270:return[m,b-E,S,w];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#d=!0}disableEditMode(){this.#d=!1}isInEditMode(){return this.#d}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#l),this.div?.addEventListener("focusout",this.#c)}serialize(g=!1,b=null){(0,d.unreachable)("An editor must be serializable")}static deserialize(g,b,y){const f=new this.prototype.constructor({parent:b,id:b.getNextId(),uiManager:y});f.rotation=g.rotation;const[m,E]=f.pageDimensions,[w,S,$,T]=f.getRectInCurrentCoords(g.rect,E);return f.x=w/m,f.y=S/E,f.width=$/m,f.height=T/E,f}remove(){this.div.removeEventListener("focusin",this.#l),this.div.removeEventListener("focusout",this.#c),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#r?.remove(),this.#r=null,this.#n=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#v(),this.#i.classList.remove("hidden"))}select(){this.makeResizable(),this.div?.classList.add("selectedEditor")}unselect(){this.#i?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(g,b){}disableEditing(){this.#r&&(this.#r.hidden=!0)}enableEditing(){this.#r&&(this.#r.hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return this.#p}set isEditing(g){this.#p=g,this.parent&&(g?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(g,b){this.#o=!0;const y=g/b,{style:f}=this.div;f.aspectRatio=y,f.height="auto"}static get MIN_SIZE(){return 16}}s.AnnotationEditor=v;class A extends v{constructor(g){super(g),this.annotationElementId=g.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.KeyboardManager=s.CommandManager=s.ColorManager=s.AnnotationEditorUIManager=void 0,s.bindEvents=p,s.opacityToHex=v;var u=c(1),d=c(6);function p(m,E,w){for(const S of w)E.addEventListener(S,m[S].bind(m))}function v(m){return Math.round(Math.min(255,Math.max(1,255*m))).toString(16).padStart(2,"0")}class A{#e=0;getId(){return`${u.AnnotationEditorPrefix}${this.#e++}`}}class x{#e=(0,u.getUuid)();#t=0;#r=null;static get _isSVGFittingCanvas(){const E='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',S=new OffscreenCanvas(1,3).getContext("2d"),$=new Image;$.src=E;const T=$.decode().then(()=>(S.drawImage($,0,0,1,1,0,0,1,3),new Uint32Array(S.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,u.shadow)(this,"_isSVGFittingCanvas",T)}async#n(E,w){this.#r||=new Map;let S=this.#r.get(E);if(S===null)return null;if(S?.bitmap)return S.refCounter+=1,S;try{S||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let $;if(typeof w=="string"){S.url=w;const T=await fetch(w);if(!T.ok)throw new Error(T.statusText);$=await T.blob()}else $=S.file=w;if($.type==="image/svg+xml"){const T=x._isSVGFittingCanvas,_=new FileReader,I=new Image,C=new Promise((P,O)=>{I.onload=()=>{S.bitmap=I,S.isSvg=!0,P()},_.onload=async()=>{const L=S.svgUrl=_.result;I.src=await T?`${L}#svgView(preserveAspectRatio(none))`:L},I.onerror=_.onerror=O});_.readAsDataURL($),await C}else S.bitmap=await createImageBitmap($);S.refCounter=1}catch($){console.error($),S=null}return this.#r.set(E,S),S&&this.#r.set(S.id,S),S}async getFromFile(E){const{lastModified:w,name:S,size:$,type:T}=E;return this.#n(`${w}_${S}_${$}_${T}`,E)}async getFromUrl(E){return this.#n(E,E)}async getFromId(E){this.#r||=new Map;const w=this.#r.get(E);return w?w.bitmap?(w.refCounter+=1,w):w.file?this.getFromFile(w.file):this.getFromUrl(w.url):null}getSvgUrl(E){const w=this.#r.get(E);return w?.isSvg?w.svgUrl:null}deleteId(E){this.#r||=new Map;const w=this.#r.get(E);w&&(w.refCounter-=1,w.refCounter===0&&(w.bitmap=null))}isValidId(E){return E.startsWith(`image_${this.#e}_`)}}class g{#e=[];#t=!1;#r;#n=-1;constructor(E=128){this.#r=E}add({cmd:E,undo:w,mustExec:S,type:$=NaN,overwriteIfSameType:T=!1,keepUndo:_=!1}){if(S&&E(),this.#t)return;const I={cmd:E,undo:w,type:$};if(this.#n===-1){this.#e.length>0&&(this.#e.length=0),this.#n=0,this.#e.push(I);return}if(T&&this.#e[this.#n].type===$){_&&(I.undo=this.#e[this.#n].undo),this.#e[this.#n]=I;return}const C=this.#n+1;C===this.#r?this.#e.splice(0,1):(this.#n=C,C<this.#e.length&&this.#e.splice(C)),this.#e.push(I)}undo(){this.#n!==-1&&(this.#t=!0,this.#e[this.#n].undo(),this.#t=!1,this.#n-=1)}redo(){this.#n<this.#e.length-1&&(this.#n+=1,this.#t=!0,this.#e[this.#n].cmd(),this.#t=!1)}hasSomethingToUndo(){return this.#n!==-1}hasSomethingToRedo(){return this.#n<this.#e.length-1}destroy(){this.#e=null}}s.CommandManager=g;class b{constructor(E){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:w}=u.FeatureTest.platform;for(const[S,$,T={}]of E)for(const _ of S){const I=_.startsWith("mac+");w&&I?(this.callbacks.set(_.slice(4),{callback:$,options:T}),this.allKeys.add(_.split("+").at(-1))):!w&&!I&&(this.callbacks.set(_,{callback:$,options:T}),this.allKeys.add(_.split("+").at(-1)))}}#e(E){E.altKey&&this.buffer.push("alt"),E.ctrlKey&&this.buffer.push("ctrl"),E.metaKey&&this.buffer.push("meta"),E.shiftKey&&this.buffer.push("shift"),this.buffer.push(E.key);const w=this.buffer.join("+");return this.buffer.length=0,w}exec(E,w){if(!this.allKeys.has(w.key))return;const S=this.callbacks.get(this.#e(w));if(!S)return;const{callback:$,options:{bubbles:T=!1,args:_=[],checker:I=null}}=S;I&&!I(E,w)||($.bind(E,..._)(),T||(w.stopPropagation(),w.preventDefault()))}}s.KeyboardManager=b;class y{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const E=new Map([["CanvasText",null],["Canvas",null]]);return(0,d.getColorValues)(E),(0,u.shadow)(this,"_colors",E)}convert(E){const w=(0,d.getRGB)(E);if(!window.matchMedia("(forced-colors: active)").matches)return w;for(const[S,$]of this._colors)if($.every((T,_)=>T===w[_]))return y._colorsMapping.get(S);return w}getHexCode(E){const w=this._colors.get(E);return w?u.Util.makeHexColor(...w):E}}s.ColorManager=y;class f{#e=null;#t=new Map;#r=new Map;#n=null;#s=null;#o=new g;#i=0;#l=new Set;#c=null;#a=null;#p=new Set;#d=null;#f=new A;#h=!1;#A=!1;#m=null;#g=u.AnnotationEditorType.NONE;#u=new Set;#v=null;#C=this.blur.bind(this);#E=this.focus.bind(this);#$=this.copy.bind(this);#I=this.cut.bind(this);#M=this.paste.bind(this);#D=this.keydown.bind(this);#k=this.onEditingAction.bind(this);#b=this.onPageChanging.bind(this);#B=this.onScaleChanging.bind(this);#T=this.onRotationChanging.bind(this);#R={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#x=[0,0];#_=null;#w=null;#F=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const E=f.prototype,w=T=>{const{activeElement:_}=document;return _&&T.#w.contains(_)&&T.hasSomethingToControl()},S=this.TRANSLATE_SMALL,$=this.TRANSLATE_BIG;return(0,u.shadow)(this,"_keyboardManager",new b([[["ctrl+a","mac+meta+a"],E.selectAll],[["ctrl+z","mac+meta+z"],E.undo],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],E.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],E.delete],[["Escape","mac+Escape"],E.unselectAll],[["ArrowLeft","mac+ArrowLeft"],E.translateSelectedEditors,{args:[-S,0],checker:w}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],E.translateSelectedEditors,{args:[-$,0],checker:w}],[["ArrowRight","mac+ArrowRight"],E.translateSelectedEditors,{args:[S,0],checker:w}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],E.translateSelectedEditors,{args:[$,0],checker:w}],[["ArrowUp","mac+ArrowUp"],E.translateSelectedEditors,{args:[0,-S],checker:w}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],E.translateSelectedEditors,{args:[0,-$],checker:w}],[["ArrowDown","mac+ArrowDown"],E.translateSelectedEditors,{args:[0,S],checker:w}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],E.translateSelectedEditors,{args:[0,$],checker:w}]]))}constructor(E,w,S,$,T,_){this.#w=E,this.#F=w,this.#n=S,this._eventBus=$,this._eventBus._on("editingaction",this.#k),this._eventBus._on("pagechanging",this.#b),this._eventBus._on("scalechanging",this.#B),this._eventBus._on("rotationchanging",this.#T),this.#s=T.annotationStorage,this.#d=T.filterFactory,this.#v=_,this.viewParameters={realScale:d.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#P(),this.#N(),this._eventBus._off("editingaction",this.#k),this._eventBus._off("pagechanging",this.#b),this._eventBus._off("scalechanging",this.#B),this._eventBus._off("rotationchanging",this.#T);for(const E of this.#r.values())E.destroy();this.#r.clear(),this.#t.clear(),this.#p.clear(),this.#e=null,this.#u.clear(),this.#o.destroy(),this.#n.destroy()}get hcmFilter(){return(0,u.shadow)(this,"hcmFilter",this.#v?this.#d.addHCMFilter(this.#v.foreground,this.#v.background):"none")}get direction(){return(0,u.shadow)(this,"direction",getComputedStyle(this.#w).direction)}editAltText(E){this.#n?.editAltText(this,E)}onPageChanging({pageNumber:E}){this.#i=E-1}focusMainContainer(){this.#w.focus()}findParent(E,w){for(const S of this.#r.values()){const{x:$,y:T,width:_,height:I}=S.div.getBoundingClientRect();if(E>=$&&E<=$+_&&w>=T&&w<=T+I)return S}return null}disableUserSelect(E=!1){this.#F.classList.toggle("noUserSelect",E)}addShouldRescale(E){this.#p.add(E)}removeShouldRescale(E){this.#p.delete(E)}onScaleChanging({scale:E}){this.commitOrRemove(),this.viewParameters.realScale=E*d.PixelsPerInch.PDF_TO_CSS_UNITS;for(const w of this.#p)w.onScaleChanging()}onRotationChanging({pagesRotation:E}){this.commitOrRemove(),this.viewParameters.rotation=E}addToAnnotationStorage(E){!E.isEmpty()&&this.#s&&!this.#s.has(E.id)&&this.#s.setValue(E.id,E)}#L(){window.addEventListener("focus",this.#E),window.addEventListener("blur",this.#C)}#N(){window.removeEventListener("focus",this.#E),window.removeEventListener("blur",this.#C)}blur(){if(!this.hasSelection)return;const{activeElement:E}=document;for(const w of this.#u)if(w.div.contains(E)){this.#m=[w,E],w._focusEventsAllowed=!1;break}}focus(){if(!this.#m)return;const[E,w]=this.#m;this.#m=null,w.addEventListener("focusin",()=>{E._focusEventsAllowed=!0},{once:!0}),w.focus()}#j(){window.addEventListener("keydown",this.#D,{capture:!0})}#P(){window.removeEventListener("keydown",this.#D,{capture:!0})}#O(){document.addEventListener("copy",this.#$),document.addEventListener("cut",this.#I),document.addEventListener("paste",this.#M)}#S(){document.removeEventListener("copy",this.#$),document.removeEventListener("cut",this.#I),document.removeEventListener("paste",this.#M)}addEditListeners(){this.#j(),this.#O()}removeEditListeners(){this.#P(),this.#S()}copy(E){if(E.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;const w=[];for(const S of this.#u){const $=S.serialize(!0);$&&w.push($)}w.length!==0&&E.clipboardData.setData("application/pdfjs",JSON.stringify(w))}cut(E){this.copy(E),this.delete()}paste(E){E.preventDefault();const{clipboardData:w}=E;for(const T of w.items)for(const _ of this.#a)if(_.isHandlingMimeForPasting(T.type)){_.paste(T,this.currentLayer);return}let S=w.getData("application/pdfjs");if(!S)return;try{S=JSON.parse(S)}catch(T){(0,u.warn)(`paste: "${T.message}".`);return}if(!Array.isArray(S))return;this.unselectAll();const $=this.currentLayer;try{const T=[];for(const C of S){const P=$.deserialize(C);if(!P)return;T.push(P)}const _=()=>{for(const C of T)this.#U(C);this.#W(T)},I=()=>{for(const C of T)C.remove()};this.addCommands({cmd:_,undo:I,mustExec:!0})}catch(T){(0,u.warn)(`paste: "${T.message}".`)}}keydown(E){this.getActive()?.shouldGetKeyboardEvents()||f._keyboardManager.exec(this,E)}onEditingAction(E){["undo","redo","delete","selectAll"].includes(E.name)&&this[E.name]()}#y(E){Object.entries(E).some(([S,$])=>this.#R[S]!==$)&&this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#R,E)})}#z(E){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:E})}setEditingState(E){E?(this.#L(),this.#j(),this.#O(),this.#y({isEditing:this.#g!==u.AnnotationEditorType.NONE,isEmpty:this.#H(),hasSomethingToUndo:this.#o.hasSomethingToUndo(),hasSomethingToRedo:this.#o.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#N(),this.#P(),this.#S(),this.#y({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(E){if(!this.#a){this.#a=E;for(const w of this.#a)this.#z(w.defaultPropertiesToUpdate)}}getId(){return this.#f.getId()}get currentLayer(){return this.#r.get(this.#i)}getLayer(E){return this.#r.get(E)}get currentPageIndex(){return this.#i}addLayer(E){this.#r.set(E.pageIndex,E),this.#h?E.enable():E.disable()}removeLayer(E){this.#r.delete(E.pageIndex)}updateMode(E,w=null){if(this.#g!==E){if(this.#g=E,E===u.AnnotationEditorType.NONE){this.setEditingState(!1),this.#V();return}this.setEditingState(!0),this.#G(),this.unselectAll();for(const S of this.#r.values())S.updateMode(E);if(w){for(const S of this.#t.values())if(S.annotationElementId===w){this.setSelected(S),S.enterInEditMode();break}}}}updateToolbar(E){E!==this.#g&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:E})}updateParams(E,w){if(this.#a){if(E===u.AnnotationEditorParamsType.CREATE){this.currentLayer.addNewEditor(E);return}for(const S of this.#u)S.updateParams(E,w);for(const S of this.#a)S.updateDefaultParams(E,w)}}enableWaiting(E=!1){if(this.#A!==E){this.#A=E;for(const w of this.#r.values())E?w.disableClick():w.enableClick(),w.div.classList.toggle("waiting",E)}}#G(){if(!this.#h){this.#h=!0;for(const E of this.#r.values())E.enable()}}#V(){if(this.unselectAll(),this.#h){this.#h=!1;for(const E of this.#r.values())E.disable()}}getEditors(E){const w=[];for(const S of this.#t.values())S.pageIndex===E&&w.push(S);return w}getEditor(E){return this.#t.get(E)}addEditor(E){this.#t.set(E.id,E)}removeEditor(E){this.#t.delete(E.id),this.unselect(E),(!E.annotationElementId||!this.#l.has(E.annotationElementId))&&this.#s?.remove(E.id)}addDeletedAnnotationElement(E){this.#l.add(E.annotationElementId),E.deleted=!0}isDeletedAnnotationElement(E){return this.#l.has(E)}removeDeletedAnnotationElement(E){this.#l.delete(E.annotationElementId),E.deleted=!1}#U(E){const w=this.#r.get(E.pageIndex);w?w.addOrRebuild(E):this.addEditor(E)}setActiveEditor(E){this.#e!==E&&(this.#e=E,E&&this.#z(E.propertiesToUpdate))}toggleSelected(E){if(this.#u.has(E)){this.#u.delete(E),E.unselect(),this.#y({hasSelectedEditor:this.hasSelection});return}this.#u.add(E),E.select(),this.#z(E.propertiesToUpdate),this.#y({hasSelectedEditor:!0})}setSelected(E){for(const w of this.#u)w!==E&&w.unselect();this.#u.clear(),this.#u.add(E),E.select(),this.#z(E.propertiesToUpdate),this.#y({hasSelectedEditor:!0})}isSelected(E){return this.#u.has(E)}unselect(E){E.unselect(),this.#u.delete(E),this.#y({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#u.size!==0}undo(){this.#o.undo(),this.#y({hasSomethingToUndo:this.#o.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#H()})}redo(){this.#o.redo(),this.#y({hasSomethingToUndo:!0,hasSomethingToRedo:this.#o.hasSomethingToRedo(),isEmpty:this.#H()})}addCommands(E){this.#o.add(E),this.#y({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#H()})}#H(){if(this.#t.size===0)return!0;if(this.#t.size===1)for(const E of this.#t.values())return E.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const E=[...this.#u],w=()=>{for(const $ of E)$.remove()},S=()=>{for(const $ of E)this.#U($)};this.addCommands({cmd:w,undo:S,mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#W(E){this.#u.clear();for(const w of E)w.isEmpty()||(this.#u.add(w),w.select());this.#y({hasSelectedEditor:!0})}selectAll(){for(const E of this.#u)E.commit();this.#W(this.#t.values())}unselectAll(){if(this.#e){this.#e.commitOrRemove();return}if(this.hasSelection){for(const E of this.#u)E.unselect();this.#u.clear(),this.#y({hasSelectedEditor:!1})}}translateSelectedEditors(E,w,S=!1){if(S||this.commitOrRemove(),!this.hasSelection)return;this.#x[0]+=E,this.#x[1]+=w;const[$,T]=this.#x,_=[...this.#u],I=1e3;this.#_&&clearTimeout(this.#_),this.#_=setTimeout(()=>{this.#_=null,this.#x[0]=this.#x[1]=0,this.addCommands({cmd:()=>{for(const C of _)this.#t.has(C.id)&&C.translateInPage($,T)},undo:()=>{for(const C of _)this.#t.has(C.id)&&C.translateInPage(-$,-T)},mustExec:!1})},I);for(const C of _)C.translateInPage(E,w)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#c=new Map;for(const E of this.#u)this.#c.set(E,{savedX:E.x,savedY:E.y,savedPageIndex:E.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#c)return!1;this.disableUserSelect(!1);const E=this.#c;this.#c=null;let w=!1;for(const[{x:$,y:T,pageIndex:_},I]of E)I.newX=$,I.newY=T,I.newPageIndex=_,w||=$!==I.savedX||T!==I.savedY||_!==I.savedPageIndex;if(!w)return!1;const S=($,T,_,I)=>{if(this.#t.has($.id)){const C=this.#r.get(I);C?$._setParentAndPosition(C,T,_):($.pageIndex=I,$.x=T,$.y=_)}};return this.addCommands({cmd:()=>{for(const[$,{newX:T,newY:_,newPageIndex:I}]of E)S($,T,_,I)},undo:()=>{for(const[$,{savedX:T,savedY:_,savedPageIndex:I}]of E)S($,T,_,I)},mustExec:!0}),!0}dragSelectedEditors(E,w){if(this.#c)for(const S of this.#c.keys())S.drag(E,w)}rebuild(E){if(E.parent===null){const w=this.getLayer(E.pageIndex);w?(w.changeParent(E),w.addOrRebuild(E)):(this.addEditor(E),this.addToAnnotationStorage(E),E.rebuild())}else E.parent.addOrRebuild(E)}isActive(E){return this.#e===E}getActive(){return this.#e}getMode(){return this.#g}get imageManager(){return(0,u.shadow)(this,"imageManager",new x)}}s.AnnotationEditorUIManager=f}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.StatTimer=s.RenderingCancelledException=s.PixelsPerInch=s.PageViewport=s.PDFDateString=s.DOMStandardFontDataFactory=s.DOMSVGFactory=s.DOMFilterFactory=s.DOMCanvasFactory=s.DOMCMapReaderFactory=void 0,s.deprecated=O,s.getColorValues=V,s.getCurrentTransform=j,s.getCurrentTransformInverse=G,s.getFilenameFromUrl=$,s.getPdfFilenameFromUrl=T,s.getRGB=D,s.getXfaPageViewport=F,s.isDataScheme=w,s.isPdfFile=S,s.isValidFetchUrl=I,s.loadScript=P,s.noContextMenu=C,s.setLayerDimensions=U;var u=c(7),d=c(1);const p="http://www.w3.org/2000/svg";class v{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}s.PixelsPerInch=v;class A extends u.BaseFilterFactory{#e;#t;#r;#n;#s;#o;#i;#l;#c;#a;#p=0;constructor({docId:N,ownerDocument:R=globalThis.document}={}){super(),this.#r=N,this.#n=R}get#d(){return this.#e||=new Map}get#f(){if(!this.#t){const N=this.#n.createElement("div"),{style:R}=N;R.visibility="hidden",R.contain="strict",R.width=R.height=0,R.position="absolute",R.top=R.left=0,R.zIndex=-1;const k=this.#n.createElementNS(p,"svg");k.setAttribute("width",0),k.setAttribute("height",0),this.#t=this.#n.createElementNS(p,"defs"),N.append(k),k.append(this.#t),this.#n.body.append(N)}return this.#t}addFilter(N){if(!N)return"none";let R=this.#d.get(N);if(R)return R;let k,z,W,J;if(N.length===1){const Q=N[0],ee=new Array(256);for(let Y=0;Y<256;Y++)ee[Y]=Q[Y]/255;J=k=z=W=ee.join(",")}else{const[Q,ee,Y]=N,Z=new Array(256),te=new Array(256),ae=new Array(256);for(let oe=0;oe<256;oe++)Z[oe]=Q[oe]/255,te[oe]=ee[oe]/255,ae[oe]=Y[oe]/255;k=Z.join(","),z=te.join(","),W=ae.join(","),J=`${k}${z}${W}`}if(R=this.#d.get(J),R)return this.#d.set(N,R),R;const re=`g_${this.#r}_transfer_map_${this.#p++}`,K=`url(#${re})`;this.#d.set(N,K),this.#d.set(J,K);const q=this.#A(re);return this.#g(k,z,W,q),K}addHCMFilter(N,R){const k=`${N}-${R}`;if(this.#o===k)return this.#i;if(this.#o=k,this.#i="none",this.#s?.remove(),!N||!R)return this.#i;const z=this.#u(N);N=d.Util.makeHexColor(...z);const W=this.#u(R);if(R=d.Util.makeHexColor(...W),this.#f.style.color="",N==="#000000"&&R==="#ffffff"||N===R)return this.#i;const J=new Array(256);for(let ee=0;ee<=255;ee++){const Y=ee/255;J[ee]=Y<=.03928?Y/12.92:((Y+.055)/1.055)**2.4}const re=J.join(","),K=`g_${this.#r}_hcm_filter`,q=this.#l=this.#A(K);this.#g(re,re,re,q),this.#h(q);const Q=(ee,Y)=>{const Z=z[ee]/255,te=W[ee]/255,ae=new Array(Y+1);for(let oe=0;oe<=Y;oe++)ae[oe]=Z+oe/Y*(te-Z);return ae.join(",")};return this.#g(Q(0,5),Q(1,5),Q(2,5),q),this.#i=`url(#${K})`,this.#i}addHighlightHCMFilter(N,R,k,z){const W=`${N}-${R}-${k}-${z}`;if(this.#c===W)return this.#a;if(this.#c=W,this.#a="none",this.#l?.remove(),!N||!R)return this.#a;const[J,re]=[N,R].map(this.#u.bind(this));let K=Math.round(.2126*J[0]+.7152*J[1]+.0722*J[2]),q=Math.round(.2126*re[0]+.7152*re[1]+.0722*re[2]),[Q,ee]=[k,z].map(this.#u.bind(this));q<K&&([K,q,Q,ee]=[q,K,ee,Q]),this.#f.style.color="";const Y=(ae,oe,se)=>{const fe=new Array(256),pe=(q-K)/se,ge=ae/255,me=(oe-ae)/(255*se);let be=0;for(let le=0;le<=se;le++){const ve=Math.round(K+le*pe),he=ge+le*me;for(let ye=be;ye<=ve;ye++)fe[ye]=he;be=ve+1}for(let le=be;le<256;le++)fe[le]=fe[be-1];return fe.join(",")},Z=`g_${this.#r}_hcm_highlight_filter`,te=this.#l=this.#A(Z);return this.#h(te),this.#g(Y(Q[0],ee[0],5),Y(Q[1],ee[1],5),Y(Q[2],ee[2],5),te),this.#a=`url(#${Z})`,this.#a}destroy(N=!1){N&&(this.#i||this.#a)||(this.#t&&(this.#t.parentNode.parentNode.remove(),this.#t=null),this.#e&&(this.#e.clear(),this.#e=null),this.#p=0)}#h(N){const R=this.#n.createElementNS(p,"feColorMatrix");R.setAttribute("type","matrix"),R.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"),N.append(R)}#A(N){const R=this.#n.createElementNS(p,"filter");return R.setAttribute("color-interpolation-filters","sRGB"),R.setAttribute("id",N),this.#f.append(R),R}#m(N,R,k){const z=this.#n.createElementNS(p,R);z.setAttribute("type","discrete"),z.setAttribute("tableValues",k),N.append(z)}#g(N,R,k,z){const W=this.#n.createElementNS(p,"feComponentTransfer");z.append(W),this.#m(W,"feFuncR",N),this.#m(W,"feFuncG",R),this.#m(W,"feFuncB",k)}#u(N){return this.#f.style.color=N,D(getComputedStyle(this.#f).getPropertyValue("color"))}}s.DOMFilterFactory=A;class x extends u.BaseCanvasFactory{constructor({ownerDocument:N=globalThis.document}={}){super(),this._document=N}_createCanvas(N,R){const k=this._document.createElement("canvas");return k.width=N,k.height=R,k}}s.DOMCanvasFactory=x;async function g(M,N=!1){if(I(M,document.baseURI)){const R=await fetch(M);if(!R.ok)throw new Error(R.statusText);return N?new Uint8Array(await R.arrayBuffer()):(0,d.stringToBytes)(await R.text())}return new Promise((R,k)=>{const z=new XMLHttpRequest;z.open("GET",M,!0),N&&(z.responseType="arraybuffer"),z.onreadystatechange=()=>{if(z.readyState===XMLHttpRequest.DONE){if(z.status===200||z.status===0){let W;if(N&&z.response?W=new Uint8Array(z.response):!N&&z.responseText&&(W=(0,d.stringToBytes)(z.responseText)),W){R(W);return}}k(new Error(z.statusText))}},z.send(null)})}class b extends u.BaseCMapReaderFactory{_fetchData(N,R){return g(N,this.isCompressed).then(k=>({cMapData:k,compressionType:R}))}}s.DOMCMapReaderFactory=b;class y extends u.BaseStandardFontDataFactory{_fetchData(N){return g(N,!0)}}s.DOMStandardFontDataFactory=y;class f extends u.BaseSVGFactory{_createSVG(N){return document.createElementNS(p,N)}}s.DOMSVGFactory=f;class m{constructor({viewBox:N,scale:R,rotation:k,offsetX:z=0,offsetY:W=0,dontFlip:J=!1}){this.viewBox=N,this.scale=R,this.rotation=k,this.offsetX=z,this.offsetY=W;const re=(N[2]+N[0])/2,K=(N[3]+N[1])/2;let q,Q,ee,Y;switch(k%=360,k<0&&(k+=360),k){case 180:q=-1,Q=0,ee=0,Y=1;break;case 90:q=0,Q=1,ee=1,Y=0;break;case 270:q=0,Q=-1,ee=-1,Y=0;break;case 0:q=1,Q=0,ee=0,Y=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}J&&(ee=-ee,Y=-Y);let Z,te,ae,oe;q===0?(Z=Math.abs(K-N[1])*R+z,te=Math.abs(re-N[0])*R+W,ae=(N[3]-N[1])*R,oe=(N[2]-N[0])*R):(Z=Math.abs(re-N[0])*R+z,te=Math.abs(K-N[1])*R+W,ae=(N[2]-N[0])*R,oe=(N[3]-N[1])*R),this.transform=[q*R,Q*R,ee*R,Y*R,Z-q*R*re-ee*R*K,te-Q*R*re-Y*R*K],this.width=ae,this.height=oe}get rawDims(){const{viewBox:N}=this;return(0,d.shadow)(this,"rawDims",{pageWidth:N[2]-N[0],pageHeight:N[3]-N[1],pageX:N[0],pageY:N[1]})}clone({scale:N=this.scale,rotation:R=this.rotation,offsetX:k=this.offsetX,offsetY:z=this.offsetY,dontFlip:W=!1}={}){return new m({viewBox:this.viewBox.slice(),scale:N,rotation:R,offsetX:k,offsetY:z,dontFlip:W})}convertToViewportPoint(N,R){return d.Util.applyTransform([N,R],this.transform)}convertToViewportRectangle(N){const R=d.Util.applyTransform([N[0],N[1]],this.transform),k=d.Util.applyTransform([N[2],N[3]],this.transform);return[R[0],R[1],k[0],k[1]]}convertToPdfPoint(N,R){return d.Util.applyInverseTransform([N,R],this.transform)}}s.PageViewport=m;class E extends d.BaseException{constructor(N,R=0){super(N,"RenderingCancelledException"),this.extraDelay=R}}s.RenderingCancelledException=E;function w(M){const N=M.length;let R=0;for(;R<N&&M[R].trim()==="";)R++;return M.substring(R,R+5).toLowerCase()==="data:"}function S(M){return typeof M=="string"&&/\.pdf$/i.test(M)}function $(M,N=!1){return N||([M]=M.split(/[#?]/,1)),M.substring(M.lastIndexOf("/")+1)}function T(M,N="document.pdf"){if(typeof M!="string")return N;if(w(M))return(0,d.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),N;const R=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,k=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,z=R.exec(M);let W=k.exec(z[1])||k.exec(z[2])||k.exec(z[3]);if(W&&(W=W[0],W.includes("%")))try{W=k.exec(decodeURIComponent(W))[0]}catch{}return W||N}class _{started=Object.create(null);times=[];time(N){N in this.started&&(0,d.warn)(`Timer is already running for ${N}`),this.started[N]=Date.now()}timeEnd(N){N in this.started||(0,d.warn)(`Timer has not been started for ${N}`),this.times.push({name:N,start:this.started[N],end:Date.now()}),delete this.started[N]}toString(){const N=[];let R=0;for(const{name:k}of this.times)R=Math.max(k.length,R);for(const{name:k,start:z,end:W}of this.times)N.push(`${k.padEnd(R)} ${W-z}ms
59
+ `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return codePointToString(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),a){var c=this.pos-1;this.invalidStringToken(c,"Invalid escape sequence in template string")}default:if(s>=48&&s<=55){var u=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],d=parseInt(u,8);return d>255&&(u=u.slice(0,-1),d=parseInt(u,8)),this.pos+=u.length-1,s=this.input.charCodeAt(this.pos),(u!=="0"||s===56||s===57)&&(this.strict||a)&&this.invalidStringToken(this.pos-1-u.length,a?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(d)}return isNewLine(s)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(s)}},pp.readHexChar=function(a){var s=this.pos,c=this.readInt(16,a);return c===null&&this.invalidStringToken(s,"Bad character escape sequence"),c},pp.readWord1=function(){this.containsEsc=!1;for(var a="",s=!0,c=this.pos,u=this.options.ecmaVersion>=6;this.pos<this.input.length;){var d=this.fullCharCodeAtPos();if(isIdentifierChar(d,u))this.pos+=d<=65535?1:2;else if(d===92){this.containsEsc=!0,a+=this.input.slice(c,this.pos);var p=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var v=this.readCodePoint();(s?isIdentifierStart:isIdentifierChar)(v,u)||this.invalidStringToken(p,"Invalid Unicode escape"),a+=codePointToString(v),c=this.pos}else break;s=!1}return a+this.input.slice(c,this.pos)},pp.readWord=function(){var a=this.readWord1(),s=types$1.name;return this.keywords.test(a)&&(s=keywords[a]),this.finishToken(s,a)};var version$2="8.16.0";Parser.acorn={Parser,version:version$2,defaultOptions:defaultOptions$1,Position,SourceLocation,getLineInfo,Node,TokenType,tokTypes:types$1,keywordTypes:keywords,TokContext,tokContexts:types$2,isIdentifierChar,isIdentifierStart,Token,isNewLine,lineBreak,lineBreakG,nonASCIIwhitespace};function parseExpressionAt(a,s,c){return Parser.parseExpressionAt(a,s,c)}const expressionCache=new Map,parseDataCache=new Map,parseData=a=>{const s=JSON.stringify(a);if(parseDataCache.has(s))return parseDataCache.get(s);const c=Object.fromEntries(Object.entries(a).map(([u,d])=>{if(typeof d=="string")try{const p=JSON.parse(d);return[u,p]}catch{return[u,d]}return[u,d]}));return parseDataCache.set(s,c),c},padZero=a=>String(a).padStart(2,"0"),formatDate=a=>`${a.getFullYear()}/${padZero(a.getMonth()+1)}/${padZero(a.getDate())}`,formatDateTime=a=>`${formatDate(a)} ${padZero(a.getHours())}:${padZero(a.getMinutes())}`,safeAssign=(a,...s)=>{if(a==null)throw new TypeError("Cannot convert undefined or null to object");const c={...a};for(const u of s)if(u!=null)for(const d in u)d==="__proto__"||d==="constructor"||d==="prototype"||Object.prototype.hasOwnProperty.call(u,d)&&(c[d]=u[d]);return c},safeObject={keys:Object.keys,values:Object.values,entries:Object.entries,fromEntries:Object.fromEntries,is:Object.is,hasOwnProperty:Object.hasOwnProperty,assign:safeAssign},allowedGlobals={Math,String,Number,Boolean,Array,Object:safeObject,Date,JSON,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent},validateAST=a=>{switch(a.type){case"Literal":case"Identifier":break;case"BinaryExpression":case"LogicalExpression":{const s=a;validateAST(s.left),validateAST(s.right);break}case"UnaryExpression":{validateAST(a.argument);break}case"ConditionalExpression":{const s=a;validateAST(s.test),validateAST(s.consequent),validateAST(s.alternate);break}case"MemberExpression":{const s=a;if(validateAST(s.object),s.computed)validateAST(s.property);else{const c=s.property.name;if(["constructor","__proto__","prototype"].includes(c))throw new Error("Access to prohibited property");if(["__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"].includes(c))throw new Error(`Access to prohibited method: ${c}`);if(typeof c=="string"&&["toLocaleString","valueOf"].includes(c))throw new Error(`Access to prohibited method: ${c}`)}break}case"CallExpression":{const s=a;validateAST(s.callee),s.arguments.forEach(validateAST);break}case"ArrayExpression":{a.elements.forEach(c=>{c&&validateAST(c)});break}case"ObjectExpression":{a.properties.forEach(c=>{const u=c;validateAST(u.key),validateAST(u.value)});break}case"ArrowFunctionExpression":{const s=a;s.params.forEach(c=>{if(c.type!=="Identifier")throw new Error("Only identifier parameters are supported in arrow functions");validateAST(c)}),validateAST(s.body);break}default:throw new Error(`Unsupported syntax in placeholder: ${a.type}`)}},evaluateAST=(a,s)=>{switch(a.type){case"Literal":return a.value;case"Identifier":{const c=a;if(Object.prototype.hasOwnProperty.call(s,c.name))return s[c.name];if(Object.prototype.hasOwnProperty.call(allowedGlobals,c.name))return allowedGlobals[c.name];throw new Error(`Undefined variable: ${c.name}`)}case"BinaryExpression":{const c=a,u=evaluateAST(c.left,s),d=evaluateAST(c.right,s);switch(c.operator){case"+":return u+d;case"-":return u-d;case"*":return u*d;case"/":return u/d;case"%":return u%d;case"**":return u**d;case"==":return u==d;case"!=":return u!=d;case"===":return u===d;case"!==":return u!==d;case"<":return u<d;case">":return u>d;case"<=":return u<=d;case">=":return u>=d;default:throw new Error(`Unsupported operator: ${c.operator}`)}}case"LogicalExpression":{const c=a,u=evaluateAST(c.left,s),d=evaluateAST(c.right,s);switch(c.operator){case"&&":return u&&d;case"||":return u||d;default:throw new Error(`Unsupported operator: ${c.operator}`)}}case"UnaryExpression":{const c=a,u=evaluateAST(c.argument,s);switch(c.operator){case"+":return+u;case"-":return-u;case"!":return!u;default:throw new Error(`Unsupported operator: ${c.operator}`)}}case"ConditionalExpression":{const c=a,u=evaluateAST(c.test,s);return evaluateAST(u?c.consequent:c.alternate,s)}case"MemberExpression":{const c=a,u=evaluateAST(c.object,s);let d;if(c.computed?d=evaluateAST(c.property,s):d=c.property.name,typeof d=="string"||typeof d=="number"){if(typeof d=="string"&&["constructor","__proto__","prototype"].includes(d))throw new Error("Access to prohibited property");if(typeof d=="string"&&["__defineGetter__","__defineSetter__","__lookupGetter__","__lookupSetter__"].includes(d))throw new Error(`Access to prohibited method: ${d}`);return u[d]}else throw new Error("Invalid property access")}case"CallExpression":{const c=a,u=evaluateAST(c.callee,s),d=c.arguments.map(p=>evaluateAST(p,s));if(typeof u=="function")if(c.callee.type==="MemberExpression"){const p=c.callee,v=evaluateAST(p.object,s);if(v!==null&&(typeof v=="object"||typeof v=="number"||typeof v=="string"||typeof v=="boolean"))return u.call(v,...d);throw new Error("Invalid object in member function call")}else return u(...d);else throw new Error("Attempted to call a non-function")}case"ArrowFunctionExpression":{const c=a,u=c.params.map(p=>p.name),d=c.body;return(...p)=>{const v={...s};return u.forEach((A,x)=>{v[A]=p[x]}),evaluateAST(d,v)}}case"ArrayExpression":return a.elements.map(u=>u?evaluateAST(u,s):null);case"ObjectExpression":{const c=a,u={};return c.properties.forEach(d=>{const p=d;let v;if(p.key.type==="Identifier")v=p.key.name;else{const x=evaluateAST(p.key,s);if(typeof x!="string"&&typeof x!="number")throw new Error("Object property keys must be strings or numbers");v=String(x)}const A=evaluateAST(p.value,s);u[v]=A}),u}default:throw new Error(`Unsupported syntax in placeholder: ${a.type}`)}},evaluatePlaceholders=a=>{const{content:s,context:c}=a;let u="",d=0;for(;d<s.length;){const p=s.indexOf("{",d);if(p===-1){u+=s.slice(d);break}u+=s.slice(d,p);let v=1,A=p+1;for(;A<s.length&&v>0;)s[A]==="{"?v++:s[A]==="}"&&v--,A++;if(v===0){const x=s.slice(p+1,A-1).trim();if(expressionCache.has(x)){const g=expressionCache.get(x);try{const b=g(c);u+=String(b)}catch{u+=s.slice(p,A)}}else try{const g=parseExpressionAt(x,0,{ecmaVersion:"latest"});validateAST(g);const b=f=>evaluateAST(g,f);expressionCache.set(x,b);const y=b(c);u+=String(y)}catch{u+=s.slice(p,A)}d=A}else throw new Error("Invalid placeholder")}return u},replacePlaceholders=a=>{const{content:s,variables:c,schemas:u}=a;if(!s||typeof s!="string"||!s.includes("{")||!s.includes("}"))return s;const d=new Date,p=formatDate(d),v=formatDateTime(d),A={...Object.fromEntries(u.flat().map(b=>[b.name,b.readOnly&&b.content||""])),...c},x=parseData(A),g={date:p,dateTime:v,...x};return Object.entries(g).forEach(([b,y])=>{typeof y=="string"&&y.includes("{")&&y.includes("}")&&(g[b]=evaluatePlaceholders({content:y,context:g}))}),evaluatePlaceholders({content:s,context:g})},pluginRegistry=a=>({plugins:a,entries:()=>Object.entries(a),values:()=>Object.values(a),exists:()=>Object.values(a).length>0,findWithLabelByType(s){for(const[c,u]of Object.entries(this.plugins)){if(!u||typeof u!="object"||!u.propPanel||typeof u.propPanel!="object")continue;const d=u.propPanel.defaultSchema;if(d&&"type"in d&&d.type===s)return[c,u]}return["",void 0]},findByType(s){const[,c]=this.findWithLabelByType(s);return c}}),DEFAULT_LANG="en",DESTROYED_ERR_MSG="[@pdfme/ui] this instance is already destroyed",SELECTABLE_CLASSNAME="selectable",RULER_HEIGHT=30,PAGE_GAP=10,LEFT_SIDEBAR_WIDTH=45,RIGHT_SIDEBAR_WIDTH=400,BACKGROUND_COLOR="rgb(74, 74, 74)",DEFAULT_MAX_ZOOM=2,DESIGNER_CLASSNAME="pdfme-designer-",UI_CLASSNAME="pdfme-ui-";const isff=typeof navigator<"u"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function addEvent$1(a,s,c,u){a.addEventListener?a.addEventListener(s,c,u):a.attachEvent&&a.attachEvent(`on${s}`,c)}function removeEvent$1(a,s,c,u){a&&(a.removeEventListener?a.removeEventListener(s,c,u):a.detachEvent&&a.detachEvent(`on${s}`,c))}function getMods(a,s){const c=s.slice(0,s.length-1),u=[];for(let d=0;d<c.length;d++)u.push(a[c[d].toLowerCase()]);return u}function getKeys$1(a){typeof a!="string"&&(a=""),a=a.replace(/\s/g,"");const s=a.split(",");let c=s.lastIndexOf("");for(;c>=0;)s[c-1]+=",",s.splice(c,1),c=s.lastIndexOf("");return s}function compareArray(a,s){const c=a.length>=s.length?a:s,u=a.length>=s.length?s:a;let d=!0;for(let p=0;p<c.length;p++)u.indexOf(c[p])===-1&&(d=!1);return d}function getLayoutIndependentKeyCode(a){let s=a.keyCode||a.which||a.charCode;return a.code&&/^Key[A-Z]$/.test(a.code)&&(s=a.code.charCodeAt(3)),s}const _keyMap={backspace:8,"⌫":8,tab:9,clear:12,enter:13,"↩":13,return:13,esc:27,escape:27,space:32,left:37,up:38,right:39,down:40,arrowup:38,arrowdown:40,arrowleft:37,arrowright:39,del:46,delete:46,ins:45,insert:45,home:36,end:35,pageup:33,pagedown:34,capslock:20,num_0:96,num_1:97,num_2:98,num_3:99,num_4:100,num_5:101,num_6:102,num_7:103,num_8:104,num_9:105,num_multiply:106,num_add:107,num_enter:108,num_subtract:109,num_decimal:110,num_divide:111,"⇪":20,",":188,".":190,"/":191,"`":192,"-":isff?173:189,"=":isff?61:187,";":isff?59:186,"'":222,"{":219,"}":221,"[":219,"]":221,"\\":220},_modifier={"⇧":16,shift:16,"⌥":18,alt:18,option:18,"⌃":17,ctrl:17,control:17,"⌘":91,cmd:91,meta:91,command:91},modifierMap={16:"shiftKey",18:"altKey",17:"ctrlKey",91:"metaKey",shiftKey:16,ctrlKey:17,altKey:18,metaKey:91},_mods={16:!1,18:!1,17:!1,91:!1},_handlers={};for(let a=1;a<20;a++)_keyMap[`f${a}`]=111+a;let _downKeys=[],winListendFocus=null,winListendFullscreen=null,_scope="all";const elementEventMap=new Map,code=a=>_keyMap[a.toLowerCase()]||_modifier[a.toLowerCase()]||a.toUpperCase().charCodeAt(0),getKey$3=a=>Object.keys(_keyMap).find(s=>_keyMap[s]===a),getModifier=a=>Object.keys(_modifier).find(s=>_modifier[s]===a),setScope=a=>{_scope=a||"all"},getScope=()=>_scope||"all",getPressedKeyCodes=()=>_downKeys.slice(0),getPressedKeyString=()=>_downKeys.map(a=>getKey$3(a)||getModifier(a)||String.fromCharCode(a)),getAllKeyCodes=()=>{const a=[];return Object.keys(_handlers).forEach(s=>{_handlers[s].forEach(({key:c,scope:u,mods:d,shortcut:p})=>{a.push({scope:u,shortcut:p,mods:d,keys:c.split("+").map(v=>code(v))})})}),a},filter$1=a=>{const s=a.target||a.srcElement,{tagName:c}=s;let u=!0;const d=c==="INPUT"&&!["checkbox","radio","range","button","file","reset","submit","color"].includes(s.type);return(s.isContentEditable||(d||c==="TEXTAREA"||c==="SELECT")&&!s.readOnly)&&(u=!1),u},isPressed=a=>(typeof a=="string"&&(a=code(a)),_downKeys.indexOf(a)!==-1),deleteScope=(a,s)=>{let c,u;a||(a=getScope());for(const d in _handlers)if(Object.prototype.hasOwnProperty.call(_handlers,d))for(c=_handlers[d],u=0;u<c.length;)c[u].scope===a?c.splice(u,1).forEach(({element:v})=>removeKeyEvent(v)):u++;getScope()===a&&setScope(s||"all")};function clearModifier(a){let s=getLayoutIndependentKeyCode(a);a.key&&a.key.toLowerCase()==="capslock"&&(s=code(a.key));const c=_downKeys.indexOf(s);if(c>=0&&_downKeys.splice(c,1),a.key&&a.key.toLowerCase()==="meta"&&_downKeys.splice(0,_downKeys.length),(s===93||s===224)&&(s=91),s in _mods){_mods[s]=!1;for(const u in _modifier)_modifier[u]===s&&(hotkeys$1[u]=!1)}}const unbind=(a,...s)=>{if(typeof a>"u")Object.keys(_handlers).forEach(c=>{Array.isArray(_handlers[c])&&_handlers[c].forEach(u=>eachUnbind(u)),delete _handlers[c]}),removeKeyEvent(null);else if(Array.isArray(a))a.forEach(c=>{c.key&&eachUnbind(c)});else if(typeof a=="object")a.key&&eachUnbind(a);else if(typeof a=="string"){let[c,u]=s;typeof c=="function"&&(u=c,c=""),eachUnbind({key:a,scope:c,method:u,splitKey:"+"})}},eachUnbind=({key:a,scope:s,method:c,splitKey:u="+"})=>{getKeys$1(a).forEach(p=>{const v=p.split(u),A=v.length,x=v[A-1],g=x==="*"?"*":code(x);if(!_handlers[g])return;s||(s=getScope());const b=A>1?getMods(_modifier,v):[],y=[];_handlers[g]=_handlers[g].filter(f=>{const E=(c?f.method===c:!0)&&f.scope===s&&compareArray(f.mods,b);return E&&y.push(f.element),!E}),y.forEach(f=>removeKeyEvent(f))})};function eventHandler(a,s,c,u){if(s.element!==u)return;let d;if(s.scope===c||s.scope==="all"){d=s.mods.length>0;for(const p in _mods)Object.prototype.hasOwnProperty.call(_mods,p)&&(!_mods[p]&&s.mods.indexOf(+p)>-1||_mods[p]&&s.mods.indexOf(+p)===-1)&&(d=!1);(s.mods.length===0&&!_mods[16]&&!_mods[18]&&!_mods[17]&&!_mods[91]||d||s.shortcut==="*")&&(s.keys=[],s.keys=s.keys.concat(_downKeys),s.method(a,s)===!1&&(a.preventDefault?a.preventDefault():a.returnValue=!1,a.stopPropagation&&a.stopPropagation(),a.cancelBubble&&(a.cancelBubble=!0)))}}function dispatch(a,s){const c=_handlers["*"];let u=getLayoutIndependentKeyCode(a);if(a.key&&a.key.toLowerCase()==="capslock"||!(hotkeys$1.filter||filter$1).call(this,a))return;if((u===93||u===224)&&(u=91),_downKeys.indexOf(u)===-1&&u!==229&&_downKeys.push(u),["metaKey","ctrlKey","altKey","shiftKey"].forEach(x=>{const g=modifierMap[x];a[x]&&_downKeys.indexOf(g)===-1?_downKeys.push(g):!a[x]&&_downKeys.indexOf(g)>-1?_downKeys.splice(_downKeys.indexOf(g),1):x==="metaKey"&&a[x]&&(_downKeys=_downKeys.filter(b=>b in modifierMap||b===u))}),u in _mods){_mods[u]=!0;for(const x in _modifier)if(Object.prototype.hasOwnProperty.call(_modifier,x)){const g=modifierMap[_modifier[x]];hotkeys$1[x]=a[g]}if(!c)return}for(const x in _mods)Object.prototype.hasOwnProperty.call(_mods,x)&&(_mods[x]=a[modifierMap[x]]);a.getModifierState&&!(a.altKey&&!a.ctrlKey)&&a.getModifierState("AltGraph")&&(_downKeys.indexOf(17)===-1&&_downKeys.push(17),_downKeys.indexOf(18)===-1&&_downKeys.push(18),_mods[17]=!0,_mods[18]=!0);const p=getScope();if(c)for(let x=0;x<c.length;x++)c[x].scope===p&&(a.type==="keydown"&&c[x].keydown||a.type==="keyup"&&c[x].keyup)&&eventHandler(a,c[x],p,s);if(!(u in _handlers))return;const v=_handlers[u],A=v.length;for(let x=0;x<A;x++)if((a.type==="keydown"&&v[x].keydown||a.type==="keyup"&&v[x].keyup)&&v[x].key){const g=v[x],{splitKey:b}=g,y=g.key.split(b),f=[];for(let m=0;m<y.length;m++)f.push(code(y[m]));f.sort().join("")===_downKeys.sort().join("")&&eventHandler(a,g,p,s)}}const hotkeys$1=function a(s,c,u){_downKeys=[];const d=getKeys$1(s);let p=[],v="all",A=document,x=0,g=!1,b=!0,y="+",f=!1,m=!1;if(u===void 0&&typeof c=="function"&&(u=c),Object.prototype.toString.call(c)==="[object Object]"){const E=c;E.scope&&(v=E.scope),E.element&&(A=E.element),E.keyup&&(g=E.keyup),E.keydown!==void 0&&(b=E.keydown),E.capture!==void 0&&(f=E.capture),typeof E.splitKey=="string"&&(y=E.splitKey),E.single===!0&&(m=!0)}for(typeof c=="string"&&(v=c),m&&unbind(s,v);x<d.length;x++){const E=d[x].split(y);p=[],E.length>1&&(p=getMods(_modifier,E));let w=E[E.length-1];w=w==="*"?"*":code(w),w in _handlers||(_handlers[w]=[]),_handlers[w].push({keyup:g,keydown:b,scope:v,mods:p,shortcut:d[x],method:u,key:d[x],splitKey:y,element:A})}if(typeof A<"u"&&typeof window<"u"){if(!elementEventMap.has(A)){const E=(S=window.event)=>dispatch(S,A),w=(S=window.event)=>{dispatch(S,A),clearModifier(S)};elementEventMap.set(A,{keydownListener:E,keyupListenr:w,capture:f}),addEvent$1(A,"keydown",E,f),addEvent$1(A,"keyup",w,f)}if(!winListendFocus){const E=()=>{_downKeys=[]};winListendFocus={listener:E,capture:f},addEvent$1(window,"focus",E,f)}if(!winListendFullscreen&&typeof document<"u"){const E=()=>{_downKeys=[];for(const $ in _mods)_mods[$]=!1;for(const $ in _modifier)a[$]=!1},w=E,S=E;document.addEventListener("fullscreenchange",w),document.addEventListener("webkitfullscreenchange",S),winListendFullscreen={fullscreen:w,webkit:S}}}};function trigger(a,s="all"){Object.keys(_handlers).forEach(c=>{_handlers[c].filter(d=>d.scope===s&&d.shortcut===a).forEach(d=>{d&&d.method&&d.method({},d)})})}function removeKeyEvent(a){const s=Object.values(_handlers).flat();if(s.findIndex(({element:u})=>u===a)<0&&a){const{keydownListener:u,keyupListenr:d,capture:p}=elementEventMap.get(a)||{};u&&d&&(removeEvent$1(a,"keyup",d,p),removeEvent$1(a,"keydown",u,p),elementEventMap.delete(a))}if(s.length<=0||elementEventMap.size<=0){if(Array.from(elementEventMap.keys()).forEach(d=>{const{keydownListener:p,keyupListenr:v,capture:A}=elementEventMap.get(d)||{};p&&v&&(removeEvent$1(d,"keyup",v,A),removeEvent$1(d,"keydown",p,A),elementEventMap.delete(d))}),elementEventMap.clear(),Object.keys(_handlers).forEach(d=>delete _handlers[d]),winListendFocus){const{listener:d,capture:p}=winListendFocus;removeEvent$1(window,"focus",d,p),winListendFocus=null}winListendFullscreen&&typeof document<"u"&&(document.removeEventListener("fullscreenchange",winListendFullscreen.fullscreen),document.removeEventListener("webkitfullscreenchange",winListendFullscreen.webkit),winListendFullscreen=null)}}const _api={getPressedKeyString,setScope,getScope,deleteScope,getPressedKeyCodes,getAllKeyCodes,isPressed,filter:filter$1,trigger,unbind,keyMap:_keyMap,modifier:_modifier,modifierMap};for(const a in _api){const s=a;Object.prototype.hasOwnProperty.call(_api,s)&&(hotkeys$1[s]=_api[s])}if(typeof window<"u"){const a=window.hotkeys;hotkeys$1.noConflict=s=>(s&&window.hotkeys===hotkeys$1&&(window.hotkeys=a),hotkeys$1),window.hotkeys=hotkeys$1}typeof module<"u"&&module.exports&&(module.exports=hotkeys$1,module.exports.default=hotkeys$1);var reactExports=requireReact();const React=getDefaultExportFromCjs(reactExports),React$1=_mergeNamespaces({__proto__:null,default:React},[reactExports]);function commonjsRequire(a){throw new Error('Could not dynamically require "'+a+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf={exports:{}};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$5=getAugmentedNamespace(__viteBrowserExternal$1);var hasRequiredPdf;function requirePdf(){return hasRequiredPdf||(hasRequiredPdf=1,(function(module,exports$1){(function(s,c){module.exports=s.pdfjsLib=c()})(globalThis,()=>(()=>{var __webpack_modules__=[,((a,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.VerbosityLevel=s.Util=s.UnknownErrorException=s.UnexpectedResponseException=s.TextRenderingMode=s.RenderingIntentFlag=s.PromiseCapability=s.PermissionFlag=s.PasswordResponses=s.PasswordException=s.PageActionEventType=s.OPS=s.MissingPDFException=s.MAX_IMAGE_SIZE_TO_CACHE=s.LINE_FACTOR=s.LINE_DESCENT_FACTOR=s.InvalidPDFException=s.ImageKind=s.IDENTITY_MATRIX=s.FormatError=s.FeatureTest=s.FONT_IDENTITY_MATRIX=s.DocumentActionEventType=s.CMapCompressionType=s.BaseException=s.BASELINE_FACTOR=s.AnnotationType=s.AnnotationReplyType=s.AnnotationPrefix=s.AnnotationMode=s.AnnotationFlag=s.AnnotationFieldFlag=s.AnnotationEditorType=s.AnnotationEditorPrefix=s.AnnotationEditorParamsType=s.AnnotationBorderStyleType=s.AnnotationActionEventType=s.AbortException=void 0,s.assert=k,s.bytesToString=ae,s.createValidAbsoluteUrl=W,s.getModificationDate=Ae,s.getUuid=Te,s.getVerbosityLevel=U,s.info=M,s.isArrayBuffer=we,s.isArrayEqual=$e,s.isNodeJS=void 0,s.normalizeUnicode=Ie,s.objectFromMap=pe,s.objectSize=fe,s.setVerbosityLevel=G,s.shadow=J,s.string32=se,s.stringToBytes=oe,s.stringToPDFString=ye,s.stringToUTF8String=Ee,s.unreachable=R,s.utf8StringToString=xe,s.warn=N;const c=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");s.isNodeJS=c;const u=[1,0,0,1,0,0];s.IDENTITY_MATRIX=u;const d=[.001,0,0,.001,0,0];s.FONT_IDENTITY_MATRIX=d;const p=1e7;s.MAX_IMAGE_SIZE_TO_CACHE=p;const v=1.35;s.LINE_FACTOR=v;const A=.35;s.LINE_DESCENT_FACTOR=A;const x=A/v;s.BASELINE_FACTOR=x;const g={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};s.RenderingIntentFlag=g;const b={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};s.AnnotationMode=b;const y="pdfjs_internal_editor_";s.AnnotationEditorPrefix=y;const f={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15};s.AnnotationEditorType=f;const m={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23};s.AnnotationEditorParamsType=m;const E={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};s.PermissionFlag=E;const w={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};s.TextRenderingMode=w;const S={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};s.ImageKind=S;const $={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};s.AnnotationType=$;const T={GROUP:"Group",REPLY:"R"};s.AnnotationReplyType=T;const _={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};s.AnnotationFlag=_;const I={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};s.AnnotationFieldFlag=I;const C={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};s.AnnotationBorderStyleType=C;const P={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};s.AnnotationActionEventType=P;const O={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};s.DocumentActionEventType=O;const L={O:"PageOpen",C:"PageClose"};s.PageActionEventType=L;const B={ERRORS:0,WARNINGS:1,INFOS:5};s.VerbosityLevel=B;const F={NONE:0,BINARY:1};s.CMapCompressionType=F;const D={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};s.OPS=D;const V={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};s.PasswordResponses=V;let j=B.WARNINGS;function G(Re){Number.isInteger(Re)&&(j=Re)}function U(){return j}function M(Re){j>=B.INFOS&&console.log(`Info: ${Re}`)}function N(Re){j>=B.WARNINGS&&console.log(`Warning: ${Re}`)}function R(Re){throw new Error(Re)}function k(Re,Be){Re||R(Be)}function z(Re){switch(Re?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function W(Re,Be=null,Pe=null){if(!Re)return null;try{if(Pe&&typeof Re=="string"&&(Pe.addDefaultProtocol&&Re.startsWith("www.")&&Re.match(/\./g)?.length>=2&&(Re=`http://${Re}`),Pe.tryConvertEncoding))try{Re=Ee(Re)}catch{}const Me=Be?new URL(Re,Be):new URL(Re);if(z(Me))return Me}catch{}return null}function J(Re,Be,Pe,Me=!1){return Object.defineProperty(Re,Be,{value:Pe,enumerable:!Me,configurable:!0,writable:!1}),Pe}const re=(function(){function Be(Pe,Me){this.constructor===Be&&R("Cannot initialize BaseException."),this.message=Pe,this.name=Me}return Be.prototype=new Error,Be.constructor=Be,Be})();s.BaseException=re;class K extends re{constructor(Be,Pe){super(Be,"PasswordException"),this.code=Pe}}s.PasswordException=K;class q extends re{constructor(Be,Pe){super(Be,"UnknownErrorException"),this.details=Pe}}s.UnknownErrorException=q;class Q extends re{constructor(Be){super(Be,"InvalidPDFException")}}s.InvalidPDFException=Q;class ee extends re{constructor(Be){super(Be,"MissingPDFException")}}s.MissingPDFException=ee;class Y extends re{constructor(Be,Pe){super(Be,"UnexpectedResponseException"),this.status=Pe}}s.UnexpectedResponseException=Y;class Z extends re{constructor(Be){super(Be,"FormatError")}}s.FormatError=Z;class te extends re{constructor(Be){super(Be,"AbortException")}}s.AbortException=te;function ae(Re){(typeof Re!="object"||Re?.length===void 0)&&R("Invalid argument for bytesToString");const Be=Re.length,Pe=8192;if(Be<Pe)return String.fromCharCode.apply(null,Re);const Me=[];for(let Fe=0;Fe<Be;Fe+=Pe){const Ue=Math.min(Fe+Pe,Be),ze=Re.subarray(Fe,Ue);Me.push(String.fromCharCode.apply(null,ze))}return Me.join("")}function oe(Re){typeof Re!="string"&&R("Invalid argument for stringToBytes");const Be=Re.length,Pe=new Uint8Array(Be);for(let Me=0;Me<Be;++Me)Pe[Me]=Re.charCodeAt(Me)&255;return Pe}function se(Re){return String.fromCharCode(Re>>24&255,Re>>16&255,Re>>8&255,Re&255)}function fe(Re){return Object.keys(Re).length}function pe(Re){const Be=Object.create(null);for(const[Pe,Me]of Re)Be[Pe]=Me;return Be}function ge(){const Re=new Uint8Array(4);return Re[0]=1,new Uint32Array(Re.buffer,0,1)[0]===1}function me(){try{return new Function(""),!0}catch{return!1}}class be{static get isLittleEndian(){return J(this,"isLittleEndian",ge())}static get isEvalSupported(){return J(this,"isEvalSupported",me())}static get isOffscreenCanvasSupported(){return J(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?J(this,"platform",{isWin:!1,isMac:!1}):J(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){return J(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}s.FeatureTest=be;const le=[...Array(256).keys()].map(Re=>Re.toString(16).padStart(2,"0"));class ve{static makeHexColor(Be,Pe,Me){return`#${le[Be]}${le[Pe]}${le[Me]}`}static scaleMinMax(Be,Pe){let Me;Be[0]?(Be[0]<0&&(Me=Pe[0],Pe[0]=Pe[1],Pe[1]=Me),Pe[0]*=Be[0],Pe[1]*=Be[0],Be[3]<0&&(Me=Pe[2],Pe[2]=Pe[3],Pe[3]=Me),Pe[2]*=Be[3],Pe[3]*=Be[3]):(Me=Pe[0],Pe[0]=Pe[2],Pe[2]=Me,Me=Pe[1],Pe[1]=Pe[3],Pe[3]=Me,Be[1]<0&&(Me=Pe[2],Pe[2]=Pe[3],Pe[3]=Me),Pe[2]*=Be[1],Pe[3]*=Be[1],Be[2]<0&&(Me=Pe[0],Pe[0]=Pe[1],Pe[1]=Me),Pe[0]*=Be[2],Pe[1]*=Be[2]),Pe[0]+=Be[4],Pe[1]+=Be[4],Pe[2]+=Be[5],Pe[3]+=Be[5]}static transform(Be,Pe){return[Be[0]*Pe[0]+Be[2]*Pe[1],Be[1]*Pe[0]+Be[3]*Pe[1],Be[0]*Pe[2]+Be[2]*Pe[3],Be[1]*Pe[2]+Be[3]*Pe[3],Be[0]*Pe[4]+Be[2]*Pe[5]+Be[4],Be[1]*Pe[4]+Be[3]*Pe[5]+Be[5]]}static applyTransform(Be,Pe){const Me=Be[0]*Pe[0]+Be[1]*Pe[2]+Pe[4],Fe=Be[0]*Pe[1]+Be[1]*Pe[3]+Pe[5];return[Me,Fe]}static applyInverseTransform(Be,Pe){const Me=Pe[0]*Pe[3]-Pe[1]*Pe[2],Fe=(Be[0]*Pe[3]-Be[1]*Pe[2]+Pe[2]*Pe[5]-Pe[4]*Pe[3])/Me,Ue=(-Be[0]*Pe[1]+Be[1]*Pe[0]+Pe[4]*Pe[1]-Pe[5]*Pe[0])/Me;return[Fe,Ue]}static getAxialAlignedBoundingBox(Be,Pe){const Me=this.applyTransform(Be,Pe),Fe=this.applyTransform(Be.slice(2,4),Pe),Ue=this.applyTransform([Be[0],Be[3]],Pe),ze=this.applyTransform([Be[2],Be[1]],Pe);return[Math.min(Me[0],Fe[0],Ue[0],ze[0]),Math.min(Me[1],Fe[1],Ue[1],ze[1]),Math.max(Me[0],Fe[0],Ue[0],ze[0]),Math.max(Me[1],Fe[1],Ue[1],ze[1])]}static inverseTransform(Be){const Pe=Be[0]*Be[3]-Be[1]*Be[2];return[Be[3]/Pe,-Be[1]/Pe,-Be[2]/Pe,Be[0]/Pe,(Be[2]*Be[5]-Be[4]*Be[3])/Pe,(Be[4]*Be[1]-Be[5]*Be[0])/Pe]}static singularValueDecompose2dScale(Be){const Pe=[Be[0],Be[2],Be[1],Be[3]],Me=Be[0]*Pe[0]+Be[1]*Pe[2],Fe=Be[0]*Pe[1]+Be[1]*Pe[3],Ue=Be[2]*Pe[0]+Be[3]*Pe[2],ze=Be[2]*Pe[1]+Be[3]*Pe[3],Le=(Me+ze)/2,ke=Math.sqrt((Me+ze)**2-4*(Me*ze-Ue*Fe))/2,je=Le+ke||1,Xe=Le-ke||1;return[Math.sqrt(je),Math.sqrt(Xe)]}static normalizeRect(Be){const Pe=Be.slice(0);return Be[0]>Be[2]&&(Pe[0]=Be[2],Pe[2]=Be[0]),Be[1]>Be[3]&&(Pe[1]=Be[3],Pe[3]=Be[1]),Pe}static intersect(Be,Pe){const Me=Math.max(Math.min(Be[0],Be[2]),Math.min(Pe[0],Pe[2])),Fe=Math.min(Math.max(Be[0],Be[2]),Math.max(Pe[0],Pe[2]));if(Me>Fe)return null;const Ue=Math.max(Math.min(Be[1],Be[3]),Math.min(Pe[1],Pe[3])),ze=Math.min(Math.max(Be[1],Be[3]),Math.max(Pe[1],Pe[3]));return Ue>ze?null:[Me,Ue,Fe,ze]}static bezierBoundingBox(Be,Pe,Me,Fe,Ue,ze,Le,ke){const je=[],Xe=[[],[]];let it,tt,ht,ft,qe,Je,ct,ot;for(let yt=0;yt<2;++yt){if(yt===0?(tt=6*Be-12*Me+6*Ue,it=-3*Be+9*Me-9*Ue+3*Le,ht=3*Me-3*Be):(tt=6*Pe-12*Fe+6*ze,it=-3*Pe+9*Fe-9*ze+3*ke,ht=3*Fe-3*Pe),Math.abs(it)<1e-12){if(Math.abs(tt)<1e-12)continue;ft=-ht/tt,0<ft&&ft<1&&je.push(ft);continue}ct=tt*tt-4*ht*it,ot=Math.sqrt(ct),!(ct<0)&&(qe=(-tt+ot)/(2*it),0<qe&&qe<1&&je.push(qe),Je=(-tt-ot)/(2*it),0<Je&&Je<1&&je.push(Je))}let Ke=je.length,Ze;const st=Ke;for(;Ke--;)ft=je[Ke],Ze=1-ft,Xe[0][Ke]=Ze*Ze*Ze*Be+3*Ze*Ze*ft*Me+3*Ze*ft*ft*Ue+ft*ft*ft*Le,Xe[1][Ke]=Ze*Ze*Ze*Pe+3*Ze*Ze*ft*Fe+3*Ze*ft*ft*ze+ft*ft*ft*ke;return Xe[0][st]=Be,Xe[1][st]=Pe,Xe[0][st+1]=Le,Xe[1][st+1]=ke,Xe[0].length=Xe[1].length=st+2,[Math.min(...Xe[0]),Math.min(...Xe[1]),Math.max(...Xe[0]),Math.max(...Xe[1])]}}s.Util=ve;const he=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function ye(Re){if(Re[0]>="ï"){let Pe;if(Re[0]==="þ"&&Re[1]==="ÿ"?Pe="utf-16be":Re[0]==="ÿ"&&Re[1]==="þ"?Pe="utf-16le":Re[0]==="ï"&&Re[1]==="»"&&Re[2]==="¿"&&(Pe="utf-8"),Pe)try{const Me=new TextDecoder(Pe,{fatal:!0}),Fe=oe(Re);return Me.decode(Fe)}catch(Me){N(`stringToPDFString: "${Me}".`)}}const Be=[];for(let Pe=0,Me=Re.length;Pe<Me;Pe++){const Fe=he[Re.charCodeAt(Pe)];Be.push(Fe?String.fromCharCode(Fe):Re.charAt(Pe))}return Be.join("")}function Ee(Re){return decodeURIComponent(escape(Re))}function xe(Re){return unescape(encodeURIComponent(Re))}function we(Re){return typeof Re=="object"&&Re?.byteLength!==void 0}function $e(Re,Be){if(Re.length!==Be.length)return!1;for(let Pe=0,Me=Re.length;Pe<Me;Pe++)if(Re[Pe]!==Be[Pe])return!1;return!0}function Ae(Re=new Date){return[Re.getUTCFullYear().toString(),(Re.getUTCMonth()+1).toString().padStart(2,"0"),Re.getUTCDate().toString().padStart(2,"0"),Re.getUTCHours().toString().padStart(2,"0"),Re.getUTCMinutes().toString().padStart(2,"0"),Re.getUTCSeconds().toString().padStart(2,"0")].join("")}class ue{#e=!1;constructor(){this.promise=new Promise((Be,Pe)=>{this.resolve=Me=>{this.#e=!0,Be(Me)},this.reject=Me=>{this.#e=!0,Pe(Me)}})}get settled(){return this.#e}}s.PromiseCapability=ue;let ce=null,Ce=null;function Ie(Re){return ce||(ce=/([\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,Ce=new Map([["ſt","ſt"]])),Re.replaceAll(ce,(Be,Pe,Me)=>Pe?Pe.normalize("NFKC"):Ce.get(Me))}function Te(){if(typeof crypto<"u"&&typeof crypto?.randomUUID=="function")return crypto.randomUUID();const Re=new Uint8Array(32);if(typeof crypto<"u"&&typeof crypto?.getRandomValues=="function")crypto.getRandomValues(Re);else for(let Be=0;Be<32;Be++)Re[Be]=Math.floor(Math.random()*255);return ae(Re)}const De="pdfjs_internal_id_";s.AnnotationPrefix=De}),((__unused_webpack_module,exports$1,__w_pdfjs_require__)=>{Object.defineProperty(exports$1,"__esModule",{value:!0}),exports$1.RenderTask=exports$1.PDFWorkerUtil=exports$1.PDFWorker=exports$1.PDFPageProxy=exports$1.PDFDocumentProxy=exports$1.PDFDocumentLoadingTask=exports$1.PDFDataRangeTransport=exports$1.LoopbackPort=exports$1.DefaultStandardFontDataFactory=exports$1.DefaultFilterFactory=exports$1.DefaultCanvasFactory=exports$1.DefaultCMapReaderFactory=void 0,Object.defineProperty(exports$1,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports$1.build=void 0,exports$1.getDocument=getDocument,exports$1.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports$1.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports$1.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports$1.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports$1.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;function getDocument(a){if(typeof a=="string"||a instanceof URL?a={url:a}:(0,_util.isArrayBuffer)(a)&&(a={data:a}),typeof a!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!a.url&&!a.data&&!a.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const s=new PDFDocumentLoadingTask,{docId:c}=s,u=a.url?getUrlProp(a.url):null,d=a.data?getDataProp(a.data):null,p=a.httpHeaders||null,v=a.withCredentials===!0,A=a.password??null,x=a.range instanceof PDFDataRangeTransport?a.range:null,g=Number.isInteger(a.rangeChunkSize)&&a.rangeChunkSize>0?a.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let b=a.worker instanceof PDFWorker?a.worker:null;const y=a.verbosity,f=typeof a.docBaseUrl=="string"&&!(0,_display_utils.isDataScheme)(a.docBaseUrl)?a.docBaseUrl:null,m=typeof a.cMapUrl=="string"?a.cMapUrl:null,E=a.cMapPacked!==!1,w=a.CMapReaderFactory||DefaultCMapReaderFactory,S=typeof a.standardFontDataUrl=="string"?a.standardFontDataUrl:null,$=a.StandardFontDataFactory||DefaultStandardFontDataFactory,T=a.stopAtErrors!==!0,_=Number.isInteger(a.maxImageSize)&&a.maxImageSize>-1?a.maxImageSize:-1,I=a.isEvalSupported!==!1,C=typeof a.isOffscreenCanvasSupported=="boolean"?a.isOffscreenCanvasSupported:!_util.isNodeJS,P=Number.isInteger(a.canvasMaxAreaInBytes)?a.canvasMaxAreaInBytes:-1,O=typeof a.disableFontFace=="boolean"?a.disableFontFace:_util.isNodeJS,L=a.fontExtraProperties===!0,B=a.enableXfa===!0,F=a.ownerDocument||globalThis.document,D=a.disableRange===!0,V=a.disableStream===!0,j=a.disableAutoFetch===!0,G=a.pdfBug===!0,U=x?x.length:a.length??NaN,M=typeof a.useSystemFonts=="boolean"?a.useSystemFonts:!_util.isNodeJS&&!O,N=typeof a.useWorkerFetch=="boolean"?a.useWorkerFetch:w===_display_utils.DOMCMapReaderFactory&&$===_display_utils.DOMStandardFontDataFactory&&m&&S&&(0,_display_utils.isValidFetchUrl)(m,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(S,document.baseURI),R=a.canvasFactory||new DefaultCanvasFactory({ownerDocument:F}),k=a.filterFactory||new DefaultFilterFactory({docId:c,ownerDocument:F}),z=null;(0,_util.setVerbosityLevel)(y);const W={canvasFactory:R,filterFactory:k};if(N||(W.cMapReaderFactory=new w({baseUrl:m,isCompressed:E}),W.standardFontDataFactory=new $({baseUrl:S})),!b){const K={verbosity:y,port:_worker_options.GlobalWorkerOptions.workerPort};b=K.port?PDFWorker.fromPort(K):new PDFWorker(K),s._worker=b}const J={docId:c,apiVersion:"3.11.174",data:d,password:A,disableAutoFetch:j,rangeChunkSize:g,length:U,docBaseUrl:f,enableXfa:B,evaluatorOptions:{maxImageSize:_,disableFontFace:O,ignoreErrors:T,isEvalSupported:I,isOffscreenCanvasSupported:C,canvasMaxAreaInBytes:P,fontExtraProperties:L,useSystemFonts:M,cMapUrl:N?m:null,standardFontDataUrl:N?S:null}},re={ignoreErrors:T,isEvalSupported:I,disableFontFace:O,fontExtraProperties:L,enableXfa:B,ownerDocument:F,disableAutoFetch:j,pdfBug:G,styleElement:z};return b.promise.then(function(){if(s.destroyed)throw new Error("Loading aborted");const K=_fetchDocument(b,J),q=new Promise(function(Q){let ee;x?ee=new _transport_stream.PDFDataTransportStream({length:U,initialData:x.initialData,progressiveDone:x.progressiveDone,contentDispositionFilename:x.contentDispositionFilename,disableRange:D,disableStream:V},x):d||(ee=(Z=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(Z):(0,_display_utils.isValidFetchUrl)(Z.url)?new _displayFetch_stream.PDFFetchStream(Z):new _displayNetwork.PDFNetworkStream(Z))({url:u,length:U,httpHeaders:p,withCredentials:v,rangeChunkSize:g,disableRange:D,disableStream:V})),Q(ee)});return Promise.all([K,q]).then(function([Q,ee]){if(s.destroyed)throw new Error("Loading aborted");const Y=new _message_handler.MessageHandler(c,Q,b.port),Z=new WorkerTransport(Y,s,ee,re,W);s._transport=Z,Y.send("Ready",null)})}).catch(s._capability.reject),s}async function _fetchDocument(a,s){if(a.destroyed)throw new Error("Worker was destroyed");const c=await a.messageHandler.sendWithPromise("GetDocRequest",s,s.data?[s.data.buffer]:null);if(a.destroyed)throw new Error("Worker was destroyed");return c}function getUrlProp(a){if(a instanceof URL)return a.href;try{return new URL(a,window.location).href}catch{if(_util.isNodeJS&&typeof a=="string")return a}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(a){if(_util.isNodeJS&&typeof Buffer<"u"&&a instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength)return a;if(typeof a=="string")return(0,_util.stringToBytes)(a);if(typeof a=="object"&&!isNaN(a?.length)||(0,_util.isArrayBuffer)(a))return new Uint8Array(a);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}class PDFDocumentLoadingTask{static#e=0;constructor(){this._capability=new _util.PromiseCapability,this._transport=null,this._worker=null,this.docId=`d${PDFDocumentLoadingTask.#e++}`,this.destroyed=!1,this.onPassword=null,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(s){throw this._worker?.port&&delete this._worker._pendingDestroy,s}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}exports$1.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(s,c,u=!1,d=null){this.length=s,this.initialData=c,this.progressiveDone=u,this.contentDispositionFilename=d,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(s){this._rangeListeners.push(s)}addProgressListener(s){this._progressListeners.push(s)}addProgressiveReadListener(s){this._progressiveReadListeners.push(s)}addProgressiveDoneListener(s){this._progressiveDoneListeners.push(s)}onDataRange(s,c){for(const u of this._rangeListeners)u(s,c)}onDataProgress(s,c){this._readyCapability.promise.then(()=>{for(const u of this._progressListeners)u(s,c)})}onDataProgressiveRead(s){this._readyCapability.promise.then(()=>{for(const c of this._progressiveReadListeners)c(s)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const s of this._progressiveDoneListeners)s()})}transportReady(){this._readyCapability.resolve()}requestDataRange(s,c){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports$1.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(s,c){this._pdfInfo=s,this._transport=c,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then(u=>{if(!u)return u;const d=[];for(const p in u)d.push(...u[p]);return d}))})}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(s){return this._transport.getPage(s)}getPageIndex(s){return this._transport.getPageIndex(s)}getDestinations(){return this._transport.getDestinations()}getDestination(s){return this._transport.getDestination(s)}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()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}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()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(s=!1){return this._transport.startCleanup(s||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}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()}}exports$1.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{#e=null;#t=!1;constructor(s,c,u,d=!1){this._pageIndex=s,this._pageInfo=c,this._transport=u,this._stats=d?new _display_utils.StatTimer:null,this._pdfBug=d,this.commonObjs=u.commonObjs,this.objs=new PDFObjects,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}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:s,rotation:c=this.rotate,offsetX:u=0,offsetY:d=0,dontFlip:p=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:s,rotation:c,offsetX:u,offsetY:d,dontFlip:p})}getAnnotations({intent:s="display"}={}){const c=this._transport.getRenderingIntent(s);return this._transport.getAnnotations(this._pageIndex,c.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:s,viewport:c,intent:u="display",annotationMode:d=_util.AnnotationMode.ENABLE,transform:p=null,background:v=null,optionalContentConfigPromise:A=null,annotationCanvasMap:x=null,pageColors:g=null,printAnnotationStorage:b=null}){this._stats?.time("Overall");const y=this._transport.getRenderingIntent(u,d,b);this.#t=!1,this.#n(),A||(A=this._transport.getOptionalContentConfig());let f=this._intentStates.get(y.cacheKey);f||(f=Object.create(null),this._intentStates.set(y.cacheKey,f)),f.streamReaderCancelTimeout&&(clearTimeout(f.streamReaderCancelTimeout),f.streamReaderCancelTimeout=null);const m=!!(y.renderingIntent&_util.RenderingIntentFlag.PRINT);f.displayReadyCapability||(f.displayReadyCapability=new _util.PromiseCapability,f.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(y));const E=$=>{f.renderTasks.delete(w),(this._maybeCleanupAfterRender||m)&&(this.#t=!0),this.#r(!m),$?(w.capability.reject($),this._abortOperatorList({intentState:f,reason:$ instanceof Error?$:new Error($)})):w.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},w=new InternalRenderTask({callback:E,params:{canvasContext:s,viewport:c,transform:p,background:v},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:x,operatorList:f.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!m,pdfBug:this._pdfBug,pageColors:g});(f.renderTasks||=new Set).add(w);const S=w.task;return Promise.all([f.displayReadyCapability.promise,A]).then(([$,T])=>{if(this.destroyed){E();return}this._stats?.time("Rendering"),w.initializeGraphics({transparency:$,optionalContentConfig:T}),w.operatorListChanged()}).catch(E),S}getOperatorList({intent:s="display",annotationMode:c=_util.AnnotationMode.ENABLE,printAnnotationStorage:u=null}={}){function d(){v.operatorList.lastChunk&&(v.opListReadCapability.resolve(v.operatorList),v.renderTasks.delete(A))}const p=this._transport.getRenderingIntent(s,c,u,!0);let v=this._intentStates.get(p.cacheKey);v||(v=Object.create(null),this._intentStates.set(p.cacheKey,v));let A;return v.opListReadCapability||(A=Object.create(null),A.operatorListChanged=d,v.opListReadCapability=new _util.PromiseCapability,(v.renderTasks||=new Set).add(A),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(p)),v.opListReadCapability.promise}streamTextContent({includeMarkedContent:s=!1,disableNormalization:c=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:s===!0,disableNormalization:c===!0},{highWaterMark:100,size(d){return d.items.length}})}getTextContent(s={}){if(this._transport._htmlForXfa)return this.getXfa().then(u=>_xfa_text.XfaText.textContent(u));const c=this.streamTextContent(s);return new Promise(function(u,d){function p(){v.read().then(function({value:x,done:g}){if(g){u(A);return}Object.assign(A.styles,x.styles),A.items.push(...x.items),p()},d)}const v=c.getReader(),A={items:[],styles:Object.create(null)};p()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const s=[];for(const c of this._intentStates.values())if(this._abortOperatorList({intentState:c,reason:new Error("Page was destroyed."),force:!0}),!c.opListReadCapability)for(const u of c.renderTasks)s.push(u.completed),u.cancel();return this.objs.clear(),this.#t=!1,this.#n(),Promise.all(s)}cleanup(s=!1){this.#t=!0;const c=this.#r(!1);return s&&c&&(this._stats&&=new _display_utils.StatTimer),c}#r(s=!1){if(this.#n(),!this.#t||this.destroyed)return!1;if(s)return this.#e=setTimeout(()=>{this.#e=null,this.#r(!1)},DELAYED_CLEANUP_TIMEOUT),!1;for(const{renderTasks:c,operatorList:u}of this._intentStates.values())if(c.size>0||!u.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}#n(){this.#e&&(clearTimeout(this.#e),this.#e=null)}_startRenderPage(s,c){const u=this._intentStates.get(c);u&&(this._stats?.timeEnd("Page Request"),u.displayReadyCapability?.resolve(s))}_renderPageChunk(s,c){for(let u=0,d=s.length;u<d;u++)c.operatorList.fnArray.push(s.fnArray[u]),c.operatorList.argsArray.push(s.argsArray[u]);c.operatorList.lastChunk=s.lastChunk,c.operatorList.separateAnnots=s.separateAnnots;for(const u of c.renderTasks)u.operatorListChanged();s.lastChunk&&this.#r(!0)}_pumpOperatorList({renderingIntent:s,cacheKey:c,annotationStorageSerializable:u}){const{map:d,transfers:p}=u,A=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:s,cacheKey:c,annotationStorage:d},p).getReader(),x=this._intentStates.get(c);x.streamReader=A;const g=()=>{A.read().then(({value:b,done:y})=>{if(y){x.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(b,x),g())},b=>{if(x.streamReader=null,!this._transport.destroyed){if(x.operatorList){x.operatorList.lastChunk=!0;for(const y of x.renderTasks)y.operatorListChanged();this.#r(!0)}if(x.displayReadyCapability)x.displayReadyCapability.reject(b);else if(x.opListReadCapability)x.opListReadCapability.reject(b);else throw b}})};g()}_abortOperatorList({intentState:s,reason:c,force:u=!1}){if(s.streamReader){if(s.streamReaderCancelTimeout&&(clearTimeout(s.streamReaderCancelTimeout),s.streamReaderCancelTimeout=null),!u){if(s.renderTasks.size>0)return;if(c instanceof _display_utils.RenderingCancelledException){let d=RENDERING_CANCELLED_TIMEOUT;c.extraDelay>0&&c.extraDelay<1e3&&(d+=c.extraDelay),s.streamReaderCancelTimeout=setTimeout(()=>{s.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:s,reason:c,force:!0})},d);return}}if(s.streamReader.cancel(new _util.AbortException(c.message)).catch(()=>{}),s.streamReader=null,!this._transport.destroyed){for(const[d,p]of this._intentStates)if(p===s){this._intentStates.delete(d);break}this.cleanup()}}}get stats(){return this._stats}}exports$1.PDFPageProxy=PDFPageProxy;class LoopbackPort{#e=new Set;#t=Promise.resolve();postMessage(s,c){const u={data:structuredClone(s,c?{transfer:c}:null)};this.#t.then(()=>{for(const d of this.#e)d.call(this,u)})}addEventListener(s,c){this.#e.add(c)}removeEventListener(s,c){this.#e.delete(c)}terminate(){this.#e.clear()}}exports$1.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports$1.PDFWorkerUtil=PDFWorkerUtil;{if(_util.isNodeJS&&typeof commonjsRequire=="function")PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if(typeof document=="object"){const a=document?.currentScript?.src;a&&(PDFWorkerUtil.fallbackWorkerSrc=a.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(a,s){let c;try{if(c=new URL(a),!c.origin||c.origin==="null")return!1}catch{return!1}const u=new URL(s,c);return c.origin===u.origin},PDFWorkerUtil.createCDNWrapper=function(a){const s=`importScripts("${a}");`;return URL.createObjectURL(new Blob([s]))}}class PDFWorker{static#workerPorts;constructor({name:a=null,port:s=null,verbosity:c=(0,_util.getVerbosityLevel)()}={}){if(this.name=a,this.destroyed=!1,this.verbosity=c,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,s){if(PDFWorker.#workerPorts?.has(s))throw new Error("Cannot use more than one PDFWorker per port.");(PDFWorker.#workerPorts||=new WeakMap).set(s,this),this._initializeFromPort(s);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(a){this._port=a,this._messageHandler=new _message_handler.MessageHandler("main","worker",a),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:a}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,a)||(a=PDFWorkerUtil.createCDNWrapper(new URL(a,window.location).href));const s=new Worker(a),c=new _message_handler.MessageHandler("main","worker",s),u=()=>{s.removeEventListener("error",d),c.destroy(),s.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},d=()=>{this._webWorker||u()};s.addEventListener("error",d),c.on("test",v=>{if(s.removeEventListener("error",d),this.destroyed){u();return}v?(this._messageHandler=c,this._port=s,this._webWorker=s,this._readyCapability.resolve(),c.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),c.destroy(),s.terminate())}),c.on("ready",v=>{if(s.removeEventListener("error",d),this.destroyed){u();return}try{p()}catch{this._setupFakeWorker()}});const p=()=>{const v=new Uint8Array;c.send("test",v,[v.buffer])};p();return}catch{(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),PDFWorker._setupFakeWorkerGlobal.then(a=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const s=new LoopbackPort;this._port=s;const c=`fake${PDFWorkerUtil.fakeWorkerId++}`,u=new _message_handler.MessageHandler(c+"_worker",c,s);a.setup(u,s);const d=new _message_handler.MessageHandler(c,c+"_worker",s);this._messageHandler=d,this._readyCapability.resolve(),d.send("configure",{verbosity:this.verbosity})}).catch(a=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${a.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),PDFWorker.#workerPorts?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(a){if(!a?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const s=this.#workerPorts?.get(a.port);if(s){if(s._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return s}return new PDFWorker(a)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _util.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS&&typeof commonjsRequire=="function"){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports$1.PDFWorker=PDFWorker;class WorkerTransport{#e=new Map;#t=new Map;#r=new Map;#n=null;constructor(s,c,u,d,p){this.messageHandler=s,this.loadingTask=c,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:d.ownerDocument,styleElement:d.styleElement}),this._params=d,this.canvasFactory=p.canvasFactory,this.filterFactory=p.filterFactory,this.cMapReaderFactory=p.cMapReaderFactory,this.standardFontDataFactory=p.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=u,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}#s(s,c=null){const u=this.#e.get(s);if(u)return u;const d=this.messageHandler.sendWithPromise(s,c);return this.#e.set(s,d),d}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(s,c=_util.AnnotationMode.ENABLE,u=null,d=!1){let p=_util.RenderingIntentFlag.DISPLAY,v=_annotation_storage.SerializableEmpty;switch(s){case"any":p=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":p=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${s}`)}switch(c){case _util.AnnotationMode.DISABLE:p+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:p+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:p+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,v=(p&_util.RenderingIntentFlag.PRINT&&u instanceof _annotation_storage.PrintAnnotationStorage?u:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${c}`)}return d&&(p+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:p,cacheKey:`${p}_${v.hash}`,annotationStorageSerializable:v}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,this.#n?.reject(new Error("Worker was destroyed during onPassword callback"));const s=[];for(const u of this.#t.values())s.push(u._destroy());this.#t.clear(),this.#r.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const c=this.messageHandler.sendWithPromise("Terminate",null);return s.push(c),Promise.all(s).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),this._networkStream?.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:s,loadingTask:c}=this;s.on("GetReader",(u,d)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=p=>{this._lastProgress={loaded:p.loaded,total:p.total}},d.onPull=()=>{this._fullReader.read().then(function({value:p,done:v}){if(v){d.close();return}(0,_util.assert)(p instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),d.enqueue(new Uint8Array(p),1,[p])}).catch(p=>{d.error(p)})},d.onCancel=p=>{this._fullReader.cancel(p),d.ready.catch(v=>{if(!this.destroyed)throw v})}}),s.on("ReaderHeadersReady",u=>{const d=new _util.PromiseCapability,p=this._fullReader;return p.headersReady.then(()=>{(!p.isStreamingSupported||!p.isRangeSupported)&&(this._lastProgress&&c.onProgress?.(this._lastProgress),p.onProgress=v=>{c.onProgress?.({loaded:v.loaded,total:v.total})}),d.resolve({isStreamingSupported:p.isStreamingSupported,isRangeSupported:p.isRangeSupported,contentLength:p.contentLength})},d.reject),d.promise}),s.on("GetRangeReader",(u,d)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const p=this._networkStream.getRangeReader(u.begin,u.end);if(!p){d.close();return}d.onPull=()=>{p.read().then(function({value:v,done:A}){if(A){d.close();return}(0,_util.assert)(v instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),d.enqueue(new Uint8Array(v),1,[v])}).catch(v=>{d.error(v)})},d.onCancel=v=>{p.cancel(v),d.ready.catch(A=>{if(!this.destroyed)throw A})}}),s.on("GetDoc",({pdfInfo:u})=>{this._numPages=u.numPages,this._htmlForXfa=u.htmlForXfa,delete u.htmlForXfa,c._capability.resolve(new PDFDocumentProxy(u,this))}),s.on("DocException",function(u){let d;switch(u.name){case"PasswordException":d=new _util.PasswordException(u.message,u.code);break;case"InvalidPDFException":d=new _util.InvalidPDFException(u.message);break;case"MissingPDFException":d=new _util.MissingPDFException(u.message);break;case"UnexpectedResponseException":d=new _util.UnexpectedResponseException(u.message,u.status);break;case"UnknownErrorException":d=new _util.UnknownErrorException(u.message,u.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}c._capability.reject(d)}),s.on("PasswordRequest",u=>{if(this.#n=new _util.PromiseCapability,c.onPassword){const d=p=>{p instanceof Error?this.#n.reject(p):this.#n.resolve({password:p})};try{c.onPassword(d,u.code)}catch(p){this.#n.reject(p)}}else this.#n.reject(new _util.PasswordException(u.message,u.code));return this.#n.promise}),s.on("DataLoaded",u=>{c.onProgress?.({loaded:u.length,total:u.length}),this.downloadInfoCapability.resolve(u)}),s.on("StartRenderPage",u=>{if(this.destroyed)return;this.#t.get(u.pageIndex)._startRenderPage(u.transparency,u.cacheKey)}),s.on("commonobj",([u,d,p])=>{if(!this.destroyed&&!this.commonObjs.has(u))switch(d){case"Font":const v=this._params;if("error"in p){const g=p.error;(0,_util.warn)(`Error during font loading: ${g}`),this.commonObjs.resolve(u,g);break}const A=v.pdfBug&&globalThis.FontInspector?.enabled?(g,b)=>globalThis.FontInspector.fontAdded(g,b):null,x=new _font_loader.FontFaceObject(p,{isEvalSupported:v.isEvalSupported,disableFontFace:v.disableFontFace,ignoreErrors:v.ignoreErrors,inspectFont:A});this.fontLoader.bind(x).catch(g=>s.sendWithPromise("FontFallback",{id:u})).finally(()=>{!v.fontExtraProperties&&x.data&&(x.data=null),this.commonObjs.resolve(u,x)});break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(u,p);break;default:throw new Error(`Got unknown common object type ${d}`)}}),s.on("obj",([u,d,p,v])=>{if(this.destroyed)return;const A=this.#t.get(d);if(!A.objs.has(u))switch(p){case"Image":if(A.objs.resolve(u,v),v){let x;if(v.bitmap){const{width:g,height:b}=v;x=g*b*4}else x=v.data?.length||0;x>_util.MAX_IMAGE_SIZE_TO_CACHE&&(A._maybeCleanupAfterRender=!0)}break;case"Pattern":A.objs.resolve(u,v);break;default:throw new Error(`Got unknown object type ${p}`)}}),s.on("DocProgress",u=>{this.destroyed||c.onProgress?.({loaded:u.loaded,total:u.total})}),s.on("FetchBuiltInCMap",u=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(u):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),s.on("FetchStandardFontData",u=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(u):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:s,transfers:c}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:s,filename:this._fullReader?.filename??null},c).finally(()=>{this.annotationStorage.resetModified()})}getPage(s){if(!Number.isInteger(s)||s<=0||s>this._numPages)return Promise.reject(new Error("Invalid page request."));const c=s-1,u=this.#r.get(c);if(u)return u;const d=this.messageHandler.sendWithPromise("GetPage",{pageIndex:c}).then(p=>{if(this.destroyed)throw new Error("Transport destroyed");const v=new PDFPageProxy(c,p,this,this._params.pdfBug);return this.#t.set(c,v),v});return this.#r.set(c,d),d}getPageIndex(s){return typeof s!="object"||s===null||!Number.isInteger(s.num)||s.num<0||!Number.isInteger(s.gen)||s.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:s.num,gen:s.gen})}getAnnotations(s,c){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:s,intent:c})}getFieldObjects(){return this.#s("GetFieldObjects")}hasJSActions(){return this.#s("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(s){return typeof s!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:s})}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)}getDocJSActions(){return this.#s("GetDocJSActions")}getPageJSActions(s){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:s})}getStructTree(s){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:s})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(s=>new _optional_content_config.OptionalContentConfig(s))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const s="GetMetadata",c=this.#e.get(s);if(c)return c;const u=this.messageHandler.sendWithPromise(s,null).then(d=>({info:d[0],metadata:d[1]?new _metadata.Metadata(d[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(s,u),u}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(s=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const c of this.#t.values())if(!c.cleanup())throw new Error(`startCleanup: Page ${c.pageNumber} is currently rendering.`);this.commonObjs.clear(),s||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:s,enableXfa:c}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:s,enableXfa:c})}}class PDFObjects{#e=Object.create(null);#t(s){return this.#e[s]||={capability:new _util.PromiseCapability,data:null}}get(s,c=null){if(c){const d=this.#t(s);return d.capability.promise.then(()=>c(d.data)),null}const u=this.#e[s];if(!u?.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${s}.`);return u.data}has(s){return this.#e[s]?.capability.settled||!1}resolve(s,c=null){const u=this.#t(s);u.data=c,u.capability.resolve()}clear(){for(const s in this.#e){const{data:c}=this.#e[s];c?.bitmap?.close()}this.#e=Object.create(null)}}class RenderTask{#e=null;constructor(s){this.#e=s,this.onContinue=null}get promise(){return this.#e.capability.promise}cancel(s=0){this.#e.cancel(null,s)}get separateAnnots(){const{separateAnnots:s}=this.#e.operatorList;if(!s)return!1;const{annotationCanvasMap:c}=this.#e;return s.form||s.canvas&&c?.size>0}}exports$1.RenderTask=RenderTask;class InternalRenderTask{static#e=new WeakSet;constructor({callback:s,params:c,objs:u,commonObjs:d,annotationCanvasMap:p,operatorList:v,pageIndex:A,canvasFactory:x,filterFactory:g,useRequestAnimationFrame:b=!1,pdfBug:y=!1,pageColors:f=null}){this.callback=s,this.params=c,this.objs=u,this.commonObjs=d,this.annotationCanvasMap=p,this.operatorListIdx=null,this.operatorList=v,this._pageIndex=A,this.canvasFactory=x,this.filterFactory=g,this._pdfBug=y,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=b===!0&&typeof window<"u",this.cancelled=!1,this.capability=new _util.PromiseCapability,this.task=new RenderTask(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=c.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:s=!1,optionalContentConfig:c}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#e.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.");InternalRenderTask.#e.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());const{canvasContext:u,viewport:d,transform:p,background:v}=this.params;this.gfx=new _canvas.CanvasGraphics(u,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:c},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:p,viewport:d,transparency:s,background:v}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(s=null,c=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),InternalRenderTask.#e.delete(this._canvas),this.callback(s||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,c))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}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?window.requestAnimationFrame(()=>{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.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),InternalRenderTask.#e.delete(this._canvas),this.callback())))}}const version="3.11.174";exports$1.version=version;const build="ce8716743";exports$1.build=build}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SerializableEmpty=s.PrintAnnotationStorage=s.AnnotationStorage=void 0;var u=c(1),d=c(4),p=c(8);const v=Object.freeze({map:null,hash:"",transfers:void 0});s.SerializableEmpty=v;class A{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(b,y){const f=this.#t.get(b);return f===void 0?y:Object.assign(y,f)}getRawValue(b){return this.#t.get(b)}remove(b){if(this.#t.delete(b),this.#t.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const y of this.#t.values())if(y instanceof d.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(b,y){const f=this.#t.get(b);let m=!1;if(f!==void 0)for(const[E,w]of Object.entries(y))f[E]!==w&&(m=!0,f[E]=w);else m=!0,this.#t.set(b,y);m&&this.#r(),y instanceof d.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(y.constructor._type)}has(b){return this.#t.has(b)}getAll(){return this.#t.size>0?(0,u.objectFromMap)(this.#t):null}setAll(b){for(const[y,f]of Object.entries(b))this.setValue(y,f)}get size(){return this.#t.size}#r(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new x(this)}get serializable(){if(this.#t.size===0)return v;const b=new Map,y=new p.MurmurHash3_64,f=[],m=Object.create(null);let E=!1;for(const[w,S]of this.#t){const $=S instanceof d.AnnotationEditor?S.serialize(!1,m):S;$&&(b.set(w,$),y.update(`${w}:${JSON.stringify($)}`),E||=!!$.bitmap)}if(E)for(const w of b.values())w.bitmap&&f.push(w.bitmap);return b.size>0?{map:b,hash:y.hexdigest(),transfers:f}:v}}s.AnnotationStorage=A;class x extends A{#e;constructor(b){super();const{map:y,hash:f,transfers:m}=b.serializable,E=structuredClone(y,m?{transfer:m}:null);this.#e={map:E,hash:f,transfers:m}}get print(){(0,u.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}}s.PrintAnnotationStorage=x}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AnnotationEditor=void 0;var u=c(5),d=c(1),p=c(6);class v{#e="";#t=!1;#r=null;#n=null;#s=null;#o=!1;#i=null;#l=this.focusin.bind(this);#c=this.focusout.bind(this);#a=!1;#p=!1;#d=!1;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#f=!1;#h=v._zIndex++;static _borderLineWidth=-1;static _colorManager=new u.ColorManager;static _zIndex=1;static SMALL_EDITOR_SIZE=0;constructor(g){this.constructor===v&&(0,d.unreachable)("Cannot initialize AnnotationEditor."),this.parent=g.parent,this.id=g.id,this.width=this.height=null,this.pageIndex=g.parent.pageIndex,this.name=g.name,this.div=null,this._uiManager=g.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=g.isCentered,this._structTreeParentId=null;const{rotation:b,rawDims:{pageWidth:y,pageHeight:f,pageX:m,pageY:E}}=this.parent.viewport;this.rotation=b,this.pageRotation=(360+b-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[y,f],this.pageTranslation=[m,E];const[w,S]=this.parentDimensions;this.x=g.x/w,this.y=g.y/S,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,d.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(g){const b=new A({id:g.parent.getNextId(),parent:g.parent,uiManager:g._uiManager});b.annotationElementId=g.annotationElementId,b.deleted=!0,b._uiManager.addToAnnotationStorage(b)}static initialize(g,b=null){if(v._l10nPromise||=new Map(["editor_alt_text_button_label","editor_alt_text_edit_button_label","editor_alt_text_decorative_tooltip"].map(f=>[f,g.get(f)])),b?.strings)for(const f of b.strings)v._l10nPromise.set(f,g.get(f));if(v._borderLineWidth!==-1)return;const y=getComputedStyle(document.documentElement);v._borderLineWidth=parseFloat(y.getPropertyValue("--outline-width"))||0}static updateDefaultParams(g,b){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(g){return!1}static paste(g,b){(0,d.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#f}set _isDraggable(g){this.#f=g,this.div?.classList.toggle("draggable",g)}center(){const[g,b]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*b/(g*2),this.y+=this.width*g/(b*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*b/(g*2),this.y-=this.width*g/(b*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(g){this._uiManager.addCommands(g)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#h}setParent(g){g!==null&&(this.pageIndex=g.pageIndex,this.pageDimensions=g.pageDimensions),this.parent=g}focusin(g){this._focusEventsAllowed&&(this.#a?this.#a=!1:this.parent.setSelected(this))}focusout(g){!this._focusEventsAllowed||!this.isAttachedToDOM||g.relatedTarget?.closest(`#${this.id}`)||(g.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(g,b,y,f){const[m,E]=this.parentDimensions;[y,f]=this.screenToPageTranslation(y,f),this.x=(g+y)/m,this.y=(b+f)/E,this.fixAndSetPosition()}#A([g,b],y,f){[y,f]=this.screenToPageTranslation(y,f),this.x+=y/g,this.y+=f/b,this.fixAndSetPosition()}translate(g,b){this.#A(this.parentDimensions,g,b)}translateInPage(g,b){this.#A(this.pageDimensions,g,b),this.div.scrollIntoView({block:"nearest"})}drag(g,b){const[y,f]=this.parentDimensions;if(this.x+=g/y,this.y+=b/f,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:$,y:T}=this.div.getBoundingClientRect();this.parent.findNewParent(this,$,T)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:m,y:E}=this;const[w,S]=this.#m();m+=w,E+=S,this.div.style.left=`${(100*m).toFixed(2)}%`,this.div.style.top=`${(100*E).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}#m(){const[g,b]=this.parentDimensions,{_borderLineWidth:y}=v,f=y/g,m=y/b;switch(this.rotation){case 90:return[-f,m];case 180:return[f,m];case 270:return[f,-m];default:return[-f,-m]}}fixAndSetPosition(){const[g,b]=this.pageDimensions;let{x:y,y:f,width:m,height:E}=this;switch(m*=g,E*=b,y*=g,f*=b,this.rotation){case 0:y=Math.max(0,Math.min(g-m,y)),f=Math.max(0,Math.min(b-E,f));break;case 90:y=Math.max(0,Math.min(g-E,y)),f=Math.min(b,Math.max(m,f));break;case 180:y=Math.min(g,Math.max(m,y)),f=Math.min(b,Math.max(E,f));break;case 270:y=Math.min(g,Math.max(E,y)),f=Math.max(0,Math.min(b-m,f));break}this.x=y/=g,this.y=f/=b;const[w,S]=this.#m();y+=w,f+=S;const{style:$}=this.div;$.left=`${(100*y).toFixed(2)}%`,$.top=`${(100*f).toFixed(2)}%`,this.moveInDOM()}static#g(g,b,y){switch(y){case 90:return[b,-g];case 180:return[-g,-b];case 270:return[-b,g];default:return[g,b]}}screenToPageTranslation(g,b){return v.#g(g,b,this.parentRotation)}pageTranslationToScreen(g,b){return v.#g(g,b,360-this.parentRotation)}#u(g){switch(g){case 90:{const[b,y]=this.pageDimensions;return[0,-b/y,y/b,0]}case 180:return[-1,0,0,-1];case 270:{const[b,y]=this.pageDimensions;return[0,b/y,-y/b,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:g,pageDimensions:[b,y]}=this,f=b*g,m=y*g;return d.FeatureTest.isCSSRoundSupported?[Math.round(f),Math.round(m)]:[f,m]}setDims(g,b){const[y,f]=this.parentDimensions;this.div.style.width=`${(100*g/y).toFixed(2)}%`,this.#o||(this.div.style.height=`${(100*b/f).toFixed(2)}%`),this.#r?.classList.toggle("small",g<v.SMALL_EDITOR_SIZE||b<v.SMALL_EDITOR_SIZE)}fixDims(){const{style:g}=this.div,{height:b,width:y}=g,f=y.endsWith("%"),m=!this.#o&&b.endsWith("%");if(f&&m)return;const[E,w]=this.parentDimensions;f||(g.width=`${(100*parseFloat(y)/E).toFixed(2)}%`),!this.#o&&!m&&(g.height=`${(100*parseFloat(b)/w).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#v(){if(this.#i)return;this.#i=document.createElement("div"),this.#i.classList.add("resizers");const g=["topLeft","topRight","bottomRight","bottomLeft"];this._willKeepAspectRatio||g.push("topMiddle","middleRight","bottomMiddle","middleLeft");for(const b of g){const y=document.createElement("div");this.#i.append(y),y.classList.add("resizer",b),y.addEventListener("pointerdown",this.#C.bind(this,b)),y.addEventListener("contextmenu",p.noContextMenu)}this.div.prepend(this.#i)}#C(g,b){b.preventDefault();const{isMac:y}=d.FeatureTest.platform;if(b.button!==0||b.ctrlKey&&y)return;const f=this.#E.bind(this,g),m=this._isDraggable;this._isDraggable=!1;const E={passive:!0,capture:!0};window.addEventListener("pointermove",f,E);const w=this.x,S=this.y,$=this.width,T=this.height,_=this.parent.div.style.cursor,I=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(b.target).cursor;const C=()=>{this._isDraggable=m,window.removeEventListener("pointerup",C),window.removeEventListener("blur",C),window.removeEventListener("pointermove",f,E),this.parent.div.style.cursor=_,this.div.style.cursor=I;const P=this.x,O=this.y,L=this.width,B=this.height;P===w&&O===S&&L===$&&B===T||this.addCommands({cmd:()=>{this.width=L,this.height=B,this.x=P,this.y=O;const[F,D]=this.parentDimensions;this.setDims(F*L,D*B),this.fixAndSetPosition()},undo:()=>{this.width=$,this.height=T,this.x=w,this.y=S;const[F,D]=this.parentDimensions;this.setDims(F*$,D*T),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener("pointerup",C),window.addEventListener("blur",C)}#E(g,b){const[y,f]=this.parentDimensions,m=this.x,E=this.y,w=this.width,S=this.height,$=v.MIN_SIZE/y,T=v.MIN_SIZE/f,_=q=>Math.round(q*1e4)/1e4,I=this.#u(this.rotation),C=(q,Q)=>[I[0]*q+I[2]*Q,I[1]*q+I[3]*Q],P=this.#u(360-this.rotation),O=(q,Q)=>[P[0]*q+P[2]*Q,P[1]*q+P[3]*Q];let L,B,F=!1,D=!1;switch(g){case"topLeft":F=!0,L=(q,Q)=>[0,0],B=(q,Q)=>[q,Q];break;case"topMiddle":L=(q,Q)=>[q/2,0],B=(q,Q)=>[q/2,Q];break;case"topRight":F=!0,L=(q,Q)=>[q,0],B=(q,Q)=>[0,Q];break;case"middleRight":D=!0,L=(q,Q)=>[q,Q/2],B=(q,Q)=>[0,Q/2];break;case"bottomRight":F=!0,L=(q,Q)=>[q,Q],B=(q,Q)=>[0,0];break;case"bottomMiddle":L=(q,Q)=>[q/2,Q],B=(q,Q)=>[q/2,0];break;case"bottomLeft":F=!0,L=(q,Q)=>[0,Q],B=(q,Q)=>[q,0];break;case"middleLeft":D=!0,L=(q,Q)=>[0,Q/2],B=(q,Q)=>[q,Q/2];break}const V=L(w,S),j=B(w,S);let G=C(...j);const U=_(m+G[0]),M=_(E+G[1]);let N=1,R=1,[k,z]=this.screenToPageTranslation(b.movementX,b.movementY);if([k,z]=O(k/y,z/f),F){const q=Math.hypot(w,S);N=R=Math.max(Math.min(Math.hypot(j[0]-V[0]-k,j[1]-V[1]-z)/q,1/w,1/S),$/w,T/S)}else D?N=Math.max($,Math.min(1,Math.abs(j[0]-V[0]-k)))/w:R=Math.max(T,Math.min(1,Math.abs(j[1]-V[1]-z)))/S;const W=_(w*N),J=_(S*R);G=C(...B(W,J));const re=U-G[0],K=M-G[1];this.width=W,this.height=J,this.x=re,this.y=K,this.setDims(y*W,f*J),this.fixAndSetPosition()}async addAltTextButton(){if(this.#r)return;const g=this.#r=document.createElement("button");g.className="altText";const b=await v._l10nPromise.get("editor_alt_text_button_label");g.textContent=b,g.setAttribute("aria-label",b),g.tabIndex="0",g.addEventListener("contextmenu",p.noContextMenu),g.addEventListener("pointerdown",y=>y.stopPropagation()),g.addEventListener("click",y=>{y.preventDefault(),this._uiManager.editAltText(this)},{capture:!0}),g.addEventListener("keydown",y=>{y.target===g&&y.key==="Enter"&&(y.preventDefault(),this._uiManager.editAltText(this))}),this.#$(),this.div.append(g),v.SMALL_EDITOR_SIZE||(v.SMALL_EDITOR_SIZE=Math.min(128,Math.round(g.getBoundingClientRect().width*1.4)))}async#$(){const g=this.#r;if(!g)return;if(!this.#e&&!this.#t){g.classList.remove("done"),this.#n?.remove();return}v._l10nPromise.get("editor_alt_text_edit_button_label").then(y=>{g.setAttribute("aria-label",y)});let b=this.#n;if(!b){this.#n=b=document.createElement("span"),b.className="tooltip",b.setAttribute("role","tooltip");const y=b.id=`alt-text-tooltip-${this.id}`;g.setAttribute("aria-describedby",y);const f=100;g.addEventListener("mouseenter",()=>{this.#s=setTimeout(()=>{this.#s=null,this.#n.classList.add("show"),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"alt_text_tooltip"}}})},f)}),g.addEventListener("mouseleave",()=>{clearTimeout(this.#s),this.#s=null,this.#n?.classList.remove("show")})}g.classList.add("done"),b.innerText=this.#t?await v._l10nPromise.get("editor_alt_text_decorative_tooltip"):this.#e,b.parentNode||g.append(b)}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:this.#e,decorative:this.#t}}set altTextData({altText:g,decorative:b}){this.#e===g&&this.#t===b||(this.#e=g,this.#t=b,this.#$())}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",this.#l),this.div.addEventListener("focusout",this.#c);const[g,b]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*b/g).toFixed(2)}%`,this.div.style.maxHeight=`${(100*g/b).toFixed(2)}%`);const[y,f]=this.getInitialTranslation();return this.translate(y,f),(0,u.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(g){const{isMac:b}=d.FeatureTest.platform;if(g.button!==0||g.ctrlKey&&b){g.preventDefault();return}this.#a=!0,this.#I(g)}#I(g){if(!this._isDraggable)return;const b=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let y,f;b&&(y={passive:!0,capture:!0},f=E=>{const[w,S]=this.screenToPageTranslation(E.movementX,E.movementY);this._uiManager.dragSelectedEditors(w,S)},window.addEventListener("pointermove",f,y));const m=()=>{if(window.removeEventListener("pointerup",m),window.removeEventListener("blur",m),b&&window.removeEventListener("pointermove",f,y),this.#a=!1,!this._uiManager.endDragSession()){const{isMac:E}=d.FeatureTest.platform;g.ctrlKey&&!E||g.shiftKey||g.metaKey&&E?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener("pointerup",m),window.addEventListener("blur",m)}moveInDOM(){this.parent?.moveEditorInDOM(this)}_setParentAndPosition(g,b,y){g.changeParent(this),this.x=b,this.y=y,this.fixAndSetPosition()}getRect(g,b){const y=this.parentScale,[f,m]=this.pageDimensions,[E,w]=this.pageTranslation,S=g/y,$=b/y,T=this.x*f,_=this.y*m,I=this.width*f,C=this.height*m;switch(this.rotation){case 0:return[T+S+E,m-_-$-C+w,T+S+I+E,m-_-$+w];case 90:return[T+$+E,m-_+S+w,T+$+C+E,m-_+S+I+w];case 180:return[T-S-I+E,m-_+$+w,T-S+E,m-_+$+C+w];case 270:return[T-$-C+E,m-_-S-I+w,T-$+E,m-_-S+w];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(g,b){const[y,f,m,E]=g,w=m-y,S=E-f;switch(this.rotation){case 0:return[y,b-E,w,S];case 90:return[y,b-f,S,w];case 180:return[m,b-f,w,S];case 270:return[m,b-E,S,w];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#d=!0}disableEditMode(){this.#d=!1}isInEditMode(){return this.#d}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#l),this.div?.addEventListener("focusout",this.#c)}serialize(g=!1,b=null){(0,d.unreachable)("An editor must be serializable")}static deserialize(g,b,y){const f=new this.prototype.constructor({parent:b,id:b.getNextId(),uiManager:y});f.rotation=g.rotation;const[m,E]=f.pageDimensions,[w,S,$,T]=f.getRectInCurrentCoords(g.rect,E);return f.x=w/m,f.y=S/E,f.width=$/m,f.height=T/E,f}remove(){this.div.removeEventListener("focusin",this.#l),this.div.removeEventListener("focusout",this.#c),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#r?.remove(),this.#r=null,this.#n=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#v(),this.#i.classList.remove("hidden"))}select(){this.makeResizable(),this.div?.classList.add("selectedEditor")}unselect(){this.#i?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(g,b){}disableEditing(){this.#r&&(this.#r.hidden=!0)}enableEditing(){this.#r&&(this.#r.hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return this.#p}set isEditing(g){this.#p=g,this.parent&&(g?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(g,b){this.#o=!0;const y=g/b,{style:f}=this.div;f.aspectRatio=y,f.height="auto"}static get MIN_SIZE(){return 16}}s.AnnotationEditor=v;class A extends v{constructor(g){super(g),this.annotationElementId=g.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.KeyboardManager=s.CommandManager=s.ColorManager=s.AnnotationEditorUIManager=void 0,s.bindEvents=p,s.opacityToHex=v;var u=c(1),d=c(6);function p(m,E,w){for(const S of w)E.addEventListener(S,m[S].bind(m))}function v(m){return Math.round(Math.min(255,Math.max(1,255*m))).toString(16).padStart(2,"0")}class A{#e=0;getId(){return`${u.AnnotationEditorPrefix}${this.#e++}`}}class x{#e=(0,u.getUuid)();#t=0;#r=null;static get _isSVGFittingCanvas(){const E='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',S=new OffscreenCanvas(1,3).getContext("2d"),$=new Image;$.src=E;const T=$.decode().then(()=>(S.drawImage($,0,0,1,1,0,0,1,3),new Uint32Array(S.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,u.shadow)(this,"_isSVGFittingCanvas",T)}async#n(E,w){this.#r||=new Map;let S=this.#r.get(E);if(S===null)return null;if(S?.bitmap)return S.refCounter+=1,S;try{S||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let $;if(typeof w=="string"){S.url=w;const T=await fetch(w);if(!T.ok)throw new Error(T.statusText);$=await T.blob()}else $=S.file=w;if($.type==="image/svg+xml"){const T=x._isSVGFittingCanvas,_=new FileReader,I=new Image,C=new Promise((P,O)=>{I.onload=()=>{S.bitmap=I,S.isSvg=!0,P()},_.onload=async()=>{const L=S.svgUrl=_.result;I.src=await T?`${L}#svgView(preserveAspectRatio(none))`:L},I.onerror=_.onerror=O});_.readAsDataURL($),await C}else S.bitmap=await createImageBitmap($);S.refCounter=1}catch($){console.error($),S=null}return this.#r.set(E,S),S&&this.#r.set(S.id,S),S}async getFromFile(E){const{lastModified:w,name:S,size:$,type:T}=E;return this.#n(`${w}_${S}_${$}_${T}`,E)}async getFromUrl(E){return this.#n(E,E)}async getFromId(E){this.#r||=new Map;const w=this.#r.get(E);return w?w.bitmap?(w.refCounter+=1,w):w.file?this.getFromFile(w.file):this.getFromUrl(w.url):null}getSvgUrl(E){const w=this.#r.get(E);return w?.isSvg?w.svgUrl:null}deleteId(E){this.#r||=new Map;const w=this.#r.get(E);w&&(w.refCounter-=1,w.refCounter===0&&(w.bitmap=null))}isValidId(E){return E.startsWith(`image_${this.#e}_`)}}class g{#e=[];#t=!1;#r;#n=-1;constructor(E=128){this.#r=E}add({cmd:E,undo:w,mustExec:S,type:$=NaN,overwriteIfSameType:T=!1,keepUndo:_=!1}){if(S&&E(),this.#t)return;const I={cmd:E,undo:w,type:$};if(this.#n===-1){this.#e.length>0&&(this.#e.length=0),this.#n=0,this.#e.push(I);return}if(T&&this.#e[this.#n].type===$){_&&(I.undo=this.#e[this.#n].undo),this.#e[this.#n]=I;return}const C=this.#n+1;C===this.#r?this.#e.splice(0,1):(this.#n=C,C<this.#e.length&&this.#e.splice(C)),this.#e.push(I)}undo(){this.#n!==-1&&(this.#t=!0,this.#e[this.#n].undo(),this.#t=!1,this.#n-=1)}redo(){this.#n<this.#e.length-1&&(this.#n+=1,this.#t=!0,this.#e[this.#n].cmd(),this.#t=!1)}hasSomethingToUndo(){return this.#n!==-1}hasSomethingToRedo(){return this.#n<this.#e.length-1}destroy(){this.#e=null}}s.CommandManager=g;class b{constructor(E){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:w}=u.FeatureTest.platform;for(const[S,$,T={}]of E)for(const _ of S){const I=_.startsWith("mac+");w&&I?(this.callbacks.set(_.slice(4),{callback:$,options:T}),this.allKeys.add(_.split("+").at(-1))):!w&&!I&&(this.callbacks.set(_,{callback:$,options:T}),this.allKeys.add(_.split("+").at(-1)))}}#e(E){E.altKey&&this.buffer.push("alt"),E.ctrlKey&&this.buffer.push("ctrl"),E.metaKey&&this.buffer.push("meta"),E.shiftKey&&this.buffer.push("shift"),this.buffer.push(E.key);const w=this.buffer.join("+");return this.buffer.length=0,w}exec(E,w){if(!this.allKeys.has(w.key))return;const S=this.callbacks.get(this.#e(w));if(!S)return;const{callback:$,options:{bubbles:T=!1,args:_=[],checker:I=null}}=S;I&&!I(E,w)||($.bind(E,..._)(),T||(w.stopPropagation(),w.preventDefault()))}}s.KeyboardManager=b;class y{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const E=new Map([["CanvasText",null],["Canvas",null]]);return(0,d.getColorValues)(E),(0,u.shadow)(this,"_colors",E)}convert(E){const w=(0,d.getRGB)(E);if(!window.matchMedia("(forced-colors: active)").matches)return w;for(const[S,$]of this._colors)if($.every((T,_)=>T===w[_]))return y._colorsMapping.get(S);return w}getHexCode(E){const w=this._colors.get(E);return w?u.Util.makeHexColor(...w):E}}s.ColorManager=y;class f{#e=null;#t=new Map;#r=new Map;#n=null;#s=null;#o=new g;#i=0;#l=new Set;#c=null;#a=null;#p=new Set;#d=null;#f=new A;#h=!1;#A=!1;#m=null;#g=u.AnnotationEditorType.NONE;#u=new Set;#v=null;#C=this.blur.bind(this);#E=this.focus.bind(this);#$=this.copy.bind(this);#I=this.cut.bind(this);#M=this.paste.bind(this);#D=this.keydown.bind(this);#k=this.onEditingAction.bind(this);#b=this.onPageChanging.bind(this);#B=this.onScaleChanging.bind(this);#T=this.onRotationChanging.bind(this);#R={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#x=[0,0];#_=null;#w=null;#F=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const E=f.prototype,w=T=>{const{activeElement:_}=document;return _&&T.#w.contains(_)&&T.hasSomethingToControl()},S=this.TRANSLATE_SMALL,$=this.TRANSLATE_BIG;return(0,u.shadow)(this,"_keyboardManager",new b([[["ctrl+a","mac+meta+a"],E.selectAll],[["ctrl+z","mac+meta+z"],E.undo],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],E.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],E.delete],[["Escape","mac+Escape"],E.unselectAll],[["ArrowLeft","mac+ArrowLeft"],E.translateSelectedEditors,{args:[-S,0],checker:w}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],E.translateSelectedEditors,{args:[-$,0],checker:w}],[["ArrowRight","mac+ArrowRight"],E.translateSelectedEditors,{args:[S,0],checker:w}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],E.translateSelectedEditors,{args:[$,0],checker:w}],[["ArrowUp","mac+ArrowUp"],E.translateSelectedEditors,{args:[0,-S],checker:w}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],E.translateSelectedEditors,{args:[0,-$],checker:w}],[["ArrowDown","mac+ArrowDown"],E.translateSelectedEditors,{args:[0,S],checker:w}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],E.translateSelectedEditors,{args:[0,$],checker:w}]]))}constructor(E,w,S,$,T,_){this.#w=E,this.#F=w,this.#n=S,this._eventBus=$,this._eventBus._on("editingaction",this.#k),this._eventBus._on("pagechanging",this.#b),this._eventBus._on("scalechanging",this.#B),this._eventBus._on("rotationchanging",this.#T),this.#s=T.annotationStorage,this.#d=T.filterFactory,this.#v=_,this.viewParameters={realScale:d.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#P(),this.#N(),this._eventBus._off("editingaction",this.#k),this._eventBus._off("pagechanging",this.#b),this._eventBus._off("scalechanging",this.#B),this._eventBus._off("rotationchanging",this.#T);for(const E of this.#r.values())E.destroy();this.#r.clear(),this.#t.clear(),this.#p.clear(),this.#e=null,this.#u.clear(),this.#o.destroy(),this.#n.destroy()}get hcmFilter(){return(0,u.shadow)(this,"hcmFilter",this.#v?this.#d.addHCMFilter(this.#v.foreground,this.#v.background):"none")}get direction(){return(0,u.shadow)(this,"direction",getComputedStyle(this.#w).direction)}editAltText(E){this.#n?.editAltText(this,E)}onPageChanging({pageNumber:E}){this.#i=E-1}focusMainContainer(){this.#w.focus()}findParent(E,w){for(const S of this.#r.values()){const{x:$,y:T,width:_,height:I}=S.div.getBoundingClientRect();if(E>=$&&E<=$+_&&w>=T&&w<=T+I)return S}return null}disableUserSelect(E=!1){this.#F.classList.toggle("noUserSelect",E)}addShouldRescale(E){this.#p.add(E)}removeShouldRescale(E){this.#p.delete(E)}onScaleChanging({scale:E}){this.commitOrRemove(),this.viewParameters.realScale=E*d.PixelsPerInch.PDF_TO_CSS_UNITS;for(const w of this.#p)w.onScaleChanging()}onRotationChanging({pagesRotation:E}){this.commitOrRemove(),this.viewParameters.rotation=E}addToAnnotationStorage(E){!E.isEmpty()&&this.#s&&!this.#s.has(E.id)&&this.#s.setValue(E.id,E)}#L(){window.addEventListener("focus",this.#E),window.addEventListener("blur",this.#C)}#N(){window.removeEventListener("focus",this.#E),window.removeEventListener("blur",this.#C)}blur(){if(!this.hasSelection)return;const{activeElement:E}=document;for(const w of this.#u)if(w.div.contains(E)){this.#m=[w,E],w._focusEventsAllowed=!1;break}}focus(){if(!this.#m)return;const[E,w]=this.#m;this.#m=null,w.addEventListener("focusin",()=>{E._focusEventsAllowed=!0},{once:!0}),w.focus()}#j(){window.addEventListener("keydown",this.#D,{capture:!0})}#P(){window.removeEventListener("keydown",this.#D,{capture:!0})}#O(){document.addEventListener("copy",this.#$),document.addEventListener("cut",this.#I),document.addEventListener("paste",this.#M)}#S(){document.removeEventListener("copy",this.#$),document.removeEventListener("cut",this.#I),document.removeEventListener("paste",this.#M)}addEditListeners(){this.#j(),this.#O()}removeEditListeners(){this.#P(),this.#S()}copy(E){if(E.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;const w=[];for(const S of this.#u){const $=S.serialize(!0);$&&w.push($)}w.length!==0&&E.clipboardData.setData("application/pdfjs",JSON.stringify(w))}cut(E){this.copy(E),this.delete()}paste(E){E.preventDefault();const{clipboardData:w}=E;for(const T of w.items)for(const _ of this.#a)if(_.isHandlingMimeForPasting(T.type)){_.paste(T,this.currentLayer);return}let S=w.getData("application/pdfjs");if(!S)return;try{S=JSON.parse(S)}catch(T){(0,u.warn)(`paste: "${T.message}".`);return}if(!Array.isArray(S))return;this.unselectAll();const $=this.currentLayer;try{const T=[];for(const C of S){const P=$.deserialize(C);if(!P)return;T.push(P)}const _=()=>{for(const C of T)this.#U(C);this.#W(T)},I=()=>{for(const C of T)C.remove()};this.addCommands({cmd:_,undo:I,mustExec:!0})}catch(T){(0,u.warn)(`paste: "${T.message}".`)}}keydown(E){this.getActive()?.shouldGetKeyboardEvents()||f._keyboardManager.exec(this,E)}onEditingAction(E){["undo","redo","delete","selectAll"].includes(E.name)&&this[E.name]()}#y(E){Object.entries(E).some(([S,$])=>this.#R[S]!==$)&&this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#R,E)})}#z(E){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:E})}setEditingState(E){E?(this.#L(),this.#j(),this.#O(),this.#y({isEditing:this.#g!==u.AnnotationEditorType.NONE,isEmpty:this.#H(),hasSomethingToUndo:this.#o.hasSomethingToUndo(),hasSomethingToRedo:this.#o.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#N(),this.#P(),this.#S(),this.#y({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(E){if(!this.#a){this.#a=E;for(const w of this.#a)this.#z(w.defaultPropertiesToUpdate)}}getId(){return this.#f.getId()}get currentLayer(){return this.#r.get(this.#i)}getLayer(E){return this.#r.get(E)}get currentPageIndex(){return this.#i}addLayer(E){this.#r.set(E.pageIndex,E),this.#h?E.enable():E.disable()}removeLayer(E){this.#r.delete(E.pageIndex)}updateMode(E,w=null){if(this.#g!==E){if(this.#g=E,E===u.AnnotationEditorType.NONE){this.setEditingState(!1),this.#V();return}this.setEditingState(!0),this.#G(),this.unselectAll();for(const S of this.#r.values())S.updateMode(E);if(w){for(const S of this.#t.values())if(S.annotationElementId===w){this.setSelected(S),S.enterInEditMode();break}}}}updateToolbar(E){E!==this.#g&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:E})}updateParams(E,w){if(this.#a){if(E===u.AnnotationEditorParamsType.CREATE){this.currentLayer.addNewEditor(E);return}for(const S of this.#u)S.updateParams(E,w);for(const S of this.#a)S.updateDefaultParams(E,w)}}enableWaiting(E=!1){if(this.#A!==E){this.#A=E;for(const w of this.#r.values())E?w.disableClick():w.enableClick(),w.div.classList.toggle("waiting",E)}}#G(){if(!this.#h){this.#h=!0;for(const E of this.#r.values())E.enable()}}#V(){if(this.unselectAll(),this.#h){this.#h=!1;for(const E of this.#r.values())E.disable()}}getEditors(E){const w=[];for(const S of this.#t.values())S.pageIndex===E&&w.push(S);return w}getEditor(E){return this.#t.get(E)}addEditor(E){this.#t.set(E.id,E)}removeEditor(E){this.#t.delete(E.id),this.unselect(E),(!E.annotationElementId||!this.#l.has(E.annotationElementId))&&this.#s?.remove(E.id)}addDeletedAnnotationElement(E){this.#l.add(E.annotationElementId),E.deleted=!0}isDeletedAnnotationElement(E){return this.#l.has(E)}removeDeletedAnnotationElement(E){this.#l.delete(E.annotationElementId),E.deleted=!1}#U(E){const w=this.#r.get(E.pageIndex);w?w.addOrRebuild(E):this.addEditor(E)}setActiveEditor(E){this.#e!==E&&(this.#e=E,E&&this.#z(E.propertiesToUpdate))}toggleSelected(E){if(this.#u.has(E)){this.#u.delete(E),E.unselect(),this.#y({hasSelectedEditor:this.hasSelection});return}this.#u.add(E),E.select(),this.#z(E.propertiesToUpdate),this.#y({hasSelectedEditor:!0})}setSelected(E){for(const w of this.#u)w!==E&&w.unselect();this.#u.clear(),this.#u.add(E),E.select(),this.#z(E.propertiesToUpdate),this.#y({hasSelectedEditor:!0})}isSelected(E){return this.#u.has(E)}unselect(E){E.unselect(),this.#u.delete(E),this.#y({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#u.size!==0}undo(){this.#o.undo(),this.#y({hasSomethingToUndo:this.#o.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#H()})}redo(){this.#o.redo(),this.#y({hasSomethingToUndo:!0,hasSomethingToRedo:this.#o.hasSomethingToRedo(),isEmpty:this.#H()})}addCommands(E){this.#o.add(E),this.#y({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#H()})}#H(){if(this.#t.size===0)return!0;if(this.#t.size===1)for(const E of this.#t.values())return E.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const E=[...this.#u],w=()=>{for(const $ of E)$.remove()},S=()=>{for(const $ of E)this.#U($)};this.addCommands({cmd:w,undo:S,mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#W(E){this.#u.clear();for(const w of E)w.isEmpty()||(this.#u.add(w),w.select());this.#y({hasSelectedEditor:!0})}selectAll(){for(const E of this.#u)E.commit();this.#W(this.#t.values())}unselectAll(){if(this.#e){this.#e.commitOrRemove();return}if(this.hasSelection){for(const E of this.#u)E.unselect();this.#u.clear(),this.#y({hasSelectedEditor:!1})}}translateSelectedEditors(E,w,S=!1){if(S||this.commitOrRemove(),!this.hasSelection)return;this.#x[0]+=E,this.#x[1]+=w;const[$,T]=this.#x,_=[...this.#u],I=1e3;this.#_&&clearTimeout(this.#_),this.#_=setTimeout(()=>{this.#_=null,this.#x[0]=this.#x[1]=0,this.addCommands({cmd:()=>{for(const C of _)this.#t.has(C.id)&&C.translateInPage($,T)},undo:()=>{for(const C of _)this.#t.has(C.id)&&C.translateInPage(-$,-T)},mustExec:!1})},I);for(const C of _)C.translateInPage(E,w)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#c=new Map;for(const E of this.#u)this.#c.set(E,{savedX:E.x,savedY:E.y,savedPageIndex:E.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#c)return!1;this.disableUserSelect(!1);const E=this.#c;this.#c=null;let w=!1;for(const[{x:$,y:T,pageIndex:_},I]of E)I.newX=$,I.newY=T,I.newPageIndex=_,w||=$!==I.savedX||T!==I.savedY||_!==I.savedPageIndex;if(!w)return!1;const S=($,T,_,I)=>{if(this.#t.has($.id)){const C=this.#r.get(I);C?$._setParentAndPosition(C,T,_):($.pageIndex=I,$.x=T,$.y=_)}};return this.addCommands({cmd:()=>{for(const[$,{newX:T,newY:_,newPageIndex:I}]of E)S($,T,_,I)},undo:()=>{for(const[$,{savedX:T,savedY:_,savedPageIndex:I}]of E)S($,T,_,I)},mustExec:!0}),!0}dragSelectedEditors(E,w){if(this.#c)for(const S of this.#c.keys())S.drag(E,w)}rebuild(E){if(E.parent===null){const w=this.getLayer(E.pageIndex);w?(w.changeParent(E),w.addOrRebuild(E)):(this.addEditor(E),this.addToAnnotationStorage(E),E.rebuild())}else E.parent.addOrRebuild(E)}isActive(E){return this.#e===E}getActive(){return this.#e}getMode(){return this.#g}get imageManager(){return(0,u.shadow)(this,"imageManager",new x)}}s.AnnotationEditorUIManager=f}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.StatTimer=s.RenderingCancelledException=s.PixelsPerInch=s.PageViewport=s.PDFDateString=s.DOMStandardFontDataFactory=s.DOMSVGFactory=s.DOMFilterFactory=s.DOMCanvasFactory=s.DOMCMapReaderFactory=void 0,s.deprecated=O,s.getColorValues=V,s.getCurrentTransform=j,s.getCurrentTransformInverse=G,s.getFilenameFromUrl=$,s.getPdfFilenameFromUrl=T,s.getRGB=D,s.getXfaPageViewport=F,s.isDataScheme=w,s.isPdfFile=S,s.isValidFetchUrl=I,s.loadScript=P,s.noContextMenu=C,s.setLayerDimensions=U;var u=c(7),d=c(1);const p="http://www.w3.org/2000/svg";class v{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}s.PixelsPerInch=v;class A extends u.BaseFilterFactory{#e;#t;#r;#n;#s;#o;#i;#l;#c;#a;#p=0;constructor({docId:N,ownerDocument:R=globalThis.document}={}){super(),this.#r=N,this.#n=R}get#d(){return this.#e||=new Map}get#f(){if(!this.#t){const N=this.#n.createElement("div"),{style:R}=N;R.visibility="hidden",R.contain="strict",R.width=R.height=0,R.position="absolute",R.top=R.left=0,R.zIndex=-1;const k=this.#n.createElementNS(p,"svg");k.setAttribute("width",0),k.setAttribute("height",0),this.#t=this.#n.createElementNS(p,"defs"),N.append(k),k.append(this.#t),this.#n.body.append(N)}return this.#t}addFilter(N){if(!N)return"none";let R=this.#d.get(N);if(R)return R;let k,z,W,J;if(N.length===1){const Q=N[0],ee=new Array(256);for(let Y=0;Y<256;Y++)ee[Y]=Q[Y]/255;J=k=z=W=ee.join(",")}else{const[Q,ee,Y]=N,Z=new Array(256),te=new Array(256),ae=new Array(256);for(let oe=0;oe<256;oe++)Z[oe]=Q[oe]/255,te[oe]=ee[oe]/255,ae[oe]=Y[oe]/255;k=Z.join(","),z=te.join(","),W=ae.join(","),J=`${k}${z}${W}`}if(R=this.#d.get(J),R)return this.#d.set(N,R),R;const re=`g_${this.#r}_transfer_map_${this.#p++}`,K=`url(#${re})`;this.#d.set(N,K),this.#d.set(J,K);const q=this.#A(re);return this.#g(k,z,W,q),K}addHCMFilter(N,R){const k=`${N}-${R}`;if(this.#o===k)return this.#i;if(this.#o=k,this.#i="none",this.#s?.remove(),!N||!R)return this.#i;const z=this.#u(N);N=d.Util.makeHexColor(...z);const W=this.#u(R);if(R=d.Util.makeHexColor(...W),this.#f.style.color="",N==="#000000"&&R==="#ffffff"||N===R)return this.#i;const J=new Array(256);for(let ee=0;ee<=255;ee++){const Y=ee/255;J[ee]=Y<=.03928?Y/12.92:((Y+.055)/1.055)**2.4}const re=J.join(","),K=`g_${this.#r}_hcm_filter`,q=this.#l=this.#A(K);this.#g(re,re,re,q),this.#h(q);const Q=(ee,Y)=>{const Z=z[ee]/255,te=W[ee]/255,ae=new Array(Y+1);for(let oe=0;oe<=Y;oe++)ae[oe]=Z+oe/Y*(te-Z);return ae.join(",")};return this.#g(Q(0,5),Q(1,5),Q(2,5),q),this.#i=`url(#${K})`,this.#i}addHighlightHCMFilter(N,R,k,z){const W=`${N}-${R}-${k}-${z}`;if(this.#c===W)return this.#a;if(this.#c=W,this.#a="none",this.#l?.remove(),!N||!R)return this.#a;const[J,re]=[N,R].map(this.#u.bind(this));let K=Math.round(.2126*J[0]+.7152*J[1]+.0722*J[2]),q=Math.round(.2126*re[0]+.7152*re[1]+.0722*re[2]),[Q,ee]=[k,z].map(this.#u.bind(this));q<K&&([K,q,Q,ee]=[q,K,ee,Q]),this.#f.style.color="";const Y=(ae,oe,se)=>{const fe=new Array(256),pe=(q-K)/se,ge=ae/255,me=(oe-ae)/(255*se);let be=0;for(let le=0;le<=se;le++){const ve=Math.round(K+le*pe),he=ge+le*me;for(let ye=be;ye<=ve;ye++)fe[ye]=he;be=ve+1}for(let le=be;le<256;le++)fe[le]=fe[be-1];return fe.join(",")},Z=`g_${this.#r}_hcm_highlight_filter`,te=this.#l=this.#A(Z);return this.#h(te),this.#g(Y(Q[0],ee[0],5),Y(Q[1],ee[1],5),Y(Q[2],ee[2],5),te),this.#a=`url(#${Z})`,this.#a}destroy(N=!1){N&&(this.#i||this.#a)||(this.#t&&(this.#t.parentNode.parentNode.remove(),this.#t=null),this.#e&&(this.#e.clear(),this.#e=null),this.#p=0)}#h(N){const R=this.#n.createElementNS(p,"feColorMatrix");R.setAttribute("type","matrix"),R.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"),N.append(R)}#A(N){const R=this.#n.createElementNS(p,"filter");return R.setAttribute("color-interpolation-filters","sRGB"),R.setAttribute("id",N),this.#f.append(R),R}#m(N,R,k){const z=this.#n.createElementNS(p,R);z.setAttribute("type","discrete"),z.setAttribute("tableValues",k),N.append(z)}#g(N,R,k,z){const W=this.#n.createElementNS(p,"feComponentTransfer");z.append(W),this.#m(W,"feFuncR",N),this.#m(W,"feFuncG",R),this.#m(W,"feFuncB",k)}#u(N){return this.#f.style.color=N,D(getComputedStyle(this.#f).getPropertyValue("color"))}}s.DOMFilterFactory=A;class x extends u.BaseCanvasFactory{constructor({ownerDocument:N=globalThis.document}={}){super(),this._document=N}_createCanvas(N,R){const k=this._document.createElement("canvas");return k.width=N,k.height=R,k}}s.DOMCanvasFactory=x;async function g(M,N=!1){if(I(M,document.baseURI)){const R=await fetch(M);if(!R.ok)throw new Error(R.statusText);return N?new Uint8Array(await R.arrayBuffer()):(0,d.stringToBytes)(await R.text())}return new Promise((R,k)=>{const z=new XMLHttpRequest;z.open("GET",M,!0),N&&(z.responseType="arraybuffer"),z.onreadystatechange=()=>{if(z.readyState===XMLHttpRequest.DONE){if(z.status===200||z.status===0){let W;if(N&&z.response?W=new Uint8Array(z.response):!N&&z.responseText&&(W=(0,d.stringToBytes)(z.responseText)),W){R(W);return}}k(new Error(z.statusText))}},z.send(null)})}class b extends u.BaseCMapReaderFactory{_fetchData(N,R){return g(N,this.isCompressed).then(k=>({cMapData:k,compressionType:R}))}}s.DOMCMapReaderFactory=b;class y extends u.BaseStandardFontDataFactory{_fetchData(N){return g(N,!0)}}s.DOMStandardFontDataFactory=y;class f extends u.BaseSVGFactory{_createSVG(N){return document.createElementNS(p,N)}}s.DOMSVGFactory=f;class m{constructor({viewBox:N,scale:R,rotation:k,offsetX:z=0,offsetY:W=0,dontFlip:J=!1}){this.viewBox=N,this.scale=R,this.rotation=k,this.offsetX=z,this.offsetY=W;const re=(N[2]+N[0])/2,K=(N[3]+N[1])/2;let q,Q,ee,Y;switch(k%=360,k<0&&(k+=360),k){case 180:q=-1,Q=0,ee=0,Y=1;break;case 90:q=0,Q=1,ee=1,Y=0;break;case 270:q=0,Q=-1,ee=-1,Y=0;break;case 0:q=1,Q=0,ee=0,Y=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}J&&(ee=-ee,Y=-Y);let Z,te,ae,oe;q===0?(Z=Math.abs(K-N[1])*R+z,te=Math.abs(re-N[0])*R+W,ae=(N[3]-N[1])*R,oe=(N[2]-N[0])*R):(Z=Math.abs(re-N[0])*R+z,te=Math.abs(K-N[1])*R+W,ae=(N[2]-N[0])*R,oe=(N[3]-N[1])*R),this.transform=[q*R,Q*R,ee*R,Y*R,Z-q*R*re-ee*R*K,te-Q*R*re-Y*R*K],this.width=ae,this.height=oe}get rawDims(){const{viewBox:N}=this;return(0,d.shadow)(this,"rawDims",{pageWidth:N[2]-N[0],pageHeight:N[3]-N[1],pageX:N[0],pageY:N[1]})}clone({scale:N=this.scale,rotation:R=this.rotation,offsetX:k=this.offsetX,offsetY:z=this.offsetY,dontFlip:W=!1}={}){return new m({viewBox:this.viewBox.slice(),scale:N,rotation:R,offsetX:k,offsetY:z,dontFlip:W})}convertToViewportPoint(N,R){return d.Util.applyTransform([N,R],this.transform)}convertToViewportRectangle(N){const R=d.Util.applyTransform([N[0],N[1]],this.transform),k=d.Util.applyTransform([N[2],N[3]],this.transform);return[R[0],R[1],k[0],k[1]]}convertToPdfPoint(N,R){return d.Util.applyInverseTransform([N,R],this.transform)}}s.PageViewport=m;class E extends d.BaseException{constructor(N,R=0){super(N,"RenderingCancelledException"),this.extraDelay=R}}s.RenderingCancelledException=E;function w(M){const N=M.length;let R=0;for(;R<N&&M[R].trim()==="";)R++;return M.substring(R,R+5).toLowerCase()==="data:"}function S(M){return typeof M=="string"&&/\.pdf$/i.test(M)}function $(M,N=!1){return N||([M]=M.split(/[#?]/,1)),M.substring(M.lastIndexOf("/")+1)}function T(M,N="document.pdf"){if(typeof M!="string")return N;if(w(M))return(0,d.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),N;const R=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,k=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,z=R.exec(M);let W=k.exec(z[1])||k.exec(z[2])||k.exec(z[3]);if(W&&(W=W[0],W.includes("%")))try{W=k.exec(decodeURIComponent(W))[0]}catch{}return W||N}class _{started=Object.create(null);times=[];time(N){N in this.started&&(0,d.warn)(`Timer is already running for ${N}`),this.started[N]=Date.now()}timeEnd(N){N in this.started||(0,d.warn)(`Timer has not been started for ${N}`),this.times.push({name:N,start:this.started[N],end:Date.now()}),delete this.started[N]}toString(){const N=[];let R=0;for(const{name:k}of this.times)R=Math.max(k.length,R);for(const{name:k,start:z,end:W}of this.times)N.push(`${k.padEnd(R)} ${W-z}ms
60
60
  `);return N.join("")}}s.StatTimer=_;function I(M,N){try{const{protocol:R}=N?new URL(M,N):new URL(M);return R==="http:"||R==="https:"}catch{return!1}}function C(M){M.preventDefault()}function P(M,N=!1){return new Promise((R,k)=>{const z=document.createElement("script");z.src=M,z.onload=function(W){N&&z.remove(),R(W)},z.onerror=function(){k(new Error(`Cannot load script at: ${z.src}`))},(document.head||document.documentElement).append(z)})}function O(M){console.log("Deprecated API usage: "+M)}let L;class B{static toDateObject(N){if(!N||typeof N!="string")return null;L||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const R=L.exec(N);if(!R)return null;const k=parseInt(R[1],10);let z=parseInt(R[2],10);z=z>=1&&z<=12?z-1:0;let W=parseInt(R[3],10);W=W>=1&&W<=31?W:1;let J=parseInt(R[4],10);J=J>=0&&J<=23?J:0;let re=parseInt(R[5],10);re=re>=0&&re<=59?re:0;let K=parseInt(R[6],10);K=K>=0&&K<=59?K:0;const q=R[7]||"Z";let Q=parseInt(R[8],10);Q=Q>=0&&Q<=23?Q:0;let ee=parseInt(R[9],10)||0;return ee=ee>=0&&ee<=59?ee:0,q==="-"?(J+=Q,re+=ee):q==="+"&&(J-=Q,re-=ee),new Date(Date.UTC(k,z,W,J,re,K))}}s.PDFDateString=B;function F(M,{scale:N=1,rotation:R=0}){const{width:k,height:z}=M.attributes.style,W=[0,0,parseInt(k),parseInt(z)];return new m({viewBox:W,scale:N,rotation:R})}function D(M){if(M.startsWith("#")){const N=parseInt(M.slice(1),16);return[(N&16711680)>>16,(N&65280)>>8,N&255]}return M.startsWith("rgb(")?M.slice(4,-1).split(",").map(N=>parseInt(N)):M.startsWith("rgba(")?M.slice(5,-1).split(",").map(N=>parseInt(N)).slice(0,3):((0,d.warn)(`Not a valid color format: "${M}"`),[0,0,0])}function V(M){const N=document.createElement("span");N.style.visibility="hidden",document.body.append(N);for(const R of M.keys()){N.style.color=R;const k=window.getComputedStyle(N).color;M.set(R,D(k))}N.remove()}function j(M){const{a:N,b:R,c:k,d:z,e:W,f:J}=M.getTransform();return[N,R,k,z,W,J]}function G(M){const{a:N,b:R,c:k,d:z,e:W,f:J}=M.getTransform().invertSelf();return[N,R,k,z,W,J]}function U(M,N,R=!1,k=!0){if(N instanceof m){const{pageWidth:z,pageHeight:W}=N.rawDims,{style:J}=M,re=d.FeatureTest.isCSSRoundSupported,K=`var(--scale-factor) * ${z}px`,q=`var(--scale-factor) * ${W}px`,Q=re?`round(${K}, 1px)`:`calc(${K})`,ee=re?`round(${q}, 1px)`:`calc(${q})`;!R||N.rotation%180===0?(J.width=Q,J.height=ee):(J.width=ee,J.height=Q)}k&&M.setAttribute("data-main-rotation",N.rotation)}}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.BaseStandardFontDataFactory=s.BaseSVGFactory=s.BaseFilterFactory=s.BaseCanvasFactory=s.BaseCMapReaderFactory=void 0;var u=c(1);class d{constructor(){this.constructor===d&&(0,u.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(b){return"none"}addHCMFilter(b,y){return"none"}addHighlightHCMFilter(b,y,f,m){return"none"}destroy(b=!1){}}s.BaseFilterFactory=d;class p{constructor(){this.constructor===p&&(0,u.unreachable)("Cannot initialize BaseCanvasFactory.")}create(b,y){if(b<=0||y<=0)throw new Error("Invalid canvas size");const f=this._createCanvas(b,y);return{canvas:f,context:f.getContext("2d")}}reset(b,y,f){if(!b.canvas)throw new Error("Canvas is not specified");if(y<=0||f<=0)throw new Error("Invalid canvas size");b.canvas.width=y,b.canvas.height=f}destroy(b){if(!b.canvas)throw new Error("Canvas is not specified");b.canvas.width=0,b.canvas.height=0,b.canvas=null,b.context=null}_createCanvas(b,y){(0,u.unreachable)("Abstract method `_createCanvas` called.")}}s.BaseCanvasFactory=p;class v{constructor({baseUrl:b=null,isCompressed:y=!0}){this.constructor===v&&(0,u.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=b,this.isCompressed=y}async fetch({name:b}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!b)throw new Error("CMap name must be specified.");const y=this.baseUrl+b+(this.isCompressed?".bcmap":""),f=this.isCompressed?u.CMapCompressionType.BINARY:u.CMapCompressionType.NONE;return this._fetchData(y,f).catch(m=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${y}`)})}_fetchData(b,y){(0,u.unreachable)("Abstract method `_fetchData` called.")}}s.BaseCMapReaderFactory=v;class A{constructor({baseUrl:b=null}){this.constructor===A&&(0,u.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=b}async fetch({filename:b}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!b)throw new Error("Font filename must be specified.");const y=`${this.baseUrl}${b}`;return this._fetchData(y).catch(f=>{throw new Error(`Unable to load font data at: ${y}`)})}_fetchData(b){(0,u.unreachable)("Abstract method `_fetchData` called.")}}s.BaseStandardFontDataFactory=A;class x{constructor(){this.constructor===x&&(0,u.unreachable)("Cannot initialize BaseSVGFactory.")}create(b,y,f=!1){if(b<=0||y<=0)throw new Error("Invalid SVG dimensions");const m=this._createSVG("svg:svg");return m.setAttribute("version","1.1"),f||(m.setAttribute("width",`${b}px`),m.setAttribute("height",`${y}px`)),m.setAttribute("preserveAspectRatio","none"),m.setAttribute("viewBox",`0 0 ${b} ${y}`),m}createElement(b){if(typeof b!="string")throw new Error("Invalid SVG element type");return this._createSVG(b)}_createSVG(b){(0,u.unreachable)("Abstract method `_createSVG` called.")}}s.BaseSVGFactory=x}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.MurmurHash3_64=void 0;var u=c(1);const d=3285377520,p=4294901760,v=65535;class A{constructor(g){this.h1=g?g&4294967295:d,this.h2=g?g&4294967295:d}update(g){let b,y;if(typeof g=="string"){b=new Uint8Array(g.length*2),y=0;for(let O=0,L=g.length;O<L;O++){const B=g.charCodeAt(O);B<=255?b[y++]=B:(b[y++]=B>>>8,b[y++]=B&255)}}else if((0,u.isArrayBuffer)(g))b=g.slice(),y=b.byteLength;else throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");const f=y>>2,m=y-f*4,E=new Uint32Array(b.buffer,0,f);let w=0,S=0,$=this.h1,T=this.h2;const _=3432918353,I=461845907,C=_&v,P=I&v;for(let O=0;O<f;O++)O&1?(w=E[O],w=w*_&p|w*C&v,w=w<<15|w>>>17,w=w*I&p|w*P&v,$^=w,$=$<<13|$>>>19,$=$*5+3864292196):(S=E[O],S=S*_&p|S*C&v,S=S<<15|S>>>17,S=S*I&p|S*P&v,T^=S,T=T<<13|T>>>19,T=T*5+3864292196);switch(w=0,m){case 3:w^=b[f*4+2]<<16;case 2:w^=b[f*4+1]<<8;case 1:w^=b[f*4],w=w*_&p|w*C&v,w=w<<15|w>>>17,w=w*I&p|w*P&v,f&1?$^=w:T^=w}this.h1=$,this.h2=T}hexdigest(){let g=this.h1,b=this.h2;return g^=b>>>1,g=g*3981806797&p|g*36045&v,b=b*4283543511&p|((b<<16|g>>>16)*2950163797&p)>>>16,g^=b>>>1,g=g*444984403&p|g*60499&v,b=b*3301882366&p|((b<<16|g>>>16)*3120437893&p)>>>16,g^=b>>>1,(g>>>0).toString(16).padStart(8,"0")+(b>>>0).toString(16).padStart(8,"0")}}s.MurmurHash3_64=A}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FontLoader=s.FontFaceObject=void 0;var u=c(1);class d{#e=new Set;constructor({ownerDocument:A=globalThis.document,styleElement:x=null}){this._document=A,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(A){this.nativeFontFaces.add(A),this._document.fonts.add(A)}removeNativeFontFace(A){this.nativeFontFaces.delete(A),this._document.fonts.delete(A)}insertRule(A){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const x=this.styleElement.sheet;x.insertRule(A,x.cssRules.length)}clear(){for(const A of this.nativeFontFaces)this._document.fonts.delete(A);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(A){if(!(!A||this.#e.has(A.loadedName))){if((0,u.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:x,src:g,style:b}=A,y=new FontFace(x,g,b);this.addNativeFontFace(y);try{await y.load(),this.#e.add(x)}catch{(0,u.warn)(`Cannot load system font: ${A.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(y)}return}(0,u.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(A){if(A.attached||A.missingFile&&!A.systemFontInfo)return;if(A.attached=!0,A.systemFontInfo){await this.loadSystemFont(A.systemFontInfo);return}if(this.isFontLoadingAPISupported){const g=A.createNativeFontFace();if(g){this.addNativeFontFace(g);try{await g.loaded}catch(b){throw(0,u.warn)(`Failed to load font '${g.family}': '${b}'.`),A.disableFontFace=!0,b}}return}const x=A.createFontFaceRule();if(x){if(this.insertRule(x),this.isSyncFontLoadingSupported)return;await new Promise(g=>{const b=this._queueLoadingCallback(g);this._prepareFontLoadEvent(A,b)})}}get isFontLoadingAPISupported(){const A=!!this._document?.fonts;return(0,u.shadow)(this,"isFontLoadingAPISupported",A)}get isSyncFontLoadingSupported(){let A=!1;return(u.isNodeJS||typeof navigator<"u"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(A=!0),(0,u.shadow)(this,"isSyncFontLoadingSupported",A)}_queueLoadingCallback(A){function x(){for((0,u.assert)(!b.done,"completeRequest() cannot be called twice."),b.done=!0;g.length>0&&g[0].done;){const y=g.shift();setTimeout(y.callback,0)}}const{loadingRequests:g}=this,b={done:!1,complete:x,callback:A};return g.push(b),b}get _loadTestFont(){const A=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,u.shadow)(this,"_loadTestFont",A)}_prepareFontLoadEvent(A,x){function g(F,D){return F.charCodeAt(D)<<24|F.charCodeAt(D+1)<<16|F.charCodeAt(D+2)<<8|F.charCodeAt(D+3)&255}function b(F,D,V,j){const G=F.substring(0,D),U=F.substring(D+V);return G+j+U}let y,f;const m=this._document.createElement("canvas");m.width=1,m.height=1;const E=m.getContext("2d");let w=0;function S(F,D){if(++w>30){(0,u.warn)("Load test font never loaded."),D();return}if(E.font="30px "+F,E.fillText(".",0,20),E.getImageData(0,0,1,1).data[3]>0){D();return}setTimeout(S.bind(null,F,D))}const $=`lt${Date.now()}${this.loadTestFontId++}`;let T=this._loadTestFont;T=b(T,976,$.length,$);const I=16,C=1482184792;let P=g(T,I);for(y=0,f=$.length-3;y<f;y+=4)P=P-C+g($,y)|0;y<$.length&&(P=P-C+g($+"XXX",y)|0),T=b(T,I,4,(0,u.string32)(P));const O=`url(data:font/opentype;base64,${btoa(T)});`,L=`@font-face {font-family:"${$}";src:${O}}`;this.insertRule(L);const B=this._document.createElement("div");B.style.visibility="hidden",B.style.width=B.style.height="10px",B.style.position="absolute",B.style.top=B.style.left="0px";for(const F of[A.loadedName,$]){const D=this._document.createElement("span");D.textContent="Hi",D.style.fontFamily=F,B.append(D)}this._document.body.append(B),S($,()=>{B.remove(),x.complete()})}}s.FontLoader=d;class p{constructor(A,{isEvalSupported:x=!0,disableFontFace:g=!1,ignoreErrors:b=!1,inspectFont:y=null}){this.compiledGlyphs=Object.create(null);for(const f in A)this[f]=A[f];this.isEvalSupported=x!==!1,this.disableFontFace=g===!0,this.ignoreErrors=b===!0,this._inspectFont=y}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let A;if(!this.cssFontInfo)A=new FontFace(this.loadedName,this.data,{});else{const x={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(x.style=`oblique ${this.cssFontInfo.italicAngle}deg`),A=new FontFace(this.cssFontInfo.fontFamily,this.data,x)}return this._inspectFont?.(this),A}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const A=(0,u.bytesToString)(this.data),x=`url(data:${this.mimetype};base64,${btoa(A)});`;let g;if(!this.cssFontInfo)g=`@font-face {font-family:"${this.loadedName}";src:${x}}`;else{let b=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(b+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),g=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${b}src:${x}}`}return this._inspectFont?.(this,x),g}getPathGenerator(A,x){if(this.compiledGlyphs[x]!==void 0)return this.compiledGlyphs[x];let g;try{g=A.get(this.loadedName+"_path_"+x)}catch(b){if(!this.ignoreErrors)throw b;return(0,u.warn)(`getPathGenerator - ignoring character: "${b}".`),this.compiledGlyphs[x]=function(y,f){}}if(this.isEvalSupported&&u.FeatureTest.isEvalSupported){const b=[];for(const y of g){const f=y.args!==void 0?y.args.join(","):"";b.push("c.",y.cmd,"(",f,`);
61
61
  `)}return this.compiledGlyphs[x]=new Function("c","size",b.join(""))}return this.compiledGlyphs[x]=function(b,y){for(const f of g)f.cmd==="scale"&&(f.args=[y,-y]),b[f.cmd].apply(b,f.args)}}}s.FontFaceObject=p}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.NodeStandardFontDataFactory=s.NodeFilterFactory=s.NodeCanvasFactory=s.NodeCMapReaderFactory=void 0;var u=c(7);c(1);const d=function(g){return new Promise((b,y)=>{require$$5.readFile(g,(m,E)=>{if(m||!E){y(new Error(m));return}b(new Uint8Array(E))})})};class p extends u.BaseFilterFactory{}s.NodeFilterFactory=p;class v extends u.BaseCanvasFactory{_createCanvas(b,y){return require$$5.createCanvas(b,y)}}s.NodeCanvasFactory=v;class A extends u.BaseCMapReaderFactory{_fetchData(b,y){return d(b).then(f=>({cMapData:f,compressionType:y}))}}s.NodeCMapReaderFactory=A;class x extends u.BaseStandardFontDataFactory{_fetchData(b){return d(b)}}s.NodeStandardFontDataFactory=x}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.CanvasGraphics=void 0;var u=c(1),d=c(6),p=c(12),v=c(13);const A=16,x=100,g=4096,b=15,y=10,f=1e3,m=16;function E(R,k){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(){k.save(),this.__originalSave()},R.restore=function(){k.restore(),this.__originalRestore()},R.translate=function(W,J){k.translate(W,J),this.__originalTranslate(W,J)},R.scale=function(W,J){k.scale(W,J),this.__originalScale(W,J)},R.transform=function(W,J,re,K,q,Q){k.transform(W,J,re,K,q,Q),this.__originalTransform(W,J,re,K,q,Q)},R.setTransform=function(W,J,re,K,q,Q){k.setTransform(W,J,re,K,q,Q),this.__originalSetTransform(W,J,re,K,q,Q)},R.resetTransform=function(){k.resetTransform(),this.__originalResetTransform()},R.rotate=function(W){k.rotate(W),this.__originalRotate(W)},R.clip=function(W){k.clip(W),this.__originalClip(W)},R.moveTo=function(z,W){k.moveTo(z,W),this.__originalMoveTo(z,W)},R.lineTo=function(z,W){k.lineTo(z,W),this.__originalLineTo(z,W)},R.bezierCurveTo=function(z,W,J,re,K,q){k.bezierCurveTo(z,W,J,re,K,q),this.__originalBezierCurveTo(z,W,J,re,K,q)},R.rect=function(z,W,J,re){k.rect(z,W,J,re),this.__originalRect(z,W,J,re)},R.closePath=function(){k.closePath(),this.__originalClosePath()},R.beginPath=function(){k.beginPath(),this.__originalBeginPath()}}class w{constructor(k){this.canvasFactory=k,this.cache=Object.create(null)}getCanvas(k,z,W){let J;return this.cache[k]!==void 0?(J=this.cache[k],this.canvasFactory.reset(J,z,W)):(J=this.canvasFactory.create(z,W),this.cache[k]=J),J}delete(k){delete this.cache[k]}clear(){for(const k in this.cache){const z=this.cache[k];this.canvasFactory.destroy(z),delete this.cache[k]}}}function S(R,k,z,W,J,re,K,q,Q,ee){const[Y,Z,te,ae,oe,se]=(0,d.getCurrentTransform)(R);if(Z===0&&te===0){const ge=K*Y+oe,me=Math.round(ge),be=q*ae+se,le=Math.round(be),ve=(K+Q)*Y+oe,he=Math.abs(Math.round(ve)-me)||1,ye=(q+ee)*ae+se,Ee=Math.abs(Math.round(ye)-le)||1;return R.setTransform(Math.sign(Y),0,0,Math.sign(ae),me,le),R.drawImage(k,z,W,J,re,0,0,he,Ee),R.setTransform(Y,Z,te,ae,oe,se),[he,Ee]}if(Y===0&&ae===0){const ge=q*te+oe,me=Math.round(ge),be=K*Z+se,le=Math.round(be),ve=(q+ee)*te+oe,he=Math.abs(Math.round(ve)-me)||1,ye=(K+Q)*Z+se,Ee=Math.abs(Math.round(ye)-le)||1;return R.setTransform(0,Math.sign(Z),Math.sign(te),0,me,le),R.drawImage(k,z,W,J,re,0,0,Ee,he),R.setTransform(Y,Z,te,ae,oe,se),[Ee,he]}R.drawImage(k,z,W,J,re,K,q,Q,ee);const fe=Math.hypot(Y,Z),pe=Math.hypot(te,ae);return[fe*Q,pe*ee]}function $(R){const{width:k,height:z}=R;if(k>f||z>f)return null;const W=1e3,J=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),re=k+1;let K=new Uint8Array(re*(z+1)),q,Q,ee;const Y=k+7&-8;let Z=new Uint8Array(Y*z),te=0;for(const pe of R.data){let ge=128;for(;ge>0;)Z[te++]=pe&ge?0:255,ge>>=1}let ae=0;for(te=0,Z[te]!==0&&(K[0]=1,++ae),Q=1;Q<k;Q++)Z[te]!==Z[te+1]&&(K[Q]=Z[te]?2:1,++ae),te++;for(Z[te]!==0&&(K[Q]=2,++ae),q=1;q<z;q++){te=q*Y,ee=q*re,Z[te-Y]!==Z[te]&&(K[ee]=Z[te]?1:8,++ae);let pe=(Z[te]?4:0)+(Z[te-Y]?8:0);for(Q=1;Q<k;Q++)pe=(pe>>2)+(Z[te+1]?4:0)+(Z[te-Y+1]?8:0),J[pe]&&(K[ee+Q]=J[pe],++ae),te++;if(Z[te-Y]!==Z[te]&&(K[ee+Q]=Z[te]?2:4,++ae),ae>W)return null}for(te=Y*(z-1),ee=q*re,Z[te]!==0&&(K[ee]=8,++ae),Q=1;Q<k;Q++)Z[te]!==Z[te+1]&&(K[ee+Q]=Z[te]?4:8,++ae),te++;if(Z[te]!==0&&(K[ee+Q]=4,++ae),ae>W)return null;const oe=new Int32Array([0,re,-1,0,-re,0,0,0,1]),se=new Path2D;for(q=0;ae&&q<=z;q++){let pe=q*re;const ge=pe+k;for(;pe<ge&&!K[pe];)pe++;if(pe===ge)continue;se.moveTo(pe%re,q);const me=pe;let be=K[pe];do{const le=oe[be];do pe+=le;while(!K[pe]);const ve=K[pe];ve!==5&&ve!==10?(be=ve,K[pe]=0):(be=ve&51*be>>4,K[pe]&=be>>2|be<<2),se.lineTo(pe%re,pe/re|0),K[pe]||--ae}while(me!==pe);--q}return Z=null,K=null,function(pe){pe.save(),pe.scale(1/k,-1/z),pe.translate(0,-z),pe.fill(se),pe.beginPath(),pe.restore()}}class T{constructor(k,z){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=u.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=u.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=u.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,k,z])}clone(){const k=Object.create(this);return k.clipBox=this.clipBox.slice(),k}setCurrentPoint(k,z){this.x=k,this.y=z}updatePathMinMax(k,z,W){[z,W]=u.Util.applyTransform([z,W],k),this.minX=Math.min(this.minX,z),this.minY=Math.min(this.minY,W),this.maxX=Math.max(this.maxX,z),this.maxY=Math.max(this.maxY,W)}updateRectMinMax(k,z){const W=u.Util.applyTransform(z,k),J=u.Util.applyTransform(z.slice(2),k);this.minX=Math.min(this.minX,W[0],J[0]),this.minY=Math.min(this.minY,W[1],J[1]),this.maxX=Math.max(this.maxX,W[0],J[0]),this.maxY=Math.max(this.maxY,W[1],J[1])}updateScalingPathMinMax(k,z){u.Util.scaleMinMax(k,z),this.minX=Math.min(this.minX,z[0]),this.maxX=Math.max(this.maxX,z[1]),this.minY=Math.min(this.minY,z[2]),this.maxY=Math.max(this.maxY,z[3])}updateCurvePathMinMax(k,z,W,J,re,K,q,Q,ee,Y){const Z=u.Util.bezierBoundingBox(z,W,J,re,K,q,Q,ee);if(Y){Y[0]=Math.min(Y[0],Z[0],Z[2]),Y[1]=Math.max(Y[1],Z[0],Z[2]),Y[2]=Math.min(Y[2],Z[1],Z[3]),Y[3]=Math.max(Y[3],Z[1],Z[3]);return}this.updateRectMinMax(k,Z)}getPathBoundingBox(k=p.PathType.FILL,z=null){const W=[this.minX,this.minY,this.maxX,this.maxY];if(k===p.PathType.STROKE){z||(0,u.unreachable)("Stroke bounding box must include transform.");const J=u.Util.singularValueDecompose2dScale(z),re=J[0]*this.lineWidth/2,K=J[1]*this.lineWidth/2;W[0]-=re,W[1]-=K,W[2]+=re,W[3]+=K}return W}updateClipFromPath(){const k=u.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(k||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(k){this.clipBox=k,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(k=p.PathType.FILL,z=null){return u.Util.intersect(this.clipBox,this.getPathBoundingBox(k,z))}}function _(R,k){if(typeof ImageData<"u"&&k instanceof ImageData){R.putImageData(k,0,0);return}const z=k.height,W=k.width,J=z%m,re=(z-J)/m,K=J===0?re:re+1,q=R.createImageData(W,m);let Q=0,ee;const Y=k.data,Z=q.data;let te,ae,oe,se;if(k.kind===u.ImageKind.GRAYSCALE_1BPP){const fe=Y.byteLength,pe=new Uint32Array(Z.buffer,0,Z.byteLength>>2),ge=pe.length,me=W+7>>3,be=4294967295,le=u.FeatureTest.isLittleEndian?4278190080:255;for(te=0;te<K;te++){for(oe=te<re?m:J,ee=0,ae=0;ae<oe;ae++){const ve=fe-Q;let he=0;const ye=ve>me?W:ve*8-7,Ee=ye&-8;let xe=0,we=0;for(;he<Ee;he+=8)we=Y[Q++],pe[ee++]=we&128?be:le,pe[ee++]=we&64?be:le,pe[ee++]=we&32?be:le,pe[ee++]=we&16?be:le,pe[ee++]=we&8?be:le,pe[ee++]=we&4?be:le,pe[ee++]=we&2?be:le,pe[ee++]=we&1?be:le;for(;he<ye;he++)xe===0&&(we=Y[Q++],xe=128),pe[ee++]=we&xe?be:le,xe>>=1}for(;ee<ge;)pe[ee++]=0;R.putImageData(q,0,te*m)}}else if(k.kind===u.ImageKind.RGBA_32BPP){for(ae=0,se=W*m*4,te=0;te<re;te++)Z.set(Y.subarray(Q,Q+se)),Q+=se,R.putImageData(q,0,ae),ae+=m;te<K&&(se=W*J*4,Z.set(Y.subarray(Q,Q+se)),R.putImageData(q,0,ae))}else if(k.kind===u.ImageKind.RGB_24BPP)for(oe=m,se=W*oe,te=0;te<K;te++){for(te>=re&&(oe=J,se=W*oe),ee=0,ae=se;ae--;)Z[ee++]=Y[Q++],Z[ee++]=Y[Q++],Z[ee++]=Y[Q++],Z[ee++]=255;R.putImageData(q,0,te*m)}else throw new Error(`bad image kind: ${k.kind}`)}function I(R,k){if(k.bitmap){R.drawImage(k.bitmap,0,0);return}const z=k.height,W=k.width,J=z%m,re=(z-J)/m,K=J===0?re:re+1,q=R.createImageData(W,m);let Q=0;const ee=k.data,Y=q.data;for(let Z=0;Z<K;Z++){const te=Z<re?m:J;({srcPos:Q}=(0,v.convertBlackAndWhiteToRGBA)({src:ee,srcPos:Q,dest:Y,width:W,height:te,nonBlackColor:0})),R.putImageData(q,0,Z*m)}}function C(R,k){const z=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const W of z)R[W]!==void 0&&(k[W]=R[W]);R.setLineDash!==void 0&&(k.setLineDash(R.getLineDash()),k.lineDashOffset=R.lineDashOffset)}function P(R){if(R.strokeStyle=R.fillStyle="#000000",R.fillRule="nonzero",R.globalAlpha=1,R.lineWidth=1,R.lineCap="butt",R.lineJoin="miter",R.miterLimit=10,R.globalCompositeOperation="source-over",R.font="10px sans-serif",R.setLineDash!==void 0&&(R.setLineDash([]),R.lineDashOffset=0),!u.isNodeJS){const{filter:k}=R;k!=="none"&&k!==""&&(R.filter="none")}}function O(R,k,z,W){const J=R.length;for(let re=3;re<J;re+=4){const K=R[re];if(K===0)R[re-3]=k,R[re-2]=z,R[re-1]=W;else if(K<255){const q=255-K;R[re-3]=R[re-3]*K+k*q>>8,R[re-2]=R[re-2]*K+z*q>>8,R[re-1]=R[re-1]*K+W*q>>8}}}function L(R,k,z){const W=R.length,J=1/255;for(let re=3;re<W;re+=4){const K=z?z[R[re]]:R[re];k[re]=k[re]*K*J|0}}function B(R,k,z){const W=R.length;for(let J=3;J<W;J+=4){const re=R[J-3]*77+R[J-2]*152+R[J-1]*28;k[J]=z?k[J]*z[re>>8]>>8:k[J]*re>>16}}function F(R,k,z,W,J,re,K,q,Q,ee,Y){const Z=!!re,te=Z?re[0]:0,ae=Z?re[1]:0,oe=Z?re[2]:0,se=J==="Luminosity"?B:L,pe=Math.min(W,Math.ceil(1048576/z));for(let ge=0;ge<W;ge+=pe){const me=Math.min(pe,W-ge),be=R.getImageData(q-ee,ge+(Q-Y),z,me),le=k.getImageData(q,ge+Q,z,me);Z&&O(be.data,te,ae,oe),se(be.data,le.data,K),k.putImageData(le,q,ge+Q)}}function D(R,k,z,W){const J=W[0],re=W[1],K=W[2]-J,q=W[3]-re;K===0||q===0||(F(k.context,z,K,q,k.subtype,k.backdrop,k.transferMap,J,re,k.offsetX,k.offsetY),R.save(),R.globalAlpha=1,R.globalCompositeOperation="source-over",R.setTransform(1,0,0,1,0,0),R.drawImage(z.canvas,0,0),R.restore())}function V(R,k){const z=u.Util.singularValueDecompose2dScale(R);z[0]=Math.fround(z[0]),z[1]=Math.fround(z[1]);const W=Math.fround((globalThis.devicePixelRatio||1)*d.PixelsPerInch.PDF_TO_CSS_UNITS);return k!==void 0?k:z[0]<=W||z[1]<=W}const j=["butt","round","square"],G=["miter","round","bevel"],U={},M={};class N{constructor(k,z,W,J,re,{optionalContentConfig:K,markedContentStack:q=null},Q,ee){this.ctx=k,this.current=new T(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=z,this.objs=W,this.canvasFactory=J,this.filterFactory=re,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=q||[],this.optionalContentConfig=K,this.cachedCanvases=new w(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=Q,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=ee,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(k,z=null){return typeof k=="string"?k.startsWith("g_")?this.commonObjs.get(k):this.objs.get(k):z}beginDrawing({transform:k,viewport:z,transparency:W=!1,background:J=null}){const re=this.ctx.canvas.width,K=this.ctx.canvas.height,q=this.ctx.fillStyle;if(this.ctx.fillStyle=J||"#ffffff",this.ctx.fillRect(0,0,re,K),this.ctx.fillStyle=q,W){const Q=this.cachedCanvases.getCanvas("transparent",re,K);this.compositeCtx=this.ctx,this.transparentCanvas=Q.canvas,this.ctx=Q.context,this.ctx.save(),this.ctx.transform(...(0,d.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),P(this.ctx),k&&(this.ctx.transform(...k),this.outputScaleX=k[0],this.outputScaleY=k[0]),this.ctx.transform(...z.transform),this.viewportScale=z.scale,this.baseTransform=(0,d.getCurrentTransform)(this.ctx)}executeOperatorList(k,z,W,J){const re=k.argsArray,K=k.fnArray;let q=z||0;const Q=re.length;if(Q===q)return q;const ee=Q-q>y&&typeof W=="function",Y=ee?Date.now()+b:0;let Z=0;const te=this.commonObjs,ae=this.objs;let oe;for(;;){if(J!==void 0&&q===J.nextBreakPoint)return J.breakIt(q,W),q;if(oe=K[q],oe!==u.OPS.dependency)this[oe].apply(this,re[q]);else for(const se of re[q]){const fe=se.startsWith("g_")?te:ae;if(!fe.has(se))return fe.get(se,W),q}if(q++,q===Q)return q;if(ee&&++Z>y){if(Date.now()>Y)return W(),q;Z=0}}}#e(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();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.transparentCanvas=null)}endDrawing(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const k of this._cachedBitmapsMap.values()){for(const z of k.values())typeof HTMLCanvasElement<"u"&&z instanceof HTMLCanvasElement&&(z.width=z.height=0);k.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){const k=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(k!=="none"){const z=this.ctx.filter;this.ctx.filter=k,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=z}}}_scaleImage(k,z){const W=k.width,J=k.height;let re=Math.max(Math.hypot(z[0],z[1]),1),K=Math.max(Math.hypot(z[2],z[3]),1),q=W,Q=J,ee="prescale1",Y,Z;for(;re>2&&q>1||K>2&&Q>1;){let te=q,ae=Q;re>2&&q>1&&(te=q>=16384?Math.floor(q/2)-1||1:Math.ceil(q/2),re/=q/te),K>2&&Q>1&&(ae=Q>=16384?Math.floor(Q/2)-1||1:Math.ceil(Q)/2,K/=Q/ae),Y=this.cachedCanvases.getCanvas(ee,te,ae),Z=Y.context,Z.clearRect(0,0,te,ae),Z.drawImage(k,0,0,q,Q,0,0,te,ae),k=Y.canvas,q=te,Q=ae,ee=ee==="prescale1"?"prescale2":"prescale1"}return{img:k,paintWidth:q,paintHeight:Q}}_createMaskCanvas(k){const z=this.ctx,{width:W,height:J}=k,re=this.current.fillColor,K=this.current.patternFill,q=(0,d.getCurrentTransform)(z);let Q,ee,Y,Z;if((k.bitmap||k.data)&&k.count>1){const he=k.bitmap||k.data.buffer;ee=JSON.stringify(K?q:[q.slice(0,4),re]),Q=this._cachedBitmapsMap.get(he),Q||(Q=new Map,this._cachedBitmapsMap.set(he,Q));const ye=Q.get(ee);if(ye&&!K){const Ee=Math.round(Math.min(q[0],q[2])+q[4]),xe=Math.round(Math.min(q[1],q[3])+q[5]);return{canvas:ye,offsetX:Ee,offsetY:xe}}Y=ye}Y||(Z=this.cachedCanvases.getCanvas("maskCanvas",W,J),I(Z.context,k));let te=u.Util.transform(q,[1/W,0,0,-1/J,0,0]);te=u.Util.transform(te,[1,0,0,1,0,-J]);const ae=u.Util.applyTransform([0,0],te),oe=u.Util.applyTransform([W,J],te),se=u.Util.normalizeRect([ae[0],ae[1],oe[0],oe[1]]),fe=Math.round(se[2]-se[0])||1,pe=Math.round(se[3]-se[1])||1,ge=this.cachedCanvases.getCanvas("fillCanvas",fe,pe),me=ge.context,be=Math.min(ae[0],oe[0]),le=Math.min(ae[1],oe[1]);me.translate(-be,-le),me.transform(...te),Y||(Y=this._scaleImage(Z.canvas,(0,d.getCurrentTransformInverse)(me)),Y=Y.img,Q&&K&&Q.set(ee,Y)),me.imageSmoothingEnabled=V((0,d.getCurrentTransform)(me),k.interpolate),S(me,Y,0,0,Y.width,Y.height,0,0,W,J),me.globalCompositeOperation="source-in";const ve=u.Util.transform((0,d.getCurrentTransformInverse)(me),[1,0,0,1,-be,-le]);return me.fillStyle=K?re.getPattern(z,this,ve,p.PathType.FILL):re,me.fillRect(0,0,W,J),Q&&!K&&(this.cachedCanvases.delete("fillCanvas"),Q.set(ee,ge.canvas)),{canvas:ge.canvas,offsetX:Math.round(be),offsetY:Math.round(le)}}setLineWidth(k){k!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=k,this.ctx.lineWidth=k}setLineCap(k){this.ctx.lineCap=j[k]}setLineJoin(k){this.ctx.lineJoin=G[k]}setMiterLimit(k){this.ctx.miterLimit=k}setDash(k,z){const W=this.ctx;W.setLineDash!==void 0&&(W.setLineDash(k),W.lineDashOffset=z)}setRenderingIntent(k){}setFlatness(k){}setGState(k){for(const[z,W]of k)switch(z){case"LW":this.setLineWidth(W);break;case"LC":this.setLineCap(W);break;case"LJ":this.setLineJoin(W);break;case"ML":this.setMiterLimit(W);break;case"D":this.setDash(W[0],W[1]);break;case"RI":this.setRenderingIntent(W);break;case"FL":this.setFlatness(W);break;case"Font":this.setFont(W[0],W[1]);break;case"CA":this.current.strokeAlpha=W;break;case"ca":this.current.fillAlpha=W,this.ctx.globalAlpha=W;break;case"BM":this.ctx.globalCompositeOperation=W;break;case"SMask":this.current.activeSMask=W?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(W);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const k=this.inSMaskMode;this.current.activeSMask&&!k?this.beginSMaskMode():!this.current.activeSMask&&k&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const k=this.ctx.canvas.width,z=this.ctx.canvas.height,W="smaskGroupAt"+this.groupLevel,J=this.cachedCanvases.getCanvas(W,k,z);this.suspendedCtx=this.ctx,this.ctx=J.context;const re=this.ctx;re.setTransform(...(0,d.getCurrentTransform)(this.suspendedCtx)),C(this.suspendedCtx,re),E(re,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),C(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(k){if(!this.current.activeSMask)return;k?(k[0]=Math.floor(k[0]),k[1]=Math.floor(k[1]),k[2]=Math.ceil(k[2]),k[3]=Math.ceil(k[3])):k=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const z=this.current.activeSMask,W=this.suspendedCtx;D(W,z,this.ctx,k),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()}save(){this.inSMaskMode?(C(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const k=this.current;this.stateStack.push(k),this.current=k.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),C(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(k,z,W,J,re,K){this.ctx.transform(k,z,W,J,re,K),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(k,z,W){const J=this.ctx,re=this.current;let K=re.x,q=re.y,Q,ee;const Y=(0,d.getCurrentTransform)(J),Z=Y[0]===0&&Y[3]===0||Y[1]===0&&Y[2]===0,te=Z?W.slice(0):null;for(let ae=0,oe=0,se=k.length;ae<se;ae++)switch(k[ae]|0){case u.OPS.rectangle:K=z[oe++],q=z[oe++];const fe=z[oe++],pe=z[oe++],ge=K+fe,me=q+pe;J.moveTo(K,q),fe===0||pe===0?J.lineTo(ge,me):(J.lineTo(ge,q),J.lineTo(ge,me),J.lineTo(K,me)),Z||re.updateRectMinMax(Y,[K,q,ge,me]),J.closePath();break;case u.OPS.moveTo:K=z[oe++],q=z[oe++],J.moveTo(K,q),Z||re.updatePathMinMax(Y,K,q);break;case u.OPS.lineTo:K=z[oe++],q=z[oe++],J.lineTo(K,q),Z||re.updatePathMinMax(Y,K,q);break;case u.OPS.curveTo:Q=K,ee=q,K=z[oe+4],q=z[oe+5],J.bezierCurveTo(z[oe],z[oe+1],z[oe+2],z[oe+3],K,q),re.updateCurvePathMinMax(Y,Q,ee,z[oe],z[oe+1],z[oe+2],z[oe+3],K,q,te),oe+=6;break;case u.OPS.curveTo2:Q=K,ee=q,J.bezierCurveTo(K,q,z[oe],z[oe+1],z[oe+2],z[oe+3]),re.updateCurvePathMinMax(Y,Q,ee,K,q,z[oe],z[oe+1],z[oe+2],z[oe+3],te),K=z[oe+2],q=z[oe+3],oe+=4;break;case u.OPS.curveTo3:Q=K,ee=q,K=z[oe+2],q=z[oe+3],J.bezierCurveTo(z[oe],z[oe+1],K,q,K,q),re.updateCurvePathMinMax(Y,Q,ee,z[oe],z[oe+1],K,q,K,q,te),oe+=4;break;case u.OPS.closePath:J.closePath();break}Z&&re.updateScalingPathMinMax(Y,te),re.setCurrentPoint(K,q)}closePath(){this.ctx.closePath()}stroke(k=!0){const z=this.ctx,W=this.current.strokeColor;z.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof W=="object"&&W?.getPattern?(z.save(),z.strokeStyle=W.getPattern(z,this,(0,d.getCurrentTransformInverse)(z),p.PathType.STROKE),this.rescaleAndStroke(!1),z.restore()):this.rescaleAndStroke(!0)),k&&this.consumePath(this.current.getClippedPathBoundingBox()),z.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(k=!0){const z=this.ctx,W=this.current.fillColor,J=this.current.patternFill;let re=!1;J&&(z.save(),z.fillStyle=W.getPattern(z,this,(0,d.getCurrentTransformInverse)(z),p.PathType.FILL),re=!0);const K=this.current.getClippedPathBoundingBox();this.contentVisible&&K!==null&&(this.pendingEOFill?(z.fill("evenodd"),this.pendingEOFill=!1):z.fill()),re&&z.restore(),k&&this.consumePath(K)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=U}eoClip(){this.pendingClip=M}beginText(){this.current.textMatrix=u.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const k=this.pendingTextPaths,z=this.ctx;if(k===void 0){z.beginPath();return}z.save(),z.beginPath();for(const W of k)z.setTransform(...W.transform),z.translate(W.x,W.y),W.addToPath(z,W.fontSize);z.restore(),z.clip(),z.beginPath(),delete this.pendingTextPaths}setCharSpacing(k){this.current.charSpacing=k}setWordSpacing(k){this.current.wordSpacing=k}setHScale(k){this.current.textHScale=k/100}setLeading(k){this.current.leading=-k}setFont(k,z){const W=this.commonObjs.get(k),J=this.current;if(!W)throw new Error(`Can't find font for ${k}`);if(J.fontMatrix=W.fontMatrix||u.FONT_IDENTITY_MATRIX,(J.fontMatrix[0]===0||J.fontMatrix[3]===0)&&(0,u.warn)("Invalid font matrix for font "+k),z<0?(z=-z,J.fontDirection=-1):J.fontDirection=1,this.current.font=W,this.current.fontSize=z,W.isType3Font)return;const re=W.loadedName||"sans-serif",K=W.systemFontInfo?.css||`"${re}", ${W.fallbackName}`;let q="normal";W.black?q="900":W.bold&&(q="bold");const Q=W.italic?"italic":"normal";let ee=z;z<A?ee=A:z>x&&(ee=x),this.current.fontSizeScale=z/ee,this.ctx.font=`${Q} ${q} ${ee}px ${K}`}setTextRenderingMode(k){this.current.textRenderingMode=k}setTextRise(k){this.current.textRise=k}moveText(k,z){this.current.x=this.current.lineX+=k,this.current.y=this.current.lineY+=z}setLeadingMoveText(k,z){this.setLeading(-z),this.moveText(k,z)}setTextMatrix(k,z,W,J,re,K){this.current.textMatrix=[k,z,W,J,re,K],this.current.textMatrixScale=Math.hypot(k,z),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(k,z,W,J){const re=this.ctx,K=this.current,q=K.font,Q=K.textRenderingMode,ee=K.fontSize/K.fontSizeScale,Y=Q&u.TextRenderingMode.FILL_STROKE_MASK,Z=!!(Q&u.TextRenderingMode.ADD_TO_PATH_FLAG),te=K.patternFill&&!q.missingFile;let ae;(q.disableFontFace||Z||te)&&(ae=q.getPathGenerator(this.commonObjs,k)),q.disableFontFace||te?(re.save(),re.translate(z,W),re.beginPath(),ae(re,ee),J&&re.setTransform(...J),(Y===u.TextRenderingMode.FILL||Y===u.TextRenderingMode.FILL_STROKE)&&re.fill(),(Y===u.TextRenderingMode.STROKE||Y===u.TextRenderingMode.FILL_STROKE)&&re.stroke(),re.restore()):((Y===u.TextRenderingMode.FILL||Y===u.TextRenderingMode.FILL_STROKE)&&re.fillText(k,z,W),(Y===u.TextRenderingMode.STROKE||Y===u.TextRenderingMode.FILL_STROKE)&&re.strokeText(k,z,W)),Z&&(this.pendingTextPaths||=[]).push({transform:(0,d.getCurrentTransform)(re),x:z,y:W,fontSize:ee,addToPath:ae})}get isFontSubpixelAAEnabled(){const{context:k}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);k.scale(1.5,1),k.fillText("I",0,10);const z=k.getImageData(0,0,10,10).data;let W=!1;for(let J=3;J<z.length;J+=4)if(z[J]>0&&z[J]<255){W=!0;break}return(0,u.shadow)(this,"isFontSubpixelAAEnabled",W)}showText(k){const z=this.current,W=z.font;if(W.isType3Font)return this.showType3Text(k);const J=z.fontSize;if(J===0)return;const re=this.ctx,K=z.fontSizeScale,q=z.charSpacing,Q=z.wordSpacing,ee=z.fontDirection,Y=z.textHScale*ee,Z=k.length,te=W.vertical,ae=te?1:-1,oe=W.defaultVMetrics,se=J*z.fontMatrix[0],fe=z.textRenderingMode===u.TextRenderingMode.FILL&&!W.disableFontFace&&!z.patternFill;re.save(),re.transform(...z.textMatrix),re.translate(z.x,z.y+z.textRise),ee>0?re.scale(Y,-1):re.scale(Y,1);let pe;if(z.patternFill){re.save();const ve=z.fillColor.getPattern(re,this,(0,d.getCurrentTransformInverse)(re),p.PathType.FILL);pe=(0,d.getCurrentTransform)(re),re.restore(),re.fillStyle=ve}let ge=z.lineWidth;const me=z.textMatrixScale;if(me===0||ge===0){const ve=z.textRenderingMode&u.TextRenderingMode.FILL_STROKE_MASK;(ve===u.TextRenderingMode.STROKE||ve===u.TextRenderingMode.FILL_STROKE)&&(ge=this.getSinglePixelWidth())}else ge/=me;if(K!==1&&(re.scale(K,K),ge/=K),re.lineWidth=ge,W.isInvalidPDFjsFont){const ve=[];let he=0;for(const ye of k)ve.push(ye.unicode),he+=ye.width;re.fillText(ve.join(""),0,0),z.x+=he*se*Y,re.restore(),this.compose();return}let be=0,le;for(le=0;le<Z;++le){const ve=k[le];if(typeof ve=="number"){be+=ae*ve*J/1e3;continue}let he=!1;const ye=(ve.isSpace?Q:0)+q,Ee=ve.fontChar,xe=ve.accent;let we,$e,Ae=ve.width;if(te){const ce=ve.vmetric||oe,Ce=-(ve.vmetric?ce[1]:Ae*.5)*se,Ie=ce[2]*se;Ae=ce?-ce[0]:Ae,we=Ce/K,$e=(be+Ie)/K}else we=be/K,$e=0;if(W.remeasure&&Ae>0){const ce=re.measureText(Ee).width*1e3/J*K;if(Ae<ce&&this.isFontSubpixelAAEnabled){const Ce=Ae/ce;he=!0,re.save(),re.scale(Ce,1),we/=Ce}else Ae!==ce&&(we+=(Ae-ce)/2e3*J/K)}if(this.contentVisible&&(ve.isInFont||W.missingFile)){if(fe&&!xe)re.fillText(Ee,we,$e);else if(this.paintChar(Ee,we,$e,pe),xe){const ce=we+J*xe.offset.x/K,Ce=$e-J*xe.offset.y/K;this.paintChar(xe.fontChar,ce,Ce,pe)}}const ue=te?Ae*se-ye*ee:Ae*se+ye*ee;be+=ue,he&&re.restore()}te?z.y-=be:z.x+=be*Y,re.restore(),this.compose()}showType3Text(k){const z=this.ctx,W=this.current,J=W.font,re=W.fontSize,K=W.fontDirection,q=J.vertical?1:-1,Q=W.charSpacing,ee=W.wordSpacing,Y=W.textHScale*K,Z=W.fontMatrix||u.FONT_IDENTITY_MATRIX,te=k.length,ae=W.textRenderingMode===u.TextRenderingMode.INVISIBLE;let oe,se,fe,pe;if(!(ae||re===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,z.save(),z.transform(...W.textMatrix),z.translate(W.x,W.y),z.scale(Y,K),oe=0;oe<te;++oe){if(se=k[oe],typeof se=="number"){pe=q*se*re/1e3,this.ctx.translate(pe,0),W.x+=pe*Y;continue}const ge=(se.isSpace?ee:0)+Q,me=J.charProcOperatorList[se.operatorListId];if(!me){(0,u.warn)(`Type3 character "${se.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=se,this.save(),z.scale(re,re),z.transform(...Z),this.executeOperatorList(me),this.restore()),fe=u.Util.applyTransform([se.width,0],Z)[0]*re+ge,z.translate(fe,0),W.x+=fe*Y}z.restore(),this.processingType3=null}}setCharWidth(k,z){}setCharWidthAndBounds(k,z,W,J,re,K){this.ctx.rect(W,J,re-W,K-J),this.ctx.clip(),this.endPath()}getColorN_Pattern(k){let z;if(k[0]==="TilingPattern"){const W=k[1],J=this.baseTransform||(0,d.getCurrentTransform)(this.ctx),re={createCanvasGraphics:K=>new N(K,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};z=new p.TilingPattern(k,W,this.ctx,re,J)}else z=this._getPattern(k[1],k[2]);return z}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(k,z,W){const J=u.Util.makeHexColor(k,z,W);this.ctx.strokeStyle=J,this.current.strokeColor=J}setFillRGBColor(k,z,W){const J=u.Util.makeHexColor(k,z,W);this.ctx.fillStyle=J,this.current.fillColor=J,this.current.patternFill=!1}_getPattern(k,z=null){let W;return this.cachedPatterns.has(k)?W=this.cachedPatterns.get(k):(W=(0,p.getShadingPattern)(this.getObject(k)),this.cachedPatterns.set(k,W)),z&&(W.matrix=z),W}shadingFill(k){if(!this.contentVisible)return;const z=this.ctx;this.save();const W=this._getPattern(k);z.fillStyle=W.getPattern(z,this,(0,d.getCurrentTransformInverse)(z),p.PathType.SHADING);const J=(0,d.getCurrentTransformInverse)(z);if(J){const{width:re,height:K}=z.canvas,[q,Q,ee,Y]=u.Util.getAxialAlignedBoundingBox([0,0,re,K],J);this.ctx.fillRect(q,Q,ee-q,Y-Q)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,u.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,u.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(k,z){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(k)&&k.length===6&&this.transform(...k),this.baseTransform=(0,d.getCurrentTransform)(this.ctx),z)){const W=z[2]-z[0],J=z[3]-z[1];this.ctx.rect(z[0],z[1],W,J),this.current.updateRectMinMax((0,d.getCurrentTransform)(this.ctx),z),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(k){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const z=this.ctx;k.isolated||(0,u.info)("TODO: Support non-isolated groups."),k.knockout&&(0,u.warn)("Knockout groups not supported.");const W=(0,d.getCurrentTransform)(z);if(k.matrix&&z.transform(...k.matrix),!k.bbox)throw new Error("Bounding box is required.");let J=u.Util.getAxialAlignedBoundingBox(k.bbox,(0,d.getCurrentTransform)(z));const re=[0,0,z.canvas.width,z.canvas.height];J=u.Util.intersect(J,re)||[0,0,0,0];const K=Math.floor(J[0]),q=Math.floor(J[1]);let Q=Math.max(Math.ceil(J[2])-K,1),ee=Math.max(Math.ceil(J[3])-q,1),Y=1,Z=1;Q>g&&(Y=Q/g,Q=g),ee>g&&(Z=ee/g,ee=g),this.current.startNewPathAndClipBox([0,0,Q,ee]);let te="groupAt"+this.groupLevel;k.smask&&(te+="_smask_"+this.smaskCounter++%2);const ae=this.cachedCanvases.getCanvas(te,Q,ee),oe=ae.context;oe.scale(1/Y,1/Z),oe.translate(-K,-q),oe.transform(...W),k.smask?this.smaskStack.push({canvas:ae.canvas,context:oe,offsetX:K,offsetY:q,scaleX:Y,scaleY:Z,subtype:k.smask.subtype,backdrop:k.smask.backdrop,transferMap:k.smask.transferMap||null,startTransformInverse:null}):(z.setTransform(1,0,0,1,0,0),z.translate(K,q),z.scale(Y,Z),z.save()),C(z,oe),this.ctx=oe,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(z),this.groupLevel++}endGroup(k){if(!this.contentVisible)return;this.groupLevel--;const z=this.ctx,W=this.groupStack.pop();if(this.ctx=W,this.ctx.imageSmoothingEnabled=!1,k.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const J=(0,d.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...J);const re=u.Util.getAxialAlignedBoundingBox([0,0,z.canvas.width,z.canvas.height],J);this.ctx.drawImage(z.canvas,0,0),this.ctx.restore(),this.compose(re)}}beginAnnotation(k,z,W,J,re){if(this.#e(),P(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(z)&&z.length===4){const K=z[2]-z[0],q=z[3]-z[1];if(re&&this.annotationCanvasMap){W=W.slice(),W[4]-=z[0],W[5]-=z[1],z=z.slice(),z[0]=z[1]=0,z[2]=K,z[3]=q;const[Q,ee]=u.Util.singularValueDecompose2dScale((0,d.getCurrentTransform)(this.ctx)),{viewportScale:Y}=this,Z=Math.ceil(K*this.outputScaleX*Y),te=Math.ceil(q*this.outputScaleY*Y);this.annotationCanvas=this.canvasFactory.create(Z,te);const{canvas:ae,context:oe}=this.annotationCanvas;this.annotationCanvasMap.set(k,ae),this.annotationCanvas.savedCtx=this.ctx,this.ctx=oe,this.ctx.save(),this.ctx.setTransform(Q,0,0,-ee,0,q*ee),P(this.ctx)}else P(this.ctx),this.ctx.rect(z[0],z[1],K,q),this.ctx.clip(),this.endPath()}this.current=new T(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...W),this.transform(...J)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(k){if(!this.contentVisible)return;const z=k.count;k=this.getObject(k.data,k),k.count=z;const W=this.ctx,J=this.processingType3;if(J&&(J.compiled===void 0&&(J.compiled=$(k)),J.compiled)){J.compiled(W);return}const re=this._createMaskCanvas(k),K=re.canvas;W.save(),W.setTransform(1,0,0,1,0,0),W.drawImage(K,re.offsetX,re.offsetY),W.restore(),this.compose()}paintImageMaskXObjectRepeat(k,z,W=0,J=0,re,K){if(!this.contentVisible)return;k=this.getObject(k.data,k);const q=this.ctx;q.save();const Q=(0,d.getCurrentTransform)(q);q.transform(z,W,J,re,0,0);const ee=this._createMaskCanvas(k);q.setTransform(1,0,0,1,ee.offsetX-Q[4],ee.offsetY-Q[5]);for(let Y=0,Z=K.length;Y<Z;Y+=2){const te=u.Util.transform(Q,[z,W,J,re,K[Y],K[Y+1]]),[ae,oe]=u.Util.applyTransform([0,0],te);q.drawImage(ee.canvas,ae,oe)}q.restore(),this.compose()}paintImageMaskXObjectGroup(k){if(!this.contentVisible)return;const z=this.ctx,W=this.current.fillColor,J=this.current.patternFill;for(const re of k){const{data:K,width:q,height:Q,transform:ee}=re,Y=this.cachedCanvases.getCanvas("maskCanvas",q,Q),Z=Y.context;Z.save();const te=this.getObject(K,re);I(Z,te),Z.globalCompositeOperation="source-in",Z.fillStyle=J?W.getPattern(Z,this,(0,d.getCurrentTransformInverse)(z),p.PathType.FILL):W,Z.fillRect(0,0,q,Q),Z.restore(),z.save(),z.transform(...ee),z.scale(1,-1),S(z,Y.canvas,0,0,q,Q,0,-1,1,1),z.restore()}this.compose()}paintImageXObject(k){if(!this.contentVisible)return;const z=this.getObject(k);if(!z){(0,u.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(z)}paintImageXObjectRepeat(k,z,W,J){if(!this.contentVisible)return;const re=this.getObject(k);if(!re){(0,u.warn)("Dependent image isn't ready yet");return}const K=re.width,q=re.height,Q=[];for(let ee=0,Y=J.length;ee<Y;ee+=2)Q.push({transform:[z,0,0,W,J[ee],J[ee+1]],x:0,y:0,w:K,h:q});this.paintInlineImageXObjectGroup(re,Q)}applyTransferMapsToCanvas(k){return this.current.transferMaps!=="none"&&(k.filter=this.current.transferMaps,k.drawImage(k.canvas,0,0),k.filter="none"),k.canvas}applyTransferMapsToBitmap(k){if(this.current.transferMaps==="none")return k.bitmap;const{bitmap:z,width:W,height:J}=k,re=this.cachedCanvases.getCanvas("inlineImage",W,J),K=re.context;return K.filter=this.current.transferMaps,K.drawImage(z,0,0),K.filter="none",re.canvas}paintInlineImageXObject(k){if(!this.contentVisible)return;const z=k.width,W=k.height,J=this.ctx;if(this.save(),!u.isNodeJS){const{filter:q}=J;q!=="none"&&q!==""&&(J.filter="none")}J.scale(1/z,-1/W);let re;if(k.bitmap)re=this.applyTransferMapsToBitmap(k);else if(typeof HTMLElement=="function"&&k instanceof HTMLElement||!k.data)re=k;else{const Q=this.cachedCanvases.getCanvas("inlineImage",z,W).context;_(Q,k),re=this.applyTransferMapsToCanvas(Q)}const K=this._scaleImage(re,(0,d.getCurrentTransformInverse)(J));J.imageSmoothingEnabled=V((0,d.getCurrentTransform)(J),k.interpolate),S(J,K.img,0,0,K.paintWidth,K.paintHeight,0,-W,z,W),this.compose(),this.restore()}paintInlineImageXObjectGroup(k,z){if(!this.contentVisible)return;const W=this.ctx;let J;if(k.bitmap)J=k.bitmap;else{const re=k.width,K=k.height,Q=this.cachedCanvases.getCanvas("inlineImage",re,K).context;_(Q,k),J=this.applyTransferMapsToCanvas(Q)}for(const re of z)W.save(),W.transform(...re.transform),W.scale(1,-1),S(W,J,re.x,re.y,re.w,re.h,0,-1,1,1),W.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(k){}markPointProps(k,z){}beginMarkedContent(k){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(k,z){k==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(z)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(k){const z=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(k);const W=this.ctx;this.pendingClip&&(z||(this.pendingClip===M?W.clip("evenodd"):W.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),W.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const k=(0,d.getCurrentTransform)(this.ctx);if(k[1]===0&&k[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(k[0]),Math.abs(k[3]));else{const z=Math.abs(k[0]*k[3]-k[2]*k[1]),W=Math.hypot(k[0],k[2]),J=Math.hypot(k[1],k[3]);this._cachedGetSinglePixelWidth=Math.max(W,J)/z}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:k}=this.current,{a:z,b:W,c:J,d:re}=this.ctx.getTransform();let K,q;if(W===0&&J===0){const Q=Math.abs(z),ee=Math.abs(re);if(Q===ee)if(k===0)K=q=1/Q;else{const Y=Q*k;K=q=Y<1?1/Y:1}else if(k===0)K=1/Q,q=1/ee;else{const Y=Q*k,Z=ee*k;K=Y<1?1/Y:1,q=Z<1?1/Z:1}}else{const Q=Math.abs(z*re-W*J),ee=Math.hypot(z,W),Y=Math.hypot(J,re);if(k===0)K=Y/Q,q=ee/Q;else{const Z=k*Q;K=Y>Z?Y/Z:1,q=ee>Z?ee/Z:1}}this._cachedScaleForStroking[0]=K,this._cachedScaleForStroking[1]=q}return this._cachedScaleForStroking}rescaleAndStroke(k){const{ctx:z}=this,{lineWidth:W}=this.current,[J,re]=this.getScaleForStroking();if(z.lineWidth=W||1,J===1&&re===1){z.stroke();return}const K=z.getLineDash();if(k&&z.save(),z.scale(J,re),K.length>0){const q=Math.max(J,re);z.setLineDash(K.map(Q=>Q/q)),z.lineDashOffset/=q}z.stroke(),k&&z.restore()}isContentVisible(){for(let k=this.markedContentStack.length-1;k>=0;k--)if(!this.markedContentStack[k].visible)return!1;return!0}}s.CanvasGraphics=N;for(const R in u.OPS)N.prototype[R]!==void 0&&(N.prototype[u.OPS[R]]=N.prototype[R])}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TilingPattern=s.PathType=void 0,s.getShadingPattern=m;var u=c(1),d=c(6);const p={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};s.PathType=p;function v(S,$){if(!$)return;const T=$[2]-$[0],_=$[3]-$[1],I=new Path2D;I.rect($[0],$[1],T,_),S.clip(I)}class A{constructor(){this.constructor===A&&(0,u.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,u.unreachable)("Abstract method `getPattern` called.")}}class x extends A{constructor($){super(),this._type=$[1],this._bbox=$[2],this._colorStops=$[3],this._p0=$[4],this._p1=$[5],this._r0=$[6],this._r1=$[7],this.matrix=null}_createGradient($){let T;this._type==="axial"?T=$.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(T=$.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const _ of this._colorStops)T.addColorStop(_[0],_[1]);return T}getPattern($,T,_,I){let C;if(I===p.STROKE||I===p.FILL){const P=T.current.getClippedPathBoundingBox(I,(0,d.getCurrentTransform)($))||[0,0,0,0],O=Math.ceil(P[2]-P[0])||1,L=Math.ceil(P[3]-P[1])||1,B=T.cachedCanvases.getCanvas("pattern",O,L,!0),F=B.context;F.clearRect(0,0,F.canvas.width,F.canvas.height),F.beginPath(),F.rect(0,0,F.canvas.width,F.canvas.height),F.translate(-P[0],-P[1]),_=u.Util.transform(_,[1,0,0,1,P[0],P[1]]),F.transform(...T.baseTransform),this.matrix&&F.transform(...this.matrix),v(F,this._bbox),F.fillStyle=this._createGradient(F),F.fill(),C=$.createPattern(B.canvas,"no-repeat");const D=new DOMMatrix(_);C.setTransform(D)}else v($,this._bbox),C=this._createGradient($);return C}}function g(S,$,T,_,I,C,P,O){const L=$.coords,B=$.colors,F=S.data,D=S.width*4;let V;L[T+1]>L[_+1]&&(V=T,T=_,_=V,V=C,C=P,P=V),L[_+1]>L[I+1]&&(V=_,_=I,I=V,V=P,P=O,O=V),L[T+1]>L[_+1]&&(V=T,T=_,_=V,V=C,C=P,P=V);const j=(L[T]+$.offsetX)*$.scaleX,G=(L[T+1]+$.offsetY)*$.scaleY,U=(L[_]+$.offsetX)*$.scaleX,M=(L[_+1]+$.offsetY)*$.scaleY,N=(L[I]+$.offsetX)*$.scaleX,R=(L[I+1]+$.offsetY)*$.scaleY;if(G>=R)return;const k=B[C],z=B[C+1],W=B[C+2],J=B[P],re=B[P+1],K=B[P+2],q=B[O],Q=B[O+1],ee=B[O+2],Y=Math.round(G),Z=Math.round(R);let te,ae,oe,se,fe,pe,ge,me;for(let be=Y;be<=Z;be++){if(be<M){const Ee=be<G?0:(G-be)/(G-M);te=j-(j-U)*Ee,ae=k-(k-J)*Ee,oe=z-(z-re)*Ee,se=W-(W-K)*Ee}else{let Ee;be>R?Ee=1:M===R?Ee=0:Ee=(M-be)/(M-R),te=U-(U-N)*Ee,ae=J-(J-q)*Ee,oe=re-(re-Q)*Ee,se=K-(K-ee)*Ee}let le;be<G?le=0:be>R?le=1:le=(G-be)/(G-R),fe=j-(j-N)*le,pe=k-(k-q)*le,ge=z-(z-Q)*le,me=W-(W-ee)*le;const ve=Math.round(Math.min(te,fe)),he=Math.round(Math.max(te,fe));let ye=D*be+ve*4;for(let Ee=ve;Ee<=he;Ee++)le=(te-Ee)/(te-fe),le<0?le=0:le>1&&(le=1),F[ye++]=ae-(ae-pe)*le|0,F[ye++]=oe-(oe-ge)*le|0,F[ye++]=se-(se-me)*le|0,F[ye++]=255}}function b(S,$,T){const _=$.coords,I=$.colors;let C,P;switch($.type){case"lattice":const O=$.verticesPerRow,L=Math.floor(_.length/O)-1,B=O-1;for(C=0;C<L;C++){let F=C*O;for(let D=0;D<B;D++,F++)g(S,T,_[F],_[F+1],_[F+O],I[F],I[F+1],I[F+O]),g(S,T,_[F+O+1],_[F+1],_[F+O],I[F+O+1],I[F+1],I[F+O])}break;case"triangles":for(C=0,P=_.length;C<P;C+=3)g(S,T,_[C],_[C+1],_[C+2],I[C],I[C+1],I[C+2]);break;default:throw new Error("illegal figure")}}class y extends A{constructor($){super(),this._coords=$[2],this._colors=$[3],this._figures=$[4],this._bounds=$[5],this._bbox=$[7],this._background=$[8],this.matrix=null}_createMeshCanvas($,T,_){const O=Math.floor(this._bounds[0]),L=Math.floor(this._bounds[1]),B=Math.ceil(this._bounds[2])-O,F=Math.ceil(this._bounds[3])-L,D=Math.min(Math.ceil(Math.abs(B*$[0]*1.1)),3e3),V=Math.min(Math.ceil(Math.abs(F*$[1]*1.1)),3e3),j=B/D,G=F/V,U={coords:this._coords,colors:this._colors,offsetX:-O,offsetY:-L,scaleX:1/j,scaleY:1/G},M=D+4,N=V+4,R=_.getCanvas("mesh",M,N,!1),k=R.context,z=k.createImageData(D,V);if(T){const J=z.data;for(let re=0,K=J.length;re<K;re+=4)J[re]=T[0],J[re+1]=T[1],J[re+2]=T[2],J[re+3]=255}for(const J of this._figures)b(z,J,U);return k.putImageData(z,2,2),{canvas:R.canvas,offsetX:O-2*j,offsetY:L-2*G,scaleX:j,scaleY:G}}getPattern($,T,_,I){v($,this._bbox);let C;if(I===p.SHADING)C=u.Util.singularValueDecompose2dScale((0,d.getCurrentTransform)($));else if(C=u.Util.singularValueDecompose2dScale(T.baseTransform),this.matrix){const O=u.Util.singularValueDecompose2dScale(this.matrix);C=[C[0]*O[0],C[1]*O[1]]}const P=this._createMeshCanvas(C,I===p.SHADING?null:this._background,T.cachedCanvases);return I!==p.SHADING&&($.setTransform(...T.baseTransform),this.matrix&&$.transform(...this.matrix)),$.translate(P.offsetX,P.offsetY),$.scale(P.scaleX,P.scaleY),$.createPattern(P.canvas,"no-repeat")}}class f extends A{getPattern(){return"hotpink"}}function m(S){switch(S[0]){case"RadialAxial":return new x(S);case"Mesh":return new y(S);case"Dummy":return new f}throw new Error(`Unknown IR type: ${S[0]}`)}const E={COLORED:1,UNCOLORED:2};class w{static MAX_PATTERN_SIZE=3e3;constructor($,T,_,I,C){this.operatorList=$[2],this.matrix=$[3]||[1,0,0,1,0,0],this.bbox=$[4],this.xstep=$[5],this.ystep=$[6],this.paintType=$[7],this.tilingType=$[8],this.color=T,this.ctx=_,this.canvasGraphicsFactory=I,this.baseTransform=C}createPatternCanvas($){const T=this.operatorList,_=this.bbox,I=this.xstep,C=this.ystep,P=this.paintType,O=this.tilingType,L=this.color,B=this.canvasGraphicsFactory;(0,u.info)("TilingType: "+O);const F=_[0],D=_[1],V=_[2],j=_[3],G=u.Util.singularValueDecompose2dScale(this.matrix),U=u.Util.singularValueDecompose2dScale(this.baseTransform),M=[G[0]*U[0],G[1]*U[1]],N=this.getSizeAndScale(I,this.ctx.canvas.width,M[0]),R=this.getSizeAndScale(C,this.ctx.canvas.height,M[1]),k=$.cachedCanvases.getCanvas("pattern",N.size,R.size,!0),z=k.context,W=B.createCanvasGraphics(z);W.groupLevel=$.groupLevel,this.setFillAndStrokeStyleToContext(W,P,L);let J=F,re=D,K=V,q=j;return F<0&&(J=0,K+=Math.abs(F)),D<0&&(re=0,q+=Math.abs(D)),z.translate(-(N.scale*J),-(R.scale*re)),W.transform(N.scale,0,0,R.scale,0,0),z.save(),this.clipBbox(W,J,re,K,q),W.baseTransform=(0,d.getCurrentTransform)(W.ctx),W.executeOperatorList(T),W.endDrawing(),{canvas:k.canvas,scaleX:N.scale,scaleY:R.scale,offsetX:J,offsetY:re}}getSizeAndScale($,T,_){$=Math.abs($);const I=Math.max(w.MAX_PATTERN_SIZE,T);let C=Math.ceil($*_);return C>=I?C=I:_=C/$,{scale:_,size:C}}clipBbox($,T,_,I,C){const P=I-T,O=C-_;$.ctx.rect(T,_,P,O),$.current.updateRectMinMax((0,d.getCurrentTransform)($.ctx),[T,_,I,C]),$.clip(),$.endPath()}setFillAndStrokeStyleToContext($,T,_){const I=$.ctx,C=$.current;switch(T){case E.COLORED:const P=this.ctx;I.fillStyle=P.fillStyle,I.strokeStyle=P.strokeStyle,C.fillColor=P.fillStyle,C.strokeColor=P.strokeStyle;break;case E.UNCOLORED:const O=u.Util.makeHexColor(_[0],_[1],_[2]);I.fillStyle=O,I.strokeStyle=O,C.fillColor=O,C.strokeColor=O;break;default:throw new u.FormatError(`Unsupported paint type: ${T}`)}}getPattern($,T,_,I){let C=_;I!==p.SHADING&&(C=u.Util.transform(C,T.baseTransform),this.matrix&&(C=u.Util.transform(C,this.matrix)));const P=this.createPatternCanvas(T);let O=new DOMMatrix(C);O=O.translate(P.offsetX,P.offsetY),O=O.scale(1/P.scaleX,1/P.scaleY);const L=$.createPattern(P.canvas,"repeat");return L.setTransform(O),L}}s.TilingPattern=w}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.convertBlackAndWhiteToRGBA=p,s.convertToRGBA=d,s.grayToRGBA=A;var u=c(1);function d(x){switch(x.kind){case u.ImageKind.GRAYSCALE_1BPP:return p(x);case u.ImageKind.RGB_24BPP:return v(x)}return null}function p({src:x,srcPos:g=0,dest:b,width:y,height:f,nonBlackColor:m=4294967295,inverseDecode:E=!1}){const w=u.FeatureTest.isLittleEndian?4278190080:255,[S,$]=E?[m,w]:[w,m],T=y>>3,_=y&7,I=x.length;b=new Uint32Array(b.buffer);let C=0;for(let P=0;P<f;P++){for(const L=g+T;g<L;g++){const B=g<I?x[g]:255;b[C++]=B&128?$:S,b[C++]=B&64?$:S,b[C++]=B&32?$:S,b[C++]=B&16?$:S,b[C++]=B&8?$:S,b[C++]=B&4?$:S,b[C++]=B&2?$:S,b[C++]=B&1?$:S}if(_===0)continue;const O=g<I?x[g++]:255;for(let L=0;L<_;L++)b[C++]=O&1<<7-L?$:S}return{srcPos:g,destPos:C}}function v({src:x,srcPos:g=0,dest:b,destPos:y=0,width:f,height:m}){let E=0;const w=x.length>>2,S=new Uint32Array(x.buffer,g,w);if(u.FeatureTest.isLittleEndian){for(;E<w-2;E+=3,y+=4){const $=S[E],T=S[E+1],_=S[E+2];b[y]=$|4278190080,b[y+1]=$>>>24|T<<8|4278190080,b[y+2]=T>>>16|_<<16|4278190080,b[y+3]=_>>>8|4278190080}for(let $=E*4,T=x.length;$<T;$+=3)b[y++]=x[$]|x[$+1]<<8|x[$+2]<<16|4278190080}else{for(;E<w-2;E+=3,y+=4){const $=S[E],T=S[E+1],_=S[E+2];b[y]=$|255,b[y+1]=$<<24|T>>>8|255,b[y+2]=T<<16|_>>>16|255,b[y+3]=_<<8|255}for(let $=E*4,T=x.length;$<T;$+=3)b[y++]=x[$]<<24|x[$+1]<<16|x[$+2]<<8|255}return{srcPos:g,destPos:y}}function A(x,g){if(u.FeatureTest.isLittleEndian)for(let b=0,y=x.length;b<y;b++)g[b]=x[b]*65793|4278190080;else for(let b=0,y=x.length;b<y;b++)g[b]=x[b]*16843008|255}}),((a,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.GlobalWorkerOptions=void 0;const c=Object.create(null);s.GlobalWorkerOptions=c,c.workerPort=null,c.workerSrc=""}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.MessageHandler=void 0;var u=c(1);const d={DATA:1,ERROR:2},p={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function v(x){switch(x instanceof Error||typeof x=="object"&&x!==null||(0,u.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),x.name){case"AbortException":return new u.AbortException(x.message);case"MissingPDFException":return new u.MissingPDFException(x.message);case"PasswordException":return new u.PasswordException(x.message,x.code);case"UnexpectedResponseException":return new u.UnexpectedResponseException(x.message,x.status);case"UnknownErrorException":return new u.UnknownErrorException(x.message,x.details);default:return new u.UnknownErrorException(x.message,x.toString())}}class A{constructor(g,b,y){this.sourceName=g,this.targetName=b,this.comObj=y,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),this._onComObjOnMessage=f=>{const m=f.data;if(m.targetName!==this.sourceName)return;if(m.stream){this.#t(m);return}if(m.callback){const w=m.callbackId,S=this.callbackCapabilities[w];if(!S)throw new Error(`Cannot resolve callback ${w}`);if(delete this.callbackCapabilities[w],m.callback===d.DATA)S.resolve(m.data);else if(m.callback===d.ERROR)S.reject(v(m.reason));else throw new Error("Unexpected callback case");return}const E=this.actionHandler[m.action];if(!E)throw new Error(`Unknown action from worker: ${m.action}`);if(m.callbackId){const w=this.sourceName,S=m.sourceName;new Promise(function($){$(E(m.data))}).then(function($){y.postMessage({sourceName:w,targetName:S,callback:d.DATA,callbackId:m.callbackId,data:$})},function($){y.postMessage({sourceName:w,targetName:S,callback:d.ERROR,callbackId:m.callbackId,reason:v($)})});return}if(m.streamId){this.#e(m);return}E(m.data)},y.addEventListener("message",this._onComObjOnMessage)}on(g,b){const y=this.actionHandler;if(y[g])throw new Error(`There is already an actionName called "${g}"`);y[g]=b}send(g,b,y){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:g,data:b},y)}sendWithPromise(g,b,y){const f=this.callbackId++,m=new u.PromiseCapability;this.callbackCapabilities[f]=m;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:g,callbackId:f,data:b},y)}catch(E){m.reject(E)}return m.promise}sendWithStream(g,b,y,f){const m=this.streamId++,E=this.sourceName,w=this.targetName,S=this.comObj;return new ReadableStream({start:$=>{const T=new u.PromiseCapability;return this.streamControllers[m]={controller:$,startCall:T,pullCall:null,cancelCall:null,isClosed:!1},S.postMessage({sourceName:E,targetName:w,action:g,streamId:m,data:b,desiredSize:$.desiredSize},f),T.promise},pull:$=>{const T=new u.PromiseCapability;return this.streamControllers[m].pullCall=T,S.postMessage({sourceName:E,targetName:w,stream:p.PULL,streamId:m,desiredSize:$.desiredSize}),T.promise},cancel:$=>{(0,u.assert)($ instanceof Error,"cancel must have a valid reason");const T=new u.PromiseCapability;return this.streamControllers[m].cancelCall=T,this.streamControllers[m].isClosed=!0,S.postMessage({sourceName:E,targetName:w,stream:p.CANCEL,streamId:m,reason:v($)}),T.promise}},y)}#e(g){const b=g.streamId,y=this.sourceName,f=g.sourceName,m=this.comObj,E=this,w=this.actionHandler[g.action],S={enqueue($,T=1,_){if(this.isCancelled)return;const I=this.desiredSize;this.desiredSize-=T,I>0&&this.desiredSize<=0&&(this.sinkCapability=new u.PromiseCapability,this.ready=this.sinkCapability.promise),m.postMessage({sourceName:y,targetName:f,stream:p.ENQUEUE,streamId:b,chunk:$},_)},close(){this.isCancelled||(this.isCancelled=!0,m.postMessage({sourceName:y,targetName:f,stream:p.CLOSE,streamId:b}),delete E.streamSinks[b])},error($){(0,u.assert)($ instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,m.postMessage({sourceName:y,targetName:f,stream:p.ERROR,streamId:b,reason:v($)}))},sinkCapability:new u.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:g.desiredSize,ready:null};S.sinkCapability.resolve(),S.ready=S.sinkCapability.promise,this.streamSinks[b]=S,new Promise(function($){$(w(g.data,S))}).then(function(){m.postMessage({sourceName:y,targetName:f,stream:p.START_COMPLETE,streamId:b,success:!0})},function($){m.postMessage({sourceName:y,targetName:f,stream:p.START_COMPLETE,streamId:b,reason:v($)})})}#t(g){const b=g.streamId,y=this.sourceName,f=g.sourceName,m=this.comObj,E=this.streamControllers[b],w=this.streamSinks[b];switch(g.stream){case p.START_COMPLETE:g.success?E.startCall.resolve():E.startCall.reject(v(g.reason));break;case p.PULL_COMPLETE:g.success?E.pullCall.resolve():E.pullCall.reject(v(g.reason));break;case p.PULL:if(!w){m.postMessage({sourceName:y,targetName:f,stream:p.PULL_COMPLETE,streamId:b,success:!0});break}w.desiredSize<=0&&g.desiredSize>0&&w.sinkCapability.resolve(),w.desiredSize=g.desiredSize,new Promise(function(S){S(w.onPull?.())}).then(function(){m.postMessage({sourceName:y,targetName:f,stream:p.PULL_COMPLETE,streamId:b,success:!0})},function(S){m.postMessage({sourceName:y,targetName:f,stream:p.PULL_COMPLETE,streamId:b,reason:v(S)})});break;case p.ENQUEUE:if((0,u.assert)(E,"enqueue should have stream controller"),E.isClosed)break;E.controller.enqueue(g.chunk);break;case p.CLOSE:if((0,u.assert)(E,"close should have stream controller"),E.isClosed)break;E.isClosed=!0,E.controller.close(),this.#r(E,b);break;case p.ERROR:(0,u.assert)(E,"error should have stream controller"),E.controller.error(v(g.reason)),this.#r(E,b);break;case p.CANCEL_COMPLETE:g.success?E.cancelCall.resolve():E.cancelCall.reject(v(g.reason)),this.#r(E,b);break;case p.CANCEL:if(!w)break;new Promise(function(S){S(w.onCancel?.(v(g.reason)))}).then(function(){m.postMessage({sourceName:y,targetName:f,stream:p.CANCEL_COMPLETE,streamId:b,success:!0})},function(S){m.postMessage({sourceName:y,targetName:f,stream:p.CANCEL_COMPLETE,streamId:b,reason:v(S)})}),w.sinkCapability.reject(v(g.reason)),w.isCancelled=!0,delete this.streamSinks[b];break;default:throw new Error("Unexpected stream case")}}async#r(g,b){await Promise.allSettled([g.startCall?.promise,g.pullCall?.promise,g.cancelCall?.promise]),delete this.streamControllers[b]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}s.MessageHandler=A}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.Metadata=void 0;var u=c(1);class d{#e;#t;constructor({parsedData:v,rawData:A}){this.#e=v,this.#t=A}getRaw(){return this.#t}get(v){return this.#e.get(v)??null}getAll(){return(0,u.objectFromMap)(this.#e)}has(v){return this.#e.has(v)}}s.Metadata=d}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.OptionalContentConfig=void 0;var u=c(1),d=c(8);const p=Symbol("INTERNAL");class v{#e=!0;constructor(g,b){this.name=g,this.intent=b}get visible(){return this.#e}_setVisible(g,b){g!==p&&(0,u.unreachable)("Internal method `_setVisible` called."),this.#e=b}}class A{#e=null;#t=new Map;#r=null;#n=null;constructor(g){if(this.name=null,this.creator=null,g!==null){this.name=g.name,this.creator=g.creator,this.#n=g.order;for(const b of g.groups)this.#t.set(b.id,new v(b.name,b.intent));if(g.baseState==="OFF")for(const b of this.#t.values())b._setVisible(p,!1);for(const b of g.on)this.#t.get(b)._setVisible(p,!0);for(const b of g.off)this.#t.get(b)._setVisible(p,!1);this.#r=this.getHash()}}#s(g){const b=g.length;if(b<2)return!0;const y=g[0];for(let f=1;f<b;f++){const m=g[f];let E;if(Array.isArray(m))E=this.#s(m);else if(this.#t.has(m))E=this.#t.get(m).visible;else return(0,u.warn)(`Optional content group not found: ${m}`),!0;switch(y){case"And":if(!E)return!1;break;case"Or":if(E)return!0;break;case"Not":return!E;default:return!0}}return y==="And"}isVisible(g){if(this.#t.size===0)return!0;if(!g)return(0,u.warn)("Optional content group not defined."),!0;if(g.type==="OCG")return this.#t.has(g.id)?this.#t.get(g.id).visible:((0,u.warn)(`Optional content group not found: ${g.id}`),!0);if(g.type==="OCMD"){if(g.expression)return this.#s(g.expression);if(!g.policy||g.policy==="AnyOn"){for(const b of g.ids){if(!this.#t.has(b))return(0,u.warn)(`Optional content group not found: ${b}`),!0;if(this.#t.get(b).visible)return!0}return!1}else if(g.policy==="AllOn"){for(const b of g.ids){if(!this.#t.has(b))return(0,u.warn)(`Optional content group not found: ${b}`),!0;if(!this.#t.get(b).visible)return!1}return!0}else if(g.policy==="AnyOff"){for(const b of g.ids){if(!this.#t.has(b))return(0,u.warn)(`Optional content group not found: ${b}`),!0;if(!this.#t.get(b).visible)return!0}return!1}else if(g.policy==="AllOff"){for(const b of g.ids){if(!this.#t.has(b))return(0,u.warn)(`Optional content group not found: ${b}`),!0;if(this.#t.get(b).visible)return!1}return!0}return(0,u.warn)(`Unknown optional content policy ${g.policy}.`),!0}return(0,u.warn)(`Unknown group type ${g.type}.`),!0}setVisibility(g,b=!0){if(!this.#t.has(g)){(0,u.warn)(`Optional content group not found: ${g}`);return}this.#t.get(g)._setVisible(p,!!b),this.#e=null}get hasInitialVisibility(){return this.#r===null||this.getHash()===this.#r}getOrder(){return this.#t.size?this.#n?this.#n.slice():[...this.#t.keys()]:null}getGroups(){return this.#t.size>0?(0,u.objectFromMap)(this.#t):null}getGroup(g){return this.#t.get(g)||null}getHash(){if(this.#e!==null)return this.#e;const g=new d.MurmurHash3_64;for(const[b,y]of this.#t)g.update(`${b}:${y.visible}`);return this.#e=g.hexdigest()}}s.OptionalContentConfig=A}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PDFDataTransportStream=void 0;var u=c(1),d=c(6);class p{constructor({length:g,initialData:b,progressiveDone:y=!1,contentDispositionFilename:f=null,disableRange:m=!1,disableStream:E=!1},w){if((0,u.assert)(w,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=y,this._contentDispositionFilename=f,b?.length>0){const S=b instanceof Uint8Array&&b.byteLength===b.buffer.byteLength?b.buffer:new Uint8Array(b).buffer;this._queuedChunks.push(S)}this._pdfDataRangeTransport=w,this._isStreamingSupported=!E,this._isRangeSupported=!m,this._contentLength=g,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((S,$)=>{this._onReceiveData({begin:S,chunk:$})}),this._pdfDataRangeTransport.addProgressListener((S,$)=>{this._onProgress({loaded:S,total:$})}),this._pdfDataRangeTransport.addProgressiveReadListener(S=>{this._onReceiveData({chunk:S})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:g,chunk:b}){const y=b instanceof Uint8Array&&b.byteLength===b.buffer.byteLength?b.buffer:new Uint8Array(b).buffer;if(g===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(y):this._queuedChunks.push(y);else{const f=this._rangeReaders.some(function(m){return m._begin!==g?!1:(m._enqueue(y),!0)});(0,u.assert)(f,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(g){g.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:g.loaded}):this._fullRequestReader?.onProgress?.({loaded:g.loaded,total:g.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(g){const b=this._rangeReaders.indexOf(g);b>=0&&this._rangeReaders.splice(b,1)}getFullReader(){(0,u.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const g=this._queuedChunks;return this._queuedChunks=null,new v(this,g,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(g,b){if(b<=this._progressiveDataLength)return null;const y=new A(this,g,b);return this._pdfDataRangeTransport.requestDataRange(g,b),this._rangeReaders.push(y),y}cancelAllRequests(g){this._fullRequestReader?.cancel(g);for(const b of this._rangeReaders.slice(0))b.cancel(g);this._pdfDataRangeTransport.abort()}}s.PDFDataTransportStream=p;class v{constructor(g,b,y=!1,f=null){this._stream=g,this._done=y||!1,this._filename=(0,d.isPdfFile)(f)?f:null,this._queuedChunks=b||[],this._loaded=0;for(const m of this._queuedChunks)this._loaded+=m.byteLength;this._requests=[],this._headersReady=Promise.resolve(),g._fullRequestReader=this,this.onProgress=null}_enqueue(g){this._done||(this._requests.length>0?this._requests.shift().resolve({value:g,done:!1}):this._queuedChunks.push(g),this._loaded+=g.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const g=new u.PromiseCapability;return this._requests.push(g),g.promise}cancel(g){this._done=!0;for(const b of this._requests)b.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class A{constructor(g,b,y){this._stream=g,this._begin=b,this._end=y,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(g){if(!this._done){if(this._requests.length===0)this._queuedChunk=g;else{this._requests.shift().resolve({value:g,done:!1});for(const y of this._requests)y.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const b=this._queuedChunk;return this._queuedChunk=null,{value:b,done:!1}}if(this._done)return{value:void 0,done:!0};const g=new u.PromiseCapability;return this._requests.push(g),g.promise}cancel(g){this._done=!0;for(const b of this._requests)b.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PDFFetchStream=void 0;var u=c(1),d=c(20);function p(y,f,m){return{method:"GET",headers:y,signal:m.signal,mode:"cors",credentials:f?"include":"same-origin",redirect:"follow"}}function v(y){const f=new Headers;for(const m in y){const E=y[m];E!==void 0&&f.append(m,E)}return f}function A(y){return y instanceof Uint8Array?y.buffer:y instanceof ArrayBuffer?y:((0,u.warn)(`getArrayBuffer - unexpected data format: ${y}`),new Uint8Array(y).buffer)}class x{constructor(f){this.source=f,this.isHttp=/^https?:/i.test(f.url),this.httpHeaders=this.isHttp&&f.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,u.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new g(this),this._fullRequestReader}getRangeReader(f,m){if(m<=this._progressiveDataLength)return null;const E=new b(this,f,m);return this._rangeRequestReaders.push(E),E}cancelAllRequests(f){this._fullRequestReader?.cancel(f);for(const m of this._rangeRequestReaders.slice(0))m.cancel(f)}}s.PDFFetchStream=x;class g{constructor(f){this._stream=f,this._reader=null,this._loaded=0,this._filename=null;const m=f.source;this._withCredentials=m.withCredentials||!1,this._contentLength=m.length,this._headersCapability=new u.PromiseCapability,this._disableRange=m.disableRange||!1,this._rangeChunkSize=m.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!m.disableStream,this._isRangeSupported=!m.disableRange,this._headers=v(this._stream.httpHeaders);const E=m.url;fetch(E,p(this._headers,this._withCredentials,this._abortController)).then(w=>{if(!(0,d.validateResponseStatus)(w.status))throw(0,d.createResponseStatusError)(w.status,E);this._reader=w.body.getReader(),this._headersCapability.resolve();const S=_=>w.headers.get(_),{allowRangeRequests:$,suggestedLength:T}=(0,d.validateRangeRequestCapabilities)({getResponseHeader:S,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=$,this._contentLength=T||this._contentLength,this._filename=(0,d.extractFilenameFromHeader)(S),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new u.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}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(){await this._headersCapability.promise;const{value:f,done:m}=await this._reader.read();return m?{value:f,done:m}:(this._loaded+=f.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:A(f),done:!1})}cancel(f){this._reader?.cancel(f),this._abortController.abort()}}class b{constructor(f,m,E){this._stream=f,this._reader=null,this._loaded=0;const w=f.source;this._withCredentials=w.withCredentials||!1,this._readCapability=new u.PromiseCapability,this._isStreamingSupported=!w.disableStream,this._abortController=new AbortController,this._headers=v(this._stream.httpHeaders),this._headers.append("Range",`bytes=${m}-${E-1}`);const S=w.url;fetch(S,p(this._headers,this._withCredentials,this._abortController)).then($=>{if(!(0,d.validateResponseStatus)($.status))throw(0,d.createResponseStatusError)($.status,S);this._readCapability.resolve(),this._reader=$.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:f,done:m}=await this._reader.read();return m?{value:f,done:m}:(this._loaded+=f.byteLength,this.onProgress?.({loaded:this._loaded}),{value:A(f),done:!1})}cancel(f){this._reader?.cancel(f),this._abortController.abort()}}}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.createResponseStatusError=x,s.extractFilenameFromHeader=A,s.validateRangeRequestCapabilities=v,s.validateResponseStatus=g;var u=c(1),d=c(21),p=c(6);function v({getResponseHeader:b,isHttp:y,rangeChunkSize:f,disableRange:m}){const E={allowRangeRequests:!1,suggestedLength:void 0},w=parseInt(b("Content-Length"),10);return!Number.isInteger(w)||(E.suggestedLength=w,w<=2*f)||m||!y||b("Accept-Ranges")!=="bytes"||(b("Content-Encoding")||"identity")!=="identity"||(E.allowRangeRequests=!0),E}function A(b){const y=b("Content-Disposition");if(y){let f=(0,d.getFilenameFromContentDispositionHeader)(y);if(f.includes("%"))try{f=decodeURIComponent(f)}catch{}if((0,p.isPdfFile)(f))return f}return null}function x(b,y){return b===404||b===0&&y.startsWith("file:")?new u.MissingPDFException('Missing PDF "'+y+'".'):new u.UnexpectedResponseException(`Unexpected server response (${b}) while retrieving PDF "${y}".`,b)}function g(b){return b===200||b===206}}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.getFilenameFromContentDispositionHeader=d;var u=c(1);function d(p){let v=!0,A=x("filename\\*","i").exec(p);if(A){A=A[1];let w=f(A);return w=unescape(w),w=m(w),w=E(w),b(w)}if(A=y(p),A){const w=E(A);return b(w)}if(A=x("filename","i").exec(p),A){A=A[1];let w=f(A);return w=E(w),b(w)}function x(w,S){return new RegExp("(?:^|;)\\s*"+w+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',S)}function g(w,S){if(w){if(!/^[\x00-\xFF]+$/.test(S))return S;try{const $=new TextDecoder(w,{fatal:!0}),T=(0,u.stringToBytes)(S);S=$.decode(T),v=!1}catch{}}return S}function b(w){return v&&/[\x80-\xff]/.test(w)&&(w=g("utf-8",w),v&&(w=g("iso-8859-1",w))),w}function y(w){const S=[];let $;const T=x("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;($=T.exec(w))!==null;){let[,I,C,P]=$;if(I=parseInt(I,10),I in S){if(I===0)break;continue}S[I]=[C,P]}const _=[];for(let I=0;I<S.length&&I in S;++I){let[C,P]=S[I];P=f(P),C&&(P=unescape(P),I===0&&(P=m(P))),_.push(P)}return _.join("")}function f(w){if(w.startsWith('"')){const S=w.slice(1).split('\\"');for(let $=0;$<S.length;++$){const T=S[$].indexOf('"');T!==-1&&(S[$]=S[$].slice(0,T),S.length=$+1),S[$]=S[$].replaceAll(/\\(.)/g,"$1")}w=S.join('"')}return w}function m(w){const S=w.indexOf("'");if(S===-1)return w;const $=w.slice(0,S),_=w.slice(S+1).replace(/^[^']*'/,"");return g($,_)}function E(w){return!w.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(w)?w:w.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(S,$,T,_){if(T==="q"||T==="Q")return _=_.replaceAll("_"," "),_=_.replaceAll(/=([0-9a-fA-F]{2})/g,function(I,C){return String.fromCharCode(parseInt(C,16))}),g($,_);try{_=atob(_)}catch{}return g($,_)})}return""}}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PDFNetworkStream=void 0;var u=c(1),d=c(20);const p=200,v=206;function A(f){const m=f.response;return typeof m!="string"?m:(0,u.stringToBytes)(m).buffer}class x{constructor(m,E={}){this.url=m,this.isHttp=/^https?:/i.test(m),this.httpHeaders=this.isHttp&&E.httpHeaders||Object.create(null),this.withCredentials=E.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(m,E,w){const S={begin:m,end:E};for(const $ in w)S[$]=w[$];return this.request(S)}requestFull(m){return this.request(m)}request(m){const E=new XMLHttpRequest,w=this.currXhrId++,S=this.pendingRequests[w]={xhr:E};E.open("GET",this.url),E.withCredentials=this.withCredentials;for(const $ in this.httpHeaders){const T=this.httpHeaders[$];T!==void 0&&E.setRequestHeader($,T)}return this.isHttp&&"begin"in m&&"end"in m?(E.setRequestHeader("Range",`bytes=${m.begin}-${m.end-1}`),S.expectedStatus=v):S.expectedStatus=p,E.responseType="arraybuffer",m.onError&&(E.onerror=function($){m.onError(E.status)}),E.onreadystatechange=this.onStateChange.bind(this,w),E.onprogress=this.onProgress.bind(this,w),S.onHeadersReceived=m.onHeadersReceived,S.onDone=m.onDone,S.onError=m.onError,S.onProgress=m.onProgress,E.send(null),w}onProgress(m,E){const w=this.pendingRequests[m];w&&w.onProgress?.(E)}onStateChange(m,E){const w=this.pendingRequests[m];if(!w)return;const S=w.xhr;if(S.readyState>=2&&w.onHeadersReceived&&(w.onHeadersReceived(),delete w.onHeadersReceived),S.readyState!==4||!(m in this.pendingRequests))return;if(delete this.pendingRequests[m],S.status===0&&this.isHttp){w.onError?.(S.status);return}const $=S.status||p;if(!($===p&&w.expectedStatus===v)&&$!==w.expectedStatus){w.onError?.(S.status);return}const _=A(S);if($===v){const I=S.getResponseHeader("Content-Range"),C=/bytes (\d+)-(\d+)\/(\d+)/.exec(I);w.onDone({begin:parseInt(C[1],10),chunk:_})}else _?w.onDone({begin:0,chunk:_}):w.onError?.(S.status)}getRequestXhr(m){return this.pendingRequests[m].xhr}isPendingRequest(m){return m in this.pendingRequests}abortRequest(m){const E=this.pendingRequests[m].xhr;delete this.pendingRequests[m],E.abort()}}class g{constructor(m){this._source=m,this._manager=new x(m.url,{httpHeaders:m.httpHeaders,withCredentials:m.withCredentials}),this._rangeChunkSize=m.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(m){const E=this._rangeRequestReaders.indexOf(m);E>=0&&this._rangeRequestReaders.splice(E,1)}getFullReader(){return(0,u.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new b(this._manager,this._source),this._fullRequestReader}getRangeReader(m,E){const w=new y(this._manager,m,E);return w.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(w),w}cancelAllRequests(m){this._fullRequestReader?.cancel(m);for(const E of this._rangeRequestReaders.slice(0))E.cancel(m)}}s.PDFNetworkStream=g;class b{constructor(m,E){this._manager=m;const w={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=E.url,this._fullRequestId=m.requestFull(w),this._headersReceivedCapability=new u.PromiseCapability,this._disableRange=E.disableRange||!1,this._contentLength=E.length,this._rangeChunkSize=E.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const m=this._fullRequestId,E=this._manager.getRequestXhr(m),w=T=>E.getResponseHeader(T),{allowRangeRequests:S,suggestedLength:$}=(0,d.validateRangeRequestCapabilities)({getResponseHeader:w,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});S&&(this._isRangeSupported=!0),this._contentLength=$||this._contentLength,this._filename=(0,d.extractFilenameFromHeader)(w),this._isRangeSupported&&this._manager.abortRequest(m),this._headersReceivedCapability.resolve()}_onDone(m){if(m&&(this._requests.length>0?this._requests.shift().resolve({value:m.chunk,done:!1}):this._cachedChunks.push(m.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const E of this._requests)E.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(m){this._storedError=(0,d.createResponseStatusError)(m,this._url),this._headersReceivedCapability.reject(this._storedError);for(const E of this._requests)E.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(m){this.onProgress?.({loaded:m.loaded,total:m.lengthComputable?m.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(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};const m=new u.PromiseCapability;return this._requests.push(m),m.promise}cancel(m){this._done=!0,this._headersReceivedCapability.reject(m);for(const E of this._requests)E.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class y{constructor(m,E,w){this._manager=m;const S={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=m.url,this._requestId=m.requestRange(E,w,S),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(m){const E=m.chunk;this._requests.length>0?this._requests.shift().resolve({value:E,done:!1}):this._queuedChunk=E,this._done=!0;for(const w of this._requests)w.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(m){this._storedError=(0,d.createResponseStatusError)(m,this._url);for(const E of this._requests)E.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(m){this.isStreamingSupported||this.onProgress?.({loaded:m.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const E=this._queuedChunk;return this._queuedChunk=null,{value:E,done:!1}}if(this._done)return{value:void 0,done:!0};const m=new u.PromiseCapability;return this._requests.push(m),m.promise}cancel(m){this._done=!0;for(const E of this._requests)E.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.PDFNodeStream=void 0;var u=c(1),d=c(20);const p=/^file:\/\/\/[a-zA-Z]:\//;function v(w){const S=require$$5,$=S.parse(w);return $.protocol==="file:"||$.host?$:/^[a-z]:[/\\]/i.test(w)?S.parse(`file:///${w}`):($.host||($.protocol="file:"),$)}class A{constructor(S){this.source=S,this.url=v(S.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&S.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,u.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new m(this):new y(this),this._fullRequestReader}getRangeReader(S,$){if($<=this._progressiveDataLength)return null;const T=this.isFsUrl?new E(this,S,$):new f(this,S,$);return this._rangeRequestReaders.push(T),T}cancelAllRequests(S){this._fullRequestReader?.cancel(S);for(const $ of this._rangeRequestReaders.slice(0))$.cancel(S)}}s.PDFNodeStream=A;class x{constructor(S){this._url=S.url,this._done=!1,this._storedError=null,this.onProgress=null;const $=S.source;this._contentLength=$.length,this._loaded=0,this._filename=null,this._disableRange=$.disableRange||!1,this._rangeChunkSize=$.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!$.disableStream,this._isRangeSupported=!$.disableRange,this._readableStream=null,this._readCapability=new u.PromiseCapability,this._headersCapability=new u.PromiseCapability}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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const S=this._readableStream.read();return S===null?(this._readCapability=new u.PromiseCapability,this.read()):(this._loaded+=S.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(S).buffer,done:!1})}cancel(S){if(!this._readableStream){this._error(S);return}this._readableStream.destroy(S)}_error(S){this._storedError=S,this._readCapability.resolve()}_setReadableStream(S){this._readableStream=S,S.on("readable",()=>{this._readCapability.resolve()}),S.on("end",()=>{S.destroy(),this._done=!0,this._readCapability.resolve()}),S.on("error",$=>{this._error($)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new u.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class g{constructor(S){this._url=S.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=new u.PromiseCapability;const $=S.source;this._isStreamingSupported=!$.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const S=this._readableStream.read();return S===null?(this._readCapability=new u.PromiseCapability,this.read()):(this._loaded+=S.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(S).buffer,done:!1})}cancel(S){if(!this._readableStream){this._error(S);return}this._readableStream.destroy(S)}_error(S){this._storedError=S,this._readCapability.resolve()}_setReadableStream(S){this._readableStream=S,S.on("readable",()=>{this._readCapability.resolve()}),S.on("end",()=>{S.destroy(),this._done=!0,this._readCapability.resolve()}),S.on("error",$=>{this._error($)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function b(w,S){return{protocol:w.protocol,auth:w.auth,host:w.hostname,port:w.port,path:w.path,method:"GET",headers:S}}class y extends x{constructor(S){super(S);const $=T=>{if(T.statusCode===404){const P=new u.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=P,this._headersCapability.reject(P);return}this._headersCapability.resolve(),this._setReadableStream(T);const _=P=>this._readableStream.headers[P.toLowerCase()],{allowRangeRequests:I,suggestedLength:C}=(0,d.validateRangeRequestCapabilities)({getResponseHeader:_,isHttp:S.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=I,this._contentLength=C||this._contentLength,this._filename=(0,d.extractFilenameFromHeader)(_)};if(this._request=null,this._url.protocol==="http:"){const T=require$$5;this._request=T.request(b(this._url,S.httpHeaders),$)}else{const T=require$$5;this._request=T.request(b(this._url,S.httpHeaders),$)}this._request.on("error",T=>{this._storedError=T,this._headersCapability.reject(T)}),this._request.end()}}class f extends g{constructor(S,$,T){super(S),this._httpHeaders={};for(const I in S.httpHeaders){const C=S.httpHeaders[I];C!==void 0&&(this._httpHeaders[I]=C)}this._httpHeaders.Range=`bytes=${$}-${T-1}`;const _=I=>{if(I.statusCode===404){const C=new u.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=C;return}this._setReadableStream(I)};if(this._request=null,this._url.protocol==="http:"){const I=require$$5;this._request=I.request(b(this._url,this._httpHeaders),_)}else{const I=require$$5;this._request=I.request(b(this._url,this._httpHeaders),_)}this._request.on("error",I=>{this._storedError=I}),this._request.end()}}class m extends x{constructor(S){super(S);let $=decodeURIComponent(this._url.path);p.test(this._url.href)&&($=$.replace(/^\//,""));const T=require$$5;T.lstat($,(_,I)=>{if(_){_.code==="ENOENT"&&(_=new u.MissingPDFException(`Missing PDF "${$}".`)),this._storedError=_,this._headersCapability.reject(_);return}this._contentLength=I.size,this._setReadableStream(T.createReadStream($)),this._headersCapability.resolve()})}}class E extends g{constructor(S,$,T){super(S);let _=decodeURIComponent(this._url.path);p.test(this._url.href)&&(_=_.replace(/^\//,""));const I=require$$5;this._setReadableStream(I.createReadStream(_,{start:$,end:T-1}))}}}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.SVGGraphics=void 0;var u=c(6),d=c(1);const p={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},v="http://www.w3.org/XML/1998/namespace",A="http://www.w3.org/1999/xlink",x=["butt","round","square"],g=["miter","round","bevel"],b=function(I,C="",P=!1){if(URL.createObjectURL&&typeof Blob<"u"&&!P)return URL.createObjectURL(new Blob([I],{type:C}));const O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let L=`data:${C};base64,`;for(let B=0,F=I.length;B<F;B+=3){const D=I[B]&255,V=I[B+1]&255,j=I[B+2]&255,G=D>>2,U=(D&3)<<4|V>>4,M=B+1<F?(V&15)<<2|j>>6:64,N=B+2<F?j&63:64;L+=O[G]+O[U]+O[M]+O[N]}return L},y=(function(){const I=new Uint8Array([137,80,78,71,13,10,26,10]),C=12,P=new Int32Array(256);for(let j=0;j<256;j++){let G=j;for(let U=0;U<8;U++)G=G&1?3988292384^G>>1&2147483647:G>>1&2147483647;P[j]=G}function O(j,G,U){let M=-1;for(let N=G;N<U;N++){const R=(M^j[N])&255,k=P[R];M=M>>>8^k}return M^-1}function L(j,G,U,M){let N=M;const R=G.length;U[N]=R>>24&255,U[N+1]=R>>16&255,U[N+2]=R>>8&255,U[N+3]=R&255,N+=4,U[N]=j.charCodeAt(0)&255,U[N+1]=j.charCodeAt(1)&255,U[N+2]=j.charCodeAt(2)&255,U[N+3]=j.charCodeAt(3)&255,N+=4,U.set(G,N),N+=G.length;const k=O(U,M+4,N);U[N]=k>>24&255,U[N+1]=k>>16&255,U[N+2]=k>>8&255,U[N+3]=k&255}function B(j,G,U){let M=1,N=0;for(let R=G;R<U;++R)M=(M+(j[R]&255))%65521,N=(N+M)%65521;return N<<16|M}function F(j){if(!d.isNodeJS)return D(j);try{const G=parseInt(process.versions.node)>=8?j:Buffer.from(j),U=require$$5.deflateSync(G,{level:9});return U instanceof Uint8Array?U:new Uint8Array(U)}catch(G){(0,d.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+G)}return D(j)}function D(j){let G=j.length;const U=65535,M=Math.ceil(G/U),N=new Uint8Array(2+G+M*5+4);let R=0;N[R++]=120,N[R++]=156;let k=0;for(;G>U;)N[R++]=0,N[R++]=255,N[R++]=255,N[R++]=0,N[R++]=0,N.set(j.subarray(k,k+U),R),R+=U,k+=U,G-=U;N[R++]=1,N[R++]=G&255,N[R++]=G>>8&255,N[R++]=~G&65535&255,N[R++]=(~G&65535)>>8&255,N.set(j.subarray(k),R),R+=j.length-k;const z=B(j,0,j.length);return N[R++]=z>>24&255,N[R++]=z>>16&255,N[R++]=z>>8&255,N[R++]=z&255,N}function V(j,G,U,M){const N=j.width,R=j.height;let k,z,W;const J=j.data;switch(G){case d.ImageKind.GRAYSCALE_1BPP:z=0,k=1,W=N+7>>3;break;case d.ImageKind.RGB_24BPP:z=2,k=8,W=N*3;break;case d.ImageKind.RGBA_32BPP:z=6,k=8,W=N*4;break;default:throw new Error("invalid format")}const re=new Uint8Array((1+W)*R);let K=0,q=0;for(let ae=0;ae<R;++ae)re[K++]=0,re.set(J.subarray(q,q+W),K),q+=W,K+=W;if(G===d.ImageKind.GRAYSCALE_1BPP&&M){K=0;for(let ae=0;ae<R;ae++){K++;for(let oe=0;oe<W;oe++)re[K++]^=255}}const Q=new Uint8Array([N>>24&255,N>>16&255,N>>8&255,N&255,R>>24&255,R>>16&255,R>>8&255,R&255,k,z,0,0,0]),ee=F(re),Y=I.length+C*3+Q.length+ee.length,Z=new Uint8Array(Y);let te=0;return Z.set(I,te),te+=I.length,L("IHDR",Q,Z,te),te+=C+Q.length,L("IDATA",ee,Z,te),te+=C+ee.length,L("IEND",new Uint8Array(0),Z,te),b(Z,"image/png",U)}return function(G,U,M){const N=G.kind===void 0?d.ImageKind.GRAYSCALE_1BPP:G.kind;return V(G,N,U,M)}})();class f{constructor(){this.fontSizeScale=1,this.fontWeight=p.fontWeight,this.fontSize=0,this.textMatrix=d.IDENTITY_MATRIX,this.fontMatrix=d.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=d.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=p.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(C,P){this.x=C,this.y=P}}function m(I){let C=[];const P=[];for(const O of I){if(O.fn==="save"){C.push({fnId:92,fn:"group",items:[]}),P.push(C),C=C.at(-1).items;continue}O.fn==="restore"?C=P.pop():C.push(O)}return C}function E(I){if(Number.isInteger(I))return I.toString();const C=I.toFixed(10);let P=C.length-1;if(C[P]!=="0")return C;do P--;while(C[P]==="0");return C.substring(0,C[P]==="."?P:P+1)}function w(I){if(I[4]===0&&I[5]===0){if(I[1]===0&&I[2]===0)return I[0]===1&&I[3]===1?"":`scale(${E(I[0])} ${E(I[3])})`;if(I[0]===I[3]&&I[1]===-I[2]){const C=Math.acos(I[0])*180/Math.PI;return`rotate(${E(C)})`}}else if(I[0]===1&&I[1]===0&&I[2]===0&&I[3]===1)return`translate(${E(I[4])} ${E(I[5])})`;return`matrix(${E(I[0])} ${E(I[1])} ${E(I[2])} ${E(I[3])} ${E(I[4])} ${E(I[5])})`}let S=0,$=0,T=0;class _{constructor(C,P,O=!1){(0,u.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new u.DOMSVGFactory,this.current=new f,this.transformMatrix=d.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=C,this.objs=P,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!O,this._operatorIdMapping=[];for(const L in d.OPS)this._operatorIdMapping[d.OPS[L]]=L}getObject(C,P=null){return typeof C=="string"?C.startsWith("g_")?this.commonObjs.get(C):this.objs.get(C):P}save(){this.transformStack.push(this.transformMatrix);const C=this.current;this.extraStack.push(C),this.current=C.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(C){this.save(),this.executeOpTree(C),this.restore()}loadDependencies(C){const P=C.fnArray,O=C.argsArray;for(let L=0,B=P.length;L<B;L++)if(P[L]===d.OPS.dependency)for(const F of O[L]){const D=F.startsWith("g_")?this.commonObjs:this.objs,V=new Promise(j=>{D.get(F,j)});this.current.dependencies.push(V)}return Promise.all(this.current.dependencies)}transform(C,P,O,L,B,F){const D=[C,P,O,L,B,F];this.transformMatrix=d.Util.transform(this.transformMatrix,D),this.tgrp=null}getSVG(C,P){this.viewport=P;const O=this._initialize(P);return this.loadDependencies(C).then(()=>(this.transformMatrix=d.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(C)),O))}convertOpList(C){const P=this._operatorIdMapping,O=C.argsArray,L=C.fnArray,B=[];for(let F=0,D=L.length;F<D;F++){const V=L[F];B.push({fnId:V,fn:P[V],args:O[F]})}return m(B)}executeOpTree(C){for(const P of C){const O=P.fn,L=P.fnId,B=P.args;switch(L|0){case d.OPS.beginText:this.beginText();break;case d.OPS.dependency:break;case d.OPS.setLeading:this.setLeading(B);break;case d.OPS.setLeadingMoveText:this.setLeadingMoveText(B[0],B[1]);break;case d.OPS.setFont:this.setFont(B);break;case d.OPS.showText:this.showText(B[0]);break;case d.OPS.showSpacedText:this.showText(B[0]);break;case d.OPS.endText:this.endText();break;case d.OPS.moveText:this.moveText(B[0],B[1]);break;case d.OPS.setCharSpacing:this.setCharSpacing(B[0]);break;case d.OPS.setWordSpacing:this.setWordSpacing(B[0]);break;case d.OPS.setHScale:this.setHScale(B[0]);break;case d.OPS.setTextMatrix:this.setTextMatrix(B[0],B[1],B[2],B[3],B[4],B[5]);break;case d.OPS.setTextRise:this.setTextRise(B[0]);break;case d.OPS.setTextRenderingMode:this.setTextRenderingMode(B[0]);break;case d.OPS.setLineWidth:this.setLineWidth(B[0]);break;case d.OPS.setLineJoin:this.setLineJoin(B[0]);break;case d.OPS.setLineCap:this.setLineCap(B[0]);break;case d.OPS.setMiterLimit:this.setMiterLimit(B[0]);break;case d.OPS.setFillRGBColor:this.setFillRGBColor(B[0],B[1],B[2]);break;case d.OPS.setStrokeRGBColor:this.setStrokeRGBColor(B[0],B[1],B[2]);break;case d.OPS.setStrokeColorN:this.setStrokeColorN(B);break;case d.OPS.setFillColorN:this.setFillColorN(B);break;case d.OPS.shadingFill:this.shadingFill(B[0]);break;case d.OPS.setDash:this.setDash(B[0],B[1]);break;case d.OPS.setRenderingIntent:this.setRenderingIntent(B[0]);break;case d.OPS.setFlatness:this.setFlatness(B[0]);break;case d.OPS.setGState:this.setGState(B[0]);break;case d.OPS.fill:this.fill();break;case d.OPS.eoFill:this.eoFill();break;case d.OPS.stroke:this.stroke();break;case d.OPS.fillStroke:this.fillStroke();break;case d.OPS.eoFillStroke:this.eoFillStroke();break;case d.OPS.clip:this.clip("nonzero");break;case d.OPS.eoClip:this.clip("evenodd");break;case d.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case d.OPS.paintImageXObject:this.paintImageXObject(B[0]);break;case d.OPS.paintInlineImageXObject:this.paintInlineImageXObject(B[0]);break;case d.OPS.paintImageMaskXObject:this.paintImageMaskXObject(B[0]);break;case d.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(B[0],B[1]);break;case d.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case d.OPS.closePath:this.closePath();break;case d.OPS.closeStroke:this.closeStroke();break;case d.OPS.closeFillStroke:this.closeFillStroke();break;case d.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case d.OPS.nextLine:this.nextLine();break;case d.OPS.transform:this.transform(B[0],B[1],B[2],B[3],B[4],B[5]);break;case d.OPS.constructPath:this.constructPath(B[0],B[1]);break;case d.OPS.endPath:this.endPath();break;case 92:this.group(P.items);break;default:(0,d.warn)(`Unimplemented operator ${O}`);break}}}setWordSpacing(C){this.current.wordSpacing=C}setCharSpacing(C){this.current.charSpacing=C}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(C,P,O,L,B,F){const D=this.current;D.textMatrix=D.lineMatrix=[C,P,O,L,B,F],D.textMatrixScale=Math.hypot(C,P),D.x=D.lineX=0,D.y=D.lineY=0,D.xcoords=[],D.ycoords=[],D.tspan=this.svgFactory.createElement("svg:tspan"),D.tspan.setAttributeNS(null,"font-family",D.fontFamily),D.tspan.setAttributeNS(null,"font-size",`${E(D.fontSize)}px`),D.tspan.setAttributeNS(null,"y",E(-D.y)),D.txtElement=this.svgFactory.createElement("svg:text"),D.txtElement.append(D.tspan)}beginText(){const C=this.current;C.x=C.lineX=0,C.y=C.lineY=0,C.textMatrix=d.IDENTITY_MATRIX,C.lineMatrix=d.IDENTITY_MATRIX,C.textMatrixScale=1,C.tspan=this.svgFactory.createElement("svg:tspan"),C.txtElement=this.svgFactory.createElement("svg:text"),C.txtgrp=this.svgFactory.createElement("svg:g"),C.xcoords=[],C.ycoords=[]}moveText(C,P){const O=this.current;O.x=O.lineX+=C,O.y=O.lineY+=P,O.xcoords=[],O.ycoords=[],O.tspan=this.svgFactory.createElement("svg:tspan"),O.tspan.setAttributeNS(null,"font-family",O.fontFamily),O.tspan.setAttributeNS(null,"font-size",`${E(O.fontSize)}px`),O.tspan.setAttributeNS(null,"y",E(-O.y))}showText(C){const P=this.current,O=P.font,L=P.fontSize;if(L===0)return;const B=P.fontSizeScale,F=P.charSpacing,D=P.wordSpacing,V=P.fontDirection,j=P.textHScale*V,G=O.vertical,U=G?1:-1,M=O.defaultVMetrics,N=L*P.fontMatrix[0];let R=0;for(const W of C){if(W===null){R+=V*D;continue}else if(typeof W=="number"){R+=U*W*L/1e3;continue}const J=(W.isSpace?D:0)+F,re=W.fontChar;let K,q,Q=W.width;if(G){let Y;const Z=W.vmetric||M;Y=W.vmetric?Z[1]:Q*.5,Y=-Y*N;const te=Z[2]*N;Q=Z?-Z[0]:Q,K=Y/B,q=(R+te)/B}else K=R/B,q=0;(W.isInFont||O.missingFile)&&(P.xcoords.push(P.x+K),G&&P.ycoords.push(-P.y+q),P.tspan.textContent+=re);const ee=G?Q*N-J*V:Q*N+J*V;R+=ee}P.tspan.setAttributeNS(null,"x",P.xcoords.map(E).join(" ")),G?P.tspan.setAttributeNS(null,"y",P.ycoords.map(E).join(" ")):P.tspan.setAttributeNS(null,"y",E(-P.y)),G?P.y-=R:P.x+=R*j,P.tspan.setAttributeNS(null,"font-family",P.fontFamily),P.tspan.setAttributeNS(null,"font-size",`${E(P.fontSize)}px`),P.fontStyle!==p.fontStyle&&P.tspan.setAttributeNS(null,"font-style",P.fontStyle),P.fontWeight!==p.fontWeight&&P.tspan.setAttributeNS(null,"font-weight",P.fontWeight);const k=P.textRenderingMode&d.TextRenderingMode.FILL_STROKE_MASK;if(k===d.TextRenderingMode.FILL||k===d.TextRenderingMode.FILL_STROKE?(P.fillColor!==p.fillColor&&P.tspan.setAttributeNS(null,"fill",P.fillColor),P.fillAlpha<1&&P.tspan.setAttributeNS(null,"fill-opacity",P.fillAlpha)):P.textRenderingMode===d.TextRenderingMode.ADD_TO_PATH?P.tspan.setAttributeNS(null,"fill","transparent"):P.tspan.setAttributeNS(null,"fill","none"),k===d.TextRenderingMode.STROKE||k===d.TextRenderingMode.FILL_STROKE){const W=1/(P.textMatrixScale||1);this._setStrokeAttributes(P.tspan,W)}let z=P.textMatrix;P.textRise!==0&&(z=z.slice(),z[5]+=P.textRise),P.txtElement.setAttributeNS(null,"transform",`${w(z)} scale(${E(j)}, -1)`),P.txtElement.setAttributeNS(v,"xml:space","preserve"),P.txtElement.append(P.tspan),P.txtgrp.append(P.txtElement),this._ensureTransformGroup().append(P.txtElement)}setLeadingMoveText(C,P){this.setLeading(-P),this.moveText(C,P)}addFontStyle(C){if(!C.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const P=b(C.data,C.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${C.loadedName}"; src: url(${P}); }
62
62
  `}setFont(C){const P=this.current,O=this.commonObjs.get(C[0]);let L=C[1];P.font=O,this.embedFonts&&!O.missingFile&&!this.embeddedFonts[O.loadedName]&&(this.addFontStyle(O),this.embeddedFonts[O.loadedName]=O),P.fontMatrix=O.fontMatrix||d.FONT_IDENTITY_MATRIX;let B="normal";O.black?B="900":O.bold&&(B="bold");const F=O.italic?"italic":"normal";L<0?(L=-L,P.fontDirection=-1):P.fontDirection=1,P.fontSize=L,P.fontFamily=O.loadedName,P.fontWeight=B,P.fontStyle=F,P.tspan=this.svgFactory.createElement("svg:tspan"),P.tspan.setAttributeNS(null,"y",E(-P.y)),P.xcoords=[],P.ycoords=[]}endText(){const C=this.current;C.textRenderingMode&d.TextRenderingMode.ADD_TO_PATH_FLAG&&C.txtElement?.hasChildNodes()&&(C.element=C.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(C){C>0&&(this.current.lineWidth=C)}setLineCap(C){this.current.lineCap=x[C]}setLineJoin(C){this.current.lineJoin=g[C]}setMiterLimit(C){this.current.miterLimit=C}setStrokeAlpha(C){this.current.strokeAlpha=C}setStrokeRGBColor(C,P,O){this.current.strokeColor=d.Util.makeHexColor(C,P,O)}setFillAlpha(C){this.current.fillAlpha=C}setFillRGBColor(C,P,O){this.current.fillColor=d.Util.makeHexColor(C,P,O),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(C){this.current.strokeColor=this._makeColorN_Pattern(C)}setFillColorN(C){this.current.fillColor=this._makeColorN_Pattern(C)}shadingFill(C){const{width:P,height:O}=this.viewport,L=d.Util.inverseTransform(this.transformMatrix),[B,F,D,V]=d.Util.getAxialAlignedBoundingBox([0,0,P,O],L),j=this.svgFactory.createElement("svg:rect");j.setAttributeNS(null,"x",B),j.setAttributeNS(null,"y",F),j.setAttributeNS(null,"width",D-B),j.setAttributeNS(null,"height",V-F),j.setAttributeNS(null,"fill",this._makeShadingPattern(C)),this.current.fillAlpha<1&&j.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(j)}_makeColorN_Pattern(C){return C[0]==="TilingPattern"?this._makeTilingPattern(C):this._makeShadingPattern(C)}_makeTilingPattern(C){const P=C[1],O=C[2],L=C[3]||d.IDENTITY_MATRIX,[B,F,D,V]=C[4],j=C[5],G=C[6],U=C[7],M=`shading${T++}`,[N,R,k,z]=d.Util.normalizeRect([...d.Util.applyTransform([B,F],L),...d.Util.applyTransform([D,V],L)]),[W,J]=d.Util.singularValueDecompose2dScale(L),re=j*W,K=G*J,q=this.svgFactory.createElement("svg:pattern");q.setAttributeNS(null,"id",M),q.setAttributeNS(null,"patternUnits","userSpaceOnUse"),q.setAttributeNS(null,"width",re),q.setAttributeNS(null,"height",K),q.setAttributeNS(null,"x",`${N}`),q.setAttributeNS(null,"y",`${R}`);const Q=this.svg,ee=this.transformMatrix,Y=this.current.fillColor,Z=this.current.strokeColor,te=this.svgFactory.create(k-N,z-R);if(this.svg=te,this.transformMatrix=L,U===2){const ae=d.Util.makeHexColor(...P);this.current.fillColor=ae,this.current.strokeColor=ae}return this.executeOpTree(this.convertOpList(O)),this.svg=Q,this.transformMatrix=ee,this.current.fillColor=Y,this.current.strokeColor=Z,q.append(te.childNodes[0]),this.defs.append(q),`url(#${M})`}_makeShadingPattern(C){switch(typeof C=="string"&&(C=this.objs.get(C)),C[0]){case"RadialAxial":const P=`shading${T++}`,O=C[3];let L;switch(C[1]){case"axial":const B=C[4],F=C[5];L=this.svgFactory.createElement("svg:linearGradient"),L.setAttributeNS(null,"id",P),L.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),L.setAttributeNS(null,"x1",B[0]),L.setAttributeNS(null,"y1",B[1]),L.setAttributeNS(null,"x2",F[0]),L.setAttributeNS(null,"y2",F[1]);break;case"radial":const D=C[4],V=C[5],j=C[6],G=C[7];L=this.svgFactory.createElement("svg:radialGradient"),L.setAttributeNS(null,"id",P),L.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),L.setAttributeNS(null,"cx",V[0]),L.setAttributeNS(null,"cy",V[1]),L.setAttributeNS(null,"r",G),L.setAttributeNS(null,"fx",D[0]),L.setAttributeNS(null,"fy",D[1]),L.setAttributeNS(null,"fr",j);break;default:throw new Error(`Unknown RadialAxial type: ${C[1]}`)}for(const B of O){const F=this.svgFactory.createElement("svg:stop");F.setAttributeNS(null,"offset",B[0]),F.setAttributeNS(null,"stop-color",B[1]),L.append(F)}return this.defs.append(L),`url(#${P})`;case"Mesh":return(0,d.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${C[0]}`)}}setDash(C,P){this.current.dashArray=C,this.current.dashPhase=P}constructPath(C,P){const O=this.current;let L=O.x,B=O.y,F=[],D=0;for(const V of C)switch(V|0){case d.OPS.rectangle:L=P[D++],B=P[D++];const j=P[D++],G=P[D++],U=L+j,M=B+G;F.push("M",E(L),E(B),"L",E(U),E(B),"L",E(U),E(M),"L",E(L),E(M),"Z");break;case d.OPS.moveTo:L=P[D++],B=P[D++],F.push("M",E(L),E(B));break;case d.OPS.lineTo:L=P[D++],B=P[D++],F.push("L",E(L),E(B));break;case d.OPS.curveTo:L=P[D+4],B=P[D+5],F.push("C",E(P[D]),E(P[D+1]),E(P[D+2]),E(P[D+3]),E(L),E(B)),D+=6;break;case d.OPS.curveTo2:F.push("C",E(L),E(B),E(P[D]),E(P[D+1]),E(P[D+2]),E(P[D+3])),L=P[D+2],B=P[D+3],D+=4;break;case d.OPS.curveTo3:L=P[D+2],B=P[D+3],F.push("C",E(P[D]),E(P[D+1]),E(L),E(B),E(L),E(B)),D+=4;break;case d.OPS.closePath:F.push("Z");break}F=F.join(" "),O.path&&C.length>0&&C[0]!==d.OPS.rectangle&&C[0]!==d.OPS.moveTo?F=O.path.getAttributeNS(null,"d")+F:(O.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(O.path)),O.path.setAttributeNS(null,"d",F),O.path.setAttributeNS(null,"fill","none"),O.element=O.path,O.setCurrentPoint(L,B)}endPath(){const C=this.current;if(C.path=null,!this.pendingClip)return;if(!C.element){this.pendingClip=null;return}const P=`clippath${S++}`,O=this.svgFactory.createElement("svg:clipPath");O.setAttributeNS(null,"id",P),O.setAttributeNS(null,"transform",w(this.transformMatrix));const L=C.element.cloneNode(!0);if(this.pendingClip==="evenodd"?L.setAttributeNS(null,"clip-rule","evenodd"):L.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,O.append(L),this.defs.append(O),C.activeClipUrl){C.clipGroup=null;for(const B of this.extraStack)B.clipGroup=null;O.setAttributeNS(null,"clip-path",C.activeClipUrl)}C.activeClipUrl=`url(#${P})`,this.tgrp=null}clip(C){this.pendingClip=C}closePath(){const C=this.current;if(C.path){const P=`${C.path.getAttributeNS(null,"d")}Z`;C.path.setAttributeNS(null,"d",P)}}setLeading(C){this.current.leading=-C}setTextRise(C){this.current.textRise=C}setTextRenderingMode(C){this.current.textRenderingMode=C}setHScale(C){this.current.textHScale=C/100}setRenderingIntent(C){}setFlatness(C){}setGState(C){for(const[P,O]of C)switch(P){case"LW":this.setLineWidth(O);break;case"LC":this.setLineCap(O);break;case"LJ":this.setLineJoin(O);break;case"ML":this.setMiterLimit(O);break;case"D":this.setDash(O[0],O[1]);break;case"RI":this.setRenderingIntent(O);break;case"FL":this.setFlatness(O);break;case"Font":this.setFont(O);break;case"CA":this.setStrokeAlpha(O);break;case"ca":this.setFillAlpha(O);break;default:(0,d.warn)(`Unimplemented graphic state operator ${P}`);break}}fill(){const C=this.current;C.element&&(C.element.setAttributeNS(null,"fill",C.fillColor),C.element.setAttributeNS(null,"fill-opacity",C.fillAlpha),this.endPath())}stroke(){const C=this.current;C.element&&(this._setStrokeAttributes(C.element),C.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(C,P=1){const O=this.current;let L=O.dashArray;P!==1&&L.length>0&&(L=L.map(function(B){return P*B})),C.setAttributeNS(null,"stroke",O.strokeColor),C.setAttributeNS(null,"stroke-opacity",O.strokeAlpha),C.setAttributeNS(null,"stroke-miterlimit",E(O.miterLimit)),C.setAttributeNS(null,"stroke-linecap",O.lineCap),C.setAttributeNS(null,"stroke-linejoin",O.lineJoin),C.setAttributeNS(null,"stroke-width",E(P*O.lineWidth)+"px"),C.setAttributeNS(null,"stroke-dasharray",L.map(E).join(" ")),C.setAttributeNS(null,"stroke-dashoffset",E(P*O.dashPhase)+"px")}eoFill(){this.current.element?.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element?.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const C=this.svgFactory.createElement("svg:rect");C.setAttributeNS(null,"x","0"),C.setAttributeNS(null,"y","0"),C.setAttributeNS(null,"width","1px"),C.setAttributeNS(null,"height","1px"),C.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(C)}paintImageXObject(C){const P=this.getObject(C);if(!P){(0,d.warn)(`Dependent image with object ID ${C} is not ready yet`);return}this.paintInlineImageXObject(P)}paintInlineImageXObject(C,P){const O=C.width,L=C.height,B=y(C,this.forceDataSchema,!!P),F=this.svgFactory.createElement("svg:rect");F.setAttributeNS(null,"x","0"),F.setAttributeNS(null,"y","0"),F.setAttributeNS(null,"width",E(O)),F.setAttributeNS(null,"height",E(L)),this.current.element=F,this.clip("nonzero");const D=this.svgFactory.createElement("svg:image");D.setAttributeNS(A,"xlink:href",B),D.setAttributeNS(null,"x","0"),D.setAttributeNS(null,"y",E(-L)),D.setAttributeNS(null,"width",E(O)+"px"),D.setAttributeNS(null,"height",E(L)+"px"),D.setAttributeNS(null,"transform",`scale(${E(1/O)} ${E(-1/L)})`),P?P.append(D):this._ensureTransformGroup().append(D)}paintImageMaskXObject(C){const P=this.getObject(C.data,C);if(P.bitmap){(0,d.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}const O=this.current,L=P.width,B=P.height,F=O.fillColor;O.maskId=`mask${$++}`;const D=this.svgFactory.createElement("svg:mask");D.setAttributeNS(null,"id",O.maskId);const V=this.svgFactory.createElement("svg:rect");V.setAttributeNS(null,"x","0"),V.setAttributeNS(null,"y","0"),V.setAttributeNS(null,"width",E(L)),V.setAttributeNS(null,"height",E(B)),V.setAttributeNS(null,"fill",F),V.setAttributeNS(null,"mask",`url(#${O.maskId})`),this.defs.append(D),this._ensureTransformGroup().append(V),this.paintInlineImageXObject(P,D)}paintFormXObjectBegin(C,P){if(Array.isArray(C)&&C.length===6&&this.transform(C[0],C[1],C[2],C[3],C[4],C[5]),P){const O=P[2]-P[0],L=P[3]-P[1],B=this.svgFactory.createElement("svg:rect");B.setAttributeNS(null,"x",P[0]),B.setAttributeNS(null,"y",P[1]),B.setAttributeNS(null,"width",E(O)),B.setAttributeNS(null,"height",E(L)),this.current.element=B,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(C){const P=this.svgFactory.create(C.width,C.height),O=this.svgFactory.createElement("svg:defs");P.append(O),this.defs=O;const L=this.svgFactory.createElement("svg:g");return L.setAttributeNS(null,"transform",w(C.transform)),P.append(L),this.svg=L,P}_ensureClipGroup(){if(!this.current.clipGroup){const C=this.svgFactory.createElement("svg:g");C.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(C),this.current.clipGroup=C}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",w(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}s.SVGGraphics=_}),((a,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.XfaText=void 0;class c{static textContent(d){const p=[],v={items:p,styles:Object.create(null)};function A(x){if(!x)return;let g=null;const b=x.name;if(b==="#text")g=x.value;else if(c.shouldBuildText(b))x?.attributes?.textContent?g=x.attributes.textContent:x.value&&(g=x.value);else return;if(g!==null&&p.push({str:g}),!!x.children)for(const y of x.children)A(y)}return A(d),v}static shouldBuildText(d){return!(d==="textarea"||d==="input"||d==="option"||d==="select")}}s.XfaText=c}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.TextLayerRenderTask=void 0,s.renderTextLayer=w,s.updateTextLayer=S;var u=c(1),d=c(6);const p=1e5,v=30,A=.8,x=new Map;function g($,T){let _;if(T&&u.FeatureTest.isOffscreenCanvasSupported)_=new OffscreenCanvas($,$).getContext("2d",{alpha:!1});else{const I=document.createElement("canvas");I.width=I.height=$,_=I.getContext("2d",{alpha:!1})}return _}function b($,T){const _=x.get($);if(_)return _;const I=g(v,T);I.font=`${v}px ${$}`;const C=I.measureText("");let P=C.fontBoundingBoxAscent,O=Math.abs(C.fontBoundingBoxDescent);if(P){const B=P/(P+O);return x.set($,B),I.canvas.width=I.canvas.height=0,B}I.strokeStyle="red",I.clearRect(0,0,v,v),I.strokeText("g",0,0);let L=I.getImageData(0,0,v,v).data;O=0;for(let B=L.length-1-3;B>=0;B-=4)if(L[B]>0){O=Math.ceil(B/4/v);break}I.clearRect(0,0,v,v),I.strokeText("A",0,v),L=I.getImageData(0,0,v,v).data,P=0;for(let B=0,F=L.length;B<F;B+=4)if(L[B]>0){P=v-Math.floor(B/4/v);break}if(I.canvas.width=I.canvas.height=0,P){const B=P/(P+O);return x.set($,B),B}return x.set($,A),A}function y($,T,_){const I=document.createElement("span"),C={angle:0,canvasWidth:0,hasText:T.str!=="",hasEOL:T.hasEOL,fontSize:0};$._textDivs.push(I);const P=u.Util.transform($._transform,T.transform);let O=Math.atan2(P[1],P[0]);const L=_[T.fontName];L.vertical&&(O+=Math.PI/2);const B=Math.hypot(P[2],P[3]),F=B*b(L.fontFamily,$._isOffscreenCanvasSupported);let D,V;O===0?(D=P[4],V=P[5]-F):(D=P[4]+F*Math.sin(O),V=P[5]-F*Math.cos(O));const j="calc(var(--scale-factor)*",G=I.style;$._container===$._rootContainer?(G.left=`${(100*D/$._pageWidth).toFixed(2)}%`,G.top=`${(100*V/$._pageHeight).toFixed(2)}%`):(G.left=`${j}${D.toFixed(2)}px)`,G.top=`${j}${V.toFixed(2)}px)`),G.fontSize=`${j}${B.toFixed(2)}px)`,G.fontFamily=L.fontFamily,C.fontSize=B,I.setAttribute("role","presentation"),I.textContent=T.str,I.dir=T.dir,$._fontInspectorEnabled&&(I.dataset.fontName=T.fontName),O!==0&&(C.angle=O*(180/Math.PI));let U=!1;if(T.str.length>1)U=!0;else if(T.str!==" "&&T.transform[0]!==T.transform[3]){const M=Math.abs(T.transform[0]),N=Math.abs(T.transform[3]);M!==N&&Math.max(M,N)/Math.min(M,N)>1.5&&(U=!0)}U&&(C.canvasWidth=L.vertical?T.height:T.width),$._textDivProperties.set(I,C),$._isReadableStream&&$._layoutText(I)}function f($){const{div:T,scale:_,properties:I,ctx:C,prevFontSize:P,prevFontFamily:O}=$,{style:L}=T;let B="";if(I.canvasWidth!==0&&I.hasText){const{fontFamily:F}=L,{canvasWidth:D,fontSize:V}=I;(P!==V||O!==F)&&(C.font=`${V*_}px ${F}`,$.prevFontSize=V,$.prevFontFamily=F);const{width:j}=C.measureText(T.textContent);j>0&&(B=`scaleX(${D*_/j})`)}I.angle!==0&&(B=`rotate(${I.angle}deg) ${B}`),B.length>0&&(L.transform=B)}function m($){if($._canceled)return;const T=$._textDivs,_=$._capability;if(T.length>p){_.resolve();return}if(!$._isReadableStream)for(const C of T)$._layoutText(C);_.resolve()}class E{constructor({textContentSource:T,container:_,viewport:I,textDivs:C,textDivProperties:P,textContentItemsStr:O,isOffscreenCanvasSupported:L}){this._textContentSource=T,this._isReadableStream=T instanceof ReadableStream,this._container=this._rootContainer=_,this._textDivs=C||[],this._textContentItemsStr=O||[],this._isOffscreenCanvasSupported=L,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=P||new WeakMap,this._canceled=!1,this._capability=new u.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:I.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:g(0,L)};const{pageWidth:B,pageHeight:F,pageX:D,pageY:V}=I.rawDims;this._transform=[1,0,0,-1,-D,V+F],this._pageWidth=B,this._pageHeight=F,(0,d.setLayerDimensions)(_,I),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new u.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._capability.reject(new u.AbortException("TextLayer task cancelled."))}_processItems(T,_){for(const I of T){if(I.str===void 0){if(I.type==="beginMarkedContentProps"||I.type==="beginMarkedContent"){const C=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),I.id!==null&&this._container.setAttribute("id",`${I.id}`),C.append(this._container)}else I.type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(I.str),y(this,I,_)}}_layoutText(T){const _=this._layoutTextParams.properties=this._textDivProperties.get(T);if(this._layoutTextParams.div=T,f(this._layoutTextParams),_.hasText&&this._container.append(T),_.hasEOL){const I=document.createElement("br");I.setAttribute("role","presentation"),this._container.append(I)}}_render(){const T=new u.PromiseCapability;let _=Object.create(null);if(this._isReadableStream){const I=()=>{this._reader.read().then(({value:C,done:P})=>{if(P){T.resolve();return}Object.assign(_,C.styles),this._processItems(C.items,_),I()},T.reject)};this._reader=this._textContentSource.getReader(),I()}else if(this._textContentSource){const{items:I,styles:C}=this._textContentSource;this._processItems(I,C),T.resolve()}else throw new Error('No "textContentSource" parameter specified.');T.promise.then(()=>{_=null,m(this)},this._capability.reject)}}s.TextLayerRenderTask=E;function w($){!$.textContentSource&&($.textContent||$.textContentStream)&&((0,d.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),$.textContentSource=$.textContent||$.textContentStream);const{container:T,viewport:_}=$,I=getComputedStyle(T),C=I.getPropertyValue("visibility"),P=parseFloat(I.getPropertyValue("--scale-factor"));C==="visible"&&(!P||Math.abs(P-_.scale)>1e-5)&&console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");const O=new E($);return O._render(),O}function S({container:$,viewport:T,textDivs:_,textDivProperties:I,isOffscreenCanvasSupported:C,mustRotate:P=!0,mustRescale:O=!0}){if(P&&(0,d.setLayerDimensions)($,{rotation:T.rotation}),O){const L=g(0,C),F={prevFontSize:null,prevFontFamily:null,div:null,scale:T.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:L};for(const D of _)F.properties=I.get(D),F.div=D,f(F)}}}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.AnnotationEditorLayer=void 0;var u=c(1),d=c(4),p=c(28),v=c(33),A=c(6),x=c(34);class g{#e;#t=!1;#r=null;#n=this.pointerup.bind(this);#s=this.pointerdown.bind(this);#o=new Map;#i=!1;#l=!1;#c=!1;#a;static _initialized=!1;constructor({uiManager:y,pageIndex:f,div:m,accessibilityManager:E,annotationLayer:w,viewport:S,l10n:$}){const T=[p.FreeTextEditor,v.InkEditor,x.StampEditor];if(!g._initialized){g._initialized=!0;for(const _ of T)_.initialize($)}y.registerEditorTypes(T),this.#a=y,this.pageIndex=f,this.div=m,this.#e=E,this.#r=w,this.viewport=S,this.#a.addLayer(this)}get isEmpty(){return this.#o.size===0}updateToolbar(y){this.#a.updateToolbar(y)}updateMode(y=this.#a.getMode()){this.#h(),y===u.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),y!==u.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",y===u.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",y===u.AnnotationEditorType.INK),this.div.classList.toggle("stampEditing",y===u.AnnotationEditorType.STAMP),this.div.hidden=!1)}addInkEditorIfNeeded(y){if(!y&&this.#a.getMode()!==u.AnnotationEditorType.INK)return;if(!y){for(const m of this.#o.values())if(m.isEmpty()){m.setInBackground();return}}this.#d({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(y){this.#a.setEditingState(y)}addCommands(y){this.#a.addCommands(y)}enable(){this.div.style.pointerEvents="auto";const y=new Set;for(const m of this.#o.values())m.enableEditing(),m.annotationElementId&&y.add(m.annotationElementId);if(!this.#r)return;const f=this.#r.getEditableAnnotations();for(const m of f){if(m.hide(),this.#a.isDeletedAnnotationElement(m.data.id)||y.has(m.data.id))continue;const E=this.deserialize(m);E&&(this.addOrRebuild(E),E.enableEditing())}}disable(){this.#c=!0,this.div.style.pointerEvents="none";const y=new Set;for(const f of this.#o.values()){if(f.disableEditing(),!f.annotationElementId||f.serialize()!==null){y.add(f.annotationElementId);continue}this.getEditableAnnotation(f.annotationElementId)?.show(),f.remove()}if(this.#r){const f=this.#r.getEditableAnnotations();for(const m of f){const{id:E}=m.data;y.has(E)||this.#a.isDeletedAnnotationElement(E)||m.show()}}this.#h(),this.isEmpty&&(this.div.hidden=!0),this.#c=!1}getEditableAnnotation(y){return this.#r?.getEditableAnnotation(y)||null}setActiveEditor(y){this.#a.getActive()!==y&&this.#a.setActiveEditor(y)}enableClick(){this.div.addEventListener("pointerdown",this.#s),this.div.addEventListener("pointerup",this.#n)}disableClick(){this.div.removeEventListener("pointerdown",this.#s),this.div.removeEventListener("pointerup",this.#n)}attach(y){this.#o.set(y.id,y);const{annotationElementId:f}=y;f&&this.#a.isDeletedAnnotationElement(f)&&this.#a.removeDeletedAnnotationElement(y)}detach(y){this.#o.delete(y.id),this.#e?.removePointerInTextLayer(y.contentDiv),!this.#c&&y.annotationElementId&&this.#a.addDeletedAnnotationElement(y)}remove(y){this.detach(y),this.#a.removeEditor(y),y.div.contains(document.activeElement)&&setTimeout(()=>{this.#a.focusMainContainer()},0),y.div.remove(),y.isAttachedToDOM=!1,this.#l||this.addInkEditorIfNeeded(!1)}changeParent(y){y.parent!==this&&(y.annotationElementId&&(this.#a.addDeletedAnnotationElement(y.annotationElementId),d.AnnotationEditor.deleteAnnotationElement(y),y.annotationElementId=null),this.attach(y),y.parent?.detach(y),y.setParent(this),y.div&&y.isAttachedToDOM&&(y.div.remove(),this.div.append(y.div)))}add(y){if(this.changeParent(y),this.#a.addEditor(y),this.attach(y),!y.isAttachedToDOM){const f=y.render();this.div.append(f),y.isAttachedToDOM=!0}y.fixAndSetPosition(),y.onceAdded(),this.#a.addToAnnotationStorage(y)}moveEditorInDOM(y){if(!y.isAttachedToDOM)return;const{activeElement:f}=document;y.div.contains(f)&&(y._focusEventsAllowed=!1,setTimeout(()=>{y.div.contains(document.activeElement)?y._focusEventsAllowed=!0:(y.div.addEventListener("focusin",()=>{y._focusEventsAllowed=!0},{once:!0}),f.focus())},0)),y._structTreeParentId=this.#e?.moveElementInDOM(this.div,y.div,y.contentDiv,!0)}addOrRebuild(y){y.needsToBeRebuilt()?y.rebuild():this.add(y)}addUndoableEditor(y){const f=()=>y._uiManager.rebuild(y),m=()=>{y.remove()};this.addCommands({cmd:f,undo:m,mustExec:!1})}getNextId(){return this.#a.getId()}#p(y){switch(this.#a.getMode()){case u.AnnotationEditorType.FREETEXT:return new p.FreeTextEditor(y);case u.AnnotationEditorType.INK:return new v.InkEditor(y);case u.AnnotationEditorType.STAMP:return new x.StampEditor(y)}return null}pasteEditor(y,f){this.#a.updateToolbar(y),this.#a.updateMode(y);const{offsetX:m,offsetY:E}=this.#f(),w=this.getNextId(),S=this.#p({parent:this,id:w,x:m,y:E,uiManager:this.#a,isCentered:!0,...f});S&&this.add(S)}deserialize(y){switch(y.annotationType??y.annotationEditorType){case u.AnnotationEditorType.FREETEXT:return p.FreeTextEditor.deserialize(y,this,this.#a);case u.AnnotationEditorType.INK:return v.InkEditor.deserialize(y,this,this.#a);case u.AnnotationEditorType.STAMP:return x.StampEditor.deserialize(y,this,this.#a)}return null}#d(y,f){const m=this.getNextId(),E=this.#p({parent:this,id:m,x:y.offsetX,y:y.offsetY,uiManager:this.#a,isCentered:f});return E&&this.add(E),E}#f(){const{x:y,y:f,width:m,height:E}=this.div.getBoundingClientRect(),w=Math.max(0,y),S=Math.max(0,f),$=Math.min(window.innerWidth,y+m),T=Math.min(window.innerHeight,f+E),_=(w+$)/2-y,I=(S+T)/2-f,[C,P]=this.viewport.rotation%180===0?[_,I]:[I,_];return{offsetX:C,offsetY:P}}addNewEditor(){this.#d(this.#f(),!0)}setSelected(y){this.#a.setSelected(y)}toggleSelected(y){this.#a.toggleSelected(y)}isSelected(y){return this.#a.isSelected(y)}unselect(y){this.#a.unselect(y)}pointerup(y){const{isMac:f}=u.FeatureTest.platform;if(!(y.button!==0||y.ctrlKey&&f)&&y.target===this.div&&this.#i){if(this.#i=!1,!this.#t){this.#t=!0;return}if(this.#a.getMode()===u.AnnotationEditorType.STAMP){this.#a.unselectAll();return}this.#d(y,!1)}}pointerdown(y){if(this.#i){this.#i=!1;return}const{isMac:f}=u.FeatureTest.platform;if(y.button!==0||y.ctrlKey&&f||y.target!==this.div)return;this.#i=!0;const m=this.#a.getActive();this.#t=!m||m.isEmpty()}findNewParent(y,f,m){const E=this.#a.findParent(f,m);return E===null||E===this?!1:(E.changeParent(y),!0)}destroy(){this.#a.getActive()?.parent===this&&(this.#a.commitOrRemove(),this.#a.setActiveEditor(null));for(const y of this.#o.values())this.#e?.removePointerInTextLayer(y.contentDiv),y.setParent(null),y.isAttachedToDOM=!1,y.div.remove();this.div=null,this.#o.clear(),this.#a.removeLayer(this)}#h(){this.#l=!0;for(const y of this.#o.values())y.isEmpty()&&y.remove();this.#l=!1}render({viewport:y}){this.viewport=y,(0,A.setLayerDimensions)(this.div,y);for(const f of this.#a.getEditors(this.pageIndex))this.add(f);this.updateMode()}update({viewport:y}){this.#a.commitOrRemove(),this.viewport=y,(0,A.setLayerDimensions)(this.div,{rotation:y.rotation}),this.updateMode()}get pageDimensions(){const{pageWidth:y,pageHeight:f}=this.viewport.rawDims;return[y,f]}}s.AnnotationEditorLayer=g}),((a,s,c)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.FreeTextEditor=void 0;var u=c(1),d=c(5),p=c(4),v=c(29);class A extends p.AnnotationEditor{#e=this.editorDivBlur.bind(this);#t=this.editorDivFocus.bind(this);#r=this.editorDivInput.bind(this);#n=this.editorDivKeydown.bind(this);#s;#o="";#i=`${this.id}-editor`;#l;#c=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const g=A.prototype,b=m=>m.isEmpty(),y=d.AnnotationEditorUIManager.TRANSLATE_SMALL,f=d.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,u.shadow)(this,"_keyboardManager",new d.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],g.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],g.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],g._translateEmpty,{args:[-y,0],checker:b}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],g._translateEmpty,{args:[-f,0],checker:b}],[["ArrowRight","mac+ArrowRight"],g._translateEmpty,{args:[y,0],checker:b}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],g._translateEmpty,{args:[f,0],checker:b}],[["ArrowUp","mac+ArrowUp"],g._translateEmpty,{args:[0,-y],checker:b}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],g._translateEmpty,{args:[0,-f],checker:b}],[["ArrowDown","mac+ArrowDown"],g._translateEmpty,{args:[0,y],checker:b}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],g._translateEmpty,{args:[0,f],checker:b}]]))}static _type="freetext";constructor(g){super({...g,name:"freeTextEditor"}),this.#s=g.color||A._defaultColor||p.AnnotationEditor._defaultLineColor,this.#l=g.fontSize||A._defaultFontSize}static initialize(g){p.AnnotationEditor.initialize(g,{strings:["free_text2_default_content","editor_free_text2_aria_label"]});const b=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(b.getPropertyValue("--freetext-padding"))}static updateDefaultParams(g,b){switch(g){case u.AnnotationEditorParamsType.FREETEXT_SIZE:A._defaultFontSize=b;break;case u.AnnotationEditorParamsType.FREETEXT_COLOR:A._defaultColor=b;break}}updateParams(g,b){switch(g){case u.AnnotationEditorParamsType.FREETEXT_SIZE:this.#a(b);break;case u.AnnotationEditorParamsType.FREETEXT_COLOR:this.#p(b);break}}static get defaultPropertiesToUpdate(){return[[u.AnnotationEditorParamsType.FREETEXT_SIZE,A._defaultFontSize],[u.AnnotationEditorParamsType.FREETEXT_COLOR,A._defaultColor||p.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[u.AnnotationEditorParamsType.FREETEXT_SIZE,this.#l],[u.AnnotationEditorParamsType.FREETEXT_COLOR,this.#s]]}#a(g){const b=f=>{this.editorDiv.style.fontSize=`calc(${f}px * var(--scale-factor))`,this.translate(0,-(f-this.#l)*this.parentScale),this.#l=f,this.#f()},y=this.#l;this.addCommands({cmd:()=>{b(g)},undo:()=>{b(y)},mustExec:!0,type:u.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#p(g){const b=this.#s;this.addCommands({cmd:()=>{this.#s=this.editorDiv.style.color=g},undo:()=>{this.#s=this.editorDiv.style.color=b},mustExec:!0,type:u.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(g,b){this._uiManager.translateSelectedEditors(g,b,!0)}getInitialTranslation(){const g=this.parentScale;return[-A._internalPadding*g,-(A._internalPadding+this.#l)*g]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(u.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",this.#n),this.editorDiv.addEventListener("focus",this.#t),this.editorDiv.addEventListener("blur",this.#e),this.editorDiv.addEventListener("input",this.#r))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#i),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#n),this.editorDiv.removeEventListener("focus",this.#t),this.editorDiv.removeEventListener("blur",this.#e),this.editorDiv.removeEventListener("input",this.#r),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freeTextEditing"))}focusin(g){this._focusEventsAllowed&&(super.focusin(g),g.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){if(this.width){this.#m();return}this.enableEditMode(),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()}#d(){const g=this.editorDiv.getElementsByTagName("div");if(g.length===0)return this.editorDiv.innerText;const b=[];for(const y of g)b.push(y.innerText.replace(/\r\n?|\n/,""));return b.join(`