@pdfme/ui 5.5.2-dev.1 → 5.5.2-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -37,7 +37,7 @@ Defaulting to 2020, but this will stop working in the future.`)),s.ecmaVersion=1
37
37
  `;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]===`
38
38
  `&&++this.pos;case`
39
39
  `: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`
40
- `;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.15.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,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=_e,s.objectFromMap=pe,s.objectSize=fe,s.setVerbosityLevel=V,s.shadow=Z,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 I={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};s.AnnotationFlag=I;const _={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=_;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 G={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};s.PasswordResponses=G;let j=B.WARNINGS;function V(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 H(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(H(Me))return Me}catch{}return null}function Z(Re,Be,Pe,Me=!1){return Object.defineProperty(Re,Be,{value:Pe,enumerable:!Me,configurable:!0,writable:!1}),Pe}const te=(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=te;class K extends te{constructor(Be,Pe){super(Be,"PasswordException"),this.code=Pe}}s.PasswordException=K;class q extends te{constructor(Be,Pe){super(Be,"UnknownErrorException"),this.details=Pe}}s.UnknownErrorException=q;class Q extends te{constructor(Be){super(Be,"InvalidPDFException")}}s.InvalidPDFException=Q;class ee extends te{constructor(Be){super(Be,"MissingPDFException")}}s.MissingPDFException=ee;class Y extends te{constructor(Be,Pe){super(Be,"UnexpectedResponseException"),this.status=Pe}}s.UnexpectedResponseException=Y;class J extends te{constructor(Be){super(Be,"FormatError")}}s.FormatError=J;class re extends te{constructor(Be){super(Be,"AbortException")}}s.AbortException=re;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),He=Re.subarray(Fe,Ue);Me.push(String.fromCharCode.apply(null,He))}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 Z(this,"isLittleEndian",ge())}static get isEvalSupported(){return Z(this,"isEvalSupported",me())}static get isOffscreenCanvasSupported(){return Z(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?Z(this,"platform",{isWin:!1,isMac:!1}):Z(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){return Z(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),He=this.applyTransform([Be[2],Be[1]],Pe);return[Math.min(Me[0],Fe[0],Ue[0],He[0]),Math.min(Me[1],Fe[1],Ue[1],He[1]),Math.max(Me[0],Fe[0],Ue[0],He[0]),Math.max(Me[1],Fe[1],Ue[1],He[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],He=Be[2]*Pe[1]+Be[3]*Pe[3],Le=(Me+He)/2,ke=Math.sqrt((Me+He)**2-4*(Me*He-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])),He=Math.min(Math.max(Be[1],Be[3]),Math.max(Pe[1],Pe[3]));return Ue>He?null:[Me,Ue,Fe,He]}static bezierBoundingBox(Be,Pe,Me,Fe,Ue,He,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*He,it=-3*Pe+9*Fe-9*He+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*He+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 _e(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,I=Number.isInteger(a.maxImageSize)&&a.maxImageSize>-1?a.maxImageSize:-1,_=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,G=a.disableStream===!0,j=a.disableAutoFetch===!0,V=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}),H=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 Z={docId:c,apiVersion:"3.11.174",data:d,password:A,disableAutoFetch:j,rangeChunkSize:g,length:U,docBaseUrl:f,enableXfa:B,evaluatorOptions:{maxImageSize:I,disableFontFace:O,ignoreErrors:T,isEvalSupported:_,isOffscreenCanvasSupported:C,canvasMaxAreaInBytes:P,fontExtraProperties:L,useSystemFonts:M,cMapUrl:N?m:null,standardFontDataUrl:N?S:null}},te={ignoreErrors:T,isEvalSupported:_,disableFontFace:O,fontExtraProperties:L,enableXfa:B,ownerDocument:F,disableAutoFetch:j,pdfBug:V,styleElement:H};return b.promise.then(function(){if(s.destroyed)throw new Error("Loading aborted");const K=_fetchDocument(b,Z),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:G},x):d||(ee=(J=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(J):(0,_display_utils.isValidFetchUrl)(J.url)?new _displayFetch_stream.PDFFetchStream(J):new _displayNetwork.PDFNetworkStream(J))({url:u,length:U,httpHeaders:p,withCredentials:v,rangeChunkSize:g,disableRange:D,disableStream:G})),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),J=new WorkerTransport(Y,s,ee,te,W);s._transport=J,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,I=this.parent.div.style.cursor,_=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=I,this.div.style.cursor=_;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,I=q=>Math.round(q*1e4)/1e4,_=this.#u(this.rotation),C=(q,Q)=>[_[0]*q+_[2]*Q,_[1]*q+_[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 G=L(w,S),j=B(w,S);let V=C(...j);const U=I(m+V[0]),M=I(E+V[1]);let N=1,R=1,[k,H]=this.screenToPageTranslation(b.movementX,b.movementY);if([k,H]=O(k/y,H/f),F){const q=Math.hypot(w,S);N=R=Math.max(Math.min(Math.hypot(j[0]-G[0]-k,j[1]-G[1]-H)/q,1/w,1/S),$/w,T/S)}else D?N=Math.max($,Math.min(1,Math.abs(j[0]-G[0]-k)))/w:R=Math.max(T,Math.min(1,Math.abs(j[1]-G[1]-H)))/S;const W=I(w*N),Z=I(S*R);V=C(...B(W,Z));const te=U-V[0],K=M-V[1];this.width=W,this.height=Z,this.x=te,this.y=K,this.setDims(y*W,f*Z),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.#_(g)}#_(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,I=this.y*m,_=this.width*f,C=this.height*m;switch(this.rotation){case 0:return[T+S+E,m-I-$-C+w,T+S+_+E,m-I-$+w];case 90:return[T+$+E,m-I+S+w,T+$+C+E,m-I+S+_+w];case 180:return[T-S-_+E,m-I+$+w,T-S+E,m-I+$+C+w];case 270:return[T-$-C+E,m-I-S-_+w,T-$+E,m-I-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,I=new FileReader,_=new Image,C=new Promise((P,O)=>{_.onload=()=>{S.bitmap=_,S.isSvg=!0,P()},I.onload=async()=>{const L=S.svgUrl=I.result;_.src=await T?`${L}#svgView(preserveAspectRatio(none))`:L},_.onerror=I.onerror=O});I.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:I=!1}){if(S&&E(),this.#t)return;const _={cmd:E,undo:w,type:$};if(this.#n===-1){this.#e.length>0&&(this.#e.length=0),this.#n=0,this.#e.push(_);return}if(T&&this.#e[this.#n].type===$){I&&(_.undo=this.#e[this.#n].undo),this.#e[this.#n]=_;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(_)}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 I of S){const _=I.startsWith("mac+");w&&_?(this.callbacks.set(I.slice(4),{callback:$,options:T}),this.allKeys.add(I.split("+").at(-1))):!w&&!_&&(this.callbacks.set(I,{callback:$,options:T}),this.allKeys.add(I.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:I=[],checker:_=null}}=S;_&&!_(E,w)||($.bind(E,...I)(),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,I)=>T===w[I]))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);#_=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];#I=null;#w=null;#F=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const E=f.prototype,w=T=>{const{activeElement:I}=document;return I&&T.#w.contains(I)&&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,I){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=I,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:I,height:_}=S.div.getBoundingClientRect();if(E>=$&&E<=$+I&&w>=T&&w<=T+_)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.#_),document.addEventListener("paste",this.#M)}#S(){document.removeEventListener("copy",this.#$),document.removeEventListener("cut",this.#_),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 I of this.#a)if(I.isHandlingMimeForPasting(T.type)){I.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 I=()=>{for(const C of T)this.#U(C);this.#W(T)},_=()=>{for(const C of T)C.remove()};this.addCommands({cmd:I,undo:_,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)})}#H(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.#z(),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.#H(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.#H(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.#H(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.#H(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.#z()})}redo(){this.#o.redo(),this.#y({hasSomethingToUndo:!0,hasSomethingToRedo:this.#o.hasSomethingToRedo(),isEmpty:this.#z()})}addCommands(E){this.#o.add(E),this.#y({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#z()})}#z(){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,I=[...this.#u],_=1e3;this.#I&&clearTimeout(this.#I),this.#I=setTimeout(()=>{this.#I=null,this.#x[0]=this.#x[1]=0,this.addCommands({cmd:()=>{for(const C of I)this.#t.has(C.id)&&C.translateInPage($,T)},undo:()=>{for(const C of I)this.#t.has(C.id)&&C.translateInPage(-$,-T)},mustExec:!1})},_);for(const C of I)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)_.newX=$,_.newY=T,_.newPageIndex=I,w||=$!==_.savedX||T!==_.savedY||I!==_.savedPageIndex;if(!w)return!1;const S=($,T,I,_)=>{if(this.#t.has($.id)){const C=this.#r.get(_);C?$._setParentAndPosition(C,T,I):($.pageIndex=_,$.x=T,$.y=I)}};return this.addCommands({cmd:()=>{for(const[$,{newX:T,newY:I,newPageIndex:_}]of E)S($,T,I,_)},undo:()=>{for(const[$,{savedX:T,savedY:I,savedPageIndex:_}]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=G,s.getCurrentTransform=j,s.getCurrentTransformInverse=V,s.getFilenameFromUrl=$,s.getPdfFilenameFromUrl=T,s.getRGB=D,s.getXfaPageViewport=F,s.isDataScheme=w,s.isPdfFile=S,s.isValidFetchUrl=_,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,H,W,Z;if(N.length===1){const Q=N[0],ee=new Array(256);for(let Y=0;Y<256;Y++)ee[Y]=Q[Y]/255;Z=k=H=W=ee.join(",")}else{const[Q,ee,Y]=N,J=new Array(256),re=new Array(256),ae=new Array(256);for(let oe=0;oe<256;oe++)J[oe]=Q[oe]/255,re[oe]=ee[oe]/255,ae[oe]=Y[oe]/255;k=J.join(","),H=re.join(","),W=ae.join(","),Z=`${k}${H}${W}`}if(R=this.#d.get(Z),R)return this.#d.set(N,R),R;const te=`g_${this.#r}_transfer_map_${this.#p++}`,K=`url(#${te})`;this.#d.set(N,K),this.#d.set(Z,K);const q=this.#A(te);return this.#g(k,H,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 H=this.#u(N);N=d.Util.makeHexColor(...H);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 Z=new Array(256);for(let ee=0;ee<=255;ee++){const Y=ee/255;Z[ee]=Y<=.03928?Y/12.92:((Y+.055)/1.055)**2.4}const te=Z.join(","),K=`g_${this.#r}_hcm_filter`,q=this.#l=this.#A(K);this.#g(te,te,te,q),this.#h(q);const Q=(ee,Y)=>{const J=H[ee]/255,re=W[ee]/255,ae=new Array(Y+1);for(let oe=0;oe<=Y;oe++)ae[oe]=J+oe/Y*(re-J);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,H){const W=`${N}-${R}-${k}-${H}`;if(this.#c===W)return this.#a;if(this.#c=W,this.#a="none",this.#l?.remove(),!N||!R)return this.#a;const[Z,te]=[N,R].map(this.#u.bind(this));let K=Math.round(.2126*Z[0]+.7152*Z[1]+.0722*Z[2]),q=Math.round(.2126*te[0]+.7152*te[1]+.0722*te[2]),[Q,ee]=[k,H].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(",")},J=`g_${this.#r}_hcm_highlight_filter`,re=this.#l=this.#A(J);return this.#h(re),this.#g(Y(Q[0],ee[0],5),Y(Q[1],ee[1],5),Y(Q[2],ee[2],5),re),this.#a=`url(#${J})`,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 H=this.#n.createElementNS(p,R);H.setAttribute("type","discrete"),H.setAttribute("tableValues",k),N.append(H)}#g(N,R,k,H){const W=this.#n.createElementNS(p,"feComponentTransfer");H.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(_(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 H=new XMLHttpRequest;H.open("GET",M,!0),N&&(H.responseType="arraybuffer"),H.onreadystatechange=()=>{if(H.readyState===XMLHttpRequest.DONE){if(H.status===200||H.status===0){let W;if(N&&H.response?W=new Uint8Array(H.response):!N&&H.responseText&&(W=(0,d.stringToBytes)(H.responseText)),W){R(W);return}}k(new Error(H.statusText))}},H.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:H=0,offsetY:W=0,dontFlip:Z=!1}){this.viewBox=N,this.scale=R,this.rotation=k,this.offsetX=H,this.offsetY=W;const te=(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.")}Z&&(ee=-ee,Y=-Y);let J,re,ae,oe;q===0?(J=Math.abs(K-N[1])*R+H,re=Math.abs(te-N[0])*R+W,ae=(N[3]-N[1])*R,oe=(N[2]-N[0])*R):(J=Math.abs(te-N[0])*R+H,re=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,J-q*R*te-ee*R*K,re-Q*R*te-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:H=this.offsetY,dontFlip:W=!1}={}){return new m({viewBox:this.viewBox.slice(),scale:N,rotation:R,offsetX:k,offsetY:H,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,H=R.exec(M);let W=k.exec(H[1])||k.exec(H[2])||k.exec(H[3]);if(W&&(W=W[0],W.includes("%")))try{W=k.exec(decodeURIComponent(W))[0]}catch{}return W||N}class I{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:H,end:W}of this.times)N.push(`${k.padEnd(R)} ${W-H}ms
40
+ `;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.15.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=_e,s.objectFromMap=pe,s.objectSize=fe,s.setVerbosityLevel=V,s.shadow=Z,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 I={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};s.AnnotationFlag=I;const _={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=_;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 G={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};s.PasswordResponses=G;let j=B.WARNINGS;function V(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 H(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(H(Me))return Me}catch{}return null}function Z(Re,Be,Pe,Me=!1){return Object.defineProperty(Re,Be,{value:Pe,enumerable:!Me,configurable:!0,writable:!1}),Pe}const te=(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=te;class K extends te{constructor(Be,Pe){super(Be,"PasswordException"),this.code=Pe}}s.PasswordException=K;class q extends te{constructor(Be,Pe){super(Be,"UnknownErrorException"),this.details=Pe}}s.UnknownErrorException=q;class Q extends te{constructor(Be){super(Be,"InvalidPDFException")}}s.InvalidPDFException=Q;class ee extends te{constructor(Be){super(Be,"MissingPDFException")}}s.MissingPDFException=ee;class Y extends te{constructor(Be,Pe){super(Be,"UnexpectedResponseException"),this.status=Pe}}s.UnexpectedResponseException=Y;class J extends te{constructor(Be){super(Be,"FormatError")}}s.FormatError=J;class re extends te{constructor(Be){super(Be,"AbortException")}}s.AbortException=re;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),He=Re.subarray(Fe,Ue);Me.push(String.fromCharCode.apply(null,He))}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 Z(this,"isLittleEndian",ge())}static get isEvalSupported(){return Z(this,"isEvalSupported",me())}static get isOffscreenCanvasSupported(){return Z(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?Z(this,"platform",{isWin:!1,isMac:!1}):Z(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){return Z(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),He=this.applyTransform([Be[2],Be[1]],Pe);return[Math.min(Me[0],Fe[0],Ue[0],He[0]),Math.min(Me[1],Fe[1],Ue[1],He[1]),Math.max(Me[0],Fe[0],Ue[0],He[0]),Math.max(Me[1],Fe[1],Ue[1],He[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],He=Be[2]*Pe[1]+Be[3]*Pe[3],Le=(Me+He)/2,ke=Math.sqrt((Me+He)**2-4*(Me*He-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])),He=Math.min(Math.max(Be[1],Be[3]),Math.max(Pe[1],Pe[3]));return Ue>He?null:[Me,Ue,Fe,He]}static bezierBoundingBox(Be,Pe,Me,Fe,Ue,He,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*He,it=-3*Pe+9*Fe-9*He+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*He+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 _e(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,I=Number.isInteger(a.maxImageSize)&&a.maxImageSize>-1?a.maxImageSize:-1,_=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,G=a.disableStream===!0,j=a.disableAutoFetch===!0,V=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}),H=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 Z={docId:c,apiVersion:"3.11.174",data:d,password:A,disableAutoFetch:j,rangeChunkSize:g,length:U,docBaseUrl:f,enableXfa:B,evaluatorOptions:{maxImageSize:I,disableFontFace:O,ignoreErrors:T,isEvalSupported:_,isOffscreenCanvasSupported:C,canvasMaxAreaInBytes:P,fontExtraProperties:L,useSystemFonts:M,cMapUrl:N?m:null,standardFontDataUrl:N?S:null}},te={ignoreErrors:T,isEvalSupported:_,disableFontFace:O,fontExtraProperties:L,enableXfa:B,ownerDocument:F,disableAutoFetch:j,pdfBug:V,styleElement:H};return b.promise.then(function(){if(s.destroyed)throw new Error("Loading aborted");const K=_fetchDocument(b,Z),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:G},x):d||(ee=(J=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(J):(0,_display_utils.isValidFetchUrl)(J.url)?new _displayFetch_stream.PDFFetchStream(J):new _displayNetwork.PDFNetworkStream(J))({url:u,length:U,httpHeaders:p,withCredentials:v,rangeChunkSize:g,disableRange:D,disableStream:G})),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),J=new WorkerTransport(Y,s,ee,te,W);s._transport=J,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,I=this.parent.div.style.cursor,_=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=I,this.div.style.cursor=_;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,I=q=>Math.round(q*1e4)/1e4,_=this.#u(this.rotation),C=(q,Q)=>[_[0]*q+_[2]*Q,_[1]*q+_[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 G=L(w,S),j=B(w,S);let V=C(...j);const U=I(m+V[0]),M=I(E+V[1]);let N=1,R=1,[k,H]=this.screenToPageTranslation(b.movementX,b.movementY);if([k,H]=O(k/y,H/f),F){const q=Math.hypot(w,S);N=R=Math.max(Math.min(Math.hypot(j[0]-G[0]-k,j[1]-G[1]-H)/q,1/w,1/S),$/w,T/S)}else D?N=Math.max($,Math.min(1,Math.abs(j[0]-G[0]-k)))/w:R=Math.max(T,Math.min(1,Math.abs(j[1]-G[1]-H)))/S;const W=I(w*N),Z=I(S*R);V=C(...B(W,Z));const te=U-V[0],K=M-V[1];this.width=W,this.height=Z,this.x=te,this.y=K,this.setDims(y*W,f*Z),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.#_(g)}#_(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,I=this.y*m,_=this.width*f,C=this.height*m;switch(this.rotation){case 0:return[T+S+E,m-I-$-C+w,T+S+_+E,m-I-$+w];case 90:return[T+$+E,m-I+S+w,T+$+C+E,m-I+S+_+w];case 180:return[T-S-_+E,m-I+$+w,T-S+E,m-I+$+C+w];case 270:return[T-$-C+E,m-I-S-_+w,T-$+E,m-I-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,I=new FileReader,_=new Image,C=new Promise((P,O)=>{_.onload=()=>{S.bitmap=_,S.isSvg=!0,P()},I.onload=async()=>{const L=S.svgUrl=I.result;_.src=await T?`${L}#svgView(preserveAspectRatio(none))`:L},_.onerror=I.onerror=O});I.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:I=!1}){if(S&&E(),this.#t)return;const _={cmd:E,undo:w,type:$};if(this.#n===-1){this.#e.length>0&&(this.#e.length=0),this.#n=0,this.#e.push(_);return}if(T&&this.#e[this.#n].type===$){I&&(_.undo=this.#e[this.#n].undo),this.#e[this.#n]=_;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(_)}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 I of S){const _=I.startsWith("mac+");w&&_?(this.callbacks.set(I.slice(4),{callback:$,options:T}),this.allKeys.add(I.split("+").at(-1))):!w&&!_&&(this.callbacks.set(I,{callback:$,options:T}),this.allKeys.add(I.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:I=[],checker:_=null}}=S;_&&!_(E,w)||($.bind(E,...I)(),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,I)=>T===w[I]))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);#_=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];#I=null;#w=null;#F=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const E=f.prototype,w=T=>{const{activeElement:I}=document;return I&&T.#w.contains(I)&&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,I){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=I,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:I,height:_}=S.div.getBoundingClientRect();if(E>=$&&E<=$+I&&w>=T&&w<=T+_)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.#_),document.addEventListener("paste",this.#M)}#S(){document.removeEventListener("copy",this.#$),document.removeEventListener("cut",this.#_),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 I of this.#a)if(I.isHandlingMimeForPasting(T.type)){I.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 I=()=>{for(const C of T)this.#U(C);this.#W(T)},_=()=>{for(const C of T)C.remove()};this.addCommands({cmd:I,undo:_,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)})}#H(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.#z(),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.#H(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.#H(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.#H(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.#H(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.#z()})}redo(){this.#o.redo(),this.#y({hasSomethingToUndo:!0,hasSomethingToRedo:this.#o.hasSomethingToRedo(),isEmpty:this.#z()})}addCommands(E){this.#o.add(E),this.#y({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#z()})}#z(){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,I=[...this.#u],_=1e3;this.#I&&clearTimeout(this.#I),this.#I=setTimeout(()=>{this.#I=null,this.#x[0]=this.#x[1]=0,this.addCommands({cmd:()=>{for(const C of I)this.#t.has(C.id)&&C.translateInPage($,T)},undo:()=>{for(const C of I)this.#t.has(C.id)&&C.translateInPage(-$,-T)},mustExec:!1})},_);for(const C of I)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)_.newX=$,_.newY=T,_.newPageIndex=I,w||=$!==_.savedX||T!==_.savedY||I!==_.savedPageIndex;if(!w)return!1;const S=($,T,I,_)=>{if(this.#t.has($.id)){const C=this.#r.get(_);C?$._setParentAndPosition(C,T,I):($.pageIndex=_,$.x=T,$.y=I)}};return this.addCommands({cmd:()=>{for(const[$,{newX:T,newY:I,newPageIndex:_}]of E)S($,T,I,_)},undo:()=>{for(const[$,{savedX:T,savedY:I,savedPageIndex:_}]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=G,s.getCurrentTransform=j,s.getCurrentTransformInverse=V,s.getFilenameFromUrl=$,s.getPdfFilenameFromUrl=T,s.getRGB=D,s.getXfaPageViewport=F,s.isDataScheme=w,s.isPdfFile=S,s.isValidFetchUrl=_,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,H,W,Z;if(N.length===1){const Q=N[0],ee=new Array(256);for(let Y=0;Y<256;Y++)ee[Y]=Q[Y]/255;Z=k=H=W=ee.join(",")}else{const[Q,ee,Y]=N,J=new Array(256),re=new Array(256),ae=new Array(256);for(let oe=0;oe<256;oe++)J[oe]=Q[oe]/255,re[oe]=ee[oe]/255,ae[oe]=Y[oe]/255;k=J.join(","),H=re.join(","),W=ae.join(","),Z=`${k}${H}${W}`}if(R=this.#d.get(Z),R)return this.#d.set(N,R),R;const te=`g_${this.#r}_transfer_map_${this.#p++}`,K=`url(#${te})`;this.#d.set(N,K),this.#d.set(Z,K);const q=this.#A(te);return this.#g(k,H,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 H=this.#u(N);N=d.Util.makeHexColor(...H);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 Z=new Array(256);for(let ee=0;ee<=255;ee++){const Y=ee/255;Z[ee]=Y<=.03928?Y/12.92:((Y+.055)/1.055)**2.4}const te=Z.join(","),K=`g_${this.#r}_hcm_filter`,q=this.#l=this.#A(K);this.#g(te,te,te,q),this.#h(q);const Q=(ee,Y)=>{const J=H[ee]/255,re=W[ee]/255,ae=new Array(Y+1);for(let oe=0;oe<=Y;oe++)ae[oe]=J+oe/Y*(re-J);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,H){const W=`${N}-${R}-${k}-${H}`;if(this.#c===W)return this.#a;if(this.#c=W,this.#a="none",this.#l?.remove(),!N||!R)return this.#a;const[Z,te]=[N,R].map(this.#u.bind(this));let K=Math.round(.2126*Z[0]+.7152*Z[1]+.0722*Z[2]),q=Math.round(.2126*te[0]+.7152*te[1]+.0722*te[2]),[Q,ee]=[k,H].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(",")},J=`g_${this.#r}_hcm_highlight_filter`,re=this.#l=this.#A(J);return this.#h(re),this.#g(Y(Q[0],ee[0],5),Y(Q[1],ee[1],5),Y(Q[2],ee[2],5),re),this.#a=`url(#${J})`,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 H=this.#n.createElementNS(p,R);H.setAttribute("type","discrete"),H.setAttribute("tableValues",k),N.append(H)}#g(N,R,k,H){const W=this.#n.createElementNS(p,"feComponentTransfer");H.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(_(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 H=new XMLHttpRequest;H.open("GET",M,!0),N&&(H.responseType="arraybuffer"),H.onreadystatechange=()=>{if(H.readyState===XMLHttpRequest.DONE){if(H.status===200||H.status===0){let W;if(N&&H.response?W=new Uint8Array(H.response):!N&&H.responseText&&(W=(0,d.stringToBytes)(H.responseText)),W){R(W);return}}k(new Error(H.statusText))}},H.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:H=0,offsetY:W=0,dontFlip:Z=!1}){this.viewBox=N,this.scale=R,this.rotation=k,this.offsetX=H,this.offsetY=W;const te=(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.")}Z&&(ee=-ee,Y=-Y);let J,re,ae,oe;q===0?(J=Math.abs(K-N[1])*R+H,re=Math.abs(te-N[0])*R+W,ae=(N[3]-N[1])*R,oe=(N[2]-N[0])*R):(J=Math.abs(te-N[0])*R+H,re=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,J-q*R*te-ee*R*K,re-Q*R*te-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:H=this.offsetY,dontFlip:W=!1}={}){return new m({viewBox:this.viewBox.slice(),scale:N,rotation:R,offsetX:k,offsetY:H,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,H=R.exec(M);let W=k.exec(H[1])||k.exec(H[2])||k.exec(H[3]);if(W&&(W=W[0],W.includes("%")))try{W=k.exec(decodeURIComponent(W))[0]}catch{}return W||N}class I{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:H,end:W}of this.times)N.push(`${k.padEnd(R)} ${W-H}ms
41
41
  `);return N.join("")}}s.StatTimer=I;function _(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 H=document.createElement("script");H.src=M,H.onload=function(W){N&&H.remove(),R(W)},H.onerror=function(){k(new Error(`Cannot load script at: ${H.src}`))},(document.head||document.documentElement).append(H)})}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 H=parseInt(R[2],10);H=H>=1&&H<=12?H-1:0;let W=parseInt(R[3],10);W=W>=1&&W<=31?W:1;let Z=parseInt(R[4],10);Z=Z>=0&&Z<=23?Z:0;let te=parseInt(R[5],10);te=te>=0&&te<=59?te: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==="-"?(Z+=Q,te+=ee):q==="+"&&(Z-=Q,te-=ee),new Date(Date.UTC(k,H,W,Z,te,K))}}s.PDFDateString=B;function F(M,{scale:N=1,rotation:R=0}){const{width:k,height:H}=M.attributes.style,W=[0,0,parseInt(k),parseInt(H)];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 G(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:H,e:W,f:Z}=M.getTransform();return[N,R,k,H,W,Z]}function V(M){const{a:N,b:R,c:k,d:H,e:W,f:Z}=M.getTransform().invertSelf();return[N,R,k,H,W,Z]}function U(M,N,R=!1,k=!0){if(N instanceof m){const{pageWidth:H,pageHeight:W}=N.rawDims,{style:Z}=M,te=d.FeatureTest.isCSSRoundSupported,K=`var(--scale-factor) * ${H}px`,q=`var(--scale-factor) * ${W}px`,Q=te?`round(${K}, 1px)`:`calc(${K})`,ee=te?`round(${q}, 1px)`:`calc(${q})`;!R||N.rotation%180===0?(Z.width=Q,Z.height=ee):(Z.width=ee,Z.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 I=3432918353,_=461845907,C=I&v,P=_&v;for(let O=0;O<f;O++)O&1?(w=E[O],w=w*I&p|w*C&v,w=w<<15|w>>>17,w=w*_&p|w*P&v,$^=w,$=$<<13|$>>>19,$=$*5+3864292196):(S=E[O],S=S*I&p|S*C&v,S=S<<15|S>>>17,S=S*_&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*I&p|w*C&v,w=w<<15|w>>>17,w=w*_&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,G,j){const V=F.substring(0,D),U=F.substring(D+G);return V+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 _=16,C=1482184792;let P=g(T,_);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,_,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,`);
42
42
  `)}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,Z){k.translate(W,Z),this.__originalTranslate(W,Z)},R.scale=function(W,Z){k.scale(W,Z),this.__originalScale(W,Z)},R.transform=function(W,Z,te,K,q,Q){k.transform(W,Z,te,K,q,Q),this.__originalTransform(W,Z,te,K,q,Q)},R.setTransform=function(W,Z,te,K,q,Q){k.setTransform(W,Z,te,K,q,Q),this.__originalSetTransform(W,Z,te,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(H,W){k.moveTo(H,W),this.__originalMoveTo(H,W)},R.lineTo=function(H,W){k.lineTo(H,W),this.__originalLineTo(H,W)},R.bezierCurveTo=function(H,W,Z,te,K,q){k.bezierCurveTo(H,W,Z,te,K,q),this.__originalBezierCurveTo(H,W,Z,te,K,q)},R.rect=function(H,W,Z,te){k.rect(H,W,Z,te),this.__originalRect(H,W,Z,te)},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,H,W){let Z;return this.cache[k]!==void 0?(Z=this.cache[k],this.canvasFactory.reset(Z,H,W)):(Z=this.canvasFactory.create(H,W),this.cache[k]=Z),Z}delete(k){delete this.cache[k]}clear(){for(const k in this.cache){const H=this.cache[k];this.canvasFactory.destroy(H),delete this.cache[k]}}}function S(R,k,H,W,Z,te,K,q,Q,ee){const[Y,J,re,ae,oe,se]=(0,d.getCurrentTransform)(R);if(J===0&&re===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,H,W,Z,te,0,0,he,Ee),R.setTransform(Y,J,re,ae,oe,se),[he,Ee]}if(Y===0&&ae===0){const ge=q*re+oe,me=Math.round(ge),be=K*J+se,le=Math.round(be),ve=(q+ee)*re+oe,he=Math.abs(Math.round(ve)-me)||1,ye=(K+Q)*J+se,Ee=Math.abs(Math.round(ye)-le)||1;return R.setTransform(0,Math.sign(J),Math.sign(re),0,me,le),R.drawImage(k,H,W,Z,te,0,0,Ee,he),R.setTransform(Y,J,re,ae,oe,se),[Ee,he]}R.drawImage(k,H,W,Z,te,K,q,Q,ee);const fe=Math.hypot(Y,J),pe=Math.hypot(re,ae);return[fe*Q,pe*ee]}function $(R){const{width:k,height:H}=R;if(k>f||H>f)return null;const W=1e3,Z=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),te=k+1;let K=new Uint8Array(te*(H+1)),q,Q,ee;const Y=k+7&-8;let J=new Uint8Array(Y*H),re=0;for(const pe of R.data){let ge=128;for(;ge>0;)J[re++]=pe&ge?0:255,ge>>=1}let ae=0;for(re=0,J[re]!==0&&(K[0]=1,++ae),Q=1;Q<k;Q++)J[re]!==J[re+1]&&(K[Q]=J[re]?2:1,++ae),re++;for(J[re]!==0&&(K[Q]=2,++ae),q=1;q<H;q++){re=q*Y,ee=q*te,J[re-Y]!==J[re]&&(K[ee]=J[re]?1:8,++ae);let pe=(J[re]?4:0)+(J[re-Y]?8:0);for(Q=1;Q<k;Q++)pe=(pe>>2)+(J[re+1]?4:0)+(J[re-Y+1]?8:0),Z[pe]&&(K[ee+Q]=Z[pe],++ae),re++;if(J[re-Y]!==J[re]&&(K[ee+Q]=J[re]?2:4,++ae),ae>W)return null}for(re=Y*(H-1),ee=q*te,J[re]!==0&&(K[ee]=8,++ae),Q=1;Q<k;Q++)J[re]!==J[re+1]&&(K[ee+Q]=J[re]?4:8,++ae),re++;if(J[re]!==0&&(K[ee+Q]=4,++ae),ae>W)return null;const oe=new Int32Array([0,te,-1,0,-te,0,0,0,1]),se=new Path2D;for(q=0;ae&&q<=H;q++){let pe=q*te;const ge=pe+k;for(;pe<ge&&!K[pe];)pe++;if(pe===ge)continue;se.moveTo(pe%te,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%te,pe/te|0),K[pe]||--ae}while(me!==pe);--q}return J=null,K=null,function(pe){pe.save(),pe.scale(1/k,-1/H),pe.translate(0,-H),pe.fill(se),pe.beginPath(),pe.restore()}}class T{constructor(k,H){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,H])}clone(){const k=Object.create(this);return k.clipBox=this.clipBox.slice(),k}setCurrentPoint(k,H){this.x=k,this.y=H}updatePathMinMax(k,H,W){[H,W]=u.Util.applyTransform([H,W],k),this.minX=Math.min(this.minX,H),this.minY=Math.min(this.minY,W),this.maxX=Math.max(this.maxX,H),this.maxY=Math.max(this.maxY,W)}updateRectMinMax(k,H){const W=u.Util.applyTransform(H,k),Z=u.Util.applyTransform(H.slice(2),k);this.minX=Math.min(this.minX,W[0],Z[0]),this.minY=Math.min(this.minY,W[1],Z[1]),this.maxX=Math.max(this.maxX,W[0],Z[0]),this.maxY=Math.max(this.maxY,W[1],Z[1])}updateScalingPathMinMax(k,H){u.Util.scaleMinMax(k,H),this.minX=Math.min(this.minX,H[0]),this.maxX=Math.max(this.maxX,H[1]),this.minY=Math.min(this.minY,H[2]),this.maxY=Math.max(this.maxY,H[3])}updateCurvePathMinMax(k,H,W,Z,te,K,q,Q,ee,Y){const J=u.Util.bezierBoundingBox(H,W,Z,te,K,q,Q,ee);if(Y){Y[0]=Math.min(Y[0],J[0],J[2]),Y[1]=Math.max(Y[1],J[0],J[2]),Y[2]=Math.min(Y[2],J[1],J[3]),Y[3]=Math.max(Y[3],J[1],J[3]);return}this.updateRectMinMax(k,J)}getPathBoundingBox(k=p.PathType.FILL,H=null){const W=[this.minX,this.minY,this.maxX,this.maxY];if(k===p.PathType.STROKE){H||(0,u.unreachable)("Stroke bounding box must include transform.");const Z=u.Util.singularValueDecompose2dScale(H),te=Z[0]*this.lineWidth/2,K=Z[1]*this.lineWidth/2;W[0]-=te,W[1]-=K,W[2]+=te,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,H=null){return u.Util.intersect(this.clipBox,this.getPathBoundingBox(k,H))}}function I(R,k){if(typeof ImageData<"u"&&k instanceof ImageData){R.putImageData(k,0,0);return}const H=k.height,W=k.width,Z=H%m,te=(H-Z)/m,K=Z===0?te:te+1,q=R.createImageData(W,m);let Q=0,ee;const Y=k.data,J=q.data;let re,ae,oe,se;if(k.kind===u.ImageKind.GRAYSCALE_1BPP){const fe=Y.byteLength,pe=new Uint32Array(J.buffer,0,J.byteLength>>2),ge=pe.length,me=W+7>>3,be=4294967295,le=u.FeatureTest.isLittleEndian?4278190080:255;for(re=0;re<K;re++){for(oe=re<te?m:Z,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,re*m)}}else if(k.kind===u.ImageKind.RGBA_32BPP){for(ae=0,se=W*m*4,re=0;re<te;re++)J.set(Y.subarray(Q,Q+se)),Q+=se,R.putImageData(q,0,ae),ae+=m;re<K&&(se=W*Z*4,J.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,re=0;re<K;re++){for(re>=te&&(oe=Z,se=W*oe),ee=0,ae=se;ae--;)J[ee++]=Y[Q++],J[ee++]=Y[Q++],J[ee++]=Y[Q++],J[ee++]=255;R.putImageData(q,0,re*m)}else throw new Error(`bad image kind: ${k.kind}`)}function _(R,k){if(k.bitmap){R.drawImage(k.bitmap,0,0);return}const H=k.height,W=k.width,Z=H%m,te=(H-Z)/m,K=Z===0?te:te+1,q=R.createImageData(W,m);let Q=0;const ee=k.data,Y=q.data;for(let J=0;J<K;J++){const re=J<te?m:Z;({srcPos:Q}=(0,v.convertBlackAndWhiteToRGBA)({src:ee,srcPos:Q,dest:Y,width:W,height:re,nonBlackColor:0})),R.putImageData(q,0,J*m)}}function C(R,k){const H=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const W of H)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,H,W){const Z=R.length;for(let te=3;te<Z;te+=4){const K=R[te];if(K===0)R[te-3]=k,R[te-2]=H,R[te-1]=W;else if(K<255){const q=255-K;R[te-3]=R[te-3]*K+k*q>>8,R[te-2]=R[te-2]*K+H*q>>8,R[te-1]=R[te-1]*K+W*q>>8}}}function L(R,k,H){const W=R.length,Z=1/255;for(let te=3;te<W;te+=4){const K=H?H[R[te]]:R[te];k[te]=k[te]*K*Z|0}}function B(R,k,H){const W=R.length;for(let Z=3;Z<W;Z+=4){const te=R[Z-3]*77+R[Z-2]*152+R[Z-1]*28;k[Z]=H?k[Z]*H[te>>8]>>8:k[Z]*te>>16}}function F(R,k,H,W,Z,te,K,q,Q,ee,Y){const J=!!te,re=J?te[0]:0,ae=J?te[1]:0,oe=J?te[2]:0,se=Z==="Luminosity"?B:L,pe=Math.min(W,Math.ceil(1048576/H));for(let ge=0;ge<W;ge+=pe){const me=Math.min(pe,W-ge),be=R.getImageData(q-ee,ge+(Q-Y),H,me),le=k.getImageData(q,ge+Q,H,me);J&&O(be.data,re,ae,oe),se(be.data,le.data,K),k.putImageData(le,q,ge+Q)}}function D(R,k,H,W){const Z=W[0],te=W[1],K=W[2]-Z,q=W[3]-te;K===0||q===0||(F(k.context,H,K,q,k.subtype,k.backdrop,k.transferMap,Z,te,k.offsetX,k.offsetY),R.save(),R.globalAlpha=1,R.globalCompositeOperation="source-over",R.setTransform(1,0,0,1,0,0),R.drawImage(H.canvas,0,0),R.restore())}function G(R,k){const H=u.Util.singularValueDecompose2dScale(R);H[0]=Math.fround(H[0]),H[1]=Math.fround(H[1]);const W=Math.fround((globalThis.devicePixelRatio||1)*d.PixelsPerInch.PDF_TO_CSS_UNITS);return k!==void 0?k:H[0]<=W||H[1]<=W}const j=["butt","round","square"],V=["miter","round","bevel"],U={},M={};class N{constructor(k,H,W,Z,te,{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=H,this.objs=W,this.canvasFactory=Z,this.filterFactory=te,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,H=null){return typeof k=="string"?k.startsWith("g_")?this.commonObjs.get(k):this.objs.get(k):H}beginDrawing({transform:k,viewport:H,transparency:W=!1,background:Z=null}){const te=this.ctx.canvas.width,K=this.ctx.canvas.height,q=this.ctx.fillStyle;if(this.ctx.fillStyle=Z||"#ffffff",this.ctx.fillRect(0,0,te,K),this.ctx.fillStyle=q,W){const Q=this.cachedCanvases.getCanvas("transparent",te,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(...H.transform),this.viewportScale=H.scale,this.baseTransform=(0,d.getCurrentTransform)(this.ctx)}executeOperatorList(k,H,W,Z){const te=k.argsArray,K=k.fnArray;let q=H||0;const Q=te.length;if(Q===q)return q;const ee=Q-q>y&&typeof W=="function",Y=ee?Date.now()+b:0;let J=0;const re=this.commonObjs,ae=this.objs;let oe;for(;;){if(Z!==void 0&&q===Z.nextBreakPoint)return Z.breakIt(q,W),q;if(oe=K[q],oe!==u.OPS.dependency)this[oe].apply(this,te[q]);else for(const se of te[q]){const fe=se.startsWith("g_")?re:ae;if(!fe.has(se))return fe.get(se,W),q}if(q++,q===Q)return q;if(ee&&++J>y){if(Date.now()>Y)return W(),q;J=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 H of k.values())typeof HTMLCanvasElement<"u"&&H instanceof HTMLCanvasElement&&(H.width=H.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 H=this.ctx.filter;this.ctx.filter=k,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=H}}}_scaleImage(k,H){const W=k.width,Z=k.height;let te=Math.max(Math.hypot(H[0],H[1]),1),K=Math.max(Math.hypot(H[2],H[3]),1),q=W,Q=Z,ee="prescale1",Y,J;for(;te>2&&q>1||K>2&&Q>1;){let re=q,ae=Q;te>2&&q>1&&(re=q>=16384?Math.floor(q/2)-1||1:Math.ceil(q/2),te/=q/re),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,re,ae),J=Y.context,J.clearRect(0,0,re,ae),J.drawImage(k,0,0,q,Q,0,0,re,ae),k=Y.canvas,q=re,Q=ae,ee=ee==="prescale1"?"prescale2":"prescale1"}return{img:k,paintWidth:q,paintHeight:Q}}_createMaskCanvas(k){const H=this.ctx,{width:W,height:Z}=k,te=this.current.fillColor,K=this.current.patternFill,q=(0,d.getCurrentTransform)(H);let Q,ee,Y,J;if((k.bitmap||k.data)&&k.count>1){const he=k.bitmap||k.data.buffer;ee=JSON.stringify(K?q:[q.slice(0,4),te]),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||(J=this.cachedCanvases.getCanvas("maskCanvas",W,Z),_(J.context,k));let re=u.Util.transform(q,[1/W,0,0,-1/Z,0,0]);re=u.Util.transform(re,[1,0,0,1,0,-Z]);const ae=u.Util.applyTransform([0,0],re),oe=u.Util.applyTransform([W,Z],re),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(...re),Y||(Y=this._scaleImage(J.canvas,(0,d.getCurrentTransformInverse)(me)),Y=Y.img,Q&&K&&Q.set(ee,Y)),me.imageSmoothingEnabled=G((0,d.getCurrentTransform)(me),k.interpolate),S(me,Y,0,0,Y.width,Y.height,0,0,W,Z),me.globalCompositeOperation="source-in";const ve=u.Util.transform((0,d.getCurrentTransformInverse)(me),[1,0,0,1,-be,-le]);return me.fillStyle=K?te.getPattern(H,this,ve,p.PathType.FILL):te,me.fillRect(0,0,W,Z),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=V[k]}setMiterLimit(k){this.ctx.miterLimit=k}setDash(k,H){const W=this.ctx;W.setLineDash!==void 0&&(W.setLineDash(k),W.lineDashOffset=H)}setRenderingIntent(k){}setFlatness(k){}setGState(k){for(const[H,W]of k)switch(H){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,H=this.ctx.canvas.height,W="smaskGroupAt"+this.groupLevel,Z=this.cachedCanvases.getCanvas(W,k,H);this.suspendedCtx=this.ctx,this.ctx=Z.context;const te=this.ctx;te.setTransform(...(0,d.getCurrentTransform)(this.suspendedCtx)),C(this.suspendedCtx,te),E(te,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 H=this.current.activeSMask,W=this.suspendedCtx;D(W,H,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,H,W,Z,te,K){this.ctx.transform(k,H,W,Z,te,K),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(k,H,W){const Z=this.ctx,te=this.current;let K=te.x,q=te.y,Q,ee;const Y=(0,d.getCurrentTransform)(Z),J=Y[0]===0&&Y[3]===0||Y[1]===0&&Y[2]===0,re=J?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=H[oe++],q=H[oe++];const fe=H[oe++],pe=H[oe++],ge=K+fe,me=q+pe;Z.moveTo(K,q),fe===0||pe===0?Z.lineTo(ge,me):(Z.lineTo(ge,q),Z.lineTo(ge,me),Z.lineTo(K,me)),J||te.updateRectMinMax(Y,[K,q,ge,me]),Z.closePath();break;case u.OPS.moveTo:K=H[oe++],q=H[oe++],Z.moveTo(K,q),J||te.updatePathMinMax(Y,K,q);break;case u.OPS.lineTo:K=H[oe++],q=H[oe++],Z.lineTo(K,q),J||te.updatePathMinMax(Y,K,q);break;case u.OPS.curveTo:Q=K,ee=q,K=H[oe+4],q=H[oe+5],Z.bezierCurveTo(H[oe],H[oe+1],H[oe+2],H[oe+3],K,q),te.updateCurvePathMinMax(Y,Q,ee,H[oe],H[oe+1],H[oe+2],H[oe+3],K,q,re),oe+=6;break;case u.OPS.curveTo2:Q=K,ee=q,Z.bezierCurveTo(K,q,H[oe],H[oe+1],H[oe+2],H[oe+3]),te.updateCurvePathMinMax(Y,Q,ee,K,q,H[oe],H[oe+1],H[oe+2],H[oe+3],re),K=H[oe+2],q=H[oe+3],oe+=4;break;case u.OPS.curveTo3:Q=K,ee=q,K=H[oe+2],q=H[oe+3],Z.bezierCurveTo(H[oe],H[oe+1],K,q,K,q),te.updateCurvePathMinMax(Y,Q,ee,H[oe],H[oe+1],K,q,K,q,re),oe+=4;break;case u.OPS.closePath:Z.closePath();break}J&&te.updateScalingPathMinMax(Y,re),te.setCurrentPoint(K,q)}closePath(){this.ctx.closePath()}stroke(k=!0){const H=this.ctx,W=this.current.strokeColor;H.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof W=="object"&&W?.getPattern?(H.save(),H.strokeStyle=W.getPattern(H,this,(0,d.getCurrentTransformInverse)(H),p.PathType.STROKE),this.rescaleAndStroke(!1),H.restore()):this.rescaleAndStroke(!0)),k&&this.consumePath(this.current.getClippedPathBoundingBox()),H.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(k=!0){const H=this.ctx,W=this.current.fillColor,Z=this.current.patternFill;let te=!1;Z&&(H.save(),H.fillStyle=W.getPattern(H,this,(0,d.getCurrentTransformInverse)(H),p.PathType.FILL),te=!0);const K=this.current.getClippedPathBoundingBox();this.contentVisible&&K!==null&&(this.pendingEOFill?(H.fill("evenodd"),this.pendingEOFill=!1):H.fill()),te&&H.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,H=this.ctx;if(k===void 0){H.beginPath();return}H.save(),H.beginPath();for(const W of k)H.setTransform(...W.transform),H.translate(W.x,W.y),W.addToPath(H,W.fontSize);H.restore(),H.clip(),H.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,H){const W=this.commonObjs.get(k),Z=this.current;if(!W)throw new Error(`Can't find font for ${k}`);if(Z.fontMatrix=W.fontMatrix||u.FONT_IDENTITY_MATRIX,(Z.fontMatrix[0]===0||Z.fontMatrix[3]===0)&&(0,u.warn)("Invalid font matrix for font "+k),H<0?(H=-H,Z.fontDirection=-1):Z.fontDirection=1,this.current.font=W,this.current.fontSize=H,W.isType3Font)return;const te=W.loadedName||"sans-serif",K=W.systemFontInfo?.css||`"${te}", ${W.fallbackName}`;let q="normal";W.black?q="900":W.bold&&(q="bold");const Q=W.italic?"italic":"normal";let ee=H;H<A?ee=A:H>x&&(ee=x),this.current.fontSizeScale=H/ee,this.ctx.font=`${Q} ${q} ${ee}px ${K}`}setTextRenderingMode(k){this.current.textRenderingMode=k}setTextRise(k){this.current.textRise=k}moveText(k,H){this.current.x=this.current.lineX+=k,this.current.y=this.current.lineY+=H}setLeadingMoveText(k,H){this.setLeading(-H),this.moveText(k,H)}setTextMatrix(k,H,W,Z,te,K){this.current.textMatrix=[k,H,W,Z,te,K],this.current.textMatrixScale=Math.hypot(k,H),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(k,H,W,Z){const te=this.ctx,K=this.current,q=K.font,Q=K.textRenderingMode,ee=K.fontSize/K.fontSizeScale,Y=Q&u.TextRenderingMode.FILL_STROKE_MASK,J=!!(Q&u.TextRenderingMode.ADD_TO_PATH_FLAG),re=K.patternFill&&!q.missingFile;let ae;(q.disableFontFace||J||re)&&(ae=q.getPathGenerator(this.commonObjs,k)),q.disableFontFace||re?(te.save(),te.translate(H,W),te.beginPath(),ae(te,ee),Z&&te.setTransform(...Z),(Y===u.TextRenderingMode.FILL||Y===u.TextRenderingMode.FILL_STROKE)&&te.fill(),(Y===u.TextRenderingMode.STROKE||Y===u.TextRenderingMode.FILL_STROKE)&&te.stroke(),te.restore()):((Y===u.TextRenderingMode.FILL||Y===u.TextRenderingMode.FILL_STROKE)&&te.fillText(k,H,W),(Y===u.TextRenderingMode.STROKE||Y===u.TextRenderingMode.FILL_STROKE)&&te.strokeText(k,H,W)),J&&(this.pendingTextPaths||=[]).push({transform:(0,d.getCurrentTransform)(te),x:H,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 H=k.getImageData(0,0,10,10).data;let W=!1;for(let Z=3;Z<H.length;Z+=4)if(H[Z]>0&&H[Z]<255){W=!0;break}return(0,u.shadow)(this,"isFontSubpixelAAEnabled",W)}showText(k){const H=this.current,W=H.font;if(W.isType3Font)return this.showType3Text(k);const Z=H.fontSize;if(Z===0)return;const te=this.ctx,K=H.fontSizeScale,q=H.charSpacing,Q=H.wordSpacing,ee=H.fontDirection,Y=H.textHScale*ee,J=k.length,re=W.vertical,ae=re?1:-1,oe=W.defaultVMetrics,se=Z*H.fontMatrix[0],fe=H.textRenderingMode===u.TextRenderingMode.FILL&&!W.disableFontFace&&!H.patternFill;te.save(),te.transform(...H.textMatrix),te.translate(H.x,H.y+H.textRise),ee>0?te.scale(Y,-1):te.scale(Y,1);let pe;if(H.patternFill){te.save();const ve=H.fillColor.getPattern(te,this,(0,d.getCurrentTransformInverse)(te),p.PathType.FILL);pe=(0,d.getCurrentTransform)(te),te.restore(),te.fillStyle=ve}let ge=H.lineWidth;const me=H.textMatrixScale;if(me===0||ge===0){const ve=H.textRenderingMode&u.TextRenderingMode.FILL_STROKE_MASK;(ve===u.TextRenderingMode.STROKE||ve===u.TextRenderingMode.FILL_STROKE)&&(ge=this.getSinglePixelWidth())}else ge/=me;if(K!==1&&(te.scale(K,K),ge/=K),te.lineWidth=ge,W.isInvalidPDFjsFont){const ve=[];let he=0;for(const ye of k)ve.push(ye.unicode),he+=ye.width;te.fillText(ve.join(""),0,0),H.x+=he*se*Y,te.restore(),this.compose();return}let be=0,le;for(le=0;le<J;++le){const ve=k[le];if(typeof ve=="number"){be+=ae*ve*Z/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(re){const ce=ve.vmetric||oe,Ce=-(ve.vmetric?ce[1]:Ae*.5)*se,_e=ce[2]*se;Ae=ce?-ce[0]:Ae,we=Ce/K,$e=(be+_e)/K}else we=be/K,$e=0;if(W.remeasure&&Ae>0){const ce=te.measureText(Ee).width*1e3/Z*K;if(Ae<ce&&this.isFontSubpixelAAEnabled){const Ce=Ae/ce;he=!0,te.save(),te.scale(Ce,1),we/=Ce}else Ae!==ce&&(we+=(Ae-ce)/2e3*Z/K)}if(this.contentVisible&&(ve.isInFont||W.missingFile)){if(fe&&!xe)te.fillText(Ee,we,$e);else if(this.paintChar(Ee,we,$e,pe),xe){const ce=we+Z*xe.offset.x/K,Ce=$e-Z*xe.offset.y/K;this.paintChar(xe.fontChar,ce,Ce,pe)}}const ue=re?Ae*se-ye*ee:Ae*se+ye*ee;be+=ue,he&&te.restore()}re?H.y-=be:H.x+=be*Y,te.restore(),this.compose()}showType3Text(k){const H=this.ctx,W=this.current,Z=W.font,te=W.fontSize,K=W.fontDirection,q=Z.vertical?1:-1,Q=W.charSpacing,ee=W.wordSpacing,Y=W.textHScale*K,J=W.fontMatrix||u.FONT_IDENTITY_MATRIX,re=k.length,ae=W.textRenderingMode===u.TextRenderingMode.INVISIBLE;let oe,se,fe,pe;if(!(ae||te===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,H.save(),H.transform(...W.textMatrix),H.translate(W.x,W.y),H.scale(Y,K),oe=0;oe<re;++oe){if(se=k[oe],typeof se=="number"){pe=q*se*te/1e3,this.ctx.translate(pe,0),W.x+=pe*Y;continue}const ge=(se.isSpace?ee:0)+Q,me=Z.charProcOperatorList[se.operatorListId];if(!me){(0,u.warn)(`Type3 character "${se.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=se,this.save(),H.scale(te,te),H.transform(...J),this.executeOperatorList(me),this.restore()),fe=u.Util.applyTransform([se.width,0],J)[0]*te+ge,H.translate(fe,0),W.x+=fe*Y}H.restore(),this.processingType3=null}}setCharWidth(k,H){}setCharWidthAndBounds(k,H,W,Z,te,K){this.ctx.rect(W,Z,te-W,K-Z),this.ctx.clip(),this.endPath()}getColorN_Pattern(k){let H;if(k[0]==="TilingPattern"){const W=k[1],Z=this.baseTransform||(0,d.getCurrentTransform)(this.ctx),te={createCanvasGraphics:K=>new N(K,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};H=new p.TilingPattern(k,W,this.ctx,te,Z)}else H=this._getPattern(k[1],k[2]);return H}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(k,H,W){const Z=u.Util.makeHexColor(k,H,W);this.ctx.strokeStyle=Z,this.current.strokeColor=Z}setFillRGBColor(k,H,W){const Z=u.Util.makeHexColor(k,H,W);this.ctx.fillStyle=Z,this.current.fillColor=Z,this.current.patternFill=!1}_getPattern(k,H=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)),H&&(W.matrix=H),W}shadingFill(k){if(!this.contentVisible)return;const H=this.ctx;this.save();const W=this._getPattern(k);H.fillStyle=W.getPattern(H,this,(0,d.getCurrentTransformInverse)(H),p.PathType.SHADING);const Z=(0,d.getCurrentTransformInverse)(H);if(Z){const{width:te,height:K}=H.canvas,[q,Q,ee,Y]=u.Util.getAxialAlignedBoundingBox([0,0,te,K],Z);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,H){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),H)){const W=H[2]-H[0],Z=H[3]-H[1];this.ctx.rect(H[0],H[1],W,Z),this.current.updateRectMinMax((0,d.getCurrentTransform)(this.ctx),H),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 H=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)(H);if(k.matrix&&H.transform(...k.matrix),!k.bbox)throw new Error("Bounding box is required.");let Z=u.Util.getAxialAlignedBoundingBox(k.bbox,(0,d.getCurrentTransform)(H));const te=[0,0,H.canvas.width,H.canvas.height];Z=u.Util.intersect(Z,te)||[0,0,0,0];const K=Math.floor(Z[0]),q=Math.floor(Z[1]);let Q=Math.max(Math.ceil(Z[2])-K,1),ee=Math.max(Math.ceil(Z[3])-q,1),Y=1,J=1;Q>g&&(Y=Q/g,Q=g),ee>g&&(J=ee/g,ee=g),this.current.startNewPathAndClipBox([0,0,Q,ee]);let re="groupAt"+this.groupLevel;k.smask&&(re+="_smask_"+this.smaskCounter++%2);const ae=this.cachedCanvases.getCanvas(re,Q,ee),oe=ae.context;oe.scale(1/Y,1/J),oe.translate(-K,-q),oe.transform(...W),k.smask?this.smaskStack.push({canvas:ae.canvas,context:oe,offsetX:K,offsetY:q,scaleX:Y,scaleY:J,subtype:k.smask.subtype,backdrop:k.smask.backdrop,transferMap:k.smask.transferMap||null,startTransformInverse:null}):(H.setTransform(1,0,0,1,0,0),H.translate(K,q),H.scale(Y,J),H.save()),C(H,oe),this.ctx=oe,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(H),this.groupLevel++}endGroup(k){if(!this.contentVisible)return;this.groupLevel--;const H=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 Z=(0,d.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...Z);const te=u.Util.getAxialAlignedBoundingBox([0,0,H.canvas.width,H.canvas.height],Z);this.ctx.drawImage(H.canvas,0,0),this.ctx.restore(),this.compose(te)}}beginAnnotation(k,H,W,Z,te){if(this.#e(),P(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(H)&&H.length===4){const K=H[2]-H[0],q=H[3]-H[1];if(te&&this.annotationCanvasMap){W=W.slice(),W[4]-=H[0],W[5]-=H[1],H=H.slice(),H[0]=H[1]=0,H[2]=K,H[3]=q;const[Q,ee]=u.Util.singularValueDecompose2dScale((0,d.getCurrentTransform)(this.ctx)),{viewportScale:Y}=this,J=Math.ceil(K*this.outputScaleX*Y),re=Math.ceil(q*this.outputScaleY*Y);this.annotationCanvas=this.canvasFactory.create(J,re);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(H[0],H[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(...Z)}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 H=k.count;k=this.getObject(k.data,k),k.count=H;const W=this.ctx,Z=this.processingType3;if(Z&&(Z.compiled===void 0&&(Z.compiled=$(k)),Z.compiled)){Z.compiled(W);return}const te=this._createMaskCanvas(k),K=te.canvas;W.save(),W.setTransform(1,0,0,1,0,0),W.drawImage(K,te.offsetX,te.offsetY),W.restore(),this.compose()}paintImageMaskXObjectRepeat(k,H,W=0,Z=0,te,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(H,W,Z,te,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,J=K.length;Y<J;Y+=2){const re=u.Util.transform(Q,[H,W,Z,te,K[Y],K[Y+1]]),[ae,oe]=u.Util.applyTransform([0,0],re);q.drawImage(ee.canvas,ae,oe)}q.restore(),this.compose()}paintImageMaskXObjectGroup(k){if(!this.contentVisible)return;const H=this.ctx,W=this.current.fillColor,Z=this.current.patternFill;for(const te of k){const{data:K,width:q,height:Q,transform:ee}=te,Y=this.cachedCanvases.getCanvas("maskCanvas",q,Q),J=Y.context;J.save();const re=this.getObject(K,te);_(J,re),J.globalCompositeOperation="source-in",J.fillStyle=Z?W.getPattern(J,this,(0,d.getCurrentTransformInverse)(H),p.PathType.FILL):W,J.fillRect(0,0,q,Q),J.restore(),H.save(),H.transform(...ee),H.scale(1,-1),S(H,Y.canvas,0,0,q,Q,0,-1,1,1),H.restore()}this.compose()}paintImageXObject(k){if(!this.contentVisible)return;const H=this.getObject(k);if(!H){(0,u.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(H)}paintImageXObjectRepeat(k,H,W,Z){if(!this.contentVisible)return;const te=this.getObject(k);if(!te){(0,u.warn)("Dependent image isn't ready yet");return}const K=te.width,q=te.height,Q=[];for(let ee=0,Y=Z.length;ee<Y;ee+=2)Q.push({transform:[H,0,0,W,Z[ee],Z[ee+1]],x:0,y:0,w:K,h:q});this.paintInlineImageXObjectGroup(te,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:H,width:W,height:Z}=k,te=this.cachedCanvases.getCanvas("inlineImage",W,Z),K=te.context;return K.filter=this.current.transferMaps,K.drawImage(H,0,0),K.filter="none",te.canvas}paintInlineImageXObject(k){if(!this.contentVisible)return;const H=k.width,W=k.height,Z=this.ctx;if(this.save(),!u.isNodeJS){const{filter:q}=Z;q!=="none"&&q!==""&&(Z.filter="none")}Z.scale(1/H,-1/W);let te;if(k.bitmap)te=this.applyTransferMapsToBitmap(k);else if(typeof HTMLElement=="function"&&k instanceof HTMLElement||!k.data)te=k;else{const Q=this.cachedCanvases.getCanvas("inlineImage",H,W).context;I(Q,k),te=this.applyTransferMapsToCanvas(Q)}const K=this._scaleImage(te,(0,d.getCurrentTransformInverse)(Z));Z.imageSmoothingEnabled=G((0,d.getCurrentTransform)(Z),k.interpolate),S(Z,K.img,0,0,K.paintWidth,K.paintHeight,0,-W,H,W),this.compose(),this.restore()}paintInlineImageXObjectGroup(k,H){if(!this.contentVisible)return;const W=this.ctx;let Z;if(k.bitmap)Z=k.bitmap;else{const te=k.width,K=k.height,Q=this.cachedCanvases.getCanvas("inlineImage",te,K).context;I(Q,k),Z=this.applyTransferMapsToCanvas(Q)}for(const te of H)W.save(),W.transform(...te.transform),W.scale(1,-1),S(W,Z,te.x,te.y,te.w,te.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,H){}beginMarkedContent(k){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(k,H){k==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(H)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(k){const H=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(k);const W=this.ctx;this.pendingClip&&(H||(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 H=Math.abs(k[0]*k[3]-k[2]*k[1]),W=Math.hypot(k[0],k[2]),Z=Math.hypot(k[1],k[3]);this._cachedGetSinglePixelWidth=Math.max(W,Z)/H}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:k}=this.current,{a:H,b:W,c:Z,d:te}=this.ctx.getTransform();let K,q;if(W===0&&Z===0){const Q=Math.abs(H),ee=Math.abs(te);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,J=ee*k;K=Y<1?1/Y:1,q=J<1?1/J:1}}else{const Q=Math.abs(H*te-W*Z),ee=Math.hypot(H,W),Y=Math.hypot(Z,te);if(k===0)K=Y/Q,q=ee/Q;else{const J=k*Q;K=Y>J?Y/J:1,q=ee>J?ee/J:1}}this._cachedScaleForStroking[0]=K,this._cachedScaleForStroking[1]=q}return this._cachedScaleForStroking}rescaleAndStroke(k){const{ctx:H}=this,{lineWidth:W}=this.current,[Z,te]=this.getScaleForStroking();if(H.lineWidth=W||1,Z===1&&te===1){H.stroke();return}const K=H.getLineDash();if(k&&H.save(),H.scale(Z,te),K.length>0){const q=Math.max(Z,te);H.setLineDash(K.map(Q=>Q/q)),H.lineDashOffset/=q}H.stroke(),k&&H.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],I=$[3]-$[1],_=new Path2D;_.rect($[0],$[1],T,I),S.clip(_)}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 I of this._colorStops)T.addColorStop(I[0],I[1]);return T}getPattern($,T,I,_){let C;if(_===p.STROKE||_===p.FILL){const P=T.current.getClippedPathBoundingBox(_,(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]),I=u.Util.transform(I,[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(I);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 G;L[T+1]>L[I+1]&&(G=T,T=I,I=G,G=C,C=P,P=G),L[I+1]>L[_+1]&&(G=I,I=_,_=G,G=P,P=O,O=G),L[T+1]>L[I+1]&&(G=T,T=I,I=G,G=C,C=P,P=G);const j=(L[T]+$.offsetX)*$.scaleX,V=(L[T+1]+$.offsetY)*$.scaleY,U=(L[I]+$.offsetX)*$.scaleX,M=(L[I+1]+$.offsetY)*$.scaleY,N=(L[_]+$.offsetX)*$.scaleX,R=(L[_+1]+$.offsetY)*$.scaleY;if(V>=R)return;const k=B[C],H=B[C+1],W=B[C+2],Z=B[P],te=B[P+1],K=B[P+2],q=B[O],Q=B[O+1],ee=B[O+2],Y=Math.round(V),J=Math.round(R);let re,ae,oe,se,fe,pe,ge,me;for(let be=Y;be<=J;be++){if(be<M){const Ee=be<V?0:(V-be)/(V-M);re=j-(j-U)*Ee,ae=k-(k-Z)*Ee,oe=H-(H-te)*Ee,se=W-(W-K)*Ee}else{let Ee;be>R?Ee=1:M===R?Ee=0:Ee=(M-be)/(M-R),re=U-(U-N)*Ee,ae=Z-(Z-q)*Ee,oe=te-(te-Q)*Ee,se=K-(K-ee)*Ee}let le;be<V?le=0:be>R?le=1:le=(V-be)/(V-R),fe=j-(j-N)*le,pe=k-(k-q)*le,ge=H-(H-Q)*le,me=W-(W-ee)*le;const ve=Math.round(Math.min(re,fe)),he=Math.round(Math.max(re,fe));let ye=D*be+ve*4;for(let Ee=ve;Ee<=he;Ee++)le=(re-Ee)/(re-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 I=$.coords,_=$.colors;let C,P;switch($.type){case"lattice":const O=$.verticesPerRow,L=Math.floor(I.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,I[F],I[F+1],I[F+O],_[F],_[F+1],_[F+O]),g(S,T,I[F+O+1],I[F+1],I[F+O],_[F+O+1],_[F+1],_[F+O])}break;case"triangles":for(C=0,P=I.length;C<P;C+=3)g(S,T,I[C],I[C+1],I[C+2],_[C],_[C+1],_[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,I){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),G=Math.min(Math.ceil(Math.abs(F*$[1]*1.1)),3e3),j=B/D,V=F/G,U={coords:this._coords,colors:this._colors,offsetX:-O,offsetY:-L,scaleX:1/j,scaleY:1/V},M=D+4,N=G+4,R=I.getCanvas("mesh",M,N,!1),k=R.context,H=k.createImageData(D,G);if(T){const Z=H.data;for(let te=0,K=Z.length;te<K;te+=4)Z[te]=T[0],Z[te+1]=T[1],Z[te+2]=T[2],Z[te+3]=255}for(const Z of this._figures)b(H,Z,U);return k.putImageData(H,2,2),{canvas:R.canvas,offsetX:O-2*j,offsetY:L-2*V,scaleX:j,scaleY:V}}getPattern($,T,I,_){v($,this._bbox);let C;if(_===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,_===p.SHADING?null:this._background,T.cachedCanvases);return _!==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=I,this.canvasGraphicsFactory=_,this.baseTransform=C}createPatternCanvas($){const T=this.operatorList,I=this.bbox,_=this.xstep,C=this.ystep,P=this.paintType,O=this.tilingType,L=this.color,B=this.canvasGraphicsFactory;(0,u.info)("TilingType: "+O);const F=I[0],D=I[1],G=I[2],j=I[3],V=u.Util.singularValueDecompose2dScale(this.matrix),U=u.Util.singularValueDecompose2dScale(this.baseTransform),M=[V[0]*U[0],V[1]*U[1]],N=this.getSizeAndScale(_,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),H=k.context,W=B.createCanvasGraphics(H);W.groupLevel=$.groupLevel,this.setFillAndStrokeStyleToContext(W,P,L);let Z=F,te=D,K=G,q=j;return F<0&&(Z=0,K+=Math.abs(F)),D<0&&(te=0,q+=Math.abs(D)),H.translate(-(N.scale*Z),-(R.scale*te)),W.transform(N.scale,0,0,R.scale,0,0),H.save(),this.clipBbox(W,Z,te,K,q),W.baseTransform=(0,d.getCurrentTransform)(W.ctx),W.executeOperatorList(T),W.endDrawing(),{canvas:k.canvas,scaleX:N.scale,scaleY:R.scale,offsetX:Z,offsetY:te}}getSizeAndScale($,T,I){$=Math.abs($);const _=Math.max(w.MAX_PATTERN_SIZE,T);let C=Math.ceil($*I);return C>=_?C=_:I=C/$,{scale:I,size:C}}clipBbox($,T,I,_,C){const P=_-T,O=C-I;$.ctx.rect(T,I,P,O),$.current.updateRectMinMax((0,d.getCurrentTransform)($.ctx),[T,I,_,C]),$.clip(),$.endPath()}setFillAndStrokeStyleToContext($,T,I){const _=$.ctx,C=$.current;switch(T){case E.COLORED:const P=this.ctx;_.fillStyle=P.fillStyle,_.strokeStyle=P.strokeStyle,C.fillColor=P.fillStyle,C.strokeColor=P.strokeStyle;break;case E.UNCOLORED:const O=u.Util.makeHexColor(I[0],I[1],I[2]);_.fillStyle=O,_.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,I=y&7,_=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<_?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(I===0)continue;const O=g<_?x[g++]:255;for(let L=0;L<I;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],I=S[E+2];b[y]=$|4278190080,b[y+1]=$>>>24|T<<8|4278190080,b[y+2]=T>>>16|I<<16|4278190080,b[y+3]=I>>>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],I=S[E+2];b[y]=$|255,b[y+1]=$<<24|T>>>8|255,b[y+2]=T<<16|I>>>16|255,b[y+3]=I<<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,I){if(this.isCancelled)return;const _=this.desiredSize;this.desiredSize-=T,_>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:$},I)},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=I=>w.headers.get(I),{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[,_,C,P]=$;if(_=parseInt(_,10),_ in S){if(_===0)break;continue}S[_]=[C,P]}const I=[];for(let _=0;_<S.length&&_ in S;++_){let[C,P]=S[_];P=f(P),C&&(P=unescape(P),_===0&&(P=m(P))),I.push(P)}return I.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),I=w.slice(S+1).replace(/^[^']*'/,"");return g($,I)}function E(w){return!w.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(w)?w:w.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(S,$,T,I){if(T==="q"||T==="Q")return I=I.replaceAll("_"," "),I=I.replaceAll(/=([0-9a-fA-F]{2})/g,function(_,C){return String.fromCharCode(parseInt(C,16))}),g($,I);try{I=atob(I)}catch{}return g($,I)})}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 I=A(S);if($===v){const _=S.getResponseHeader("Content-Range"),C=/bytes (\d+)-(\d+)\/(\d+)/.exec(_);w.onDone({begin:parseInt(C[1],10),chunk:I})}else I?w.onDone({begin:0,chunk:I}):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 I=P=>this._readableStream.headers[P.toLowerCase()],{allowRangeRequests:_,suggestedLength:C}=(0,d.validateRangeRequestCapabilities)({getResponseHeader:I,isHttp:S.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=_,this._contentLength=C||this._contentLength,this._filename=(0,d.extractFilenameFromHeader)(I)};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 _ in S.httpHeaders){const C=S.httpHeaders[_];C!==void 0&&(this._httpHeaders[_]=C)}this._httpHeaders.Range=`bytes=${$}-${T-1}`;const I=_=>{if(_.statusCode===404){const C=new u.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=C;return}this._setReadableStream(_)};if(this._request=null,this._url.protocol==="http:"){const _=require$$5;this._request=_.request(b(this._url,this._httpHeaders),I)}else{const _=require$$5;this._request=_.request(b(this._url,this._httpHeaders),I)}this._request.on("error",_=>{this._storedError=_}),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(I){I.code==="ENOENT"&&(I=new u.MissingPDFException(`Missing PDF "${$}".`)),this._storedError=I,this._headersCapability.reject(I);return}this._contentLength=_.size,this._setReadableStream(T.createReadStream($)),this._headersCapability.resolve()})}}class E extends g{constructor(S,$,T){super(S);let I=decodeURIComponent(this._url.path);p.test(this._url.href)&&(I=I.replace(/^\//,""));const _=require$$5;this._setReadableStream(_.createReadStream(I,{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(_,C="",P=!1){if(URL.createObjectURL&&typeof Blob<"u"&&!P)return URL.createObjectURL(new Blob([_],{type:C}));const O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let L=`data:${C};base64,`;for(let B=0,F=_.length;B<F;B+=3){const D=_[B]&255,G=_[B+1]&255,j=_[B+2]&255,V=D>>2,U=(D&3)<<4|G>>4,M=B+1<F?(G&15)<<2|j>>6:64,N=B+2<F?j&63:64;L+=O[V]+O[U]+O[M]+O[N]}return L},y=(function(){const _=new Uint8Array([137,80,78,71,13,10,26,10]),C=12,P=new Int32Array(256);for(let j=0;j<256;j++){let V=j;for(let U=0;U<8;U++)V=V&1?3988292384^V>>1&2147483647:V>>1&2147483647;P[j]=V}function O(j,V,U){let M=-1;for(let N=V;N<U;N++){const R=(M^j[N])&255,k=P[R];M=M>>>8^k}return M^-1}function L(j,V,U,M){let N=M;const R=V.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(V,N),N+=V.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,V,U){let M=1,N=0;for(let R=V;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 V=parseInt(process.versions.node)>=8?j:Buffer.from(j),U=require$$5.deflateSync(V,{level:9});return U instanceof Uint8Array?U:new Uint8Array(U)}catch(V){(0,d.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+V)}return D(j)}function D(j){let V=j.length;const U=65535,M=Math.ceil(V/U),N=new Uint8Array(2+V+M*5+4);let R=0;N[R++]=120,N[R++]=156;let k=0;for(;V>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,V-=U;N[R++]=1,N[R++]=V&255,N[R++]=V>>8&255,N[R++]=~V&65535&255,N[R++]=(~V&65535)>>8&255,N.set(j.subarray(k),R),R+=j.length-k;const H=B(j,0,j.length);return N[R++]=H>>24&255,N[R++]=H>>16&255,N[R++]=H>>8&255,N[R++]=H&255,N}function G(j,V,U,M){const N=j.width,R=j.height;let k,H,W;const Z=j.data;switch(V){case d.ImageKind.GRAYSCALE_1BPP:H=0,k=1,W=N+7>>3;break;case d.ImageKind.RGB_24BPP:H=2,k=8,W=N*3;break;case d.ImageKind.RGBA_32BPP:H=6,k=8,W=N*4;break;default:throw new Error("invalid format")}const te=new Uint8Array((1+W)*R);let K=0,q=0;for(let ae=0;ae<R;++ae)te[K++]=0,te.set(Z.subarray(q,q+W),K),q+=W,K+=W;if(V===d.ImageKind.GRAYSCALE_1BPP&&M){K=0;for(let ae=0;ae<R;ae++){K++;for(let oe=0;oe<W;oe++)te[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,H,0,0,0]),ee=F(te),Y=_.length+C*3+Q.length+ee.length,J=new Uint8Array(Y);let re=0;return J.set(_,re),re+=_.length,L("IHDR",Q,J,re),re+=C+Q.length,L("IDATA",ee,J,re),re+=C+ee.length,L("IEND",new Uint8Array(0),J,re),b(J,"image/png",U)}return function(V,U,M){const N=V.kind===void 0?d.ImageKind.GRAYSCALE_1BPP:V.kind;return G(V,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(_){let C=[];const P=[];for(const O of _){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(_){if(Number.isInteger(_))return _.toString();const C=_.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(_){if(_[4]===0&&_[5]===0){if(_[1]===0&&_[2]===0)return _[0]===1&&_[3]===1?"":`scale(${E(_[0])} ${E(_[3])})`;if(_[0]===_[3]&&_[1]===-_[2]){const C=Math.acos(_[0])*180/Math.PI;return`rotate(${E(C)})`}}else if(_[0]===1&&_[1]===0&&_[2]===0&&_[3]===1)return`translate(${E(_[4])} ${E(_[5])})`;return`matrix(${E(_[0])} ${E(_[1])} ${E(_[2])} ${E(_[3])} ${E(_[4])} ${E(_[5])})`}let S=0,$=0,T=0;class I{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,G=new Promise(j=>{D.get(F,j)});this.current.dependencies.push(G)}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 G=L[F];B.push({fnId:G,fn:P[G],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,G=P.fontDirection,j=P.textHScale*G,V=O.vertical,U=V?1:-1,M=O.defaultVMetrics,N=L*P.fontMatrix[0];let R=0;for(const W of C){if(W===null){R+=G*D;continue}else if(typeof W=="number"){R+=U*W*L/1e3;continue}const Z=(W.isSpace?D:0)+F,te=W.fontChar;let K,q,Q=W.width;if(V){let Y;const J=W.vmetric||M;Y=W.vmetric?J[1]:Q*.5,Y=-Y*N;const re=J[2]*N;Q=J?-J[0]:Q,K=Y/B,q=(R+re)/B}else K=R/B,q=0;(W.isInFont||O.missingFile)&&(P.xcoords.push(P.x+K),V&&P.ycoords.push(-P.y+q),P.tspan.textContent+=te);const ee=V?Q*N-Z*G:Q*N+Z*G;R+=ee}P.tspan.setAttributeNS(null,"x",P.xcoords.map(E).join(" ")),V?P.tspan.setAttributeNS(null,"y",P.ycoords.map(E).join(" ")):P.tspan.setAttributeNS(null,"y",E(-P.y)),V?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 H=P.textMatrix;P.textRise!==0&&(H=H.slice(),H[5]+=P.textRise),P.txtElement.setAttributeNS(null,"transform",`${w(H)} 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}); }
43
43
  `}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,G]=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",G-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,G]=C[4],j=C[5],V=C[6],U=C[7],M=`shading${T++}`,[N,R,k,H]=d.Util.normalizeRect([...d.Util.applyTransform([B,F],L),...d.Util.applyTransform([D,G],L)]),[W,Z]=d.Util.singularValueDecompose2dScale(L),te=j*W,K=V*Z,q=this.svgFactory.createElement("svg:pattern");q.setAttributeNS(null,"id",M),q.setAttributeNS(null,"patternUnits","userSpaceOnUse"),q.setAttributeNS(null,"width",te),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,J=this.current.strokeColor,re=this.svgFactory.create(k-N,H-R);if(this.svg=re,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=J,q.append(re.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],G=C[5],j=C[6],V=C[7];L=this.svgFactory.createElement("svg:radialGradient"),L.setAttributeNS(null,"id",P),L.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),L.setAttributeNS(null,"cx",G[0]),L.setAttributeNS(null,"cy",G[1]),L.setAttributeNS(null,"r",V),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 G of C)switch(G|0){case d.OPS.rectangle:L=P[D++],B=P[D++];const j=P[D++],V=P[D++],U=L+j,M=B+V;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 G=this.svgFactory.createElement("svg:rect");G.setAttributeNS(null,"x","0"),G.setAttributeNS(null,"y","0"),G.setAttributeNS(null,"width",E(L)),G.setAttributeNS(null,"height",E(B)),G.setAttributeNS(null,"fill",F),G.setAttributeNS(null,"mask",`url(#${O.maskId})`),this.defs.append(D),this._ensureTransformGroup().append(G),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=I}),((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 I;if(T&&u.FeatureTest.isOffscreenCanvasSupported)I=new OffscreenCanvas($,$).getContext("2d",{alpha:!1});else{const _=document.createElement("canvas");_.width=_.height=$,I=_.getContext("2d",{alpha:!1})}return I}function b($,T){const I=x.get($);if(I)return I;const _=g(v,T);_.font=`${v}px ${$}`;const C=_.measureText("");let P=C.fontBoundingBoxAscent,O=Math.abs(C.fontBoundingBoxDescent);if(P){const B=P/(P+O);return x.set($,B),_.canvas.width=_.canvas.height=0,B}_.strokeStyle="red",_.clearRect(0,0,v,v),_.strokeText("g",0,0);let L=_.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}_.clearRect(0,0,v,v),_.strokeText("A",0,v),L=_.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(_.canvas.width=_.canvas.height=0,P){const B=P/(P+O);return x.set($,B),B}return x.set($,A),A}function y($,T,I){const _=document.createElement("span"),C={angle:0,canvasWidth:0,hasText:T.str!=="",hasEOL:T.hasEOL,fontSize:0};$._textDivs.push(_);const P=u.Util.transform($._transform,T.transform);let O=Math.atan2(P[1],P[0]);const L=I[T.fontName];L.vertical&&(O+=Math.PI/2);const B=Math.hypot(P[2],P[3]),F=B*b(L.fontFamily,$._isOffscreenCanvasSupported);let D,G;O===0?(D=P[4],G=P[5]-F):(D=P[4]+F*Math.sin(O),G=P[5]-F*Math.cos(O));const j="calc(var(--scale-factor)*",V=_.style;$._container===$._rootContainer?(V.left=`${(100*D/$._pageWidth).toFixed(2)}%`,V.top=`${(100*G/$._pageHeight).toFixed(2)}%`):(V.left=`${j}${D.toFixed(2)}px)`,V.top=`${j}${G.toFixed(2)}px)`),V.fontSize=`${j}${B.toFixed(2)}px)`,V.fontFamily=L.fontFamily,C.fontSize=B,_.setAttribute("role","presentation"),_.textContent=T.str,_.dir=T.dir,$._fontInspectorEnabled&&(_.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(_,C),$._isReadableStream&&$._layoutText(_)}function f($){const{div:T,scale:I,properties:_,ctx:C,prevFontSize:P,prevFontFamily:O}=$,{style:L}=T;let B="";if(_.canvasWidth!==0&&_.hasText){const{fontFamily:F}=L,{canvasWidth:D,fontSize:G}=_;(P!==G||O!==F)&&(C.font=`${G*I}px ${F}`,$.prevFontSize=G,$.prevFontFamily=F);const{width:j}=C.measureText(T.textContent);j>0&&(B=`scaleX(${D*I/j})`)}_.angle!==0&&(B=`rotate(${_.angle}deg) ${B}`),B.length>0&&(L.transform=B)}function m($){if($._canceled)return;const T=$._textDivs,I=$._capability;if(T.length>p){I.resolve();return}if(!$._isReadableStream)for(const C of T)$._layoutText(C);I.resolve()}class E{constructor({textContentSource:T,container:I,viewport:_,textDivs:C,textDivProperties:P,textContentItemsStr:O,isOffscreenCanvasSupported:L}){this._textContentSource=T,this._isReadableStream=T instanceof ReadableStream,this._container=this._rootContainer=I,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:_.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:g(0,L)};const{pageWidth:B,pageHeight:F,pageX:D,pageY:G}=_.rawDims;this._transform=[1,0,0,-1,-D,G+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,I){for(const _ of T){if(_.str===void 0){if(_.type==="beginMarkedContentProps"||_.type==="beginMarkedContent"){const C=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),_.id!==null&&this._container.setAttribute("id",`${_.id}`),C.append(this._container)}else _.type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(_.str),y(this,_,I)}}_layoutText(T){const I=this._layoutTextParams.properties=this._textDivProperties.get(T);if(this._layoutTextParams.div=T,f(this._layoutTextParams),I.hasText&&this._container.append(T),I.hasEOL){const _=document.createElement("br");_.setAttribute("role","presentation"),this._container.append(_)}}_render(){const T=new u.PromiseCapability;let I=Object.create(null);if(this._isReadableStream){const _=()=>{this._reader.read().then(({value:C,done:P})=>{if(P){T.resolve();return}Object.assign(I,C.styles),this._processItems(C.items,I),_()},T.reject)};this._reader=this._textContentSource.getReader(),_()}else if(this._textContentSource){const{items:_,styles:C}=this._textContentSource;this._processItems(_,C),T.resolve()}else throw new Error('No "textContentSource" parameter specified.');T.promise.then(()=>{I=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=_.getPropertyValue("visibility"),P=parseFloat(_.getPropertyValue("--scale-factor"));C==="visible"&&(!P||Math.abs(P-I.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:I,textDivProperties:_,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 I)F.properties=_.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 I of T)I.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),I=(w+$)/2-y,_=(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(`
@@ -548,7 +548,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
548
548
  `]:{zIndex:10,width:u,margin:`0 ${unit$1(a.marginXXS)}`,fontSize:u,cursor:"pointer",transition:`all ${a.motionDurationSlow}`,color:d,"&:hover":{color:d},svg:{verticalAlign:"baseline"}}},[`${A}-thumbnail, ${A}-thumbnail img`]:{position:"static",display:"block",width:"100%",height:"100%",objectFit:"contain"},[`${A}-name`]:{display:"none",textAlign:"center"},[`${A}-file + ${A}-name`]:{position:"absolute",bottom:a.margin,display:"block",width:`calc(100% - ${unit$1(p(a.paddingXS).mul(2).equal())})`},[`${A}-uploading`]:{[`&${A}`]:{backgroundColor:a.colorFillAlter},[`&::before, ${c}-eye, ${c}-download, ${c}-delete`]:{display:"none"}},[`${A}-progress`]:{bottom:a.marginXL,width:`calc(100% - ${unit$1(p(a.paddingXS).mul(2).equal())})`,paddingInlineStart:0}}}),[`${s}-wrapper${s}-picture-circle-wrapper`]:{[`${s}${s}-select`]:{borderRadius:"50%"}}}},genRtlStyle=a=>{const{componentCls:s}=a;return{[`${s}-rtl`]:{direction:"rtl"}}},genBaseStyle=a=>{const{componentCls:s,colorTextDisabled:c}=a;return{[`${s}-wrapper`]:Object.assign(Object.assign({},resetComponent(a)),{[s]:{outline:0,"input[type='file']":{cursor:"pointer"}},[`${s}-select`]:{display:"inline-block"},[`${s}-hidden`]:{display:"none"},[`${s}-disabled`]:{color:c,cursor:"not-allowed"}})}},prepareComponentToken=a=>({actionsColor:a.colorIcon,pictureCardSize:a.controlHeightLG*2.55}),useStyle=genStyleHooks("Upload",a=>{const{fontSizeHeading3:s,fontHeight:c,lineWidth:u,pictureCardSize:d,calc:p}=a,v=merge(a,{uploadThumbnailSize:p(s).mul(2).equal(),uploadProgressOffset:p(p(c).div(2)).add(u).equal(),uploadPicCardSize:d});return[genBaseStyle(v),genDraggerStyle(v),genPictureStyle(v),genPictureCardStyle(v),genListStyle(v),genMotionStyle(v),genRtlStyle(v),genCollapseMotion(v)]},prepareComponentToken);var FileTwoTone$1={icon:function a(s,c){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M534 352V136H232v752h560V394H576a42 42 0 01-42-42z",fill:c}},{tag:"path",attrs:{d:"M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM602 137.8L790.2 326H602V137.8zM792 888H232V136h302v216a42 42 0 0042 42h216v494z",fill:s}}]}},name:"file",theme:"twotone"},FileTwoTone=function a(s,c){return reactExports.createElement(Icon$4,_extends$3({},s,{ref:c,icon:FileTwoTone$1}))},RefIcon$3=reactExports.forwardRef(FileTwoTone),PaperClipOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M779.3 196.6c-94.2-94.2-247.6-94.2-341.7 0l-261 260.8c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l261-260.8c32.4-32.4 75.5-50.2 121.3-50.2s88.9 17.8 121.2 50.2c32.4 32.4 50.2 75.5 50.2 121.2 0 45.8-17.8 88.8-50.2 121.2l-266 265.9-43.1 43.1c-40.3 40.3-105.8 40.3-146.1 0-19.5-19.5-30.2-45.4-30.2-73s10.7-53.5 30.2-73l263.9-263.8c6.7-6.6 15.5-10.3 24.9-10.3h.1c9.4 0 18.1 3.7 24.7 10.3 6.7 6.7 10.3 15.5 10.3 24.9 0 9.3-3.7 18.1-10.3 24.7L372.4 653c-1.7 1.7-2.6 4-2.6 6.4s.9 4.7 2.6 6.4l36.9 36.9a9 9 0 0012.7 0l215.6-215.6c19.9-19.9 30.8-46.3 30.8-74.4s-11-54.6-30.8-74.4c-41.1-41.1-107.9-41-149 0L463 364 224.8 602.1A172.22 172.22 0 00174 724.8c0 46.3 18.1 89.8 50.8 122.5 33.9 33.8 78.3 50.7 122.7 50.7 44.4 0 88.8-16.9 122.6-50.7l309.2-309C824.8 492.7 850 432 850 367.5c.1-64.6-25.1-125.3-70.7-170.9z"}}]},name:"paper-clip",theme:"outlined"},PaperClipOutlined=function a(s,c){return reactExports.createElement(Icon$4,_extends$3({},s,{ref:c,icon:PaperClipOutlined$1}))},RefIcon$2=reactExports.forwardRef(PaperClipOutlined),PictureTwoTone$1={icon:function a(s,c){return{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2z",fill:s}},{tag:"path",attrs:{d:"M424.6 765.8l-150.1-178L136 752.1V792h752v-30.4L658.1 489z",fill:c}},{tag:"path",attrs:{d:"M136 652.7l132.4-157c3.2-3.8 9-3.8 12.2 0l144 170.7L652 396.8c3.2-3.8 9-3.8 12.2 0L888 662.2V232H136v420.7zM304 280a88 88 0 110 176 88 88 0 010-176z",fill:c}},{tag:"path",attrs:{d:"M276 368a28 28 0 1056 0 28 28 0 10-56 0z",fill:c}},{tag:"path",attrs:{d:"M304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z",fill:s}}]}},name:"picture",theme:"twotone"},PictureTwoTone=function a(s,c){return reactExports.createElement(Icon$4,_extends$3({},s,{ref:c,icon:PictureTwoTone$1}))},RefIcon$1=reactExports.forwardRef(PictureTwoTone);function file2Obj(a){return Object.assign(Object.assign({},a),{lastModified:a.lastModified,lastModifiedDate:a.lastModifiedDate,name:a.name,size:a.size,type:a.type,uid:a.uid,percent:0,originFileObj:a})}function updateFileList(a,s){const c=_toConsumableArray$e(s),u=c.findIndex(({uid:d})=>d===a.uid);return u===-1?c.push(a):c[u]=a,c}function getFileItem(a,s){const c=a.uid!==void 0?"uid":"name";return s.filter(u=>u[c]===a[c])[0]}function removeFileItem(a,s){const c=a.uid!==void 0?"uid":"name",u=s.filter(d=>d[c]!==a[c]);return u.length===s.length?null:u}const extname=(a="")=>{const s=a.split("/"),u=s[s.length-1].split(/#|\?/)[0];return(/\.[^./\\]*$/.exec(u)||[""])[0]},isImageFileType=a=>a.indexOf("image/")===0,isImageUrl=a=>{if(a.type&&!a.thumbUrl)return isImageFileType(a.type);const s=a.thumbUrl||a.url||"",c=extname(s);return/^data:image\//.test(s)||/(webp|svg|png|gif|jpg|jpeg|jfif|bmp|dpg|ico|heic|heif)$/i.test(c)?!0:!(/^data:/.test(s)||c)},MEASURE_SIZE=200;function previewImage(a){return new Promise(s=>{if(!a.type||!isImageFileType(a.type)){s("");return}const c=document.createElement("canvas");c.width=MEASURE_SIZE,c.height=MEASURE_SIZE,c.style.cssText=`position: fixed; left: 0; top: 0; width: ${MEASURE_SIZE}px; height: ${MEASURE_SIZE}px; z-index: 9999; display: none;`,document.body.appendChild(c);const u=c.getContext("2d"),d=new Image;if(d.onload=()=>{const{width:p,height:v}=d;let A=MEASURE_SIZE,x=MEASURE_SIZE,g=0,b=0;p>v?(x=v*(MEASURE_SIZE/p),b=-(x-A)/2):(A=p*(MEASURE_SIZE/v),g=-(A-x)/2),u.drawImage(d,g,b,A,x);const y=c.toDataURL();document.body.removeChild(c),window.URL.revokeObjectURL(d.src),s(y)},d.crossOrigin="anonymous",a.type.startsWith("image/svg+xml")){const p=new FileReader;p.onload=()=>{p.result&&typeof p.result=="string"&&(d.src=p.result)},p.readAsDataURL(a)}else if(a.type.startsWith("image/gif")){const p=new FileReader;p.onload=()=>{p.result&&s(p.result)},p.readAsDataURL(a)}else d.src=window.URL.createObjectURL(a)})}var DownloadOutlined$1={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M505.7 661a8 8 0 0012.6 0l112-141.7c4.1-5.2.4-12.9-6.3-12.9h-74.1V168c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v338.3H400c-6.7 0-10.4 7.7-6.3 12.9l112 141.8zM878 626h-60c-4.4 0-8 3.6-8 8v154H214V634c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v198c0 17.7 14.3 32 32 32h684c17.7 0 32-14.3 32-32V634c0-4.4-3.6-8-8-8z"}}]},name:"download",theme:"outlined"},DownloadOutlined=function a(s,c){return reactExports.createElement(Icon$4,_extends$3({},s,{ref:c,icon:DownloadOutlined$1}))},RefIcon=reactExports.forwardRef(DownloadOutlined);const ListItem=reactExports.forwardRef(({prefixCls:a,className:s,style:c,locale:u,listType:d,file:p,items:v,progress:A,iconRender:x,actionIconRender:g,itemRender:b,isImgUrl:y,showPreviewIcon:f,showRemoveIcon:m,showDownloadIcon:E,previewIcon:w,removeIcon:S,downloadIcon:$,extra:T,onPreview:I,onDownload:_,onClose:C},P)=>{var O,L;const{status:B}=p,[F,D]=reactExports.useState(B);reactExports.useEffect(()=>{B!=="removed"&&D(B)},[B]);const[G,j]=reactExports.useState(!1);reactExports.useEffect(()=>{const oe=setTimeout(()=>{j(!0)},300);return()=>{clearTimeout(oe)}},[]);const V=x(p);let U=reactExports.createElement("div",{className:`${a}-icon`},V);if(d==="picture"||d==="picture-card"||d==="picture-circle")if(F==="uploading"||!p.thumbUrl&&!p.url){const oe=classnames(`${a}-list-item-thumbnail`,{[`${a}-list-item-file`]:F!=="uploading"});U=reactExports.createElement("div",{className:oe},V)}else{const oe=y?.(p)?reactExports.createElement("img",{src:p.thumbUrl||p.url,alt:p.name,className:`${a}-list-item-image`,crossOrigin:p.crossOrigin}):V,se=classnames(`${a}-list-item-thumbnail`,{[`${a}-list-item-file`]:y&&!y(p)});U=reactExports.createElement("a",{className:se,onClick:fe=>I(p,fe),href:p.url||p.thumbUrl,target:"_blank",rel:"noopener noreferrer"},oe)}const M=classnames(`${a}-list-item`,`${a}-list-item-${F}`),N=typeof p.linkProps=="string"?JSON.parse(p.linkProps):p.linkProps,R=(typeof m=="function"?m(p):m)?g((typeof S=="function"?S(p):S)||reactExports.createElement(RefIcon$7,null),()=>C(p),a,u.removeFile,!0):null,k=(typeof E=="function"?E(p):E)&&F==="done"?g((typeof $=="function"?$(p):$)||reactExports.createElement(RefIcon,null),()=>_(p),a,u.downloadFile):null,H=d!=="picture-card"&&d!=="picture-circle"&&reactExports.createElement("span",{key:"download-delete",className:classnames(`${a}-list-item-actions`,{picture:d==="picture"})},k,R),W=typeof T=="function"?T(p):T,Z=W&&reactExports.createElement("span",{className:`${a}-list-item-extra`},W),te=classnames(`${a}-list-item-name`),K=p.url?reactExports.createElement("a",Object.assign({key:"view",target:"_blank",rel:"noopener noreferrer",className:te,title:p.name},N,{href:p.url,onClick:oe=>I(p,oe)}),p.name,Z):reactExports.createElement("span",{key:"view",className:te,onClick:oe=>I(p,oe),title:p.name},p.name,Z),q=(typeof f=="function"?f(p):f)&&(p.url||p.thumbUrl)?reactExports.createElement("a",{href:p.url||p.thumbUrl,target:"_blank",rel:"noopener noreferrer",onClick:oe=>I(p,oe),title:u.previewFile},typeof w=="function"?w(p):w||reactExports.createElement(RefIcon$s,null)):null,Q=(d==="picture-card"||d==="picture-circle")&&F!=="uploading"&&reactExports.createElement("span",{className:`${a}-list-item-actions`},q,F==="done"&&k,R),{getPrefixCls:ee}=reactExports.useContext(ConfigContext$1),Y=ee(),J=reactExports.createElement("div",{className:M},U,K,H,Q,G&&reactExports.createElement(CSSMotion,{motionName:`${Y}-fade`,visible:F==="uploading",motionDeadline:2e3},({className:oe})=>{const se="percent"in p?reactExports.createElement(Progress,Object.assign({type:"line",percent:p.percent,"aria-label":p["aria-label"],"aria-labelledby":p["aria-labelledby"]},A)):null;return reactExports.createElement("div",{className:classnames(`${a}-list-item-progress`,oe)},se)})),re=p.response&&typeof p.response=="string"?p.response:((O=p.error)===null||O===void 0?void 0:O.statusText)||((L=p.error)===null||L===void 0?void 0:L.message)||u.uploadError,ae=F==="error"?reactExports.createElement(Tooltip,{title:re,getPopupContainer:oe=>oe.parentNode},J):J;return reactExports.createElement("div",{className:classnames(`${a}-list-item-container`,s),style:c,ref:P},b?b(ae,p,v,{download:_.bind(null,p),preview:I.bind(null,p),remove:C.bind(null,p)}):ae)}),InternalUploadList=(a,s)=>{const{listType:c="text",previewFile:u=previewImage,onPreview:d,onDownload:p,onRemove:v,locale:A,iconRender:x,isImageUrl:g=isImageUrl,prefixCls:b,items:y=[],showPreviewIcon:f=!0,showRemoveIcon:m=!0,showDownloadIcon:E=!1,removeIcon:w,previewIcon:S,downloadIcon:$,extra:T,progress:I={size:[-1,2],showInfo:!1},appendAction:_,appendActionVisible:C=!0,itemRender:P,disabled:O}=a,[,L]=useForceUpdate(),[B,F]=reactExports.useState(!1),D=["picture-card","picture-circle"].includes(c);reactExports.useEffect(()=>{c.startsWith("picture")&&(y||[]).forEach(te=>{!(te.originFileObj instanceof File||te.originFileObj instanceof Blob)||te.thumbUrl!==void 0||(te.thumbUrl="",u?.(te.originFileObj).then(K=>{te.thumbUrl=K||"",L()}))})},[c,y,u]),reactExports.useEffect(()=>{F(!0)},[]);const G=(te,K)=>{if(d)return K?.preventDefault(),d(te)},j=te=>{typeof p=="function"?p(te):te.url&&window.open(te.url)},V=te=>{v?.(te)},U=te=>{if(x)return x(te,c);const K=te.status==="uploading";if(c.startsWith("picture")){const q=c==="picture"?reactExports.createElement(RefIcon$F,null):A.uploading,Q=g?.(te)?reactExports.createElement(RefIcon$1,null):reactExports.createElement(RefIcon$3,null);return K?q:Q}return K?reactExports.createElement(RefIcon$F,null):reactExports.createElement(RefIcon$2,null)},M=(te,K,q,Q,ee)=>{const Y={type:"text",size:"small",title:Q,onClick:J=>{var re,ae;K(),reactExports.isValidElement(te)&&((ae=(re=te.props).onClick)===null||ae===void 0||ae.call(re,J))},className:`${q}-list-item-action`,disabled:ee?O:!1};return reactExports.isValidElement(te)?reactExports.createElement(Button$1,Object.assign({},Y,{icon:cloneElement(te,Object.assign(Object.assign({},te.props),{onClick:()=>{}}))})):reactExports.createElement(Button$1,Object.assign({},Y),reactExports.createElement("span",null,te))};reactExports.useImperativeHandle(s,()=>({handlePreview:G,handleDownload:j}));const{getPrefixCls:N}=reactExports.useContext(ConfigContext$1),R=N("upload",b),k=N(),H=classnames(`${R}-list`,`${R}-list-${c}`),W=reactExports.useMemo(()=>omit(initCollapseMotion(k),["onAppearEnd","onEnterEnd","onLeaveEnd"]),[k]),Z=Object.assign(Object.assign({},D?{}:W),{motionDeadline:2e3,motionName:`${R}-${D?"animate-inline":"animate"}`,keys:_toConsumableArray$e(y.map(te=>({key:te.uid,file:te}))),motionAppear:B});return reactExports.createElement("div",{className:H},reactExports.createElement(CSSMotionList,Object.assign({},Z,{component:!1}),({key:te,file:K,className:q,style:Q})=>reactExports.createElement(ListItem,{key:te,locale:A,prefixCls:R,className:q,style:Q,file:K,items:y,progress:I,listType:c,isImgUrl:g,showPreviewIcon:f,showRemoveIcon:m,showDownloadIcon:E,removeIcon:w,previewIcon:S,downloadIcon:$,extra:T,iconRender:U,actionIconRender:M,itemRender:P,onPreview:G,onDownload:j,onClose:V})),_&&reactExports.createElement(CSSMotion,Object.assign({},Z,{visible:C,forceRender:!0}),({className:te,style:K})=>cloneElement(_,q=>({className:classnames(q.className,te),style:Object.assign(Object.assign(Object.assign({},K),{pointerEvents:te?"none":void 0}),q.style)}))))},UploadList=reactExports.forwardRef(InternalUploadList);var __awaiter=function(a,s,c,u){function d(p){return p instanceof c?p:new c(function(v){v(p)})}return new(c||(c=Promise))(function(p,v){function A(b){try{g(u.next(b))}catch(y){v(y)}}function x(b){try{g(u.throw(b))}catch(y){v(y)}}function g(b){b.done?p(b.value):d(b.value).then(A,x)}g((u=u.apply(a,[])).next())})};const LIST_IGNORE=`__LIST_IGNORE_${Date.now()}__`,InternalUpload=(a,s)=>{const c=useComponentConfig("upload"),{fileList:u,defaultFileList:d,onRemove:p,showUploadList:v=!0,listType:A="text",onPreview:x,onDownload:g,onChange:b,onDrop:y,previewFile:f,disabled:m,locale:E,iconRender:w,isImageUrl:S,progress:$,prefixCls:T,className:I,type:_="select",children:C,style:P,itemRender:O,maxCount:L,data:B={},multiple:F=!1,hasControlInside:D=!0,action:G="",accept:j="",supportServerRender:V=!0,rootClassName:U}=a,M=reactExports.useContext(DisabledContext),N=m??M,R=a.customRequest||c.customRequest,[k,H]=useMergedState(d||[],{value:u,postState:Pe=>Pe??[]}),[W,Z]=reactExports.useState("drop"),te=reactExports.useRef(null),K=reactExports.useRef(null);reactExports.useMemo(()=>{const Pe=Date.now();(u||[]).forEach((Me,Fe)=>{!Me.uid&&!Object.isFrozen(Me)&&(Me.uid=`__AUTO__${Pe}_${Fe}__`)})},[u]);const q=(Pe,Me,Fe)=>{let Ue=_toConsumableArray$e(Me),He=!1;L===1?Ue=Ue.slice(-1):L&&(He=Ue.length>L,Ue=Ue.slice(0,L)),reactDomExports.flushSync(()=>{H(Ue)});const Le={file:Pe,fileList:Ue};Fe&&(Le.event=Fe),(!He||Pe.status==="removed"||Ue.some(ke=>ke.uid===Pe.uid))&&reactDomExports.flushSync(()=>{b?.(Le)})},Q=(Pe,Me)=>__awaiter(void 0,void 0,void 0,function*(){const{beforeUpload:Fe,transformFile:Ue}=a;let He=Pe;if(Fe){const Le=yield Fe(Pe,Me);if(Le===!1)return!1;if(delete Pe[LIST_IGNORE],Le===LIST_IGNORE)return Object.defineProperty(Pe,LIST_IGNORE,{value:!0,configurable:!0}),!1;typeof Le=="object"&&Le&&(He=Le)}return Ue&&(He=yield Ue(He)),He}),ee=Pe=>{const Me=Pe.filter(He=>!He.file[LIST_IGNORE]);if(!Me.length)return;const Fe=Me.map(He=>file2Obj(He.file));let Ue=_toConsumableArray$e(k);Fe.forEach(He=>{Ue=updateFileList(He,Ue)}),Fe.forEach((He,Le)=>{let ke=He;if(Me[Le].parsedFile)He.status="uploading";else{const{originFileObj:je}=He;let Xe;try{Xe=new File([je],je.name,{type:je.type})}catch{Xe=new Blob([je],{type:je.type}),Xe.name=je.name,Xe.lastModifiedDate=new Date,Xe.lastModified=new Date().getTime()}Xe.uid=He.uid,ke=Xe}q(ke,Ue)})},Y=(Pe,Me,Fe)=>{try{typeof Pe=="string"&&(Pe=JSON.parse(Pe))}catch{}if(!getFileItem(Me,k))return;const Ue=file2Obj(Me);Ue.status="done",Ue.percent=100,Ue.response=Pe,Ue.xhr=Fe;const He=updateFileList(Ue,k);q(Ue,He)},J=(Pe,Me)=>{if(!getFileItem(Me,k))return;const Fe=file2Obj(Me);Fe.status="uploading",Fe.percent=Pe.percent;const Ue=updateFileList(Fe,k);q(Fe,Ue,Pe)},re=(Pe,Me,Fe)=>{if(!getFileItem(Fe,k))return;const Ue=file2Obj(Fe);Ue.error=Pe,Ue.response=Me,Ue.status="error";const He=updateFileList(Ue,k);q(Ue,He)},ae=Pe=>{let Me;Promise.resolve(typeof p=="function"?p(Pe):p).then(Fe=>{var Ue;if(Fe===!1)return;const He=removeFileItem(Pe,k);He&&(Me=Object.assign(Object.assign({},Pe),{status:"removed"}),k?.forEach(Le=>{const ke=Me.uid!==void 0?"uid":"name";Le[ke]===Me[ke]&&!Object.isFrozen(Le)&&(Le.status="removed")}),(Ue=te.current)===null||Ue===void 0||Ue.abort(Me),q(Me,He))})},oe=Pe=>{Z(Pe.type),Pe.type==="drop"&&y?.(Pe)};reactExports.useImperativeHandle(s,()=>({onBatchStart:ee,onSuccess:Y,onProgress:J,onError:re,fileList:k,upload:te.current,nativeElement:K.current}));const{getPrefixCls:se,direction:fe,upload:pe}=reactExports.useContext(ConfigContext$1),ge=se("upload",T),me=Object.assign(Object.assign({onBatchStart:ee,onError:re,onProgress:J,onSuccess:Y},a),{customRequest:R,data:B,multiple:F,action:G,accept:j,supportServerRender:V,prefixCls:ge,disabled:N,beforeUpload:Q,onChange:void 0,hasControlInside:D});delete me.className,delete me.style,(!C||N)&&delete me.id;const be=`${ge}-wrapper`,[le,ve,he]=useStyle(ge,be),[ye]=useLocale$1("Upload",localeValues.Upload),{showRemoveIcon:Ee,showPreviewIcon:xe,showDownloadIcon:we,removeIcon:$e,previewIcon:Ae,downloadIcon:ue,extra:ce}=typeof v=="boolean"?{}:v,Ce=typeof Ee>"u"?!N:Ee,_e=(Pe,Me)=>v?reactExports.createElement(UploadList,{prefixCls:ge,listType:A,items:k,previewFile:f,onPreview:x,onDownload:g,onRemove:ae,showRemoveIcon:Ce,showPreviewIcon:xe,showDownloadIcon:we,removeIcon:$e,previewIcon:Ae,downloadIcon:ue,iconRender:w,extra:ce,locale:Object.assign(Object.assign({},ye),E),isImageUrl:S,progress:$,appendAction:Pe,appendActionVisible:Me,itemRender:O,disabled:N}):Pe,Te=classnames(be,I,U,ve,he,pe?.className,{[`${ge}-rtl`]:fe==="rtl",[`${ge}-picture-card-wrapper`]:A==="picture-card",[`${ge}-picture-circle-wrapper`]:A==="picture-circle"}),De=Object.assign(Object.assign({},pe?.style),P);if(_==="drag"){const Pe=classnames(ve,ge,`${ge}-drag`,{[`${ge}-drag-uploading`]:k.some(Me=>Me.status==="uploading"),[`${ge}-drag-hover`]:W==="dragover",[`${ge}-disabled`]:N,[`${ge}-rtl`]:fe==="rtl"});return le(reactExports.createElement("span",{className:Te,ref:K},reactExports.createElement("div",{className:Pe,style:De,onDrop:oe,onDragOver:oe,onDragLeave:oe},reactExports.createElement(Upload$2,Object.assign({},me,{ref:te,className:`${ge}-btn`}),reactExports.createElement("div",{className:`${ge}-drag-container`},C))),_e()))}const Re=classnames(ge,`${ge}-select`,{[`${ge}-disabled`]:N,[`${ge}-hidden`]:!C}),Be=reactExports.createElement("div",{className:Re,style:De},reactExports.createElement(Upload$2,Object.assign({},me,{ref:te})));return le(A==="picture-card"||A==="picture-circle"?reactExports.createElement("span",{className:Te,ref:K},_e(Be,!!C)):reactExports.createElement("span",{className:Te,ref:K},Be,_e()))},Upload$1=reactExports.forwardRef(InternalUpload);var __rest$3=function(a,s){var c={};for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&s.indexOf(u)<0&&(c[u]=a[u]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,u=Object.getOwnPropertySymbols(a);d<u.length;d++)s.indexOf(u[d])<0&&Object.prototype.propertyIsEnumerable.call(a,u[d])&&(c[u[d]]=a[u[d]]);return c};const Dragger=reactExports.forwardRef((a,s)=>{const{style:c,height:u,hasControlInside:d=!1,children:p}=a,v=__rest$3(a,["style","height","hasControlInside","children"]),A=Object.assign(Object.assign({},c),{height:u});return reactExports.createElement(Upload$1,Object.assign({ref:s,hasControlInside:d},v,{style:A,type:"drag"}),p)}),Upload=Upload$1;Upload.Dragger=Dragger,Upload.LIST_IGNORE=LIST_IGNORE;const toKebabCase=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),toCamelCase=a=>a.replace(/^([A-Z])|[\s-_]+(\w)/g,(s,c,u)=>u?u.toUpperCase():c.toLowerCase()),toPascalCase=a=>{const s=toCamelCase(a);return s.charAt(0).toUpperCase()+s.slice(1)},mergeClasses=(...a)=>a.filter((s,c,u)=>!!s&&s.trim()!==""&&u.indexOf(s)===c).join(" ").trim(),hasA11yProp=a=>{for(const s in a)if(s.startsWith("aria-")||s==="role"||s==="title")return!0};var defaultAttributes$1={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const Icon=reactExports.forwardRef(({color:a="currentColor",size:s=24,strokeWidth:c=2,absoluteStrokeWidth:u,className:d="",children:p,iconNode:v,...A},x)=>reactExports.createElement("svg",{ref:x,...defaultAttributes$1,width:s,height:s,stroke:a,strokeWidth:u?Number(c)*24/Number(s):c,className:mergeClasses("lucide",d),...!p&&!hasA11yProp(A)&&{"aria-hidden":"true"},...A},[...v.map(([g,b])=>reactExports.createElement(g,b)),...Array.isArray(p)?p:[p]]));const createLucideIcon=(a,s)=>{const c=reactExports.forwardRef(({className:u,...d},p)=>reactExports.createElement(Icon,{ref:p,iconNode:s,className:mergeClasses(`lucide-${toKebabCase(toPascalCase(a))}`,`lucide-${a}`,u),...d}));return c.displayName=toPascalCase(a),c};const __iconNode$m=[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M10 16v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4",key:"11f1s0"}],["path",{d:"M10 8V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4",key:"t14dx9"}],["path",{d:"M20 16v1a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-1",key:"1w07xs"}],["path",{d:"M14 8V7c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v1",key:"1apec2"}]],AlignCenterHorizontal=createLucideIcon("align-center-horizontal",__iconNode$m);const __iconNode$l=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4",key:"14d6g8"}],["path",{d:"M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4",key:"1e2lrw"}],["path",{d:"M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1",key:"1fkdwx"}],["path",{d:"M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1",key:"1euafb"}]],AlignCenterVertical=createLucideIcon("align-center-vertical",__iconNode$l);const __iconNode$k=[["rect",{width:"6",height:"16",x:"4",y:"2",rx:"2",key:"z5wdxg"}],["rect",{width:"6",height:"9",x:"14",y:"9",rx:"2",key:"um7a8w"}],["path",{d:"M22 22H2",key:"19qnx5"}]],AlignEndHorizontal=createLucideIcon("align-end-horizontal",__iconNode$k);const __iconNode$j=[["rect",{width:"16",height:"6",x:"2",y:"4",rx:"2",key:"10wcwx"}],["rect",{width:"9",height:"6",x:"9",y:"14",rx:"2",key:"4p5bwg"}],["path",{d:"M22 22V2",key:"12ipfv"}]],AlignEndVertical=createLucideIcon("align-end-vertical",__iconNode$j);const __iconNode$i=[["rect",{width:"6",height:"10",x:"9",y:"7",rx:"2",key:"yn7j0q"}],["path",{d:"M4 22V2",key:"tsjzd3"}],["path",{d:"M20 22V2",key:"1bnhr8"}]],AlignHorizontalSpaceAround=createLucideIcon("align-horizontal-space-around",__iconNode$i);const __iconNode$h=[["rect",{width:"6",height:"16",x:"4",y:"6",rx:"2",key:"1n4dg1"}],["rect",{width:"6",height:"9",x:"14",y:"6",rx:"2",key:"17khns"}],["path",{d:"M22 2H2",key:"fhrpnj"}]],AlignStartHorizontal=createLucideIcon("align-start-horizontal",__iconNode$h);const __iconNode$g=[["rect",{width:"9",height:"6",x:"6",y:"14",rx:"2",key:"lpm2y7"}],["rect",{width:"16",height:"6",x:"6",y:"4",rx:"2",key:"rdj6ps"}],["path",{d:"M2 2v20",key:"1ivd8o"}]],AlignStartVertical=createLucideIcon("align-start-vertical",__iconNode$g);const __iconNode$f=[["rect",{width:"10",height:"6",x:"7",y:"9",rx:"2",key:"b1zbii"}],["path",{d:"M22 20H2",key:"1p1f7z"}],["path",{d:"M22 4H2",key:"1b7qnq"}]],AlignVerticalSpaceAround=createLucideIcon("align-vertical-space-around",__iconNode$f);const __iconNode$e=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],ArrowLeft=createLucideIcon("arrow-left",__iconNode$e);const __iconNode$d=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ArrowRight=createLucideIcon("arrow-right",__iconNode$d);const __iconNode$c=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ChevronLeft=createLucideIcon("chevron-left",__iconNode$c);const __iconNode$b=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],ChevronRight=createLucideIcon("chevron-right",__iconNode$b);const __iconNode$a=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],ChevronsLeft=createLucideIcon("chevrons-left",__iconNode$a);const __iconNode$9=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],ChevronsRight=createLucideIcon("chevrons-right",__iconNode$9);const __iconNode$8=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],CircleAlert=createLucideIcon("circle-alert",__iconNode$8);const __iconNode$7=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Ellipsis=createLucideIcon("ellipsis",__iconNode$7);const __iconNode$6=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],GripVertical=createLucideIcon("grip-vertical",__iconNode$6);const __iconNode$5=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],LoaderCircle=createLucideIcon("loader-circle",__iconNode$5);const __iconNode$4=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],Lock=createLucideIcon("lock",__iconNode$4);const __iconNode$3=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Menu=createLucideIcon("menu",__iconNode$3);const __iconNode$2=[["path",{d:"M5 12h14",key:"1ays0h"}]],Minus=createLucideIcon("minus",__iconNode$2);const __iconNode$1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Plus=createLucideIcon("plus",__iconNode$1);const __iconNode=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],X=createLucideIcon("x",__iconNode);function arrayMove(a,s,c){const u=a.slice();return u.splice(c<0?u.length+c:c,0,u.splice(s,1)[0]),u}function getSortedRects(a,s){return a.reduce((c,u,d)=>{const p=s.get(u);return p&&(c[d]=p),c},Array(a.length))}function isValidIndex(a){return a!==null&&a>=0}function itemsEqual(a,s){if(a===s)return!0;if(a.length!==s.length)return!1;for(let c=0;c<a.length;c++)if(a[c]!==s[c])return!1;return!0}function normalizeDisabled(a){return typeof a=="boolean"?{draggable:a,droppable:a}:a}const rectSortingStrategy=a=>{let{rects:s,activeIndex:c,overIndex:u,index:d}=a;const p=arrayMove(s,u,c),v=s[d],A=p[d];return!A||!v?null:{x:A.left-v.left,y:A.top-v.top,scaleX:A.width/v.width,scaleY:A.height/v.height}},defaultScale$1={scaleX:1,scaleY:1},verticalListSortingStrategy=a=>{var s;let{activeIndex:c,activeNodeRect:u,index:d,rects:p,overIndex:v}=a;const A=(s=p[c])!=null?s:u;if(!A)return null;if(d===c){const g=p[v];return g?{x:0,y:c<v?g.top+g.height-(A.top+A.height):g.top-A.top,...defaultScale$1}:null}const x=getItemGap$1(p,d,c);return d>c&&d<=v?{x:0,y:-A.height-x,...defaultScale$1}:d<c&&d>=v?{x:0,y:A.height+x,...defaultScale$1}:{x:0,y:0,...defaultScale$1}};function getItemGap$1(a,s,c){const u=a[s],d=a[s-1],p=a[s+1];return u?c<s?d?u.top-(d.top+d.height):p?p.top-(u.top+u.height):0:p?p.top-(u.top+u.height):d?u.top-(d.top+d.height):0:0}const ID_PREFIX="Sortable",Context$1=React.createContext({activeIndex:-1,containerId:ID_PREFIX,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:rectSortingStrategy,disabled:{draggable:!1,droppable:!1}});function SortableContext(a){let{children:s,id:c,items:u,strategy:d=rectSortingStrategy,disabled:p=!1}=a;const{active:v,dragOverlay:A,droppableRects:x,over:g,measureDroppableContainers:b}=useDndContext(),y=useUniqueId(ID_PREFIX,c),f=A.rect!==null,m=reactExports.useMemo(()=>u.map(P=>typeof P=="object"&&"id"in P?P.id:P),[u]),E=v!=null,w=v?m.indexOf(v.id):-1,S=g?m.indexOf(g.id):-1,$=reactExports.useRef(m),T=!itemsEqual(m,$.current),I=S!==-1&&w===-1||T,_=normalizeDisabled(p);useIsomorphicLayoutEffect$1(()=>{T&&E&&b(m)},[T,m,E,b]),reactExports.useEffect(()=>{$.current=m},[m]);const C=reactExports.useMemo(()=>({activeIndex:w,containerId:y,disabled:_,disableTransforms:I,items:m,overIndex:S,useDragOverlay:f,sortedRects:getSortedRects(m,x),strategy:d}),[w,y,_.draggable,_.droppable,I,m,S,x,f,d]);return React.createElement(Context$1.Provider,{value:C},s)}const defaultNewIndexGetter=a=>{let{id:s,items:c,activeIndex:u,overIndex:d}=a;return arrayMove(c,u,d).indexOf(s)},defaultAnimateLayoutChanges=a=>{let{containerId:s,isSorting:c,wasDragging:u,index:d,items:p,newIndex:v,previousItems:A,previousContainerId:x,transition:g}=a;return!g||!u||A!==p&&d===v?!1:c?!0:v!==d&&s===x},defaultTransition={duration:200,easing:"ease"},transitionProperty="transform",disabledTransition=CSS$1.Transition.toString({property:transitionProperty,duration:0,easing:"linear"}),defaultAttributes={roleDescription:"sortable"};function useDerivedTransform(a){let{disabled:s,index:c,node:u,rect:d}=a;const[p,v]=reactExports.useState(null),A=reactExports.useRef(c);return useIsomorphicLayoutEffect$1(()=>{if(!s&&c!==A.current&&u.current){const x=d.current;if(x){const g=getClientRect$1(u.current,{ignoreTransform:!0}),b={x:x.left-g.left,y:x.top-g.top,scaleX:x.width/g.width,scaleY:x.height/g.height};(b.x||b.y)&&v(b)}}c!==A.current&&(A.current=c)},[s,c,u,d]),reactExports.useEffect(()=>{p&&v(null)},[p]),p}function useSortable(a){let{animateLayoutChanges:s=defaultAnimateLayoutChanges,attributes:c,disabled:u,data:d,getNewIndex:p=defaultNewIndexGetter,id:v,strategy:A,resizeObserverConfig:x,transition:g=defaultTransition}=a;const{items:b,containerId:y,activeIndex:f,disabled:m,disableTransforms:E,sortedRects:w,overIndex:S,useDragOverlay:$,strategy:T}=reactExports.useContext(Context$1),I=normalizeLocalDisabled(u,m),_=b.indexOf(v),C=reactExports.useMemo(()=>({sortable:{containerId:y,index:_,items:b},...d}),[y,d,_,b]),P=reactExports.useMemo(()=>b.slice(b.indexOf(v)),[b,v]),{rect:O,node:L,isOver:B,setNodeRef:F}=useDroppable({id:v,data:C,disabled:I.droppable,resizeObserverConfig:{updateMeasurementsFor:P,...x}}),{active:D,activatorEvent:G,activeNodeRect:j,attributes:V,setNodeRef:U,listeners:M,isDragging:N,over:R,setActivatorNodeRef:k,transform:H}=useDraggable({id:v,data:C,attributes:{...defaultAttributes,...c},disabled:I.draggable}),W=useCombinedRefs(F,U),Z=!!D,te=Z&&!E&&isValidIndex(f)&&isValidIndex(S),K=!$&&N,q=K&&te?H:null,ee=te?q??(A??T)({rects:w,activeNodeRect:j,activeIndex:f,overIndex:S,index:_}):null,Y=isValidIndex(f)&&isValidIndex(S)?p({id:v,items:b,activeIndex:f,overIndex:S}):_,J=D?.id,re=reactExports.useRef({activeId:J,items:b,newIndex:Y,containerId:y}),ae=b!==re.current.items,oe=s({active:D,containerId:y,isDragging:N,isSorting:Z,id:v,index:_,items:b,newIndex:re.current.newIndex,previousItems:re.current.items,previousContainerId:re.current.containerId,transition:g,wasDragging:re.current.activeId!=null}),se=useDerivedTransform({disabled:!oe,index:_,node:L,rect:O});return reactExports.useEffect(()=>{Z&&re.current.newIndex!==Y&&(re.current.newIndex=Y),y!==re.current.containerId&&(re.current.containerId=y),b!==re.current.items&&(re.current.items=b)},[Z,Y,y,b]),reactExports.useEffect(()=>{if(J===re.current.activeId)return;if(J!=null&&re.current.activeId==null){re.current.activeId=J;return}const pe=setTimeout(()=>{re.current.activeId=J},50);return()=>clearTimeout(pe)},[J]),{active:D,activeIndex:f,attributes:V,data:C,rect:O,index:_,newIndex:Y,items:b,isOver:B,isSorting:Z,isDragging:N,listeners:M,node:L,overIndex:S,over:R,setNodeRef:W,setActivatorNodeRef:k,setDroppableNodeRef:F,setDraggableNodeRef:U,transform:se??ee,transition:fe()};function fe(){if(se||ae&&re.current.newIndex===_)return disabledTransition;if(!(K&&!isKeyboardEvent(G)||!g)&&(Z||oe))return CSS$1.Transition.toString({...g,property:transitionProperty})}}function normalizeLocalDisabled(a,s){var c,u;return typeof a=="boolean"?{draggable:a,droppable:!1}:{draggable:(c=a?.draggable)!=null?c:s.draggable,droppable:(u=a?.droppable)!=null?u:s.droppable}}function hasSortableData(a){if(!a)return!1;const s=a.data.current;return!!(s&&"sortable"in s&&typeof s.sortable=="object"&&"containerId"in s.sortable&&"items"in s.sortable&&"index"in s.sortable)}const directions=[KeyboardCode.Down,KeyboardCode.Right,KeyboardCode.Up,KeyboardCode.Left],sortableKeyboardCoordinates=(a,s)=>{let{context:{active:c,collisionRect:u,droppableRects:d,droppableContainers:p,over:v,scrollableAncestors:A}}=s;if(directions.includes(a.code)){if(a.preventDefault(),!c||!u)return;const x=[];p.getEnabled().forEach(y=>{if(!y||y!=null&&y.disabled)return;const f=d.get(y.id);if(f)switch(a.code){case KeyboardCode.Down:u.top<f.top&&x.push(y);break;case KeyboardCode.Up:u.top>f.top&&x.push(y);break;case KeyboardCode.Left:u.left>f.left&&x.push(y);break;case KeyboardCode.Right:u.left<f.left&&x.push(y);break}});const g=closestCorners({collisionRect:u,droppableRects:d,droppableContainers:x});let b=getFirstCollision(g,"id");if(b===v?.id&&g.length>1&&(b=g[1].id),b!=null){const y=p.get(c.id),f=p.get(b),m=f?d.get(f.id):null,E=f?.node.current;if(E&&m&&y&&f){const S=getScrollableAncestors(E).some((P,O)=>A[O]!==P),$=isSameContainer(y,f),T=isAfter(y,f),I=S||!$?{x:0,y:0}:{x:T?u.width-m.width:0,y:T?u.height-m.height:0},_={x:m.left,y:m.top};return I.x&&I.y?_:subtract(_,I)}}}};function isSameContainer(a,s){return!hasSortableData(a)||!hasSortableData(s)?!1:a.data.current.sortable.containerId===s.data.current.sortable.containerId}function isAfter(a,s){return!hasSortableData(a)||!hasSortableData(s)||!isSameContainer(a,s)?!1:a.data.current.sortable.index<s.data.current.sortable.index}const{Text:Text$4}=Typography,Item=React.memo(React.forwardRef(function a({icon:s,value:c,status:u,title:d,required:p,readOnly:v,style:A,dragOverlay:x,onClick:g,onMouseEnter:b,onMouseLeave:y,dragging:f,fadeIn:m,listeners:E,sorting:w,transition:S,transform:$,...T},I){const _=reactExports.useContext(I18nContext);reactExports.useEffect(()=>{if(x)return document.body.style.cursor="grabbing",()=>{document.body.style.cursor=""}},[x]);const{x:C,y:P,scaleX:O,scaleY:L}=$||{x:0,y:0,scaleX:1,scaleY:1};return jsxRuntimeExports.jsx("li",{style:{marginTop:10,transition:S,transform:`translate(${C}px, ${P}px) scale(${O}, ${L})`},onMouseEnter:b,onMouseLeave:y,ref:I,children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",cursor:"pointer",gap:"0.5rem",...A},...T,onClick:()=>g&&g(),children:[jsxRuntimeExports.jsx(Button$1,{...E,style:{display:"flex",alignItems:"center",background:"none",boxShadow:"none",border:"none",paddingLeft:"0.25rem"},icon:jsxRuntimeExports.jsx(GripVertical,{size:15,style:{cursor:"grab"}})}),s,jsxRuntimeExports.jsx(Text$4,{style:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis",width:"100%"},title:d||"",children:u===void 0?c:jsxRuntimeExports.jsxs("span",{style:{display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(CircleAlert,{size:15,style:{marginRight:"0.25rem"}}),u==="is-warning"?_("noKeyName"):c,u==="is-danger"?_("notUniq"):""]})}),v&&jsxRuntimeExports.jsx(Lock,{size:15,style:{marginRight:"0.5rem"}}),p&&jsxRuntimeExports.jsx("span",{style:{color:"red",marginRight:"0.5rem"},children:"*"})]})})}));Item.displayName="Item";const usePrevious=a=>{const s=reactExports.useRef(null);return reactExports.useEffect(()=>{s.current=a}),s.current},getScale=(a,s)=>Math.floor((a/s>1?1:a/s)*100)/100,useUIPreProcessor=({template:a,size:s,zoomLevel:c,maxZoom:u})=>{const[d,p]=reactExports.useState([]),[v,A]=reactExports.useState([]),[x,g]=reactExports.useState(0),[b,y]=reactExports.useState(null),f=async m=>{const{template:{basePdf:E,schemas:w},size:S}=m;let $,T,I,_;if(isBlankPdf(E)){const{width:P,height:O}=E;$=P*ZOOM,T=O*ZOOM,I=w.map(()=>"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAA1JREFUGFdj+P///38ACfsD/QVDRcoAAAAASUVORK5CYII="),_=w.map(()=>({width:P,height:O}))}else{const P=await getB64BasePdf(E),O=b64toUint8Array(P),L=new ArrayBuffer(O.byteLength);new Uint8Array(L).set(O);const[B,F]=await Promise.all([pdf2size(L),pdf2img(L.slice(),{scale:u})]);_=B,$=_[0].width*ZOOM,T=_[0].height*ZOOM,I=F.map(arrayBufferToBase64)}const C=Math.min(getScale(S.width,$),getScale(S.height-RULER_HEIGHT,T));return{backgrounds:I,pageSizes:_,scale:C}};return reactExports.useEffect(()=>{f({template:a,size:s}).then(({pageSizes:m,scale:E,backgrounds:w})=>{A(m),g(E),p(w)}).catch(m=>{y(m),console.error("[@pdfme/ui]",m)})},[a,s]),{backgrounds:d,pageSizes:v,scale:x*c,error:b,refresh:m=>f({template:m,size:s}).then(({pageSizes:E,scale:w,backgrounds:S})=>{A(E),g(w),p(S)})}},useScrollPageCursor=({ref:a,pageSizes:s,scale:c,pageCursor:u,onChangePageCursor:d})=>{const p=reactExports.useCallback(()=>{if(!s[0]||!a.current)return;const v=a.current.scrollTop,{top:A}=a.current.getBoundingClientRect(),x=s.reduce((b,y,f)=>{let m=(y.height*ZOOM+RULER_HEIGHT)*c;return f===0?m+=A-m/2:m+=b[f-1],b.concat(m)},[]);let g=0;x.forEach((b,y)=>{v>b&&(g=y+1>=x.length?x.length-1:y+1)}),g!==u&&d(g)},[d,u,s,a,c]);reactExports.useEffect(()=>(a.current?.addEventListener("scroll",p),()=>{a.current?.removeEventListener("scroll",p)}),[a,p])},useMountStatus=()=>{const[a,s]=reactExports.useState(!1);return reactExports.useEffect(()=>{const c=setTimeout(()=>s(!0),500);return()=>clearTimeout(c)},[]),a},useInitEvents=({pageCursor:a,pageSizes:s,activeElements:c,template:u,schemasList:d,changeSchemas:p,commitSchemas:v,removeSchemas:A,onSaveTemplate:x,past:g,future:b,setSchemasList:y,onEdit:f,onEditEnd:m})=>{const E=reactExports.useRef(null),w=reactExports.useCallback(()=>{const $=()=>{const I=c.map(_=>_.id);return d[a].filter(_=>I.includes(_.id))},T=I=>{const _=I==="undo",C=_?g:b;if(C.current.length<=0)return;(_?b:g).current.push(cloneDeep$1(d[a]));const P=cloneDeep$1(d);P[a]=C.current.pop(),y(P)};initShortCuts({move:(I,_)=>{const C=s[a],P=$(),O=moveCommandToChangeSchemasArg({command:I,activeSchemas:P,pageSize:C,isShift:_});p(O)},copy:()=>{const I=$();I.length!==0&&(E.current=I)},paste:()=>{if(!E.current||E.current.length===0)return;const I=d[a],_=[],C=E.current.map(P=>{const O=uuid$6(),L=getUniqueSchemaName({copiedSchemaName:P.name,schema:I,stackUniqueSchemaNames:_}),{height:B,width:F,position:D}=P,G=s[a],j={x:D.x+10>G.width-F?G.width-F:D.x+10,y:D.y+10>G.height-B?G.height-B:D.y+10};return Object.assign(cloneDeep$1(P),{id:O,name:L,position:j})});v(d[a].concat(C)),f(C.map(P=>document.getElementById(P.id))),E.current=C},redo:()=>T("redo"),undo:()=>T("undo"),save:()=>x&&x(schemasList2template(d,u.basePdf)),remove:()=>A($().map(I=>I.id)),esc:m,selectAll:()=>f(d[a].map(I=>document.getElementById(I.id)))})},[u,c,a,s,p,v,d,x,A,g,b,y,E,f,m]),S=reactExports.useCallback(()=>{destroyShortCuts()},[]);reactExports.useEffect(()=>(w(),S),[w,S])};const{entries,setPrototypeOf:setPrototypeOf$2,isFrozen,getPrototypeOf,getOwnPropertyDescriptor}=Object;let{freeze,seal,create:create$2}=Object,{apply:apply$1,construct}=typeof Reflect<"u"&&Reflect;freeze||(freeze=function(s){return s}),seal||(seal=function(s){return s}),apply$1||(apply$1=function(s,c){for(var u=arguments.length,d=new Array(u>2?u-2:0),p=2;p<u;p++)d[p-2]=arguments[p];return s.apply(c,d)}),construct||(construct=function(s){for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];return new s(...u)});const arrayForEach=unapply(Array.prototype.forEach),arrayLastIndexOf=unapply(Array.prototype.lastIndexOf),arrayPop=unapply(Array.prototype.pop),arrayPush$1=unapply(Array.prototype.push),arraySplice=unapply(Array.prototype.splice),stringToLowerCase=unapply(String.prototype.toLowerCase),stringToString=unapply(String.prototype.toString),stringMatch=unapply(String.prototype.match),stringReplace=unapply(String.prototype.replace),stringIndexOf=unapply(String.prototype.indexOf),stringTrim=unapply(String.prototype.trim),objectHasOwnProperty=unapply(Object.prototype.hasOwnProperty),regExpTest=unapply(RegExp.prototype.test),typeErrorCreate=unconstruct(TypeError);function unapply(a){return function(s){s instanceof RegExp&&(s.lastIndex=0);for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];return apply$1(a,s,u)}}function unconstruct(a){return function(){for(var s=arguments.length,c=new Array(s),u=0;u<s;u++)c[u]=arguments[u];return construct(a,c)}}function addToSet(a,s){let c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:stringToLowerCase;setPrototypeOf$2&&setPrototypeOf$2(a,null);let u=s.length;for(;u--;){let d=s[u];if(typeof d=="string"){const p=c(d);p!==d&&(isFrozen(s)||(s[u]=p),d=p)}a[d]=!0}return a}function cleanArray(a){for(let s=0;s<a.length;s++)objectHasOwnProperty(a,s)||(a[s]=null);return a}function clone(a){const s=create$2(null);for(const[c,u]of entries(a))objectHasOwnProperty(a,c)&&(Array.isArray(u)?s[c]=cleanArray(u):u&&typeof u=="object"&&u.constructor===Object?s[c]=clone(u):s[c]=u);return s}function lookupGetter(a,s){for(;a!==null;){const u=getOwnPropertyDescriptor(a,s);if(u){if(u.get)return unapply(u.get);if(typeof u.value=="function")return unapply(u.value)}a=getPrototypeOf(a)}function c(){return null}return c}const html$1=freeze(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),svg$1=freeze(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),svgFilters=freeze(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),svgDisallowed=freeze(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),mathMl$1=freeze(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),mathMlDisallowed=freeze(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),text=freeze(["#text"]),html$2=freeze(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),svg=freeze(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),mathMl=freeze(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),xml=freeze(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),MUSTACHE_EXPR=seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ERB_EXPR=seal(/<%[\w\W]*|[\w\W]*%>/gm),TMPLIT_EXPR=seal(/\$\{[\w\W]*/gm),DATA_ATTR=seal(/^data-[\-\w.\u00B7-\uFFFF]+$/),ARIA_ATTR=seal(/^aria-[\-\w]+$/),IS_ALLOWED_URI=seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),IS_SCRIPT_OR_DATA=seal(/^(?:\w+script|data):/i),ATTR_WHITESPACE=seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),DOCTYPE_NAME=seal(/^html$/i),CUSTOM_ELEMENT=seal(/^[a-z][.\w]*(-[.\w]+)+$/i);var EXPRESSIONS=Object.freeze({__proto__:null,ARIA_ATTR,ATTR_WHITESPACE,CUSTOM_ELEMENT,DATA_ATTR,DOCTYPE_NAME,ERB_EXPR,IS_ALLOWED_URI,IS_SCRIPT_OR_DATA,MUSTACHE_EXPR,TMPLIT_EXPR});const NODE_TYPE={element:1,text:3,progressingInstruction:7,comment:8,document:9},getGlobal=function a(){return typeof window>"u"?null:window},_createTrustedTypesPolicy=function a(s,c){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let u=null;const d="data-tt-policy-suffix";c&&c.hasAttribute(d)&&(u=c.getAttribute(d));const p="dompurify"+(u?"#"+u:"");try{return s.createPolicy(p,{createHTML(v){return v},createScriptURL(v){return v}})}catch{return console.warn("TrustedTypes policy "+p+" could not be created."),null}},_createHooksMap=function a(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function createDOMPurify(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:getGlobal();const s=Ve=>createDOMPurify(Ve);if(s.version="3.3.0",s.removed=[],!a||!a.document||a.document.nodeType!==NODE_TYPE.document||!a.Element)return s.isSupported=!1,s;let{document:c}=a;const u=c,d=u.currentScript,{DocumentFragment:p,HTMLTemplateElement:v,Node:A,Element:x,NodeFilter:g,NamedNodeMap:b=a.NamedNodeMap||a.MozNamedAttrMap,HTMLFormElement:y,DOMParser:f,trustedTypes:m}=a,E=x.prototype,w=lookupGetter(E,"cloneNode"),S=lookupGetter(E,"remove"),$=lookupGetter(E,"nextSibling"),T=lookupGetter(E,"childNodes"),I=lookupGetter(E,"parentNode");if(typeof v=="function"){const Ve=c.createElement("template");Ve.content&&Ve.content.ownerDocument&&(c=Ve.content.ownerDocument)}let _,C="";const{implementation:P,createNodeIterator:O,createDocumentFragment:L,getElementsByTagName:B}=c,{importNode:F}=u;let D=_createHooksMap();s.isSupported=typeof entries=="function"&&typeof I=="function"&&P&&P.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:G,ERB_EXPR:j,TMPLIT_EXPR:V,DATA_ATTR:U,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:N,ATTR_WHITESPACE:R,CUSTOM_ELEMENT:k}=EXPRESSIONS;let{IS_ALLOWED_URI:H}=EXPRESSIONS,W=null;const Z=addToSet({},[...html$1,...svg$1,...svgFilters,...mathMl$1,...text]);let te=null;const K=addToSet({},[...html$2,...svg,...mathMl,...xml]);let q=Object.seal(create$2(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Q=null,ee=null;const Y=Object.seal(create$2(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let J=!0,re=!0,ae=!1,oe=!0,se=!1,fe=!0,pe=!1,ge=!1,me=!1,be=!1,le=!1,ve=!1,he=!0,ye=!1;const Ee="user-content-";let xe=!0,we=!1,$e={},Ae=null;const ue=addToSet({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let ce=null;const Ce=addToSet({},["audio","video","img","source","image","track"]);let _e=null;const Te=addToSet({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),De="http://www.w3.org/1998/Math/MathML",Re="http://www.w3.org/2000/svg",Be="http://www.w3.org/1999/xhtml";let Pe=Be,Me=!1,Fe=null;const Ue=addToSet({},[De,Re,Be],stringToString);let He=addToSet({},["mi","mo","mn","ms","mtext"]),Le=addToSet({},["annotation-xml"]);const ke=addToSet({},["title","style","font","a","script"]);let je=null;const Xe=["application/xhtml+xml","text/html"],it="text/html";let tt=null,ht=null;const ft=c.createElement("form"),qe=function(Ne){return Ne instanceof RegExp||Ne instanceof Function},Je=function(){let Ne=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ht&&ht===Ne)){if((!Ne||typeof Ne!="object")&&(Ne={}),Ne=clone(Ne),je=Xe.indexOf(Ne.PARSER_MEDIA_TYPE)===-1?it:Ne.PARSER_MEDIA_TYPE,tt=je==="application/xhtml+xml"?stringToString:stringToLowerCase,W=objectHasOwnProperty(Ne,"ALLOWED_TAGS")?addToSet({},Ne.ALLOWED_TAGS,tt):Z,te=objectHasOwnProperty(Ne,"ALLOWED_ATTR")?addToSet({},Ne.ALLOWED_ATTR,tt):K,Fe=objectHasOwnProperty(Ne,"ALLOWED_NAMESPACES")?addToSet({},Ne.ALLOWED_NAMESPACES,stringToString):Ue,_e=objectHasOwnProperty(Ne,"ADD_URI_SAFE_ATTR")?addToSet(clone(Te),Ne.ADD_URI_SAFE_ATTR,tt):Te,ce=objectHasOwnProperty(Ne,"ADD_DATA_URI_TAGS")?addToSet(clone(Ce),Ne.ADD_DATA_URI_TAGS,tt):Ce,Ae=objectHasOwnProperty(Ne,"FORBID_CONTENTS")?addToSet({},Ne.FORBID_CONTENTS,tt):ue,Q=objectHasOwnProperty(Ne,"FORBID_TAGS")?addToSet({},Ne.FORBID_TAGS,tt):clone({}),ee=objectHasOwnProperty(Ne,"FORBID_ATTR")?addToSet({},Ne.FORBID_ATTR,tt):clone({}),$e=objectHasOwnProperty(Ne,"USE_PROFILES")?Ne.USE_PROFILES:!1,J=Ne.ALLOW_ARIA_ATTR!==!1,re=Ne.ALLOW_DATA_ATTR!==!1,ae=Ne.ALLOW_UNKNOWN_PROTOCOLS||!1,oe=Ne.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=Ne.SAFE_FOR_TEMPLATES||!1,fe=Ne.SAFE_FOR_XML!==!1,pe=Ne.WHOLE_DOCUMENT||!1,be=Ne.RETURN_DOM||!1,le=Ne.RETURN_DOM_FRAGMENT||!1,ve=Ne.RETURN_TRUSTED_TYPE||!1,me=Ne.FORCE_BODY||!1,he=Ne.SANITIZE_DOM!==!1,ye=Ne.SANITIZE_NAMED_PROPS||!1,xe=Ne.KEEP_CONTENT!==!1,we=Ne.IN_PLACE||!1,H=Ne.ALLOWED_URI_REGEXP||IS_ALLOWED_URI,Pe=Ne.NAMESPACE||Be,He=Ne.MATHML_TEXT_INTEGRATION_POINTS||He,Le=Ne.HTML_INTEGRATION_POINTS||Le,q=Ne.CUSTOM_ELEMENT_HANDLING||{},Ne.CUSTOM_ELEMENT_HANDLING&&qe(Ne.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(q.tagNameCheck=Ne.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Ne.CUSTOM_ELEMENT_HANDLING&&qe(Ne.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(q.attributeNameCheck=Ne.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Ne.CUSTOM_ELEMENT_HANDLING&&typeof Ne.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(q.allowCustomizedBuiltInElements=Ne.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),se&&(re=!1),le&&(be=!0),$e&&(W=addToSet({},text),te=[],$e.html===!0&&(addToSet(W,html$1),addToSet(te,html$2)),$e.svg===!0&&(addToSet(W,svg$1),addToSet(te,svg),addToSet(te,xml)),$e.svgFilters===!0&&(addToSet(W,svgFilters),addToSet(te,svg),addToSet(te,xml)),$e.mathMl===!0&&(addToSet(W,mathMl$1),addToSet(te,mathMl),addToSet(te,xml))),Ne.ADD_TAGS&&(typeof Ne.ADD_TAGS=="function"?Y.tagCheck=Ne.ADD_TAGS:(W===Z&&(W=clone(W)),addToSet(W,Ne.ADD_TAGS,tt))),Ne.ADD_ATTR&&(typeof Ne.ADD_ATTR=="function"?Y.attributeCheck=Ne.ADD_ATTR:(te===K&&(te=clone(te)),addToSet(te,Ne.ADD_ATTR,tt))),Ne.ADD_URI_SAFE_ATTR&&addToSet(_e,Ne.ADD_URI_SAFE_ATTR,tt),Ne.FORBID_CONTENTS&&(Ae===ue&&(Ae=clone(Ae)),addToSet(Ae,Ne.FORBID_CONTENTS,tt)),xe&&(W["#text"]=!0),pe&&addToSet(W,["html","head","body"]),W.table&&(addToSet(W,["tbody"]),delete Q.tbody),Ne.TRUSTED_TYPES_POLICY){if(typeof Ne.TRUSTED_TYPES_POLICY.createHTML!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Ne.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=Ne.TRUSTED_TYPES_POLICY,C=_.createHTML("")}else _===void 0&&(_=_createTrustedTypesPolicy(m,d)),_!==null&&typeof C=="string"&&(C=_.createHTML(""));freeze&&freeze(Ne),ht=Ne}},ct=addToSet({},[...svg$1,...svgFilters,...svgDisallowed]),ot=addToSet({},[...mathMl$1,...mathMlDisallowed]),Ke=function(Ne){let We=I(Ne);(!We||!We.tagName)&&(We={namespaceURI:Pe,tagName:"template"});const Qe=stringToLowerCase(Ne.tagName),et=stringToLowerCase(We.tagName);return Fe[Ne.namespaceURI]?Ne.namespaceURI===Re?We.namespaceURI===Be?Qe==="svg":We.namespaceURI===De?Qe==="svg"&&(et==="annotation-xml"||He[et]):!!ct[Qe]:Ne.namespaceURI===De?We.namespaceURI===Be?Qe==="math":We.namespaceURI===Re?Qe==="math"&&Le[et]:!!ot[Qe]:Ne.namespaceURI===Be?We.namespaceURI===Re&&!Le[et]||We.namespaceURI===De&&!He[et]?!1:!ot[Qe]&&(ke[Qe]||!ct[Qe]):!!(je==="application/xhtml+xml"&&Fe[Ne.namespaceURI]):!1},Ze=function(Ne){arrayPush$1(s.removed,{element:Ne});try{I(Ne).removeChild(Ne)}catch{S(Ne)}},st=function(Ne,We){try{arrayPush$1(s.removed,{attribute:We.getAttributeNode(Ne),from:We})}catch{arrayPush$1(s.removed,{attribute:null,from:We})}if(We.removeAttribute(Ne),Ne==="is")if(be||le)try{Ze(We)}catch{}else try{We.setAttribute(Ne,"")}catch{}},yt=function(Ne){let We=null,Qe=null;if(me)Ne="<remove></remove>"+Ne;else{const at=stringMatch(Ne,/^[\r\n\t ]+/);Qe=at&&at[0]}je==="application/xhtml+xml"&&Pe===Be&&(Ne='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Ne+"</body></html>");const et=_?_.createHTML(Ne):Ne;if(Pe===Be)try{We=new f().parseFromString(et,je)}catch{}if(!We||!We.documentElement){We=P.createDocument(Pe,"template",null);try{We.documentElement.innerHTML=Me?C:et}catch{}}const rt=We.body||We.documentElement;return Ne&&Qe&&rt.insertBefore(c.createTextNode(Qe),rt.childNodes[0]||null),Pe===Be?B.call(We,pe?"html":"body")[0]:pe?We.documentElement:rt},_t=function(Ne){return O.call(Ne.ownerDocument||Ne,Ne,g.SHOW_ELEMENT|g.SHOW_COMMENT|g.SHOW_TEXT|g.SHOW_PROCESSING_INSTRUCTION|g.SHOW_CDATA_SECTION,null)},At=function(Ne){return Ne instanceof y&&(typeof Ne.nodeName!="string"||typeof Ne.textContent!="string"||typeof Ne.removeChild!="function"||!(Ne.attributes instanceof b)||typeof Ne.removeAttribute!="function"||typeof Ne.setAttribute!="function"||typeof Ne.namespaceURI!="string"||typeof Ne.insertBefore!="function"||typeof Ne.hasChildNodes!="function")},pt=function(Ne){return typeof A=="function"&&Ne instanceof A};function lt(Ve,Ne,We){arrayForEach(Ve,Qe=>{Qe.call(s,Ne,We,ht)})}const Ct=function(Ne){let We=null;if(lt(D.beforeSanitizeElements,Ne,null),At(Ne))return Ze(Ne),!0;const Qe=tt(Ne.nodeName);if(lt(D.uponSanitizeElement,Ne,{tagName:Qe,allowedTags:W}),fe&&Ne.hasChildNodes()&&!pt(Ne.firstElementChild)&&regExpTest(/<[/\w!]/g,Ne.innerHTML)&&regExpTest(/<[/\w!]/g,Ne.textContent)||Ne.nodeType===NODE_TYPE.progressingInstruction||fe&&Ne.nodeType===NODE_TYPE.comment&&regExpTest(/<[/\w]/g,Ne.data))return Ze(Ne),!0;if(!(Y.tagCheck instanceof Function&&Y.tagCheck(Qe))&&(!W[Qe]||Q[Qe])){if(!Q[Qe]&&Nt(Qe)&&(q.tagNameCheck instanceof RegExp&&regExpTest(q.tagNameCheck,Qe)||q.tagNameCheck instanceof Function&&q.tagNameCheck(Qe)))return!1;if(xe&&!Ae[Qe]){const et=I(Ne)||Ne.parentNode,rt=T(Ne)||Ne.childNodes;if(rt&&et){const at=rt.length;for(let Ye=at-1;Ye>=0;--Ye){const vt=w(rt[Ye],!0);vt.__removalCount=(Ne.__removalCount||0)+1,et.insertBefore(vt,$(Ne))}}}return Ze(Ne),!0}return Ne instanceof x&&!Ke(Ne)||(Qe==="noscript"||Qe==="noembed"||Qe==="noframes")&&regExpTest(/<\/no(script|embed|frames)/i,Ne.innerHTML)?(Ze(Ne),!0):(se&&Ne.nodeType===NODE_TYPE.text&&(We=Ne.textContent,arrayForEach([G,j,V],et=>{We=stringReplace(We,et," ")}),Ne.textContent!==We&&(arrayPush$1(s.removed,{element:Ne.cloneNode()}),Ne.textContent=We)),lt(D.afterSanitizeElements,Ne,null),!1)},Mt=function(Ne,We,Qe){if(he&&(We==="id"||We==="name")&&(Qe in c||Qe in ft))return!1;if(!(re&&!ee[We]&&regExpTest(U,We))){if(!(J&&regExpTest(M,We))){if(!(Y.attributeCheck instanceof Function&&Y.attributeCheck(We,Ne))){if(!te[We]||ee[We]){if(!(Nt(Ne)&&(q.tagNameCheck instanceof RegExp&&regExpTest(q.tagNameCheck,Ne)||q.tagNameCheck instanceof Function&&q.tagNameCheck(Ne))&&(q.attributeNameCheck instanceof RegExp&&regExpTest(q.attributeNameCheck,We)||q.attributeNameCheck instanceof Function&&q.attributeNameCheck(We,Ne))||We==="is"&&q.allowCustomizedBuiltInElements&&(q.tagNameCheck instanceof RegExp&&regExpTest(q.tagNameCheck,Qe)||q.tagNameCheck instanceof Function&&q.tagNameCheck(Qe))))return!1}else if(!_e[We]){if(!regExpTest(H,stringReplace(Qe,R,""))){if(!((We==="src"||We==="xlink:href"||We==="href")&&Ne!=="script"&&stringIndexOf(Qe,"data:")===0&&ce[Ne])){if(!(ae&&!regExpTest(N,stringReplace(Qe,R,"")))){if(Qe)return!1}}}}}}}return!0},Nt=function(Ne){return Ne!=="annotation-xml"&&stringMatch(Ne,k)},Rt=function(Ne){lt(D.beforeSanitizeAttributes,Ne,null);const{attributes:We}=Ne;if(!We||At(Ne))return;const Qe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:te,forceKeepAttr:void 0};let et=We.length;for(;et--;){const rt=We[et],{name:at,namespaceURI:Ye,value:vt}=rt,wt=tt(at),xt=vt;let gt=at==="value"?xt:stringTrim(xt);if(Qe.attrName=wt,Qe.attrValue=gt,Qe.keepAttr=!0,Qe.forceKeepAttr=void 0,lt(D.uponSanitizeAttribute,Ne,Qe),gt=Qe.attrValue,ye&&(wt==="id"||wt==="name")&&(st(at,Ne),gt=Ee+gt),fe&&regExpTest(/((--!?|])>)|<\/(style|title|textarea)/i,gt)){st(at,Ne);continue}if(wt==="attributename"&&stringMatch(gt,"href")){st(at,Ne);continue}if(Qe.forceKeepAttr)continue;if(!Qe.keepAttr){st(at,Ne);continue}if(!oe&&regExpTest(/\/>/i,gt)){st(at,Ne);continue}se&&arrayForEach([G,j,V],kt=>{gt=stringReplace(gt,kt," ")});const St=tt(Ne.nodeName);if(!Mt(St,wt,gt)){st(at,Ne);continue}if(_&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!Ye)switch(m.getAttributeType(St,wt)){case"TrustedHTML":{gt=_.createHTML(gt);break}case"TrustedScriptURL":{gt=_.createScriptURL(gt);break}}if(gt!==xt)try{Ye?Ne.setAttributeNS(Ye,at,gt):Ne.setAttribute(at,gt),At(Ne)?Ze(Ne):arrayPop(s.removed)}catch{st(at,Ne)}}lt(D.afterSanitizeAttributes,Ne,null)},Bt=function Ve(Ne){let We=null;const Qe=_t(Ne);for(lt(D.beforeSanitizeShadowDOM,Ne,null);We=Qe.nextNode();)lt(D.uponSanitizeShadowNode,We,null),Ct(We),Rt(We),We.content instanceof p&&Ve(We.content);lt(D.afterSanitizeShadowDOM,Ne,null)};return s.sanitize=function(Ve){let Ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},We=null,Qe=null,et=null,rt=null;if(Me=!Ve,Me&&(Ve="<!-->"),typeof Ve!="string"&&!pt(Ve))if(typeof Ve.toString=="function"){if(Ve=Ve.toString(),typeof Ve!="string")throw typeErrorCreate("dirty is not a string, aborting")}else throw typeErrorCreate("toString is not a function");if(!s.isSupported)return Ve;if(ge||Je(Ne),s.removed=[],typeof Ve=="string"&&(we=!1),we){if(Ve.nodeName){const vt=tt(Ve.nodeName);if(!W[vt]||Q[vt])throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place")}}else if(Ve instanceof A)We=yt("<!---->"),Qe=We.ownerDocument.importNode(Ve,!0),Qe.nodeType===NODE_TYPE.element&&Qe.nodeName==="BODY"||Qe.nodeName==="HTML"?We=Qe:We.appendChild(Qe);else{if(!be&&!se&&!pe&&Ve.indexOf("<")===-1)return _&&ve?_.createHTML(Ve):Ve;if(We=yt(Ve),!We)return be?null:ve?C:""}We&&me&&Ze(We.firstChild);const at=_t(we?Ve:We);for(;et=at.nextNode();)Ct(et),Rt(et),et.content instanceof p&&Bt(et.content);if(we)return Ve;if(be){if(le)for(rt=L.call(We.ownerDocument);We.firstChild;)rt.appendChild(We.firstChild);else rt=We;return(te.shadowroot||te.shadowrootmode)&&(rt=F.call(u,rt,!0)),rt}let Ye=pe?We.outerHTML:We.innerHTML;return pe&&W["!doctype"]&&We.ownerDocument&&We.ownerDocument.doctype&&We.ownerDocument.doctype.name&&regExpTest(DOCTYPE_NAME,We.ownerDocument.doctype.name)&&(Ye="<!DOCTYPE "+We.ownerDocument.doctype.name+`>
549
549
  `+Ye),se&&arrayForEach([G,j,V],vt=>{Ye=stringReplace(Ye,vt," ")}),_&&ve?_.createHTML(Ye):Ye},s.setConfig=function(){let Ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Je(Ve),ge=!0},s.clearConfig=function(){ht=null,ge=!1},s.isValidAttribute=function(Ve,Ne,We){ht||Je({});const Qe=tt(Ve),et=tt(Ne);return Mt(Qe,et,We)},s.addHook=function(Ve,Ne){typeof Ne=="function"&&arrayPush$1(D[Ve],Ne)},s.removeHook=function(Ve,Ne){if(Ne!==void 0){const We=arrayLastIndexOf(D[Ve],Ne);return We===-1?void 0:arraySplice(D[Ve],We,1)[0]}return arrayPop(D[Ve])},s.removeHooks=function(Ve){D[Ve]=[]},s.removeAllHooks=function(){D=_createHooksMap()},s}var purify=createDOMPurify();const SVGIcon=({svgString:a,size:s,styles:c,label:u})=>{const d=reactExports.useMemo(()=>{const p=purify.sanitize(a,{USE_PROFILES:{svg:!0,svgFilters:!0},ALLOWED_TAGS:["svg","path","circle","rect","line","polygon","polyline","ellipse","g","defs","title","desc","metadata"],ALLOWED_ATTR:["class","id","fill","stroke","stroke-width","viewBox","width","height","d","cx","cy","r","x","y","x1","y1","x2","y2","points","rx","ry","transform"],FORBID_TAGS:["script","foreignObject","use","embed","iframe","object","link","style"],FORBID_ATTR:["onload","onerror","onclick","onmouseover","onfocus","onblur","href","xlink:href","src","action","formaction"],KEEP_CONTENT:!1}),x=new DOMParser().parseFromString(p,"image/svg+xml").querySelector("svg");return x?(s&&(x.setAttribute("width",s.toString()),x.setAttribute("height",s.toString())),x.outerHTML):null},[a,s]);return d?jsxRuntimeExports.jsx("div",{style:c,title:u,dangerouslySetInnerHTML:{__html:d}}):null},PluginIcon=a=>{const{plugin:s,label:c,size:u,styles:d}=a,{token:p}=theme.useToken(),v=reactExports.useContext(OptionsContext),A=s.propPanel.defaultSchema?.type??"",x=v.icons?.[A]??s.icon,g={...d,color:p.colorText,display:"flex",justifyContent:"center"};return x?jsxRuntimeExports.jsx(SVGIcon,{svgString:x,size:u,styles:g,label:c}):jsxRuntimeExports.jsx("div",{style:{...d,overflow:"hidden",fontSize:10},title:c,children:c})},SelectableSortableItem=({isSelected:a,style:s,onSelect:c,onEdit:u,schema:d,schemas:p,onMouseEnter:v,onMouseLeave:A})=>{const{token:x}=theme.useToken(),g=reactExports.useContext(I18nContext),b=reactExports.useContext(PluginsRegistry),{setNodeRef:y,listeners:f,isDragging:m,isSorting:E,transform:w,transition:S}=useSortable({id:d.id}),$=useMountStatus(),T=m&&!$,I={...f,onClick:B=>c(d.id,B.shiftKey)},[_,C]=b.findWithLabelByType(d.type);let P;d.name?p.find(B=>d.name&&B.name===d.name&&B.id!==d.id)&&(P="is-danger"):P="is-warning";let O=g("edit");P==="is-warning"?O=g("plsInputName"):P==="is-danger"&&(O=g("fieldMustUniq"));const L=a?{background:x.colorPrimary,opacity:E||m?.5:1}:{};return jsxRuntimeExports.jsx(Item,{ref:y,onMouseEnter:v,onMouseLeave:A,onClick:()=>u(d.id),icon:C&&jsxRuntimeExports.jsx(PluginIcon,{plugin:C,label:_,size:20}),value:d.name,status:P,title:O,required:d.required,readOnly:d.readOnly,style:{...L,...s},dragging:m,sorting:E,transition:S,transform:w,fadeIn:T,listeners:I})},SelectableSortableContainer=a=>{const{token:s}=theme.useToken(),{schemas:c,onEdit:u,onSortEnd:d,hoveringSchemaId:p,onChangeHoveringSchemaId:v}=a,[A,x]=reactExports.useState([]),[g,b]=reactExports.useState(null),[y,f]=reactExports.useState(null),m=reactExports.useContext(PluginsRegistry),E=useSensors(useSensor(PointerSensor,{activationConstraint:{distance:15}}),useSensor(KeyboardSensor,{coordinateGetter:sortableKeyboardCoordinates})),w=T=>A.map(I=>I.id).includes(T),S=(T,I)=>{if(I)if(w(T)){const _=A.filter(C=>C.id!==T);x(_)}else{const _=c.find(P=>P.id===T),C=A.concat(_);x(C)}else x([])},$=T=>{const I=typeof T=="string"?c.find(P=>P.id===T):T;if(!I)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const[_,C]=m.findWithLabelByType(I.type);return C?jsxRuntimeExports.jsx(PluginIcon,{plugin:C,label:_,size:20,styles:{marginRight:"0.5rem"}}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})};return jsxRuntimeExports.jsx(DndContext,{sensors:E,collisionDetection:closestCorners,onDragStart:({active:T})=>{f(String(T.id)),b(c),w(String(T.id))?A.length>0&&d(A.reduce((I,_)=>_.id===String(T.id)?I:I.filter(C=>C!==_),c)):x([])},onDragEnd:({active:T,over:I})=>{const _=I?.id||"",C=c.map(O=>O.id).indexOf(String(T.id)),P=c.map(O=>O.id).indexOf(String(_));if(A.length){let O=[...c];O=arrayMove(O,C,P),O.splice(P+1,0,...A.filter(L=>L.id!==y)),d(O),x([])}else C!==P&&d(arrayMove(c,C,P));f(null)},onDragCancel:()=>{g&&d(g),f(null),b(null)},children:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{style:{height:"100%",overflowY:"auto"},children:jsxRuntimeExports.jsx(SortableContext,{items:c,strategy:verticalListSortingStrategy,children:jsxRuntimeExports.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",borderRadius:5},children:c.map(T=>jsxRuntimeExports.jsx(SelectableSortableItem,{style:{border:`1px solid ${T.id===p?s.colorPrimary:"transparent"}`},schema:T,schemas:c,isSelected:w(T.id)||y===T.id,onEdit:u,onSelect:S,onMouseEnter:()=>v(T.id),onMouseLeave:()=>v(null)},T.id))})})}),reactDomExports.createPortal(jsxRuntimeExports.jsx(DragOverlay,{adjustScale:!0,children:y?(()=>{const T=c.find(I=>I.id===y);return T?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("ul",{style:{margin:0,padding:0,listStyle:"none"},children:jsxRuntimeExports.jsx(Item,{icon:$(y),value:T.name,required:T.required,readOnly:T.readOnly,style:{background:s.colorPrimary},dragOverlay:!0})}),jsxRuntimeExports.jsx("ul",{style:{margin:0,padding:0,listStyle:"none"},children:A.filter(I=>I.id!==y).map(I=>jsxRuntimeExports.jsx(Item,{icon:$(I),value:I.name,required:I.required,readOnly:I.readOnly,style:{background:s.colorPrimary},dragOverlay:!0},I.id))})]}):null})():null}),document.body)]})})},{Text:Text$3}=Typography,{TextArea:TextArea$2}=Input$1,headHeight=40,ListView=a=>{const{schemas:s,onSortEnd:c,onEdit:u,size:d,hoveringSchemaId:p,onChangeHoveringSchemaId:v,changeSchemas:A}=a,{token:x}=theme.useToken(),g=reactExports.useContext(I18nContext),[b,y]=reactExports.useState(!1),[f,m]=reactExports.useState(""),E=getSidebarContentHeight(d.height),w=()=>{const $=f.split(`
550
550
  `);$.length!==s.length?alert(g("errorBulkUpdateFieldName")):(A($.map((T,I)=>({key:"name",value:T,schemaId:s[I].id}))),y(!1))},S=()=>{m(s.map($=>$.name).join(`
551
- `)),y(!0)};return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{style:{height:headHeight,display:"flex",alignItems:"center"},children:jsxRuntimeExports.jsx(Text$3,{strong:!0,style:{textAlign:"center",width:"100%"},children:g("fieldsList")})}),jsxRuntimeExports.jsx(Divider,{style:{marginTop:x.marginXS,marginBottom:x.marginXS}}),jsxRuntimeExports.jsxs("div",{style:{height:E-headHeight},children:[b?jsxRuntimeExports.jsx(TextArea$2,{wrap:"off",value:f,onChange:$=>m($.target.value),style:{paddingLeft:30,height:E-headHeight,width:RIGHT_SIDEBAR_WIDTH-35,lineHeight:"2.75rem"}}):jsxRuntimeExports.jsx(SelectableSortableContainer,{schemas:s,hoveringSchemaId:p,onChangeHoveringSchemaId:v,onSortEnd:c,onEdit:u}),jsxRuntimeExports.jsx("div",{style:{paddingTop:"0.5rem",display:"flex",alignItems:"center",justifyContent:"flex-end"},children:b?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Button$1,{size:"small",type:"text",onClick:w,children:jsxRuntimeExports.jsxs("u",{children:[" ",g("commitBulkUpdateFieldName")]})}),jsxRuntimeExports.jsx("span",{style:{margin:"0 1rem"},children:"/"}),jsxRuntimeExports.jsx(Button$1,{size:"small",type:"text",onClick:()=>y(!1),children:jsxRuntimeExports.jsxs("u",{children:[" ",g("cancel")]})})]}):jsxRuntimeExports.jsx(Button$1,{size:"small",type:"text",onClick:S,children:jsxRuntimeExports.jsxs("u",{children:[" ",g("bulkUpdateFieldName")]})})})]})]})};var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root.Symbol,objectProto$g=Object.prototype,hasOwnProperty$d=objectProto$g.hasOwnProperty,nativeObjectToString$1=objectProto$g.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(a){var s=hasOwnProperty$d.call(a,symToStringTag$1),c=a[symToStringTag$1];try{a[symToStringTag$1]=void 0;var u=!0}catch{}var d=nativeObjectToString$1.call(a);return u&&(s?a[symToStringTag$1]=c:delete a[symToStringTag$1]),d}var objectProto$f=Object.prototype,nativeObjectToString=objectProto$f.toString;function objectToString(a){return nativeObjectToString.call(a)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(a){return a==null?a===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(a)?getRawTag(a):objectToString(a)}function isObjectLike(a){return a!=null&&typeof a=="object"}var symbolTag$3="[object Symbol]";function isSymbol(a){return typeof a=="symbol"||isObjectLike(a)&&baseGetTag(a)==symbolTag$3}function arrayMap(a,s){for(var c=-1,u=a==null?0:a.length,d=Array(u);++c<u;)d[c]=s(a[c],c,a);return d}var isArray$2=Array.isArray,symbolProto$2=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto$2?symbolProto$2.toString:void 0;function baseToString(a){if(typeof a=="string")return a;if(isArray$2(a))return arrayMap(a,baseToString)+"";if(isSymbol(a))return symbolToString?symbolToString.call(a):"";var s=a+"";return s=="0"&&1/a==-1/0?"-0":s}function isObject$3(a){var s=typeof a;return a!=null&&(s=="object"||s=="function")}function identity$1(a){return a}var asyncTag="[object AsyncFunction]",funcTag$2="[object Function]",genTag$1="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$2(a){if(!isObject$3(a))return!1;var s=baseGetTag(a);return s==funcTag$2||s==genTag$1||s==asyncTag||s==proxyTag}var coreJsData=root["__core-js_shared__"],maskSrcKey=(function(){var a=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function isMasked(a){return!!maskSrcKey&&maskSrcKey in a}var funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource(a){if(a!=null){try{return funcToString$2.call(a)}catch{}try{return a+""}catch{}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$e=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$c=objectProto$e.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$c).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(a){if(!isObject$3(a)||isMasked(a))return!1;var s=isFunction$2(a)?reIsNative:reIsHostCtor;return s.test(toSource(a))}function getValue$1(a,s){return a?.[s]}function getNative(a,s){var c=getValue$1(a,s);return baseIsNative(c)?c:void 0}var WeakMap$1=getNative(root,"WeakMap"),objectCreate=Object.create,baseCreate=(function(){function a(){}return function(s){if(!isObject$3(s))return{};if(objectCreate)return objectCreate(s);a.prototype=s;var c=new a;return a.prototype=void 0,c}})();function apply(a,s,c){switch(c.length){case 0:return a.call(s);case 1:return a.call(s,c[0]);case 2:return a.call(s,c[0],c[1]);case 3:return a.call(s,c[0],c[1],c[2])}return a.apply(s,c)}function copyArray(a,s){var c=-1,u=a.length;for(s||(s=Array(u));++c<u;)s[c]=a[c];return s}var HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;function shortOut(a){var s=0,c=0;return function(){var u=nativeNow(),d=HOT_SPAN-(u-c);if(c=u,d>0){if(++s>=HOT_COUNT)return arguments[0]}else s=0;return a.apply(void 0,arguments)}}function constant(a){return function(){return a}}var defineProperty$4=(function(){try{var a=getNative(Object,"defineProperty");return a({},"",{}),a}catch{}})(),baseSetToString=defineProperty$4?function(a,s){return defineProperty$4(a,"toString",{configurable:!0,enumerable:!1,value:constant(s),writable:!0})}:identity$1,setToString=shortOut(baseSetToString);function arrayEach(a,s){for(var c=-1,u=a==null?0:a.length;++c<u&&s(a[c],c,a)!==!1;);return a}var MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(a,s){var c=typeof a;return s=s??MAX_SAFE_INTEGER$1,!!s&&(c=="number"||c!="symbol"&&reIsUint.test(a))&&a>-1&&a%1==0&&a<s}function baseAssignValue(a,s,c){s=="__proto__"&&defineProperty$4?defineProperty$4(a,s,{configurable:!0,enumerable:!0,value:c,writable:!0}):a[s]=c}function eq(a,s){return a===s||a!==a&&s!==s}var objectProto$d=Object.prototype,hasOwnProperty$b=objectProto$d.hasOwnProperty;function assignValue(a,s,c){var u=a[s];(!(hasOwnProperty$b.call(a,s)&&eq(u,c))||c===void 0&&!(s in a))&&baseAssignValue(a,s,c)}function copyObject(a,s,c,u){var d=!c;c||(c={});for(var p=-1,v=s.length;++p<v;){var A=s[p],x=void 0;x===void 0&&(x=a[A]),d?baseAssignValue(c,A,x):assignValue(c,A,x)}return c}var nativeMax=Math.max;function overRest(a,s,c){return s=nativeMax(s===void 0?a.length-1:s,0),function(){for(var u=arguments,d=-1,p=nativeMax(u.length-s,0),v=Array(p);++d<p;)v[d]=u[s+d];d=-1;for(var A=Array(s+1);++d<s;)A[d]=u[d];return A[s]=c(v),apply(a,this,A)}}function baseRest(a,s){return setToString(overRest(a,s,identity$1),a+"")}var MAX_SAFE_INTEGER=9007199254740991;function isLength(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=MAX_SAFE_INTEGER}function isArrayLike(a){return a!=null&&isLength(a.length)&&!isFunction$2(a)}function isIterateeCall(a,s,c){if(!isObject$3(c))return!1;var u=typeof s;return(u=="number"?isArrayLike(c)&&isIndex(s,c.length):u=="string"&&s in c)?eq(c[s],a):!1}function createAssigner(a){return baseRest(function(s,c){var u=-1,d=c.length,p=d>1?c[d-1]:void 0,v=d>2?c[2]:void 0;for(p=a.length>3&&typeof p=="function"?(d--,p):void 0,v&&isIterateeCall(c[0],c[1],v)&&(p=d<3?void 0:p,d=1),s=Object(s);++u<d;){var A=c[u];A&&a(s,A,u,p)}return s})}var objectProto$c=Object.prototype;function isPrototype(a){var s=a&&a.constructor,c=typeof s=="function"&&s.prototype||objectProto$c;return a===c}function baseTimes(a,s){for(var c=-1,u=Array(a);++c<a;)u[c]=s(c);return u}var argsTag$3="[object Arguments]";function baseIsArguments(a){return isObjectLike(a)&&baseGetTag(a)==argsTag$3}var objectProto$b=Object.prototype,hasOwnProperty$a=objectProto$b.hasOwnProperty,propertyIsEnumerable$1=objectProto$b.propertyIsEnumerable,isArguments=baseIsArguments((function(){return arguments})())?baseIsArguments:function(a){return isObjectLike(a)&&hasOwnProperty$a.call(a,"callee")&&!propertyIsEnumerable$1.call(a,"callee")};function stubFalse(){return!1}var freeExports$2=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$2=freeExports$2&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$2=freeModule$2&&freeModule$2.exports===freeExports$2,Buffer$2=moduleExports$2?root.Buffer:void 0,nativeIsBuffer=Buffer$2?Buffer$2.isBuffer:void 0,isBuffer=nativeIsBuffer||stubFalse,argsTag$2="[object Arguments]",arrayTag$2="[object Array]",boolTag$3="[object Boolean]",dateTag$3="[object Date]",errorTag$2="[object Error]",funcTag$1="[object Function]",mapTag$5="[object Map]",numberTag$3="[object Number]",objectTag$4="[object Object]",regexpTag$3="[object RegExp]",setTag$5="[object Set]",stringTag$3="[object String]",weakMapTag$2="[object WeakMap]",arrayBufferTag$3="[object ArrayBuffer]",dataViewTag$4="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0,typedArrayTags[argsTag$2]=typedArrayTags[arrayTag$2]=typedArrayTags[arrayBufferTag$3]=typedArrayTags[boolTag$3]=typedArrayTags[dataViewTag$4]=typedArrayTags[dateTag$3]=typedArrayTags[errorTag$2]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag$5]=typedArrayTags[numberTag$3]=typedArrayTags[objectTag$4]=typedArrayTags[regexpTag$3]=typedArrayTags[setTag$5]=typedArrayTags[stringTag$3]=typedArrayTags[weakMapTag$2]=!1;function baseIsTypedArray(a){return isObjectLike(a)&&isLength(a.length)&&!!typedArrayTags[baseGetTag(a)]}function baseUnary(a){return function(s){return a(s)}}var freeExports$1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal.process,nodeUtil=(function(){try{var a=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return a||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch{}})(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$a=Object.prototype,hasOwnProperty$9=objectProto$a.hasOwnProperty;function arrayLikeKeys(a,s){var c=isArray$2(a),u=!c&&isArguments(a),d=!c&&!u&&isBuffer(a),p=!c&&!u&&!d&&isTypedArray(a),v=c||u||d||p,A=v?baseTimes(a.length,String):[],x=A.length;for(var g in a)(s||hasOwnProperty$9.call(a,g))&&!(v&&(g=="length"||d&&(g=="offset"||g=="parent")||p&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||isIndex(g,x)))&&A.push(g);return A}function overArg(a,s){return function(c){return a(s(c))}}var nativeKeys=overArg(Object.keys,Object),objectProto$9=Object.prototype,hasOwnProperty$8=objectProto$9.hasOwnProperty;function baseKeys(a){if(!isPrototype(a))return nativeKeys(a);var s=[];for(var c in Object(a))hasOwnProperty$8.call(a,c)&&c!="constructor"&&s.push(c);return s}function keys(a){return isArrayLike(a)?arrayLikeKeys(a):baseKeys(a)}function nativeKeysIn(a){var s=[];if(a!=null)for(var c in Object(a))s.push(c);return s}var objectProto$8=Object.prototype,hasOwnProperty$7=objectProto$8.hasOwnProperty;function baseKeysIn(a){if(!isObject$3(a))return nativeKeysIn(a);var s=isPrototype(a),c=[];for(var u in a)u=="constructor"&&(s||!hasOwnProperty$7.call(a,u))||c.push(u);return c}function keysIn(a){return isArrayLike(a)?arrayLikeKeys(a,!0):baseKeysIn(a)}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(a,s){if(isArray$2(a))return!1;var c=typeof a;return c=="number"||c=="symbol"||c=="boolean"||a==null||isSymbol(a)?!0:reIsPlainProp.test(a)||!reIsDeepProp.test(a)||s!=null&&a in Object(s)}var nativeCreate=getNative(Object,"create");function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0}function hashDelete(a){var s=this.has(a)&&delete this.__data__[a];return this.size-=s?1:0,s}var HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$7=Object.prototype,hasOwnProperty$6=objectProto$7.hasOwnProperty;function hashGet(a){var s=this.__data__;if(nativeCreate){var c=s[a];return c===HASH_UNDEFINED$2?void 0:c}return hasOwnProperty$6.call(s,a)?s[a]:void 0}var objectProto$6=Object.prototype,hasOwnProperty$5=objectProto$6.hasOwnProperty;function hashHas(a){var s=this.__data__;return nativeCreate?s[a]!==void 0:hasOwnProperty$5.call(s,a)}var HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet(a,s){var c=this.__data__;return this.size+=this.has(a)?0:1,c[a]=nativeCreate&&s===void 0?HASH_UNDEFINED$1:s,this}function Hash(a){var s=-1,c=a==null?0:a.length;for(this.clear();++s<c;){var u=a[s];this.set(u[0],u[1])}}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;function listCacheClear(){this.__data__=[],this.size=0}function assocIndexOf(a,s){for(var c=a.length;c--;)if(eq(a[c][0],s))return c;return-1}var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(a){var s=this.__data__,c=assocIndexOf(s,a);if(c<0)return!1;var u=s.length-1;return c==u?s.pop():splice.call(s,c,1),--this.size,!0}function listCacheGet(a){var s=this.__data__,c=assocIndexOf(s,a);return c<0?void 0:s[c][1]}function listCacheHas(a){return assocIndexOf(this.__data__,a)>-1}function listCacheSet(a,s){var c=this.__data__,u=assocIndexOf(c,a);return u<0?(++this.size,c.push([a,s])):c[u][1]=s,this}function ListCache(a){var s=-1,c=a==null?0:a.length;for(this.clear();++s<c;){var u=a[s];this.set(u[0],u[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map$1=getNative(root,"Map");function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}function isKeyable(a){var s=typeof a;return s=="string"||s=="number"||s=="symbol"||s=="boolean"?a!=="__proto__":a===null}function getMapData(a,s){var c=a.__data__;return isKeyable(s)?c[typeof s=="string"?"string":"hash"]:c.map}function mapCacheDelete(a){var s=getMapData(this,a).delete(a);return this.size-=s?1:0,s}function mapCacheGet(a){return getMapData(this,a).get(a)}function mapCacheHas(a){return getMapData(this,a).has(a)}function mapCacheSet(a,s){var c=getMapData(this,a),u=c.size;return c.set(a,s),this.size+=c.size==u?0:1,this}function MapCache(a){var s=-1,c=a==null?0:a.length;for(this.clear();++s<c;){var u=a[s];this.set(u[0],u[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT$1="Expected a function";function memoize(a,s){if(typeof a!="function"||s!=null&&typeof s!="function")throw new TypeError(FUNC_ERROR_TEXT$1);var c=function(){var u=arguments,d=s?s.apply(this,u):u[0],p=c.cache;if(p.has(d))return p.get(d);var v=a.apply(this,u);return c.cache=p.set(d,v)||p,v};return c.cache=new(memoize.Cache||MapCache),c}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(a){var s=memoize(a,function(u){return c.size===MAX_MEMOIZE_SIZE&&c.clear(),u}),c=s.cache;return s}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped(function(a){var s=[];return a.charCodeAt(0)===46&&s.push(""),a.replace(rePropName,function(c,u,d,p){s.push(d?p.replace(reEscapeChar,"$1"):u||c)}),s});function toString(a){return a==null?"":baseToString(a)}function castPath(a,s){return isArray$2(a)?a:isKey(a,s)?[a]:stringToPath(toString(a))}function toKey(a){if(typeof a=="string"||isSymbol(a))return a;var s=a+"";return s=="0"&&1/a==-1/0?"-0":s}function baseGet(a,s){s=castPath(s,a);for(var c=0,u=s.length;a!=null&&c<u;)a=a[toKey(s[c++])];return c&&c==u?a:void 0}function get(a,s,c){var u=a==null?void 0:baseGet(a,s);return u===void 0?c:u}function arrayPush(a,s){for(var c=-1,u=s.length,d=a.length;++c<u;)a[d+c]=s[c];return a}var getPrototype=overArg(Object.getPrototypeOf,Object),objectTag$3="[object Object]",funcProto=Function.prototype,objectProto$5=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$4=objectProto$5.hasOwnProperty,objectCtorString=funcToString.call(Object);function isPlainObject(a){if(!isObjectLike(a)||baseGetTag(a)!=objectTag$3)return!1;var s=getPrototype(a);if(s===null)return!0;var c=hasOwnProperty$4.call(s,"constructor")&&s.constructor;return typeof c=="function"&&c instanceof c&&funcToString.call(c)==objectCtorString}function baseSlice(a,s,c){var u=-1,d=a.length;s<0&&(s=-s>d?0:d+s),c=c>d?d:c,c<0&&(c+=d),d=s>c?0:c-s>>>0,s>>>=0;for(var p=Array(d);++u<d;)p[u]=a[u+s];return p}function stackClear(){this.__data__=new ListCache,this.size=0}function stackDelete(a){var s=this.__data__,c=s.delete(a);return this.size=s.size,c}function stackGet(a){return this.__data__.get(a)}function stackHas(a){return this.__data__.has(a)}var LARGE_ARRAY_SIZE=200;function stackSet(a,s){var c=this.__data__;if(c instanceof ListCache){var u=c.__data__;if(!Map$1||u.length<LARGE_ARRAY_SIZE-1)return u.push([a,s]),this.size=++c.size,this;c=this.__data__=new MapCache(u)}return c.set(a,s),this.size=c.size,this}function Stack(a){var s=this.__data__=new ListCache(a);this.size=s.size}Stack.prototype.clear=stackClear,Stack.prototype.delete=stackDelete,Stack.prototype.get=stackGet,Stack.prototype.has=stackHas,Stack.prototype.set=stackSet;var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer$1=moduleExports?root.Buffer:void 0,allocUnsafe=Buffer$1?Buffer$1.allocUnsafe:void 0;function cloneBuffer(a,s){if(s)return a.slice();var c=a.length,u=allocUnsafe?allocUnsafe(c):new a.constructor(c);return a.copy(u),u}function arrayFilter(a,s){for(var c=-1,u=a==null?0:a.length,d=0,p=[];++c<u;){var v=a[c];s(v,c,a)&&(p[d++]=v)}return p}function stubArray(){return[]}var objectProto$4=Object.prototype,propertyIsEnumerable=objectProto$4.propertyIsEnumerable,nativeGetSymbols$1=Object.getOwnPropertySymbols,getSymbols=nativeGetSymbols$1?function(a){return a==null?[]:(a=Object(a),arrayFilter(nativeGetSymbols$1(a),function(s){return propertyIsEnumerable.call(a,s)}))}:stubArray,nativeGetSymbols=Object.getOwnPropertySymbols,getSymbolsIn=nativeGetSymbols?function(a){for(var s=[];a;)arrayPush(s,getSymbols(a)),a=getPrototype(a);return s}:stubArray;function baseGetAllKeys(a,s,c){var u=s(a);return isArray$2(a)?u:arrayPush(u,c(a))}function getAllKeys(a){return baseGetAllKeys(a,keys,getSymbols)}function getAllKeysIn(a){return baseGetAllKeys(a,keysIn,getSymbolsIn)}var DataView$1=getNative(root,"DataView"),Promise$1=getNative(root,"Promise"),Set$1=getNative(root,"Set"),mapTag$4="[object Map]",objectTag$2="[object Object]",promiseTag="[object Promise]",setTag$4="[object Set]",weakMapTag$1="[object WeakMap]",dataViewTag$3="[object DataView]",dataViewCtorString=toSource(DataView$1),mapCtorString=toSource(Map$1),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set$1),weakMapCtorString=toSource(WeakMap$1),getTag=baseGetTag;(DataView$1&&getTag(new DataView$1(new ArrayBuffer(1)))!=dataViewTag$3||Map$1&&getTag(new Map$1)!=mapTag$4||Promise$1&&getTag(Promise$1.resolve())!=promiseTag||Set$1&&getTag(new Set$1)!=setTag$4||WeakMap$1&&getTag(new WeakMap$1)!=weakMapTag$1)&&(getTag=function(a){var s=baseGetTag(a),c=s==objectTag$2?a.constructor:void 0,u=c?toSource(c):"";if(u)switch(u){case dataViewCtorString:return dataViewTag$3;case mapCtorString:return mapTag$4;case promiseCtorString:return promiseTag;case setCtorString:return setTag$4;case weakMapCtorString:return weakMapTag$1}return s});var objectProto$3=Object.prototype,hasOwnProperty$3=objectProto$3.hasOwnProperty;function initCloneArray(a){var s=a.length,c=new a.constructor(s);return s&&typeof a[0]=="string"&&hasOwnProperty$3.call(a,"index")&&(c.index=a.index,c.input=a.input),c}var Uint8Array$1=root.Uint8Array;function cloneArrayBuffer(a){var s=new a.constructor(a.byteLength);return new Uint8Array$1(s).set(new Uint8Array$1(a)),s}function cloneDataView(a,s){var c=cloneArrayBuffer(a.buffer);return new a.constructor(c,a.byteOffset,a.byteLength)}var reFlags=/\w*$/;function cloneRegExp(a){var s=new a.constructor(a.source,reFlags.exec(a));return s.lastIndex=a.lastIndex,s}var symbolProto$1=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf$1=symbolProto$1?symbolProto$1.valueOf:void 0;function cloneSymbol(a){return symbolValueOf$1?Object(symbolValueOf$1.call(a)):{}}function cloneTypedArray(a,s){var c=s?cloneArrayBuffer(a.buffer):a.buffer;return new a.constructor(c,a.byteOffset,a.length)}var boolTag$2="[object Boolean]",dateTag$2="[object Date]",mapTag$3="[object Map]",numberTag$2="[object Number]",regexpTag$2="[object RegExp]",setTag$3="[object Set]",stringTag$2="[object String]",symbolTag$2="[object Symbol]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$2="[object DataView]",float32Tag$1="[object Float32Array]",float64Tag$1="[object Float64Array]",int8Tag$1="[object Int8Array]",int16Tag$1="[object Int16Array]",int32Tag$1="[object Int32Array]",uint8Tag$1="[object Uint8Array]",uint8ClampedTag$1="[object Uint8ClampedArray]",uint16Tag$1="[object Uint16Array]",uint32Tag$1="[object Uint32Array]";function initCloneByTag(a,s,c){var u=a.constructor;switch(s){case arrayBufferTag$2:return cloneArrayBuffer(a);case boolTag$2:case dateTag$2:return new u(+a);case dataViewTag$2:return cloneDataView(a);case float32Tag$1:case float64Tag$1:case int8Tag$1:case int16Tag$1:case int32Tag$1:case uint8Tag$1:case uint8ClampedTag$1:case uint16Tag$1:case uint32Tag$1:return cloneTypedArray(a,c);case mapTag$3:return new u;case numberTag$2:case stringTag$2:return new u(a);case regexpTag$2:return cloneRegExp(a);case setTag$3:return new u;case symbolTag$2:return cloneSymbol(a)}}function initCloneObject(a){return typeof a.constructor=="function"&&!isPrototype(a)?baseCreate(getPrototype(a)):{}}var mapTag$2="[object Map]";function baseIsMap(a){return isObjectLike(a)&&getTag(a)==mapTag$2}var nodeIsMap=nodeUtil&&nodeUtil.isMap,isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap,setTag$2="[object Set]";function baseIsSet(a){return isObjectLike(a)&&getTag(a)==setTag$2}var nodeIsSet=nodeUtil&&nodeUtil.isSet,isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet,CLONE_DEEP_FLAG$1=1,argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag$1="[object Boolean]",dateTag$1="[object Date]",errorTag$1="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag$1="[object Map]",numberTag$1="[object Number]",objectTag$1="[object Object]",regexpTag$1="[object RegExp]",setTag$1="[object Set]",stringTag$1="[object String]",symbolTag$1="[object Symbol]",weakMapTag="[object WeakMap]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",cloneableTags={};cloneableTags[argsTag$1]=cloneableTags[arrayTag$1]=cloneableTags[arrayBufferTag$1]=cloneableTags[dataViewTag$1]=cloneableTags[boolTag$1]=cloneableTags[dateTag$1]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag$1]=cloneableTags[numberTag$1]=cloneableTags[objectTag$1]=cloneableTags[regexpTag$1]=cloneableTags[setTag$1]=cloneableTags[stringTag$1]=cloneableTags[symbolTag$1]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag$1]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=!1;function baseClone(a,s,c,u,d,p){var v,A=s&CLONE_DEEP_FLAG$1;if(v!==void 0)return v;if(!isObject$3(a))return a;var x=isArray$2(a);if(x)v=initCloneArray(a);else{var g=getTag(a),b=g==funcTag||g==genTag;if(isBuffer(a))return cloneBuffer(a,A);if(g==objectTag$1||g==argsTag$1||b&&!d)v=b?{}:initCloneObject(a);else{if(!cloneableTags[g])return d?a:{};v=initCloneByTag(a,g,A)}}p||(p=new Stack);var y=p.get(a);if(y)return y;p.set(a,v),isSet(a)?a.forEach(function(E){v.add(baseClone(E,s,c,E,a,p))}):isMap(a)&&a.forEach(function(E,w){v.set(w,baseClone(E,s,c,w,a,p))});var f=getAllKeys,m=x?void 0:f(a);return arrayEach(m||a,function(E,w){m&&(w=E,E=a[w]),assignValue(v,w,baseClone(E,s,c,w,a,p))}),v}var CLONE_DEEP_FLAG=1,CLONE_SYMBOLS_FLAG=4;function cloneDeep(a){return baseClone(a,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}var HASH_UNDEFINED="__lodash_hash_undefined__";function setCacheAdd(a){return this.__data__.set(a,HASH_UNDEFINED),this}function setCacheHas(a){return this.__data__.has(a)}function SetCache(a){var s=-1,c=a==null?0:a.length;for(this.__data__=new MapCache;++s<c;)this.add(a[s])}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas;function arraySome(a,s){for(var c=-1,u=a==null?0:a.length;++c<u;)if(s(a[c],c,a))return!0;return!1}function cacheHas(a,s){return a.has(s)}var COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;function equalArrays(a,s,c,u,d,p){var v=c&COMPARE_PARTIAL_FLAG$5,A=a.length,x=s.length;if(A!=x&&!(v&&x>A))return!1;var g=p.get(a),b=p.get(s);if(g&&b)return g==s&&b==a;var y=-1,f=!0,m=c&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(p.set(a,s),p.set(s,a);++y<A;){var E=a[y],w=s[y];if(u)var S=v?u(w,E,y,s,a,p):u(E,w,y,a,s,p);if(S!==void 0){if(S)continue;f=!1;break}if(m){if(!arraySome(s,function($,T){if(!cacheHas(m,T)&&(E===$||d(E,$,c,u,p)))return m.push(T)})){f=!1;break}}else if(!(E===w||d(E,w,c,u,p))){f=!1;break}}return p.delete(a),p.delete(s),f}function mapToArray(a){var s=-1,c=Array(a.size);return a.forEach(function(u,d){c[++s]=[d,u]}),c}function setToArray(a){var s=-1,c=Array(a.size);return a.forEach(function(u){c[++s]=u}),c}var COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2,boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",mapTag="[object Map]",numberTag="[object Number]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;function equalByTag(a,s,c,u,d,p,v){switch(c){case dataViewTag:if(a.byteLength!=s.byteLength||a.byteOffset!=s.byteOffset)return!1;a=a.buffer,s=s.buffer;case arrayBufferTag:return!(a.byteLength!=s.byteLength||!p(new Uint8Array$1(a),new Uint8Array$1(s)));case boolTag:case dateTag:case numberTag:return eq(+a,+s);case errorTag:return a.name==s.name&&a.message==s.message;case regexpTag:case stringTag:return a==s+"";case mapTag:var A=mapToArray;case setTag:var x=u&COMPARE_PARTIAL_FLAG$4;if(A||(A=setToArray),a.size!=s.size&&!x)return!1;var g=v.get(a);if(g)return g==s;u|=COMPARE_UNORDERED_FLAG$2,v.set(a,s);var b=equalArrays(A(a),A(s),u,d,p,v);return v.delete(a),b;case symbolTag:if(symbolValueOf)return symbolValueOf.call(a)==symbolValueOf.call(s)}return!1}var COMPARE_PARTIAL_FLAG$3=1,objectProto$2=Object.prototype,hasOwnProperty$2=objectProto$2.hasOwnProperty;function equalObjects(a,s,c,u,d,p){var v=c&COMPARE_PARTIAL_FLAG$3,A=getAllKeys(a),x=A.length,g=getAllKeys(s),b=g.length;if(x!=b&&!v)return!1;for(var y=x;y--;){var f=A[y];if(!(v?f in s:hasOwnProperty$2.call(s,f)))return!1}var m=p.get(a),E=p.get(s);if(m&&E)return m==s&&E==a;var w=!0;p.set(a,s),p.set(s,a);for(var S=v;++y<x;){f=A[y];var $=a[f],T=s[f];if(u)var I=v?u(T,$,f,s,a,p):u($,T,f,a,s,p);if(!(I===void 0?$===T||d($,T,c,u,p):I)){w=!1;break}S||(S=f=="constructor")}if(w&&!S){var _=a.constructor,C=s.constructor;_!=C&&"constructor"in a&&"constructor"in s&&!(typeof _=="function"&&_ instanceof _&&typeof C=="function"&&C instanceof C)&&(w=!1)}return p.delete(a),p.delete(s),w}var COMPARE_PARTIAL_FLAG$2=1,argsTag="[object Arguments]",arrayTag="[object Array]",objectTag="[object Object]",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function baseIsEqualDeep(a,s,c,u,d,p){var v=isArray$2(a),A=isArray$2(s),x=v?arrayTag:getTag(a),g=A?arrayTag:getTag(s);x=x==argsTag?objectTag:x,g=g==argsTag?objectTag:g;var b=x==objectTag,y=g==objectTag,f=x==g;if(f&&isBuffer(a)){if(!isBuffer(s))return!1;v=!0,b=!1}if(f&&!b)return p||(p=new Stack),v||isTypedArray(a)?equalArrays(a,s,c,u,d,p):equalByTag(a,s,x,c,u,d,p);if(!(c&COMPARE_PARTIAL_FLAG$2)){var m=b&&hasOwnProperty$1.call(a,"__wrapped__"),E=y&&hasOwnProperty$1.call(s,"__wrapped__");if(m||E){var w=m?a.value():a,S=E?s.value():s;return p||(p=new Stack),d(w,S,c,u,p)}}return f?(p||(p=new Stack),equalObjects(a,s,c,u,d,p)):!1}function baseIsEqual(a,s,c,u,d){return a===s?!0:a==null||s==null||!isObjectLike(a)&&!isObjectLike(s)?a!==a&&s!==s:baseIsEqualDeep(a,s,c,u,baseIsEqual,d)}var COMPARE_PARTIAL_FLAG$1=1,COMPARE_UNORDERED_FLAG$1=2;function baseIsMatch(a,s,c,u){var d=c.length,p=d;if(a==null)return!p;for(a=Object(a);d--;){var v=c[d];if(v[2]?v[1]!==a[v[0]]:!(v[0]in a))return!1}for(;++d<p;){v=c[d];var A=v[0],x=a[A],g=v[1];if(v[2]){if(x===void 0&&!(A in a))return!1}else{var b=new Stack,y;if(!(y===void 0?baseIsEqual(g,x,COMPARE_PARTIAL_FLAG$1|COMPARE_UNORDERED_FLAG$1,u,b):y))return!1}}return!0}function isStrictComparable(a){return a===a&&!isObject$3(a)}function getMatchData(a){for(var s=keys(a),c=s.length;c--;){var u=s[c],d=a[u];s[c]=[u,d,isStrictComparable(d)]}return s}function matchesStrictComparable(a,s){return function(c){return c==null?!1:c[a]===s&&(s!==void 0||a in Object(c))}}function baseMatches(a){var s=getMatchData(a);return s.length==1&&s[0][2]?matchesStrictComparable(s[0][0],s[0][1]):function(c){return c===a||baseIsMatch(c,a,s)}}function baseHasIn(a,s){return a!=null&&s in Object(a)}function hasPath(a,s,c){s=castPath(s,a);for(var u=-1,d=s.length,p=!1;++u<d;){var v=toKey(s[u]);if(!(p=a!=null&&c(a,v)))break;a=a[v]}return p||++u!=d?p:(d=a==null?0:a.length,!!d&&isLength(d)&&isIndex(v,d)&&(isArray$2(a)||isArguments(a)))}function hasIn(a,s){return a!=null&&hasPath(a,s,baseHasIn)}var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;function baseMatchesProperty(a,s){return isKey(a)&&isStrictComparable(s)?matchesStrictComparable(toKey(a),s):function(c){var u=get(c,a);return u===void 0&&u===s?hasIn(c,a):baseIsEqual(s,u,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG)}}function baseProperty(a){return function(s){return s?.[a]}}function basePropertyDeep(a){return function(s){return baseGet(s,a)}}function property(a){return isKey(a)?baseProperty(toKey(a)):basePropertyDeep(a)}function baseIteratee(a){return typeof a=="function"?a:a==null?identity$1:typeof a=="object"?isArray$2(a)?baseMatchesProperty(a[0],a[1]):baseMatches(a):property(a)}function createBaseFor(a){return function(s,c,u){for(var d=-1,p=Object(s),v=u(s),A=v.length;A--;){var x=v[++d];if(c(p[x],x,p)===!1)break}return s}}var baseFor=createBaseFor();function baseForOwn(a,s){return a&&baseFor(a,s,keys)}function createBaseEach(a,s){return function(c,u){if(c==null)return c;if(!isArrayLike(c))return a(c,u);for(var d=c.length,p=-1,v=Object(c);++p<d&&u(v[p],p,v)!==!1;);return c}}var baseEach=createBaseEach(baseForOwn);function assignMergeValue(a,s,c){(c!==void 0&&!eq(a[s],c)||c===void 0&&!(s in a))&&baseAssignValue(a,s,c)}function isArrayLikeObject(a){return isObjectLike(a)&&isArrayLike(a)}function safeGet$1(a,s){if(!(s==="constructor"&&typeof a[s]=="function")&&s!="__proto__")return a[s]}function toPlainObject(a){return copyObject(a,keysIn(a))}function baseMergeDeep(a,s,c,u,d,p,v){var A=safeGet$1(a,c),x=safeGet$1(s,c),g=v.get(x);if(g){assignMergeValue(a,c,g);return}var b=p?p(A,x,c+"",a,s,v):void 0,y=b===void 0;if(y){var f=isArray$2(x),m=!f&&isBuffer(x),E=!f&&!m&&isTypedArray(x);b=x,f||m||E?isArray$2(A)?b=A:isArrayLikeObject(A)?b=copyArray(A):m?(y=!1,b=cloneBuffer(x,!0)):E?(y=!1,b=cloneTypedArray(x,!0)):b=[]:isPlainObject(x)||isArguments(x)?(b=A,isArguments(A)?b=toPlainObject(A):(!isObject$3(A)||isFunction$2(A))&&(b=initCloneObject(x))):y=!1}y&&(v.set(x,b),d(b,x,u,p,v),v.delete(x)),assignMergeValue(a,c,b)}function baseMerge(a,s,c,u,d){a!==s&&baseFor(s,function(p,v){if(d||(d=new Stack),isObject$3(p))baseMergeDeep(a,s,v,c,baseMerge,u,d);else{var A=u?u(safeGet$1(a,v),p,v+"",a,s,d):void 0;A===void 0&&(A=p),assignMergeValue(a,v,A)}},keysIn)}createAssigner(function(a,s,c,u){baseMerge(a,s,c,u)});function last(a){var s=a==null?0:a.length;return s?a[s-1]:void 0}var objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function baseHas(a,s){return a!=null&&hasOwnProperty.call(a,s)}function has(a,s){return a!=null&&hasPath(a,s,baseHas)}function parent(a,s){return s.length<2?a:baseGet(a,baseSlice(s,0,-1))}function isMatch(a,s){return a===s||baseIsMatch(a,s,getMatchData(s))}function isUndefined$1(a){return a===void 0}createAssigner(function(a,s,c){baseMerge(a,s,c)});var FUNC_ERROR_TEXT="Expected a function";function negate(a){if(typeof a!="function")throw new TypeError(FUNC_ERROR_TEXT);return function(){var s=arguments;switch(s.length){case 0:return!a.call(this);case 1:return!a.call(this,s[0]);case 2:return!a.call(this,s[0],s[1]);case 3:return!a.call(this,s[0],s[1],s[2])}return!a.apply(this,s)}}function baseUnset(a,s){return s=castPath(s,a),a=parent(a,s),a==null||delete a[toKey(last(s))]}function baseSet(a,s,c,u){if(!isObject$3(a))return a;s=castPath(s,a);for(var d=-1,p=s.length,v=p-1,A=a;A!=null&&++d<p;){var x=toKey(s[d]),g=c;if(x==="__proto__"||x==="constructor"||x==="prototype")return a;if(d!=v){var b=A[x];g=void 0,g===void 0&&(g=isObject$3(b)?b:isIndex(s[d+1])?[]:{})}assignValue(A,x,g),A=A[x]}return a}function basePickBy(a,s,c){for(var u=-1,d=s.length,p={};++u<d;){var v=s[u],A=baseGet(a,v);c(A,v)&&baseSet(p,castPath(v,a),A)}return p}function pickBy(a,s){if(a==null)return{};var c=arrayMap(getAllKeysIn(a),function(u){return[u]});return s=baseIteratee(s),basePickBy(a,c,function(u,d){return s(u,d[0])})}function omitBy(a,s){return pickBy(a,negate(baseIteratee(s)))}function set(a,s,c){return a==null?a:baseSet(a,s,c)}function baseSome(a,s){var c;return baseEach(a,function(u,d,p){return c=s(u,d,p),!c}),!!c}function some$1(a,s,c){var u=isArray$2(a)?arraySome:baseSome;return c&&isIterateeCall(a,s,c)&&(s=void 0),u(a,baseIteratee(s))}function unset(a,s){return a==null?!0:baseUnset(a,s)}const __vite_import_meta_env__={},createStoreImpl=a=>{let s;const c=new Set,u=(b,y)=>{const f=typeof b=="function"?b(s):b;if(!Object.is(f,s)){const m=s;s=y??(typeof f!="object"||f===null)?f:Object.assign({},s,f),c.forEach(E=>E(s,m))}},d=()=>s,x={setState:u,getState:d,getInitialState:()=>g,subscribe:b=>(c.add(b),()=>c.delete(b)),destroy:()=>{(__vite_import_meta_env__?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),c.clear()}},g=s=a(u,d,x);return x},createStore$1=a=>a?createStoreImpl(a):createStoreImpl;var withSelector={exports:{}},withSelector_production={},shim={exports:{}},useSyncExternalStoreShim_production={};var hasRequiredUseSyncExternalStoreShim_production;function requireUseSyncExternalStoreShim_production(){if(hasRequiredUseSyncExternalStoreShim_production)return useSyncExternalStoreShim_production;hasRequiredUseSyncExternalStoreShim_production=1;var a=requireReact();function s(y,f){return y===f&&(y!==0||1/y===1/f)||y!==y&&f!==f}var c=typeof Object.is=="function"?Object.is:s,u=a.useState,d=a.useEffect,p=a.useLayoutEffect,v=a.useDebugValue;function A(y,f){var m=f(),E=u({inst:{value:m,getSnapshot:f}}),w=E[0].inst,S=E[1];return p(function(){w.value=m,w.getSnapshot=f,x(w)&&S({inst:w})},[y,m,f]),d(function(){return x(w)&&S({inst:w}),y(function(){x(w)&&S({inst:w})})},[y]),v(m),m}function x(y){var f=y.getSnapshot;y=y.value;try{var m=f();return!c(y,m)}catch{return!0}}function g(y,f){return f()}var b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:A;return useSyncExternalStoreShim_production.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:b,useSyncExternalStoreShim_production}var hasRequiredShim;function requireShim(){return hasRequiredShim||(hasRequiredShim=1,shim.exports=requireUseSyncExternalStoreShim_production()),shim.exports}var hasRequiredWithSelector_production;function requireWithSelector_production(){if(hasRequiredWithSelector_production)return withSelector_production;hasRequiredWithSelector_production=1;var a=requireReact(),s=requireShim();function c(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var u=typeof Object.is=="function"?Object.is:c,d=s.useSyncExternalStore,p=a.useRef,v=a.useEffect,A=a.useMemo,x=a.useDebugValue;return withSelector_production.useSyncExternalStoreWithSelector=function(g,b,y,f,m){var E=p(null);if(E.current===null){var w={hasValue:!1,value:null};E.current=w}else w=E.current;E=A(function(){function $(P){if(!T){if(T=!0,I=P,P=f(P),m!==void 0&&w.hasValue){var O=w.value;if(m(O,P))return _=O}return _=P}if(O=_,u(I,P))return O;var L=f(P);return m!==void 0&&m(O,L)?(I=P,O):(I=P,_=L)}var T=!1,I,_,C=y===void 0?null:y;return[function(){return $(b())},C===null?void 0:function(){return $(C())}]},[b,y,f,m]);var S=d(g,E[0],E[1]);return v(function(){w.hasValue=!0,w.value=S},[S]),x(S),S},withSelector_production}var hasRequiredWithSelector;function requireWithSelector(){return hasRequiredWithSelector||(hasRequiredWithSelector=1,withSelector.exports=requireWithSelector_production()),withSelector.exports}var withSelectorExports=requireWithSelector();const useSyncExternalStoreExports=getDefaultExportFromCjs(withSelectorExports),{useDebugValue}=React,{useSyncExternalStoreWithSelector}=useSyncExternalStoreExports,identity=a=>a;function useStore(a,s=identity,c){const u=useSyncExternalStoreWithSelector(a.subscribe,a.getState,a.getServerState||a.getInitialState,s,c);return useDebugValue(u),u}var FRContext=reactExports.createContext(null),ConfigContext=reactExports.createContext(null),displayTypeEnum={column:"vertical",row:"horizontal",inline:"inline"},transformProps=function a(s){var c=s.schema,u=s.beforeFinish,d=s.onMount,p=s.displayType,v=p===void 0?"column":p,A=s.watch,x=s.removeHiddenData,g=x===void 0?!0:x,b=s.readOnly,y=s.column,f=y===void 0?1:y,m=s.mapping,E=s.debugCss,w=s.locale,S=s.configProvider,$=s.validateMessages,T=s.debug,I=s.id,_=s.labelWidth,C=s.maxWidth,P=s.form,O=s.onFinish,L=s.onFinishFailed,B=s.footer,F=s.operateExtra,D=s.logOnMount,G=s.logOnSubmit,j=s.labelCol,V=s.fieldCol,U=s.disabled,M=s.className,N=s.validateTrigger,R=s.antdVersion,k=__rest$16(s,["schema","beforeFinish","onMount","displayType","watch","removeHiddenData","readOnly","column","mapping","debugCss","locale","configProvider","validateMessages","debug","id","labelWidth","maxWidth","form","onFinish","onFinishFailed","footer","operateExtra","logOnMount","logOnSubmit","labelCol","fieldCol","disabled","className","validateTrigger","antdVersion"]),H=Object.assign({},k);return v&&(H.layout=displayTypeEnum[v]||"horizontal"),{formProps:H,schema:c,displayType:v,onFinish:O,beforeFinish:u,onMount:d,watch:A,readOnly:b,disabled:U,column:f,mapping:m,debugCss:E,locale:w,configProvider:S,footer:B,form:P,labelWidth:_,validateMessages:$,debug:T,id:I,onFinishFailed:L,removeHiddenData:g,operateExtra:F,logOnMount:D,logOnSubmit:G,labelCol:j,fieldCol:V,maxWidth:C,className:M,validateTrigger:N,antdVersion:R}},_set=set,_get=get,_cloneDeep=cloneDeep,_some=some$1,_isMatch=isMatch,isObject$2=function a(s){var c=Object.prototype.toString.call(s);return c.indexOf("Object")>-1},isArray$1=function a(s){var c=Object.prototype.toString.call(s);return c.indexOf("Array")>-1},isFunction$1=function a(s){return typeof s=="function"};function isUrl$1(a){var s=/^(?:\w+:)?\/\/(\S+)$/;return typeof a!="string"?!1:s.test(a)}var isNumber$1=function a(s){return!isNaN(Number(s))},getArray=function a(s){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return Array.isArray(s)?s:c};function isObjType(a){return a?.type==="object"&&a?.properties&&a?.widgetType!=="field"}function isListType(a){return a?.type==="array"&&isObjType(a?.items)&&a?.enum===void 0}function isCheckBoxType(a,s){if(s)return!1;if(a.widget==="checkbox")return!0;if(a&&a.type==="boolean")return a.enum?!1:a.widget===void 0}var translation$1=function a(s){return function(c){var u=s?.locale.FormRender;return u[c]}},_hasFuncProperty=function a(s){return _some(s,function(c){return isFunction$1(c)?!0:isObject$2(c)?_hasFuncProperty(c):!1})},safeGet=function a(s,c,u){var d;return(d=get(s,c,u))!==null&&d!==void 0?d:u};function _typeof$g(a){"@babel/helpers - typeof";return _typeof$g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},_typeof$g(a)}function _defineProperty$9(a,s,c){return(s=_toPropertyKey$7(s))in a?Object.defineProperty(a,s,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[s]=c,a}function _toPropertyKey$7(a){var s=_toPrimitive$8(a,"string");return _typeof$g(s)=="symbol"?s:s+""}function _toPrimitive$8(a,s){if(_typeof$g(a)!="object"||!a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var u=c.call(a,s);if(_typeof$g(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}function _toConsumableArray$d(a){return _arrayWithoutHoles$d(a)||_iterableToArray$d(a)||_unsupportedIterableToArray$l(a)||_nonIterableSpread$d()}function _nonIterableSpread$d(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
551
+ `)),y(!0)};return jsxRuntimeExports.jsxs("div",{className:DESIGNER_CLASSNAME+"list-view",children:[jsxRuntimeExports.jsx("div",{style:{height:headHeight,display:"flex",alignItems:"center"},children:jsxRuntimeExports.jsx(Text$3,{strong:!0,style:{textAlign:"center",width:"100%"},children:g("fieldsList")})}),jsxRuntimeExports.jsx(Divider,{style:{marginTop:x.marginXS,marginBottom:x.marginXS}}),jsxRuntimeExports.jsxs("div",{style:{height:E-headHeight},children:[b?jsxRuntimeExports.jsx(TextArea$2,{wrap:"off",value:f,onChange:$=>m($.target.value),style:{paddingLeft:30,height:E-headHeight,width:RIGHT_SIDEBAR_WIDTH-35,lineHeight:"2.75rem"}}):jsxRuntimeExports.jsx(SelectableSortableContainer,{schemas:s,hoveringSchemaId:p,onChangeHoveringSchemaId:v,onSortEnd:c,onEdit:u}),jsxRuntimeExports.jsx("div",{style:{paddingTop:"0.5rem",display:"flex",alignItems:"center",justifyContent:"flex-end"},children:b?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Button$1,{className:DESIGNER_CLASSNAME+"bulk-commit",size:"small",type:"text",onClick:w,children:jsxRuntimeExports.jsxs("u",{children:[" ",g("commitBulkUpdateFieldName")]})}),jsxRuntimeExports.jsx("span",{style:{margin:"0 1rem"},children:"/"}),jsxRuntimeExports.jsx(Button$1,{className:DESIGNER_CLASSNAME+"bulk-cancel",size:"small",type:"text",onClick:()=>y(!1),children:jsxRuntimeExports.jsxs("u",{children:[" ",g("cancel")]})})]}):jsxRuntimeExports.jsx(Button$1,{className:DESIGNER_CLASSNAME+"bulk-update",size:"small",type:"text",onClick:S,children:jsxRuntimeExports.jsxs("u",{children:[" ",g("bulkUpdateFieldName")]})})})]})]})};var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root.Symbol,objectProto$g=Object.prototype,hasOwnProperty$d=objectProto$g.hasOwnProperty,nativeObjectToString$1=objectProto$g.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(a){var s=hasOwnProperty$d.call(a,symToStringTag$1),c=a[symToStringTag$1];try{a[symToStringTag$1]=void 0;var u=!0}catch{}var d=nativeObjectToString$1.call(a);return u&&(s?a[symToStringTag$1]=c:delete a[symToStringTag$1]),d}var objectProto$f=Object.prototype,nativeObjectToString=objectProto$f.toString;function objectToString(a){return nativeObjectToString.call(a)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(a){return a==null?a===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(a)?getRawTag(a):objectToString(a)}function isObjectLike(a){return a!=null&&typeof a=="object"}var symbolTag$3="[object Symbol]";function isSymbol(a){return typeof a=="symbol"||isObjectLike(a)&&baseGetTag(a)==symbolTag$3}function arrayMap(a,s){for(var c=-1,u=a==null?0:a.length,d=Array(u);++c<u;)d[c]=s(a[c],c,a);return d}var isArray$2=Array.isArray,symbolProto$2=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto$2?symbolProto$2.toString:void 0;function baseToString(a){if(typeof a=="string")return a;if(isArray$2(a))return arrayMap(a,baseToString)+"";if(isSymbol(a))return symbolToString?symbolToString.call(a):"";var s=a+"";return s=="0"&&1/a==-1/0?"-0":s}function isObject$3(a){var s=typeof a;return a!=null&&(s=="object"||s=="function")}function identity$1(a){return a}var asyncTag="[object AsyncFunction]",funcTag$2="[object Function]",genTag$1="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$2(a){if(!isObject$3(a))return!1;var s=baseGetTag(a);return s==funcTag$2||s==genTag$1||s==asyncTag||s==proxyTag}var coreJsData=root["__core-js_shared__"],maskSrcKey=(function(){var a=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return a?"Symbol(src)_1."+a:""})();function isMasked(a){return!!maskSrcKey&&maskSrcKey in a}var funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource(a){if(a!=null){try{return funcToString$2.call(a)}catch{}try{return a+""}catch{}}return""}var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$e=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$c=objectProto$e.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$c).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(a){if(!isObject$3(a)||isMasked(a))return!1;var s=isFunction$2(a)?reIsNative:reIsHostCtor;return s.test(toSource(a))}function getValue$1(a,s){return a?.[s]}function getNative(a,s){var c=getValue$1(a,s);return baseIsNative(c)?c:void 0}var WeakMap$1=getNative(root,"WeakMap"),objectCreate=Object.create,baseCreate=(function(){function a(){}return function(s){if(!isObject$3(s))return{};if(objectCreate)return objectCreate(s);a.prototype=s;var c=new a;return a.prototype=void 0,c}})();function apply(a,s,c){switch(c.length){case 0:return a.call(s);case 1:return a.call(s,c[0]);case 2:return a.call(s,c[0],c[1]);case 3:return a.call(s,c[0],c[1],c[2])}return a.apply(s,c)}function copyArray(a,s){var c=-1,u=a.length;for(s||(s=Array(u));++c<u;)s[c]=a[c];return s}var HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;function shortOut(a){var s=0,c=0;return function(){var u=nativeNow(),d=HOT_SPAN-(u-c);if(c=u,d>0){if(++s>=HOT_COUNT)return arguments[0]}else s=0;return a.apply(void 0,arguments)}}function constant(a){return function(){return a}}var defineProperty$4=(function(){try{var a=getNative(Object,"defineProperty");return a({},"",{}),a}catch{}})(),baseSetToString=defineProperty$4?function(a,s){return defineProperty$4(a,"toString",{configurable:!0,enumerable:!1,value:constant(s),writable:!0})}:identity$1,setToString=shortOut(baseSetToString);function arrayEach(a,s){for(var c=-1,u=a==null?0:a.length;++c<u&&s(a[c],c,a)!==!1;);return a}var MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(a,s){var c=typeof a;return s=s??MAX_SAFE_INTEGER$1,!!s&&(c=="number"||c!="symbol"&&reIsUint.test(a))&&a>-1&&a%1==0&&a<s}function baseAssignValue(a,s,c){s=="__proto__"&&defineProperty$4?defineProperty$4(a,s,{configurable:!0,enumerable:!0,value:c,writable:!0}):a[s]=c}function eq(a,s){return a===s||a!==a&&s!==s}var objectProto$d=Object.prototype,hasOwnProperty$b=objectProto$d.hasOwnProperty;function assignValue(a,s,c){var u=a[s];(!(hasOwnProperty$b.call(a,s)&&eq(u,c))||c===void 0&&!(s in a))&&baseAssignValue(a,s,c)}function copyObject(a,s,c,u){var d=!c;c||(c={});for(var p=-1,v=s.length;++p<v;){var A=s[p],x=void 0;x===void 0&&(x=a[A]),d?baseAssignValue(c,A,x):assignValue(c,A,x)}return c}var nativeMax=Math.max;function overRest(a,s,c){return s=nativeMax(s===void 0?a.length-1:s,0),function(){for(var u=arguments,d=-1,p=nativeMax(u.length-s,0),v=Array(p);++d<p;)v[d]=u[s+d];d=-1;for(var A=Array(s+1);++d<s;)A[d]=u[d];return A[s]=c(v),apply(a,this,A)}}function baseRest(a,s){return setToString(overRest(a,s,identity$1),a+"")}var MAX_SAFE_INTEGER=9007199254740991;function isLength(a){return typeof a=="number"&&a>-1&&a%1==0&&a<=MAX_SAFE_INTEGER}function isArrayLike(a){return a!=null&&isLength(a.length)&&!isFunction$2(a)}function isIterateeCall(a,s,c){if(!isObject$3(c))return!1;var u=typeof s;return(u=="number"?isArrayLike(c)&&isIndex(s,c.length):u=="string"&&s in c)?eq(c[s],a):!1}function createAssigner(a){return baseRest(function(s,c){var u=-1,d=c.length,p=d>1?c[d-1]:void 0,v=d>2?c[2]:void 0;for(p=a.length>3&&typeof p=="function"?(d--,p):void 0,v&&isIterateeCall(c[0],c[1],v)&&(p=d<3?void 0:p,d=1),s=Object(s);++u<d;){var A=c[u];A&&a(s,A,u,p)}return s})}var objectProto$c=Object.prototype;function isPrototype(a){var s=a&&a.constructor,c=typeof s=="function"&&s.prototype||objectProto$c;return a===c}function baseTimes(a,s){for(var c=-1,u=Array(a);++c<a;)u[c]=s(c);return u}var argsTag$3="[object Arguments]";function baseIsArguments(a){return isObjectLike(a)&&baseGetTag(a)==argsTag$3}var objectProto$b=Object.prototype,hasOwnProperty$a=objectProto$b.hasOwnProperty,propertyIsEnumerable$1=objectProto$b.propertyIsEnumerable,isArguments=baseIsArguments((function(){return arguments})())?baseIsArguments:function(a){return isObjectLike(a)&&hasOwnProperty$a.call(a,"callee")&&!propertyIsEnumerable$1.call(a,"callee")};function stubFalse(){return!1}var freeExports$2=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$2=freeExports$2&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$2=freeModule$2&&freeModule$2.exports===freeExports$2,Buffer$2=moduleExports$2?root.Buffer:void 0,nativeIsBuffer=Buffer$2?Buffer$2.isBuffer:void 0,isBuffer=nativeIsBuffer||stubFalse,argsTag$2="[object Arguments]",arrayTag$2="[object Array]",boolTag$3="[object Boolean]",dateTag$3="[object Date]",errorTag$2="[object Error]",funcTag$1="[object Function]",mapTag$5="[object Map]",numberTag$3="[object Number]",objectTag$4="[object Object]",regexpTag$3="[object RegExp]",setTag$5="[object Set]",stringTag$3="[object String]",weakMapTag$2="[object WeakMap]",arrayBufferTag$3="[object ArrayBuffer]",dataViewTag$4="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0,typedArrayTags[argsTag$2]=typedArrayTags[arrayTag$2]=typedArrayTags[arrayBufferTag$3]=typedArrayTags[boolTag$3]=typedArrayTags[dataViewTag$4]=typedArrayTags[dateTag$3]=typedArrayTags[errorTag$2]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag$5]=typedArrayTags[numberTag$3]=typedArrayTags[objectTag$4]=typedArrayTags[regexpTag$3]=typedArrayTags[setTag$5]=typedArrayTags[stringTag$3]=typedArrayTags[weakMapTag$2]=!1;function baseIsTypedArray(a){return isObjectLike(a)&&isLength(a.length)&&!!typedArrayTags[baseGetTag(a)]}function baseUnary(a){return function(s){return a(s)}}var freeExports$1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal.process,nodeUtil=(function(){try{var a=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return a||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch{}})(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$a=Object.prototype,hasOwnProperty$9=objectProto$a.hasOwnProperty;function arrayLikeKeys(a,s){var c=isArray$2(a),u=!c&&isArguments(a),d=!c&&!u&&isBuffer(a),p=!c&&!u&&!d&&isTypedArray(a),v=c||u||d||p,A=v?baseTimes(a.length,String):[],x=A.length;for(var g in a)(s||hasOwnProperty$9.call(a,g))&&!(v&&(g=="length"||d&&(g=="offset"||g=="parent")||p&&(g=="buffer"||g=="byteLength"||g=="byteOffset")||isIndex(g,x)))&&A.push(g);return A}function overArg(a,s){return function(c){return a(s(c))}}var nativeKeys=overArg(Object.keys,Object),objectProto$9=Object.prototype,hasOwnProperty$8=objectProto$9.hasOwnProperty;function baseKeys(a){if(!isPrototype(a))return nativeKeys(a);var s=[];for(var c in Object(a))hasOwnProperty$8.call(a,c)&&c!="constructor"&&s.push(c);return s}function keys(a){return isArrayLike(a)?arrayLikeKeys(a):baseKeys(a)}function nativeKeysIn(a){var s=[];if(a!=null)for(var c in Object(a))s.push(c);return s}var objectProto$8=Object.prototype,hasOwnProperty$7=objectProto$8.hasOwnProperty;function baseKeysIn(a){if(!isObject$3(a))return nativeKeysIn(a);var s=isPrototype(a),c=[];for(var u in a)u=="constructor"&&(s||!hasOwnProperty$7.call(a,u))||c.push(u);return c}function keysIn(a){return isArrayLike(a)?arrayLikeKeys(a,!0):baseKeysIn(a)}var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(a,s){if(isArray$2(a))return!1;var c=typeof a;return c=="number"||c=="symbol"||c=="boolean"||a==null||isSymbol(a)?!0:reIsPlainProp.test(a)||!reIsDeepProp.test(a)||s!=null&&a in Object(s)}var nativeCreate=getNative(Object,"create");function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0}function hashDelete(a){var s=this.has(a)&&delete this.__data__[a];return this.size-=s?1:0,s}var HASH_UNDEFINED$2="__lodash_hash_undefined__",objectProto$7=Object.prototype,hasOwnProperty$6=objectProto$7.hasOwnProperty;function hashGet(a){var s=this.__data__;if(nativeCreate){var c=s[a];return c===HASH_UNDEFINED$2?void 0:c}return hasOwnProperty$6.call(s,a)?s[a]:void 0}var objectProto$6=Object.prototype,hasOwnProperty$5=objectProto$6.hasOwnProperty;function hashHas(a){var s=this.__data__;return nativeCreate?s[a]!==void 0:hasOwnProperty$5.call(s,a)}var HASH_UNDEFINED$1="__lodash_hash_undefined__";function hashSet(a,s){var c=this.__data__;return this.size+=this.has(a)?0:1,c[a]=nativeCreate&&s===void 0?HASH_UNDEFINED$1:s,this}function Hash(a){var s=-1,c=a==null?0:a.length;for(this.clear();++s<c;){var u=a[s];this.set(u[0],u[1])}}Hash.prototype.clear=hashClear,Hash.prototype.delete=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet;function listCacheClear(){this.__data__=[],this.size=0}function assocIndexOf(a,s){for(var c=a.length;c--;)if(eq(a[c][0],s))return c;return-1}var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(a){var s=this.__data__,c=assocIndexOf(s,a);if(c<0)return!1;var u=s.length-1;return c==u?s.pop():splice.call(s,c,1),--this.size,!0}function listCacheGet(a){var s=this.__data__,c=assocIndexOf(s,a);return c<0?void 0:s[c][1]}function listCacheHas(a){return assocIndexOf(this.__data__,a)>-1}function listCacheSet(a,s){var c=this.__data__,u=assocIndexOf(c,a);return u<0?(++this.size,c.push([a,s])):c[u][1]=s,this}function ListCache(a){var s=-1,c=a==null?0:a.length;for(this.clear();++s<c;){var u=a[s];this.set(u[0],u[1])}}ListCache.prototype.clear=listCacheClear,ListCache.prototype.delete=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet;var Map$1=getNative(root,"Map");function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}function isKeyable(a){var s=typeof a;return s=="string"||s=="number"||s=="symbol"||s=="boolean"?a!=="__proto__":a===null}function getMapData(a,s){var c=a.__data__;return isKeyable(s)?c[typeof s=="string"?"string":"hash"]:c.map}function mapCacheDelete(a){var s=getMapData(this,a).delete(a);return this.size-=s?1:0,s}function mapCacheGet(a){return getMapData(this,a).get(a)}function mapCacheHas(a){return getMapData(this,a).has(a)}function mapCacheSet(a,s){var c=getMapData(this,a),u=c.size;return c.set(a,s),this.size+=c.size==u?0:1,this}function MapCache(a){var s=-1,c=a==null?0:a.length;for(this.clear();++s<c;){var u=a[s];this.set(u[0],u[1])}}MapCache.prototype.clear=mapCacheClear,MapCache.prototype.delete=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT$1="Expected a function";function memoize(a,s){if(typeof a!="function"||s!=null&&typeof s!="function")throw new TypeError(FUNC_ERROR_TEXT$1);var c=function(){var u=arguments,d=s?s.apply(this,u):u[0],p=c.cache;if(p.has(d))return p.get(d);var v=a.apply(this,u);return c.cache=p.set(d,v)||p,v};return c.cache=new(memoize.Cache||MapCache),c}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(a){var s=memoize(a,function(u){return c.size===MAX_MEMOIZE_SIZE&&c.clear(),u}),c=s.cache;return s}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped(function(a){var s=[];return a.charCodeAt(0)===46&&s.push(""),a.replace(rePropName,function(c,u,d,p){s.push(d?p.replace(reEscapeChar,"$1"):u||c)}),s});function toString(a){return a==null?"":baseToString(a)}function castPath(a,s){return isArray$2(a)?a:isKey(a,s)?[a]:stringToPath(toString(a))}function toKey(a){if(typeof a=="string"||isSymbol(a))return a;var s=a+"";return s=="0"&&1/a==-1/0?"-0":s}function baseGet(a,s){s=castPath(s,a);for(var c=0,u=s.length;a!=null&&c<u;)a=a[toKey(s[c++])];return c&&c==u?a:void 0}function get(a,s,c){var u=a==null?void 0:baseGet(a,s);return u===void 0?c:u}function arrayPush(a,s){for(var c=-1,u=s.length,d=a.length;++c<u;)a[d+c]=s[c];return a}var getPrototype=overArg(Object.getPrototypeOf,Object),objectTag$3="[object Object]",funcProto=Function.prototype,objectProto$5=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$4=objectProto$5.hasOwnProperty,objectCtorString=funcToString.call(Object);function isPlainObject(a){if(!isObjectLike(a)||baseGetTag(a)!=objectTag$3)return!1;var s=getPrototype(a);if(s===null)return!0;var c=hasOwnProperty$4.call(s,"constructor")&&s.constructor;return typeof c=="function"&&c instanceof c&&funcToString.call(c)==objectCtorString}function baseSlice(a,s,c){var u=-1,d=a.length;s<0&&(s=-s>d?0:d+s),c=c>d?d:c,c<0&&(c+=d),d=s>c?0:c-s>>>0,s>>>=0;for(var p=Array(d);++u<d;)p[u]=a[u+s];return p}function stackClear(){this.__data__=new ListCache,this.size=0}function stackDelete(a){var s=this.__data__,c=s.delete(a);return this.size=s.size,c}function stackGet(a){return this.__data__.get(a)}function stackHas(a){return this.__data__.has(a)}var LARGE_ARRAY_SIZE=200;function stackSet(a,s){var c=this.__data__;if(c instanceof ListCache){var u=c.__data__;if(!Map$1||u.length<LARGE_ARRAY_SIZE-1)return u.push([a,s]),this.size=++c.size,this;c=this.__data__=new MapCache(u)}return c.set(a,s),this.size=c.size,this}function Stack(a){var s=this.__data__=new ListCache(a);this.size=s.size}Stack.prototype.clear=stackClear,Stack.prototype.delete=stackDelete,Stack.prototype.get=stackGet,Stack.prototype.has=stackHas,Stack.prototype.set=stackSet;var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer$1=moduleExports?root.Buffer:void 0,allocUnsafe=Buffer$1?Buffer$1.allocUnsafe:void 0;function cloneBuffer(a,s){if(s)return a.slice();var c=a.length,u=allocUnsafe?allocUnsafe(c):new a.constructor(c);return a.copy(u),u}function arrayFilter(a,s){for(var c=-1,u=a==null?0:a.length,d=0,p=[];++c<u;){var v=a[c];s(v,c,a)&&(p[d++]=v)}return p}function stubArray(){return[]}var objectProto$4=Object.prototype,propertyIsEnumerable=objectProto$4.propertyIsEnumerable,nativeGetSymbols$1=Object.getOwnPropertySymbols,getSymbols=nativeGetSymbols$1?function(a){return a==null?[]:(a=Object(a),arrayFilter(nativeGetSymbols$1(a),function(s){return propertyIsEnumerable.call(a,s)}))}:stubArray,nativeGetSymbols=Object.getOwnPropertySymbols,getSymbolsIn=nativeGetSymbols?function(a){for(var s=[];a;)arrayPush(s,getSymbols(a)),a=getPrototype(a);return s}:stubArray;function baseGetAllKeys(a,s,c){var u=s(a);return isArray$2(a)?u:arrayPush(u,c(a))}function getAllKeys(a){return baseGetAllKeys(a,keys,getSymbols)}function getAllKeysIn(a){return baseGetAllKeys(a,keysIn,getSymbolsIn)}var DataView$1=getNative(root,"DataView"),Promise$1=getNative(root,"Promise"),Set$1=getNative(root,"Set"),mapTag$4="[object Map]",objectTag$2="[object Object]",promiseTag="[object Promise]",setTag$4="[object Set]",weakMapTag$1="[object WeakMap]",dataViewTag$3="[object DataView]",dataViewCtorString=toSource(DataView$1),mapCtorString=toSource(Map$1),promiseCtorString=toSource(Promise$1),setCtorString=toSource(Set$1),weakMapCtorString=toSource(WeakMap$1),getTag=baseGetTag;(DataView$1&&getTag(new DataView$1(new ArrayBuffer(1)))!=dataViewTag$3||Map$1&&getTag(new Map$1)!=mapTag$4||Promise$1&&getTag(Promise$1.resolve())!=promiseTag||Set$1&&getTag(new Set$1)!=setTag$4||WeakMap$1&&getTag(new WeakMap$1)!=weakMapTag$1)&&(getTag=function(a){var s=baseGetTag(a),c=s==objectTag$2?a.constructor:void 0,u=c?toSource(c):"";if(u)switch(u){case dataViewCtorString:return dataViewTag$3;case mapCtorString:return mapTag$4;case promiseCtorString:return promiseTag;case setCtorString:return setTag$4;case weakMapCtorString:return weakMapTag$1}return s});var objectProto$3=Object.prototype,hasOwnProperty$3=objectProto$3.hasOwnProperty;function initCloneArray(a){var s=a.length,c=new a.constructor(s);return s&&typeof a[0]=="string"&&hasOwnProperty$3.call(a,"index")&&(c.index=a.index,c.input=a.input),c}var Uint8Array$1=root.Uint8Array;function cloneArrayBuffer(a){var s=new a.constructor(a.byteLength);return new Uint8Array$1(s).set(new Uint8Array$1(a)),s}function cloneDataView(a,s){var c=cloneArrayBuffer(a.buffer);return new a.constructor(c,a.byteOffset,a.byteLength)}var reFlags=/\w*$/;function cloneRegExp(a){var s=new a.constructor(a.source,reFlags.exec(a));return s.lastIndex=a.lastIndex,s}var symbolProto$1=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf$1=symbolProto$1?symbolProto$1.valueOf:void 0;function cloneSymbol(a){return symbolValueOf$1?Object(symbolValueOf$1.call(a)):{}}function cloneTypedArray(a,s){var c=s?cloneArrayBuffer(a.buffer):a.buffer;return new a.constructor(c,a.byteOffset,a.length)}var boolTag$2="[object Boolean]",dateTag$2="[object Date]",mapTag$3="[object Map]",numberTag$2="[object Number]",regexpTag$2="[object RegExp]",setTag$3="[object Set]",stringTag$2="[object String]",symbolTag$2="[object Symbol]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$2="[object DataView]",float32Tag$1="[object Float32Array]",float64Tag$1="[object Float64Array]",int8Tag$1="[object Int8Array]",int16Tag$1="[object Int16Array]",int32Tag$1="[object Int32Array]",uint8Tag$1="[object Uint8Array]",uint8ClampedTag$1="[object Uint8ClampedArray]",uint16Tag$1="[object Uint16Array]",uint32Tag$1="[object Uint32Array]";function initCloneByTag(a,s,c){var u=a.constructor;switch(s){case arrayBufferTag$2:return cloneArrayBuffer(a);case boolTag$2:case dateTag$2:return new u(+a);case dataViewTag$2:return cloneDataView(a);case float32Tag$1:case float64Tag$1:case int8Tag$1:case int16Tag$1:case int32Tag$1:case uint8Tag$1:case uint8ClampedTag$1:case uint16Tag$1:case uint32Tag$1:return cloneTypedArray(a,c);case mapTag$3:return new u;case numberTag$2:case stringTag$2:return new u(a);case regexpTag$2:return cloneRegExp(a);case setTag$3:return new u;case symbolTag$2:return cloneSymbol(a)}}function initCloneObject(a){return typeof a.constructor=="function"&&!isPrototype(a)?baseCreate(getPrototype(a)):{}}var mapTag$2="[object Map]";function baseIsMap(a){return isObjectLike(a)&&getTag(a)==mapTag$2}var nodeIsMap=nodeUtil&&nodeUtil.isMap,isMap=nodeIsMap?baseUnary(nodeIsMap):baseIsMap,setTag$2="[object Set]";function baseIsSet(a){return isObjectLike(a)&&getTag(a)==setTag$2}var nodeIsSet=nodeUtil&&nodeUtil.isSet,isSet=nodeIsSet?baseUnary(nodeIsSet):baseIsSet,CLONE_DEEP_FLAG$1=1,argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag$1="[object Boolean]",dateTag$1="[object Date]",errorTag$1="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag$1="[object Map]",numberTag$1="[object Number]",objectTag$1="[object Object]",regexpTag$1="[object RegExp]",setTag$1="[object Set]",stringTag$1="[object String]",symbolTag$1="[object Symbol]",weakMapTag="[object WeakMap]",arrayBufferTag$1="[object ArrayBuffer]",dataViewTag$1="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",cloneableTags={};cloneableTags[argsTag$1]=cloneableTags[arrayTag$1]=cloneableTags[arrayBufferTag$1]=cloneableTags[dataViewTag$1]=cloneableTags[boolTag$1]=cloneableTags[dateTag$1]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag$1]=cloneableTags[numberTag$1]=cloneableTags[objectTag$1]=cloneableTags[regexpTag$1]=cloneableTags[setTag$1]=cloneableTags[stringTag$1]=cloneableTags[symbolTag$1]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=!0,cloneableTags[errorTag$1]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=!1;function baseClone(a,s,c,u,d,p){var v,A=s&CLONE_DEEP_FLAG$1;if(v!==void 0)return v;if(!isObject$3(a))return a;var x=isArray$2(a);if(x)v=initCloneArray(a);else{var g=getTag(a),b=g==funcTag||g==genTag;if(isBuffer(a))return cloneBuffer(a,A);if(g==objectTag$1||g==argsTag$1||b&&!d)v=b?{}:initCloneObject(a);else{if(!cloneableTags[g])return d?a:{};v=initCloneByTag(a,g,A)}}p||(p=new Stack);var y=p.get(a);if(y)return y;p.set(a,v),isSet(a)?a.forEach(function(E){v.add(baseClone(E,s,c,E,a,p))}):isMap(a)&&a.forEach(function(E,w){v.set(w,baseClone(E,s,c,w,a,p))});var f=getAllKeys,m=x?void 0:f(a);return arrayEach(m||a,function(E,w){m&&(w=E,E=a[w]),assignValue(v,w,baseClone(E,s,c,w,a,p))}),v}var CLONE_DEEP_FLAG=1,CLONE_SYMBOLS_FLAG=4;function cloneDeep(a){return baseClone(a,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}var HASH_UNDEFINED="__lodash_hash_undefined__";function setCacheAdd(a){return this.__data__.set(a,HASH_UNDEFINED),this}function setCacheHas(a){return this.__data__.has(a)}function SetCache(a){var s=-1,c=a==null?0:a.length;for(this.__data__=new MapCache;++s<c;)this.add(a[s])}SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas;function arraySome(a,s){for(var c=-1,u=a==null?0:a.length;++c<u;)if(s(a[c],c,a))return!0;return!1}function cacheHas(a,s){return a.has(s)}var COMPARE_PARTIAL_FLAG$5=1,COMPARE_UNORDERED_FLAG$3=2;function equalArrays(a,s,c,u,d,p){var v=c&COMPARE_PARTIAL_FLAG$5,A=a.length,x=s.length;if(A!=x&&!(v&&x>A))return!1;var g=p.get(a),b=p.get(s);if(g&&b)return g==s&&b==a;var y=-1,f=!0,m=c&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(p.set(a,s),p.set(s,a);++y<A;){var E=a[y],w=s[y];if(u)var S=v?u(w,E,y,s,a,p):u(E,w,y,a,s,p);if(S!==void 0){if(S)continue;f=!1;break}if(m){if(!arraySome(s,function($,T){if(!cacheHas(m,T)&&(E===$||d(E,$,c,u,p)))return m.push(T)})){f=!1;break}}else if(!(E===w||d(E,w,c,u,p))){f=!1;break}}return p.delete(a),p.delete(s),f}function mapToArray(a){var s=-1,c=Array(a.size);return a.forEach(function(u,d){c[++s]=[d,u]}),c}function setToArray(a){var s=-1,c=Array(a.size);return a.forEach(function(u){c[++s]=u}),c}var COMPARE_PARTIAL_FLAG$4=1,COMPARE_UNORDERED_FLAG$2=2,boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",mapTag="[object Map]",numberTag="[object Number]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;function equalByTag(a,s,c,u,d,p,v){switch(c){case dataViewTag:if(a.byteLength!=s.byteLength||a.byteOffset!=s.byteOffset)return!1;a=a.buffer,s=s.buffer;case arrayBufferTag:return!(a.byteLength!=s.byteLength||!p(new Uint8Array$1(a),new Uint8Array$1(s)));case boolTag:case dateTag:case numberTag:return eq(+a,+s);case errorTag:return a.name==s.name&&a.message==s.message;case regexpTag:case stringTag:return a==s+"";case mapTag:var A=mapToArray;case setTag:var x=u&COMPARE_PARTIAL_FLAG$4;if(A||(A=setToArray),a.size!=s.size&&!x)return!1;var g=v.get(a);if(g)return g==s;u|=COMPARE_UNORDERED_FLAG$2,v.set(a,s);var b=equalArrays(A(a),A(s),u,d,p,v);return v.delete(a),b;case symbolTag:if(symbolValueOf)return symbolValueOf.call(a)==symbolValueOf.call(s)}return!1}var COMPARE_PARTIAL_FLAG$3=1,objectProto$2=Object.prototype,hasOwnProperty$2=objectProto$2.hasOwnProperty;function equalObjects(a,s,c,u,d,p){var v=c&COMPARE_PARTIAL_FLAG$3,A=getAllKeys(a),x=A.length,g=getAllKeys(s),b=g.length;if(x!=b&&!v)return!1;for(var y=x;y--;){var f=A[y];if(!(v?f in s:hasOwnProperty$2.call(s,f)))return!1}var m=p.get(a),E=p.get(s);if(m&&E)return m==s&&E==a;var w=!0;p.set(a,s),p.set(s,a);for(var S=v;++y<x;){f=A[y];var $=a[f],T=s[f];if(u)var I=v?u(T,$,f,s,a,p):u($,T,f,a,s,p);if(!(I===void 0?$===T||d($,T,c,u,p):I)){w=!1;break}S||(S=f=="constructor")}if(w&&!S){var _=a.constructor,C=s.constructor;_!=C&&"constructor"in a&&"constructor"in s&&!(typeof _=="function"&&_ instanceof _&&typeof C=="function"&&C instanceof C)&&(w=!1)}return p.delete(a),p.delete(s),w}var COMPARE_PARTIAL_FLAG$2=1,argsTag="[object Arguments]",arrayTag="[object Array]",objectTag="[object Object]",objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function baseIsEqualDeep(a,s,c,u,d,p){var v=isArray$2(a),A=isArray$2(s),x=v?arrayTag:getTag(a),g=A?arrayTag:getTag(s);x=x==argsTag?objectTag:x,g=g==argsTag?objectTag:g;var b=x==objectTag,y=g==objectTag,f=x==g;if(f&&isBuffer(a)){if(!isBuffer(s))return!1;v=!0,b=!1}if(f&&!b)return p||(p=new Stack),v||isTypedArray(a)?equalArrays(a,s,c,u,d,p):equalByTag(a,s,x,c,u,d,p);if(!(c&COMPARE_PARTIAL_FLAG$2)){var m=b&&hasOwnProperty$1.call(a,"__wrapped__"),E=y&&hasOwnProperty$1.call(s,"__wrapped__");if(m||E){var w=m?a.value():a,S=E?s.value():s;return p||(p=new Stack),d(w,S,c,u,p)}}return f?(p||(p=new Stack),equalObjects(a,s,c,u,d,p)):!1}function baseIsEqual(a,s,c,u,d){return a===s?!0:a==null||s==null||!isObjectLike(a)&&!isObjectLike(s)?a!==a&&s!==s:baseIsEqualDeep(a,s,c,u,baseIsEqual,d)}var COMPARE_PARTIAL_FLAG$1=1,COMPARE_UNORDERED_FLAG$1=2;function baseIsMatch(a,s,c,u){var d=c.length,p=d;if(a==null)return!p;for(a=Object(a);d--;){var v=c[d];if(v[2]?v[1]!==a[v[0]]:!(v[0]in a))return!1}for(;++d<p;){v=c[d];var A=v[0],x=a[A],g=v[1];if(v[2]){if(x===void 0&&!(A in a))return!1}else{var b=new Stack,y;if(!(y===void 0?baseIsEqual(g,x,COMPARE_PARTIAL_FLAG$1|COMPARE_UNORDERED_FLAG$1,u,b):y))return!1}}return!0}function isStrictComparable(a){return a===a&&!isObject$3(a)}function getMatchData(a){for(var s=keys(a),c=s.length;c--;){var u=s[c],d=a[u];s[c]=[u,d,isStrictComparable(d)]}return s}function matchesStrictComparable(a,s){return function(c){return c==null?!1:c[a]===s&&(s!==void 0||a in Object(c))}}function baseMatches(a){var s=getMatchData(a);return s.length==1&&s[0][2]?matchesStrictComparable(s[0][0],s[0][1]):function(c){return c===a||baseIsMatch(c,a,s)}}function baseHasIn(a,s){return a!=null&&s in Object(a)}function hasPath(a,s,c){s=castPath(s,a);for(var u=-1,d=s.length,p=!1;++u<d;){var v=toKey(s[u]);if(!(p=a!=null&&c(a,v)))break;a=a[v]}return p||++u!=d?p:(d=a==null?0:a.length,!!d&&isLength(d)&&isIndex(v,d)&&(isArray$2(a)||isArguments(a)))}function hasIn(a,s){return a!=null&&hasPath(a,s,baseHasIn)}var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;function baseMatchesProperty(a,s){return isKey(a)&&isStrictComparable(s)?matchesStrictComparable(toKey(a),s):function(c){var u=get(c,a);return u===void 0&&u===s?hasIn(c,a):baseIsEqual(s,u,COMPARE_PARTIAL_FLAG|COMPARE_UNORDERED_FLAG)}}function baseProperty(a){return function(s){return s?.[a]}}function basePropertyDeep(a){return function(s){return baseGet(s,a)}}function property(a){return isKey(a)?baseProperty(toKey(a)):basePropertyDeep(a)}function baseIteratee(a){return typeof a=="function"?a:a==null?identity$1:typeof a=="object"?isArray$2(a)?baseMatchesProperty(a[0],a[1]):baseMatches(a):property(a)}function createBaseFor(a){return function(s,c,u){for(var d=-1,p=Object(s),v=u(s),A=v.length;A--;){var x=v[++d];if(c(p[x],x,p)===!1)break}return s}}var baseFor=createBaseFor();function baseForOwn(a,s){return a&&baseFor(a,s,keys)}function createBaseEach(a,s){return function(c,u){if(c==null)return c;if(!isArrayLike(c))return a(c,u);for(var d=c.length,p=-1,v=Object(c);++p<d&&u(v[p],p,v)!==!1;);return c}}var baseEach=createBaseEach(baseForOwn);function assignMergeValue(a,s,c){(c!==void 0&&!eq(a[s],c)||c===void 0&&!(s in a))&&baseAssignValue(a,s,c)}function isArrayLikeObject(a){return isObjectLike(a)&&isArrayLike(a)}function safeGet$1(a,s){if(!(s==="constructor"&&typeof a[s]=="function")&&s!="__proto__")return a[s]}function toPlainObject(a){return copyObject(a,keysIn(a))}function baseMergeDeep(a,s,c,u,d,p,v){var A=safeGet$1(a,c),x=safeGet$1(s,c),g=v.get(x);if(g){assignMergeValue(a,c,g);return}var b=p?p(A,x,c+"",a,s,v):void 0,y=b===void 0;if(y){var f=isArray$2(x),m=!f&&isBuffer(x),E=!f&&!m&&isTypedArray(x);b=x,f||m||E?isArray$2(A)?b=A:isArrayLikeObject(A)?b=copyArray(A):m?(y=!1,b=cloneBuffer(x,!0)):E?(y=!1,b=cloneTypedArray(x,!0)):b=[]:isPlainObject(x)||isArguments(x)?(b=A,isArguments(A)?b=toPlainObject(A):(!isObject$3(A)||isFunction$2(A))&&(b=initCloneObject(x))):y=!1}y&&(v.set(x,b),d(b,x,u,p,v),v.delete(x)),assignMergeValue(a,c,b)}function baseMerge(a,s,c,u,d){a!==s&&baseFor(s,function(p,v){if(d||(d=new Stack),isObject$3(p))baseMergeDeep(a,s,v,c,baseMerge,u,d);else{var A=u?u(safeGet$1(a,v),p,v+"",a,s,d):void 0;A===void 0&&(A=p),assignMergeValue(a,v,A)}},keysIn)}createAssigner(function(a,s,c,u){baseMerge(a,s,c,u)});function last(a){var s=a==null?0:a.length;return s?a[s-1]:void 0}var objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function baseHas(a,s){return a!=null&&hasOwnProperty.call(a,s)}function has(a,s){return a!=null&&hasPath(a,s,baseHas)}function parent(a,s){return s.length<2?a:baseGet(a,baseSlice(s,0,-1))}function isMatch(a,s){return a===s||baseIsMatch(a,s,getMatchData(s))}function isUndefined$1(a){return a===void 0}createAssigner(function(a,s,c){baseMerge(a,s,c)});var FUNC_ERROR_TEXT="Expected a function";function negate(a){if(typeof a!="function")throw new TypeError(FUNC_ERROR_TEXT);return function(){var s=arguments;switch(s.length){case 0:return!a.call(this);case 1:return!a.call(this,s[0]);case 2:return!a.call(this,s[0],s[1]);case 3:return!a.call(this,s[0],s[1],s[2])}return!a.apply(this,s)}}function baseUnset(a,s){return s=castPath(s,a),a=parent(a,s),a==null||delete a[toKey(last(s))]}function baseSet(a,s,c,u){if(!isObject$3(a))return a;s=castPath(s,a);for(var d=-1,p=s.length,v=p-1,A=a;A!=null&&++d<p;){var x=toKey(s[d]),g=c;if(x==="__proto__"||x==="constructor"||x==="prototype")return a;if(d!=v){var b=A[x];g=void 0,g===void 0&&(g=isObject$3(b)?b:isIndex(s[d+1])?[]:{})}assignValue(A,x,g),A=A[x]}return a}function basePickBy(a,s,c){for(var u=-1,d=s.length,p={};++u<d;){var v=s[u],A=baseGet(a,v);c(A,v)&&baseSet(p,castPath(v,a),A)}return p}function pickBy(a,s){if(a==null)return{};var c=arrayMap(getAllKeysIn(a),function(u){return[u]});return s=baseIteratee(s),basePickBy(a,c,function(u,d){return s(u,d[0])})}function omitBy(a,s){return pickBy(a,negate(baseIteratee(s)))}function set(a,s,c){return a==null?a:baseSet(a,s,c)}function baseSome(a,s){var c;return baseEach(a,function(u,d,p){return c=s(u,d,p),!c}),!!c}function some$1(a,s,c){var u=isArray$2(a)?arraySome:baseSome;return c&&isIterateeCall(a,s,c)&&(s=void 0),u(a,baseIteratee(s))}function unset(a,s){return a==null?!0:baseUnset(a,s)}const __vite_import_meta_env__={},createStoreImpl=a=>{let s;const c=new Set,u=(b,y)=>{const f=typeof b=="function"?b(s):b;if(!Object.is(f,s)){const m=s;s=y??(typeof f!="object"||f===null)?f:Object.assign({},s,f),c.forEach(E=>E(s,m))}},d=()=>s,x={setState:u,getState:d,getInitialState:()=>g,subscribe:b=>(c.add(b),()=>c.delete(b)),destroy:()=>{(__vite_import_meta_env__?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),c.clear()}},g=s=a(u,d,x);return x},createStore$1=a=>a?createStoreImpl(a):createStoreImpl;var withSelector={exports:{}},withSelector_production={},shim={exports:{}},useSyncExternalStoreShim_production={};var hasRequiredUseSyncExternalStoreShim_production;function requireUseSyncExternalStoreShim_production(){if(hasRequiredUseSyncExternalStoreShim_production)return useSyncExternalStoreShim_production;hasRequiredUseSyncExternalStoreShim_production=1;var a=requireReact();function s(y,f){return y===f&&(y!==0||1/y===1/f)||y!==y&&f!==f}var c=typeof Object.is=="function"?Object.is:s,u=a.useState,d=a.useEffect,p=a.useLayoutEffect,v=a.useDebugValue;function A(y,f){var m=f(),E=u({inst:{value:m,getSnapshot:f}}),w=E[0].inst,S=E[1];return p(function(){w.value=m,w.getSnapshot=f,x(w)&&S({inst:w})},[y,m,f]),d(function(){return x(w)&&S({inst:w}),y(function(){x(w)&&S({inst:w})})},[y]),v(m),m}function x(y){var f=y.getSnapshot;y=y.value;try{var m=f();return!c(y,m)}catch{return!0}}function g(y,f){return f()}var b=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:A;return useSyncExternalStoreShim_production.useSyncExternalStore=a.useSyncExternalStore!==void 0?a.useSyncExternalStore:b,useSyncExternalStoreShim_production}var hasRequiredShim;function requireShim(){return hasRequiredShim||(hasRequiredShim=1,shim.exports=requireUseSyncExternalStoreShim_production()),shim.exports}var hasRequiredWithSelector_production;function requireWithSelector_production(){if(hasRequiredWithSelector_production)return withSelector_production;hasRequiredWithSelector_production=1;var a=requireReact(),s=requireShim();function c(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var u=typeof Object.is=="function"?Object.is:c,d=s.useSyncExternalStore,p=a.useRef,v=a.useEffect,A=a.useMemo,x=a.useDebugValue;return withSelector_production.useSyncExternalStoreWithSelector=function(g,b,y,f,m){var E=p(null);if(E.current===null){var w={hasValue:!1,value:null};E.current=w}else w=E.current;E=A(function(){function $(P){if(!T){if(T=!0,I=P,P=f(P),m!==void 0&&w.hasValue){var O=w.value;if(m(O,P))return _=O}return _=P}if(O=_,u(I,P))return O;var L=f(P);return m!==void 0&&m(O,L)?(I=P,O):(I=P,_=L)}var T=!1,I,_,C=y===void 0?null:y;return[function(){return $(b())},C===null?void 0:function(){return $(C())}]},[b,y,f,m]);var S=d(g,E[0],E[1]);return v(function(){w.hasValue=!0,w.value=S},[S]),x(S),S},withSelector_production}var hasRequiredWithSelector;function requireWithSelector(){return hasRequiredWithSelector||(hasRequiredWithSelector=1,withSelector.exports=requireWithSelector_production()),withSelector.exports}var withSelectorExports=requireWithSelector();const useSyncExternalStoreExports=getDefaultExportFromCjs(withSelectorExports),{useDebugValue}=React,{useSyncExternalStoreWithSelector}=useSyncExternalStoreExports,identity=a=>a;function useStore(a,s=identity,c){const u=useSyncExternalStoreWithSelector(a.subscribe,a.getState,a.getServerState||a.getInitialState,s,c);return useDebugValue(u),u}var FRContext=reactExports.createContext(null),ConfigContext=reactExports.createContext(null),displayTypeEnum={column:"vertical",row:"horizontal",inline:"inline"},transformProps=function a(s){var c=s.schema,u=s.beforeFinish,d=s.onMount,p=s.displayType,v=p===void 0?"column":p,A=s.watch,x=s.removeHiddenData,g=x===void 0?!0:x,b=s.readOnly,y=s.column,f=y===void 0?1:y,m=s.mapping,E=s.debugCss,w=s.locale,S=s.configProvider,$=s.validateMessages,T=s.debug,I=s.id,_=s.labelWidth,C=s.maxWidth,P=s.form,O=s.onFinish,L=s.onFinishFailed,B=s.footer,F=s.operateExtra,D=s.logOnMount,G=s.logOnSubmit,j=s.labelCol,V=s.fieldCol,U=s.disabled,M=s.className,N=s.validateTrigger,R=s.antdVersion,k=__rest$16(s,["schema","beforeFinish","onMount","displayType","watch","removeHiddenData","readOnly","column","mapping","debugCss","locale","configProvider","validateMessages","debug","id","labelWidth","maxWidth","form","onFinish","onFinishFailed","footer","operateExtra","logOnMount","logOnSubmit","labelCol","fieldCol","disabled","className","validateTrigger","antdVersion"]),H=Object.assign({},k);return v&&(H.layout=displayTypeEnum[v]||"horizontal"),{formProps:H,schema:c,displayType:v,onFinish:O,beforeFinish:u,onMount:d,watch:A,readOnly:b,disabled:U,column:f,mapping:m,debugCss:E,locale:w,configProvider:S,footer:B,form:P,labelWidth:_,validateMessages:$,debug:T,id:I,onFinishFailed:L,removeHiddenData:g,operateExtra:F,logOnMount:D,logOnSubmit:G,labelCol:j,fieldCol:V,maxWidth:C,className:M,validateTrigger:N,antdVersion:R}},_set=set,_get=get,_cloneDeep=cloneDeep,_some=some$1,_isMatch=isMatch,isObject$2=function a(s){var c=Object.prototype.toString.call(s);return c.indexOf("Object")>-1},isArray$1=function a(s){var c=Object.prototype.toString.call(s);return c.indexOf("Array")>-1},isFunction$1=function a(s){return typeof s=="function"};function isUrl$1(a){var s=/^(?:\w+:)?\/\/(\S+)$/;return typeof a!="string"?!1:s.test(a)}var isNumber$1=function a(s){return!isNaN(Number(s))},getArray=function a(s){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return Array.isArray(s)?s:c};function isObjType(a){return a?.type==="object"&&a?.properties&&a?.widgetType!=="field"}function isListType(a){return a?.type==="array"&&isObjType(a?.items)&&a?.enum===void 0}function isCheckBoxType(a,s){if(s)return!1;if(a.widget==="checkbox")return!0;if(a&&a.type==="boolean")return a.enum?!1:a.widget===void 0}var translation$1=function a(s){return function(c){var u=s?.locale.FormRender;return u[c]}},_hasFuncProperty=function a(s){return _some(s,function(c){return isFunction$1(c)?!0:isObject$2(c)?_hasFuncProperty(c):!1})},safeGet=function a(s,c,u){var d;return(d=get(s,c,u))!==null&&d!==void 0?d:u};function _typeof$g(a){"@babel/helpers - typeof";return _typeof$g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},_typeof$g(a)}function _defineProperty$9(a,s,c){return(s=_toPropertyKey$7(s))in a?Object.defineProperty(a,s,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[s]=c,a}function _toPropertyKey$7(a){var s=_toPrimitive$8(a,"string");return _typeof$g(s)=="symbol"?s:s+""}function _toPrimitive$8(a,s){if(_typeof$g(a)!="object"||!a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var u=c.call(a,s);if(_typeof$g(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}function _toConsumableArray$d(a){return _arrayWithoutHoles$d(a)||_iterableToArray$d(a)||_unsupportedIterableToArray$l(a)||_nonIterableSpread$d()}function _nonIterableSpread$d(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
552
552
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _arrayWithoutHoles$d(a){if(Array.isArray(a))return _arrayLikeToArray$l(a)}function _toArray(a){return _arrayWithHoles$e(a)||_iterableToArray$d(a)||_unsupportedIterableToArray$l(a)||_nonIterableRest$e()}function _nonIterableRest$e(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
553
553
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray$l(a,s){if(a){if(typeof a=="string")return _arrayLikeToArray$l(a,s);var c={}.toString.call(a).slice(8,-1);return c==="Object"&&a.constructor&&(c=a.constructor.name),c==="Map"||c==="Set"?Array.from(a):c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray$l(a,s):void 0}}function _arrayLikeToArray$l(a,s){(s==null||s>a.length)&&(s=a.length);for(var c=0,u=Array(s);c<s;c++)u[c]=a[c];return u}function _iterableToArray$d(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function _arrayWithHoles$e(a){if(Array.isArray(a))return a}var isMultiBind=function a(s){return isArray$1(s)&&s.every(function(c){return typeof c=="string"})},transformPath=function a(s){var c=[],u=function(p){var v=p.indexOf("[]");if(v===-1){c.push(p);return}c.push(p.substring(0,v)),u(p.substring(v+3))};return u(s),c.length===1?c[0]:c},transformValueToBind=function a(s,c,u){if(u===!1){unset(s,c);return}if(typeof u=="string"){var d=get(s,c),p=get(s,u);isObject$2(p)&&(d=Object.assign(Object.assign({},p),d)),set(s,u,d),unset(s,c);return}if(isMultiBind(u)){var v=get(s,c);unset(s,c),Array.isArray(v)&&v.forEach(function(A,x){var g=u[x];g&&set(s,g,A)})}},transformBindToValue=function a(s,c,u){if(typeof u=="string"){var d=get(s,u),p=get(s,c);isObject$2(p)&&(d=Object.assign(Object.assign({},p),d)),set(s,c,d),unset(s,u);return}if(isMultiBind(u)){var v=[];u.forEach(function(A){var x=get(s,A);v.push(x),unset(s,A)}),v.length>0&&set(s,c,v)}},parseValuesToBind=function a(s,c){if(!JSON.stringify(c).includes("bind"))return s;var u=_cloneDeep(s),d=function(v,A,x){var g=_toArray(A),b=g[0],y=g.slice(1);if(y.length===1){var f=get(v,b,[])||[];f.forEach(function(E,w){var S=get(E,y[0]);if(x==="root"){f[w]=S;return}transformValueToBind(E,y[0],x)})}if(isArray$1(v))v.forEach(function(E){return d(E,[b].concat(_toConsumableArray$d(y)),x)});else if(isObject$2(v)){var m=get(v,b);d(m,y,x)}};return Object.keys(c).forEach(function(p){var v,A,x=(A=(v=c[p])===null||v===void 0?void 0:v.schema)===null||A===void 0?void 0:A.bind;if(x!==void 0){var g=transformPath(p);isArray$1(g)?d(u,g,x):transformValueToBind(u,g,x)}}),u},parseBindToValues=function a(s,c){if(!JSON.stringify(c).includes("bind"))return s;var u=_cloneDeep(s),d=function(v,A,x){var g=_toArray(A),b=g[0],y=g.slice(1);if(y.length===1){var f=safeGet(v,b,[]);f.forEach(function(E,w){if(x==="root"){f[w]=_defineProperty$9({},y[0],E);return}transformBindToValue(E,y[0],x)})}if(isArray$1(v))v.forEach(function(E){return d(E,[b].concat(_toConsumableArray$d(y)),x)});else if(isObject$2(v)){var m=get(v,b);d(m,y,x)}};return Object.keys(c).forEach(function(p){var v,A,x=(A=(v=c[p])===null||v===void 0?void 0:v.schema)===null||A===void 0?void 0:A.bind;if(x!==void 0){var g=transformPath(p);isArray$1(g)?d(u,g,x):transformBindToValue(u,g,x)}}),u},transformHidden=function a(s){var c=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof s!="string")return!!s;var d=s.replace(/^{\s*{/g,"").replace(/}\s*}$/g,"").trim(),p=`
554
554
  return `.concat(d.replace(/formData/g,JSON.stringify(c)).replace(/rootValue/g,JSON.stringify(u)),`
@@ -638,8 +638,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
638
638
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _iterableToArrayLimit$2(a,s){var c=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(c!=null){var u,d,p,v,A=[],x=!0,g=!1;try{if(p=(c=c.call(a)).next,s!==0)for(;!(x=(u=p.call(c)).done)&&(A.push(u.value),A.length!==s);x=!0);}catch(b){g=!0,d=b}finally{try{if(!x&&c.return!=null&&(v=c.return(),Object(v)!==v))return}finally{if(g)throw d}}return A}}function _arrayWithHoles$2(a){if(Array.isArray(a))return a}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray$2(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
639
639
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray$2(a,s){if(a){if(typeof a=="string")return _arrayLikeToArray$2(a,s);var c={}.toString.call(a).slice(8,-1);return c==="Object"&&a.constructor&&(c=a.constructor.name),c==="Map"||c==="Set"?Array.from(a):c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray$2(a,s):void 0}}function _iterableToArray(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray$2(a)}function _arrayLikeToArray$2(a,s){(s==null||s>a.length)&&(s=a.length);for(var c=0,u=Array(s);c<s;c++)u[c]=a[c];return u}var TabPaneContent=function a(s){var c=s.renderCore,u=s.name,d=s.schema,p=s.rootPath;return reactExports.useMemo(function(){return React.createElement("div",{style:{flex:1}},c({schema:d,parentPath:[u],rootPath:[].concat(_toConsumableArray(p),[u])}))},[JSON.stringify(s)])},TabList=function a(s){var c=s.schema,u=s.fields,d=s.rootPath,p=s.renderCore,v=s.readOnly,A=s.delConfirmProps,x=s.tabName,g=s.hideDelete,b=s.hideAdd,y=s.addItem,f=s.removeItem,m=s.tabItemProps,E=m===void 0?{}:m,w=s.activeKey,S=__rest$16(s,["schema","fields","rootPath","renderCore","readOnly","delConfirmProps","tabName","hideDelete","hideAdd","addItem","removeItem","tabItemProps","activeKey"]),$=reactExports.useState("0"),T=_slicedToArray$2($,2),I=T[0],_=T[1],C=reactExports.useContext(ConfigProvider.ConfigContext),P=translation(C);reactExports.useEffect(function(){_(w||"0")},[w]);var O=function(G){return x instanceof Array?x[G]||G+1:"".concat(x||P("item")," ").concat(G+1)},L=function(G){f(G),_("".concat(G>1?G-1:0))},B=function(G,j){if(j==="add"&&(!c.max||u.length<c.max)&&!v&&!b){y();var V=u.length;_("".concat(V))}},F=function(G){return!v&&!g?React.createElement(Popconfirm,Object.assign({onConfirm:function(){return L(G)}},A),React.createElement(_CloseOutlined,null)):React.createElement(React.Fragment,null)};return React.createElement(Tabs,Object.assign({className:"fr-tab-list",type:"editable-card"},S,{onChange:_,activeKey:"".concat(I),onEdit:B,hideAdd:v||b}),u.map(function(D){var G=D.key,j=D.name;return React.createElement(Tabs.TabPane,Object.assign({key:G,className:"fr-list-item"},E,{tab:O(j),closeIcon:F(j)}),React.createElement(TabPaneContent,{name:j,rootPath:d,schema:c,renderCore:p}))}))};function _typeof(a){"@babel/helpers - typeof";return _typeof=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},_typeof(a)}function _defineProperty(a,s,c){return(s=_toPropertyKey(s))in a?Object.defineProperty(a,s,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[s]=c,a}function _toPropertyKey(a){var s=_toPrimitive(a,"string");return _typeof(s)=="symbol"?s:s+""}function _toPrimitive(a,s){if(_typeof(a)!="object"||!a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var u=c.call(a,s);if(_typeof(u)!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(a)}const index=(function(a){var s=a.schema;return React.createElement("div",{className:classnames("fr-void-title",_defineProperty({},s?.className,!!s?.className))},s.title)});var ErrorSchema=function a(s){var c=reactExports.useContext(ConfigProvider.ConfigContext),u=translation(c);return React.createElement("div",null,React.createElement("div",{style:{color:"red"}},u("schema_not_match")),React.createElement("div",null,JSON.stringify(s)))};const defaultWidgets=Object.freeze(Object.defineProperty({__proto__:null,Card:BoxCard,CardList,Checkbox,Checkboxes,Collapse:BoxCollapse,Color,DatePicker,DateRange,DrawerList:TableList,ErrorSchema,Html:html,ImageInput,Input,InputNumber,LineTitle:FLineTitle,MultiSelect,PercentSlider,Radio,Rate:index$1,Select:MultiSelect,SimpleList,Slider,SubInline:BoxSubInline,Switch,TabList,TableList:TableList$1,TextArea,TimePicker,TimeRange,TreeSelect,Upload:FrUpload,UrlInput,VirtualList,VoidTitle:index},Symbol.toStringTag,{value:"Module"}));function _slicedToArray$1(a,s){return _arrayWithHoles$1(a)||_iterableToArrayLimit$1(a,s)||_unsupportedIterableToArray$1(a,s)||_nonIterableRest$1()}function _nonIterableRest$1(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
640
640
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray$1(a,s){if(a){if(typeof a=="string")return _arrayLikeToArray$1(a,s);var c={}.toString.call(a).slice(8,-1);return c==="Object"&&a.constructor&&(c=a.constructor.name),c==="Map"||c==="Set"?Array.from(a):c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray$1(a,s):void 0}}function _arrayLikeToArray$1(a,s){(s==null||s>a.length)&&(s=a.length);for(var c=0,u=Array(s);c<s;c++)u[c]=a[c];return u}function _iterableToArrayLimit$1(a,s){var c=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(c!=null){var u,d,p,v,A=[],x=!0,g=!1;try{if(p=(c=c.call(a)).next,s!==0)for(;!(x=(u=p.call(c)).done)&&(A.push(u.value),A.length!==s);x=!0);}catch(b){g=!0,d=b}finally{try{if(!x&&c.return!=null&&(v=c.return(),Object(v)!==v))return}finally{if(g)throw d}}return A}}function _arrayWithHoles$1(a){if(Array.isArray(a))return a}function flattenSchema(){var a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0,c=arguments.length>2?arguments[2]:void 0,u=arguments.length>3?arguments[3]:void 0,d=u||{},p=_cloneDeep(a)||{},v=s||"#";p.$id||(p.$id=v);var A=[];return isObjType(p)&&(sortProperties(Object.entries(p.properties)).forEach(function(x){var g=_slicedToArray$1(x,2),b=g[0],y=g[1],f=isListType(y)?b+"[]":b,m=v==="#"?f:v+"."+f;A.push(m),flattenSchema(y,m,v,d)}),p.properties={}),isListType(p)&&(sortProperties(Object.entries(p.items.properties)).forEach(function(x){var g=_slicedToArray$1(x,2),b=g[0],y=g[1],f=isListType(y)?b+"[]":b,m=v==="#"?f:v+"."+f;A.push(m),flattenSchema(y,m,v,d)}),p.items.properties={}),p.type&&(d[v]={parent:c,schema:p,children:A}),d}function _slicedToArray(a,s){return _arrayWithHoles(a)||_iterableToArrayLimit(a,s)||_unsupportedIterableToArray(a,s)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
641
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray(a,s){if(a){if(typeof a=="string")return _arrayLikeToArray(a,s);var c={}.toString.call(a).slice(8,-1);return c==="Object"&&a.constructor&&(c=a.constructor.name),c==="Map"||c==="Set"?Array.from(a):c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,s):void 0}}function _arrayLikeToArray(a,s){(s==null||s>a.length)&&(s=a.length);for(var c=0,u=Array(s);c<s;c++)u[c]=a[c];return u}function _iterableToArrayLimit(a,s){var c=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(c!=null){var u,d,p,v,A=[],x=!0,g=!1;try{if(p=(c=c.call(a)).next,s!==0)for(;!(x=(u=p.call(c)).done)&&(A.push(u.value),A.length!==s);x=!0);}catch(b){g=!0,d=b}finally{try{if(!x&&c.return!=null&&(v=c.return(),Object(v)!==v))return}finally{if(g)throw d}}return A}}function _arrayWithHoles(a){if(Array.isArray(a))return a}var updateSchemaByPath=function a(s,c,u){var d=getSchemaFullPath(s,u),p=_get(u,d,{}),v=isFunction$1(c)?c(p):c,A=Object.assign(Object.assign({},p),v);v.props&&(A.props=Object.assign(Object.assign({},p?.props),v.props)),_set(u,d,A)},getFieldName=function a(s){if(s){if(typeof s=="boolean")return s;var c=[];return isArray$1(s)&&(c=s.map(function(u){return u.split(".").map(function(d){return isNaN(Number(d))?d:d*1})})),c=s.split(".").map(function(u){return isNaN(Number(u))?u:u*1}),c=c.map(function(u){return typeof u=="string"&&u?.indexOf("[")===0&&u?.indexOf("]")===u?.length-1?Number(u.substring(1,u.length-1)):u}),c}},useForm=function a(){var s=Form$1.useForm(),c=_slicedToArray(s,1),u=c[0],d=reactExports.useRef({}),p=reactExports.useRef(null),v=reactExports.useRef({}),A=reactExports.useRef({});u.getFieldError;var x=u.getFieldsError,g=u.getFieldInstance,b=u.setFieldsValue,y=u.setFields,f=u.scrollToField,m=u.isFieldsTouched,E=u.isFieldTouched,w=u.isFieldValidating,S=u.resetFields,$=u.validateFields,T=__rest$16(u,["getFieldError","getFieldsError","getFieldInstance","setFieldsValue","setFields","scrollToField","isFieldsTouched","isFieldTouched","isFieldValidating","resetFields","validateFields"]),I=T,_=function(O){var L=p.current.setState;L||setTimeout(function(){L({schema:v.current,flattenSchema:d.current})},0),L(O)},C=function(O){d.current=flattenSchema(O)||{},v.current=O,_({schema:O,flattenSchema:d.current})};return I.setSchema=function(P){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(isObject$2(P)){if(O){C(P);return}var L=cloneDeep(v.current);Object.keys(P||{}).forEach(function(B){updateSchemaByPath(B,P[B],L)}),C(L)}},I.setSchemaByPath=function(P,O){if(!(!_hasFuncProperty(O)&&_isMatch(O,I.getSchemaByPath(P)))){var L=cloneDeep(v.current);updateSchemaByPath(P,O,L),C(L)}},I.setValues=function(P){var O=parseBindToValues(P,d.current);b(O)},I.getValues=function(P,O,L){var B=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,F,D=cloneDeep(u.getFieldsValue(getFieldName(P),O)),G=((F=p.current)===null||F===void 0?void 0:F.getState())||{},j=G.removeHiddenData;return B&&j&&(D=filterValuesHidden(D,d.current)),L||(D=filterValuesUndefined(D)),parseValuesToBind(D,d.current)},I.getValueByPath=function(P){var O=getFieldName(P);return u.getFieldValue(O)},I.setValueByPath=function(P,O){if(!u.setFieldValue){var L=u.getFieldsValue();_set(L,P,O),I.setValues(L);return}var B=getFieldName(P);u.setFieldValue(B,O);try{JSON.stringify(u.getFieldValue(B))!==JSON.stringify(O)&&u.setFieldValue(B,O)}catch{}},I.getSchemaByPath=function(P){typeof P!="string"&&console.warn("请输入正确的路径");var O=getSchemaFullPath(P,v.current);return _get(v.current,O)},I.getSchema=function(){return v.current},I.setErrorFields=function(P){var O=transformFieldsData(P,getFieldName);O&&y(O)},I.removeErrorField=function(P){y([{name:getFieldName(P),errors:[]}])},I.getFieldError=function(P){var O=getFieldName(P);return u.getFieldError(O)},I.getFieldsError=function(P){var O=getFieldName(P);return x(O)},I.getFieldInstance=function(P){var O=getFieldName(P);return g(O)},I.getHiddenValues=function(){var P=I.getValues(),O=I.getValues(!0),L={},B=function(D,G,j){Object.keys(D).forEach(function(V){var U=D[V],M=j?"".concat(j,".").concat(V):V;if(!G.hasOwnProperty(V)){_set(L,M,U);return}isObject$2(U)&&B(U,G[V],M),isArray$1(U)&&U.map(function(N,R){B(N,_get(G,"".concat(V,"[").concat(R,"]"),[]),"".concat(M,"[").concat(R,"]"))})})};return B(O,P,null),L},I.setFields=function(P){var O=transformFieldsData(P,getFieldName);O&&y(O)},I.__initStore=function(P){p.current=P},I.scrollToPath=function(P){for(var O=getFieldName(P),L=arguments.length,B=new Array(L>1?L-1:0),F=1;F<L;F++)B[F-1]=arguments[F];f.apply(void 0,[O].concat(B))},I.isFieldsTouched=function(P,O){var L=(P||[]).map(function(B){return getFieldName(B)});return m(L,O)},I.isFieldTouched=function(P){var O=getFieldName(P);return E(O)},I.isFieldValidating=function(P){var O=getFieldName(P);return w(O)},I.resetFields=function(P){var O=(P||[]).map(function(L){return getFieldName(L)});O.length>0?S(O):S()},I.validateFields=function(P,O){var L=(P||[]).map(function(B){return getFieldName(B)});return L.length>0?$(L,O):$()},I.getFlattenSchema=function(P){var O;return P?(O=d.current)===null||O===void 0?void 0:O[P]:d.current},I.onItemChange=I.setValueByPath,I.setFieldRef=function(P,O){P&&(A.current[P]=O)},I.getFieldRef=function(P){return A.current[P]},I};const FormRenderComponent=withProvider(FormCore,defaultWidgets),AlignWidget=a=>{const{activeElements:s,changeSchemas:c,schemas:u,pageSize:d,schema:p}=a,v=g=>{const b=s.map(C=>C.id),y=u.filter(C=>b.includes(C.id)),f=["left","center","right"].includes(g),m=f?"x":"y",E=f?"width":"height",w=y.length===1,S=d&&typeof d=="object"?E==="width"?d.width:d.height:0,$=w?0:Math.min(...y.map(C=>{const P=C.position&&typeof C.position=="object"?C.position:{x:0,y:0};return m==="x"?P.x:P.y})),T=w?S:Math.max(...y.map(C=>{const P=C.position&&typeof C.position=="object"?C.position:{x:0,y:0},O=m==="x"?P.x:P.y,L=C,B=E==="width"?L.width||0:L.height||0;return O+B}));let I=$,_=C=>0;["center","middle"].includes(g)?(I=($+T)/2,_=C=>C/2):["right","bottom"].includes(g)&&(I=T,_=C=>C),c(y.map(C=>{const P=C,O=E==="width"?P.width||0:P.height||0;return{key:`position.${m}`,value:round$1(I-_(O),2),schemaId:P.id}}))},A=g=>{const b=s.map(O=>O.id),y=u.filter(O=>b.includes(O.id)),f=g==="vertical",m=f?"y":"x",E=f?"height":"width",w=Math.min(...y.map(O=>{const L=O.position&&typeof O.position=="object"?O.position:{x:0,y:0};return m==="x"?L.x:L.y})),S=Math.max(...y.map(O=>{const L=O.position&&typeof O.position=="object"?O.position:{x:0,y:0},B=m==="x"?L.x:L.y,F=O,D=E==="width"?F.width||0:F.height||0;return B+D}));if(y.length<3)return;const $=w,T=S-w,I=y.reduce((O,L)=>{const B=L,F=E==="width"?B.width||0:B.height||0;return O+F},0),C=(T-I)/(y.length-1);let P=0;c(y.map((O,L)=>{const B=L===0?0:(()=>{const G=y[L-1];return E==="width"?G.width||0:G.height||0})();P+=L===0?0:B+C;const F=round$1($+P,2),D=O;return{key:`position.${m}`,value:F,schemaId:D.id}}))},x=[{id:"left",icon:jsxRuntimeExports.jsx(AlignStartVertical,{size:15}),onClick:()=>v("left")},{id:"center",icon:jsxRuntimeExports.jsx(AlignCenterVertical,{size:15}),onClick:()=>v("center")},{id:"right",icon:jsxRuntimeExports.jsx(AlignEndVertical,{size:15}),onClick:()=>v("right")},{id:"top",icon:jsxRuntimeExports.jsx(AlignStartHorizontal,{size:15}),onClick:()=>v("top")},{id:"middle",icon:jsxRuntimeExports.jsx(AlignCenterHorizontal,{size:15}),onClick:()=>v("middle")},{id:"bottom",icon:jsxRuntimeExports.jsx(AlignEndHorizontal,{size:15}),onClick:()=>v("bottom")},{id:"vertical",icon:jsxRuntimeExports.jsx(AlignVerticalSpaceAround,{size:15}),onClick:()=>A("vertical")},{id:"horizontal",icon:jsxRuntimeExports.jsx(AlignHorizontalSpaceAround,{size:15}),onClick:()=>A("horizontal")}];return jsxRuntimeExports.jsx(Form$1.Item,{label:p.title,children:jsxRuntimeExports.jsx(Space.Compact,{children:x.map(g=>jsxRuntimeExports.jsx(Button$1,{style:{padding:7},disabled:s.length<=2&&["vertical","horizontal"].includes(g.id),...g},g.id))})})},WidgetRenderer=a=>{const{widget:s,...c}=a,u=reactExports.useRef(null);return reactExports.useEffect(()=>(u.current&&(u.current.innerHTML="",s({...c,rootElement:u.current})),()=>{u.current&&(u.current.innerHTML="")}),[a.activeSchema]),jsxRuntimeExports.jsx("div",{ref:u})},ButtonGroupWidget=a=>{const{activeElements:s,changeSchemas:c,schemas:u,schema:d}=a,{token:p}=theme.useToken(),v=b=>{const y=b.key,f=b.type,m=s.map(w=>w.id),E=u.filter(w=>m.includes(w.id));c(E.map(w=>{const S=!!(w[y]??!1),$=f==="boolean"?!S:b.value;return{key:y,value:$,schemaId:w.id}}))},A=b=>{const y=b.key,f=b.type;let m=!1;const E=s.map(S=>S.id);return u.filter(S=>E.includes(S.id)).forEach(S=>{const $=S;m=f==="boolean"?!!($[y]??!1):$[y]===b.value}),m},x=(b,y)=>y?b.replace(/="currentColor"/g,`="${y}"`):b,g=b=>{const y=`data:image/svg+xml;utf8,${encodeURIComponent(x(b,p.colorText))}`;return jsxRuntimeExports.jsx("img",{width:17,height:17,src:y,alt:""})};return jsxRuntimeExports.jsx(Form$1.Item,{children:jsxRuntimeExports.jsx(Space.Compact,{children:d.buttons.map((b,y)=>{const f=A(b);return jsxRuntimeExports.jsx(Button$1,{type:f?"primary":void 0,ghost:f,onClick:()=>v(b),style:{padding:7,zIndex:f?2:0},icon:g(b.icon)},y)})})})},{Text:Text$2}=Typography,DetailView$1=a=>{const{token:s}=theme.useToken(),{size:c,schemasList:u,changeSchemas:d,deselectSchema:p,activeSchema:v,pageSize:A,basePdf:x}=a,g=useForm(),b=reactExports.useContext(I18nContext),y=reactExports.useContext(PluginsRegistry),f=reactExports.useContext(OptionsContext),m=N=>typeof b=="function"?b(N):N,[E,w]=reactExports.useState({});reactExports.useEffect(()=>{const N={AlignWidget:R=>jsxRuntimeExports.jsx(AlignWidget,{...R,...a,options:f}),Divider:()=>jsxRuntimeExports.jsx(Divider,{style:{marginTop:s.marginXS,marginBottom:s.marginXS}}),ButtonGroup:R=>jsxRuntimeExports.jsx(ButtonGroupWidget,{...R,...a,options:f})};for(const R of y.values()){const k=R.propPanel.widgets||{};Object.entries(k).forEach(([H,W])=>{N[H]=Z=>jsxRuntimeExports.jsx(WidgetRenderer,{...Z,...a,options:f,theme:s,i18n:m,widget:W})})}w(N)},[v,y,JSON.stringify(f)]),reactExports.useEffect(()=>{const N={...v},R=typeof N.readOnly=="boolean"?N.readOnly:!1;N.editable=!R,g.setValues(N)},[v,g]),reactExports.useEffect(()=>g.resetFields(),[v.id]),reactExports.useEffect(()=>{S.current=N=>{for(const R of u)for(const k of Object.values(R))if(k.name===N&&k.id!==v.id)return!1;return!0}},[u,v]);const S=reactExports.useRef(N=>!0),$=(N,R)=>S.current(R),[T,I,_,C]=isBlankPdf(x)?x.padding:[0,0,0,0],P=(N,R,k)=>{const H=g.getValues(),W=H.position,Z=H.width,te=H.height;if(!W||Z===void 0||te===void 0)return!0;if(k==="x"){if(R<C||R>A.width-I)return!0;if(Z>0&&R+Z>A.width-I)return!1}else if(k==="y"){if(R<T||R>A.height-_)return!0;if(te>0&&R+te>A.height-_)return!1}else if(k==="width"){if(W.x<C||W.x>A.width-I)return!0;if(R>0&&W.x+R>A.width-I)return!1}else if(k==="height"){if(W.y<T||W.y>A.height-_)return!0;if(R>0&&W.y+R>A.height-_)return!1}return!0},O=debounce$1(function(...N){const R=N[0],k=(W,Z)=>typeof W=="object"&&W!==null?JSON.stringify(W)!==JSON.stringify(Z):W!==Z;let H=[];for(const W in R){if(["id","content"].includes(W))continue;let Z=R[W];if(k(Z,v[W])){if(Z===null&&["rotate","opacity"].includes(W)&&(Z=void 0),W==="editable"){const te=!Z;H.push({key:"readOnly",value:te,schemaId:v.id}),te&&H.push({key:"required",value:!1,schemaId:v.id});continue}H.push({key:W,value:Z,schemaId:v.id})}}H.length&&g.validateFields().then(()=>d(H)).catch(W=>{W.errorFields.length&&(H=H.filter(Z=>!W.errorFields.find(te=>te.name.includes(Z.key)))),H.length&&d(H)})},100),L=y.findByType(v.type);if(!L)throw Error(`[@pdfme/ui] Failed to find plugin used for ${v.type}`);const B=L.propPanel.schema,F=[];y.entries().forEach(([N,R])=>{F.push({label:N,value:R.propPanel.defaultSchema?.type??void 0})});const D={},G=L?.propPanel?.defaultSchema?(()=>{const N={};for(const R in L.propPanel.defaultSchema)Object.prototype.hasOwnProperty.call(L.propPanel.defaultSchema,R)&&(N[R]=L.propPanel.defaultSchema[R]);return N})():D,j=A.width-C-I,V=A.height-T-_,U={type:"object",column:2,properties:{type:{title:m("type"),type:"string",widget:"select",props:{options:F},required:!0,span:12},name:{title:m("fieldName"),type:"string",required:!0,span:12,rules:[{validator:$,message:m("validation.uniqueName")}],props:{autoComplete:"off"}},editable:{title:m("editable"),type:"boolean",span:8,hidden:typeof G.readOnly<"u"},required:{title:m("required"),type:"boolean",span:16,hidden:"{{!formData.editable}}"},"-":{type:"void",widget:"Divider"},align:{title:m("align"),type:"void",widget:"AlignWidget"},position:{type:"object",widget:"card",properties:{x:{title:"X",type:"number",widget:"inputNumber",required:!0,span:8,min:C,max:A.width-I,rules:[{validator:(N,R)=>P(N,R,"x"),message:m("validation.outOfBounds")}]},y:{title:"Y",type:"number",widget:"inputNumber",required:!0,span:8,min:T,max:A.height-_,rules:[{validator:(N,R)=>P(N,R,"y"),message:m("validation.outOfBounds")}]}}},width:{title:m("width"),type:"number",widget:"inputNumber",required:!0,span:6,props:{min:0,max:j},rules:[{validator:(N,R)=>P(N,R,"width"),message:m("validation.outOfBounds")}]},height:{title:m("height"),type:"number",widget:"inputNumber",required:!0,span:6,props:{min:0,max:V},rules:[{validator:(N,R)=>P(N,R,"height"),message:m("validation.outOfBounds")}]},rotate:{title:m("rotate"),type:"number",widget:"inputNumber",disabled:typeof G.rotate>"u",max:360,props:{min:0},span:6},opacity:{title:m("opacity"),type:"number",widget:"inputNumber",disabled:typeof G.opacity>"u",props:{step:.1,min:0,max:1},span:6}}},M={...U.properties};if(typeof B=="function"){const{size:N,schemas:R,pageSize:k,changeSchemas:H,activeElements:W,deselectSchema:Z,activeSchema:te}=a,q=B({...{size:N,schemas:R,pageSize:k,changeSchemas:H,activeElements:W,deselectSchema:Z,activeSchema:te},options:f,theme:s,i18n:m}),Q=q&&typeof q=="object"?q:{},ee=Object.keys(Q).length===0?{}:{"--":{type:"void",widget:"Divider"}};U.properties={...M,...ee,...Q}}else{const N=B&&typeof B=="object"?B:{},R=Object.keys(N).length===0?{}:{"--":{type:"void",widget:"Divider"}};U.properties={...M,...R,...N}}return jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("div",{style:{height:40,display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button$1,{style:{position:"absolute",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},onClick:p,icon:jsxRuntimeExports.jsx(Menu,{strokeWidth:1.5,size:20})}),jsxRuntimeExports.jsx(Text$2,{strong:!0,style:{textAlign:"center",width:"100%"},children:m("editField")})]}),jsxRuntimeExports.jsx(Divider,{style:{marginTop:s.marginXS,marginBottom:s.marginXS}}),jsxRuntimeExports.jsx("div",{style:{height:getSidebarContentHeight(c.height),overflowY:"auto",overflowX:"hidden"},children:jsxRuntimeExports.jsx(FormRenderComponent,{form:g,schema:U,widgets:E,watch:{"#":O},locale:"en-US"})})]})},propsAreUnchanged=(a,s)=>JSON.stringify(a.activeSchema)==JSON.stringify(s.activeSchema),DetailView=React.memo(DetailView$1,propsAreUnchanged),Sidebar=a=>{const{sidebarOpen:s,setSidebarOpen:c,activeElements:u,schemas:d}=a,{token:p}=theme.useToken(),v=()=>d.filter(g=>u.map(b=>b.id).includes(g.id)),A=()=>{const g=v();return g[g.length-1]},x={strokeWidth:1.5,size:20};return jsxRuntimeExports.jsx("div",{style:{position:"absolute",right:0,zIndex:1,height:"100%",width:s?RIGHT_SIDEBAR_WIDTH:0},children:jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Button$1,{style:{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",top:"1rem",right:"1rem",zIndex:100},icon:s?jsxRuntimeExports.jsx(ArrowRight,{...x}):jsxRuntimeExports.jsx(ArrowLeft,{...x}),onClick:()=>c(!s)}),jsxRuntimeExports.jsx("div",{style:{width:RIGHT_SIDEBAR_WIDTH,height:"100%",display:s?"block":"none",top:0,right:0,position:"absolute",padding:"0.7rem 1rem",overflowY:"auto",fontFamily:"'Open Sans', sans-serif",boxSizing:"border-box",background:p.colorBgLayout},children:jsxRuntimeExports.jsx("div",{children:v().length===0?jsxRuntimeExports.jsx(ListView,{...a}):jsxRuntimeExports.jsx(DetailView,{...a,activeSchema:A()})})})]})})},useRerenderDependencies=a=>{const{plugin:s,value:c,mode:u,scale:d,schema:p,options:v}=a,A=cloneDeep$1(v);A.font&&Object.values(A.font).forEach(g=>{g.data="..."});const x=JSON.stringify(A);return reactExports.useMemo(()=>s?.uninterruptedEditMode&&u==="designer"?[u]:[c,u,d,JSON.stringify(p),x],[c,u,d,p,x,s])},Wrapper=({children:a,outline:s,onChangeHoveringSchemaId:c,schema:u,selectable:d=!0})=>jsxRuntimeExports.jsxs("div",{title:u.name,onMouseEnter:()=>c&&c(u.id),onMouseLeave:()=>c&&c(null),className:d?SELECTABLE_CLASSNAME:"",id:u.id,style:{position:"absolute",cursor:u.readOnly?"initial":"pointer",height:u.height*ZOOM,width:u.width*ZOOM,top:u.position.y*ZOOM,left:u.position.x*ZOOM,transform:`rotate(${u.rotate??0}deg)`,opacity:u.opacity??1,outline:s},children:[u.required&&jsxRuntimeExports.jsx("span",{style:{color:"red",position:"absolute",top:-12,left:-12,fontSize:18,fontWeight:700},children:"*"}),a]}),Renderer=a=>{const{schema:s,basePdf:c,value:u,mode:d,onChange:p,stopEditing:v,tabIndex:A,placeholder:x,scale:g}=a,b=reactExports.useContext(PluginsRegistry),y=reactExports.useContext(OptionsContext),f=reactExports.useContext(I18nContext),{token:m}=theme.useToken(),E=reactExports.useRef(null),w=reactExports.useContext(CacheContext),S=b.findByType(s.type),$=useRerenderDependencies({plugin:S,value:u,mode:d,scale:g,schema:s,options:y});return reactExports.useEffect(()=>{if(!S?.ui||!E.current||!s.type)return;E.current.innerHTML="";const T=S.ui;return T({value:u,schema:s,basePdf:c,rootElement:E.current,mode:d,onChange:p,stopEditing:v,tabIndex:A,placeholder:x,options:y,theme:m,i18n:f,scale:g,_cache:w}),()=>{E.current&&(E.current.innerHTML="")}},$),S?jsxRuntimeExports.jsx(Wrapper,{...a,children:jsxRuntimeExports.jsx("div",{style:{height:"100%",width:"100%"},ref:E})}):(console.error(`[@pdfme/ui] Renderer for type ${s.type} not found.
642
- Check this document: https://pdfme.com/docs/custom-schemas`),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}))},Draggable$1=a=>{const{scale:s,basePdf:c,plugin:u}=a,{token:d}=theme.useToken(),p=reactExports.useContext(OptionsContext),v=u.propPanel.defaultSchema;if(p.font){const w=getFallbackFontName(p.font);setFontNameRecursively(v,w)}const A=useDraggable({id:v.type,data:v}),{listeners:x,setNodeRef:g,attributes:b,transform:y,isDragging:f}=A,m={transform:CSS$1.Translate.toString(y)},E=React.useMemo(()=>jsxRuntimeExports.jsx("div",{style:{transform:`scale(${s})`},children:jsxRuntimeExports.jsx(Renderer,{schema:{...v,id:v.type},basePdf:c,value:v.content||"",onChangeHoveringSchemaId:()=>{},mode:"viewer",outline:`1px solid ${d.colorPrimary}`,scale:s})}),[v,c,s,d.colorPrimary]);return jsxRuntimeExports.jsxs("div",{ref:g,style:m,...x,...b,children:[f&&E,jsxRuntimeExports.jsx("div",{style:{visibility:f?"hidden":"visible"},children:a.children})]})},LeftSidebar=({height:a,scale:s,basePdf:c})=>{const{token:u}=theme.useToken(),d=reactExports.useContext(PluginsRegistry),[p,v]=reactExports.useState(!1);return reactExports.useEffect(()=>{const A=()=>{p&&v(!1)};return document.addEventListener("mouseup",A),()=>{document.removeEventListener("mouseup",A)}},[p]),jsxRuntimeExports.jsx("div",{style:{left:0,right:0,position:"absolute",zIndex:1,height:a,width:LEFT_SIDEBAR_WIDTH,background:u.colorBgLayout,textAlign:"center",overflow:p?"visible":"auto"},children:d.entries().map(([A,x])=>x?.propPanel.defaultSchema?jsxRuntimeExports.jsx(Draggable$1,{scale:s,basePdf:c,plugin:x,children:jsxRuntimeExports.jsx(Button$1,{onMouseDown:()=>v(!0),style:{width:35,height:35,marginTop:"0.25rem",padding:"0.25rem"},children:jsxRuntimeExports.jsx(PluginIcon,{plugin:x,label:A})})},A):null)})},Paper=a=>{const{paperRefs:s,scale:c,size:u,schemasList:d,pageSizes:p,backgrounds:v,renderPaper:A,renderSchema:x,hasRulers:g}=a,b=reactExports.useContext(FontContext),y=g?RULER_HEIGHT:0;return p.length!==v.length||p.length!==d.length?null:jsxRuntimeExports.jsx("div",{style:{transform:`scale(${c})`,transformOrigin:"top left",height:c,width:c},children:v.map((f,m)=>{const E=p[m],w={width:E.width*ZOOM,height:E.height*ZOOM},S=w.width*c+y<u.width?`${(u.width/c-w.width)/2}px`:`${y}px`;let $=m>0?(y+PAGE_GAP)*(m+1):y;return g||($+=PAGE_GAP*2),jsxRuntimeExports.jsxs("div",{ref:T=>{T&&(s.current[m]=T)},onMouseDown:T=>{T.currentTarget===T.target&&document&&document.hasFocus()&&document.activeElement instanceof HTMLElement&&document.activeElement.blur()},style:{fontFamily:`'${getFallbackFontName(b)}'`,top:`${$}px`,left:S,position:"relative",backgroundImage:`url(${f})`,backgroundSize:`${w.width}px ${w.height}px`,...w},children:[A({paperSize:w,index:m}),d[m].map((T,I)=>jsxRuntimeExports.jsx("div",{children:x({schema:T,index:m===0?I:I+d[m-1].length})},T.id))]},String(m)+JSON.stringify(w))})})};var FUNCTION="function",OBJECT="object",STRING="string",NUMBER="number",UNDEFINED="undefined",IS_WINDOW=typeof window!==UNDEFINED,doc=typeof document!==UNDEFINED&&document,OPEN_CLOSED_CHARACTERS=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],TINY_NUM$1=1e-7,DEFAULT_UNIT_PRESETS={cm:function(a){return a*96/2.54},mm:function(a){return a*96/254},in:function(a){return a*96},pt:function(a){return a*96/72},pc:function(a){return a*96/6},"%":function(a,s){return a*s/100},vw:function(a,s){return s===void 0&&(s=window.innerWidth),a/100*s},vh:function(a,s){return s===void 0&&(s=window.innerHeight),a/100*s},vmax:function(a,s){return s===void 0&&(s=Math.max(window.innerWidth,window.innerHeight)),a/100*s},vmin:function(a,s){return s===void 0&&(s=Math.min(window.innerWidth,window.innerHeight)),a/100*s}};function __spreadArrays$2(){for(var a=0,s=0,c=arguments.length;s<c;s++)a+=arguments[s].length;for(var u=Array(a),d=0,s=0;s<c;s++)for(var p=arguments[s],v=0,A=p.length;v<A;v++,d++)u[d]=p[v];return u}function dot(a,s,c,u){return(a*u+s*c)/(c+u)}function isUndefined(a){return typeof a===UNDEFINED}function isObject$1(a){return a&&typeof a===OBJECT}function isArray(a){return Array.isArray(a)}function isString(a){return typeof a===STRING}function isNumber(a){return typeof a===NUMBER}function isFunction(a){return typeof a===FUNCTION}function isEqualSeparator(a,s){var c=a===""||a==" ",u=s===""||s==" ";return u&&c||a===s}function findOpen(a,s,c,u,d){var p=findIgnore(a,s,c);return p?c:findClose(a,s,c+1,u,d)}function findIgnore(a,s,c){if(!a.ignore)return null;var u=s.slice(Math.max(c-3,0),c+3).join("");return new RegExp(a.ignore).exec(u)}function findClose(a,s,c,u,d){for(var p=function(g){var b=s[g].trim();if(b===a.close&&!findIgnore(a,s,g))return{value:g};var y=g,f=find$1(d,function(m){var E=m.open;return E===b});if(f&&(y=findOpen(f,s,g,u,d)),y===-1)return v=g,"break";g=y,v=g},v,A=c;A<u;++A){var x=p(A);if(A=v,typeof x=="object")return x.value;if(x==="break")break}return-1}function splitText(a,s){var c=isString(s)?{separator:s}:s,u=c.separator,d=u===void 0?",":u,p=c.isSeparateFirst,v=c.isSeparateOnlyOpenClose,A=c.isSeparateOpenClose,x=A===void 0?v:A,g=c.openCloseCharacters,b=g===void 0?OPEN_CLOSED_CHARACTERS:g,y=b.map(function(O){var L=O.open,B=O.close;return L===B?L:L+"|"+B}).join("|"),f="(\\s*"+d+"\\s*|"+y+"|\\s+)",m=new RegExp(f,"g"),E=a.split(m).filter(function(O){return O&&O!=="undefined"}),w=E.length,S=[],$=[];function T(){return $.length?(S.push($.join("")),$=[],!0):!1}for(var I=function(O){var L=E[O].trim(),B=O,F=find$1(b,function(j){var V=j.open;return V===L}),D=find$1(b,function(j){var V=j.close;return V===L});if(F){if(B=findOpen(F,E,O,w,b),B!==-1&&x)return T()&&p||(S.push(E.slice(O,B+1).join("")),O=B,p)?(_=O,"break"):(_=O,"continue")}else if(D&&!findIgnore(D,E,O)){var G=__spreadArrays$2(b);return G.splice(b.indexOf(D),1),{value:splitText(a,{separator:d,isSeparateFirst:p,isSeparateOnlyOpenClose:v,isSeparateOpenClose:x,openCloseCharacters:G})}}else if(isEqualSeparator(L,d)&&!v)return T(),p?(_=O,"break"):(_=O,"continue");B===-1&&(B=w-1),$.push(E.slice(O,B+1).join("")),O=B,_=O},_,C=0;C<w;++C){var P=I(C);if(C=_,typeof P=="object")return P.value;if(P==="break")break}return $.length&&S.push($.join("")),S}function splitSpace(a){return splitText(a,"")}function splitComma(a){return splitText(a,",")}function splitBracket(a){var s=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(a);return!s||s.length<4?{}:{prefix:s[1],value:s[2],suffix:s[3]}}function splitUnit(a){var s=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(a);if(!s)return{prefix:"",unit:"",value:NaN};var c=s[1],u=s[2],d=s[3];return{prefix:c,unit:d,value:parseFloat(u)}}function camelize(a){return a.replace(/[\s-_]+([^\s-_])/g,function(s,c){return c.toUpperCase()})}function decamelize(a,s){return a.replace(/([a-z])([A-Z])/g,function(c,u,d){return""+u+s+d.toLowerCase()})}function now(){return Date.now?Date.now():new Date().getTime()}function findIndex(a,s,c){c===void 0&&(c=-1);for(var u=a.length,d=0;d<u;++d)if(s(a[d],d,a))return d;return c}function findLastIndex(a,s,c){c===void 0&&(c=-1);for(var u=a.length,d=u-1;d>=0;--d)if(s(a[d],d,a))return d;return c}function findLast(a,s,c){var u=findLastIndex(a,s);return u>-1?a[u]:c}function find$1(a,s,c){var u=findIndex(a,s);return u>-1?a[u]:c}var requestAnimationFrame$1=(function(){var a=now(),s=IS_WINDOW&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame);return s?s.bind(window):function(c){var u=now(),d=setTimeout(function(){c(u-a)},1e3/60);return d}})(),cancelAnimationFrame$1=(function(){var a=IS_WINDOW&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame);return a?a.bind(window):function(s){clearTimeout(s)}})();function getKeys(a){return Object.keys(a)}function convertUnitSize(a,s){var c=splitUnit(a),u=c.value,d=c.unit;if(isObject$1(s)){var p=s[d];if(p){if(isFunction(p))return p(u);if(DEFAULT_UNIT_PRESETS[d])return DEFAULT_UNIT_PRESETS[d](u,p)}}else if(d==="%")return u*s/100;return DEFAULT_UNIT_PRESETS[d]?DEFAULT_UNIT_PRESETS[d](u):u}function between(a,s,c){return Math.max(s,Math.min(a,c))}function checkBoundSize(a,s,c,u){return u===void 0&&(u=a[0]/a[1]),[[throttle(s[0],TINY_NUM$1),throttle(s[0]/u,TINY_NUM$1)],[throttle(s[1]*u,TINY_NUM$1),throttle(s[1],TINY_NUM$1)]].filter(function(d){return d.every(function(p,v){var A=s[v],x=throttle(A,TINY_NUM$1);return c?p<=A||p<=x:p>=A||p>=x})})[0]||a}function calculateBoundSize(a,s,c,u){if(!u)return a.map(function(m,E){return between(m,s[E],c[E])});var d=a[0],p=a[1],v=u===!0?d/p:u,A=checkBoundSize(a,s,!1,v),x=A[0],g=A[1],b=checkBoundSize(a,c,!0,v),y=b[0],f=b[1];return d<x||p<g?(d=x,p=g):(d>y||p>f)&&(d=y,p=f),[d,p]}function sum(a){for(var s=a.length,c=0,u=s-1;u>=0;--u)c+=a[u];return c}function average(a){for(var s=a.length,c=0,u=s-1;u>=0;--u)c+=a[u];return s?c/s:0}function getRad$1(a,s){var c=s[0]-a[0],u=s[1]-a[1],d=Math.atan2(u,c);return d>=0?d:d+Math.PI*2}function getCenterPoint(a){return[0,1].map(function(s){return average(a.map(function(c){return c[s]}))})}function getShapeDirection(a){var s=getCenterPoint(a),c=getRad$1(s,a[0]),u=getRad$1(s,a[1]);return c<u&&u-c<Math.PI||c>u&&u-c<-Math.PI?1:-1}function getDist$2(a,s){return Math.sqrt(Math.pow((s?s[0]:0)-a[0],2)+Math.pow((s?s[1]:0)-a[1],2))}function throttle(a,s){if(!s)return a;var c=1/s;return Math.round(a/s)/c}function throttleArray(a,s){return a.forEach(function(c,u){a[u]=throttle(a[u],s)}),a}function counter(a){for(var s=[],c=0;c<a;++c)s.push(c);return s}function flat$1(a){return a.reduce(function(s,c){return s.concat(c)},[])}function hasClass(a,s){return a.classList?a.classList.contains(s):!!a.className.match(new RegExp("(\\s|^)"+s+"(\\s|$)"))}function addClass(a,s){a.classList?a.classList.add(s):a.className+=" "+s}function removeClass(a,s){if(a.classList)a.classList.remove(s);else{var c=new RegExp("(\\s|^)"+s+"(\\s|$)");a.className=a.className.replace(c," ")}}function addEvent(a,s,c,u){a.addEventListener(s,c,u)}function removeEvent(a,s,c,u){a.removeEventListener(s,c,u)}function getDocument(a){return a?.ownerDocument||doc}function getDocumentElement(a){return getDocument(a).documentElement}function getDocumentBody(a){return getDocument(a).body}function getWindow(a){var s;return((s=a?.ownerDocument)===null||s===void 0?void 0:s.defaultView)||window}function isWindow(a){return a&&"postMessage"in a&&"blur"in a&&"self"in a}function isNode(a){return isObject$1(a)&&a.nodeName&&a.nodeType&&"ownerDocument"in a}var __assign$8=function(){return __assign$8=Object.assign||function(s){for(var c,u=1,d=arguments.length;u<d;u++){c=arguments[u];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(s[p]=c[p])}return s},__assign$8.apply(this,arguments)};function __spreadArrays$1(){for(var a=0,s=0,c=arguments.length;s<c;s++)a+=arguments[s].length;for(var u=Array(a),d=0,s=0;s<c;s++)for(var p=arguments[s],v=0,A=p.length;v<A;v++,d++)u[d]=p[v];return u}var EventEmitter=(function(){function a(){this._events={}}var s=a.prototype;return s.on=function(c,u){if(isObject$1(c))for(var d in c)this.on(d,c[d]);else this._addEvent(c,u,{});return this},s.off=function(c,u){if(!c)this._events={};else if(isObject$1(c))for(var d in c)this.off(d);else if(!u)this._events[c]=[];else{var p=this._events[c];if(p){var v=findIndex(p,function(A){return A.listener===u});v>-1&&p.splice(v,1)}}return this},s.once=function(c,u){var d=this;return u&&this._addEvent(c,u,{once:!0}),new Promise(function(p){d._addEvent(c,p,{once:!0})})},s.emit=function(c,u){var d=this;u===void 0&&(u={});var p=this._events[c];if(!c||!p)return!0;var v=!1;return u.eventType=c,u.stop=function(){v=!0},u.currentTarget=this,__spreadArrays$1(p).forEach(function(A){A.listener(u),A.once&&d.off(c,A.listener)}),!v},s.trigger=function(c,u){return u===void 0&&(u={}),this.emit(c,u)},s._addEvent=function(c,u,d){var p=this._events;p[c]=p[c]||[];var v=p[c];v.push(__assign$8({listener:u},d))},a})();var extendStatics$8=function(a,s){return extendStatics$8=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,u){c.__proto__=u}||function(c,u){for(var d in u)u.hasOwnProperty(d)&&(c[d]=u[d])},extendStatics$8(a,s)};function __extends$8(a,s){extendStatics$8(a,s);function c(){this.constructor=a}a.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}var __assign$7=function(){return __assign$7=Object.assign||function(s){for(var c,u=1,d=arguments.length;u<d;u++){c=arguments[u];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(s[p]=c[p])}return s},__assign$7.apply(this,arguments)};function getRad(a,s){var c=s[0]-a[0],u=s[1]-a[1],d=Math.atan2(u,c);return d>=0?d:d+Math.PI*2}function getRotatiion(a){return getRad([a[0].clientX,a[0].clientY],[a[1].clientX,a[1].clientY])/Math.PI*180}function isMultiTouch(a){return a.touches&&a.touches.length>=2}function getEventClients(a){return a?a.touches?getClients(a.touches):[getClient$1(a)]:[]}function isMouseEvent(a){return a&&(a.type.indexOf("mouse")>-1||"button"in a)}function getPosition(a,s,c){var u=c.length,d=getAverageClient(a,u),p=d.clientX,v=d.clientY,A=d.originalClientX,x=d.originalClientY,g=getAverageClient(s,u),b=g.clientX,y=g.clientY,f=getAverageClient(c,u),m=f.clientX,E=f.clientY,w=p-b,S=v-y,$=p-m,T=v-E;return{clientX:A,clientY:x,deltaX:w,deltaY:S,distX:$,distY:T}}function getDist$1(a){return Math.sqrt(Math.pow(a[0].clientX-a[1].clientX,2)+Math.pow(a[0].clientY-a[1].clientY,2))}function getClients(a){for(var s=Math.min(a.length,2),c=[],u=0;u<s;++u)c.push(getClient$1(a[u]));return c}function getClient$1(a){return{clientX:a.clientX,clientY:a.clientY}}function getAverageClient(a,s){s===void 0&&(s=a.length);for(var c={clientX:0,clientY:0,originalClientX:0,originalClientY:0},u=Math.min(a.length,s),d=0;d<u;++d){var p=a[d];c.originalClientX+="originalClientX"in p?p.originalClientX:p.clientX,c.originalClientY+="originalClientY"in p?p.originalClientY:p.clientY,c.clientX+=p.clientX,c.clientY+=p.clientY}return s?{clientX:c.clientX/s,clientY:c.clientY/s,originalClientX:c.originalClientX/s,originalClientY:c.originalClientY/s}:c}var ClientStore=(function(){function a(s){this.prevClients=[],this.startClients=[],this.movement=0,this.length=0,this.startClients=s,this.prevClients=s,this.length=s.length}return a.prototype.getAngle=function(s){return s===void 0&&(s=this.prevClients),getRotatiion(s)},a.prototype.getRotation=function(s){return s===void 0&&(s=this.prevClients),getRotatiion(s)-getRotatiion(this.startClients)},a.prototype.getPosition=function(s,c){s===void 0&&(s=this.prevClients);var u=getPosition(s||this.prevClients,this.prevClients,this.startClients),d=u.deltaX,p=u.deltaY;return this.movement+=Math.sqrt(d*d+p*p),this.prevClients=s,u},a.prototype.getPositions=function(s){s===void 0&&(s=this.prevClients);for(var c=this.prevClients,u=this.startClients,d=Math.min(this.length,c.length),p=[],v=0;v<d;++v)p[v]=getPosition([s[v]],[c[v]],[u[v]]);return p},a.prototype.getMovement=function(s){var c=this.movement;if(!s)return c;var u=getAverageClient(s,this.length),d=getAverageClient(this.prevClients,this.length),p=u.clientX-d.clientX,v=u.clientY-d.clientY;return Math.sqrt(p*p+v*v)+c},a.prototype.getDistance=function(s){return s===void 0&&(s=this.prevClients),getDist$1(s)},a.prototype.getScale=function(s){return s===void 0&&(s=this.prevClients),getDist$1(s)/getDist$1(this.startClients)},a.prototype.move=function(s,c){this.startClients.forEach(function(u){u.clientX-=s,u.clientY-=c}),this.prevClients.forEach(function(u){u.clientX-=s,u.clientY-=c})},a})(),INPUT_TAGNAMES=["textarea","input"],Gesto=(function(a){__extends$8(s,a);function s(c,u){u===void 0&&(u={});var d=a.call(this)||this;d.options={},d.flag=!1,d.pinchFlag=!1,d.data={},d.isDrag=!1,d.isPinch=!1,d.clientStores=[],d.targets=[],d.prevTime=0,d.doubleFlag=!1,d._useMouse=!1,d._useTouch=!1,d._useDrag=!1,d._dragFlag=!1,d._isTrusted=!1,d._isMouseEvent=!1,d._isSecondaryButton=!1,d._preventMouseEvent=!1,d._prevInputEvent=null,d._isDragAPI=!1,d._isIdle=!0,d._preventMouseEventId=0,d._window=window,d.onDragStart=function(f,m){if(m===void 0&&(m=!0),!(!d.flag&&f.cancelable===!1)){var E=f.type.indexOf("drag")>=-1;if(!(d.flag&&E)){d._isDragAPI=!0;var w=d.options,S=w.container,$=w.pinchOutside,T=w.preventWheelClick,I=w.preventRightClick,_=w.preventDefault,C=w.checkInput,P=w.dragFocusedInput,O=w.preventClickEventOnDragStart,L=w.preventClickEventOnDrag,B=w.preventClickEventByCondition,F=d._useTouch,D=!d.flag;if(d._isSecondaryButton=f.which===3||f.button===2,T&&(f.which===2||f.button===1)||I&&(f.which===3||f.button===2))return d.stop(),!1;if(D){var G=d._window.document.activeElement,j=f.target;if(j){var V=j.tagName.toLowerCase(),U=INPUT_TAGNAMES.indexOf(V)>-1,M=j.isContentEditable;if(U||M){if(C||!P&&G===j)return!1;if(G&&(G===j||M&&G.isContentEditable&&G.contains(j)))if(P)j.blur();else return!1}else if((_||f.type==="touchstart")&&G){var N=G.tagName.toLowerCase();(G.isContentEditable||INPUT_TAGNAMES.indexOf(N)>-1)&&G.blur()}(O||L||B)&&addEvent(d._window,"click",d._onClick,!0)}d.clientStores=[new ClientStore(getEventClients(f))],d._isIdle=!1,d.flag=!0,d.isDrag=!1,d._isTrusted=m,d._dragFlag=!0,d._prevInputEvent=f,d.data={},d.doubleFlag=now()-d.prevTime<200,d._isMouseEvent=isMouseEvent(f),!d._isMouseEvent&&d._preventMouseEvent&&d._allowMouseEvent();var R=d._preventMouseEvent||d.emit("dragStart",__assign$7(__assign$7({data:d.data,datas:d.data,inputEvent:f,isMouseEvent:d._isMouseEvent,isSecondaryButton:d._isSecondaryButton,isTrusted:m,isDouble:d.doubleFlag},d.getCurrentStore().getPosition()),{preventDefault:function(){f.preventDefault()},preventDrag:function(){d._dragFlag=!1}}));R===!1&&d.stop(),d._isMouseEvent&&d.flag&&_&&f.preventDefault()}if(!d.flag)return!1;var k=0;if(D?(d._attchDragEvent(),F&&$&&(k=setTimeout(function(){addEvent(S,"touchstart",d.onDragStart,{passive:!1})}))):F&&$&&removeEvent(S,"touchstart",d.onDragStart),d.flag&&isMultiTouch(f)){if(clearTimeout(k),D&&f.touches.length!==f.changedTouches.length)return;d.pinchFlag||d.onPinchStart(f)}}}},d.onDrag=function(f,m){if(d.flag){var E=d.options.preventDefault;!d._isMouseEvent&&E&&f.preventDefault(),d._prevInputEvent=f;var w=getEventClients(f),S=d.moveClients(w,f,!1);if(d._dragFlag){if(d.pinchFlag||S.deltaX||S.deltaY){var $=d._preventMouseEvent||d.emit("drag",__assign$7(__assign$7({},S),{isScroll:!!m,inputEvent:f}));if($===!1){d.stop();return}}d.pinchFlag&&d.onPinch(f,w)}d.getCurrentStore().getPosition(w,!0)}},d.onDragEnd=function(f){if(d.flag){var m=d.options,E=m.pinchOutside,w=m.container,S=m.preventClickEventOnDrag,$=m.preventClickEventOnDragStart,T=m.preventClickEventByCondition,I=d.isDrag;(S||$||T)&&requestAnimationFrame(function(){d._allowClickEvent()}),!T&&!$&&S&&!I&&d._allowClickEvent(),d._useTouch&&E&&removeEvent(w,"touchstart",d.onDragStart),d.pinchFlag&&d.onPinchEnd(f);var _=f?.touches?getEventClients(f):[],C=_.length;C===0||!d.options.keepDragging?d.flag=!1:d._addStore(new ClientStore(_));var P=d._getPosition(),O=now(),L=!I&&d.doubleFlag;d._prevInputEvent=null,d.prevTime=I||L?0:O,d.flag||(d._dettachDragEvent(),d._preventMouseEvent||d.emit("dragEnd",__assign$7({data:d.data,datas:d.data,isDouble:L,isDrag:I,isClick:!I,isMouseEvent:d._isMouseEvent,isSecondaryButton:d._isSecondaryButton,inputEvent:f,isTrusted:d._isTrusted},P)),d.clientStores=[],d._isMouseEvent||(d._preventMouseEvent=!0,clearTimeout(d._preventMouseEventId),d._preventMouseEventId=setTimeout(function(){d._preventMouseEvent=!1},200)),d._isIdle=!0)}},d.onBlur=function(){d.onDragEnd()},d._allowClickEvent=function(){removeEvent(d._window,"click",d._onClick,!0)},d._onClick=function(f){d._allowClickEvent(),d._allowMouseEvent();var m=d.options.preventClickEventByCondition;m?.(f)||(f.stopPropagation(),f.preventDefault())},d._onContextMenu=function(f){var m=d.options;m.preventRightClick?d.onDragEnd(f):f.preventDefault()},d._passCallback=function(){};var p=[].concat(c),v=p[0];d._window=isWindow(v)?v:getWindow(v),d.options=__assign$7({checkInput:!1,container:v&&!("document"in v)?getWindow(v):v,preventRightClick:!0,preventWheelClick:!0,preventClickEventOnDragStart:!1,preventClickEventOnDrag:!1,preventClickEventByCondition:null,preventDefault:!0,checkWindowBlur:!1,keepDragging:!1,pinchThreshold:0,events:["touch","mouse"]},u);var A=d.options,x=A.container,g=A.events,b=A.checkWindowBlur;if(d._useDrag=g.indexOf("drag")>-1,d._useTouch=g.indexOf("touch")>-1,d._useMouse=g.indexOf("mouse")>-1,d.targets=p,d._useDrag&&p.forEach(function(f){addEvent(f,"dragstart",d.onDragStart)}),d._useMouse&&(p.forEach(function(f){addEvent(f,"mousedown",d.onDragStart),addEvent(f,"mousemove",d._passCallback)}),addEvent(x,"contextmenu",d._onContextMenu)),b&&addEvent(getWindow(),"blur",d.onBlur),d._useTouch){var y={passive:!1};p.forEach(function(f){addEvent(f,"touchstart",d.onDragStart,y),addEvent(f,"touchmove",d._passCallback,y)})}return d}return s.prototype.stop=function(){this.isDrag=!1,this.data={},this.clientStores=[],this.pinchFlag=!1,this.doubleFlag=!1,this.prevTime=0,this.flag=!1,this._isIdle=!0,this._allowClickEvent(),this._dettachDragEvent(),this._isDragAPI=!1},s.prototype.getMovement=function(c){return this.getCurrentStore().getMovement(c)+this.clientStores.slice(1).reduce(function(u,d){return u+d.movement},0)},s.prototype.isDragging=function(){return this.isDrag},s.prototype.isIdle=function(){return this._isIdle},s.prototype.isFlag=function(){return this.flag},s.prototype.isPinchFlag=function(){return this.pinchFlag},s.prototype.isDoubleFlag=function(){return this.doubleFlag},s.prototype.isPinching=function(){return this.isPinch},s.prototype.scrollBy=function(c,u,d,p){p===void 0&&(p=!0),this.flag&&(this.clientStores[0].move(c,u),p&&this.onDrag(d,!0))},s.prototype.move=function(c,u){var d=c[0],p=c[1],v=this.getCurrentStore(),A=v.prevClients;return this.moveClients(A.map(function(x){var g=x.clientX,b=x.clientY;return{clientX:g+d,clientY:b+p,originalClientX:g,originalClientY:b}}),u,!0)},s.prototype.triggerDragStart=function(c){this.onDragStart(c,!1)},s.prototype.setEventData=function(c){var u=this.data;for(var d in c)u[d]=c[d];return this},s.prototype.setEventDatas=function(c){return this.setEventData(c)},s.prototype.getCurrentEvent=function(c){return c===void 0&&(c=this._prevInputEvent),__assign$7(__assign$7({data:this.data,datas:this.data},this._getPosition()),{movement:this.getMovement(),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:c})},s.prototype.getEventData=function(){return this.data},s.prototype.getEventDatas=function(){return this.data},s.prototype.unset=function(){var c=this,u=this.targets,d=this.options.container;this.off(),removeEvent(this._window,"blur",this.onBlur),this._useDrag&&u.forEach(function(p){removeEvent(p,"dragstart",c.onDragStart)}),this._useMouse&&(u.forEach(function(p){removeEvent(p,"mousedown",c.onDragStart)}),removeEvent(d,"contextmenu",this._onContextMenu)),this._useTouch&&(u.forEach(function(p){removeEvent(p,"touchstart",c.onDragStart)}),removeEvent(d,"touchstart",this.onDragStart)),this._prevInputEvent=null,this._allowClickEvent(),this._dettachDragEvent()},s.prototype.onPinchStart=function(c){var u=this,d=this.options.pinchThreshold;if(!(this.isDrag&&this.getMovement()>d)){var p=new ClientStore(getEventClients(c));this.pinchFlag=!0,this._addStore(p);var v=this.emit("pinchStart",__assign$7(__assign$7({data:this.data,datas:this.data,angle:p.getAngle(),touches:this.getCurrentStore().getPositions()},p.getPosition()),{inputEvent:c,isTrusted:this._isTrusted,preventDefault:function(){c.preventDefault()},preventDrag:function(){u._dragFlag=!1}}));v===!1&&(this.pinchFlag=!1)}},s.prototype.onPinch=function(c,u){if(!(!this.flag||!this.pinchFlag||u.length<2)){var d=this.getCurrentStore();this.isPinch=!0,this.emit("pinch",__assign$7(__assign$7({data:this.data,datas:this.data,movement:this.getMovement(u),angle:d.getAngle(u),rotation:d.getRotation(u),touches:d.getPositions(u),scale:d.getScale(u),distance:d.getDistance(u)},d.getPosition(u)),{inputEvent:c,isTrusted:this._isTrusted}))}},s.prototype.onPinchEnd=function(c){if(this.pinchFlag){var u=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var d=this.getCurrentStore();this.emit("pinchEnd",__assign$7(__assign$7({data:this.data,datas:this.data,isPinch:u,touches:d.getPositions()},d.getPosition()),{inputEvent:c}))}},s.prototype.getCurrentStore=function(){return this.clientStores[0]},s.prototype.moveClients=function(c,u,d){var p=this._getPosition(c,d),v=this.isDrag;(p.deltaX||p.deltaY)&&(this.isDrag=!0);var A=!1;return!v&&this.isDrag&&(A=!0),__assign$7(__assign$7({data:this.data,datas:this.data},p),{movement:this.getMovement(c),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,isMouseEvent:this._isMouseEvent,isSecondaryButton:this._isSecondaryButton,inputEvent:u,isTrusted:this._isTrusted,isFirstDrag:A})},s.prototype._addStore=function(c){this.clientStores.splice(0,0,c)},s.prototype._getPosition=function(c,u){var d=this.getCurrentStore(),p=d.getPosition(c,u),v=this.clientStores.slice(1).reduce(function(g,b){var y=b.getPosition();return g.distX+=y.distX,g.distY+=y.distY,g},p),A=v.distX,x=v.distY;return __assign$7(__assign$7({},p),{distX:A,distY:x})},s.prototype._attchDragEvent=function(){var c=this._window,u=this.options.container,d={passive:!1};this._isDragAPI&&(addEvent(u,"dragover",this.onDrag,d),addEvent(c,"dragend",this.onDragEnd)),this._useMouse&&(addEvent(u,"mousemove",this.onDrag),addEvent(c,"mouseup",this.onDragEnd)),this._useTouch&&(addEvent(u,"touchmove",this.onDrag,d),addEvent(c,"touchend",this.onDragEnd,d),addEvent(c,"touchcancel",this.onDragEnd,d))},s.prototype._dettachDragEvent=function(){var c=this._window,u=this.options.container;this._isDragAPI&&(removeEvent(u,"dragover",this.onDrag),removeEvent(c,"dragend",this.onDragEnd)),this._useMouse&&(removeEvent(u,"mousemove",this.onDrag),removeEvent(c,"mouseup",this.onDragEnd)),this._useTouch&&(removeEvent(u,"touchstart",this.onDragStart),removeEvent(u,"touchmove",this.onDrag),removeEvent(c,"touchend",this.onDragEnd),removeEvent(c,"touchcancel",this.onDragEnd))},s.prototype._allowMouseEvent=function(){this._preventMouseEvent=!1,clearTimeout(this._preventMouseEventId)},s})(EventEmitter);function prefixNames(a){for(var s=[],c=1;c<arguments.length;c++)s[c-1]=arguments[c];return s.map(function(u){return u.split(" ").map(function(d){return d?""+a+d:""}).join(" ")}).join(" ")}function prefixCSS(a,s){return s.replace(/([^}{]*){/gm,function(c,u){return u.replace(/\.([^{,\s\d.]+)/g,"."+a+"$1")+"{"})}function ref(a,s){return function(c){c&&(a[s]=c)}}function refs(a,s,c){return function(u){u&&(a[s][c]=u)}}function Properties(a,s){return function(c){var u=c.prototype;a.forEach(function(d){s(u,d)})}}function withMethods(a,s){return s===void 0&&(s={}),function(c,u){a.forEach(function(d){var p=s[d]||d;p in c||(c[p]=function(){for(var v,A=[],x=0;x<arguments.length;x++)A[x]=arguments[x];var g=(v=this[u])[d].apply(v,A);return g===this[u]?this:g})})}}var PolyMap=(function(){function a(){this.keys=[],this.values=[]}var s=a.prototype;return s.get=function(c){return this.values[this.keys.indexOf(c)]},s.set=function(c,u){var d=this.keys,p=this.values,v=d.indexOf(c),A=v===-1?d.length:v;d[A]=c,p[A]=u},a})(),HashMap=(function(){function a(){this.object={}}var s=a.prototype;return s.get=function(c){return this.object[c]},s.set=function(c,u){this.object[c]=u},a})(),SUPPORT_MAP=typeof Map=="function",Link=(function(){function a(){}var s=a.prototype;return s.connect=function(c,u){this.prev=c,this.next=u,c&&(c.next=this),u&&(u.prev=this)},s.disconnect=function(){var c=this.prev,u=this.next;c&&(c.next=u),u&&(u.prev=c)},s.getIndex=function(){for(var c=this,u=-1;c;)c=c.prev,++u;return u},a})();function orderChanged(a,s){var c=[],u=[];return a.forEach(function(d){var p=d[0],v=d[1],A=new Link;c[p]=A,u[v]=A}),c.forEach(function(d,p){d.connect(c[p-1])}),a.filter(function(d,p){return!s[p]}).map(function(d,p){var v=d[0],A=d[1];if(v===A)return[0,0];var x=c[v],g=u[A-1],b=x.getIndex();x.disconnect(),g?x.connect(g,g.next):x.connect(void 0,c[0]);var y=x.getIndex();return[b,y]})}var Result=(function(){function a(c,u,d,p,v,A,x,g){this.prevList=c,this.list=u,this.added=d,this.removed=p,this.changed=v,this.maintained=A,this.changedBeforeAdded=x,this.fixed=g}var s=a.prototype;return Object.defineProperty(s,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(s,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),s.caculateOrdered=function(){var c=orderChanged(this.changedBeforeAdded,this.fixed),u=this.changed,d=[];this.cacheOrdered=c.filter(function(p,v){var A=p[0],x=p[1],g=u[v],b=g[0],y=g[1];if(A!==x)return d.push([b,y]),!0}),this.cachePureChanged=d},a})();function diff$1(a,s,c){var u=SUPPORT_MAP?Map:c?HashMap:PolyMap,d=c||function(T){return T},p=[],v=[],A=[],x=a.map(d),g=s.map(d),b=new u,y=new u,f=[],m=[],E={},w=[],S=0,$=0;return x.forEach(function(T,I){b.set(T,I)}),g.forEach(function(T,I){y.set(T,I)}),x.forEach(function(T,I){var _=y.get(T);typeof _>"u"?(++$,v.push(I)):E[_]=$}),g.forEach(function(T,I){var _=b.get(T);typeof _>"u"?(p.push(I),++S):(A.push([_,I]),$=E[I]||0,f.push([_-$,I-S]),m.push(I===_),_!==I&&w.push([_,I]))}),v.reverse(),new Result(a,s,p,v,w,A,f,m)}var ListDiffer=(function(){function a(c,u){c===void 0&&(c=[]),this.findKeyCallback=u,this.list=[].slice.call(c)}var s=a.prototype;return s.update=function(c){var u=[].slice.call(c),d=diff$1(this.list,u,this.findKeyCallback);return this.list=u,d},a})();var extendStatics$7=function(a,s){return extendStatics$7=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,u){c.__proto__=u}||function(c,u){for(var d in u)u.hasOwnProperty(d)&&(c[d]=u[d])},extendStatics$7(a,s)};function __extends$7(a,s){extendStatics$7(a,s);function c(){this.constructor=a}a.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}var findKeyCallback=typeof Map=="function"?void 0:(function(){var a=0;return function(s){return s.__DIFF_KEY__||(s.__DIFF_KEY__=++a)}})(),ChildrenDiffer=(function(a){__extends$7(s,a);function s(c){return c===void 0&&(c=[]),a.call(this,c,findKeyCallback)||this}return s})(ListDiffer);function diff(a,s){return diff$1(a,s,findKeyCallback)}var extendStatics$6=function(a,s){return extendStatics$6=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,u){c.__proto__=u}||function(c,u){for(var d in u)u.hasOwnProperty(d)&&(c[d]=u[d])},extendStatics$6(a,s)};function __extends$6(a,s){extendStatics$6(a,s);function c(){this.constructor=a}a.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}var __assign$6=function(){return __assign$6=Object.assign||function(s){for(var c,u=1,d=arguments.length;u<d;u++){c=arguments[u];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(s[p]=c[p])}return s},__assign$6.apply(this,arguments)};function getDefaultScrollPosition$1(a){var s=a.container;return s===document.body?[s.scrollLeft||document.documentElement.scrollLeft,s.scrollTop||document.documentElement.scrollTop]:[s.scrollLeft,s.scrollTop]}function checkDefaultScrollEvent(a,s){return a.addEventListener("scroll",s),function(){a.removeEventListener("scroll",s)}}function getContainerElement(a){if(a){if(isString(a))return document.querySelector(a)}else return null;if(isFunction(a))return a();if(a instanceof Element)return a;if("current"in a)return a.current;if("value"in a)return a.value}var DragScroll=(function(a){__extends$6(s,a);function s(){var u=a!==null&&a.apply(this,arguments)||this;return u._startRect=null,u._startPos=[],u._prevTime=0,u._timer=0,u._prevScrollPos=[0,0],u._isWait=!1,u._flag=!1,u._currentOptions=null,u._lock=!1,u._unregister=null,u._onScroll=function(){var d=u._currentOptions;u._lock||!d||u.emit("scrollDrag",{next:function(p){u.checkScroll({container:d.container,inputEvent:p})}})},u}var c=s.prototype;return c.dragStart=function(u,d){var p=getContainerElement(d.container);if(!p){this._flag=!1;return}var v=0,A=0,x=0,g=0;if(p===document.body)x=window.innerWidth,g=window.innerHeight;else{var b=p.getBoundingClientRect();v=b.top,A=b.left,x=b.width,g=b.height}this._flag=!0,this._startPos=[u.clientX,u.clientY],this._startRect={top:v,left:A,width:x,height:g},this._prevScrollPos=this._getScrollPosition([0,0],d),this._currentOptions=d,this._registerScrollEvent(d)},c.drag=function(u,d){if(clearTimeout(this._timer),!!this._flag){var p=u.clientX,v=u.clientY,A=d.threshold,x=A===void 0?0:A,g=this,b=g._startRect,y=g._startPos;this._currentOptions=d;var f=[0,0];return b.top>v-x?(y[1]>b.top||v<y[1])&&(f[1]=-1):b.top+b.height<v+x&&(y[1]<b.top+b.height||v>y[1])&&(f[1]=1),b.left>p-x?(y[0]>b.left||p<y[0])&&(f[0]=-1):b.left+b.width<p+x&&(y[0]<b.left+b.width||p>y[0])&&(f[0]=1),!f[0]&&!f[1]?!1:this._continueDrag(__assign$6(__assign$6({},d),{direction:f,inputEvent:u,isDrag:!0}))}},c.checkScroll=function(u){var d=this;if(this._isWait)return!1;var p=u.prevScrollPos,v=p===void 0?this._prevScrollPos:p,A=u.direction,x=u.throttleTime,g=x===void 0?0:x,b=u.inputEvent,y=u.isDrag,f=this._getScrollPosition(A||[0,0],u),m=f[0]-v[0],E=f[1]-v[1],w=A||[m?Math.abs(m)/m:0,E?Math.abs(E)/E:0];return this._prevScrollPos=f,this._lock=!1,!m&&!E?!1:(this.emit("move",{offsetX:w[0]?m:0,offsetY:w[1]?E:0,inputEvent:b}),g&&y&&(clearTimeout(this._timer),this._timer=window.setTimeout(function(){d._continueDrag(u)},g)),!0)},c.dragEnd=function(){this._flag=!1,this._lock=!1,clearTimeout(this._timer),this._unregisterScrollEvent()},c._getScrollPosition=function(u,d){var p=d.container,v=d.getScrollPosition,A=v===void 0?getDefaultScrollPosition$1:v;return A({container:getContainerElement(p),direction:u})},c._continueDrag=function(u){var d=this,p,v=u.container,A=u.direction,x=u.throttleTime,g=u.useScroll,b=u.isDrag,y=u.inputEvent;if(!(!this._flag||b&&this._isWait)){var f=now(),m=Math.max(x+this._prevTime-f,0);if(m>0)return clearTimeout(this._timer),this._timer=window.setTimeout(function(){d._continueDrag(u)},m),!1;this._prevTime=f;var E=this._getScrollPosition(A,u);this._prevScrollPos=E,b&&(this._isWait=!0),g||(this._lock=!0);var w={container:getContainerElement(v),direction:A,inputEvent:y};return(p=u.requestScroll)===null||p===void 0||p.call(u,w),this.emit("scroll",w),this._isWait=!1,g||this.checkScroll(__assign$6(__assign$6({},u),{prevScrollPos:E,direction:A,inputEvent:y}))}},c._registerScrollEvent=function(u){this._unregisterScrollEvent();var d=u.checkScrollEvent;if(d){var p=d===!0?checkDefaultScrollEvent:d,v=getContainerElement(u.container);d===!0&&(v===document.body||v===document.documentElement)?this._unregister=checkDefaultScrollEvent(window,this._onScroll):this._unregister=p(v,this._onScroll)}},c._unregisterScrollEvent=function(){var u;(u=this._unregister)===null||u===void 0||u.call(this),this._unregister=null},s})(EventEmitter),extendStatics$5=function(a,s){return extendStatics$5=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,u){c.__proto__=u}||function(c,u){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(c[d]=u[d])},extendStatics$5(a,s)};function __extends$5(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");extendStatics$5(a,s);function c(){this.constructor=a}a.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function createCommonjsModule(a,s){return s={exports:{}},a(s,s.exports),s.exports}var keycode=createCommonjsModule(function(a,s){function c(x){if(x&&typeof x=="object"){var g=x.which||x.keyCode||x.charCode;g&&(x=g)}if(typeof x=="number")return v[x];var b=String(x),y=u[b.toLowerCase()];if(y)return y;var y=d[b.toLowerCase()];if(y)return y;if(b.length===1)return b.charCodeAt(0)}c.isEventKey=function(g,b){if(g&&typeof g=="object"){var y=g.which||g.keyCode||g.charCode;if(y==null)return!1;if(typeof b=="string"){var f=u[b.toLowerCase()];if(f)return f===y;var f=d[b.toLowerCase()];if(f)return f===y}else if(typeof b=="number")return b===y;return!1}},s=a.exports=c;var u=s.code=s.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},d=s.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(p=97;p<123;p++)u[String.fromCharCode(p)]=p-32;for(var p=48;p<58;p++)u[p-48]=p;for(p=1;p<13;p++)u["f"+p]=p+111;for(p=0;p<10;p++)u["numpad "+p]=p+96;var v=s.names=s.title={};for(p in u)v[u[p]]=p;for(var A in d)u[A]=d[A]});keycode.code,keycode.codes,keycode.aliases;var keycode_4=keycode.names;keycode.title;var codeData={"+":"plus","left command":"meta","right command":"meta"},keysSort={shift:1,ctrl:2,alt:3,meta:4};function getKey(a,s){var c=(keycode_4[a]||s||"").toLowerCase();for(var u in codeData)c=c.replace(u,codeData[u]);return c.replace(/\s/g,"")}function getCombi(a,s){s===void 0&&(s=getKey(a.keyCode,a.key));var c=getModifierCombi(a);return c.indexOf(s)===-1&&c.push(s),c.filter(Boolean)}function getModifierCombi(a){var s=[a.shiftKey&&"shift",a.ctrlKey&&"ctrl",a.altKey&&"alt",a.metaKey&&"meta"];return s.filter(Boolean)}function getArrangeCombi(a){var s=a.slice();return s.sort(function(c,u){var d=keysSort[c]||5,p=keysSort[u]||5;return d-p}),s}var globalKeyController,KeyController=(function(a){__extends$5(s,a);function s(u){u===void 0&&(u=window);var d=a.call(this)||this;return d.container=u,d.ctrlKey=!1,d.altKey=!1,d.shiftKey=!1,d.metaKey=!1,d.clear=function(){return d.ctrlKey=!1,d.altKey=!1,d.shiftKey=!1,d.metaKey=!1,d},d.keydownEvent=function(p){d.triggerEvent("keydown",p)},d.keyupEvent=function(p){d.triggerEvent("keyup",p)},d.blur=function(){d.clear(),d.trigger("blur")},addEvent(u,"blur",d.blur),addEvent(u,"keydown",d.keydownEvent),addEvent(u,"keyup",d.keyupEvent),d}var c=s.prototype;return Object.defineProperty(s,"global",{get:function(){return globalKeyController||(globalKeyController=new s)},enumerable:!1,configurable:!0}),s.setGlobal=function(){return this.global},c.destroy=function(){var u=this.container;this.clear(),this.off(),removeEvent(u,"blur",this.blur),removeEvent(u,"keydown",this.keydownEvent),removeEvent(u,"keyup",this.keyupEvent)},c.keydown=function(u,d){return this.addEvent("keydown",u,d)},c.offKeydown=function(u,d){return this.removeEvent("keydown",u,d)},c.offKeyup=function(u,d){return this.removeEvent("keyup",u,d)},c.keyup=function(u,d){return this.addEvent("keyup",u,d)},c.addEvent=function(u,d,p){return isArray(d)?this.on("".concat(u,".").concat(getArrangeCombi(d).join(".")),p):isString(d)?this.on("".concat(u,".").concat(d),p):this.on(u,d),this},c.removeEvent=function(u,d,p){return isArray(d)?this.off("".concat(u,".").concat(getArrangeCombi(d).join(".")),p):isString(d)?this.off("".concat(u,".").concat(d),p):this.off(u,d),this},c.triggerEvent=function(u,d){this.ctrlKey=d.ctrlKey,this.shiftKey=d.shiftKey,this.altKey=d.altKey,this.metaKey=d.metaKey;var p=getKey(d.keyCode,d.key),v=p==="ctrl"||p==="shift"||p==="meta"||p==="alt",A={key:p,isToggle:v,inputEvent:d,keyCode:d.keyCode,ctrlKey:d.ctrlKey,altKey:d.altKey,shiftKey:d.shiftKey,metaKey:d.metaKey};this.trigger(u,A),this.trigger("".concat(u,".").concat(p),A);var x=getCombi(d,p);x.length>1&&this.trigger("".concat(u,".").concat(x.join(".")),A)},s})(EventEmitter);function __spreadArrays(){for(var a=0,s=0,c=arguments.length;s<c;s++)a+=arguments[s].length;for(var u=Array(a),d=0,s=0;s<c;s++)for(var p=arguments[s],v=0,A=p.length;v<A;v++,d++)u[d]=p[v];return u}function tinyThrottle(a){return throttle(a,TINY_NUM$1)}function isSameConstants(a,s){return a.every(function(c,u){return tinyThrottle(c-s[u])===0})}function isSamePoint(a,s){return!tinyThrottle(a[0]-s[0])&&!tinyThrottle(a[1]-s[1])}function getAreaSize(a){return a.length<3?0:Math.abs(sum(a.map(function(s,c){var u=a[c+1]||a[0];return s[0]*u[1]-u[0]*s[1]})))/2}function fitPoints(a,s){var c=s.width,u=s.height,d=s.left,p=s.top,v=getMinMaxs(a),A=v.minX,x=v.minY,g=v.maxX,b=v.maxY,y=c/(g-A),f=u/(b-x);return a.map(function(m){return[d+(m[0]-A)*y,p+(m[1]-x)*f]})}function getMinMaxs(a){var s=a.map(function(u){return u[0]}),c=a.map(function(u){return u[1]});return{minX:Math.min.apply(Math,s),minY:Math.min.apply(Math,c),maxX:Math.max.apply(Math,s),maxY:Math.max.apply(Math,c)}}function isInside(a,s,c){var u=a[0],d=a[1],p=getMinMaxs(s),v=p.minX,A=p.maxX,x=[[v,d],[A,d]],g=getLinearConstants(x[0],x[1]),b=convertLines(s),y=[];if(b.forEach(function(E){var w=getLinearConstants(E[0],E[1]),S=E[0];if(isSameConstants(g,w))y.push({pos:a,line:E,type:"line"});else{var $=getPointsOnLines(getIntersectionPointsByConstants(g,w),[x,E]);$.forEach(function(T){E.some(function(I){return isSamePoint(I,T)})?y.push({pos:T,line:E,type:"point"}):tinyThrottle(S[1]-d)!==0&&y.push({pos:T,line:E,type:"intersection"})})}}),find$1(y,function(E){return E[0]===u}))return!0;var f=0,m={};return y.forEach(function(E){var w=E.pos,S=E.type,$=E.line;if(!(w[0]>u))if(S==="intersection")++f;else{if(S==="line")return;if(S==="point"){var T=find$1($,function(C){return C[1]!==d}),I=m[w[0]],_=T[1]>d?1:-1;I?I!==_&&++f:m[w[0]]=_}}}),f%2===1}function getLinearConstants(a,s){var c=a[0],u=a[1],d=s[0],p=s[1],v=d-c,A=p-u;Math.abs(v)<TINY_NUM$1&&(v=0),Math.abs(A)<TINY_NUM$1&&(A=0);var x=0,g=0,b=0;return v?A?(x=-A/v,g=1,b=-x*c-u):(g=1,b=-u):A&&(x=-1,b=c),[x,g,b]}function getIntersectionPointsByConstants(a,s){var c=a[0],u=a[1],d=a[2],p=s[0],v=s[1],A=s[2],x=c===0&&p===0,g=u===0&&v===0,b=[];if(x&&g)return[];if(x){var y=-d/u,f=-A/v;return y!==f?[]:[[-1/0,y],[1/0,y]]}else if(g){var m=-d/c,E=-A/p;return m!==E?[]:[[m,-1/0],[m,1/0]]}else if(c===0){var w=-d/u,S=-(v*w+A)/p;b=[[S,w]]}else if(p===0){var w=-A/v,S=-(u*w+d)/c;b=[[S,w]]}else if(u===0){var S=-d/c,w=-(p*S+A)/v;b=[[S,w]]}else if(v===0){var S=-A/p,w=-(c*S+d)/u;b=[[S,w]]}else{var S=(u*A-v*d)/(v*c-u*p),w=-(c*S+d)/u;b=[[S,w]]}return b.map(function($){return[$[0],$[1]]})}function getPointsOnLines(a,s){var c=s.map(function(y){return[0,1].map(function(f){return[Math.min(y[0][f],y[1][f]),Math.max(y[0][f],y[1][f])]})}),u=[];if(a.length===2){var d=a[0],p=d[0],v=d[1];if(tinyThrottle(p-a[1][0])){if(!tinyThrottle(v-a[1][1])){var g=Math.max.apply(Math,c.map(function(y){return y[0][0]})),b=Math.min.apply(Math,c.map(function(y){return y[0][1]}));if(tinyThrottle(g-b)>0)return[];u=[[g,v],[b,v]]}}else{var A=Math.max.apply(Math,c.map(function(y){return y[1][0]})),x=Math.min.apply(Math,c.map(function(y){return y[1][1]}));if(tinyThrottle(A-x)>0)return[];u=[[p,A],[p,x]]}}return u.length||(u=a.filter(function(y){var f=y[0],m=y[1];return c.every(function(E){return 0<=tinyThrottle(f-E[0][0])&&0<=tinyThrottle(E[0][1]-f)&&0<=tinyThrottle(m-E[1][0])&&0<=tinyThrottle(E[1][1]-m)})})),u.map(function(y){return[tinyThrottle(y[0]),tinyThrottle(y[1])]})}function convertLines(a){return __spreadArrays(a.slice(1),[a[0]]).map(function(s,c){return[a[c],s]})}function getOverlapPointInfos(a,s){var c=a.slice(),u=s.slice();getShapeDirection(c)===-1&&c.reverse(),getShapeDirection(u)===-1&&u.reverse();var d=convertLines(c),p=convertLines(u),v=d.map(function(b){return getLinearConstants(b[0],b[1])}),A=p.map(function(b){return getLinearConstants(b[0],b[1])}),x=[];v.forEach(function(b,y){var f=d[y],m=[];A.forEach(function(E,w){var S=getIntersectionPointsByConstants(b,E),$=getPointsOnLines(S,[f,p[w]]);m.push.apply(m,$.map(function(T){return{index1:y,index2:w,pos:T,type:"intersection"}}))}),m.sort(function(E,w){return getDist$2(f[0],E.pos)-getDist$2(f[0],w.pos)}),x.push.apply(x,m),isInside(f[1],u)&&x.push({index1:y,index2:-1,pos:f[1],type:"inside"})}),p.forEach(function(b,y){if(isInside(b[1],c)){var f=!1,m=findIndex(x,function(E){var w=E.index2;return w===y?(f=!0,!1):!!f});m===-1&&(f=!1,m=findIndex(x,function(E){var w=E.index1,S=E.index2;return w===-1&&S+1===y?(f=!0,!1):!!f})),m===-1?x.push({index1:-1,index2:y,pos:b[1],type:"inside"}):x.splice(m,0,{index1:-1,index2:y,pos:b[1],type:"inside"})}});var g={};return x.filter(function(b){var y=b.pos,f=y[0]+"x"+y[1];return g[f]?!1:(g[f]=!0,!0)})}function getOverlapPoints(a,s){var c=getOverlapPointInfos(a,s);return c.map(function(u){var d=u.pos;return d})}function getOverlapSize(a,s){var c=getOverlapPoints(a,s);return getAreaSize(c)}function add(a,s,c,u,d,p){for(var v=0;v<d;++v){var A=c+v*d,x=u+v*d;a[A]+=a[x]*p,s[A]+=s[x]*p}}function swap(a,s,c,u,d){for(var p=0;p<d;++p){var v=c+p*d,A=u+p*d,x=a[v],g=s[v];a[v]=a[A],a[A]=x,s[v]=s[A],s[A]=g}}function divide(a,s,c,u,d){for(var p=0;p<u;++p){var v=c+p*u;a[v]/=d,s[v]/=d}}function ignoreDimension(a,s,c){for(var u=a.slice(),d=0;d<c;++d)u[d*c+s-1]=0,u[(s-1)*c+d]=0;return u[(s-1)*(c+1)]=1,u}function invert(a,s){s===void 0&&(s=Math.sqrt(a.length));for(var c=a.slice(),u=createIdentityMatrix(s),d=0;d<s;++d){var p=s*d+d;if(!throttle(c[p],TINY_NUM$1)){for(var v=d+1;v<s;++v)if(c[s*d+v]){swap(c,u,d,v,s);break}}if(!throttle(c[p],TINY_NUM$1))return[];divide(c,u,d,s,c[p]);for(var v=0;v<s;++v){var A=v,x=v+d*s,g=c[x];!throttle(g,TINY_NUM$1)||d===v||add(c,u,A,d,s,-g)}}return u}function transpose(a,s){s===void 0&&(s=Math.sqrt(a.length));for(var c=[],u=0;u<s;++u)for(var d=0;d<s;++d)c[d*s+u]=a[s*u+d];return c}function getOrigin(a,s){s===void 0&&(s=Math.sqrt(a.length));for(var c=[],u=a[s*s-1],d=0;d<s-1;++d)c[d]=a[s*(s-1)+d]/u;return c[s-1]=0,c}function fromTranslation(a,s){for(var c=createIdentityMatrix(s),u=0;u<s-1;++u)c[s*(s-1)+u]=a[u]||0;return c}function convertPositionMatrix(a,s){for(var c=a.slice(),u=a.length;u<s-1;++u)c[u]=0;return c[s-1]=1,c}function convertDimension(a,s,c){if(s===void 0&&(s=Math.sqrt(a.length)),s===c)return a;for(var u=createIdentityMatrix(c),d=Math.min(s,c),p=0;p<d-1;++p){for(var v=0;v<d-1;++v)u[p*c+v]=a[p*s+v];u[(p+1)*c-1]=a[(p+1)*s-1],u[(c-1)*c+p]=a[(s-1)*s+p]}return u[c*c-1]=a[s*s-1],u}function multiplies(a){for(var s=[],c=1;c<arguments.length;c++)s[c-1]=arguments[c];var u=createIdentityMatrix(a);return s.forEach(function(d){u=multiply(u,d,a)}),u}function multiply(a,s,c){c===void 0&&(c=Math.sqrt(a.length));var u=[],d=a.length/c,p=s.length/d;if(d){if(!p)return a}else return s;for(var v=0;v<c;++v)for(var A=0;A<p;++A){u[A*c+v]=0;for(var x=0;x<d;++x)u[A*c+v]+=a[x*c+v]*s[A*d+x]}return u}function plus(a,s){for(var c=Math.min(a.length,s.length),u=a.slice(),d=0;d<c;++d)u[d]=u[d]+s[d];return u}function minus(a,s){for(var c=Math.min(a.length,s.length),u=a.slice(),d=0;d<c;++d)u[d]=u[d]-s[d];return u}function convertCSStoMatrix(a,s){return s===void 0&&(s=a.length===6),s?[a[0],a[1],0,a[2],a[3],0,a[4],a[5],1]:a}function convertMatrixtoCSS(a,s){return s===void 0&&(s=a.length===9),s?[a[0],a[1],a[3],a[4],a[6],a[7]]:a}function calculate(a,s,c){c===void 0&&(c=s.length);var u=multiply(a,s,c),d=u[c-1];return u.map(function(p){return p/d})}function rotateX3d(a,s){return multiply(a,[1,0,0,0,0,Math.cos(s),Math.sin(s),0,0,-Math.sin(s),Math.cos(s),0,0,0,0,1],4)}function rotateY3d(a,s){return multiply(a,[Math.cos(s),0,-Math.sin(s),0,0,1,0,0,Math.sin(s),0,Math.cos(s),0,0,0,0,1],4)}function rotateZ3d(a,s){return multiply(a,createRotateMatrix(s,4))}function scale3d(a,s){var c=s[0],u=c===void 0?1:c,d=s[1],p=d===void 0?1:d,v=s[2],A=v===void 0?1:v;return multiply(a,[u,0,0,0,0,p,0,0,0,0,A,0,0,0,0,1],4)}function rotate(a,s){return calculate(createRotateMatrix(s,3),convertPositionMatrix(a,3))}function translate3d(a,s){var c=s[0],u=c===void 0?0:c,d=s[1],p=d===void 0?0:d,v=s[2],A=v===void 0?0:v;return multiply(a,[1,0,0,0,0,1,0,0,0,0,1,0,u,p,A,1],4)}function matrix3d(a,s){return multiply(a,s,4)}function createRotateMatrix(a,s){var c=Math.cos(a),u=Math.sin(a),d=createIdentityMatrix(s);return d[0]=c,d[1]=u,d[s]=-u,d[s+1]=c,d}function createIdentityMatrix(a){for(var s=a*a,c=[],u=0;u<s;++u)c[u]=u%(a+1)?0:1;return c}function createScaleMatrix(a,s){for(var c=createIdentityMatrix(s),u=Math.min(a.length,s-1),d=0;d<u;++d)c[(s+1)*d]=a[d];return c}function createOriginMatrix(a,s){for(var c=createIdentityMatrix(s),u=Math.min(a.length,s-1),d=0;d<u;++d)c[s*(s-1)+d]=a[d];return c}function createWarpMatrix(a,s,c,u,d,p,v,A){var x=a[0],g=a[1],b=s[0],y=s[1],f=c[0],m=c[1],E=u[0],w=u[1],S=d[0],$=d[1],T=p[0],I=p[1],_=v[0],C=v[1],P=A[0],O=A[1],L=[x,0,b,0,f,0,E,0,g,0,y,0,m,0,w,0,1,0,1,0,1,0,1,0,0,x,0,b,0,f,0,E,0,g,0,y,0,m,0,w,0,1,0,1,0,1,0,1,-S*x,-$*x,-T*b,-I*b,-_*f,-C*f,-P*E,-O*E,-S*g,-$*g,-T*y,-I*y,-_*m,-C*m,-P*w,-O*w],B=invert(L,8);if(!B.length)return[];var F=multiply(B,[S,$,T,I,_,C,P,O],8);return F[8]=1,convertDimension(transpose(F),3,4)}var __assign$5=function(){return __assign$5=Object.assign||function(s){for(var c,u=1,d=arguments.length;u<d;u++){c=arguments[u];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(s[p]=c[p])}return s},__assign$5.apply(this,arguments)};function createMatrix(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function parseMat(a,s){return s===void 0&&(s=0),toMat(parse(a,s))}function calculateMatrixDist(a,s){var c=calculate(a,[s[0],s[1]||0,s[2]||0,1],4),u=c[3]||1;return[c[0]/u,c[1]/u,c[2]/u]}function getDistElementMatrix(a,s){s===void 0&&(s=document.body);for(var c=a,u=createMatrix();c;){var d=getComputedStyle(c).transform;if(u=matrix3d(parseMat(d),u),c===s)break;c=c.parentElement}return u=invert(u,4),u[12]=0,u[13]=0,u[14]=0,u}function toMat(a){var s=createMatrix();return a.forEach(function(c){var u=c.matrixFunction,d=c.functionValue;u&&(s=u(s,d))}),s}function parse(a,s){s===void 0&&(s=0);var c=isArray(a)?a:splitSpace(a);return c.map(function(u){var d=splitBracket(u),p=d.prefix,v=d.value,A=null,x=p,g="";if(p==="translate"||p==="translateX"||p==="translate3d"){var b=isObject$1(s)?__assign$5(__assign$5({},s),{"o%":s["%"]}):{"%":s,"o%":s},y=splitComma(v).map(function(j,V){return V===0&&"x%"in b?b["%"]=s["x%"]:V===1&&"y%"in b?b["%"]=s["y%"]:b["%"]=s["o%"],convertUnitSize(j,b)}),f=y[0],m=y[1],E=m===void 0?0:m,w=y[2],S=w===void 0?0:w;A=translate3d,g=[f,E,S]}else if(p==="translateY"){var $=isObject$1(s)?__assign$5({"%":s["y%"]},s):{"%":s},E=convertUnitSize(v,$);A=translate3d,g=[0,E,0]}else if(p==="translateZ"){var S=parseFloat(v);A=translate3d,g=[0,0,S]}else if(p==="scale"||p==="scale3d"){var T=splitComma(v).map(function(j){return parseFloat(j)}),I=T[0],_=T[1],C=_===void 0?I:_,P=T[2],O=P===void 0?1:P;A=scale3d,g=[I,C,O]}else if(p==="scaleX"){var I=parseFloat(v);A=scale3d,g=[I,1,1]}else if(p==="scaleY"){var C=parseFloat(v);A=scale3d,g=[1,C,1]}else if(p==="scaleZ"){var O=parseFloat(v);A=scale3d,g=[1,1,O]}else if(p==="rotate"||p==="rotateZ"||p==="rotateX"||p==="rotateY"){var L=splitUnit(v),B=L.unit,F=L.value,D=B==="rad"?F:F*Math.PI/180;p==="rotate"||p==="rotateZ"?(x="rotateZ",A=rotateZ3d):p==="rotateX"?A=rotateX3d:p==="rotateY"&&(A=rotateY3d),g=D}else if(p==="matrix3d")A=matrix3d,g=splitComma(v).map(function(j){return parseFloat(j)});else if(p==="matrix"){var G=splitComma(v).map(function(j){return parseFloat(j)});A=matrix3d,g=[G[0],G[1],0,0,G[2],G[3],0,0,0,0,1,0,G[4],G[5],0,1]}else x="";return{name:p,functionName:x,value:v,matrixFunction:A,functionValue:g}})}function hash(a){for(var s=5381,c=a.length;c;)s=s*33^a.charCodeAt(--c);return s>>>0}var stringHash=hash;function getHash(a){return stringHash(a).toString(36)}function getShadowRoot$1(a){if(a&&a.getRootNode){var s=a.getRootNode();if(s.nodeType===11)return s}}function replaceStyle(a,s,c){return c.original?s:s.replace(/([^};{\s}][^};{]*|^\s*){/mg,function(u,d){var p=d.trim();return(p?splitComma(p):[""]).map(function(v){var A=v.trim();return A.indexOf("@")===0?A:A.indexOf(":global")>-1?A.replace(/\:global/g,""):A.indexOf(":host")>-1?"".concat(A.replace(/\:host/g,".".concat(a))):A?".".concat(a," ").concat(A):".".concat(a)}).join(", ")+" {"})}function injectStyle(a,s,c,u,d){var p=getDocument(u),v=p.createElement("style");return v.setAttribute("type","text/css"),v.setAttribute("data-styled-id",a),v.setAttribute("data-styled-count","1"),c.nonce&&v.setAttribute("nonce",c.nonce),v.innerHTML=replaceStyle(a,s,c),(d||p.head||p.body).appendChild(v),v}function styled$1(a){var s="rCS"+getHash(a);return{className:s,inject:function(c,u){u===void 0&&(u={});var d=getShadowRoot$1(c),p=(d||c.ownerDocument||document).querySelector('style[data-styled-id="'.concat(s,'"]'));if(!p)p=injectStyle(s,a,u,c,d);else{var v=parseFloat(p.getAttribute("data-styled-count"))||0;p.setAttribute("data-styled-count","".concat(v+1))}return{destroy:function(){var A,x=parseFloat(p.getAttribute("data-styled-count"))||0;x<=1?(p.remove?p.remove():(A=p.parentNode)===null||A===void 0||A.removeChild(p),p=null):p.setAttribute("data-styled-count","".concat(x-1))}}}}}var extendStatics$4=function(a,s){return extendStatics$4=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,u){c.__proto__=u}||function(c,u){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(c[d]=u[d])},extendStatics$4(a,s)};function __extends$4(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");extendStatics$4(a,s);function c(){this.constructor=a}a.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}var __assign$4=function(){return __assign$4=Object.assign||function(s){for(var c,u=1,d=arguments.length;u<d;u++){c=arguments[u];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(s[p]=c[p])}return s},__assign$4.apply(this,arguments)};function __rest$2(a,s){var c={};for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&s.indexOf(u)<0&&(c[u]=a[u]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,u=Object.getOwnPropertySymbols(a);d<u.length;d++)s.indexOf(u[d])<0&&Object.prototype.propertyIsEnumerable.call(a,u[d])&&(c[u[d]]=a[u[d]]);return c}function __decorate$2(a,s,c,u){var d=arguments.length,p=d<3?s:u===null?u=Object.getOwnPropertyDescriptor(s,c):u,v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(a,s,c,u);else for(var A=a.length-1;A>=0;A--)(v=a[A])&&(p=(d<3?v(p):d>3?v(s,c,p):v(s,c))||p);return d>3&&p&&Object.defineProperty(s,c,p),p}function __spreadArray$2(a,s,c){for(var u=0,d=s.length,p;u<d;u++)(p||!(u in s))&&(p||(p=Array.prototype.slice.call(s,0,u)),p[u]=s[u]);return a.concat(p||Array.prototype.slice.call(s))}function getClient(a){if("touches"in a){var s=a.touches[0]||a.changedTouches[0];return{clientX:s.clientX,clientY:s.clientY}}else return{clientX:a.clientX,clientY:a.clientY}}function filterDuplicated(a){if(typeof Map>"u")return a.filter(function(c,u){return a.indexOf(c)===u});var s=new Map;return a.filter(function(c){return s.has(c)?!1:(s.set(c,!0),!0)})}function elementFromPoint(a,s,c){var u=getDocument(a);return u.elementFromPoint&&u.elementFromPoint(s,c)||null}function createElement(a,s,c){var u=a.tag,d=a.children,p=a.attributes,v=a.className,A=a.style,x=s||getDocument(c).createElement(u);for(var g in p)x.setAttribute(g,p[g]);var b=x.children;if(d.forEach(function(f,m){createElement(f,b[m],x)}),v&&v.split(/\s+/g).forEach(function(f){f&&!hasClass(x,f)&&addClass(x,f)}),A){var y=x.style;for(var g in A)y[g]=A[g]}return!s&&c&&c.appendChild(x),x}function h(a,s){for(var c=[],u=2;u<arguments.length;u++)c[u-2]=arguments[u];var d=s||{},p=d.className,v=p===void 0?"":p,A=d.style,x=A===void 0?{}:A,g=__rest$2(d,["className","style"]);return{tag:a,className:v,style:x,attributes:g,children:c}}function diffValue(a,s,c){a!==s&&c(a,s)}function getRect$1(a,s,c){var u;c===void 0&&(c=a.data.boundArea);var d=a.distX,p=d===void 0?0:d,v=a.distY,A=v===void 0?0:v,x=a.data,g=x.startX,b=x.startY;if(s>0){var y=Math.sqrt((p*p+A*A)/(1+s*s)),f=s*y;p=(p>=0?1:-1)*f,A=(A>=0?1:-1)*y}var m=Math.abs(p),E=Math.abs(A),w=p<0?g-c.left:c.right-g,S=A<0?b-c.top:c.bottom-b;u=calculateBoundSize([m,E],[0,0],[w,S],!!s),m=u[0],E=u[1],p=(p>=0?1:-1)*m,A=(A>=0?1:-1)*E;var $=Math.min(0,p),T=Math.min(0,A),I=g+$,_=b+T;return{left:I,top:_,right:I+m,bottom:_+E,width:m,height:E}}function getDefaultElementRect(a){var s=a.getBoundingClientRect(),c=s.left,u=s.top,d=s.width,p=s.height;return{pos1:[c,u],pos2:[c+d,u],pos3:[c,u+p],pos4:[c+d,u+p]}}function passTargets(a,s,c){var u=diff(a,s),d=u.list,p=u.prevList,v=u.added,A=u.removed,x=u.maintained;return __spreadArray$2(__spreadArray$2(__spreadArray$2([],v.map(function(g){return d[g]}),!0),A.map(function(g){return p[g]}),!0),c?x.map(function(g){var b=g[1];return d[b]}):[])}function getLineSize(a){for(var s=0,c=a.length,u=1;u<c;++u)s=Math.max(getDist$2(a[u],a[u-1]),s);return s}var injector=styled$1(`
641
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _unsupportedIterableToArray(a,s){if(a){if(typeof a=="string")return _arrayLikeToArray(a,s);var c={}.toString.call(a).slice(8,-1);return c==="Object"&&a.constructor&&(c=a.constructor.name),c==="Map"||c==="Set"?Array.from(a):c==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c)?_arrayLikeToArray(a,s):void 0}}function _arrayLikeToArray(a,s){(s==null||s>a.length)&&(s=a.length);for(var c=0,u=Array(s);c<s;c++)u[c]=a[c];return u}function _iterableToArrayLimit(a,s){var c=a==null?null:typeof Symbol<"u"&&a[Symbol.iterator]||a["@@iterator"];if(c!=null){var u,d,p,v,A=[],x=!0,g=!1;try{if(p=(c=c.call(a)).next,s!==0)for(;!(x=(u=p.call(c)).done)&&(A.push(u.value),A.length!==s);x=!0);}catch(b){g=!0,d=b}finally{try{if(!x&&c.return!=null&&(v=c.return(),Object(v)!==v))return}finally{if(g)throw d}}return A}}function _arrayWithHoles(a){if(Array.isArray(a))return a}var updateSchemaByPath=function a(s,c,u){var d=getSchemaFullPath(s,u),p=_get(u,d,{}),v=isFunction$1(c)?c(p):c,A=Object.assign(Object.assign({},p),v);v.props&&(A.props=Object.assign(Object.assign({},p?.props),v.props)),_set(u,d,A)},getFieldName=function a(s){if(s){if(typeof s=="boolean")return s;var c=[];return isArray$1(s)&&(c=s.map(function(u){return u.split(".").map(function(d){return isNaN(Number(d))?d:d*1})})),c=s.split(".").map(function(u){return isNaN(Number(u))?u:u*1}),c=c.map(function(u){return typeof u=="string"&&u?.indexOf("[")===0&&u?.indexOf("]")===u?.length-1?Number(u.substring(1,u.length-1)):u}),c}},useForm=function a(){var s=Form$1.useForm(),c=_slicedToArray(s,1),u=c[0],d=reactExports.useRef({}),p=reactExports.useRef(null),v=reactExports.useRef({}),A=reactExports.useRef({});u.getFieldError;var x=u.getFieldsError,g=u.getFieldInstance,b=u.setFieldsValue,y=u.setFields,f=u.scrollToField,m=u.isFieldsTouched,E=u.isFieldTouched,w=u.isFieldValidating,S=u.resetFields,$=u.validateFields,T=__rest$16(u,["getFieldError","getFieldsError","getFieldInstance","setFieldsValue","setFields","scrollToField","isFieldsTouched","isFieldTouched","isFieldValidating","resetFields","validateFields"]),I=T,_=function(O){var L=p.current.setState;L||setTimeout(function(){L({schema:v.current,flattenSchema:d.current})},0),L(O)},C=function(O){d.current=flattenSchema(O)||{},v.current=O,_({schema:O,flattenSchema:d.current})};return I.setSchema=function(P){var O=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(isObject$2(P)){if(O){C(P);return}var L=cloneDeep(v.current);Object.keys(P||{}).forEach(function(B){updateSchemaByPath(B,P[B],L)}),C(L)}},I.setSchemaByPath=function(P,O){if(!(!_hasFuncProperty(O)&&_isMatch(O,I.getSchemaByPath(P)))){var L=cloneDeep(v.current);updateSchemaByPath(P,O,L),C(L)}},I.setValues=function(P){var O=parseBindToValues(P,d.current);b(O)},I.getValues=function(P,O,L){var B=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,F,D=cloneDeep(u.getFieldsValue(getFieldName(P),O)),G=((F=p.current)===null||F===void 0?void 0:F.getState())||{},j=G.removeHiddenData;return B&&j&&(D=filterValuesHidden(D,d.current)),L||(D=filterValuesUndefined(D)),parseValuesToBind(D,d.current)},I.getValueByPath=function(P){var O=getFieldName(P);return u.getFieldValue(O)},I.setValueByPath=function(P,O){if(!u.setFieldValue){var L=u.getFieldsValue();_set(L,P,O),I.setValues(L);return}var B=getFieldName(P);u.setFieldValue(B,O);try{JSON.stringify(u.getFieldValue(B))!==JSON.stringify(O)&&u.setFieldValue(B,O)}catch{}},I.getSchemaByPath=function(P){typeof P!="string"&&console.warn("请输入正确的路径");var O=getSchemaFullPath(P,v.current);return _get(v.current,O)},I.getSchema=function(){return v.current},I.setErrorFields=function(P){var O=transformFieldsData(P,getFieldName);O&&y(O)},I.removeErrorField=function(P){y([{name:getFieldName(P),errors:[]}])},I.getFieldError=function(P){var O=getFieldName(P);return u.getFieldError(O)},I.getFieldsError=function(P){var O=getFieldName(P);return x(O)},I.getFieldInstance=function(P){var O=getFieldName(P);return g(O)},I.getHiddenValues=function(){var P=I.getValues(),O=I.getValues(!0),L={},B=function(D,G,j){Object.keys(D).forEach(function(V){var U=D[V],M=j?"".concat(j,".").concat(V):V;if(!G.hasOwnProperty(V)){_set(L,M,U);return}isObject$2(U)&&B(U,G[V],M),isArray$1(U)&&U.map(function(N,R){B(N,_get(G,"".concat(V,"[").concat(R,"]"),[]),"".concat(M,"[").concat(R,"]"))})})};return B(O,P,null),L},I.setFields=function(P){var O=transformFieldsData(P,getFieldName);O&&y(O)},I.__initStore=function(P){p.current=P},I.scrollToPath=function(P){for(var O=getFieldName(P),L=arguments.length,B=new Array(L>1?L-1:0),F=1;F<L;F++)B[F-1]=arguments[F];f.apply(void 0,[O].concat(B))},I.isFieldsTouched=function(P,O){var L=(P||[]).map(function(B){return getFieldName(B)});return m(L,O)},I.isFieldTouched=function(P){var O=getFieldName(P);return E(O)},I.isFieldValidating=function(P){var O=getFieldName(P);return w(O)},I.resetFields=function(P){var O=(P||[]).map(function(L){return getFieldName(L)});O.length>0?S(O):S()},I.validateFields=function(P,O){var L=(P||[]).map(function(B){return getFieldName(B)});return L.length>0?$(L,O):$()},I.getFlattenSchema=function(P){var O;return P?(O=d.current)===null||O===void 0?void 0:O[P]:d.current},I.onItemChange=I.setValueByPath,I.setFieldRef=function(P,O){P&&(A.current[P]=O)},I.getFieldRef=function(P){return A.current[P]},I};const FormRenderComponent=withProvider(FormCore,defaultWidgets),AlignWidget=a=>{const{activeElements:s,changeSchemas:c,schemas:u,pageSize:d,schema:p}=a,v=g=>{const b=s.map(C=>C.id),y=u.filter(C=>b.includes(C.id)),f=["left","center","right"].includes(g),m=f?"x":"y",E=f?"width":"height",w=y.length===1,S=d&&typeof d=="object"?E==="width"?d.width:d.height:0,$=w?0:Math.min(...y.map(C=>{const P=C.position&&typeof C.position=="object"?C.position:{x:0,y:0};return m==="x"?P.x:P.y})),T=w?S:Math.max(...y.map(C=>{const P=C.position&&typeof C.position=="object"?C.position:{x:0,y:0},O=m==="x"?P.x:P.y,L=C,B=E==="width"?L.width||0:L.height||0;return O+B}));let I=$,_=C=>0;["center","middle"].includes(g)?(I=($+T)/2,_=C=>C/2):["right","bottom"].includes(g)&&(I=T,_=C=>C),c(y.map(C=>{const P=C,O=E==="width"?P.width||0:P.height||0;return{key:`position.${m}`,value:round$1(I-_(O),2),schemaId:P.id}}))},A=g=>{const b=s.map(O=>O.id),y=u.filter(O=>b.includes(O.id)),f=g==="vertical",m=f?"y":"x",E=f?"height":"width",w=Math.min(...y.map(O=>{const L=O.position&&typeof O.position=="object"?O.position:{x:0,y:0};return m==="x"?L.x:L.y})),S=Math.max(...y.map(O=>{const L=O.position&&typeof O.position=="object"?O.position:{x:0,y:0},B=m==="x"?L.x:L.y,F=O,D=E==="width"?F.width||0:F.height||0;return B+D}));if(y.length<3)return;const $=w,T=S-w,I=y.reduce((O,L)=>{const B=L,F=E==="width"?B.width||0:B.height||0;return O+F},0),C=(T-I)/(y.length-1);let P=0;c(y.map((O,L)=>{const B=L===0?0:(()=>{const G=y[L-1];return E==="width"?G.width||0:G.height||0})();P+=L===0?0:B+C;const F=round$1($+P,2),D=O;return{key:`position.${m}`,value:F,schemaId:D.id}}))},x=[{id:"left",icon:jsxRuntimeExports.jsx(AlignStartVertical,{size:15}),onClick:()=>v("left")},{id:"center",icon:jsxRuntimeExports.jsx(AlignCenterVertical,{size:15}),onClick:()=>v("center")},{id:"right",icon:jsxRuntimeExports.jsx(AlignEndVertical,{size:15}),onClick:()=>v("right")},{id:"top",icon:jsxRuntimeExports.jsx(AlignStartHorizontal,{size:15}),onClick:()=>v("top")},{id:"middle",icon:jsxRuntimeExports.jsx(AlignCenterHorizontal,{size:15}),onClick:()=>v("middle")},{id:"bottom",icon:jsxRuntimeExports.jsx(AlignEndHorizontal,{size:15}),onClick:()=>v("bottom")},{id:"vertical",icon:jsxRuntimeExports.jsx(AlignVerticalSpaceAround,{size:15}),onClick:()=>A("vertical")},{id:"horizontal",icon:jsxRuntimeExports.jsx(AlignHorizontalSpaceAround,{size:15}),onClick:()=>A("horizontal")}];return jsxRuntimeExports.jsx(Form$1.Item,{label:p.title,children:jsxRuntimeExports.jsx(Space.Compact,{children:x.map(g=>jsxRuntimeExports.jsx(Button$1,{className:DESIGNER_CLASSNAME+"align-"+g.id,style:{padding:7},disabled:s.length<=2&&["vertical","horizontal"].includes(g.id),...g},g.id))})})},WidgetRenderer=a=>{const{widget:s,...c}=a,u=reactExports.useRef(null);return reactExports.useEffect(()=>(u.current&&(u.current.innerHTML="",s({...c,rootElement:u.current})),()=>{u.current&&(u.current.innerHTML="")}),[a.activeSchema]),jsxRuntimeExports.jsx("div",{ref:u})},ButtonGroupWidget=a=>{const{activeElements:s,changeSchemas:c,schemas:u,schema:d}=a,{token:p}=theme.useToken(),v=b=>{const y=b.key,f=b.type,m=s.map(w=>w.id),E=u.filter(w=>m.includes(w.id));c(E.map(w=>{const S=!!(w[y]??!1),$=f==="boolean"?!S:b.value;return{key:y,value:$,schemaId:w.id}}))},A=b=>{const y=b.key,f=b.type;let m=!1;const E=s.map(S=>S.id);return u.filter(S=>E.includes(S.id)).forEach(S=>{const $=S;m=f==="boolean"?!!($[y]??!1):$[y]===b.value}),m},x=(b,y)=>y?b.replace(/="currentColor"/g,`="${y}"`):b,g=b=>{const y=`data:image/svg+xml;utf8,${encodeURIComponent(x(b,p.colorText))}`;return jsxRuntimeExports.jsx("img",{width:17,height:17,src:y,alt:""})};return jsxRuntimeExports.jsx(Form$1.Item,{children:jsxRuntimeExports.jsx(Space.Compact,{children:d.buttons.map((b,y)=>{const f=A(b);return jsxRuntimeExports.jsx(Button$1,{type:f?"primary":void 0,ghost:f,onClick:()=>v(b),style:{padding:7,zIndex:f?2:0},icon:g(b.icon)},y)})})})},{Text:Text$2}=Typography,DetailView$1=a=>{const{token:s}=theme.useToken(),{size:c,schemasList:u,changeSchemas:d,deselectSchema:p,activeSchema:v,pageSize:A,basePdf:x}=a,g=useForm(),b=reactExports.useContext(I18nContext),y=reactExports.useContext(PluginsRegistry),f=reactExports.useContext(OptionsContext),m=N=>typeof b=="function"?b(N):N,[E,w]=reactExports.useState({});reactExports.useEffect(()=>{const N={AlignWidget:R=>jsxRuntimeExports.jsx(AlignWidget,{...R,...a,options:f}),Divider:()=>jsxRuntimeExports.jsx(Divider,{style:{marginTop:s.marginXS,marginBottom:s.marginXS}}),ButtonGroup:R=>jsxRuntimeExports.jsx(ButtonGroupWidget,{...R,...a,options:f})};for(const R of y.values()){const k=R.propPanel.widgets||{};Object.entries(k).forEach(([H,W])=>{N[H]=Z=>jsxRuntimeExports.jsx(WidgetRenderer,{...Z,...a,options:f,theme:s,i18n:m,widget:W})})}w(N)},[v,y,JSON.stringify(f)]),reactExports.useEffect(()=>{const N={...v},R=typeof N.readOnly=="boolean"?N.readOnly:!1;N.editable=!R,g.setValues(N)},[v,g]),reactExports.useEffect(()=>g.resetFields(),[v.id]),reactExports.useEffect(()=>{S.current=N=>{for(const R of u)for(const k of Object.values(R))if(k.name===N&&k.id!==v.id)return!1;return!0}},[u,v]);const S=reactExports.useRef(N=>!0),$=(N,R)=>S.current(R),[T,I,_,C]=isBlankPdf(x)?x.padding:[0,0,0,0],P=(N,R,k)=>{const H=g.getValues(),W=H.position,Z=H.width,te=H.height;if(!W||Z===void 0||te===void 0)return!0;if(k==="x"){if(R<C||R>A.width-I)return!0;if(Z>0&&R+Z>A.width-I)return!1}else if(k==="y"){if(R<T||R>A.height-_)return!0;if(te>0&&R+te>A.height-_)return!1}else if(k==="width"){if(W.x<C||W.x>A.width-I)return!0;if(R>0&&W.x+R>A.width-I)return!1}else if(k==="height"){if(W.y<T||W.y>A.height-_)return!0;if(R>0&&W.y+R>A.height-_)return!1}return!0},O=debounce$1(function(...N){const R=N[0],k=(W,Z)=>typeof W=="object"&&W!==null?JSON.stringify(W)!==JSON.stringify(Z):W!==Z;let H=[];for(const W in R){if(["id","content"].includes(W))continue;let Z=R[W];if(k(Z,v[W])){if(Z===null&&["rotate","opacity"].includes(W)&&(Z=void 0),W==="editable"){const te=!Z;H.push({key:"readOnly",value:te,schemaId:v.id}),te&&H.push({key:"required",value:!1,schemaId:v.id});continue}H.push({key:W,value:Z,schemaId:v.id})}}H.length&&g.validateFields().then(()=>d(H)).catch(W=>{W.errorFields.length&&(H=H.filter(Z=>!W.errorFields.find(te=>te.name.includes(Z.key)))),H.length&&d(H)})},100),L=y.findByType(v.type);if(!L)throw Error(`[@pdfme/ui] Failed to find plugin used for ${v.type}`);const B=L.propPanel.schema,F=[];y.entries().forEach(([N,R])=>{F.push({label:N,value:R.propPanel.defaultSchema?.type??void 0})});const D={},G=L?.propPanel?.defaultSchema?(()=>{const N={};for(const R in L.propPanel.defaultSchema)Object.prototype.hasOwnProperty.call(L.propPanel.defaultSchema,R)&&(N[R]=L.propPanel.defaultSchema[R]);return N})():D,j=A.width-C-I,V=A.height-T-_,U={type:"object",column:2,properties:{type:{title:m("type"),type:"string",widget:"select",props:{options:F},required:!0,span:12},name:{title:m("fieldName"),type:"string",required:!0,span:12,rules:[{validator:$,message:m("validation.uniqueName")}],props:{autoComplete:"off"}},editable:{title:m("editable"),type:"boolean",span:8,hidden:typeof G.readOnly<"u"},required:{title:m("required"),type:"boolean",span:16,hidden:"{{!formData.editable}}"},"-":{type:"void",widget:"Divider"},align:{title:m("align"),type:"void",widget:"AlignWidget"},position:{type:"object",widget:"card",properties:{x:{title:"X",type:"number",widget:"inputNumber",required:!0,span:8,min:C,max:A.width-I,rules:[{validator:(N,R)=>P(N,R,"x"),message:m("validation.outOfBounds")}]},y:{title:"Y",type:"number",widget:"inputNumber",required:!0,span:8,min:T,max:A.height-_,rules:[{validator:(N,R)=>P(N,R,"y"),message:m("validation.outOfBounds")}]}}},width:{title:m("width"),type:"number",widget:"inputNumber",required:!0,span:6,props:{min:0,max:j},rules:[{validator:(N,R)=>P(N,R,"width"),message:m("validation.outOfBounds")}]},height:{title:m("height"),type:"number",widget:"inputNumber",required:!0,span:6,props:{min:0,max:V},rules:[{validator:(N,R)=>P(N,R,"height"),message:m("validation.outOfBounds")}]},rotate:{title:m("rotate"),type:"number",widget:"inputNumber",disabled:typeof G.rotate>"u",max:360,props:{min:0},span:6},opacity:{title:m("opacity"),type:"number",widget:"inputNumber",disabled:typeof G.opacity>"u",props:{step:.1,min:0,max:1},span:6}}},M={...U.properties};if(typeof B=="function"){const{size:N,schemas:R,pageSize:k,changeSchemas:H,activeElements:W,deselectSchema:Z,activeSchema:te}=a,q=B({...{size:N,schemas:R,pageSize:k,changeSchemas:H,activeElements:W,deselectSchema:Z,activeSchema:te},options:f,theme:s,i18n:m}),Q=q&&typeof q=="object"?q:{},ee=Object.keys(Q).length===0?{}:{"--":{type:"void",widget:"Divider"}};U.properties={...M,...ee,...Q}}else{const N=B&&typeof B=="object"?B:{},R=Object.keys(N).length===0?{}:{"--":{type:"void",widget:"Divider"}};U.properties={...M,...R,...N}}return jsxRuntimeExports.jsxs("div",{className:DESIGNER_CLASSNAME+"detail-view",children:[jsxRuntimeExports.jsxs("div",{style:{height:40,display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button$1,{className:DESIGNER_CLASSNAME+"back-button",style:{position:"absolute",zIndex:100,display:"flex",alignItems:"center",justifyContent:"center"},onClick:p,icon:jsxRuntimeExports.jsx(Menu,{strokeWidth:1.5,size:20})}),jsxRuntimeExports.jsx(Text$2,{strong:!0,style:{textAlign:"center",width:"100%"},children:m("editField")})]}),jsxRuntimeExports.jsx(Divider,{style:{marginTop:s.marginXS,marginBottom:s.marginXS}}),jsxRuntimeExports.jsx("div",{style:{height:getSidebarContentHeight(c.height),overflowY:"auto",overflowX:"hidden"},children:jsxRuntimeExports.jsx(FormRenderComponent,{form:g,schema:U,widgets:E,watch:{"#":O},locale:"en-US"})})]})},propsAreUnchanged=(a,s)=>JSON.stringify(a.activeSchema)==JSON.stringify(s.activeSchema),DetailView=React.memo(DetailView$1,propsAreUnchanged),Sidebar=a=>{const{sidebarOpen:s,setSidebarOpen:c,activeElements:u,schemas:d}=a,{token:p}=theme.useToken(),v=()=>d.filter(g=>u.map(b=>b.id).includes(g.id)),A=()=>{const g=v();return g[g.length-1]},x={strokeWidth:1.5,size:20};return jsxRuntimeExports.jsx("div",{className:DESIGNER_CLASSNAME+"right-sidebar",style:{position:"absolute",right:0,zIndex:1,height:"100%",width:s?RIGHT_SIDEBAR_WIDTH:0},children:jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Button$1,{className:DESIGNER_CLASSNAME+"sidebar-toggle",style:{position:"absolute",display:"flex",alignItems:"center",justifyContent:"center",top:"1rem",right:"1rem",zIndex:100},icon:s?jsxRuntimeExports.jsx(ArrowRight,{...x}):jsxRuntimeExports.jsx(ArrowLeft,{...x}),onClick:()=>c(!s)}),jsxRuntimeExports.jsx("div",{style:{width:RIGHT_SIDEBAR_WIDTH,height:"100%",display:s?"block":"none",top:0,right:0,position:"absolute",padding:"0.7rem 1rem",overflowY:"auto",fontFamily:"'Open Sans', sans-serif",boxSizing:"border-box",background:p.colorBgLayout},children:jsxRuntimeExports.jsx("div",{children:v().length===0?jsxRuntimeExports.jsx(ListView,{...a}):jsxRuntimeExports.jsx(DetailView,{...a,activeSchema:A()})})})]})})},useRerenderDependencies=a=>{const{plugin:s,value:c,mode:u,scale:d,schema:p,options:v}=a,A=cloneDeep$1(v);A.font&&Object.values(A.font).forEach(g=>{g.data="..."});const x=JSON.stringify(A);return reactExports.useMemo(()=>s?.uninterruptedEditMode&&u==="designer"?[u]:[c,u,d,JSON.stringify(p),x],[c,u,d,p,x,s])},Wrapper=({children:a,outline:s,onChangeHoveringSchemaId:c,schema:u,selectable:d=!0})=>jsxRuntimeExports.jsxs("div",{title:u.name,onMouseEnter:()=>c&&c(u.id),onMouseLeave:()=>c&&c(null),className:d?SELECTABLE_CLASSNAME:"",id:u.id,style:{position:"absolute",cursor:u.readOnly?"initial":"pointer",height:u.height*ZOOM,width:u.width*ZOOM,top:u.position.y*ZOOM,left:u.position.x*ZOOM,transform:`rotate(${u.rotate??0}deg)`,opacity:u.opacity??1,outline:s},children:[u.required&&jsxRuntimeExports.jsx("span",{style:{color:"red",position:"absolute",top:-12,left:-12,fontSize:18,fontWeight:700},children:"*"}),a]}),Renderer=a=>{const{schema:s,basePdf:c,value:u,mode:d,onChange:p,stopEditing:v,tabIndex:A,placeholder:x,scale:g}=a,b=reactExports.useContext(PluginsRegistry),y=reactExports.useContext(OptionsContext),f=reactExports.useContext(I18nContext),{token:m}=theme.useToken(),E=reactExports.useRef(null),w=reactExports.useContext(CacheContext),S=b.findByType(s.type),$=useRerenderDependencies({plugin:S,value:u,mode:d,scale:g,schema:s,options:y});return reactExports.useEffect(()=>{if(!S?.ui||!E.current||!s.type)return;E.current.innerHTML="";const T=S.ui;return T({value:u,schema:s,basePdf:c,rootElement:E.current,mode:d,onChange:p,stopEditing:v,tabIndex:A,placeholder:x,options:y,theme:m,i18n:f,scale:g,_cache:w}),()=>{E.current&&(E.current.innerHTML="")}},$),S?jsxRuntimeExports.jsx(Wrapper,{...a,children:jsxRuntimeExports.jsx("div",{style:{height:"100%",width:"100%"},ref:E})}):(console.error(`[@pdfme/ui] Renderer for type ${s.type} not found.
642
+ Check this document: https://pdfme.com/docs/custom-schemas`),jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}))},Draggable$1=a=>{const{scale:s,basePdf:c,plugin:u}=a,{token:d}=theme.useToken(),p=reactExports.useContext(OptionsContext),v=u.propPanel.defaultSchema;if(p.font){const w=getFallbackFontName(p.font);setFontNameRecursively(v,w)}const A=useDraggable({id:v.type,data:v}),{listeners:x,setNodeRef:g,attributes:b,transform:y,isDragging:f}=A,m={transform:CSS$1.Translate.toString(y)},E=React.useMemo(()=>jsxRuntimeExports.jsx("div",{style:{transform:`scale(${s})`},children:jsxRuntimeExports.jsx(Renderer,{schema:{...v,id:v.type},basePdf:c,value:v.content||"",onChangeHoveringSchemaId:()=>{},mode:"viewer",outline:`1px solid ${d.colorPrimary}`,scale:s})}),[v,c,s,d.colorPrimary]);return jsxRuntimeExports.jsxs("div",{ref:g,style:m,...x,...b,children:[f&&E,jsxRuntimeExports.jsx("div",{style:{visibility:f?"hidden":"visible"},children:a.children})]})},LeftSidebar=({height:a,scale:s,basePdf:c})=>{const{token:u}=theme.useToken(),d=reactExports.useContext(PluginsRegistry),[p,v]=reactExports.useState(!1);return reactExports.useEffect(()=>{const A=()=>{p&&v(!1)};return document.addEventListener("mouseup",A),()=>{document.removeEventListener("mouseup",A)}},[p]),jsxRuntimeExports.jsx("div",{className:DESIGNER_CLASSNAME+"left-sidebar",style:{left:0,right:0,position:"absolute",zIndex:1,height:a,width:LEFT_SIDEBAR_WIDTH,background:u.colorBgLayout,textAlign:"center",overflow:p?"visible":"auto"},children:d.entries().map(([A,x])=>{if(!x?.propPanel.defaultSchema)return null;const g=x.propPanel.defaultSchema.type;return jsxRuntimeExports.jsx(Draggable$1,{scale:s,basePdf:c,plugin:x,children:jsxRuntimeExports.jsx(Button$1,{className:DESIGNER_CLASSNAME+"plugin-"+g,onMouseDown:()=>v(!0),style:{width:35,height:35,marginTop:"0.25rem",padding:"0.25rem"},children:jsxRuntimeExports.jsx(PluginIcon,{plugin:x,label:A})})},A)})})},Paper=a=>{const{paperRefs:s,scale:c,size:u,schemasList:d,pageSizes:p,backgrounds:v,renderPaper:A,renderSchema:x,hasRulers:g}=a,b=reactExports.useContext(FontContext),y=g?RULER_HEIGHT:0;return p.length!==v.length||p.length!==d.length?null:jsxRuntimeExports.jsx("div",{style:{transform:`scale(${c})`,transformOrigin:"top left",height:c,width:c},children:v.map((f,m)=>{const E=p[m],w={width:E.width*ZOOM,height:E.height*ZOOM},S=w.width*c+y<u.width?`${(u.width/c-w.width)/2}px`:`${y}px`;let $=m>0?(y+PAGE_GAP)*(m+1):y;return g||($+=PAGE_GAP*2),jsxRuntimeExports.jsxs("div",{ref:T=>{T&&(s.current[m]=T)},onMouseDown:T=>{T.currentTarget===T.target&&document&&document.hasFocus()&&document.activeElement instanceof HTMLElement&&document.activeElement.blur()},style:{fontFamily:`'${getFallbackFontName(b)}'`,top:`${$}px`,left:S,position:"relative",backgroundImage:`url(${f})`,backgroundSize:`${w.width}px ${w.height}px`,...w},children:[A({paperSize:w,index:m}),d[m].map((T,I)=>jsxRuntimeExports.jsx("div",{children:x({schema:T,index:m===0?I:I+d[m-1].length})},T.id))]},String(m)+JSON.stringify(w))})})};var FUNCTION="function",OBJECT="object",STRING="string",NUMBER="number",UNDEFINED="undefined",IS_WINDOW=typeof window!==UNDEFINED,doc=typeof document!==UNDEFINED&&document,OPEN_CLOSED_CHARACTERS=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],TINY_NUM$1=1e-7,DEFAULT_UNIT_PRESETS={cm:function(a){return a*96/2.54},mm:function(a){return a*96/254},in:function(a){return a*96},pt:function(a){return a*96/72},pc:function(a){return a*96/6},"%":function(a,s){return a*s/100},vw:function(a,s){return s===void 0&&(s=window.innerWidth),a/100*s},vh:function(a,s){return s===void 0&&(s=window.innerHeight),a/100*s},vmax:function(a,s){return s===void 0&&(s=Math.max(window.innerWidth,window.innerHeight)),a/100*s},vmin:function(a,s){return s===void 0&&(s=Math.min(window.innerWidth,window.innerHeight)),a/100*s}};function __spreadArrays$2(){for(var a=0,s=0,c=arguments.length;s<c;s++)a+=arguments[s].length;for(var u=Array(a),d=0,s=0;s<c;s++)for(var p=arguments[s],v=0,A=p.length;v<A;v++,d++)u[d]=p[v];return u}function dot(a,s,c,u){return(a*u+s*c)/(c+u)}function isUndefined(a){return typeof a===UNDEFINED}function isObject$1(a){return a&&typeof a===OBJECT}function isArray(a){return Array.isArray(a)}function isString(a){return typeof a===STRING}function isNumber(a){return typeof a===NUMBER}function isFunction(a){return typeof a===FUNCTION}function isEqualSeparator(a,s){var c=a===""||a==" ",u=s===""||s==" ";return u&&c||a===s}function findOpen(a,s,c,u,d){var p=findIgnore(a,s,c);return p?c:findClose(a,s,c+1,u,d)}function findIgnore(a,s,c){if(!a.ignore)return null;var u=s.slice(Math.max(c-3,0),c+3).join("");return new RegExp(a.ignore).exec(u)}function findClose(a,s,c,u,d){for(var p=function(g){var b=s[g].trim();if(b===a.close&&!findIgnore(a,s,g))return{value:g};var y=g,f=find$1(d,function(m){var E=m.open;return E===b});if(f&&(y=findOpen(f,s,g,u,d)),y===-1)return v=g,"break";g=y,v=g},v,A=c;A<u;++A){var x=p(A);if(A=v,typeof x=="object")return x.value;if(x==="break")break}return-1}function splitText(a,s){var c=isString(s)?{separator:s}:s,u=c.separator,d=u===void 0?",":u,p=c.isSeparateFirst,v=c.isSeparateOnlyOpenClose,A=c.isSeparateOpenClose,x=A===void 0?v:A,g=c.openCloseCharacters,b=g===void 0?OPEN_CLOSED_CHARACTERS:g,y=b.map(function(O){var L=O.open,B=O.close;return L===B?L:L+"|"+B}).join("|"),f="(\\s*"+d+"\\s*|"+y+"|\\s+)",m=new RegExp(f,"g"),E=a.split(m).filter(function(O){return O&&O!=="undefined"}),w=E.length,S=[],$=[];function T(){return $.length?(S.push($.join("")),$=[],!0):!1}for(var I=function(O){var L=E[O].trim(),B=O,F=find$1(b,function(j){var V=j.open;return V===L}),D=find$1(b,function(j){var V=j.close;return V===L});if(F){if(B=findOpen(F,E,O,w,b),B!==-1&&x)return T()&&p||(S.push(E.slice(O,B+1).join("")),O=B,p)?(_=O,"break"):(_=O,"continue")}else if(D&&!findIgnore(D,E,O)){var G=__spreadArrays$2(b);return G.splice(b.indexOf(D),1),{value:splitText(a,{separator:d,isSeparateFirst:p,isSeparateOnlyOpenClose:v,isSeparateOpenClose:x,openCloseCharacters:G})}}else if(isEqualSeparator(L,d)&&!v)return T(),p?(_=O,"break"):(_=O,"continue");B===-1&&(B=w-1),$.push(E.slice(O,B+1).join("")),O=B,_=O},_,C=0;C<w;++C){var P=I(C);if(C=_,typeof P=="object")return P.value;if(P==="break")break}return $.length&&S.push($.join("")),S}function splitSpace(a){return splitText(a,"")}function splitComma(a){return splitText(a,",")}function splitBracket(a){var s=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(a);return!s||s.length<4?{}:{prefix:s[1],value:s[2],suffix:s[3]}}function splitUnit(a){var s=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(a);if(!s)return{prefix:"",unit:"",value:NaN};var c=s[1],u=s[2],d=s[3];return{prefix:c,unit:d,value:parseFloat(u)}}function camelize(a){return a.replace(/[\s-_]+([^\s-_])/g,function(s,c){return c.toUpperCase()})}function decamelize(a,s){return a.replace(/([a-z])([A-Z])/g,function(c,u,d){return""+u+s+d.toLowerCase()})}function now(){return Date.now?Date.now():new Date().getTime()}function findIndex(a,s,c){c===void 0&&(c=-1);for(var u=a.length,d=0;d<u;++d)if(s(a[d],d,a))return d;return c}function findLastIndex(a,s,c){c===void 0&&(c=-1);for(var u=a.length,d=u-1;d>=0;--d)if(s(a[d],d,a))return d;return c}function findLast(a,s,c){var u=findLastIndex(a,s);return u>-1?a[u]:c}function find$1(a,s,c){var u=findIndex(a,s);return u>-1?a[u]:c}var requestAnimationFrame$1=(function(){var a=now(),s=IS_WINDOW&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame);return s?s.bind(window):function(c){var u=now(),d=setTimeout(function(){c(u-a)},1e3/60);return d}})(),cancelAnimationFrame$1=(function(){var a=IS_WINDOW&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame);return a?a.bind(window):function(s){clearTimeout(s)}})();function getKeys(a){return Object.keys(a)}function convertUnitSize(a,s){var c=splitUnit(a),u=c.value,d=c.unit;if(isObject$1(s)){var p=s[d];if(p){if(isFunction(p))return p(u);if(DEFAULT_UNIT_PRESETS[d])return DEFAULT_UNIT_PRESETS[d](u,p)}}else if(d==="%")return u*s/100;return DEFAULT_UNIT_PRESETS[d]?DEFAULT_UNIT_PRESETS[d](u):u}function between(a,s,c){return Math.max(s,Math.min(a,c))}function checkBoundSize(a,s,c,u){return u===void 0&&(u=a[0]/a[1]),[[throttle(s[0],TINY_NUM$1),throttle(s[0]/u,TINY_NUM$1)],[throttle(s[1]*u,TINY_NUM$1),throttle(s[1],TINY_NUM$1)]].filter(function(d){return d.every(function(p,v){var A=s[v],x=throttle(A,TINY_NUM$1);return c?p<=A||p<=x:p>=A||p>=x})})[0]||a}function calculateBoundSize(a,s,c,u){if(!u)return a.map(function(m,E){return between(m,s[E],c[E])});var d=a[0],p=a[1],v=u===!0?d/p:u,A=checkBoundSize(a,s,!1,v),x=A[0],g=A[1],b=checkBoundSize(a,c,!0,v),y=b[0],f=b[1];return d<x||p<g?(d=x,p=g):(d>y||p>f)&&(d=y,p=f),[d,p]}function sum(a){for(var s=a.length,c=0,u=s-1;u>=0;--u)c+=a[u];return c}function average(a){for(var s=a.length,c=0,u=s-1;u>=0;--u)c+=a[u];return s?c/s:0}function getRad$1(a,s){var c=s[0]-a[0],u=s[1]-a[1],d=Math.atan2(u,c);return d>=0?d:d+Math.PI*2}function getCenterPoint(a){return[0,1].map(function(s){return average(a.map(function(c){return c[s]}))})}function getShapeDirection(a){var s=getCenterPoint(a),c=getRad$1(s,a[0]),u=getRad$1(s,a[1]);return c<u&&u-c<Math.PI||c>u&&u-c<-Math.PI?1:-1}function getDist$2(a,s){return Math.sqrt(Math.pow((s?s[0]:0)-a[0],2)+Math.pow((s?s[1]:0)-a[1],2))}function throttle(a,s){if(!s)return a;var c=1/s;return Math.round(a/s)/c}function throttleArray(a,s){return a.forEach(function(c,u){a[u]=throttle(a[u],s)}),a}function counter(a){for(var s=[],c=0;c<a;++c)s.push(c);return s}function flat$1(a){return a.reduce(function(s,c){return s.concat(c)},[])}function hasClass(a,s){return a.classList?a.classList.contains(s):!!a.className.match(new RegExp("(\\s|^)"+s+"(\\s|$)"))}function addClass(a,s){a.classList?a.classList.add(s):a.className+=" "+s}function removeClass(a,s){if(a.classList)a.classList.remove(s);else{var c=new RegExp("(\\s|^)"+s+"(\\s|$)");a.className=a.className.replace(c," ")}}function addEvent(a,s,c,u){a.addEventListener(s,c,u)}function removeEvent(a,s,c,u){a.removeEventListener(s,c,u)}function getDocument(a){return a?.ownerDocument||doc}function getDocumentElement(a){return getDocument(a).documentElement}function getDocumentBody(a){return getDocument(a).body}function getWindow(a){var s;return((s=a?.ownerDocument)===null||s===void 0?void 0:s.defaultView)||window}function isWindow(a){return a&&"postMessage"in a&&"blur"in a&&"self"in a}function isNode(a){return isObject$1(a)&&a.nodeName&&a.nodeType&&"ownerDocument"in a}var __assign$8=function(){return __assign$8=Object.assign||function(s){for(var c,u=1,d=arguments.length;u<d;u++){c=arguments[u];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(s[p]=c[p])}return s},__assign$8.apply(this,arguments)};function __spreadArrays$1(){for(var a=0,s=0,c=arguments.length;s<c;s++)a+=arguments[s].length;for(var u=Array(a),d=0,s=0;s<c;s++)for(var p=arguments[s],v=0,A=p.length;v<A;v++,d++)u[d]=p[v];return u}var EventEmitter=(function(){function a(){this._events={}}var s=a.prototype;return s.on=function(c,u){if(isObject$1(c))for(var d in c)this.on(d,c[d]);else this._addEvent(c,u,{});return this},s.off=function(c,u){if(!c)this._events={};else if(isObject$1(c))for(var d in c)this.off(d);else if(!u)this._events[c]=[];else{var p=this._events[c];if(p){var v=findIndex(p,function(A){return A.listener===u});v>-1&&p.splice(v,1)}}return this},s.once=function(c,u){var d=this;return u&&this._addEvent(c,u,{once:!0}),new Promise(function(p){d._addEvent(c,p,{once:!0})})},s.emit=function(c,u){var d=this;u===void 0&&(u={});var p=this._events[c];if(!c||!p)return!0;var v=!1;return u.eventType=c,u.stop=function(){v=!0},u.currentTarget=this,__spreadArrays$1(p).forEach(function(A){A.listener(u),A.once&&d.off(c,A.listener)}),!v},s.trigger=function(c,u){return u===void 0&&(u={}),this.emit(c,u)},s._addEvent=function(c,u,d){var p=this._events;p[c]=p[c]||[];var v=p[c];v.push(__assign$8({listener:u},d))},a})();var extendStatics$8=function(a,s){return extendStatics$8=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,u){c.__proto__=u}||function(c,u){for(var d in u)u.hasOwnProperty(d)&&(c[d]=u[d])},extendStatics$8(a,s)};function __extends$8(a,s){extendStatics$8(a,s);function c(){this.constructor=a}a.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}var __assign$7=function(){return __assign$7=Object.assign||function(s){for(var c,u=1,d=arguments.length;u<d;u++){c=arguments[u];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(s[p]=c[p])}return s},__assign$7.apply(this,arguments)};function getRad(a,s){var c=s[0]-a[0],u=s[1]-a[1],d=Math.atan2(u,c);return d>=0?d:d+Math.PI*2}function getRotatiion(a){return getRad([a[0].clientX,a[0].clientY],[a[1].clientX,a[1].clientY])/Math.PI*180}function isMultiTouch(a){return a.touches&&a.touches.length>=2}function getEventClients(a){return a?a.touches?getClients(a.touches):[getClient$1(a)]:[]}function isMouseEvent(a){return a&&(a.type.indexOf("mouse")>-1||"button"in a)}function getPosition(a,s,c){var u=c.length,d=getAverageClient(a,u),p=d.clientX,v=d.clientY,A=d.originalClientX,x=d.originalClientY,g=getAverageClient(s,u),b=g.clientX,y=g.clientY,f=getAverageClient(c,u),m=f.clientX,E=f.clientY,w=p-b,S=v-y,$=p-m,T=v-E;return{clientX:A,clientY:x,deltaX:w,deltaY:S,distX:$,distY:T}}function getDist$1(a){return Math.sqrt(Math.pow(a[0].clientX-a[1].clientX,2)+Math.pow(a[0].clientY-a[1].clientY,2))}function getClients(a){for(var s=Math.min(a.length,2),c=[],u=0;u<s;++u)c.push(getClient$1(a[u]));return c}function getClient$1(a){return{clientX:a.clientX,clientY:a.clientY}}function getAverageClient(a,s){s===void 0&&(s=a.length);for(var c={clientX:0,clientY:0,originalClientX:0,originalClientY:0},u=Math.min(a.length,s),d=0;d<u;++d){var p=a[d];c.originalClientX+="originalClientX"in p?p.originalClientX:p.clientX,c.originalClientY+="originalClientY"in p?p.originalClientY:p.clientY,c.clientX+=p.clientX,c.clientY+=p.clientY}return s?{clientX:c.clientX/s,clientY:c.clientY/s,originalClientX:c.originalClientX/s,originalClientY:c.originalClientY/s}:c}var ClientStore=(function(){function a(s){this.prevClients=[],this.startClients=[],this.movement=0,this.length=0,this.startClients=s,this.prevClients=s,this.length=s.length}return a.prototype.getAngle=function(s){return s===void 0&&(s=this.prevClients),getRotatiion(s)},a.prototype.getRotation=function(s){return s===void 0&&(s=this.prevClients),getRotatiion(s)-getRotatiion(this.startClients)},a.prototype.getPosition=function(s,c){s===void 0&&(s=this.prevClients);var u=getPosition(s||this.prevClients,this.prevClients,this.startClients),d=u.deltaX,p=u.deltaY;return this.movement+=Math.sqrt(d*d+p*p),this.prevClients=s,u},a.prototype.getPositions=function(s){s===void 0&&(s=this.prevClients);for(var c=this.prevClients,u=this.startClients,d=Math.min(this.length,c.length),p=[],v=0;v<d;++v)p[v]=getPosition([s[v]],[c[v]],[u[v]]);return p},a.prototype.getMovement=function(s){var c=this.movement;if(!s)return c;var u=getAverageClient(s,this.length),d=getAverageClient(this.prevClients,this.length),p=u.clientX-d.clientX,v=u.clientY-d.clientY;return Math.sqrt(p*p+v*v)+c},a.prototype.getDistance=function(s){return s===void 0&&(s=this.prevClients),getDist$1(s)},a.prototype.getScale=function(s){return s===void 0&&(s=this.prevClients),getDist$1(s)/getDist$1(this.startClients)},a.prototype.move=function(s,c){this.startClients.forEach(function(u){u.clientX-=s,u.clientY-=c}),this.prevClients.forEach(function(u){u.clientX-=s,u.clientY-=c})},a})(),INPUT_TAGNAMES=["textarea","input"],Gesto=(function(a){__extends$8(s,a);function s(c,u){u===void 0&&(u={});var d=a.call(this)||this;d.options={},d.flag=!1,d.pinchFlag=!1,d.data={},d.isDrag=!1,d.isPinch=!1,d.clientStores=[],d.targets=[],d.prevTime=0,d.doubleFlag=!1,d._useMouse=!1,d._useTouch=!1,d._useDrag=!1,d._dragFlag=!1,d._isTrusted=!1,d._isMouseEvent=!1,d._isSecondaryButton=!1,d._preventMouseEvent=!1,d._prevInputEvent=null,d._isDragAPI=!1,d._isIdle=!0,d._preventMouseEventId=0,d._window=window,d.onDragStart=function(f,m){if(m===void 0&&(m=!0),!(!d.flag&&f.cancelable===!1)){var E=f.type.indexOf("drag")>=-1;if(!(d.flag&&E)){d._isDragAPI=!0;var w=d.options,S=w.container,$=w.pinchOutside,T=w.preventWheelClick,I=w.preventRightClick,_=w.preventDefault,C=w.checkInput,P=w.dragFocusedInput,O=w.preventClickEventOnDragStart,L=w.preventClickEventOnDrag,B=w.preventClickEventByCondition,F=d._useTouch,D=!d.flag;if(d._isSecondaryButton=f.which===3||f.button===2,T&&(f.which===2||f.button===1)||I&&(f.which===3||f.button===2))return d.stop(),!1;if(D){var G=d._window.document.activeElement,j=f.target;if(j){var V=j.tagName.toLowerCase(),U=INPUT_TAGNAMES.indexOf(V)>-1,M=j.isContentEditable;if(U||M){if(C||!P&&G===j)return!1;if(G&&(G===j||M&&G.isContentEditable&&G.contains(j)))if(P)j.blur();else return!1}else if((_||f.type==="touchstart")&&G){var N=G.tagName.toLowerCase();(G.isContentEditable||INPUT_TAGNAMES.indexOf(N)>-1)&&G.blur()}(O||L||B)&&addEvent(d._window,"click",d._onClick,!0)}d.clientStores=[new ClientStore(getEventClients(f))],d._isIdle=!1,d.flag=!0,d.isDrag=!1,d._isTrusted=m,d._dragFlag=!0,d._prevInputEvent=f,d.data={},d.doubleFlag=now()-d.prevTime<200,d._isMouseEvent=isMouseEvent(f),!d._isMouseEvent&&d._preventMouseEvent&&d._allowMouseEvent();var R=d._preventMouseEvent||d.emit("dragStart",__assign$7(__assign$7({data:d.data,datas:d.data,inputEvent:f,isMouseEvent:d._isMouseEvent,isSecondaryButton:d._isSecondaryButton,isTrusted:m,isDouble:d.doubleFlag},d.getCurrentStore().getPosition()),{preventDefault:function(){f.preventDefault()},preventDrag:function(){d._dragFlag=!1}}));R===!1&&d.stop(),d._isMouseEvent&&d.flag&&_&&f.preventDefault()}if(!d.flag)return!1;var k=0;if(D?(d._attchDragEvent(),F&&$&&(k=setTimeout(function(){addEvent(S,"touchstart",d.onDragStart,{passive:!1})}))):F&&$&&removeEvent(S,"touchstart",d.onDragStart),d.flag&&isMultiTouch(f)){if(clearTimeout(k),D&&f.touches.length!==f.changedTouches.length)return;d.pinchFlag||d.onPinchStart(f)}}}},d.onDrag=function(f,m){if(d.flag){var E=d.options.preventDefault;!d._isMouseEvent&&E&&f.preventDefault(),d._prevInputEvent=f;var w=getEventClients(f),S=d.moveClients(w,f,!1);if(d._dragFlag){if(d.pinchFlag||S.deltaX||S.deltaY){var $=d._preventMouseEvent||d.emit("drag",__assign$7(__assign$7({},S),{isScroll:!!m,inputEvent:f}));if($===!1){d.stop();return}}d.pinchFlag&&d.onPinch(f,w)}d.getCurrentStore().getPosition(w,!0)}},d.onDragEnd=function(f){if(d.flag){var m=d.options,E=m.pinchOutside,w=m.container,S=m.preventClickEventOnDrag,$=m.preventClickEventOnDragStart,T=m.preventClickEventByCondition,I=d.isDrag;(S||$||T)&&requestAnimationFrame(function(){d._allowClickEvent()}),!T&&!$&&S&&!I&&d._allowClickEvent(),d._useTouch&&E&&removeEvent(w,"touchstart",d.onDragStart),d.pinchFlag&&d.onPinchEnd(f);var _=f?.touches?getEventClients(f):[],C=_.length;C===0||!d.options.keepDragging?d.flag=!1:d._addStore(new ClientStore(_));var P=d._getPosition(),O=now(),L=!I&&d.doubleFlag;d._prevInputEvent=null,d.prevTime=I||L?0:O,d.flag||(d._dettachDragEvent(),d._preventMouseEvent||d.emit("dragEnd",__assign$7({data:d.data,datas:d.data,isDouble:L,isDrag:I,isClick:!I,isMouseEvent:d._isMouseEvent,isSecondaryButton:d._isSecondaryButton,inputEvent:f,isTrusted:d._isTrusted},P)),d.clientStores=[],d._isMouseEvent||(d._preventMouseEvent=!0,clearTimeout(d._preventMouseEventId),d._preventMouseEventId=setTimeout(function(){d._preventMouseEvent=!1},200)),d._isIdle=!0)}},d.onBlur=function(){d.onDragEnd()},d._allowClickEvent=function(){removeEvent(d._window,"click",d._onClick,!0)},d._onClick=function(f){d._allowClickEvent(),d._allowMouseEvent();var m=d.options.preventClickEventByCondition;m?.(f)||(f.stopPropagation(),f.preventDefault())},d._onContextMenu=function(f){var m=d.options;m.preventRightClick?d.onDragEnd(f):f.preventDefault()},d._passCallback=function(){};var p=[].concat(c),v=p[0];d._window=isWindow(v)?v:getWindow(v),d.options=__assign$7({checkInput:!1,container:v&&!("document"in v)?getWindow(v):v,preventRightClick:!0,preventWheelClick:!0,preventClickEventOnDragStart:!1,preventClickEventOnDrag:!1,preventClickEventByCondition:null,preventDefault:!0,checkWindowBlur:!1,keepDragging:!1,pinchThreshold:0,events:["touch","mouse"]},u);var A=d.options,x=A.container,g=A.events,b=A.checkWindowBlur;if(d._useDrag=g.indexOf("drag")>-1,d._useTouch=g.indexOf("touch")>-1,d._useMouse=g.indexOf("mouse")>-1,d.targets=p,d._useDrag&&p.forEach(function(f){addEvent(f,"dragstart",d.onDragStart)}),d._useMouse&&(p.forEach(function(f){addEvent(f,"mousedown",d.onDragStart),addEvent(f,"mousemove",d._passCallback)}),addEvent(x,"contextmenu",d._onContextMenu)),b&&addEvent(getWindow(),"blur",d.onBlur),d._useTouch){var y={passive:!1};p.forEach(function(f){addEvent(f,"touchstart",d.onDragStart,y),addEvent(f,"touchmove",d._passCallback,y)})}return d}return s.prototype.stop=function(){this.isDrag=!1,this.data={},this.clientStores=[],this.pinchFlag=!1,this.doubleFlag=!1,this.prevTime=0,this.flag=!1,this._isIdle=!0,this._allowClickEvent(),this._dettachDragEvent(),this._isDragAPI=!1},s.prototype.getMovement=function(c){return this.getCurrentStore().getMovement(c)+this.clientStores.slice(1).reduce(function(u,d){return u+d.movement},0)},s.prototype.isDragging=function(){return this.isDrag},s.prototype.isIdle=function(){return this._isIdle},s.prototype.isFlag=function(){return this.flag},s.prototype.isPinchFlag=function(){return this.pinchFlag},s.prototype.isDoubleFlag=function(){return this.doubleFlag},s.prototype.isPinching=function(){return this.isPinch},s.prototype.scrollBy=function(c,u,d,p){p===void 0&&(p=!0),this.flag&&(this.clientStores[0].move(c,u),p&&this.onDrag(d,!0))},s.prototype.move=function(c,u){var d=c[0],p=c[1],v=this.getCurrentStore(),A=v.prevClients;return this.moveClients(A.map(function(x){var g=x.clientX,b=x.clientY;return{clientX:g+d,clientY:b+p,originalClientX:g,originalClientY:b}}),u,!0)},s.prototype.triggerDragStart=function(c){this.onDragStart(c,!1)},s.prototype.setEventData=function(c){var u=this.data;for(var d in c)u[d]=c[d];return this},s.prototype.setEventDatas=function(c){return this.setEventData(c)},s.prototype.getCurrentEvent=function(c){return c===void 0&&(c=this._prevInputEvent),__assign$7(__assign$7({data:this.data,datas:this.data},this._getPosition()),{movement:this.getMovement(),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:c})},s.prototype.getEventData=function(){return this.data},s.prototype.getEventDatas=function(){return this.data},s.prototype.unset=function(){var c=this,u=this.targets,d=this.options.container;this.off(),removeEvent(this._window,"blur",this.onBlur),this._useDrag&&u.forEach(function(p){removeEvent(p,"dragstart",c.onDragStart)}),this._useMouse&&(u.forEach(function(p){removeEvent(p,"mousedown",c.onDragStart)}),removeEvent(d,"contextmenu",this._onContextMenu)),this._useTouch&&(u.forEach(function(p){removeEvent(p,"touchstart",c.onDragStart)}),removeEvent(d,"touchstart",this.onDragStart)),this._prevInputEvent=null,this._allowClickEvent(),this._dettachDragEvent()},s.prototype.onPinchStart=function(c){var u=this,d=this.options.pinchThreshold;if(!(this.isDrag&&this.getMovement()>d)){var p=new ClientStore(getEventClients(c));this.pinchFlag=!0,this._addStore(p);var v=this.emit("pinchStart",__assign$7(__assign$7({data:this.data,datas:this.data,angle:p.getAngle(),touches:this.getCurrentStore().getPositions()},p.getPosition()),{inputEvent:c,isTrusted:this._isTrusted,preventDefault:function(){c.preventDefault()},preventDrag:function(){u._dragFlag=!1}}));v===!1&&(this.pinchFlag=!1)}},s.prototype.onPinch=function(c,u){if(!(!this.flag||!this.pinchFlag||u.length<2)){var d=this.getCurrentStore();this.isPinch=!0,this.emit("pinch",__assign$7(__assign$7({data:this.data,datas:this.data,movement:this.getMovement(u),angle:d.getAngle(u),rotation:d.getRotation(u),touches:d.getPositions(u),scale:d.getScale(u),distance:d.getDistance(u)},d.getPosition(u)),{inputEvent:c,isTrusted:this._isTrusted}))}},s.prototype.onPinchEnd=function(c){if(this.pinchFlag){var u=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;var d=this.getCurrentStore();this.emit("pinchEnd",__assign$7(__assign$7({data:this.data,datas:this.data,isPinch:u,touches:d.getPositions()},d.getPosition()),{inputEvent:c}))}},s.prototype.getCurrentStore=function(){return this.clientStores[0]},s.prototype.moveClients=function(c,u,d){var p=this._getPosition(c,d),v=this.isDrag;(p.deltaX||p.deltaY)&&(this.isDrag=!0);var A=!1;return!v&&this.isDrag&&(A=!0),__assign$7(__assign$7({data:this.data,datas:this.data},p),{movement:this.getMovement(c),isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,isMouseEvent:this._isMouseEvent,isSecondaryButton:this._isSecondaryButton,inputEvent:u,isTrusted:this._isTrusted,isFirstDrag:A})},s.prototype._addStore=function(c){this.clientStores.splice(0,0,c)},s.prototype._getPosition=function(c,u){var d=this.getCurrentStore(),p=d.getPosition(c,u),v=this.clientStores.slice(1).reduce(function(g,b){var y=b.getPosition();return g.distX+=y.distX,g.distY+=y.distY,g},p),A=v.distX,x=v.distY;return __assign$7(__assign$7({},p),{distX:A,distY:x})},s.prototype._attchDragEvent=function(){var c=this._window,u=this.options.container,d={passive:!1};this._isDragAPI&&(addEvent(u,"dragover",this.onDrag,d),addEvent(c,"dragend",this.onDragEnd)),this._useMouse&&(addEvent(u,"mousemove",this.onDrag),addEvent(c,"mouseup",this.onDragEnd)),this._useTouch&&(addEvent(u,"touchmove",this.onDrag,d),addEvent(c,"touchend",this.onDragEnd,d),addEvent(c,"touchcancel",this.onDragEnd,d))},s.prototype._dettachDragEvent=function(){var c=this._window,u=this.options.container;this._isDragAPI&&(removeEvent(u,"dragover",this.onDrag),removeEvent(c,"dragend",this.onDragEnd)),this._useMouse&&(removeEvent(u,"mousemove",this.onDrag),removeEvent(c,"mouseup",this.onDragEnd)),this._useTouch&&(removeEvent(u,"touchstart",this.onDragStart),removeEvent(u,"touchmove",this.onDrag),removeEvent(c,"touchend",this.onDragEnd),removeEvent(c,"touchcancel",this.onDragEnd))},s.prototype._allowMouseEvent=function(){this._preventMouseEvent=!1,clearTimeout(this._preventMouseEventId)},s})(EventEmitter);function prefixNames(a){for(var s=[],c=1;c<arguments.length;c++)s[c-1]=arguments[c];return s.map(function(u){return u.split(" ").map(function(d){return d?""+a+d:""}).join(" ")}).join(" ")}function prefixCSS(a,s){return s.replace(/([^}{]*){/gm,function(c,u){return u.replace(/\.([^{,\s\d.]+)/g,"."+a+"$1")+"{"})}function ref(a,s){return function(c){c&&(a[s]=c)}}function refs(a,s,c){return function(u){u&&(a[s][c]=u)}}function Properties(a,s){return function(c){var u=c.prototype;a.forEach(function(d){s(u,d)})}}function withMethods(a,s){return s===void 0&&(s={}),function(c,u){a.forEach(function(d){var p=s[d]||d;p in c||(c[p]=function(){for(var v,A=[],x=0;x<arguments.length;x++)A[x]=arguments[x];var g=(v=this[u])[d].apply(v,A);return g===this[u]?this:g})})}}var PolyMap=(function(){function a(){this.keys=[],this.values=[]}var s=a.prototype;return s.get=function(c){return this.values[this.keys.indexOf(c)]},s.set=function(c,u){var d=this.keys,p=this.values,v=d.indexOf(c),A=v===-1?d.length:v;d[A]=c,p[A]=u},a})(),HashMap=(function(){function a(){this.object={}}var s=a.prototype;return s.get=function(c){return this.object[c]},s.set=function(c,u){this.object[c]=u},a})(),SUPPORT_MAP=typeof Map=="function",Link=(function(){function a(){}var s=a.prototype;return s.connect=function(c,u){this.prev=c,this.next=u,c&&(c.next=this),u&&(u.prev=this)},s.disconnect=function(){var c=this.prev,u=this.next;c&&(c.next=u),u&&(u.prev=c)},s.getIndex=function(){for(var c=this,u=-1;c;)c=c.prev,++u;return u},a})();function orderChanged(a,s){var c=[],u=[];return a.forEach(function(d){var p=d[0],v=d[1],A=new Link;c[p]=A,u[v]=A}),c.forEach(function(d,p){d.connect(c[p-1])}),a.filter(function(d,p){return!s[p]}).map(function(d,p){var v=d[0],A=d[1];if(v===A)return[0,0];var x=c[v],g=u[A-1],b=x.getIndex();x.disconnect(),g?x.connect(g,g.next):x.connect(void 0,c[0]);var y=x.getIndex();return[b,y]})}var Result=(function(){function a(c,u,d,p,v,A,x,g){this.prevList=c,this.list=u,this.added=d,this.removed=p,this.changed=v,this.maintained=A,this.changedBeforeAdded=x,this.fixed=g}var s=a.prototype;return Object.defineProperty(s,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(s,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),s.caculateOrdered=function(){var c=orderChanged(this.changedBeforeAdded,this.fixed),u=this.changed,d=[];this.cacheOrdered=c.filter(function(p,v){var A=p[0],x=p[1],g=u[v],b=g[0],y=g[1];if(A!==x)return d.push([b,y]),!0}),this.cachePureChanged=d},a})();function diff$1(a,s,c){var u=SUPPORT_MAP?Map:c?HashMap:PolyMap,d=c||function(T){return T},p=[],v=[],A=[],x=a.map(d),g=s.map(d),b=new u,y=new u,f=[],m=[],E={},w=[],S=0,$=0;return x.forEach(function(T,I){b.set(T,I)}),g.forEach(function(T,I){y.set(T,I)}),x.forEach(function(T,I){var _=y.get(T);typeof _>"u"?(++$,v.push(I)):E[_]=$}),g.forEach(function(T,I){var _=b.get(T);typeof _>"u"?(p.push(I),++S):(A.push([_,I]),$=E[I]||0,f.push([_-$,I-S]),m.push(I===_),_!==I&&w.push([_,I]))}),v.reverse(),new Result(a,s,p,v,w,A,f,m)}var ListDiffer=(function(){function a(c,u){c===void 0&&(c=[]),this.findKeyCallback=u,this.list=[].slice.call(c)}var s=a.prototype;return s.update=function(c){var u=[].slice.call(c),d=diff$1(this.list,u,this.findKeyCallback);return this.list=u,d},a})();var extendStatics$7=function(a,s){return extendStatics$7=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,u){c.__proto__=u}||function(c,u){for(var d in u)u.hasOwnProperty(d)&&(c[d]=u[d])},extendStatics$7(a,s)};function __extends$7(a,s){extendStatics$7(a,s);function c(){this.constructor=a}a.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}var findKeyCallback=typeof Map=="function"?void 0:(function(){var a=0;return function(s){return s.__DIFF_KEY__||(s.__DIFF_KEY__=++a)}})(),ChildrenDiffer=(function(a){__extends$7(s,a);function s(c){return c===void 0&&(c=[]),a.call(this,c,findKeyCallback)||this}return s})(ListDiffer);function diff(a,s){return diff$1(a,s,findKeyCallback)}var extendStatics$6=function(a,s){return extendStatics$6=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,u){c.__proto__=u}||function(c,u){for(var d in u)u.hasOwnProperty(d)&&(c[d]=u[d])},extendStatics$6(a,s)};function __extends$6(a,s){extendStatics$6(a,s);function c(){this.constructor=a}a.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}var __assign$6=function(){return __assign$6=Object.assign||function(s){for(var c,u=1,d=arguments.length;u<d;u++){c=arguments[u];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(s[p]=c[p])}return s},__assign$6.apply(this,arguments)};function getDefaultScrollPosition$1(a){var s=a.container;return s===document.body?[s.scrollLeft||document.documentElement.scrollLeft,s.scrollTop||document.documentElement.scrollTop]:[s.scrollLeft,s.scrollTop]}function checkDefaultScrollEvent(a,s){return a.addEventListener("scroll",s),function(){a.removeEventListener("scroll",s)}}function getContainerElement(a){if(a){if(isString(a))return document.querySelector(a)}else return null;if(isFunction(a))return a();if(a instanceof Element)return a;if("current"in a)return a.current;if("value"in a)return a.value}var DragScroll=(function(a){__extends$6(s,a);function s(){var u=a!==null&&a.apply(this,arguments)||this;return u._startRect=null,u._startPos=[],u._prevTime=0,u._timer=0,u._prevScrollPos=[0,0],u._isWait=!1,u._flag=!1,u._currentOptions=null,u._lock=!1,u._unregister=null,u._onScroll=function(){var d=u._currentOptions;u._lock||!d||u.emit("scrollDrag",{next:function(p){u.checkScroll({container:d.container,inputEvent:p})}})},u}var c=s.prototype;return c.dragStart=function(u,d){var p=getContainerElement(d.container);if(!p){this._flag=!1;return}var v=0,A=0,x=0,g=0;if(p===document.body)x=window.innerWidth,g=window.innerHeight;else{var b=p.getBoundingClientRect();v=b.top,A=b.left,x=b.width,g=b.height}this._flag=!0,this._startPos=[u.clientX,u.clientY],this._startRect={top:v,left:A,width:x,height:g},this._prevScrollPos=this._getScrollPosition([0,0],d),this._currentOptions=d,this._registerScrollEvent(d)},c.drag=function(u,d){if(clearTimeout(this._timer),!!this._flag){var p=u.clientX,v=u.clientY,A=d.threshold,x=A===void 0?0:A,g=this,b=g._startRect,y=g._startPos;this._currentOptions=d;var f=[0,0];return b.top>v-x?(y[1]>b.top||v<y[1])&&(f[1]=-1):b.top+b.height<v+x&&(y[1]<b.top+b.height||v>y[1])&&(f[1]=1),b.left>p-x?(y[0]>b.left||p<y[0])&&(f[0]=-1):b.left+b.width<p+x&&(y[0]<b.left+b.width||p>y[0])&&(f[0]=1),!f[0]&&!f[1]?!1:this._continueDrag(__assign$6(__assign$6({},d),{direction:f,inputEvent:u,isDrag:!0}))}},c.checkScroll=function(u){var d=this;if(this._isWait)return!1;var p=u.prevScrollPos,v=p===void 0?this._prevScrollPos:p,A=u.direction,x=u.throttleTime,g=x===void 0?0:x,b=u.inputEvent,y=u.isDrag,f=this._getScrollPosition(A||[0,0],u),m=f[0]-v[0],E=f[1]-v[1],w=A||[m?Math.abs(m)/m:0,E?Math.abs(E)/E:0];return this._prevScrollPos=f,this._lock=!1,!m&&!E?!1:(this.emit("move",{offsetX:w[0]?m:0,offsetY:w[1]?E:0,inputEvent:b}),g&&y&&(clearTimeout(this._timer),this._timer=window.setTimeout(function(){d._continueDrag(u)},g)),!0)},c.dragEnd=function(){this._flag=!1,this._lock=!1,clearTimeout(this._timer),this._unregisterScrollEvent()},c._getScrollPosition=function(u,d){var p=d.container,v=d.getScrollPosition,A=v===void 0?getDefaultScrollPosition$1:v;return A({container:getContainerElement(p),direction:u})},c._continueDrag=function(u){var d=this,p,v=u.container,A=u.direction,x=u.throttleTime,g=u.useScroll,b=u.isDrag,y=u.inputEvent;if(!(!this._flag||b&&this._isWait)){var f=now(),m=Math.max(x+this._prevTime-f,0);if(m>0)return clearTimeout(this._timer),this._timer=window.setTimeout(function(){d._continueDrag(u)},m),!1;this._prevTime=f;var E=this._getScrollPosition(A,u);this._prevScrollPos=E,b&&(this._isWait=!0),g||(this._lock=!0);var w={container:getContainerElement(v),direction:A,inputEvent:y};return(p=u.requestScroll)===null||p===void 0||p.call(u,w),this.emit("scroll",w),this._isWait=!1,g||this.checkScroll(__assign$6(__assign$6({},u),{prevScrollPos:E,direction:A,inputEvent:y}))}},c._registerScrollEvent=function(u){this._unregisterScrollEvent();var d=u.checkScrollEvent;if(d){var p=d===!0?checkDefaultScrollEvent:d,v=getContainerElement(u.container);d===!0&&(v===document.body||v===document.documentElement)?this._unregister=checkDefaultScrollEvent(window,this._onScroll):this._unregister=p(v,this._onScroll)}},c._unregisterScrollEvent=function(){var u;(u=this._unregister)===null||u===void 0||u.call(this),this._unregister=null},s})(EventEmitter),extendStatics$5=function(a,s){return extendStatics$5=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,u){c.__proto__=u}||function(c,u){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(c[d]=u[d])},extendStatics$5(a,s)};function __extends$5(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");extendStatics$5(a,s);function c(){this.constructor=a}a.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}function createCommonjsModule(a,s){return s={exports:{}},a(s,s.exports),s.exports}var keycode=createCommonjsModule(function(a,s){function c(x){if(x&&typeof x=="object"){var g=x.which||x.keyCode||x.charCode;g&&(x=g)}if(typeof x=="number")return v[x];var b=String(x),y=u[b.toLowerCase()];if(y)return y;var y=d[b.toLowerCase()];if(y)return y;if(b.length===1)return b.charCodeAt(0)}c.isEventKey=function(g,b){if(g&&typeof g=="object"){var y=g.which||g.keyCode||g.charCode;if(y==null)return!1;if(typeof b=="string"){var f=u[b.toLowerCase()];if(f)return f===y;var f=d[b.toLowerCase()];if(f)return f===y}else if(typeof b=="number")return b===y;return!1}},s=a.exports=c;var u=s.code=s.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},d=s.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};for(p=97;p<123;p++)u[String.fromCharCode(p)]=p-32;for(var p=48;p<58;p++)u[p-48]=p;for(p=1;p<13;p++)u["f"+p]=p+111;for(p=0;p<10;p++)u["numpad "+p]=p+96;var v=s.names=s.title={};for(p in u)v[u[p]]=p;for(var A in d)u[A]=d[A]});keycode.code,keycode.codes,keycode.aliases;var keycode_4=keycode.names;keycode.title;var codeData={"+":"plus","left command":"meta","right command":"meta"},keysSort={shift:1,ctrl:2,alt:3,meta:4};function getKey(a,s){var c=(keycode_4[a]||s||"").toLowerCase();for(var u in codeData)c=c.replace(u,codeData[u]);return c.replace(/\s/g,"")}function getCombi(a,s){s===void 0&&(s=getKey(a.keyCode,a.key));var c=getModifierCombi(a);return c.indexOf(s)===-1&&c.push(s),c.filter(Boolean)}function getModifierCombi(a){var s=[a.shiftKey&&"shift",a.ctrlKey&&"ctrl",a.altKey&&"alt",a.metaKey&&"meta"];return s.filter(Boolean)}function getArrangeCombi(a){var s=a.slice();return s.sort(function(c,u){var d=keysSort[c]||5,p=keysSort[u]||5;return d-p}),s}var globalKeyController,KeyController=(function(a){__extends$5(s,a);function s(u){u===void 0&&(u=window);var d=a.call(this)||this;return d.container=u,d.ctrlKey=!1,d.altKey=!1,d.shiftKey=!1,d.metaKey=!1,d.clear=function(){return d.ctrlKey=!1,d.altKey=!1,d.shiftKey=!1,d.metaKey=!1,d},d.keydownEvent=function(p){d.triggerEvent("keydown",p)},d.keyupEvent=function(p){d.triggerEvent("keyup",p)},d.blur=function(){d.clear(),d.trigger("blur")},addEvent(u,"blur",d.blur),addEvent(u,"keydown",d.keydownEvent),addEvent(u,"keyup",d.keyupEvent),d}var c=s.prototype;return Object.defineProperty(s,"global",{get:function(){return globalKeyController||(globalKeyController=new s)},enumerable:!1,configurable:!0}),s.setGlobal=function(){return this.global},c.destroy=function(){var u=this.container;this.clear(),this.off(),removeEvent(u,"blur",this.blur),removeEvent(u,"keydown",this.keydownEvent),removeEvent(u,"keyup",this.keyupEvent)},c.keydown=function(u,d){return this.addEvent("keydown",u,d)},c.offKeydown=function(u,d){return this.removeEvent("keydown",u,d)},c.offKeyup=function(u,d){return this.removeEvent("keyup",u,d)},c.keyup=function(u,d){return this.addEvent("keyup",u,d)},c.addEvent=function(u,d,p){return isArray(d)?this.on("".concat(u,".").concat(getArrangeCombi(d).join(".")),p):isString(d)?this.on("".concat(u,".").concat(d),p):this.on(u,d),this},c.removeEvent=function(u,d,p){return isArray(d)?this.off("".concat(u,".").concat(getArrangeCombi(d).join(".")),p):isString(d)?this.off("".concat(u,".").concat(d),p):this.off(u,d),this},c.triggerEvent=function(u,d){this.ctrlKey=d.ctrlKey,this.shiftKey=d.shiftKey,this.altKey=d.altKey,this.metaKey=d.metaKey;var p=getKey(d.keyCode,d.key),v=p==="ctrl"||p==="shift"||p==="meta"||p==="alt",A={key:p,isToggle:v,inputEvent:d,keyCode:d.keyCode,ctrlKey:d.ctrlKey,altKey:d.altKey,shiftKey:d.shiftKey,metaKey:d.metaKey};this.trigger(u,A),this.trigger("".concat(u,".").concat(p),A);var x=getCombi(d,p);x.length>1&&this.trigger("".concat(u,".").concat(x.join(".")),A)},s})(EventEmitter);function __spreadArrays(){for(var a=0,s=0,c=arguments.length;s<c;s++)a+=arguments[s].length;for(var u=Array(a),d=0,s=0;s<c;s++)for(var p=arguments[s],v=0,A=p.length;v<A;v++,d++)u[d]=p[v];return u}function tinyThrottle(a){return throttle(a,TINY_NUM$1)}function isSameConstants(a,s){return a.every(function(c,u){return tinyThrottle(c-s[u])===0})}function isSamePoint(a,s){return!tinyThrottle(a[0]-s[0])&&!tinyThrottle(a[1]-s[1])}function getAreaSize(a){return a.length<3?0:Math.abs(sum(a.map(function(s,c){var u=a[c+1]||a[0];return s[0]*u[1]-u[0]*s[1]})))/2}function fitPoints(a,s){var c=s.width,u=s.height,d=s.left,p=s.top,v=getMinMaxs(a),A=v.minX,x=v.minY,g=v.maxX,b=v.maxY,y=c/(g-A),f=u/(b-x);return a.map(function(m){return[d+(m[0]-A)*y,p+(m[1]-x)*f]})}function getMinMaxs(a){var s=a.map(function(u){return u[0]}),c=a.map(function(u){return u[1]});return{minX:Math.min.apply(Math,s),minY:Math.min.apply(Math,c),maxX:Math.max.apply(Math,s),maxY:Math.max.apply(Math,c)}}function isInside(a,s,c){var u=a[0],d=a[1],p=getMinMaxs(s),v=p.minX,A=p.maxX,x=[[v,d],[A,d]],g=getLinearConstants(x[0],x[1]),b=convertLines(s),y=[];if(b.forEach(function(E){var w=getLinearConstants(E[0],E[1]),S=E[0];if(isSameConstants(g,w))y.push({pos:a,line:E,type:"line"});else{var $=getPointsOnLines(getIntersectionPointsByConstants(g,w),[x,E]);$.forEach(function(T){E.some(function(I){return isSamePoint(I,T)})?y.push({pos:T,line:E,type:"point"}):tinyThrottle(S[1]-d)!==0&&y.push({pos:T,line:E,type:"intersection"})})}}),find$1(y,function(E){return E[0]===u}))return!0;var f=0,m={};return y.forEach(function(E){var w=E.pos,S=E.type,$=E.line;if(!(w[0]>u))if(S==="intersection")++f;else{if(S==="line")return;if(S==="point"){var T=find$1($,function(C){return C[1]!==d}),I=m[w[0]],_=T[1]>d?1:-1;I?I!==_&&++f:m[w[0]]=_}}}),f%2===1}function getLinearConstants(a,s){var c=a[0],u=a[1],d=s[0],p=s[1],v=d-c,A=p-u;Math.abs(v)<TINY_NUM$1&&(v=0),Math.abs(A)<TINY_NUM$1&&(A=0);var x=0,g=0,b=0;return v?A?(x=-A/v,g=1,b=-x*c-u):(g=1,b=-u):A&&(x=-1,b=c),[x,g,b]}function getIntersectionPointsByConstants(a,s){var c=a[0],u=a[1],d=a[2],p=s[0],v=s[1],A=s[2],x=c===0&&p===0,g=u===0&&v===0,b=[];if(x&&g)return[];if(x){var y=-d/u,f=-A/v;return y!==f?[]:[[-1/0,y],[1/0,y]]}else if(g){var m=-d/c,E=-A/p;return m!==E?[]:[[m,-1/0],[m,1/0]]}else if(c===0){var w=-d/u,S=-(v*w+A)/p;b=[[S,w]]}else if(p===0){var w=-A/v,S=-(u*w+d)/c;b=[[S,w]]}else if(u===0){var S=-d/c,w=-(p*S+A)/v;b=[[S,w]]}else if(v===0){var S=-A/p,w=-(c*S+d)/u;b=[[S,w]]}else{var S=(u*A-v*d)/(v*c-u*p),w=-(c*S+d)/u;b=[[S,w]]}return b.map(function($){return[$[0],$[1]]})}function getPointsOnLines(a,s){var c=s.map(function(y){return[0,1].map(function(f){return[Math.min(y[0][f],y[1][f]),Math.max(y[0][f],y[1][f])]})}),u=[];if(a.length===2){var d=a[0],p=d[0],v=d[1];if(tinyThrottle(p-a[1][0])){if(!tinyThrottle(v-a[1][1])){var g=Math.max.apply(Math,c.map(function(y){return y[0][0]})),b=Math.min.apply(Math,c.map(function(y){return y[0][1]}));if(tinyThrottle(g-b)>0)return[];u=[[g,v],[b,v]]}}else{var A=Math.max.apply(Math,c.map(function(y){return y[1][0]})),x=Math.min.apply(Math,c.map(function(y){return y[1][1]}));if(tinyThrottle(A-x)>0)return[];u=[[p,A],[p,x]]}}return u.length||(u=a.filter(function(y){var f=y[0],m=y[1];return c.every(function(E){return 0<=tinyThrottle(f-E[0][0])&&0<=tinyThrottle(E[0][1]-f)&&0<=tinyThrottle(m-E[1][0])&&0<=tinyThrottle(E[1][1]-m)})})),u.map(function(y){return[tinyThrottle(y[0]),tinyThrottle(y[1])]})}function convertLines(a){return __spreadArrays(a.slice(1),[a[0]]).map(function(s,c){return[a[c],s]})}function getOverlapPointInfos(a,s){var c=a.slice(),u=s.slice();getShapeDirection(c)===-1&&c.reverse(),getShapeDirection(u)===-1&&u.reverse();var d=convertLines(c),p=convertLines(u),v=d.map(function(b){return getLinearConstants(b[0],b[1])}),A=p.map(function(b){return getLinearConstants(b[0],b[1])}),x=[];v.forEach(function(b,y){var f=d[y],m=[];A.forEach(function(E,w){var S=getIntersectionPointsByConstants(b,E),$=getPointsOnLines(S,[f,p[w]]);m.push.apply(m,$.map(function(T){return{index1:y,index2:w,pos:T,type:"intersection"}}))}),m.sort(function(E,w){return getDist$2(f[0],E.pos)-getDist$2(f[0],w.pos)}),x.push.apply(x,m),isInside(f[1],u)&&x.push({index1:y,index2:-1,pos:f[1],type:"inside"})}),p.forEach(function(b,y){if(isInside(b[1],c)){var f=!1,m=findIndex(x,function(E){var w=E.index2;return w===y?(f=!0,!1):!!f});m===-1&&(f=!1,m=findIndex(x,function(E){var w=E.index1,S=E.index2;return w===-1&&S+1===y?(f=!0,!1):!!f})),m===-1?x.push({index1:-1,index2:y,pos:b[1],type:"inside"}):x.splice(m,0,{index1:-1,index2:y,pos:b[1],type:"inside"})}});var g={};return x.filter(function(b){var y=b.pos,f=y[0]+"x"+y[1];return g[f]?!1:(g[f]=!0,!0)})}function getOverlapPoints(a,s){var c=getOverlapPointInfos(a,s);return c.map(function(u){var d=u.pos;return d})}function getOverlapSize(a,s){var c=getOverlapPoints(a,s);return getAreaSize(c)}function add(a,s,c,u,d,p){for(var v=0;v<d;++v){var A=c+v*d,x=u+v*d;a[A]+=a[x]*p,s[A]+=s[x]*p}}function swap(a,s,c,u,d){for(var p=0;p<d;++p){var v=c+p*d,A=u+p*d,x=a[v],g=s[v];a[v]=a[A],a[A]=x,s[v]=s[A],s[A]=g}}function divide(a,s,c,u,d){for(var p=0;p<u;++p){var v=c+p*u;a[v]/=d,s[v]/=d}}function ignoreDimension(a,s,c){for(var u=a.slice(),d=0;d<c;++d)u[d*c+s-1]=0,u[(s-1)*c+d]=0;return u[(s-1)*(c+1)]=1,u}function invert(a,s){s===void 0&&(s=Math.sqrt(a.length));for(var c=a.slice(),u=createIdentityMatrix(s),d=0;d<s;++d){var p=s*d+d;if(!throttle(c[p],TINY_NUM$1)){for(var v=d+1;v<s;++v)if(c[s*d+v]){swap(c,u,d,v,s);break}}if(!throttle(c[p],TINY_NUM$1))return[];divide(c,u,d,s,c[p]);for(var v=0;v<s;++v){var A=v,x=v+d*s,g=c[x];!throttle(g,TINY_NUM$1)||d===v||add(c,u,A,d,s,-g)}}return u}function transpose(a,s){s===void 0&&(s=Math.sqrt(a.length));for(var c=[],u=0;u<s;++u)for(var d=0;d<s;++d)c[d*s+u]=a[s*u+d];return c}function getOrigin(a,s){s===void 0&&(s=Math.sqrt(a.length));for(var c=[],u=a[s*s-1],d=0;d<s-1;++d)c[d]=a[s*(s-1)+d]/u;return c[s-1]=0,c}function fromTranslation(a,s){for(var c=createIdentityMatrix(s),u=0;u<s-1;++u)c[s*(s-1)+u]=a[u]||0;return c}function convertPositionMatrix(a,s){for(var c=a.slice(),u=a.length;u<s-1;++u)c[u]=0;return c[s-1]=1,c}function convertDimension(a,s,c){if(s===void 0&&(s=Math.sqrt(a.length)),s===c)return a;for(var u=createIdentityMatrix(c),d=Math.min(s,c),p=0;p<d-1;++p){for(var v=0;v<d-1;++v)u[p*c+v]=a[p*s+v];u[(p+1)*c-1]=a[(p+1)*s-1],u[(c-1)*c+p]=a[(s-1)*s+p]}return u[c*c-1]=a[s*s-1],u}function multiplies(a){for(var s=[],c=1;c<arguments.length;c++)s[c-1]=arguments[c];var u=createIdentityMatrix(a);return s.forEach(function(d){u=multiply(u,d,a)}),u}function multiply(a,s,c){c===void 0&&(c=Math.sqrt(a.length));var u=[],d=a.length/c,p=s.length/d;if(d){if(!p)return a}else return s;for(var v=0;v<c;++v)for(var A=0;A<p;++A){u[A*c+v]=0;for(var x=0;x<d;++x)u[A*c+v]+=a[x*c+v]*s[A*d+x]}return u}function plus(a,s){for(var c=Math.min(a.length,s.length),u=a.slice(),d=0;d<c;++d)u[d]=u[d]+s[d];return u}function minus(a,s){for(var c=Math.min(a.length,s.length),u=a.slice(),d=0;d<c;++d)u[d]=u[d]-s[d];return u}function convertCSStoMatrix(a,s){return s===void 0&&(s=a.length===6),s?[a[0],a[1],0,a[2],a[3],0,a[4],a[5],1]:a}function convertMatrixtoCSS(a,s){return s===void 0&&(s=a.length===9),s?[a[0],a[1],a[3],a[4],a[6],a[7]]:a}function calculate(a,s,c){c===void 0&&(c=s.length);var u=multiply(a,s,c),d=u[c-1];return u.map(function(p){return p/d})}function rotateX3d(a,s){return multiply(a,[1,0,0,0,0,Math.cos(s),Math.sin(s),0,0,-Math.sin(s),Math.cos(s),0,0,0,0,1],4)}function rotateY3d(a,s){return multiply(a,[Math.cos(s),0,-Math.sin(s),0,0,1,0,0,Math.sin(s),0,Math.cos(s),0,0,0,0,1],4)}function rotateZ3d(a,s){return multiply(a,createRotateMatrix(s,4))}function scale3d(a,s){var c=s[0],u=c===void 0?1:c,d=s[1],p=d===void 0?1:d,v=s[2],A=v===void 0?1:v;return multiply(a,[u,0,0,0,0,p,0,0,0,0,A,0,0,0,0,1],4)}function rotate(a,s){return calculate(createRotateMatrix(s,3),convertPositionMatrix(a,3))}function translate3d(a,s){var c=s[0],u=c===void 0?0:c,d=s[1],p=d===void 0?0:d,v=s[2],A=v===void 0?0:v;return multiply(a,[1,0,0,0,0,1,0,0,0,0,1,0,u,p,A,1],4)}function matrix3d(a,s){return multiply(a,s,4)}function createRotateMatrix(a,s){var c=Math.cos(a),u=Math.sin(a),d=createIdentityMatrix(s);return d[0]=c,d[1]=u,d[s]=-u,d[s+1]=c,d}function createIdentityMatrix(a){for(var s=a*a,c=[],u=0;u<s;++u)c[u]=u%(a+1)?0:1;return c}function createScaleMatrix(a,s){for(var c=createIdentityMatrix(s),u=Math.min(a.length,s-1),d=0;d<u;++d)c[(s+1)*d]=a[d];return c}function createOriginMatrix(a,s){for(var c=createIdentityMatrix(s),u=Math.min(a.length,s-1),d=0;d<u;++d)c[s*(s-1)+d]=a[d];return c}function createWarpMatrix(a,s,c,u,d,p,v,A){var x=a[0],g=a[1],b=s[0],y=s[1],f=c[0],m=c[1],E=u[0],w=u[1],S=d[0],$=d[1],T=p[0],I=p[1],_=v[0],C=v[1],P=A[0],O=A[1],L=[x,0,b,0,f,0,E,0,g,0,y,0,m,0,w,0,1,0,1,0,1,0,1,0,0,x,0,b,0,f,0,E,0,g,0,y,0,m,0,w,0,1,0,1,0,1,0,1,-S*x,-$*x,-T*b,-I*b,-_*f,-C*f,-P*E,-O*E,-S*g,-$*g,-T*y,-I*y,-_*m,-C*m,-P*w,-O*w],B=invert(L,8);if(!B.length)return[];var F=multiply(B,[S,$,T,I,_,C,P,O],8);return F[8]=1,convertDimension(transpose(F),3,4)}var __assign$5=function(){return __assign$5=Object.assign||function(s){for(var c,u=1,d=arguments.length;u<d;u++){c=arguments[u];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(s[p]=c[p])}return s},__assign$5.apply(this,arguments)};function createMatrix(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}function parseMat(a,s){return s===void 0&&(s=0),toMat(parse(a,s))}function calculateMatrixDist(a,s){var c=calculate(a,[s[0],s[1]||0,s[2]||0,1],4),u=c[3]||1;return[c[0]/u,c[1]/u,c[2]/u]}function getDistElementMatrix(a,s){s===void 0&&(s=document.body);for(var c=a,u=createMatrix();c;){var d=getComputedStyle(c).transform;if(u=matrix3d(parseMat(d),u),c===s)break;c=c.parentElement}return u=invert(u,4),u[12]=0,u[13]=0,u[14]=0,u}function toMat(a){var s=createMatrix();return a.forEach(function(c){var u=c.matrixFunction,d=c.functionValue;u&&(s=u(s,d))}),s}function parse(a,s){s===void 0&&(s=0);var c=isArray(a)?a:splitSpace(a);return c.map(function(u){var d=splitBracket(u),p=d.prefix,v=d.value,A=null,x=p,g="";if(p==="translate"||p==="translateX"||p==="translate3d"){var b=isObject$1(s)?__assign$5(__assign$5({},s),{"o%":s["%"]}):{"%":s,"o%":s},y=splitComma(v).map(function(j,V){return V===0&&"x%"in b?b["%"]=s["x%"]:V===1&&"y%"in b?b["%"]=s["y%"]:b["%"]=s["o%"],convertUnitSize(j,b)}),f=y[0],m=y[1],E=m===void 0?0:m,w=y[2],S=w===void 0?0:w;A=translate3d,g=[f,E,S]}else if(p==="translateY"){var $=isObject$1(s)?__assign$5({"%":s["y%"]},s):{"%":s},E=convertUnitSize(v,$);A=translate3d,g=[0,E,0]}else if(p==="translateZ"){var S=parseFloat(v);A=translate3d,g=[0,0,S]}else if(p==="scale"||p==="scale3d"){var T=splitComma(v).map(function(j){return parseFloat(j)}),I=T[0],_=T[1],C=_===void 0?I:_,P=T[2],O=P===void 0?1:P;A=scale3d,g=[I,C,O]}else if(p==="scaleX"){var I=parseFloat(v);A=scale3d,g=[I,1,1]}else if(p==="scaleY"){var C=parseFloat(v);A=scale3d,g=[1,C,1]}else if(p==="scaleZ"){var O=parseFloat(v);A=scale3d,g=[1,1,O]}else if(p==="rotate"||p==="rotateZ"||p==="rotateX"||p==="rotateY"){var L=splitUnit(v),B=L.unit,F=L.value,D=B==="rad"?F:F*Math.PI/180;p==="rotate"||p==="rotateZ"?(x="rotateZ",A=rotateZ3d):p==="rotateX"?A=rotateX3d:p==="rotateY"&&(A=rotateY3d),g=D}else if(p==="matrix3d")A=matrix3d,g=splitComma(v).map(function(j){return parseFloat(j)});else if(p==="matrix"){var G=splitComma(v).map(function(j){return parseFloat(j)});A=matrix3d,g=[G[0],G[1],0,0,G[2],G[3],0,0,0,0,1,0,G[4],G[5],0,1]}else x="";return{name:p,functionName:x,value:v,matrixFunction:A,functionValue:g}})}function hash(a){for(var s=5381,c=a.length;c;)s=s*33^a.charCodeAt(--c);return s>>>0}var stringHash=hash;function getHash(a){return stringHash(a).toString(36)}function getShadowRoot$1(a){if(a&&a.getRootNode){var s=a.getRootNode();if(s.nodeType===11)return s}}function replaceStyle(a,s,c){return c.original?s:s.replace(/([^};{\s}][^};{]*|^\s*){/mg,function(u,d){var p=d.trim();return(p?splitComma(p):[""]).map(function(v){var A=v.trim();return A.indexOf("@")===0?A:A.indexOf(":global")>-1?A.replace(/\:global/g,""):A.indexOf(":host")>-1?"".concat(A.replace(/\:host/g,".".concat(a))):A?".".concat(a," ").concat(A):".".concat(a)}).join(", ")+" {"})}function injectStyle(a,s,c,u,d){var p=getDocument(u),v=p.createElement("style");return v.setAttribute("type","text/css"),v.setAttribute("data-styled-id",a),v.setAttribute("data-styled-count","1"),c.nonce&&v.setAttribute("nonce",c.nonce),v.innerHTML=replaceStyle(a,s,c),(d||p.head||p.body).appendChild(v),v}function styled$1(a){var s="rCS"+getHash(a);return{className:s,inject:function(c,u){u===void 0&&(u={});var d=getShadowRoot$1(c),p=(d||c.ownerDocument||document).querySelector('style[data-styled-id="'.concat(s,'"]'));if(!p)p=injectStyle(s,a,u,c,d);else{var v=parseFloat(p.getAttribute("data-styled-count"))||0;p.setAttribute("data-styled-count","".concat(v+1))}return{destroy:function(){var A,x=parseFloat(p.getAttribute("data-styled-count"))||0;x<=1?(p.remove?p.remove():(A=p.parentNode)===null||A===void 0||A.removeChild(p),p=null):p.setAttribute("data-styled-count","".concat(x-1))}}}}}var extendStatics$4=function(a,s){return extendStatics$4=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,u){c.__proto__=u}||function(c,u){for(var d in u)Object.prototype.hasOwnProperty.call(u,d)&&(c[d]=u[d])},extendStatics$4(a,s)};function __extends$4(a,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");extendStatics$4(a,s);function c(){this.constructor=a}a.prototype=s===null?Object.create(s):(c.prototype=s.prototype,new c)}var __assign$4=function(){return __assign$4=Object.assign||function(s){for(var c,u=1,d=arguments.length;u<d;u++){c=arguments[u];for(var p in c)Object.prototype.hasOwnProperty.call(c,p)&&(s[p]=c[p])}return s},__assign$4.apply(this,arguments)};function __rest$2(a,s){var c={};for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&s.indexOf(u)<0&&(c[u]=a[u]);if(a!=null&&typeof Object.getOwnPropertySymbols=="function")for(var d=0,u=Object.getOwnPropertySymbols(a);d<u.length;d++)s.indexOf(u[d])<0&&Object.prototype.propertyIsEnumerable.call(a,u[d])&&(c[u[d]]=a[u[d]]);return c}function __decorate$2(a,s,c,u){var d=arguments.length,p=d<3?s:u===null?u=Object.getOwnPropertyDescriptor(s,c):u,v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(a,s,c,u);else for(var A=a.length-1;A>=0;A--)(v=a[A])&&(p=(d<3?v(p):d>3?v(s,c,p):v(s,c))||p);return d>3&&p&&Object.defineProperty(s,c,p),p}function __spreadArray$2(a,s,c){for(var u=0,d=s.length,p;u<d;u++)(p||!(u in s))&&(p||(p=Array.prototype.slice.call(s,0,u)),p[u]=s[u]);return a.concat(p||Array.prototype.slice.call(s))}function getClient(a){if("touches"in a){var s=a.touches[0]||a.changedTouches[0];return{clientX:s.clientX,clientY:s.clientY}}else return{clientX:a.clientX,clientY:a.clientY}}function filterDuplicated(a){if(typeof Map>"u")return a.filter(function(c,u){return a.indexOf(c)===u});var s=new Map;return a.filter(function(c){return s.has(c)?!1:(s.set(c,!0),!0)})}function elementFromPoint(a,s,c){var u=getDocument(a);return u.elementFromPoint&&u.elementFromPoint(s,c)||null}function createElement(a,s,c){var u=a.tag,d=a.children,p=a.attributes,v=a.className,A=a.style,x=s||getDocument(c).createElement(u);for(var g in p)x.setAttribute(g,p[g]);var b=x.children;if(d.forEach(function(f,m){createElement(f,b[m],x)}),v&&v.split(/\s+/g).forEach(function(f){f&&!hasClass(x,f)&&addClass(x,f)}),A){var y=x.style;for(var g in A)y[g]=A[g]}return!s&&c&&c.appendChild(x),x}function h(a,s){for(var c=[],u=2;u<arguments.length;u++)c[u-2]=arguments[u];var d=s||{},p=d.className,v=p===void 0?"":p,A=d.style,x=A===void 0?{}:A,g=__rest$2(d,["className","style"]);return{tag:a,className:v,style:x,attributes:g,children:c}}function diffValue(a,s,c){a!==s&&c(a,s)}function getRect$1(a,s,c){var u;c===void 0&&(c=a.data.boundArea);var d=a.distX,p=d===void 0?0:d,v=a.distY,A=v===void 0?0:v,x=a.data,g=x.startX,b=x.startY;if(s>0){var y=Math.sqrt((p*p+A*A)/(1+s*s)),f=s*y;p=(p>=0?1:-1)*f,A=(A>=0?1:-1)*y}var m=Math.abs(p),E=Math.abs(A),w=p<0?g-c.left:c.right-g,S=A<0?b-c.top:c.bottom-b;u=calculateBoundSize([m,E],[0,0],[w,S],!!s),m=u[0],E=u[1],p=(p>=0?1:-1)*m,A=(A>=0?1:-1)*E;var $=Math.min(0,p),T=Math.min(0,A),I=g+$,_=b+T;return{left:I,top:_,right:I+m,bottom:_+E,width:m,height:E}}function getDefaultElementRect(a){var s=a.getBoundingClientRect(),c=s.left,u=s.top,d=s.width,p=s.height;return{pos1:[c,u],pos2:[c+d,u],pos3:[c,u+p],pos4:[c+d,u+p]}}function passTargets(a,s,c){var u=diff(a,s),d=u.list,p=u.prevList,v=u.added,A=u.removed,x=u.maintained;return __spreadArray$2(__spreadArray$2(__spreadArray$2([],v.map(function(g){return d[g]}),!0),A.map(function(g){return p[g]}),!0),c?x.map(function(g){var b=g[1];return d[b]}):[])}function getLineSize(a){for(var s=0,c=a.length,u=1;u<c;++u)s=Math.max(getDist$2(a[u],a[u-1]),s);return s}var injector=styled$1(`
643
643
  :host {
644
644
  position: fixed;
645
645
  display: none;
@@ -1029,7 +1029,7 @@ canvas {
1029
1029
  .adder.dragging {
1030
1030
  display: block;
1031
1031
  }
1032
- `);__spreadArray(["className","rulerStyle","snapThreshold","snaps","displayDragPos","cspNonce","dragPosFormat","defaultGuides","showGuides","scrollOptions","guideStyle","guidesOffset","digit","defaultGuidesPos","dragGuideStyle","displayGuidePos","guidePosFormat","guidePosStyle","lockGuides","guidesZoom"],PROPERTIES,!0);var GuidesElement=styled("div",GUIDES_CSS),Guides=(function(a){__extends(s,a);function s(u){var d=a.call(this,u)||this;return d.state={guides:[]},d.scrollPos=0,d.managerRef=reactExports.createRef(),d.guideElements=[],d._isFirstMove=!1,d._zoom=1,d._guidesZoom=1,d._observer=null,d.onDragStart=function(p){var v=p.datas,A=p.inputEvent;d._isFirstMove=!0,d.movePos(p),d.props.onDragStart(__assign(__assign({},p),{dragElement:v.target})),d.gesto.isFlag()&&(A.stopPropagation(),A.preventDefault(),d._startDragScroll(p))},d._onDrag=function(p){d._isFirstMove&&(d._isFirstMove=!1,addClass(p.datas.target,DRAGGING));var v=d.movePos(p);if(d.props.onDrag(__assign(__assign({},p),{dragElement:p.datas.target})),!d.gesto.isFlag()){d._endDragScroll(p);return}return d._dragScroll(p),v},d.onDragEnd=function(p){var v=p.datas,A=p.isDouble,x=p.distX,g=p.distY,b=d.movePos(p),y=d.state.guides,f=d.props,m=f.onChangeGuides,E=f.displayDragPos,w=f.digit,S=f.lockGuides,$=f.guidesOffset,T=d._guidesZoom,I=parseFloat((b/T).toFixed(w||0)),_=d.scrollPos-($||0);if(E&&(d.displayElement.style.cssText+="display: none;"),removeClass(v.target,DRAGGING),d.props.onDragEnd(__assign(__assign({},p),{dragElement:v.target})),d._endDragScroll(p),v.fromRuler)d._isFirstMove&&d.props.onClickRuler(__assign(__assign({},p),{pos:0})),I>=_&&y.indexOf(I)<0&&d.setState({guides:__spreadArray(__spreadArray([],y,!0),[I],!1)},function(){m({guides:d.state.guides,distX:x,distY:g,index:y.length,isAdd:!0,isRemove:!1,isChange:!1})});else{var C=parseFloat(v.target.getAttribute("data-index")),P=!1,O=!1;y=__spreadArray([],y,!0);var L=y.indexOf(I);if(A||I<_||L>-1&&L!==C){if(S&&(S===!0||S.indexOf("remove")>-1))return;y.splice(C,1),P=!0}else{if(L>-1)return;if(S&&(S===!0||S.indexOf("change")>-1))return;y[C]=I,O=!0}d.setState({guides:y},function(){var B=d.state.guides;m({distX:x,distY:g,guides:B,isAdd:!1,index:C,isChange:O,isRemove:P})})}},d._onCheck=function(){d.resize()},d.state.guides=u.defaultGuides||[],d.scrollPos=u.defaultGuidesPos||0,d}var c=s.prototype;return c.render=function(){var u=this.props,d=u.className,p=u.type,v=u.zoom,A=u.guidesZoom,x=u.style,g=u.rulerStyle,b=u.displayDragPos,y=u.cspNonce,f=u.dragGuideStyle,m=u.guidePosStyle,E=m===void 0?{}:m,w=this.props,S=this.getTranslateName(),$={};return PROPERTIES.forEach(function(T){T==="style"||T==="warpSelf"||T==="useResizeObserver"||($[T]=w[T])}),this._zoom=v,this._guidesZoom=A||v,reactExports.createElement(GuidesElement,{ref:this.managerRef,cspNonce:y,className:"".concat(prefix("manager",p)," ").concat(d),style:x},reactExports.createElement("div",{className:prefix("guide-origin"),ref:ref(this,"originElement")}),reactExports.createElement(Ruler,__assign({ref:ref(this,"ruler"),style:g},$)),reactExports.createElement("div",{className:GUIDES,ref:ref(this,"guidesElement"),style:{transform:"".concat(S,"(").concat(-this.scrollPos*this._guidesZoom,"px)")}},b&&reactExports.createElement("div",{className:DISPLAY_DRAG,ref:ref(this,"displayElement"),style:E||{}}),reactExports.createElement("div",{className:ADDER,ref:ref(this,"adderElement"),style:f}),this.renderGuides()))},c.drawRuler=function(u){this.ruler.draw(u)},c.renderGuides=function(){var u=this,d=this.props,p=d,v=p.type,A=p.showGuides,x=p.guideStyle,g=p.displayGuidePos,b=p.guidePosStyle,y=b===void 0?{}:b,f=p.guidesOffset,m=this._guidesZoom,E=this.getTranslateName(),w=this.state.guides,S=d.guidePosFormat||d.dragPosFormat||function($){return $};if(this.guideElements=[],A)return w.map(function($,T){var I=$+(f||0);return reactExports.createElement("div",{className:prefix("guide",v),ref:refs(u,"guideElements",T),key:T,"data-index":T,"data-pos":$,style:__assign(__assign({},x),{transform:"".concat(E,"(").concat(I*m,"px) translateZ(0px)")})},g&&reactExports.createElement("div",{className:prefix("guide-pos"),style:y||{}},S($)))})},c.componentDidMount=function(){var u=this;this.gesto=new Gesto(this.managerRef.current,{container:document.body}).on("dragStart",function(d){var p=u.props,v=p.type,A=p.lockGuides,x=u._guidesZoom;if(A===!0){d.stop();return}var g=d.inputEvent,b=g.target,y=d.datas,f=u.ruler.canvasElement,m=u.guidesElement,E=v==="horizontal",w=u.originElement.getBoundingClientRect(),S=getDistElementMatrix(u.managerRef.current),$=calculateMatrixDist(S,[d.clientX-w.left,d.clientY-w.top]);$[0]-=m.offsetLeft,$[1]-=m.offsetTop,$[E?1:0]+=u.scrollPos*x,y.offsetPos=$,y.matrix=S;var T=A&&A.indexOf("add")>-1,I=A&&A.indexOf("remove")>-1,_=A&&A.indexOf("change")>-1;if(b===f){if(T){d.stop();return}y.fromRuler=!0,y.target=u.adderElement}else if(hasClass(b,GUIDE)){if(I&&_){d.stop();return}y.target=b}else return d.stop(),!1;u.onDragStart(d)}).on("drag",this._onDrag).on("dragEnd",this.onDragEnd),this.props.useResizeObserver?(this._observer=new ResizeObserver(this._onCheck),this._observer.observe(this.guidesElement,{box:"border-box"}),this._observer.observe(this.getRulerElement(),{box:"border-box"})):this._onCheck()},c.componentWillUnmount=function(){var u;this.gesto.unset(),(u=this._observer)===null||u===void 0||u.disconnect()},c.componentDidUpdate=function(u){var d=this.props.defaultGuides;u.defaultGuides!==d&&this.setState({guides:d||[]})},c.loadGuides=function(u){this.setState({guides:u})},c.getGuides=function(){return this.state.guides},c.scrollGuides=function(u,d){d===void 0&&(d=this._guidesZoom),this._setZoom({guidesZoom:d});var p=this.getTranslateName(),v=this.guidesElement;this.scrollPos=u,v.style.transform="".concat(p,"(").concat(-u*d,"px)");var A=this.state.guides,x=this.props.guidesOffset||0;this.guideElements.forEach(function(g,b){if(g){var y=A[b]+(x||0);g.style.transform="".concat(p,"(").concat(y*d,"px) translateZ(0px)"),g.style.display=-u+y<0?"none":"block"}})},c.zoomTo=function(u,d){d===void 0&&(d=u),this.scroll(this.getRulerScrollPos(),u),this.scrollGuides(this.getGuideScrollPos(),d)},c.getElement=function(){return this.managerRef.current},c.getRulerElement=function(){return this.ruler.canvasElement},c.getGuideScrollPos=function(){return this.scrollPos},c.getRulerScrollPos=function(){return this.ruler.getScrollPos()},c.scroll=function(u,d){d===void 0&&(d=this._zoom),this._setZoom({zoom:d}),this.ruler.scroll(u,d)},c.resize=function(u){u===void 0&&(u=this._zoom),this._setZoom({zoom:u}),this.ruler.resize(u)},c.movePos=function(u){var d=u.datas,p=u.distX,v=u.distY,A=this.props,x=A.type,g=A.snaps,b=A.snapThreshold,y=A.displayDragPos,f=A.digit,m=A.guidesOffset||0,E=this._guidesZoom,w=A.dragPosFormat||function(D){return D},S=x==="horizontal",$=calculateMatrixDist(d.matrix,[p,v]),T=d.offsetPos,I=$[0]+T[0],_=$[1]+T[1],C=m*E,P=Math.round(S?_:I)-m,O=parseFloat((P/E).toFixed(f||0)),L=g.slice().sort(function(D,G){return Math.abs(O-D)-Math.abs(O-G)});if(L.length&&Math.abs(L[0]*E-P)<b&&(O=L[0],P=O*E),!d.fromRuler||!this._isFirstMove){if(y){var B=x==="horizontal"?[I,P+C]:[P+C,_];this.displayElement.style.cssText+="display: block;transform: translate(-50%, -50%) "+"translate(".concat(B.map(function(D){return"".concat(D,"px")}).join(", "),")"),this.displayElement.innerHTML="".concat(w(O))}var F=d.target;F.setAttribute("data-pos",O),F.style.transform="".concat(this.getTranslateName(),"(").concat(P+m*E,"px)")}return P},c.getTranslateName=function(){return this.props.type==="horizontal"?"translateY":"translateX"},c._startDragScroll=function(u){var d=this,p=this.props.scrollOptions;if(p){var v=u.datas,A=new DragScroll;v.dragScroll=A,A.on("scroll",function(x){var g,b,y=x.container,f=x.direction;(b=(g=d.props).onRequestScroll)===null||b===void 0||b.call(g,{container:y,direction:f})}).on("move",function(x){var g=x.offsetX,b=x.offsetY,y=x.inputEvent;d.gesto.scrollBy(g,b,y.inputEvent,!0)}),A.dragStart(u,{container:p.container})}},c._dragScroll=function(u){var d=this.props.scrollOptions;if(d){var p=u.datas.dragScroll;p.drag(u,d)}},c._endDragScroll=function(u){var d;(d=u.datas.dragScroll)===null||d===void 0||d.dragEnd(),u.datas.dragScroll=null},c._setZoom=function(u){var d=u.zoom,p=u.guidesZoom;this.props.zoom;var v=!!this.props.guidesZoom;v?p&&(this._guidesZoom=p):(p&&(this._zoom=p,this._guidesZoom=p),d&&(this._guidesZoom=d)),d&&(this._zoom=d)},s.defaultProps={className:"",type:"horizontal",zoom:1,guidesZoom:0,style:{},snapThreshold:5,snaps:[],digit:0,onClickRuler:function(){},onChangeGuides:function(){},onRequestScroll:function(){},onDragStart:function(){},onDrag:function(){},onDragEnd:function(){},displayDragPos:!1,dragPosFormat:function(u){return u},defaultGuides:[],lockGuides:!1,showGuides:!0,guideStyle:{},dragGuideStyle:{},guidePosStyle:{},defaultGuidesPos:0},s})(reactExports.PureComponent);const guideStyle=(a,s,c,u)=>({position:"absolute",top:a,left:s,height:c,width:u,background:"#333333"}),_Guides=({paperSize:a,horizontalRef:s,verticalRef:c})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"ruler-container",style:guideStyle(-RULER_HEIGHT,-RULER_HEIGHT,RULER_HEIGHT,RULER_HEIGHT)}),jsxRuntimeExports.jsx(Guides,{zoom:ZOOM,style:guideStyle(-RULER_HEIGHT,0,RULER_HEIGHT,a.width),type:"horizontal",ref:s}),jsxRuntimeExports.jsx(Guides,{zoom:ZOOM,style:guideStyle(0,-RULER_HEIGHT,a.height,RULER_HEIGHT),type:"vertical",ref:c})]}),Mask=({width:a,height:s})=>jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:-RULER_HEIGHT,left:-RULER_HEIGHT,zIndex:100,width:a,height:s,background:theme.useToken().token.colorBgMask}}),getPaddingStyle=(a,s,c)=>{const u={position:"absolute",background:c,opacity:.25,pointerEvents:"none"};switch(a){case 0:u.top=0,u.height=`${s*ZOOM}px`,u.left=0,u.right=0;break;case 1:u.right=0,u.width=`${s*ZOOM}px`,u.top=0,u.bottom=0;break;case 2:u.bottom=0,u.height=`${s*ZOOM}px`,u.left=0,u.right=0;break;case 3:u.left=0,u.width=`${s*ZOOM}px`,u.top=0,u.bottom=0;break}return u},Padding=({basePdf:a})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:isBlankPdf(a)&&a.padding.map((s,c)=>jsxRuntimeExports.jsx("div",{style:getPaddingStyle(c,s,theme.useToken().token.colorError)},String(c)))}),StaticSchema=a=>{const{template:{schemas:s,basePdf:c},input:u,scale:d,totalPages:p,currentPage:v}=a;return!isBlankPdf(c)||!c.staticSchema?null:jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:c.staticSchema.map(A=>jsxRuntimeExports.jsx(Renderer,{schema:{...A,id:uuid$6()},basePdf:c,value:A.readOnly?replacePlaceholders({content:A.content||"",variables:{...u,totalPages:p,currentPage:v},schemas:s}):A.content||"",onChangeHoveringSchemaId:()=>{},mode:"viewer",outline:"none",scale:d,selectable:!1},A.name))})},mm2px=a=>a*3.7795275591,DELETE_BTN_ID=uuid$6(),fmt4Num=a=>Number(a.replace("px","")),fmt=a=>round$1(fmt4Num(a)/ZOOM,2),isTopLeftResize=a=>a==="-1,-1"||a==="-1,0"||a==="0,-1",normalizeRotate=a=>(a%360+360)%360,DeleteButton=({activeElements:a})=>{const{token:s}=theme.useToken(),c=26,u=Math.min(...a.map(({style:p})=>fmt4Num(p.top))),d=Math.max(...a.map(({style:p})=>fmt4Num(p.left)+fmt4Num(p.width)))+10;return jsxRuntimeExports.jsx(Button$1,{id:DELETE_BTN_ID,style:{position:"absolute",zIndex:1,top:u,left:d,width:c,height:c,padding:2,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:s.borderRadius,color:s.colorWhite,background:s.colorPrimary},children:jsxRuntimeExports.jsx(X,{style:{pointerEvents:"none"}})})},Canvas$1=(a,s)=>{const{basePdf:c,pageCursor:u,scale:d,backgrounds:p,pageSizes:v,size:A,activeElements:x,schemasList:g,hoveringSchemaId:b,onEdit:y,changeSchemas:f,removeSchemas:m,onChangeHoveringSchemaId:E,paperRefs:w,sidebarOpen:S}=a,{token:$}=theme.useToken(),T=reactExports.useContext(PluginsRegistry),I=reactExports.useRef([]),_=reactExports.useRef([]),C=reactExports.useRef(null),[P,O]=reactExports.useState(!1),[L,B]=reactExports.useState(!1),F=usePrevious(g[u]),D=ee=>{ee.shiftKey&&O(!0)},G=ee=>{(ee.key==="Shift"||!ee.shiftKey)&&O(!1),(ee.key==="Escape"||ee.key==="Esc")&&B(!1)},j=reactExports.useCallback(()=>{window.addEventListener("keydown",D),window.addEventListener("keyup",G)},[]),V=reactExports.useCallback(()=>{window.removeEventListener("keydown",D),window.removeEventListener("keyup",G)},[]);reactExports.useEffect(()=>(j(),V),[j,V]),reactExports.useEffect(()=>{if(C.current?.updateRect(),!F)return;const ee=JSON.stringify(F[u]||{}),Y=JSON.stringify(g[u]||{});ee===Y&&C.current?.updateRect()},[u,g,F]);const U=({target:ee,top:Y,left:J})=>{const{width:re,height:ae}=ee.style,oe=fmt(re),se=fmt(ae),fe=Y/ZOOM,pe=J/ZOOM,{width:ge,height:me}=v[u];let be=0,le=0,ve=0,he=0;if(isBlankPdf(c)){const[ye,Ee,xe,we]=c.padding;be=ye*ZOOM,le=Ee,ve=xe,he=we*ZOOM}fe+se>me-ve?ee.style.top=`${(me-se-ve)*ZOOM}px`:ee.style.top=`${Y<be?be:Y}px`,pe+oe>ge-le?ee.style.left=`${(ge-oe-le)*ZOOM}px`:ee.style.left=`${J<he?he:J}px`},M=({target:ee})=>{const{top:Y,left:J}=ee.style;f([{key:"position.y",value:fmt(Y),schemaId:ee.id},{key:"position.x",value:fmt(J),schemaId:ee.id}])},N=({targets:ee})=>{const Y=ee.map(({style:{top:J,left:re},id:ae})=>[{key:"position.y",value:fmt(J),schemaId:ae},{key:"position.x",value:fmt(re),schemaId:ae}]);f(flatten(Y))},R=({target:ee,rotate:Y})=>{ee.style.transform=`rotate(${Y}deg)`},k=({target:ee})=>{const{transform:Y}=ee.style,J=Number(Y.replace("rotate(","").replace("deg)","")),re=normalizeRotate(J);f([{key:"rotate",value:re,schemaId:ee.id}])},H=({targets:ee})=>{const Y=ee.map(({style:{transform:J},id:re})=>{const ae=Number(J.replace("rotate(","").replace("deg)",""));return[{key:"rotate",value:normalizeRotate(ae),schemaId:re}]});f(flatten(Y))},W=({target:ee})=>{const{id:Y,style:J}=ee,{width:re,height:ae,top:oe,left:se}=J;f([{key:"position.x",value:fmt(se),schemaId:Y},{key:"position.y",value:fmt(oe),schemaId:Y},{key:"width",value:fmt(re),schemaId:Y},{key:"height",value:fmt(ae),schemaId:Y}]);const fe=g[u].find(pe=>pe.id===Y);fe&&(fe.position.x=fmt(se),fe.position.y=fmt(oe),fe.width=fmt(re),fe.height=fmt(ae))},Z=({targets:ee})=>{const Y=ee.map(({style:{width:J,height:re,top:ae,left:oe},id:se})=>[{key:"width",value:fmt(J),schemaId:se},{key:"height",value:fmt(re),schemaId:se},{key:"position.y",value:fmt(ae),schemaId:se},{key:"position.x",value:fmt(oe),schemaId:se}]);f(flatten(Y))},te=({target:ee,width:Y,height:J,direction:re})=>{if(!ee)return;let ae=0,oe=0,se=0,fe=0;if(isBlankPdf(c)){const[ye,Ee,xe,we]=c.padding;ae=ye*ZOOM,oe=mm2px(Ee),se=mm2px(xe),fe=we*ZOOM}const pe=mm2px(v[u].width),ge=mm2px(v[u].height),me={width:`${Y}px`,height:`${J}px`},be=ee.style;let le=fmt4Num(be.left)+(fmt4Num(be.width)-Y),ve=fmt4Num(be.top)+(fmt4Num(be.height)-J);le<fe&&(le=fe),ve<ae&&(ve=ae),le+Y>pe-oe&&(me.width=`${pe-oe-le}px`),ve+J>ge-se&&(me.height=`${ge-se-ve}px`);const he=re.toString();isTopLeftResize(he)?(me.top=`${ve}px`,me.left=`${le}px`):he==="1,-1"?me.top=`${ve}px`:he==="-1,1"&&(me.left=`${le}px`),Object.assign(be,me)},K=(ee,Y)=>ee[Y]&&ee[Y].getGuides().map(J=>J*ZOOM),q=()=>{B(!0)},Q=reactExports.useMemo(()=>{const Y=(g[u]||[]).filter(ae=>x.map(oe=>oe.id).includes(ae.id)).map(ae=>ae.type),J=[...new Set(Y)],re=[];return T.entries().forEach(([,ae])=>{ae.propPanel.defaultSchema&&re.push(ae.propPanel.defaultSchema)}),J.every(ae=>{const oe=re.find(se=>se&&"type"in se&&se.type===ae);return oe&&"rotate"in oe})},[x,u,g,T]);return jsxRuntimeExports.jsxs("div",{style:{position:"relative",overflow:"auto",marginRight:S?RIGHT_SIDEBAR_WIDTH:0,...A},ref:s,children:[jsxRuntimeExports.jsx(Selecto,{container:w.current[u],continueSelect:P,onDragStart:ee=>{const Y=ee.inputEvent,J=Y.target,re=C.current?.isMoveableElement(J);(Y.type==="touchstart"&&ee.isTrusted||re)&&ee.stop(),w.current[u]===J&&y([]);const ae=J;ae&&ae.id===DELETE_BTN_ID&&m(x.map(oe=>oe.id))},onSelect:ee=>{const Y=ee.inputEvent,J=ee.added,re=ee.removed,ae=ee.selected,oe=Y.type==="mousedown";let se=oe?ae:[];!oe&&J.length>0&&(se=x.concat(J)),!oe&&re.length>0&&(se=x.filter(pe=>!re.includes(pe))),y(se),se!=x&&B(!1);const fe=Y;fe&&typeof fe.shiftKey=="boolean"&&!fe.shiftKey&&O(!1)}}),jsxRuntimeExports.jsx(Paper,{paperRefs:w,scale:d,size:A,schemasList:g,pageSizes:v,backgrounds:p,hasRulers:!0,renderPaper:({index:ee,paperSize:Y})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!L&&x.length>0&&u===ee&&jsxRuntimeExports.jsx(DeleteButton,{activeElements:x}),jsxRuntimeExports.jsx(Padding,{basePdf:c}),jsxRuntimeExports.jsx(StaticSchema,{template:{schemas:g,basePdf:c},input:Object.fromEntries(g.flat().map(({name:J,content:re=""})=>[J,re])),scale:d,totalPages:g.length,currentPage:ee+1}),jsxRuntimeExports.jsx(_Guides,{paperSize:Y,horizontalRef:J=>{J&&(_.current[ee]=J)},verticalRef:J=>{J&&(I.current[ee]=J)}}),u!==ee?jsxRuntimeExports.jsx(Mask,{width:Y.width+RULER_HEIGHT,height:Y.height+RULER_HEIGHT}):!L&&jsxRuntimeExports.jsx(Moveable,{ref:C,target:x,bounds:{left:0,top:0,bottom:Y.height,right:Y.width},horizontalGuidelines:K(_.current,ee),verticalGuidelines:K(I.current,ee),keepRatio:P,rotatable:Q,onDrag:U,onDragEnd:M,onDragGroupEnd:N,onRotate:R,onRotateEnd:k,onRotateGroupEnd:H,onResize:te,onResizeEnd:W,onResizeGroupEnd:Z,onClick:q})]}),renderSchema:({schema:ee,index:Y})=>{const J=L&&x.map(oe=>oe.id).includes(ee.id)?"designer":"viewer",re=ee.content||"";let ae=re;if(J!=="designer"&&ee.readOnly){const oe={...g.flat().reduce((se,fe)=>(se[fe.name]=fe.content||"",se),{}),totalPages:g.length,currentPage:Y+1};ae=replacePlaceholders({content:re,variables:oe,schemas:g})}return jsxRuntimeExports.jsx(Renderer,{schema:ee,basePdf:c,value:ae,onChangeHoveringSchemaId:E,mode:J,onChange:(g[u]||[]).some(oe=>oe.id===ee.id)?oe=>{const se=Array.isArray(oe)?oe:[oe];f(se.map(({key:fe,value:pe})=>({key:fe,value:pe,schemaId:ee.id})))}:void 0,stopEditing:()=>B(!1),outline:`1px ${b===ee.id?"solid":"dashed"} ${ee.readOnly&&b!==ee.id?"transparent":$.colorPrimary}`,scale:d},ee.id)}})]})},Canvas=reactExports.forwardRef(Canvas$1),Spinner=()=>{const{token:a}=theme.useToken(),s={position:"relative",width:"100%",height:"100%",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",color:a.colorPrimary},c={animation:"spin 1s linear infinite"};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("style",{children:`
1032
+ `);__spreadArray(["className","rulerStyle","snapThreshold","snaps","displayDragPos","cspNonce","dragPosFormat","defaultGuides","showGuides","scrollOptions","guideStyle","guidesOffset","digit","defaultGuidesPos","dragGuideStyle","displayGuidePos","guidePosFormat","guidePosStyle","lockGuides","guidesZoom"],PROPERTIES,!0);var GuidesElement=styled("div",GUIDES_CSS),Guides=(function(a){__extends(s,a);function s(u){var d=a.call(this,u)||this;return d.state={guides:[]},d.scrollPos=0,d.managerRef=reactExports.createRef(),d.guideElements=[],d._isFirstMove=!1,d._zoom=1,d._guidesZoom=1,d._observer=null,d.onDragStart=function(p){var v=p.datas,A=p.inputEvent;d._isFirstMove=!0,d.movePos(p),d.props.onDragStart(__assign(__assign({},p),{dragElement:v.target})),d.gesto.isFlag()&&(A.stopPropagation(),A.preventDefault(),d._startDragScroll(p))},d._onDrag=function(p){d._isFirstMove&&(d._isFirstMove=!1,addClass(p.datas.target,DRAGGING));var v=d.movePos(p);if(d.props.onDrag(__assign(__assign({},p),{dragElement:p.datas.target})),!d.gesto.isFlag()){d._endDragScroll(p);return}return d._dragScroll(p),v},d.onDragEnd=function(p){var v=p.datas,A=p.isDouble,x=p.distX,g=p.distY,b=d.movePos(p),y=d.state.guides,f=d.props,m=f.onChangeGuides,E=f.displayDragPos,w=f.digit,S=f.lockGuides,$=f.guidesOffset,T=d._guidesZoom,I=parseFloat((b/T).toFixed(w||0)),_=d.scrollPos-($||0);if(E&&(d.displayElement.style.cssText+="display: none;"),removeClass(v.target,DRAGGING),d.props.onDragEnd(__assign(__assign({},p),{dragElement:v.target})),d._endDragScroll(p),v.fromRuler)d._isFirstMove&&d.props.onClickRuler(__assign(__assign({},p),{pos:0})),I>=_&&y.indexOf(I)<0&&d.setState({guides:__spreadArray(__spreadArray([],y,!0),[I],!1)},function(){m({guides:d.state.guides,distX:x,distY:g,index:y.length,isAdd:!0,isRemove:!1,isChange:!1})});else{var C=parseFloat(v.target.getAttribute("data-index")),P=!1,O=!1;y=__spreadArray([],y,!0);var L=y.indexOf(I);if(A||I<_||L>-1&&L!==C){if(S&&(S===!0||S.indexOf("remove")>-1))return;y.splice(C,1),P=!0}else{if(L>-1)return;if(S&&(S===!0||S.indexOf("change")>-1))return;y[C]=I,O=!0}d.setState({guides:y},function(){var B=d.state.guides;m({distX:x,distY:g,guides:B,isAdd:!1,index:C,isChange:O,isRemove:P})})}},d._onCheck=function(){d.resize()},d.state.guides=u.defaultGuides||[],d.scrollPos=u.defaultGuidesPos||0,d}var c=s.prototype;return c.render=function(){var u=this.props,d=u.className,p=u.type,v=u.zoom,A=u.guidesZoom,x=u.style,g=u.rulerStyle,b=u.displayDragPos,y=u.cspNonce,f=u.dragGuideStyle,m=u.guidePosStyle,E=m===void 0?{}:m,w=this.props,S=this.getTranslateName(),$={};return PROPERTIES.forEach(function(T){T==="style"||T==="warpSelf"||T==="useResizeObserver"||($[T]=w[T])}),this._zoom=v,this._guidesZoom=A||v,reactExports.createElement(GuidesElement,{ref:this.managerRef,cspNonce:y,className:"".concat(prefix("manager",p)," ").concat(d),style:x},reactExports.createElement("div",{className:prefix("guide-origin"),ref:ref(this,"originElement")}),reactExports.createElement(Ruler,__assign({ref:ref(this,"ruler"),style:g},$)),reactExports.createElement("div",{className:GUIDES,ref:ref(this,"guidesElement"),style:{transform:"".concat(S,"(").concat(-this.scrollPos*this._guidesZoom,"px)")}},b&&reactExports.createElement("div",{className:DISPLAY_DRAG,ref:ref(this,"displayElement"),style:E||{}}),reactExports.createElement("div",{className:ADDER,ref:ref(this,"adderElement"),style:f}),this.renderGuides()))},c.drawRuler=function(u){this.ruler.draw(u)},c.renderGuides=function(){var u=this,d=this.props,p=d,v=p.type,A=p.showGuides,x=p.guideStyle,g=p.displayGuidePos,b=p.guidePosStyle,y=b===void 0?{}:b,f=p.guidesOffset,m=this._guidesZoom,E=this.getTranslateName(),w=this.state.guides,S=d.guidePosFormat||d.dragPosFormat||function($){return $};if(this.guideElements=[],A)return w.map(function($,T){var I=$+(f||0);return reactExports.createElement("div",{className:prefix("guide",v),ref:refs(u,"guideElements",T),key:T,"data-index":T,"data-pos":$,style:__assign(__assign({},x),{transform:"".concat(E,"(").concat(I*m,"px) translateZ(0px)")})},g&&reactExports.createElement("div",{className:prefix("guide-pos"),style:y||{}},S($)))})},c.componentDidMount=function(){var u=this;this.gesto=new Gesto(this.managerRef.current,{container:document.body}).on("dragStart",function(d){var p=u.props,v=p.type,A=p.lockGuides,x=u._guidesZoom;if(A===!0){d.stop();return}var g=d.inputEvent,b=g.target,y=d.datas,f=u.ruler.canvasElement,m=u.guidesElement,E=v==="horizontal",w=u.originElement.getBoundingClientRect(),S=getDistElementMatrix(u.managerRef.current),$=calculateMatrixDist(S,[d.clientX-w.left,d.clientY-w.top]);$[0]-=m.offsetLeft,$[1]-=m.offsetTop,$[E?1:0]+=u.scrollPos*x,y.offsetPos=$,y.matrix=S;var T=A&&A.indexOf("add")>-1,I=A&&A.indexOf("remove")>-1,_=A&&A.indexOf("change")>-1;if(b===f){if(T){d.stop();return}y.fromRuler=!0,y.target=u.adderElement}else if(hasClass(b,GUIDE)){if(I&&_){d.stop();return}y.target=b}else return d.stop(),!1;u.onDragStart(d)}).on("drag",this._onDrag).on("dragEnd",this.onDragEnd),this.props.useResizeObserver?(this._observer=new ResizeObserver(this._onCheck),this._observer.observe(this.guidesElement,{box:"border-box"}),this._observer.observe(this.getRulerElement(),{box:"border-box"})):this._onCheck()},c.componentWillUnmount=function(){var u;this.gesto.unset(),(u=this._observer)===null||u===void 0||u.disconnect()},c.componentDidUpdate=function(u){var d=this.props.defaultGuides;u.defaultGuides!==d&&this.setState({guides:d||[]})},c.loadGuides=function(u){this.setState({guides:u})},c.getGuides=function(){return this.state.guides},c.scrollGuides=function(u,d){d===void 0&&(d=this._guidesZoom),this._setZoom({guidesZoom:d});var p=this.getTranslateName(),v=this.guidesElement;this.scrollPos=u,v.style.transform="".concat(p,"(").concat(-u*d,"px)");var A=this.state.guides,x=this.props.guidesOffset||0;this.guideElements.forEach(function(g,b){if(g){var y=A[b]+(x||0);g.style.transform="".concat(p,"(").concat(y*d,"px) translateZ(0px)"),g.style.display=-u+y<0?"none":"block"}})},c.zoomTo=function(u,d){d===void 0&&(d=u),this.scroll(this.getRulerScrollPos(),u),this.scrollGuides(this.getGuideScrollPos(),d)},c.getElement=function(){return this.managerRef.current},c.getRulerElement=function(){return this.ruler.canvasElement},c.getGuideScrollPos=function(){return this.scrollPos},c.getRulerScrollPos=function(){return this.ruler.getScrollPos()},c.scroll=function(u,d){d===void 0&&(d=this._zoom),this._setZoom({zoom:d}),this.ruler.scroll(u,d)},c.resize=function(u){u===void 0&&(u=this._zoom),this._setZoom({zoom:u}),this.ruler.resize(u)},c.movePos=function(u){var d=u.datas,p=u.distX,v=u.distY,A=this.props,x=A.type,g=A.snaps,b=A.snapThreshold,y=A.displayDragPos,f=A.digit,m=A.guidesOffset||0,E=this._guidesZoom,w=A.dragPosFormat||function(D){return D},S=x==="horizontal",$=calculateMatrixDist(d.matrix,[p,v]),T=d.offsetPos,I=$[0]+T[0],_=$[1]+T[1],C=m*E,P=Math.round(S?_:I)-m,O=parseFloat((P/E).toFixed(f||0)),L=g.slice().sort(function(D,G){return Math.abs(O-D)-Math.abs(O-G)});if(L.length&&Math.abs(L[0]*E-P)<b&&(O=L[0],P=O*E),!d.fromRuler||!this._isFirstMove){if(y){var B=x==="horizontal"?[I,P+C]:[P+C,_];this.displayElement.style.cssText+="display: block;transform: translate(-50%, -50%) "+"translate(".concat(B.map(function(D){return"".concat(D,"px")}).join(", "),")"),this.displayElement.innerHTML="".concat(w(O))}var F=d.target;F.setAttribute("data-pos",O),F.style.transform="".concat(this.getTranslateName(),"(").concat(P+m*E,"px)")}return P},c.getTranslateName=function(){return this.props.type==="horizontal"?"translateY":"translateX"},c._startDragScroll=function(u){var d=this,p=this.props.scrollOptions;if(p){var v=u.datas,A=new DragScroll;v.dragScroll=A,A.on("scroll",function(x){var g,b,y=x.container,f=x.direction;(b=(g=d.props).onRequestScroll)===null||b===void 0||b.call(g,{container:y,direction:f})}).on("move",function(x){var g=x.offsetX,b=x.offsetY,y=x.inputEvent;d.gesto.scrollBy(g,b,y.inputEvent,!0)}),A.dragStart(u,{container:p.container})}},c._dragScroll=function(u){var d=this.props.scrollOptions;if(d){var p=u.datas.dragScroll;p.drag(u,d)}},c._endDragScroll=function(u){var d;(d=u.datas.dragScroll)===null||d===void 0||d.dragEnd(),u.datas.dragScroll=null},c._setZoom=function(u){var d=u.zoom,p=u.guidesZoom;this.props.zoom;var v=!!this.props.guidesZoom;v?p&&(this._guidesZoom=p):(p&&(this._zoom=p,this._guidesZoom=p),d&&(this._guidesZoom=d)),d&&(this._zoom=d)},s.defaultProps={className:"",type:"horizontal",zoom:1,guidesZoom:0,style:{},snapThreshold:5,snaps:[],digit:0,onClickRuler:function(){},onChangeGuides:function(){},onRequestScroll:function(){},onDragStart:function(){},onDrag:function(){},onDragEnd:function(){},displayDragPos:!1,dragPosFormat:function(u){return u},defaultGuides:[],lockGuides:!1,showGuides:!0,guideStyle:{},dragGuideStyle:{},guidePosStyle:{},defaultGuidesPos:0},s})(reactExports.PureComponent);const guideStyle=(a,s,c,u)=>({position:"absolute",top:a,left:s,height:c,width:u,background:"#333333"}),_Guides=({paperSize:a,horizontalRef:s,verticalRef:c})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"ruler-container",style:guideStyle(-RULER_HEIGHT,-RULER_HEIGHT,RULER_HEIGHT,RULER_HEIGHT)}),jsxRuntimeExports.jsx(Guides,{zoom:ZOOM,style:guideStyle(-RULER_HEIGHT,0,RULER_HEIGHT,a.width),type:"horizontal",ref:s}),jsxRuntimeExports.jsx(Guides,{zoom:ZOOM,style:guideStyle(0,-RULER_HEIGHT,a.height,RULER_HEIGHT),type:"vertical",ref:c})]}),Mask=({width:a,height:s})=>jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:-RULER_HEIGHT,left:-RULER_HEIGHT,zIndex:100,width:a,height:s,background:theme.useToken().token.colorBgMask}}),getPaddingStyle=(a,s,c)=>{const u={position:"absolute",background:c,opacity:.25,pointerEvents:"none"};switch(a){case 0:u.top=0,u.height=`${s*ZOOM}px`,u.left=0,u.right=0;break;case 1:u.right=0,u.width=`${s*ZOOM}px`,u.top=0,u.bottom=0;break;case 2:u.bottom=0,u.height=`${s*ZOOM}px`,u.left=0,u.right=0;break;case 3:u.left=0,u.width=`${s*ZOOM}px`,u.top=0,u.bottom=0;break}return u},Padding=({basePdf:a})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:isBlankPdf(a)&&a.padding.map((s,c)=>jsxRuntimeExports.jsx("div",{style:getPaddingStyle(c,s,theme.useToken().token.colorError)},String(c)))}),StaticSchema=a=>{const{template:{schemas:s,basePdf:c},input:u,scale:d,totalPages:p,currentPage:v}=a;return!isBlankPdf(c)||!c.staticSchema?null:jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:c.staticSchema.map(A=>jsxRuntimeExports.jsx(Renderer,{schema:{...A,id:uuid$6()},basePdf:c,value:A.readOnly?replacePlaceholders({content:A.content||"",variables:{...u,totalPages:p,currentPage:v},schemas:s}):A.content||"",onChangeHoveringSchemaId:()=>{},mode:"viewer",outline:"none",scale:d,selectable:!1},A.name))})},mm2px=a=>a*3.7795275591,DELETE_BTN_ID=uuid$6(),fmt4Num=a=>Number(a.replace("px","")),fmt=a=>round$1(fmt4Num(a)/ZOOM,2),isTopLeftResize=a=>a==="-1,-1"||a==="-1,0"||a==="0,-1",normalizeRotate=a=>(a%360+360)%360,DeleteButton=({activeElements:a})=>{const{token:s}=theme.useToken(),c=26,u=Math.min(...a.map(({style:p})=>fmt4Num(p.top))),d=Math.max(...a.map(({style:p})=>fmt4Num(p.left)+fmt4Num(p.width)))+10;return jsxRuntimeExports.jsx(Button$1,{id:DELETE_BTN_ID,className:DESIGNER_CLASSNAME+"delete-button",style:{position:"absolute",zIndex:1,top:u,left:d,width:c,height:c,padding:2,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:s.borderRadius,color:s.colorWhite,background:s.colorPrimary},children:jsxRuntimeExports.jsx(X,{style:{pointerEvents:"none"}})})},Canvas$1=(a,s)=>{const{basePdf:c,pageCursor:u,scale:d,backgrounds:p,pageSizes:v,size:A,activeElements:x,schemasList:g,hoveringSchemaId:b,onEdit:y,changeSchemas:f,removeSchemas:m,onChangeHoveringSchemaId:E,paperRefs:w,sidebarOpen:S}=a,{token:$}=theme.useToken(),T=reactExports.useContext(PluginsRegistry),I=reactExports.useRef([]),_=reactExports.useRef([]),C=reactExports.useRef(null),[P,O]=reactExports.useState(!1),[L,B]=reactExports.useState(!1),F=usePrevious(g[u]),D=ee=>{ee.shiftKey&&O(!0)},G=ee=>{(ee.key==="Shift"||!ee.shiftKey)&&O(!1),(ee.key==="Escape"||ee.key==="Esc")&&B(!1)},j=reactExports.useCallback(()=>{window.addEventListener("keydown",D),window.addEventListener("keyup",G)},[]),V=reactExports.useCallback(()=>{window.removeEventListener("keydown",D),window.removeEventListener("keyup",G)},[]);reactExports.useEffect(()=>(j(),V),[j,V]),reactExports.useEffect(()=>{if(C.current?.updateRect(),!F)return;const ee=JSON.stringify(F[u]||{}),Y=JSON.stringify(g[u]||{});ee===Y&&C.current?.updateRect()},[u,g,F]);const U=({target:ee,top:Y,left:J})=>{const{width:re,height:ae}=ee.style,oe=fmt(re),se=fmt(ae),fe=Y/ZOOM,pe=J/ZOOM,{width:ge,height:me}=v[u];let be=0,le=0,ve=0,he=0;if(isBlankPdf(c)){const[ye,Ee,xe,we]=c.padding;be=ye*ZOOM,le=Ee,ve=xe,he=we*ZOOM}fe+se>me-ve?ee.style.top=`${(me-se-ve)*ZOOM}px`:ee.style.top=`${Y<be?be:Y}px`,pe+oe>ge-le?ee.style.left=`${(ge-oe-le)*ZOOM}px`:ee.style.left=`${J<he?he:J}px`},M=({target:ee})=>{const{top:Y,left:J}=ee.style;f([{key:"position.y",value:fmt(Y),schemaId:ee.id},{key:"position.x",value:fmt(J),schemaId:ee.id}])},N=({targets:ee})=>{const Y=ee.map(({style:{top:J,left:re},id:ae})=>[{key:"position.y",value:fmt(J),schemaId:ae},{key:"position.x",value:fmt(re),schemaId:ae}]);f(flatten(Y))},R=({target:ee,rotate:Y})=>{ee.style.transform=`rotate(${Y}deg)`},k=({target:ee})=>{const{transform:Y}=ee.style,J=Number(Y.replace("rotate(","").replace("deg)","")),re=normalizeRotate(J);f([{key:"rotate",value:re,schemaId:ee.id}])},H=({targets:ee})=>{const Y=ee.map(({style:{transform:J},id:re})=>{const ae=Number(J.replace("rotate(","").replace("deg)",""));return[{key:"rotate",value:normalizeRotate(ae),schemaId:re}]});f(flatten(Y))},W=({target:ee})=>{const{id:Y,style:J}=ee,{width:re,height:ae,top:oe,left:se}=J;f([{key:"position.x",value:fmt(se),schemaId:Y},{key:"position.y",value:fmt(oe),schemaId:Y},{key:"width",value:fmt(re),schemaId:Y},{key:"height",value:fmt(ae),schemaId:Y}]);const fe=g[u].find(pe=>pe.id===Y);fe&&(fe.position.x=fmt(se),fe.position.y=fmt(oe),fe.width=fmt(re),fe.height=fmt(ae))},Z=({targets:ee})=>{const Y=ee.map(({style:{width:J,height:re,top:ae,left:oe},id:se})=>[{key:"width",value:fmt(J),schemaId:se},{key:"height",value:fmt(re),schemaId:se},{key:"position.y",value:fmt(ae),schemaId:se},{key:"position.x",value:fmt(oe),schemaId:se}]);f(flatten(Y))},te=({target:ee,width:Y,height:J,direction:re})=>{if(!ee)return;let ae=0,oe=0,se=0,fe=0;if(isBlankPdf(c)){const[ye,Ee,xe,we]=c.padding;ae=ye*ZOOM,oe=mm2px(Ee),se=mm2px(xe),fe=we*ZOOM}const pe=mm2px(v[u].width),ge=mm2px(v[u].height),me={width:`${Y}px`,height:`${J}px`},be=ee.style;let le=fmt4Num(be.left)+(fmt4Num(be.width)-Y),ve=fmt4Num(be.top)+(fmt4Num(be.height)-J);le<fe&&(le=fe),ve<ae&&(ve=ae),le+Y>pe-oe&&(me.width=`${pe-oe-le}px`),ve+J>ge-se&&(me.height=`${ge-se-ve}px`);const he=re.toString();isTopLeftResize(he)?(me.top=`${ve}px`,me.left=`${le}px`):he==="1,-1"?me.top=`${ve}px`:he==="-1,1"&&(me.left=`${le}px`),Object.assign(be,me)},K=(ee,Y)=>ee[Y]&&ee[Y].getGuides().map(J=>J*ZOOM),q=()=>{B(!0)},Q=reactExports.useMemo(()=>{const Y=(g[u]||[]).filter(ae=>x.map(oe=>oe.id).includes(ae.id)).map(ae=>ae.type),J=[...new Set(Y)],re=[];return T.entries().forEach(([,ae])=>{ae.propPanel.defaultSchema&&re.push(ae.propPanel.defaultSchema)}),J.every(ae=>{const oe=re.find(se=>se&&"type"in se&&se.type===ae);return oe&&"rotate"in oe})},[x,u,g,T]);return jsxRuntimeExports.jsxs("div",{className:DESIGNER_CLASSNAME+"canvas",style:{position:"relative",overflow:"auto",marginRight:S?RIGHT_SIDEBAR_WIDTH:0,...A},ref:s,children:[jsxRuntimeExports.jsx(Selecto,{container:w.current[u],continueSelect:P,onDragStart:ee=>{const Y=ee.inputEvent,J=Y.target,re=C.current?.isMoveableElement(J);(Y.type==="touchstart"&&ee.isTrusted||re)&&ee.stop(),w.current[u]===J&&y([]);const ae=J;ae&&ae.id===DELETE_BTN_ID&&m(x.map(oe=>oe.id))},onSelect:ee=>{const Y=ee.inputEvent,J=ee.added,re=ee.removed,ae=ee.selected,oe=Y.type==="mousedown";let se=oe?ae:[];!oe&&J.length>0&&(se=x.concat(J)),!oe&&re.length>0&&(se=x.filter(pe=>!re.includes(pe))),y(se),se!=x&&B(!1);const fe=Y;fe&&typeof fe.shiftKey=="boolean"&&!fe.shiftKey&&O(!1)}}),jsxRuntimeExports.jsx(Paper,{paperRefs:w,scale:d,size:A,schemasList:g,pageSizes:v,backgrounds:p,hasRulers:!0,renderPaper:({index:ee,paperSize:Y})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!L&&x.length>0&&u===ee&&jsxRuntimeExports.jsx(DeleteButton,{activeElements:x}),jsxRuntimeExports.jsx(Padding,{basePdf:c}),jsxRuntimeExports.jsx(StaticSchema,{template:{schemas:g,basePdf:c},input:Object.fromEntries(g.flat().map(({name:J,content:re=""})=>[J,re])),scale:d,totalPages:g.length,currentPage:ee+1}),jsxRuntimeExports.jsx(_Guides,{paperSize:Y,horizontalRef:J=>{J&&(_.current[ee]=J)},verticalRef:J=>{J&&(I.current[ee]=J)}}),u!==ee?jsxRuntimeExports.jsx(Mask,{width:Y.width+RULER_HEIGHT,height:Y.height+RULER_HEIGHT}):!L&&jsxRuntimeExports.jsx(Moveable,{ref:C,target:x,bounds:{left:0,top:0,bottom:Y.height,right:Y.width},horizontalGuidelines:K(_.current,ee),verticalGuidelines:K(I.current,ee),keepRatio:P,rotatable:Q,onDrag:U,onDragEnd:M,onDragGroupEnd:N,onRotate:R,onRotateEnd:k,onRotateGroupEnd:H,onResize:te,onResizeEnd:W,onResizeGroupEnd:Z,onClick:q})]}),renderSchema:({schema:ee,index:Y})=>{const J=L&&x.map(oe=>oe.id).includes(ee.id)?"designer":"viewer",re=ee.content||"";let ae=re;if(J!=="designer"&&ee.readOnly){const oe={...g.flat().reduce((se,fe)=>(se[fe.name]=fe.content||"",se),{}),totalPages:g.length,currentPage:Y+1};ae=replacePlaceholders({content:re,variables:oe,schemas:g})}return jsxRuntimeExports.jsx(Renderer,{schema:ee,basePdf:c,value:ae,onChangeHoveringSchemaId:E,mode:J,onChange:(g[u]||[]).some(oe=>oe.id===ee.id)?oe=>{const se=Array.isArray(oe)?oe:[oe];f(se.map(({key:fe,value:pe})=>({key:fe,value:pe,schemaId:ee.id})))}:void 0,stopEditing:()=>B(!1),outline:`1px ${b===ee.id?"solid":"dashed"} ${ee.readOnly&&b!==ee.id?"transparent":$.colorPrimary}`,scale:d},ee.id)}})]})},Canvas=reactExports.forwardRef(Canvas$1),Spinner=()=>{const{token:a}=theme.useToken(),s={position:"relative",width:"100%",height:"100%",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",color:a.colorPrimary},c={animation:"spin 1s linear infinite"};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("style",{children:`
1033
1033
  @keyframes spin {
1034
1034
  0% {
1035
1035
  transform: rotate(0deg);
@@ -1038,4 +1038,4 @@ canvas {
1038
1038
  transform: rotate(360deg);
1039
1039
  }
1040
1040
  }
1041
- `}),jsxRuntimeExports.jsx("div",{style:s,children:jsxRuntimeExports.jsx(LoaderCircle,{size:50,style:c})})]})},Root$1=({size:a,scale:s,children:c},u)=>{const d=reactExports.useContext(FontContext);return reactExports.useEffect(()=>{if(!document||!document.fonts)return;const v=Object.entries(d).map(([A,{data:x}])=>new FontFace(A,typeof x=="string"?`url(${x})`:x,{display:"swap"})).filter(A=>!document.fonts.has(A));Promise.allSettled(v.map(A=>A.load())).then(A=>{A.forEach(x=>{x.status==="fulfilled"&&document.fonts.add(x.value)})})},[d]),jsxRuntimeExports.jsx("div",{ref:u,style:{position:"relative",background:BACKGROUND_COLOR,...a},children:jsxRuntimeExports.jsx("div",{style:{margin:"0 auto",...a},children:s===0?jsxRuntimeExports.jsx(Spinner,{}):c})})},Root=reactExports.forwardRef(Root$1),ErrorScreen=({size:a,error:s})=>{const c=reactExports.useContext(I18nContext),{token:u}=theme.useToken();return jsxRuntimeExports.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",background:BACKGROUND_COLOR,...a},children:jsxRuntimeExports.jsx("div",{style:{width:300,margin:"0 auto",background:u.colorBgLayout},children:jsxRuntimeExports.jsx(Result$1,{icon:null,title:"ERROR",subTitle:c("errorOccurred"),extra:jsxRuntimeExports.jsx("span",{children:s.message})})})})},{Text:Text$1}=Typography,Zoom=({zoomLevel:a,setZoomLevel:s,style:c})=>{const d=useMaxZoom(),p=.25,v=a-.25,A=a+.25;return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button$1,{type:"text",disabled:p>=v,onClick:()=>s(v),icon:jsxRuntimeExports.jsx(Minus,{size:16,color:c.textStyle.color})}),jsxRuntimeExports.jsxs(Text$1,{strong:!0,style:c.textStyle,children:[Math.round(a*100),"%"]}),jsxRuntimeExports.jsx(Button$1,{type:"text",disabled:d<A,onClick:()=>s(A),icon:jsxRuntimeExports.jsx(Plus,{size:16,color:c.textStyle.color})})]})},Pager=({pageCursor:a,pageNum:s,setPageCursor:c,style:u})=>jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button$1,{type:"text",disabled:a<=0,onClick:()=>c(a-1),children:jsxRuntimeExports.jsx(ChevronLeft,{size:16,color:u.textStyle.color})}),jsxRuntimeExports.jsxs(Text$1,{strong:!0,style:u.textStyle,children:[a+1,"/",s]}),jsxRuntimeExports.jsx(Button$1,{type:"text",disabled:a+1>=s,onClick:()=>c(a+1),children:jsxRuntimeExports.jsx(ChevronRight,{size:16,color:u.textStyle.color})})]}),ContextMenu=({items:a,style:s})=>jsxRuntimeExports.jsx(Dropdown,{menu:{items:a},placement:"top",arrow:!0,trigger:["click"],children:jsxRuntimeExports.jsx(Button$1,{type:"text",children:jsxRuntimeExports.jsx(Ellipsis,{size:16,color:s.textStyle.color})})}),CtlBar=a=>{const{token:s}=theme.useToken(),c=reactExports.useContext(I18nContext),{size:u,pageCursor:d,pageNum:p,setPageCursor:v,zoomLevel:A,setZoomLevel:x,addPageAfter:g,removePage:b}=a,y=[];g&&y.push({key:"1",label:jsxRuntimeExports.jsx("div",{onClick:g,children:c("addPageAfter")})}),b&&p>1&&d!==0&&y.push({key:"2",label:jsxRuntimeExports.jsx("div",{onClick:b,children:c("removePage")})});const f=300,m=y.length>0?50:0,E=(p>1?f:f/2)+m,w={color:s.colorWhite,fontSize:s.fontSize,margin:s.marginXS};return jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:"auto",bottom:"6%",width:u.width},children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-evenly",position:"relative",zIndex:1,left:`calc(50% - ${E/2}px)`,width:E,height:40,boxSizing:"border-box",padding:s.paddingSM,borderRadius:s.borderRadius,backgroundColor:s.colorBgMask},children:[p>1&&jsxRuntimeExports.jsx(Pager,{style:{textStyle:w},pageCursor:d,pageNum:p,setPageCursor:v}),jsxRuntimeExports.jsx(Zoom,{style:{textStyle:w},zoomLevel:A,setZoomLevel:x}),y.length>0&&jsxRuntimeExports.jsx(ContextMenu,{items:y,style:{textStyle:w}})]})})},scaleDragPosAdjustment=(a,s)=>s>1?a*(s-1):s<1?a*-(1-s):0,TemplateEditor=({template:a,size:s,onSaveTemplate:c,onChangeTemplate:u,onPageCursorChange:d})=>{const p=reactExports.useRef([]),v=reactExports.useRef([]),A=reactExports.useRef(null),x=reactExports.useRef([]),g=reactExports.useContext(I18nContext),b=reactExports.useContext(PluginsRegistry),y=reactExports.useContext(OptionsContext),f=useMaxZoom(),[m,E]=reactExports.useState(null),[w,S]=reactExports.useState([]),[$,T]=reactExports.useState([[]]),[I,_]=reactExports.useState(0),[C,P]=reactExports.useState(y.zoomLevel??1),[O,L]=reactExports.useState(y.sidebarOpen??!0),[B,F]=reactExports.useState(null),{backgrounds:D,pageSizes:G,scale:j,error:V,refresh:U}=useUIPreProcessor({template:a,size:s,zoomLevel:C,maxZoom:f}),M=ae=>{S(ae),E(null)},N=()=>{S([]),E(null)};reactExports.useEffect(()=>{typeof y.zoomLevel=="number"&&y.zoomLevel!==C&&P(y.zoomLevel),typeof y.sidebarOpen=="boolean"&&y.sidebarOpen!==O&&L(y.sidebarOpen)},[y]),useScrollPageCursor({ref:A,pageSizes:G,scale:j,pageCursor:I,onChangePageCursor:ae=>{_(ae),d(ae),N()}});const R=reactExports.useCallback(ae=>{v.current=[],p.current.push(cloneDeep$1($[I]));const oe=cloneDeep$1($);oe[I]=ae,T(oe),u(schemasList2template(oe,a.basePdf))},[a,$,I,u]),k=reactExports.useCallback(ae=>{R($[I].filter(oe=>!ae.includes(oe.id))),N()},[$,I,R]),H=reactExports.useCallback(ae=>{changeSchemas({objs:ae,schemas:$[I],basePdf:a.basePdf,pluginsRegistry:b,pageSize:G[I],commitSchemas:R})},[R,I,$,b,G,a.basePdf]);useInitEvents({pageCursor:I,pageSizes:G,activeElements:w,template:a,schemasList:$,changeSchemas:H,commitSchemas:R,removeSchemas:k,onSaveTemplate:c,past:p,future:v,setSchemasList:T,onEdit:M,onEditEnd:N});const W=reactExports.useCallback(async ae=>{const oe=await template2SchemasList(ae);T(oe),N(),_(0),A.current?.scroll&&A.current.scroll({top:0,behavior:"smooth"})},[]),Z=ae=>{const[oe,se,fe,pe]=isBlankPdf(a.basePdf)?a.basePdf.padding:[0,0,0,0],ge=G[I],me=ve=>{let he=$.reduce((Ee,xe)=>Ee+xe.length,1),ye=ve+he;for(;$.some(Ee=>Ee.find(xe=>xe.name===ye));)he++,ye=ve+he;return ye},be=(ve,he,ye)=>Math.min(Math.max(ve,he),ye),le={id:uuid$6(),...ae,name:me(g("field")),position:{x:be(pe,ae.position.x,ge.width-se-ae.width),y:be(oe,ae.position.y,ge.height-fe-ae.height)},required:ae.readOnly?!1:y.requiredByDefault||ae.required||!1};if(ae.position.y===0){const ve=x.current[I],he=ve?ve.getBoundingClientRect().top:0;le.position.y=he>0?oe:G[I].height/2}R($[I].concat(le)),setTimeout(()=>M([document.getElementById(le.id)]))},te=ae=>{R(ae)},K=ae=>{E(ae)},q=async(ae,oe)=>{_(oe);const se=schemasList2template(ae,a.basePdf);u(se),await W(se),U(se),setTimeout(()=>{A.current&&(A.current.scrollTop=getPagesScrollTopByIndex(G,oe,j))},0)},Q=()=>{if(I===0||!window.confirm(g("removePageConfirm")))return;const ae=cloneDeep$1($);ae.splice(I,1),q(ae,I-1)},ee=()=>{const ae=cloneDeep$1($);ae.splice(I+1,0,[]),q(ae,I+1)};B!==a&&(F(a),W(a));const Y=s.width-LEFT_SIDEBAR_WIDTH,J={width:O?Y-RIGHT_SIDEBAR_WIDTH:Y,height:s.height};if(V)return jsxRuntimeExports.jsx(ErrorScreen,{size:s,error:V});const re=isBlankPdf(a.basePdf)?{addPageAfter:ee,removePage:Q}:{};return jsxRuntimeExports.jsx(Root,{size:s,scale:j,children:jsxRuntimeExports.jsxs(DndContext,{onDragEnd:ae=>{if(!ae.active)return;const oe=ae.active,se=x.current[I].getBoundingClientRect(),fe=oe.rect.current.initial?.left||0,pe=oe.rect.current.initial?.top||0,ge=se.left-fe+scaleDragPosAdjustment(20,j),me=se.top-pe,be=(ae.delta.y-me)/j,le=(ae.delta.x-ge)/j,ve={x:round$1(px2mm(Math.max(0,le)),2),y:round$1(px2mm(Math.max(0,be)),2)};Z({...oe.data.current,position:ve})},onDragStart:N,children:[jsxRuntimeExports.jsx(LeftSidebar,{height:A.current?A.current.clientHeight:0,scale:j,basePdf:a.basePdf}),jsxRuntimeExports.jsxs("div",{style:{position:"absolute",width:Y,marginLeft:LEFT_SIDEBAR_WIDTH},children:[jsxRuntimeExports.jsx(CtlBar,{size:J,pageCursor:I,pageNum:$.length,setPageCursor:ae=>{A.current&&(A.current.scrollTop=getPagesScrollTopByIndex(G,ae,j),_(ae),N())},zoomLevel:C,setZoomLevel:P,...re}),jsxRuntimeExports.jsx(Sidebar,{hoveringSchemaId:m,onChangeHoveringSchemaId:K,height:A.current?A.current.clientHeight:0,size:s,pageSize:G[I]??[],basePdf:a.basePdf,activeElements:w,schemasList:$,schemas:$[I]??[],changeSchemas:H,onSortEnd:te,onEdit:ae=>{const oe=document.getElementById(ae);oe&&M([oe])},onEditEnd:N,deselectSchema:N,sidebarOpen:O,setSidebarOpen:L}),jsxRuntimeExports.jsx(Canvas,{ref:A,paperRefs:x,basePdf:a.basePdf,hoveringSchemaId:m,onChangeHoveringSchemaId:K,height:s.height-RULER_HEIGHT*ZOOM,pageCursor:I,scale:j,size:J,pageSizes:G,backgrounds:D,activeElements:w,schemasList:$,changeSchemas:H,removeSchemas:k,sidebarOpen:O,onEdit:M})]})]})})},defaultTheme={token:{colorPrimary:"#38a0ff"},components:{Form:{fontSize:12,margin:8,marginLG:12,marginXS:4,padding:8,paddingLG:12,paddingXS:4,itemMarginBottom:4,verticalLabelPadding:"0 0 2px"}}},isObject=a=>!!a&&typeof a=="object"&&!Array.isArray(a),deepMerge=(a,s)=>{let c={...a};return isObject(a)&&isObject(s)&&Object.keys(s).forEach(u=>{const d=s[u];if(isObject(d))if(!(u in a))Object.assign(c,{[u]:d});else{const p=a[u];isObject(p)?c[u]=deepMerge(p,d):Object.assign(c,{[u]:d})}else Object.assign(c,{[u]:d})}),c},AppContextProvider=({children:a,lang:s,font:c,plugins:u,options:d})=>{let p=defaultTheme;d.theme&&(p=deepMerge(p,d.theme));let v=getDict(s);return d.labels&&(v=deepMerge(v,d.labels)),jsxRuntimeExports.jsx(ConfigProvider,{theme:p,children:jsxRuntimeExports.jsx(I18nContext.Provider,{value:A=>i18n(A,v),children:jsxRuntimeExports.jsx(FontContext.Provider,{value:c,children:jsxRuntimeExports.jsx(PluginsRegistry.Provider,{value:u,children:jsxRuntimeExports.jsx(OptionsContext.Provider,{value:d,children:a})})})})})};class Designer extends BaseUIClass{constructor(s){super(s),this.pageCursor=0,checkDesignerProps(s)}saveTemplate(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);this.onSaveTemplateCallback&&this.onSaveTemplateCallback(this.template)}updateTemplate(s){if(checkTemplate(s),!this.domContainer)throw Error(DESTROYED_ERR_MSG);this.template=cloneDeep$1(s),this.onChangeTemplateCallback&&this.onChangeTemplateCallback(s),this.render()}onSaveTemplate(s){this.onSaveTemplateCallback=s}onChangeTemplate(s){this.onChangeTemplateCallback=s}getPageCursor(){return this.pageCursor}render(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.render(jsxRuntimeExports.jsx(AppContextProvider,{lang:this.getLang(),font:this.getFont(),plugins:this.getPluginsRegistry(),options:this.getOptions(),children:jsxRuntimeExports.jsx(TemplateEditor,{template:this.template,onSaveTemplate:s=>{this.template=s,this.template.pdfmeVersion=PDFME_VERSION,this.onSaveTemplateCallback&&this.onSaveTemplateCallback(s)},onChangeTemplate:s=>{this.template=s,this.template.pdfmeVersion=PDFME_VERSION,this.onChangeTemplateCallback&&this.onChangeTemplateCallback(s)},onPageCursorChange:s=>{this.pageCursor=s},size:this.size})}),this.domContainer)}}const{Text}=Typography,icons={left:ChevronLeft,right:ChevronRight,doubleLeft:ChevronsLeft,doubleRight:ChevronsRight},UnitButton=({type:a,onClick:s,disabled:c,textStyle:u})=>{const d=icons[a];return jsxRuntimeExports.jsx(Button$1,{type:"text",onClick:s,disabled:c,children:jsxRuntimeExports.jsx(d,{style:{color:u.color}})})},UnitPager=({size:a,unitCursor:s,unitNum:c,setUnitCursor:u})=>{if(c<=1)return null;const{token:d}=theme.useToken(),p={pointerEvents:"initial",position:"sticky",zIndex:1,display:"flex",alignItems:"center",boxSizing:"border-box",height:40,padding:d.paddingSM,borderRadius:d.borderRadius,backgroundColor:d.colorBgMask},v={color:d.colorWhite,fontSize:d.fontSize,margin:d.marginXS};return jsxRuntimeExports.jsx("div",{style:{position:"absolute",...a},children:jsxRuntimeExports.jsxs("div",{style:{position:"sticky",width:"100%",zIndex:1,top:`calc(50% - ${p.height/2}px)`,display:"flex",alignItems:"center"},children:[s>0&&jsxRuntimeExports.jsxs("div",{style:{left:"1rem",marginLeft:"1rem",...p},children:[jsxRuntimeExports.jsx(UnitButton,{type:"doubleLeft",onClick:()=>u(0),disabled:s<=0,textStyle:v}),jsxRuntimeExports.jsx(UnitButton,{type:"left",onClick:()=>u(s-1),disabled:s<=0,textStyle:v}),jsxRuntimeExports.jsxs(Text,{strong:!0,style:v,children:[s+1,"/",c]})]}),s+1<c&&jsxRuntimeExports.jsxs("div",{style:{right:"1rem",marginLeft:"auto",marginRight:"1rem",...p},children:[jsxRuntimeExports.jsxs(Text,{strong:!0,style:v,children:[s+1,"/",c]}),jsxRuntimeExports.jsx(UnitButton,{type:"right",onClick:()=>u(s+1),disabled:s+1>=c,textStyle:v}),jsxRuntimeExports.jsx(UnitButton,{type:"doubleRight",onClick:()=>u(c-1),disabled:s+1>=c,textStyle:v})]})]})})},_cache=new Map,Preview=({template:a,inputs:s,size:c,onChangeInput:u})=>{const{token:d}=theme.useToken(),p=reactExports.useContext(FontContext),v=reactExports.useContext(OptionsContext),A=useMaxZoom(),x=reactExports.useRef(null),g=reactExports.useRef([]),[b,y]=reactExports.useState(0),[f,m]=reactExports.useState(0),[E,w]=reactExports.useState(v.zoomLevel??1),[S,$]=reactExports.useState([[]]),{backgrounds:T,pageSizes:I,scale:_,error:C,refresh:P}=useUIPreProcessor({template:a,size:c,zoomLevel:E,maxZoom:A}),O=!!u,L=s[b],B=G=>{getDynamicTemplate({template:G,input:L,options:{font:p},_cache,getDynamicHeights:(V,U)=>{switch(U.schema.type){case"table":return getDynamicHeightsForTable(V,U);default:return Promise.resolve([U.schema.height])}}}).then(async V=>{const U=await template2SchemasList(V);$(U),await P(V)}).catch(V=>console.error("[@pdfme/ui] ",V))};reactExports.useEffect(()=>{typeof v.zoomLevel=="number"&&v.zoomLevel!==E&&w(v.zoomLevel)},[v]),reactExports.useEffect(()=>{b>s.length-1&&y(s.length-1),B(a)},[a,s,c]),useScrollPageCursor({ref:x,pageSizes:I,scale:_,pageCursor:f,onChangePageCursor:m});const F=({name:G,value:j})=>u&&u({index:b,name:G,value:j}),D=(G,j)=>{let V=!1;G.forEach(({key:U,value:M})=>{if(U==="content"){const N=M,R=L?.[j.name]||"";if(N===R)return;F({name:j.name,value:N}),j.type==="table"&&(V=!0)}else{const N=S[f].find(R=>R.id===j.id);if(!N)return;N[U]=M}}),V&&B(a),$([...S])};return C?jsxRuntimeExports.jsx(ErrorScreen,{size:c,error:C}):jsxRuntimeExports.jsxs(Root,{size:c,scale:_,children:[jsxRuntimeExports.jsx(CtlBar,{size:c,pageCursor:f,pageNum:S.length,setPageCursor:G=>{x.current&&(x.current.scrollTop=getPagesScrollTopByIndex(I,G,_),m(G))},zoomLevel:E,setZoomLevel:w}),jsxRuntimeExports.jsx(UnitPager,{size:c,unitCursor:b,unitNum:s.length,setUnitCursor:y}),jsxRuntimeExports.jsx("div",{ref:x,style:{...c,position:"relative",overflow:"auto"},children:jsxRuntimeExports.jsx(Paper,{paperRefs:g,scale:_,size:c,schemasList:S,pageSizes:I,backgrounds:T,renderSchema:({schema:G,index:j})=>{const V=G.readOnly?replacePlaceholders({content:G.content||"",variables:{...L,totalPages:S.length,currentPage:j+1},schemas:S}):String(L&&L[G.name]||"");return jsxRuntimeExports.jsx(Renderer,{schema:G,basePdf:a.basePdf,value:V,mode:O?"form":"viewer",placeholder:G.content,tabIndex:j+100,onChange:U=>{const M=Array.isArray(U)?U:[U];D(M,G)},outline:O&&!G.readOnly?`1px dashed ${d.colorPrimary}`:"transparent",scale:_},G.id)},renderPaper:({index:G})=>jsxRuntimeExports.jsx(StaticSchema,{template:a,scale:_,input:L,totalPages:S.length,currentPage:G+1})})})]})};class Form extends PreviewUI{constructor(s){super(s)}onChangeInput(s){this.onChangeInputCallback=s}setInputs(s){const c=this.getInputs();super.setInputs(s);const u=[];s.forEach((d,p)=>{const v=c[p]||{};new Set([...Object.keys(d),...Object.keys(v)]).forEach(x=>{const g=d[x],b=v[x];g!==b&&u.push({index:p,name:x,value:g})})}),u.forEach(d=>{this.onChangeInputCallback&&this.onChangeInputCallback(d)})}render(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.render(jsxRuntimeExports.jsx(AppContextProvider,{lang:this.getLang(),font:this.getFont(),plugins:this.getPluginsRegistry(),options:this.getOptions(),children:jsxRuntimeExports.jsx(Preview,{template:this.template,size:this.size,inputs:this.inputs,onChangeInput:s=>{const{index:c,value:u,name:d}=s;this.onChangeInputCallback&&this.onChangeInputCallback({index:c,value:u,name:d}),this.inputs&&this.inputs[c]&&this.inputs[c][d]!==u&&(this.inputs[c][d]=u,this.render())}})}),this.domContainer)}}class Viewer extends PreviewUI{constructor(s){super(s),console.warn("[@pdfme/ui] Viewer component is deprecated and will be removed in a future version.")}render(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.render(jsxRuntimeExports.jsx(AppContextProvider,{lang:this.getLang(),font:this.getFont(),plugins:this.getPluginsRegistry(),options:this.getOptions(),children:jsxRuntimeExports.jsx(Preview,{template:this.template,size:this.size,inputs:this.inputs})}),this.domContainer)}}exports.Designer=Designer,exports.Form=Form,exports.Viewer=Viewer,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));
1041
+ `}),jsxRuntimeExports.jsx("div",{style:s,children:jsxRuntimeExports.jsx(LoaderCircle,{size:50,style:c})})]})},Root$1=({size:a,scale:s,children:c},u)=>{const d=reactExports.useContext(FontContext);return reactExports.useEffect(()=>{if(!document||!document.fonts)return;const v=Object.entries(d).map(([A,{data:x}])=>new FontFace(A,typeof x=="string"?`url(${x})`:x,{display:"swap"})).filter(A=>!document.fonts.has(A));Promise.allSettled(v.map(A=>A.load())).then(A=>{A.forEach(x=>{x.status==="fulfilled"&&document.fonts.add(x.value)})})},[d]),jsxRuntimeExports.jsx("div",{className:DESIGNER_CLASSNAME+"root",ref:u,style:{position:"relative",background:BACKGROUND_COLOR,...a},children:jsxRuntimeExports.jsx("div",{className:DESIGNER_CLASSNAME+"background",style:{margin:"0 auto",...a},children:s===0?jsxRuntimeExports.jsx(Spinner,{}):c})})},Root=reactExports.forwardRef(Root$1),ErrorScreen=({size:a,error:s})=>{const c=reactExports.useContext(I18nContext),{token:u}=theme.useToken();return jsxRuntimeExports.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",background:BACKGROUND_COLOR,...a},children:jsxRuntimeExports.jsx("div",{style:{width:300,margin:"0 auto",background:u.colorBgLayout},children:jsxRuntimeExports.jsx(Result$1,{icon:null,title:"ERROR",subTitle:c("errorOccurred"),extra:jsxRuntimeExports.jsx("span",{children:s.message})})})})},{Text:Text$1}=Typography,Zoom=({zoomLevel:a,setZoomLevel:s,style:c})=>{const d=useMaxZoom(),p=.25,v=a-.25,A=a+.25;return jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button$1,{className:UI_CLASSNAME+"zoom-out",type:"text",disabled:p>=v,onClick:()=>s(v),icon:jsxRuntimeExports.jsx(Minus,{size:16,color:c.textStyle.color})}),jsxRuntimeExports.jsxs(Text$1,{strong:!0,style:c.textStyle,children:[Math.round(a*100),"%"]}),jsxRuntimeExports.jsx(Button$1,{className:UI_CLASSNAME+"zoom-in",type:"text",disabled:d<A,onClick:()=>s(A),icon:jsxRuntimeExports.jsx(Plus,{size:16,color:c.textStyle.color})})]})},Pager=({pageCursor:a,pageNum:s,setPageCursor:c,style:u})=>jsxRuntimeExports.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[jsxRuntimeExports.jsx(Button$1,{className:UI_CLASSNAME+"page-prev",type:"text",disabled:a<=0,onClick:()=>c(a-1),children:jsxRuntimeExports.jsx(ChevronLeft,{size:16,color:u.textStyle.color})}),jsxRuntimeExports.jsxs(Text$1,{strong:!0,style:u.textStyle,children:[a+1,"/",s]}),jsxRuntimeExports.jsx(Button$1,{className:UI_CLASSNAME+"page-next",type:"text",disabled:a+1>=s,onClick:()=>c(a+1),children:jsxRuntimeExports.jsx(ChevronRight,{size:16,color:u.textStyle.color})})]}),ContextMenu=({items:a,style:s})=>jsxRuntimeExports.jsx(Dropdown,{menu:{items:a},placement:"top",arrow:!0,trigger:["click"],children:jsxRuntimeExports.jsx(Button$1,{className:UI_CLASSNAME+"context-menu",type:"text",children:jsxRuntimeExports.jsx(Ellipsis,{size:16,color:s.textStyle.color})})}),CtlBar=a=>{const{token:s}=theme.useToken(),c=reactExports.useContext(I18nContext),{size:u,pageCursor:d,pageNum:p,setPageCursor:v,zoomLevel:A,setZoomLevel:x,addPageAfter:g,removePage:b}=a,y=[];g&&y.push({key:"1",label:jsxRuntimeExports.jsx("div",{onClick:g,children:c("addPageAfter")})}),b&&p>1&&d!==0&&y.push({key:"2",label:jsxRuntimeExports.jsx("div",{onClick:b,children:c("removePage")})});const f=300,m=y.length>0?50:0,E=(p>1?f:f/2)+m,w={color:s.colorWhite,fontSize:s.fontSize,margin:s.marginXS};return jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:"auto",bottom:"6%",width:u.width},children:jsxRuntimeExports.jsxs("div",{className:UI_CLASSNAME+"control-bar",style:{display:"flex",alignItems:"center",justifyContent:"space-evenly",position:"relative",zIndex:1,left:`calc(50% - ${E/2}px)`,width:E,height:40,boxSizing:"border-box",padding:s.paddingSM,borderRadius:s.borderRadius,backgroundColor:s.colorBgMask},children:[p>1&&jsxRuntimeExports.jsx("div",{className:UI_CLASSNAME+"pager",children:jsxRuntimeExports.jsx(Pager,{style:{textStyle:w},pageCursor:d,pageNum:p,setPageCursor:v})}),jsxRuntimeExports.jsx("div",{className:UI_CLASSNAME+"zoom",children:jsxRuntimeExports.jsx(Zoom,{style:{textStyle:w},zoomLevel:A,setZoomLevel:x})}),y.length>0&&jsxRuntimeExports.jsx(ContextMenu,{items:y,style:{textStyle:w}})]})})},scaleDragPosAdjustment=(a,s)=>s>1?a*(s-1):s<1?a*-(1-s):0,TemplateEditor=({template:a,size:s,onSaveTemplate:c,onChangeTemplate:u,onPageCursorChange:d})=>{const p=reactExports.useRef([]),v=reactExports.useRef([]),A=reactExports.useRef(null),x=reactExports.useRef([]),g=reactExports.useContext(I18nContext),b=reactExports.useContext(PluginsRegistry),y=reactExports.useContext(OptionsContext),f=useMaxZoom(),[m,E]=reactExports.useState(null),[w,S]=reactExports.useState([]),[$,T]=reactExports.useState([[]]),[I,_]=reactExports.useState(0),[C,P]=reactExports.useState(y.zoomLevel??1),[O,L]=reactExports.useState(y.sidebarOpen??!0),[B,F]=reactExports.useState(null),{backgrounds:D,pageSizes:G,scale:j,error:V,refresh:U}=useUIPreProcessor({template:a,size:s,zoomLevel:C,maxZoom:f}),M=ae=>{S(ae),E(null)},N=()=>{S([]),E(null)};reactExports.useEffect(()=>{typeof y.zoomLevel=="number"&&y.zoomLevel!==C&&P(y.zoomLevel),typeof y.sidebarOpen=="boolean"&&y.sidebarOpen!==O&&L(y.sidebarOpen)},[y]),useScrollPageCursor({ref:A,pageSizes:G,scale:j,pageCursor:I,onChangePageCursor:ae=>{_(ae),d(ae),N()}});const R=reactExports.useCallback(ae=>{v.current=[],p.current.push(cloneDeep$1($[I]));const oe=cloneDeep$1($);oe[I]=ae,T(oe),u(schemasList2template(oe,a.basePdf))},[a,$,I,u]),k=reactExports.useCallback(ae=>{R($[I].filter(oe=>!ae.includes(oe.id))),N()},[$,I,R]),H=reactExports.useCallback(ae=>{changeSchemas({objs:ae,schemas:$[I],basePdf:a.basePdf,pluginsRegistry:b,pageSize:G[I],commitSchemas:R})},[R,I,$,b,G,a.basePdf]);useInitEvents({pageCursor:I,pageSizes:G,activeElements:w,template:a,schemasList:$,changeSchemas:H,commitSchemas:R,removeSchemas:k,onSaveTemplate:c,past:p,future:v,setSchemasList:T,onEdit:M,onEditEnd:N});const W=reactExports.useCallback(async ae=>{const oe=await template2SchemasList(ae);T(oe),N(),_(0),A.current?.scroll&&A.current.scroll({top:0,behavior:"smooth"})},[]),Z=ae=>{const[oe,se,fe,pe]=isBlankPdf(a.basePdf)?a.basePdf.padding:[0,0,0,0],ge=G[I],me=ve=>{let he=$.reduce((Ee,xe)=>Ee+xe.length,1),ye=ve+he;for(;$.some(Ee=>Ee.find(xe=>xe.name===ye));)he++,ye=ve+he;return ye},be=(ve,he,ye)=>Math.min(Math.max(ve,he),ye),le={id:uuid$6(),...ae,name:me(g("field")),position:{x:be(pe,ae.position.x,ge.width-se-ae.width),y:be(oe,ae.position.y,ge.height-fe-ae.height)},required:ae.readOnly?!1:y.requiredByDefault||ae.required||!1};if(ae.position.y===0){const ve=x.current[I],he=ve?ve.getBoundingClientRect().top:0;le.position.y=he>0?oe:G[I].height/2}R($[I].concat(le)),setTimeout(()=>M([document.getElementById(le.id)]))},te=ae=>{R(ae)},K=ae=>{E(ae)},q=async(ae,oe)=>{_(oe);const se=schemasList2template(ae,a.basePdf);u(se),await W(se),U(se),setTimeout(()=>{A.current&&(A.current.scrollTop=getPagesScrollTopByIndex(G,oe,j))},0)},Q=()=>{if(I===0||!window.confirm(g("removePageConfirm")))return;const ae=cloneDeep$1($);ae.splice(I,1),q(ae,I-1)},ee=()=>{const ae=cloneDeep$1($);ae.splice(I+1,0,[]),q(ae,I+1)};B!==a&&(F(a),W(a));const Y=s.width-LEFT_SIDEBAR_WIDTH,J={width:O?Y-RIGHT_SIDEBAR_WIDTH:Y,height:s.height};if(V)return jsxRuntimeExports.jsx(ErrorScreen,{size:s,error:V});const re=isBlankPdf(a.basePdf)?{addPageAfter:ee,removePage:Q}:{};return jsxRuntimeExports.jsx(Root,{size:s,scale:j,children:jsxRuntimeExports.jsxs(DndContext,{onDragEnd:ae=>{if(!ae.active)return;const oe=ae.active,se=x.current[I].getBoundingClientRect(),fe=oe.rect.current.initial?.left||0,pe=oe.rect.current.initial?.top||0,ge=se.left-fe+scaleDragPosAdjustment(20,j),me=se.top-pe,be=(ae.delta.y-me)/j,le=(ae.delta.x-ge)/j,ve={x:round$1(px2mm(Math.max(0,le)),2),y:round$1(px2mm(Math.max(0,be)),2)};Z({...oe.data.current,position:ve})},onDragStart:N,children:[jsxRuntimeExports.jsx(LeftSidebar,{height:A.current?A.current.clientHeight:0,scale:j,basePdf:a.basePdf}),jsxRuntimeExports.jsxs("div",{style:{position:"absolute",width:Y,marginLeft:LEFT_SIDEBAR_WIDTH},children:[jsxRuntimeExports.jsx(CtlBar,{size:J,pageCursor:I,pageNum:$.length,setPageCursor:ae=>{A.current&&(A.current.scrollTop=getPagesScrollTopByIndex(G,ae,j),_(ae),N())},zoomLevel:C,setZoomLevel:P,...re}),jsxRuntimeExports.jsx(Sidebar,{hoveringSchemaId:m,onChangeHoveringSchemaId:K,height:A.current?A.current.clientHeight:0,size:s,pageSize:G[I]??[],basePdf:a.basePdf,activeElements:w,schemasList:$,schemas:$[I]??[],changeSchemas:H,onSortEnd:te,onEdit:ae=>{const oe=document.getElementById(ae);oe&&M([oe])},onEditEnd:N,deselectSchema:N,sidebarOpen:O,setSidebarOpen:L}),jsxRuntimeExports.jsx(Canvas,{ref:A,paperRefs:x,basePdf:a.basePdf,hoveringSchemaId:m,onChangeHoveringSchemaId:K,height:s.height-RULER_HEIGHT*ZOOM,pageCursor:I,scale:j,size:J,pageSizes:G,backgrounds:D,activeElements:w,schemasList:$,changeSchemas:H,removeSchemas:k,sidebarOpen:O,onEdit:M})]})]})})},defaultTheme={token:{colorPrimary:"#38a0ff"},components:{Form:{fontSize:12,margin:8,marginLG:12,marginXS:4,padding:8,paddingLG:12,paddingXS:4,itemMarginBottom:4,verticalLabelPadding:"0 0 2px"}}},isObject=a=>!!a&&typeof a=="object"&&!Array.isArray(a),deepMerge=(a,s)=>{let c={...a};return isObject(a)&&isObject(s)&&Object.keys(s).forEach(u=>{const d=s[u];if(isObject(d))if(!(u in a))Object.assign(c,{[u]:d});else{const p=a[u];isObject(p)?c[u]=deepMerge(p,d):Object.assign(c,{[u]:d})}else Object.assign(c,{[u]:d})}),c},AppContextProvider=({children:a,lang:s,font:c,plugins:u,options:d})=>{let p=defaultTheme;d.theme&&(p=deepMerge(p,d.theme));let v=getDict(s);return d.labels&&(v=deepMerge(v,d.labels)),jsxRuntimeExports.jsx(ConfigProvider,{theme:p,children:jsxRuntimeExports.jsx(I18nContext.Provider,{value:A=>i18n(A,v),children:jsxRuntimeExports.jsx(FontContext.Provider,{value:c,children:jsxRuntimeExports.jsx(PluginsRegistry.Provider,{value:u,children:jsxRuntimeExports.jsx(OptionsContext.Provider,{value:d,children:a})})})})})};class Designer extends BaseUIClass{constructor(s){super(s),this.pageCursor=0,checkDesignerProps(s)}saveTemplate(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);this.onSaveTemplateCallback&&this.onSaveTemplateCallback(this.template)}updateTemplate(s){if(checkTemplate(s),!this.domContainer)throw Error(DESTROYED_ERR_MSG);this.template=cloneDeep$1(s),this.onChangeTemplateCallback&&this.onChangeTemplateCallback(s),this.render()}onSaveTemplate(s){this.onSaveTemplateCallback=s}onChangeTemplate(s){this.onChangeTemplateCallback=s}getPageCursor(){return this.pageCursor}render(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.render(jsxRuntimeExports.jsx(AppContextProvider,{lang:this.getLang(),font:this.getFont(),plugins:this.getPluginsRegistry(),options:this.getOptions(),children:jsxRuntimeExports.jsx(TemplateEditor,{template:this.template,onSaveTemplate:s=>{this.template=s,this.template.pdfmeVersion=PDFME_VERSION,this.onSaveTemplateCallback&&this.onSaveTemplateCallback(s)},onChangeTemplate:s=>{this.template=s,this.template.pdfmeVersion=PDFME_VERSION,this.onChangeTemplateCallback&&this.onChangeTemplateCallback(s)},onPageCursorChange:s=>{this.pageCursor=s},size:this.size})}),this.domContainer)}}const{Text}=Typography,icons={left:ChevronLeft,right:ChevronRight,doubleLeft:ChevronsLeft,doubleRight:ChevronsRight},UnitButton=({type:a,onClick:s,disabled:c,textStyle:u})=>{const d=icons[a];return jsxRuntimeExports.jsx(Button$1,{type:"text",onClick:s,disabled:c,children:jsxRuntimeExports.jsx(d,{style:{color:u.color}})})},UnitPager=({size:a,unitCursor:s,unitNum:c,setUnitCursor:u})=>{if(c<=1)return null;const{token:d}=theme.useToken(),p={pointerEvents:"initial",position:"sticky",zIndex:1,display:"flex",alignItems:"center",boxSizing:"border-box",height:40,padding:d.paddingSM,borderRadius:d.borderRadius,backgroundColor:d.colorBgMask},v={color:d.colorWhite,fontSize:d.fontSize,margin:d.marginXS};return jsxRuntimeExports.jsx("div",{style:{position:"absolute",...a},children:jsxRuntimeExports.jsxs("div",{style:{position:"sticky",width:"100%",zIndex:1,top:`calc(50% - ${p.height/2}px)`,display:"flex",alignItems:"center"},children:[s>0&&jsxRuntimeExports.jsxs("div",{style:{left:"1rem",marginLeft:"1rem",...p},children:[jsxRuntimeExports.jsx(UnitButton,{type:"doubleLeft",onClick:()=>u(0),disabled:s<=0,textStyle:v}),jsxRuntimeExports.jsx(UnitButton,{type:"left",onClick:()=>u(s-1),disabled:s<=0,textStyle:v}),jsxRuntimeExports.jsxs(Text,{strong:!0,style:v,children:[s+1,"/",c]})]}),s+1<c&&jsxRuntimeExports.jsxs("div",{style:{right:"1rem",marginLeft:"auto",marginRight:"1rem",...p},children:[jsxRuntimeExports.jsxs(Text,{strong:!0,style:v,children:[s+1,"/",c]}),jsxRuntimeExports.jsx(UnitButton,{type:"right",onClick:()=>u(s+1),disabled:s+1>=c,textStyle:v}),jsxRuntimeExports.jsx(UnitButton,{type:"doubleRight",onClick:()=>u(c-1),disabled:s+1>=c,textStyle:v})]})]})})},_cache=new Map,Preview=({template:a,inputs:s,size:c,onChangeInput:u})=>{const{token:d}=theme.useToken(),p=reactExports.useContext(FontContext),v=reactExports.useContext(OptionsContext),A=useMaxZoom(),x=reactExports.useRef(null),g=reactExports.useRef([]),[b,y]=reactExports.useState(0),[f,m]=reactExports.useState(0),[E,w]=reactExports.useState(v.zoomLevel??1),[S,$]=reactExports.useState([[]]),{backgrounds:T,pageSizes:I,scale:_,error:C,refresh:P}=useUIPreProcessor({template:a,size:c,zoomLevel:E,maxZoom:A}),O=!!u,L=s[b],B=G=>{getDynamicTemplate({template:G,input:L,options:{font:p},_cache,getDynamicHeights:(V,U)=>{switch(U.schema.type){case"table":return getDynamicHeightsForTable(V,U);default:return Promise.resolve([U.schema.height])}}}).then(async V=>{const U=await template2SchemasList(V);$(U),await P(V)}).catch(V=>console.error("[@pdfme/ui] ",V))};reactExports.useEffect(()=>{typeof v.zoomLevel=="number"&&v.zoomLevel!==E&&w(v.zoomLevel)},[v]),reactExports.useEffect(()=>{b>s.length-1&&y(s.length-1),B(a)},[a,s,c]),useScrollPageCursor({ref:x,pageSizes:I,scale:_,pageCursor:f,onChangePageCursor:m});const F=({name:G,value:j})=>u&&u({index:b,name:G,value:j}),D=(G,j)=>{let V=!1;G.forEach(({key:U,value:M})=>{if(U==="content"){const N=M,R=L?.[j.name]||"";if(N===R)return;F({name:j.name,value:N}),j.type==="table"&&(V=!0)}else{const N=S[f].find(R=>R.id===j.id);if(!N)return;N[U]=M}}),V&&B(a),$([...S])};return C?jsxRuntimeExports.jsx(ErrorScreen,{size:c,error:C}):jsxRuntimeExports.jsxs(Root,{size:c,scale:_,children:[jsxRuntimeExports.jsx(CtlBar,{size:c,pageCursor:f,pageNum:S.length,setPageCursor:G=>{x.current&&(x.current.scrollTop=getPagesScrollTopByIndex(I,G,_),m(G))},zoomLevel:E,setZoomLevel:w}),jsxRuntimeExports.jsx(UnitPager,{size:c,unitCursor:b,unitNum:s.length,setUnitCursor:y}),jsxRuntimeExports.jsx("div",{ref:x,style:{...c,position:"relative",overflow:"auto"},children:jsxRuntimeExports.jsx(Paper,{paperRefs:g,scale:_,size:c,schemasList:S,pageSizes:I,backgrounds:T,renderSchema:({schema:G,index:j})=>{const V=G.readOnly?replacePlaceholders({content:G.content||"",variables:{...L,totalPages:S.length,currentPage:j+1},schemas:S}):String(L&&L[G.name]||"");return jsxRuntimeExports.jsx(Renderer,{schema:G,basePdf:a.basePdf,value:V,mode:O?"form":"viewer",placeholder:G.content,tabIndex:j+100,onChange:U=>{const M=Array.isArray(U)?U:[U];D(M,G)},outline:O&&!G.readOnly?`1px dashed ${d.colorPrimary}`:"transparent",scale:_},G.id)},renderPaper:({index:G})=>jsxRuntimeExports.jsx(StaticSchema,{template:a,scale:_,input:L,totalPages:S.length,currentPage:G+1})})})]})};class Form extends PreviewUI{constructor(s){super(s)}onChangeInput(s){this.onChangeInputCallback=s}setInputs(s){const c=this.getInputs();super.setInputs(s);const u=[];s.forEach((d,p)=>{const v=c[p]||{};new Set([...Object.keys(d),...Object.keys(v)]).forEach(x=>{const g=d[x],b=v[x];g!==b&&u.push({index:p,name:x,value:g})})}),u.forEach(d=>{this.onChangeInputCallback&&this.onChangeInputCallback(d)})}render(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.render(jsxRuntimeExports.jsx(AppContextProvider,{lang:this.getLang(),font:this.getFont(),plugins:this.getPluginsRegistry(),options:this.getOptions(),children:jsxRuntimeExports.jsx(Preview,{template:this.template,size:this.size,inputs:this.inputs,onChangeInput:s=>{const{index:c,value:u,name:d}=s;this.onChangeInputCallback&&this.onChangeInputCallback({index:c,value:u,name:d}),this.inputs&&this.inputs[c]&&this.inputs[c][d]!==u&&(this.inputs[c][d]=u,this.render())}})}),this.domContainer)}}class Viewer extends PreviewUI{constructor(s){super(s),console.warn("[@pdfme/ui] Viewer component is deprecated and will be removed in a future version.")}render(){if(!this.domContainer)throw Error(DESTROYED_ERR_MSG);ReactDOM.render(jsxRuntimeExports.jsx(AppContextProvider,{lang:this.getLang(),font:this.getFont(),plugins:this.getPluginsRegistry(),options:this.getOptions(),children:jsxRuntimeExports.jsx(Preview,{template:this.template,size:this.size,inputs:this.inputs})}),this.domContainer)}}exports.Designer=Designer,exports.Form=Form,exports.Viewer=Viewer,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})}));