superdoc 2.23.1-next.3 β 2.23.1-next.4
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/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/document-api/src/content-controls/content-controls.types.d.ts +5 -0
- package/dist/document-api/src/contract/operation-definitions.d.ts +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist-cdn/superdoc.min.js +3 -3
- package/package.json +2 -2
package/dist-cdn/superdoc.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var SuperDoc=(function(){var WT=Object.create,ep=Object.defineProperty,KT=Object.getOwnPropertyDescriptor,qT=Object.getOwnPropertyNames,YT=Object.getPrototypeOf,XT=Object.prototype.hasOwnProperty,Or=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}},y2=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Kd=(e,t)=>{let n={};for(var r in e)ep(n,r,{get:e[r],enumerable:!0});return t||ep(n,Symbol.toStringTag,{value:"Module"}),n},ZT=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=qT(t),i=0,s=o.length,a;i<s;i++)a=o[i],!XT.call(e,a)&&a!==n&&ep(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=KT(t,a))||r.enumerable});return e},b2=(e,t,n)=>(n=e!=null?WT(YT(e)):{},ZT(t||!e||!e.__esModule?ep(n,"default",{value:e,enumerable:!0}):n,e)),QT=new Set(["documentId","actionId","commandId","operation","source","origin","phase","kind","status","success","changed","reason","code","direction","outcome","receipt","result","failure","rejection","txId","documentEpoch","commitSequence","targetCommitSequence","paintedCommitSequence","renderInputEpoch","paintedRenderInputEpoch","health","selection","selectionBefore","selectionAfter","snapshot","target","start","end","anchor","focus","story","storyType","storyId","refId","noteId","textboxId","position","offset","unit","value","blockId","blockOffset","fragmentId","pageIndex","layoutEpoch","revision","sourceCommit","selectionLineageId","selectionIntentSequence","intentSequence","intentId","authoringMode","editableCommandKind","inputKind","visualIntent","preEdit","postEdit","fallback","selectionRevision","timing","selectionTargetMs","textReplaceMs","postEditSelectionMs","totalMs","inputAtMs","dispatchAtMs","committedAtMs","durationMs","elapsedMs","affectedStories","tableId","cellId","contentControlId","outsideContentControl","trackedBlockOffset","projectionBlockId","geometryBlockId","geometryBlockOffset","geometryTrackedBlockOffset","lineAffinity","inlineAffinity","stability","nativeId","paraId","partId","partRevision","storyRevision","pathFingerprint","path","index","name","id","range","hasRangeSelection","inputType","dataLength","isComposing","repeat","altKey","ctrlKey","metaKey","shiftKey","key","button","buttons","pointerType","clickCount","x","y","selector","domPath","scrollLeft","scrollTop","command","segments","nodeId","byteSpan","sdtId","controlId","scope","coordinateSpace","contentControlIds","scrollAncestors","layoutBlockRef","contextSource"]),JT=new Set(["text","data","message","errorMessage","quotedText"]),ex=["keydown","keyup","beforeinput","pointerdown","pointermove","pointerup","click","dblclick","mousedown","mouseup","scroll","compositionstart","compositionend","paste","cut","drop","dragstart"],tx=new Set(["Alt","AltGraph","CapsLock","Control","Meta","NumLock","ScrollLock","Shift","Enter","Tab","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","End","Home","PageDown","PageUp","Backspace","Delete","Insert","Escape","ContextMenu","Pause","Dead","Process","Unidentified"]),nx=0;function su(e,t){return e&&typeof e=="object"?Object.getOwnPropertyDescriptor(e,t)?.value:void 0}function w2(e,t,n){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=n?e:t}var rx=class{constructor(e,t){this.root=e,this.version=t,this.session=null,this.events=[],this.startMs=0,this.maxEvents=2e4,this.maxBytes=8388608,this.closed=!1,this.pendingIntents=new Set,this.heldKeys=new Set,this.heldButtons=new Set,this.cleanups=[];const n=this;this.api=Object.freeze({get active(){return n.active},start:r=>this.start(r),stop:()=>this.stop(),getSnapshot:()=>this.snapshot()})}attachInputs(){const e=this.root.ownerDocument.defaultView;if(!e)throw new Error("Workflow recording requires a browser window.");try{for(const t of ex){const n=r=>{if(!(!this.active||!r.isTrusted))try{r.target instanceof e.Node&&this.root.contains(r.target)?this.input(r):(r.type==="keyup"?this.heldKeys.delete(r.key):r.type==="pointerup"&&this.heldButtons.delete(r.button))&&this.unsupported("input-released-outside-mount")}catch{this.fail("capture-failure")}};e.addEventListener(t,n,!0),this.cleanups.push(()=>e.removeEventListener(t,n,!0))}}catch(t){throw this.detachInputs(),t}}detachInputs(){const e=this.cleanups;this.cleanups=[];for(const t of e)try{t()}catch{}}get active(){return this.session?.status==="recording"}start(e={}){if(this.closed)throw new Error("Cannot record a destroyed SuperDoc instance.");if(this.active)throw new Error("Stop the active workflow recording first.");this.maxEvents=w2(su(e,"maxEvents"),2e4,1e5),this.maxBytes=w2(su(e,"maxBytes"),8388608,67108864);const t=this.root.ownerDocument.defaultView;this.events=[],this.pendingIntents.clear(),this.startMs=t.performance.now(),this.session={schemaVersion:1,sessionId:`workflow-${Date.now()}-${++nx}`,version:this.version(),status:"recording",startedAt:Date.now(),durationMs:0,timeOrigin:t.performance.timeOrigin,startTimeMs:this.startMs,captureContent:su(e,"captureContent")===!0,viewport:{width:t.innerWidth,height:t.innerHeight,devicePixelRatio:t.devicePixelRatio},retainedBytes:0,replayUnsupportedReasons:[],pendingIntentIds:[]};try{this.attachInputs(),this.observe("workflow:started",()=>({scrollTop:this.root.scrollTop,scrollLeft:this.root.scrollLeft}))}catch{this.fail("capture-failure")}return this.snapshot()}observe(e,t){if(this.active)try{let n=4096;const r=(s,a=0)=>{if(--n<0||a>14)throw new Error("payload-limit");if(s===null||typeof s=="boolean")return s;if(typeof s=="number")return Number.isFinite(s)?s:void 0;if(typeof s=="string"){if(s.length>32768)throw new Error("payload-limit");return s}if(!s||typeof s!="object")return;if(Array.isArray(s)){if(s.length>256)throw new Error("payload-limit");return Array.from({length:s.length},(u,d)=>r(su(s,String(d)),a+1)??null)}const l={};for(const u of QT){const d=su(s,u);u==="value"&&typeof d=="string"&&!this.session.captureContent||d!==void 0&&(l[u]=r(d,a+1))}if(this.session.captureContent)for(const u of JT){const d=su(s,u);d!==void 0&&(l[u]=r(d,a+1))}return l},o={sequence:this.events.length+1,atMs:this.root.ownerDocument.defaultView.performance.now()-this.startMs,type:e,data:r(t())??{}},i=JSON.stringify(o);if(this.events.length>=this.maxEvents||this.session.retainedBytes+i.length*2>this.maxBytes){this.fail("capture-limit");return}if(this.events.push(i),this.session.retainedBytes+=i.length*2,e==="interaction:intent"){const s=`${o.data.documentId??""}/${o.data.selectionLineageId}/${o.data.intentSequence}`;(o.data.phase==="enqueued"||o.data.phase==="executing")&&this.pendingIntents.add(s),(o.data.phase==="settled"||o.data.phase==="failed")&&this.pendingIntents.delete(s)}}catch{this.fail("capture-failure")}}unsupported(e){this.session.replayUnsupportedReasons.includes(e)||this.session.replayUnsupportedReasons.push(e)}fail(e){if(this.session){this.unsupported(e);try{this.session.durationMs=this.root.ownerDocument.defaultView.performance.now()-this.startMs}catch{}this.session.status="incomplete",this.clearHeldInput(),this.detachInputs()}}input(e){if(!(!this.active||!e.isTrusted))try{const t=e.target instanceof this.root.ownerDocument.defaultView.Element?e.target:this.root,n=e;if(e.type==="pointermove"&&n.buttons===0)return;let r=t,o=null;for(;r&&r!==this.root;){for(const l of["data-layout-fragment-id","data-layout-block-ref","data-page-index","data-item","data-testid","aria-label"]){const u=r.getAttribute(l);if(u){o=`[${l}=${JSON.stringify(u)}]`;break}}if(o)break;r=r.parentElement}if(!o&&t!==this.root){const l=[];for(r=t;r&&r!==this.root;){const u=r.parentElement;if(!u)break;l.unshift(`:nth-child(${Array.prototype.indexOf.call(u.children,r)+1})`),r=u}r===this.root&&(o=`:scope > ${l.join(" > ")}`),r=t}const i=e,s={selector:o};if(e.type.startsWith("pointer")||["mousedown","mouseup","click","dblclick"].includes(e.type)){const l=[];let u=r??this.root;for(;u&&u!==this.root;){const p=u.parentElement;if(!p)break;l.unshift(`:nth-child(${Array.prototype.indexOf.call(p.children,u)+1})`),u=p}u===this.root&&l.length&&(s.domPath=`:scope > ${l.join(" > ")}`);const d=new Set;for(let p=t;p&&p!==this.root;p=p.parentElement){for(const[m,v]of[["data-source-node-id","blockId"],["data-layout-fragment-id","fragmentId"],["data-layout-block-ref","layoutBlockRef"],["data-layout-story","storyId"],["data-page-index","pageIndex"]]){const C=p.getAttribute(m);C&&s[v]==null&&(s[v]=v==="pageIndex"?Number(C):C)}const g=p.getAttribute("data-sdt-id")??p.getAttribute("data-sdt-container-id");g&&d.add(g),p.classList.contains("superdoc-table-fragment")&&s.tableId==null&&(s.tableId=p.getAttribute("data-layout-block-ref"))}s.contentControlIds=[...d],s.contextSource="painted-pointer",s.fragmentId&&s.pageIndex!=null&&(s.selector=`[data-page-index="${s.pageIndex}"] ${o}`);const f=[];for(let p=t;p;p=p.parentElement){const g=this.root.ownerDocument.defaultView.getComputedStyle(p),m=p===this.root||/auto|scroll/.test(`${g.overflowX} ${g.overflowY}`);if(p.scrollLeft||p.scrollTop||m&&(p.scrollWidth>p.clientWidth||p.scrollHeight>p.clientHeight)){const v=[];let C=p;for(;C&&C!==this.root;){const w=C.parentElement;if(!w)break;v.unshift(`:nth-child(${Array.prototype.indexOf.call(w.children,C)+1})`),C=w}C===this.root&&f.push({selector:p===this.root?null:`:scope > ${v.join(" > ")}`,scrollLeft:p.scrollLeft,scrollTop:p.scrollTop})}if(p===this.root)break;if(f.length>=32)throw new Error("scroll-ancestor-limit")}s.scrollAncestors=f}const a={target:s,inputAtMs:e.timeStamp>this.root.ownerDocument.defaultView.performance.timeOrigin?e.timeStamp-this.root.ownerDocument.defaultView.performance.timeOrigin:e.timeStamp,altKey:i.altKey,ctrlKey:i.ctrlKey,metaKey:i.metaKey,shiftKey:i.shiftKey};if(e.type==="keydown"||e.type==="keyup"){const l=i.key;e.type==="keydown"?this.heldKeys.add(l):this.heldKeys.delete(l);const u=tx.has(l)||/^F(?:[1-9]|1\d|2[0-4])$/.test(l);a.key=!u&&!this.session.captureContent?void 0:l,a.repeat=i.repeat,a.isComposing=i.isComposing,!u&&!this.session.captureContent&&this.unsupported("content-redacted"),(i.isComposing||l==="Dead"||l==="Process")&&this.unsupported("ime")}else if(e.type.startsWith("pointer")||["mousedown","mouseup","click","dblclick"].includes(e.type)){const l=(r??this.root).getBoundingClientRect();e.type==="pointerdown"&&this.heldButtons.add(n.button),e.type==="pointerup"&&this.heldButtons.delete(n.button),Object.assign(a,{button:n.button,buttons:n.buttons,pointerType:n.pointerType??"mouse",clickCount:n.detail,x:n.clientX-l.left,y:n.clientY-l.top}),n.pointerType&&n.pointerType!=="mouse"&&this.unsupported("non-mouse-pointer"),o||this.unsupported("unresolved-pointer-target")}else if(e.type==="scroll")Object.assign(a,{scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t!==this.root&&!o&&this.unsupported("unresolved-scroll-target");else{const l=e;Object.assign(a,{inputType:l.inputType,dataLength:l.data?.length,...this.session.captureContent?{data:l.data}:{}}),l.data&&!this.session.captureContent&&this.unsupported("content-redacted"),["paste","cut","drop","dragstart","compositionstart","compositionend"].includes(e.type)&&this.unsupported(e.type),e.type==="beforeinput"&&l.inputType!=="insertText"&&!l.inputType?.startsWith("delete")&&this.unsupported(`beforeinput:${l.inputType}`)}this.observe(`browser:${e.type}`,()=>a)}catch{this.fail("capture-failure")}}clearHeldInput(){this.heldKeys.clear(),this.heldButtons.clear()}stop(){return this.active&&((this.heldKeys.size||this.heldButtons.size)&&this.unsupported("held-input-at-stop"),this.session.durationMs=this.root.ownerDocument.defaultView.performance.now()-this.startMs,this.session.status="stopped",this.clearHeldInput()),this.detachInputs(),this.snapshot()}snapshot(){return this.session?{...this.session,viewport:{...this.session.viewport},durationMs:this.active?this.root.ownerDocument.defaultView.performance.now()-this.startMs:this.session.durationMs,replayUnsupportedReasons:[...this.session.replayUnsupportedReasons],events:this.events.map(e=>JSON.parse(e)),pendingIntentIds:[...this.pendingIntents]}:null}close(){this.active&&this.fail("instance-destroyed"),this.closed=!0,this.detachInputs()}};function C2(e){try{return fs(fs(fs(e,"diagnostics"),"recording"),"enabled")===!0}catch{return!1}}var au=new WeakMap,ox=0,k2=["documentId","generation","actionId","commandId","operation","source","origin","outcome","phase","success","changed","dryRun","revision","txId","direction","inputType","inputKind","editableCommandKind","dataLength","isComposing","hasRangeSelection","durationMs","elapsedMs","code","reason","failureSource","diagnosticCode","diagnosticStage","internalCode","severity","status","state","beforeHello","remoteGeneration","changedStoryIds","changedPartUris","reviewChanged","saveId","byteLength","targetCommitSequence","paintedCommitSequence","paintedRenderInputEpoch","health","commitSequence","documentEpoch","renderInputEpoch","layoutEpoch","renderEpoch","hasCommitEvent","input","receipt","result","failure","selection","target","selectionTarget","start","end","from","to","offset","blockId","nodeId","kind","story","storyType","id","empty","activeMarks","affectedStories","inserted","updated","removed","invalidatedRefs","remappedRefs","textRangeShifts","insertedLength","deletedLength","renderCommit","snapshot","lifecycle","workerFailure","timing","selectionBefore","selectionAfter"],ix=["text","data","message","errorMessage","quotedText","value"];function fs(e,t){if(!(!e||typeof e!="object"))return Object.getOwnPropertyDescriptor(e,t)?.value}function S2(e,t,n){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=n?e:t}var sx=class{constructor(e,t,n){if(this.version=t,this.sessionId=`interaction-${++ox}`,this.slots=[],this.head=0,this.count=0,this.sequence=0,this.actions=0,this.bytes=0,this.evicted=0,this.truncated=0,this.failures=0,this.closed=!1,this.cleanups=[],C2(e))try{this.workflow=new rx(n,t)}catch{}const r=fs(fs(e,"diagnostics"),"history");this.enabled=fs(r,"enabled")!==!1,this.captureContent=fs(r,"captureContent")===!0,this.maxEvents=S2(fs(r,"maxEvents"),500,1e4),this.maxBytes=S2(fs(r,"maxBytes"),1048576,16777216)}record(e,t){if(this.workflow?.observe(e,t),!(!this.enabled||this.closed))try{let n=!1,r=128;const o=(l,u=0)=>{if(--r<0||u>5){n=!0;return}if(l===null||typeof l=="boolean")return l;if(typeof l=="number")return Number.isFinite(l)?l:void 0;if(typeof l=="string")return l.length>512&&(n=!0),l.slice(0,512);if(!l||typeof l!="object")return;if(Array.isArray(l)){const f=Math.min(l.length,16);l.length>f&&(n=!0);const p=[];for(let g=0;g<f&&r>0;g++)p.push(o(fs(l,String(g)),u+1)??null);return p}const d={};for(const f of this.captureContent?[...k2,...ix]:k2){if(r<=0){n=!0;break}const p=fs(l,f);if(p===void 0)continue;const g=o(p,u+1);g!==void 0&&(d[f]=g)}return d},i=o(t())??{};if(e==="selection:changed"){const l=JSON.stringify(i);if(l===this.lastSelection)return;this.lastSelection=l}else this.lastSelection=void 0;const s={sequence:++this.sequence,observedAt:Date.now(),type:e,data:i,truncated:n};let a=JSON.stringify(s);if(a.length*2>Math.min(8192,this.maxBytes)&&(s.data={},s.truncated=!0,a=JSON.stringify(s)),s.truncated&&this.truncated++,a.length*2>this.maxBytes){this.evicted++;return}for(;this.count&&(this.count>=this.maxEvents||this.bytes+a.length*2>this.maxBytes);){const l=this.slots[this.head];this.bytes-=l.length*2,this.slots[this.head]=void 0,this.head=(this.head+1)%this.maxEvents,this.count--,this.evicted++}this.slots[(this.head+this.count)%this.maxEvents]=a,this.count++,this.bytes+=a.length*2}catch{this.failures++}}action(){return(this.enabled||this.workflow?.active)&&!this.closed?`${this.sessionId}:${++this.actions}`:void 0}snapshot(){const e=[];try{for(let n=0;n<this.count;n++)e.push(JSON.parse(this.slots[(this.head+n)%this.maxEvents]))}catch{this.failures++}let t="unknown";try{t=this.version()}catch{this.failures++}return{schemaVersion:1,sessionId:this.sessionId,version:t,enabled:this.enabled,events:e,retainedBytes:this.bytes,evictedEvents:this.evicted,truncatedEvents:this.truncated,captureFailures:this.failures}}clear(){this.slots=[],this.head=0,this.count=0,this.bytes=0,this.evicted=0,this.truncated=0,this.failures=0,this.lastSelection=void 0}attach(e){if(this.enabled)for(const t of["keydown","beforeinput","compositionstart","compositionend","paste","cut","drop"]){const n=r=>this.record(`input:${t}`,()=>{const o=r;if(r.type==="keydown"){const i=r;return{inputKind:["Backspace","Delete","Enter","Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(i.key)?i.key:"key",dataLength:i.key.length===1?1:void 0,isComposing:i.isComposing}}return{inputType:o.inputType,dataLength:o.data?.length,isComposing:o.isComposing,...this.captureContent?{data:o.data}:{}}});try{e.addEventListener(t,n,!0),this.cleanups.push(()=>e.removeEventListener(t,n,!0))}catch{this.failures++}}}close(){this.workflow?.close(),this.closed=!0;for(const e of this.cleanups)try{e()}catch{this.failures++}this.cleanups=[]}},_2=()=>({schemaVersion:1,sessionId:"unavailable",version:"unknown",enabled:!1,events:[],retainedBytes:0,evictedEvents:0,truncatedEvents:0,captureFailures:1}),ax=Object.freeze({getSnapshot:_2,clear(){}});function lx(e,t,n,r){try{const o=new sx(t,n,r);au.set(e,o),o.attach(r);const i=Object.freeze({...o.workflow?{recording:o.workflow.api}:{},getSnapshot:()=>{try{return o.snapshot()}catch{return _2()}},clear:()=>{try{o.clear()}catch{}}});return o.record("instance:created",()=>({})),i}catch{return ax}}function qd(e,t,n){try{e&&au.get(e)?.record(t,n)}catch{}}function cx(e,t,n){try{const r=au.get(e),o=r?.action();return o&&r?.record(t,()=>({...n(),actionId:o})),o}catch{return}}function ux(e){try{au.get(e)?.close(),au.delete(e)}catch{}}function dx(e){return au.get(e)?.workflow?.api}var fx=y2(((e,t)=>{var n=Object.prototype.hasOwnProperty,r="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(r=!1));function i(u,d,f){this.fn=u,this.context=d,this.once=f||!1}function s(u,d,f,p,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var m=new i(f,p||u,g),v=r?r+d:d;return u._events[v]?u._events[v].fn?u._events[v]=[u._events[v],m]:u._events[v].push(m):(u._events[v]=m,u._eventsCount++),u}function a(u,d){--u._eventsCount===0?u._events=new o:delete u._events[d]}function l(){this._events=new o,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],f,p;if(this._eventsCount===0)return d;for(p in f=this._events)n.call(f,p)&&d.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},l.prototype.listeners=function(d){var f=r?r+d:d,p=this._events[f];if(!p)return[];if(p.fn)return[p.fn];for(var g=0,m=p.length,v=new Array(m);g<m;g++)v[g]=p[g].fn;return v},l.prototype.listenerCount=function(d){var f=r?r+d:d,p=this._events[f];return p?p.fn?1:p.length:0},l.prototype.emit=function(d,f,p,g,m,v){var C=r?r+d:d;if(!this._events[C])return!1;var w=this._events[C],S=arguments.length,y,k;if(w.fn){switch(w.once&&this.removeListener(d,w.fn,void 0,!0),S){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,f),!0;case 3:return w.fn.call(w.context,f,p),!0;case 4:return w.fn.call(w.context,f,p,g),!0;case 5:return w.fn.call(w.context,f,p,g,m),!0;case 6:return w.fn.call(w.context,f,p,g,m,v),!0}for(k=1,y=new Array(S-1);k<S;k++)y[k-1]=arguments[k];w.fn.apply(w.context,y)}else{var x=w.length,M;for(k=0;k<x;k++)switch(w[k].once&&this.removeListener(d,w[k].fn,void 0,!0),S){case 1:w[k].fn.call(w[k].context);break;case 2:w[k].fn.call(w[k].context,f);break;case 3:w[k].fn.call(w[k].context,f,p);break;case 4:w[k].fn.call(w[k].context,f,p,g);break;default:if(!y)for(M=1,y=new Array(S-1);M<S;M++)y[M-1]=arguments[M];w[k].fn.apply(w[k].context,y)}}return!0},l.prototype.on=function(d,f,p){return s(this,d,f,p,!1)},l.prototype.once=function(d,f,p){return s(this,d,f,p,!0)},l.prototype.removeListener=function(d,f,p,g){var m=r?r+d:d;if(!this._events[m])return this;if(!f)return a(this,m),this;var v=this._events[m];if(v.fn)v.fn===f&&(!g||v.once)&&(!p||v.context===p)&&a(this,m);else{for(var C=0,w=[],S=v.length;C<S;C++)(v[C].fn!==f||g&&!v[C].once||p&&v[C].context!==p)&&w.push(v[C]);w.length?this._events[m]=w.length===1?w[0]:w:a(this,m)}return this},l.prototype.removeAllListeners=function(d){var f;return d?(f=r?r+d:d,this._events[f]&&a(this,f)):(this._events=new o,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,typeof t<"u"&&(t.exports=l)})),av=b2(fx(),1),Ao=[];for(let e=0;e<256;++e)Ao.push((e+256).toString(16).slice(1));function hx(e,t=0){return(Ao[e[t+0]]+Ao[e[t+1]]+Ao[e[t+2]]+Ao[e[t+3]]+"-"+Ao[e[t+4]]+Ao[e[t+5]]+"-"+Ao[e[t+6]]+Ao[e[t+7]]+"-"+Ao[e[t+8]]+Ao[e[t+9]]+"-"+Ao[e[t+10]]+Ao[e[t+11]]+Ao[e[t+12]]+Ao[e[t+13]]+Ao[e[t+14]]+Ao[e[t+15]]).toLowerCase()}var lv,px=new Uint8Array(16);function mx(){if(!lv){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");lv=crypto.getRandomValues.bind(crypto)}return lv(px)}var gx=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),A2={randomUUID:gx};function cl(e,t,n){if(A2.randomUUID&&!t&&!e)return A2.randomUUID();e=e||{};const r=e.random??e.rng?.()??mx();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n=n||0,n<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let o=0;o<16;++o)t[n+o]=r[o];return t}return hx(r)}function Yd(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}function An(e){if($t(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=ar(r)?vx(r):An(r);if(o)for(const i in o)t[i]=o[i]}return t}else if(ar(e)||jn(e))return e}function vx(e){const t={};return e.replace(F2,"").split(D2).forEach(n=>{if(n){const r=n.split(O2);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function tn(e){let t="";if(ar(e))t=e;else if($t(e))for(let n=0;n<e.length;n++){const r=tn(e[n]);r&&(t+=r+" ")}else if(jn(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function cv(e){if(!e)return null;let{class:t,style:n}=e;return t&&!ar(t)&&(e.class=tn(t)),n&&(e.style=An(n)),e}function I2(e){return!!e||e===""}function yx(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=ma(e[r],t[r]);return n}function ma(e,t){if(e===t)return!0;let n=dv(e),r=dv(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=si(e),r=si(t),n||r)return e===t;if(n=$t(e),r=$t(t),n||r)return n&&r?yx(e,t):!1;if(n=jn(e),r=jn(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(const o in e){const i=e.hasOwnProperty(o),s=t.hasOwnProperty(o);if(i&&!s||!i&&s||!ma(e[o],t[o]))return!1}}return String(e)===String(t)}function tp(e,t){return e.findIndex(n=>ma(n,t))}function bx(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:(typeof e!="number"||Number.isFinite(e),String(e))}var Dn,hc,Si,uv,lu,Xd,Yn,np,E2,Gn,$t,pc,ul,dv,T2,cn,ar,si,jn,rp,fv,mc,x2,Zd,Qd,dl,Jd,R2,Gr,M2,Zo,cu,uu,fo,gc,hv,ef,tf,L2,nf,P2,D2,O2,F2,pv,N2,wx,mv,Et,gv,op,vv=Or((()=>{Dn={},hc=[],Si=()=>{},uv=()=>!1,lu=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Xd=e=>e.startsWith("onUpdate:"),Yn=Object.assign,np=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},E2=Object.prototype.hasOwnProperty,Gn=(e,t)=>E2.call(e,t),$t=Array.isArray,pc=e=>mc(e)==="[object Map]",ul=e=>mc(e)==="[object Set]",dv=e=>mc(e)==="[object Date]",T2=e=>mc(e)==="[object RegExp]",cn=e=>typeof e=="function",ar=e=>typeof e=="string",si=e=>typeof e=="symbol",jn=e=>e!==null&&typeof e=="object",rp=e=>(jn(e)||cn(e))&&cn(e.then)&&cn(e.catch),fv=Object.prototype.toString,mc=e=>fv.call(e),x2=e=>mc(e).slice(8,-1),Zd=e=>mc(e)==="[object Object]",Qd=e=>ar(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,dl=Yd(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Jd=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},R2=/-\w/g,Gr=Jd(e=>e.replace(R2,t=>t.slice(1).toUpperCase())),M2=/\B([A-Z])/g,Zo=Jd(e=>e.replace(M2,"-$1").toLowerCase()),cu=Jd(e=>e.charAt(0).toUpperCase()+e.slice(1)),uu=Jd(e=>e?`on${cu(e)}`:""),fo=(e,t)=>!Object.is(e,t),gc=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},hv=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},ef=e=>{const t=parseFloat(e);return isNaN(t)?e:t},tf=e=>{const t=ar(e)?Number(e):NaN;return isNaN(t)?e:t},nf=()=>L2||(L2=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),P2=Yd("Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"),D2=/;(?![^(]*\))/g,O2=/:([^]+)/,F2=/\/\*[^]*?\*\//g,pv="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",N2=Yd(pv),wx=Yd(pv+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),mv=e=>!!(e&&e.__v_isRef===!0),Et=e=>ar(e)?e:e==null?"":$t(e)||jn(e)&&(e.toString===fv||!cn(e.toString))?mv(e)?Et(e.value):JSON.stringify(e,gv,2):String(e),gv=(e,t)=>mv(t)?gv(e,t.value):pc(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],i)=>(n[op(r,i)+" =>"]=o,n),{})}:ul(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>op(n))}:si(t)?op(t):jn(t)&&!$t(t)&&!Zd(t)?String(t):t,op=(e,t="")=>{var n;return si(e)?`Symbol(${(n=e.description)!=null?n:t})`:e}}));function yv(e){return new up(e)}function bv(){return No}function B2(e,t=!1){No&&No.cleanups.push(e)}function z2(e,t=!1){if(e.flags|=8,t){e.next=af,af=e;return}e.next=sf,sf=e}function wv(){Tv++}function Cv(){if(--Tv>0)return;if(af){let t=af;for(af=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;sf;){let t=sf;for(sf=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function j2(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function V2(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),Sv(r),Cx(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function kv(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(U2(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function U2(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===hu)||(e.globalVersion=hu,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!kv(e))))return;e.flags|=2;const t=e.dep,n=fr,r=Ui;fr=e,Ui=!0;try{j2(e);const o=e.fn(e._value);(t.version===0||fo(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{fr=n,Ui=r,V2(e),e.flags&=-3}}function Sv(e,t=!1){const{dep:n,prevSub:r,nextSub:o}=e;if(r&&(r.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)Sv(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Cx(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function kx(e,t){e.effect instanceof fu&&(e=e.effect.fn);const n=new fu(e);t&&Yn(n,t);try{n.run()}catch(o){throw n.stop(),o}const r=n.run.bind(n);return r.effect=n,r}function Sx(e){e.effect.stop()}function ga(){xv.push(Ui),Ui=!1}function va(){const e=xv.pop();Ui=e===void 0?!0:e}function $2(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=fr;fr=void 0;try{t()}finally{fr=n}}}function H2(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)H2(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}function Fo(e,t,n){if(Ui&&fr){let r=cf.get(e);r||cf.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new lf),o.map=r,o.key=n),o.track()}}function ya(e,t,n,r,o,i){const s=cf.get(e);if(!s){hu++;return}const a=l=>{l&&l.trigger()};if(wv(),t==="clear")s.forEach(a);else{const l=$t(e),u=l&&Qd(n);if(l&&n==="length"){const d=Number(r);s.forEach((f,p)=>{(p==="length"||p===pu||!si(p)&&p>=d)&&a(f)})}else switch((n!==void 0||s.has(void 0))&&a(s.get(n)),u&&a(s.get(pu)),t){case"add":l?u&&a(s.get("length")):(a(s.get(fl)),pc(e)&&a(s.get(fp)));break;case"delete":l||(a(s.get(fl)),pc(e)&&a(s.get(fp)));break;case"set":pc(e)&&a(s.get(fl));break}}Cv()}function _x(e,t){const n=cf.get(e);return n&&n.get(t)}function du(e){const t=kn(e);return t===e?t:(Fo(t,"iterate",pu),li(e)?t:t.map($i))}function ip(e){return Fo(e=kn(e),"iterate",pu),e}function Bs(e,t){return zs(e)?vc(ai(e)?$i(t):t):$i(t)}function _v(e,t,n){const r=ip(e),o=r[t]();return r!==e&&!li(e)&&(o._next=o.next,o.next=()=>{const i=o._next();return i.done||(i.value=n(i.value)),i}),o}function ba(e,t,n,r,o,i){const s=ip(e),a=s!==e&&!li(e),l=s[t];if(l!==ew[t]){const f=l.apply(e,i);return a?$i(f):f}let u=n;s!==e&&(a?u=function(f,p){return n.call(this,Bs(e,f),p,e)}:n.length>2&&(u=function(f,p){return n.call(this,f,p,e)}));const d=l.call(s,u,r);return a&&o?o(d):d}function G2(e,t,n,r){const o=ip(e),i=o!==e&&!li(e);let s=n,a=!1;o!==e&&(i?(a=r.length===0,s=function(u,d,f){return a&&(a=!1,u=Bs(e,u)),n.call(this,u,Bs(e,d),f,e)}):n.length>3&&(s=function(u,d,f){return n.call(this,u,d,f,e)}));const l=o[t](s,...r);return a?Bs(e,l):l}function Av(e,t,n){const r=kn(e);Fo(r,"iterate",pu);const o=r[t](...n);return(o===-1||o===!1)&&of(n[0])?(n[0]=kn(n[0]),r[t](...n)):o}function rf(e,t,n=[]){ga(),wv();const r=kn(e)[t].apply(e,n);return Cv(),va(),r}function Ax(e){si(e)||(e=String(e));const t=kn(this);return Fo(t,"has",e),t.hasOwnProperty(e)}function Ix(e,t,n){return function(...r){const o=this.__v_raw,i=kn(o),s=pc(i),a=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,u=o[e](...r),d=n?hp:t?vc:$i;return!t&&Fo(i,"iterate",l?fp:fl),Yn(Object.create(u),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:a?[d(f[0]),d(f[1])]:d(f),done:p}}})}}function sp(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Ex(e,t){const n={get(r){const o=this.__v_raw,i=kn(o),s=kn(r);e||(fo(r,s)&&Fo(i,"get",r),Fo(i,"get",s));const{has:a}=uf(i),l=t?hp:e?vc:$i;if(a.call(i,r))return l(o.get(r));if(a.call(i,s))return l(o.get(s));o!==i&&o.get(r)},get size(){const r=this.__v_raw;return!e&&Fo(kn(r),"iterate",fl),r.size},has(r){const o=this.__v_raw,i=kn(o),s=kn(r);return e||(fo(r,s)&&Fo(i,"has",r),Fo(i,"has",s)),r===s?o.has(r):o.has(r)||o.has(s)},forEach(r,o){const i=this,s=i.__v_raw,a=kn(s),l=t?hp:e?vc:$i;return!e&&Fo(a,"iterate",fl),s.forEach((u,d)=>r.call(o,l(u),l(d),i))}};return Yn(n,e?{add:sp("add"),set:sp("set"),delete:sp("delete"),clear:sp("clear")}:{add(r){const o=kn(this),i=uf(o),s=kn(r),a=!t&&!li(r)&&!zs(r)?s:r;return i.has.call(o,a)||fo(r,a)&&i.has.call(o,r)||fo(s,a)&&i.has.call(o,s)||(o.add(a),ya(o,"add",a,a)),this},set(r,o){!t&&!li(o)&&!zs(o)&&(o=kn(o));const i=kn(this),{has:s,get:a}=uf(i);let l=s.call(i,r);l||(r=kn(r),l=s.call(i,r));const u=a.call(i,r);return i.set(r,o),l?fo(o,u)&&ya(i,"set",r,o,u):ya(i,"add",r,o),this},delete(r){const o=kn(this),{has:i,get:s}=uf(o);let a=i.call(o,r);a||(r=kn(r),a=i.call(o,r));const l=s?s.call(o,r):void 0,u=o.delete(r);return a&&ya(o,"delete",r,void 0,l),u},clear(){const r=kn(this),o=r.size!==0,i=void 0,s=r.clear();return o&&ya(r,"clear",void 0,void 0,i),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=Ix(r,e,t)}),n}function ap(e,t){const n=Ex(e,t);return(r,o,i)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(Gn(n,o)&&o in r?n:r,o,i)}function Tx(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function xx(e){return e.__v_skip||!Object.isExtensible(e)?0:Tx(x2(e))}function no(e){return zs(e)?e:cp(e,!1,nw,sw,Dv)}function W2(e){return cp(e,!1,ow,aw,Ov)}function lp(e){return cp(e,!0,rw,lw,Fv)}function Rx(e){return cp(e,!0,iw,cw,Nv)}function cp(e,t,n,r,o){if(!jn(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=xx(e);if(i===0)return e;const s=o.get(e);if(s)return s;const a=new Proxy(e,i===2?r:n);return o.set(e,a),a}function ai(e){return zs(e)?ai(e.__v_raw):!!(e&&e.__v_isReactive)}function zs(e){return!!(e&&e.__v_isReadonly)}function li(e){return!!(e&&e.__v_isShallow)}function of(e){return e?!!e.__v_raw:!1}function kn(e){const t=e&&e.__v_raw;return t?kn(t):e}function Xr(e){return!Gn(e,"__v_skip")&&Object.isExtensible(e)&&hv(e,"__v_skip",!0),e}function vr(e){return e?e.__v_isRef===!0:!1}function ne(e){return K2(e,!1)}function Fr(e){return K2(e,!0)}function K2(e,t){return vr(e)?e:new uw(e,t)}function Mx(e){e.dep&&e.dep.trigger()}function Je(e){return vr(e)?e.value:e}function Lx(e){return cn(e)?e():Je(e)}function Iv(e){return ai(e)?e:new Proxy(e,dw)}function q2(e){return new fw(e)}function Y2(e){const t=$t(e)?new Array(e.length):{};for(const n in e)t[n]=X2(e,n);return t}function Ev(e,t,n){return vr(e)?e:cn(e)?new pw(e):jn(e)&&arguments.length>1?X2(e,t,n):ne(e)}function X2(e,t,n){return new hw(e,t,n)}function Px(e,t,n=!1){let r,o;return cn(e)?r=e:(r=e.get,o=e.set),new mw(r,o,n)}function Dx(){return Ca}function Z2(e,t=!1,n=Ca){if(n){let r=ff.get(n);r||ff.set(n,r=[]),r.push(e)}}function Ox(e,t,n=Dn){const{immediate:r,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=n,u=k=>o?k:li(k)||o===!1||o===0?wa(k,1):wa(k);let d,f,p,g,m=!1,v=!1;if(vr(e)?(f=()=>e.value,m=li(e)):ai(e)?(f=()=>u(e),m=!0):$t(e)?(v=!0,m=e.some(k=>ai(k)||li(k)),f=()=>e.map(k=>{if(vr(k))return k.value;if(ai(k))return u(k);if(cn(k))return l?l(k,2):k()})):cn(e)?t?f=l?()=>l(e,2):e:f=()=>{if(p){ga();try{p()}finally{va()}}const k=Ca;Ca=d;try{return l?l(e,3,[g]):e(g)}finally{Ca=k}}:f=Si,t&&o){const k=f,x=o===!0?1/0:o;f=()=>wa(k(),x)}const C=bv(),w=()=>{d.stop(),C&&C.active&&np(C.effects,d)};if(i&&t){const k=t;t=(...x)=>{k(...x),w()}}let S=v?new Array(e.length).fill(df):df;const y=k=>{if(!(!(d.flags&1)||!d.dirty&&!k))if(t){const x=d.run();if(o||m||(v?x.some((M,z)=>fo(M,S[z])):fo(x,S))){p&&p();const M=Ca;Ca=d;try{const z=[x,S===df?void 0:v&&S[0]===df?[]:S,g];S=x,l?l(t,3,z):t(...z)}finally{Ca=M}}}else d.run()};return a&&a(y),d=new fu(f),d.scheduler=s?()=>s(y,!1):y,g=k=>Z2(k,!1,d),p=d.onStop=()=>{const k=ff.get(d);if(k){if(l)l(k,4);else for(const x of k)x();ff.delete(d)}},t?r?y(!0):S=d.run():s?s(y.bind(null,!0),!0):d.run(),w.pause=d.pause.bind(d),w.resume=d.resume.bind(d),w.stop=w,w}function wa(e,t=1/0,n){if(t<=0||!jn(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,vr(e))wa(e.value,t,n);else if($t(e))for(let r=0;r<e.length;r++)wa(e[r],t,n);else if(ul(e)||pc(e))e.forEach(r=>{wa(r,t,n)});else if(Zd(e)){for(const r in e)wa(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&wa(e[r],t,n)}return e}var No,up,fr,dp,fu,Tv,sf,af,Ui,xv,hu,Q2,lf,cf,fl,fp,pu,J2,ew,tw,Rv,Mv,Lv,Pv,nw,rw,ow,iw,hp,uf,sw,aw,lw,cw,Dv,Ov,Fv,Nv,$i,vc,uw,dw,fw,hw,pw,mw,gw,vw,df,ff,Ca,Fx=Or((()=>{vv(),up=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=No,!e&&No&&(this.index=(No.scopes||(No.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=No;try{return No=this,e()}finally{No=t}}}on(){++this._on===1&&(this.prevScope=No,No=this)}off(){this._on>0&&--this._on===0&&(No=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}},dp=new WeakSet,fu=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,No&&No.active&&No.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,dp.has(this)&&(dp.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||z2(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,$2(this),j2(this);const e=fr,t=Ui;fr=this,Ui=!0;try{return this.fn()}finally{V2(this),fr=e,Ui=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Sv(e);this.deps=this.depsTail=void 0,$2(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?dp.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){kv(this)&&this.run()}get dirty(){return kv(this)}},Tv=0,Ui=!0,xv=[],hu=0,Q2=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},lf=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!fr||!Ui||fr===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==fr)t=this.activeLink=new Q2(fr,this),fr.deps?(t.prevDep=fr.depsTail,fr.depsTail.nextDep=t,fr.depsTail=t):fr.deps=fr.depsTail=t,H2(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){const n=t.nextDep;n.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=n),t.prevDep=fr.depsTail,t.nextDep=void 0,fr.depsTail.nextDep=t,fr.depsTail=t,fr.deps===t&&(fr.deps=n)}return t}trigger(e){this.version++,hu++,this.notify(e)}notify(e){wv();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Cv()}}},cf=new WeakMap,fl=Symbol(""),fp=Symbol(""),pu=Symbol(""),J2={__proto__:null,[Symbol.iterator](){return _v(this,Symbol.iterator,e=>Bs(this,e))},concat(...e){return du(this).concat(...e.map(t=>$t(t)?du(t):t))},entries(){return _v(this,"entries",e=>(e[1]=Bs(this,e[1]),e))},every(e,t){return ba(this,"every",e,t,void 0,arguments)},filter(e,t){return ba(this,"filter",e,t,n=>n.map(r=>Bs(this,r)),arguments)},find(e,t){return ba(this,"find",e,t,n=>Bs(this,n),arguments)},findIndex(e,t){return ba(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ba(this,"findLast",e,t,n=>Bs(this,n),arguments)},findLastIndex(e,t){return ba(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ba(this,"forEach",e,t,void 0,arguments)},includes(...e){return Av(this,"includes",e)},indexOf(...e){return Av(this,"indexOf",e)},join(e){return du(this).join(e)},lastIndexOf(...e){return Av(this,"lastIndexOf",e)},map(e,t){return ba(this,"map",e,t,void 0,arguments)},pop(){return rf(this,"pop")},push(...e){return rf(this,"push",e)},reduce(e,...t){return G2(this,"reduce",e,t)},reduceRight(e,...t){return G2(this,"reduceRight",e,t)},shift(){return rf(this,"shift")},some(e,t){return ba(this,"some",e,t,void 0,arguments)},splice(...e){return rf(this,"splice",e)},toReversed(){return du(this).toReversed()},toSorted(e){return du(this).toSorted(e)},toSpliced(...e){return du(this).toSpliced(...e)},unshift(...e){return rf(this,"unshift",e)},values(){return _v(this,"values",e=>Bs(this,e))}},ew=Array.prototype,tw=Yd("__proto__,__v_isRef,__isVue"),Rv=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(si)),Mv=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t==="__v_skip")return e.__v_skip;const r=this._isReadonly,o=this._isShallow;if(t==="__v_isReactive")return!r;if(t==="__v_isReadonly")return r;if(t==="__v_isShallow")return o;if(t==="__v_raw")return n===(r?o?Nv:Fv:o?Ov:Dv).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const i=$t(e);if(!r){let a;if(i&&(a=J2[t]))return a;if(t==="hasOwnProperty")return Ax}const s=Reflect.get(e,t,vr(e)?e:n);if((si(t)?Rv.has(t):tw(t))||(r||Fo(e,"get",t),o))return s;if(vr(s)){const a=i&&Qd(t)?s:s.value;return r&&jn(a)?lp(a):a}return jn(s)?r?lp(s):no(s):s}},Lv=class extends Mv{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t];const i=$t(e)&&Qd(t);if(!this._isShallow){const l=zs(o);if(!li(n)&&!zs(n)&&(o=kn(o),n=kn(n)),!i&&vr(o)&&!vr(n))return l||(o.value=n),!0}const s=i?Number(t)<e.length:Gn(e,t),a=Reflect.set(e,t,n,vr(e)?e:r);return e===kn(r)&&(s?fo(n,o)&&ya(e,"set",t,n,o):ya(e,"add",t,n)),a}deleteProperty(e,t){const n=Gn(e,t),r=e[t],o=Reflect.deleteProperty(e,t);return o&&n&&ya(e,"delete",t,void 0,r),o}has(e,t){const n=Reflect.has(e,t);return(!si(t)||!Rv.has(t))&&Fo(e,"has",t),n}ownKeys(e){return Fo(e,"iterate",$t(e)?"length":fl),Reflect.ownKeys(e)}},Pv=class extends Mv{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},nw=new Lv,rw=new Pv,ow=new Lv(!0),iw=new Pv(!0),hp=e=>e,uf=e=>Reflect.getPrototypeOf(e),sw={get:ap(!1,!1)},aw={get:ap(!1,!0)},lw={get:ap(!0,!1)},cw={get:ap(!0,!0)},Dv=new WeakMap,Ov=new WeakMap,Fv=new WeakMap,Nv=new WeakMap,$i=e=>jn(e)?no(e):e,vc=e=>jn(e)?lp(e):e,uw=class{constructor(e,t){this.dep=new lf,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:kn(e),this._value=t?e:$i(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||li(e)||zs(e);e=n?e:kn(e),fo(e,t)&&(this._rawValue=e,this._value=n?e:$i(e),this.dep.trigger())}},dw={get:(e,t,n)=>t==="__v_raw"?e:Je(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return vr(o)&&!vr(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}},fw=class{constructor(e){this.__v_isRef=!0,this._value=void 0;const t=this.dep=new lf,{get:n,set:r}=e(t.track.bind(t),t.trigger.bind(t));this._get=n,this._set=r}get value(){return this._value=this._get()}set value(e){this._set(e)}},hw=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=si(t)?t:String(t),this._raw=kn(e);let r=!0,o=e;if(!$t(e)||si(this._key)||!Qd(this._key))do r=!of(o)||li(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=Je(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&vr(this._raw[this._key])){const t=this._object[this._key];if(vr(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return _x(this._raw,this._key)}},pw=class{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}},mw=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new lf(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=hu-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&fr!==this)return z2(this,!0),!0}get value(){const e=this.dep.track();return U2(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}},gw={GET:"get",HAS:"has",ITERATE:"iterate"},vw={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},df={},ff=new WeakMap,Ca=void 0}));function Nx(e){ry.push(e)}function Bx(){ry.pop()}function zx(e,t){}function mu(e,t,n,r){try{return r?e(...r):e()}catch(o){yc(o,t,n)}}function Hi(e,t,n,r){if(cn(e)){const o=mu(e,t,n,r);return o&&rp(o)&&o.catch(i=>{yc(i,t,n)}),o}if($t(e)){const o=[];for(let i=0;i<e.length;i++)o.push(Hi(e[i],t,n,r));return o}}function yc(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Dn;if(t){let a=t.parent;const l=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const d=a.ec;if(d){for(let f=0;f<d.length;f++)if(d[f](e,l,u)===!1)return}a=a.parent}if(i){ga(),mu(i,null,10,[e,l,u]),va();return}}jx(e,n,o,r,s)}function jx(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}function kt(e){const t=Sf||oy;return e?t.then(this?e.bind(this):e):t}function Vx(e){let t=ps+1,n=Bo.length;for(;t<n;){const r=t+n>>>1,o=Bo[r],i=wu(o);i<e||i===e&&o.flags&2?t=r+1:n=r}return t}function Bv(e){if(!(e.flags&1)){const t=wu(e),n=Bo[Bo.length-1];!n||!(e.flags&2)&&t>=wu(n)?Bo.push(e):Bo.splice(Vx(t),0,e),e.flags|=1,yw()}}function yw(){Sf||(Sf=oy.then(ww))}function hf(e){$t(e)?wc.push(...e):Aa&&e.id===-1?Aa.splice(Cc+1,0,e):e.flags&1||(wc.push(e),e.flags|=1),yw()}function bw(e,t,n=ps+1){for(;n<Bo.length;n++){const r=Bo[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Bo.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function pp(e){if(wc.length){const t=[...new Set(wc)].sort((n,r)=>wu(n)-wu(r));if(wc.length=0,Aa){Aa.push(...t);return}for(Aa=t,Cc=0;Cc<Aa.length;Cc++){const n=Aa[Cc];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Aa=null,Cc=0}}function ww(e){try{for(ps=0;ps<Bo.length;ps++){const t=Bo[ps];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),mu(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;ps<Bo.length;ps++){const t=Bo[ps];t&&(t.flags&=-2)}ps=-1,Bo.length=0,pp(e),Sf=null,(Bo.length||wc.length)&&ww(e)}}function Cw(e,t){var n,r;Cu=e,Cu?(Cu.enabled=!0,_f.forEach(({event:o,args:i})=>Cu.emit(o,...i)),_f=[]):typeof window<"u"&&window.HTMLElement&&!((r=(n=window.navigator)==null?void 0:n.userAgent)!=null&&r.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(o=>{Cw(o,t)}),setTimeout(()=>{Cu||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,_f=[])},3e3)):_f=[]}function pf(e){const t=po;return po=e,Af=e&&e.type.__scopeId||null,t}function Ux(e){Af=e}function $x(){Af=null}function ho(e,t=po,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&Cf(-1);const i=pf(t);let s;try{s=e(...o)}finally{pf(i),r._d&&Cf(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function _i(e,t){if(po===null)return e;const n=kf(po),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[i,s,a,l=Dn]=t[o];i&&(cn(i)&&(i={mounted:i,updated:i}),i.deep&&wa(s),r.push({dir:i,instance:n,value:s,oldValue:void 0,arg:a,modifiers:l}))}return e}function js(e,t,n,r){const o=e.dirs,i=t&&t.dirs;for(let s=0;s<o.length;s++){const a=o[s];i&&(a.oldValue=i[s].value);let l=a.dir[r];l&&(ga(),Hi(l,n,8,[e.el,a,e,t]),va())}}function kw(e,t){if(mo){let n=mo.provides;const r=mo.parent&&mo.parent.provides;r===n&&(n=mo.provides=Object.create(r)),n[e]=t}}function hl(e,t,n=!1){const r=Cr();if(r||yl){let o=yl?yl._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&cn(t)?t.call(r&&r.proxy):t}}function Sw(){return!!(Cr()||yl)}function Hx(e,t){return mf(e,null,t)}function Gx(e,t){return mf(e,null,{flush:"post"})}function _w(e,t){return mf(e,null,{flush:"sync"})}function Vt(e,t,n){return mf(e,t,n)}function mf(e,t,n=Dn){const{immediate:r,deep:o,flush:i,once:s}=n,a=Yn({},n),l=t&&r||!t&&i!=="post";let u;if(Cl){if(i==="sync"){const g=sy();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!l){const g=()=>{};return g.stop=Si,g.resume=Si,g.pause=Si,g}}const d=mo;a.call=(g,m,v)=>Hi(g,d,m,v);let f=!1;i==="post"?a.scheduler=g=>{Wr(g,d&&d.suspense)}:i!=="sync"&&(f=!0,a.scheduler=(g,m)=>{m?g():Bv(g)}),a.augmentJob=g=>{t&&(g.flags|=4),f&&(g.flags|=2,d&&(g.id=d.uid,g.i=d))};const p=Ox(e,t,a);return Cl&&(u?u.push(p):l&&p()),p}function Wx(e,t,n){const r=this.proxy,o=ar(e)?e.includes(".")?Aw(r,e):()=>r[e]:e.bind(r,r);let i;cn(t)?i=t:(i=t.handler,n=t);const s=_c(this),a=mf(o,i.bind(r),n);return s(),a}function Aw(e,t){const n=t.split(".");return()=>{let r=e;for(let o=0;o<n.length&&r;o++)r=r[n[o]];return r}}function mp(e,t,n,{o:{insert:r},m:o},i=2){i===0&&r(e.targetAnchor,t,n);const{el:s,anchor:a,shapeFlag:l,children:u,props:d}=e,f=i===2;if(f&&r(s,t,n),(!f||gl(d))&&l&16)for(let p=0;p<u.length;p++)o(u[p],t,n,2);f&&r(a,t,n)}function Kx(e,t,n,r,o,i,{o:{nextSibling:s,parentNode:a,querySelector:l,insert:u,createText:d}},f){function p(C,w){let S=w;for(;S;){if(S&&S.nodeType===8){if(S.data==="teleport start anchor")t.targetStart=S;else if(S.data==="teleport anchor"){t.targetAnchor=S,C._lpa=t.targetAnchor&&s(t.targetAnchor);break}}S=s(S)}}function g(C,w){w.anchor=f(s(C),w,a(C),n,r,o,i)}const m=t.target=Ip(t.props,l),v=gl(t.props);if(m){const C=m._lpa||m.firstChild;t.shapeFlag&16&&(v?(g(e,t),p(m,C),t.targetAnchor||zv(m,t,d,u,a(e)===m?e:null)):(t.anchor=s(e),p(m,C),t.targetAnchor||zv(m,t,d,u),f(C&&s(C),t,m,n,r,o,i))),gf(t,v)}else v&&t.shapeFlag&16&&(g(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}function gf(e,t){const n=e.ctx;if(n&&n.ut){let r,o;for(t?(r=e.el,o=e.anchor):(r=e.targetStart,o=e.targetAnchor);r&&r!==o;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function zv(e,t,n,r,o=null){const i=t.targetStart=n(""),s=t.targetAnchor=n("");return i[ay]=s,e&&(r(i,e,o),r(s,e,o)),s}function jv(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Nn(()=>{e.isMounted=!0}),hr(()=>{e.isUnmounting=!0}),e}function Iw(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Br){t=n;break}}return t}function Ew(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function gu(e,t,n,r,o){const{appear:i,mode:s,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:d,onEnterCancelled:f,onBeforeLeave:p,onLeave:g,onAfterLeave:m,onLeaveCancelled:v,onBeforeAppear:C,onAppear:w,onAfterAppear:S,onAppearCancelled:y}=t,k=String(e.key),x=Ew(n,e),M=(B,L)=>{B&&Hi(B,r,9,L)},z=(B,L)=>{const V=L[1];M(B,L),$t(B)?B.every(T=>T.length<=1)&&V():B.length<=1&&V()},q={mode:s,persisted:a,beforeEnter(B){let L=l;if(!n.isMounted)if(i)L=C||l;else return;B[ms]&&B[ms](!0);const V=x[k];V&&hs(e,V)&&V.el[ms]&&V.el[ms](),M(L,[B])},enter(B){if(x[k]===e)return;let L=u,V=d,T=f;if(!n.isMounted)if(i)L=w||u,V=S||d,T=y||f;else return;let $=!1;B[ku]=H=>{$||($=!0,H?M(T,[B]):M(V,[B]),q.delayedLeave&&q.delayedLeave(),B[ku]=void 0)};const R=B[ku].bind(null,!1);L?z(L,[B,R]):R()},leave(B,L){const V=String(e.key);if(B[ku]&&B[ku](!0),n.isUnmounting)return L();M(p,[B]);let T=!1;B[ms]=R=>{T||(T=!0,L(),R?M(v,[B]):M(m,[B]),B[ms]=void 0,x[V]===e&&delete x[V])};const $=B[ms].bind(null,!1);x[V]=e,g?z(g,[B,$]):$()},clone(B){const L=gu(B,t,n,r,o);return o&&o(L),L}};return q}function Vv(e){if(Su(e))return e=Vs(e),e.children=null,e}function Tw(e){if(!Su(e))return ly(e.type)&&e.children?Iw(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&cn(n.default))return n.default()}}function ka(e,t){e.shapeFlag&6&&e.component?(e.transition=t,ka(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function gp(e,t=!1,n){let r=[],o=0;for(let i=0;i<e.length;i++){let s=e[i];const a=n==null?s.key:String(n)+String(s.key!=null?s.key:i);s.type===zt?(s.patchFlag&128&&o++,r=r.concat(gp(s.children,t,a))):(t||s.type!==Br)&&r.push(a!=null?Vs(s,{key:a}):s)}if(o>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function pl(e,t){return cn(e)?Yn({name:e.name},t,{setup:e}):e}function qx(){const e=Cr();return e?(e.appContext.config.idPrefix||"v")+"-"+e.ids[0]+e.ids[1]++:""}function Uv(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Yx(e){const t=Cr(),n=Fr(null);if(t){const r=t.refs===Dn?t.refs={}:t.refs;Object.defineProperty(r,e,{enumerable:!0,get:()=>n.value,set:o=>n.value=o})}return n}function xw(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}function vu(e,t,n,r,o=!1){if($t(e)){e.forEach((v,C)=>vu(v,t&&($t(t)?t[C]:t),n,r,o));return}if($s(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&vu(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?kf(r.component):r.el,s=o?null:i,{i:a,r:l}=e,u=t&&t.r,d=a.refs===Dn?a.refs={}:a.refs,f=a.setupState,p=kn(f),g=f===Dn?uv:v=>xw(d,v)?!1:Gn(p,v),m=(v,C)=>!(C&&xw(d,C));if(u!=null&&u!==l){if(Rw(t),ar(u))d[u]=null,g(u)&&(f[u]=null);else if(vr(u)){const v=t;m(u,v.k)&&(u.value=null),v.k&&(d[v.k]=null)}}if(cn(l))mu(l,a,12,[s,d]);else{const v=ar(l),C=vr(l);if(v||C){const w=()=>{if(e.f){const S=v?g(l)?f[l]:d[l]:m(l)||!e.k?l.value:d[e.k];if(o)$t(S)&&np(S,i);else if($t(S))S.includes(i)||S.push(i);else if(v)d[l]=[i],g(l)&&(f[l]=d[l]);else{const y=[i];m(l,e.k)&&(l.value=y),e.k&&(d[e.k]=y)}}else v?(d[l]=s,g(l)&&(f[l]=s)):C&&(m(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const S=()=>{w(),If.delete(e)};S.id=-1,If.set(e,S),Wr(S,n)}else Rw(e),w()}}}function Rw(e){const t=If.get(e);t&&(t.flags|=8,If.delete(e))}function Xx(e){const{mt:t,p:n,o:{patchProp:r,createText:o,nextSibling:i,parentNode:s,remove:a,insert:l,createComment:u}}=e,d=(y,k)=>{if(!k.hasChildNodes()){n(null,y,k),pp(),k._vnode=y;return}f(k.firstChild,y,null,null,null),pp(),k._vnode=y},f=(y,k,x,M,z,q=!1)=>{q=q||!!k.dynamicChildren;const B=Sc(y)&&y.data==="[",L=()=>v(y,k,x,M,z,B),{type:V,ref:T,shapeFlag:$,patchFlag:R}=k;let H=y.nodeType;k.el=y,R===-2&&(q=!1,k.dynamicChildren=null);let G=null;switch(V){case Ia:H!==3?k.children===""?(l(k.el=o(""),s(y),y),G=y):G=L():(y.data!==k.children&&(kc(),y.data=k.children),G=i(y));break;case Br:S(y)?(G=i(y),w(k.el=y.content.firstChild,y,x)):H!==8||B?G=L():G=i(y);break;case bl:if(B&&(y=i(y),H=y.nodeType),H===1||H===3){G=y;const ee=!k.children.length;for(let J=0;J<k.staticCount;J++)ee&&(k.children+=G.nodeType===1?G.outerHTML:G.data),J===k.staticCount-1&&(k.anchor=G),G=i(G);return B?i(G):G}else L();break;case zt:B?G=m(y,k,x,M,z,q):G=L();break;default:if($&1)(H!==1||k.type.toLowerCase()!==y.tagName.toLowerCase())&&!S(y)?G=L():G=p(y,k,x,M,z,q);else if($&6){k.slotScopeIds=z;const ee=s(y);if(B?G=C(y):Sc(y)&&y.data==="teleport start"?G=C(y,y.data,"teleport end"):G=i(y),t(k,ee,null,x,M,Ef(ee),q),$s(k)&&!k.type.__asyncResolved){let J;B?(J=on(zt),J.anchor=G?G.previousSibling:ee.lastChild):J=y.nodeType===3?Ai(""):on("div"),J.el=y,k.component.subTree=J}}else $&64?H!==8?G=L():G=k.type.hydrate(y,k,x,M,z,q,e,g):$&128&&(G=k.type.hydrate(y,k,x,M,Ef(s(y)),z,q,e,f))}return T!=null&&vu(T,null,M,k),G},p=(y,k,x,M,z,q)=>{q=q||!!k.dynamicChildren;const{type:B,props:L,patchFlag:V,shapeFlag:T,dirs:$,transition:R}=k,H=B==="input"||B==="option";if(H||V!==-1){$&&js(k,null,x,"created");let G=!1;if(S(y)){G=Jw(null,R)&&x&&x.vnode.props&&x.vnode.props.appear;const J=y.content.firstChild;if(G){const X=J.getAttribute("class");X&&(J.$cls=X),R.beforeEnter(J)}w(J,y,x),k.el=y=J}if(T&16&&!(L&&(L.innerHTML||L.textContent))){let J=g(y.firstChild,k,y,x,M,z,q);for(;J;){vp(y,1)||kc();const X=J;J=J.nextSibling,a(X)}}else if(T&8){let J=k.children;J[0]===`
|
|
2
2
|
`&&(y.tagName==="PRE"||y.tagName==="TEXTAREA")&&(J=J.slice(1));const{textContent:X}=y;X!==J&&X!==J.replace(/\r\n|\r/g,`
|
|
3
3
|
`)&&(vp(y,0)||kc(),y.textContent=k.children)}if(L){if(H||!q||V&48){const J=y.tagName.includes("-");for(const X in L)(H&&(X.endsWith("value")||X==="indeterminate")||lu(X)&&!dl(X)||X[0]==="."||J&&!dl(X))&&r(y,X,null,L[X],void 0,x)}else if(L.onClick)r(y,"onClick",null,L.onClick,void 0,x);else if(V&4&&ai(L.style))for(const J in L.style)L.style[J]}let ee;(ee=L&&L.onVnodeBeforeMount)&&ui(ee,x,k),$&&js(k,null,x,"beforeMount"),((ee=L&&L.onVnodeMounted)||$||G)&&oC(()=>{ee&&ui(ee,x,k),G&&R.enter(y),$&&js(k,null,x,"mounted")},M)}return y.nextSibling},g=(y,k,x,M,z,q,B)=>{B=B||!!k.dynamicChildren;const L=k.children,V=L.length;for(let T=0;T<V;T++){const $=B?L[T]:L[T]=ci(L[T]),R=$.type===Ia;y?(R&&!B&&T+1<V&&ci(L[T+1]).type===Ia&&(l(o(y.data.slice($.children.length)),x,i(y)),y.data=$.children),y=f(y,$,M,z,q,B)):R&&!$.children?l($.el=o(""),x):(vp(x,1)||kc(),n(null,$,x,null,M,z,Ef(x),q))}return y},m=(y,k,x,M,z,q)=>{const{slotScopeIds:B}=k;B&&(z=z?z.concat(B):B);const L=s(y),V=g(i(y),k,L,x,M,z,q);return V&&Sc(V)&&V.data==="]"?i(k.anchor=V):(kc(),l(k.anchor=u("]"),L,V),V)},v=(y,k,x,M,z,q)=>{if(vp(y.parentElement,1)||kc(),k.el=null,q){const V=C(y);for(;;){const T=i(y);if(T&&T!==V)a(T);else break}}const B=i(y),L=s(y);return a(y),n(null,k,L,B,x,M,Ef(L),z),x&&(x.vnode.el=k.el,_p(x,k.el)),B},C=(y,k="[",x="]")=>{let M=0;for(;y;)if(y=i(y),y&&Sc(y)&&(y.data===k&&M++,y.data===x)){if(M===0)return i(y);M--}return y},w=(y,k,x)=>{const M=k.parentNode;M&&M.replaceChild(y,k);let z=x;for(;z;)z.vnode.el===k&&(z.vnode.el=z.subTree.el=y),z=z.parent},S=y=>y.nodeType===1&&y.tagName==="TEMPLATE";return[d,f]}function vp(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(py);)e=e.parentElement;const n=e&&e.getAttribute(py);if(n==null)return!1;if(n==="")return!0;{const r=n.split(",");return t===0&&r.includes("children")?!0:r.includes(SC[t])}}function Zx(e){const{top:t,left:n,bottom:r,right:o}=e.getBoundingClientRect(),{innerHeight:i,innerWidth:s}=window;return(t>0&&t<i||r>0&&r<i)&&(n>0&&n<s||o>0&&o<s)}function Qx(e,t){if(Sc(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Sc(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}function Mw(e){cn(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:i,timeout:s,suspensible:a=!0,onError:l}=e;let u=null,d,f=0;const p=()=>(f++,u=null,g()),g=()=>{let m;return u||(m=u=t().catch(v=>{if(v=v instanceof Error?v:new Error(String(v)),l)return new Promise((C,w)=>{l(v,()=>C(p()),()=>w(v),f+1)});throw v}).then(v=>m!==u&&u?u:(v&&(v.__esModule||v[Symbol.toStringTag]==="Module")&&(v=v.default),d=v,v)))};return pl({name:"AsyncComponentWrapper",__asyncLoader:g,__asyncHydrate(m,v,C){let w=!1;(v.bu||(v.bu=[])).push(()=>w=!0);const S=()=>{w||C()},y=i?()=>{const k=i(S,x=>Qx(m,x));k&&(v.bum||(v.bum=[])).push(k)}:S;d?y():g().then(()=>!v.isUnmounted&&y())},get __asyncResolved(){return d},setup(){const m=mo;if(Uv(m),d)return()=>yp(d,m);const v=y=>{u=null,yc(y,m,13,!r)};if(a&&m.suspense||Cl)return g().then(y=>()=>yp(y,m)).catch(y=>(v(y),()=>r?on(r,{error:y}):null));const C=ne(!1),w=ne(),S=ne(!!o);return o&&setTimeout(()=>{S.value=!1},o),s!=null&&setTimeout(()=>{if(!C.value&&!w.value){const y=new Error(`Async component timed out after ${s}ms.`);v(y),w.value=y}},s),g().then(()=>{C.value=!0,m.parent&&Su(m.parent.vnode)&&m.parent.update()}).catch(y=>{v(y),w.value=y}),()=>{if(C.value&&d)return yp(d,m);if(w.value&&r)return on(r,{error:w.value});if(n&&!S.value)return yp(n,m)}}})}function yp(e,t){const{ref:n,props:r,children:o,ce:i}=t.vnode,s=on(e,r,o);return s.ref=n,s.ce=i,delete t.vnode.ce,s}function vf(e,t){return $t(e)?e.some(n=>vf(n,t)):ar(e)?e.split(",").includes(t):T2(e)?(e.lastIndex=0,e.test(t)):!1}function $v(e,t){Lw(e,"a",t)}function Hv(e,t){Lw(e,"da",t)}function Lw(e,t,n=mo){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(wp(t,r,n),n){let o=n.parent;for(;o&&o.parent;)Su(o.parent.vnode)&&Jx(r,t,n,o),o=o.parent}}function Jx(e,t,n,r){const o=wp(t,e,r,!0);xf(()=>{np(r[t],o)},n)}function Gv(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function bp(e){return e.shapeFlag&128?e.ssContent:e}function wp(e,t,n=mo,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...s)=>{ga();const a=_c(n),l=Hi(t,n,e,s);return a(),va(),l});return r?o.unshift(i):o.push(i),i}}function Pw(e,t=mo){wp("ec",e,t)}function e5(e,t){return Kv(xp,e,!0,t)||e}function Wv(e){return ar(e)?Kv(xp,e,!1)||e:e||by}function Dw(e){return Kv(MC,e)}function Kv(e,t,n=!0,r=!1){const o=po||mo;if(o){const i=o.type;if(e===xp){const a=ny(i,!1);if(a&&(a===t||a===Gr(t)||a===cu(Gr(t))))return i}const s=Ow(o[e]||i[e],t)||Ow(o.appContext[e],t);return!s&&r?i:s}}function Ow(e,t){return e&&(e[t]||e[Gr(t)]||e[cu(Gr(t))])}function Mn(e,t,n,r){let o;const i=n&&n[r],s=$t(e);if(s||ar(e)){const a=s&&ai(e);let l=!1,u=!1;a&&(l=!li(e),u=zs(e),e=ip(e)),o=new Array(e.length);for(let d=0,f=e.length;d<f;d++)o[d]=t(l?u?vc($i(e[d])):$i(e[d]):e[d],d,void 0,i&&i[d])}else if(typeof e=="number"){o=new Array(e);for(let a=0;a<e;a++)o[a]=t(a+1,a,void 0,i&&i[a])}else if(jn(e))if(e[Symbol.iterator])o=Array.from(e,(a,l)=>t(a,l,void 0,i&&i[l]));else{const a=Object.keys(e);o=new Array(a.length);for(let l=0,u=a.length;l<u;l++){const d=a[l];o[l]=t(e[d],d,l,i&&i[l])}}else o=[];return n&&(n[r]=o),o}function t5(e,t){for(let n=0;n<t.length;n++){const r=t[n];if($t(r))for(let o=0;o<r.length;o++)e[r[o].name]=r[o].fn;else r&&(e[r.name]=r.key?(...o)=>{const i=r.fn(...o);return i&&(i.key=r.key),i}:r.fn)}return e}function yu(e,t,n={},r,o){if(po.ce||po.parent&&$s(po.parent)&&po.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),pe(),pn(zt,null,[on("slot",n,r&&r())],u?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),pe();const s=i&&qv(i(n)),a=n.key||s&&s.key,l=pn(zt,{key:(a&&!si(a)?a:`_${t}`)+(!s&&r?"_fb":"")},s||(r?r():[]),s&&e._===1?64:-2);return!o&&l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),i&&i._c&&(i._d=!0),l}function qv(e){return e.some(t=>Sa(t)?!(t.type===Br||t.type===zt&&!qv(t.children)):!0)?e:null}function n5(e,t){const n={};for(const r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:uu(r)]=e[r];return n}function r5(){return null}function o5(){return null}function i5(e){}function s5(e){}function a5(){return null}function l5(){}function c5(e,t){return null}function Fw(){return Bw("useSlots").slots}function Nw(){return Bw("useAttrs").attrs}function Bw(e){const t=Cr();return t.setupContext||(t.setupContext=hC(t))}function yf(e){return $t(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function u5(e,t){const n=yf(e);for(const r in t){if(r.startsWith("__skip"))continue;let o=n[r];o?$t(o)||cn(o)?o=n[r]={type:o,default:t[r]}:o.default=t[r]:o===null&&(o=n[r]={default:t[r]}),o&&t[`__skip_${r}`]&&(o.skipFactory=!0)}return n}function d5(e,t){return!e||!t?e||t:$t(e)&&$t(t)?e.concat(t):Yn({},yf(e),yf(t))}function f5(e,t){const n={};for(const r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function h5(e){const t=Cr(),n=Cl;let r=e();Eu(),n&&Iu(!1);const o=()=>{_c(t),n&&Iu(!0)},i=()=>{Cr()!==t&&t.scope.off(),Eu(),n&&Iu(!1)};return rp(r)&&(r=r.catch(s=>{throw o(),Promise.resolve().then(()=>Promise.resolve().then(i)),s})),[r,()=>{o(),Promise.resolve().then(i)}]}function p5(e){const t=Yv(e),n=e.proxy,r=e.ctx;Pp=!1,t.beforeCreate&&zw(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:u,created:d,beforeMount:f,mounted:p,beforeUpdate:g,updated:m,activated:v,deactivated:C,beforeDestroy:w,beforeUnmount:S,destroyed:y,unmounted:k,render:x,renderTracked:M,renderTriggered:z,errorCaptured:q,serverPrefetch:B,expose:L,inheritAttrs:V,components:T,directives:$,filters:R}=t;if(u&&m5(u,r,null),s)for(const ee in s){const J=s[ee];cn(J)&&(r[ee]=J.bind(n))}if(o){const ee=o.call(n,n);jn(ee)&&(e.data=no(ee))}if(Pp=!0,i)for(const ee in i){const J=i[ee],X=cn(J)?J.bind(n,n):cn(J.get)?J.get.bind(n,n):Si,xe=!cn(J)&&cn(J.set)?J.set.bind(n):Si,fe=ke({get:X,set:xe});Object.defineProperty(r,ee,{enumerable:!0,configurable:!0,get:()=>fe.value,set:ye=>fe.value=ye})}if(a)for(const ee in a)jw(a[ee],r,n,ee);if(l){const ee=cn(l)?l.call(n):l;Reflect.ownKeys(ee).forEach(J=>{kw(J,ee[J])})}d&&zw(d,e,"c");function G(ee,J){$t(J)?J.forEach(X=>ee(X.bind(n))):J&&ee(J.bind(n))}if(G(my,f),G(Nn,p),G(Tp,g),G(Tf,m),G($v,v),G(Hv,C),G(Pw,q),G(yy,M),G(vy,z),G(hr,S),G(xf,k),G(gy,B),$t(L))if(L.length){const ee=e.exposed||(e.exposed={});L.forEach(J=>{Object.defineProperty(ee,J,{get:()=>n[J],set:X=>n[J]=X,enumerable:!0})})}else e.exposed||(e.exposed={});x&&e.render===Si&&(e.render=x),V!=null&&(e.inheritAttrs=V),T&&(e.components=T),$&&(e.directives=$),B&&Uv(e)}function m5(e,t,n=Si){$t(e)&&(e=Xv(e));for(const r in e){const o=e[r];let i;jn(o)?"default"in o?i=hl(o.from||r,o.default,!0):i=hl(o.from||r):i=hl(o),vr(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):t[r]=i}}function zw(e,t,n){Hi($t(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function jw(e,t,n,r){let o=r.includes(".")?Aw(n,r):()=>n[r];if(ar(e)){const i=t[e];cn(i)&&Vt(o,i)}else if(cn(e))Vt(o,e.bind(n));else if(jn(e))if($t(e))e.forEach(i=>jw(i,t,n,r));else{const i=cn(e.handler)?e.handler.bind(n):t[e.handler];cn(i)&&Vt(o,i,e)}}function Yv(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:i,config:{optionMergeStrategies:s}}=e.appContext,a=i.get(t);let l;return a?l=a:!o.length&&!n&&!r?l=t:(l={},o.length&&o.forEach(u=>Cp(l,u,s,!0)),Cp(l,t,s)),jn(t)&&i.set(t,l),l}function Cp(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&Cp(e,i,n,!0),o&&o.forEach(s=>Cp(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const a=PC[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}function Vw(e,t){return t?e?function(){return Yn(cn(e)?e.call(this,this):e,cn(t)?t.call(this,this):t)}:t:e}function g5(e,t){return bf(Xv(e),Xv(t))}function Xv(e){if($t(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Qo(e,t){return e?[...new Set([].concat(e,t))]:t}function bf(e,t){return e?Yn(Object.create(null),e,t):t}function Uw(e,t){return e?$t(e)&&$t(t)?[...new Set([...e,...t])]:Yn(Object.create(null),yf(e),yf(t??{})):t}function v5(e,t){if(!e)return t;if(!t)return e;const n=Yn(Object.create(null),e);for(const r in t)n[r]=Qo(e[r],t[r]);return n}function $w(){return{app:null,config:{isNativeTag:uv,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}function y5(e,t){return function(r,o=null){cn(r)||(r=Yn({},r)),o!=null&&!jn(o)&&(o=null);const i=$w(),s=new WeakSet,a=[];let l=!1;const u=i.app={_uid:DC++,_component:r,_props:o,_container:null,_context:i,_instance:null,version:xy,get config(){return i.config},set config(d){},use(d,...f){return s.has(d)||(d&&cn(d.install)?(s.add(d),d.install(u,...f)):cn(d)&&(s.add(d),d(u,...f))),u},mixin(d){return i.mixins.includes(d)||i.mixins.push(d),u},component(d,f){return f?(i.components[d]=f,u):i.components[d]},directive(d,f){return f?(i.directives[d]=f,u):i.directives[d]},mount(d,f,p){if(!l){const g=u._ceVNode||on(r,o);return g.appContext=i,p===!0?p="svg":p===!1&&(p=void 0),f&&t?t(g,d):e(g,d,p),l=!0,u._container=d,d.__vue_app__=u,kf(g.component)}},onUnmount(d){a.push(d)},unmount(){l&&(Hi(a,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(d,f){return i.provides[d]=f,u},runWithContext(d){const f=yl;yl=u;try{return d()}finally{yl=f}}};return u}}function b5(e,t,n=Dn){const r=Cr(),o=Gr(t),i=Zo(t),s=wy(e,o),a=q2((l,u)=>{let d,f=Dn,p;return _w(()=>{const g=e[o];fo(d,g)&&(d=g,u())}),{get(){return l(),n.get?n.get(d):d},set(g){const m=n.set?n.set(g):g;if(!fo(m,d)&&!(f!==Dn&&fo(g,f)))return;const v=r.vnode.props;v&&(t in v||o in v||i in v)&&(`onUpdate:${t}`in v||`onUpdate:${o}`in v||`onUpdate:${i}`in v)||(d=g,u()),r.emit(`update:${t}`,m),fo(g,m)&&fo(g,f)&&!fo(m,p)&&u(),f=g,p=m}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?s||Dn:a,done:!1}:{done:!0}}}},a}function w5(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Dn;let o=n;const i=t.startsWith("update:"),s=i&&wy(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>ar(d)?d.trim():d)),s.number&&(o=n.map(ef)));let a,l=r[a=uu(t)]||r[a=uu(Gr(t))];!l&&i&&(l=r[a=uu(Zo(t))]),l&&Hi(l,e,6,o);const u=r[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Hi(u,e,6,o)}}function Hw(e,t,n=!1){const r=n?OC:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const i=e.emits;let s={},a=!1;if(!cn(e)){const l=u=>{const d=Hw(u,t,!0);d&&(a=!0,Yn(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(jn(e)&&r.set(e,null),null):($t(i)?i.forEach(l=>s[l]=null):Yn(s,i),jn(e)&&r.set(e,s),s)}function kp(e,t){return!e||!lu(t)?!1:(t=t.slice(2).replace(/Once$/,""),Gn(e,t[0].toLowerCase()+t.slice(1))||Gn(e,Zo(t))||Gn(e,t))}function Sp(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:u,renderCache:d,props:f,data:p,setupState:g,ctx:m,inheritAttrs:v}=e,C=pf(e);let w,S;try{if(n.shapeFlag&4){const k=o||r,x=k;w=ci(u.call(x,k,d,f,g,p,m)),S=a}else{const k=t;w=ci(k.length>1?k(f,{attrs:a,slots:s,emit:l}):k(f,null)),S=t.props?a:FC(a)}}catch(k){Au.length=0,yc(k,e,1),w=on(Br)}let y=w;if(S&&v!==!1){const k=Object.keys(S),{shapeFlag:x}=y;k.length&&x&7&&(i&&k.some(Xd)&&(S=NC(S,i)),y=Vs(y,S,!1,!0))}return n.dirs&&(y=Vs(y,null,!1,!0),y.dirs=y.dirs?y.dirs.concat(n.dirs):n.dirs),n.transition&&ka(y,n.transition),w=y,pf(C),w}function C5(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(Sa(o)){if(o.type!==Br||o.children==="v-if"){if(n)return;n=o}}else return}return n}function k5(e,t,n){const{props:r,children:o,component:i}=e,{props:s,children:a,patchFlag:l}=t,u=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?Gw(r,s,u):!!s;if(l&8){const d=t.dynamicProps;for(let f=0;f<d.length;f++){const p=d[f];if(Ww(s,r,p)&&!kp(u,p))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:r===s?!1:r?s?Gw(r,s,u):!0:!!s;return!1}function Gw(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let o=0;o<r.length;o++){const i=r[o];if(Ww(t,e,i)&&!kp(n,i))return!0}return!1}function Ww(e,t,n){const r=e[n],o=t[n];return n==="style"&&jn(r)&&jn(o)?!ma(r,o):r!==o}function _p({vnode:e,parent:t,suspense:n},r){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=r,e=o),o===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}function S5(e,t,n,r=!1){const o={},i=ky();e.propsDefaults=Object.create(null),Kw(e,t,o,i);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:W2(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function _5(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=kn(o),[l]=e.propsOptions;let u=!1;if((r||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let f=0;f<d.length;f++){let p=d[f];if(kp(e.emitsOptions,p))continue;const g=t[p];if(l)if(Gn(i,p))g!==i[p]&&(i[p]=g,u=!0);else{const m=Gr(p);o[m]=Zv(l,a,m,g,e,!1)}else g!==i[p]&&(i[p]=g,u=!0)}}}else{Kw(e,t,o,i)&&(u=!0);let d;for(const f in a)(!t||!Gn(t,f)&&((d=Zo(f))===f||!Gn(t,d)))&&(l?n&&(n[f]!==void 0||n[d]!==void 0)&&(o[f]=Zv(l,a,f,void 0,e,!0)):delete o[f]);if(i!==a)for(const f in i)(!t||!Gn(t,f))&&(delete i[f],u=!0)}u&&ya(e.attrs,"set","")}function Kw(e,t,n,r){const[o,i]=e.propsOptions;let s=!1,a;if(t)for(let l in t){if(dl(l))continue;const u=t[l];let d;o&&Gn(o,d=Gr(l))?!i||!i.includes(d)?n[d]=u:(a||(a={}))[d]=u:kp(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,s=!0)}if(i){const l=kn(n),u=a||Dn;for(let d=0;d<i.length;d++){const f=i[d];n[f]=Zv(o,l,f,u[f],e,!Gn(u,f))}}return s}function Zv(e,t,n,r,o,i){const s=e[n];if(s!=null){const a=Gn(s,"default");if(a&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&cn(l)){const{propsDefaults:u}=o;if(n in u)r=u[n];else{const d=_c(o);r=u[n]=l.call(null,t),d()}}else r=l;o.ce&&o.ce._setProp(n,r)}s[0]&&(i&&!a?r=!1:s[1]&&(r===""||r===Zo(n))&&(r=!0))}return r}function qw(e,t,n=!1){const r=n?BC:t.propsCache,o=r.get(e);if(o)return o;const i=e.props,s={},a=[];let l=!1;if(!cn(e)){const d=f=>{l=!0;const[p,g]=qw(f,t,!0);Yn(s,p),g&&a.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!i&&!l)return jn(e)&&r.set(e,hc),hc;if($t(i))for(let d=0;d<i.length;d++){const f=Gr(i[d]);Yw(f)&&(s[f]=Dn)}else if(i)for(const d in i){const f=Gr(d);if(Yw(f)){const p=i[d],g=s[f]=$t(p)||cn(p)?{type:p}:Yn({},p),m=g.type;let v=!1,C=!0;if($t(m))for(let w=0;w<m.length;++w){const S=m[w],y=cn(S)&&S.name;if(y==="Boolean"){v=!0;break}else y==="String"&&(C=!1)}else v=cn(m)&&m.name==="Boolean";g[0]=v,g[1]=C,(v||Gn(g,"default"))&&a.push(f)}}const u=[s,a];return jn(e)&&r.set(e,u),u}function Yw(e){return e[0]!=="$"&&!dl(e)}function Xw(e){return Qw(e)}function Zw(e){return Qw(e,Xx)}function Qw(e,t){const n=nf();n.__VUE__=!0;const{insert:r,remove:o,patchProp:i,createElement:s,createText:a,createComment:l,setText:u,setElementText:d,parentNode:f,nextSibling:p,setScopeId:g=Si,insertStaticContent:m}=e,v=(Q,I,ie,j=null,Z=null,K=null,ae=void 0,Ce=null,D=!!I.dynamicChildren)=>{if(Q===I)return;Q&&!hs(Q,I)&&(j=ut(Q),ye(Q,Z,K,!0),Q=null),I.patchFlag===-2&&(D=!1,I.dynamicChildren=null);const{type:N,ref:me,shapeFlag:Se}=I;switch(N){case Ia:C(Q,I,ie,j);break;case Br:w(Q,I,ie,j);break;case bl:Q==null&&S(I,ie,j,ae);break;case zt:T(Q,I,ie,j,Z,K,ae,Ce,D);break;default:Se&1?x(Q,I,ie,j,Z,K,ae,Ce,D):Se&6?$(Q,I,ie,j,Z,K,ae,Ce,D):(Se&64||Se&128)&&N.process(Q,I,ie,j,Z,K,ae,Ce,D,Re)}me!=null&&Z?vu(me,Q&&Q.ref,K,I||Q,!I):me==null&&Q&&Q.ref!=null&&vu(Q.ref,null,K,Q,!0)},C=(Q,I,ie,j)=>{if(Q==null)r(I.el=a(I.children),ie,j);else{const Z=I.el=Q.el;I.children!==Q.children&&u(Z,I.children)}},w=(Q,I,ie,j)=>{Q==null?r(I.el=l(I.children||""),ie,j):I.el=Q.el},S=(Q,I,ie,j)=>{[Q.el,Q.anchor]=m(Q.children,I,ie,j,Q.el,Q.anchor)},y=({el:Q,anchor:I},ie,j)=>{let Z;for(;Q&&Q!==I;)Z=p(Q),r(Q,ie,j),Q=Z;r(I,ie,j)},k=({el:Q,anchor:I})=>{let ie;for(;Q&&Q!==I;)ie=p(Q),o(Q),Q=ie;o(I)},x=(Q,I,ie,j,Z,K,ae,Ce,D)=>{if(I.type==="svg"?ae="svg":I.type==="math"&&(ae="mathml"),Q==null)M(I,ie,j,Z,K,ae,Ce,D);else{const N=Q.el&&Q.el._isVueCE?Q.el:null;try{N&&N._beginPatch(),B(Q,I,Z,K,ae,Ce,D)}finally{N&&N._endPatch()}}},M=(Q,I,ie,j,Z,K,ae,Ce)=>{let D,N;const{props:me,shapeFlag:Se,transition:Te,dirs:Ne}=Q;if(D=Q.el=s(Q.type,K,me&&me.is,me),Se&8?d(D,Q.children):Se&16&&q(Q.children,D,null,j,Z,Qv(Q,K),ae,Ce),Ne&&js(Q,null,j,"created"),z(D,Q,Q.scopeId,ae,j),me){for(const rt in me)rt!=="value"&&!dl(rt)&&i(D,rt,null,me[rt],K,j);"value"in me&&i(D,"value",null,me.value,K),(N=me.onVnodeBeforeMount)&&ui(N,j,Q)}Ne&&js(Q,null,j,"beforeMount");const Ge=Jw(Z,Te);Ge&&Te.beforeEnter(D),r(D,I,ie),((N=me&&me.onVnodeMounted)||Ge||Ne)&&Wr(()=>{N&&ui(N,j,Q),Ge&&Te.enter(D),Ne&&js(Q,null,j,"mounted")},Z)},z=(Q,I,ie,j,Z)=>{if(ie&&g(Q,ie),j)for(let K=0;K<j.length;K++)g(Q,j[K]);if(Z){let K=Z.subTree;if(I===K||Rf(K.type)&&(K.ssContent===I||K.ssFallback===I)){const ae=Z.vnode;z(Q,ae,ae.scopeId,ae.slotScopeIds,Z.parent)}}},q=(Q,I,ie,j,Z,K,ae,Ce,D=0)=>{for(let N=D;N<Q.length;N++){const me=Q[N]=Ce?_a(Q[N]):ci(Q[N]);v(null,me,I,ie,j,Z,K,ae,Ce)}},B=(Q,I,ie,j,Z,K,ae)=>{const Ce=I.el=Q.el;let{patchFlag:D,dynamicChildren:N,dirs:me}=I;D|=Q.patchFlag&16;const Se=Q.props||Dn,Te=I.props||Dn;let Ne;if(ie&&bc(ie,!1),(Ne=Te.onVnodeBeforeUpdate)&&ui(Ne,ie,I,Q),me&&js(I,Q,ie,"beforeUpdate"),ie&&bc(ie,!0),(Se.innerHTML&&Te.innerHTML==null||Se.textContent&&Te.textContent==null)&&d(Ce,""),N?L(Q.dynamicChildren,N,Ce,ie,j,Qv(I,Z),K):ae||J(Q,I,Ce,null,ie,j,Qv(I,Z),K,!1),D>0){if(D&16)V(Ce,Se,Te,ie,Z);else if(D&2&&Se.class!==Te.class&&i(Ce,"class",null,Te.class,Z),D&4&&i(Ce,"style",Se.style,Te.style,Z),D&8){const Ge=I.dynamicProps;for(let rt=0;rt<Ge.length;rt++){const vt=Ge[rt],Ot=Se[vt],Mt=Te[vt];(Mt!==Ot||vt==="value")&&i(Ce,vt,Ot,Mt,Z,ie)}}D&1&&Q.children!==I.children&&d(Ce,I.children)}else!ae&&N==null&&V(Ce,Se,Te,ie,Z);((Ne=Te.onVnodeUpdated)||me)&&Wr(()=>{Ne&&ui(Ne,ie,I,Q),me&&js(I,Q,ie,"updated")},j)},L=(Q,I,ie,j,Z,K,ae)=>{for(let Ce=0;Ce<I.length;Ce++){const D=Q[Ce],N=I[Ce],me=D.el&&(D.type===zt||!hs(D,N)||D.shapeFlag&198)?f(D.el):ie;v(D,N,me,null,j,Z,K,ae,!0)}},V=(Q,I,ie,j,Z)=>{if(I!==ie){if(I!==Dn)for(const K in I)!dl(K)&&!(K in ie)&&i(Q,K,I[K],null,Z,j);for(const K in ie){if(dl(K))continue;const ae=ie[K],Ce=I[K];ae!==Ce&&K!=="value"&&i(Q,K,Ce,ae,Z,j)}"value"in ie&&i(Q,"value",I.value,ie.value,Z)}},T=(Q,I,ie,j,Z,K,ae,Ce,D)=>{const N=I.el=Q?Q.el:a(""),me=I.anchor=Q?Q.anchor:a("");let{patchFlag:Se,dynamicChildren:Te,slotScopeIds:Ne}=I;Ne&&(Ce=Ce?Ce.concat(Ne):Ne),Q==null?(r(N,ie,j),r(me,ie,j),q(I.children||[],ie,me,Z,K,ae,Ce,D)):Se>0&&Se&64&&Te&&Q.dynamicChildren&&Q.dynamicChildren.length===Te.length?(L(Q.dynamicChildren,Te,ie,Z,K,ae,Ce),(I.key!=null||Z&&I===Z.subTree)&&Jv(Q,I,!0)):J(Q,I,ie,me,Z,K,ae,Ce,D)},$=(Q,I,ie,j,Z,K,ae,Ce,D)=>{I.slotScopeIds=Ce,Q==null?I.shapeFlag&512?Z.ctx.activate(I,ie,j,ae,D):R(I,ie,j,Z,K,ae,D):H(Q,I,D)},R=(Q,I,ie,j,Z,K,ae)=>{const Ce=Q.component=cC(Q,j,Z);if(Su(Q)&&(Ce.ctx.renderer=Re),dC(Ce,!1,ae),Ce.asyncDep){if(Z&&Z.registerDep(Ce,G,ae),!Q.el){const D=Ce.subTree=on(Br);w(null,D,I,ie),Q.placeholder=D.el}}else G(Ce,Q,I,ie,Z,K,ae)},H=(Q,I,ie)=>{const j=I.component=Q.component;if(k5(Q,I,ie))if(j.asyncDep&&!j.asyncResolved){ee(j,I,ie);return}else j.next=I,j.update();else I.el=Q.el,j.vnode=I},G=(Q,I,ie,j,Z,K,ae)=>{const Ce=()=>{if(Q.isMounted){let{next:Se,bu:Te,u:Ne,parent:Ge,vnode:rt}=Q;{const Ue=eC(Q);if(Ue){Se&&(Se.el=rt.el,ee(Q,Se,ae)),Ue.asyncDep.then(()=>{Wr(()=>{Q.isUnmounted||N()},Z)});return}}let vt=Se,Ot;bc(Q,!1),Se?(Se.el=rt.el,ee(Q,Se,ae)):Se=rt,Te&&gc(Te),(Ot=Se.props&&Se.props.onVnodeBeforeUpdate)&&ui(Ot,Ge,Se,rt),bc(Q,!0);const Mt=Sp(Q),Yt=Q.subTree;Q.subTree=Mt,v(Yt,Mt,f(Yt.el),ut(Yt),Q,Z,K),Se.el=Mt.el,vt===null&&_p(Q,Mt.el),Ne&&Wr(Ne,Z),(Ot=Se.props&&Se.props.onVnodeUpdated)&&Wr(()=>ui(Ot,Ge,Se,rt),Z)}else{let Se;const{el:Te,props:Ne}=I,{bm:Ge,m:rt,parent:vt,root:Ot,type:Mt}=Q,Yt=$s(I);if(bc(Q,!1),Ge&&gc(Ge),!Yt&&(Se=Ne&&Ne.onVnodeBeforeMount)&&ui(Se,vt,I),bc(Q,!0),Te&&be){const Ue=()=>{Q.subTree=Sp(Q),be(Te,Q.subTree,Q,Z,null)};Yt&&Mt.__asyncHydrate?Mt.__asyncHydrate(Te,Q,Ue):Ue()}else{Ot.ce&&Ot.ce._hasShadowRoot()&&Ot.ce._injectChildStyle(Mt,Q.parent?Q.parent.type:void 0);const Ue=Q.subTree=Sp(Q);v(null,Ue,ie,j,Q,Z,K),I.el=Ue.el}if(rt&&Wr(rt,Z),!Yt&&(Se=Ne&&Ne.onVnodeMounted)){const Ue=I;Wr(()=>ui(Se,vt,Ue),Z)}(I.shapeFlag&256||vt&&$s(vt.vnode)&&vt.vnode.shapeFlag&256)&&Q.a&&Wr(Q.a,Z),Q.isMounted=!0,I=ie=j=null}};Q.scope.on();const D=Q.effect=new fu(Ce);Q.scope.off();const N=Q.update=D.run.bind(D),me=Q.job=D.runIfDirty.bind(D);me.i=Q,me.id=Q.uid,D.scheduler=()=>Bv(me),bc(Q,!0),N()},ee=(Q,I,ie)=>{I.component=Q;const j=Q.vnode.props;Q.vnode=I,Q.next=null,_5(Q,I.props,j,ie),VC(Q,I.children,ie),ga(),bw(Q),va()},J=(Q,I,ie,j,Z,K,ae,Ce,D=!1)=>{const N=Q&&Q.children,me=Q?Q.shapeFlag:0,Se=I.children,{patchFlag:Te,shapeFlag:Ne}=I;if(Te>0){if(Te&128){xe(N,Se,ie,j,Z,K,ae,Ce,D);return}else if(Te&256){X(N,Se,ie,j,Z,K,ae,Ce,D);return}}Ne&8?(me&16&&nt(N,Z,K),Se!==N&&d(ie,Se)):me&16?Ne&16?xe(N,Se,ie,j,Z,K,ae,Ce,D):nt(N,Z,K,!0):(me&8&&d(ie,""),Ne&16&&q(Se,ie,j,Z,K,ae,Ce,D))},X=(Q,I,ie,j,Z,K,ae,Ce,D)=>{Q=Q||hc,I=I||hc;const N=Q.length,me=I.length,Se=Math.min(N,me);let Te;for(Te=0;Te<Se;Te++){const Ne=I[Te]=D?_a(I[Te]):ci(I[Te]);v(Q[Te],Ne,ie,null,Z,K,ae,Ce,D)}N>me?nt(Q,Z,K,!0,!1,Se):q(I,ie,j,Z,K,ae,Ce,D,Se)},xe=(Q,I,ie,j,Z,K,ae,Ce,D)=>{let N=0;const me=I.length;let Se=Q.length-1,Te=me-1;for(;N<=Se&&N<=Te;){const Ne=Q[N],Ge=I[N]=D?_a(I[N]):ci(I[N]);if(hs(Ne,Ge))v(Ne,Ge,ie,null,Z,K,ae,Ce,D);else break;N++}for(;N<=Se&&N<=Te;){const Ne=Q[Se],Ge=I[Te]=D?_a(I[Te]):ci(I[Te]);if(hs(Ne,Ge))v(Ne,Ge,ie,null,Z,K,ae,Ce,D);else break;Se--,Te--}if(N>Se){if(N<=Te){const Ne=Te+1,Ge=Ne<me?I[Ne].el:j;for(;N<=Te;)v(null,I[N]=D?_a(I[N]):ci(I[N]),ie,Ge,Z,K,ae,Ce,D),N++}}else if(N>Te)for(;N<=Se;)ye(Q[N],Z,K,!0),N++;else{const Ne=N,Ge=N,rt=new Map;for(N=Ge;N<=Te;N++){const Xt=I[N]=D?_a(I[N]):ci(I[N]);Xt.key!=null&&rt.set(Xt.key,N)}let vt,Ot=0;const Mt=Te-Ge+1;let Yt=!1,Ue=0;const nn=new Array(Mt);for(N=0;N<Mt;N++)nn[N]=0;for(N=Ne;N<=Se;N++){const Xt=Q[N];if(Ot>=Mt){ye(Xt,Z,K,!0);continue}let Bn;if(Xt.key!=null)Bn=rt.get(Xt.key);else for(vt=Ge;vt<=Te;vt++)if(nn[vt-Ge]===0&&hs(Xt,I[vt])){Bn=vt;break}Bn===void 0?ye(Xt,Z,K,!0):(nn[Bn-Ge]=N+1,Bn>=Ue?Ue=Bn:Yt=!0,v(Xt,I[Bn],ie,null,Z,K,ae,Ce,D),Ot++)}const Un=Yt?A5(nn):hc;for(vt=Un.length-1,N=Mt-1;N>=0;N--){const Xt=Ge+N,Bn=I[Xt],Ln=I[Xt+1],jr=Xt+1<me?Ln.el||tC(Ln):j;nn[N]===0?v(null,Bn,ie,jr,Z,K,ae,Ce,D):Yt&&(vt<0||N!==Un[vt]?fe(Bn,ie,jr,2):vt--)}}},fe=(Q,I,ie,j,Z=null)=>{const{el:K,type:ae,transition:Ce,children:D,shapeFlag:N}=Q;if(N&6){fe(Q.component.subTree,I,ie,j);return}if(N&128){Q.suspense.move(I,ie,j);return}if(N&64){ae.move(Q,I,ie,Re);return}if(ae===zt){r(K,I,ie);for(let me=0;me<D.length;me++)fe(D[me],I,ie,j);r(Q.anchor,I,ie);return}if(ae===bl){y(Q,I,ie);return}if(j!==2&&N&1&&Ce)if(j===0)Ce.beforeEnter(K),r(K,I,ie),Wr(()=>Ce.enter(K),Z);else{const{leave:me,delayLeave:Se,afterLeave:Te}=Ce,Ne=()=>{Q.ctx.isUnmounted?o(K):r(K,I,ie)},Ge=()=>{K._isLeaving&&K[ms](!0),me(K,()=>{Ne(),Te&&Te()})};Se?Se(K,Ne,Ge):Ge()}else r(K,I,ie)},ye=(Q,I,ie,j=!1,Z=!1)=>{const{type:K,props:ae,ref:Ce,children:D,dynamicChildren:N,shapeFlag:me,patchFlag:Se,dirs:Te,cacheIndex:Ne,memo:Ge}=Q;if(Se===-2&&(Z=!1),Ce!=null&&(ga(),vu(Ce,null,ie,Q,!0),va()),Ne!=null&&(I.renderCache[Ne]=void 0),me&256){I.ctx.deactivate(Q);return}const rt=me&1&&Te,vt=!$s(Q);let Ot;if(vt&&(Ot=ae&&ae.onVnodeBeforeUnmount)&&ui(Ot,I,Q),me&6)je(Q.component,ie,j);else{if(me&128){Q.suspense.unmount(ie,j);return}rt&&js(Q,null,I,"beforeUnmount"),me&64?Q.type.remove(Q,I,ie,Re,j):N&&!N.hasOnce&&(K!==zt||Se>0&&Se&64)?nt(N,I,ie,!1,!0):(K===zt&&Se&384||!Z&&me&16)&&nt(D,I,ie),j&&ve(Q)}const Mt=Ge!=null&&Ne==null;(vt&&(Ot=ae&&ae.onVnodeUnmounted)||rt||Mt)&&Wr(()=>{Ot&&ui(Ot,I,Q),rt&&js(Q,null,I,"unmounted"),Mt&&(Q.el=null)},ie)},ve=Q=>{const{type:I,el:ie,anchor:j,transition:Z}=Q;if(I===zt){Le(ie,j);return}if(I===bl){k(Q);return}const K=()=>{o(ie),Z&&!Z.persisted&&Z.afterLeave&&Z.afterLeave()};if(Q.shapeFlag&1&&Z&&!Z.persisted){const{leave:ae,delayLeave:Ce}=Z,D=()=>ae(ie,K);Ce?Ce(Q.el,K,D):D()}else K()},Le=(Q,I)=>{let ie;for(;Q!==I;)ie=p(Q),o(Q),Q=ie;o(I)},je=(Q,I,ie)=>{const{bum:j,scope:Z,job:K,subTree:ae,um:Ce,m:D,a:N}=Q;Ap(D),Ap(N),j&&gc(j),Z.stop(),K&&(K.flags|=8,ye(ae,Q,I,ie)),Ce&&Wr(Ce,I),Wr(()=>{Q.isUnmounted=!0},I)},nt=(Q,I,ie,j=!1,Z=!1,K=0)=>{for(let ae=K;ae<Q.length;ae++)ye(Q[ae],I,ie,j,Z)},ut=Q=>{if(Q.shapeFlag&6)return ut(Q.component.subTree);if(Q.shapeFlag&128)return Q.suspense.next();const I=p(Q.anchor||Q.el),ie=I&&I[ay];return ie?p(ie):I};let ft=!1;const At=(Q,I,ie)=>{let j;Q==null?I._vnode&&(ye(I._vnode,null,null,!0),j=I._vnode.component):v(I._vnode||null,Q,I,null,null,null,ie),I._vnode=Q,ft||(ft=!0,bw(j),pp(),ft=!1)},Re={p:v,um:ye,m:fe,r:ve,mt:R,mc:q,pc:J,pbc:L,n:ut,o:e};let se,be;return t&&([se,be]=t(Re)),{render:At,hydrate:se,createApp:y5(At,se)}}function Qv({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function bc({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Jw(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Jv(e,t,n=!1){const r=e.children,o=t.children;if($t(r)&&$t(o))for(let i=0;i<r.length;i++){const s=r[i];let a=o[i];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=o[i]=_a(o[i]),a.el=s.el),!n&&a.patchFlag!==-2&&Jv(s,a)),a.type===Ia&&(a.patchFlag===-1&&(a=o[i]=_a(a)),a.el=s.el),a.type===Br&&!a.el&&(a.el=s.el)}}function A5(e){const t=e.slice(),n=[0];let r,o,i,s,a;const l=e.length;for(r=0;r<l;r++){const u=e[r];if(u!==0){if(o=n[n.length-1],e[o]<u){t[r]=o,n.push(r);continue}for(i=0,s=n.length-1;i<s;)a=i+s>>1,e[n[a]]<u?i=a+1:s=a;u<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r)}}for(i=n.length,s=n[i-1];i-- >0;)n[i]=s,s=t[s];return n}function eC(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:eC(t)}function Ap(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function tC(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?tC(t.subTree):null}function wf(e,t){const n=e.props&&e.props[t];cn(n)&&n()}function I5(e,t,n,r,o,i,s,a,l){const{p:u,o:{createElement:d}}=l,f=d("div"),p=e.suspense=nC(e,o,r,t,f,n,i,s,a,l);u(null,p.pendingBranch=e.ssContent,f,null,r,p,i,s),p.deps>0?(wf(e,"onPending"),wf(e,"onFallback"),u(null,e.ssFallback,t,n,r,null,i,s),bu(p,e.ssFallback)):p.resolve(!1,!0)}function E5(e,t,n,r,o,i,s,a,{p:l,um:u,o:{createElement:d}}){const f=t.suspense=e.suspense;f.vnode=t,t.el=e.el;const p=t.ssContent,g=t.ssFallback,{activeBranch:m,pendingBranch:v,isInFallback:C,isHydrating:w}=f;if(v)f.pendingBranch=p,hs(v,p)?(l(v,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():C&&(w||(l(m,g,n,r,o,null,i,s,a),bu(f,g)))):(f.pendingId=Fp++,w?(f.isHydrating=!1,f.activeBranch=v):u(v,o,f),f.deps=0,f.effects.length=0,f.hiddenContainer=d("div"),C?(l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():(l(m,g,n,r,o,null,i,s,a),bu(f,g))):m&&hs(m,p)?(l(m,p,n,r,o,f,i,s,a),f.resolve(!0)):(l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0&&f.resolve()));else if(m&&hs(m,p))l(m,p,n,r,o,f,i,s,a),bu(f,p);else if(wf(t,"onPending"),f.pendingBranch=p,p.shapeFlag&512?f.pendingId=p.component.suspenseId:f.pendingId=Fp++,l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0)f.resolve();else{const{timeout:S,pendingId:y}=f;S>0?setTimeout(()=>{f.pendingId===y&&f.fallback(g)},S):S===0&&f.fallback(g)}}function nC(e,t,n,r,o,i,s,a,l,u,d=!1){const{p:f,m:p,um:g,n:m,o:{parentNode:v,remove:C}}=u;let w;const S=R5(e);S&&t&&t.pendingBranch&&(w=t.pendingId,t.deps++);const y=e.props?tf(e.props.timeout):void 0,k=i,x={vnode:e,parent:t,parentComponent:n,namespace:s,container:r,hiddenContainer:o,deps:0,pendingId:Fp++,timeout:typeof y=="number"?y:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!d,isHydrating:d,isUnmounted:!1,effects:[],resolve(M=!1,z=!1){const{vnode:q,activeBranch:B,pendingBranch:L,pendingId:V,effects:T,parentComponent:$,container:R,isInFallback:H}=x;let G=!1;x.isHydrating?x.isHydrating=!1:M||(G=B&&L.transition&&L.transition.mode==="out-in",G&&(B.transition.afterLeave=()=>{V===x.pendingId&&(p(L,R,i===k?m(B):i,0),hf(T),H&&q.ssFallback&&(q.ssFallback.el=null))}),B&&!x.isFallbackMountPending&&(v(B.el)===R&&(i=m(B)),g(B,$,x,!0),!G&&H&&q.ssFallback&&Wr(()=>q.ssFallback.el=null,x)),G||p(L,R,i,0)),x.isFallbackMountPending=!1,bu(x,L),x.pendingBranch=null,x.isInFallback=!1;let ee=x.parent,J=!1;for(;ee;){if(ee.pendingBranch){ee.effects.push(...T),J=!0;break}ee=ee.parent}!J&&!G&&hf(T),x.effects=[],S&&t&&t.pendingBranch&&w===t.pendingId&&(t.deps--,t.deps===0&&!z&&t.resolve()),wf(q,"onResolve")},fallback(M){if(!x.pendingBranch)return;const{vnode:z,activeBranch:q,parentComponent:B,container:L,namespace:V}=x;wf(z,"onFallback");const T=m(q),$=()=>{x.isFallbackMountPending=!1,x.isInFallback&&(f(null,M,L,T,B,null,V,a,l),bu(x,M))},R=M.transition&&M.transition.mode==="out-in";R&&(x.isFallbackMountPending=!0,q.transition.afterLeave=$),x.isInFallback=!0,g(q,B,null,!0),R||$()},move(M,z,q){x.activeBranch&&p(x.activeBranch,M,z,q),x.container=M},next(){return x.activeBranch&&m(x.activeBranch)},registerDep(M,z,q){const B=!!x.pendingBranch;B&&x.deps++;const L=M.vnode.el;M.asyncDep.catch(V=>{yc(V,M,0)}).then(V=>{if(M.isUnmounted||x.isUnmounted||x.pendingId!==M.suspenseId)return;Eu(),M.asyncResolved=!0;const{vnode:T}=M;ty(M,V,!1),L&&(T.el=L);const $=!L&&M.subTree.el;z(M,T,v(L||M.subTree.el),L?null:m(M.subTree),x,s,q),$&&(T.placeholder=null,C($)),_p(M,T.el),B&&--x.deps===0&&x.resolve()})},unmount(M,z){x.isUnmounted=!0,x.activeBranch&&g(x.activeBranch,n,M,z),x.pendingBranch&&g(x.pendingBranch,n,M,z)}};return x}function T5(e,t,n,r,o,i,s,a,l){const u=t.suspense=nC(t,r,n,e.parentNode,document.createElement("div"),null,o,i,s,a,!0),d=l(e,u.pendingBranch=t.ssContent,n,u,i,s);return u.deps===0&&u.resolve(!1,!0),d}function x5(e){const{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=rC(r?n.default:n),e.ssFallback=r?rC(n.fallback):on(Br)}function rC(e){let t;if(cn(e)){const n=wl&&e._c;n&&(e._d=!1,pe()),e=e(),n&&(e._d=!0,t=Io,iC())}return $t(e)&&(e=C5(e)),e=ci(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function oC(e,t){t&&t.pendingBranch?$t(e)?t.effects.push(...e):t.effects.push(e):hf(e)}function bu(e,t){e.activeBranch=t;const{vnode:n,parentComponent:r}=e;let o=t.el;for(;!o&&t.component;)t=t.component.subTree,o=t.el;n.el=o,r&&r.subTree===n&&(r.vnode.el=o,_p(r,o))}function R5(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}function pe(e=!1){Au.push(Io=e?null:[])}function iC(){Au.pop(),Io=Au[Au.length-1]||null}function Cf(e,t=!1){wl+=e,e<0&&Io&&t&&(Io.hasOnce=!0)}function sC(e){return e.dynamicChildren=wl>0?Io||hc:null,iC(),wl>0&&Io&&Io.push(e),e}function we(e,t,n,r,o,i){return sC(ue(e,t,n,r,o,i,!0))}function pn(e,t,n,r,o){return sC(on(e,t,n,r,o,!0))}function Sa(e){return e?e.__v_isVNode===!0:!1}function hs(e,t){return e.type===t.type&&e.key===t.key}function M5(e){}function ue(e,t=null,n=null,r=0,o=null,i=e===zt?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ey(t),ref:t&&Mf(t),scopeId:Af,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:po};return a?(ey(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=ar(n)?8:16),wl>0&&!s&&Io&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&Io.push(l),l}function L5(e,t=null,n=null,r=0,o=null,i=!1){if((!e||e===by)&&(e=Br),Sa(e)){const a=Vs(e,t,!0);return n&&ey(a,n),wl>0&&!i&&Io&&(a.shapeFlag&6?Io[Io.indexOf(e)]=a:Io.push(a)),a.patchFlag=-2,a}if(O5(e)&&(e=e.__vccOpts),t){t=aC(t);let{class:a,style:l}=t;a&&!ar(a)&&(t.class=tn(a)),jn(l)&&(of(l)&&!$t(l)&&(l=Yn({},l)),t.style=An(l))}const s=ar(e)?1:Rf(e)?128:ly(e)?64:jn(e)?4:cn(e)?2:0;return ue(e,t,n,r,o,s,i,!0)}function aC(e){return e?of(e)||Sy(e)?Yn({},e):e:null}function Vs(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,u=t?Us(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&Ey(u),ref:t&&t.ref?n&&i?$t(i)?i.concat(Mf(t)):[i,Mf(t)]:Mf(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==zt?s===-1?16:s|16:s,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Vs(e.ssContent),ssFallback:e.ssFallback&&Vs(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&ka(d,l.clone(d)),d}function Ai(e=" ",t=0){return on(Ia,null,e,t)}function lC(e,t){const n=on(bl,null,e);return n.staticCount=t,n}function dt(e="",t=!1){return t?(pe(),pn(Br,null,e)):on(Br,null,e)}function ci(e){return e==null||typeof e=="boolean"?on(Br):$t(e)?on(zt,null,e.slice()):Sa(e)?_a(e):on(Ia,null,String(e))}function _a(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Vs(e)}function ey(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if($t(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),ey(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!Sy(t)?t._ctx=po:o===3&&po&&(po.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else cn(t)?(t={default:t,_ctx:po},n=32):(t=String(t),r&64?(n=16,t=[Ai(t)]):n=8);e.children=t,e.shapeFlag|=n}function Us(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const o in r)if(o==="class")t.class!==r.class&&(t.class=tn([t.class,r.class]));else if(o==="style")t.style=An([t.style,r.style]);else if(lu(o)){const i=t[o],s=r[o];s&&i!==s&&!($t(i)&&i.includes(s))?t[o]=i?[].concat(i,s):s:s==null&&i==null&&!Xd(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function ui(e,t,n,r=null){Hi(e,t,7,[n,r])}function cC(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||$C,i={uid:HC++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new up(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:qw(r,o),emitsOptions:Hw(r,o),emit:null,emitted:null,propsDefaults:Dn,inheritAttrs:r.inheritAttrs,ctx:Dn,data:Dn,props:Dn,attrs:Dn,slots:Dn,refs:Dn,setupState:Dn,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=t?t.root:i,i.emit=w5.bind(null,i),e.ce&&e.ce(i),i}function uC(e){return e.vnode.shapeFlag&4}function dC(e,t=!1,n=!1){t&&Iu(t);const{props:r,children:o}=e.vnode,i=uC(e);S5(e,r,i,t),jC(e,o,n||t);const s=i?P5(e,t):void 0;return t&&Iu(!1),s}function P5(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Lp);const{setup:r}=n;if(r){ga();const o=e.setupContext=r.length>1?hC(e):null,i=_c(e),s=mu(r,e,0,[e.props,o]),a=rp(s);if(va(),i(),(a||e.sp)&&!$s(e)&&Uv(e),a){if(s.then(Eu,Eu),t)return s.then(l=>{ty(e,l,t)}).catch(l=>{yc(l,e,0)});e.asyncDep=s}else ty(e,s,t)}else fC(e,t)}function ty(e,t,n){cn(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:jn(t)&&(e.setupState=Iv(t)),fC(e,n)}function D5(e){Bp=e,Ty=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,LC))}}function fC(e,t,n){const r=e.type;if(!e.render){if(!t&&Bp&&!r.render){const o=r.template||Yv(e).template;if(o){const{isCustomElement:i,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:l}=r,u=Yn(Yn({isCustomElement:i,delimiters:a},s),l);r.render=Bp(o,u)}}e.render=r.render||Si,Ty&&Ty(e)}{const o=_c(e);ga();try{p5(e)}finally{va(),o()}}}function hC(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,WC),slots:e.slots,emit:e.emit,expose:t}}function kf(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Iv(Xr(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in _u)return _u[n](e)},has(t,n){return n in t||n in _u}})):e.proxy}function ny(e,t=!0){return cn(e)?e.displayName||e.name:e.name||t&&e.__name}function O5(e){return cn(e)&&"__vccOpts"in e}function Nr(e,t,n){try{Cf(-1);const r=arguments.length;return r===2?jn(t)&&!$t(t)?Sa(t)?on(e,null,[t]):on(e,t):on(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Sa(n)&&(n=[n]),on(e,t,n))}finally{Cf(1)}}function F5(){return;function e(t,n,r){const o=t[r];if($t(o)&&o.includes(n)||jn(o)&&n in o||t.extends&&e(t.extends,n,r)||t.mixins&&t.mixins.some(i=>e(i,n,r)))return!0}}function N5(e,t,n,r){const o=n[r];if(o&&pC(o,e))return o;const i=t();return i.memo=e.slice(),i.cacheIndex=r,n[r]=i}function pC(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(fo(n[r],t[r]))return!1;return wl>0&&Io&&Io.push(e),!0}var ry,mC,gC,Bo,ps,wc,Aa,Cc,oy,Sf,wu,Cu,_f,po,Af,vC,iy,sy,ml,ay,ly,gl,yC,cy,uy,Ip,bC,vl,ms,ku,Ii,Ep,dy,wC,fy,If,hy,kc,CC,kC,Ef,Sc,py,SC,_C,AC,IC,EC,TC,xC,$s,Su,RC,Hs,my,Nn,Tp,Tf,hr,xf,gy,vy,yy,xp,MC,by,Rp,_u,Mp,Lp,LC,Pp,PC,DC,yl,wy,OC,FC,NC,Cy,ky,Sy,BC,Dp,Op,zC,_y,Ay,Iy,jC,VC,Wr,Rf,Fp,UC,zt,Ia,Br,bl,Au,Io,wl,Ey,Mf,on,$C,HC,mo,Cr,Np,Iu,_c,Eu,Cl,Bp,Ty,GC,WC,ke,xy,KC,qC,YC,XC,ZC,B5,z5,j5,QC=Or((()=>{Fx(),vv(),ry=[],mC={SETUP_FUNCTION:0,0:"SETUP_FUNCTION",RENDER_FUNCTION:1,1:"RENDER_FUNCTION",NATIVE_EVENT_HANDLER:5,5:"NATIVE_EVENT_HANDLER",COMPONENT_EVENT_HANDLER:6,6:"COMPONENT_EVENT_HANDLER",VNODE_HOOK:7,7:"VNODE_HOOK",DIRECTIVE_HOOK:8,8:"DIRECTIVE_HOOK",TRANSITION_HOOK:9,9:"TRANSITION_HOOK",APP_ERROR_HANDLER:10,10:"APP_ERROR_HANDLER",APP_WARN_HANDLER:11,11:"APP_WARN_HANDLER",FUNCTION_REF:12,12:"FUNCTION_REF",ASYNC_COMPONENT_LOADER:13,13:"ASYNC_COMPONENT_LOADER",SCHEDULER:14,14:"SCHEDULER",COMPONENT_UPDATE:15,15:"COMPONENT_UPDATE",APP_UNMOUNT_CLEANUP:16,16:"APP_UNMOUNT_CLEANUP"},gC={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"},Bo=[],ps=-1,wc=[],Aa=null,Cc=0,oy=Promise.resolve(),Sf=null,wu=e=>e.id==null?e.flags&2?-1:1/0:e.id,_f=[],po=null,Af=null,vC=e=>ho,iy=Symbol.for("v-scx"),sy=()=>{{const e=hl(iy);return e}},ml=new WeakMap,ay=Symbol("_vte"),ly=e=>e.__isTeleport,gl=e=>e&&(e.disabled||e.disabled===""),yC=e=>e&&(e.defer||e.defer===""),cy=e=>typeof SVGElement<"u"&&e instanceof SVGElement,uy=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Ip=(e,t)=>{const n=e&&e.to;return ar(n)?t?t(n):null:n},bC={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,i,s,a,l,u){const{mc:d,pc:f,pbc:p,o:{insert:g,querySelector:m,createText:v,createComment:C}}=u,w=gl(t.props);let{dynamicChildren:S}=t;const y=(M,z,q)=>{M.shapeFlag&16&&d(M.children,z,q,o,i,s,a,l)},k=(M=t)=>{const z=gl(M.props),q=M.target=Ip(M.props,m),B=zv(q,M,v,g);q&&(s!=="svg"&&cy(q)?s="svg":s!=="mathml"&&uy(q)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(q),z||(y(M,q,B),gf(M,!1)))},x=M=>{const z=()=>{ml.get(M)===z&&(ml.delete(M),gl(M.props)&&(y(M,n,M.anchor),gf(M,!0)),k(M))};ml.set(M,z),Wr(z,i)};if(e==null){const M=t.el=v(""),z=t.anchor=v("");if(g(M,n,r),g(z,n,r),yC(t.props)||i&&i.pendingBranch){x(t);return}w&&(y(t,n,z),gf(t,!0)),k()}else{t.el=e.el;const M=t.anchor=e.anchor,z=ml.get(e);if(z){z.flags|=8,ml.delete(e),x(t);return}t.targetStart=e.targetStart;const q=t.target=e.target,B=t.targetAnchor=e.targetAnchor,L=gl(e.props),V=L?n:q,T=L?M:B;if(s==="svg"||cy(q)?s="svg":(s==="mathml"||uy(q))&&(s="mathml"),S?(p(e.dynamicChildren,S,V,o,i,s,a),Jv(e,t,!0)):l||f(e,t,V,T,o,i,s,a,!1),w)L?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):mp(t,n,M,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const $=t.target=Ip(t.props,m);$&&mp(t,$,null,u,0)}else L&&mp(t,q,B,u,1);gf(t,w)}},remove(e,t,n,{um:r,o:{remove:o}},i){const{shapeFlag:s,children:a,anchor:l,targetStart:u,targetAnchor:d,target:f,props:p}=e;let g=i||!gl(p);const m=ml.get(e);if(m&&(m.flags|=8,ml.delete(e),g=!1),f&&(o(u),o(d)),i&&o(l),s&16)for(let v=0;v<a.length;v++){const C=a[v];r(C,t,n,g,!!C.dynamicChildren)}},move:mp,hydrate:Kx},vl=bC,ms=Symbol("_leaveCb"),ku=Symbol("_enterCb"),Ii=[Function,Array],Ep={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Ii,onEnter:Ii,onAfterEnter:Ii,onEnterCancelled:Ii,onBeforeLeave:Ii,onLeave:Ii,onAfterLeave:Ii,onLeaveCancelled:Ii,onBeforeAppear:Ii,onAppear:Ii,onAfterAppear:Ii,onAppearCancelled:Ii},dy=e=>{const t=e.subTree;return t.component?dy(t.component):t},wC={name:"BaseTransition",props:Ep,setup(e,{slots:t}){const n=Cr(),r=jv();return()=>{const o=t.default&&gp(t.default(),!0);if(!o||!o.length)return;const i=Iw(o),s=kn(e),{mode:a}=s;if(r.isLeaving)return Vv(i);const l=Tw(i);if(!l)return Vv(i);let u=gu(l,s,r,n,f=>u=f);l.type!==Br&&ka(l,u);let d=n.subTree&&Tw(n.subTree);if(d&&d.type!==Br&&!hs(d,l)&&dy(n).type!==Br){let f=gu(d,s,r,n);if(ka(d,f),a==="out-in"&&l.type!==Br)return r.isLeaving=!0,f.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,d=void 0},Vv(i);a==="in-out"&&l.type!==Br?f.delayLeave=(p,g,m)=>{const v=Ew(r,d);v[String(d.key)]=d,p[ms]=()=>{g(),p[ms]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{m(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return i}}},fy=wC,If=new WeakMap,hy=!1,kc=()=>{hy||(console.error("Hydration completed but contains mismatches."),hy=!0)},CC=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",kC=e=>e.namespaceURI.includes("MathML"),Ef=e=>{if(e.nodeType===1){if(CC(e))return"svg";if(kC(e))return"mathml"}},Sc=e=>e.nodeType===8,py="data-allow-mismatch",SC={0:"text",1:"children",2:"class",3:"style",4:"attribute"},_C=nf().requestIdleCallback||(e=>setTimeout(e,1)),AC=nf().cancelIdleCallback||(e=>clearTimeout(e)),IC=(e=1e4)=>t=>{const n=_C(t,{timeout:e});return()=>AC(n)},EC=e=>(t,n)=>{const r=new IntersectionObserver(o=>{for(const i of o)if(i.isIntersecting){r.disconnect(),t();break}},e);return n(o=>{if(o instanceof Element){if(Zx(o))return t(),r.disconnect(),!1;r.observe(o)}}),()=>r.disconnect()},TC=e=>t=>{if(e){const n=matchMedia(e);if(n.matches)t();else return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t)}},xC=(e=[])=>(t,n)=>{ar(e)&&(e=[e]);let r=!1;const o=s=>{r||(r=!0,i(),t(),s.target.dispatchEvent(new s.constructor(s.type,s)))},i=()=>{n(s=>{for(const a of e)s.removeEventListener(a,o)})};return n(s=>{for(const a of e)s.addEventListener(a,o,{once:!0})}),i},$s=e=>!!e.type.__asyncLoader,Su=e=>e.type.__isKeepAlive,RC={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=Cr(),r=n.ctx;if(!r.renderer)return()=>{const S=t.default&&t.default();return S&&S.length===1?S[0]:S};const o=new Map,i=new Set;let s=null;const a=n.suspense,{renderer:{p:l,m:u,um:d,o:{createElement:f}}}=r,p=f("div");r.activate=(S,y,k,x,M)=>{const z=S.component;u(S,y,k,0,a),l(z.vnode,S,y,k,z,a,x,S.slotScopeIds,M),Wr(()=>{z.isDeactivated=!1,z.a&&gc(z.a);const q=S.props&&S.props.onVnodeMounted;q&&ui(q,z.parent,S)},a)},r.deactivate=S=>{const y=S.component;Ap(y.m),Ap(y.a),u(S,p,null,1,a),Wr(()=>{y.da&&gc(y.da);const k=S.props&&S.props.onVnodeUnmounted;k&&ui(k,y.parent,S),y.isDeactivated=!0},a)};function g(S){Gv(S),d(S,n,a,!0)}function m(S){o.forEach((y,k)=>{const x=ny($s(y)?y.type.__asyncResolved||{}:y.type);x&&!S(x)&&v(k)})}function v(S){const y=o.get(S);y&&(!s||!hs(y,s))?g(y):s&&Gv(s),o.delete(S),i.delete(S)}Vt(()=>[e.include,e.exclude],([S,y])=>{S&&m(k=>vf(S,k)),y&&m(k=>!vf(y,k))},{flush:"post",deep:!0});let C=null;const w=()=>{C!=null&&(Rf(n.subTree.type)?Wr(()=>{o.set(C,bp(n.subTree))},n.subTree.suspense):o.set(C,bp(n.subTree)))};return Nn(w),Tf(w),hr(()=>{o.forEach(S=>{const{subTree:y,suspense:k}=n,x=bp(y);if(S.type===x.type&&S.key===x.key){Gv(x);const M=x.component.da;M&&Wr(M,k);return}g(S)})}),()=>{if(C=null,!t.default)return s=null;const S=t.default(),y=S[0];if(S.length>1)return s=null,S;if(!Sa(y)||!(y.shapeFlag&4)&&!(y.shapeFlag&128))return s=null,y;let k=bp(y);if(k.type===Br)return s=null,k;const x=k.type,M=ny($s(k)?k.type.__asyncResolved||{}:x),{include:z,exclude:q,max:B}=e;if(z&&(!M||!vf(z,M))||q&&M&&vf(q,M))return k.shapeFlag&=-257,s=k,y;const L=k.key==null?x:k.key,V=o.get(L);return k.el&&(k=Vs(k),y.shapeFlag&128&&(y.ssContent=k)),C=L,V?(k.el=V.el,k.component=V.component,k.transition&&ka(k,k.transition),k.shapeFlag|=512,i.delete(L),i.add(L)):(i.add(L),B&&i.size>parseInt(B,10)&&v(i.values().next().value)),k.shapeFlag|=256,s=k,Rf(y.type)?y:k}}},Hs=e=>(t,n=mo)=>{(!Cl||e==="sp")&&wp(e,(...r)=>t(...r),n)},my=Hs("bm"),Nn=Hs("m"),Tp=Hs("bu"),Tf=Hs("u"),hr=Hs("bum"),xf=Hs("um"),gy=Hs("sp"),vy=Hs("rtg"),yy=Hs("rtc"),xp="components",MC="directives",by=Symbol.for("v-ndc"),Rp=e=>e?uC(e)?kf(e):Rp(e.parent):null,_u=Yn(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Rp(e.parent),$root:e=>Rp(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Yv(e),$forceUpdate:e=>e.f||(e.f=()=>{Bv(e.update)}),$nextTick:e=>e.n||(e.n=kt.bind(e.proxy)),$watch:e=>Wx.bind(e)}),Mp=(e,t)=>e!==Dn&&!e.__isScriptSetup&&Gn(e,t),Lp={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,props:i,accessCache:s,type:a,appContext:l}=e;if(t[0]!=="$"){const p=s[t];if(p!==void 0)switch(p){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return i[t]}else{if(Mp(r,t))return s[t]=1,r[t];if(o!==Dn&&Gn(o,t))return s[t]=2,o[t];if(Gn(i,t))return s[t]=3,i[t];if(n!==Dn&&Gn(n,t))return s[t]=4,n[t];Pp&&(s[t]=0)}}const u=_u[t];let d,f;if(u)return t==="$attrs"&&Fo(e.attrs,"get",""),u(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==Dn&&Gn(n,t))return s[t]=4,n[t];if(f=l.config.globalProperties,Gn(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return Mp(o,t)?(o[t]=n,!0):r!==Dn&&Gn(r,t)?(r[t]=n,!0):Gn(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:o,props:i,type:s}},a){let l;return!!(n[a]||e!==Dn&&a[0]!=="$"&&Gn(e,a)||Mp(t,a)||Gn(i,a)||Gn(r,a)||Gn(_u,a)||Gn(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Gn(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},LC=Yn({},Lp,{get(e,t){if(t!==Symbol.unscopables)return Lp.get(e,t,e)},has(e,t){return t[0]!=="_"&&!P2(t)}}),Pp=!0,PC={data:Vw,props:Uw,emits:Uw,methods:bf,computed:bf,beforeCreate:Qo,created:Qo,beforeMount:Qo,mounted:Qo,beforeUpdate:Qo,updated:Qo,beforeDestroy:Qo,beforeUnmount:Qo,destroyed:Qo,unmounted:Qo,activated:Qo,deactivated:Qo,errorCaptured:Qo,serverPrefetch:Qo,components:bf,directives:bf,watch:v5,provide:Vw,inject:g5},DC=0,yl=null,wy=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Gr(t)}Modifiers`]||e[`${Zo(t)}Modifiers`],OC=new WeakMap,FC=e=>{let t;for(const n in e)(n==="class"||n==="style"||lu(n))&&((t||(t={}))[n]=e[n]);return t},NC=(e,t)=>{const n={};for(const r in e)(!Xd(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},Cy={},ky=()=>Object.create(Cy),Sy=e=>Object.getPrototypeOf(e)===Cy,BC=new WeakMap,Dp=e=>e==="_"||e==="_ctx"||e==="$stable",Op=e=>$t(e)?e.map(ci):[ci(e)],zC=(e,t,n)=>{if(t._n)return t;const r=ho((...o)=>Op(t(...o)),n);return r._c=!1,r},_y=(e,t,n)=>{const r=e._ctx;for(const o in e){if(Dp(o))continue;const i=e[o];if(cn(i))t[o]=zC(o,i,r);else if(i!=null){const s=Op(i);t[o]=()=>s}}},Ay=(e,t)=>{const n=Op(t);e.slots.default=()=>n},Iy=(e,t,n)=>{for(const r in t)(n||!Dp(r))&&(e[r]=t[r])},jC=(e,t,n)=>{const r=e.slots=ky();if(e.vnode.shapeFlag&32){const o=t._;o?(Iy(r,t,n),n&&hv(r,"_",o,!0)):_y(t,r)}else t&&Ay(e,t)},VC=(e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=Dn;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:Iy(o,t,n):(i=!t.$stable,_y(t,o)),s=t}else t&&(Ay(e,t),s={default:1});if(i)for(const a in o)!Dp(a)&&s[a]==null&&delete o[a]},Wr=oC,Rf=e=>e.__isSuspense,Fp=0,UC={name:"Suspense",__isSuspense:!0,process(e,t,n,r,o,i,s,a,l,u){if(e==null)I5(t,n,r,o,i,s,a,l,u);else{if(i&&i.deps>0&&!e.suspense.isInFallback){t.suspense=e.suspense,t.suspense.vnode=t,t.el=e.el;return}E5(e,t,n,r,o,s,a,l,u)}},hydrate:T5,normalize:x5},zt=Symbol.for("v-fgt"),Ia=Symbol.for("v-txt"),Br=Symbol.for("v-cmt"),bl=Symbol.for("v-stc"),Au=[],Io=null,wl=1,Ey=({key:e})=>e??null,Mf=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?ar(e)||vr(e)||cn(e)?{i:po,r:e,k:t,f:!!n}:e:null),on=L5,$C=$w(),HC=0,mo=null,Cr=()=>mo||po;{const e=nf(),t=(n,r)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(r),i=>{o.length>1?o.forEach(s=>s(i)):o[0](i)}};Np=t("__VUE_INSTANCE_SETTERS__",n=>mo=n),Iu=t("__VUE_SSR_SETTERS__",n=>Cl=n)}_c=e=>{const t=mo;return Np(e),e.scope.on(),()=>{e.scope.off(),Np(t)}},Eu=()=>{mo&&mo.scope.off(),Np(null)},Cl=!1,GC=()=>!Bp,WC={get(e,t){return Fo(e,"get",""),e[t]}},ke=(e,t)=>Px(e,t,Cl),xy="3.5.32",KC=Si,qC=gC,YC=Cu,XC=Cw,ZC={createComponentInstance:cC,setupComponent:dC,renderComponentRoot:Sp,setCurrentRenderingInstance:pf,isVNode:Sa,normalizeVNode:ci,getComponentPublicInstance:kf,ensureValidVNode:qv,pushWarningContext:Nx,popWarningContext:Bx},B5=null,z5=null,j5=null}));function JC(e){const t={};for(const T in e)T in Ny||(t[T]=e[T]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:i=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:u=s,appearToClass:d=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,m=V5(o),v=m&&m[0],C=m&&m[1],{onBeforeEnter:w,onEnter:S,onEnterCancelled:y,onLeave:k,onLeaveCancelled:x,onBeforeAppear:M=w,onAppear:z=S,onAppearCancelled:q=y}=t,B=(T,$,R,H)=>{T._enterCancelled=H,kl(T,$?d:a),kl(T,$?u:s),R&&R()},L=(T,$)=>{T._isLeaving=!1,kl(T,f),kl(T,g),kl(T,p),$&&$()},V=T=>($,R)=>{const H=T?z:S,G=()=>B($,T,R);Sl(H,[$,G]),ek(()=>{kl($,T?l:i),Gs($,T?d:a),zy(H)||tk($,r,v,G)})};return Yn(t,{onBeforeEnter(T){Sl(w,[T]),Gs(T,i),Gs(T,s)},onBeforeAppear(T){Sl(M,[T]),Gs(T,l),Gs(T,u)},onEnter:V(!1),onAppear:V(!0),onLeave(T,$){T._isLeaving=!0;const R=()=>L(T,$);Gs(T,f),T._enterCancelled?(Gs(T,p),My(T)):(My(T),Gs(T,p)),ek(()=>{T._isLeaving&&(kl(T,f),Gs(T,g),zy(k)||tk(T,r,C,R))}),Sl(k,[T,R])},onEnterCancelled(T){B(T,!1,void 0,!0),Sl(y,[T])},onAppearCancelled(T){B(T,!0,void 0,!0),Sl(q,[T])},onLeaveCancelled(T){L(T),Sl(x,[T])}})}function V5(e){if(e==null)return null;if(jn(e))return[Ry(e.enter),Ry(e.leave)];{const t=Ry(e);return[t,t]}}function Ry(e){return tf(e)}function Gs(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Ac]||(e[Ac]=new Set)).add(t)}function kl(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Ac];n&&(n.delete(t),n.size||(e[Ac]=void 0))}function ek(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function tk(e,t,n,r){const o=e._endId=++Sk,i=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:s,timeout:a,propCount:l}=nk(e,t);if(!s)return r();const u=s+"end";let d=0;const f=()=>{e.removeEventListener(u,p),i()},p=g=>{g.target===e&&++d>=l&&f()};setTimeout(()=>{d<l&&f()},a+1),e.addEventListener(u,p)}function nk(e,t){const n=window.getComputedStyle(e),r=m=>(n[m]||"").split(", "),o=r(`${Ta}Delay`),i=r(`${Ta}Duration`),s=rk(o,i),a=r(`${xu}Delay`),l=r(`${xu}Duration`),u=rk(a,l);let d=null,f=0,p=0;t===Ta?s>0&&(d=Ta,f=s,p=i.length):t===xu?u>0&&(d=xu,f=u,p=l.length):(f=Math.max(s,u),d=f>0?s>u?Ta:xu:null,p=d?d===Ta?i.length:l.length:0);const g=d===Ta&&/\b(?:transform|all)(?:,|$)/.test(r(`${Ta}Property`).toString());return{type:d,timeout:f,propCount:p,hasTransform:g}}function rk(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>ok(n)+ok(e[r])))}function ok(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function My(e){return(e?e.ownerDocument:document).body.offsetHeight}function U5(e,t,n){const r=e[Ac];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function Lf(e,t){e.style.display=t?e[Pf]:"none",e[jy]=!t}function $5(){Vy.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}function H5(e){const t=Cr();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>zp(i,o))},r=()=>{const o=e(t.proxy);t.ce?zp(t.ce,o):Ly(t.subTree,o),n(o)};Tp(()=>{hf(r)}),Nn(()=>{Vt(r,Si,{flush:"post"});const o=new MutationObserver(r);o.observe(t.subTree.el.parentNode,{childList:!0}),xf(()=>o.disconnect())})}function Ly(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{Ly(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)zp(e.el,t);else if(e.type===zt)e.children.forEach(n=>Ly(n,t));else if(e.type===bl){let{el:n,anchor:r}=e;for(;n&&(zp(n,t),n!==r);)n=n.nextSibling}}function zp(e,t){if(e.nodeType===1){const n=e.style;let r="";for(const o in t){const i=bx(t[o]);n.setProperty(`--${o}`,i),r+=`--${o}: ${i};`}n[Uy]=r}}function G5(e,t,n){const r=e.style,o=ar(n);let i=!1;if(n&&!o){if(t)if(ar(t))for(const s of t.split(";")){const a=s.slice(0,s.indexOf(":")).trim();n[a]==null&&jp(r,a,"")}else for(const s in t)n[s]==null&&jp(r,s,"");for(const s in n)s==="display"&&(i=!0),jp(r,s,n[s])}else if(o){if(t!==n){const s=r[Uy];s&&(n+=";"+s),r.cssText=n,i=_k.test(n)}}else t&&e.removeAttribute("style");Pf in e&&(e[Pf]=i?r.display:"",e[jy]&&(r.display="none"))}function jp(e,t,n){if($t(n))n.forEach(r=>jp(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=W5(e,t);$y.test(n)?e.setProperty(Zo(r),n.replace($y,""),"important"):e[r]=n}}function W5(e,t){const n=Hp[t];if(n)return n;let r=Gr(t);if(r!=="filter"&&r in e)return Hp[t]=r;r=cu(r);for(let o=0;o<Hy.length;o++){const i=Hy[o]+r;if(i in e)return Hp[t]=i}return t}function ik(e,t,n,r,o,i=N2(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Gy,t.slice(6,t.length)):e.setAttributeNS(Gy,t,n):n==null||i&&!I2(n)?e.removeAttribute(t):e.setAttribute(t,i?"":si(n)?String(n):n)}function sk(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Dy(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const a=i==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let s=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=I2(n):n==null&&a==="string"?(n="",s=!0):a==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(o||t)}function Ea(e,t,n,r){e.addEventListener(t,n,r)}function K5(e,t,n,r){e.removeEventListener(t,n,r)}function q5(e,t,n,r,o=null){const i=e[Wy]||(e[Wy]={}),s=i[t];if(r&&s)s.value=r;else{const[a,l]=Y5(t);r?Ea(e,a,i[t]=X5(r,o),l):s&&(K5(e,a,s,l),i[t]=void 0)}}function Y5(e){let t;if(Ky.test(e)){t={};let n;for(;n=e.match(Ky);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Zo(e.slice(2)),t]}function X5(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Hi(Z5(r,n.value),t,5,[r])};return n.value=e,n.attached=Ik(),n}function Z5(e,t){if($t(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>o=>!o._stopped&&r&&r(o))}else return t}function Q5(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&qy(t)&&cn(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return qy(t)&&ar(n)?!1:t in e}function J5(e,t){const n=e._def.props;if(!n)return!1;const r=Gr(t);return Array.isArray(n)?n.some(o=>Gr(o)===r):Object.keys(n).some(o=>Gr(o)===r)}function ak(e,t,n){let r=pl(e,t);Zd(r)&&(r=Yn({},r,t));class o extends Zy{constructor(s){super(r,s,n)}}return o.def=r,o}function lk(e){const t=Cr(),n=t&&t.ce;return n||null}function e6(){const e=lk();return e&&e.shadowRoot}function t6(e="$style"){{const t=Cr();if(!t)return Dn;const n=t.type.__cssModules;if(!n)return Dn;const r=n[e];return r||Dn}}function n6(e){const t=e.el;t[Df]&&t[Df](),t[eb]&&t[eb]()}function r6(e){Jy.set(e,ck(e.el))}function o6(e){const t=Qy.get(e),n=Jy.get(e),r=t.left-n.left,o=t.top-n.top;if(r||o){const i=e.el,s=i.style,a=i.getBoundingClientRect();let l=1,u=1;return i.offsetWidth&&(l=a.width/i.offsetWidth),i.offsetHeight&&(u=a.height/i.offsetHeight),(!Number.isFinite(l)||l===0)&&(l=1),(!Number.isFinite(u)||u===0)&&(u=1),Math.abs(l-1)<.01&&(l=1),Math.abs(u-1)<.01&&(u=1),s.transform=s.webkitTransform=`translate(${r/l}px,${o/u}px)`,s.transitionDuration="0s",e}}function ck(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function i6(e,t,n){const r=e.cloneNode(),o=e[Ac];o&&o.forEach(a=>{a.split(/\s+/).forEach(l=>l&&r.classList.remove(l))}),n.split(/\s+/).forEach(a=>a&&r.classList.add(a)),r.style.display="none";const i=t.nodeType===1?t:t.parentNode;i.appendChild(r);const{hasTransform:s}=nk(r);return i.removeChild(r),s}function s6(e){e.target.composing=!0}function uk(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function dk(e,t,n){return t&&(e=e.trim()),n&&(e=ef(e)),e}function fk(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if($t(t))o=tp(t,r.props.value)>-1;else if(ul(t))o=t.has(r.props.value);else{if(t===n)return;o=ma(t,pk(e,!0))}e.checked!==o&&(e.checked=o)}function hk(e,t){const n=e.multiple,r=$t(t);if(!(n&&!r&&!ul(t))){for(let o=0,i=e.options.length;o<i;o++){const s=e.options[o],a=Tu(s);if(n)if(r){const l=typeof a;l==="string"||l==="number"?s.selected=t.some(u=>String(u)===String(a)):s.selected=tp(t,a)>-1}else s.selected=t.has(a);else if(ma(Tu(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Tu(e){return"_value"in e?e._value:e.value}function pk(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function mk(e,t){switch(e){case"SELECT":return Kp;case"TEXTAREA":return Ti;default:switch(t){case"checkbox":return Ru;case"radio":return Wp;default:return Ti}}}function Vp(e,t,n,r,o){const i=mk(e.tagName,n.props&&n.props.type)[o];i&&i(e,t,n,r)}function a6(){Ti.getSSRProps=({value:e})=>({value:e}),Wp.getSSRProps=({value:e},t)=>{if(t.props&&ma(t.props.value,e))return{checked:!0}},Ru.getSSRProps=({value:e},t)=>{if($t(e)){if(t.props&&tp(e,t.props.value)>-1)return{checked:!0}}else if(ul(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},tb.getSSRProps=(e,t)=>{if(typeof t.type!="string")return;const n=mk(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}function gk(){return Of||(Of=Xw(nb))}function vk(){return Of=rb?Of:Zw(nb),rb=!0,Of}function yk(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function bk(e){return ar(e)?document.querySelector(e):e}var Up,Py,Dy,wk,Ck,Ws,Oy,Fy,Ta,xu,Ac,Ny,By,kk,$p,Sl,zy,Sk,Pf,jy,Vy,Uy,_k,$y,Hy,Hp,Gy,Wy,Ky,Gp,Ak,Ik,qy,Yy,Xy,Ek,Tk,Zy,Qy,Jy,Df,eb,xk,Rk,xa,Ei,Ti,Ru,Wp,Kp,tb,Mk,Lk,sn,Pk,Jo,nb,Of,rb,ob,Dk,Ic,ib,sb,Ok,l6=Or((()=>{if(QC(),QC(),vv(),Up=void 0,Py=typeof window<"u"&&window.trustedTypes,Py)try{Up=Py.createPolicy("vue",{createHTML:e=>e})}catch{}Dy=Up?e=>Up.createHTML(e):e=>e,wk="http://www.w3.org/2000/svg",Ck="http://www.w3.org/1998/Math/MathML",Ws=typeof document<"u"?document:null,Oy=Ws&&Ws.createElement("template"),Fy={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const o=t==="svg"?Ws.createElementNS(wk,e):t==="mathml"?Ws.createElementNS(Ck,e):n?Ws.createElement(e,{is:n}):Ws.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>Ws.createTextNode(e),createComment:e=>Ws.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ws.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,o,i){const s=n?n.previousSibling:t.lastChild;if(o&&(o===i||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===i||!(o=o.nextSibling)););else{Oy.innerHTML=Dy(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=Oy.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[s?s.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Ta="transition",xu="animation",Ac=Symbol("_vtc"),Ny={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},By=Yn({},Ep,Ny),kk=e=>(e.displayName="Transition",e.props=By,e),$p=kk((e,{slots:t})=>Nr(fy,JC(e),t)),Sl=(e,t=[])=>{$t(e)?e.forEach(n=>n(...t)):e&&e(...t)},zy=e=>e?$t(e)?e.some(t=>t.length>1):e.length>1:!1,Sk=0,Pf=Symbol("_vod"),jy=Symbol("_vsh"),Vy={name:"show",beforeMount(e,{value:t},{transition:n}){e[Pf]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Lf(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),Lf(e,!0),r.enter(e)):r.leave(e,()=>{Lf(e,!1)}):Lf(e,t))},beforeUnmount(e,{value:t}){Lf(e,t)}},Uy=Symbol(""),_k=/(?:^|;)\s*display\s*:/,$y=/\s*!important$/,Hy=["Webkit","Moz","ms"],Hp={},Gy="http://www.w3.org/1999/xlink",Wy=Symbol("_vei"),Ky=/(?:Once|Passive|Capture)$/,Gp=0,Ak=Promise.resolve(),Ik=()=>Gp||(Ak.then(()=>Gp=0),Gp=Date.now()),qy=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Yy=(e,t,n,r,o,i)=>{const s=o==="svg";t==="class"?U5(e,r,s):t==="style"?G5(e,n,r):lu(t)?Xd(t)||q5(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Q5(e,t,r,s))?(sk(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&ik(e,t,r,s,i,t!=="value")):e._isVueCE&&(J5(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!ar(r)))?sk(e,Gr(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),ik(e,t,r,s))},Xy={},Ek=((e,t)=>ak(e,t,ib)),Tk=typeof HTMLElement<"u"?HTMLElement:class{},Zy=class OT extends Tk{constructor(t,n={},r=Ic){super(),this._def=t,this._props=n,this._createApp=r,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._patching=!1,this._dirty=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._styleAnchors=new WeakMap,this._ob=null,this.shadowRoot&&r!==Ic?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(Yn({},t.shadowRootOptions,{mode:"open"})),this._root=this.shadowRoot):this._root=this}connectedCallback(){if(!this.isConnected)return;!this.shadowRoot&&!this._resolved&&this._parseSlots(),this._connected=!0;let t=this;for(;t=t&&(t.assignedSlot||t.parentNode||t.host);)if(t instanceof OT){this._parent=t;break}this._instance||(this._resolved?this._mount(this._def):t&&t._pendingResolve?this._pendingResolve=t._pendingResolve.then(()=>{this._pendingResolve=void 0,this._resolveDef()}):this._resolveDef())}_setParent(t=this._parent){t&&(this._instance.parent=t._instance,this._inheritParentContext(t))}_inheritParentContext(t=this._parent){t&&this._app&&Object.setPrototypeOf(this._app._context.provides,t._instance.provides)}disconnectedCallback(){this._connected=!1,kt(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null,this._teleportTargets&&(this._teleportTargets.clear(),this._teleportTargets=void 0))})}_processMutations(t){for(const n of t)this._setAttr(n.attributeName)}_resolveDef(){if(this._pendingResolve)return;for(let r=0;r<this.attributes.length;r++)this._setAttr(this.attributes[r].name);this._ob=new MutationObserver(this._processMutations.bind(this)),this._ob.observe(this,{attributes:!0});const t=(r,o=!1)=>{this._resolved=!0,this._pendingResolve=void 0;const{props:i,styles:s}=r;let a;if(i&&!$t(i))for(const l in i){const u=i[l];(u===Number||u&&u.type===Number)&&(l in this._props&&(this._props[l]=tf(this._props[l])),(a||(a=Object.create(null)))[Gr(l)]=!0)}this._numberProps=a,this._resolveProps(r),this.shadowRoot&&this._applyStyles(s),this._mount(r)},n=this._def.__asyncLoader;n?this._pendingResolve=n().then(r=>{r.configureApp=this._def.configureApp,t(this._def=r,!0)}):t(this._def)}_mount(t){this._app=this._createApp(t),this._inheritParentContext(),t.configureApp&&t.configureApp(this._app),this._app._ceVNode=this._createVNode(),this._app.mount(this._root);const n=this._instance&&this._instance.exposed;if(n)for(const r in n)Gn(this,r)||Object.defineProperty(this,r,{get:()=>Je(n[r])})}_resolveProps(t){const{props:n}=t,r=$t(n)?n:Object.keys(n||{});for(const o of Object.keys(this))o[0]!=="_"&&r.includes(o)&&this._setProp(o,this[o]);for(const o of r.map(Gr))Object.defineProperty(this,o,{get(){return this._getProp(o)},set(i){this._setProp(o,i,!0,!this._patching)}})}_setAttr(t){if(t.startsWith("data-v-"))return;const n=this.hasAttribute(t);let r=n?this.getAttribute(t):Xy;const o=Gr(t);n&&this._numberProps&&this._numberProps[o]&&(r=tf(r)),this._setProp(o,r,!1,!0)}_getProp(t){return this._props[t]}_setProp(t,n,r=!0,o=!1){if(n!==this._props[t]&&(this._dirty=!0,n===Xy?delete this._props[t]:(this._props[t]=n,t==="key"&&this._app&&(this._app._ceVNode.key=n)),o&&this._instance&&this._update(),r)){const i=this._ob;i&&(this._processMutations(i.takeRecords()),i.disconnect()),n===!0?this.setAttribute(Zo(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(Zo(t),n+""):n||this.removeAttribute(Zo(t)),i&&i.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),ob(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=on(this._def,Yn(t,this._props));return this._instance||(n.ce=r=>{this._instance=r,r.ce=this,r.isCE=!0;const o=(i,s)=>{this.dispatchEvent(new CustomEvent(i,Zd(s[0])?Yn({detail:s},s[0]):{detail:s}))};r.emit=(i,...s)=>{o(i,s),Zo(i)!==i&&o(Zo(i),s)},this._setParent()}),n}_applyStyles(t,n,r){if(!t)return;if(n){if(n===this._def||this._styleChildren.has(n))return;this._styleChildren.add(n)}const o=this._nonce,i=this.shadowRoot,s=r?this._getStyleAnchor(r)||this._getStyleAnchor(this._def):this._getRootStyleInsertionAnchor(i);let a=null;for(let l=t.length-1;l>=0;l--){const u=document.createElement("style");o&&u.setAttribute("nonce",o),u.textContent=t[l],i.insertBefore(u,a||s),a=u,l===0&&(r||this._styleAnchors.set(this._def,u),n&&this._styleAnchors.set(n,u))}}_getStyleAnchor(t){if(!t)return null;const n=this._styleAnchors.get(t);return n&&n.parentNode===this.shadowRoot?n:(n&&this._styleAnchors.delete(t),null)}_getRootStyleInsertionAnchor(t){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(!(r instanceof HTMLStyleElement))return r}return null}_parseSlots(){const t=this._slots={};let n;for(;n=this.firstChild;){const r=n.nodeType===1&&n.getAttribute("slot")||"default";(t[r]||(t[r]=[])).push(n),this.removeChild(n)}}_renderSlots(){const t=this._getSlots(),n=this._instance.type.__scopeId;for(let r=0;r<t.length;r++){const o=t[r],i=o.getAttribute("name")||"default",s=this._slots[i],a=o.parentNode;if(s)for(const l of s){if(n&&l.nodeType===1){const u=n+"-s",d=document.createTreeWalker(l,1);l.setAttribute(u,"");let f;for(;f=d.nextNode();)f.setAttribute(u,"")}a.insertBefore(l,o)}else for(;o.firstChild;)a.insertBefore(o.firstChild,o);a.removeChild(o)}}_getSlots(){const t=[this];this._teleportTargets&&t.push(...this._teleportTargets);const n=new Set;for(const r of t){const o=r.querySelectorAll("slot");for(let i=0;i<o.length;i++)n.add(o[i])}return Array.from(n)}_injectChildStyle(t,n){this._applyStyles(t.styles,t,n)}_beginPatch(){this._patching=!0,this._dirty=!1}_endPatch(){this._patching=!1,this._dirty&&this._instance&&this._update()}_hasShadowRoot(){return this._def.shadowRoot!==!1}_removeChildStyle(t){}},Qy=new WeakMap,Jy=new WeakMap,Df=Symbol("_moveCb"),eb=Symbol("_enterCb"),xk=e=>(delete e.props.mode,e),Rk=xk({name:"TransitionGroup",props:Yn({},By,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=Cr(),r=jv();let o,i;return Tf(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!i6(o[0].el,n.vnode.el,s)){o=[];return}o.forEach(n6),o.forEach(r6);const a=o.filter(o6);My(n.vnode.el),a.forEach(l=>{const u=l.el,d=u.style;Gs(u,s),d.transform=d.webkitTransform=d.transitionDuration="";const f=u[Df]=p=>{p&&p.target!==u||(!p||p.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",f),u[Df]=null,kl(u,s))};u.addEventListener("transitionend",f)}),o=[]}),()=>{const s=kn(e),a=JC(s);let l=s.tag||zt;if(o=[],i)for(let u=0;u<i.length;u++){const d=i[u];d.el&&d.el instanceof Element&&(o.push(d),ka(d,gu(d,a,r,n)),Qy.set(d,ck(d.el)))}i=t.default?gp(t.default()):[];for(let u=0;u<i.length;u++){const d=i[u];d.key!=null&&ka(d,gu(d,a,r,n))}return on(l,null,i)}}}),xa=e=>{const t=e.props["onUpdate:modelValue"]||!1;return $t(t)?n=>gc(t,n):t},Ei=Symbol("_assign"),Ti={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[Ei]=xa(o);const i=r||o.props&&o.props.type==="number";Ea(e,t?"change":"input",s=>{s.target.composing||e[Ei](dk(e.value,n,i))}),(n||i)&&Ea(e,"change",()=>{e.value=dk(e.value,n,i)}),t||(Ea(e,"compositionstart",s6),Ea(e,"compositionend",uk),Ea(e,"change",uk))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:i}},s){if(e[Ei]=xa(s),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?ef(e.value):e.value,l=t??"";if(a===l)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===l)||(e.value=l)}},Ru={deep:!0,created(e,t,n){e[Ei]=xa(n),Ea(e,"change",()=>{const r=e._modelValue,o=Tu(e),i=e.checked,s=e[Ei];if($t(r)){const a=tp(r,o),l=a!==-1;if(i&&!l)s(r.concat(o));else if(!i&&l){const u=[...r];u.splice(a,1),s(u)}}else if(ul(r)){const a=new Set(r);i?a.add(o):a.delete(o),s(a)}else s(pk(e,i))})},mounted:fk,beforeUpdate(e,t,n){e[Ei]=xa(n),fk(e,t,n)}},Wp={created(e,{value:t},n){e.checked=ma(t,n.props.value),e[Ei]=xa(n),Ea(e,"change",()=>{e[Ei](Tu(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Ei]=xa(r),t!==n&&(e.checked=ma(t,r.props.value))}},Kp={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=ul(t);Ea(e,"change",()=>{const i=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?ef(Tu(s)):Tu(s));e[Ei](e.multiple?o?new Set(i):i:i[0]),e._assigning=!0,kt(()=>{e._assigning=!1})}),e[Ei]=xa(r)},mounted(e,{value:t}){hk(e,t)},beforeUpdate(e,t,n){e[Ei]=xa(n)},updated(e,{value:t}){e._assigning||hk(e,t)}},tb={created(e,t,n){Vp(e,t,n,null,"created")},mounted(e,t,n){Vp(e,t,n,null,"mounted")},beforeUpdate(e,t,n,r){Vp(e,t,n,r,"beforeUpdate")},updated(e,t,n,r){Vp(e,t,n,r,"updated")}},Mk=["ctrl","shift","alt","meta"],Lk={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Mk.some(n=>e[`${n}Key`]&&!t.includes(n))},sn=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((o,...i)=>{for(let s=0;s<t.length;s++){const a=Lk[t[s]];if(a&&a(o,t))return}return e(o,...i)}))},Pk={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Jo=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const i=Zo(o.key);if(t.some(s=>s===i||Pk[s]===i))return e(o)}))},nb=Yn({patchProp:Yy},Fy),rb=!1,ob=((...e)=>{gk().render(...e)}),Dk=((...e)=>{vk().hydrate(...e)}),Ic=((...e)=>{const t=gk().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=bk(r);if(!o)return;const i=t._component;!cn(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,yk(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t}),ib=((...e)=>{const t=vk().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=bk(r);if(o)return n(o,!0,yk(o))},t}),sb=!1,Ok=()=>{sb||(sb=!0,a6(),$5())}})),c6=Kd({BaseTransition:()=>fy,BaseTransitionPropsValidators:()=>Ep,Comment:()=>Br,DeprecationTypes:()=>null,EffectScope:()=>up,ErrorCodes:()=>mC,ErrorTypeStrings:()=>qC,Fragment:()=>zt,KeepAlive:()=>RC,ReactiveEffect:()=>fu,Static:()=>bl,Suspense:()=>UC,Teleport:()=>vl,Text:()=>Ia,TrackOpTypes:()=>gw,Transition:()=>$p,TransitionGroup:()=>Rk,TriggerOpTypes:()=>vw,VueElement:()=>Zy,assertNumber:()=>zx,callWithAsyncErrorHandling:()=>Hi,callWithErrorHandling:()=>mu,camelize:()=>Gr,capitalize:()=>cu,cloneVNode:()=>Vs,compatUtils:()=>null,compile:()=>Fk,computed:()=>ke,createApp:()=>Ic,createBlock:()=>pn,createCommentVNode:()=>dt,createElementBlock:()=>we,createElementVNode:()=>ue,createHydrationRenderer:()=>Zw,createPropsRestProxy:()=>f5,createRenderer:()=>Xw,createSSRApp:()=>ib,createSlots:()=>t5,createStaticVNode:()=>lC,createTextVNode:()=>Ai,createVNode:()=>on,customRef:()=>q2,defineAsyncComponent:()=>Mw,defineComponent:()=>pl,defineCustomElement:()=>ak,defineEmits:()=>o5,defineExpose:()=>i5,defineModel:()=>l5,defineOptions:()=>s5,defineProps:()=>r5,defineSSRCustomElement:()=>Ek,defineSlots:()=>a5,devtools:()=>YC,effect:()=>kx,effectScope:()=>yv,getCurrentInstance:()=>Cr,getCurrentScope:()=>bv,getCurrentWatcher:()=>Dx,getTransitionRawChildren:()=>gp,guardReactiveProps:()=>aC,h:()=>Nr,handleError:()=>yc,hasInjectionContext:()=>Sw,hydrate:()=>Dk,hydrateOnIdle:()=>IC,hydrateOnInteraction:()=>xC,hydrateOnMediaQuery:()=>TC,hydrateOnVisible:()=>EC,initCustomFormatter:()=>F5,initDirectivesForSSR:()=>Ok,inject:()=>hl,isMemoSame:()=>pC,isProxy:()=>of,isReactive:()=>ai,isReadonly:()=>zs,isRef:()=>vr,isRuntimeOnly:()=>GC,isShallow:()=>li,isVNode:()=>Sa,markRaw:()=>Xr,mergeDefaults:()=>u5,mergeModels:()=>d5,mergeProps:()=>Us,nextTick:()=>kt,nodeOps:()=>Fy,normalizeClass:()=>tn,normalizeProps:()=>cv,normalizeStyle:()=>An,onActivated:()=>$v,onBeforeMount:()=>my,onBeforeUnmount:()=>hr,onBeforeUpdate:()=>Tp,onDeactivated:()=>Hv,onErrorCaptured:()=>Pw,onMounted:()=>Nn,onRenderTracked:()=>yy,onRenderTriggered:()=>vy,onScopeDispose:()=>B2,onServerPrefetch:()=>gy,onUnmounted:()=>xf,onUpdated:()=>Tf,onWatcherCleanup:()=>Z2,openBlock:()=>pe,patchProp:()=>Yy,popScopeId:()=>$x,provide:()=>kw,proxyRefs:()=>Iv,pushScopeId:()=>Ux,queuePostFlushCb:()=>hf,reactive:()=>no,readonly:()=>lp,ref:()=>ne,registerRuntimeCompiler:()=>D5,render:()=>ob,renderList:()=>Mn,renderSlot:()=>yu,resolveComponent:()=>e5,resolveDirective:()=>Dw,resolveDynamicComponent:()=>Wv,resolveFilter:()=>null,resolveTransitionHooks:()=>gu,setBlockTracking:()=>Cf,setDevtoolsHook:()=>XC,setTransitionHooks:()=>ka,shallowReactive:()=>W2,shallowReadonly:()=>Rx,shallowRef:()=>Fr,ssrContextKey:()=>iy,ssrUtils:()=>ZC,stop:()=>Sx,toDisplayString:()=>Et,toHandlerKey:()=>uu,toHandlers:()=>n5,toRaw:()=>kn,toRef:()=>Ev,toRefs:()=>Y2,toValue:()=>Lx,transformVNodeArgs:()=>M5,triggerRef:()=>Mx,unref:()=>Je,useAttrs:()=>Nw,useCssModule:()=>t6,useCssVars:()=>H5,useHost:()=>lk,useId:()=>qx,useModel:()=>b5,useSSRContext:()=>sy,useShadowRoot:()=>e6,useSlots:()=>Fw,useTemplateRef:()=>Yx,useTransitionState:()=>jv,vModelCheckbox:()=>Ru,vModelDynamic:()=>tb,vModelRadio:()=>Wp,vModelSelect:()=>Kp,vModelText:()=>Ti,vShow:()=>Vy,version:()=>xy,warn:()=>KC,watch:()=>Vt,watchEffect:()=>Hx,watchPostEffect:()=>Gx,watchSyncEffect:()=>_w,withAsyncContext:()=>h5,withCtx:()=>ho,withDefaults:()=>c5,withDirectives:()=>_i,withKeys:()=>Jo,withMemo:()=>N5,withModifiers:()=>sn,withScopeId:()=>vC}),Fk,Nt=Or((()=>{l6(),Fk=()=>{}})),u6=y2(((e,t)=>{(function(n){typeof e=="object"&&typeof t<"u"?t.exports=n():typeof define=="function"&&define.amd?define([],n):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=n()})(function(){return(function n(r,o,i){function s(u,d){if(!o[u]){if(!r[u]){var f=typeof require=="function"&&require;if(!d&&f)return f(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var g=o[u]={exports:{}};r[u][0].call(g.exports,function(m){var v=r[u][1][m];return s(v||m)},g,g.exports,n,r,o,i)}return o[u].exports}for(var a=typeof require=="function"&&require,l=0;l<i.length;l++)s(i[l]);return s})({1:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(l){for(var u,d,f,p,g,m,v,C=[],w=0,S=l.length,y=S,k=i.getTypeOf(l)!=="string";w<l.length;)y=S-w,f=k?(u=l[w++],d=w<S?l[w++]:0,w<S?l[w++]:0):(u=l.charCodeAt(w++),d=w<S?l.charCodeAt(w++):0,w<S?l.charCodeAt(w++):0),p=u>>2,g=(3&u)<<4|d>>4,m=1<y?(15&d)<<2|f>>6:64,v=2<y?63&f:64,C.push(a.charAt(p)+a.charAt(g)+a.charAt(m)+a.charAt(v));return C.join("")},o.decode=function(l){var u,d,f,p,g,m,v=0,C=0,w="data:";if(l.substr(0,w.length)===w)throw new Error("Invalid base64 input, it looks like a data url.");var S,y=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&y--,l.charAt(l.length-2)===a.charAt(64)&&y--,y%1!=0)throw new Error("Invalid base64 input, bad content length.");for(S=s.uint8array?new Uint8Array(0|y):new Array(0|y);v<l.length;)u=a.indexOf(l.charAt(v++))<<2|(p=a.indexOf(l.charAt(v++)))>>4,d=(15&p)<<4|(g=a.indexOf(l.charAt(v++)))>>2,f=(3&g)<<6|(m=a.indexOf(l.charAt(v++))),S[C++]=u,g!==64&&(S[C++]=d),m!==64&&(S[C++]=f);return S}},{"./support":30,"./utils":32}],2:[function(n,r,o){"use strict";var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(d,f,p,g,m){this.compressedSize=d,this.uncompressedSize=f,this.crc32=p,this.compression=g,this.compressedContent=m}u.prototype={getContentWorker:function(){var d=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,p){return d.pipe(new a).pipe(new l("uncompressedSize")).pipe(f.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",f)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){"use strict";var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){"use strict";var i=n("./utils"),s=(function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l})();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?(function(u,d,f,p){var g=s,m=p+f;u^=-1;for(var v=p;v<m;v++)u=u>>>8^g[255&(u^d[v])];return-1^u})(0|l,a,a.length,0):(function(u,d,f,p){var g=s,m=p+f;u^=-1;for(var v=p;v<m;v++)u=u>>>8^g[255&(u^d.charCodeAt(v))];return-1^u})(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){"use strict";o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){"use strict";var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),u=i?"uint8array":"array";function d(f,p){l.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(d,l),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,f.data),!1)},d.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(p){f.push({data:p,meta:f.meta})}},o.compressWorker=function(f){return new d("Deflate",f)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){"use strict";function i(g,m){var v,C="";for(v=0;v<m;v++)C+=String.fromCharCode(255&g),g>>>=8;return C}function s(g,m,v,C,w,S){var y,k,x=g.file,M=g.compression,z=S!==u.utf8encode,q=a.transformTo("string",S(x.name)),B=a.transformTo("string",u.utf8encode(x.name)),L=x.comment,V=a.transformTo("string",S(L)),T=a.transformTo("string",u.utf8encode(L)),$=B.length!==x.name.length,R=T.length!==L.length,H="",G="",ee="",J=x.dir,X=x.date,xe={crc32:0,compressedSize:0,uncompressedSize:0};m&&!v||(xe.crc32=g.crc32,xe.compressedSize=g.compressedSize,xe.uncompressedSize=g.uncompressedSize);var fe=0;m&&(fe|=8),z||!$&&!R||(fe|=2048);var ye=0,ve=0;J&&(ye|=16),w==="UNIX"?(ve=798,ye|=(function(je,nt){var ut=je;return je||(ut=nt?16893:33204),(65535&ut)<<16})(x.unixPermissions,J)):(ve=20,ye|=(function(je){return 63&(je||0)})(x.dosPermissions)),y=X.getUTCHours(),y<<=6,y|=X.getUTCMinutes(),y<<=5,y|=X.getUTCSeconds()/2,k=X.getUTCFullYear()-1980,k<<=4,k|=X.getUTCMonth()+1,k<<=5,k|=X.getUTCDate(),$&&(G=i(1,1)+i(d(q),4)+B,H+="up"+i(G.length,2)+G),R&&(ee=i(1,1)+i(d(V),4)+T,H+="uc"+i(ee.length,2)+ee);var Le="";return Le+=`
|
|
4
|
-
\0`,Le+=i(fe,2),Le+=M.magic,Le+=i(y,2),Le+=i(k,2),Le+=i(xe.crc32,4),Le+=i(xe.compressedSize,4),Le+=i(xe.uncompressedSize,4),Le+=i(q.length,2),Le+=i(H.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Le+q+H,dirRecord:f.CENTRAL_FILE_HEADER+i(ve,2)+Le+i(V.length,2)+"\0\0\0\0"+i(ye,4)+i(C,4)+q+H+V}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(g,m,v,C){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=v,this.encodeFileName=C,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(g){var m=g.meta.percent||0,v=this.entriesCount,C=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:v?(m+100*(v-C-1))/v:100}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var v=s(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,v=s(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:(function(C){return f.DATA_DESCRIPTOR+i(C.crc32,4)+i(C.compressedSize,4)+i(C.uncompressedSize,4)})(g),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-g,C=(function(w,S,y,k,x){var M=a.transformTo("string",x(k));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(S,4)+i(y,4)+i(M.length,2)+M})(this.dirRecords.length,v,g,this.zipComment,this.encodeFileName);this.push({data:C,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(g){this._sources.push(g);var m=this;return g.on("data",function(v){m.processChunk(v)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(v){m.error(v)}),this},p.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var v=0;v<m.length;v++)try{m[v].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,u){var d=new s(l.streamFiles,u,l.platform,l.encodeFileName),f=0;try{a.forEach(function(p,g){f++;var m=(function(S,y){var k=S||y,x=i[k];if(!x)throw new Error(k+" is not a valid compression method !");return x})(g.options.compression,l.compression),v=g.options.compressionOptions||l.compressionOptions||{},C=g.dir,w=g.date;g._compressWorker(m,v).withStreamInfo("file",{name:p,dir:C,date:w,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(p){return new s.Promise(function(g,m){var v=p.decompressed.getContentWorker().pipe(new u);v.on("error",function(C){m(C)}).on("end",function(){v.streamInfo.crc32!==p.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var m=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(v){var C=new l(g);return C.load(v),C}).then(function(v){var C=[s.Promise.resolve(v)],w=v.files;if(g.checkCRC32)for(var S=0;S<w.length;S++)C.push(f(w[S]));return s.Promise.all(C)}).then(function(v){for(var C=v.shift(),w=C.files,S=0;S<w.length;S++){var y=w[S],k=y.fileNameStr,x=i.resolve(y.fileNameStr);m.file(x,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:g.createFolders}),y.dir||(m.file(x).unsafeOriginalName=k)}return C.zipComment.length&&(m.comment=C.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,u){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),a.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){"use strict";var i=n("readable-stream").Readable;function s(a,l,u){i.call(this,l),this._helper=a;var d=this;a.on("data",function(f,p){d.push(f)||d._helper.pause(),u&&u(p)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(k,x,M){var z,q=a.getTypeOf(x),B=a.extend(M||{},d);B.date=B.date||new Date,B.compression!==null&&(B.compression=B.compression.toUpperCase()),typeof B.unixPermissions=="string"&&(B.unixPermissions=parseInt(B.unixPermissions,8)),B.unixPermissions&&16384&B.unixPermissions&&(B.dir=!0),B.dosPermissions&&16&B.dosPermissions&&(B.dir=!0),B.dir&&(k=w(k)),B.createFolders&&(z=C(k))&&S.call(this,z,!0);var L=q==="string"&&B.binary===!1&&B.base64===!1;M&&M.binary!==void 0||(B.binary=!L),(x instanceof f&&x.uncompressedSize===0||B.dir||!x||x.length===0)&&(B.base64=!1,B.binary=!0,x="",B.compression="STORE",q="string");var V=null;V=x instanceof f||x instanceof l?x:m.isNode&&m.isStream(x)?new v(k,x):a.prepareContent(k,x,B.binary,B.optimizedBinaryString,B.base64);var T=new p(k,V,B);this.files[k]=T}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),g=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),C=function(k){k.slice(-1)==="/"&&(k=k.substring(0,k.length-1));var x=k.lastIndexOf("/");return 0<x?k.substring(0,x):""},w=function(k){return k.slice(-1)!=="/"&&(k+="/"),k},S=function(k,x){return x=x!==void 0?x:d.createFolders,k=w(k),this.files[k]||i.call(this,k,null,{dir:!0,createFolders:x}),this.files[k]};function y(k){return Object.prototype.toString.call(k)==="[object RegExp]"}r.exports={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(k){var x,M,z;for(x in this.files)z=this.files[x],(M=x.slice(this.root.length,x.length))&&x.slice(0,this.root.length)===this.root&&k(M,z)},filter:function(k){var x=[];return this.forEach(function(M,z){k(M,z)&&x.push(z)}),x},file:function(k,x,M){if(arguments.length!==1)return k=this.root+k,i.call(this,k,x,M),this;if(y(k)){var z=k;return this.filter(function(B,L){return!L.dir&&z.test(B)})}var q=this.files[this.root+k];return q&&!q.dir?q:null},folder:function(k){if(!k)return this;if(y(k))return this.filter(function(q,B){return B.dir&&k.test(q)});var x=this.root+k,M=S.call(this,x),z=this.clone();return z.root=M.name,z},remove:function(k){k=this.root+k;var x=this.files[k];if(x||(k.slice(-1)!=="/"&&(k+="/"),x=this.files[k]),x&&!x.dir)delete this.files[k];else for(var M=this.filter(function(q,B){return B.name.slice(0,k.length)===k}),z=0;z<M.length;z++)delete this.files[M[z].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(k){var x,M={};try{if((M=a.extend(k||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=M.type.toLowerCase(),M.compression=M.compression.toUpperCase(),M.type==="binarystring"&&(M.type="string"),!M.type)throw new Error("No output type specified.");a.checkSupport(M.type),M.platform!=="darwin"&&M.platform!=="freebsd"&&M.platform!=="linux"&&M.platform!=="sunos"||(M.platform="UNIX"),M.platform==="win32"&&(M.platform="DOS");var z=M.comment||this.comment||"";x=g.generateWorker(this,M,z)}catch(q){(x=new l("error")).error(q)}return new u(x,M.type||"string",M.mimeType)},generateAsync:function(k,x){return this.generateInternalStream(k).accumulate(x)},generateNodeStream:function(k,x){return(k=k||{}).type||(k.type="nodebuffer"),this.generateInternalStream(k).toNodejsStream(x)}}},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){"use strict";r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===f)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&u===p[1]&&d===p[2]&&f===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,u=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){"use strict";var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){"use strict";var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var p=i.getTypeOf(f);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(f):s.uint8array?new d(i.transformTo("uint8array",f)):new a(i.transformTo("array",f)):new l(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){"use strict";function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(m,v){return new d.Promise(function(C,w){var S=[],y=m._internalType,k=m._outputType,x=m._mimeType;m.on("data",function(M,z){S.push(M),v&&v(z)}).on("error",function(M){S=[],w(M)}).on("end",function(){try{C((function(M,z,q){switch(M){case"blob":return i.newBlob(i.transformTo("arraybuffer",z),q);case"base64":return l.encode(z);default:return i.transformTo(M,z)}})(k,(function(M,z){var q,B=0,L=null,V=0;for(q=0;q<z.length;q++)V+=z[q].length;switch(M){case"string":return z.join("");case"array":return Array.prototype.concat.apply([],z);case"uint8array":for(L=new Uint8Array(V),q=0;q<z.length;q++)L.set(z[q],B),B+=z[q].length;return L;case"nodebuffer":return Buffer.concat(z);default:throw new Error("concat : unsupported type '"+M+"'")}})(y,S),x))}catch(M){w(M)}S=[]}).resume()})}function g(m,v,C){var w=v;switch(v){case"blob":case"arraybuffer":w="uint8array";break;case"base64":w="string"}try{this._internalType=w,this._outputType=v,this._mimeType=C,i.checkSupport(w),this._worker=m.pipe(new s(w)),m.lock()}catch(S){this._worker=new a("error"),this._worker.error(S)}}g.prototype={accumulate:function(m){return p(this,m)},on:function(m,v){var C=this;return m==="data"?this._worker.on(m,function(w){v.call(C,w.data,w.meta)}):this._worker.on(m,function(){i.delay(v,arguments,C)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},m)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(m){var v,C,w,S,y,k=m.length,x=0;for(S=0;S<k;S++)(64512&(C=m.charCodeAt(S)))==55296&&S+1<k&&(64512&(w=m.charCodeAt(S+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),S++),x+=C<128?1:C<2048?2:C<65536?3:4;for(v=s.uint8array?new Uint8Array(x):new Array(x),S=y=0;y<x;S++)(64512&(C=m.charCodeAt(S)))==55296&&S+1<k&&(64512&(w=m.charCodeAt(S+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),S++),C<128?v[y++]=C:(C<2048?v[y++]=192|C>>>6:(C<65536?v[y++]=224|C>>>12:(v[y++]=240|C>>>18,v[y++]=128|C>>>12&63),v[y++]=128|C>>>6&63),v[y++]=128|63&C);return v})(g)},o.utf8decode=function(g){return s.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):(function(m){var v,C,w,S,y=m.length,k=new Array(2*y);for(v=C=0;v<y;)if((w=m[v++])<128)k[C++]=w;else if(4<(S=u[w]))k[C++]=65533,v+=S-1;else{for(w&=S===2?31:S===3?15:7;1<S&&v<y;)w=w<<6|63&m[v++],S--;1<S?k[C++]=65533:w<65536?k[C++]=w:(w-=65536,k[C++]=55296|w>>10&1023,k[C++]=56320|1023&w)}return k.length!==C&&(k.subarray?k=k.subarray(0,C):k.length=C),i.applyFromCharCode(k)})(g=i.transformTo(s.uint8array?"uint8array":"array",g))},i.inherits(f,l),f.prototype.processChunk=function(g){var m=i.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var v=m;(m=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),m.set(v,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var C=(function(S,y){var k;for((y=y||S.length)>S.length&&(y=S.length),k=y-1;0<=k&&(192&S[k])==128;)k--;return k<0||k===0?y:k+u[S[k]]>y?k:y})(m),w=m;C!==m.length&&(s.uint8array?(w=m.subarray(0,C),this.leftOver=m.subarray(C,m.length)):(w=m.slice(0,C),this.leftOver=m.slice(C,m.length))),this.push({data:o.utf8decode(w),meta:g.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(p,l),p.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(v){return v}function d(v,C){for(var w=0;w<v.length;++w)C[w]=255&v.charCodeAt(w);return C}n("setimmediate"),o.newBlob=function(v,C){o.checkSupport("blob");try{return new Blob([v],{type:C})}catch{try{var w=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return w.append(v),w.getBlob(C)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(v,C,w){var S=[],y=0,k=v.length;if(k<=w)return String.fromCharCode.apply(null,v);for(;y<k;)C==="array"||C==="nodebuffer"?S.push(String.fromCharCode.apply(null,v.slice(y,Math.min(y+w,k)))):S.push(String.fromCharCode.apply(null,v.subarray(y,Math.min(y+w,k)))),y+=w;return S.join("")},stringifyByChar:function(v){for(var C="",w=0;w<v.length;w++)C+=String.fromCharCode(v[w]);return C},applyCanBeUsed:{uint8array:(function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}})()}};function p(v){var C=65536,w=o.getTypeOf(v),S=!0;if(w==="uint8array"?S=f.applyCanBeUsed.uint8array:w==="nodebuffer"&&(S=f.applyCanBeUsed.nodebuffer),S)for(;1<C;)try{return f.stringifyByChunk(v,w,C)}catch{C=Math.floor(C/2)}return f.stringifyByChar(v)}function g(v,C){for(var w=0;w<v.length;w++)C[w]=v[w];return C}o.applyFromCharCode=p;var m={};m.string={string:u,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return m.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,a.allocBuffer(v.length))}},m.array={string:p,array:u,arraybuffer:function(v){return new Uint8Array(v).buffer},uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(v)}},m.arraybuffer={string:function(v){return p(new Uint8Array(v))},array:function(v){return g(new Uint8Array(v),new Array(v.byteLength))},arraybuffer:u,uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(new Uint8Array(v))}},m.uint8array={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:u,nodebuffer:function(v){return a.newBufferFrom(v)}},m.nodebuffer={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return g(v,new Uint8Array(v.length))},nodebuffer:u},o.transformTo=function(v,C){return C=C||"",v?(o.checkSupport(v),m[o.getTypeOf(C)][v](C)):C},o.resolve=function(v){for(var C=v.split("/"),w=[],S=0;S<C.length;S++){var y=C[S];y==="."||y===""&&S!==0&&S!==C.length-1||(y===".."?w.pop():w.push(y))}return w.join("/")},o.getTypeOf=function(v){return typeof v=="string"?"string":Object.prototype.toString.call(v)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(v)?"nodebuffer":i.uint8array&&v instanceof Uint8Array?"uint8array":i.arraybuffer&&v instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(v){if(!i[v.toLowerCase()])throw new Error(v+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(v){var C,w,S="";for(w=0;w<(v||"").length;w++)S+="\\x"+((C=v.charCodeAt(w))<16?"0":"")+C.toString(16).toUpperCase();return S},o.delay=function(v,C,w){setImmediate(function(){v.apply(w||null,C||[])})},o.inherits=function(v,C){function w(){}w.prototype=C.prototype,v.prototype=new w},o.extend=function(){var v,C,w={};for(v=0;v<arguments.length;v++)for(C in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],C)&&w[C]===void 0&&(w[C]=arguments[v][C]);return w},o.prepareContent=function(v,C,w,S,y){return l.Promise.resolve(C).then(function(k){return i.blob&&(k instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(k))!==-1)&&typeof FileReader<"u"?new l.Promise(function(x,M){var z=new FileReader;z.onload=function(q){x(q.target.result)},z.onerror=function(q){M(q.target.error)},z.readAsArrayBuffer(k)}):k}).then(function(k){var x=o.getTypeOf(k);return x?(x==="arraybuffer"?k=o.transformTo("uint8array",k):x==="string"&&(y?k=s.decode(k):w&&S!==!0&&(k=(function(M){return d(M,i.uint8array?new Uint8Array(M.length):new Array(M.length))})(k))),k):l.Promise.reject(new Error("Can't read the data of '"+v+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),l=n("./zipEntry"),u=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var g=this.reader.index;this.reader.setIndex(f);var m=this.reader.readString(4)===p;return this.reader.setIndex(g),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",g=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,g,m=this.zip64EndOfCentralSize-44;0<m;)f=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var m=p-g;if(0<m)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function p(g,m){this.options=g,this.loadOptions=m}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var m,v;if(g.skip(22),this.fileNameLength=g.readInt(2),v=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(C){for(var w in d)if(Object.prototype.hasOwnProperty.call(d,w)&&d[w].magic===C)return d[w];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,m,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var m=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(m),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var m,v,C,w=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<w;)m=g.readInt(2),v=g.readInt(2),C=g.readData(v),this.extraFields[m]={id:m,length:v,value:C};g.setIndex(w)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var v=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var C=this.findExtraFieldUnicodeComment();if(C!==null)this.fileCommentStr=C;else{var w=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileName)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileComment)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(m,v,C){this.name=m,this.dir=C.dir,this.date=C.date,this.comment=C.comment,this.unixPermissions=C.unixPermissions,this.dosPermissions=C.dosPermissions,this._data=v,this._dataBinary=C.binary,this.options={compression:C.compression,compressionOptions:C.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(m){var v=null,C="string";try{if(!m)throw new Error("No output type specified.");var w=(C=m.toLowerCase())==="string"||C==="text";C!=="binarystring"&&C!=="text"||(C="string"),v=this._decompressWorker();var S=!this._dataBinary;S&&!w&&(v=v.pipe(new l.Utf8EncodeWorker)),!S&&w&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(y){(v=new d("error")).error(y)}return new s(v,C,"")},async:function(m,v){return this.internalStream(m).accumulate(v)},nodeStream:function(m,v){return this.internalStream(m||"nodebuffer").toNodejsStream(v)},_compressWorker:function(m,v){if(this._data instanceof u&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var C=this._decompressWorker();return this._dataBinary||(C=C.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(C,m,v)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)i.prototype[f[g]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,d=new l(m),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var v=i.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(m,0)};else{var p=new i.MessageChannel;p.port1.onmessage=m,s=function(){p.port2.postMessage(0)}}var g=[];function m(){var v,C;a=!0;for(var w=g.length;w;){for(C=g,g=[],v=-1;++v<w;)C[v]();w=g.length}a=!1}r.exports=function(v){g.push(v)!==1||a||s()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){"use strict";var i=n("immediate");function s(){}var a={},l=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,w!==s&&v(this,w)}function p(w,S,y){this.promise=w,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function g(w,S,y){i(function(){var k;try{k=S(y)}catch(x){return a.reject(w,x)}k===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,k)})}function m(w){var S=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof S=="function")return function(){S.apply(w,arguments)}}function v(w,S){var y=!1;function k(z){y||(y=!0,a.reject(w,z))}function x(z){y||(y=!0,a.resolve(w,z))}var M=C(function(){S(x,k)});M.status==="error"&&k(M.value)}function C(w,S){var y={};try{y.value=w(S),y.status="success"}catch(k){y.status="error",y.value=k}return y}(r.exports=f).prototype.finally=function(w){if(typeof w!="function")return this;var S=this.constructor;return this.then(function(y){return S.resolve(w()).then(function(){return y})},function(y){return S.resolve(w()).then(function(){throw y})})},f.prototype.catch=function(w){return this.then(null,w)},f.prototype.then=function(w,S){if(typeof w!="function"&&this.state===u||typeof S!="function"&&this.state===l)return this;var y=new this.constructor(s);return this.state!==d?g(y,this.state===u?w:S,this.outcome):this.queue.push(new p(y,w,S)),y},p.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},p.prototype.otherCallFulfilled=function(w){g(this.promise,this.onFulfilled,w)},p.prototype.callRejected=function(w){a.reject(this.promise,w)},p.prototype.otherCallRejected=function(w){g(this.promise,this.onRejected,w)},a.resolve=function(w,S){var y=C(m,S);if(y.status==="error")return a.reject(w,y.value);var k=y.value;if(k)v(w,k);else{w.state=u,w.outcome=S;for(var x=-1,M=w.queue.length;++x<M;)w.queue[x].callFulfilled(S)}return w},a.reject=function(w,S){w.state=l,w.outcome=S;for(var y=-1,k=w.queue.length;++y<k;)w.queue[y].callRejected(S);return w},f.resolve=function(w){return w instanceof this?w:a.resolve(new this(s),w)},f.reject=function(w){var S=new this(s);return a.reject(S,w)},f.all=function(w){var S=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=w.length,k=!1;if(!y)return this.resolve([]);for(var x=new Array(y),M=0,z=-1,q=new this(s);++z<y;)B(w[z],z);return q;function B(L,V){S.resolve(L).then(function(T){x[V]=T,++M!==y||k||(k=!0,a.resolve(q,x))},function(T){k||(k=!0,a.reject(q,T))})}},f.race=function(w){var S=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=w.length,k=!1;if(!y)return this.resolve([]);for(var x=-1,M=new this(s);++x<y;)z=w[x],S.resolve(z).then(function(q){k||(k=!0,a.resolve(M,q))},function(q){k||(k=!0,a.reject(M,q))});var z;return M}},{immediate:36}],38:[function(n,r,o){"use strict";var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){"use strict";var i=n("./zlib/deflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,p=-1,g=0,m=8;function v(w){if(!(this instanceof v))return new v(w);this.options=s.assign({level:p,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},w||{});var S=this.options;S.raw&&0<S.windowBits?S.windowBits=-S.windowBits:S.gzip&&0<S.windowBits&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var y=i.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(y!==f)throw new Error(l[y]);if(S.header&&i.deflateSetHeader(this.strm,S.header),S.dictionary){var k;if(k=typeof S.dictionary=="string"?a.string2buf(S.dictionary):d.call(S.dictionary)==="[object ArrayBuffer]"?new Uint8Array(S.dictionary):S.dictionary,(y=i.deflateSetDictionary(this.strm,k))!==f)throw new Error(l[y]);this._dict_set=!0}}function C(w,S){var y=new v(S);if(y.push(w,!0),y.err)throw y.msg||l[y.err];return y.result}v.prototype.push=function(w,S){var y,k,x=this.strm,M=this.options.chunkSize;if(this.ended)return!1;k=S===~~S?S:S===!0?4:0,typeof w=="string"?x.input=a.string2buf(w):d.call(w)==="[object ArrayBuffer]"?x.input=new Uint8Array(w):x.input=w,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new s.Buf8(M),x.next_out=0,x.avail_out=M),(y=i.deflate(x,k))!==1&&y!==f)return this.onEnd(y),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||k!==4&&k!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(x.output,x.next_out))):this.onData(s.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&y!==1);return k===4?(y=i.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===f):k!==2||(this.onEnd(f),!(x.avail_out=0))},v.prototype.onData=function(w){this.chunks.push(w)},v.prototype.onEnd=function(w){w===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=w,this.msg=this.strm.msg},o.Deflate=v,o.deflate=C,o.deflateRaw=function(w,S){return(S=S||{}).raw=!0,C(w,S)},o.gzip=function(w,S){return(S=S||{}).gzip=!0,C(w,S)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){"use strict";var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),p=Object.prototype.toString;function g(v){if(!(this instanceof g))return new g(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var C=this.options;C.raw&&0<=C.windowBits&&C.windowBits<16&&(C.windowBits=-C.windowBits,C.windowBits===0&&(C.windowBits=-15)),!(0<=C.windowBits&&C.windowBits<16)||v&&v.windowBits||(C.windowBits+=32),15<C.windowBits&&C.windowBits<48&&(15&C.windowBits)==0&&(C.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var w=i.inflateInit2(this.strm,C.windowBits);if(w!==l.Z_OK)throw new Error(u[w]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function m(v,C){var w=new g(C);if(w.push(v,!0),w.err)throw w.msg||u[w.err];return w.result}g.prototype.push=function(v,C){var w,S,y,k,x,M,z=this.strm,q=this.options.chunkSize,B=this.options.dictionary,L=!1;if(this.ended)return!1;S=C===~~C?C:C===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?z.input=a.binstring2buf(v):p.call(v)==="[object ArrayBuffer]"?z.input=new Uint8Array(v):z.input=v,z.next_in=0,z.avail_in=z.input.length;do{if(z.avail_out===0&&(z.output=new s.Buf8(q),z.next_out=0,z.avail_out=q),(w=i.inflate(z,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&B&&(M=typeof B=="string"?a.string2buf(B):p.call(B)==="[object ArrayBuffer]"?new Uint8Array(B):B,w=i.inflateSetDictionary(this.strm,M)),w===l.Z_BUF_ERROR&&L===!0&&(w=l.Z_OK,L=!1),w!==l.Z_STREAM_END&&w!==l.Z_OK)return this.onEnd(w),!(this.ended=!0);z.next_out&&(z.avail_out!==0&&w!==l.Z_STREAM_END&&(z.avail_in!==0||S!==l.Z_FINISH&&S!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=a.utf8border(z.output,z.next_out),k=z.next_out-y,x=a.buf2string(z.output,y),z.next_out=k,z.avail_out=q-k,k&&s.arraySet(z.output,z.output,y,k,0),this.onData(x)):this.onData(s.shrinkBuf(z.output,z.next_out)))),z.avail_in===0&&z.avail_out===0&&(L=!0)}while((0<z.avail_in||z.avail_out===0)&&w!==l.Z_STREAM_END);return w===l.Z_STREAM_END&&(S=l.Z_FINISH),S===l.Z_FINISH?(w=i.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===l.Z_OK):S!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(z.avail_out=0))},g.prototype.onData=function(v){this.chunks.push(v)},g.prototype.onEnd=function(v){v===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},o.Inflate=g,o.inflate=m,o.inflateRaw=function(v,C){return(C=C||{}).raw=!0,m(v,C)},o.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(l[f]=d[f])}}return l},o.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var s={arraySet:function(l,u,d,f,p){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+f),p);else for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){var u,d,f,p,g,m;for(u=f=0,d=l.length;u<d;u++)f+=l[u].length;for(m=new Uint8Array(f),u=p=0,d=l.length;u<d;u++)g=l[u],m.set(g,p),p+=g.length;return m}},a={arraySet:function(l,u,d,f,p){for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){"use strict";var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,p){if(p<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,p));for(var g="",m=0;m<p;m++)g+=String.fromCharCode(f[m]);return g}l[254]=l[254]=1,o.string2buf=function(f){var p,g,m,v,C,w=f.length,S=0;for(v=0;v<w;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),S+=g<128?1:g<2048?2:g<65536?3:4;for(p=new i.Buf8(S),v=C=0;C<S;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),g<128?p[C++]=g:(g<2048?p[C++]=192|g>>>6:(g<65536?p[C++]=224|g>>>12:(p[C++]=240|g>>>18,p[C++]=128|g>>>12&63),p[C++]=128|g>>>6&63),p[C++]=128|63&g);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),g=0,m=p.length;g<m;g++)p[g]=f.charCodeAt(g);return p},o.buf2string=function(f,p){var g,m,v,C,w=p||f.length,S=new Array(2*w);for(g=m=0;g<w;)if((v=f[g++])<128)S[m++]=v;else if(4<(C=l[v]))S[m++]=65533,g+=C-1;else{for(v&=C===2?31:C===3?15:7;1<C&&g<w;)v=v<<6|63&f[g++],C--;1<C?S[m++]=65533:v<65536?S[m++]=v:(v-=65536,S[m++]=55296|v>>10&1023,S[m++]=56320|1023&v)}return d(S,m)},o.utf8border=function(f,p){var g;for((p=p||f.length)>f.length&&(p=f.length),g=p-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?p:g+l[f[g]]>p?g:p}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var u=65535&i|0,d=i>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;d=d+(u=u+s[l++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){"use strict";r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){"use strict";var i=(function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,u){var d=i,f=u+l;s^=-1;for(var p=u;p<f;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,p=4,g=0,m=-2,v=-1,C=4,w=2,S=8,y=9,k=286,x=30,M=19,z=2*k+1,q=15,B=3,L=258,V=L+B+1,T=42,$=113,R=1,H=2,G=3,ee=4;function J(I,ie){return I.msg=d[ie],ie}function X(I){return(I<<1)-(4<I?9:0)}function xe(I){for(var ie=I.length;0<=--ie;)I[ie]=0}function fe(I){var ie=I.state,j=ie.pending;j>I.avail_out&&(j=I.avail_out),j!==0&&(s.arraySet(I.output,ie.pending_buf,ie.pending_out,j,I.next_out),I.next_out+=j,ie.pending_out+=j,I.total_out+=j,I.avail_out-=j,ie.pending-=j,ie.pending===0&&(ie.pending_out=0))}function ye(I,ie){a._tr_flush_block(I,0<=I.block_start?I.block_start:-1,I.strstart-I.block_start,ie),I.block_start=I.strstart,fe(I.strm)}function ve(I,ie){I.pending_buf[I.pending++]=ie}function Le(I,ie){I.pending_buf[I.pending++]=ie>>>8&255,I.pending_buf[I.pending++]=255&ie}function je(I,ie){var j,Z,K=I.max_chain_length,ae=I.strstart,Ce=I.prev_length,D=I.nice_match,N=I.strstart>I.w_size-V?I.strstart-(I.w_size-V):0,me=I.window,Se=I.w_mask,Te=I.prev,Ne=I.strstart+L,Ge=me[ae+Ce-1],rt=me[ae+Ce];I.prev_length>=I.good_match&&(K>>=2),D>I.lookahead&&(D=I.lookahead);do if(me[(j=ie)+Ce]===rt&&me[j+Ce-1]===Ge&&me[j]===me[ae]&&me[++j]===me[ae+1]){ae+=2,j++;do;while(me[++ae]===me[++j]&&me[++ae]===me[++j]&&me[++ae]===me[++j]&&me[++ae]===me[++j]&&me[++ae]===me[++j]&&me[++ae]===me[++j]&&me[++ae]===me[++j]&&me[++ae]===me[++j]&&ae<Ne);if(Z=L-(Ne-ae),ae=Ne-L,Ce<Z){if(I.match_start=ie,D<=(Ce=Z))break;Ge=me[ae+Ce-1],rt=me[ae+Ce]}}while((ie=Te[ie&Se])>N&&--K!=0);return Ce<=I.lookahead?Ce:I.lookahead}function nt(I){var ie,j,Z,K,ae,Ce,D,N,me,Se,Te=I.w_size;do{if(K=I.window_size-I.lookahead-I.strstart,I.strstart>=Te+(Te-V)){for(s.arraySet(I.window,I.window,Te,Te,0),I.match_start-=Te,I.strstart-=Te,I.block_start-=Te,ie=j=I.hash_size;Z=I.head[--ie],I.head[ie]=Te<=Z?Z-Te:0,--j;);for(ie=j=Te;Z=I.prev[--ie],I.prev[ie]=Te<=Z?Z-Te:0,--j;);K+=Te}if(I.strm.avail_in===0)break;if(Ce=I.strm,D=I.window,N=I.strstart+I.lookahead,me=K,Se=void 0,Se=Ce.avail_in,me<Se&&(Se=me),j=Se===0?0:(Ce.avail_in-=Se,s.arraySet(D,Ce.input,Ce.next_in,Se,N),Ce.state.wrap===1?Ce.adler=l(Ce.adler,D,Se,N):Ce.state.wrap===2&&(Ce.adler=u(Ce.adler,D,Se,N)),Ce.next_in+=Se,Ce.total_in+=Se,Se),I.lookahead+=j,I.lookahead+I.insert>=B)for(ae=I.strstart-I.insert,I.ins_h=I.window[ae],I.ins_h=(I.ins_h<<I.hash_shift^I.window[ae+1])&I.hash_mask;I.insert&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[ae+B-1])&I.hash_mask,I.prev[ae&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=ae,ae++,I.insert--,!(I.lookahead+I.insert<B)););}while(I.lookahead<V&&I.strm.avail_in!==0)}function ut(I,ie){for(var j,Z;;){if(I.lookahead<V){if(nt(I),I.lookahead<V&&ie===f)return R;if(I.lookahead===0)break}if(j=0,I.lookahead>=B&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+B-1])&I.hash_mask,j=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),j!==0&&I.strstart-j<=I.w_size-V&&(I.match_length=je(I,j)),I.match_length>=B)if(Z=a._tr_tally(I,I.strstart-I.match_start,I.match_length-B),I.lookahead-=I.match_length,I.match_length<=I.max_lazy_match&&I.lookahead>=B){for(I.match_length--;I.strstart++,I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+B-1])&I.hash_mask,j=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart,--I.match_length!=0;);I.strstart++}else I.strstart+=I.match_length,I.match_length=0,I.ins_h=I.window[I.strstart],I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+1])&I.hash_mask;else Z=a._tr_tally(I,0,I.window[I.strstart]),I.lookahead--,I.strstart++;if(Z&&(ye(I,!1),I.strm.avail_out===0))return R}return I.insert=I.strstart<B-1?I.strstart:B-1,ie===p?(ye(I,!0),I.strm.avail_out===0?G:ee):I.last_lit&&(ye(I,!1),I.strm.avail_out===0)?R:H}function ft(I,ie){for(var j,Z,K;;){if(I.lookahead<V){if(nt(I),I.lookahead<V&&ie===f)return R;if(I.lookahead===0)break}if(j=0,I.lookahead>=B&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+B-1])&I.hash_mask,j=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),I.prev_length=I.match_length,I.prev_match=I.match_start,I.match_length=B-1,j!==0&&I.prev_length<I.max_lazy_match&&I.strstart-j<=I.w_size-V&&(I.match_length=je(I,j),I.match_length<=5&&(I.strategy===1||I.match_length===B&&4096<I.strstart-I.match_start)&&(I.match_length=B-1)),I.prev_length>=B&&I.match_length<=I.prev_length){for(K=I.strstart+I.lookahead-B,Z=a._tr_tally(I,I.strstart-1-I.prev_match,I.prev_length-B),I.lookahead-=I.prev_length-1,I.prev_length-=2;++I.strstart<=K&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+B-1])&I.hash_mask,j=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),--I.prev_length!=0;);if(I.match_available=0,I.match_length=B-1,I.strstart++,Z&&(ye(I,!1),I.strm.avail_out===0))return R}else if(I.match_available){if((Z=a._tr_tally(I,0,I.window[I.strstart-1]))&&ye(I,!1),I.strstart++,I.lookahead--,I.strm.avail_out===0)return R}else I.match_available=1,I.strstart++,I.lookahead--}return I.match_available&&(Z=a._tr_tally(I,0,I.window[I.strstart-1]),I.match_available=0),I.insert=I.strstart<B-1?I.strstart:B-1,ie===p?(ye(I,!0),I.strm.avail_out===0?G:ee):I.last_lit&&(ye(I,!1),I.strm.avail_out===0)?R:H}function At(I,ie,j,Z,K){this.good_length=I,this.max_lazy=ie,this.nice_length=j,this.max_chain=Z,this.func=K}function Re(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=S,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*z),this.dyn_dtree=new s.Buf16(2*(2*x+1)),this.bl_tree=new s.Buf16(2*(2*M+1)),xe(this.dyn_ltree),xe(this.dyn_dtree),xe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(q+1),this.heap=new s.Buf16(2*k+1),xe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*k+1),xe(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function se(I){var ie;return I&&I.state?(I.total_in=I.total_out=0,I.data_type=w,(ie=I.state).pending=0,ie.pending_out=0,ie.wrap<0&&(ie.wrap=-ie.wrap),ie.status=ie.wrap?T:$,I.adler=ie.wrap===2?0:1,ie.last_flush=f,a._tr_init(ie),g):J(I,m)}function be(I){var ie=se(I);return ie===g&&(function(j){j.window_size=2*j.w_size,xe(j.head),j.max_lazy_match=i[j.level].max_lazy,j.good_match=i[j.level].good_length,j.nice_match=i[j.level].nice_length,j.max_chain_length=i[j.level].max_chain,j.strstart=0,j.block_start=0,j.lookahead=0,j.insert=0,j.match_length=j.prev_length=B-1,j.match_available=0,j.ins_h=0})(I.state),ie}function Q(I,ie,j,Z,K,ae){if(!I)return m;var Ce=1;if(ie===v&&(ie=6),Z<0?(Ce=0,Z=-Z):15<Z&&(Ce=2,Z-=16),K<1||y<K||j!==S||Z<8||15<Z||ie<0||9<ie||ae<0||C<ae)return J(I,m);Z===8&&(Z=9);var D=new Re;return(I.state=D).strm=I,D.wrap=Ce,D.gzhead=null,D.w_bits=Z,D.w_size=1<<D.w_bits,D.w_mask=D.w_size-1,D.hash_bits=K+7,D.hash_size=1<<D.hash_bits,D.hash_mask=D.hash_size-1,D.hash_shift=~~((D.hash_bits+B-1)/B),D.window=new s.Buf8(2*D.w_size),D.head=new s.Buf16(D.hash_size),D.prev=new s.Buf16(D.w_size),D.lit_bufsize=1<<K+6,D.pending_buf_size=4*D.lit_bufsize,D.pending_buf=new s.Buf8(D.pending_buf_size),D.d_buf=1*D.lit_bufsize,D.l_buf=3*D.lit_bufsize,D.level=ie,D.strategy=ae,D.method=j,be(I)}i=[new At(0,0,0,0,function(I,ie){var j=65535;for(j>I.pending_buf_size-5&&(j=I.pending_buf_size-5);;){if(I.lookahead<=1){if(nt(I),I.lookahead===0&&ie===f)return R;if(I.lookahead===0)break}I.strstart+=I.lookahead,I.lookahead=0;var Z=I.block_start+j;if((I.strstart===0||I.strstart>=Z)&&(I.lookahead=I.strstart-Z,I.strstart=Z,ye(I,!1),I.strm.avail_out===0)||I.strstart-I.block_start>=I.w_size-V&&(ye(I,!1),I.strm.avail_out===0))return R}return I.insert=0,ie===p?(ye(I,!0),I.strm.avail_out===0?G:ee):(I.strstart>I.block_start&&(ye(I,!1),I.strm.avail_out),R)}),new At(4,4,8,4,ut),new At(4,5,16,8,ut),new At(4,6,32,32,ut),new At(4,4,16,16,ft),new At(8,16,32,32,ft),new At(8,16,128,128,ft),new At(8,32,128,256,ft),new At(32,128,258,1024,ft),new At(32,258,258,4096,ft)],o.deflateInit=function(I,ie){return Q(I,ie,S,15,8,0)},o.deflateInit2=Q,o.deflateReset=be,o.deflateResetKeep=se,o.deflateSetHeader=function(I,ie){return I&&I.state?I.state.wrap!==2?m:(I.state.gzhead=ie,g):m},o.deflate=function(I,ie){var j,Z,K,ae;if(!I||!I.state||5<ie||ie<0)return I?J(I,m):m;if(Z=I.state,!I.output||!I.input&&I.avail_in!==0||Z.status===666&&ie!==p)return J(I,I.avail_out===0?-5:m);if(Z.strm=I,j=Z.last_flush,Z.last_flush=ie,Z.status===T)if(Z.wrap===2)I.adler=0,ve(Z,31),ve(Z,139),ve(Z,8),Z.gzhead?(ve(Z,(Z.gzhead.text?1:0)+(Z.gzhead.hcrc?2:0)+(Z.gzhead.extra?4:0)+(Z.gzhead.name?8:0)+(Z.gzhead.comment?16:0)),ve(Z,255&Z.gzhead.time),ve(Z,Z.gzhead.time>>8&255),ve(Z,Z.gzhead.time>>16&255),ve(Z,Z.gzhead.time>>24&255),ve(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),ve(Z,255&Z.gzhead.os),Z.gzhead.extra&&Z.gzhead.extra.length&&(ve(Z,255&Z.gzhead.extra.length),ve(Z,Z.gzhead.extra.length>>8&255)),Z.gzhead.hcrc&&(I.adler=u(I.adler,Z.pending_buf,Z.pending,0)),Z.gzindex=0,Z.status=69):(ve(Z,0),ve(Z,0),ve(Z,0),ve(Z,0),ve(Z,0),ve(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),ve(Z,3),Z.status=$);else{var Ce=S+(Z.w_bits-8<<4)<<8;Ce|=(2<=Z.strategy||Z.level<2?0:Z.level<6?1:Z.level===6?2:3)<<6,Z.strstart!==0&&(Ce|=32),Ce+=31-Ce%31,Z.status=$,Le(Z,Ce),Z.strstart!==0&&(Le(Z,I.adler>>>16),Le(Z,65535&I.adler)),I.adler=1}if(Z.status===69)if(Z.gzhead.extra){for(K=Z.pending;Z.gzindex<(65535&Z.gzhead.extra.length)&&(Z.pending!==Z.pending_buf_size||(Z.gzhead.hcrc&&Z.pending>K&&(I.adler=u(I.adler,Z.pending_buf,Z.pending-K,K)),fe(I),K=Z.pending,Z.pending!==Z.pending_buf_size));)ve(Z,255&Z.gzhead.extra[Z.gzindex]),Z.gzindex++;Z.gzhead.hcrc&&Z.pending>K&&(I.adler=u(I.adler,Z.pending_buf,Z.pending-K,K)),Z.gzindex===Z.gzhead.extra.length&&(Z.gzindex=0,Z.status=73)}else Z.status=73;if(Z.status===73)if(Z.gzhead.name){K=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>K&&(I.adler=u(I.adler,Z.pending_buf,Z.pending-K,K)),fe(I),K=Z.pending,Z.pending===Z.pending_buf_size)){ae=1;break}ae=Z.gzindex<Z.gzhead.name.length?255&Z.gzhead.name.charCodeAt(Z.gzindex++):0,ve(Z,ae)}while(ae!==0);Z.gzhead.hcrc&&Z.pending>K&&(I.adler=u(I.adler,Z.pending_buf,Z.pending-K,K)),ae===0&&(Z.gzindex=0,Z.status=91)}else Z.status=91;if(Z.status===91)if(Z.gzhead.comment){K=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>K&&(I.adler=u(I.adler,Z.pending_buf,Z.pending-K,K)),fe(I),K=Z.pending,Z.pending===Z.pending_buf_size)){ae=1;break}ae=Z.gzindex<Z.gzhead.comment.length?255&Z.gzhead.comment.charCodeAt(Z.gzindex++):0,ve(Z,ae)}while(ae!==0);Z.gzhead.hcrc&&Z.pending>K&&(I.adler=u(I.adler,Z.pending_buf,Z.pending-K,K)),ae===0&&(Z.status=103)}else Z.status=103;if(Z.status===103&&(Z.gzhead.hcrc?(Z.pending+2>Z.pending_buf_size&&fe(I),Z.pending+2<=Z.pending_buf_size&&(ve(Z,255&I.adler),ve(Z,I.adler>>8&255),I.adler=0,Z.status=$)):Z.status=$),Z.pending!==0){if(fe(I),I.avail_out===0)return Z.last_flush=-1,g}else if(I.avail_in===0&&X(ie)<=X(j)&&ie!==p)return J(I,-5);if(Z.status===666&&I.avail_in!==0)return J(I,-5);if(I.avail_in!==0||Z.lookahead!==0||ie!==f&&Z.status!==666){var D=Z.strategy===2?(function(N,me){for(var Se;;){if(N.lookahead===0&&(nt(N),N.lookahead===0)){if(me===f)return R;break}if(N.match_length=0,Se=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++,Se&&(ye(N,!1),N.strm.avail_out===0))return R}return N.insert=0,me===p?(ye(N,!0),N.strm.avail_out===0?G:ee):N.last_lit&&(ye(N,!1),N.strm.avail_out===0)?R:H})(Z,ie):Z.strategy===3?(function(N,me){for(var Se,Te,Ne,Ge,rt=N.window;;){if(N.lookahead<=L){if(nt(N),N.lookahead<=L&&me===f)return R;if(N.lookahead===0)break}if(N.match_length=0,N.lookahead>=B&&0<N.strstart&&(Te=rt[Ne=N.strstart-1])===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]){Ge=N.strstart+L;do;while(Te===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]&&Ne<Ge);N.match_length=L-(Ge-Ne),N.match_length>N.lookahead&&(N.match_length=N.lookahead)}if(N.match_length>=B?(Se=a._tr_tally(N,1,N.match_length-B),N.lookahead-=N.match_length,N.strstart+=N.match_length,N.match_length=0):(Se=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++),Se&&(ye(N,!1),N.strm.avail_out===0))return R}return N.insert=0,me===p?(ye(N,!0),N.strm.avail_out===0?G:ee):N.last_lit&&(ye(N,!1),N.strm.avail_out===0)?R:H})(Z,ie):i[Z.level].func(Z,ie);if(D!==G&&D!==ee||(Z.status=666),D===R||D===G)return I.avail_out===0&&(Z.last_flush=-1),g;if(D===H&&(ie===1?a._tr_align(Z):ie!==5&&(a._tr_stored_block(Z,0,0,!1),ie===3&&(xe(Z.head),Z.lookahead===0&&(Z.strstart=0,Z.block_start=0,Z.insert=0))),fe(I),I.avail_out===0))return Z.last_flush=-1,g}return ie!==p?g:Z.wrap<=0?1:(Z.wrap===2?(ve(Z,255&I.adler),ve(Z,I.adler>>8&255),ve(Z,I.adler>>16&255),ve(Z,I.adler>>24&255),ve(Z,255&I.total_in),ve(Z,I.total_in>>8&255),ve(Z,I.total_in>>16&255),ve(Z,I.total_in>>24&255)):(Le(Z,I.adler>>>16),Le(Z,65535&I.adler)),fe(I),0<Z.wrap&&(Z.wrap=-Z.wrap),Z.pending!==0?g:1)},o.deflateEnd=function(I){var ie;return I&&I.state?(ie=I.state.status)!==T&&ie!==69&&ie!==73&&ie!==91&&ie!==103&&ie!==$&&ie!==666?J(I,m):(I.state=null,ie===$?J(I,-3):g):m},o.deflateSetDictionary=function(I,ie){var j,Z,K,ae,Ce,D,N,me,Se=ie.length;if(!I||!I.state||(ae=(j=I.state).wrap)===2||ae===1&&j.status!==T||j.lookahead)return m;for(ae===1&&(I.adler=l(I.adler,ie,Se,0)),j.wrap=0,Se>=j.w_size&&(ae===0&&(xe(j.head),j.strstart=0,j.block_start=0,j.insert=0),me=new s.Buf8(j.w_size),s.arraySet(me,ie,Se-j.w_size,j.w_size,0),ie=me,Se=j.w_size),Ce=I.avail_in,D=I.next_in,N=I.input,I.avail_in=Se,I.next_in=0,I.input=ie,nt(j);j.lookahead>=B;){for(Z=j.strstart,K=j.lookahead-(B-1);j.ins_h=(j.ins_h<<j.hash_shift^j.window[Z+B-1])&j.hash_mask,j.prev[Z&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=Z,Z++,--K;);j.strstart=Z,j.lookahead=B-1,nt(j)}return j.strstart+=j.lookahead,j.block_start=j.strstart,j.insert=j.lookahead,j.lookahead=0,j.match_length=j.prev_length=B-1,j.match_available=0,I.next_in=D,I.input=N,I.avail_in=Ce,j.wrap=ae,g},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){"use strict";r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){"use strict";r.exports=function(i,s){var a=i.state,l=i.next_in,u,d,f,p,g,m,v,C,w,S,y,k,x,M,z,q,B,L,V,T,$,R=i.input,H;u=l+(i.avail_in-5),d=i.next_out,H=i.output,f=d-(s-i.avail_out),p=d+(i.avail_out-257),g=a.dmax,m=a.wsize,v=a.whave,C=a.wnext,w=a.window,S=a.hold,y=a.bits,k=a.lencode,x=a.distcode,M=(1<<a.lenbits)-1,z=(1<<a.distbits)-1;e:do{y<15&&(S+=R[l++]<<y,y+=8,S+=R[l++]<<y,y+=8),q=k[S&M];t:for(;;){if(S>>>=B=q>>>24,y-=B,(B=q>>>16&255)===0)H[d++]=65535&q;else{if(!(16&B)){if((64&B)==0){q=k[(65535&q)+(S&(1<<B)-1)];continue t}if(32&B){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}L=65535&q,(B&=15)&&(y<B&&(S+=R[l++]<<y,y+=8),L+=S&(1<<B)-1,S>>>=B,y-=B),y<15&&(S+=R[l++]<<y,y+=8,S+=R[l++]<<y,y+=8),q=x[S&z];n:for(;;){if(S>>>=B=q>>>24,y-=B,!(16&(B=q>>>16&255))){if((64&B)==0){q=x[(65535&q)+(S&(1<<B)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(V=65535&q,y<(B&=15)&&(S+=R[l++]<<y,(y+=8)<B&&(S+=R[l++]<<y,y+=8)),g<(V+=S&(1<<B)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(S>>>=B,y-=B,(B=d-f)<V){if(v<(B=V-B)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if($=w,(T=0)===C){if(T+=m-B,B<L){for(L-=B;H[d++]=w[T++],--B;);T=d-V,$=H}}else if(C<B){if(T+=m+C-B,(B-=C)<L){for(L-=B;H[d++]=w[T++],--B;);if(T=0,C<L){for(L-=B=C;H[d++]=w[T++],--B;);T=d-V,$=H}}}else if(T+=C-B,B<L){for(L-=B;H[d++]=w[T++],--B;);T=d-V,$=H}for(;2<L;)H[d++]=$[T++],H[d++]=$[T++],H[d++]=$[T++],L-=3;L&&(H[d++]=$[T++],1<L&&(H[d++]=$[T++]))}else{for(T=d-V;H[d++]=H[T++],H[d++]=H[T++],H[d++]=H[T++],2<(L-=3););L&&(H[d++]=H[T++],1<L&&(H[d++]=H[T++]))}break}}break}}while(l<u&&d<p);l-=L=y>>3,S&=(1<<(y-=L<<3))-1,i.next_in=l,i.next_out=d,i.avail_in=l<u?u-l+5:5-(l-u),i.avail_out=d<p?p-d+257:257-(d-p),a.hold=S,a.bits=y}},{}],49:[function(n,r,o){"use strict";var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),u=n("./inftrees"),d=1,f=2,p=0,g=-2,m=1,v=852,C=592;function w(T){return(T>>>24&255)+(T>>>8&65280)+((65280&T)<<8)+((255&T)<<24)}function S(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(T){var $;return T&&T.state?($=T.state,T.total_in=T.total_out=$.total=0,T.msg="",$.wrap&&(T.adler=1&$.wrap),$.mode=m,$.last=0,$.havedict=0,$.dmax=32768,$.head=null,$.hold=0,$.bits=0,$.lencode=$.lendyn=new i.Buf32(v),$.distcode=$.distdyn=new i.Buf32(C),$.sane=1,$.back=-1,p):g}function k(T){var $;return T&&T.state?(($=T.state).wsize=0,$.whave=0,$.wnext=0,y(T)):g}function x(T,$){var R,H;return T&&T.state?(H=T.state,$<0?(R=0,$=-$):(R=1+($>>4),$<48&&($&=15)),$&&($<8||15<$)?g:(H.window!==null&&H.wbits!==$&&(H.window=null),H.wrap=R,H.wbits=$,k(T))):g}function M(T,$){var R,H;return T?(H=new S,(T.state=H).window=null,(R=x(T,$))!==p&&(T.state=null),R):g}var z,q,B=!0;function L(T){if(B){var $;for(z=new i.Buf32(512),q=new i.Buf32(32),$=0;$<144;)T.lens[$++]=8;for(;$<256;)T.lens[$++]=9;for(;$<280;)T.lens[$++]=7;for(;$<288;)T.lens[$++]=8;for(u(d,T.lens,0,288,z,0,T.work,{bits:9}),$=0;$<32;)T.lens[$++]=5;u(f,T.lens,0,32,q,0,T.work,{bits:5}),B=!1}T.lencode=z,T.lenbits=9,T.distcode=q,T.distbits=5}function V(T,$,R,H){var G,ee=T.state;return ee.window===null&&(ee.wsize=1<<ee.wbits,ee.wnext=0,ee.whave=0,ee.window=new i.Buf8(ee.wsize)),H>=ee.wsize?(i.arraySet(ee.window,$,R-ee.wsize,ee.wsize,0),ee.wnext=0,ee.whave=ee.wsize):(H<(G=ee.wsize-ee.wnext)&&(G=H),i.arraySet(ee.window,$,R-H,G,ee.wnext),(H-=G)?(i.arraySet(ee.window,$,R-H,H,0),ee.wnext=H,ee.whave=ee.wsize):(ee.wnext+=G,ee.wnext===ee.wsize&&(ee.wnext=0),ee.whave<ee.wsize&&(ee.whave+=G))),0}o.inflateReset=k,o.inflateReset2=x,o.inflateResetKeep=y,o.inflateInit=function(T){return M(T,15)},o.inflateInit2=M,o.inflate=function(T,$){var R,H,G,ee,J,X,xe,fe,ye,ve,Le,je,nt,ut,ft,At,Re,se,be,Q,I,ie,j,Z,K=0,ae=new i.Buf8(4),Ce=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!T||!T.state||!T.output||!T.input&&T.avail_in!==0)return g;(R=T.state).mode===12&&(R.mode=13),J=T.next_out,G=T.output,xe=T.avail_out,ee=T.next_in,H=T.input,X=T.avail_in,fe=R.hold,ye=R.bits,ve=X,Le=xe,ie=p;e:for(;;)switch(R.mode){case m:if(R.wrap===0){R.mode=13;break}for(;ye<16;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(2&R.wrap&&fe===35615){ae[R.check=0]=255&fe,ae[1]=fe>>>8&255,R.check=a(R.check,ae,2,0),ye=fe=0,R.mode=2;break}if(R.flags=0,R.head&&(R.head.done=!1),!(1&R.wrap)||(((255&fe)<<8)+(fe>>8))%31){T.msg="incorrect header check",R.mode=30;break}if((15&fe)!=8){T.msg="unknown compression method",R.mode=30;break}if(ye-=4,I=8+(15&(fe>>>=4)),R.wbits===0)R.wbits=I;else if(I>R.wbits){T.msg="invalid window size",R.mode=30;break}R.dmax=1<<I,T.adler=R.check=1,R.mode=512&fe?10:12,ye=fe=0;break;case 2:for(;ye<16;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(R.flags=fe,(255&R.flags)!=8){T.msg="unknown compression method",R.mode=30;break}if(57344&R.flags){T.msg="unknown header flags set",R.mode=30;break}R.head&&(R.head.text=fe>>8&1),512&R.flags&&(ae[0]=255&fe,ae[1]=fe>>>8&255,R.check=a(R.check,ae,2,0)),ye=fe=0,R.mode=3;case 3:for(;ye<32;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}R.head&&(R.head.time=fe),512&R.flags&&(ae[0]=255&fe,ae[1]=fe>>>8&255,ae[2]=fe>>>16&255,ae[3]=fe>>>24&255,R.check=a(R.check,ae,4,0)),ye=fe=0,R.mode=4;case 4:for(;ye<16;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}R.head&&(R.head.xflags=255&fe,R.head.os=fe>>8),512&R.flags&&(ae[0]=255&fe,ae[1]=fe>>>8&255,R.check=a(R.check,ae,2,0)),ye=fe=0,R.mode=5;case 5:if(1024&R.flags){for(;ye<16;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}R.length=fe,R.head&&(R.head.extra_len=fe),512&R.flags&&(ae[0]=255&fe,ae[1]=fe>>>8&255,R.check=a(R.check,ae,2,0)),ye=fe=0}else R.head&&(R.head.extra=null);R.mode=6;case 6:if(1024&R.flags&&(X<(je=R.length)&&(je=X),je&&(R.head&&(I=R.head.extra_len-R.length,R.head.extra||(R.head.extra=new Array(R.head.extra_len)),i.arraySet(R.head.extra,H,ee,je,I)),512&R.flags&&(R.check=a(R.check,H,je,ee)),X-=je,ee+=je,R.length-=je),R.length))break e;R.length=0,R.mode=7;case 7:if(2048&R.flags){if(X===0)break e;for(je=0;I=H[ee+je++],R.head&&I&&R.length<65536&&(R.head.name+=String.fromCharCode(I)),I&&je<X;);if(512&R.flags&&(R.check=a(R.check,H,je,ee)),X-=je,ee+=je,I)break e}else R.head&&(R.head.name=null);R.length=0,R.mode=8;case 8:if(4096&R.flags){if(X===0)break e;for(je=0;I=H[ee+je++],R.head&&I&&R.length<65536&&(R.head.comment+=String.fromCharCode(I)),I&&je<X;);if(512&R.flags&&(R.check=a(R.check,H,je,ee)),X-=je,ee+=je,I)break e}else R.head&&(R.head.comment=null);R.mode=9;case 9:if(512&R.flags){for(;ye<16;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(fe!==(65535&R.check)){T.msg="header crc mismatch",R.mode=30;break}ye=fe=0}R.head&&(R.head.hcrc=R.flags>>9&1,R.head.done=!0),T.adler=R.check=0,R.mode=12;break;case 10:for(;ye<32;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}T.adler=R.check=w(fe),ye=fe=0,R.mode=11;case 11:if(R.havedict===0)return T.next_out=J,T.avail_out=xe,T.next_in=ee,T.avail_in=X,R.hold=fe,R.bits=ye,2;T.adler=R.check=1,R.mode=12;case 12:if($===5||$===6)break e;case 13:if(R.last){fe>>>=7&ye,ye-=7&ye,R.mode=27;break}for(;ye<3;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}switch(R.last=1&fe,ye-=1,3&(fe>>>=1)){case 0:R.mode=14;break;case 1:if(L(R),R.mode=20,$!==6)break;fe>>>=2,ye-=2;break e;case 2:R.mode=17;break;case 3:T.msg="invalid block type",R.mode=30}fe>>>=2,ye-=2;break;case 14:for(fe>>>=7&ye,ye-=7&ye;ye<32;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if((65535&fe)!=(fe>>>16^65535)){T.msg="invalid stored block lengths",R.mode=30;break}if(R.length=65535&fe,ye=fe=0,R.mode=15,$===6)break e;case 15:R.mode=16;case 16:if(je=R.length){if(X<je&&(je=X),xe<je&&(je=xe),je===0)break e;i.arraySet(G,H,ee,je,J),X-=je,ee+=je,xe-=je,J+=je,R.length-=je;break}R.mode=12;break;case 17:for(;ye<14;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(R.nlen=257+(31&fe),fe>>>=5,ye-=5,R.ndist=1+(31&fe),fe>>>=5,ye-=5,R.ncode=4+(15&fe),fe>>>=4,ye-=4,286<R.nlen||30<R.ndist){T.msg="too many length or distance symbols",R.mode=30;break}R.have=0,R.mode=18;case 18:for(;R.have<R.ncode;){for(;ye<3;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}R.lens[Ce[R.have++]]=7&fe,fe>>>=3,ye-=3}for(;R.have<19;)R.lens[Ce[R.have++]]=0;if(R.lencode=R.lendyn,R.lenbits=7,j={bits:R.lenbits},ie=u(0,R.lens,0,19,R.lencode,0,R.work,j),R.lenbits=j.bits,ie){T.msg="invalid code lengths set",R.mode=30;break}R.have=0,R.mode=19;case 19:for(;R.have<R.nlen+R.ndist;){for(;At=(K=R.lencode[fe&(1<<R.lenbits)-1])>>>16&255,Re=65535&K,!((ft=K>>>24)<=ye);){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(Re<16)fe>>>=ft,ye-=ft,R.lens[R.have++]=Re;else{if(Re===16){for(Z=ft+2;ye<Z;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(fe>>>=ft,ye-=ft,R.have===0){T.msg="invalid bit length repeat",R.mode=30;break}I=R.lens[R.have-1],je=3+(3&fe),fe>>>=2,ye-=2}else if(Re===17){for(Z=ft+3;ye<Z;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}ye-=ft,I=0,je=3+(7&(fe>>>=ft)),fe>>>=3,ye-=3}else{for(Z=ft+7;ye<Z;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}ye-=ft,I=0,je=11+(127&(fe>>>=ft)),fe>>>=7,ye-=7}if(R.have+je>R.nlen+R.ndist){T.msg="invalid bit length repeat",R.mode=30;break}for(;je--;)R.lens[R.have++]=I}}if(R.mode===30)break;if(R.lens[256]===0){T.msg="invalid code -- missing end-of-block",R.mode=30;break}if(R.lenbits=9,j={bits:R.lenbits},ie=u(d,R.lens,0,R.nlen,R.lencode,0,R.work,j),R.lenbits=j.bits,ie){T.msg="invalid literal/lengths set",R.mode=30;break}if(R.distbits=6,R.distcode=R.distdyn,j={bits:R.distbits},ie=u(f,R.lens,R.nlen,R.ndist,R.distcode,0,R.work,j),R.distbits=j.bits,ie){T.msg="invalid distances set",R.mode=30;break}if(R.mode=20,$===6)break e;case 20:R.mode=21;case 21:if(6<=X&&258<=xe){T.next_out=J,T.avail_out=xe,T.next_in=ee,T.avail_in=X,R.hold=fe,R.bits=ye,l(T,Le),J=T.next_out,G=T.output,xe=T.avail_out,ee=T.next_in,H=T.input,X=T.avail_in,fe=R.hold,ye=R.bits,R.mode===12&&(R.back=-1);break}for(R.back=0;At=(K=R.lencode[fe&(1<<R.lenbits)-1])>>>16&255,Re=65535&K,!((ft=K>>>24)<=ye);){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(At&&(240&At)==0){for(se=ft,be=At,Q=Re;At=(K=R.lencode[Q+((fe&(1<<se+be)-1)>>se)])>>>16&255,Re=65535&K,!(se+(ft=K>>>24)<=ye);){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}fe>>>=se,ye-=se,R.back+=se}if(fe>>>=ft,ye-=ft,R.back+=ft,R.length=Re,At===0){R.mode=26;break}if(32&At){R.back=-1,R.mode=12;break}if(64&At){T.msg="invalid literal/length code",R.mode=30;break}R.extra=15&At,R.mode=22;case 22:if(R.extra){for(Z=R.extra;ye<Z;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}R.length+=fe&(1<<R.extra)-1,fe>>>=R.extra,ye-=R.extra,R.back+=R.extra}R.was=R.length,R.mode=23;case 23:for(;At=(K=R.distcode[fe&(1<<R.distbits)-1])>>>16&255,Re=65535&K,!((ft=K>>>24)<=ye);){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if((240&At)==0){for(se=ft,be=At,Q=Re;At=(K=R.distcode[Q+((fe&(1<<se+be)-1)>>se)])>>>16&255,Re=65535&K,!(se+(ft=K>>>24)<=ye);){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}fe>>>=se,ye-=se,R.back+=se}if(fe>>>=ft,ye-=ft,R.back+=ft,64&At){T.msg="invalid distance code",R.mode=30;break}R.offset=Re,R.extra=15&At,R.mode=24;case 24:if(R.extra){for(Z=R.extra;ye<Z;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}R.offset+=fe&(1<<R.extra)-1,fe>>>=R.extra,ye-=R.extra,R.back+=R.extra}if(R.offset>R.dmax){T.msg="invalid distance too far back",R.mode=30;break}R.mode=25;case 25:if(xe===0)break e;if(je=Le-xe,R.offset>je){if((je=R.offset-je)>R.whave&&R.sane){T.msg="invalid distance too far back",R.mode=30;break}nt=je>R.wnext?(je-=R.wnext,R.wsize-je):R.wnext-je,je>R.length&&(je=R.length),ut=R.window}else ut=G,nt=J-R.offset,je=R.length;for(xe<je&&(je=xe),xe-=je,R.length-=je;G[J++]=ut[nt++],--je;);R.length===0&&(R.mode=21);break;case 26:if(xe===0)break e;G[J++]=R.length,xe--,R.mode=21;break;case 27:if(R.wrap){for(;ye<32;){if(X===0)break e;X--,fe|=H[ee++]<<ye,ye+=8}if(Le-=xe,T.total_out+=Le,R.total+=Le,Le&&(T.adler=R.check=R.flags?a(R.check,G,Le,J-Le):s(R.check,G,Le,J-Le)),Le=xe,(R.flags?fe:w(fe))!==R.check){T.msg="incorrect data check",R.mode=30;break}ye=fe=0}R.mode=28;case 28:if(R.wrap&&R.flags){for(;ye<32;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(fe!==(4294967295&R.total)){T.msg="incorrect length check",R.mode=30;break}ye=fe=0}R.mode=29;case 29:ie=1;break e;case 30:ie=-3;break e;case 31:return-4;default:return g}return T.next_out=J,T.avail_out=xe,T.next_in=ee,T.avail_in=X,R.hold=fe,R.bits=ye,(R.wsize||Le!==T.avail_out&&R.mode<30&&(R.mode<27||$!==4))&&V(T,T.output,T.next_out,Le-T.avail_out)?(R.mode=31,-4):(ve-=T.avail_in,Le-=T.avail_out,T.total_in+=ve,T.total_out+=Le,R.total+=Le,R.wrap&&Le&&(T.adler=R.check=R.flags?a(R.check,G,Le,T.next_out-Le):s(R.check,G,Le,T.next_out-Le)),T.data_type=R.bits+(R.last?64:0)+(R.mode===12?128:0)+(R.mode===20||R.mode===15?256:0),(ve==0&&Le===0||$===4)&&ie===p&&(ie=-5),ie)},o.inflateEnd=function(T){if(!T||!T.state)return g;var $=T.state;return $.window&&($.window=null),T.state=null,p},o.inflateGetHeader=function(T,$){var R;return T&&T.state?(2&(R=T.state).wrap)==0?g:((R.head=$).done=!1,p):g},o.inflateSetDictionary=function(T,$){var R,H=$.length;return T&&T.state?(R=T.state).wrap!==0&&R.mode!==11?g:R.mode===11&&s(1,$,H,0)!==R.check?-3:V(T,$,H,H)?(R.mode=31,-4):(R.havedict=1,p):g},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){"use strict";var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,p,g,m,v,C,w){var S,y,k,x,M,z,q,B,L,V=w.bits,T=0,$=0,R=0,H=0,G=0,ee=0,J=0,X=0,xe=0,fe=0,ye=null,ve=0,Le=new i.Buf16(16),je=new i.Buf16(16),nt=null,ut=0;for(T=0;T<=15;T++)Le[T]=0;for($=0;$<g;$++)Le[f[p+$]]++;for(G=V,H=15;1<=H&&Le[H]===0;H--);if(H<G&&(G=H),H===0)return m[v++]=20971520,m[v++]=20971520,w.bits=1,0;for(R=1;R<H&&Le[R]===0;R++);for(G<R&&(G=R),T=X=1;T<=15;T++)if(X<<=1,(X-=Le[T])<0)return-1;if(0<X&&(d===0||H!==1))return-1;for(je[1]=0,T=1;T<15;T++)je[T+1]=je[T]+Le[T];for($=0;$<g;$++)f[p+$]!==0&&(C[je[f[p+$]]++]=$);if(z=d===0?(ye=nt=C,19):d===1?(ye=s,ve-=257,nt=a,ut-=257,256):(ye=l,nt=u,-1),T=R,M=v,J=$=fe=0,k=-1,x=(xe=1<<(ee=G))-1,d===1&&852<xe||d===2&&592<xe)return 1;for(;;){for(q=T-J,L=C[$]<z?(B=0,C[$]):C[$]>z?(B=nt[ut+C[$]],ye[ve+C[$]]):(B=96,0),S=1<<T-J,R=y=1<<ee;m[M+(fe>>J)+(y-=S)]=q<<24|B<<16|L|0,y!==0;);for(S=1<<T-1;fe&S;)S>>=1;if(S!==0?(fe&=S-1,fe+=S):fe=0,$++,--Le[T]==0){if(T===H)break;T=f[p+C[$]]}if(G<T&&(fe&x)!==k){for(J===0&&(J=G),M+=R,X=1<<(ee=T-J);ee+J<H&&!((X-=Le[ee+J])<=0);)ee++,X<<=1;if(xe+=1<<ee,d===1&&852<xe||d===2&&592<xe)return 1;m[k=fe&x]=G<<24|ee<<16|M-v|0}}return fe!==0&&(m[M+fe]=T-J<<24|4194304),w.bits=G,0}},{"../utils/common":41}],51:[function(n,r,o){"use strict";r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){"use strict";var i=n("../utils/common"),s=0,a=1;function l(K){for(var ae=K.length;0<=--ae;)K[ae]=0}var u=0,d=29,f=256,p=f+1+d,g=30,m=19,v=2*p+1,C=15,w=16,S=7,y=256,k=16,x=17,M=18,z=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],q=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],B=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],V=new Array(2*(p+2));l(V);var T=new Array(2*g);l(T);var $=new Array(512);l($);var R=new Array(256);l(R);var H=new Array(d);l(H);var G,ee,J,X=new Array(g);function xe(K,ae,Ce,D,N){this.static_tree=K,this.extra_bits=ae,this.extra_base=Ce,this.elems=D,this.max_length=N,this.has_stree=K&&K.length}function fe(K,ae){this.dyn_tree=K,this.max_code=0,this.stat_desc=ae}function ye(K){return K<256?$[K]:$[256+(K>>>7)]}function ve(K,ae){K.pending_buf[K.pending++]=255&ae,K.pending_buf[K.pending++]=ae>>>8&255}function Le(K,ae,Ce){K.bi_valid>w-Ce?(K.bi_buf|=ae<<K.bi_valid&65535,ve(K,K.bi_buf),K.bi_buf=ae>>w-K.bi_valid,K.bi_valid+=Ce-w):(K.bi_buf|=ae<<K.bi_valid&65535,K.bi_valid+=Ce)}function je(K,ae,Ce){Le(K,Ce[2*ae],Ce[2*ae+1])}function nt(K,ae){for(var Ce=0;Ce|=1&K,K>>>=1,Ce<<=1,0<--ae;);return Ce>>>1}function ut(K,ae,Ce){var D,N,me=new Array(C+1),Se=0;for(D=1;D<=C;D++)me[D]=Se=Se+Ce[D-1]<<1;for(N=0;N<=ae;N++){var Te=K[2*N+1];Te!==0&&(K[2*N]=nt(me[Te]++,Te))}}function ft(K){var ae;for(ae=0;ae<p;ae++)K.dyn_ltree[2*ae]=0;for(ae=0;ae<g;ae++)K.dyn_dtree[2*ae]=0;for(ae=0;ae<m;ae++)K.bl_tree[2*ae]=0;K.dyn_ltree[2*y]=1,K.opt_len=K.static_len=0,K.last_lit=K.matches=0}function At(K){8<K.bi_valid?ve(K,K.bi_buf):0<K.bi_valid&&(K.pending_buf[K.pending++]=K.bi_buf),K.bi_buf=0,K.bi_valid=0}function Re(K,ae,Ce,D){var N=2*ae,me=2*Ce;return K[N]<K[me]||K[N]===K[me]&&D[ae]<=D[Ce]}function se(K,ae,Ce){for(var D=K.heap[Ce],N=Ce<<1;N<=K.heap_len&&(N<K.heap_len&&Re(ae,K.heap[N+1],K.heap[N],K.depth)&&N++,!Re(ae,D,K.heap[N],K.depth));)K.heap[Ce]=K.heap[N],Ce=N,N<<=1;K.heap[Ce]=D}function be(K,ae,Ce){var D,N,me,Se,Te=0;if(K.last_lit!==0)for(;D=K.pending_buf[K.d_buf+2*Te]<<8|K.pending_buf[K.d_buf+2*Te+1],N=K.pending_buf[K.l_buf+Te],Te++,D===0?je(K,N,ae):(je(K,(me=R[N])+f+1,ae),(Se=z[me])!==0&&Le(K,N-=H[me],Se),je(K,me=ye(--D),Ce),(Se=q[me])!==0&&Le(K,D-=X[me],Se)),Te<K.last_lit;);je(K,y,ae)}function Q(K,ae){var Ce,D,N,me=ae.dyn_tree,Se=ae.stat_desc.static_tree,Te=ae.stat_desc.has_stree,Ne=ae.stat_desc.elems,Ge=-1;for(K.heap_len=0,K.heap_max=v,Ce=0;Ce<Ne;Ce++)me[2*Ce]!==0?(K.heap[++K.heap_len]=Ge=Ce,K.depth[Ce]=0):me[2*Ce+1]=0;for(;K.heap_len<2;)me[2*(N=K.heap[++K.heap_len]=Ge<2?++Ge:0)]=1,K.depth[N]=0,K.opt_len--,Te&&(K.static_len-=Se[2*N+1]);for(ae.max_code=Ge,Ce=K.heap_len>>1;1<=Ce;Ce--)se(K,me,Ce);for(N=Ne;Ce=K.heap[1],K.heap[1]=K.heap[K.heap_len--],se(K,me,1),D=K.heap[1],K.heap[--K.heap_max]=Ce,K.heap[--K.heap_max]=D,me[2*N]=me[2*Ce]+me[2*D],K.depth[N]=(K.depth[Ce]>=K.depth[D]?K.depth[Ce]:K.depth[D])+1,me[2*Ce+1]=me[2*D+1]=N,K.heap[1]=N++,se(K,me,1),2<=K.heap_len;);K.heap[--K.heap_max]=K.heap[1],(function(rt,vt){var Ot,Mt,Yt,Ue,nn,Un,Xt=vt.dyn_tree,Bn=vt.max_code,Ln=vt.stat_desc.static_tree,jr=vt.stat_desc.has_stree,qr=vt.stat_desc.extra_bits,wr=vt.stat_desc.extra_base,Tn=vt.stat_desc.max_length,er=0;for(Ue=0;Ue<=C;Ue++)rt.bl_count[Ue]=0;for(Xt[2*rt.heap[rt.heap_max]+1]=0,Ot=rt.heap_max+1;Ot<v;Ot++)Tn<(Ue=Xt[2*Xt[2*(Mt=rt.heap[Ot])+1]+1]+1)&&(Ue=Tn,er++),Xt[2*Mt+1]=Ue,Bn<Mt||(rt.bl_count[Ue]++,nn=0,wr<=Mt&&(nn=qr[Mt-wr]),Un=Xt[2*Mt],rt.opt_len+=Un*(Ue+nn),jr&&(rt.static_len+=Un*(Ln[2*Mt+1]+nn)));if(er!==0){do{for(Ue=Tn-1;rt.bl_count[Ue]===0;)Ue--;rt.bl_count[Ue]--,rt.bl_count[Ue+1]+=2,rt.bl_count[Tn]--,er-=2}while(0<er);for(Ue=Tn;Ue!==0;Ue--)for(Mt=rt.bl_count[Ue];Mt!==0;)Bn<(Yt=rt.heap[--Ot])||(Xt[2*Yt+1]!==Ue&&(rt.opt_len+=(Ue-Xt[2*Yt+1])*Xt[2*Yt],Xt[2*Yt+1]=Ue),Mt--)}})(K,ae),ut(me,Ge,K.bl_count)}function I(K,ae,Ce){var D,N,me=-1,Se=ae[1],Te=0,Ne=7,Ge=4;for(Se===0&&(Ne=138,Ge=3),ae[2*(Ce+1)+1]=65535,D=0;D<=Ce;D++)N=Se,Se=ae[2*(D+1)+1],++Te<Ne&&N===Se||(Te<Ge?K.bl_tree[2*N]+=Te:N!==0?(N!==me&&K.bl_tree[2*N]++,K.bl_tree[2*k]++):Te<=10?K.bl_tree[2*x]++:K.bl_tree[2*M]++,me=N,Ge=(Te=0)===Se?(Ne=138,3):N===Se?(Ne=6,3):(Ne=7,4))}function ie(K,ae,Ce){var D,N,me=-1,Se=ae[1],Te=0,Ne=7,Ge=4;for(Se===0&&(Ne=138,Ge=3),D=0;D<=Ce;D++)if(N=Se,Se=ae[2*(D+1)+1],!(++Te<Ne&&N===Se)){if(Te<Ge)for(;je(K,N,K.bl_tree),--Te!=0;);else N!==0?(N!==me&&(je(K,N,K.bl_tree),Te--),je(K,k,K.bl_tree),Le(K,Te-3,2)):Te<=10?(je(K,x,K.bl_tree),Le(K,Te-3,3)):(je(K,M,K.bl_tree),Le(K,Te-11,7));me=N,Ge=(Te=0)===Se?(Ne=138,3):N===Se?(Ne=6,3):(Ne=7,4)}}l(X);var j=!1;function Z(K,ae,Ce,D){Le(K,(u<<1)+(D?1:0),3),(function(N,me,Se,Te){At(N),Te&&(ve(N,Se),ve(N,~Se)),i.arraySet(N.pending_buf,N.window,me,Se,N.pending),N.pending+=Se})(K,ae,Ce,!0)}o._tr_init=function(K){j||((function(){var ae,Ce,D,N,me,Se=new Array(C+1);for(N=D=0;N<d-1;N++)for(H[N]=D,ae=0;ae<1<<z[N];ae++)R[D++]=N;for(R[D-1]=N,N=me=0;N<16;N++)for(X[N]=me,ae=0;ae<1<<q[N];ae++)$[me++]=N;for(me>>=7;N<g;N++)for(X[N]=me<<7,ae=0;ae<1<<q[N]-7;ae++)$[256+me++]=N;for(Ce=0;Ce<=C;Ce++)Se[Ce]=0;for(ae=0;ae<=143;)V[2*ae+1]=8,ae++,Se[8]++;for(;ae<=255;)V[2*ae+1]=9,ae++,Se[9]++;for(;ae<=279;)V[2*ae+1]=7,ae++,Se[7]++;for(;ae<=287;)V[2*ae+1]=8,ae++,Se[8]++;for(ut(V,p+1,Se),ae=0;ae<g;ae++)T[2*ae+1]=5,T[2*ae]=nt(ae,5);G=new xe(V,z,f+1,p,C),ee=new xe(T,q,0,g,C),J=new xe(new Array(0),B,0,m,S)})(),j=!0),K.l_desc=new fe(K.dyn_ltree,G),K.d_desc=new fe(K.dyn_dtree,ee),K.bl_desc=new fe(K.bl_tree,J),K.bi_buf=0,K.bi_valid=0,ft(K)},o._tr_stored_block=Z,o._tr_flush_block=function(K,ae,Ce,D){var N,me,Se=0;0<K.level?(K.strm.data_type===2&&(K.strm.data_type=(function(Te){var Ne,Ge=4093624447;for(Ne=0;Ne<=31;Ne++,Ge>>>=1)if(1&Ge&&Te.dyn_ltree[2*Ne]!==0)return s;if(Te.dyn_ltree[18]!==0||Te.dyn_ltree[20]!==0||Te.dyn_ltree[26]!==0)return a;for(Ne=32;Ne<f;Ne++)if(Te.dyn_ltree[2*Ne]!==0)return a;return s})(K)),Q(K,K.l_desc),Q(K,K.d_desc),Se=(function(Te){var Ne;for(I(Te,Te.dyn_ltree,Te.l_desc.max_code),I(Te,Te.dyn_dtree,Te.d_desc.max_code),Q(Te,Te.bl_desc),Ne=m-1;3<=Ne&&Te.bl_tree[2*L[Ne]+1]===0;Ne--);return Te.opt_len+=3*(Ne+1)+5+5+4,Ne})(K),N=K.opt_len+3+7>>>3,(me=K.static_len+3+7>>>3)<=N&&(N=me)):N=me=Ce+5,Ce+4<=N&&ae!==-1?Z(K,ae,Ce,D):K.strategy===4||me===N?(Le(K,2+(D?1:0),3),be(K,V,T)):(Le(K,4+(D?1:0),3),(function(Te,Ne,Ge,rt){var vt;for(Le(Te,Ne-257,5),Le(Te,Ge-1,5),Le(Te,rt-4,4),vt=0;vt<rt;vt++)Le(Te,Te.bl_tree[2*L[vt]+1],3);ie(Te,Te.dyn_ltree,Ne-1),ie(Te,Te.dyn_dtree,Ge-1)})(K,K.l_desc.max_code+1,K.d_desc.max_code+1,Se+1),be(K,K.dyn_ltree,K.dyn_dtree)),ft(K),D&&At(K)},o._tr_tally=function(K,ae,Ce){return K.pending_buf[K.d_buf+2*K.last_lit]=ae>>>8&255,K.pending_buf[K.d_buf+2*K.last_lit+1]=255&ae,K.pending_buf[K.l_buf+K.last_lit]=255&Ce,K.last_lit++,ae===0?K.dyn_ltree[2*Ce]++:(K.matches++,ae--,K.dyn_ltree[2*(R[Ce]+f+1)]++,K.dyn_dtree[2*ye(ae)]++),K.last_lit===K.lit_bufsize-1},o._tr_align=function(K){Le(K,2,3),je(K,y,V),(function(ae){ae.bi_valid===16?(ve(ae,ae.bi_buf),ae.bi_buf=0,ae.bi_valid=0):8<=ae.bi_valid&&(ae.pending_buf[ae.pending++]=255&ae.bi_buf,ae.bi_buf>>=8,ae.bi_valid-=8)})(K)}},{"../utils/common":41}],53:[function(n,r,o){"use strict";r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){"use strict";if(!s.setImmediate){var l,u,d,f,p=1,g={},m=!1,v=s.document,C=Object.getPrototypeOf&&Object.getPrototypeOf(s);C=C&&C.setTimeout?C:s,l={}.toString.call(s.process)==="[object process]"?function(k){process.nextTick(function(){S(k)})}:(function(){if(s.postMessage&&!s.importScripts){var k=!0,x=s.onmessage;return s.onmessage=function(){k=!1},s.postMessage("","*"),s.onmessage=x,k}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",y,!1):s.attachEvent("onmessage",y),function(k){s.postMessage(f+k,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(k){S(k.data)},function(k){d.port2.postMessage(k)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(k){var x=v.createElement("script");x.onreadystatechange=function(){S(k),x.onreadystatechange=null,u.removeChild(x),x=null},u.appendChild(x)}):function(k){setTimeout(S,0,k)},C.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var x=new Array(arguments.length-1),M=0;M<x.length;M++)x[M]=arguments[M+1];return g[p]={callback:k,args:x},l(p),p++},C.clearImmediate=w}function w(k){delete g[k]}function S(k){if(m)setTimeout(S,0,k);else{var x=g[k];if(x){m=!0;try{(function(M){var z=M.callback,q=M.args;switch(q.length){case 0:z();break;case 1:z(q[0]);break;case 2:z(q[0],q[1]);break;case 3:z(q[0],q[1],q[2]);break;default:z.apply(a,q)}})(x)}finally{w(k),m=!1}}}}function y(k){k.source===s&&typeof k.data=="string"&&k.data.indexOf(f)===0&&S(+k.data.slice(f.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})),kr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Ra="application/pdf",Mu="text/html",d6={docx:kr,pdf:Ra,html:Mu},qp={RESOLVED:"resolved",NEW:"new",ADD:"add",UPDATE:"update",DELETED:"deleted",PENDING:"pending",SELECTED:"selected",COMMENTS_LIST:"comments-list",CHANGE_ACCEPTED:"change-accepted",CHANGE_REJECTED:"change-rejected"};Nt();var f6=b2(u6(),1),h6=e=>typeof e!="string"?"":e.trim(),ab=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Yp=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Ec=e=>{const t=e??{},n=h6(t.id),r=ab(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},Nk=({current:e,other:t})=>{const n=Ec(e),r=Ec(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},Lu=({actor:e,fallbackKey:t=""})=>{const n=Ec(e);if(n.hasId)return`id:${n.id}`;if(n.hasEmail)return`email:${n.email}`;const r=typeof t=="number"?String(t):typeof t=="string"?t.trim():"";return r?`fallback:${r}`:""};function p6(e){return typeof e.captureStackTrace=="function"}var Xp=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",p6(Error)&&Error.captureStackTrace(this,this.constructor)}},m6=class extends Xp{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},g6=class extends Xp{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},lb=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new m6(e);const s=atob(i[1]),a=Uint8Array.from(s,l=>l.charCodeAt(0));return new File([a],t,{type:n})}const r=await fetch(e);if(!r.ok)throw new g6(e,new Error(`HTTP ${r.status}: ${r.statusText}`));const o=await r.blob();return new File([o],t,{type:n})}catch(r){throw r instanceof Xp?r:new Xp("Failed to create file object",r)}};function v6(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const i=n[o]||0,s=r[o]||0;if(i>s)return 1;if(i<s)return-1}return 0}var Zp=new WeakMap;function Bk(e){return e.ownerDocument??document}function zk(e,t){const n=Zp.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Zp.delete(t))}function jk(e,t){const n=Bk(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&zk(e,e.__clickOutsideDocument);let r=Zp.get(n);if(!r){const o=new Map,i=s=>{const a=typeof s.composedPath=="function"?s.composedPath():null;for(const[l,u]of o)(a?.includes(l)??l.contains(s.target))||u.value?.(s)};r={bindings:o,listener:i},Zp.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var cb={mounted(e,t){jk(e,t)},updated(e,t){jk(e,t)},unmounted(e){zk(e,e.__clickOutsideDocument??Bk(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function y6(e){return e[1].user!==void 0}var b6=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(y6).filter(([r,o])=>{const i=Lu({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=Lu({actor:o.user,fallbackKey:r});let s=e.userColorMap.get(i);return s||(s=o.user.color||(e.config.colors.length>0?e.config.colors[e.colorIndex%e.config.colors.length]:void 0),e.userColorMap.set(i,s),e.colorIndex++),{clientId:r,...o.user,color:s}})},w6="https://ingest.superdoc.dev/v1/collect",wY="community-and-eval-agplv3";function C6(){try{return"2.23.1-next.3"}catch{return"unknown"}}var k6=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||w6,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=C6()}getBrowserInfo(){return typeof window>"u"?{userAgent:"",currentUrl:"",hostname:"",screenSize:{width:0,height:0}}:{userAgent:window.navigator.userAgent,currentUrl:window.location.origin,hostname:window.location.hostname,screenSize:{width:window.screen.width,height:window.screen.height}}}trackDocumentOpen(e,t=null){if(!this.enabled)return;const n={timestamp:new Date().toISOString(),documentId:e,documentCreatedAt:t};this.sendEvent(n)}async sendEvent(e){const t={superdocVersion:this.superdocVersion,browserInfo:this.getBrowserInfo(),...this.metadata&&{metadata:this.metadata},events:[e]};try{await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-License-Key":this.licenseKey},body:JSON.stringify(t),credentials:"omit"})}catch{}}},Qp={PAGE:"superdoc-page",FRAGMENT:"superdoc-fragment",FLOATING_FRAGMENT:"superdoc-floating-fragment",LINE:"superdoc-line",INLINE_SDT_WRAPPER:"superdoc-structured-content-inline",INLINE_SDT_LABEL:"superdoc-structured-content-inline__label",BLOCK_SDT:"superdoc-structured-content-block",BLOCK_SDT_LABEL:"superdoc-structured-content__label",TABLE_FRAGMENT:"superdoc-table-fragment",DOCUMENT_SECTION:"superdoc-document-section",SDT_GROUP_HOVER:"sdt-group-hover",TOC_ENTRY:"superdoc-toc-entry",TOC_GROUP_HOVER:"toc-group-hover",IMAGE_FRAGMENT:"superdoc-image-fragment",INLINE_IMAGE:"superdoc-inline-image",LIST_MARKER:"superdoc-list-marker",INLINE_IMAGE_CLIP_WRAPPER:"superdoc-inline-image-clip-wrapper",ANNOTATION:"annotation",ANNOTATION_CONTENT:"annotation-content",ANNOTATION_CARET_ANCHOR:"annotation-caret-anchor"},CY=[Qp.INLINE_SDT_LABEL,Qp.BLOCK_SDT_LABEL],Vk={PM_START:"data-pm-start",PM_END:"data-pm-end",LAYOUT_EPOCH:"data-layout-epoch",TABLE_BOUNDARIES:"data-table-boundaries",SDT_ID:"data-sdt-id",SDT_TYPE:"data-sdt-type",FIELD_ID:"data-field-id",FIELD_TYPE:"data-field-type",DRAGGABLE:"data-draggable",DISPLAY_LABEL:"data-display-label",VARIANT:"data-variant",TYPE:"data-type",LAYOUT_BOUNDARY_SCHEMA:"data-layout-boundary-schema",LAYOUT_FRAGMENT_ID:"data-layout-fragment-id",LAYOUT_STORY:"data-layout-story",LAYOUT_BLOCK_REF:"data-layout-block-ref",LAYOUT_COLUMN_INDEX:"data-layout-column-index"},S6=e=>{if(!e)return{kind:"unknown"};if(e==="body")return{kind:"body"};const t=e.indexOf(":"),n=t===-1?e:e.slice(0,t),r=t===-1?void 0:e.slice(t+1);switch(n){case"body":case"header":case"footer":case"footnote":case"endnote":case"textbox":return r?{kind:n,id:r}:{kind:n};default:return{kind:"unknown"}}},kY=`.${Qp.BLOCK_SDT}[${Vk.SDT_ID}]`,SY=`[${Vk.DRAGGABLE}="true"]`,_6=typeof window<"u",Uk,Ff=e=>Uk=e,$k=Symbol();function ub(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Nf;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Nf||(Nf={}));var Hk=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:typeof globalThis=="object"?globalThis:{HTMLElement:null};function A6(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function db(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){I6(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function Gk(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Jp(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{const n=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(n)}}var em=typeof navigator=="object"?navigator:{userAgent:""},Wk=/Macintosh/.test(em.userAgent)&&/AppleWebKit/.test(em.userAgent)&&!/Safari/.test(em.userAgent),I6=_6?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!Wk?E6:"msSaveOrOpenBlob"in em?T6:x6:()=>{};function E6(e,t="download",n){const r=document.createElement("a");r.download=t,r.rel="noopener",typeof e=="string"?(r.href=e,r.origin!==location.origin?Gk(r.href)?db(e,t,n):(r.target="_blank",Jp(r)):Jp(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Jp(r)},0))}function T6(e,t="download",n){if(typeof e=="string")if(Gk(e))db(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Jp(r)})}else navigator.msSaveOrOpenBlob(A6(e,n),t)}function x6(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return db(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(Hk.HTMLElement))||"safari"in Hk,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||Wk)&&typeof FileReader<"u"){const a=new FileReader;a.onloadend=function(){let l=a.result;if(typeof l!="string")throw r=null,new Error("Wrong reader.result type");l=s?l:l.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=l:location.assign(l),r=null},a.readAsDataURL(e)}else{const a=URL.createObjectURL(e);r?r.location.assign(a):location.href=a,r=null,setTimeout(function(){URL.revokeObjectURL(a)},4e4)}}var{assign:_Y}=Object;function R6(){const e=yv(!0),t=e.run(()=>ne({}));let n=[],r=[];const o=Xr({install(i){Ff(o),o._a=i,i.provide($k,o),i.config.globalProperties.$pinia=o,r.forEach(s=>n.push(s)),r=[]},use(i){return this._a?n.push(i):r.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o}var Kk=()=>{};function qk(e,t,n,r=Kk){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&bv()&&B2(o),o}function Pu(e,...t){e.forEach(n=>{n(...t)})}var M6=e=>e(),Yk=Symbol(),fb=Symbol();function hb(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,r)=>e.set(r,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],o=e[n];ub(o)&&ub(r)&&e.hasOwnProperty(n)&&!vr(r)&&!ai(r)?e[n]=hb(o,r):e[n]=r}return e}var L6=Symbol();function P6(e){return!ub(e)||!Object.prototype.hasOwnProperty.call(e,L6)}var{assign:_l}=Object;function D6(e){return!!(vr(e)&&e.effect)}function O6(e,t,n,r){const{state:o,actions:i,getters:s}=t,a=n.state.value[e];let l;function u(){a||(n.state.value[e]=o?o():{});const d=Y2(n.state.value[e]);return _l(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=Xr(ke(()=>{Ff(n);const g=n._s.get(e);return s[p].call(g,g)})),f),{}))}return l=Xk(e,u,t,n,r,!0),l}function Xk(e,t,n={},r,o,i){let s;const a=_l({actions:{}},n),l={deep:!0};let u,d,f=new Set,p=new Set,g;const m=r.state.value[e];!i&&!m&&(r.state.value[e]={});let v;function C(M){let z;u=d=!1,typeof M=="function"?(M(r.state.value[e]),z={type:Nf.patchFunction,storeId:e,events:g}):(hb(r.state.value[e],M),z={type:Nf.patchObject,payload:M,storeId:e,events:g});const q=v=Symbol();kt().then(()=>{v===q&&(u=!0)}),d=!0,Pu(f,z,r.state.value[e])}const w=i?function(){const{state:z}=n,q=z?z():{};this.$patch(B=>{_l(B,q)})}:Kk;function S(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const y=(M,z="")=>{if(Yk in M)return M[fb]=z,M;const q=function(){Ff(r);const B=Array.from(arguments),L=new Set,V=new Set;function T(H){L.add(H)}function $(H){V.add(H)}Pu(p,{args:B,name:q[fb],store:k,after:T,onError:$});let R;try{R=M.apply(this&&this.$id===e?this:k,B)}catch(H){throw Pu(V,H),H}return R instanceof Promise?R.then(H=>(Pu(L,H),H)).catch(H=>(Pu(V,H),Promise.reject(H))):(Pu(L,R),R)};return q[Yk]=!0,q[fb]=z,q},k=no({_p:r,$id:e,$onAction:qk.bind(null,p),$patch:C,$reset:w,$subscribe(M,z={}){const q=qk(f,M,z.detached,()=>B()),B=s.run(()=>Vt(()=>r.state.value[e],L=>{(z.flush==="sync"?d:u)&&M({storeId:e,type:Nf.direct,events:g},L)},_l({},l,z)));return q},$dispose:S});r._s.set(e,k);const x=(r._a&&r._a.runWithContext||M6)(()=>r._e.run(()=>(s=yv()).run(()=>t({action:y}))));for(const M in x){const z=x[M];vr(z)&&!D6(z)||ai(z)?i||(m&&P6(z)&&(vr(z)?z.value=m[M]:hb(z,m[M])),r.state.value[e][M]=z):typeof z=="function"&&(x[M]=y(z,M),a.actions[M]=z)}return _l(k,x),_l(kn(k),x),Object.defineProperty(k,"$state",{get:()=>r.state.value[e],set:M=>{C(z=>{_l(z,M)})}}),r._p.forEach(M=>{_l(k,s.run(()=>M({store:k,app:r._a,pinia:r,options:a})))}),m&&i&&n.hydrate&&n.hydrate(k.$state,m),u=!0,d=!0,k}function Zk(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=Sw();return s=s||(l?hl($k,null):null),s&&Ff(s),s=Uk,s._s.has(e)||(o?Xk(e,t,r,s):O6(e,r,s)),s._s.get(e)}return i.$id=e,i}function Ks(e){const t=kn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=ke({get:()=>e[r],set(i){e[r]=i}}):(vr(o)||ai(o))&&(n[r]=Ev(e,r))}return n}function Qk(e){return e.collaboration!==void 0?e.collaboration:e.v2Collaboration}function Jk(e){if(typeof e!="string"||e.length===0)return"<none>";try{const t=new URL(e);t.search="",t.hash="",t.username="",t.password="";const n=e.includes("?")?"?<redacted>":"";return`${t.toString().replace(/\?$/,"")}${n}`}catch{const t=e.replace(/\/\/[^/@]+@/,"//"),n=t.search(/[?#]/);return n===-1?t:`${t.slice(0,n)}?<redacted>`}}function Tc(e){return typeof e=="string"&&e.length>0?e:null}function F6(e){if(typeof e!="string"||e.length===0)return null;try{const t=new URL(e);return t.protocol==="ws:"||t.protocol==="wss:"?e:null}catch{return null}}function N6(e,t){if(typeof e!="string")return null;const n=e.trim();if(n.length===0)return null;try{const r=new URL(n);return r.protocol==="http:"||r.protocol==="https:"?n:null}catch{if(typeof t!="string"||t.trim().length===0)return null;try{const r=new URL(n,t);return r.protocol==="http:"||r.protocol==="https:"?r.href:null}catch{return null}}}function B6(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return Object.keys(t).length>0?t:void 0}function pb(e){return e===void 0?"join":e==="join"||e==="create"?e:null}function z6(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=2147483647?e:null}function tm(e,t){return!e.ok||t===void 0?e:{ok:!0,target:{...e.target,syncTimeoutMs:t}}}function mb(){return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration roomMode must be either "join" or "create".'}}function j6(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function V6(e){if(!e||typeof e!="object")return null;const t=typeof e.providerType=="string"?e.providerType.toLowerCase():"";return t==="hocuspocus"?"hocuspocus":t==="liveblocks"?"liveblocks":t==="superdoc"?"superdoc":e.ydoc!=null||e.provider!=null?"external-ydoc-provider":null}function e3(e,t){const n=Tc(t.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:`SuperDoc v2 collaboration requires a non-empty collaboration.documentId for the "${e}" provider.`};const r=t.url??t.serverUrl,o=F6(r);if(!o)return{ok:!1,reason:"invalid-server-url",message:`SuperDoc v2 collaboration requires a valid ws:// or wss:// URL for the "${e}" provider (received: ${Jk(r)}).`};const i=B6(t.params),s=e==="hocuspocus"&&typeof t.token=="function"?t.token:e==="hocuspocus"?Tc(t.token):null,a=pb(t.roomMode);return a?{ok:!0,target:{providerFamily:e,documentId:n,roomMode:a,serverUrl:o,...i?{params:i}:{},...s?{token:s}:{}}}:mb()}function U6(e){const t=Tc(e.adapterId);if(!t)return{ok:!1,reason:"invalid-adapter-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.adapterId."};const n=Tc(e.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.documentId."};const r=pb(e.roomMode);if(!r)return mb();if(Object.prototype.hasOwnProperty.call(e,"providerOptions"))try{structuredClone(e.providerOptions)}catch{return{ok:!1,reason:"invalid-provider-options",message:"SuperDoc v2 provider extension options must be structured-clone-safe."}}const o=typeof e.token=="function"?e.token:Tc(e.token);return{ok:!0,target:{providerFamily:"extension",adapterId:t,documentId:n,roomMode:r,...Object.prototype.hasOwnProperty.call(e,"providerOptions")?{providerOptions:e.providerOptions}:{},...o?{token:o}:{}}}}function $6(e,t){const n=Tc(e.documentId??e.roomId);if(!n)return{ok:!1,reason:"invalid-document-id",message:'SuperDoc v2 collaboration requires a non-empty collaboration.documentId (or roomId) for the "liveblocks" provider.'};const r=Tc(e.publicApiKey),o=pb(e.roomMode);if(!o)return mb();const i=e.authEndpoint,s=typeof i=="string"&&i.length>0;if(!r&&!s)return{ok:!1,reason:"missing-auth",message:"SuperDoc v2 Liveblocks collaboration requires exactly one auth mode: a publicApiKey or an authEndpoint. None was provided."};if(r&&s)return{ok:!1,reason:"mixed-auth",message:"SuperDoc v2 Liveblocks collaboration accepts exactly one auth mode; pass either publicApiKey or authEndpoint, not both."};if(r)return{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,publicApiKey:r}};const a=N6(i,t);return a?{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,authEndpoint:a}}:{ok:!1,reason:"invalid-auth-endpoint",message:"SuperDoc v2 Liveblocks collaboration requires a valid http(s) authEndpoint URL (received: <redacted>)."}}function t3(e){const{legacyCollaboration:t,documentType:n,documentCount:r,authEndpointBaseUrl:o}=e,i=Qk(e);if(typeof r=="number"&&r>1)return{ok:!1,reason:"unsupported-multi-document",message:`SuperDoc v2 collaboration supports exactly one document per room; received ${r}.`};if(n!=null&&n!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return{ok:!1,reason:"unsupported-document-type",message:"SuperDoc v2 collaboration supports DOCX documents only."};if(!(i!=null&&typeof i=="object")){const u=V6(t);if(u){const d=u==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",f=Jk(t?.url);return{ok:!1,reason:d,message:u==="external-ydoc-provider"?"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. Provide a collaboration target (e.g. { providerType, documentId, url }) instead.":`SuperDoc v2 collaboration does not accept "${u}" through the legacy modules.collaboration block (server: ${f}). Configure it as a document.collaboration target ({ providerType: "${u}", documentId, ... }) instead.`}}return{ok:!1,reason:"missing-target",message:"SuperDoc v2 collaboration requires a collaboration target ({ documentId, serverUrl } or { providerType, ... }). None was provided."}}const s=i;if(Object.prototype.hasOwnProperty.call(s,"createIfMissing"))return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration createIfMissing has been removed. Use roomMode: "create" for creation or roomMode: "join" for normal opens.'};if(s.ydoc!=null||s.provider!=null)return{ok:!1,reason:"unsupported-legacy-provider",message:"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. v2 owns its provider; pass a collaboration target ({ providerType, documentId, serverUrl | publicApiKey | authEndpoint }) instead."};const a=z6(s.syncTimeoutMs);if(a===null)return{ok:!1,reason:"invalid-sync-timeout",message:"SuperDoc v2 collaboration syncTimeoutMs must be a finite positive number within the JavaScript timer range."};const l=j6(s);return l===null||l==="y-websocket"?tm(e3("y-websocket",s),a):l==="hocuspocus"?tm(e3("hocuspocus",s),a):l==="liveblocks"?tm($6(s,o),a):l==="extension"?tm(U6(s),a):{ok:!1,reason:"unsupported-provider-family",message:`SuperDoc v2 collaboration does not support the "${l}" provider family. Supported families are y-websocket, hocuspocus, liveblocks, and extension.`}}var Bf=(e,t="document")=>{if(!e)return null;if(typeof File=="function"&&e instanceof File)return e;if(typeof Blob=="function"&&e instanceof Blob){if(typeof File=="function"){const n=e.name||t;return new File([e],n,{type:e.type})}return e}return e.originFileObj?Bf(e.originFileObj,e.name||t):e.file?Bf(e.file,e.name||t):e.raw?Bf(e.raw,e.name||t):null},n3=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,H6=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,Al=e=>{if(ArrayBuffer.isView(e))return H6?.call(e)==="Uint8Array";if(!n3)return!1;try{return n3.call(e),!0}catch{return!1}},gb=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},vb=(e,t)=>new Blob([gb(e)],{type:t}),yb=e=>{switch(e.toLowerCase()){case"docx":case kr:return kr;case"pdf":case Ra:return Ra;case"html":case Mu:return Mu;default:return e}},nm=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?kr:t.endsWith(".pdf")?Ra:t.endsWith(".html")||t.endsWith(".htm")?Mu:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},G6=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",W6="application/octet-stream",bb=e=>{if(e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"collaboration")){const n={...e};delete n.collaboration,e={...n,v2Collaboration:Qk(e)}}if(Al(e))return{type:kr,data:gb(e),name:"document.docx"};const t=Bf(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=nm(n),i=o||nm(r),s=t.type.toLowerCase()===W6,a=s&&o?n:r||n||"document",l=s&&i?i:t.type||i||"application/vnd.openxmlformats-officedocument.wordprocessingml.document";let u=t;return s&&i&&typeof File=="function"&&t instanceof File?u=new File([t],a,{type:l,lastModified:t.lastModified}):s&&i&&typeof Blob=="function"&&t instanceof Blob&&(u=new Blob([t],{type:l})),{...e.v2Collaboration!==void 0?{v2Collaboration:e.v2Collaboration}:{},type:l,data:u,name:a}}if(e&&typeof e=="object"&&"data"in e){if(Al(e.data)){const r=yb(e.type||nm(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?gb(e.data):vb(e.data,r),name:e.name||G6(r)}}const n=Bf(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?yb(e.type):"",o=r||n.type||nm(n.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document",i=!n.type||!!(r&&n.type!==r);let s=n;return i&&typeof File=="function"&&n instanceof File?s=new File([n],n.name,{type:o,lastModified:n.lastModified}):i&&typeof Blob=="function"&&n instanceof Blob&&(s=new Blob([n],{type:o})),{...e,type:o,data:s,name:e.name||n.name||"document"}}}if(e&&typeof e=="object"&&"url"in e&&typeof e.type=="string"){const n=yb(e.type);if(n!==e.type)return{...e,type:n}}return e};Nt();function K6(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?no({...t}):ne(t),i=ne(null);return Vt(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function q6(e){const t=ne(e.itemid),n=ne(e.itemicon),r=ne(e.itemiconpack),o=ne(e.itemdisplaylabel),i=e.itemlinkvalue,s=e.itemplaceholdertext,{value:a}=K6(e,i,ne([])),l=ne(e.itemtype),u=ne(e.itemfieldtype),d=e,f=no({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=ne(e.logicrules),g=ne(!1),m=no({}),v={SELECT:X6,IMAGEINPUT:Y6,CHECKBOXINPUT:Z6};return l.value in v&&Object.assign(m,v[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:u,value:a,format:ne(e.itemformat),logicRules:p,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...m}}function Y6(e){return{fontfamily:ne(e.fontfamily),iteminputtype:ne(e.iteminputtype)}}function X6(e){return{options:ne(e.itemoptions)}}function Z6(e){const t=ne(e.itemoptions);return t.value&&(t.value=t.value.map(n=>({label:n.itemdisplaylabel,value:n.itemlinkvalue,checked:n.ischecked,id:n.itemid,annotationId:n.annotationId}))),{options:t}}var qs=()=>new Map,wb=e=>{const t=qs();return e.forEach((n,r)=>{t.set(r,n)}),t},Du=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},Q6=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},J6=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Ou=()=>new Set,Cb=e=>e[e.length-1],Fu=Array.from,kb=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},r3=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},e8=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},rm=Array.isArray,t8=class{constructor(){this._observers=qs()}on(e,t){return Du(this._observers,e,Ou).add(t),t}once(e,t){const n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){const n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return Fu((this._observers.get(e)||qs()).values()).forEach(n=>n(...t))}destroy(){this._observers=qs()}},Ma=Math.floor,om=Math.abs,o3=(e,t)=>e<t?e:t,Nu=(e,t)=>e>t?e:t,AY=Number.isNaN,n8=e=>e!==0?e<0:1/e<0,IY=1,EY=2,TY=4,xY=8,RY=32,MY=64,LY=128,r8=1<<17,o8=1<<18,i8=1<<19,s8=1<<20,a8=1<<21,l8=1<<22,c8=1<<23,u8=1<<24,d8=1<<25,f8=1<<26,h8=1<<27,p8=1<<28,m8=1<<29,g8=1<<30,PY=31,DY=63,OY=127,FY=r8-1,NY=o8-1,BY=i8-1,zY=s8-1,jY=a8-1,VY=l8-1,UY=c8-1,$Y=u8-1,HY=d8-1,GY=f8-1,WY=h8-1,KY=p8-1,qY=m8-1,YY=g8-1,XY=2147483647,i3=Number.MAX_SAFE_INTEGER,s3=Number.MIN_SAFE_INTEGER,v8=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Ma(e)===e),ZY=Number.isNaN,QY=Number.parseInt,a3=String.fromCharCode,JY=String.fromCodePoint,eX=a3(65535),y8=e=>e.toLowerCase(),b8=/^\s*/g,w8=e=>e.replace(b8,""),C8=/([A-Z])/g,l3=(e,t)=>w8(e.replace(C8,n=>`${t}${y8(n)}`)),k8=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},zf=typeof TextEncoder<"u"?new TextEncoder:null,S8=e=>zf.encode(e),_8=zf?S8:k8,Sb=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Sb&&Sb.decode(new Uint8Array).length===1&&(Sb=null);var A8=(e,t)=>e8(t,()=>e).join(""),jf=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},_b=()=>new jf,I8=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},La=e=>{const t=new Uint8Array(I8(e));let n=0;for(let r=0;r<e.bufs.length;r++){const o=e.bufs[r];t.set(o,n),n+=o.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},E8=(e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Nu(n,t)*2),e.cpos=0)},go=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},Ab=go,lr=(e,t)=>{for(;t>127;)go(e,128|127&t),t=Ma(t/128);go(e,127&t)},Ib=(e,t)=>{const n=n8(t);for(n&&(t=-t),go(e,(t>63?128:0)|(n?64:0)|63&t),t=Ma(t/64);t>0;)go(e,(t>127?128:0)|127&t),t=Ma(t/128)},Eb=new Uint8Array(3e4),T8=Eb.length/3,x8=(e,t)=>{if(t.length<T8){const n=zf.encodeInto(t,Eb).written||0;lr(e,n);for(let r=0;r<n;r++)go(e,Eb[r])}else xi(e,_8(t))},R8=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;lr(e,r);for(let o=0;o<r;o++)go(e,n.codePointAt(o))},Bu=zf&&zf.encodeInto?x8:R8,Tb=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=o3(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Nu(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},xi=(e,t)=>{lr(e,t.byteLength),Tb(e,t)},xb=(e,t)=>{E8(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},M8=(e,t)=>xb(e,4).setFloat32(0,t,!1),L8=(e,t)=>xb(e,8).setFloat64(0,t,!1),P8=(e,t)=>xb(e,8).setBigInt64(0,t,!1),c3=new DataView(new ArrayBuffer(4)),D8=e=>(c3.setFloat32(0,e),c3.getFloat32(0)===e),Vf=(e,t)=>{switch(typeof t){case"string":go(e,119),Bu(e,t);break;case"number":v8(t)&&om(t)<=2147483647?(go(e,125),Ib(e,t)):D8(t)?(go(e,124),M8(e,t)):(go(e,123),L8(e,t));break;case"bigint":go(e,122),P8(e,t);break;case"object":if(t===null)go(e,126);else if(rm(t)){go(e,117),lr(e,t.length);for(let n=0;n<t.length;n++)Vf(e,t[n])}else if(t instanceof Uint8Array)go(e,116),xi(e,t);else{go(e,118);const n=Object.keys(t);lr(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];Bu(e,o),Vf(e,t[o])}}break;case"boolean":go(e,t?120:121);break;default:go(e,127)}},u3=class extends jf{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&lr(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},d3=e=>{e.count>0&&(Ib(e.encoder,e.count===1?e.s:-e.s),e.count>1&&lr(e.encoder,e.count-2))},im=class{constructor(){this.encoder=new jf,this.s=0,this.count=0}write(e){this.s===e?this.count++:(d3(this),this.count=1,this.s=e)}toUint8Array(){return d3(this),La(this.encoder)}},f3=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Ib(e.encoder,t),e.count>1&&lr(e.encoder,e.count-2)}},Rb=class{constructor(){this.encoder=new jf,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(f3(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return f3(this),La(this.encoder)}},O8=class{constructor(){this.sarr=[],this.s="",this.lensE=new im}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new jf;return this.sarr.push(this.s),this.s="",Bu(e,this.sarr.join("")),Tb(e,this.lensE.toUint8Array()),La(e)}},Il=e=>new Error(e),gs=()=>{throw Il("Method unimplemented")},Pa=()=>{throw Il("Unexpected case")},tX=crypto.subtle,F8=crypto.getRandomValues.bind(crypto),h3=()=>F8(new Uint32Array(1))[0],N8="10000000-1000-4000-8000-100000000000",B8=()=>N8.replace(/[018]/g,e=>(e^h3()&15>>e/4).toString(16)),z8=Date.now,p3=e=>new Promise(e),nX=Promise.all.bind(Promise),m3=e=>e===void 0?null:e,j8=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},g3=new j8,V8=!0;try{typeof localStorage<"u"&&localStorage&&(g3=localStorage,V8=!1)}catch{}var U8=g3,Uf=Symbol("Equality"),v3=(e,t)=>e===t||!!e?.[Uf]?.(t)||!1,$8=e=>typeof e=="object",H8=Object.assign,G8=Object.keys,W8=(e,t)=>{for(const n in e)t(e[n],n)},sm=e=>G8(e).length,K8=e=>{for(const t in e)return!1;return!0},$f=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},Mb=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),q8=(e,t)=>e===t||sm(e)===sm(t)&&$f(e,(n,r)=>(n!==void 0||Mb(t,r))&&v3(t[r],n)),Y8=Object.freeze,y3=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&y3(e[t])}return Y8(e)},Lb=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&Lb(e,t,n+1)}},am=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[Uf]!=null)return e[Uf](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(const n of e.keys())if(!t.has(n)||!am(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(sm(e)!==sm(t))return!1;for(const n in e)if(!Mb(e,n)||!am(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!am(e[n],t[n]))return!1;break;default:return!1}return!0},X8=(e,t)=>t.includes(e),Hf=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",rX=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,Ys,Z8=[],Q8=()=>{if(Ys===void 0)if(Hf){Ys=qs();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&Ys.set(t,""),t=r):t!==null?(Ys.set(t,r),t=null):Z8.push(r)}t!==null&&Ys.set(t,"")}else typeof location=="object"?(Ys=qs(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");Ys.set(`--${l3(t,"-")}`,n),Ys.set(`-${l3(t,"-")}`,n)}})):Ys=qs();return Ys},Pb=e=>Q8().has(e),lm=e=>m3(Hf?process.env[e.toUpperCase().replaceAll("-","_")]:U8.getItem(e)),b3=e=>Pb("--"+e)||lm(e)!==null,J8=b3("production"),eR=Hf&&X8(process.env.FORCE_COLOR,["true","1","2"]),tR=eR||!Pb("--no-colors")&&!b3("no-color")&&(!Hf||process.stdout.isTTY)&&(!Hf||Pb("--color")||lm("COLORTERM")!==null||(lm("TERM")||"").includes("color")),nR=class{constructor(e,t){this.left=e,this.right=t}},Da=(e,t)=>new nR(e,t),w3=e=>e.next()>=.5,Db=(e,t,n)=>Ma(e.next()*(n+1-t)+t),C3=(e,t,n)=>Ma(e.next()*(n+1-t)+t),Ob=(e,t,n)=>C3(e,t,n),rR=e=>a3(Ob(e,97,122)),oR=(e,t=0,n=20)=>{const r=Ob(e,t,n);let o="";for(let i=0;i<r;i++)o+=rR(e);return o},Fb=(e,t)=>t[Ob(e,0,t.length-1)],iR=Symbol("0schema"),sR=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){const e=[];for(let t=this._rerrs.length-1;t>0;t--){const n=this._rerrs[t];e.push(A8(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
4
|
+
\0`,Le+=i(fe,2),Le+=M.magic,Le+=i(y,2),Le+=i(k,2),Le+=i(xe.crc32,4),Le+=i(xe.compressedSize,4),Le+=i(xe.uncompressedSize,4),Le+=i(q.length,2),Le+=i(H.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Le+q+H,dirRecord:f.CENTRAL_FILE_HEADER+i(ve,2)+Le+i(V.length,2)+"\0\0\0\0"+i(ye,4)+i(C,4)+q+H+V}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(g,m,v,C){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=v,this.encodeFileName=C,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(g){var m=g.meta.percent||0,v=this.entriesCount,C=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:v?(m+100*(v-C-1))/v:100}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var v=s(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,v=s(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:(function(C){return f.DATA_DESCRIPTOR+i(C.crc32,4)+i(C.compressedSize,4)+i(C.uncompressedSize,4)})(g),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-g,C=(function(w,S,y,k,x){var M=a.transformTo("string",x(k));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(S,4)+i(y,4)+i(M.length,2)+M})(this.dirRecords.length,v,g,this.zipComment,this.encodeFileName);this.push({data:C,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(g){this._sources.push(g);var m=this;return g.on("data",function(v){m.processChunk(v)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(v){m.error(v)}),this},p.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var v=0;v<m.length;v++)try{m[v].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,u){var d=new s(l.streamFiles,u,l.platform,l.encodeFileName),f=0;try{a.forEach(function(p,g){f++;var m=(function(S,y){var k=S||y,x=i[k];if(!x)throw new Error(k+" is not a valid compression method !");return x})(g.options.compression,l.compression),v=g.options.compressionOptions||l.compressionOptions||{},C=g.dir,w=g.date;g._compressWorker(m,v).withStreamInfo("file",{name:p,dir:C,date:w,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(p){return new s.Promise(function(g,m){var v=p.decompressed.getContentWorker().pipe(new u);v.on("error",function(C){m(C)}).on("end",function(){v.streamInfo.crc32!==p.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var m=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(v){var C=new l(g);return C.load(v),C}).then(function(v){var C=[s.Promise.resolve(v)],w=v.files;if(g.checkCRC32)for(var S=0;S<w.length;S++)C.push(f(w[S]));return s.Promise.all(C)}).then(function(v){for(var C=v.shift(),w=C.files,S=0;S<w.length;S++){var y=w[S],k=y.fileNameStr,x=i.resolve(y.fileNameStr);m.file(x,y.decompressed,{binary:!0,optimizedBinaryString:!0,date:y.date,dir:y.dir,comment:y.fileCommentStr.length?y.fileCommentStr:null,unixPermissions:y.unixPermissions,dosPermissions:y.dosPermissions,createFolders:g.createFolders}),y.dir||(m.file(x).unsafeOriginalName=k)}return C.zipComment.length&&(m.comment=C.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,u){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),a.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){"use strict";var i=n("readable-stream").Readable;function s(a,l,u){i.call(this,l),this._helper=a;var d=this;a.on("data",function(f,p){d.push(f)||d._helper.pause(),u&&u(p)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(k,x,M){var z,q=a.getTypeOf(x),B=a.extend(M||{},d);B.date=B.date||new Date,B.compression!==null&&(B.compression=B.compression.toUpperCase()),typeof B.unixPermissions=="string"&&(B.unixPermissions=parseInt(B.unixPermissions,8)),B.unixPermissions&&16384&B.unixPermissions&&(B.dir=!0),B.dosPermissions&&16&B.dosPermissions&&(B.dir=!0),B.dir&&(k=w(k)),B.createFolders&&(z=C(k))&&S.call(this,z,!0);var L=q==="string"&&B.binary===!1&&B.base64===!1;M&&M.binary!==void 0||(B.binary=!L),(x instanceof f&&x.uncompressedSize===0||B.dir||!x||x.length===0)&&(B.base64=!1,B.binary=!0,x="",B.compression="STORE",q="string");var V=null;V=x instanceof f||x instanceof l?x:m.isNode&&m.isStream(x)?new v(k,x):a.prepareContent(k,x,B.binary,B.optimizedBinaryString,B.base64);var T=new p(k,V,B);this.files[k]=T}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),g=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),C=function(k){k.slice(-1)==="/"&&(k=k.substring(0,k.length-1));var x=k.lastIndexOf("/");return 0<x?k.substring(0,x):""},w=function(k){return k.slice(-1)!=="/"&&(k+="/"),k},S=function(k,x){return x=x!==void 0?x:d.createFolders,k=w(k),this.files[k]||i.call(this,k,null,{dir:!0,createFolders:x}),this.files[k]};function y(k){return Object.prototype.toString.call(k)==="[object RegExp]"}r.exports={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(k){var x,M,z;for(x in this.files)z=this.files[x],(M=x.slice(this.root.length,x.length))&&x.slice(0,this.root.length)===this.root&&k(M,z)},filter:function(k){var x=[];return this.forEach(function(M,z){k(M,z)&&x.push(z)}),x},file:function(k,x,M){if(arguments.length!==1)return k=this.root+k,i.call(this,k,x,M),this;if(y(k)){var z=k;return this.filter(function(B,L){return!L.dir&&z.test(B)})}var q=this.files[this.root+k];return q&&!q.dir?q:null},folder:function(k){if(!k)return this;if(y(k))return this.filter(function(q,B){return B.dir&&k.test(q)});var x=this.root+k,M=S.call(this,x),z=this.clone();return z.root=M.name,z},remove:function(k){k=this.root+k;var x=this.files[k];if(x||(k.slice(-1)!=="/"&&(k+="/"),x=this.files[k]),x&&!x.dir)delete this.files[k];else for(var M=this.filter(function(q,B){return B.name.slice(0,k.length)===k}),z=0;z<M.length;z++)delete this.files[M[z].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(k){var x,M={};try{if((M=a.extend(k||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=M.type.toLowerCase(),M.compression=M.compression.toUpperCase(),M.type==="binarystring"&&(M.type="string"),!M.type)throw new Error("No output type specified.");a.checkSupport(M.type),M.platform!=="darwin"&&M.platform!=="freebsd"&&M.platform!=="linux"&&M.platform!=="sunos"||(M.platform="UNIX"),M.platform==="win32"&&(M.platform="DOS");var z=M.comment||this.comment||"";x=g.generateWorker(this,M,z)}catch(q){(x=new l("error")).error(q)}return new u(x,M.type||"string",M.mimeType)},generateAsync:function(k,x){return this.generateInternalStream(k).accumulate(x)},generateNodeStream:function(k,x){return(k=k||{}).type||(k.type="nodebuffer"),this.generateInternalStream(k).toNodejsStream(x)}}},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){"use strict";r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===f)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&u===p[1]&&d===p[2]&&f===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,u=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){"use strict";var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){"use strict";var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var p=i.getTypeOf(f);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(f):s.uint8array?new d(i.transformTo("uint8array",f)):new a(i.transformTo("array",f)):new l(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){"use strict";function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(m,v){return new d.Promise(function(C,w){var S=[],y=m._internalType,k=m._outputType,x=m._mimeType;m.on("data",function(M,z){S.push(M),v&&v(z)}).on("error",function(M){S=[],w(M)}).on("end",function(){try{C((function(M,z,q){switch(M){case"blob":return i.newBlob(i.transformTo("arraybuffer",z),q);case"base64":return l.encode(z);default:return i.transformTo(M,z)}})(k,(function(M,z){var q,B=0,L=null,V=0;for(q=0;q<z.length;q++)V+=z[q].length;switch(M){case"string":return z.join("");case"array":return Array.prototype.concat.apply([],z);case"uint8array":for(L=new Uint8Array(V),q=0;q<z.length;q++)L.set(z[q],B),B+=z[q].length;return L;case"nodebuffer":return Buffer.concat(z);default:throw new Error("concat : unsupported type '"+M+"'")}})(y,S),x))}catch(M){w(M)}S=[]}).resume()})}function g(m,v,C){var w=v;switch(v){case"blob":case"arraybuffer":w="uint8array";break;case"base64":w="string"}try{this._internalType=w,this._outputType=v,this._mimeType=C,i.checkSupport(w),this._worker=m.pipe(new s(w)),m.lock()}catch(S){this._worker=new a("error"),this._worker.error(S)}}g.prototype={accumulate:function(m){return p(this,m)},on:function(m,v){var C=this;return m==="data"?this._worker.on(m,function(w){v.call(C,w.data,w.meta)}):this._worker.on(m,function(){i.delay(v,arguments,C)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},m)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(m){var v,C,w,S,y,k=m.length,x=0;for(S=0;S<k;S++)(64512&(C=m.charCodeAt(S)))==55296&&S+1<k&&(64512&(w=m.charCodeAt(S+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),S++),x+=C<128?1:C<2048?2:C<65536?3:4;for(v=s.uint8array?new Uint8Array(x):new Array(x),S=y=0;y<x;S++)(64512&(C=m.charCodeAt(S)))==55296&&S+1<k&&(64512&(w=m.charCodeAt(S+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),S++),C<128?v[y++]=C:(C<2048?v[y++]=192|C>>>6:(C<65536?v[y++]=224|C>>>12:(v[y++]=240|C>>>18,v[y++]=128|C>>>12&63),v[y++]=128|C>>>6&63),v[y++]=128|63&C);return v})(g)},o.utf8decode=function(g){return s.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):(function(m){var v,C,w,S,y=m.length,k=new Array(2*y);for(v=C=0;v<y;)if((w=m[v++])<128)k[C++]=w;else if(4<(S=u[w]))k[C++]=65533,v+=S-1;else{for(w&=S===2?31:S===3?15:7;1<S&&v<y;)w=w<<6|63&m[v++],S--;1<S?k[C++]=65533:w<65536?k[C++]=w:(w-=65536,k[C++]=55296|w>>10&1023,k[C++]=56320|1023&w)}return k.length!==C&&(k.subarray?k=k.subarray(0,C):k.length=C),i.applyFromCharCode(k)})(g=i.transformTo(s.uint8array?"uint8array":"array",g))},i.inherits(f,l),f.prototype.processChunk=function(g){var m=i.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var v=m;(m=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),m.set(v,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var C=(function(S,y){var k;for((y=y||S.length)>S.length&&(y=S.length),k=y-1;0<=k&&(192&S[k])==128;)k--;return k<0||k===0?y:k+u[S[k]]>y?k:y})(m),w=m;C!==m.length&&(s.uint8array?(w=m.subarray(0,C),this.leftOver=m.subarray(C,m.length)):(w=m.slice(0,C),this.leftOver=m.slice(C,m.length))),this.push({data:o.utf8decode(w),meta:g.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(p,l),p.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(v){return v}function d(v,C){for(var w=0;w<v.length;++w)C[w]=255&v.charCodeAt(w);return C}n("setimmediate"),o.newBlob=function(v,C){o.checkSupport("blob");try{return new Blob([v],{type:C})}catch{try{var w=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return w.append(v),w.getBlob(C)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(v,C,w){var S=[],y=0,k=v.length;if(k<=w)return String.fromCharCode.apply(null,v);for(;y<k;)C==="array"||C==="nodebuffer"?S.push(String.fromCharCode.apply(null,v.slice(y,Math.min(y+w,k)))):S.push(String.fromCharCode.apply(null,v.subarray(y,Math.min(y+w,k)))),y+=w;return S.join("")},stringifyByChar:function(v){for(var C="",w=0;w<v.length;w++)C+=String.fromCharCode(v[w]);return C},applyCanBeUsed:{uint8array:(function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}})()}};function p(v){var C=65536,w=o.getTypeOf(v),S=!0;if(w==="uint8array"?S=f.applyCanBeUsed.uint8array:w==="nodebuffer"&&(S=f.applyCanBeUsed.nodebuffer),S)for(;1<C;)try{return f.stringifyByChunk(v,w,C)}catch{C=Math.floor(C/2)}return f.stringifyByChar(v)}function g(v,C){for(var w=0;w<v.length;w++)C[w]=v[w];return C}o.applyFromCharCode=p;var m={};m.string={string:u,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return m.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,a.allocBuffer(v.length))}},m.array={string:p,array:u,arraybuffer:function(v){return new Uint8Array(v).buffer},uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(v)}},m.arraybuffer={string:function(v){return p(new Uint8Array(v))},array:function(v){return g(new Uint8Array(v),new Array(v.byteLength))},arraybuffer:u,uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(new Uint8Array(v))}},m.uint8array={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:u,nodebuffer:function(v){return a.newBufferFrom(v)}},m.nodebuffer={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return g(v,new Uint8Array(v.length))},nodebuffer:u},o.transformTo=function(v,C){return C=C||"",v?(o.checkSupport(v),m[o.getTypeOf(C)][v](C)):C},o.resolve=function(v){for(var C=v.split("/"),w=[],S=0;S<C.length;S++){var y=C[S];y==="."||y===""&&S!==0&&S!==C.length-1||(y===".."?w.pop():w.push(y))}return w.join("/")},o.getTypeOf=function(v){return typeof v=="string"?"string":Object.prototype.toString.call(v)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(v)?"nodebuffer":i.uint8array&&v instanceof Uint8Array?"uint8array":i.arraybuffer&&v instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(v){if(!i[v.toLowerCase()])throw new Error(v+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(v){var C,w,S="";for(w=0;w<(v||"").length;w++)S+="\\x"+((C=v.charCodeAt(w))<16?"0":"")+C.toString(16).toUpperCase();return S},o.delay=function(v,C,w){setImmediate(function(){v.apply(w||null,C||[])})},o.inherits=function(v,C){function w(){}w.prototype=C.prototype,v.prototype=new w},o.extend=function(){var v,C,w={};for(v=0;v<arguments.length;v++)for(C in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],C)&&w[C]===void 0&&(w[C]=arguments[v][C]);return w},o.prepareContent=function(v,C,w,S,y){return l.Promise.resolve(C).then(function(k){return i.blob&&(k instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(k))!==-1)&&typeof FileReader<"u"?new l.Promise(function(x,M){var z=new FileReader;z.onload=function(q){x(q.target.result)},z.onerror=function(q){M(q.target.error)},z.readAsArrayBuffer(k)}):k}).then(function(k){var x=o.getTypeOf(k);return x?(x==="arraybuffer"?k=o.transformTo("uint8array",k):x==="string"&&(y?k=s.decode(k):w&&S!==!0&&(k=(function(M){return d(M,i.uint8array?new Uint8Array(M.length):new Array(M.length))})(k))),k):l.Promise.reject(new Error("Can't read the data of '"+v+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),l=n("./zipEntry"),u=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var g=this.reader.index;this.reader.setIndex(f);var m=this.reader.readString(4)===p;return this.reader.setIndex(g),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",g=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,g,m=this.zip64EndOfCentralSize-44;0<m;)f=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var m=p-g;if(0<m)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function p(g,m){this.options=g,this.loadOptions=m}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var m,v;if(g.skip(22),this.fileNameLength=g.readInt(2),v=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(C){for(var w in d)if(Object.prototype.hasOwnProperty.call(d,w)&&d[w].magic===C)return d[w];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,m,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var m=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(m),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var m,v,C,w=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<w;)m=g.readInt(2),v=g.readInt(2),C=g.readData(v),this.extraFields[m]={id:m,length:v,value:C};g.setIndex(w)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var v=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var C=this.findExtraFieldUnicodeComment();if(C!==null)this.fileCommentStr=C;else{var w=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileName)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileComment)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(m,v,C){this.name=m,this.dir=C.dir,this.date=C.date,this.comment=C.comment,this.unixPermissions=C.unixPermissions,this.dosPermissions=C.dosPermissions,this._data=v,this._dataBinary=C.binary,this.options={compression:C.compression,compressionOptions:C.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(m){var v=null,C="string";try{if(!m)throw new Error("No output type specified.");var w=(C=m.toLowerCase())==="string"||C==="text";C!=="binarystring"&&C!=="text"||(C="string"),v=this._decompressWorker();var S=!this._dataBinary;S&&!w&&(v=v.pipe(new l.Utf8EncodeWorker)),!S&&w&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(y){(v=new d("error")).error(y)}return new s(v,C,"")},async:function(m,v){return this.internalStream(m).accumulate(v)},nodeStream:function(m,v){return this.internalStream(m||"nodebuffer").toNodejsStream(v)},_compressWorker:function(m,v){if(this._data instanceof u&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var C=this._decompressWorker();return this._dataBinary||(C=C.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(C,m,v)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)i.prototype[f[g]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,d=new l(m),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var v=i.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(m,0)};else{var p=new i.MessageChannel;p.port1.onmessage=m,s=function(){p.port2.postMessage(0)}}var g=[];function m(){var v,C;a=!0;for(var w=g.length;w;){for(C=g,g=[],v=-1;++v<w;)C[v]();w=g.length}a=!1}r.exports=function(v){g.push(v)!==1||a||s()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){"use strict";var i=n("immediate");function s(){}var a={},l=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,w!==s&&v(this,w)}function p(w,S,y){this.promise=w,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof y=="function"&&(this.onRejected=y,this.callRejected=this.otherCallRejected)}function g(w,S,y){i(function(){var k;try{k=S(y)}catch(x){return a.reject(w,x)}k===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,k)})}function m(w){var S=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof S=="function")return function(){S.apply(w,arguments)}}function v(w,S){var y=!1;function k(z){y||(y=!0,a.reject(w,z))}function x(z){y||(y=!0,a.resolve(w,z))}var M=C(function(){S(x,k)});M.status==="error"&&k(M.value)}function C(w,S){var y={};try{y.value=w(S),y.status="success"}catch(k){y.status="error",y.value=k}return y}(r.exports=f).prototype.finally=function(w){if(typeof w!="function")return this;var S=this.constructor;return this.then(function(y){return S.resolve(w()).then(function(){return y})},function(y){return S.resolve(w()).then(function(){throw y})})},f.prototype.catch=function(w){return this.then(null,w)},f.prototype.then=function(w,S){if(typeof w!="function"&&this.state===u||typeof S!="function"&&this.state===l)return this;var y=new this.constructor(s);return this.state!==d?g(y,this.state===u?w:S,this.outcome):this.queue.push(new p(y,w,S)),y},p.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},p.prototype.otherCallFulfilled=function(w){g(this.promise,this.onFulfilled,w)},p.prototype.callRejected=function(w){a.reject(this.promise,w)},p.prototype.otherCallRejected=function(w){g(this.promise,this.onRejected,w)},a.resolve=function(w,S){var y=C(m,S);if(y.status==="error")return a.reject(w,y.value);var k=y.value;if(k)v(w,k);else{w.state=u,w.outcome=S;for(var x=-1,M=w.queue.length;++x<M;)w.queue[x].callFulfilled(S)}return w},a.reject=function(w,S){w.state=l,w.outcome=S;for(var y=-1,k=w.queue.length;++y<k;)w.queue[y].callRejected(S);return w},f.resolve=function(w){return w instanceof this?w:a.resolve(new this(s),w)},f.reject=function(w){var S=new this(s);return a.reject(S,w)},f.all=function(w){var S=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=w.length,k=!1;if(!y)return this.resolve([]);for(var x=new Array(y),M=0,z=-1,q=new this(s);++z<y;)B(w[z],z);return q;function B(L,V){S.resolve(L).then(function(T){x[V]=T,++M!==y||k||(k=!0,a.resolve(q,x))},function(T){k||(k=!0,a.reject(q,T))})}},f.race=function(w){var S=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var y=w.length,k=!1;if(!y)return this.resolve([]);for(var x=-1,M=new this(s);++x<y;)z=w[x],S.resolve(z).then(function(q){k||(k=!0,a.resolve(M,q))},function(q){k||(k=!0,a.reject(M,q))});var z;return M}},{immediate:36}],38:[function(n,r,o){"use strict";var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){"use strict";var i=n("./zlib/deflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,p=-1,g=0,m=8;function v(w){if(!(this instanceof v))return new v(w);this.options=s.assign({level:p,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},w||{});var S=this.options;S.raw&&0<S.windowBits?S.windowBits=-S.windowBits:S.gzip&&0<S.windowBits&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var y=i.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(y!==f)throw new Error(l[y]);if(S.header&&i.deflateSetHeader(this.strm,S.header),S.dictionary){var k;if(k=typeof S.dictionary=="string"?a.string2buf(S.dictionary):d.call(S.dictionary)==="[object ArrayBuffer]"?new Uint8Array(S.dictionary):S.dictionary,(y=i.deflateSetDictionary(this.strm,k))!==f)throw new Error(l[y]);this._dict_set=!0}}function C(w,S){var y=new v(S);if(y.push(w,!0),y.err)throw y.msg||l[y.err];return y.result}v.prototype.push=function(w,S){var y,k,x=this.strm,M=this.options.chunkSize;if(this.ended)return!1;k=S===~~S?S:S===!0?4:0,typeof w=="string"?x.input=a.string2buf(w):d.call(w)==="[object ArrayBuffer]"?x.input=new Uint8Array(w):x.input=w,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new s.Buf8(M),x.next_out=0,x.avail_out=M),(y=i.deflate(x,k))!==1&&y!==f)return this.onEnd(y),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||k!==4&&k!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(x.output,x.next_out))):this.onData(s.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&y!==1);return k===4?(y=i.deflateEnd(this.strm),this.onEnd(y),this.ended=!0,y===f):k!==2||(this.onEnd(f),!(x.avail_out=0))},v.prototype.onData=function(w){this.chunks.push(w)},v.prototype.onEnd=function(w){w===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=w,this.msg=this.strm.msg},o.Deflate=v,o.deflate=C,o.deflateRaw=function(w,S){return(S=S||{}).raw=!0,C(w,S)},o.gzip=function(w,S){return(S=S||{}).gzip=!0,C(w,S)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){"use strict";var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),p=Object.prototype.toString;function g(v){if(!(this instanceof g))return new g(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var C=this.options;C.raw&&0<=C.windowBits&&C.windowBits<16&&(C.windowBits=-C.windowBits,C.windowBits===0&&(C.windowBits=-15)),!(0<=C.windowBits&&C.windowBits<16)||v&&v.windowBits||(C.windowBits+=32),15<C.windowBits&&C.windowBits<48&&(15&C.windowBits)==0&&(C.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var w=i.inflateInit2(this.strm,C.windowBits);if(w!==l.Z_OK)throw new Error(u[w]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function m(v,C){var w=new g(C);if(w.push(v,!0),w.err)throw w.msg||u[w.err];return w.result}g.prototype.push=function(v,C){var w,S,y,k,x,M,z=this.strm,q=this.options.chunkSize,B=this.options.dictionary,L=!1;if(this.ended)return!1;S=C===~~C?C:C===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?z.input=a.binstring2buf(v):p.call(v)==="[object ArrayBuffer]"?z.input=new Uint8Array(v):z.input=v,z.next_in=0,z.avail_in=z.input.length;do{if(z.avail_out===0&&(z.output=new s.Buf8(q),z.next_out=0,z.avail_out=q),(w=i.inflate(z,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&B&&(M=typeof B=="string"?a.string2buf(B):p.call(B)==="[object ArrayBuffer]"?new Uint8Array(B):B,w=i.inflateSetDictionary(this.strm,M)),w===l.Z_BUF_ERROR&&L===!0&&(w=l.Z_OK,L=!1),w!==l.Z_STREAM_END&&w!==l.Z_OK)return this.onEnd(w),!(this.ended=!0);z.next_out&&(z.avail_out!==0&&w!==l.Z_STREAM_END&&(z.avail_in!==0||S!==l.Z_FINISH&&S!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(y=a.utf8border(z.output,z.next_out),k=z.next_out-y,x=a.buf2string(z.output,y),z.next_out=k,z.avail_out=q-k,k&&s.arraySet(z.output,z.output,y,k,0),this.onData(x)):this.onData(s.shrinkBuf(z.output,z.next_out)))),z.avail_in===0&&z.avail_out===0&&(L=!0)}while((0<z.avail_in||z.avail_out===0)&&w!==l.Z_STREAM_END);return w===l.Z_STREAM_END&&(S=l.Z_FINISH),S===l.Z_FINISH?(w=i.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===l.Z_OK):S!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(z.avail_out=0))},g.prototype.onData=function(v){this.chunks.push(v)},g.prototype.onEnd=function(v){v===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},o.Inflate=g,o.inflate=m,o.inflateRaw=function(v,C){return(C=C||{}).raw=!0,m(v,C)},o.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(l[f]=d[f])}}return l},o.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var s={arraySet:function(l,u,d,f,p){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+f),p);else for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){var u,d,f,p,g,m;for(u=f=0,d=l.length;u<d;u++)f+=l[u].length;for(m=new Uint8Array(f),u=p=0,d=l.length;u<d;u++)g=l[u],m.set(g,p),p+=g.length;return m}},a={arraySet:function(l,u,d,f,p){for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){"use strict";var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,p){if(p<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,p));for(var g="",m=0;m<p;m++)g+=String.fromCharCode(f[m]);return g}l[254]=l[254]=1,o.string2buf=function(f){var p,g,m,v,C,w=f.length,S=0;for(v=0;v<w;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),S+=g<128?1:g<2048?2:g<65536?3:4;for(p=new i.Buf8(S),v=C=0;C<S;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),g<128?p[C++]=g:(g<2048?p[C++]=192|g>>>6:(g<65536?p[C++]=224|g>>>12:(p[C++]=240|g>>>18,p[C++]=128|g>>>12&63),p[C++]=128|g>>>6&63),p[C++]=128|63&g);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),g=0,m=p.length;g<m;g++)p[g]=f.charCodeAt(g);return p},o.buf2string=function(f,p){var g,m,v,C,w=p||f.length,S=new Array(2*w);for(g=m=0;g<w;)if((v=f[g++])<128)S[m++]=v;else if(4<(C=l[v]))S[m++]=65533,g+=C-1;else{for(v&=C===2?31:C===3?15:7;1<C&&g<w;)v=v<<6|63&f[g++],C--;1<C?S[m++]=65533:v<65536?S[m++]=v:(v-=65536,S[m++]=55296|v>>10&1023,S[m++]=56320|1023&v)}return d(S,m)},o.utf8border=function(f,p){var g;for((p=p||f.length)>f.length&&(p=f.length),g=p-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?p:g+l[f[g]]>p?g:p}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var u=65535&i|0,d=i>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;d=d+(u=u+s[l++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){"use strict";r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){"use strict";var i=(function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,u){var d=i,f=u+l;s^=-1;for(var p=u;p<f;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,p=4,g=0,m=-2,v=-1,C=4,w=2,S=8,y=9,k=286,x=30,M=19,z=2*k+1,q=15,B=3,L=258,V=L+B+1,T=42,$=113,R=1,H=2,G=3,ee=4;function J(I,ie){return I.msg=d[ie],ie}function X(I){return(I<<1)-(4<I?9:0)}function xe(I){for(var ie=I.length;0<=--ie;)I[ie]=0}function fe(I){var ie=I.state,j=ie.pending;j>I.avail_out&&(j=I.avail_out),j!==0&&(s.arraySet(I.output,ie.pending_buf,ie.pending_out,j,I.next_out),I.next_out+=j,ie.pending_out+=j,I.total_out+=j,I.avail_out-=j,ie.pending-=j,ie.pending===0&&(ie.pending_out=0))}function ye(I,ie){a._tr_flush_block(I,0<=I.block_start?I.block_start:-1,I.strstart-I.block_start,ie),I.block_start=I.strstart,fe(I.strm)}function ve(I,ie){I.pending_buf[I.pending++]=ie}function Le(I,ie){I.pending_buf[I.pending++]=ie>>>8&255,I.pending_buf[I.pending++]=255&ie}function je(I,ie){var j,Z,K=I.max_chain_length,ae=I.strstart,Ce=I.prev_length,D=I.nice_match,N=I.strstart>I.w_size-V?I.strstart-(I.w_size-V):0,me=I.window,Se=I.w_mask,Te=I.prev,Ne=I.strstart+L,Ge=me[ae+Ce-1],rt=me[ae+Ce];I.prev_length>=I.good_match&&(K>>=2),D>I.lookahead&&(D=I.lookahead);do if(me[(j=ie)+Ce]===rt&&me[j+Ce-1]===Ge&&me[j]===me[ae]&&me[++j]===me[ae+1]){ae+=2,j++;do;while(me[++ae]===me[++j]&&me[++ae]===me[++j]&&me[++ae]===me[++j]&&me[++ae]===me[++j]&&me[++ae]===me[++j]&&me[++ae]===me[++j]&&me[++ae]===me[++j]&&me[++ae]===me[++j]&&ae<Ne);if(Z=L-(Ne-ae),ae=Ne-L,Ce<Z){if(I.match_start=ie,D<=(Ce=Z))break;Ge=me[ae+Ce-1],rt=me[ae+Ce]}}while((ie=Te[ie&Se])>N&&--K!=0);return Ce<=I.lookahead?Ce:I.lookahead}function nt(I){var ie,j,Z,K,ae,Ce,D,N,me,Se,Te=I.w_size;do{if(K=I.window_size-I.lookahead-I.strstart,I.strstart>=Te+(Te-V)){for(s.arraySet(I.window,I.window,Te,Te,0),I.match_start-=Te,I.strstart-=Te,I.block_start-=Te,ie=j=I.hash_size;Z=I.head[--ie],I.head[ie]=Te<=Z?Z-Te:0,--j;);for(ie=j=Te;Z=I.prev[--ie],I.prev[ie]=Te<=Z?Z-Te:0,--j;);K+=Te}if(I.strm.avail_in===0)break;if(Ce=I.strm,D=I.window,N=I.strstart+I.lookahead,me=K,Se=void 0,Se=Ce.avail_in,me<Se&&(Se=me),j=Se===0?0:(Ce.avail_in-=Se,s.arraySet(D,Ce.input,Ce.next_in,Se,N),Ce.state.wrap===1?Ce.adler=l(Ce.adler,D,Se,N):Ce.state.wrap===2&&(Ce.adler=u(Ce.adler,D,Se,N)),Ce.next_in+=Se,Ce.total_in+=Se,Se),I.lookahead+=j,I.lookahead+I.insert>=B)for(ae=I.strstart-I.insert,I.ins_h=I.window[ae],I.ins_h=(I.ins_h<<I.hash_shift^I.window[ae+1])&I.hash_mask;I.insert&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[ae+B-1])&I.hash_mask,I.prev[ae&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=ae,ae++,I.insert--,!(I.lookahead+I.insert<B)););}while(I.lookahead<V&&I.strm.avail_in!==0)}function ut(I,ie){for(var j,Z;;){if(I.lookahead<V){if(nt(I),I.lookahead<V&&ie===f)return R;if(I.lookahead===0)break}if(j=0,I.lookahead>=B&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+B-1])&I.hash_mask,j=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),j!==0&&I.strstart-j<=I.w_size-V&&(I.match_length=je(I,j)),I.match_length>=B)if(Z=a._tr_tally(I,I.strstart-I.match_start,I.match_length-B),I.lookahead-=I.match_length,I.match_length<=I.max_lazy_match&&I.lookahead>=B){for(I.match_length--;I.strstart++,I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+B-1])&I.hash_mask,j=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart,--I.match_length!=0;);I.strstart++}else I.strstart+=I.match_length,I.match_length=0,I.ins_h=I.window[I.strstart],I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+1])&I.hash_mask;else Z=a._tr_tally(I,0,I.window[I.strstart]),I.lookahead--,I.strstart++;if(Z&&(ye(I,!1),I.strm.avail_out===0))return R}return I.insert=I.strstart<B-1?I.strstart:B-1,ie===p?(ye(I,!0),I.strm.avail_out===0?G:ee):I.last_lit&&(ye(I,!1),I.strm.avail_out===0)?R:H}function ft(I,ie){for(var j,Z,K;;){if(I.lookahead<V){if(nt(I),I.lookahead<V&&ie===f)return R;if(I.lookahead===0)break}if(j=0,I.lookahead>=B&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+B-1])&I.hash_mask,j=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),I.prev_length=I.match_length,I.prev_match=I.match_start,I.match_length=B-1,j!==0&&I.prev_length<I.max_lazy_match&&I.strstart-j<=I.w_size-V&&(I.match_length=je(I,j),I.match_length<=5&&(I.strategy===1||I.match_length===B&&4096<I.strstart-I.match_start)&&(I.match_length=B-1)),I.prev_length>=B&&I.match_length<=I.prev_length){for(K=I.strstart+I.lookahead-B,Z=a._tr_tally(I,I.strstart-1-I.prev_match,I.prev_length-B),I.lookahead-=I.prev_length-1,I.prev_length-=2;++I.strstart<=K&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+B-1])&I.hash_mask,j=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),--I.prev_length!=0;);if(I.match_available=0,I.match_length=B-1,I.strstart++,Z&&(ye(I,!1),I.strm.avail_out===0))return R}else if(I.match_available){if((Z=a._tr_tally(I,0,I.window[I.strstart-1]))&&ye(I,!1),I.strstart++,I.lookahead--,I.strm.avail_out===0)return R}else I.match_available=1,I.strstart++,I.lookahead--}return I.match_available&&(Z=a._tr_tally(I,0,I.window[I.strstart-1]),I.match_available=0),I.insert=I.strstart<B-1?I.strstart:B-1,ie===p?(ye(I,!0),I.strm.avail_out===0?G:ee):I.last_lit&&(ye(I,!1),I.strm.avail_out===0)?R:H}function At(I,ie,j,Z,K){this.good_length=I,this.max_lazy=ie,this.nice_length=j,this.max_chain=Z,this.func=K}function Re(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=S,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*z),this.dyn_dtree=new s.Buf16(2*(2*x+1)),this.bl_tree=new s.Buf16(2*(2*M+1)),xe(this.dyn_ltree),xe(this.dyn_dtree),xe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(q+1),this.heap=new s.Buf16(2*k+1),xe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*k+1),xe(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function se(I){var ie;return I&&I.state?(I.total_in=I.total_out=0,I.data_type=w,(ie=I.state).pending=0,ie.pending_out=0,ie.wrap<0&&(ie.wrap=-ie.wrap),ie.status=ie.wrap?T:$,I.adler=ie.wrap===2?0:1,ie.last_flush=f,a._tr_init(ie),g):J(I,m)}function be(I){var ie=se(I);return ie===g&&(function(j){j.window_size=2*j.w_size,xe(j.head),j.max_lazy_match=i[j.level].max_lazy,j.good_match=i[j.level].good_length,j.nice_match=i[j.level].nice_length,j.max_chain_length=i[j.level].max_chain,j.strstart=0,j.block_start=0,j.lookahead=0,j.insert=0,j.match_length=j.prev_length=B-1,j.match_available=0,j.ins_h=0})(I.state),ie}function Q(I,ie,j,Z,K,ae){if(!I)return m;var Ce=1;if(ie===v&&(ie=6),Z<0?(Ce=0,Z=-Z):15<Z&&(Ce=2,Z-=16),K<1||y<K||j!==S||Z<8||15<Z||ie<0||9<ie||ae<0||C<ae)return J(I,m);Z===8&&(Z=9);var D=new Re;return(I.state=D).strm=I,D.wrap=Ce,D.gzhead=null,D.w_bits=Z,D.w_size=1<<D.w_bits,D.w_mask=D.w_size-1,D.hash_bits=K+7,D.hash_size=1<<D.hash_bits,D.hash_mask=D.hash_size-1,D.hash_shift=~~((D.hash_bits+B-1)/B),D.window=new s.Buf8(2*D.w_size),D.head=new s.Buf16(D.hash_size),D.prev=new s.Buf16(D.w_size),D.lit_bufsize=1<<K+6,D.pending_buf_size=4*D.lit_bufsize,D.pending_buf=new s.Buf8(D.pending_buf_size),D.d_buf=1*D.lit_bufsize,D.l_buf=3*D.lit_bufsize,D.level=ie,D.strategy=ae,D.method=j,be(I)}i=[new At(0,0,0,0,function(I,ie){var j=65535;for(j>I.pending_buf_size-5&&(j=I.pending_buf_size-5);;){if(I.lookahead<=1){if(nt(I),I.lookahead===0&&ie===f)return R;if(I.lookahead===0)break}I.strstart+=I.lookahead,I.lookahead=0;var Z=I.block_start+j;if((I.strstart===0||I.strstart>=Z)&&(I.lookahead=I.strstart-Z,I.strstart=Z,ye(I,!1),I.strm.avail_out===0)||I.strstart-I.block_start>=I.w_size-V&&(ye(I,!1),I.strm.avail_out===0))return R}return I.insert=0,ie===p?(ye(I,!0),I.strm.avail_out===0?G:ee):(I.strstart>I.block_start&&(ye(I,!1),I.strm.avail_out),R)}),new At(4,4,8,4,ut),new At(4,5,16,8,ut),new At(4,6,32,32,ut),new At(4,4,16,16,ft),new At(8,16,32,32,ft),new At(8,16,128,128,ft),new At(8,32,128,256,ft),new At(32,128,258,1024,ft),new At(32,258,258,4096,ft)],o.deflateInit=function(I,ie){return Q(I,ie,S,15,8,0)},o.deflateInit2=Q,o.deflateReset=be,o.deflateResetKeep=se,o.deflateSetHeader=function(I,ie){return I&&I.state?I.state.wrap!==2?m:(I.state.gzhead=ie,g):m},o.deflate=function(I,ie){var j,Z,K,ae;if(!I||!I.state||5<ie||ie<0)return I?J(I,m):m;if(Z=I.state,!I.output||!I.input&&I.avail_in!==0||Z.status===666&&ie!==p)return J(I,I.avail_out===0?-5:m);if(Z.strm=I,j=Z.last_flush,Z.last_flush=ie,Z.status===T)if(Z.wrap===2)I.adler=0,ve(Z,31),ve(Z,139),ve(Z,8),Z.gzhead?(ve(Z,(Z.gzhead.text?1:0)+(Z.gzhead.hcrc?2:0)+(Z.gzhead.extra?4:0)+(Z.gzhead.name?8:0)+(Z.gzhead.comment?16:0)),ve(Z,255&Z.gzhead.time),ve(Z,Z.gzhead.time>>8&255),ve(Z,Z.gzhead.time>>16&255),ve(Z,Z.gzhead.time>>24&255),ve(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),ve(Z,255&Z.gzhead.os),Z.gzhead.extra&&Z.gzhead.extra.length&&(ve(Z,255&Z.gzhead.extra.length),ve(Z,Z.gzhead.extra.length>>8&255)),Z.gzhead.hcrc&&(I.adler=u(I.adler,Z.pending_buf,Z.pending,0)),Z.gzindex=0,Z.status=69):(ve(Z,0),ve(Z,0),ve(Z,0),ve(Z,0),ve(Z,0),ve(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),ve(Z,3),Z.status=$);else{var Ce=S+(Z.w_bits-8<<4)<<8;Ce|=(2<=Z.strategy||Z.level<2?0:Z.level<6?1:Z.level===6?2:3)<<6,Z.strstart!==0&&(Ce|=32),Ce+=31-Ce%31,Z.status=$,Le(Z,Ce),Z.strstart!==0&&(Le(Z,I.adler>>>16),Le(Z,65535&I.adler)),I.adler=1}if(Z.status===69)if(Z.gzhead.extra){for(K=Z.pending;Z.gzindex<(65535&Z.gzhead.extra.length)&&(Z.pending!==Z.pending_buf_size||(Z.gzhead.hcrc&&Z.pending>K&&(I.adler=u(I.adler,Z.pending_buf,Z.pending-K,K)),fe(I),K=Z.pending,Z.pending!==Z.pending_buf_size));)ve(Z,255&Z.gzhead.extra[Z.gzindex]),Z.gzindex++;Z.gzhead.hcrc&&Z.pending>K&&(I.adler=u(I.adler,Z.pending_buf,Z.pending-K,K)),Z.gzindex===Z.gzhead.extra.length&&(Z.gzindex=0,Z.status=73)}else Z.status=73;if(Z.status===73)if(Z.gzhead.name){K=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>K&&(I.adler=u(I.adler,Z.pending_buf,Z.pending-K,K)),fe(I),K=Z.pending,Z.pending===Z.pending_buf_size)){ae=1;break}ae=Z.gzindex<Z.gzhead.name.length?255&Z.gzhead.name.charCodeAt(Z.gzindex++):0,ve(Z,ae)}while(ae!==0);Z.gzhead.hcrc&&Z.pending>K&&(I.adler=u(I.adler,Z.pending_buf,Z.pending-K,K)),ae===0&&(Z.gzindex=0,Z.status=91)}else Z.status=91;if(Z.status===91)if(Z.gzhead.comment){K=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>K&&(I.adler=u(I.adler,Z.pending_buf,Z.pending-K,K)),fe(I),K=Z.pending,Z.pending===Z.pending_buf_size)){ae=1;break}ae=Z.gzindex<Z.gzhead.comment.length?255&Z.gzhead.comment.charCodeAt(Z.gzindex++):0,ve(Z,ae)}while(ae!==0);Z.gzhead.hcrc&&Z.pending>K&&(I.adler=u(I.adler,Z.pending_buf,Z.pending-K,K)),ae===0&&(Z.status=103)}else Z.status=103;if(Z.status===103&&(Z.gzhead.hcrc?(Z.pending+2>Z.pending_buf_size&&fe(I),Z.pending+2<=Z.pending_buf_size&&(ve(Z,255&I.adler),ve(Z,I.adler>>8&255),I.adler=0,Z.status=$)):Z.status=$),Z.pending!==0){if(fe(I),I.avail_out===0)return Z.last_flush=-1,g}else if(I.avail_in===0&&X(ie)<=X(j)&&ie!==p)return J(I,-5);if(Z.status===666&&I.avail_in!==0)return J(I,-5);if(I.avail_in!==0||Z.lookahead!==0||ie!==f&&Z.status!==666){var D=Z.strategy===2?(function(N,me){for(var Se;;){if(N.lookahead===0&&(nt(N),N.lookahead===0)){if(me===f)return R;break}if(N.match_length=0,Se=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++,Se&&(ye(N,!1),N.strm.avail_out===0))return R}return N.insert=0,me===p?(ye(N,!0),N.strm.avail_out===0?G:ee):N.last_lit&&(ye(N,!1),N.strm.avail_out===0)?R:H})(Z,ie):Z.strategy===3?(function(N,me){for(var Se,Te,Ne,Ge,rt=N.window;;){if(N.lookahead<=L){if(nt(N),N.lookahead<=L&&me===f)return R;if(N.lookahead===0)break}if(N.match_length=0,N.lookahead>=B&&0<N.strstart&&(Te=rt[Ne=N.strstart-1])===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]){Ge=N.strstart+L;do;while(Te===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]&&Te===rt[++Ne]&&Ne<Ge);N.match_length=L-(Ge-Ne),N.match_length>N.lookahead&&(N.match_length=N.lookahead)}if(N.match_length>=B?(Se=a._tr_tally(N,1,N.match_length-B),N.lookahead-=N.match_length,N.strstart+=N.match_length,N.match_length=0):(Se=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++),Se&&(ye(N,!1),N.strm.avail_out===0))return R}return N.insert=0,me===p?(ye(N,!0),N.strm.avail_out===0?G:ee):N.last_lit&&(ye(N,!1),N.strm.avail_out===0)?R:H})(Z,ie):i[Z.level].func(Z,ie);if(D!==G&&D!==ee||(Z.status=666),D===R||D===G)return I.avail_out===0&&(Z.last_flush=-1),g;if(D===H&&(ie===1?a._tr_align(Z):ie!==5&&(a._tr_stored_block(Z,0,0,!1),ie===3&&(xe(Z.head),Z.lookahead===0&&(Z.strstart=0,Z.block_start=0,Z.insert=0))),fe(I),I.avail_out===0))return Z.last_flush=-1,g}return ie!==p?g:Z.wrap<=0?1:(Z.wrap===2?(ve(Z,255&I.adler),ve(Z,I.adler>>8&255),ve(Z,I.adler>>16&255),ve(Z,I.adler>>24&255),ve(Z,255&I.total_in),ve(Z,I.total_in>>8&255),ve(Z,I.total_in>>16&255),ve(Z,I.total_in>>24&255)):(Le(Z,I.adler>>>16),Le(Z,65535&I.adler)),fe(I),0<Z.wrap&&(Z.wrap=-Z.wrap),Z.pending!==0?g:1)},o.deflateEnd=function(I){var ie;return I&&I.state?(ie=I.state.status)!==T&&ie!==69&&ie!==73&&ie!==91&&ie!==103&&ie!==$&&ie!==666?J(I,m):(I.state=null,ie===$?J(I,-3):g):m},o.deflateSetDictionary=function(I,ie){var j,Z,K,ae,Ce,D,N,me,Se=ie.length;if(!I||!I.state||(ae=(j=I.state).wrap)===2||ae===1&&j.status!==T||j.lookahead)return m;for(ae===1&&(I.adler=l(I.adler,ie,Se,0)),j.wrap=0,Se>=j.w_size&&(ae===0&&(xe(j.head),j.strstart=0,j.block_start=0,j.insert=0),me=new s.Buf8(j.w_size),s.arraySet(me,ie,Se-j.w_size,j.w_size,0),ie=me,Se=j.w_size),Ce=I.avail_in,D=I.next_in,N=I.input,I.avail_in=Se,I.next_in=0,I.input=ie,nt(j);j.lookahead>=B;){for(Z=j.strstart,K=j.lookahead-(B-1);j.ins_h=(j.ins_h<<j.hash_shift^j.window[Z+B-1])&j.hash_mask,j.prev[Z&j.w_mask]=j.head[j.ins_h],j.head[j.ins_h]=Z,Z++,--K;);j.strstart=Z,j.lookahead=B-1,nt(j)}return j.strstart+=j.lookahead,j.block_start=j.strstart,j.insert=j.lookahead,j.lookahead=0,j.match_length=j.prev_length=B-1,j.match_available=0,I.next_in=D,I.input=N,I.avail_in=Ce,j.wrap=ae,g},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){"use strict";r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){"use strict";r.exports=function(i,s){var a=i.state,l=i.next_in,u,d,f,p,g,m,v,C,w,S,y,k,x,M,z,q,B,L,V,T,$,R=i.input,H;u=l+(i.avail_in-5),d=i.next_out,H=i.output,f=d-(s-i.avail_out),p=d+(i.avail_out-257),g=a.dmax,m=a.wsize,v=a.whave,C=a.wnext,w=a.window,S=a.hold,y=a.bits,k=a.lencode,x=a.distcode,M=(1<<a.lenbits)-1,z=(1<<a.distbits)-1;e:do{y<15&&(S+=R[l++]<<y,y+=8,S+=R[l++]<<y,y+=8),q=k[S&M];t:for(;;){if(S>>>=B=q>>>24,y-=B,(B=q>>>16&255)===0)H[d++]=65535&q;else{if(!(16&B)){if((64&B)==0){q=k[(65535&q)+(S&(1<<B)-1)];continue t}if(32&B){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}L=65535&q,(B&=15)&&(y<B&&(S+=R[l++]<<y,y+=8),L+=S&(1<<B)-1,S>>>=B,y-=B),y<15&&(S+=R[l++]<<y,y+=8,S+=R[l++]<<y,y+=8),q=x[S&z];n:for(;;){if(S>>>=B=q>>>24,y-=B,!(16&(B=q>>>16&255))){if((64&B)==0){q=x[(65535&q)+(S&(1<<B)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(V=65535&q,y<(B&=15)&&(S+=R[l++]<<y,(y+=8)<B&&(S+=R[l++]<<y,y+=8)),g<(V+=S&(1<<B)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(S>>>=B,y-=B,(B=d-f)<V){if(v<(B=V-B)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if($=w,(T=0)===C){if(T+=m-B,B<L){for(L-=B;H[d++]=w[T++],--B;);T=d-V,$=H}}else if(C<B){if(T+=m+C-B,(B-=C)<L){for(L-=B;H[d++]=w[T++],--B;);if(T=0,C<L){for(L-=B=C;H[d++]=w[T++],--B;);T=d-V,$=H}}}else if(T+=C-B,B<L){for(L-=B;H[d++]=w[T++],--B;);T=d-V,$=H}for(;2<L;)H[d++]=$[T++],H[d++]=$[T++],H[d++]=$[T++],L-=3;L&&(H[d++]=$[T++],1<L&&(H[d++]=$[T++]))}else{for(T=d-V;H[d++]=H[T++],H[d++]=H[T++],H[d++]=H[T++],2<(L-=3););L&&(H[d++]=H[T++],1<L&&(H[d++]=H[T++]))}break}}break}}while(l<u&&d<p);l-=L=y>>3,S&=(1<<(y-=L<<3))-1,i.next_in=l,i.next_out=d,i.avail_in=l<u?u-l+5:5-(l-u),i.avail_out=d<p?p-d+257:257-(d-p),a.hold=S,a.bits=y}},{}],49:[function(n,r,o){"use strict";var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),u=n("./inftrees"),d=1,f=2,p=0,g=-2,m=1,v=852,C=592;function w(T){return(T>>>24&255)+(T>>>8&65280)+((65280&T)<<8)+((255&T)<<24)}function S(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function y(T){var $;return T&&T.state?($=T.state,T.total_in=T.total_out=$.total=0,T.msg="",$.wrap&&(T.adler=1&$.wrap),$.mode=m,$.last=0,$.havedict=0,$.dmax=32768,$.head=null,$.hold=0,$.bits=0,$.lencode=$.lendyn=new i.Buf32(v),$.distcode=$.distdyn=new i.Buf32(C),$.sane=1,$.back=-1,p):g}function k(T){var $;return T&&T.state?(($=T.state).wsize=0,$.whave=0,$.wnext=0,y(T)):g}function x(T,$){var R,H;return T&&T.state?(H=T.state,$<0?(R=0,$=-$):(R=1+($>>4),$<48&&($&=15)),$&&($<8||15<$)?g:(H.window!==null&&H.wbits!==$&&(H.window=null),H.wrap=R,H.wbits=$,k(T))):g}function M(T,$){var R,H;return T?(H=new S,(T.state=H).window=null,(R=x(T,$))!==p&&(T.state=null),R):g}var z,q,B=!0;function L(T){if(B){var $;for(z=new i.Buf32(512),q=new i.Buf32(32),$=0;$<144;)T.lens[$++]=8;for(;$<256;)T.lens[$++]=9;for(;$<280;)T.lens[$++]=7;for(;$<288;)T.lens[$++]=8;for(u(d,T.lens,0,288,z,0,T.work,{bits:9}),$=0;$<32;)T.lens[$++]=5;u(f,T.lens,0,32,q,0,T.work,{bits:5}),B=!1}T.lencode=z,T.lenbits=9,T.distcode=q,T.distbits=5}function V(T,$,R,H){var G,ee=T.state;return ee.window===null&&(ee.wsize=1<<ee.wbits,ee.wnext=0,ee.whave=0,ee.window=new i.Buf8(ee.wsize)),H>=ee.wsize?(i.arraySet(ee.window,$,R-ee.wsize,ee.wsize,0),ee.wnext=0,ee.whave=ee.wsize):(H<(G=ee.wsize-ee.wnext)&&(G=H),i.arraySet(ee.window,$,R-H,G,ee.wnext),(H-=G)?(i.arraySet(ee.window,$,R-H,H,0),ee.wnext=H,ee.whave=ee.wsize):(ee.wnext+=G,ee.wnext===ee.wsize&&(ee.wnext=0),ee.whave<ee.wsize&&(ee.whave+=G))),0}o.inflateReset=k,o.inflateReset2=x,o.inflateResetKeep=y,o.inflateInit=function(T){return M(T,15)},o.inflateInit2=M,o.inflate=function(T,$){var R,H,G,ee,J,X,xe,fe,ye,ve,Le,je,nt,ut,ft,At,Re,se,be,Q,I,ie,j,Z,K=0,ae=new i.Buf8(4),Ce=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!T||!T.state||!T.output||!T.input&&T.avail_in!==0)return g;(R=T.state).mode===12&&(R.mode=13),J=T.next_out,G=T.output,xe=T.avail_out,ee=T.next_in,H=T.input,X=T.avail_in,fe=R.hold,ye=R.bits,ve=X,Le=xe,ie=p;e:for(;;)switch(R.mode){case m:if(R.wrap===0){R.mode=13;break}for(;ye<16;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(2&R.wrap&&fe===35615){ae[R.check=0]=255&fe,ae[1]=fe>>>8&255,R.check=a(R.check,ae,2,0),ye=fe=0,R.mode=2;break}if(R.flags=0,R.head&&(R.head.done=!1),!(1&R.wrap)||(((255&fe)<<8)+(fe>>8))%31){T.msg="incorrect header check",R.mode=30;break}if((15&fe)!=8){T.msg="unknown compression method",R.mode=30;break}if(ye-=4,I=8+(15&(fe>>>=4)),R.wbits===0)R.wbits=I;else if(I>R.wbits){T.msg="invalid window size",R.mode=30;break}R.dmax=1<<I,T.adler=R.check=1,R.mode=512&fe?10:12,ye=fe=0;break;case 2:for(;ye<16;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(R.flags=fe,(255&R.flags)!=8){T.msg="unknown compression method",R.mode=30;break}if(57344&R.flags){T.msg="unknown header flags set",R.mode=30;break}R.head&&(R.head.text=fe>>8&1),512&R.flags&&(ae[0]=255&fe,ae[1]=fe>>>8&255,R.check=a(R.check,ae,2,0)),ye=fe=0,R.mode=3;case 3:for(;ye<32;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}R.head&&(R.head.time=fe),512&R.flags&&(ae[0]=255&fe,ae[1]=fe>>>8&255,ae[2]=fe>>>16&255,ae[3]=fe>>>24&255,R.check=a(R.check,ae,4,0)),ye=fe=0,R.mode=4;case 4:for(;ye<16;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}R.head&&(R.head.xflags=255&fe,R.head.os=fe>>8),512&R.flags&&(ae[0]=255&fe,ae[1]=fe>>>8&255,R.check=a(R.check,ae,2,0)),ye=fe=0,R.mode=5;case 5:if(1024&R.flags){for(;ye<16;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}R.length=fe,R.head&&(R.head.extra_len=fe),512&R.flags&&(ae[0]=255&fe,ae[1]=fe>>>8&255,R.check=a(R.check,ae,2,0)),ye=fe=0}else R.head&&(R.head.extra=null);R.mode=6;case 6:if(1024&R.flags&&(X<(je=R.length)&&(je=X),je&&(R.head&&(I=R.head.extra_len-R.length,R.head.extra||(R.head.extra=new Array(R.head.extra_len)),i.arraySet(R.head.extra,H,ee,je,I)),512&R.flags&&(R.check=a(R.check,H,je,ee)),X-=je,ee+=je,R.length-=je),R.length))break e;R.length=0,R.mode=7;case 7:if(2048&R.flags){if(X===0)break e;for(je=0;I=H[ee+je++],R.head&&I&&R.length<65536&&(R.head.name+=String.fromCharCode(I)),I&&je<X;);if(512&R.flags&&(R.check=a(R.check,H,je,ee)),X-=je,ee+=je,I)break e}else R.head&&(R.head.name=null);R.length=0,R.mode=8;case 8:if(4096&R.flags){if(X===0)break e;for(je=0;I=H[ee+je++],R.head&&I&&R.length<65536&&(R.head.comment+=String.fromCharCode(I)),I&&je<X;);if(512&R.flags&&(R.check=a(R.check,H,je,ee)),X-=je,ee+=je,I)break e}else R.head&&(R.head.comment=null);R.mode=9;case 9:if(512&R.flags){for(;ye<16;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(fe!==(65535&R.check)){T.msg="header crc mismatch",R.mode=30;break}ye=fe=0}R.head&&(R.head.hcrc=R.flags>>9&1,R.head.done=!0),T.adler=R.check=0,R.mode=12;break;case 10:for(;ye<32;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}T.adler=R.check=w(fe),ye=fe=0,R.mode=11;case 11:if(R.havedict===0)return T.next_out=J,T.avail_out=xe,T.next_in=ee,T.avail_in=X,R.hold=fe,R.bits=ye,2;T.adler=R.check=1,R.mode=12;case 12:if($===5||$===6)break e;case 13:if(R.last){fe>>>=7&ye,ye-=7&ye,R.mode=27;break}for(;ye<3;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}switch(R.last=1&fe,ye-=1,3&(fe>>>=1)){case 0:R.mode=14;break;case 1:if(L(R),R.mode=20,$!==6)break;fe>>>=2,ye-=2;break e;case 2:R.mode=17;break;case 3:T.msg="invalid block type",R.mode=30}fe>>>=2,ye-=2;break;case 14:for(fe>>>=7&ye,ye-=7&ye;ye<32;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if((65535&fe)!=(fe>>>16^65535)){T.msg="invalid stored block lengths",R.mode=30;break}if(R.length=65535&fe,ye=fe=0,R.mode=15,$===6)break e;case 15:R.mode=16;case 16:if(je=R.length){if(X<je&&(je=X),xe<je&&(je=xe),je===0)break e;i.arraySet(G,H,ee,je,J),X-=je,ee+=je,xe-=je,J+=je,R.length-=je;break}R.mode=12;break;case 17:for(;ye<14;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(R.nlen=257+(31&fe),fe>>>=5,ye-=5,R.ndist=1+(31&fe),fe>>>=5,ye-=5,R.ncode=4+(15&fe),fe>>>=4,ye-=4,286<R.nlen||30<R.ndist){T.msg="too many length or distance symbols",R.mode=30;break}R.have=0,R.mode=18;case 18:for(;R.have<R.ncode;){for(;ye<3;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}R.lens[Ce[R.have++]]=7&fe,fe>>>=3,ye-=3}for(;R.have<19;)R.lens[Ce[R.have++]]=0;if(R.lencode=R.lendyn,R.lenbits=7,j={bits:R.lenbits},ie=u(0,R.lens,0,19,R.lencode,0,R.work,j),R.lenbits=j.bits,ie){T.msg="invalid code lengths set",R.mode=30;break}R.have=0,R.mode=19;case 19:for(;R.have<R.nlen+R.ndist;){for(;At=(K=R.lencode[fe&(1<<R.lenbits)-1])>>>16&255,Re=65535&K,!((ft=K>>>24)<=ye);){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(Re<16)fe>>>=ft,ye-=ft,R.lens[R.have++]=Re;else{if(Re===16){for(Z=ft+2;ye<Z;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(fe>>>=ft,ye-=ft,R.have===0){T.msg="invalid bit length repeat",R.mode=30;break}I=R.lens[R.have-1],je=3+(3&fe),fe>>>=2,ye-=2}else if(Re===17){for(Z=ft+3;ye<Z;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}ye-=ft,I=0,je=3+(7&(fe>>>=ft)),fe>>>=3,ye-=3}else{for(Z=ft+7;ye<Z;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}ye-=ft,I=0,je=11+(127&(fe>>>=ft)),fe>>>=7,ye-=7}if(R.have+je>R.nlen+R.ndist){T.msg="invalid bit length repeat",R.mode=30;break}for(;je--;)R.lens[R.have++]=I}}if(R.mode===30)break;if(R.lens[256]===0){T.msg="invalid code -- missing end-of-block",R.mode=30;break}if(R.lenbits=9,j={bits:R.lenbits},ie=u(d,R.lens,0,R.nlen,R.lencode,0,R.work,j),R.lenbits=j.bits,ie){T.msg="invalid literal/lengths set",R.mode=30;break}if(R.distbits=6,R.distcode=R.distdyn,j={bits:R.distbits},ie=u(f,R.lens,R.nlen,R.ndist,R.distcode,0,R.work,j),R.distbits=j.bits,ie){T.msg="invalid distances set",R.mode=30;break}if(R.mode=20,$===6)break e;case 20:R.mode=21;case 21:if(6<=X&&258<=xe){T.next_out=J,T.avail_out=xe,T.next_in=ee,T.avail_in=X,R.hold=fe,R.bits=ye,l(T,Le),J=T.next_out,G=T.output,xe=T.avail_out,ee=T.next_in,H=T.input,X=T.avail_in,fe=R.hold,ye=R.bits,R.mode===12&&(R.back=-1);break}for(R.back=0;At=(K=R.lencode[fe&(1<<R.lenbits)-1])>>>16&255,Re=65535&K,!((ft=K>>>24)<=ye);){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(At&&(240&At)==0){for(se=ft,be=At,Q=Re;At=(K=R.lencode[Q+((fe&(1<<se+be)-1)>>se)])>>>16&255,Re=65535&K,!(se+(ft=K>>>24)<=ye);){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}fe>>>=se,ye-=se,R.back+=se}if(fe>>>=ft,ye-=ft,R.back+=ft,R.length=Re,At===0){R.mode=26;break}if(32&At){R.back=-1,R.mode=12;break}if(64&At){T.msg="invalid literal/length code",R.mode=30;break}R.extra=15&At,R.mode=22;case 22:if(R.extra){for(Z=R.extra;ye<Z;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}R.length+=fe&(1<<R.extra)-1,fe>>>=R.extra,ye-=R.extra,R.back+=R.extra}R.was=R.length,R.mode=23;case 23:for(;At=(K=R.distcode[fe&(1<<R.distbits)-1])>>>16&255,Re=65535&K,!((ft=K>>>24)<=ye);){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if((240&At)==0){for(se=ft,be=At,Q=Re;At=(K=R.distcode[Q+((fe&(1<<se+be)-1)>>se)])>>>16&255,Re=65535&K,!(se+(ft=K>>>24)<=ye);){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}fe>>>=se,ye-=se,R.back+=se}if(fe>>>=ft,ye-=ft,R.back+=ft,64&At){T.msg="invalid distance code",R.mode=30;break}R.offset=Re,R.extra=15&At,R.mode=24;case 24:if(R.extra){for(Z=R.extra;ye<Z;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}R.offset+=fe&(1<<R.extra)-1,fe>>>=R.extra,ye-=R.extra,R.back+=R.extra}if(R.offset>R.dmax){T.msg="invalid distance too far back",R.mode=30;break}R.mode=25;case 25:if(xe===0)break e;if(je=Le-xe,R.offset>je){if((je=R.offset-je)>R.whave&&R.sane){T.msg="invalid distance too far back",R.mode=30;break}nt=je>R.wnext?(je-=R.wnext,R.wsize-je):R.wnext-je,je>R.length&&(je=R.length),ut=R.window}else ut=G,nt=J-R.offset,je=R.length;for(xe<je&&(je=xe),xe-=je,R.length-=je;G[J++]=ut[nt++],--je;);R.length===0&&(R.mode=21);break;case 26:if(xe===0)break e;G[J++]=R.length,xe--,R.mode=21;break;case 27:if(R.wrap){for(;ye<32;){if(X===0)break e;X--,fe|=H[ee++]<<ye,ye+=8}if(Le-=xe,T.total_out+=Le,R.total+=Le,Le&&(T.adler=R.check=R.flags?a(R.check,G,Le,J-Le):s(R.check,G,Le,J-Le)),Le=xe,(R.flags?fe:w(fe))!==R.check){T.msg="incorrect data check",R.mode=30;break}ye=fe=0}R.mode=28;case 28:if(R.wrap&&R.flags){for(;ye<32;){if(X===0)break e;X--,fe+=H[ee++]<<ye,ye+=8}if(fe!==(4294967295&R.total)){T.msg="incorrect length check",R.mode=30;break}ye=fe=0}R.mode=29;case 29:ie=1;break e;case 30:ie=-3;break e;case 31:return-4;default:return g}return T.next_out=J,T.avail_out=xe,T.next_in=ee,T.avail_in=X,R.hold=fe,R.bits=ye,(R.wsize||Le!==T.avail_out&&R.mode<30&&(R.mode<27||$!==4))&&V(T,T.output,T.next_out,Le-T.avail_out)?(R.mode=31,-4):(ve-=T.avail_in,Le-=T.avail_out,T.total_in+=ve,T.total_out+=Le,R.total+=Le,R.wrap&&Le&&(T.adler=R.check=R.flags?a(R.check,G,Le,T.next_out-Le):s(R.check,G,Le,T.next_out-Le)),T.data_type=R.bits+(R.last?64:0)+(R.mode===12?128:0)+(R.mode===20||R.mode===15?256:0),(ve==0&&Le===0||$===4)&&ie===p&&(ie=-5),ie)},o.inflateEnd=function(T){if(!T||!T.state)return g;var $=T.state;return $.window&&($.window=null),T.state=null,p},o.inflateGetHeader=function(T,$){var R;return T&&T.state?(2&(R=T.state).wrap)==0?g:((R.head=$).done=!1,p):g},o.inflateSetDictionary=function(T,$){var R,H=$.length;return T&&T.state?(R=T.state).wrap!==0&&R.mode!==11?g:R.mode===11&&s(1,$,H,0)!==R.check?-3:V(T,$,H,H)?(R.mode=31,-4):(R.havedict=1,p):g},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){"use strict";var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,p,g,m,v,C,w){var S,y,k,x,M,z,q,B,L,V=w.bits,T=0,$=0,R=0,H=0,G=0,ee=0,J=0,X=0,xe=0,fe=0,ye=null,ve=0,Le=new i.Buf16(16),je=new i.Buf16(16),nt=null,ut=0;for(T=0;T<=15;T++)Le[T]=0;for($=0;$<g;$++)Le[f[p+$]]++;for(G=V,H=15;1<=H&&Le[H]===0;H--);if(H<G&&(G=H),H===0)return m[v++]=20971520,m[v++]=20971520,w.bits=1,0;for(R=1;R<H&&Le[R]===0;R++);for(G<R&&(G=R),T=X=1;T<=15;T++)if(X<<=1,(X-=Le[T])<0)return-1;if(0<X&&(d===0||H!==1))return-1;for(je[1]=0,T=1;T<15;T++)je[T+1]=je[T]+Le[T];for($=0;$<g;$++)f[p+$]!==0&&(C[je[f[p+$]]++]=$);if(z=d===0?(ye=nt=C,19):d===1?(ye=s,ve-=257,nt=a,ut-=257,256):(ye=l,nt=u,-1),T=R,M=v,J=$=fe=0,k=-1,x=(xe=1<<(ee=G))-1,d===1&&852<xe||d===2&&592<xe)return 1;for(;;){for(q=T-J,L=C[$]<z?(B=0,C[$]):C[$]>z?(B=nt[ut+C[$]],ye[ve+C[$]]):(B=96,0),S=1<<T-J,R=y=1<<ee;m[M+(fe>>J)+(y-=S)]=q<<24|B<<16|L|0,y!==0;);for(S=1<<T-1;fe&S;)S>>=1;if(S!==0?(fe&=S-1,fe+=S):fe=0,$++,--Le[T]==0){if(T===H)break;T=f[p+C[$]]}if(G<T&&(fe&x)!==k){for(J===0&&(J=G),M+=R,X=1<<(ee=T-J);ee+J<H&&!((X-=Le[ee+J])<=0);)ee++,X<<=1;if(xe+=1<<ee,d===1&&852<xe||d===2&&592<xe)return 1;m[k=fe&x]=G<<24|ee<<16|M-v|0}}return fe!==0&&(m[M+fe]=T-J<<24|4194304),w.bits=G,0}},{"../utils/common":41}],51:[function(n,r,o){"use strict";r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){"use strict";var i=n("../utils/common"),s=0,a=1;function l(K){for(var ae=K.length;0<=--ae;)K[ae]=0}var u=0,d=29,f=256,p=f+1+d,g=30,m=19,v=2*p+1,C=15,w=16,S=7,y=256,k=16,x=17,M=18,z=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],q=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],B=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],V=new Array(2*(p+2));l(V);var T=new Array(2*g);l(T);var $=new Array(512);l($);var R=new Array(256);l(R);var H=new Array(d);l(H);var G,ee,J,X=new Array(g);function xe(K,ae,Ce,D,N){this.static_tree=K,this.extra_bits=ae,this.extra_base=Ce,this.elems=D,this.max_length=N,this.has_stree=K&&K.length}function fe(K,ae){this.dyn_tree=K,this.max_code=0,this.stat_desc=ae}function ye(K){return K<256?$[K]:$[256+(K>>>7)]}function ve(K,ae){K.pending_buf[K.pending++]=255&ae,K.pending_buf[K.pending++]=ae>>>8&255}function Le(K,ae,Ce){K.bi_valid>w-Ce?(K.bi_buf|=ae<<K.bi_valid&65535,ve(K,K.bi_buf),K.bi_buf=ae>>w-K.bi_valid,K.bi_valid+=Ce-w):(K.bi_buf|=ae<<K.bi_valid&65535,K.bi_valid+=Ce)}function je(K,ae,Ce){Le(K,Ce[2*ae],Ce[2*ae+1])}function nt(K,ae){for(var Ce=0;Ce|=1&K,K>>>=1,Ce<<=1,0<--ae;);return Ce>>>1}function ut(K,ae,Ce){var D,N,me=new Array(C+1),Se=0;for(D=1;D<=C;D++)me[D]=Se=Se+Ce[D-1]<<1;for(N=0;N<=ae;N++){var Te=K[2*N+1];Te!==0&&(K[2*N]=nt(me[Te]++,Te))}}function ft(K){var ae;for(ae=0;ae<p;ae++)K.dyn_ltree[2*ae]=0;for(ae=0;ae<g;ae++)K.dyn_dtree[2*ae]=0;for(ae=0;ae<m;ae++)K.bl_tree[2*ae]=0;K.dyn_ltree[2*y]=1,K.opt_len=K.static_len=0,K.last_lit=K.matches=0}function At(K){8<K.bi_valid?ve(K,K.bi_buf):0<K.bi_valid&&(K.pending_buf[K.pending++]=K.bi_buf),K.bi_buf=0,K.bi_valid=0}function Re(K,ae,Ce,D){var N=2*ae,me=2*Ce;return K[N]<K[me]||K[N]===K[me]&&D[ae]<=D[Ce]}function se(K,ae,Ce){for(var D=K.heap[Ce],N=Ce<<1;N<=K.heap_len&&(N<K.heap_len&&Re(ae,K.heap[N+1],K.heap[N],K.depth)&&N++,!Re(ae,D,K.heap[N],K.depth));)K.heap[Ce]=K.heap[N],Ce=N,N<<=1;K.heap[Ce]=D}function be(K,ae,Ce){var D,N,me,Se,Te=0;if(K.last_lit!==0)for(;D=K.pending_buf[K.d_buf+2*Te]<<8|K.pending_buf[K.d_buf+2*Te+1],N=K.pending_buf[K.l_buf+Te],Te++,D===0?je(K,N,ae):(je(K,(me=R[N])+f+1,ae),(Se=z[me])!==0&&Le(K,N-=H[me],Se),je(K,me=ye(--D),Ce),(Se=q[me])!==0&&Le(K,D-=X[me],Se)),Te<K.last_lit;);je(K,y,ae)}function Q(K,ae){var Ce,D,N,me=ae.dyn_tree,Se=ae.stat_desc.static_tree,Te=ae.stat_desc.has_stree,Ne=ae.stat_desc.elems,Ge=-1;for(K.heap_len=0,K.heap_max=v,Ce=0;Ce<Ne;Ce++)me[2*Ce]!==0?(K.heap[++K.heap_len]=Ge=Ce,K.depth[Ce]=0):me[2*Ce+1]=0;for(;K.heap_len<2;)me[2*(N=K.heap[++K.heap_len]=Ge<2?++Ge:0)]=1,K.depth[N]=0,K.opt_len--,Te&&(K.static_len-=Se[2*N+1]);for(ae.max_code=Ge,Ce=K.heap_len>>1;1<=Ce;Ce--)se(K,me,Ce);for(N=Ne;Ce=K.heap[1],K.heap[1]=K.heap[K.heap_len--],se(K,me,1),D=K.heap[1],K.heap[--K.heap_max]=Ce,K.heap[--K.heap_max]=D,me[2*N]=me[2*Ce]+me[2*D],K.depth[N]=(K.depth[Ce]>=K.depth[D]?K.depth[Ce]:K.depth[D])+1,me[2*Ce+1]=me[2*D+1]=N,K.heap[1]=N++,se(K,me,1),2<=K.heap_len;);K.heap[--K.heap_max]=K.heap[1],(function(rt,vt){var Ot,Mt,Yt,Ue,nn,Un,Xt=vt.dyn_tree,Bn=vt.max_code,Ln=vt.stat_desc.static_tree,jr=vt.stat_desc.has_stree,qr=vt.stat_desc.extra_bits,wr=vt.stat_desc.extra_base,Tn=vt.stat_desc.max_length,er=0;for(Ue=0;Ue<=C;Ue++)rt.bl_count[Ue]=0;for(Xt[2*rt.heap[rt.heap_max]+1]=0,Ot=rt.heap_max+1;Ot<v;Ot++)Tn<(Ue=Xt[2*Xt[2*(Mt=rt.heap[Ot])+1]+1]+1)&&(Ue=Tn,er++),Xt[2*Mt+1]=Ue,Bn<Mt||(rt.bl_count[Ue]++,nn=0,wr<=Mt&&(nn=qr[Mt-wr]),Un=Xt[2*Mt],rt.opt_len+=Un*(Ue+nn),jr&&(rt.static_len+=Un*(Ln[2*Mt+1]+nn)));if(er!==0){do{for(Ue=Tn-1;rt.bl_count[Ue]===0;)Ue--;rt.bl_count[Ue]--,rt.bl_count[Ue+1]+=2,rt.bl_count[Tn]--,er-=2}while(0<er);for(Ue=Tn;Ue!==0;Ue--)for(Mt=rt.bl_count[Ue];Mt!==0;)Bn<(Yt=rt.heap[--Ot])||(Xt[2*Yt+1]!==Ue&&(rt.opt_len+=(Ue-Xt[2*Yt+1])*Xt[2*Yt],Xt[2*Yt+1]=Ue),Mt--)}})(K,ae),ut(me,Ge,K.bl_count)}function I(K,ae,Ce){var D,N,me=-1,Se=ae[1],Te=0,Ne=7,Ge=4;for(Se===0&&(Ne=138,Ge=3),ae[2*(Ce+1)+1]=65535,D=0;D<=Ce;D++)N=Se,Se=ae[2*(D+1)+1],++Te<Ne&&N===Se||(Te<Ge?K.bl_tree[2*N]+=Te:N!==0?(N!==me&&K.bl_tree[2*N]++,K.bl_tree[2*k]++):Te<=10?K.bl_tree[2*x]++:K.bl_tree[2*M]++,me=N,Ge=(Te=0)===Se?(Ne=138,3):N===Se?(Ne=6,3):(Ne=7,4))}function ie(K,ae,Ce){var D,N,me=-1,Se=ae[1],Te=0,Ne=7,Ge=4;for(Se===0&&(Ne=138,Ge=3),D=0;D<=Ce;D++)if(N=Se,Se=ae[2*(D+1)+1],!(++Te<Ne&&N===Se)){if(Te<Ge)for(;je(K,N,K.bl_tree),--Te!=0;);else N!==0?(N!==me&&(je(K,N,K.bl_tree),Te--),je(K,k,K.bl_tree),Le(K,Te-3,2)):Te<=10?(je(K,x,K.bl_tree),Le(K,Te-3,3)):(je(K,M,K.bl_tree),Le(K,Te-11,7));me=N,Ge=(Te=0)===Se?(Ne=138,3):N===Se?(Ne=6,3):(Ne=7,4)}}l(X);var j=!1;function Z(K,ae,Ce,D){Le(K,(u<<1)+(D?1:0),3),(function(N,me,Se,Te){At(N),Te&&(ve(N,Se),ve(N,~Se)),i.arraySet(N.pending_buf,N.window,me,Se,N.pending),N.pending+=Se})(K,ae,Ce,!0)}o._tr_init=function(K){j||((function(){var ae,Ce,D,N,me,Se=new Array(C+1);for(N=D=0;N<d-1;N++)for(H[N]=D,ae=0;ae<1<<z[N];ae++)R[D++]=N;for(R[D-1]=N,N=me=0;N<16;N++)for(X[N]=me,ae=0;ae<1<<q[N];ae++)$[me++]=N;for(me>>=7;N<g;N++)for(X[N]=me<<7,ae=0;ae<1<<q[N]-7;ae++)$[256+me++]=N;for(Ce=0;Ce<=C;Ce++)Se[Ce]=0;for(ae=0;ae<=143;)V[2*ae+1]=8,ae++,Se[8]++;for(;ae<=255;)V[2*ae+1]=9,ae++,Se[9]++;for(;ae<=279;)V[2*ae+1]=7,ae++,Se[7]++;for(;ae<=287;)V[2*ae+1]=8,ae++,Se[8]++;for(ut(V,p+1,Se),ae=0;ae<g;ae++)T[2*ae+1]=5,T[2*ae]=nt(ae,5);G=new xe(V,z,f+1,p,C),ee=new xe(T,q,0,g,C),J=new xe(new Array(0),B,0,m,S)})(),j=!0),K.l_desc=new fe(K.dyn_ltree,G),K.d_desc=new fe(K.dyn_dtree,ee),K.bl_desc=new fe(K.bl_tree,J),K.bi_buf=0,K.bi_valid=0,ft(K)},o._tr_stored_block=Z,o._tr_flush_block=function(K,ae,Ce,D){var N,me,Se=0;0<K.level?(K.strm.data_type===2&&(K.strm.data_type=(function(Te){var Ne,Ge=4093624447;for(Ne=0;Ne<=31;Ne++,Ge>>>=1)if(1&Ge&&Te.dyn_ltree[2*Ne]!==0)return s;if(Te.dyn_ltree[18]!==0||Te.dyn_ltree[20]!==0||Te.dyn_ltree[26]!==0)return a;for(Ne=32;Ne<f;Ne++)if(Te.dyn_ltree[2*Ne]!==0)return a;return s})(K)),Q(K,K.l_desc),Q(K,K.d_desc),Se=(function(Te){var Ne;for(I(Te,Te.dyn_ltree,Te.l_desc.max_code),I(Te,Te.dyn_dtree,Te.d_desc.max_code),Q(Te,Te.bl_desc),Ne=m-1;3<=Ne&&Te.bl_tree[2*L[Ne]+1]===0;Ne--);return Te.opt_len+=3*(Ne+1)+5+5+4,Ne})(K),N=K.opt_len+3+7>>>3,(me=K.static_len+3+7>>>3)<=N&&(N=me)):N=me=Ce+5,Ce+4<=N&&ae!==-1?Z(K,ae,Ce,D):K.strategy===4||me===N?(Le(K,2+(D?1:0),3),be(K,V,T)):(Le(K,4+(D?1:0),3),(function(Te,Ne,Ge,rt){var vt;for(Le(Te,Ne-257,5),Le(Te,Ge-1,5),Le(Te,rt-4,4),vt=0;vt<rt;vt++)Le(Te,Te.bl_tree[2*L[vt]+1],3);ie(Te,Te.dyn_ltree,Ne-1),ie(Te,Te.dyn_dtree,Ge-1)})(K,K.l_desc.max_code+1,K.d_desc.max_code+1,Se+1),be(K,K.dyn_ltree,K.dyn_dtree)),ft(K),D&&At(K)},o._tr_tally=function(K,ae,Ce){return K.pending_buf[K.d_buf+2*K.last_lit]=ae>>>8&255,K.pending_buf[K.d_buf+2*K.last_lit+1]=255&ae,K.pending_buf[K.l_buf+K.last_lit]=255&Ce,K.last_lit++,ae===0?K.dyn_ltree[2*Ce]++:(K.matches++,ae--,K.dyn_ltree[2*(R[Ce]+f+1)]++,K.dyn_dtree[2*ye(ae)]++),K.last_lit===K.lit_bufsize-1},o._tr_align=function(K){Le(K,2,3),je(K,y,V),(function(ae){ae.bi_valid===16?(ve(ae,ae.bi_buf),ae.bi_buf=0,ae.bi_valid=0):8<=ae.bi_valid&&(ae.pending_buf[ae.pending++]=255&ae.bi_buf,ae.bi_buf>>=8,ae.bi_valid-=8)})(K)}},{"../utils/common":41}],53:[function(n,r,o){"use strict";r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){"use strict";if(!s.setImmediate){var l,u,d,f,p=1,g={},m=!1,v=s.document,C=Object.getPrototypeOf&&Object.getPrototypeOf(s);C=C&&C.setTimeout?C:s,l={}.toString.call(s.process)==="[object process]"?function(k){process.nextTick(function(){S(k)})}:(function(){if(s.postMessage&&!s.importScripts){var k=!0,x=s.onmessage;return s.onmessage=function(){k=!1},s.postMessage("","*"),s.onmessage=x,k}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",y,!1):s.attachEvent("onmessage",y),function(k){s.postMessage(f+k,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(k){S(k.data)},function(k){d.port2.postMessage(k)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(k){var x=v.createElement("script");x.onreadystatechange=function(){S(k),x.onreadystatechange=null,u.removeChild(x),x=null},u.appendChild(x)}):function(k){setTimeout(S,0,k)},C.setImmediate=function(k){typeof k!="function"&&(k=new Function(""+k));for(var x=new Array(arguments.length-1),M=0;M<x.length;M++)x[M]=arguments[M+1];return g[p]={callback:k,args:x},l(p),p++},C.clearImmediate=w}function w(k){delete g[k]}function S(k){if(m)setTimeout(S,0,k);else{var x=g[k];if(x){m=!0;try{(function(M){var z=M.callback,q=M.args;switch(q.length){case 0:z();break;case 1:z(q[0]);break;case 2:z(q[0],q[1]);break;case 3:z(q[0],q[1],q[2]);break;default:z.apply(a,q)}})(x)}finally{w(k),m=!1}}}}function y(k){k.source===s&&typeof k.data=="string"&&k.data.indexOf(f)===0&&S(+k.data.slice(f.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})),kr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Ra="application/pdf",Mu="text/html",d6={docx:kr,pdf:Ra,html:Mu},qp={RESOLVED:"resolved",NEW:"new",ADD:"add",UPDATE:"update",DELETED:"deleted",PENDING:"pending",SELECTED:"selected",COMMENTS_LIST:"comments-list",CHANGE_ACCEPTED:"change-accepted",CHANGE_REJECTED:"change-rejected"};Nt();var f6=b2(u6(),1),h6=e=>typeof e!="string"?"":e.trim(),ab=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Yp=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Ec=e=>{const t=e??{},n=h6(t.id),r=ab(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},Nk=({current:e,other:t})=>{const n=Ec(e),r=Ec(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},Lu=({actor:e,fallbackKey:t=""})=>{const n=Ec(e);if(n.hasId)return`id:${n.id}`;if(n.hasEmail)return`email:${n.email}`;const r=typeof t=="number"?String(t):typeof t=="string"?t.trim():"";return r?`fallback:${r}`:""};function p6(e){return typeof e.captureStackTrace=="function"}var Xp=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",p6(Error)&&Error.captureStackTrace(this,this.constructor)}},m6=class extends Xp{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},g6=class extends Xp{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},lb=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new m6(e);const s=atob(i[1]),a=Uint8Array.from(s,l=>l.charCodeAt(0));return new File([a],t,{type:n})}const r=await fetch(e);if(!r.ok)throw new g6(e,new Error(`HTTP ${r.status}: ${r.statusText}`));const o=await r.blob();return new File([o],t,{type:n})}catch(r){throw r instanceof Xp?r:new Xp("Failed to create file object",r)}};function v6(e,t){const n=e.split(".").map(Number),r=t.split(".").map(Number);for(let o=0;o<Math.max(n.length,r.length);o++){const i=n[o]||0,s=r[o]||0;if(i>s)return 1;if(i<s)return-1}return 0}var Zp=new WeakMap;function Bk(e){return e.ownerDocument??document}function zk(e,t){const n=Zp.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Zp.delete(t))}function jk(e,t){const n=Bk(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&zk(e,e.__clickOutsideDocument);let r=Zp.get(n);if(!r){const o=new Map,i=s=>{const a=typeof s.composedPath=="function"?s.composedPath():null;for(const[l,u]of o)(a?.includes(l)??l.contains(s.target))||u.value?.(s)};r={bindings:o,listener:i},Zp.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var cb={mounted(e,t){jk(e,t)},updated(e,t){jk(e,t)},unmounted(e){zk(e,e.__clickOutsideDocument??Bk(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function y6(e){return e[1].user!==void 0}var b6=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(y6).filter(([r,o])=>{const i=Lu({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=Lu({actor:o.user,fallbackKey:r});let s=e.userColorMap.get(i);return s||(s=o.user.color||(e.config.colors.length>0?e.config.colors[e.colorIndex%e.config.colors.length]:void 0),e.userColorMap.set(i,s),e.colorIndex++),{clientId:r,...o.user,color:s}})},w6="https://ingest.superdoc.dev/v1/collect",wY="community-and-eval-agplv3";function C6(){try{return"2.23.1-next.4"}catch{return"unknown"}}var k6=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||w6,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=C6()}getBrowserInfo(){return typeof window>"u"?{userAgent:"",currentUrl:"",hostname:"",screenSize:{width:0,height:0}}:{userAgent:window.navigator.userAgent,currentUrl:window.location.origin,hostname:window.location.hostname,screenSize:{width:window.screen.width,height:window.screen.height}}}trackDocumentOpen(e,t=null){if(!this.enabled)return;const n={timestamp:new Date().toISOString(),documentId:e,documentCreatedAt:t};this.sendEvent(n)}async sendEvent(e){const t={superdocVersion:this.superdocVersion,browserInfo:this.getBrowserInfo(),...this.metadata&&{metadata:this.metadata},events:[e]};try{await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-License-Key":this.licenseKey},body:JSON.stringify(t),credentials:"omit"})}catch{}}},Qp={PAGE:"superdoc-page",FRAGMENT:"superdoc-fragment",FLOATING_FRAGMENT:"superdoc-floating-fragment",LINE:"superdoc-line",INLINE_SDT_WRAPPER:"superdoc-structured-content-inline",INLINE_SDT_LABEL:"superdoc-structured-content-inline__label",BLOCK_SDT:"superdoc-structured-content-block",BLOCK_SDT_LABEL:"superdoc-structured-content__label",TABLE_FRAGMENT:"superdoc-table-fragment",DOCUMENT_SECTION:"superdoc-document-section",SDT_GROUP_HOVER:"sdt-group-hover",TOC_ENTRY:"superdoc-toc-entry",TOC_GROUP_HOVER:"toc-group-hover",IMAGE_FRAGMENT:"superdoc-image-fragment",INLINE_IMAGE:"superdoc-inline-image",LIST_MARKER:"superdoc-list-marker",INLINE_IMAGE_CLIP_WRAPPER:"superdoc-inline-image-clip-wrapper",ANNOTATION:"annotation",ANNOTATION_CONTENT:"annotation-content",ANNOTATION_CARET_ANCHOR:"annotation-caret-anchor"},CY=[Qp.INLINE_SDT_LABEL,Qp.BLOCK_SDT_LABEL],Vk={PM_START:"data-pm-start",PM_END:"data-pm-end",LAYOUT_EPOCH:"data-layout-epoch",TABLE_BOUNDARIES:"data-table-boundaries",SDT_ID:"data-sdt-id",SDT_TYPE:"data-sdt-type",FIELD_ID:"data-field-id",FIELD_TYPE:"data-field-type",DRAGGABLE:"data-draggable",DISPLAY_LABEL:"data-display-label",VARIANT:"data-variant",TYPE:"data-type",LAYOUT_BOUNDARY_SCHEMA:"data-layout-boundary-schema",LAYOUT_FRAGMENT_ID:"data-layout-fragment-id",LAYOUT_STORY:"data-layout-story",LAYOUT_BLOCK_REF:"data-layout-block-ref",LAYOUT_COLUMN_INDEX:"data-layout-column-index"},S6=e=>{if(!e)return{kind:"unknown"};if(e==="body")return{kind:"body"};const t=e.indexOf(":"),n=t===-1?e:e.slice(0,t),r=t===-1?void 0:e.slice(t+1);switch(n){case"body":case"header":case"footer":case"footnote":case"endnote":case"textbox":return r?{kind:n,id:r}:{kind:n};default:return{kind:"unknown"}}},kY=`.${Qp.BLOCK_SDT}[${Vk.SDT_ID}]`,SY=`[${Vk.DRAGGABLE}="true"]`,_6=typeof window<"u",Uk,Ff=e=>Uk=e,$k=Symbol();function ub(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Nf;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Nf||(Nf={}));var Hk=typeof window=="object"&&window.window===window?window:typeof self=="object"&&self.self===self?self:typeof global=="object"&&global.global===global?global:typeof globalThis=="object"?globalThis:{HTMLElement:null};function A6(e,{autoBom:t=!1}={}){return t&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\uFEFF",e],{type:e.type}):e}function db(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){I6(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function Gk(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Jp(e){try{e.dispatchEvent(new MouseEvent("click"))}catch{const n=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window,detail:0,screenX:80,screenY:20,clientX:80,clientY:20,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null});e.dispatchEvent(n)}}var em=typeof navigator=="object"?navigator:{userAgent:""},Wk=/Macintosh/.test(em.userAgent)&&/AppleWebKit/.test(em.userAgent)&&!/Safari/.test(em.userAgent),I6=_6?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!Wk?E6:"msSaveOrOpenBlob"in em?T6:x6:()=>{};function E6(e,t="download",n){const r=document.createElement("a");r.download=t,r.rel="noopener",typeof e=="string"?(r.href=e,r.origin!==location.origin?Gk(r.href)?db(e,t,n):(r.target="_blank",Jp(r)):Jp(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Jp(r)},0))}function T6(e,t="download",n){if(typeof e=="string")if(Gk(e))db(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Jp(r)})}else navigator.msSaveOrOpenBlob(A6(e,n),t)}function x6(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return db(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(Hk.HTMLElement))||"safari"in Hk,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||Wk)&&typeof FileReader<"u"){const a=new FileReader;a.onloadend=function(){let l=a.result;if(typeof l!="string")throw r=null,new Error("Wrong reader.result type");l=s?l:l.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=l:location.assign(l),r=null},a.readAsDataURL(e)}else{const a=URL.createObjectURL(e);r?r.location.assign(a):location.href=a,r=null,setTimeout(function(){URL.revokeObjectURL(a)},4e4)}}var{assign:_Y}=Object;function R6(){const e=yv(!0),t=e.run(()=>ne({}));let n=[],r=[];const o=Xr({install(i){Ff(o),o._a=i,i.provide($k,o),i.config.globalProperties.$pinia=o,r.forEach(s=>n.push(s)),r=[]},use(i){return this._a?n.push(i):r.push(i),this},_p:n,_a:null,_e:e,_s:new Map,state:t});return o}var Kk=()=>{};function qk(e,t,n,r=Kk){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&bv()&&B2(o),o}function Pu(e,...t){e.forEach(n=>{n(...t)})}var M6=e=>e(),Yk=Symbol(),fb=Symbol();function hb(e,t){e instanceof Map&&t instanceof Map?t.forEach((n,r)=>e.set(r,n)):e instanceof Set&&t instanceof Set&&t.forEach(e.add,e);for(const n in t){if(!t.hasOwnProperty(n))continue;const r=t[n],o=e[n];ub(o)&&ub(r)&&e.hasOwnProperty(n)&&!vr(r)&&!ai(r)?e[n]=hb(o,r):e[n]=r}return e}var L6=Symbol();function P6(e){return!ub(e)||!Object.prototype.hasOwnProperty.call(e,L6)}var{assign:_l}=Object;function D6(e){return!!(vr(e)&&e.effect)}function O6(e,t,n,r){const{state:o,actions:i,getters:s}=t,a=n.state.value[e];let l;function u(){a||(n.state.value[e]=o?o():{});const d=Y2(n.state.value[e]);return _l(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=Xr(ke(()=>{Ff(n);const g=n._s.get(e);return s[p].call(g,g)})),f),{}))}return l=Xk(e,u,t,n,r,!0),l}function Xk(e,t,n={},r,o,i){let s;const a=_l({actions:{}},n),l={deep:!0};let u,d,f=new Set,p=new Set,g;const m=r.state.value[e];!i&&!m&&(r.state.value[e]={});let v;function C(M){let z;u=d=!1,typeof M=="function"?(M(r.state.value[e]),z={type:Nf.patchFunction,storeId:e,events:g}):(hb(r.state.value[e],M),z={type:Nf.patchObject,payload:M,storeId:e,events:g});const q=v=Symbol();kt().then(()=>{v===q&&(u=!0)}),d=!0,Pu(f,z,r.state.value[e])}const w=i?function(){const{state:z}=n,q=z?z():{};this.$patch(B=>{_l(B,q)})}:Kk;function S(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const y=(M,z="")=>{if(Yk in M)return M[fb]=z,M;const q=function(){Ff(r);const B=Array.from(arguments),L=new Set,V=new Set;function T(H){L.add(H)}function $(H){V.add(H)}Pu(p,{args:B,name:q[fb],store:k,after:T,onError:$});let R;try{R=M.apply(this&&this.$id===e?this:k,B)}catch(H){throw Pu(V,H),H}return R instanceof Promise?R.then(H=>(Pu(L,H),H)).catch(H=>(Pu(V,H),Promise.reject(H))):(Pu(L,R),R)};return q[Yk]=!0,q[fb]=z,q},k=no({_p:r,$id:e,$onAction:qk.bind(null,p),$patch:C,$reset:w,$subscribe(M,z={}){const q=qk(f,M,z.detached,()=>B()),B=s.run(()=>Vt(()=>r.state.value[e],L=>{(z.flush==="sync"?d:u)&&M({storeId:e,type:Nf.direct,events:g},L)},_l({},l,z)));return q},$dispose:S});r._s.set(e,k);const x=(r._a&&r._a.runWithContext||M6)(()=>r._e.run(()=>(s=yv()).run(()=>t({action:y}))));for(const M in x){const z=x[M];vr(z)&&!D6(z)||ai(z)?i||(m&&P6(z)&&(vr(z)?z.value=m[M]:hb(z,m[M])),r.state.value[e][M]=z):typeof z=="function"&&(x[M]=y(z,M),a.actions[M]=z)}return _l(k,x),_l(kn(k),x),Object.defineProperty(k,"$state",{get:()=>r.state.value[e],set:M=>{C(z=>{_l(z,M)})}}),r._p.forEach(M=>{_l(k,s.run(()=>M({store:k,app:r._a,pinia:r,options:a})))}),m&&i&&n.hydrate&&n.hydrate(k.$state,m),u=!0,d=!0,k}function Zk(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=Sw();return s=s||(l?hl($k,null):null),s&&Ff(s),s=Uk,s._s.has(e)||(o?Xk(e,t,r,s):O6(e,r,s)),s._s.get(e)}return i.$id=e,i}function Ks(e){const t=kn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=ke({get:()=>e[r],set(i){e[r]=i}}):(vr(o)||ai(o))&&(n[r]=Ev(e,r))}return n}function Qk(e){return e.collaboration!==void 0?e.collaboration:e.v2Collaboration}function Jk(e){if(typeof e!="string"||e.length===0)return"<none>";try{const t=new URL(e);t.search="",t.hash="",t.username="",t.password="";const n=e.includes("?")?"?<redacted>":"";return`${t.toString().replace(/\?$/,"")}${n}`}catch{const t=e.replace(/\/\/[^/@]+@/,"//"),n=t.search(/[?#]/);return n===-1?t:`${t.slice(0,n)}?<redacted>`}}function Tc(e){return typeof e=="string"&&e.length>0?e:null}function F6(e){if(typeof e!="string"||e.length===0)return null;try{const t=new URL(e);return t.protocol==="ws:"||t.protocol==="wss:"?e:null}catch{return null}}function N6(e,t){if(typeof e!="string")return null;const n=e.trim();if(n.length===0)return null;try{const r=new URL(n);return r.protocol==="http:"||r.protocol==="https:"?n:null}catch{if(typeof t!="string"||t.trim().length===0)return null;try{const r=new URL(n,t);return r.protocol==="http:"||r.protocol==="https:"?r.href:null}catch{return null}}}function B6(e){if(!e||typeof e!="object"||Array.isArray(e))return;const t={};for(const[n,r]of Object.entries(e))typeof r=="string"&&(t[n]=r);return Object.keys(t).length>0?t:void 0}function pb(e){return e===void 0?"join":e==="join"||e==="create"?e:null}function z6(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=2147483647?e:null}function tm(e,t){return!e.ok||t===void 0?e:{ok:!0,target:{...e.target,syncTimeoutMs:t}}}function mb(){return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration roomMode must be either "join" or "create".'}}function j6(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function V6(e){if(!e||typeof e!="object")return null;const t=typeof e.providerType=="string"?e.providerType.toLowerCase():"";return t==="hocuspocus"?"hocuspocus":t==="liveblocks"?"liveblocks":t==="superdoc"?"superdoc":e.ydoc!=null||e.provider!=null?"external-ydoc-provider":null}function e3(e,t){const n=Tc(t.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:`SuperDoc v2 collaboration requires a non-empty collaboration.documentId for the "${e}" provider.`};const r=t.url??t.serverUrl,o=F6(r);if(!o)return{ok:!1,reason:"invalid-server-url",message:`SuperDoc v2 collaboration requires a valid ws:// or wss:// URL for the "${e}" provider (received: ${Jk(r)}).`};const i=B6(t.params),s=e==="hocuspocus"&&typeof t.token=="function"?t.token:e==="hocuspocus"?Tc(t.token):null,a=pb(t.roomMode);return a?{ok:!0,target:{providerFamily:e,documentId:n,roomMode:a,serverUrl:o,...i?{params:i}:{},...s?{token:s}:{}}}:mb()}function U6(e){const t=Tc(e.adapterId);if(!t)return{ok:!1,reason:"invalid-adapter-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.adapterId."};const n=Tc(e.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.documentId."};const r=pb(e.roomMode);if(!r)return mb();if(Object.prototype.hasOwnProperty.call(e,"providerOptions"))try{structuredClone(e.providerOptions)}catch{return{ok:!1,reason:"invalid-provider-options",message:"SuperDoc v2 provider extension options must be structured-clone-safe."}}const o=typeof e.token=="function"?e.token:Tc(e.token);return{ok:!0,target:{providerFamily:"extension",adapterId:t,documentId:n,roomMode:r,...Object.prototype.hasOwnProperty.call(e,"providerOptions")?{providerOptions:e.providerOptions}:{},...o?{token:o}:{}}}}function $6(e,t){const n=Tc(e.documentId??e.roomId);if(!n)return{ok:!1,reason:"invalid-document-id",message:'SuperDoc v2 collaboration requires a non-empty collaboration.documentId (or roomId) for the "liveblocks" provider.'};const r=Tc(e.publicApiKey),o=pb(e.roomMode);if(!o)return mb();const i=e.authEndpoint,s=typeof i=="string"&&i.length>0;if(!r&&!s)return{ok:!1,reason:"missing-auth",message:"SuperDoc v2 Liveblocks collaboration requires exactly one auth mode: a publicApiKey or an authEndpoint. None was provided."};if(r&&s)return{ok:!1,reason:"mixed-auth",message:"SuperDoc v2 Liveblocks collaboration accepts exactly one auth mode; pass either publicApiKey or authEndpoint, not both."};if(r)return{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,publicApiKey:r}};const a=N6(i,t);return a?{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,authEndpoint:a}}:{ok:!1,reason:"invalid-auth-endpoint",message:"SuperDoc v2 Liveblocks collaboration requires a valid http(s) authEndpoint URL (received: <redacted>)."}}function t3(e){const{legacyCollaboration:t,documentType:n,documentCount:r,authEndpointBaseUrl:o}=e,i=Qk(e);if(typeof r=="number"&&r>1)return{ok:!1,reason:"unsupported-multi-document",message:`SuperDoc v2 collaboration supports exactly one document per room; received ${r}.`};if(n!=null&&n!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return{ok:!1,reason:"unsupported-document-type",message:"SuperDoc v2 collaboration supports DOCX documents only."};if(!(i!=null&&typeof i=="object")){const u=V6(t);if(u){const d=u==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",f=Jk(t?.url);return{ok:!1,reason:d,message:u==="external-ydoc-provider"?"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. Provide a collaboration target (e.g. { providerType, documentId, url }) instead.":`SuperDoc v2 collaboration does not accept "${u}" through the legacy modules.collaboration block (server: ${f}). Configure it as a document.collaboration target ({ providerType: "${u}", documentId, ... }) instead.`}}return{ok:!1,reason:"missing-target",message:"SuperDoc v2 collaboration requires a collaboration target ({ documentId, serverUrl } or { providerType, ... }). None was provided."}}const s=i;if(Object.prototype.hasOwnProperty.call(s,"createIfMissing"))return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration createIfMissing has been removed. Use roomMode: "create" for creation or roomMode: "join" for normal opens.'};if(s.ydoc!=null||s.provider!=null)return{ok:!1,reason:"unsupported-legacy-provider",message:"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. v2 owns its provider; pass a collaboration target ({ providerType, documentId, serverUrl | publicApiKey | authEndpoint }) instead."};const a=z6(s.syncTimeoutMs);if(a===null)return{ok:!1,reason:"invalid-sync-timeout",message:"SuperDoc v2 collaboration syncTimeoutMs must be a finite positive number within the JavaScript timer range."};const l=j6(s);return l===null||l==="y-websocket"?tm(e3("y-websocket",s),a):l==="hocuspocus"?tm(e3("hocuspocus",s),a):l==="liveblocks"?tm($6(s,o),a):l==="extension"?tm(U6(s),a):{ok:!1,reason:"unsupported-provider-family",message:`SuperDoc v2 collaboration does not support the "${l}" provider family. Supported families are y-websocket, hocuspocus, liveblocks, and extension.`}}var Bf=(e,t="document")=>{if(!e)return null;if(typeof File=="function"&&e instanceof File)return e;if(typeof Blob=="function"&&e instanceof Blob){if(typeof File=="function"){const n=e.name||t;return new File([e],n,{type:e.type})}return e}return e.originFileObj?Bf(e.originFileObj,e.name||t):e.file?Bf(e.file,e.name||t):e.raw?Bf(e.raw,e.name||t):null},n3=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,H6=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,Al=e=>{if(ArrayBuffer.isView(e))return H6?.call(e)==="Uint8Array";if(!n3)return!1;try{return n3.call(e),!0}catch{return!1}},gb=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},vb=(e,t)=>new Blob([gb(e)],{type:t}),yb=e=>{switch(e.toLowerCase()){case"docx":case kr:return kr;case"pdf":case Ra:return Ra;case"html":case Mu:return Mu;default:return e}},nm=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?kr:t.endsWith(".pdf")?Ra:t.endsWith(".html")||t.endsWith(".htm")?Mu:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},G6=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",W6="application/octet-stream",bb=e=>{if(e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"collaboration")){const n={...e};delete n.collaboration,e={...n,v2Collaboration:Qk(e)}}if(Al(e))return{type:kr,data:gb(e),name:"document.docx"};const t=Bf(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=nm(n),i=o||nm(r),s=t.type.toLowerCase()===W6,a=s&&o?n:r||n||"document",l=s&&i?i:t.type||i||"application/vnd.openxmlformats-officedocument.wordprocessingml.document";let u=t;return s&&i&&typeof File=="function"&&t instanceof File?u=new File([t],a,{type:l,lastModified:t.lastModified}):s&&i&&typeof Blob=="function"&&t instanceof Blob&&(u=new Blob([t],{type:l})),{...e.v2Collaboration!==void 0?{v2Collaboration:e.v2Collaboration}:{},type:l,data:u,name:a}}if(e&&typeof e=="object"&&"data"in e){if(Al(e.data)){const r=yb(e.type||nm(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?gb(e.data):vb(e.data,r),name:e.name||G6(r)}}const n=Bf(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?yb(e.type):"",o=r||n.type||nm(n.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document",i=!n.type||!!(r&&n.type!==r);let s=n;return i&&typeof File=="function"&&n instanceof File?s=new File([n],n.name,{type:o,lastModified:n.lastModified}):i&&typeof Blob=="function"&&n instanceof Blob&&(s=new Blob([n],{type:o})),{...e,type:o,data:s,name:e.name||n.name||"document"}}}if(e&&typeof e=="object"&&"url"in e&&typeof e.type=="string"){const n=yb(e.type);if(n!==e.type)return{...e,type:n}}return e};Nt();function K6(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?no({...t}):ne(t),i=ne(null);return Vt(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function q6(e){const t=ne(e.itemid),n=ne(e.itemicon),r=ne(e.itemiconpack),o=ne(e.itemdisplaylabel),i=e.itemlinkvalue,s=e.itemplaceholdertext,{value:a}=K6(e,i,ne([])),l=ne(e.itemtype),u=ne(e.itemfieldtype),d=e,f=no({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=ne(e.logicrules),g=ne(!1),m=no({}),v={SELECT:X6,IMAGEINPUT:Y6,CHECKBOXINPUT:Z6};return l.value in v&&Object.assign(m,v[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:u,value:a,format:ne(e.itemformat),logicRules:p,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...m}}function Y6(e){return{fontfamily:ne(e.fontfamily),iteminputtype:ne(e.iteminputtype)}}function X6(e){return{options:ne(e.itemoptions)}}function Z6(e){const t=ne(e.itemoptions);return t.value&&(t.value=t.value.map(n=>({label:n.itemdisplaylabel,value:n.itemlinkvalue,checked:n.ischecked,id:n.itemid,annotationId:n.annotationId}))),{options:t}}var qs=()=>new Map,wb=e=>{const t=qs();return e.forEach((n,r)=>{t.set(r,n)}),t},Du=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},Q6=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},J6=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Ou=()=>new Set,Cb=e=>e[e.length-1],Fu=Array.from,kb=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},r3=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},e8=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},rm=Array.isArray,t8=class{constructor(){this._observers=qs()}on(e,t){return Du(this._observers,e,Ou).add(t),t}once(e,t){const n=(...r)=>{this.off(e,n),t(...r)};this.on(e,n)}off(e,t){const n=this._observers.get(e);n!==void 0&&(n.delete(t),n.size===0&&this._observers.delete(e))}emit(e,t){return Fu((this._observers.get(e)||qs()).values()).forEach(n=>n(...t))}destroy(){this._observers=qs()}},Ma=Math.floor,om=Math.abs,o3=(e,t)=>e<t?e:t,Nu=(e,t)=>e>t?e:t,AY=Number.isNaN,n8=e=>e!==0?e<0:1/e<0,IY=1,EY=2,TY=4,xY=8,RY=32,MY=64,LY=128,r8=1<<17,o8=1<<18,i8=1<<19,s8=1<<20,a8=1<<21,l8=1<<22,c8=1<<23,u8=1<<24,d8=1<<25,f8=1<<26,h8=1<<27,p8=1<<28,m8=1<<29,g8=1<<30,PY=31,DY=63,OY=127,FY=r8-1,NY=o8-1,BY=i8-1,zY=s8-1,jY=a8-1,VY=l8-1,UY=c8-1,$Y=u8-1,HY=d8-1,GY=f8-1,WY=h8-1,KY=p8-1,qY=m8-1,YY=g8-1,XY=2147483647,i3=Number.MAX_SAFE_INTEGER,s3=Number.MIN_SAFE_INTEGER,v8=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Ma(e)===e),ZY=Number.isNaN,QY=Number.parseInt,a3=String.fromCharCode,JY=String.fromCodePoint,eX=a3(65535),y8=e=>e.toLowerCase(),b8=/^\s*/g,w8=e=>e.replace(b8,""),C8=/([A-Z])/g,l3=(e,t)=>w8(e.replace(C8,n=>`${t}${y8(n)}`)),k8=e=>{const t=unescape(encodeURIComponent(e)),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.codePointAt(o);return r},zf=typeof TextEncoder<"u"?new TextEncoder:null,S8=e=>zf.encode(e),_8=zf?S8:k8,Sb=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Sb&&Sb.decode(new Uint8Array).length===1&&(Sb=null);var A8=(e,t)=>e8(t,()=>e).join(""),jf=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},_b=()=>new jf,I8=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},La=e=>{const t=new Uint8Array(I8(e));let n=0;for(let r=0;r<e.bufs.length;r++){const o=e.bufs[r];t.set(o,n),n+=o.length}return t.set(new Uint8Array(e.cbuf.buffer,0,e.cpos),n),t},E8=(e,t)=>{const n=e.cbuf.length;n-e.cpos<t&&(e.bufs.push(new Uint8Array(e.cbuf.buffer,0,e.cpos)),e.cbuf=new Uint8Array(Nu(n,t)*2),e.cpos=0)},go=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},Ab=go,lr=(e,t)=>{for(;t>127;)go(e,128|127&t),t=Ma(t/128);go(e,127&t)},Ib=(e,t)=>{const n=n8(t);for(n&&(t=-t),go(e,(t>63?128:0)|(n?64:0)|63&t),t=Ma(t/64);t>0;)go(e,(t>127?128:0)|127&t),t=Ma(t/128)},Eb=new Uint8Array(3e4),T8=Eb.length/3,x8=(e,t)=>{if(t.length<T8){const n=zf.encodeInto(t,Eb).written||0;lr(e,n);for(let r=0;r<n;r++)go(e,Eb[r])}else xi(e,_8(t))},R8=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;lr(e,r);for(let o=0;o<r;o++)go(e,n.codePointAt(o))},Bu=zf&&zf.encodeInto?x8:R8,Tb=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=o3(n-r,t.length),i=t.length-o;e.cbuf.set(t.subarray(0,o),r),e.cpos+=o,i>0&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(Nu(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},xi=(e,t)=>{lr(e,t.byteLength),Tb(e,t)},xb=(e,t)=>{E8(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},M8=(e,t)=>xb(e,4).setFloat32(0,t,!1),L8=(e,t)=>xb(e,8).setFloat64(0,t,!1),P8=(e,t)=>xb(e,8).setBigInt64(0,t,!1),c3=new DataView(new ArrayBuffer(4)),D8=e=>(c3.setFloat32(0,e),c3.getFloat32(0)===e),Vf=(e,t)=>{switch(typeof t){case"string":go(e,119),Bu(e,t);break;case"number":v8(t)&&om(t)<=2147483647?(go(e,125),Ib(e,t)):D8(t)?(go(e,124),M8(e,t)):(go(e,123),L8(e,t));break;case"bigint":go(e,122),P8(e,t);break;case"object":if(t===null)go(e,126);else if(rm(t)){go(e,117),lr(e,t.length);for(let n=0;n<t.length;n++)Vf(e,t[n])}else if(t instanceof Uint8Array)go(e,116),xi(e,t);else{go(e,118);const n=Object.keys(t);lr(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];Bu(e,o),Vf(e,t[o])}}break;case"boolean":go(e,t?120:121);break;default:go(e,127)}},u3=class extends jf{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&lr(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},d3=e=>{e.count>0&&(Ib(e.encoder,e.count===1?e.s:-e.s),e.count>1&&lr(e.encoder,e.count-2))},im=class{constructor(){this.encoder=new jf,this.s=0,this.count=0}write(e){this.s===e?this.count++:(d3(this),this.count=1,this.s=e)}toUint8Array(){return d3(this),La(this.encoder)}},f3=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Ib(e.encoder,t),e.count>1&&lr(e.encoder,e.count-2)}},Rb=class{constructor(){this.encoder=new jf,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(f3(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return f3(this),La(this.encoder)}},O8=class{constructor(){this.sarr=[],this.s="",this.lensE=new im}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new jf;return this.sarr.push(this.s),this.s="",Bu(e,this.sarr.join("")),Tb(e,this.lensE.toUint8Array()),La(e)}},Il=e=>new Error(e),gs=()=>{throw Il("Method unimplemented")},Pa=()=>{throw Il("Unexpected case")},tX=crypto.subtle,F8=crypto.getRandomValues.bind(crypto),h3=()=>F8(new Uint32Array(1))[0],N8="10000000-1000-4000-8000-100000000000",B8=()=>N8.replace(/[018]/g,e=>(e^h3()&15>>e/4).toString(16)),z8=Date.now,p3=e=>new Promise(e),nX=Promise.all.bind(Promise),m3=e=>e===void 0?null:e,j8=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},g3=new j8,V8=!0;try{typeof localStorage<"u"&&localStorage&&(g3=localStorage,V8=!1)}catch{}var U8=g3,Uf=Symbol("Equality"),v3=(e,t)=>e===t||!!e?.[Uf]?.(t)||!1,$8=e=>typeof e=="object",H8=Object.assign,G8=Object.keys,W8=(e,t)=>{for(const n in e)t(e[n],n)},sm=e=>G8(e).length,K8=e=>{for(const t in e)return!1;return!0},$f=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},Mb=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),q8=(e,t)=>e===t||sm(e)===sm(t)&&$f(e,(n,r)=>(n!==void 0||Mb(t,r))&&v3(t[r],n)),Y8=Object.freeze,y3=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&y3(e[t])}return Y8(e)},Lb=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&Lb(e,t,n+1)}},am=(e,t)=>{if(e===t)return!0;if(e==null||t==null||e.constructor!==t.constructor&&(e.constructor||Object)!==(t.constructor||Object))return!1;if(e[Uf]!=null)return e[Uf](t);switch(e.constructor){case ArrayBuffer:e=new Uint8Array(e),t=new Uint8Array(t);case Uint8Array:if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;break;case Set:if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;break;case Map:if(e.size!==t.size)return!1;for(const n of e.keys())if(!t.has(n)||!am(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(sm(e)!==sm(t))return!1;for(const n in e)if(!Mb(e,n)||!am(e[n],t[n]))return!1;break;case Array:if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!am(e[n],t[n]))return!1;break;default:return!1}return!0},X8=(e,t)=>t.includes(e),Hf=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",rX=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,Ys,Z8=[],Q8=()=>{if(Ys===void 0)if(Hf){Ys=qs();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&Ys.set(t,""),t=r):t!==null?(Ys.set(t,r),t=null):Z8.push(r)}t!==null&&Ys.set(t,"")}else typeof location=="object"?(Ys=qs(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");Ys.set(`--${l3(t,"-")}`,n),Ys.set(`-${l3(t,"-")}`,n)}})):Ys=qs();return Ys},Pb=e=>Q8().has(e),lm=e=>m3(Hf?process.env[e.toUpperCase().replaceAll("-","_")]:U8.getItem(e)),b3=e=>Pb("--"+e)||lm(e)!==null,J8=b3("production"),eR=Hf&&X8(process.env.FORCE_COLOR,["true","1","2"]),tR=eR||!Pb("--no-colors")&&!b3("no-color")&&(!Hf||process.stdout.isTTY)&&(!Hf||Pb("--color")||lm("COLORTERM")!==null||(lm("TERM")||"").includes("color")),nR=class{constructor(e,t){this.left=e,this.right=t}},Da=(e,t)=>new nR(e,t),w3=e=>e.next()>=.5,Db=(e,t,n)=>Ma(e.next()*(n+1-t)+t),C3=(e,t,n)=>Ma(e.next()*(n+1-t)+t),Ob=(e,t,n)=>C3(e,t,n),rR=e=>a3(Ob(e,97,122)),oR=(e,t=0,n=20)=>{const r=Ob(e,t,n);let o="";for(let i=0;i<r;i++)o+=rR(e);return o},Fb=(e,t)=>t[Ob(e,0,t.length-1)],iR=Symbol("0schema"),sR=class{constructor(){this._rerrs=[]}extend(e,t,n,r=null){this._rerrs.push({path:e,expected:t,has:n,message:r})}toString(){const e=[];for(let t=this._rerrs.length-1;t>0;t--){const n=this._rerrs[t];e.push(A8(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
5
5
|
`)}},Nb=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[Uf]?v3(e,t):rm(e)?kb(e,n=>r3(t,r=>Nb(n,r))):$8(e)?$f(e,(n,r)=>Nb(n,t[r])):!1,ei=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),Nb(t,n)}equals(e){return this.constructor===e.constructor&&am(this.shape,e.shape)}[iR](){return!0}[Uf](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){gs()}get nullable(){return zu(this,pm)}get optional(){return new _3(this)}cast(e){return B3(e,this),e}expect(e){return B3(e,this),e}},Bb=class extends ei{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){const n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),n}},Zr=(e,t=null)=>new Bb(e,t),oX=Zr(Bb),zb=class extends ei{constructor(e){super(),this.shape=e}check(e,t){const n=this.shape(e);return!n&&t?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),n}},vo=e=>new zb(e),iX=Zr(zb),cm=class extends ei{constructor(e){super(),this.shape=e}check(e,t){const n=this.shape.some(r=>r===e);return!n&&t?.extend(null,this.shape.join(" | "),e.toString()),n}},um=(...e)=>new cm(e),k3=Zr(cm),aR=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),S3=e=>{if(Vu.check(e))return[aR(e)];if(k3.check(e))return e.shape.map(t=>t+"");if(O3.check(e))return["[+-]?\\d+.?\\d*"];if(F3.check(e))return[".*"];if(dm.check(e))return e.shape.map(S3).flat(1);Pa()},lR=class extends ei{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(S3).map(t=>`(${t.join("|")})`).join("")+"$")}check(e,t){const n=this._r.exec(e)!=null;return!n&&t?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),n}},sX=Zr(lR),cR=Symbol("optional"),_3=class extends ei{constructor(e){super(),this.shape=e}check(e,t){const n=e===void 0||this.shape.check(e);return!n&&t?.extend(null,"undefined (optional)","()"),n}get[cR](){return!0}},uR=Zr(_3),A3=class extends ei{check(e,t){return t?.extend(null,"never",typeof e),!1}},aX=new A3,lX=Zr(A3),I3=class FT extends ei{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new FT(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):$f(this.shape,(r,o)=>{const i=this._isPartial&&!Mb(t,o)||r.check(t[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof t[o],"Object property does not match"),i})}},dR=e=>new I3(e),fR=Zr(I3),hR=vo(e=>e!=null&&(e.constructor===Object||e.constructor==null)),E3=class extends ei{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&$f(e,(n,r)=>{const o=this.shape.keys.check(r,t);return!o&&t?.extend(r+"","Record",typeof e,o?"Key doesn't match schema":"Value doesn't match value"),o&&this.shape.values.check(n,t)})}},T3=(e,t)=>new E3(e,t),pR=Zr(E3),x3=class extends ei{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&$f(this.shape,(n,r)=>{const o=n.check(e[r],t);return!o&&t?.extend(r.toString(),"Tuple",typeof n),o})}},mR=(...e)=>new x3(e),cX=Zr(x3),R3=class extends ei{constructor(e){super(),this.shape=e.length===1?e[0]:new jb(e)}check(e,t){const n=rm(e)&&kb(e,r=>this.shape.check(r));return!n&&t?.extend(null,"Array",""),n}},M3=(...e)=>new R3(e),gR=Zr(R3),vR=vo(e=>rm(e)),L3=class extends ei{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){const n=e instanceof this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name),n}},yR=(e,t=null)=>new L3(e,t),uX=Zr(L3),bR=yR(ei),wR=class extends ei{constructor(e){super(),this.len=e.length-1,this.args=mR(...e.slice(-1)),this.res=e[this.len]}check(e,t){const n=e.constructor===Function&&e.length<=this.len;return!n&&t?.extend(null,"function",typeof e),n}},CR=Zr(wR),kR=vo(e=>typeof e=="function"),SR=class extends ei{constructor(e){super(),this.shape=e}check(e,t){const n=kb(this.shape,r=>r.check(e,t));return!n&&t?.extend(null,"Intersectinon",typeof e),n}},dX=Zr(SR,e=>e.shape.length>0),jb=class extends ei{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const n=r3(this.shape,r=>r.check(e,t));return t?.extend(null,"Union",typeof e),n}},zu=(...e)=>e.findIndex(t=>dm.check(t))>=0?zu(...e.map(t=>Gf(t)).map(t=>dm.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new jb(e),dm=Zr(jb),P3=()=>!0,fm=vo(P3),_R=Zr(zb,e=>e.shape===P3),Vb=vo(e=>typeof e=="bigint"),AR=vo(e=>e===Vb),D3=vo(e=>typeof e=="symbol"),fX=vo(e=>e===D3),ju=vo(e=>typeof e=="number"),O3=vo(e=>e===ju),Vu=vo(e=>typeof e=="string"),F3=vo(e=>e===Vu),hm=vo(e=>typeof e=="boolean"),IR=vo(e=>e===hm),N3=um(void 0),hX=Zr(cm,e=>e.shape.length===1&&e.shape[0]===void 0),pX=um(void 0),pm=um(null),ER=Zr(cm,e=>e.shape.length===1&&e.shape[0]===null),mX=Zr(Uint8Array),gX=Zr(Bb,e=>e.shape===Uint8Array),TR=zu(ju,Vu,pm,N3,Vb,hm,D3),vX=(()=>{const e=M3(fm),t=T3(Vu,fm),n=zu(ju,Vu,pm,hm,e,t);return e.shape=n,t.shape.values=n,n})(),Gf=e=>{if(bR.check(e))return e;if(hR.check(e)){const t={};for(const n in e)t[n]=Gf(e[n]);return dR(t)}else{if(vR.check(e))return zu(...e.map(Gf));if(TR.check(e))return um(e);if(kR.check(e))return Zr(e)}Pa()},B3=J8?()=>{}:(e,t)=>{const n=new sR;if(!t.check(e,n))throw Il(`Expected value to be of type ${t.constructor.name}.
|
|
6
6
|
${n.toString()}`)},xR=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Gf(e),h:t}),this}else(e){return this.if(fm,e)}done(){return(e,t)=>{for(let n=0;n<this.patterns.length;n++){const r=this.patterns[n];if(r.if.check(e))return r.h(e,t)}throw Il("Unhandled pattern")}}},RR=e=>new xR(e),z3=RR(fm).if(O3,(e,t)=>Db(t,s3,i3)).if(F3,(e,t)=>oR(t)).if(IR,(e,t)=>w3(t)).if(AR,(e,t)=>BigInt(Db(t,s3,i3))).if(dm,(e,t)=>Uu(t,Fb(t,e.shape))).if(fR,(e,t)=>{const n={};for(const r in e.shape){let o=e.shape[r];if(uR.check(o)){if(w3(t))continue;o=o.shape}n[r]=z3(o,t)}return n}).if(gR,(e,t)=>{const n=[],r=C3(t,0,42);for(let o=0;o<r;o++)n.push(Uu(t,e.shape));return n}).if(k3,(e,t)=>Fb(t,e.shape)).if(ER,(e,t)=>null).if(CR,(e,t)=>{const n=Uu(t,e.res);return()=>n}).if(_R,(e,t)=>Uu(t,Fb(t,[ju,Vu,pm,N3,Vb,hm,M3(ju),T3(zu("a","b","c"),ju)]))).if(pR,(e,t)=>{const n={},r=Db(t,0,3);for(let o=0;o<r;o++){const i=Uu(t,e.shape.keys);n[i]=Uu(t,e.shape.values)}return n}).done(),Uu=(e,t)=>z3(Gf(t),e),xc=typeof document<"u"?document:{},yX=vo(e=>e.nodeType===OR),bX=typeof DOMParser<"u"?new DOMParser:null,wX=vo(e=>e.nodeType===LR),CX=vo(e=>e.nodeType===PR),MR=e=>Q6(e,(t,n)=>`${n}:${t};`).join(""),LR=xc.ELEMENT_NODE,PR=xc.TEXT_NODE,kX=xc.CDATA_SECTION_NODE,SX=xc.COMMENT_NODE,DR=xc.DOCUMENT_NODE,_X=xc.DOCUMENT_TYPE_NODE,OR=xc.DOCUMENT_FRAGMENT_NODE,AX=vo(e=>e.nodeType===DR),Oa=Symbol,j3=Oa(),V3=Oa(),FR=Oa(),NR=Oa(),BR=Oa(),U3=Oa(),zR=Oa(),Ub=Oa(),jR=Oa(),VR=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[];let r=0;for(;r<e.length;r++){const o=e[r];if(o===void 0)break;if(o.constructor===String||o.constructor===Number)t.push(o);else if(o.constructor===Object)break}for(r>0&&n.push(t.join(""));r<e.length;r++){const o=e[r];o instanceof Symbol||n.push(o)}return n},IX=z8(),UR={[j3]:Da("font-weight","bold"),[V3]:Da("font-weight","normal"),[FR]:Da("color","blue"),[BR]:Da("color","green"),[NR]:Da("color","grey"),[U3]:Da("color","red"),[zR]:Da("color","purple"),[Ub]:Da("color","orange"),[jR]:Da("color","black")},$R=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],r=qs();let o=[],i=0;for(;i<e.length;i++){const s=e[i],a=UR[s];if(a!==void 0)r.set(a.left,a.right);else{if(s===void 0)break;if(s.constructor===String||s.constructor===Number){const l=MR(r);i>0||l.length>0?(t.push("%c"+s),n.push(l)):t.push(s)}else break}}for(i>0&&(o=n,o.unshift(t.join("")));i<e.length;i++){const s=e[i];s instanceof Symbol||o.push(s)}return o},$3=tR?$R:VR,HR=(...e)=>{console.log(...$3(e)),H3.forEach(t=>t.print(e))},GR=(...e)=>{console.warn(...$3(e)),e.unshift(Ub),H3.forEach(t=>t.print(e))},H3=Ou(),G3=e=>({[Symbol.iterator](){return this},next:e}),WR=(e,t)=>G3(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),$b=(e,t)=>G3(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),W3=class{constructor(e,t){this.clock=e,this.len=t}},K3=class{constructor(){this.clients=new Map}},q3=(e,t,n)=>t.clients.forEach((r,o)=>{const i=e.doc.store.clients.get(o);if(i!=null){const s=i[i.length-1],a=s.id.clock+s.length;for(let l=0,u=r[l];l<r.length&&u.clock<a;u=r[++l])iS(e,i,u.clock,u.len,n)}}),KR=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const o=Ma((n+r)/2),i=e[o],s=i.clock;if(s<=t){if(t<s+i.len)return o;n=o+1}else r=o-1}return null},Y3=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&KR(n,t.clock)!==null},X3=e=>{e.clients.forEach(t=>{t.sort((o,i)=>o.clock-i.clock);let n,r;for(n=1,r=1;n<t.length;n++){const o=t[r-1],i=t[n];o.clock+o.len>=i.clock?t[r-1]=new W3(o.clock,Nu(o.len,i.clock+i.len-o.clock)):(r<n&&(t[r]=i),r++)}t.length=r})},Z3=(e,t,n,r)=>{Du(e.clients,t,()=>[]).push(new W3(n,r))},qR=()=>new K3,YR=(e,t)=>{lr(e.restEncoder,t.clients.size),Fu(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),lr(e.restEncoder,n);const o=r.length;lr(e.restEncoder,o);for(let i=0;i<o;i++){const s=r[i];e.writeDsClock(s.clock),e.writeDsLen(s.len)}})},Q3=h3,Hb=class NT extends t8{constructor({guid:t=B8(),collectionid:n=null,gc:r=!0,gcFilter:o=()=>!0,meta:i=null,autoLoad:s=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=o,this.clientID=Q3(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new a7,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=s,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=p3(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>p3(u=>{const d=f=>{(f===void 0||f===!0)&&(this.off("sync",d),u())};this.on("sync",d)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const t=this._item;t!==null&&!this.shouldLoad&&yr(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Fu(this.subdocs).map(t=>t.guid))}transact(t,n=null){return yr(this,t,n)}get(t,n=Eo){const r=Du(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==Eo&&o!==n)if(o===Eo){const i=new n;i._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=i}),i._start=r._start;for(let s=i._start;s!==null;s=s.right)s.parent=i;return i._length=r._length,this.share.set(t,i),i._integrate(this,null),i}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return r}getArray(t=""){return this.get(t,C7)}getText(t=""){return this.get(t,E7)}getMap(t=""){return this.get(t,Qb)}getXmlElement(t=""){return this.get(t,TS)}getXmlFragment(t=""){return this.get(t,n0)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,Fu(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new NT({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,yr(t.parent.doc,r=>{const o=n.doc;t.deleted||r.subdocsAdded.add(o),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}},XR=class{constructor(){this.restEncoder=_b()}toUint8Array(){return La(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){lr(this.restEncoder,e)}writeDsLen(e){lr(this.restEncoder,e)}},ZR=class extends XR{writeLeftID(e){lr(this.restEncoder,e.client),lr(this.restEncoder,e.clock)}writeRightID(e){lr(this.restEncoder,e.client),lr(this.restEncoder,e.clock)}writeClient(e){lr(this.restEncoder,e)}writeInfo(e){Ab(this.restEncoder,e)}writeString(e){Bu(this.restEncoder,e)}writeParentInfo(e){lr(this.restEncoder,e?1:0)}writeTypeRef(e){lr(this.restEncoder,e)}writeLen(e){lr(this.restEncoder,e)}writeAny(e){Vf(this.restEncoder,e)}writeBuf(e){xi(this.restEncoder,e)}writeJSON(e){Bu(this.restEncoder,JSON.stringify(e))}writeKey(e){Bu(this.restEncoder,e)}},QR=class{constructor(){this.restEncoder=_b(),this.dsCurrVal=0}toUint8Array(){return La(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,lr(this.restEncoder,t)}writeDsLen(e){e===0&&Pa(),lr(this.restEncoder,e-1),this.dsCurrVal+=e}},JR=class extends QR{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Rb,this.clientEncoder=new im,this.leftClockEncoder=new Rb,this.rightClockEncoder=new Rb,this.infoEncoder=new u3(Ab),this.stringEncoder=new O8,this.parentInfoEncoder=new u3(Ab),this.typeRefEncoder=new im,this.lenEncoder=new im}toUint8Array(){const e=_b();return lr(e,0),xi(e,this.keyClockEncoder.toUint8Array()),xi(e,this.clientEncoder.toUint8Array()),xi(e,this.leftClockEncoder.toUint8Array()),xi(e,this.rightClockEncoder.toUint8Array()),xi(e,La(this.infoEncoder)),xi(e,this.stringEncoder.toUint8Array()),xi(e,La(this.parentInfoEncoder)),xi(e,this.typeRefEncoder.toUint8Array()),xi(e,this.lenEncoder.toUint8Array()),Tb(e,La(this.restEncoder)),La(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Vf(this.restEncoder,e)}writeBuf(e){xi(this.restEncoder,e)}writeJSON(e){Vf(this.restEncoder,e)}writeKey(e){const t=this.keyMap.get(e);t===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(t)}},e7=(e,t,n,r)=>{r=Nu(r,t[0].id.clock);const o=Fa(t,r);lr(e.restEncoder,t.length-o),e.writeClient(n),lr(e.restEncoder,r);const i=t[o];i.write(e,r-i.id.clock);for(let s=o+1;s<t.length;s++)t[s].write(e,0)},t7=(e,t,n)=>{const r=new Map;n.forEach((o,i)=>{di(t,i)>o&&r.set(i,o)}),Wb(t).forEach((o,i)=>{n.has(i)||r.set(i,0)}),lr(e.restEncoder,r.size),Fu(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{e7(e,t.clients.get(o),o,i)})},n7=(e,t)=>t7(e,t.doc.store,t.beforeState),r7=class{constructor(){this.l=[]}},J3=()=>new r7,eS=(e,t)=>e.l.push(t),tS=(e,t)=>{const n=e.l,r=n.length;e.l=n.filter(o=>t!==o),r===e.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},nS=(e,t,n)=>Lb(e.l,[t,n]),mm=class{constructor(e,t){this.client=e,this.clock=t}},gm=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,zr=(e,t)=>new mm(e,t),o7=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw Pa()},i7=class{constructor(e,t){this.ds=e,this.sv=t}},s7=(e,t)=>new i7(e,t),EX=s7(qR(),new Map),$u=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!Y3(t.ds,e.id),Gb=(e,t)=>{const n=Du(e.meta,Gb,Ou),r=e.doc.store;n.has(t)||(t.sv.forEach((o,i)=>{o<di(r,i)&&El(e,zr(i,o))}),q3(e,t.ds,o=>{}),n.add(t))},a7=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},Wb=e=>{const t=new Map;return e.clients.forEach((n,r)=>{const o=n[n.length-1];t.set(r,o.id.clock+o.length)}),t},di=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},rS=(e,t)=>{let n=e.clients.get(t.id.client);if(n===void 0)n=[],e.clients.set(t.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==t.id.clock)throw Pa()}n.push(t)},Fa=(e,t)=>{let n=0,r=e.length-1,o=e[r],i=o.id.clock;if(i===t)return r;let s=Ma(t/(i+o.length-1)*r);for(;n<=r;){if(o=e[s],i=o.id.clock,i<=t){if(t<i+o.length)return s;n=s+1}else r=s-1;s=Ma((n+r)/2)}throw Pa()},l7=(e,t)=>{const n=e.clients.get(t.client);return n[Fa(n,t.clock)]},Kb=l7,qb=(e,t,n)=>{const r=Fa(t,n),o=t[r];return o.id.clock<n&&o instanceof Ri?(t.splice(r+1,0,LS(e,o,n-o.id.clock)),r+1):r},El=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[qb(e,n,t.clock)]},oS=(e,t,n)=>{const r=t.clients.get(n.client),o=Fa(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==xl&&r.splice(o+1,0,LS(e,i,n.clock-i.id.clock+1)),i},c7=(e,t,n)=>{const r=e.clients.get(t.id.client);r[Fa(r,t.id.clock)]=n},iS=(e,t,n,r,o)=>{if(r===0)return;const i=n+r;let s=qb(e,t,n),a;do a=t[s++],i<a.id.clock+a.length&&qb(e,t,i),o(a);while(s<t.length&&t[s].id.clock<i)},u7=class{constructor(e,t,n){this.doc=e,this.deleteSet=new K3,this.beforeState=Wb(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},sS=(e,t)=>t.deleteSet.clients.size===0&&!J6(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(X3(t.deleteSet),n7(e,t),YR(e,t.deleteSet),!0),aS=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&Du(e.changed,t,Ou).add(n)},vm=(e,t)=>{let n=e[t],r=e[t-1],o=t;for(;o>0;n=r,r=e[--o-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof Ri&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const i=t-o;return i&&e.splice(t+1-i,i),i},d7=(e,t,n)=>{for(const[r,o]of e.clients.entries()){const i=t.clients.get(r);for(let s=o.length-1;s>=0;s--){const a=o[s],l=a.clock+a.len;for(let u=Fa(i,a.clock),d=i[u];u<i.length&&d.id.clock<l;d=i[++u]){const f=i[u];if(a.clock+a.len<=f.id.clock)break;f instanceof Ri&&f.deleted&&!f.keep&&n(f)&&f.gc(t,!1)}}}},f7=(e,t)=>{e.clients.forEach((n,r)=>{const o=t.clients.get(r);for(let i=n.length-1;i>=0;i--){const s=n[i],a=o3(o.length-1,1+Fa(o,s.clock+s.len-1));for(let l=a,u=o[l];l>0&&u.id.clock>=s.clock;u=o[l])l-=1+vm(o,l)}})},lS=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{X3(i),n.afterState=Wb(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(d=>d.target._item===null||!d.target._item.deleted),l.forEach(d=>{d.currentTarget=u,d._path=null}),l.sort((d,f)=>d.path.length-f.path.length),a.push(()=>{nS(u._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&A7(n)})}),Lb(a,[])}finally{r.gc&&d7(i,o,r.gcFilter),f7(i,o),n.afterState.forEach((d,f)=>{const p=n.beforeState.get(f)||0;if(p!==d){const g=o.clients.get(f),m=Nu(Fa(g,p),1);for(let v=g.length-1;v>=m;)v-=1+vm(g,v)}});for(let d=s.length-1;d>=0;d--){const{client:f,clock:p}=s[d].id,g=o.clients.get(f),m=Fa(g,p);m+1<g.length&&vm(g,m+1)>1||m>0&&vm(g,m)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(HR(Ub,j3,"[yjs] ",V3,U3,"Changed the client-id because another client seems to be using it."),r.clientID=Q3()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new ZR;sS(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new JR;sS(d,n)&&r.emit("updateV2",[d.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=n;(a.size>0||u.size>0||l.size>0)&&(a.forEach(d=>{d.clientID=r.clientID,d.collectionid==null&&(d.collectionid=r.collectionid),r.subdocs.add(d)}),u.forEach(d=>r.subdocs.delete(d)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,n]),u.forEach(d=>d.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,e])):lS(e,t+1)}}},yr=(e,t,n=null,r=!0)=>{const o=e._transactionCleanups;let i=!1,s=null;e._transaction===null&&(i=!0,e._transaction=new u7(e,n,r),o.push(e._transaction),o.length===1&&e.emit("beforeAllTransactions",[e]),e.emit("beforeTransaction",[e._transaction,e]));try{s=t(e._transaction)}finally{if(i){const a=e._transaction===o[0];e._transaction=null,a&&lS(o,0)}}return s},cS="You must not compute changes after the event-handler fired.",ym=class{constructor(e,t){this.target=e,this.currentTarget=e,this.transaction=t,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=h7(this.currentTarget,this.target))}deletes(e){return Y3(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Il(cS);const e=new Map,t=this.target;this.transaction.changed.get(t).forEach(n=>{if(n!==null){const r=t._map.get(n);let o,i;if(this.adds(r)){let s=r.left;for(;s!==null&&this.adds(s);)s=s.left;if(this.deletes(r))if(s!==null&&this.deletes(s))o="delete",i=Cb(s.content.getContent());else return;else s!==null&&this.deletes(s)?(o="update",i=Cb(s.content.getContent())):(o="add",i=void 0)}else if(this.deletes(r))o="delete",i=Cb(r.content.getContent());else return;e.set(n,{action:o,oldValue:i})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw Il(cS);const t=this.target,n=Ou(),r=Ou(),o=[];if(e={added:n,deleted:r,delta:o,keys:this.keys},this.transaction.changed.get(t).has(null)){let i=null;const s=()=>{i&&o.push(i)};for(let a=t._start;a!==null;a=a.right)a.deleted?this.deletes(a)&&!this.adds(a)&&((i===null||i.delete===void 0)&&(s(),i={delete:0}),i.delete+=a.length,r.add(a)):this.adds(a)?((i===null||i.insert===void 0)&&(s(),i={insert:[]}),i.insert=i.insert.concat(a.content.getContent()),n.add(a)):((i===null||i.retain===void 0)&&(s(),i={retain:0}),i.retain+=a.length);i!==null&&i.retain===void 0&&s()}this._changes=e}return e}},h7=(e,t)=>{const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let r=0,o=t._item.parent._start;for(;o!==t._item&&o!==null;)!o.deleted&&o.countable&&(r+=o.length),o=o.right;n.unshift(r)}t=t._item.parent}return n},zo=()=>{GR("Invalid access: Add Yjs type to a document before reading data.")},uS=80,Yb=0,p7=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Yb++}},m7=e=>{e.timestamp=Yb++},dS=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=Yb++},g7=(e,t,n)=>{if(e.length>=uS){const r=e.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return dS(r,t,n),r}else{const r=new p7(t,n);return e.push(r),r}},bm=(e,t)=>{if(e._start===null||t===0||e._searchMarker===null)return null;const n=e._searchMarker.length===0?null:e._searchMarker.reduce((i,s)=>om(t-i.index)<om(t-s.index)?i:s);let r=e._start,o=0;for(n!==null&&(r=n.p,o=n.index,m7(n));r.right!==null&&o<t;){if(!r.deleted&&r.countable){if(t<o+r.length)break;o+=r.length}r=r.right}for(;r.left!==null&&o>t;)r=r.left,!r.deleted&&r.countable&&(o-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(o-=r.length);return n!==null&&om(n.index-o)<r.parent.length/uS?(dS(n,r,o),n):g7(e._searchMarker,r,o)},Wf=(e,t,n)=>{for(let r=e.length-1;r>=0;r--){const o=e[r];if(n>0){let i=o.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(o.index-=i.length);if(i===null||i.marker===!0){e.splice(r,1);continue}o.p=i,i.marker=!0}(t<o.index||n>0&&t===o.index)&&(o.index=Nu(t,o.index+n))}},wm=(e,t,n)=>{const r=e,o=t.changedParentTypes;for(;Du(o,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;nS(r._eH,n,t)},Eo=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=J3(),this._dEH=J3(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw gs()}clone(){throw gs()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,t){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){eS(this._eH,e)}observeDeep(e){eS(this._dEH,e)}unobserve(e){tS(this._eH,e)}unobserveDeep(e){tS(this._dEH,e)}toJSON(){}},fS=(e,t,n)=>{e.doc??zo(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t;const o=[];let i=e._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){const s=i.content.getContent();if(s.length<=t)t-=s.length;else{for(let a=t;a<s.length&&r>0;a++)o.push(s[a]),r--;t=0}}i=i.right}return o},hS=e=>{e.doc??zo();const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let o=0;o<r.length;o++)t.push(r[o])}n=n.right}return t},Kf=(e,t)=>{let n=0,r=e._start;for(e.doc??zo();r!==null;){if(r.countable&&!r.deleted){const o=r.content.getContent();for(let i=0;i<o.length;i++)t(o[i],n++,e)}r=r.right}},pS=(e,t)=>{const n=[];return Kf(e,(r,o)=>{n.push(t(r,o,e))}),n},v7=e=>{let t=e._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;t!==null&&t.deleted;)t=t.right;if(t===null)return{done:!0,value:void 0};n=t.content.getContent(),r=0,t=t.right}const o=n[r++];return n.length<=r&&(n=null),{done:!1,value:o}}}},mS=(e,t)=>{e.doc??zo();const n=bm(e,t);let r=e._start;for(n!==null&&(r=n.p,t-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(t<r.length)return r.content.getContent()[t];t-=r.length}},Cm=(e,t,n,r)=>{let o=n;const i=e.doc,s=i.clientID,a=i.store,l=n===null?t._start:n.right;let u=[];const d=()=>{u.length>0&&(o=new Ri(zr(s,di(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new r0(u)),o.integrate(e,0),u=[])};r.forEach(f=>{if(f===null)u.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(f);break;default:switch(d(),f.constructor){case Uint8Array:case ArrayBuffer:o=new Ri(zr(s,di(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new RS(new Uint8Array(f))),o.integrate(e,0);break;case Hb:o=new Ri(zr(s,di(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new MS(f)),o.integrate(e,0);break;default:if(f instanceof Eo)o=new Ri(zr(s,di(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Wu(f)),o.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},gS=()=>Il("Length exceeded!"),vS=(e,t,n,r)=>{if(n>t._length)throw gS();if(n===0)return t._searchMarker&&Wf(t._searchMarker,n,r.length),Cm(e,t,null,r);const o=n,i=bm(t,n);let s=t._start;for(i!==null&&(s=i.p,n-=i.index,n===0&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&El(e,zr(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&Wf(t._searchMarker,o,r.length),Cm(e,t,s,r)},y7=(e,t,n)=>{let r=(t._searchMarker||[]).reduce((o,i)=>i.index>o.index?i:o,{index:0,p:t._start}).p;if(r)for(;r.right;)r=r.right;return Cm(e,t,r,n)},yS=(e,t,n,r)=>{if(r===0)return;const o=n,i=r,s=bm(t,n);let a=t._start;for(s!==null&&(a=s.p,n-=s.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&El(e,zr(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&El(e,zr(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw gS();t._searchMarker&&Wf(t._searchMarker,o,-i+r)},km=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},Xb=(e,t,n,r)=>{const o=t._map.get(n)||null,i=e.doc,s=i.clientID;let a;if(r==null)a=new r0([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new r0([r]);break;case Uint8Array:a=new RS(r);break;case Hb:a=new MS(r);break;default:if(r instanceof Eo)a=new Wu(r);else throw new Error("Unexpected content type")}new Ri(zr(s,di(i.store,s)),o,o&&o.lastId,null,null,t,n,a).integrate(e,0)},Zb=(e,t)=>{e.doc??zo();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},bS=e=>{const t={};return e.doc??zo(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},wS=(e,t)=>{e.doc??zo();const n=e._map.get(t);return n!==void 0&&!n.deleted},b7=(e,t)=>{const n={};return e._map.forEach((r,o)=>{let i=r;for(;i!==null&&(!t.sv.has(i.id.client)||i.id.clock>=(t.sv.get(i.id.client)||0));)i=i.left;i!==null&&$u(i,t)&&(n[o]=i.content.getContent()[i.length-1])}),n},Sm=e=>(e.doc??zo(),WR(e._map.entries(),t=>!t[1].deleted)),w7=class extends ym{},C7=class sv extends Eo{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new sv;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new sv}clone(){const t=new sv;return t.insert(0,this.toArray().map(n=>n instanceof Eo?n.clone():n)),t}get length(){return this.doc??zo(),this._length}_callObserver(t,n){super._callObserver(t,n),wm(this,t,new w7(this,t))}insert(t,n){this.doc!==null?yr(this.doc,r=>{vS(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?yr(this.doc,n=>{y7(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?yr(this.doc,r=>{yS(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return mS(this,t)}toArray(){return hS(this)}slice(t=0,n=this.length){return fS(this,t,n)}toJSON(){return this.map(t=>t instanceof Eo?t.toJSON():t)}map(t){return pS(this,t)}forEach(t){Kf(this,t)}[Symbol.iterator](){return v7(this)}_write(t){t.writeTypeRef(P7)}},k7=class extends ym{constructor(e,t,n){super(e,t),this.keysChanged=n}},Qb=class u2 extends Eo{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.forEach((r,o)=>{this.set(o,r)}),this._prelimContent=null}_copy(){return new u2}clone(){const t=new u2;return this.forEach((n,r)=>{t.set(r,n instanceof Eo?n.clone():n)}),t}_callObserver(t,n){wm(this,t,new k7(this,t,n))}toJSON(){this.doc??zo();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];t[r]=o instanceof Eo?o.toJSON():o}}),t}get size(){return[...Sm(this)].length}keys(){return $b(Sm(this),t=>t[0])}values(){return $b(Sm(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return $b(Sm(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??zo(),this._map.forEach((n,r)=>{n.deleted||t(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?yr(this.doc,n=>{km(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?yr(this.doc,r=>{Xb(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return Zb(this,t)}has(t){return wS(this,t)}clear(){this.doc!==null?yr(this.doc,t=>{this.forEach(function(n,r,o){km(t,o,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(D7)}},Tl=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&q8(e,t),Jb=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){this.right===null&&Pa(),this.right.content.constructor===jo?this.right.deleted||Hu(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},CS=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===jo?t.right.deleted||Hu(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&El(e,zr(t.right.id.client,t.right.id.clock+n)),t.index+=t.right.length,n-=t.right.length),t.left=t.right,t.right=t.right.right;return t},_m=(e,t,n,r)=>{const o=new Map,i=r?bm(t,n):null;if(i){const s=new Jb(i.p.left,i.p,i.index,o);return CS(e,s,n-i.index)}else{const s=new Jb(null,t._start,0,o);return CS(e,s,n)}},kS=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===jo&&Tl(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const o=e.doc,i=o.clientID;r.forEach((s,a)=>{const l=n.left,u=n.right,d=new Ri(zr(i,di(o.store,i)),l,l&&l.lastId,u,u&&u.id,t,null,new jo(a,s));d.integrate(e,0),n.right=d,n.forward()})},Hu=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},SS=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===jo&&Tl(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},_S=(e,t,n,r)=>{const o=e.doc,i=o.clientID,s=new Map;for(const a in r){const l=r[a],u=n.currentAttributes.get(a)??null;if(!Tl(u,l)){s.set(a,u);const{left:d,right:f}=n;n.right=new Ri(zr(i,di(o.store,i)),d,d&&d.lastId,f,f&&f.id,t,null,new jo(a,l)),n.right.integrate(e,0),n.forward()}}return s},e0=(e,t,n,r,o)=>{n.currentAttributes.forEach((p,g)=>{o[g]===void 0&&(o[g]=null)});const i=e.doc,s=i.clientID;SS(n,o);const a=_S(e,t,n,o),l=r.constructor===String?new Gu(r):r instanceof Eo?new Wu(r):new Am(r);let{left:u,right:d,index:f}=n;t._searchMarker&&Wf(t._searchMarker,n.index,l.getLength()),d=new Ri(zr(s,di(i.store,s)),u,u&&u.lastId,d,d&&d.id,t,null,l),d.integrate(e,0),n.right=d,n.index=f,n.forward(),kS(e,t,n,a)},AS=(e,t,n,r,o)=>{const i=e.doc,s=i.clientID;SS(n,o);const a=_S(e,t,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===jo));){if(!n.right.deleted)switch(n.right.content.constructor){case jo:{const{key:l,value:u}=n.right.content,d=o[l];if(d!==void 0){if(Tl(d,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}n.right.delete(e)}else n.currentAttributes.set(l,u);break}default:r<n.right.length&&El(e,zr(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
|
|
7
7
|
`;n.right=new Ri(zr(s,di(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new Gu(l)),n.right.integrate(e,0),n.forward()}kS(e,t,n,a)},IS=(e,t,n,r,o)=>{let i=t;const s=qs();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===jo){const u=i.content;s.set(u.key,u)}i=i.right}let a=0,l=!1;for(;t!==i;){if(n===t&&(l=!0),!t.deleted){const u=t.content;if(u.constructor===jo){const{key:d,value:f}=u,p=r.get(d)??null;(s.get(d)!==u||p===f)&&(t.delete(e),a++,!l&&(o.get(d)??null)===f&&p!==f&&(p===null?o.delete(d):o.set(d,p))),!l&&!t.deleted&&Hu(o,u)}}t=t.right}return a},S7=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===jo){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},_7=e=>{let t=0;return yr(e.doc,n=>{let r=e._start,o=e._start,i=qs();const s=wb(i);for(;o;)o.deleted===!1&&(o.content.constructor===jo?Hu(s,o.content):(t+=IS(n,r,o,i,s),i=wb(s),r=o)),o=o.right}),t},A7=e=>{const t=new Set,n=e.doc;for(const[r,o]of e.afterState.entries()){const i=e.beforeState.get(r)||0;o!==i&&iS(e,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===jo&&s.constructor!==xl&&t.add(s.parent)})}yr(n,r=>{q3(e,e.deleteSet,o=>{if(o instanceof xl||!o.parent._hasFormatting||t.has(o.parent))return;const i=o.parent;o.content.constructor===jo?t.add(i):S7(r,o)});for(const o of t)_7(o)})},ES=(e,t,n)=>{const r=n,o=wb(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case Wu:case Am:case Gu:n<t.right.length&&El(e,zr(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&IS(e,i,t.right,o,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&Wf(s._searchMarker,t.index,-r+n),t},I7=class extends ym{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(r=>{r===null?this.childListChanged=!0:this.keysChanged.add(r)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];yr(e,n=>{const r=new Map,o=new Map;let i=this.target._start,s=null;const a={};let l="",u=0,d=0;const f=()=>{if(s!==null){let p=null;switch(s){case"delete":d>0&&(p={delete:d}),d=0;break;case"insert":(typeof l=="object"||l.length>0)&&(p={insert:l},r.size>0&&(p.attributes={},r.forEach((g,m)=>{g!==null&&(p.attributes[m]=g)}))),l="";break;case"retain":u>0&&(p={retain:u},K8(a)||(p.attributes=H8({},a))),u=0;break}p&&t.push(p),s=null}};for(;i!==null;){switch(i.content.constructor){case Wu:case Am:this.adds(i)?this.deletes(i)||(f(),s="insert",l=i.content.getContent()[0],f()):this.deletes(i)?(s!=="delete"&&(f(),s="delete"),d+=1):i.deleted||(s!=="retain"&&(f(),s="retain"),u+=1);break;case Gu:this.adds(i)?this.deletes(i)||(s!=="insert"&&(f(),s="insert"),l+=i.content.str):this.deletes(i)?(s!=="delete"&&(f(),s="delete"),d+=i.length):i.deleted||(s!=="retain"&&(f(),s="retain"),u+=i.length);break;case jo:{const{key:p,value:g}=i.content;if(this.adds(i)){if(!this.deletes(i)){const m=r.get(p)??null;Tl(m,g)?g!==null&&i.delete(n):(s==="retain"&&f(),Tl(g,o.get(p)??null)?delete a[p]:a[p]=g)}}else if(this.deletes(i)){o.set(p,g);const m=r.get(p)??null;Tl(m,g)||(s==="retain"&&f(),a[p]=m)}else if(!i.deleted){o.set(p,g);const m=a[p];m!==void 0&&(Tl(m,g)?m!==null&&i.delete(n):(s==="retain"&&f(),g===null?delete a[p]:a[p]=g))}i.deleted||(s==="insert"&&f(),Hu(r,i.content));break}}i=i.right}for(f();t.length>0;){const p=t[t.length-1];if(p.retain!==void 0&&p.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},E7=class d2 extends Eo{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??zo(),this._length}_integrate(t,n){super._integrate(t,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new d2}clone(){const t=new d2;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new I7(this,t,n);wm(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??zo();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===Gu&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?yr(this.doc,r=>{const o=new Jb(null,this._start,0,new Map);for(let i=0;i<t.length;i++){const s=t[i];if(s.insert!==void 0){const a=!n&&typeof s.insert=="string"&&i===t.length-1&&o.right===null&&s.insert.slice(-1)===`
|
|
@@ -104,10 +104,10 @@ js: import "konva/skia-backend";
|
|
|
104
104
|
`,iI=()=>{if(typeof document>"u")throw new Error(LV)},ws=class HT{constructor(t=[1,0,0,1,0,0]){this.dirty=!1,this.m=t&&t.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new HT(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){const n=this.m;return{x:n[0]*t.x+n[2]*t.y+n[4],y:n[1]*t.x+n[3]*t.y+n[5]}}translate(t,n){return this.m[4]+=this.m[0]*t+this.m[2]*n,this.m[5]+=this.m[1]*t+this.m[3]*n,this}scale(t,n){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=n,this.m[3]*=n,this}rotate(t){const n=Math.cos(t),r=Math.sin(t),o=this.m[0]*n+this.m[2]*r,i=this.m[1]*n+this.m[3]*r,s=this.m[0]*-r+this.m[2]*n,a=this.m[1]*-r+this.m[3]*n;return this.m[0]=o,this.m[1]=i,this.m[2]=s,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,n){const r=this.m[0]+this.m[2]*n,o=this.m[1]+this.m[3]*n,i=this.m[2]+this.m[0]*t,s=this.m[3]+this.m[1]*t;return this.m[0]=r,this.m[1]=o,this.m[2]=i,this.m[3]=s,this}multiply(t){const n=this.m[0]*t.m[0]+this.m[2]*t.m[1],r=this.m[1]*t.m[0]+this.m[3]*t.m[1],o=this.m[0]*t.m[2]+this.m[2]*t.m[3],i=this.m[1]*t.m[2]+this.m[3]*t.m[3],s=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],a=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this.m[4]=s,this.m[5]=a,this}invert(){const t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*t,r=-this.m[1]*t,o=-this.m[2]*t,i=this.m[0]*t,s=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this.m[4]=s,this.m[5]=a,this}getMatrix(){return this.m}decompose(){const t=this.m[0],n=this.m[1],r=this.m[2],o=this.m[3],i=this.m[4],s=this.m[5],a=t*o-n*r,l={x:i,y:s,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(t!=0||n!=0){const u=Math.sqrt(t*t+n*n);l.rotation=n>0?Math.acos(t/u):-Math.acos(t/u),l.scaleX=u,l.scaleY=a/u,l.skewX=(t*r+n*o)/a,l.skewY=0}else if(r!=0||o!=0){const u=Math.sqrt(r*r+o*o);l.rotation=Math.PI/2-(o>0?Math.acos(-r/u):-Math.acos(r/u)),l.scaleX=a/u,l.scaleY=u,l.skewX=0,l.skewY=(t*r+n*o)/a}return l.rotation=Fe._getRotation(l.rotation),l}},PV="[object Array]",DV="[object Number]",OV="[object String]",FV="[object Boolean]",NV=Math.PI/180,BV=180/Math.PI,uh="#",zV="",jV="0",VV="Konva warning: ",sI="Konva error: ",UV="rgb(",s1={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},$V=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,tg=[],dh=null,HV=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(e){setTimeout(e,16)},Fe={_isElement(e){return!!(e&&e.nodeType==1)},_isFunction(e){return!!(e&&e.constructor&&e.call&&e.apply)},_isPlainObject(e){return!!e&&e.constructor===Object},_isArray(e){return Object.prototype.toString.call(e)===PV},_isNumber(e){return Object.prototype.toString.call(e)===DV&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===OV},_isBoolean(e){return Object.prototype.toString.call(e)===FV},isObject(e){return e instanceof Object},isValidSelector(e){if(typeof e!="string")return!1;const t=e[0];return t==="#"||t==="."||t===t.toUpperCase()},_sign(e){return e===0||e>0?1:-1},requestAnimFrame(e){tg.push(e),tg.length===1&&HV(function(){const t=tg;tg=[],t.forEach(function(n){n()})})},createCanvasElement(){iI();const e=document.createElement("canvas");try{e.style=e.style||{}}catch{}return e},createImageElement(){return iI(),document.createElement("img")},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){const n=Fe.createImageElement();n.onload=function(){t(n)},n.src=e},_rgbToHex(e,t,n){return((1<<24)+(e<<16)+(t<<8)+n).toString(16).slice(1)},_hexToRgb(e){e=e.replace(uh,zV);const t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:t&255}},getRandomColor(){let e=(Math.random()*16777215<<0).toString(16);for(;e.length<6;)e=jV+e;return uh+e},isCanvasFarblingActive(){if(dh!==null)return dh;if(typeof document>"u")return dh=!1,!1;const e=this.createCanvasElement();e.width=10,e.height=10;const t=e.getContext("2d",{willReadFrequently:!0});t.clearRect(0,0,10,10),t.fillStyle="#282828",t.fillRect(0,0,10,10);const n=t.getImageData(0,0,10,10).data;let r=!1;for(let o=0;o<100;o++)if(n[o*4]!==40||n[o*4+1]!==40||n[o*4+2]!==40||n[o*4+3]!==255){r=!0;break}return dh=r,this.releaseCanvas(e),dh},getHitColor(){const e=this.getRandomColor();return this.isCanvasFarblingActive()?this.getSnappedHexColor(e):e},getHitColorKey(e,t,n){return this.isCanvasFarblingActive()&&(e=Math.round(e/5)*5,t=Math.round(t/5)*5,n=Math.round(n/5)*5),uh+this._rgbToHex(e,t,n)},getSnappedHexColor(e){const t=this._hexToRgb(e);return uh+this._rgbToHex(Math.round(t.r/5)*5,Math.round(t.g/5)*5,Math.round(t.b/5)*5)},getRGB(e){let t;return e in s1?(t=s1[e],{r:t[0],g:t[1],b:t[2]}):e[0]===uh?this._hexToRgb(e.substring(1)):e.substr(0,4)===UV?(t=$V.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA(e){return e=e||"black",Fe._namedColorToRBA(e)||Fe._hex3ColorToRGBA(e)||Fe._hex4ColorToRGBA(e)||Fe._hex6ColorToRGBA(e)||Fe._hex8ColorToRGBA(e)||Fe._rgbColorToRGBA(e)||Fe._rgbaColorToRGBA(e)||Fe._hslColorToRGBA(e)},_namedColorToRBA(e){const t=s1[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(e.indexOf("rgb(")===0){e=e.match(/rgb\(([^)]+)\)/)[1];const t=e.split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(e.indexOf("rgba(")===0){e=e.match(/rgba\(([^)]+)\)/)[1];const t=e.split(/ *, */).map((n,r)=>n.slice(-1)==="%"?r===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if(e[0]==="#"&&e.length===9)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if(e[0]==="#"&&e.length===7)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if(e[0]==="#"&&e.length===5)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if(e[0]==="#"&&e.length===4)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,o=Number(n[1])/100,i=Number(n[2])/100;let s,a,l;if(o===0)return l=i*255,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};i<.5?s=i*(1+o):s=i+o-i*o;const u=2*i-s,d=[0,0,0];for(let f=0;f<3;f++)a=r+1/3*-(f-1),a<0&&a++,a>1&&a--,6*a<1?l=u+(s-u)*6*a:2*a<1?l=s:3*a<2?l=u+(s-u)*(2/3-a)*6:l=u,d[f]=l*255;return{r:Math.round(d[0]),g:Math.round(d[1]),b:Math.round(d[2]),a:1}}},haveIntersection(e,t){return!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y)},cloneObject(e){const t={};for(const n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray(e){return e.slice(0)},degToRad(e){return e*NV},radToDeg(e){return e*BV},_degToRad(e){return Fe.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),Fe.degToRad(e)},_radToDeg(e){return Fe.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),Fe.radToDeg(e)},_getRotation(e){return Tt.angleDeg?Fe.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw new Error(sI+e)},error(e){console.error(sI+e)},warn(e){Tt.showWarnings&&console.warn(VV+e)},each(e,t){for(const n in e)t(n,e[n])},_inRange(e,t,n){return t<=e&&e<n},_getProjectionToSegment(e,t,n,r,o,i){let s,a,l;const u=(e-n)*(e-n)+(t-r)*(t-r);if(u==0)s=e,a=t,l=(o-n)*(o-n)+(i-r)*(i-r);else{const d=((o-e)*(n-e)+(i-t)*(r-t))/u;d<0?(s=e,a=t,l=(e-o)*(e-o)+(t-i)*(t-i)):d>1?(s=n,a=r,l=(n-o)*(n-o)+(r-i)*(r-i)):(s=e+d*(n-e),a=t+d*(r-t),l=(s-o)*(s-o)+(a-i)*(a-i))}return[s,a,l]},_getProjectionToLine(e,t,n){const r=Fe.cloneObject(e);let o=Number.MAX_VALUE;return t.forEach(function(i,s){if(!n&&s===t.length-1)return;const a=t[(s+1)%t.length],l=Fe._getProjectionToSegment(i.x,i.y,a.x,a.y,e.x,e.y),u=l[0],d=l[1],f=l[2];f<o&&(r.x=u,r.y=d,o=f)}),r},_prepareArrayForTween(e,t,n){const r=[],o=[];if(e.length>t.length){const s=t;t=e,e=s}for(let s=0;s<e.length;s+=2)r.push({x:e[s],y:e[s+1]});for(let s=0;s<t.length;s+=2)o.push({x:t[s],y:t[s+1]});const i=[];return o.forEach(function(s){const a=Fe._getProjectionToLine(s,r,n);i.push(a.x),i.push(a.y)}),i},_prepareToStringify(e){let t;e.visitedByCircularReferenceRemoval=!0;for(const n in e)if(e.hasOwnProperty(n)&&e[n]&&typeof e[n]=="object"){if(t=Object.getOwnPropertyDescriptor(e,n),e[n].visitedByCircularReferenceRemoval||Fe._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(Fe._prepareToStringify(e[n])===null)if(t.configurable)delete e[n];else return null}return delete e.visitedByCircularReferenceRemoval,e},_assign(e,t){for(const n in t)e[n]=t[n];return e},_getFirstPointerId(e){return e.touches?e.changedTouches[0].identifier:e.pointerId||999},releaseCanvas(...e){Tt.releaseCanvasOnDestroy&&e.forEach(t=>{t.width=0,t.height=0})},drawRoundedRectPath(e,t,n,r){let o=t<0?t:0,i=n<0?n:0;t=Math.abs(t),n=Math.abs(n);let s=0,a=0,l=0,u=0;typeof r=="number"?s=a=l=u=Math.min(r,t/2,n/2):(s=Math.min(r[0]||0,t/2,n/2),a=Math.min(r[1]||0,t/2,n/2),u=Math.min(r[2]||0,t/2,n/2),l=Math.min(r[3]||0,t/2,n/2)),e.moveTo(o+s,i),e.lineTo(o+t-a,i),e.arc(o+t-a,i+a,a,Math.PI*3/2,0,!1),e.lineTo(o+t,i+n-u),e.arc(o+t-u,i+n-u,u,0,Math.PI/2,!1),e.lineTo(o+l,i+n),e.arc(o+l,i+n-l,l,Math.PI/2,Math.PI,!1),e.lineTo(o,i+s),e.arc(o+s,i+s,s,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,t,n,r,o){r=Math.abs(r);for(let i=0;i<n;i++){const s=t[(i-1+n)%n],a=t[i],l=t[(i+1)%n],u={x:a.x-s.x,y:a.y-s.y},d={x:l.x-a.x,y:l.y-a.y},f=Math.hypot(u.x,u.y),p=Math.hypot(d.x,d.y);let g;typeof o=="number"?g=o:g=i<o.length?o[i]:0,g=r*Math.cos(Math.PI/n)*Math.min(1,g/r*2);const m={x:u.x/f,y:u.y/f},v={x:d.x/p,y:d.y/p},C={x:a.x-m.x*g,y:a.y-m.y*g},w={x:a.x+v.x*g,y:a.y+v.y*g};i===0?e.moveTo(C.x,C.y):e.lineTo(C.x,C.y),e.arcTo(a.x,a.y,w.x,w.y,g)}}};function GV(e){const t=[],n=e.length,r=Fe;for(let o=0;o<n;o++){let i=e[o];r._isNumber(i)?i=Math.round(i*1e3)/1e3:r._isString(i)||(i=i+""),t.push(i)}return t}var aI=",",WV="(",KV=")",qV="([",YV="])",XV=";",ZV="()",QV="=",lI=["arc","arcTo","beginPath","bezierCurveTo","clearRect","clip","closePath","createLinearGradient","createPattern","createRadialGradient","drawImage","ellipse","fill","fillText","getImageData","createImageData","lineTo","moveTo","putImageData","quadraticCurveTo","rect","roundRect","restore","rotate","save","scale","setLineDash","setTransform","stroke","strokeText","transform","translate"],JV=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],eU=100,ng=null;function cI(){if(ng!==null)return ng;try{const e=Fe.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(ng=!1,!1)}catch{return ng=!1,!1}}var rg=class{constructor(e){this.canvas=e,Tt.enableTrace&&(this.traceArr=[],this._enableTrace())}fillShape(e){e.fillEnabled()&&this._fill(e)}_fill(e){}strokeShape(e){e.hasStroke()&&this._stroke(e)}_stroke(e){}fillStrokeShape(e){e.attrs.fillAfterStrokeEnabled?(this.strokeShape(e),this.fillShape(e)):(this.fillShape(e),this.strokeShape(e))}getTrace(e,t){let n=this.traceArr,r=n.length,o="",i,s,a,l;for(i=0;i<r;i++)s=n[i],a=s.method,a?(l=s.args,o+=a,e?o+=ZV:Fe._isArray(l[0])?o+=qV+l.join(aI)+YV:(t&&(l=l.map(u=>typeof u=="number"?Math.floor(u):u)),o+=WV+l.join(aI)+KV)):(o+=s.property,e||(o+=QV+s.val)),o+=XV;return o}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=eU&&t.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){const t=e.attrs.lineCap;t&&this.setAttr("lineCap",t)}_applyOpacity(e){const t=e.getAbsoluteOpacity();t!==1&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){const t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}_applyMiterLimit(e){const t=e.attrs.miterLimit;t!=null&&this.setAttr("miterLimit",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,o,i){this._context.arc(e,t,n,r,o,i)}arcTo(e,t,n,r,o){this._context.arcTo(e,t,n,r,o)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,o,i){this._context.bezierCurveTo(e,t,n,r,o,i)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,t){const n=arguments;if(n.length===2)return this._context.createImageData(e,t);if(n.length===1)return this._context.createImageData(e)}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,o,i){return this._context.createRadialGradient(e,t,n,r,o,i)}drawImage(e,t,n,r,o,i,s,a,l){const u=arguments,d=this._context;u.length===3?d.drawImage(e,t,n):u.length===5?d.drawImage(e,t,n,r,o):u.length===9&&d.drawImage(e,t,n,r,o,i,s,a,l)}ellipse(e,t,n,r,o,i,s,a){this._context.ellipse(e,t,n,r,o,i,s,a)}isPointInPath(e,t,n,r){return n?this._context.isPointInPath(n,e,t,r):this._context.isPointInPath(e,t,r)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}roundRect(e,t,n,r,o){this._context.roundRect(e,t,n,r,o)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,o,i){this._context.setTransform(e,t,n,r,o,i)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,o,i){this._context.transform(e,t,n,r,o,i)}translate(e,t){this._context.translate(e,t)}_enableTrace(){let e=this,t=lI.length,n=this.setAttr,r,o;const i=function(s){let a=e[s],l;e[s]=function(){return o=GV(Array.prototype.slice.call(arguments,0)),l=a.apply(e,arguments),e._trace({method:s,args:o}),l}};for(r=0;r<t;r++)i(lI[r]);e.setAttr=function(){n.apply(e,arguments);const s=arguments[0];let a=arguments[1];(s==="shadowOffsetX"||s==="shadowOffsetY"||s==="shadowBlur")&&(a=a/this.canvas.getPixelRatio()),e._trace({property:s,val:a})}}_applyGlobalCompositeOperation(e){const t=e.attrs.globalCompositeOperation;!t||t==="source-over"||this.setAttr("globalCompositeOperation",t)}};JV.forEach(function(e){Object.defineProperty(rg.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var tU=class extends rg{constructor(e,{willReadFrequently:t=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:t})}_fillColor(e){const t=e.fill();this.setAttr("fillStyle",t),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){const t=e._getLinearGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fillRadialGradient(e){const t=e._getRadialGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fill(e){const t=e.fill(),n=e.getFillPriority();if(t&&n==="color"){this._fillColor(e);return}const r=e.getFillPatternImage();if(r&&n==="pattern"){this._fillPattern(e);return}const o=e.getFillLinearGradientColorStops();if(o&&n==="linear-gradient"){this._fillLinearGradient(e);return}const i=e.getFillRadialGradientColorStops();if(i&&n==="radial-gradient"){this._fillRadialGradient(e);return}t?this._fillColor(e):r?this._fillPattern(e):o?this._fillLinearGradient(e):i&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),o=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(let i=0;i<r.length;i+=2)o.addColorStop(r[i],r[i+1]);this.setAttr("strokeStyle",o)}}_stroke(e){const t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();const r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){var t,n,r;const o=(t=e.getShadowRGBA())!==null&&t!==void 0?t:"black",i=(n=e.getShadowBlur())!==null&&n!==void 0?n:5,s=(r=e.getShadowOffset())!==null&&r!==void 0?r:{x:0,y:0},a=e.getAbsoluteScale(),l=this.canvas.getPixelRatio(),u=a.x*l,d=a.y*l;this.setAttr("shadowColor",o),this.setAttr("shadowBlur",i*Math.min(Math.abs(u),Math.abs(d))),this.setAttr("shadowOffsetX",s.x*u),this.setAttr("shadowOffsetY",s.y*d)}},nU=class extends rg{constructor(e){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:!0})}_fill(e){this.save(),this.setAttr("fillStyle",e.colorKey),e._fillFuncHit(this),this.restore()}strokeShape(e){e.hasHitStroke()&&this._stroke(e)}_stroke(e){if(e.hasHitStroke()){const t=e.getStrokeScaleEnabled();if(!t){this.save();const o=this.getCanvas().getPixelRatio();this.setTransform(o,0,0,o,0,0)}this._applyLineCap(e);const n=e.hitStrokeWidth(),r=n==="auto"?e.strokeWidth():n;this.setAttr("lineWidth",r),this.setAttr("strokeStyle",e.colorKey),e._strokeFuncHit(this),t||this.restore()}}},og;function rU(){if(og)return og;const e=Fe.createCanvasElement(),t=e.getContext("2d");return og=(function(){return(Tt._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),Fe.releaseCanvas(e),og}var a1=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const t=(e||{}).pixelRatio||Tt.pixelRatio||rU();this.pixelRatio=t,this._canvas=Fe.createCanvasElement(),this._canvas.style.padding="0",this._canvas.style.margin="0",this._canvas.style.border="0",this._canvas.style.background="transparent",this._canvas.style.position="absolute",this._canvas.style.top="0",this._canvas.style.left="0"}getContext(){return this.context}getPixelRatio(){return this.pixelRatio}setPixelRatio(e){const t=this.pixelRatio;this.pixelRatio=e,this.setSize(this.getWidth()/t,this.getHeight()/t)}setWidth(e){this.width=this._canvas.width=e*this.pixelRatio,this._canvas.style.width=e+"px";const t=this.pixelRatio;this.getContext()._context.scale(t,t)}setHeight(e){this.height=this._canvas.height=e*this.pixelRatio,this._canvas.style.height=e+"px";const t=this.pixelRatio;this.getContext()._context.scale(t,t)}getWidth(){return this.width}getHeight(){return this.height}setSize(e,t){this.setWidth(e||0),this.setHeight(t||0)}toDataURL(e,t){try{return this._canvas.toDataURL(e,t)}catch{try{return this._canvas.toDataURL()}catch(r){return Fe.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}},Bl=class extends a1{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new tU(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},l1=class extends a1{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new nU(this),this.setSize(e.width,e.height)}},Vn={get isDragging(){let e=!1;return Vn._dragElements.forEach(t=>{t.dragStatus==="dragging"&&(e=!0)}),e},justDragged:!1,get node(){let e;return Vn._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const t=[];Vn._dragElements.forEach((n,r)=>{const{node:o}=n,i=o.getStage();i.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=Fe._getFirstPointerId(e));const s=i._changedPointerPositions.find(a=>a.id===n.pointerId);if(s){if(n.dragStatus!=="dragging"){const a=o.dragDistance();if(Math.max(Math.abs(s.x-n.startPointerPos.x),Math.abs(s.y-n.startPointerPos.y))<a||(o.startDrag({evt:e}),!o.isDragging()))return}o._setDragPosition(e,n),t.push(o)}}),t.forEach(n=>{n.getStage()&&n.fire("dragmove",{type:"dragmove",target:n,evt:e},!0)})},_endDragBefore(e){const t=[];Vn._dragElements.forEach(n=>{const{node:r}=n,o=r.getStage();if(e&&o.setPointersPositions(e),!o._changedPointerPositions.find(s=>s.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(Vn.justDragged=!0,Tt._mouseListenClick=!1,Tt._touchListenClick=!1,Tt._pointerListenClick=!1,n.dragStatus="stopped");const i=n.node.getLayer()||n.node instanceof Tt.Stage&&n.node;i&&t.indexOf(i)===-1&&t.push(i)}),t.forEach(n=>{n.draw()})},_endDragAfter(e){Vn._dragElements.forEach((t,n)=>{t.dragStatus==="stopped"&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),t.dragStatus!=="dragging"&&Vn._dragElements.delete(n)})}};Tt.isBrowser&&(window.addEventListener("mouseup",Vn._endDragBefore,!0),window.addEventListener("touchend",Vn._endDragBefore,!0),window.addEventListener("touchcancel",Vn._endDragBefore,!0),window.addEventListener("mousemove",Vn._drag),window.addEventListener("touchmove",Vn._drag),window.addEventListener("mouseup",Vn._endDragAfter,!1),window.addEventListener("touchend",Vn._endDragAfter,!1),window.addEventListener("touchcancel",Vn._endDragAfter,!1));function zl(e){return Fe._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||Fe._isBoolean(e)?e:Object.prototype.toString.call(e)}function uI(e){return e>255?255:e<0?0:Math.round(e)}function _t(){if(Tt.isUnminified)return function(e,t){return Fe._isNumber(e)||Fe.warn(zl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function ig(e){if(Tt.isUnminified)return function(t,n){let r=Fe._isNumber(t),o=Fe._isArray(t)&&t.length==e;return!r&&!o&&Fe.warn(zl(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function c1(){if(Tt.isUnminified)return function(e,t){return Fe._isNumber(e)||e==="auto"||Fe.warn(zl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function Bc(){if(Tt.isUnminified)return function(e,t){return Fe._isString(e)||Fe.warn(zl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function dI(){if(Tt.isUnminified)return function(e,t){const n=Fe._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||Fe.warn(zl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function oU(){if(Tt.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(Fe._isArray(e)?e.forEach(function(r){Fe._isNumber(r)||Fe.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):Fe.warn(zl(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}function Cs(){if(Tt.isUnminified)return function(e,t){return e===!0||e===!1||Fe.warn(zl(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function iU(e){if(Tt.isUnminified)return function(t,n){return t==null||Fe.isObject(t)||Fe.warn(zl(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var fh="get",hh="set",ge={addGetterSetter(e,t,n,r,o){ge.addGetter(e,t,n),ge.addSetter(e,t,r,o),ge.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){const r=fh+Fe._capitalize(t);e.prototype[r]=e.prototype[r]||function(){const o=this.attrs[t];return o===void 0?n:o}},addSetter(e,t,n,r){const o=hh+Fe._capitalize(t);e.prototype[o]||ge.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){const o=hh+Fe._capitalize(t);e.prototype[o]=function(i){return n&&i!==void 0&&i!==null&&(i=n.call(this,i,t)),this._setAttr(t,i),r&&r.call(this),this}},addComponentsGetterSetter(e,t,n,r,o){const i=n.length,s=Fe._capitalize,a=fh+s(t),l=hh+s(t);e.prototype[a]=function(){const d={};for(let f=0;f<i;f++){const p=n[f];d[p]=this.getAttr(t+s(p))}return d};const u=iU(n);e.prototype[l]=function(d){const f=this.attrs[t];r&&(d=r.call(this,d,t)),u&&u.call(this,d,t);for(const p in d)d.hasOwnProperty(p)&&this._setAttr(t+s(p),d[p]);return d||n.forEach(p=>{this._setAttr(t+s(p),void 0)}),this._fireChangeEvent(t,f,d),o&&o.call(this),this},ge.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){const n=Fe._capitalize(t),r=hh+n,o=fh+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(e,t,n,r){Fe.error("Adding deprecated "+t);const o=fh+Fe._capitalize(t),i=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[o]=function(){Fe.error(i);const s=this.attrs[t];return s===void 0?n:s},ge.addSetter(e,t,r,function(){Fe.error(i)}),ge.addOverloadedGetterSetter(e,t)},backCompat(e,t){Fe.each(t,function(n,r){const o=e.prototype[r],i=fh+Fe._capitalize(n),s=hh+Fe._capitalize(n);function a(){o.apply(this,arguments),Fe.error('"'+n+'" method is deprecated and will be removed soon. Use ""'+r+'" instead.')}e.prototype[n]=a,e.prototype[i]=a,e.prototype[s]=a})},afterSetFilter(){this._filterUpToDate=!1}};function sU(e){const t=/(\w+)\(([^)]+)\)/g;let n;for(;(n=t.exec(e))!==null;){const[,r,o]=n;switch(r){case"blur":{const i=parseFloat(o.replace("px",""));return function(s){this.blurRadius(i*.5);const a=Tt.Filters;a&&a.Blur&&a.Blur.call(this,s)}}case"brightness":{const i=o.includes("%")?parseFloat(o)/100:parseFloat(o);return function(s){this.brightness(i);const a=Tt.Filters;a&&a.Brightness&&a.Brightness.call(this,s)}}case"contrast":{const i=parseFloat(o);return function(s){const a=100*(Math.sqrt(i)-1);this.contrast(a);const l=Tt.Filters;l&&l.Contrast&&l.Contrast.call(this,s)}}case"grayscale":return function(i){const s=Tt.Filters;s&&s.Grayscale&&s.Grayscale.call(this,i)};case"sepia":return function(i){const s=Tt.Filters;s&&s.Sepia&&s.Sepia.call(this,i)};case"invert":return function(i){const s=Tt.Filters;s&&s.Invert&&s.Invert.call(this,i)};default:Fe.warn(`CSS filter "${r}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var sg="absoluteOpacity",fI="allEventListeners",$a="absoluteTransform",hI="absoluteScale",zc="canvas",aU="Change",lU="children",cU="konva",u1="listening",uU="mouseenter",dU="mouseleave",fU="pointerenter",hU="pointerleave",pU="touchenter",mU="touchleave",pI="set",mI="Shape",ag=" ",gI="stage",jl="transform",gU="Stage",d1="visible",vU=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(ag),yU=1,xt=class Jh{constructor(t){this._id=yU++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===jl||t===$a)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){let r=this._cache.get(t);return(r===void 0||(t===jl||t===$a)&&r.dirty===!0)&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const o=n.map(i=>i+"Change.konva").join(ag);this.on(o,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(zc)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===$a&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(zc)){const{scene:t,filter:n,hit:r}=this._cache.get(zc);Fe.releaseCanvas(t._canvas,n._canvas,r._canvas),this._cache.delete(zc)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){const n=t||{};let r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let o=Math.ceil(n.width||r.width),i=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,d=n.drawBorder||!1,f=n.hitCanvasPixelRatio||1;if(!o||!i){Fe.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const p=Math.abs(Math.round(r.x)-a)>.5?1:0,g=Math.abs(Math.round(r.y)-l)>.5?1:0;o+=u*2+p,i+=u*2+g,a-=u,l-=u;const m=new Bl({pixelRatio:s,width:o,height:i}),v=new Bl({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),C=new l1({pixelRatio:f,width:o,height:i}),w=m.getContext(),S=C.getContext(),y=new Bl({width:m.width/m.pixelRatio+Math.abs(a),height:m.height/m.pixelRatio+Math.abs(l),pixelRatio:m.pixelRatio}),k=y.getContext();return C.isCache=!0,m.isCache=!0,this._cache.delete(zc),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(m.getContext()._context.imageSmoothingEnabled=!1,v.getContext()._context.imageSmoothingEnabled=!1),w.save(),S.save(),k.save(),w.translate(-a,-l),S.translate(-a,-l),k.translate(-a,-l),y.x=a,y.y=l,this._isUnderCache=!0,this._clearSelfAndDescendantCache(sg),this._clearSelfAndDescendantCache(hI),this.drawScene(m,this,y),this.drawHit(C,this),this._isUnderCache=!1,w.restore(),S.restore(),d&&(w.save(),w.beginPath(),w.rect(0,0,o,i),w.closePath(),w.setAttr("strokeStyle","red"),w.setAttr("lineWidth",5),w.stroke(),w.restore()),Fe.releaseCanvas(y._canvas),this._cache.set(zc,{scene:m,filter:v,hit:C,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(zc)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){const r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];let o=1/0,i=1/0,s=-1/0,a=-1/0;const l=this.getAbsoluteTransform(n);return r.forEach(function(u){const d=l.point(u);o===void 0&&(o=s=d.x,i=a=d.y),o=Math.min(o,d.x),i=Math.min(i,d.y),s=Math.max(s,d.x),a=Math.max(a,d.y)}),{x:o,y:i,width:s-o,height:a-i}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);const r=this._getCachedSceneCanvas(),o=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/o,r.height/o),t.restore()}_drawCachedHitCanvas(t){const n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){let t=this.filters(),n=this._getCanvasCache(),r=n.scene,o=n.filter,i=o.getContext(),s,a,l,u;if(!t||t.length===0)return r;if(this._filterUpToDate)return o;let d=!0;for(let p=0;p<t.length;p++)if(typeof t[p]=="string"&&cI(),typeof t[p]!="string"||!cI()){d=!1;break}const f=r.pixelRatio;if(o.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio),d){const p=t.join(" ");return i.save(),i.setAttr("filter",p),i.drawImage(r._canvas,0,0,r.getWidth()/f,r.getHeight()/f),i.restore(),this._filterUpToDate=!0,o}try{for(s=t.length,i.clear(),i.drawImage(r._canvas,0,0,r.getWidth()/f,r.getHeight()/f),a=i.getImageData(0,0,o.getWidth(),o.getHeight()),l=0;l<s;l++)u=t[l],typeof u=="string"&&(u=sU(u)),u.call(this,a),i.putImageData(a,0,0)}catch(p){Fe.error("Unable to apply filter. "+p.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}return this._filterUpToDate=!0,o}on(...t){const n=t[0],r=t[1];if(t[2],this._cache&&this._cache.delete(fI),t.length===3)return this._delegate.apply(this,t);const o=n.split(ag);for(let i=0;i<o.length;i++){const s=o[i].split("."),a=s[0],l=s[1]||"";this.eventListeners[a]||(this.eventListeners[a]=[]),this.eventListeners[a].push({name:l,handler:r})}return this}off(t,n){let r=(t||"").split(ag),o=r.length,i,s,a,l,u,d;if(this._cache&&this._cache.delete(fI),!t)for(s in this.eventListeners)this._off(s);for(i=0;i<o;i++)if(a=r[i],l=a.split("."),u=l[0],d=l[1],u)this.eventListeners[u]&&this._off(u,d,n);else for(s in this.eventListeners)this._off(s,d,n);return this}dispatchEvent(t){const n={target:this,type:t.type,evt:t};return this.fire(t.type,n),this}addEventListener(t,n){return this.on(t,function(r){n.call(this,r.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,n,r){const o=this;return this.on(t,function(i){const s=i.target.findAncestors(n,!0,o);for(let a=0;a<s.length;a++)i=Fe.cloneObject(i),i.currentTarget=s[a],r.call(s[a],i)}),this}remove(){return this.isDragging()&&this.stopDrag(),Vn._dragElements.delete(this._id),Vn._dragElements.forEach((t,n)=>{this.isAncestorOf(t.node)&&Vn._dragElements.delete(n)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache($a),this._clearSelfAndDescendantCache(sg),this._clearSelfAndDescendantCache(hI),this._clearSelfAndDescendantCache(gI),this._clearSelfAndDescendantCache(d1),this._clearSelfAndDescendantCache(u1)}_remove(){this._clearCaches();const t=this.getParent();t&&t.children&&(t.children.splice(this.index,1),t._setChildrenIndices(),this.parent=null)}destroy(){return this.remove(),this.clearCache(),this}getAttr(t){const n="get"+Fe._capitalize(t);return Fe._isFunction(this[n])?this[n]():this.attrs[t]}getAncestors(){let t=this.getParent(),n=[];for(;t;)n.push(t),t=t.getParent();return n}getAttrs(){return this.attrs||{}}setAttrs(t){return this._batchTransformChanges(()=>{let n,r;if(!t)return this;for(n in t)n!==lU&&(r=pI+Fe._capitalize(n),Fe._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(u1,this._isListening)}_isListening(t){if(!this.listening())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isListening(t):!0}isVisible(){return this._getCache(d1,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);const r=this.getLayer();let o=!1;Vn._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(o=!0)});const i=!n&&!Tt.hitOnDragEnabled&&(o||Tt.isTransforming());return this.isListening()&&this.isVisible()&&!i}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){let t=this.getDepth(),n=this,r=0,o,i,s,a;function l(d){for(o=[],i=d.length,s=0;s<i;s++)a=d[s],r++,a.nodeType!==mI&&(o=o.concat(a.getChildren().slice())),a._id===n._id&&(s=i);o.length>0&&o[0].getDepth()<=t&&l(o)}const u=this.getStage();return n.nodeType!==gU&&u&&l(u.getChildren()),r}getDepth(){let t=0,n=this.parent;for(;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(jl),this._clearSelfAndDescendantCache($a)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){const t=this.getStage();if(!t)return null;const n=t.getPointerPosition();if(!n)return null;const r=this.getAbsoluteTransform().copy();return r.invert(),r.point(n)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);const o=this.getAbsoluteTransform(t).getMatrix(),i=new ws,s=this.offset();return i.m=o.slice(),i.translate(s.x,s.y),i.getTranslation()}setAbsolutePosition(t){const{x:n,y:r,...o}=this._clearTransform();this.attrs.x=n,this.attrs.y=r,this._clearCache(jl);const i=this._getAbsoluteTransform().copy();return i.invert(),i.translate(t.x,t.y),t={x:this.attrs.x+i.getTranslation().x,y:this.attrs.y+i.getTranslation().y},this._setTransform(o),this.setPosition({x:t.x,y:t.y}),this._clearCache(jl),this._clearSelfAndDescendantCache($a),this}_setTransform(t){let n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){const t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){let n=t.x,r=t.y,o=this.x(),i=this.y();return n!==void 0&&(o+=n),r!==void 0&&(i+=r),this.setPosition({x:o,y:i}),this}_eachAncestorReverse(t,n){let r=[],o=this.getParent(),i,s;if(!(n&&n._id===this._id)){for(r.unshift(this);o&&(!n||o._id!==n._id);)r.unshift(o),o=o.parent;for(i=r.length,s=0;s<i;s++)t(r[s])}}rotate(t){return this.rotation(this.rotation()+t),this}moveToTop(){if(!this.parent)return Fe.warn("Node has no parent. moveToTop function is ignored."),!1;const t=this.index;return t<this.parent.getChildren().length-1?(this.parent.children.splice(t,1),this.parent.children.push(this),this.parent._setChildrenIndices(),!0):!1}moveUp(){if(!this.parent)return Fe.warn("Node has no parent. moveUp function is ignored."),!1;const t=this.index;return t<this.parent.getChildren().length-1?(this.parent.children.splice(t,1),this.parent.children.splice(t+1,0,this),this.parent._setChildrenIndices(),!0):!1}moveDown(){if(!this.parent)return Fe.warn("Node has no parent. moveDown function is ignored."),!1;const t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return Fe.warn("Node has no parent. moveToBottom function is ignored."),!1;const t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return Fe.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Fe.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");const n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(sg,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){let t=this.opacity();const n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){let t=this.getAttrs(),n,r,o,i,s;const a={attrs:{},className:this.getClassName()};for(n in t)r=t[n],s=Fe.isObject(r)&&!Fe._isPlainObject(r)&&!Fe._isArray(r),!s&&(o=typeof this[n]=="function"&&this[n],delete t[n],i=o?o.call(this):null,t[n]=r,i!==r&&(a.attrs[n]=r));return Fe._prepareToStringify(a)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){const o=[];n&&this._isMatch(t)&&o.push(this);let i=this.parent;for(;i;){if(i===r)return o;i._isMatch(t)&&o.push(i),i=i.parent}return o}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);let n=t.replace(/ /g,"").split(","),r=n.length,o,i;for(o=0;o<r;o++)if(i=n[o],Fe.isValidSelector(i)||(Fe.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Fe.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Fe.warn("Konva is awesome, right?")),i.charAt(0)==="#"){if(this.id()===i.slice(1))return!0}else if(i.charAt(0)==="."){if(this.hasName(i.slice(1)))return!0}else if(this.className===i||this.nodeType===i)return!0;return!1}getLayer(){const t=this.getParent();return t?t.getLayer():null}getStage(){return this._getCache(gI,this._getStage)}_getStage(){const t=this.getParent();return t?t.getStage():null}fire(t,n={},r){return n.target=n.target||this,r?this._fireAndBubble(t,n):this._fire(t,n),this}getAbsoluteTransform(t){return t?this._getAbsoluteTransform(t):this._getCache($a,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let n;if(t)return n=new ws,this._eachAncestorReverse(function(r){const o=r.transformsEnabled();o==="all"?n.multiply(r.getTransform()):o==="position"&&n.translate(r.x()-r.offsetX(),r.y()-r.offsetY())},t),n;{n=this._cache.get($a)||new ws,this.parent?this.parent.getAbsoluteTransform().copyInto(n):n.reset();const r=this.transformsEnabled();if(r==="all")n.multiply(this.getTransform());else if(r==="position"){const o=this.attrs.x||0,i=this.attrs.y||0,s=this.attrs.offsetX||0,a=this.attrs.offsetY||0;n.translate(o-s,i-a)}return n.dirty=!1,n}}getAbsoluteScale(t){let n=this;for(;n;)n._isUnderCache&&(t=n),n=n.getParent();const r=this.getAbsoluteTransform(t).decompose();return{x:r.scaleX,y:r.scaleY}}getAbsoluteRotation(){return this.getAbsoluteTransform().decompose().rotation}getTransform(){return this._getCache(jl,this._getTransform)}_getTransform(){var t,n;const r=this._cache.get(jl)||new ws;r.reset();const o=this.x(),i=this.y(),s=Tt.getAngle(this.rotation()),a=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,l=(n=this.attrs.scaleY)!==null&&n!==void 0?n:1,u=this.attrs.skewX||0,d=this.attrs.skewY||0,f=this.attrs.offsetX||0,p=this.attrs.offsetY||0;return(o!==0||i!==0)&&r.translate(o,i),s!==0&&r.rotate(s),(u!==0||d!==0)&&r.skew(u,d),(a!==1||l!==1)&&r.scale(a,l),(f!==0||p!==0)&&r.translate(-1*f,-1*p),r.dirty=!1,r}clone(t){let n=Fe.cloneObject(this.attrs),r,o,i,s,a;for(r in t)n[r]=t[r];const l=new this.constructor(n);for(r in this.eventListeners)for(o=this.eventListeners[r],i=o.length,s=0;s<i;s++)a=o[s],a.name.indexOf(cU)<0&&(l.eventListeners[r]||(l.eventListeners[r]=[]),l.eventListeners[r].push(a));return l}_toKonvaCanvas(t){t=t||{};const n=this.getClientRect(),r=this.getStage(),o=t.x!==void 0?t.x:Math.floor(n.x),i=t.y!==void 0?t.y:Math.floor(n.y),s=t.pixelRatio||1,a=new Bl({width:t.width||Math.ceil(n.width)||(r?r.width():0),height:t.height||Math.ceil(n.height)||(r?r.height():0),pixelRatio:s}),l=a.getContext(),u=new Bl({width:a.width/a.pixelRatio+Math.abs(o),height:a.height/a.pixelRatio+Math.abs(i),pixelRatio:a.pixelRatio});return t.imageSmoothingEnabled===!1&&(l._context.imageSmoothingEnabled=!1),l.save(),(o||i)&&l.translate(-1*o,-1*i),this.drawScene(a,void 0,u),l.restore(),a}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};const n=t.mimeType||null,r=t.quality||null,o=this._toKonvaCanvas(t).toDataURL(n,r);return t.callback&&t.callback(o),o}toImage(t){return new Promise((n,r)=>{try{const o=t?.callback;o&&delete t.callback,Fe._urlToImage(this.toDataURL(t),function(i){n(i),o?.(i)})}catch(o){r(o)}})}toBlob(t){return new Promise((n,r)=>{try{const o=t?.callback;o&&delete t.callback,this.toCanvas(t).toBlob(i=>{n(i),o?.(i)},t?.mimeType,t?.quality)}catch(o){r(o)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():Tt.dragDistance}_off(t,n,r){let o=this.eventListeners[t],i,s,a;for(i=0;i<o.length;i++)if(s=o[i].name,a=o[i].handler,(s!=="konva"||n==="konva")&&(!n||s===n)&&(!r||r===a)){if(o.splice(i,1),o.length===0){delete this.eventListeners[t];break}i--}}_fireChangeEvent(t,n,r){this._fire(t+aU,{oldVal:n,newVal:r})}addName(t){if(!this.hasName(t)){const n=this.name(),r=n?n+" "+t:t;this.name(r)}return this}hasName(t){if(!t)return!1;const n=this.name();return n?(n||"").split(/\s/g).indexOf(t)!==-1:!1}removeName(t){const n=(this.name()||"").split(/\s/g),r=n.indexOf(t);return r!==-1&&(n.splice(r,1),this.name(n.join(" "))),this}setAttr(t,n){const r=this[pI+Fe._capitalize(t)];return Fe._isFunction(r)?r.call(this,n):this._setAttr(t,n),this}_requestDraw(){if(Tt.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,n){const r=this.attrs[t];r===n&&!Fe.isObject(n)||(n==null?delete this.attrs[t]:this.attrs[t]=n,this._shouldFireChangeEvents&&this._fireChangeEvent(t,r,n),this._requestDraw())}_setComponentAttr(t,n,r){let o;r!==void 0&&(o=this.attrs[t],o||(this.attrs[t]=this.getAttr(t)),this.attrs[t][n]=r,this._fireChangeEvent(t,o,r))}_fireAndBubble(t,n,r){n&&this.nodeType===mI&&(n.target=this);const o=[uU,dU,fU,hU,pU,mU];if(!(o.indexOf(t)!==-1&&(r&&(this===r||this.isAncestorOf&&this.isAncestorOf(r))||this.nodeType==="Stage"&&!r))){this._fire(t,n);const i=o.indexOf(t)!==-1&&r&&r.isAncestorOf&&r.isAncestorOf(this)&&!r.isAncestorOf(this.parent);(n&&!n.cancelBubble||!n)&&this.parent&&this.parent.isListening()&&!i&&(r&&r.parent?this._fireAndBubble.call(this.parent,t,n,r):this._fireAndBubble.call(this.parent,t,n))}}_getProtoListeners(t){var n,r;const{nodeType:o}=this,i=Jh.protoListenerMap.get(o)||{};let s=i?.[t];if(s===void 0){s=[];let a=Object.getPrototypeOf(this);for(;a;){const l=(r=(n=a.eventListeners)===null||n===void 0?void 0:n[t])!==null&&r!==void 0?r:[];s.push(...l),a=Object.getPrototypeOf(a)}i[t]=s,Jh.protoListenerMap.set(o,i)}return s}_fire(t,n){n=n||{},n.currentTarget=this,n.type=t;const r=this._getProtoListeners(t);if(r){const i=r.slice();for(let s=0;s<i.length;s++)i[s].handler.call(this,n)}const o=this.eventListeners[t];if(o){const i=o.slice(),s=i.length;for(let l=0;l<i.length;l++)i[l].handler.call(this,n);const a=this.eventListeners[t];if(a)for(let l=s;l<a.length;l++)a[l].handler.call(this,n)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){const n=t?t.pointerId:void 0,r=this.getStage(),o=this.getAbsolutePosition();if(!r)return;const i=r._getPointerById(n)||r._changedPointerPositions[0]||o;Vn._dragElements.set(this._id,{node:this,startPointerPos:i,offset:{x:i.x-o.x,y:i.y-o.y},dragStatus:"ready",pointerId:n,startEvent:t})}startDrag(t,n=!0){Vn._dragElements.has(this._id)||this._createDragElement(t);const r=Vn._dragElements.get(this._id);r.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:r.startEvent&&r.startEvent.evt||t&&t.evt},n)}_setDragPosition(t,n){const r=this.getStage()._getPointerById(n.pointerId);if(!r)return;let o={x:r.x-n.offset.x,y:r.y-n.offset.y};const i=this.dragBoundFunc();if(i!==void 0){const s=i.call(this,o,t);s?o=s:Fe.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==o.x||this._lastPos.y!==o.y)&&(this.setAbsolutePosition(o),this._requestDraw()),this._lastPos=o}stopDrag(t){const n=Vn._dragElements.get(this._id);n&&(n.dragStatus="stopped"),Vn._endDragBefore(t),Vn._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=Vn._dragElements.get(this._id);return t?t.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){if(!(t.evt.button===void 0||Tt.dragButtons.indexOf(t.evt.button)>=0)||this.isDragging())return;let n=!1;Vn._dragElements.forEach(r=>{this.isAncestorOf(r.node)&&(n=!0)}),n||this._createDragElement(t)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const t=Vn._dragElements.get(this._id),n=t&&t.dragStatus==="dragging",r=t&&t.dragStatus==="ready";n?this.stopDrag():r&&Vn._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return Fe.haveIntersection(r,this.getClientRect())}static create(t,n){return Fe._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){let r=Jh.prototype.getClassName.call(t),o=t.children,i,s,a;n&&(t.attrs.container=n),Tt[r]||(Fe.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=Tt[r];if(i=new l(t.attrs),o)for(s=o.length,a=0;a<s;a++)i.add(Jh._createNode(o[a]));return i}};xt.protoListenerMap=new Map,xt.prototype.nodeType="Node",xt.prototype._attrsAffectingSize=[],xt.prototype.eventListeners={},xt.prototype.on(vU,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(jl),this._clearSelfAndDescendantCache($a)}),xt.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(d1)}),xt.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(u1)}),xt.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(sg)});var cr=ge.addGetterSetter;cr(xt,"zIndex"),cr(xt,"absolutePosition"),cr(xt,"position"),cr(xt,"x",0,_t()),cr(xt,"y",0,_t()),cr(xt,"globalCompositeOperation","source-over",Bc()),cr(xt,"opacity",1,_t()),cr(xt,"name","",Bc()),cr(xt,"id","",Bc()),cr(xt,"rotation",0,_t()),ge.addComponentsGetterSetter(xt,"scale",["x","y"]),cr(xt,"scaleX",1,_t()),cr(xt,"scaleY",1,_t()),ge.addComponentsGetterSetter(xt,"skew",["x","y"]),cr(xt,"skewX",0,_t()),cr(xt,"skewY",0,_t()),ge.addComponentsGetterSetter(xt,"offset",["x","y"]),cr(xt,"offsetX",0,_t()),cr(xt,"offsetY",0,_t()),cr(xt,"dragDistance",void 0,_t()),cr(xt,"width",0,_t()),cr(xt,"height",0,_t()),cr(xt,"listening",!0,Cs()),cr(xt,"preventDefault",!0,Cs()),cr(xt,"filters",void 0,function(e){return this._filterUpToDate=!1,e}),cr(xt,"visible",!0,Cs()),cr(xt,"transformsEnabled","all",Bc()),cr(xt,"size"),cr(xt,"dragBoundFunc"),cr(xt,"draggable",!1,Cs()),ge.backCompat(xt,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var Pi=class extends xt{constructor(){super(...arguments),this.children=[]}getChildren(e){const t=this.children||[];return e?t.filter(e):t}hasChildren(){return this.getChildren().length>0}removeChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(e=>{e.parent=null,e.index=0,e.destroy()}),this.children=[],this._requestDraw(),this}add(...e){if(e.length===0)return this;if(e.length>1){for(let n=0;n<e.length;n++)this.add(e[n]);return this}const t=e[0];return t.getParent()?(t.moveTo(this),this):(this._validateAdd(t),t.index=this.getChildren().length,t.parent=this,t._clearCaches(),this.getChildren().push(t),this._fire("add",{child:t}),this._requestDraw(),this)}destroy(){return this.hasChildren()&&this.destroyChildren(),super.destroy(),this}find(e){return this._generalFind(e,!1)}findOne(e){const t=this._generalFind(e,!0);return t.length>0?t[0]:void 0}_generalFind(e,t){const n=[];return this._descendants(r=>{const o=r._isMatch(e);return o&&n.push(r),!!(o&&t)}),n}_descendants(e){let t=!1;const n=this.getChildren();for(const r of n){if(t=e(r),t)return!0;if(r.hasChildren()&&(t=r._descendants(e),t))return!0}return!1}toObject(){const e=xt.prototype.toObject.call(this);return e.children=[],this.getChildren().forEach(t=>{e.children.push(t.toObject())}),e}isAncestorOf(e){let t=e.getParent();for(;t;){if(t._id===this._id)return!0;t=t.getParent()}return!1}clone(e){const t=xt.prototype.clone.call(this,e);return this.getChildren().forEach(function(n){t.add(n.clone())}),t}getAllIntersections(e){const t=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),!this.isCached()&&((t=this.children)===null||t===void 0||t.forEach(function(n){n._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(t,n){t.index=n}),this._requestDraw()}drawScene(e,t,n){const r=this.getLayer(),o=e||r&&r.getCanvas(),i=o&&o.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=o&&o.isCache;if(!this.isVisible()&&!l)return this;if(a){i.save();const u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(i),i.restore()}else this._drawChildren("drawScene",o,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;const n=this.getLayer(),r=e||n&&n.hitCanvas,o=r&&r.getContext(),i=this._getCanvasCache();if(i&&i.hit){o.save();const s=this.getAbsoluteTransform(t).getMatrix();o.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n,r){var o;const i=t&&t.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=typeof s=="number"&&typeof a=="number"||l,d=n===this;if(u){i.save();const p=this.getAbsoluteTransform(n);let g=p.getMatrix();i.transform(g[0],g[1],g[2],g[3],g[4],g[5]),i.beginPath();let m;if(l)m=l.call(this,i,this);else{const v=this.clipX(),C=this.clipY();i.rect(v||0,C||0,s,a)}i.clip.apply(i,m),g=p.copy().invert().getMatrix(),i.transform(g[0],g[1],g[2],g[3],g[4],g[5])}const f=!d&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";f&&(i.save(),i._applyGlobalCompositeOperation(this)),(o=this.children)===null||o===void 0||o.forEach(function(p){p[e](t,n,r)}),f&&i.restore(),u&&i.restore()}getClientRect(e={}){var t;const n=e.skipTransform,r=e.relativeTo;let o,i,s,a,l={x:1/0,y:1/0,width:0,height:0};const u=this;(t=this.children)===null||t===void 0||t.forEach(function(p){if(!p.visible())return;const g=p.getClientRect({relativeTo:u,skipShadow:e.skipShadow,skipStroke:e.skipStroke});g.width===0&&g.height===0||(o===void 0?(o=g.x,i=g.y,s=g.x+g.width,a=g.y+g.height):(o=Math.min(o,g.x),i=Math.min(i,g.y),s=Math.max(s,g.x+g.width),a=Math.max(a,g.y+g.height)))});const d=this.find("Shape");let f=!1;for(let p=0;p<d.length;p++)if(d[p]._isVisible(this)){f=!0;break}return f&&o!==void 0?l={x:o,y:i,width:s-o,height:a-i}:l={x:0,y:0,width:0,height:0},n?l:this._transformedRect(l,r)}};ge.addComponentsGetterSetter(Pi,"clip",["x","y","width","height"]),ge.addGetterSetter(Pi,"clipX",void 0,_t()),ge.addGetterSetter(Pi,"clipY",void 0,_t()),ge.addGetterSetter(Pi,"clipWidth",void 0,_t()),ge.addGetterSetter(Pi,"clipHeight",void 0,_t()),ge.addGetterSetter(Pi,"clipFunc");var ph=new Map,vI=Tt._global.PointerEvent!==void 0;function f1(e){return ph.get(e)}function h1(e){return{evt:e,pointerId:e.pointerId}}function yI(e,t){return ph.get(e)===t}function bI(e,t){mh(e),t.getStage()&&(ph.set(e,t),vI&&t._fire("gotpointercapture",h1(new PointerEvent("gotpointercapture"))))}function mh(e,t){const n=ph.get(e);if(!n)return;const r=n.getStage();r&&r.content,ph.delete(e),vI&&n._fire("lostpointercapture",h1(new PointerEvent("lostpointercapture")))}var bU="Stage",wU="string",wI="px",CU="mouseout",CI="mouseleave",kI="mouseover",SI="mouseenter",_I="mousemove",AI="mousedown",II="mouseup",gh="pointermove",vh="pointerdown",cd="pointerup",yh="pointercancel",kU="lostpointercapture",lg="pointerout",bh="pointerleave",cg="pointerover",ug="pointerenter",p1="contextmenu",EI="touchstart",TI="touchend",xI="touchmove",RI="touchcancel",m1="wheel",SU=5,_U=[[SI,"_pointerenter"],[AI,"_pointerdown"],[_I,"_pointermove"],[II,"_pointerup"],[CI,"_pointerleave"],[EI,"_pointerdown"],[xI,"_pointermove"],[TI,"_pointerup"],[RI,"_pointercancel"],[kI,"_pointerover"],[m1,"_wheel"],[p1,"_contextmenu"],[vh,"_pointerdown"],[gh,"_pointermove"],[cd,"_pointerup"],[yh,"_pointercancel"],[bh,"_pointerleave"],[kU,"_lostpointercapture"]],g1={mouse:{[lg]:CU,[bh]:CI,[cg]:kI,[ug]:SI,[gh]:_I,[vh]:AI,[cd]:II,[yh]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[lg]:"touchout",[bh]:"touchleave",[cg]:"touchover",[ug]:"touchenter",[gh]:xI,[vh]:EI,[cd]:TI,[yh]:RI,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[lg]:lg,[bh]:bh,[cg]:cg,[ug]:ug,[gh]:gh,[vh]:vh,[cd]:cd,[yh]:yh,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},wh=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",ud=e=>{const t=wh(e);if(t==="pointer")return Tt.pointerEventsEnabled&&g1.pointer;if(t==="touch")return g1.touch;if(t==="mouse")return g1.mouse};function MI(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&Fe.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}var AU="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);",Ch=[],dg=class extends Pi{constructor(e){super(MI(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),Ch.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{MI(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t=e.getType()==="Layer",n=e.getType()==="FastLayer";t||n||Fe.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const e=this.visible()?"":"none";this.content.style.display=e}setContainer(e){if(typeof e===wU){let t;if(e.charAt(0)==="."){const n=e.slice(1);e=document.getElementsByClassName(n)[0]}else e.charAt(0)!=="#"?t=e:t=e.slice(1),e=document.getElementById(t);if(!e)throw"Can not find container in document with id "+t}return this._setAttr("container",e),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),e.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){const e=this.children,t=e.length;for(let n=0;n<t;n++)e[n].clear();return this}clone(e){return e||(e={}),e.container=typeof document<"u"&&document.createElement("div"),Pi.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&Fe._isInDocument(e)&&this.container().removeChild(e);const t=Ch.indexOf(this);return t>-1&&Ch.splice(t,1),Fe.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const e=this._pointerPositions[0]||this._changedPointerPositions[0];return e?{x:e.x,y:e.y}:(Fe.warn(AU),null)}_getPointerById(e){return this._pointerPositions.find(t=>t.id===e)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(e){e={...e},e.x=e.x||0,e.y=e.y||0,e.width=e.width||this.width(),e.height=e.height||this.height();const t=new Bl({width:e.width,height:e.height,pixelRatio:e.pixelRatio||1}),n=t.getContext()._context,r=this.children;return(e.x||e.y)&&n.translate(-1*e.x,-1*e.y),r.forEach(function(o){if(!o.isVisible())return;const i=o._toKonvaCanvas(e);n.drawImage(i._canvas,e.x,e.y,i.getWidth()/i.getPixelRatio(),i.getHeight()/i.getPixelRatio())}),t}getIntersection(e){if(!e)return null;const t=this.children,n=t.length-1;for(let r=n;r>=0;r--){const o=t[r].getIntersection(e);if(o)return o}return null}_resizeDOM(){const e=this.width(),t=this.height();this.content&&(this.content.style.width=e+wI,this.content.style.height=t+wI),this.bufferCanvas.setSize(e,t),this.bufferHitCanvas.setSize(e,t),this.children.forEach(n=>{n.setSize({width:e,height:t}),n.draw()})}add(e,...t){if(arguments.length>1){for(let r=0;r<arguments.length;r++)this.add(arguments[r]);return this}super.add(e);const n=this.children.length;return n>SU&&Fe.warn("The stage has "+n+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),e.setSize({width:this.width(),height:this.height()}),e.draw(),Tt.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return yI(e,this)}setPointerCapture(e){bI(e,this)}releaseCapture(e){mh(e,this)}getLayers(){return this.children}_bindContentEvents(){Tt.isBrowser&&_U.forEach(([e,t])=>{this.content.addEventListener(e,n=>{this[t](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const t=ud(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=ud(e.type);t&&this._fire(t.pointerover,{evt:e,target:this,currentTarget:this})}_getTargetShape(e){let t=this[e+"targetShape"];return t&&!t.getStage()&&(t=null),t}_pointerleave(e){const t=ud(e.type),n=wh(e.type);if(!t)return;this.setPointersPositions(e);const r=this._getTargetShape(n),o=!(Tt.isDragging()||Tt.isTransforming())||Tt.hitOnDragEnabled;r&&o?(r._fireAndBubble(t.pointerout,{evt:e}),r._fireAndBubble(t.pointerleave,{evt:e}),this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this[n+"targetShape"]=null):o&&(this._fire(t.pointerleave,{evt:e,target:this,currentTarget:this}),this._fire(t.pointerout,{evt:e,target:this,currentTarget:this})),this.pointerPos=null,this._pointerPositions=[]}_pointerdown(e){const t=ud(e.type),n=wh(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(o=>{const i=this.getIntersection(o);if(Vn.justDragged=!1,Tt["_"+n+"ListenClick"]=!0,!i||!i.isListening()){this[n+"ClickStartShape"]=void 0;return}Tt.capturePointerEventsEnabled&&i.setPointerCapture(o.id),this[n+"ClickStartShape"]=i,i._fireAndBubble(t.pointerdown,{evt:e,pointerId:o.id}),r=!0;const s=e.type.indexOf("touch")>=0;i.preventDefault()&&e.cancelable&&s&&e.preventDefault()}),r||this._fire(t.pointerdown,{evt:e,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}_pointermove(e){const t=ud(e.type),n=wh(e.type);if(!t)return;const r=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(Tt.isDragging()&&Vn.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(Tt.isDragging()||Tt.isTransforming())||Tt.hitOnDragEnabled))return;const o={};let i=!1;const s=this._getTargetShape(n);this._changedPointerPositions.forEach(a=>{const l=f1(a.id)||this.getIntersection(a),u=a.id,d={evt:e,pointerId:u},f=s!==l;if(f&&s&&(s._fireAndBubble(t.pointerout,{...d},l),s._fireAndBubble(t.pointerleave,{...d},l)),l){if(o[l._id])return;o[l._id]=!0}l&&l.isListening()?(i=!0,f&&(l._fireAndBubble(t.pointerover,{...d},s),l._fireAndBubble(t.pointerenter,{...d},s),this[n+"targetShape"]=l),l._fireAndBubble(t.pointermove,{...d})):s&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:u}),this[n+"targetShape"]=null)}),i||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=ud(e.type),n=wh(e.type);if(!t)return;this.setPointersPositions(e);const r=this[n+"ClickStartShape"],o=this[n+"ClickEndShape"],i={};let s=!1;this._changedPointerPositions.forEach(a=>{const l=f1(a.id)||this.getIntersection(a);if(l){if(l.releaseCapture(a.id),i[l._id])return;i[l._id]=!0}const u=a.id,d={evt:e,pointerId:u};let f=!1;Tt["_"+n+"InDblClickWindow"]?(f=!0,clearTimeout(this[n+"DblTimeout"])):Vn.justDragged||(Tt["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){Tt["_"+n+"InDblClickWindow"]=!1},Tt.dblClickWindow),l&&l.isListening()?(s=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,{...d}),Tt["_"+n+"ListenClick"]&&r&&r===l&&(l._fireAndBubble(t.pointerclick,{...d}),f&&o&&o===l&&l._fireAndBubble(t.pointerdblclick,{...d}))):(this[n+"ClickEndShape"]=null,s||(this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),s=!0),Tt["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:u}),f&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:u}))}),s||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),Tt["_"+n+"ListenClick"]=!1,e.cancelable&&n!=="touch"&&n!=="pointer"&&e.preventDefault()}_contextmenu(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(p1,{evt:e}):this._fire(p1,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(m1,{evt:e}):this._fire(m1,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=f1(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(cd,h1(e)),mh(e.pointerId)}_lostpointercapture(e){mh(e.pointerId)}setPointersPositions(e){const t=this._getContentPosition();let n=null,r=null;e=e||window.event,e.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(e.touches,o=>{this._pointerPositions.push({id:o.identifier,x:(o.clientX-t.left)/t.scaleX,y:(o.clientY-t.top)/t.scaleY})}),Array.prototype.forEach.call(e.changedTouches||e.touches,o=>{this._changedPointerPositions.push({id:o.identifier,x:(o.clientX-t.left)/t.scaleX,y:(o.clientY-t.top)/t.scaleY})})):(n=(e.clientX-t.left)/t.scaleX,r=(e.clientY-t.top)/t.scaleY,this.pointerPos={x:n,y:r},this._pointerPositions=[{x:n,y:r,id:Fe._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:Fe._getFirstPointerId(e)}])}_setPointerPosition(e){Fe.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(e)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};const e=this.content.getBoundingClientRect();return{top:e.top,left:e.left,scaleX:e.width/this.content.clientWidth||1,scaleY:e.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new Bl({width:this.width(),height:this.height()}),this.bufferHitCanvas=new l1({pixelRatio:1,width:this.width(),height:this.height()}),!Tt.isBrowser)return;const e=this.container();if(!e)throw"Stage has no container. A container is required.";e.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),e.appendChild(this.content),this._resizeDOM()}cache(){return Fe.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(e){e.batchDraw()}),this}};dg.prototype.nodeType=bU,xr(dg),ge.addGetterSetter(dg,"container"),Tt.isBrowser&&document.addEventListener("visibilitychange",()=>{Ch.forEach(e=>{e.batchDraw()})});var LI="hasShadow",PI="shadowRGBA",DI="patternImage",OI="linearGradient",FI="radialGradient",fg;function v1(){return fg||(fg=Fe.createCanvasElement().getContext("2d"),fg)}var kh={};function IU(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function EU(e){e.stroke()}function TU(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function xU(e){e.stroke()}function RU(){this._clearCache(LI)}function MU(){this._clearCache(PI)}function LU(){this._clearCache(DI)}function PU(){this._clearCache(OI)}function DU(){this._clearCache(FI)}var wt=class extends xt{constructor(e){super(e);let t,n=0;for(;t=Fe.getHitColor(),!(t&&!(t in kh));)if(n++,n>=1e4){Fe.warn("Failed to find a unique color key for a shape. Konva may work incorrectly. Most likely your browser is using canvas farbling. Consider disabling it."),t=Fe.getRandomColor();break}this.colorKey=t,kh[t]=this}getContext(){return Fe.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return Fe.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(LI,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(DI,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=v1().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new ws;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(Tt.getAngle(this.fillPatternRotation())),t.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),t.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const n=t.getMatrix(),r=typeof DOMMatrix>"u"?{a:n[0],b:n[1],c:n[2],d:n[3],e:n[4],f:n[5]}:new DOMMatrix(n);e.setTransform(r)}return e}}_getLinearGradient(){return this._getCache(OI,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=v1(),n=this.fillLinearGradientStartPoint(),r=this.fillLinearGradientEndPoint(),o=t.createLinearGradient(n.x,n.y,r.x,r.y);for(let i=0;i<e.length;i+=2)o.addColorStop(e[i],e[i+1]);return o}}_getRadialGradient(){return this._getCache(FI,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const t=v1(),n=this.fillRadialGradientStartPoint(),r=this.fillRadialGradientEndPoint(),o=t.createRadialGradient(n.x,n.y,this.fillRadialGradientStartRadius(),r.x,r.y,this.fillRadialGradientEndRadius());for(let i=0;i<e.length;i+=2)o.addColorStop(e[i],e[i+1]);return o}}getShadowRGBA(){return this._getCache(PI,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=Fe.colorToRGBA(this.shadowColor());if(e)return"rgba("+e.r+","+e.g+","+e.b+","+e.a*(this.shadowOpacity()||1)+")"}hasFill(){return this._calculate("hasFill",["fillEnabled","fill","fillPatternImage","fillLinearGradientColorStops","fillRadialGradientColorStops"],()=>this.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const e=this.hitStrokeWidth();return e==="auto"?this.hasStroke():this.strokeEnabled()&&!!e}intersects(e){const t=this.getStage();if(!t)return!1;const n=t.bufferHitCanvas;return n.getContext().clear(),this.drawHit(n,void 0,!0),n.context.getImageData(Math.round(e.x),Math.round(e.y),1,1).data[3]>0}destroy(){return xt.prototype.destroy.call(this),delete kh[this.colorKey],delete this.colorKey,this}_useBufferCanvas(e){var t;if(!(!((t=this.attrs.perfectDrawEnabled)!==null&&t!==void 0)||t))return!1;const n=e||this.hasFill(),r=this.hasStroke(),o=this.getAbsoluteOpacity()!==1;if(n&&r&&o)return!0;const i=this.hasShadow(),s=this.shadowForStrokeEnabled();return!!(n&&r&&i&&s)}setStrokeHitEnabled(e){Fe.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}const r=e.skipTransform,o=e.relativeTo||t&&this.getStage()||void 0,i=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,a=i.width+s,l=i.height+s,u=!e.skipShadow&&this.hasShadow(),d=u?this.shadowOffsetX():0,f=u?this.shadowOffsetY():0,p=a+Math.abs(d),g=l+Math.abs(f),m=u&&this.shadowBlur()||0,v={width:p+m*2,height:g+m*2,x:-(s/2+m)+Math.min(d,0)+i.x,y:-(s/2+m)+Math.min(f,0)+i.y};return r?v:this._transformedRect(v,o)}drawScene(e,t,n){const r=this.getLayer(),o=(e||r.getCanvas()).getContext(),i=this._getCanvasCache(),s=this.getSceneFunc(),a=this.hasShadow();let l;const u=t===this;if(!this.isVisible()&&!u)return this;if(i){o.save();const d=this.getAbsoluteTransform(t).getMatrix();return o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),this._useBufferCanvas()){l=this.getStage();const d=n||l.bufferCanvas,f=d.getContext();n?(f.save(),f.setTransform(1,0,0,1,0,0),f.clearRect(0,0,d.width,d.height),f.restore()):f.clear(),f.save(),f._applyLineJoin(this),f._applyMiterLimit(this);const p=this.getAbsoluteTransform(t).getMatrix();f.transform(p[0],p[1],p[2],p[3],p[4],p[5]),s.call(this,f,this),f.restore();const g=d.pixelRatio;a&&o._applyShadow(this),u||(o._applyOpacity(this),o._applyGlobalCompositeOperation(this)),o.drawImage(d._canvas,d.x||0,d.y||0,d.width/g,d.height/g)}else{if(o._applyLineJoin(this),o._applyMiterLimit(this),!u){const d=this.getAbsoluteTransform(t).getMatrix();o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}a&&o._applyShadow(this),s.call(this,o,this)}return o.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;const r=this.getLayer(),o=e||r.hitCanvas,i=o&&o.getContext(),s=this.hitFunc()||this.sceneFunc(),a=this._getCanvasCache(),l=a&&a.hit;if(this.colorKey||Fe.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),l){i.save();const u=this.getAbsoluteTransform(t).getMatrix();return i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedHitCanvas(i),i.restore(),this}if(!s)return this;if(i.save(),i._applyLineJoin(this),i._applyMiterLimit(this),this!==t){const u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return s.call(this,i,this),i.restore(),this}drawHitFromCache(e=0){const t=this._getCanvasCache(),n=this._getCachedSceneCanvas(),r=t.hit,o=r.getContext(),i=r.getWidth(),s=r.getHeight();o.clear(),o.drawImage(n._canvas,0,0,i,s);try{const a=o.getImageData(0,0,i,s),l=a.data,u=l.length,d=Fe._hexToRgb(this.colorKey);for(let f=0;f<u;f+=4)l[f+3]>e?(l[f]=d.r,l[f+1]=d.g,l[f+2]=d.b,l[f+3]=255):l[f+3]=0;o.putImageData(a,0,0)}catch(a){Fe.error("Unable to draw hit graph from cached scene canvas. "+a.message)}return this}hasPointerCapture(e){return yI(e,this)}setPointerCapture(e){bI(e,this)}releaseCapture(e){mh(e,this)}};wt.prototype._fillFunc=IU,wt.prototype._strokeFunc=EU,wt.prototype._fillFuncHit=TU,wt.prototype._strokeFuncHit=xU,wt.prototype._centroid=!1,wt.prototype.nodeType="Shape",xr(wt),wt.prototype.eventListeners={},wt.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",RU),wt.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",MU),wt.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",LU),wt.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",PU),wt.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",DU),ge.addGetterSetter(wt,"stroke",void 0,dI()),ge.addGetterSetter(wt,"strokeWidth",2,_t()),ge.addGetterSetter(wt,"fillAfterStrokeEnabled",!1),ge.addGetterSetter(wt,"hitStrokeWidth","auto",c1()),ge.addGetterSetter(wt,"strokeHitEnabled",!0,Cs()),ge.addGetterSetter(wt,"perfectDrawEnabled",!0,Cs()),ge.addGetterSetter(wt,"shadowForStrokeEnabled",!0,Cs()),ge.addGetterSetter(wt,"lineJoin"),ge.addGetterSetter(wt,"lineCap"),ge.addGetterSetter(wt,"miterLimit"),ge.addGetterSetter(wt,"sceneFunc"),ge.addGetterSetter(wt,"hitFunc"),ge.addGetterSetter(wt,"dash"),ge.addGetterSetter(wt,"dashOffset",0,_t()),ge.addGetterSetter(wt,"shadowColor",void 0,Bc()),ge.addGetterSetter(wt,"shadowBlur",0,_t()),ge.addGetterSetter(wt,"shadowOpacity",1,_t()),ge.addComponentsGetterSetter(wt,"shadowOffset",["x","y"]),ge.addGetterSetter(wt,"shadowOffsetX",0,_t()),ge.addGetterSetter(wt,"shadowOffsetY",0,_t()),ge.addGetterSetter(wt,"fillPatternImage"),ge.addGetterSetter(wt,"fill",void 0,dI()),ge.addGetterSetter(wt,"fillPatternX",0,_t()),ge.addGetterSetter(wt,"fillPatternY",0,_t()),ge.addGetterSetter(wt,"fillLinearGradientColorStops"),ge.addGetterSetter(wt,"strokeLinearGradientColorStops"),ge.addGetterSetter(wt,"fillRadialGradientStartRadius",0),ge.addGetterSetter(wt,"fillRadialGradientEndRadius",0),ge.addGetterSetter(wt,"fillRadialGradientColorStops"),ge.addGetterSetter(wt,"fillPatternRepeat","repeat"),ge.addGetterSetter(wt,"fillEnabled",!0),ge.addGetterSetter(wt,"strokeEnabled",!0),ge.addGetterSetter(wt,"shadowEnabled",!0),ge.addGetterSetter(wt,"dashEnabled",!0),ge.addGetterSetter(wt,"strokeScaleEnabled",!0),ge.addGetterSetter(wt,"fillPriority","color"),ge.addComponentsGetterSetter(wt,"fillPatternOffset",["x","y"]),ge.addGetterSetter(wt,"fillPatternOffsetX",0,_t()),ge.addGetterSetter(wt,"fillPatternOffsetY",0,_t()),ge.addComponentsGetterSetter(wt,"fillPatternScale",["x","y"]),ge.addGetterSetter(wt,"fillPatternScaleX",1,_t()),ge.addGetterSetter(wt,"fillPatternScaleY",1,_t()),ge.addComponentsGetterSetter(wt,"fillLinearGradientStartPoint",["x","y"]),ge.addComponentsGetterSetter(wt,"strokeLinearGradientStartPoint",["x","y"]),ge.addGetterSetter(wt,"fillLinearGradientStartPointX",0),ge.addGetterSetter(wt,"strokeLinearGradientStartPointX",0),ge.addGetterSetter(wt,"fillLinearGradientStartPointY",0),ge.addGetterSetter(wt,"strokeLinearGradientStartPointY",0),ge.addComponentsGetterSetter(wt,"fillLinearGradientEndPoint",["x","y"]),ge.addComponentsGetterSetter(wt,"strokeLinearGradientEndPoint",["x","y"]),ge.addGetterSetter(wt,"fillLinearGradientEndPointX",0),ge.addGetterSetter(wt,"strokeLinearGradientEndPointX",0),ge.addGetterSetter(wt,"fillLinearGradientEndPointY",0),ge.addGetterSetter(wt,"strokeLinearGradientEndPointY",0),ge.addComponentsGetterSetter(wt,"fillRadialGradientStartPoint",["x","y"]),ge.addGetterSetter(wt,"fillRadialGradientStartPointX",0),ge.addGetterSetter(wt,"fillRadialGradientStartPointY",0),ge.addComponentsGetterSetter(wt,"fillRadialGradientEndPoint",["x","y"]),ge.addGetterSetter(wt,"fillRadialGradientEndPointX",0),ge.addGetterSetter(wt,"fillRadialGradientEndPointY",0),ge.addGetterSetter(wt,"fillPatternRotation",0),ge.addGetterSetter(wt,"fillRule",void 0,Bc()),ge.backCompat(wt,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var OU="beforeDraw",FU="draw",NI=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],NU=NI.length,jc=class extends Pi{constructor(e){super(e),this.canvas=new Bl,this.hitCanvas=new l1({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(e){return this.getContext().clear(e),this.getHitCanvas().getContext().clear(e),this}setZIndex(e){super.setZIndex(e);const t=this.getStage();return t&&t.content&&(t.content.removeChild(this.getNativeCanvasElement()),e<t.children.length-1?t.content.insertBefore(this.getNativeCanvasElement(),t.children[e+1].getCanvas()._canvas):t.content.appendChild(this.getNativeCanvasElement())),this}moveToTop(){xt.prototype.moveToTop.call(this);const e=this.getStage();return e&&e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.appendChild(this.getNativeCanvasElement())),!0}moveUp(){if(!xt.prototype.moveUp.call(this))return!1;const e=this.getStage();return!e||!e.content?!1:(e.content.removeChild(this.getNativeCanvasElement()),this.index<e.children.length-1?e.content.insertBefore(this.getNativeCanvasElement(),e.children[this.index+1].getCanvas()._canvas):e.content.appendChild(this.getNativeCanvasElement()),!0)}moveDown(){if(xt.prototype.moveDown.call(this)){const e=this.getStage();if(e){const t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[this.index+1].getCanvas()._canvas))}return!0}return!1}moveToBottom(){if(xt.prototype.moveToBottom.call(this)){const e=this.getStage();if(e){const t=e.children;e.content&&(e.content.removeChild(this.getNativeCanvasElement()),e.content.insertBefore(this.getNativeCanvasElement(),t[1].getCanvas()._canvas))}return!0}return!1}getLayer(){return this}remove(){const e=this.getNativeCanvasElement();return xt.prototype.remove.call(this),e&&e.parentNode&&Fe._isInDocument(e)&&e.parentNode.removeChild(e),this}getStage(){return this.parent}setSize({width:e,height:t}){return this.canvas.setSize(e,t),this.hitCanvas.setSize(e,t),this._setSmoothEnabled(),this}_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&Fe.throw("You may only add groups and shapes to a layer.")}_toKonvaCanvas(e){return e={...e},e.width=e.width||this.getWidth(),e.height=e.height||this.getHeight(),e.x=e.x!==void 0?e.x:this.x(),e.y=e.y!==void 0?e.y:this.y(),xt.prototype._toKonvaCanvas.call(this,e)}_checkVisibility(){this.visible()?this.canvas._canvas.style.display="block":this.canvas._canvas.style.display="none"}_setSmoothEnabled(){this.getContext()._context.imageSmoothingEnabled=this.imageSmoothingEnabled()}getWidth(){if(this.parent)return this.parent.width()}setWidth(){Fe.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Fe.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Fe.requestAnimFrame(()=>{this.draw(),this._waitingForDraw=!1})),this}getIntersection(e){if(!this.isListening()||!this.isVisible())return null;let t=1,n=!1;for(;;){for(let r=0;r<NU;r++){const o=NI[r],i=this._getIntersection({x:e.x+o.x*t,y:e.y+o.y*t}),s=i.shape;if(s)return s;if(n=!!i.antialiased,!i.antialiased)break}if(n)t+=1;else return null}}_getIntersection(e){const t=this.hitCanvas.pixelRatio,n=this.hitCanvas.context.getImageData(Math.round(e.x*t),Math.round(e.y*t),1,1).data,r=n[3];if(r===255){const o=kh[Fe.getHitColorKey(n[0],n[1],n[2])];return o?{shape:o}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(e,t,n){const r=this.getLayer(),o=e||r&&r.getCanvas();return this._fire(OU,{node:this}),this.clearBeforeDraw()&&o.getContext().clear(),Pi.prototype.drawScene.call(this,o,t,n),this._fire(FU,{node:this}),this}drawHit(e,t){const n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Pi.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Fe.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Fe.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!this.parent||!this.parent.content)return;const e=this.parent;this.hitCanvas._canvas.parentNode?e.content.removeChild(this.hitCanvas._canvas):e.content.appendChild(this.hitCanvas._canvas)}destroy(){return Fe.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};jc.prototype.nodeType="Layer",xr(jc),ge.addGetterSetter(jc,"imageSmoothingEnabled",!0),ge.addGetterSetter(jc,"clearBeforeDraw",!0),ge.addGetterSetter(jc,"hitGraphEnabled",!0,Cs());var y1=class extends jc{constructor(e){super(e),this.listening(!1),Fe.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};y1.prototype.nodeType="FastLayer",xr(y1);var dd=class extends Pi{_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&Fe.throw("You may only add groups and shapes to groups.")}};dd.prototype.nodeType="Group",xr(dd);var b1=(function(){return Nc.performance&&Nc.performance.now?function(){return Nc.performance.now()}:function(){return new Date().getTime()}})(),fd=class Wd{constructor(t,n){this.id=Wd.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:b1(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){let n=[];return t&&(n=Array.isArray(t)?t:[t]),this.layers=n,this}getLayers(){return this.layers}addLayer(t){const n=this.layers,r=n.length;for(let o=0;o<r;o++)if(n[o]._id===t._id)return!1;return this.layers.push(t),!0}isRunning(){const t=Wd.animations,n=t.length;for(let r=0;r<n;r++)if(t[r].id===this.id)return!0;return!1}start(){return this.stop(),this.frame.timeDiff=0,this.frame.lastTime=b1(),Wd._addAnimation(this),this}stop(){return Wd._removeAnimation(this),this}_updateFrameObject(t){this.frame.timeDiff=t-this.frame.lastTime,this.frame.lastTime=t,this.frame.time+=this.frame.timeDiff,this.frame.frameRate=1e3/this.frame.timeDiff}static _addAnimation(t){this.animations.push(t),this._handleAnimation()}static _removeAnimation(t){const n=t.id,r=this.animations,o=r.length;for(let i=0;i<o;i++)if(r[i].id===n){this.animations.splice(i,1);break}}static _runFrames(){const t={},n=this.animations;for(let r=0;r<n.length;r++){const o=n[r],i=o.layers,s=o.func;o._updateFrameObject(b1());const a=i.length;let l;if(s?l=s.call(o,o.frame)!==!1:l=!0,!!l)for(let u=0;u<a;u++){const d=i[u];d._id!==void 0&&(t[d._id]=d)}}for(const r in t)t.hasOwnProperty(r)&&t[r].batchDraw()}static _animationLoop(){const t=Wd;t.animations.length?(t._runFrames(),Fe.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Fe.requestAnimFrame(this._animationLoop))}};fd.animations=[],fd.animIdCounter=0,fd.animRunning=!1;var BU={node:1,duration:1,easing:1,onFinish:1,yoyo:1},zU=1,BI=2,zI=3,jI=["fill","stroke","shadowColor"],jU=0,VU=class{constructor(e,t,n,r,o,i,s){this.prop=e,this.propFunc=t,this.begin=r,this._pos=r,this.duration=i,this._change=0,this.prevPos=0,this.yoyo=s,this._time=0,this._position=0,this._startTime=0,this._finish=0,this.func=n,this._change=o-this.begin,this.pause()}fire(e){const t=this[e];t&&t()}setTime(e){e>this.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():e<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=e,this.update())}getTime(){return this._time}setPosition(e){this.prevPos=this._pos,this.propFunc(e),this._pos=e}getPosition(e){return e===void 0&&(e=this._time),this.func(e,this.begin,this._change,this.duration)}play(){this.state=BI,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=zI,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(e){this.pause(),this._time=e,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){const e=this.getTimer()-this._startTime;this.state===BI?this.setTime(e):this.state===zI&&this.setTime(this.duration-e)}pause(){this.state=zU,this.fire("onPause")}getTimer(){return new Date().getTime()}},hg=class Hr{constructor(t){const n=this,r=t.node,o=r._id,i=t.easing||Sh.Linear,s=!!t.yoyo;let a,l;typeof t.duration>"u"?a=.3:t.duration===0?a=.001:a=t.duration,this.node=r,this._id=jU++;const u=r.getLayer()||(r instanceof Tt.Stage?r.getLayers():null);u||Fe.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new fd(function(){n.tween.onEnterFrame()},u),this.tween=new VU(l,function(d){n._tweenFunc(d)},i,0,1,a*1e3,s),this._addListeners(),Hr.attrs[o]||(Hr.attrs[o]={}),Hr.attrs[o][this._id]||(Hr.attrs[o][this._id]={}),Hr.tweens[o]||(Hr.tweens[o]={});for(l in t)BU[l]===void 0&&this._addAttr(l,t[l]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,n){const r=this.node,o=r._id;let i,s,a,l,u;const d=Hr.tweens[o][t];d&&delete Hr.attrs[o][d][t];let f=r.getAttr(t);if(Fe._isArray(n))if(i=[],s=Math.max(n.length,f.length),t==="points"&&n.length!==f.length&&(n.length>f.length?(l=f,f=Fe._prepareArrayForTween(f,n,r.closed())):(a=n,n=Fe._prepareArrayForTween(n,f,r.closed()))),t.indexOf("fill")===0)for(let p=0;p<s;p++)if(p%2===0)i.push(n[p]-f[p]);else{const g=Fe.colorToRGBA(f[p]);u=Fe.colorToRGBA(n[p]),f[p]=g,i.push({r:u.r-g.r,g:u.g-g.g,b:u.b-g.b,a:u.a-g.a})}else for(let p=0;p<s;p++)i.push(n[p]-f[p]);else jI.indexOf(t)!==-1?(f=Fe.colorToRGBA(f),u=Fe.colorToRGBA(n),i={r:u.r-f.r,g:u.g-f.g,b:u.b-f.b,a:u.a-f.a}):i=n-f;Hr.attrs[o][this._id][t]={start:f,diff:i,end:n,trueEnd:a,trueStart:l},Hr.tweens[o][t]=this._id}_tweenFunc(t){const n=this.node,r=Hr.attrs[n._id][this._id];let o,i,s,a,l,u,d,f;for(o in r){if(i=r[o],s=i.start,a=i.diff,f=i.end,Fe._isArray(s))if(l=[],d=Math.max(s.length,f.length),o.indexOf("fill")===0)for(u=0;u<d;u++)u%2===0?l.push((s[u]||0)+a[u]*t):l.push("rgba("+Math.round(s[u].r+a[u].r*t)+","+Math.round(s[u].g+a[u].g*t)+","+Math.round(s[u].b+a[u].b*t)+","+(s[u].a+a[u].a*t)+")");else for(u=0;u<d;u++)l.push((s[u]||0)+a[u]*t);else jI.indexOf(o)!==-1?l="rgba("+Math.round(s.r+a.r*t)+","+Math.round(s.g+a.g*t)+","+Math.round(s.b+a.b*t)+","+(s.a+a.a*t)+")":l=s+a*t;n.setAttr(o,l)}}_addListeners(){this.tween.onPlay=()=>{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{const t=this.node,n=Hr.attrs[t._id][this._id];n.points&&n.points.trueEnd&&t.setAttr("points",n.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{const t=this.node,n=Hr.attrs[t._id][this._id];n.points&&n.points.trueStart&&t.points(n.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(t){return this.tween.seek(t*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){const t=this.node._id,n=this._id,r=Hr.tweens[t];this.pause(),this.anim&&this.anim.stop();for(const o in r)delete Hr.tweens[t][o];delete Hr.attrs[t][n],Hr.tweens[t]&&(Object.keys(Hr.tweens[t]).length===0&&delete Hr.tweens[t],Object.keys(Hr.attrs[t]).length===0&&delete Hr.attrs[t])}};hg.attrs={},hg.tweens={},xt.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new hg(e).play()};var Sh={BackEaseIn(e,t,n,r){return n*(e/=r)*e*(2.70158*e-1.70158)+t},BackEaseOut(e,t,n,r){return n*((e=e/r-1)*e*(2.70158*e+1.70158)+1)+t},BackEaseInOut(e,t,n,r){let o=1.70158;return(e/=r/2)<1?n/2*(e*e*(((o*=1.525)+1)*e-o))+t:n/2*((e-=2)*e*(((o*=1.525)+1)*e+o)+2)+t},ElasticEaseIn(e,t,n,r,o,i){let s=0;return e===0?t:(e/=r)===1?t+n:(i||(i=r*.3),!o||o<Math.abs(n)?(o=n,s=i/4):s=i/(2*Math.PI)*Math.asin(n/o),-(o*Math.pow(2,10*(e-=1))*Math.sin((e*r-s)*(2*Math.PI)/i))+t)},ElasticEaseOut(e,t,n,r,o,i){let s=0;return e===0?t:(e/=r)===1?t+n:(i||(i=r*.3),!o||o<Math.abs(n)?(o=n,s=i/4):s=i/(2*Math.PI)*Math.asin(n/o),o*Math.pow(2,-10*e)*Math.sin((e*r-s)*(2*Math.PI)/i)+n+t)},ElasticEaseInOut(e,t,n,r,o,i){let s=0;return e===0?t:(e/=r/2)===2?t+n:(i||(i=r*(.3*1.5)),!o||o<Math.abs(n)?(o=n,s=i/4):s=i/(2*Math.PI)*Math.asin(n/o),e<1?-.5*(o*Math.pow(2,10*(e-=1))*Math.sin((e*r-s)*(2*Math.PI)/i))+t:o*Math.pow(2,-10*(e-=1))*Math.sin((e*r-s)*(2*Math.PI)/i)*.5+n+t)},BounceEaseOut(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},BounceEaseIn(e,t,n,r){return n-Sh.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?Sh.BounceEaseIn(e*2,0,n,r)*.5+t:Sh.BounceEaseOut(e*2-r,0,n,r)*.5+n*.5+t},EaseIn(e,t,n,r){return n*(e/=r)*e+t},EaseOut(e,t,n,r){return-n*(e/=r)*(e-2)+t},EaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},StrongEaseIn(e,t,n,r){return n*(e/=r)*e*e*e*e+t},StrongEaseOut(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t},StrongEaseInOut(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t},Linear(e,t,n,r){return n*e/r+t}},VI=Fe._assign(Tt,{Util:Fe,Transform:ws,Node:xt,Container:Pi,Stage:dg,stages:Ch,Layer:jc,FastLayer:y1,Group:dd,DD:Vn,Shape:wt,shapes:kh,Animation:fd,Tween:hg,Easings:Sh,Context:rg,Canvas:a1}),Ha=class extends wt{_sceneFunc(e){const t=Tt.getAngle(this.angle()),n=this.clockwise();e.beginPath(),e.arc(0,0,this.outerRadius(),0,t,n),e.arc(0,0,this.innerRadius(),t,0,!n),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}getSelfRect(){const e=this.innerRadius(),t=this.outerRadius(),n=this.clockwise(),r=Tt.getAngle(n?360-this.angle():this.angle()),o=Math.cos(Math.min(r,Math.PI)),i=1,s=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),a=Math.sin(Math.min(r,Math.PI/2)),l=o*(o>0?e:t),u=i*t,d=s*(s>0?e:t),f=a*(a>0?t:e);return{x:l,y:n?-1*f:d,width:u-l,height:f-d}}};Ha.prototype._centroid=!0,Ha.prototype.className="Arc",Ha.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],xr(Ha),ge.addGetterSetter(Ha,"innerRadius",0,_t()),ge.addGetterSetter(Ha,"outerRadius",0,_t()),ge.addGetterSetter(Ha,"angle",0,_t()),ge.addGetterSetter(Ha,"clockwise",!1,Cs());function w1(e,t,n,r,o,i,s){const a=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(o-n,2)+Math.pow(i-r,2)),u=s*a/(a+l),d=s*l/(a+l);return[n-u*(o-e),r-u*(i-t),n+d*(o-e),r+d*(i-t)]}function UI(e,t){const n=e.length,r=[];for(let o=2;o<n-2;o+=2){const i=w1(e[o-2],e[o-1],e[o],e[o+1],e[o+2],e[o+3],t);isNaN(i[0])||(r.push(i[0]),r.push(i[1]),r.push(e[o]),r.push(e[o+1]),r.push(i[2]),r.push(i[3]))}return r}function UU(e){const t=[[e[0],e[2],e[4],e[6]],[e[1],e[3],e[5],e[7]]],n=[];for(const r of t){const o=-3*r[0]+9*r[1]-9*r[2]+3*r[3];if(o!==0){const i=6*r[0]-12*r[1]+6*r[2],s=-3*r[0]+3*r[1],a=i*i-4*o*s;if(a>=0){const l=Math.sqrt(a);n.push((-i+l)/(2*o)),n.push((-i-l)/(2*o))}}}return n.filter(r=>r>0&&r<1).flatMap(r=>t.map(o=>{const i=1-r;return i*i*i*o[0]+3*i*i*r*o[1]+3*i*r*r*o[2]+r*r*r*o[3]}))}var Ga=class extends wt{constructor(e){super(e),this.on("pointsChange.konva tensionChange.konva closedChange.konva bezierChange.konva",function(){this._clearCache("tensionPoints")})}_sceneFunc(e){const t=this.points(),n=t.length,r=this.tension(),o=this.closed(),i=this.bezier();if(!n)return;let s=0;if(e.beginPath(),e.moveTo(t[0],t[1]),r!==0&&n>4){const a=this.getTensionPoints(),l=a.length;for(s=o?0:4,o||e.quadraticCurveTo(a[0],a[1],a[2],a[3]);s<l-2;)e.bezierCurveTo(a[s++],a[s++],a[s++],a[s++],a[s++],a[s++]);o||e.quadraticCurveTo(a[l-2],a[l-1],t[n-2],t[n-1])}else if(i)for(s=2;s<n;)e.bezierCurveTo(t[s++],t[s++],t[s++],t[s++],t[s++],t[s++]);else for(s=2;s<n;s+=2)e.lineTo(t[s],t[s+1]);o?(e.closePath(),e.fillStrokeShape(this)):e.strokeShape(this)}getTensionPoints(){return this._getCache("tensionPoints",this._getTensionPoints)}_getTensionPoints(){return this.closed()?this._getTensionPointsClosed():UI(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),t=e.length,n=this.tension(),r=w1(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),o=w1(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),i=UI(e,n);return[r[2],r[3]].concat(i).concat([o[0],o[1],e[t-2],e[t-1],o[2],o[3],r[0],r[1],e[0],e[1]])}getWidth(){return this.getSelfRect().width}getHeight(){return this.getSelfRect().height}getSelfRect(){let e=this.points();if(e.length<4)return{x:e[0]||0,y:e[1]||0,width:0,height:0};this.tension()!==0?e=[e[0],e[1],...this._getTensionPoints(),e[e.length-2],e[e.length-1]]:this.bezier()?e=[e[0],e[1],...UU(this.points()),e[e.length-2],e[e.length-1]]:e=this.points();let t=e[0],n=e[0],r=e[1],o=e[1],i,s;for(let a=0;a<e.length/2;a++)i=e[a*2],s=e[a*2+1],t=Math.min(t,i),n=Math.max(n,i),r=Math.min(r,s),o=Math.max(o,s);return{x:t,y:r,width:n-t,height:o-r}}};Ga.prototype.className="Line",Ga.prototype._attrsAffectingSize=["points","bezier","tension"],xr(Ga),ge.addGetterSetter(Ga,"closed",!1),ge.addGetterSetter(Ga,"bezier",!1),ge.addGetterSetter(Ga,"tension",0,_t()),ge.addGetterSetter(Ga,"points",[],oU());var $U=[[],[],[-.5773502691896257,.5773502691896257],[0,-.7745966692414834,.7745966692414834],[-.33998104358485626,.33998104358485626,-.8611363115940526,.8611363115940526],[0,-.5384693101056831,.5384693101056831,-.906179845938664,.906179845938664],[.6612093864662645,-.6612093864662645,-.2386191860831969,.2386191860831969,-.932469514203152,.932469514203152],[0,.4058451513773972,-.4058451513773972,-.7415311855993945,.7415311855993945,-.9491079123427585,.9491079123427585],[-.1834346424956498,.1834346424956498,-.525532409916329,.525532409916329,-.7966664774136267,.7966664774136267,-.9602898564975363,.9602898564975363],[0,-.8360311073266358,.8360311073266358,-.9681602395076261,.9681602395076261,-.3242534234038089,.3242534234038089,-.6133714327005904,.6133714327005904],[-.14887433898163122,.14887433898163122,-.4333953941292472,.4333953941292472,-.6794095682990244,.6794095682990244,-.8650633666889845,.8650633666889845,-.9739065285171717,.9739065285171717],[0,-.26954315595234496,.26954315595234496,-.5190961292068118,.5190961292068118,-.7301520055740494,.7301520055740494,-.8870625997680953,.8870625997680953,-.978228658146057,.978228658146057],[-.1252334085114689,.1252334085114689,-.3678314989981802,.3678314989981802,-.5873179542866175,.5873179542866175,-.7699026741943047,.7699026741943047,-.9041172563704749,.9041172563704749,-.9815606342467192,.9815606342467192],[0,-.2304583159551348,.2304583159551348,-.44849275103644687,.44849275103644687,-.6423493394403402,.6423493394403402,-.8015780907333099,.8015780907333099,-.9175983992229779,.9175983992229779,-.9841830547185881,.9841830547185881],[-.10805494870734367,.10805494870734367,-.31911236892788974,.31911236892788974,-.5152486363581541,.5152486363581541,-.6872929048116855,.6872929048116855,-.827201315069765,.827201315069765,-.9284348836635735,.9284348836635735,-.9862838086968123,.9862838086968123],[0,-.20119409399743451,.20119409399743451,-.3941513470775634,.3941513470775634,-.5709721726085388,.5709721726085388,-.7244177313601701,.7244177313601701,-.8482065834104272,.8482065834104272,-.937273392400706,.937273392400706,-.9879925180204854,.9879925180204854],[-.09501250983763744,.09501250983763744,-.2816035507792589,.2816035507792589,-.45801677765722737,.45801677765722737,-.6178762444026438,.6178762444026438,-.755404408355003,.755404408355003,-.8656312023878318,.8656312023878318,-.9445750230732326,.9445750230732326,-.9894009349916499,.9894009349916499],[0,-.17848418149584785,.17848418149584785,-.3512317634538763,.3512317634538763,-.5126905370864769,.5126905370864769,-.6576711592166907,.6576711592166907,-.7815140038968014,.7815140038968014,-.8802391537269859,.8802391537269859,-.9506755217687678,.9506755217687678,-.9905754753144174,.9905754753144174],[-.0847750130417353,.0847750130417353,-.2518862256915055,.2518862256915055,-.41175116146284263,.41175116146284263,-.5597708310739475,.5597708310739475,-.6916870430603532,.6916870430603532,-.8037049589725231,.8037049589725231,-.8926024664975557,.8926024664975557,-.9558239495713977,.9558239495713977,-.9915651684209309,.9915651684209309],[0,-.16035864564022537,.16035864564022537,-.31656409996362983,.31656409996362983,-.46457074137596094,.46457074137596094,-.600545304661681,.600545304661681,-.7209661773352294,.7209661773352294,-.8227146565371428,.8227146565371428,-.9031559036148179,.9031559036148179,-.96020815213483,.96020815213483,-.9924068438435844,.9924068438435844],[-.07652652113349734,.07652652113349734,-.22778585114164507,.22778585114164507,-.37370608871541955,.37370608871541955,-.5108670019508271,.5108670019508271,-.636053680726515,.636053680726515,-.7463319064601508,.7463319064601508,-.8391169718222188,.8391169718222188,-.912234428251326,.912234428251326,-.9639719272779138,.9639719272779138,-.9931285991850949,.9931285991850949],[0,-.1455618541608951,.1455618541608951,-.2880213168024011,.2880213168024011,-.4243421202074388,.4243421202074388,-.5516188358872198,.5516188358872198,-.6671388041974123,.6671388041974123,-.7684399634756779,.7684399634756779,-.8533633645833173,.8533633645833173,-.9200993341504008,.9200993341504008,-.9672268385663063,.9672268385663063,-.9937521706203895,.9937521706203895],[-.06973927331972223,.06973927331972223,-.20786042668822127,.20786042668822127,-.34193582089208424,.34193582089208424,-.469355837986757,.469355837986757,-.5876404035069116,.5876404035069116,-.6944872631866827,.6944872631866827,-.7878168059792081,.7878168059792081,-.8658125777203002,.8658125777203002,-.926956772187174,.926956772187174,-.9700604978354287,.9700604978354287,-.9942945854823992,.9942945854823992],[0,-.1332568242984661,.1332568242984661,-.26413568097034495,.26413568097034495,-.3903010380302908,.3903010380302908,-.5095014778460075,.5095014778460075,-.6196098757636461,.6196098757636461,-.7186613631319502,.7186613631319502,-.8048884016188399,.8048884016188399,-.8767523582704416,.8767523582704416,-.9329710868260161,.9329710868260161,-.9725424712181152,.9725424712181152,-.9947693349975522,.9947693349975522],[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213]],HU=[[],[],[1,1],[.8888888888888888,.5555555555555556,.5555555555555556],[.6521451548625461,.6521451548625461,.34785484513745385,.34785484513745385],[.5688888888888889,.47862867049936647,.47862867049936647,.23692688505618908,.23692688505618908],[.3607615730481386,.3607615730481386,.46791393457269104,.46791393457269104,.17132449237917036,.17132449237917036],[.4179591836734694,.3818300505051189,.3818300505051189,.27970539148927664,.27970539148927664,.1294849661688697,.1294849661688697],[.362683783378362,.362683783378362,.31370664587788727,.31370664587788727,.22238103445337448,.22238103445337448,.10122853629037626,.10122853629037626],[.3302393550012598,.1806481606948574,.1806481606948574,.08127438836157441,.08127438836157441,.31234707704000286,.31234707704000286,.26061069640293544,.26061069640293544],[.29552422471475287,.29552422471475287,.26926671930999635,.26926671930999635,.21908636251598204,.21908636251598204,.1494513491505806,.1494513491505806,.06667134430868814,.06667134430868814],[.2729250867779006,.26280454451024665,.26280454451024665,.23319376459199048,.23319376459199048,.18629021092773426,.18629021092773426,.1255803694649046,.1255803694649046,.05566856711617366,.05566856711617366],[.24914704581340277,.24914704581340277,.2334925365383548,.2334925365383548,.20316742672306592,.20316742672306592,.16007832854334622,.16007832854334622,.10693932599531843,.10693932599531843,.04717533638651183,.04717533638651183],[.2325515532308739,.22628318026289723,.22628318026289723,.2078160475368885,.2078160475368885,.17814598076194574,.17814598076194574,.13887351021978725,.13887351021978725,.09212149983772845,.09212149983772845,.04048400476531588,.04048400476531588],[.2152638534631578,.2152638534631578,.2051984637212956,.2051984637212956,.18553839747793782,.18553839747793782,.15720316715819355,.15720316715819355,.12151857068790319,.12151857068790319,.08015808715976021,.08015808715976021,.03511946033175186,.03511946033175186],[.2025782419255613,.19843148532711158,.19843148532711158,.1861610000155622,.1861610000155622,.16626920581699392,.16626920581699392,.13957067792615432,.13957067792615432,.10715922046717194,.10715922046717194,.07036604748810812,.07036604748810812,.03075324199611727,.03075324199611727],[.1894506104550685,.1894506104550685,.18260341504492358,.18260341504492358,.16915651939500254,.16915651939500254,.14959598881657674,.14959598881657674,.12462897125553388,.12462897125553388,.09515851168249279,.09515851168249279,.062253523938647894,.062253523938647894,.027152459411754096,.027152459411754096],[.17944647035620653,.17656270536699264,.17656270536699264,.16800410215645004,.16800410215645004,.15404576107681028,.15404576107681028,.13513636846852548,.13513636846852548,.11188384719340397,.11188384719340397,.08503614831717918,.08503614831717918,.0554595293739872,.0554595293739872,.02414830286854793,.02414830286854793],[.1691423829631436,.1691423829631436,.16427648374583273,.16427648374583273,.15468467512626524,.15468467512626524,.14064291467065065,.14064291467065065,.12255520671147846,.12255520671147846,.10094204410628717,.10094204410628717,.07642573025488905,.07642573025488905,.0497145488949698,.0497145488949698,.02161601352648331,.02161601352648331],[.1610544498487837,.15896884339395434,.15896884339395434,.15276604206585967,.15276604206585967,.1426067021736066,.1426067021736066,.12875396253933621,.12875396253933621,.11156664554733399,.11156664554733399,.09149002162245,.09149002162245,.06904454273764123,.06904454273764123,.0448142267656996,.0448142267656996,.019461788229726478,.019461788229726478],[.15275338713072584,.15275338713072584,.14917298647260374,.14917298647260374,.14209610931838204,.14209610931838204,.13168863844917664,.13168863844917664,.11819453196151841,.11819453196151841,.10193011981724044,.10193011981724044,.08327674157670475,.08327674157670475,.06267204833410907,.06267204833410907,.04060142980038694,.04060142980038694,.017614007139152118,.017614007139152118],[.14608113364969041,.14452440398997005,.14452440398997005,.13988739479107315,.13988739479107315,.13226893863333747,.13226893863333747,.12183141605372853,.12183141605372853,.10879729916714838,.10879729916714838,.09344442345603386,.09344442345603386,.0761001136283793,.0761001136283793,.057134425426857205,.057134425426857205,.036953789770852494,.036953789770852494,.016017228257774335,.016017228257774335],[.13925187285563198,.13925187285563198,.13654149834601517,.13654149834601517,.13117350478706238,.13117350478706238,.12325237681051242,.12325237681051242,.11293229608053922,.11293229608053922,.10041414444288096,.10041414444288096,.08594160621706773,.08594160621706773,.06979646842452049,.06979646842452049,.052293335152683286,.052293335152683286,.03377490158481415,.03377490158481415,.0146279952982722,.0146279952982722],[.13365457218610619,.1324620394046966,.1324620394046966,.12890572218808216,.12890572218808216,.12304908430672953,.12304908430672953,.11499664022241136,.11499664022241136,.10489209146454141,.10489209146454141,.09291576606003515,.09291576606003515,.07928141177671895,.07928141177671895,.06423242140852585,.06423242140852585,.04803767173108467,.04803767173108467,.030988005856979445,.030988005856979445,.013411859487141771,.013411859487141771],[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872]],GU=[[1],[1,1],[1,2,1],[1,3,3,1]],$I=(e,t,n)=>{let r,o;const s=n/2;r=0;for(let a=0;a<20;a++)o=s*$U[20][a]+s,r+=HU[20][a]*WU(e,t,o);return s*r},HI=(e,t,n)=>{n===void 0&&(n=1);const r=e[0]-2*e[1]+e[2],o=t[0]-2*t[1]+t[2],i=2*e[1]-2*e[0],s=2*t[1]-2*t[0],a=4*(r*r+o*o),l=4*(r*i+o*s),u=i*i+s*s;if(a===0)return n*Math.sqrt(Math.pow(e[2]-e[0],2)+Math.pow(t[2]-t[0],2));const d=l/(2*a),f=u/a,p=n+d,g=f-d*d,m=p*p+g>0?Math.sqrt(p*p+g):0,v=d*d+g>0?Math.sqrt(d*d+g):0,C=d+Math.sqrt(d*d+g)!==0?g*Math.log(Math.abs((p+m)/(d+v))):0;return Math.sqrt(a)/2*(p*m-d*v+C)};function WU(e,t,n){const r=C1(1,n,e),o=C1(1,n,t),i=r*r+o*o;return Math.sqrt(i)}var C1=(e,t,n)=>{const r=n.length-1;let o,i;if(r===0)return 0;if(e===0){i=0;for(let s=0;s<=r;s++)i+=GU[r][s]*Math.pow(1-t,r-s)*Math.pow(t,s)*n[s];return i}else{o=new Array(r);for(let s=0;s<r;s++)o[s]=r*(n[s+1]-n[s]);return C1(e-1,t,o)}},GI=(e,t,n)=>{let r=1,o=e/t,i=(e-n(o))/t,s=0;for(;r>.001;){const a=n(o+i),l=Math.abs(e-a)/t;if(l<r)r=l,o+=i;else{const u=n(o-i),d=Math.abs(e-u)/t;d<r?(r=d,o-=i):i/=2}if(s++,s>500)break}return o},qi=class ki extends wt{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ki.parsePathData(this.data()),this.pathLength=ki.getPathLength(this.dataArray)}_sceneFunc(t){const n=this.dataArray;t.beginPath();let r=!1;for(let o=0;o<n.length;o++){const i=n[o].command,s=n[o].points;switch(i){case"L":t.lineTo(s[0],s[1]);break;case"M":t.moveTo(s[0],s[1]);break;case"C":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"Q":t.quadraticCurveTo(s[0],s[1],s[2],s[3]);break;case"A":const a=s[0],l=s[1],u=s[2],d=s[3],f=s[4],p=s[5],g=s[6],m=s[7],v=u>d?u:d,C=u>d?1:u/d,w=u>d?d/u:1;t.translate(a,l),t.rotate(g),t.scale(C,w),t.arc(0,0,v,f,f+p,1-m),t.scale(1/C,1/w),t.rotate(-g),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(l){if(l.command==="A"){const u=l.points[4],d=l.points[5],f=l.points[4]+d;let p=Math.PI/180;if(Math.abs(u-f)<p&&(p=Math.abs(u-f)),d<0)for(let g=u-p;g>f;g-=p){const m=ki.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(m.x,m.y)}else for(let g=u+p;g<f;g+=p){const m=ki.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(m.x,m.y)}}else if(l.command==="C")for(let u=0;u<=1;u+=.01){const d=ki.getPointOnCubicBezier(u,l.start.x,l.start.y,l.points[0],l.points[1],l.points[2],l.points[3],l.points[4],l.points[5]);t.push(d.x,d.y)}else t=t.concat(l.points)});let n=t[0],r=t[0],o=t[1],i=t[1],s,a;for(let l=0;l<t.length/2;l++)s=t[l*2],a=t[l*2+1],isNaN(s)||(n=Math.min(n,s),r=Math.max(r,s)),isNaN(a)||(o=Math.min(o,a),i=Math.max(i,a));return{x:n,y:o,width:r-n,height:i-o}}getLength(){return this.pathLength}getPointAtLength(t){return ki.getPointAtLengthOfDataArray(t,this.dataArray)}static getLineLength(t,n,r,o){return Math.sqrt((r-t)*(r-t)+(o-n)*(o-n))}static getPathLength(t){let n=0;for(let r=0;r<t.length;++r)n+=t[r].pathLength;return n}static getPointAtLengthOfDataArray(t,n){let r,o=0,i=n.length;if(!i)return null;for(;o<i&&t>n[o].pathLength;)t-=n[o].pathLength,++o;if(o===i)return r=n[o-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return n[o].command==="M"?(r=n[o].points.slice(0,2),{x:r[0],y:r[1]}):{x:n[o].start.x,y:n[o].start.y};const s=n[o],a=s.points;switch(s.command){case"L":return ki.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return ki.getPointOnCubicBezier(GI(t,ki.getPathLength(n),v=>$I([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],v)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return ki.getPointOnQuadraticBezier(GI(t,ki.getPathLength(n),v=>HI([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],v)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":const l=a[0],u=a[1],d=a[2],f=a[3],p=a[5],g=a[6];let m=a[4];return m+=p*t/s.pathLength,ki.getPointOnEllipticalArc(l,u,d,f,m,g)}return null}static getPointOnLine(t,n,r,o,i,s,a){s=s??n,a=a??r;const l=this.getLineLength(n,r,o,i);if(l<1e-10)return{x:n,y:r};if(o===n)return{x:s,y:a+(i>r?t:-t)};const u=(i-r)/(o-n),d=Math.sqrt(t*t/(1+u*u))*(o<n?-1:1),f=u*d;if(Math.abs(a-r-u*(s-n))<1e-10)return{x:s+d,y:a+f};const p=((s-n)*(o-n)+(a-r)*(i-r))/(l*l),g=n+p*(o-n),m=r+p*(i-r),v=this.getLineLength(s,a,g,m),C=Math.sqrt(t*t-v*v),w=Math.sqrt(C*C/(1+u*u))*(o<n?-1:1),S=u*w;return{x:g+w,y:m+S}}static getPointOnCubicBezier(t,n,r,o,i,s,a,l,u){function d(m){return m*m*m}function f(m){return 3*m*m*(1-m)}function p(m){return 3*m*(1-m)*(1-m)}function g(m){return(1-m)*(1-m)*(1-m)}return{x:l*d(t)+s*f(t)+o*p(t)+n*g(t),y:u*d(t)+a*f(t)+i*p(t)+r*g(t)}}static getPointOnQuadraticBezier(t,n,r,o,i,s,a){function l(f){return f*f}function u(f){return 2*f*(1-f)}function d(f){return(1-f)*(1-f)}return{x:s*l(t)+o*u(t)+n*d(t),y:a*l(t)+i*u(t)+r*d(t)}}static getPointOnEllipticalArc(t,n,r,o,i,s){const a=Math.cos(s),l=Math.sin(s),u={x:r*Math.cos(i),y:o*Math.sin(i)};return{x:t+(u.x*a-u.y*l),y:n+(u.x*l+u.y*a)}}static parsePathData(t){if(!t)return[];let n=t;const r=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(let f=0;f<r.length;f++)n=n.replace(new RegExp(r[f],"g"),"|"+r[f]);const o=n.split("|"),i=[],s=[];let a=0,l=0;const u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let d;for(let f=1;f<o.length;f++){let p=o[f],g=p.charAt(0);for(p=p.slice(1),s.length=0;d=u.exec(p);)s.push(d[0]);let m=[],v=g==="A"||g==="a"?0:-1;for(let C=0,w=s.length;C<w;C++){const S=s[C];if(S==="00"){m.push(0,0),v>=0&&(v+=2,v>=7&&(v-=7));continue}if(v>=0){if(v===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(S)){m.push(parseInt(S[0],10)),m.push(parseInt(S[1],10)),m.push(parseFloat(S.slice(2))),v+=3,v>=7&&(v-=7);continue}if(S==="11"||S==="10"||S==="01"){m.push(parseInt(S[0],10)),m.push(parseInt(S[1],10)),v+=2,v>=7&&(v-=7);continue}if(S==="0"||S==="1"){m.push(parseInt(S,10)),v+=1,v>=7&&(v-=7);continue}}else if(v===4){if(/^[01]\d+(?:\.\d+)?$/.test(S)){m.push(parseInt(S[0],10)),m.push(parseFloat(S.slice(1))),v+=2,v>=7&&(v-=7);continue}if(S==="0"||S==="1"){m.push(parseInt(S,10)),v+=1,v>=7&&(v-=7);continue}}const y=parseFloat(S);isNaN(y)?m.push(0):m.push(y),v+=1,v>=7&&(v-=7)}else{const y=parseFloat(S);isNaN(y)?m.push(0):m.push(y)}}for(;m.length>0&&!isNaN(m[0]);){let C="",w=[];const S=a,y=l;let k,x,M,z,q,B,L,V,T,$;switch(g){case"l":a+=m.shift(),l+=m.shift(),C="L",w.push(a,l);break;case"L":a=m.shift(),l=m.shift(),w.push(a,l);break;case"m":const R=m.shift(),H=m.shift();if(a+=R,l+=H,C="M",i.length>2&&i[i.length-1].command==="z"){for(let G=i.length-2;G>=0;G--)if(i[G].command==="M"){a=i[G].points[0]+R,l=i[G].points[1]+H;break}}w.push(a,l),g="l";break;case"M":a=m.shift(),l=m.shift(),C="M",w.push(a,l),g="L";break;case"h":a+=m.shift(),C="L",w.push(a,l);break;case"H":a=m.shift(),C="L",w.push(a,l);break;case"v":l+=m.shift(),C="L",w.push(a,l);break;case"V":l=m.shift(),C="L",w.push(a,l);break;case"C":w.push(m.shift(),m.shift(),m.shift(),m.shift()),a=m.shift(),l=m.shift(),w.push(a,l);break;case"c":w.push(a+m.shift(),l+m.shift(),a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),C="C",w.push(a,l);break;case"S":x=a,M=l,k=i[i.length-1],k.command==="C"&&(x=a+(a-k.points[2]),M=l+(l-k.points[3])),w.push(x,M,m.shift(),m.shift()),a=m.shift(),l=m.shift(),C="C",w.push(a,l);break;case"s":x=a,M=l,k=i[i.length-1],k.command==="C"&&(x=a+(a-k.points[2]),M=l+(l-k.points[3])),w.push(x,M,a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),C="C",w.push(a,l);break;case"Q":w.push(m.shift(),m.shift()),a=m.shift(),l=m.shift(),w.push(a,l);break;case"q":w.push(a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),C="Q",w.push(a,l);break;case"T":x=a,M=l,k=i[i.length-1],k.command==="Q"&&(x=a+(a-k.points[0]),M=l+(l-k.points[1])),a=m.shift(),l=m.shift(),C="Q",w.push(x,M,a,l);break;case"t":x=a,M=l,k=i[i.length-1],k.command==="Q"&&(x=a+(a-k.points[0]),M=l+(l-k.points[1])),a+=m.shift(),l+=m.shift(),C="Q",w.push(x,M,a,l);break;case"A":z=m.shift(),q=m.shift(),B=m.shift(),L=m.shift(),V=m.shift(),T=a,$=l,a=m.shift(),l=m.shift(),C="A",w=this.convertEndpointToCenterParameterization(T,$,a,l,L,V,z,q,B);break;case"a":z=m.shift(),q=m.shift(),B=m.shift(),L=m.shift(),V=m.shift(),T=a,$=l,a+=m.shift(),l+=m.shift(),C="A",w=this.convertEndpointToCenterParameterization(T,$,a,l,L,V,z,q,B);break}i.push({command:C||g,points:w,start:{x:S,y},pathLength:this.calcLength(S,y,C||g,w)})}(g==="z"||g==="Z")&&i.push({command:"z",points:[],start:void 0,pathLength:0})}return i}static calcLength(t,n,r,o){let i,s,a,l;const u=ki;switch(r){case"L":return u.getLineLength(t,n,o[0],o[1]);case"C":return $I([t,o[0],o[2],o[4]],[n,o[1],o[3],o[5]],1);case"Q":return HI([t,o[0],o[2]],[n,o[1],o[3]],1);case"A":i=0;const d=o[4],f=o[5],p=o[4]+f;let g=Math.PI/180;if(Math.abs(d-p)<g&&(g=Math.abs(d-p)),s=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],d,0),f<0)for(l=d-g;l>p;l-=g)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=d+g;l<p;l+=g)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;return a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],p,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),i}return 0}static convertEndpointToCenterParameterization(t,n,r,o,i,s,a,l,u){const d=u*(Math.PI/180),f=Math.cos(d)*(t-r)/2+Math.sin(d)*(n-o)/2,p=-1*Math.sin(d)*(t-r)/2+Math.cos(d)*(n-o)/2,g=f*f/(a*a)+p*p/(l*l);g>1&&(a*=Math.sqrt(g),l*=Math.sqrt(g));let m=Math.sqrt((a*a*(l*l)-a*a*(p*p)-l*l*(f*f))/(a*a*(p*p)+l*l*(f*f)));i===s&&(m*=-1),isNaN(m)&&(m=0);const v=m*a*p/l,C=m*-l*f/a,w=(t+r)/2+Math.cos(d)*v-Math.sin(d)*C,S=(n+o)/2+Math.sin(d)*v+Math.cos(d)*C,y=function(L){return Math.sqrt(L[0]*L[0]+L[1]*L[1])},k=function(L,V){return(L[0]*V[0]+L[1]*V[1])/(y(L)*y(V))},x=function(L,V){return(L[0]*V[1]<L[1]*V[0]?-1:1)*Math.acos(k(L,V))},M=x([1,0],[(f-v)/a,(p-C)/l]),z=[(f-v)/a,(p-C)/l],q=[(-1*f-v)/a,(-1*p-C)/l];let B=x(z,q);return k(z,q)<=-1&&(B=Math.PI),k(z,q)>=1&&(B=0),s===0&&B>0&&(B=B-2*Math.PI),s===1&&B<0&&(B=B+2*Math.PI),[w,S,a,l,M,B,d,s]}};qi.prototype.className="Path",qi.prototype._attrsAffectingSize=["data"],xr(qi),ge.addGetterSetter(qi,"data");var Vc=class extends Ga{_sceneFunc(e){super._sceneFunc(e);const t=Math.PI*2,n=this.points();let r=n;const o=this.tension()!==0&&n.length>4;o&&(r=this.getTensionPoints());const i=this.pointerLength(),s=n.length;let a,l;if(o){const f=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[s-2],n[s-1]],p=qi.calcLength(r[r.length-4],r[r.length-3],"C",f),g=qi.getPointOnQuadraticBezier(Math.min(1,1-i/p),f[0],f[1],f[2],f[3],f[4],f[5]);a=n[s-2]-g.x,l=n[s-1]-g.y}else a=n[s-2]-n[s-4],l=n[s-1]-n[s-3];const u=(Math.atan2(l,a)+t)%t,d=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[s-2],n[s-1]),e.rotate(u),e.moveTo(0,0),e.lineTo(-i,d/2),e.lineTo(-i,-d/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),o?(a=(r[0]+r[2])/2-n[0],l=(r[1]+r[3])/2-n[1]):(a=n[2]-n[0],l=n[3]-n[1]),e.rotate((Math.atan2(-l,-a)+t)%t),e.moveTo(0,0),e.lineTo(-i,d/2),e.lineTo(-i,-d/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x,y:e.y-t,width:e.width,height:e.height+t*2}}};Vc.prototype.className="Arrow",xr(Vc),ge.addGetterSetter(Vc,"pointerLength",10,_t()),ge.addGetterSetter(Vc,"pointerWidth",10,_t()),ge.addGetterSetter(Vc,"pointerAtBeginning",!1),ge.addGetterSetter(Vc,"pointerAtEnding",!0);var hd=class extends wt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}};hd.prototype._centroid=!0,hd.prototype.className="Circle",hd.prototype._attrsAffectingSize=["radius"],xr(hd),ge.addGetterSetter(hd,"radius",0,_t());var Vl=class extends wt{_sceneFunc(e){const t=this.radiusX(),n=this.radiusY();e.beginPath(),e.save(),t!==n&&e.scale(1,n/t),e.arc(0,0,t,0,Math.PI*2,!1),e.restore(),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(e){this.radiusX(e/2)}setHeight(e){this.radiusY(e/2)}};Vl.prototype.className="Ellipse",Vl.prototype._centroid=!0,Vl.prototype._attrsAffectingSize=["radiusX","radiusY"],xr(Vl),ge.addComponentsGetterSetter(Vl,"radius",["x","y"]),ge.addGetterSetter(Vl,"radiusX",0,_t()),ge.addGetterSetter(Vl,"radiusY",0,_t());var ks=class GT extends wt{constructor(t){super(t),this._loadListener=()=>{this._requestDraw()},this.on("imageChange.konva",n=>{this._removeImageLoad(n.oldVal),this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",this._loadListener)}_removeImageLoad(t){t&&t.removeEventListener&&t.removeEventListener("load",this._loadListener)}destroy(){return this._removeImageLoad(this.image()),super.destroy(),this}_useBufferCanvas(){const t=!!this.cornerRadius(),n=this.hasShadow();return t&&n?!0:super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),o=this.cornerRadius(),i=this.attrs.image;let s;if(i){const a=this.attrs.cropWidth,l=this.attrs.cropHeight;a&&l?s=[i,this.cropX(),this.cropY(),a,l,0,0,n,r]:s=[i,0,0,n,r]}(this.hasFill()||this.hasStroke()||o)&&(t.beginPath(),o?Fe.drawRoundedRectPath(t,n,r,o):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),i&&(o&&t.clip(),t.drawImage.apply(t,s))}_hitFunc(t){const n=this.width(),r=this.height(),o=this.cornerRadius();t.beginPath(),o?Fe.drawRoundedRectPath(t,n,r,o):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n,r;return(r=(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width)!==null&&r!==void 0?r:0}getHeight(){var t,n,r;return(r=(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height)!==null&&r!==void 0?r:0}static fromURL(t,n,r=null){const o=Fe.createImageElement();o.onload=function(){n(new GT({image:o}))},o.onerror=r,o.crossOrigin="Anonymous",o.src=t}};ks.prototype.className="Image",ks.prototype._attrsAffectingSize=["image"],xr(ks),ge.addGetterSetter(ks,"cornerRadius",0,ig(4)),ge.addGetterSetter(ks,"image"),ge.addComponentsGetterSetter(ks,"crop",["x","y","width","height"]),ge.addGetterSetter(ks,"cropX",0,_t()),ge.addGetterSetter(ks,"cropY",0,_t()),ge.addGetterSetter(ks,"cropWidth",0,_t()),ge.addGetterSetter(ks,"cropHeight",0,_t());var WI=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],KU="Change.konva",qU="none",k1="up",S1="right",_1="down",A1="left",YU=WI.length,I1=class extends dd{constructor(e){super(e),this.on("add.konva",function(t){this._addListeners(t.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let t=this,n;const r=function(){t._sync()};for(n=0;n<YU;n++)e.on(WI[n]+KU,r)}getWidth(){return this.getText().width()}getHeight(){return this.getText().height()}_sync(){let e=this.getText(),t=this.getTag(),n,r,o,i,s,a,l;if(e&&t){switch(n=e.width(),r=e.height(),o=t.pointerDirection(),i=t.pointerWidth(),l=t.pointerHeight(),s=0,a=0,o){case k1:s=n/2,a=-1*l;break;case S1:s=n+i,a=r/2;break;case _1:s=n/2,a=r+l;break;case A1:s=-1*i,a=r/2;break}t.setAttrs({x:-1*s,y:-1*a,width:n,height:r}),e.setAttrs({x:-1*s,y:-1*a})}}};I1.prototype.className="Label",xr(I1);var Uc=class extends wt{_sceneFunc(e){const t=this.width(),n=this.height(),r=this.pointerDirection(),o=this.pointerWidth(),i=this.pointerHeight(),s=this.cornerRadius();let a=0,l=0,u=0,d=0;typeof s=="number"?a=l=u=d=Math.min(s,t/2,n/2):(a=Math.min(s[0]||0,t/2,n/2),l=Math.min(s[1]||0,t/2,n/2),d=Math.min(s[2]||0,t/2,n/2),u=Math.min(s[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(a,0),r===k1&&(e.lineTo((t-o)/2,0),e.lineTo(t/2,-1*i),e.lineTo((t+o)/2,0)),e.lineTo(t-l,0),e.arc(t-l,l,l,Math.PI*3/2,0,!1),r===S1&&(e.lineTo(t,(n-i)/2),e.lineTo(t+o,n/2),e.lineTo(t,(n+i)/2)),e.lineTo(t,n-d),e.arc(t-d,n-d,d,0,Math.PI/2,!1),r===_1&&(e.lineTo((t+o)/2,n),e.lineTo(t/2,n+i),e.lineTo((t-o)/2,n)),e.lineTo(u,n),e.arc(u,n-u,u,Math.PI/2,Math.PI,!1),r===A1&&(e.lineTo(0,(n+i)/2),e.lineTo(-1*o,n/2),e.lineTo(0,(n-i)/2)),e.lineTo(0,a),e.arc(a,a,a,Math.PI,Math.PI*3/2,!1),e.closePath(),e.fillStrokeShape(this)}getSelfRect(){let e=0,t=0,n=this.pointerWidth(),r=this.pointerHeight(),o=this.pointerDirection(),i=this.width(),s=this.height();return o===k1?(t-=r,s+=r):o===_1?s+=r:o===A1?(e-=n*1.5,i+=n):o===S1&&(i+=n*1.5),{x:e,y:t,width:i,height:s}}};Uc.prototype.className="Tag",xr(Uc),ge.addGetterSetter(Uc,"pointerDirection",qU),ge.addGetterSetter(Uc,"pointerWidth",0,_t()),ge.addGetterSetter(Uc,"pointerHeight",0,_t()),ge.addGetterSetter(Uc,"cornerRadius",0,ig(4));var _h=class extends wt{_sceneFunc(e){const t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?Fe.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};_h.prototype.className="Rect",xr(_h),ge.addGetterSetter(_h,"cornerRadius",0,ig(4));var Ul=class extends wt{_sceneFunc(e){const t=this._getPoints(),n=this.radius(),r=this.sides(),o=this.cornerRadius();if(e.beginPath(),o)Fe.drawRoundedPolygonPath(e,t,r,n,o);else{e.moveTo(t[0].x,t[0].y);for(let i=1;i<t.length;i++)e.lineTo(t[i].x,t[i].y)}e.closePath(),e.fillStrokeShape(this)}_getPoints(){const e=this.attrs.sides,t=this.attrs.radius||0,n=[];for(let r=0;r<e;r++)n.push({x:t*Math.sin(r*2*Math.PI/e),y:-1*t*Math.cos(r*2*Math.PI/e)});return n}getSelfRect(){const e=this._getPoints();let t=e[0].x,n=e[0].x,r=e[0].y,o=e[0].y;return e.forEach(i=>{t=Math.min(t,i.x),n=Math.max(n,i.x),r=Math.min(r,i.y),o=Math.max(o,i.y)}),{x:t,y:r,width:n-t,height:o-r}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};Ul.prototype.className="RegularPolygon",Ul.prototype._centroid=!0,Ul.prototype._attrsAffectingSize=["radius"],xr(Ul),ge.addGetterSetter(Ul,"radius",0,_t()),ge.addGetterSetter(Ul,"sides",0,_t()),ge.addGetterSetter(Ul,"cornerRadius",0,ig(4));var KI=Math.PI*2,$c=class extends wt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,KI,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),KI,0,!0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};$c.prototype.className="Ring",$c.prototype._centroid=!0,$c.prototype._attrsAffectingSize=["innerRadius","outerRadius"],xr($c),ge.addGetterSetter($c,"innerRadius",0,_t()),ge.addGetterSetter($c,"outerRadius",0,_t());var oa=class extends wt{constructor(e){super(e),this._updated=!0,this.anim=new fd(()=>{const t=this._updated;return this._updated=!1,t}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){const t=this.animation(),n=this.frameIndex(),r=n*4,o=this.animations()[t],i=this.frameOffsets(),s=o[r+0],a=o[r+1],l=o[r+2],u=o[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,u),e.closePath(),e.fillStrokeShape(this)),d)if(i){const f=i[t],p=n*2;e.drawImage(d,s,a,l,u,f[p+0],f[p+1],l,u)}else e.drawImage(d,s,a,l,u,0,0,l,u)}_hitFunc(e){const t=this.animation(),n=this.frameIndex(),r=n*4,o=this.animations()[t],i=this.frameOffsets(),s=o[r+2],a=o[r+3];if(e.beginPath(),i){const l=i[t],u=n*2;e.rect(l[u+0],l[u+1],s,a)}else e.rect(0,0,s,a);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}};oa.prototype.className="Sprite",xr(oa),ge.addGetterSetter(oa,"animation"),ge.addGetterSetter(oa,"animations"),ge.addGetterSetter(oa,"frameOffsets"),ge.addGetterSetter(oa,"image"),ge.addGetterSetter(oa,"frameIndex",0,_t()),ge.addGetterSetter(oa,"frameRate",17,_t()),ge.backCompat(oa,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var $l=class extends wt{_sceneFunc(e){const t=this.innerRadius(),n=this.outerRadius(),r=this.numPoints();e.beginPath(),e.moveTo(0,0-n);for(let o=1;o<r*2;o++){const i=o%2===0?n:t,s=i*Math.sin(o*Math.PI/r),a=-1*i*Math.cos(o*Math.PI/r);e.lineTo(s,a)}e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(e){this.outerRadius(e/2)}setHeight(e){this.outerRadius(e/2)}};$l.prototype.className="Star",$l.prototype._centroid=!0,$l.prototype._attrsAffectingSize=["innerRadius","outerRadius"],xr($l),ge.addGetterSetter($l,"numPoints",5,_t()),ge.addGetterSetter($l,"innerRadius",0,_t()),ge.addGetterSetter($l,"outerRadius",0,_t());function Hl(e){return[...e].reduce((t,n,r,o)=>{if(/\p{Emoji}/u.test(n)){const i=o[r+1];i&&/\p{Emoji_Modifier}|\u200D/u.test(i)?(t.push(n+i),o[r+1]=""):t.push(n)}else/\p{Regional_Indicator}{2}/u.test(n+(o[r+1]||""))?t.push(n+o[r+1]):r>0&&/\p{Mn}|\p{Me}|\p{Mc}/u.test(n)?t[t.length-1]+=n:n&&t.push(n);return t},[])}var pd="auto",XU="center",qI="inherit",Ah="justify",ZU="Change.konva",YI="2d",XI="-",ZI="left",QU="text",JU="Text",e$="top",t$="bottom",QI="middle",JI="normal",n$="px ",pg=" ",r$="right",eE="rtl",o$="word",i$="char",tE="none",E1="β¦",nE=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],s$=nE.length,Ih=null;function a$(){if(Ih!==null)return Ih;Ih=!1;try{const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext(YI);if(t){t.globalAlpha=0,t.shadowColor="black",t.shadowBlur=5,t.shadowOffsetX=5,t.shadowOffsetY=5,t.fillStyle="black",t.font="10px Arial",t.fillText("X",0,10);const n=t.getImageData(0,0,10,10).data;for(let r=3;r<n.length;r+=4)if(n[r]>0){Ih=!0;break}}}catch{}return Ih}function l$(e){return e.split(",").map(t=>{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var mg;function T1(){return mg||(mg=Fe.createCanvasElement().getContext(YI),mg)}function c$(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function u$(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function d$(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}var mr=class extends wt{constructor(e){super(d$(e)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<s$;t++)this.on(nE[t]+ZU,this._setTextData);this._setTextData()}_sceneFunc(e){var t,n;const r=this.textArr,o=r.length;if(!this.text())return;let i=this.padding(),s=this.fontSize(),a=this.lineHeight()*s,l=this.verticalAlign(),u=this.direction(),d=0,f=this.align(),p=this.getWidth(),g=this.letterSpacing(),m=this.charRenderFunc(),v=this.fill(),C=this.textDecoration(),w=this.underlineOffset(),S=C.indexOf("underline")!==-1,y=C.indexOf("line-through")!==-1,k;u=u===qI?e.direction:u;let x=a/2,M=QI;if(!Tt.legacyTextRendering){const z=this.measureSize("M");M="alphabetic",x=(((t=z.fontBoundingBoxAscent)!==null&&t!==void 0?t:z.actualBoundingBoxAscent)-((n=z.fontBoundingBoxDescent)!==null&&n!==void 0?n:z.actualBoundingBoxDescent))/2+a/2}for(u===eE&&e.setAttr("direction",u),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",M),e.setAttr("textAlign",ZI),l===QI?d=(this.getHeight()-o*a-i*2)/2:l===t$&&(d=this.getHeight()-o*a-i*2),e.translate(i,d+i),k=0;k<o;k++){let z=0,q=0;const B=r[k],L=B.text,V=B.width,T=B.lastInParagraph;if(e.save(),f===r$?z+=p-V-i*2:f===XU&&(z+=(p-V-i*2)/2),S){e.save(),e.beginPath();const R=w??(Tt.legacyTextRendering?Math.round(s/2):Math.round(s/4)),H=z,G=x+q+R;e.moveTo(H,G);const ee=f===Ah&&!T?p-i*2:V;e.lineTo(H+Math.round(ee),G),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}const $=z;if(u!==eE&&(g!==0||f===Ah||m)){const R=L.split(" ").length-1,H=Hl(L);for(let G=0;G<H.length;G++){const ee=H[G];if(ee===" "&&!T&&f===Ah&&(z+=(p-i*2-V)/R),this._partialTextX=z,this._partialTextY=x+q,this._partialText=ee,m){e.save();const J=r.slice(0,k).reduce((X,xe)=>X+Hl(xe.text).length,0);m({char:ee,index:G+J,x:z,y:x+q,lineIndex:k,column:G,isLastInLine:T,width:this.measureSize(ee).width,context:e})}e.fillStrokeShape(this),m&&e.restore(),z+=this.measureSize(ee).width+g}}else g!==0&&e.setAttr("letterSpacing",`${g}px`),this._partialTextX=z,this._partialTextY=x+q,this._partialText=L,e.fillStrokeShape(this);if(y){e.save(),e.beginPath();const R=Tt.legacyTextRendering?0:-Math.round(s/4),H=$;e.moveTo(H,x+q+R);const G=f===Ah&&!T?p-i*2:V;e.lineTo(H+Math.round(G),x+q+R),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}e.restore(),o>1&&(x+=a)}}_hitFunc(e){const t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){const t=Fe._isString(e)?e:e==null?"":e+"";return this._setAttr(QU,t),this}getWidth(){return this.attrs.width===pd||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===pd||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Fe.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n,r,o,i,s,a,l,u,d,f;let p=T1(),g=this.fontSize(),m;p.save(),p.font=this._getContextFont(),m=p.measureText(e),p.restore();const v=g/100;return{actualBoundingBoxAscent:(t=m.actualBoundingBoxAscent)!==null&&t!==void 0?t:71.58203125*v,actualBoundingBoxDescent:(n=m.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(r=m.actualBoundingBoxLeft)!==null&&r!==void 0?r:-7.421875*v,actualBoundingBoxRight:(o=m.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*v,alphabeticBaseline:(i=m.alphabeticBaseline)!==null&&i!==void 0?i:0,emHeightAscent:(s=m.emHeightAscent)!==null&&s!==void 0?s:100*v,emHeightDescent:(a=m.emHeightDescent)!==null&&a!==void 0?a:-20*v,fontBoundingBoxAscent:(l=m.fontBoundingBoxAscent)!==null&&l!==void 0?l:91*v,fontBoundingBoxDescent:(u=m.fontBoundingBoxDescent)!==null&&u!==void 0?u:21*v,hangingBaseline:(d=m.hangingBaseline)!==null&&d!==void 0?d:72.80000305175781*v,ideographicBaseline:(f=m.ideographicBaseline)!==null&&f!==void 0?f:-21*v,width:m.width,height:g}}_getContextFont(){return this.fontStyle()+pg+this.fontVariant()+pg+(this.fontSize()+n$)+l$(this.fontFamily())}_addTextLine(e){this.align()===Ah&&(e=e.trim());const t=this._getTextWidth(e);return this.textArr.push({text:e,width:t,lastInParagraph:!1})}_getTextWidth(e){const t=this.letterSpacing(),n=e.length;return T1().measureText(e).width+t*n}_setTextData(){let e=this.text().split(`
|
|
105
105
|
`),t=+this.fontSize(),n=0,r=this.lineHeight()*t,o=this.attrs.width,i=this.attrs.height,s=o!==pd&&o!==void 0,a=i!==pd&&i!==void 0,l=this.padding(),u=o-l*2,d=i-l*2,f=0,p=this.wrap(),g=p!==i$&&p!==tE,m=this.ellipsis();this.textArr=[],T1().font=this._getContextFont();const v=m?this._getTextWidth(E1):0;for(let C=0,w=e.length;C<w;++C){let S=e[C],y=this._getTextWidth(S);if(s&&y>u)for(;S.length>0;){let k=0,x=Hl(S).length,M="",z=0;for(;k<x;){const q=k+x>>>1,B=Hl(S).slice(0,q+1).join(""),L=this._getTextWidth(B);(m&&a&&f+r>d?L+v:L)<=u?(k=q+1,M=B,z=L):x=q}if(M){if(g){const q=Hl(S),B=Hl(M),L=q[B.length],V=L===pg||L===XI;let T;if(V&&z<=u)T=B.length;else{const $=B.lastIndexOf(pg),R=B.lastIndexOf(XI);T=Math.max($,R)+1}T>0&&(k=T,M=q.slice(0,k).join(""),z=this._getTextWidth(M))}if(M=M.trimRight(),this._addTextLine(M),n=Math.max(n,z),f+=r,this._shouldHandleEllipsis(f)){this._tryToAddEllipsisToLastLine();break}if(S=Hl(S).slice(k).join("").trimLeft(),S.length>0&&(y=this._getTextWidth(S),y<=u)){this._addTextLine(S),f+=r,n=Math.max(n,y);break}}else break}else this._addTextLine(S),f+=r,n=Math.max(n,y),this._shouldHandleEllipsis(f)&&C<w-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),a&&f+r>d)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){const t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,o=r!==pd&&r!==void 0,i=r-this.padding()*2;return this.wrap()===tE||o&&e+n>i}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==pd&&e!==void 0,n=e-this.padding()*2,r=this.ellipsis(),o=this.textArr[this.textArr.length-1];!o||!r||(t&&(this._getTextWidth(o.text+E1)<n||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+E1))}getStrokeScaleEnabled(){return!0}_useBufferCanvas(){const e=this.textDecoration().indexOf("underline")!==-1||this.textDecoration().indexOf("line-through")!==-1,t=this.hasShadow();return e&&t||t&&this.getAbsoluteOpacity()!==1&&a$()?!0:super._useBufferCanvas()}};mr.prototype._fillFunc=c$,mr.prototype._strokeFunc=u$,mr.prototype.className=JU,mr.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],xr(mr),ge.overWriteSetter(mr,"width",c1()),ge.overWriteSetter(mr,"height",c1()),ge.addGetterSetter(mr,"direction",qI),ge.addGetterSetter(mr,"fontFamily","Arial"),ge.addGetterSetter(mr,"fontSize",12,_t()),ge.addGetterSetter(mr,"fontStyle",JI),ge.addGetterSetter(mr,"fontVariant",JI),ge.addGetterSetter(mr,"padding",0,_t()),ge.addGetterSetter(mr,"align",ZI),ge.addGetterSetter(mr,"verticalAlign",e$),ge.addGetterSetter(mr,"lineHeight",1,_t()),ge.addGetterSetter(mr,"wrap",o$),ge.addGetterSetter(mr,"ellipsis",!1,Cs()),ge.addGetterSetter(mr,"letterSpacing",0,_t()),ge.addGetterSetter(mr,"text","",Bc()),ge.addGetterSetter(mr,"textDecoration",""),ge.addGetterSetter(mr,"underlineOffset",void 0,_t()),ge.addGetterSetter(mr,"charRenderFunc",void 0);var f$="",rE="normal";function oE(e){e.fillText(this.partialText,0,0)}function iE(e){e.strokeText(this.partialText,0,0)}var ro=class extends wt{constructor(e){super(e),this.dummyCanvas=Fe.createCanvasElement(),this.dataArray=[],this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute(),this._setTextData()}),this.on("textChange.konva alignChange.konva letterSpacingChange.konva kerningFuncChange.konva fontSizeChange.konva fontFamilyChange.konva",this._setTextData),this._setTextData()}_getTextPathLength(){return qi.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:qi.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=qi.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(e){e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",this.textBaseline()),e.setAttr("textAlign","left"),e.save();const t=this.textDecoration(),n=this.fill(),r=this.fontSize(),o=this.glyphInfo,i=t.indexOf("underline")!==-1,s=t.indexOf("line-through")!==-1;i&&e.beginPath();for(let a=0;a<o.length;a++){e.save();const l=o[a].p0;e.translate(l.x,l.y),e.rotate(o[a].rotation),this.partialText=o[a].text,e.fillStrokeShape(this),i&&(a===0&&e.moveTo(0,r/2+1),e.lineTo(o[a].width,r/2+1)),e.restore()}if(i&&(e.strokeStyle=n,e.lineWidth=r/20,e.stroke()),s){e.beginPath();for(let a=0;a<o.length;a++){e.save();const l=o[a].p0;e.translate(l.x,l.y),e.rotate(o[a].rotation),a===0&&e.moveTo(0,0),e.lineTo(o[a].width,0),e.restore()}e.strokeStyle=n,e.lineWidth=r/20,e.stroke()}e.restore()}_hitFunc(e){e.beginPath();const t=this.glyphInfo;if(t.length>=1){const n=t[0].p0;e.moveTo(n.x,n.y)}for(let n=0;n<t.length;n++){const r=t[n].p1;e.lineTo(r.x,r.y)}e.setAttr("lineWidth",this.fontSize()),e.setAttr("strokeStyle",this.colorKey),e.stroke()}getTextWidth(){return this.textWidth}getTextHeight(){return Fe.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return mr.prototype.setText.call(this,e)}_getContextFont(){return mr.prototype._getContextFont.call(this)}_getTextSize(e){const t=this.dummyCanvas.getContext("2d");t.save(),t.font=this._getContextFont();const n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const e=Hl(this.text()),t=[];let n=0;for(let p=0;p<e.length;p++)t.push({char:e[p],width:this._getTextSize(e[p]).width}),n+=t[p].width;const{width:r,height:o}=this._getTextSize(this.attrs.text);if(this.textWidth=n,this.textHeight=o,this.glyphInfo=[],!this.attrs.data)return null;const i=this.letterSpacing(),s=this.align(),a=this.kerningFunc(),l=Math.max(0,n-r),u=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let d=0;s==="center"&&(d=Math.max(0,this.pathLength/2-u/2)),s==="right"&&(d=Math.max(0,this.pathLength-u));let f=d;for(let p=0;p<t.length;p++){const g=this._getPointAtLength(f);if(!g)return;const m=t[p].char;let v=t[p].width+i;if(m===" "&&s==="justify"){const M=this.text().split(" ").length-1;v+=(this.pathLength-u)/M}const C=f+v,w=this._getPointAtLength(C>this.pathLength&&C-this.pathLength<=l?this.pathLength:C);if(!w)return;const S=qi.getLineLength(g.x,g.y,w.x,w.y);let y=0;if(a)try{y=a(t[p-1].char,m)*this.fontSize()}catch{y=0}g.x+=y,w.x+=y,this.textWidth+=y;const k=qi.getPointOnLine(y+S/2,g.x,g.y,w.x,w.y),x=Math.atan2(w.y-g.y,w.x-g.x);this.glyphInfo.push({transposeX:k.x,transposeY:k.y,text:e[p],rotation:x,p0:g,p1:w,width:S}),f+=v}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const e=[];this.glyphInfo.forEach(function(l){e.push(l.p0.x),e.push(l.p0.y),e.push(l.p1.x),e.push(l.p1.y)});let t=e[0]||0,n=e[0]||0,r=e[1]||0,o=e[1]||0,i,s;for(let l=0;l<e.length/2;l++)i=e[l*2],s=e[l*2+1],t=Math.min(t,i),n=Math.max(n,i),r=Math.min(r,s),o=Math.max(o,s);const a=this.fontSize();return{x:t-a/2,y:r-a/2,width:n-t+a,height:o-r+a}}destroy(){return Fe.releaseCanvas(this.dummyCanvas),super.destroy()}};ro.prototype._fillFunc=oE,ro.prototype._strokeFunc=iE,ro.prototype._fillFuncHit=oE,ro.prototype._strokeFuncHit=iE,ro.prototype.className="TextPath",ro.prototype._attrsAffectingSize=["text","fontSize","data"],xr(ro),ge.addGetterSetter(ro,"data"),ge.addGetterSetter(ro,"fontFamily","Arial"),ge.addGetterSetter(ro,"fontSize",12,_t()),ge.addGetterSetter(ro,"fontStyle",rE),ge.addGetterSetter(ro,"align","left"),ge.addGetterSetter(ro,"letterSpacing",0,_t()),ge.addGetterSetter(ro,"textBaseline","middle"),ge.addGetterSetter(ro,"fontVariant",rE),ge.addGetterSetter(ro,"text",f$),ge.addGetterSetter(ro,"textDecoration",""),ge.addGetterSetter(ro,"kerningFunc",void 0);var sE="tr-konva",h$=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(e=>e+`.${sE}`).join(" "),aE="nodesRect",p$=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],m$={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},g$="ontouchstart"in Tt._global;function v$(e,t,n){if(e==="rotater")return n;t+=Fe.degToRad(m$[e]||0);const r=(Fe.radToDeg(t)%360+360)%360;return Fe._inRange(r,337.5,360)||Fe._inRange(r,0,22.5)?"ns-resize":Fe._inRange(r,22.5,67.5)?"nesw-resize":Fe._inRange(r,67.5,112.5)?"ew-resize":Fe._inRange(r,112.5,157.5)?"nwse-resize":Fe._inRange(r,157.5,202.5)?"ns-resize":Fe._inRange(r,202.5,247.5)?"nesw-resize":Fe._inRange(r,247.5,292.5)?"ew-resize":Fe._inRange(r,292.5,337.5)?"nwse-resize":(Fe.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var gg=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function y$(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function lE(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),o=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return{...e,rotation:e.rotation+t,x:r,y:o}}function b$(e,t){return lE(e,t,y$(e))}function w$(e,t,n){let r=t;for(let o=0;o<e.length;o++){const i=Tt.getAngle(e[o]),s=Math.abs(i-t)%(Math.PI*2);Math.min(s,Math.PI*2-s)<n&&(r=i)}return r}var x1=0,On=class extends dd{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._elementsCreated=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(h$,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Fe.warn("tr.setNode(shape), tr.node(shape) and tr.attachTo(shape) methods are deprecated. Please use tr.nodes(nodesArray) instead."),this.setNodes([e])}getNode(){return this._nodes&&this._nodes[0]}_getEventNamespace(){return sE+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const t=e.filter(n=>n.isAncestorOf(this)?(Fe.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);return this._nodes=e=t,e.length===1&&this.useSingleNodeRotation()?this.rotation(e[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(n=>{const r=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()};if(n._attrsAffectingSize.length){const o=n._attrsAffectingSize.map(i=>i+"Change."+this._getEventNamespace()).join(" ");n.on(o,r)}n.on(p$.map(o=>o+`.${this._getEventNamespace()}`).join(" "),r),n.on(`absoluteTransformChange.${this._getEventNamespace()}`,r),this._proxyDrag(n)}),this._resetTransformCache(),this.findOne(".top-left")&&this.update(),this}_proxyDrag(e){let t;e.on(`dragstart.${this._getEventNamespace()}`,n=>{t=e.getAbsolutePosition(),!this.isDragging()&&e!==this.findOne(".back")&&this.startDrag(n,!1)}),e.on(`dragmove.${this._getEventNamespace()}`,n=>{if(!t)return;const r=e.getAbsolutePosition(),o=r.x-t.x,i=r.y-t.y;this.nodes().forEach(s=>{if(s===e||s.isDragging())return;const a=s.getAbsolutePosition();s.setAbsolutePosition({x:a.x+o,y:a.y+i}),s.startDrag(n)}),t=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(e=>{e.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(aE),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(aE,this.__getNodeRect)}__getNodeShape(e,t=this.rotation(),n){const r=e.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=e.getAbsoluteScale(n),i=e.getAbsolutePosition(n),s=r.x*o.x-e.offsetX()*o.x,a=r.y*o.y-e.offsetY()*o.y,l=(Tt.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return lE({x:i.x+s*Math.cos(l)+a*Math.sin(-l),y:i.y+a*Math.cos(l)+s*Math.sin(l),width:r.width*o.x,height:r.height*o.y,rotation:l},-Tt.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const e=[];this.nodes().map(a=>{const l=a.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),u=[{x:l.x,y:l.y},{x:l.x+l.width,y:l.y},{x:l.x+l.width,y:l.y+l.height},{x:l.x,y:l.y+l.height}],d=a.getAbsoluteTransform();u.forEach(function(f){const p=d.point(f);e.push(p)})});const t=new ws;t.rotate(-Tt.getAngle(this.rotation()));let n=1/0,r=1/0,o=-1/0,i=-1/0;e.forEach(function(a){const l=t.point(a);n===void 0&&(n=o=l.x,r=i=l.y),n=Math.min(n,l.x),r=Math.min(r,l.y),o=Math.max(o,l.x),i=Math.max(i,l.y)}),t.invert();const s=t.point({x:n,y:r});return{x:s.x,y:s.y,width:o-n,height:i-r,rotation:Tt.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),gg.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(e){const t=new _h({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:g$?10:"auto"}),n=this;t.on("mousedown touchstart",function(r){n._handleMouseDown(r)}),t.on("dragstart",r=>{t.stopDrag(),r.cancelBubble=!0}),t.on("dragend",r=>{r.cancelBubble=!0}),t.on("mouseenter",()=>{const r=v$(e,Tt.getAngle(this.rotation()),this.rotateAnchorCursor());t.getStage().content&&(t.getStage().content.style.cursor=r),this._cursorChange=!0}),t.on("mouseout",()=>{t.getStage().content&&(t.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(t)}_createBack(){const e=new wt({name:"back",width:0,height:0,sceneFunc(t,n){const r=n.getParent(),o=r.padding(),i=n.width(),s=n.height();if(t.beginPath(),t.rect(-o,-o,i+o*2,s+o*2),r.rotateEnabled()&&r.rotateLineVisible()){const a=r.rotateAnchorAngle(),l=r.rotateAnchorOffset(),u=Fe.degToRad(a),d=Math.sin(u),f=-Math.cos(u),p=i/2,g=s/2;let m=1/0;f<0?m=Math.min(m,-g/f):f>0&&(m=Math.min(m,(s-g)/f)),d<0?m=Math.min(m,-p/d):d>0&&(m=Math.min(m,(i-p)/d));const v=p+d*m,C=g+f*m,w=Fe._sign(s),S=v+d*l*w,y=C+f*l*w;t.moveTo(v,C),t.lineTo(S,y)}t.fillStrokeShape(n)},hitFunc:(t,n)=>{if(!this.shouldOverdrawWholeArea())return;const r=this.padding();t.beginPath(),t.rect(-r,-r,n.width()+r*2,n.height()+r*2),t.fillStrokeShape(n)}});this.add(e),this._proxyDrag(e),e.on("dragstart",t=>{t.cancelBubble=!0}),e.on("dragmove",t=>{t.cancelBubble=!0}),e.on("dragend",t=>{t.cancelBubble=!0}),this.on("dragmove",t=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const t=this._getNodeRect(),n=t.width,r=t.height,o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/o),this.cos=Math.abs(n/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const i=e.target.getAbsolutePosition(),s=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-i.x,y:s.y-i.y},x1++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(a=>{a._fire("transformstart",{evt:e.evt,target:a})})}_handleMouseMove(e){let t,n,r;const o=this.findOne("."+this._movingAnchorName),i=o.getStage();i.setPointersPositions(e);const s=i.getPointerPosition();let a={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const l=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(a=this.anchorDragBoundFunc()(l,a,e)),o.setAbsolutePosition(a);const u=o.getAbsolutePosition();if(l.x===u.x&&l.y===u.y)return;if(this._movingAnchorName==="rotater"){const w=this._getNodeRect();t=o.x()-w.width/2,n=-o.y()+w.height/2;const S=Tt.getAngle(this.rotateAnchorAngle());let y=Math.atan2(-n,t)+Math.PI/2-S;w.height<0&&(y-=Math.PI);const k=Tt.getAngle(this.rotation())+y,x=Tt.getAngle(this.rotationSnapTolerance()),M=b$(w,w$(this.rotationSnaps(),k,x)-w.rotation);this._fitNodesInto(M,e);return}const d=this.shiftBehavior();let f;d==="inverted"?f=this.keepRatio()&&!e.shiftKey:d==="none"?f=this.keepRatio():f=this.keepRatio()||e.shiftKey;let p=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(f){const w=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(w.x-o.x(),2)+Math.pow(w.y-o.y(),2));const S=this.findOne(".top-left").x()>w.x?-1:1,y=this.findOne(".top-left").y()>w.y?-1:1;t=r*this.cos*S,n=r*this.sin*y,this.findOne(".top-left").x(w.x-t),this.findOne(".top-left").y(w.y-n)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(f){const w=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(o.x()-w.x,2)+Math.pow(w.y-o.y(),2));const S=this.findOne(".top-right").x()<w.x?-1:1,y=this.findOne(".top-right").y()>w.y?-1:1;t=r*this.cos*S,n=r*this.sin*y,this.findOne(".top-right").x(w.x+t),this.findOne(".top-right").y(w.y-n)}var g=o.position();this.findOne(".top-left").y(g.y),this.findOne(".bottom-right").x(g.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(f){const w=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(w.x-o.x(),2)+Math.pow(o.y()-w.y,2));const S=w.x<o.x()?-1:1,y=o.y()<w.y?-1:1;t=r*this.cos*S,n=r*this.sin*y,o.x(w.x-t),o.y(w.y+n)}g=o.position(),this.findOne(".top-left").x(g.x),this.findOne(".bottom-right").y(g.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(o.y());else if(this._movingAnchorName==="bottom-right"){if(f){const w=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(o.x()-w.x,2)+Math.pow(o.y()-w.y,2));const S=this.findOne(".bottom-right").x()<w.x?-1:1,y=this.findOne(".bottom-right").y()<w.y?-1:1;t=r*this.cos*S,n=r*this.sin*y,this.findOne(".bottom-right").x(w.x+t),this.findOne(".bottom-right").y(w.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(p=this.centeredScaling()||e.altKey,p){const w=this.findOne(".top-left"),S=this.findOne(".bottom-right"),y=w.x(),k=w.y(),x=this.getWidth()-S.x(),M=this.getHeight()-S.y();S.move({x:-y,y:-k}),w.move({x,y:M})}const m=this.findOne(".top-left").getAbsolutePosition();t=m.x,n=m.y;const v=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),C=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:v,height:C,rotation:Tt.getAngle(this.rotation())},e)}_handleMouseUp(e){this._removeEvents(e)}getAbsoluteTransform(){return this.getTransform()}_removeEvents(e){var t;if(this._transforming){this._transforming=!1,typeof window<"u"&&(window.removeEventListener("mousemove",this._handleMouseMove),window.removeEventListener("touchmove",this._handleMouseMove),window.removeEventListener("mouseup",this._handleMouseUp,!0),window.removeEventListener("touchend",this._handleMouseUp,!0));const n=this.getNode();x1--,this._fire("transformend",{evt:e,target:n}),(t=this.getLayer())===null||t===void 0||t.batchDraw(),n&&this._nodes.forEach(r=>{var o;r._fire("transformend",{evt:e,target:r}),(o=r.getLayer())===null||o===void 0||o.batchDraw()}),this._movingAnchorName=null}}_fitNodesInto(e,t){const n=this._getNodeRect(),r=1;if(Fe._inRange(e.width,-this.padding()*2-r,r)){this.update();return}if(Fe._inRange(e.height,-this.padding()*2-r,r)){this.update();return}const o=new ws;if(o.rotate(Tt.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const f=o.point({x:-this.padding()*2,y:0});e.x+=f.x,e.y+=f.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const f=o.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const f=o.point({x:0,y:-this.padding()*2});e.x+=f.x,e.y+=f.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const f=o.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const f=this.boundBoxFunc()(n,e);f?e=f:Fe.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,s=new ws;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/i,n.height/i);const a=new ws,l=e.width/i,u=e.height/i;this.flipEnabled()===!1?(a.translate(e.x,e.y),a.rotate(e.rotation),a.translate(e.width<0?e.width:0,e.height<0?e.height:0),a.scale(Math.abs(l),Math.abs(u))):(a.translate(e.x,e.y),a.rotate(e.rotation),a.scale(l,u));const d=a.multiply(s.invert());this._nodes.forEach(f=>{var p;if(!f.getStage())return;const g=f.getParent().getAbsoluteTransform(),m=f.getTransform().copy();m.translate(f.offsetX(),f.offsetY());const v=new ws;v.multiply(g.copy().invert()).multiply(d).multiply(g).multiply(m);const C=v.decompose();f.setAttrs(C),(p=f.getLayer())===null||p===void 0||p.batchDraw()}),this.rotation(Fe._getRotation(e.rotation)),this._nodes.forEach(f=>{this._fire("transform",{evt:t,target:f}),f._fire("transform",{evt:t,target:f})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e;const t=this._getNodeRect();this.rotation(Fe._getRotation(t.rotation));const n=t.width,r=t.height,o=this.enabledAnchors(),i=this.resizeEnabled(),s=this.padding(),a=this.anchorSize(),l=this.find("._anchor");l.forEach(x=>{x.setAttrs({width:a,height:a,offsetX:a/2,offsetY:a/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:a/2+s,offsetY:a/2+s,visible:i&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:a/2+s,visible:i&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:a/2-s,offsetY:a/2+s,visible:i&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:a/2+s,visible:i&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:a/2-s,visible:i&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:a/2+s,offsetY:a/2-s,visible:i&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:a/2-s,visible:i&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:a/2-s,offsetY:a/2-s,visible:i&&o.indexOf("bottom-right")>=0});const u=this.rotateAnchorAngle(),d=this.rotateAnchorOffset(),f=Fe.degToRad(u),p=Math.sin(f),g=-Math.cos(f),m=n/2,v=r/2;let C=1/0;g<0?C=Math.min(C,-v/g):g>0&&(C=Math.min(C,(r-v)/g)),p<0?C=Math.min(C,-m/p):p>0&&(C=Math.min(C,(n-m)/p));const w=m+p*C,S=v+g*C,y=Fe._sign(r);this._batchChangeChild(".rotater",{x:w+p*d*y,y:S+g*d*y-s*g,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(x=>x.draggable()),x:0,y:0});const k=this.anchorStyleFunc();k&&l.forEach(x=>{k(x)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),dd.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(Fe.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this):super.add(...e)}toObject(){return xt.prototype.toObject.call(this)}clone(e){return xt.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};On.isTransforming=()=>x1>0;function C$(e){return e instanceof Array||Fe.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){gg.indexOf(t)===-1&&Fe.warn("Unknown anchor name: "+t+". Available names are: "+gg.join(", "))}),e||[]}On.prototype.className="Transformer",xr(On),ge.addGetterSetter(On,"enabledAnchors",gg,C$),ge.addGetterSetter(On,"flipEnabled",!0,Cs()),ge.addGetterSetter(On,"resizeEnabled",!0),ge.addGetterSetter(On,"anchorSize",10,_t()),ge.addGetterSetter(On,"rotateEnabled",!0),ge.addGetterSetter(On,"rotateLineVisible",!0),ge.addGetterSetter(On,"rotationSnaps",[]),ge.addGetterSetter(On,"rotateAnchorOffset",50,_t()),ge.addGetterSetter(On,"rotateAnchorAngle",0,_t()),ge.addGetterSetter(On,"rotateAnchorCursor","crosshair"),ge.addGetterSetter(On,"rotationSnapTolerance",5,_t()),ge.addGetterSetter(On,"borderEnabled",!0),ge.addGetterSetter(On,"anchorStroke","rgb(0, 161, 255)"),ge.addGetterSetter(On,"anchorStrokeWidth",1,_t()),ge.addGetterSetter(On,"anchorFill","white"),ge.addGetterSetter(On,"anchorCornerRadius",0,_t()),ge.addGetterSetter(On,"borderStroke","rgb(0, 161, 255)"),ge.addGetterSetter(On,"borderStrokeWidth",1,_t()),ge.addGetterSetter(On,"borderDash"),ge.addGetterSetter(On,"keepRatio",!0),ge.addGetterSetter(On,"shiftBehavior","default"),ge.addGetterSetter(On,"centeredScaling",!1),ge.addGetterSetter(On,"ignoreStroke",!1),ge.addGetterSetter(On,"padding",0,_t()),ge.addGetterSetter(On,"nodes"),ge.addGetterSetter(On,"node"),ge.addGetterSetter(On,"boundBoxFunc"),ge.addGetterSetter(On,"anchorDragBoundFunc"),ge.addGetterSetter(On,"anchorStyleFunc"),ge.addGetterSetter(On,"shouldOverdrawWholeArea",!1),ge.addGetterSetter(On,"useSingleNodeRotation",!0),ge.backCompat(On,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Wa=class extends wt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Tt.getAngle(this.angle()),this.clockwise()),e.lineTo(0,0),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius(e/2)}setHeight(e){this.radius(e/2)}};Wa.prototype.className="Wedge",Wa.prototype._centroid=!0,Wa.prototype._attrsAffectingSize=["radius"],xr(Wa),ge.addGetterSetter(Wa,"radius",0,_t()),ge.addGetterSetter(Wa,"angle",0,_t()),ge.addGetterSetter(Wa,"clockwise",!1),ge.backCompat(Wa,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function cE(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var k$=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],S$=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function _$(e,t){const n=e.data,r=e.width,o=e.height;let i,s,a,l,u,d,f,p,g,m,v,C,w,S,y,k,x,M,z,q;const B=t+t+1,L=r-1,V=o-1,T=t+1,$=T*(T+1)/2,R=new cE,H=k$[t],G=S$[t];let ee=null,J=R,X=null,xe=null;for(let fe=1;fe<B;fe++)J=J.next=new cE,fe===T&&(ee=J);J.next=R,a=s=0;for(let fe=0;fe<o;fe++){C=w=S=y=l=u=d=f=0,p=T*(k=n[s]),g=T*(x=n[s+1]),m=T*(M=n[s+2]),v=T*(z=n[s+3]),l+=$*k,u+=$*x,d+=$*M,f+=$*z,J=R;for(let ye=0;ye<T;ye++)J.r=k,J.g=x,J.b=M,J.a=z,J=J.next;for(let ye=1;ye<T;ye++)i=s+((L<ye?L:ye)<<2),l+=(J.r=k=n[i])*(q=T-ye),u+=(J.g=x=n[i+1])*q,d+=(J.b=M=n[i+2])*q,f+=(J.a=z=n[i+3])*q,C+=k,w+=x,S+=M,y+=z,J=J.next;X=R,xe=ee;for(let ye=0;ye<r;ye++)n[s+3]=z=f*H>>G,z!==0?(z=255/z,n[s]=(l*H>>G)*z,n[s+1]=(u*H>>G)*z,n[s+2]=(d*H>>G)*z):n[s]=n[s+1]=n[s+2]=0,l-=p,u-=g,d-=m,f-=v,p-=X.r,g-=X.g,m-=X.b,v-=X.a,i=a+((i=ye+t+1)<L?i:L)<<2,C+=X.r=n[i],w+=X.g=n[i+1],S+=X.b=n[i+2],y+=X.a=n[i+3],l+=C,u+=w,d+=S,f+=y,X=X.next,p+=k=xe.r,g+=x=xe.g,m+=M=xe.b,v+=z=xe.a,C-=k,w-=x,S-=M,y-=z,xe=xe.next,s+=4;a+=r}for(let fe=0;fe<r;fe++){w=S=y=C=u=d=f=l=0,s=fe<<2,p=T*(k=n[s]),g=T*(x=n[s+1]),m=T*(M=n[s+2]),v=T*(z=n[s+3]),l+=$*k,u+=$*x,d+=$*M,f+=$*z,J=R;for(let ve=0;ve<T;ve++)J.r=k,J.g=x,J.b=M,J.a=z,J=J.next;let ye=r;for(let ve=1;ve<=t;ve++)s=ye+fe<<2,l+=(J.r=k=n[s])*(q=T-ve),u+=(J.g=x=n[s+1])*q,d+=(J.b=M=n[s+2])*q,f+=(J.a=z=n[s+3])*q,C+=k,w+=x,S+=M,y+=z,J=J.next,ve<V&&(ye+=r);s=fe,X=R,xe=ee;for(let ve=0;ve<o;ve++)i=s<<2,n[i+3]=z=f*H>>G,z>0?(z=255/z,n[i]=(l*H>>G)*z,n[i+1]=(u*H>>G)*z,n[i+2]=(d*H>>G)*z):n[i]=n[i+1]=n[i+2]=0,l-=p,u-=g,d-=m,f-=v,p-=X.r,g-=X.g,m-=X.b,v-=X.a,i=fe+((i=ve+T)<V?i:V)*r<<2,l+=C+=X.r=n[i],u+=w+=X.g=n[i+1],d+=S+=X.b=n[i+2],f+=y+=X.a=n[i+3],X=X.next,p+=k=xe.r,g+=x=xe.g,m+=M=xe.b,v+=z=xe.a,C-=k,w-=x,S-=M,y-=z,xe=xe.next,s+=r}}var A$=function(t){const n=Math.round(this.blurRadius());n>0&&_$(t,n)};ge.addGetterSetter(xt,"blurRadius",0,_t(),ge.afterSetFilter);var I$=function(e){const t=this.brightness()*255,n=e.data,r=n.length;for(let o=0;o<r;o+=4)n[o]+=t,n[o+1]+=t,n[o+2]+=t};ge.addGetterSetter(xt,"brightness",0,_t(),ge.afterSetFilter);var E$=function(e){const t=this.brightness(),n=e.data,r=n.length;for(let o=0;o<r;o+=4)n[o]=Math.min(255,n[o]*t),n[o+1]=Math.min(255,n[o+1]*t),n[o+2]=Math.min(255,n[o+2]*t)},T$=function(e){const t=Math.pow((this.contrast()+100)/100,2),n=e.data,r=n.length;let o=150,i=150,s=150;for(let a=0;a<r;a+=4)o=n[a],i=n[a+1],s=n[a+2],o/=255,o-=.5,o*=t,o+=.5,o*=255,i/=255,i-=.5,i*=t,i+=.5,i*=255,s/=255,s-=.5,s*=t,s+=.5,s*=255,o=o<0?0:o>255?255:o,i=i<0?0:i>255?255:i,s=s<0?0:s>255?255:s,n[a]=o,n[a+1]=i,n[a+2]=s};ge.addGetterSetter(xt,"contrast",0,_t(),ge.afterSetFilter);var x$=function(e){var t,n,r,o,i,s,a,l,u;const d=e.data,f=e.width,p=e.height,g=Math.min(1,Math.max(0,(n=(t=this.embossStrength)===null||t===void 0?void 0:t.call(this))!==null&&n!==void 0?n:.5)),m=Math.min(1,Math.max(0,(o=(r=this.embossWhiteLevel)===null||r===void 0?void 0:r.call(this))!==null&&o!==void 0?o:.5)),v=(a={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(s=(i=this.embossDirection)===null||i===void 0?void 0:i.call(this))!==null&&s!==void 0?s:"top-left"])!==null&&a!==void 0?a:315,C=!!((u=(l=this.embossBlend)===null||l===void 0?void 0:l.call(this))!==null&&u!==void 0&&u),w=g*10,S=m*255,y=v*Math.PI/180,k=Math.cos(y),x=Math.sin(y),M=128/1020*w,z=new Uint8ClampedArray(d),q=new Float32Array(f*p);for(let $=0,R=0;R<d.length;R+=4,$++)q[$]=.2126*z[R]+.7152*z[R+1]+.0722*z[R+2];const B=[-1,0,1,-2,0,2,-1,0,1],L=[-1,-2,-1,0,0,0,1,2,1],V=[-f-1,-f,-f+1,-1,0,1,f-1,f,f+1],T=$=>$<0?0:$>255?255:$;for(let $=1;$<p-1;$++)for(let R=1;R<f-1;R++){const H=$*f+R;let G=0,ee=0;G+=q[H+V[0]]*B[0],ee+=q[H+V[0]]*L[0],G+=q[H+V[1]]*B[1],ee+=q[H+V[1]]*L[1],G+=q[H+V[2]]*B[2],ee+=q[H+V[2]]*L[2],G+=q[H+V[3]]*B[3],ee+=q[H+V[3]]*L[3],G+=q[H+V[5]]*B[5],ee+=q[H+V[5]]*L[5],G+=q[H+V[6]]*B[6],ee+=q[H+V[6]]*L[6],G+=q[H+V[7]]*B[7],ee+=q[H+V[7]]*L[7],G+=q[H+V[8]]*B[8],ee+=q[H+V[8]]*L[8];const J=T(S+(k*G+x*ee)*M),X=H*4;if(C){const xe=J-S;d[X]=T(z[X]+xe),d[X+1]=T(z[X+1]+xe),d[X+2]=T(z[X+2]+xe),d[X+3]=z[X+3]}else d[X]=d[X+1]=d[X+2]=J,d[X+3]=z[X+3]}for(let $=0;$<f;$++){let R=$*4,H=((p-1)*f+$)*4;d[R]=z[R],d[R+1]=z[R+1],d[R+2]=z[R+2],d[R+3]=z[R+3],d[H]=z[H],d[H+1]=z[H+1],d[H+2]=z[H+2],d[H+3]=z[H+3]}for(let $=1;$<p-1;$++){let R=$*f*4,H=($*f+(f-1))*4;d[R]=z[R],d[R+1]=z[R+1],d[R+2]=z[R+2],d[R+3]=z[R+3],d[H]=z[H],d[H+1]=z[H+1],d[H+2]=z[H+2],d[H+3]=z[H+3]}return e};ge.addGetterSetter(xt,"embossStrength",.5,_t(),ge.afterSetFilter),ge.addGetterSetter(xt,"embossWhiteLevel",.5,_t(),ge.afterSetFilter),ge.addGetterSetter(xt,"embossDirection","top-left",void 0,ge.afterSetFilter),ge.addGetterSetter(xt,"embossBlend",!1,void 0,ge.afterSetFilter);function R1(e,t,n,r,o){const i=n-t,s=o-r;if(i===0)return r+s/2;if(s===0)return r;let a=(e-t)/i;return a=s*a+r,a}var R$=function(e){const t=e.data,n=t.length;let r=t[0],o=r,i,s=t[1],a=s,l,u=t[2],d=u,f;const p=this.enhance();if(p===0)return;for(let y=0;y<n;y+=4)i=t[y+0],i<r?r=i:i>o&&(o=i),l=t[y+1],l<s?s=l:l>a&&(a=l),f=t[y+2],f<u?u=f:f>d&&(d=f);o===r&&(o=255,r=0),a===s&&(a=255,s=0),d===u&&(d=255,u=0);let g,m,v,C,w,S;if(p>0)g=o+p*(255-o),m=r-p*(r-0),v=a+p*(255-a),C=s-p*(s-0),w=d+p*(255-d),S=u-p*(u-0);else{const y=(o+r)*.5;g=o+p*(o-y),m=r+p*(r-y);const k=(a+s)*.5;v=a+p*(a-k),C=s+p*(s-k);const x=(d+u)*.5;w=d+p*(d-x),S=u+p*(u-x)}for(let y=0;y<n;y+=4)t[y+0]=R1(t[y+0],r,o,m,g),t[y+1]=R1(t[y+1],s,a,C,v),t[y+2]=R1(t[y+2],u,d,S,w)};ge.addGetterSetter(xt,"enhance",0,_t(),ge.afterSetFilter);var M$=function(e){const t=e.data,n=t.length;for(let r=0;r<n;r+=4){const o=.34*t[r]+.5*t[r+1]+.16*t[r+2];t[r]=o,t[r+1]=o,t[r+2]=o}};ge.addGetterSetter(xt,"hue",0,_t(),ge.afterSetFilter),ge.addGetterSetter(xt,"saturation",0,_t(),ge.afterSetFilter),ge.addGetterSetter(xt,"luminance",0,_t(),ge.afterSetFilter);var L$=function(e){const t=e.data,n=t.length,r=1,o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=this.luminance()*127,a=r*o*Math.cos(i*Math.PI/180),l=r*o*Math.sin(i*Math.PI/180),u=.299*r+.701*a+.167*l,d=.587*r-.587*a+.33*l,f=.114*r-.114*a-.497*l,p=.299*r-.299*a-.328*l,g=.587*r+.413*a+.035*l,m=.114*r-.114*a+.293*l,v=.299*r-.3*a+1.25*l,C=.587*r-.586*a-1.05*l,w=.114*r+.886*a-.2*l;let S,y,k,x;for(let M=0;M<n;M+=4)S=t[M+0],y=t[M+1],k=t[M+2],x=t[M+3],t[M+0]=u*S+d*y+f*k+s,t[M+1]=p*S+g*y+m*k+s,t[M+2]=v*S+C*y+w*k+s,t[M+3]=x},P$=function(e){const t=e.data,n=t.length,r=Math.pow(2,this.value()),o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=r*o*Math.cos(i*Math.PI/180),a=r*o*Math.sin(i*Math.PI/180),l=.299*r+.701*s+.167*a,u=.587*r-.587*s+.33*a,d=.114*r-.114*s-.497*a,f=.299*r-.299*s-.328*a,p=.587*r+.413*s+.035*a,g=.114*r-.114*s+.293*a,m=.299*r-.3*s+1.25*a,v=.587*r-.586*s-1.05*a,C=.114*r+.886*s-.2*a;for(let w=0;w<n;w+=4){const S=t[w+0],y=t[w+1],k=t[w+2],x=t[w+3];t[w+0]=l*S+u*y+d*k,t[w+1]=f*S+p*y+g*k,t[w+2]=m*S+v*y+C*k,t[w+3]=x}};ge.addGetterSetter(xt,"hue",0,_t(),ge.afterSetFilter),ge.addGetterSetter(xt,"saturation",0,_t(),ge.afterSetFilter),ge.addGetterSetter(xt,"value",0,_t(),ge.afterSetFilter);var D$=function(e){const t=e.data,n=t.length;for(let r=0;r<n;r+=4)t[r]=255-t[r],t[r+1]=255-t[r+1],t[r+2]=255-t[r+2]},O$=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),d=i-a,f=s-l;const p=Math.sqrt(d*d+f*f);u=p>u?p:u;const g=s,m=i,v=360/m*Math.PI/180;for(let C=0;C<m;C+=1){const w=Math.sin(C*v),S=Math.cos(C*v);for(let y=0;y<g;y+=1){d=Math.floor(a+u*y/g*S),f=Math.floor(l+u*y/g*w);let k=(f*i+d)*4;const x=r[k+0],M=r[k+1],z=r[k+2],q=r[k+3];k=(C+y*i)*4,o[k+0]=x,o[k+1]=M,o[k+2]=z,o[k+3]=q}}},F$=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),d=i-a,f=s-l;const p=Math.sqrt(d*d+f*f);u=p>u?p:u;const g=s,m=i,v=n.polarRotation||0;let C,w;for(d=0;d<i;d+=1)for(f=0;f<s;f+=1){const S=d-a,y=f-l,k=Math.sqrt(S*S+y*y)*g/u;let x=(Math.atan2(y,S)*180/Math.PI+360+v)%360;x=x*m/360,C=Math.floor(x),w=Math.floor(k);let M=(w*i+C)*4;const z=r[M+0],q=r[M+1],B=r[M+2],L=r[M+3];M=(f*i+d)*4,o[M+0]=z,o[M+1]=q,o[M+2]=B,o[M+3]=L}},N$=function(e){const t=e.width,n=e.height;let r,o,i,s,a,l,u,d,f,p,g=Math.round(this.kaleidoscopePower());const m=Math.round(this.kaleidoscopeAngle()),v=Math.floor(t*(m%360)/360);if(g<1)return;const C=Fe.createCanvasElement();C.width=t,C.height=n;const w=C.getContext("2d").getImageData(0,0,t,n);Fe.releaseCanvas(C),O$(e,w,{polarCenterX:t/2,polarCenterY:n/2});let S=t/Math.pow(2,g);for(;S<=8;)S=S*2,g-=1;S=Math.ceil(S);let y=S,k=0,x=y,M=1;for(v+S>t&&(k=y,x=0,M=-1),o=0;o<n;o+=1)for(r=k;r!==x;r+=M)i=Math.round(r+v)%t,f=(t*o+i)*4,a=w.data[f+0],l=w.data[f+1],u=w.data[f+2],d=w.data[f+3],p=(t*o+r)*4,w.data[p+0]=a,w.data[p+1]=l,w.data[p+2]=u,w.data[p+3]=d;for(o=0;o<n;o+=1)for(y=Math.floor(S),s=0;s<g;s+=1){for(r=0;r<y+1;r+=1)f=(t*o+r)*4,a=w.data[f+0],l=w.data[f+1],u=w.data[f+2],d=w.data[f+3],p=(t*o+y*2-r-1)*4,w.data[p+0]=a,w.data[p+1]=l,w.data[p+2]=u,w.data[p+3]=d;y*=2}F$(w,e,{polarRotation:0})};ge.addGetterSetter(xt,"kaleidoscopePower",2,_t(),ge.afterSetFilter),ge.addGetterSetter(xt,"kaleidoscopeAngle",0,_t(),ge.afterSetFilter);function vg(e,t,n){let r=(n*e.width+t)*4;const o=[];return o.push(e.data[r++],e.data[r++],e.data[r++],e.data[r++]),o}function Eh(e,t){return Math.sqrt(Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)+Math.pow(e[2]-t[2],2))}function B$(e){const t=[0,0,0];for(let n=0;n<e.length;n++)t[0]+=e[n][0],t[1]+=e[n][1],t[2]+=e[n][2];return t[0]/=e.length,t[1]/=e.length,t[2]/=e.length,t}function z$(e,t){const n=vg(e,0,0),r=vg(e,e.width-1,0),o=vg(e,0,e.height-1),i=vg(e,e.width-1,e.height-1),s=t||10;if(Eh(n,r)<s&&Eh(r,i)<s&&Eh(i,o)<s&&Eh(o,n)<s){const a=B$([r,n,i,o]),l=[];for(let u=0;u<e.width*e.height;u++)l[u]=Eh(a,[e.data[u*4],e.data[u*4+1],e.data[u*4+2]])<s?0:255;return l}}function j$(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function V$(e,t,n){const r=[1,1,1,1,0,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,C=r[f*o+p];d+=e[v]*C}}s[u]=d===2040?255:0}return s}function U$(e,t,n){const r=[1,1,1,1,1,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,C=r[f*o+p];d+=e[v]*C}}s[u]=d>=1020?255:0}return s}function $$(e,t,n){const r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,C=r[f*o+p];d+=e[v]*C}}s[u]=d}return s}var H$=function(e){let t=z$(e,this.threshold());return t&&(t=V$(t,e.width,e.height),t=U$(t,e.width,e.height),t=$$(t,e.width,e.height),j$(e,t)),e};ge.addGetterSetter(xt,"threshold",0,_t(),ge.afterSetFilter);var G$=function(e){const t=this.noise()*255,n=e.data,r=n.length,o=t/2;for(let i=0;i<r;i+=4)n[i+0]+=o-2*o*Math.random(),n[i+1]+=o-2*o*Math.random(),n[i+2]+=o-2*o*Math.random()};ge.addGetterSetter(xt,"noise",.2,_t(),ge.afterSetFilter);var W$=function(e){let t=Math.ceil(this.pixelSize()),n=e.width,r=e.height,o=Math.ceil(n/t),i=Math.ceil(r/t),s=e.data;if(t<=0){Fe.error("pixelSize value can not be <= 0");return}for(let a=0;a<o;a+=1)for(let l=0;l<i;l+=1){let u=0,d=0,f=0,p=0;const g=a*t,m=g+t,v=l*t,C=v+t;let w=0;for(let S=g;S<m;S+=1)if(!(S>=n))for(let y=v;y<C;y+=1){if(y>=r)continue;const k=(n*y+S)*4;u+=s[k+0],d+=s[k+1],f+=s[k+2],p+=s[k+3],w+=1}u=u/w,d=d/w,f=f/w,p=p/w;for(let S=g;S<m;S+=1)if(!(S>=n))for(let y=v;y<C;y+=1){if(y>=r)continue;const k=(n*y+S)*4;s[k+0]=u,s[k+1]=d,s[k+2]=f,s[k+3]=p}}};ge.addGetterSetter(xt,"pixelSize",8,_t(),ge.afterSetFilter);var K$=function(e){const t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,o=255/t;for(let i=0;i<r;i+=1)n[i]=Math.floor(n[i]/o)*o};ge.addGetterSetter(xt,"levels",.5,_t(),ge.afterSetFilter);var q$=function(e){const t=e.data,n=t.length,r=this.red(),o=this.green(),i=this.blue();for(let s=0;s<n;s+=4){const a=(.34*t[s]+.5*t[s+1]+.16*t[s+2])/255;t[s]=a*r,t[s+1]=a*o,t[s+2]=a*i,t[s+3]=t[s+3]}};ge.addGetterSetter(xt,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ge.addGetterSetter(xt,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ge.addGetterSetter(xt,"blue",0,uI,ge.afterSetFilter);var Y$=function(e){const t=e.data,n=t.length,r=this.red(),o=this.green(),i=this.blue(),s=this.alpha();for(let a=0;a<n;a+=4){const l=1-s;t[a]=r*s+t[a]*l,t[a+1]=o*s+t[a+1]*l,t[a+2]=i*s+t[a+2]*l}};ge.addGetterSetter(xt,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ge.addGetterSetter(xt,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ge.addGetterSetter(xt,"blue",0,uI,ge.afterSetFilter),ge.addGetterSetter(xt,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var X$=function(e){const t=e.data,n=t.length;for(let r=0;r<n;r+=4){const o=t[r+0],i=t[r+1],s=t[r+2];t[r+0]=Math.min(255,o*.393+i*.769+s*.189),t[r+1]=Math.min(255,o*.349+i*.686+s*.168),t[r+2]=Math.min(255,o*.272+i*.534+s*.131)}},Z$=function(e){const n=e.data;for(let r=0;r<n.length;r+=4){const o=n[r],i=n[r+1],s=n[r+2];.2126*o+.7152*i+.0722*s>=128&&(n[r]=255-o,n[r+1]=255-i,n[r+2]=255-s)}return e},Q$=function(e){const t=this.threshold()*255,n=e.data,r=n.length;for(let o=0;o<r;o+=1)n[o]=n[o]<t?0:255};ge.addGetterSetter(xt,"threshold",.5,_t(),ge.afterSetFilter);var J$=VI.Util._assign(VI,{Arc:Ha,Arrow:Vc,Circle:hd,Ellipse:Vl,Image:ks,Label:I1,Tag:Uc,Line:Ga,Path:qi,Rect:_h,RegularPolygon:Ul,Ring:$c,Sprite:oa,Star:$l,Text:mr,TextPath:ro,Transformer:On,Wedge:Wa,Filters:{Blur:A$,Brightness:E$,Brighten:I$,Contrast:T$,Emboss:x$,Enhance:R$,Grayscale:M$,HSL:L$,HSV:P$,Invert:D$,Kaleidoscope:N$,Mask:H$,Noise:G$,Pixelate:W$,Posterize:K$,RGB:q$,RGBA:Y$,Sepia:X$,Solarize:Z$,Threshold:Q$}}),eH=J$;Nt();var tH=["dialog","floating"],uE=["top-right","top-left","bottom-right","bottom-left","top-center","bottom-center"];function nH(e){if(!e||typeof e!="object")throw new Error("SurfaceManager: request must be a non-null object.");if(!tH.includes(e.mode))throw new Error(`SurfaceManager: mode must be "dialog" or "floating", got "${e.mode}".`);const t="kind"in e&&e.kind!=null,n="component"in e&&e.component!=null,r="render"in e&&typeof e.render=="function";if(n&&r)throw new Error('SurfaceManager: request cannot provide both "component" and "render". Use one or the other.');if(!t&&!n&&!r)throw new Error('SurfaceManager: request must provide "kind" (intent-based) or "component"/"render" (direct-render).');if(e.mode==="floating"&&e.floating?.placement!=null&&!uE.includes(e.floating.placement))throw new Error(`SurfaceManager: floating.placement must be one of ${uE.join(", ")}, got "${e.floating.placement}".`)}var rH=class{activeDialog=Fr(null);activeFloating=Fr(null);#e=!1;#n=1;#t;constructor({getModuleConfig:e}){this.#t=e}open(e){if(this.#e)return this.#c(e);nH(e);const t=this.#u(e),{component:n,props:r,render:o}=this.#h(t);let i,s=!1;const a=new Promise(g=>{i=m=>s?!1:(s=!0,g(m),!0)});let l;const u=g=>{i({status:"submitted",data:g})&&this.#i(l)},d=g=>{i({status:"closed",reason:g})&&this.#i(l)};l={id:t.id,mode:t.mode,request:t,component:n,props:r,render:o,resolve:u,close:d,settle:g=>i(g),get settled(){return s}};const f=t.mode==="dialog"?"activeDialog":"activeFloating",p=this[f].value;return p&&!p.settled&&p.settle({status:"replaced",replacedBy:t.id}),this[f].value=l,{id:t.id,mode:t.mode,close:g=>this.#o(l,g),result:a}}close(e,t){if(e!=null){const o=this.#a(e);o&&this.#o(o,t);return}const n=this.activeDialog.value;if(n&&!n.settled){this.#o(n,t);return}const r=this.activeFloating.value;r&&!r.settled&&this.#o(r,t)}settleAll(e){for(const t of[this.activeDialog,this.activeFloating]){const n=t.value;n&&!n.settled&&n.settle(e),t.value=null}}destroy(){this.#e=!0,this.settleAll({status:"destroyed"})}#o(e,t){e.settled||(e.settle({status:"closed",reason:t}),this.#i(e))}#i(e){const t=e.mode==="dialog"?this.activeDialog:this.activeFloating;t.value===e&&(t.value=null)}#a(e){return this.activeDialog.value?.id===e?this.activeDialog.value:this.activeFloating.value?.id===e?this.activeFloating.value:null}#u(e){const t=e.id??`surface-${this.#n++}`,n=this.#t()??{},r=e.mode==="dialog"?n.dialog:n.floating,o=e.mode==="dialog"?{maxWidth:r?.maxWidth,...e.dialog}:e.dialog,i=e.mode==="floating"?{placement:r?.placement??"top-right",width:r?.width,maxWidth:r?.maxWidth,maxHeight:r?.maxHeight,autoFocus:r?.autoFocus??!0,closeOnOutsidePointerDown:r?.closeOnOutsidePointerDown??!1,...e.floating}:e.floating;return{...e,id:t,closeOnEscape:e.closeOnEscape??r?.closeOnEscape??!0,closeOnBackdrop:e.mode==="dialog"?e.closeOnBackdrop??r?.closeOnBackdrop??!0:!1,dialog:o,floating:i}}#h(e){if("component"in e&&e.component!=null)return{component:e.component,props:e.props};if("render"in e&&typeof e.render=="function")return{render:e.render};const t=this.#t()?.resolver;if(typeof t=="function"){const n=t(e);if(n!=null){if(n.type==="none")throw new Error(`SurfaceManager: resolver explicitly suppressed surface for kind "${e.kind}".`);if(n.type==="custom")return{component:n.component,props:n.props};if(n.type==="external")return{render:n.render}}}throw new Error(`SurfaceManager: no renderer resolved for kind "${e.kind}". Provide a resolver via surfaces.resolver, or use a direct-render request.`)}#c(e){return{id:e?.id??`surface-${this.#n++}`,mode:e?.mode??"dialog",close:()=>{},result:Promise.resolve({status:"destroyed"})}}},oH="https://docs.superdoc.dev/guides/migration/document-api",dE=new Set;function iH(e,t){dE.has(e)||(dE.add(e),console.warn(t))}var sH={state:"editor.state",view:"editor.view",schema:"editor.schema",commands:"editor.commands",chain:"editor.chain()",can:"editor.can()",dispatch:"editor.dispatch()"},fE=Symbol.for("superdoc:rawEditor"),hE=new WeakMap;function pE(e){return!e||e[fE]?e:new Proxy(e,{get(t,n){if(n===fE)return t;const r=sH[n];r&&iH(`deprecated:${String(n)}`,`[SuperDoc] ${r} is deprecated and will be removed in a future version. Use the Document API (editor.doc) instead. See ${oH}`);const o=Reflect.get(t,n,t);if(typeof o=="function"){let i=hE.get(t);return i||(i=new Map,hE.set(t,i)),i.has(n)||i.set(n,o.bind(t)),i.get(n)}return o}})}var mE=["review","original","final","off"],aH=["original","markup","final"],lH=["paired","independent"],gE=Symbol.for("@superdoc/trackChanges:normalized"),vE=new Set;function M1(e,t){vE.has(e)||(vE.add(e),console.warn(`[SuperDoc] ${e} is deprecated β use ${t} instead.`))}function yE(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n}function cH(e,t,n){return typeof e=="string"&&mE.includes(e)?e:typeof t=="string"&&mE.includes(t)?t:n}function uH(e){return typeof e!="string"||!aH.includes(e)?null:e}function dH(e){return e==="markup"?"review":e}function fH(e){return typeof e=="string"&&lH.includes(e)?e:null}function hH(e){return e==="grouped"?"paired":e==="separate"?"independent":null}function pH(e){return e==="paired"?"grouped":"separate"}function Ss(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function L1(e){const t=e[gE]===!0,n=Ss(e.viewing),r=uH(n?.trackedChanges);Ss(e.modules)||(e.modules={});const o=Ss(e.trackChanges),i=Ss(e.modules.trackChanges),s=Ss(e.layoutEngineOptions?.trackedChanges);t||(o&&Object.prototype.hasOwnProperty.call(o,"visible")&&M1("config.trackChanges.visible","config.viewing.trackedChanges"),i&&M1("config.modules.trackChanges","config.trackChanges for behavior and config.viewing.trackedChanges for viewing projection"),s&&M1("config.layoutEngineOptions.trackedChanges","config.viewing.trackedChanges for display and config.trackChanges.enabled for behavior"));const a=r?r==="markup":yE(o?.visible,i?.visible,!1),l=yE(o?.enabled,i?.enabled,typeof s?.enabled=="boolean"?s.enabled:!0),u=hH(o?.replacementMode)??fH(i?.replacements)??"paired",d=Ss(o?.authorColors)??Ss(i?.authorColors),f=d||void 0,p=Ss(o?.semanticColors)??Ss(i?.semanticColors),g=p||void 0,m=e.documentMode==="viewing",v=m?a?"review":"original":"review",C=r?m?dH(r):"review":cH(i?.mode,s?.mode,v),w={visible:a,mode:C,enabled:l,replacements:u};return f&&(w.authorColors=f),g&&(w.semanticColors=g),e.modules.trackChanges=w,e.trackChanges={visible:a,enabled:l,replacementMode:pH(u)},f&&(e.trackChanges.authorColors=f),g&&(e.trackChanges.semanticColors=g),Ss(e.layoutEngineOptions)||(e.layoutEngineOptions={}),e.layoutEngineOptions.trackedChanges={mode:C,enabled:l},typeof n?.comments=="boolean"&&(Ss(e.comments)||(e.comments={}),e.comments.visible=n.comments),Object.defineProperty(e,gE,{value:!0,writable:!0,configurable:!0,enumerable:!1}),w}var P1=Object.freeze({id:null,name:"Default SuperDoc user",email:null});function mH(e){return!e||typeof e!="object"?{...P1}:{...P1,...e}}var yg=Object.freeze({"font-family":"fontFamily","font-size":"fontSize",strikethrough:"strike","highlight-color":"highlight","text-color":"color","table-of-contents":"tableOfContents","page-number":"pageNumber","table-actions":"tableActions","text-align":"textAlign","bullet-list":"list","numbered-list":"numberedlist","indent-decrease":"indentleft","indent-increase":"indentright","line-height":"lineHeight","linked-style":"linkedStyles","measurement-unit":"measurementUnit","formatting-marks":"formattingMarks","copy-format":"copyFormat","clear-formatting":"clearFormatting","document-mode":"documentMode","track-changes-accept-selection":"acceptTrackedChangeBySelection","track-changes-reject-selection":"rejectTrackedChangeOnSelection"}),bE=Object.freeze({toolbar:!0,comments:!0,contextMenu:!0,loading:!0,search:!1,linkPopover:!1,ruler:!1,contentControls:!0}),gH=Object.freeze(["left","center","right"]),vH=Object.freeze({compact:32,default:80,wide:120}),XX=Object.freeze(Object.keys(bE)),Jr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function wE(e,t){const n=e?.[t];return n===!1?!1:n===void 0?bE[t]:!0}function yH(e,t){const n=e?.[t];return Jr(n)?n:{}}var CE=Object.freeze(["level","readOnly","allowResolve","permissionResolver"]);function bH(e){if(!CE.some(n=>n in e))return e;const t={...e};for(const n of CE)delete t[n];return t}function kE(e){const t={...e},n=Nl(e.sections,e.customItems),r=Nl(e.defaultItems,e.includeDefaultItems);return delete t.customItems,delete t.includeDefaultItems,ti(t,{sections:n,defaultItems:r})}var SE=Object.freeze({findPlaceholder:"findPlaceholder",findAriaLabel:"findAriaLabel",replacePlaceholder:"replacePlaceholder",replaceAriaLabel:"replaceAriaLabel",noResults:"noResultsLabel",previousMatchTitle:"previousMatchLabel",previousMatchAriaLabel:"previousMatchAriaLabel",nextMatchTitle:"nextMatchLabel",nextMatchAriaLabel:"nextMatchAriaLabel",closeTitle:"closeLabel",closeAriaLabel:"closeAriaLabel",replace:"replaceLabel",replaceAll:"replaceAllLabel",toggleReplaceTitle:"toggleReplaceLabel",toggleReplaceAriaLabel:"toggleReplaceAriaLabel",matchCase:"matchCaseLabel",matchCaseAriaLabel:"matchCaseAriaLabel",ignoreDiacritics:"ignoreDiacriticsLabel",ignoreDiacriticsAriaLabel:"ignoreDiacriticsAriaLabel",regex:"regexLabel",regexAriaLabel:"regexAriaLabel",invalidPattern:"invalidPatternLabel"});function wH(e){return Jr(e)?Object.fromEntries(Object.entries(e).filter(([t,n])=>SE[t]!==void 0&&n!==void 0).map(([t,n])=>[SE[t],n])):{}}function _E(e){const t={...e};return delete t.strings,delete t.replaceControls,delete t.includeTrackedDeletions,ti(t,wH(e.strings),{replaceEnabled:Nl(e.replaceControls,e.replaceEnabled),includeDeletedText:Nl(e.includeTrackedDeletions,e.includeDeletedText)})}var CH=Object.freeze({"text-color":"color","table-of-contents":"tableOfContents","page-number":"pageNumber","align-left":"alignLeft","align-right":"alignRight","align-center":"alignCenter","align-justify":"alignJustify","bullet-list":"bulletList","numbered-list":"numberedList","indent-decrease":"indentLeft","indent-increase":"indentRight","copy-format":"copyFormat","clear-formatting":"clearFormatting","track-changes-accept-selection":"trackChangesAccept","track-changes-reject-selection":"trackChangesReject","document-mode":"documentMode","document-mode-editing":"documentEditingMode","document-mode-suggesting":"documentSuggestingMode","document-mode-viewing":"documentViewingMode","highlight-color":"highlight","linked-style":"paintbrush","table-actions":"tableActions","split-cell":"splitCell","merge-cells":"mergeCells","insert-row-before":"addRowBefore","insert-row-after":"addRowAfter","insert-column-before":"addColumnBefore","insert-column-after":"addColumnAfter","delete-row":"deleteRow","delete-column":"deleteColumn","delete-table":"deleteTable","remove-borders":"deleteBorders","fix-tables":"fixTables","line-height":"lineHeight","formatting-marks":"formattingMarks"}),kH=Object.freeze({"font-family":"fontFamily","font-size":"fontSize","highlight-color":"highlight","text-color":"color","table-of-contents":"tableOfContents","page-number":"pageNumber","table-actions":"tableActions","insert-row-before":"addRowBefore","insert-row-after":"addRowAfter","insert-column-before":"addColumnBefore","insert-column-after":"addColumnAfter","delete-row":"deleteRow","delete-column":"deleteColumn","delete-table":"deleteTable","remove-borders":"removeBorders","merge-cells":"mergeCells","split-cell":"splitCell","fix-tables":"fixTables","text-align":"textAlign","bullet-list":"bulletList","numbered-list":"numberedList","indent-decrease":"indentLeft","indent-increase":"indentRight","measurement-unit":"measurementUnit","track-changes-accept-selection":"trackChangesAccept","track-changes-reject-selection":"trackChangesReject","clear-formatting":"clearFormatting","copy-format":"copyFormat","line-height":"lineHeight","linked-style-label":"formatText","formatting-marks":"formattingMarks","document-mode-editing":"documentEditingMode","document-mode-suggesting":"documentSuggestingMode","document-mode-viewing":"documentViewingMode","document-mode-editing-description":"documentEditingModeDescription","document-mode-suggesting-description":"documentSuggestingModeDescription","document-mode-viewing-description":"documentViewingModeDescription","linked-style":"linkedStyles"});function bg(e,t){return t[e]??e}function D1(e,t){if(!Jr(e))return;const n=Object.entries(e),r=n.filter(([i])=>t[i]===void 0),o=n.filter(([i])=>t[i]!==void 0);return Object.fromEntries([...r,...o].map(([i,s])=>[bg(i,t),s]))}function AE(e){return Array.isArray(e)?e.map(t=>bg(t,yg)):e}function IE(e){return Jr(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,AE(n)])):e}function SH(e,t){if(!Jr(e)||!Array.isArray(t))return e;const n={...e};for(const r of t){if(!Jr(r))continue;const o=r.region??"center";n[o]===void 0&&(n[o]=[])}return n}var _H=Object.freeze({watermark:"center","page-number":"center","formatting-marks":"right","table-of-contents":"center"});function AH(e,t){if(!Jr(e)||!Array.isArray(t))return e;const n=Object.fromEntries(Object.entries(e).map(([o,i])=>[o,Array.isArray(i)?[...i]:i])),r=new Set(Object.values(n).flatMap(o=>Array.isArray(o)?o:[]).map(o=>bg(o,yg)));for(const o of t){const i=bg(o,yg);if(r.has(i))continue;const s=_H[o];s&&(Array.isArray(n[s])||(n[s]=[]),n[s].push(o),r.add(i))}return n}function EE(e,t){return SH(AH(e,t.includeItems),t.customItems)}function IH(e){return Array.isArray(e)?e.map(t=>{if(!Jr(t))return t;const{value:n,label:r,previewFamily:o}=t;return{key:n,value:n,label:r,...o?{props:{style:{fontFamily:o}}}:{}}}):e}function EH(e){return Array.isArray(e)?e.map(t=>{if(!Jr(t)||typeof t.id!="string")return t;const n=t.size??"default",r=t.type==="separator"?void 0:vH[n],o={...t,name:t.id,group:t.region,isNarrow:n==="compact",isWide:n==="wide",...r?{layoutWidth:r,style:{...t.style,width:`${r-2}px`}}:{}};return t.label&&(o.defaultLabel===void 0&&(o.defaultLabel=t.label),o.attributes={...t.attributes,ariaLabel:t.attributes?.ariaLabel??t.label}),t.type==="dropdown"&&Array.isArray(t.options)&&(o.options=t.options.map(i=>Jr(i)?{...i,key:i.value??i.id,value:i.value??i.id}:i),o.dropdownValueKey="value"),typeof t.onSelect=="function"&&(o.command=({item:i,argument:s,payload:a,...l})=>t.onSelect({...l,value:s})),delete o.id,delete o.region,delete o.size,delete o.onSelect,o}):e}function TH(e){const t={...e},n=Nl(e.items,Jr(e.groups)?e.groups:void 0),r=Jr(e.items)&&Object.keys(e.items).length===0?{center:[]}:n,o=EE(r,e),i=o===void 0?e.groups:IE(o),s=D1(e.icons,CH),a=ti(D1(e.texts,{}),D1(e.strings,kH)),l=Array.isArray(e.includeItems)?new Set(e.includeItems):null,u=Jr(r)?new Set(Object.values(r).flatMap(d=>Array.isArray(d)?d:[])):new Set;return delete t.items,delete t.includeItems,delete t.overflow,delete t.responsiveTo,delete t.fontOptions,delete t.customItems,delete t.strings,ti(t,{groups:i,excludeItems:AE(e.excludeItems),icons:s,texts:a,hideButtons:e.overflow===void 0?e.hideButtons:e.overflow==="menu",responsiveToContainer:e.responsiveTo===void 0?e.responsiveToContainer:e.responsiveTo==="container",fonts:e.fontOptions===void 0?e.fonts:IH(e.fontOptions),customButtons:e.customItems===void 0?e.customButtons:EH(e.customItems),showFormattingMarksButton:l===null&&!u.has("formatting-marks")?e.showFormattingMarksButton:u.has("formatting-marks")||l?.has("formatting-marks"),showTableOfContentsButton:l===null&&!u.has("table-of-contents")?e.showTableOfContentsButton:u.has("table-of-contents")||l?.has("table-of-contents"),showWatermarkButton:u.has("watermark")||l?.has("watermark")||!1,showPageNumberButton:u.has("page-number")||l?.has("page-number")||!1})}function TE(e={}){const t=e.ui,n=t===!1,r=Jr(t)?t:void 0,o=$=>!n&&wE(r,$),i=$=>n?!1:r?.[$]===void 0?void 0:wE(r,$),s=$=>n?{}:yH(r,$),a=n||i("ruler")===!1,l=n||i("linkPopover")===!1,u=l?void 0:Nl(s("linkPopover").popoverResolver,e.modules?.links?.popoverResolver),d=i("contentControls")??(!n&&e.modules?.contentControls?.chrome!=="none"),f=e.modules?.contentControls?.chrome==="none"?void 0:e.modules?.contentControls?.chrome,p=s("toolbar"),g=TH(p),m=Jr(p.items),v=e.modules?.toolbar,C=Jr(v)?v:{},w=e.modules?.contextMenu??e.modules?.slashMenu,S=Jr(w)?w:{},y=e.modules?.surfaces?.findReplace,k=_E(Jr(y)?y:{}),x=Jr(C.groups)?IE(EE(C.groups,p)):C.groups,M=[g.groups,x],z=M.find(Jr),q=M.find(Array.isArray),B=m?Object.keys(g.groups??{}):Nl(q,C.toolbarGroups,e.toolbarGroups),L=Array.isArray(B)?B:null,V=($,R)=>Object.prototype.hasOwnProperty.call($,R),T=z&&L?Object.fromEntries([...L.filter($=>V(z,$)),...Object.keys(z).filter($=>!gH.includes($))].map($=>[$,z[$]])):z;return{enabled:!n,toolbar:{enabled:o("toolbar"),container:n?null:Nl(g.container,C.selector,e.toolbar)??null,options:n?{}:{...ti(C,g),groups:T,toolbarGroups:B,icons:ti(e.toolbarIcons,C.icons,g.icons),texts:ti(e.toolbarTexts,C.texts,g.texts)}},comments:{enabled:i("comments")??(!n&&e.modules?.comments!==!1),options:n?{}:pA(bH(s("comments")))},contextMenu:{enabled:i("contextMenu")??(!n&&e.disableContextMenu!==!0),suppressed:n||i("contextMenu")===!1,options:n?{}:ti(kE(S),kE(s("contextMenu")))},loading:{enabled:o("loading")},search:{enabled:i("search")??(!n&&!!e.modules?.surfaces?.findReplace),options:n?{}:ti(k,_E(s("search")))},linkPopover:{enabled:typeof u=="function",suppressed:l,options:ti(s("linkPopover"),{popoverResolver:u})},ruler:{enabled:i("ruler")??(!n&&!!e.rulers),suppressed:a,container:a?null:s("ruler").container??e.rulerContainer??null},contentControls:{enabled:d,options:d?ti({chrome:f},s("contentControls")):{chrome:"none"}}}}var wg=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),xH=e=>e==="read"||e==="write"||e==="resolve";function xE(e={}){const t=wg(e.interaction)?e.interaction:{},n=wg(t.comments)?t.comments:{},r=wg(t.trackedChanges)?t.trackedChanges:{},o=wg(e.modules?.comments)?e.modules.comments:{},i=(n.readOnly??o.readOnly??!1)===!0,s=(n.allowResolve??o.allowResolve??!0)!==!1,a=xH(n.level),l=a?n.level:i?"read":s?"resolve":"write",u=r.allowDecisions;return{comments:{level:l,readOnly:a?l==="read":i,allowResolve:a?l==="resolve":s},trackedChanges:{allowDecisions:typeof u=="boolean"?u:!i}}}var RE=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function ME(e={}){const t=RE(e.surfaces)?e.surfaces:{},n=RE(e.modules?.surfaces)?e.modules.surfaces:{},r=t.resolver===void 0?n.resolver:t.resolver;return{resolver:typeof r=="function"?r:null,dialog:ti(n.dialog,t.dialog),floating:ti(n.floating,t.floating)}}var RH="https://docs.superdoc.dev/editor/fonts/";function MH(e){return e==="localhost"||e.endsWith(".localhost")||e==="0.0.0.0"||e==="::1"||e==="[::1]"||e.startsWith("127.")}function LH(e,t,n=typeof window>"u"?"":window.location.hostname){if(!MH(n)||!Array.isArray(e))return;const r=[...new Set(e.map(s=>s.trim()).filter(Boolean))].filter(s=>!t.has(s));if(r.length===0)return;for(const s of r)t.add(s);const o=r.length===1?"font":"fonts",i=r.map(s=>`"${s}"`).join(", ");console.warn(`[SuperDoc] Missing document ${o}: ${i}. The browser is using fallback fonts, which can change line and page breaks. Configure document fonts: ${RH}`)}var PH=class{#e=new Map;#n=new Map;#t=null;#o=new Set;register(e){if(this.#e.has(e.id))throw new Error(`EditorRuntimeRegistry: duplicate runtime id "${e.id}"`);const t=e.root,n=t?this.#n.get(t):void 0;if(n!==void 0&&n!==e.id)throw new Error(`EditorRuntimeRegistry: root element already registered to runtime "${n}"`);this.#e.set(e.id,e),t&&this.#n.set(t,e.id)}unregister(e){const t=this.#e.get(e);return t?(this.#e.delete(e),t.root&&this.#n.delete(t.root),this.#t===e&&(this.#t=null,this.#i({previousRuntimeId:e,nextRuntimeId:null,reason:"active-runtime-unregistered",legacyEditorProjection:null})),!0):!1}get(e){return this.#e.get(e)??null}getAll(){return Array.from(this.#e.values())}getAllByDocumentId(e){const t=[];for(const n of this.#e.values())n.documentId===e&&t.push(n);return t}getActive(){return this.#t===null?null:this.#e.get(this.#t)}getActiveId(){return this.#t}setActive(e,t){if(e!==null&&!this.#e.has(e))throw new Error(`EditorRuntimeRegistry: cannot activate unknown runtime "${e}"`);if(e===this.#t)return;const n=this.#t;this.#t=e;let r=null;e!==null&&(r=this.#e.get(e).getLegacyEditorProjection?.()??null),this.#i({previousRuntimeId:n,nextRuntimeId:e,reason:t,legacyEditorProjection:r})}resolveFromEventTarget(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null;if(!t)return null;const n=t.closest(`[${Zm}]`);if(!n)return null;const r=n.getAttribute(Zm),o=r?this.get(r):null;return o&&o.root===n?o:null}subscribe(e){return this.#o.add(e),()=>{this.#o.delete(e)}}clear(){this.#e.clear(),this.#n.clear(),this.#t=null,this.#o.clear()}#i(e){for(const t of Array.from(this.#o))try{t(e)}catch{}}},DH=["table-add-row-before","table-add-row-after","table-delete-row","table-add-column-before","table-add-column-after","table-delete-column","table-delete","table-merge-cells","table-split-cell","table-remove-borders"],LE=[{name:"bold",commandId:"bold",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"italic",commandId:"italic",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"underline",commandId:"underline",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"strike",commandId:"strikethrough",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"clearFormatting",commandId:"clear-formatting",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"copyFormat",commandId:"copy-format",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"fontFamily",commandId:"font-family",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"fontSize",commandId:"font-size",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"color",commandId:"text-color",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"highlight",commandId:"highlight-color",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"textAlign",commandId:"text-align",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"list",commandId:"bullet-list",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"numberedlist",commandId:"numbered-list",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"indentleft",commandId:"indent-decrease",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"indentright",commandId:"indent-increase",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"lineHeight",commandId:"line-height",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"linkedStyles",commandId:"linked-style",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"link",commandId:"link",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"image",commandId:"image",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"watermark",commandId:null,instanceMethod:"ui.watermark.open",disposition:"host-routed",group:"center",note:"opens the shared Watermark dialog through superdoc.ui.watermark.open; the workflow owns scope, edit permissions, and apply"},{name:"pageNumber",commandId:"page-numbers-apply",instanceMethod:null,disposition:"controller-routed",group:"center",note:"opens the Page number popover: adds or changes the caret section numbers (position, first page, style, start) through page-numbers-apply, removes them through page-numbers-remove, or inserts at a header/footer cursor through page-number-insert"},{name:"table",commandId:"table-insert",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"tableActions",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"center",memberCommandIds:DH,note:"table editing dropdown is shell chrome; its member commands are controller-routed through the shared table-context facade (ui.tables / host.getTableContext()) and fail closed with table-context-unavailable when the caret is not in a table"},{name:"undo",commandId:"undo",instanceMethod:null,disposition:"controller-routed",group:"left"},{name:"redo",commandId:"redo",instanceMethod:null,disposition:"controller-routed",group:"left"},{name:"search",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"right",note:"built-in search button; opens the shared find/replace surface (the same one Cmd/Ctrl+F opens) by emitting a `search:open` event on the SuperDoc instance, which the shell handles. The surface reads/drives the controller search surface (ui.search), backed by the single V2 host search session (host.search) which owns query, navigation, reveal, and replace. Find/navigation are always available when the host exposes search; replace/replaceAll mutate through the host session and fail closed (document-readonly) in viewing/read-only mode. If a runtime cannot expose search, the surface fails closed with search-unavailable"},{name:"zoom",commandId:"zoom",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"measurementUnit",commandId:"measurement-unit",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"ruler",commandId:null,instanceMethod:"toggleRuler",disposition:"host-routed",group:"right",note:"built-in shell toggles ruler visibility through the public SuperDoc.toggleRuler() instance method; the controller also routes the ruler command through it so custom UIs drive the same chrome (active state from config.rulers)"},{name:"formattingMarks",commandId:null,instanceMethod:"toggleFormattingMarks",disposition:"host-routed",group:"right",note:"built-in shell toggles nonprinting marks through the public SuperDoc.toggleFormattingMarks()/setShowFormattingMarks() instance methods (not a controller command)"},{name:"documentMode",commandId:"document-mode",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"acceptTrackedChangeBySelection",commandId:"track-changes-accept-selection",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"rejectTrackedChangeOnSelection",commandId:"track-changes-reject-selection",instanceMethod:null,disposition:"controller-routed",group:"right"},{name:"customButtons",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"center",note:"consumer-defined buttons the rendered shell owns; their execution context surface is phase 2"}],PE=new Map(LE.map(e=>[e.name,e])),OH=LE.map(e=>e.name);function O1(e){return PE.get(e)??null}function FH(e){const t=PE.get(e);return t?.disposition==="controller-routed"?t.commandId:null}var NH=(e,t)=>{let n=e.replace(/[^0-9.]/g,"");return n=parseFloat(n),isNaN(n)&&(n=t),n=parseFloat(n),n},BH=(e,t,n)=>{let r,o,i,s=0;n||(n={});const a=()=>{s=n.leading===!1?0:Date.now(),r=null,i=e(...o),r||(o=null)},l=(...u)=>{const d=Date.now();!s&&n.leading===!1&&(s=d);const f=t-(d-s);return o=u,f<=0||f>t?(r&&(clearTimeout(r),r=null),s=d,i=e(...u),r||(o=null)):!r&&n.trailing!==!1&&(r=setTimeout(a,f)),i};return l.cancel=function(){clearTimeout(r),s=0,r=o=null},l};Nt(),yn();var zH={class:"sd-toolbar-icon"},jH=["innerHTML"],VH={__name:"ToolbarButtonIcon",props:{name:{type:String,required:!0},color:{type:String,default:null},icon:{type:String,default:null}},setup(e){const t=e,n=ke(()=>{if(t.name==="color")return{backgroundColor:t.color||"#111111"};if(t.name==="highlight")return{backgroundColor:t.color||"#D6D6D6"}}),r=ke(()=>["color","highlight"].includes(t.name));return(o,i)=>(pe(),we("div",zH,[ue("div",{class:tn(["sd-toolbar-icon__icon",[`sd-toolbar-icon__icon--${t.name}`]]),innerHTML:e.icon},null,10,jH),r.value?(pe(),we("div",{key:0,class:"color-bar",style:An(n.value)},null,4)):dt("",!0)]))}},DE=vn(VH,[["__scopeId","data-v-65ecd5b1"]]);Nt(),yn();var UH=["role","aria-label","aria-disabled"],$H=["data-item"],HH=["data-item"],GH={key:1,class:"sd-button-label"},WH=["data-item","aria-label"],KH=["innerHTML"],qH={key:2},YH=["onKeydown","id"],XH=["placeholder","onKeydown","id","data-item"],ZH=["data-item","innerHTML"],QH={"aria-live":"polite",class:"sd-visually-hidden"},JH={__name:"ToolbarButton",props:{iconColor:{type:String,default:null},active:{type:Boolean,default:!1},isNarrow:{type:Boolean,default:!1},isWide:{type:Boolean,default:!1},toolbarItem:{type:Object,required:!0},defaultLabel:{type:String,default:null},isOverflowItem:{type:Boolean,default:!1},allowEnterPropagation:{type:Boolean,default:!1}},emits:["buttonClick","textSubmit","mainClick"],setup(e,{emit:t}){const n=t,{proxy:r}=Cr(),o=e,{name:i,active:s,icon:a,label:l,hideLabel:u,iconColor:d,hasCaret:f,splitButton:p,disabled:g,expand:m,inlineTextInputVisible:v,hasInlineTextInput:C,minWidth:w,style:S,attributes:y}=o.toolbarItem,k=ke(()=>!!p?.value&&!!f?.value),x=ke(()=>i?.value??""),M=ne(""),z=ne(null),{isHighContrastMode:q}=Wi();Vt(()=>l?.value,Le=>{document.activeElement!==z.value&&(M.value=Le==null?"":String(Le))},{immediate:!0});const B=()=>{C&&kt(()=>{z.value?.focus(),z.value?.select()}),n("buttonClick")},L=Le=>{g?.value||(Le?.stopPropagation(),n("mainClick"))},V=()=>{k.value||B()},T=Le=>{if(k.value){L(Le);return}B()},$=Le=>{Le.preventDefault(),o.allowEnterPropagation||Le.stopPropagation(),T(Le)},R=Le=>{const je=o.toolbarItem?.nestedOptions?.value??[],nt=Le.trim();if(!nt)return"";const ut=je.find(ft=>typeof ft?.label=="string"&&ft.label.toLowerCase()===nt.toLowerCase());return ut?.label?ut.label:je.find(ft=>typeof ft?.label=="string"&&ft.label.toLowerCase().startsWith(nt.toLowerCase()))?.label??nt},H=()=>{const Le=String(M.value??"").trim();let je=Le;if(x.value==="fontSize"){const nt=Number.parseFloat(Le);je=Le.match(/^\d+(\.5)?$/)?Le:Number.isFinite(nt)?Math.floor(nt).toString():""}else x.value==="fontFamily"&&(je=R(Le));return je?(n("textSubmit",je),M.value=je,!0):!1},G=Le=>{const je=Le?.currentTarget;je instanceof HTMLInputElement&&(je.focus({preventScroll:!0}),je.select())},ee=Le=>{requestAnimationFrame(()=>{const je=document.getElementById(`inlineTextInput-${Le}`);je instanceof HTMLInputElement&&(je.focus({preventScroll:!0}),je.select())})},J=()=>{const Le=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Le instanceof HTMLElement?(Le.focus({preventScroll:!0}),!0):!1},X=()=>{const Le=r?.$toolbar?.pendingSelectionCapture,je=()=>{Le&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Le)};if(J()){je();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),je())},xe=()=>{H()&&X()},fe=Le=>{if(H(),Le.shiftKey){x.value==="fontSize"&&(Le.preventDefault(),kt(()=>ee("fontFamily")));return}if(Le.preventDefault(),x.value==="fontFamily"){kt(()=>ee("fontSize"));return}x.value==="fontSize"&&kt(X)},ye=ke(()=>S.value?S.value:{minWidth:o.minWidth}),ve=ke(()=>m?.value?pr.dropdownCaretUp:pr.dropdownCaretDown);return(Le,je)=>(pe(),we("div",{class:tn(["sd-toolbar-item",Je(y).className]),style:An(ye.value),role:e.isOverflowItem?"menuitem":"button","aria-label":Je(y).ariaLabel,"aria-disabled":Je(g)?"true":void 0,"data-sd-part":"toolbar-item",onClick:V,onKeydown:je[9]||(je[9]=Jo(nt=>$(nt),["enter"])),tabindex:"0"},[ue("div",{class:tn(["sd-toolbar-button",{"sd-active":Je(s),"sd-disabled":Je(g),narrow:e.isNarrow,wide:e.isWide,split:k.value,"has-inline-text-input":Je(C),"high-contrast":Je(q)}]),"data-item":`btn-${Je(i)||""}`},[k.value?(pe(),we("div",{key:0,class:"sd-toolbar-button__main","data-item":`btn-${Je(i)||""}-main`,onClick:je[0]||(je[0]=nt=>L(nt))},[Je(a)?(pe(),pn(DE,{key:0,color:Je(d),class:"sd-toolbar-icon",icon:Je(a),name:Je(i)},null,8,["color","icon","name"])):dt("",!0),Je(l)&&!Je(u)&&!Je(v)?(pe(),we("div",GH,Et(Je(l)),1)):dt("",!0)],8,HH)):dt("",!0),k.value?(pe(),we("div",{key:1,class:"sd-toolbar-button__caret","data-item":`btn-${Je(i)||""}-caret`,"aria-label":`${Je(y).ariaLabel} options`,role:"button"},[ue("div",{class:"sd-dropdown-caret",innerHTML:ve.value,style:An({opacity:Je(g)?.6:1})},null,12,KH)],8,WH)):(pe(),we(zt,{key:2},[Je(a)?(pe(),pn(DE,{key:0,color:Je(d),class:"sd-toolbar-icon",icon:Je(a),name:Je(i)},null,8,["color","icon","name"])):dt("",!0),Je(l)&&!Je(u)&&(!Je(v)||x.value==="fontFamily")?(pe(),we("div",{key:1,class:tn(["sd-button-label",{"sd-visually-hidden":Je(v)&&x.value==="fontFamily"}])},Et(Je(l)),3)):dt("",!0),Je(v)?(pe(),we("span",qH,[Je(i)==="fontSize"?_i((pe(),we("input",{key:0,"onUpdate:modelValue":je[1]||(je[1]=nt=>M.value=nt),onKeydown:[Jo(sn(xe,["stop","prevent"]),["enter"]),je[2]||(je[2]=Jo(nt=>fe(nt),["tab"]))],onClick:je[3]||(je[3]=sn(nt=>G(nt),["stop"])),onFocus:je[4]||(je[4]=nt=>G(nt)),type:"text",class:tn(["button-text-input button-text-input--font-size",{"high-contrast":Je(q)}]),id:"inlineTextInput-"+Je(i),autocomplete:"off",ref_key:"inlineInput",ref:z},null,42,YH)),[[Ti,M.value]]):_i((pe(),we("input",{key:1,"onUpdate:modelValue":je[5]||(je[5]=nt=>M.value=nt),placeholder:Je(l),onKeydown:[Jo(sn(xe,["stop","prevent"]),["enter"]),je[6]||(je[6]=Jo(nt=>fe(nt),["tab"]))],onClick:je[7]||(je[7]=sn(nt=>G(nt),["stop"])),onFocus:je[8]||(je[8]=nt=>G(nt)),type:"text",class:tn(["button-text-input",{"button-text-input--font-family":x.value==="fontFamily","high-contrast":Je(q)}]),id:"inlineTextInput-"+Je(i),"data-item":x.value==="fontFamily"?`btn-${Je(i)}-input`:void 0,autocomplete:"off",ref_key:"inlineInput",ref:z},null,42,XH)),[[Ti,M.value]])])):dt("",!0),Je(f)?(pe(),we("div",{key:3,class:"sd-dropdown-caret","data-item":`btn-${Je(i)||""}-toggle`,innerHTML:ve.value,style:An({opacity:Je(g)?.6:1})},null,12,ZH)):dt("",!0)],64)),ue("div",QH,Et(`${Je(y).ariaLabel} ${Je(s)?"selected":"unset"}`),1)],10,$H)],46,UH))}},F1=vn(JH,[["__scopeId","data-v-96796456"]]);Nt(),yn();var eG={class:"toolbar-separator",role:"separator","aria-label":"Toolbar separator"},tG={__name:"ToolbarSeparator",props:{active:{type:Boolean,default:!1}},emits:["command"],setup(e,{emit:t}){const{isHighContrastMode:n}=Wi(),r=()=>n.value?"#000":"var(--sd-ui-border, #dbdbdb)";return(o,i)=>(pe(),we("div",eG,[ue("div",{class:"separator-inner",style:An({backgroundColor:r()})},null,4)]))}},nG=vn(tG,[["__scopeId","data-v-cb82253a"]]);Nt(),yn();var rG={class:"toolbar-dropdown"},oG=["onClick"],iG={key:0,class:"toolbar-dropdown-option__icon"},sG={class:"toolbar-dropdown-option__label"},Cg='button, [href], input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])',aG={__name:"ToolbarDropdown",props:{options:{type:Array,default:()=>[]},show:{type:Boolean,required:!0},placement:{type:String,default:"bottom-start"},disabled:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})},menuProps:{type:Function,default:null},nodeProps:{type:Function,default:null},closeOnEscape:{type:Boolean,default:!0},hasOpenChild:{type:Boolean,default:!1}},emits:["update:show","select"],setup(e,{expose:t,emit:n}){const r=e,o=n,i=Fw(),s=ne(null),a=ne(null),l=ne({top:"0px",left:"0px",maxHeight:"none"}),u=ne([]),d=ne(-1),f=ke(()=>!!r.show),p=ne(document.fullscreenElement),g=ke(()=>f.value&&p.value?p.value:document.body),m=ke(()=>r.options.some(se=>se?.type==="render")),v=ke(()=>!!i.menu),C=ke(()=>typeof r.menuProps!="function"?{}:r.menuProps()||{}),w=ke(()=>{const{class:se,style:be,...Q}=C.value;return Q}),S=ke(()=>["toolbar-dropdown-menu",C.value.class,{"toolbar-dropdown-menu--render-only":v.value||r.options.length>0&&r.options.every(se=>se&&se.type==="render")}]),y=ke(()=>{const se=C.value.style||{};return{...r.contentStyle,...se}}),k=ke(()=>({...y.value,position:"fixed",top:l.value.top,left:l.value.left,maxHeight:l.value.maxHeight,zIndex:2e3})),x=se=>{o("update:show",se)},M=()=>{f.value&&x(!1)},z=()=>{if(!s.value)return;const se=s.value.getBoundingClientRect(),be=a.value,Q=be?.offsetWidth??0,I=be?.scrollHeight??be?.offsetHeight??0,ie=window.innerWidth||document.documentElement.clientWidth||0,j=window.innerHeight||document.documentElement.clientHeight||0,Z=8,K=4,ae=se.bottom+K,Ce=se.top-K,D=Math.max(0,j-ae-Z),N=Math.max(0,Ce-Z),me=D<I&&N>D,Se=me?N:D,Te=me?Math.max(Z,Ce-(I?Math.min(I,Se):Se)):ae;let Ne=se.left;r.placement==="bottom-end"&&(Ne=se.right-Q);const Ge=Math.max(Z,ie-Q-Z);Ne=Math.min(Math.max(Z,Ne),Ge),l.value={top:`${Te}px`,left:`${Ne}px`,maxHeight:`${Se}px`}},q=async()=>{p.value=document.fullscreenElement,f.value&&(await kt(),z())},B=()=>{r.disabled||x(!f.value)},L=se=>typeof r.nodeProps!="function"?{}:r.nodeProps(se)||{},V=se=>{se?.disabled||se?.type!=="render"&&(o("select",se?.key,se),M())},T=se=>se?.type==="render",$=se=>!se?.disabled&&se?.type!=="render",R=se=>typeof se?.icon=="function"||!!se?.icon,H=se=>typeof se?.icon=="function"?se.icon(se):se?.icon||null,G=se=>se?typeof se=="string"?se.split(/\s+/).includes("sd-selected"):Array.isArray(se)?se.some(G):typeof se=="object"?!!se["sd-selected"]:!1:!1,ee=se=>G(se?.props?.class)||G(se?.class),J=()=>r.options.map((se,be)=>$(se)?be:-1).filter(se=>se>=0),X=()=>{const se=r.options.findIndex(be=>$(be)&&ee(be));return se>=0?se:J()[0]??-1},xe=(se,be)=>{if(!se){delete u.value[be];return}u.value[be]=se},fe=()=>{u.value.forEach((be,Q)=>{be&&be.setAttribute("tabindex",Q===d.value?"0":"-1")});const se=u.value[d.value];se&&typeof se.focus=="function"&&(se.focus(),se.scrollIntoView?.({block:"nearest",inline:"nearest"}))},ye=se=>{const be=J();if(!be.length){d.value=-1;return}const Q=be.indexOf(d.value);if(Q<0){d.value=se>0?be[0]:be[be.length-1];return}const I=(Q+se+be.length)%be.length;d.value=be[I]},ve=()=>{let se=r.options[d.value];if(!$(se)){const be=J()[0];se=be===void 0?null:r.options[be]}se&&V(se)},Le=pl({name:"ToolbarDropdownRenderOption",props:{option:{type:Object,required:!0}},setup(se){return()=>typeof se.option.render!="function"?null:se.option.render()}}),je=pl({name:"ToolbarDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(se){return()=>{const be=H(se.option);return typeof be=="string"?Nr("span",{innerHTML:be}):be}}}),nt=se=>{if(!f.value)return;const be=se.target;if(!(be instanceof Element))return;const Q=s.value?.contains(be),I=a.value?.contains(be);Q||I||r.hasOpenChild&&be.closest('[data-sd-part="dropdown-menu"]')||M()},ut=ne(null),ft=()=>{const se=s.value,be=document.activeElement;if(se&&be instanceof HTMLElement&&se.contains(be)){ut.value=be;return}ut.value=se?.matches?.(Cg)?se:se?.querySelector(Cg)},At=()=>{const se=ut.value;if(se instanceof HTMLElement&&document.contains(se)){se.focus();return}const be=s.value;if(!be)return;const Q=be.matches?.(Cg)?be:be.querySelector(Cg);if(Q instanceof HTMLElement){Q.focus();return}be.setAttribute("tabindex","-1"),be.focus()};t({focusTrigger:At});const Re=se=>{if(!f.value)return;const{key:be}=se;if(["Escape","ArrowDown","ArrowUp","Enter"].includes(be)){if(be==="Escape"){if(!r.closeOnEscape)return;se.preventDefault(),M(),kt(()=>{requestAnimationFrame(At)});return}if(!(m.value||v.value)){if(se.preventDefault(),be==="ArrowDown"){ye(1),fe();return}if(be==="ArrowUp"){ye(-1),fe();return}be==="Enter"&&ve()}}};return Vt(f,async se=>{if(!se){d.value=-1,u.value=[];return}ft(),await kt(),z(),!(m.value||v.value)&&(d.value=X(),await kt(),fe())},{immediate:!0}),Vt(f,se=>{se?(document.addEventListener("pointerdown",nt,!0),document.addEventListener("keydown",Re,!0),window.addEventListener("resize",z),window.addEventListener("scroll",z,!0)):(document.removeEventListener("pointerdown",nt,!0),document.removeEventListener("keydown",Re,!0),window.removeEventListener("resize",z),window.removeEventListener("scroll",z,!0))},{immediate:!0}),Nn(()=>{document.addEventListener("fullscreenchange",q)}),hr(()=>{document.removeEventListener("fullscreenchange",q),document.removeEventListener("pointerdown",nt,!0),document.removeEventListener("keydown",Re,!0),window.removeEventListener("resize",z),window.removeEventListener("scroll",z,!0)}),(se,be)=>(pe(),we("div",rG,[ue("div",{ref_key:"triggerRef",ref:s,class:"toolbar-dropdown-trigger","data-sd-part":"dropdown-trigger",onClick:B},[yu(se.$slots,"trigger",{},void 0,!0)],512),(pe(),pn(vl,{to:g.value},[on($p,{name:"fade-in-scale-up-transition"},{default:ho(()=>[f.value?(pe(),we("div",Us({key:0,ref_key:"menuRef",ref:a,"data-sd-part":"dropdown-menu",class:S.value,style:k.value},w.value),[v.value?yu(se.$slots,"menu",{key:0},void 0,!0):dt("",!0),(pe(!0),we(zt,null,Mn(v.value?[]:e.options,(Q,I)=>(pe(),we("div",Us({key:Q.key,ref_for:!0,ref:ie=>xe(ie,I),class:["toolbar-dropdown-option",[Q.class,Q.props?.class,{"sd-disabled":Q.disabled,"sd-render":T(Q)}]],tabindex:"-1",onClick:ie=>V(Q)},{ref_for:!0},{...Q.props,...L(Q)}),[T(Q)?(pe(),pn(Je(Le),{key:0,option:Q},null,8,["option"])):(pe(),we(zt,{key:1},[R(Q)?(pe(),we("span",iG,[on(Je(je),{option:Q},null,8,["option"])])):dt("",!0),ue("span",sG,Et(Q.label),1)],64))],16,oG))),128))],16)):dt("",!0)]),_:3})],8,["to"]))]))}},OE=vn(aG,[["__scopeId","data-v-fa3f6b69"]]),FE=e=>{const t=e?.target;t instanceof Element&&(t.closest('input, textarea, [contenteditable="true"]')||e.preventDefault())},Gl=(e,t=null)=>{if(typeof t?.focus=="function"){t.focus();return}const n=e?.superdoc?.focus??e?.activeEditor?.focus;if(typeof n=="function"){n.call(e?.superdoc??e?.activeEditor,{preventScroll:!0});return}const r=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');r instanceof HTMLElement&&r.focus({preventScroll:!0})};Nt(),yn();var lG={__name:"OverflowMenu",props:{toolbarItem:{type:Object,required:!0},overflowItems:{type:Array,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["buttonClick","close","command"],setup(e,{emit:t}){const n=t,r=e,o=ne(null),i=ke(()=>r.toolbarItem.expand.value),s=ke(()=>r.overflowItems.some(d=>d.type==="dropdown"&&Je(d.expand))),a=ke(()=>({...r.toolbarItem,active:i.value})),l=d=>{if(d!==i.value){if(d){n("buttonClick",r.toolbarItem);return}n("close")}},u=({item:d,argument:f,option:p})=>{d.name.value==="watermark"&&(n("close"),o.value?.focusTrigger()),n("command",{item:d,argument:f,option:p})};return(d,f)=>(pe(),pn(OE,{ref_key:"dropdown",ref:o,class:"overflow-menu","close-on-escape":!s.value,"has-open-child":s.value,"content-style":{width:"200px",padding:"4px 8px",fontFamily:r.uiFontFamily},options:[],placement:"bottom-end",show:i.value,"onUpdate:show":l,"menu-props":()=>({role:"group",class:["overflow-menu_items","sd-toolbar-overflow-menu"]})},{trigger:ho(()=>[on(F1,{"toolbar-item":a.value,"allow-enter-propagation":!0},null,8,["toolbar-item"])]),menu:ho(()=>[on(_g,{class:"superdoc-toolbar-overflow","toolbar-items":e.overflowItems,"ui-font-family":r.uiFontFamily,"from-overflow":"",onMousedown:Je(FE),onCommand:u},null,8,["toolbar-items","ui-font-family","onMousedown"])]),_:1},8,["close-on-escape","has-open-child","content-style","show"]))}},cG=vn(lG,[["__scopeId","data-v-1227fcf9"]]),NE=e=>String(e??"").trim().toLowerCase(),kg=(e,t)=>{const n=NE(e);if(!n)return-1;for(let r=0;r<t.length;r+=1)if(NE(t[r]).startsWith(n))return r;return-1},uG=(e,t,{autocomplete:n=!0}={})=>{const r=String(e??""),o=kg(r,t),i=o>=0?String(t[o]??""):"";return n&&o>=0&&i.length>r.length?{matchIndex:o,display:i,selectionStart:r.length,selectionEnd:i.length}:{matchIndex:o,display:r,selectionStart:r.length,selectionEnd:r.length}},dG=e=>{let t=String(e??"").trim();for(;t.length>=2&&(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"));)t=t.slice(1,-1).trim();return t},fG=e=>e<=31||e===127,hG=e=>e===32||e===160||e===65279,pG=e=>Array.from(String(e)).filter(t=>!fG(t.charCodeAt(0))).join(""),mG=e=>{let t="",n=!1;for(const r of String(e)){if(hG(r.charCodeAt(0))){n=t.length>0;continue}n&&(t+=" "),n=!1,t+=r}return t},gG=e=>{const t=String(e??"").split(",")[0]??"",n=pG(t);return mG(dG(n)).trim()},vG=1,yG=1638,bG=e=>{const t=String(e??"").replace(/[^0-9.-]/g,""),n=Number.parseFloat(t);if(!Number.isFinite(n))return"";const r=Math.round(n*2)/2;return r<vG?"":String(Math.min(r,yG))};Nt(),yn();var wG=["data-item"],CG=["id","value","disabled","aria-label","aria-expanded","aria-controls","aria-activedescendant","data-item"],kG=["data-item","aria-label","disabled"],SG=["innerHTML"],_G=["id","aria-label"],AG=["id","aria-selected","aria-label","onMousedown","onMouseenter"],IG={class:"toolbar-dropdown-option__label"},EG={class:"sd-button-label sd-font-combobox__legacy-label","aria-hidden":"true"},TG={__name:"ToolbarComboBox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"},showPreview:{type:Boolean,default:!1},normalizeValue:{type:Function,default:e=>String(e??"").trim()}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t,{isHighContrastMode:o}=Wi(),i=ne(null),s=ne(null),a=ne(null),l=ne([]),u=ne(!1),d=ne(!1),f=ne(-1),p=ne(""),g=ne(""),m=ne(!1),v=ne({top:"0px",left:"0px",minWidth:"0px",maxHeight:"none"}),C=ke(()=>n.item.nestedOptions?.value??[]),w=ke(()=>C.value.map(D=>String(D?.label??""))),S=ke(()=>String(n.item.label?.value??"")),y=ke(()=>!!n.item.disabled?.value),k=ke(()=>String(n.item.name?.value??"")),x=ke(()=>n.item.attributes?.value?.ariaLabel??"Font family"),M=ke(()=>u.value?g.value:S.value),z=ke(()=>`sd-${k.value||"combobox"}-listbox-${n.item.id?.value??"default"}`),q=D=>`${z.value}-option-${D}`,B=ke(()=>d.value&&f.value>=0?q(f.value):void 0),L=ke(()=>d.value?pr.dropdownCaretUp:pr.dropdownCaretDown),V=D=>{const N=String(D??"").trim().toLowerCase();return C.value.find(me=>String(me?.label??"").trim().toLowerCase()===N)?.props?.style?.fontFamily||D||n.uiFontFamily},T=ke(()=>n.showPreview?{fontFamily:V(u.value?g.value:S.value)}:{fontFamily:n.uiFontFamily}),$=()=>{const D=n.item.selectedValue?.value;if(D){const N=C.value.findIndex(me=>me?.key===D);if(N>=0)return N}return w.value.findIndex(N=>N.toLowerCase()===S.value.toLowerCase())},R=(D,N)=>{const me=i.value;if(!(!me||typeof me.setSelectionRange!="function"))try{me.setSelectionRange(D,N)}catch{}},H=()=>{l.value[f.value]?.scrollIntoView?.({block:"nearest",inline:"nearest"})},G=()=>{l.value[f.value]?.focus?.()},ee=()=>{const D=s.value;if(!D)return;const N=D.getBoundingClientRect(),me=a.value,Se=me?.scrollHeight??me?.offsetHeight??0,Te=window.innerHeight||document.documentElement.clientHeight||0,Ne=window.innerWidth||document.documentElement.clientWidth||0,Ge=8,rt=4,vt=N.bottom+rt,Ot=N.top-rt,Mt=Math.max(0,Te-vt-Ge),Yt=Math.max(0,Ot-Ge),Ue=Mt<Se&&Yt>Mt,nn=Ue?Yt:Mt,Un=Ue?Math.max(Ge,Ot-(Se?Math.min(Se,nn):nn)):vt,Xt=Math.min(Math.max(Ge,N.left),Math.max(Ge,Ne-N.width-Ge));v.value={top:`${Un}px`,left:`${Xt}px`,minWidth:`${N.width}px`,maxHeight:`${nn}px`}},J=ke(()=>({position:"fixed",top:v.value.top,left:v.value.left,minWidth:v.value.minWidth,maxHeight:v.value.maxHeight,fontFamily:n.uiFontFamily,zIndex:2e3})),X=D=>{n.item.expand&&typeof n.item.expand=="object"&&"value"in n.item.expand&&(n.item.expand.value=D)},xe=(D,{focusInput:N=!1,focusOption:me=!1}={})=>{if(y.value||!C.value.length){X(!1);return}d.value=!0,X(!0),f.value=D??-1,N&&(u.value=!0,g.value=S.value,i.value?.focus()),kt(()=>{ee(),H(),me&&G()})},fe=({syncItem:D=!0}={})=>{d.value=!1,f.value=-1,D&&X(!1)},ye=()=>{fe(),u.value=!1,p.value="",g.value=S.value},ve=()=>{y.value||(d.value||r("item-clicked"),u.value=!0,p.value="",g.value=S.value,kt(()=>R(0,g.value.length)))},Le=D=>{if(y.value)return;const N=document.activeElement===i.value;if(r("item-clicked"),u.value=!0,N||(p.value="",g.value=S.value,D.preventDefault(),i.value?.focus({preventScroll:!0}),R(0,S.value.length)),!d.value){const me=$();xe(me>=0?me:0)}},je=D=>{const N=D.relatedTarget;N instanceof Node&&s.value?.contains(N)||N instanceof Node&&a.value?.contains(N)||ye()},nt=D=>{if(m.value)return;const N=D.target,me=N.value,Se=typeof N.selectionStart=="number"?N.selectionStart:me.length,Te=typeof N.selectionEnd=="number"?N.selectionEnd:Se,Ne=typeof D.inputType=="string"&&D.inputType.startsWith("delete"),Ge=Se===me.length&&Te===me.length;p.value=me;const rt=uG(me,w.value,{autocomplete:!Ne&&Ge});g.value=rt.display,N.value=rt.display,rt.display===me&&!Ge?R(Se,Te):R(rt.selectionStart,rt.selectionEnd),d.value&&(f.value=rt.matchIndex,kt(H))},ut=D=>{m.value=!1,nt(D)},ft=D=>{if(!C.value.length)return;const N=C.value.length,me=f.value<0?D>0?-1:0:f.value;f.value=(me+D+N)%N,kt(H)},At=(D,N)=>{r("item-clicked"),r("command",{item:n.item,argument:D,option:N}),N&&(n.item.selectedValue.value=N.key)},Re=D=>{D&&(At(D.value??D.label,D),u.value=!1,p.value="",g.value=D.label,fe())},se=()=>{if(d.value&&f.value>=0)return Re(C.value[f.value]),!0;const D=kg(p.value,w.value);if(D>=0)return Re(C.value[D]),!0;const N=n.normalizeValue(p.value);return N?(At(N,null),u.value=!1,p.value="",g.value=N,fe(),!0):!1},be=D=>{if(!(D.isComposing||m.value||D.keyCode===229)&&!(D.ctrlKey||D.metaKey||D.altKey))switch(D.key){case"ArrowDown":if(D.preventDefault(),d.value)G();else{const N=kg(p.value,w.value),me=N>=0?N:$();xe(me>=0?me:0,{focusOption:!0})}break;case"ArrowUp":if(D.preventDefault(),d.value)G();else{const N=kg(p.value,w.value),me=N>=0?N:$();xe(me>=0?me:C.value.length-1,{focusOption:!0})}break;case"Enter":D.preventDefault(),se()&&r("editor-handoff"),i.value?.blur();break;case"Tab":D.preventDefault(),se(),fe(),i.value?.blur(),r("tab-out",D);break;case"Escape":D.preventDefault(),ye(),kt(()=>i.value?.focus());break;default:break}},Q=D=>{if(D.preventDefault(),!y.value)if(r("item-clicked"),d.value)fe(),i.value?.focus();else{const N=$();xe(N>=0?N:0,{focusOption:!0})}},I=(D,N)=>{D.preventDefault(),Re(N),r("editor-handoff"),i.value?.blur()},ie=D=>{f.value=D},j=D=>{if(!(D.ctrlKey||D.metaKey||D.altKey))switch(D.key){case"ArrowDown":D.preventDefault(),ft(1),G();break;case"ArrowUp":D.preventDefault(),ft(-1),G();break;case"Enter":D.preventDefault(),f.value>=0&&(Re(C.value[f.value]),r("editor-handoff"));break;case"Escape":D.preventDefault(),ye(),kt(()=>i.value?.focus());break;case"Tab":D.preventDefault(),f.value>=0?Re(C.value[f.value]):fe(),r("tab-out",{shiftKey:D.shiftKey,target:i.value});break;default:break}},Z=D=>{if(!d.value)return;const N=D.target;N instanceof Element&&(s.value?.contains(N)||a.value?.contains(N)||ye())};Vt(d,D=>{D?(document.addEventListener("pointerdown",Z,!0),window.addEventListener("resize",ee),window.addEventListener("scroll",ee,!0)):(document.removeEventListener("pointerdown",Z,!0),window.removeEventListener("resize",ee),window.removeEventListener("scroll",ee,!0),l.value=[])},{immediate:!0}),hr(()=>{document.removeEventListener("pointerdown",Z,!0),window.removeEventListener("resize",ee),window.removeEventListener("scroll",ee,!0)});const K=(D,N)=>{if(!D){delete l.value[N];return}l.value[N]=D},ae=D=>D===f.value,Ce=D=>D?.key&&D.key===n.item.selectedValue?.value;return Vt(S,D=>{u.value||(g.value=D)}),Vt(()=>!!n.item.expand?.value,D=>{if(D&&!d.value){const N=$();xe(N>=0?N:0,{focusInput:!0});return}!D&&d.value&&fe({syncItem:!1})}),(D,N)=>(pe(),we("div",{ref_key:"rootRef",ref:s,class:tn(["sd-font-combobox sd-toolbar-split-field",{"sd-disabled":y.value,"high-contrast":Je(o)}]),style:An(n.item.style?.value),"data-item":`btn-${k.value}`},[ue("span",{class:"sd-font-combobox__field sd-toolbar-split-field__main",onMousedown:Le},[ue("input",{ref_key:"inputRef",ref:i,id:`inlineTextInput-${k.value}`,class:"button-text-input sd-font-combobox__input",type:"text",role:"combobox",autocomplete:"off",spellcheck:"false",value:M.value,style:An(T.value),disabled:y.value,"aria-label":x.value,"aria-expanded":d.value?"true":"false","aria-controls":z.value,"aria-activedescendant":B.value,"aria-haspopup":"listbox","aria-autocomplete":"both","data-item":`btn-${k.value}-input`,onFocus:ve,onBlur:je,onInput:nt,onKeydown:be,onCompositionstart:N[0]||(N[0]=me=>m.value=!0),onCompositionend:ut},null,44,CG)],32),ue("button",{type:"button",class:"sd-font-combobox__caret sd-toolbar-split-field__caret","data-item":`btn-${k.value}-toggle`,tabindex:"-1","aria-label":`${x.value} options`,disabled:y.value,onMousedown:Q},[ue("span",{class:"sd-dropdown-caret",innerHTML:L.value},null,8,SG)],40,kG),(pe(),pn(vl,{to:"body"},[d.value?(pe(),we("div",{key:0,ref_key:"popupRef",ref:a,role:"listbox","data-sd-part":"dropdown-menu",id:z.value,"aria-label":x.value,class:tn(["sd-font-combobox__listbox",{"high-contrast":Je(o)}]),style:An(J.value)},[(pe(!0),we(zt,null,Mn(C.value,(me,Se)=>(pe(),we("div",Us({key:me.key,ref_for:!0,ref:Te=>K(Te,Se),id:q(Se),role:"option",tabindex:"-1",class:["toolbar-dropdown-option sd-font-combobox__option",{"sd-active":ae(Se),"sd-selected":Ce(me)}],"aria-selected":Ce(me)?"true":"false","aria-label":`${x.value} - ${me.label}`},{ref_for:!0},me.props,{onMousedown:Te=>I(Te,me),onMouseenter:Te=>ie(Se),onKeydown:j}),[ue("span",IG,Et(me.label),1)],16,AG))),128))],14,_G)):dt("",!0)])),ue("span",EG,Et(S.value),1)],14,wG))}},BE=vn(TG,[["__scopeId","data-v-e288ef9f"]]);Nt();var xG={__name:"FontFamilyCombobox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t;return(o,i)=>(pe(),pn(BE,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!0,"normalize-value":Je(gG),onCommand:i[0]||(i[0]=s=>r("command",s)),onItemClicked:i[1]||(i[1]=s=>r("item-clicked")),onTabOut:i[2]||(i[2]=s=>r("tab-out",s)),onEditorHandoff:i[3]||(i[3]=s=>r("editor-handoff"))},null,8,["item","ui-font-family","normalize-value"]))}};Nt();var RG={__name:"FontSizeCombobox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t;return(o,i)=>(pe(),pn(BE,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!1,"normalize-value":Je(bG),onCommand:i[0]||(i[0]=s=>r("command",s)),onItemClicked:i[1]||(i[1]=s=>r("item-clicked")),onTabOut:i[2]||(i[2]=s=>r("tab-out",s)),onEditorHandoff:i[3]||(i[3]=s=>r("editor-handoff"))},null,8,["item","ui-font-family","normalize-value"]))}};Nt(),yn();var MG=["data-placement"],LG=2500,PG=Object.assign({inheritAttrs:!1},{__name:"SdTooltip",props:{trigger:{type:String,default:"hover"},delay:{type:Number,default:100},duration:{type:Number,default:100},disabled:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})}},setup(e){const t=e,n=Nw(),r=ne(!1),o=ne(null),i=ne(null),s=ne({top:"0px",left:"0px"}),a=ne("top");let l=null,u=null,d=null;const f=ke(()=>["sd-tooltip-content",n.class]),p=ke(()=>({...t.contentStyle,...n.style||{},position:"fixed",top:s.value.top,left:s.value.left,zIndex:2100})),g=()=>{l&&(window.clearTimeout(l),l=null)},m=()=>{u&&(window.clearTimeout(u),u=null)},v=()=>{d&&(window.clearTimeout(d),d=null)},C=()=>{v(),d=window.setTimeout(()=>{d=null,k()},LG)},w=($,R)=>{const H=window.getComputedStyle($),G=parseFloat(H[R]);return Number.isFinite(G)?H.boxSizing==="border-box"?G:(R==="width"?["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"]:["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"]).reduce((ee,J)=>ee+(parseFloat(H[J])||0),G):R==="width"?$.offsetWidth:$.offsetHeight},S=()=>{if(!o.value||!i.value)return;const $=o.value.getBoundingClientRect(),R=w(i.value,"width"),H=w(i.value,"height"),G=window.innerWidth||document.documentElement.clientWidth||0,ee=document.documentElement.clientHeight||window.innerHeight||0,J=8,X=10;let xe=$.left+$.width/2-R/2;xe=Math.max(J,Math.min(xe,G-R-J));const fe=$.top-H-X,ye=$.bottom+X,ve=fe>=J,Le=ye+H<=ee-J,je=$.top-X,nt=ee-$.bottom-X;ve?a.value="top":Le?a.value="bottom":a.value=je>=nt?"top":"bottom";const ut=a.value==="top"?fe:ye,ft=Math.min(J,Math.max(0,ee-H)),At=Math.max(ft,ee-H-J);s.value={top:`${Math.max(ft,Math.min(ut,At))}px`,left:`${xe}px`}},y=async()=>{t.disabled||(g(),m(),!r.value&&(r.value=!0,C(),await kt(),S()))},k=()=>{m(),g(),v(),r.value&&(r.value=!1)},x=()=>{if(g(),m(),!r.value){if(t.delay===0){y();return}u=window.setTimeout(()=>{u=null,y()},t.delay)}},M=()=>{if(m(),g(),!!r.value){if(t.duration===0){k();return}l=window.setTimeout(()=>{l=null,k()},t.duration)}},z=()=>{t.trigger==="hover"&&x()},q=()=>{t.trigger==="hover"&&M()},B=()=>{m(),g()},L=()=>{M()},V=$=>{$.key==="Escape"&&k()},T=$=>{($.key==="Enter"||$.key===" ")&&k()};return Vt(()=>t.disabled,$=>{$&&k()}),Vt(r,$=>{$?(window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),document.addEventListener("keydown",V,!0)):(window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0),document.removeEventListener("keydown",V,!0))}),hr(()=>{m(),g(),v(),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0),document.removeEventListener("keydown",V,!0)}),($,R)=>(pe(),we(zt,null,[ue("span",{ref_key:"triggerRef",ref:o,class:"sd-tooltip-trigger",onMouseenter:z,onMouseleave:q,onFocusin:z,onFocusout:q,onClickCapture:k,onKeydownCapture:T},[yu($.$slots,"trigger",{},void 0,!0)],544),(pe(),pn(vl,{to:"body"},[on($p,{name:"fade-in-scale-up-transition",css:r.value},{default:ho(()=>[r.value&&!e.disabled?(pe(),we("div",{key:0,ref_key:"contentRef",ref:i,class:tn(f.value),style:An(p.value),"data-placement":a.value,onMouseenter:B,onMouseleave:L},[R[0]||(R[0]=ue("span",{class:"sd-tooltip-arrow","aria-hidden":"true"},null,-1)),yu($.$slots,"default",{},void 0,!0)],46,MG)):dt("",!0)]),_:3},8,["css"])]))],64))}}),Sg=vn(PG,[["__scopeId","data-v-44bd03f9"]]);Nt(),yn();var DG=["onKeydown","tabindex","data-item-id"],OG={key:0},FG={key:0},NG={key:0},BG={key:0},zG={key:0},jG={__name:"ButtonGroup",props:{toolbarItems:{type:Array,required:!0},overflowItems:{type:Array,default:()=>[]},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"},position:{type:String,default:"left"},fromOverflow:{type:Boolean,default:!1},compactSideGroups:{type:Boolean,default:!1}},emits:["command","item-clicked","dropdown-update-show"],setup(e,{emit:t}){const n=t,{proxy:r}=Cr(),o=ne([]),i=ne(null),s=e,a=ne(null),{isHighContrastMode:l}=Wi(),u=window.matchMedia("(max-width: 768px)").matches,d=ke(()=>s.position==="left"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-start"}:s.position==="right"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-end"}:{flexGrow:u?0:1,justifyContent:"center"}),f=Re=>Re.type==="button",p=Re=>Re.type==="dropdown",g=Re=>Re.type==="dropdown"&&Re.name?.value==="fontFamily",m=Re=>Re.type==="dropdown"&&Re.name?.value==="fontSize",v=Re=>Re.type==="separator",C=Re=>Re.type==="overflow",w=Re=>!!Re.nestedOptions?.value?.length,S=Re=>{if(!Re)return!1;const se=Re.expand;return typeof se=="object"&&se!==null&&"value"in se?!!se.value:!!se},y=(Re,se)=>{Re?.expand&&(Re.expand.value=se)},k=(Re,se=void 0)=>{if(Re.disabled.value)return;if(C(Re)){const Q=!S(Re);Q&&z(),y(Re,Q),a.value=Q?Re:null,n("item-clicked");return}if(p(Re))return;a.value&&p(a.value)&&S(a.value)&&z(),n("item-clicked");const be=se!==void 0?se:Re.argument?.value;n("command",be===void 0?{item:Re}:{item:Re,argument:be})},x=(Re,se)=>{Re.disabled.value||(a.value=null,n("command",{item:Re,argument:se}))},M=Re=>{if(Re.disabled.value)return;z();const se=Re.splitButtonCommand,be=Re.command,Q=se||be;if(!Q)return;const I={...Re,command:Q};n("item-clicked"),n("command",{item:I})},z=()=>{const Re=r?.$toolbar?.toolbarItems||[],se=r?.$toolbar?.overflowItems||[],be=[...Re,...se];(be.length?be:s.toolbarItems).forEach(Q=>{const I=C(Q)&&!s.fromOverflow;(p(Q)||I)&&y(Q,!1)}),a.value=null},q=(Re,se)=>{z();const be=Re.dropdownValueKey.value?se[Re.dropdownValueKey.value]:se.label;n("command",{item:Re,argument:be,option:se}),Re.selectedValue.value=se.key,Re.restoreEditorFocus&&Gl(r?.$toolbar)},B=Re=>{n("command",Re)},L=()=>{z(),n("item-clicked")},V=()=>{const Re=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Re instanceof HTMLElement?(Re.focus({preventScroll:!0}),!0):!1},T=()=>{const Re=r?.$toolbar?.pendingSelectionCapture,se=()=>{Re&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Re)};if(V()){se();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),se())},$=Re=>!(Re instanceof HTMLElement)||Re.classList.contains("sd-disabled")?null:Re.querySelector("input:not([disabled]), textarea:not([disabled]), select:not([disabled])")||Re.querySelector('button:not([disabled]), [role="button"]:not(.sd-disabled), [tabindex]:not([tabindex="-1"])'),R=(Re,se)=>{const be=Re?.target?.closest?.(".sd-toolbar-item-ctn");if(!(be instanceof HTMLElement))return!1;let Q=se>0?be.nextElementSibling:be.previousElementSibling;for(;Q;){const I=$(Q);if(I instanceof HTMLElement)return be.setAttribute("tabindex","-1"),Q.setAttribute("tabindex","0"),I.focus(),!0;Q=se>0?Q.nextElementSibling:Q.previousElementSibling}return!1},H=Re=>{z();const se=Re?.shiftKey?-1:1;R(Re,se)||T()},G=Re=>{if(z(),Re?.shiftKey){R(Re,-1)||T();return}T()},ee=()=>{T()},J=Re=>Re.nestedOptions?.value?.length?Re.nestedOptions.value.map(se=>{const be=se?.type!=="render"&&Re.selectedValue.value===se.key;return{...se,props:{...se.props,class:be?"sd-selected":""}}}):[],X=(Re,se)=>({role:"menuitem","aria-label":`${se.attributes.value.ariaLabel} - ${Re.label}`}),xe=Re=>{const se=Re.target,be=Re.target.closest(".sd-toolbar-item-ctn").nextElementSibling;be&&(se.setAttribute("tabindex","-1"),be.setAttribute("tabindex","0"),be.focus())},fe=Re=>{const se=Re.target,be=Re.target.closest(".sd-toolbar-item-ctn").previousElementSibling;be&&(se.setAttribute("tabindex","-1"),be.setAttribute("tabindex","0"),be.focus())},ye=Re=>{const se=Re.target.closest(".button-group").nextElementSibling;if(se)se.setAttribute("tabindex","0"),se.focus();else{const be=document.querySelector(".ProseMirror");be&&be.focus()}},ve=Re=>{const se=Re.target.closest(".button-group").previousElementSibling;se&&(se.setAttribute("tabindex","0"),se.focus())},Le=Re=>{if(!Re.disabled.value){if(p(Re)){ut(!S(Re),Re);return}k(Re)}},je=(Re,se)=>{const be=Re.target.nodeName==="INPUT"||Re.target.nodeName==="TEXTAREA",Q=se.name.value==="fontSize"||se.name.value==="fontFamily";if(!(be&&Q)&&["Enter"," ","Spacebar","Escape","ArrowRight","ArrowLeft","Tab"].includes(Re.key))switch(Re.preventDefault(),Re.key){case"Enter":case" ":case"Spacebar":Le(se);break;case"Escape":z();break;case"ArrowRight":z(),xe(Re);break;case"ArrowLeft":z(),fe(Re);break;case"Tab":Re.shiftKey?ve(Re):ye(Re);break;default:break}},nt=Re=>{const se=o.value.find(be=>!be.classList.contains("sd-disabled"));se&&(se.setAttribute("tabindex","0"),se.focus())},ut=(Re,se)=>{if(n("item-clicked"),!Re){z(),n("dropdown-update-show",!1);return}z(),a.value=se,y(se,!0),n("dropdown-update-show",!0)},ft=Re=>{if(!a.value)return;const se=Re.target;se instanceof Element&&(se.closest('[data-sd-part="dropdown-menu"]')||i.value?.contains(se)||z())};return Vt(()=>S(a.value),Re=>{Re?document.addEventListener("pointerdown",ft,!0):document.removeEventListener("pointerdown",ft,!0)},{immediate:!0}),hr(()=>{document.removeEventListener("pointerdown",ft,!0)}),(Re,se)=>(pe(),we("div",{style:An(d.value),class:"button-group",role:"group",onFocus:nt,ref_key:"buttonGroupRef",ref:i},[(pe(!0),we(zt,null,Mn(e.toolbarItems,(be,Q)=>(pe(),we("div",{key:be.id.value,class:tn([{narrow:be.isNarrow.value,wide:be.isWide.value,"sd-disabled":be.disabled.value},"sd-toolbar-item-ctn"]),onKeydown:I=>je(I,be),ref_for:!0,ref_key:"toolbarItemRefs",ref:o,tabindex:Q===0?0:-1,"data-item-id":be.id.value},[v(be)?(pe(),pn(nG,{key:0,style:{width:"20px"}})):dt("",!0),g(be)&&w(be)?(pe(),pn(Sg,{key:1,trigger:"hover",disabled:!be.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:ho(()=>[on(xG,{item:be,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:B,onItemClicked:L,onTabOut:se[0]||(se[0]=I=>H(I)),onEditorHandoff:ee},null,8,["item","ui-font-family"])]),default:ho(()=>[ue("div",null,[Ai(Et(be.tooltip)+" ",1),be.disabled.value?(pe(),we("span",OG,"(disabled)")):dt("",!0)])]),_:2},1032,["disabled","content-style"])):m(be)&&w(be)?(pe(),pn(Sg,{key:2,trigger:"hover",disabled:!be.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:ho(()=>[on(RG,{item:be,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:B,onItemClicked:L,onTabOut:se[1]||(se[1]=I=>G(I)),onEditorHandoff:ee},null,8,["item","ui-font-family"])]),default:ho(()=>[ue("div",null,[Ai(Et(be.tooltip)+" ",1),be.disabled.value?(pe(),we("span",FG,"(disabled)")):dt("",!0)])]),_:2},1032,["disabled","content-style"])):p(be)&&be.nestedOptions?.value?.length?(pe(),pn(OE,{key:3,options:J(be),disabled:be.disabled.value,show:S(be),"content-style":{fontFamily:s.uiFontFamily},placement:"bottom-start",class:"sd-toolbar-button sd-editor-toolbar-dropdown",onSelect:(I,ie)=>q(be,ie),"onUpdate:show":I=>ut(I,be),style:An(be.dropdownStyles.value),"menu-props":()=>({role:"menu",style:{fontFamily:s.uiFontFamily},class:["sd-toolbar-dropdown-menu",{"high-contrast":Je(l)}]}),"node-props":I=>X(I,be)},{trigger:ho(()=>[on(Sg,{trigger:"hover",disabled:!be.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:ho(()=>[on(F1,{"toolbar-item":be,disabled:be.disabled.value,"allow-enter-propagation":!0,onTextSubmit:I=>x(be,I),onMainClick:I=>M(be)},null,8,["toolbar-item","disabled","onTextSubmit","onMainClick"])]),default:ho(()=>[ue("div",null,[Ai(Et(be.tooltip)+" ",1),be.disabled.value?(pe(),we("span",NG,"(disabled)")):dt("",!0)])]),_:2},1032,["disabled","content-style"])]),_:2},1032,["options","disabled","show","content-style","onSelect","onUpdate:show","style","menu-props","node-props"])):f(be)?(pe(),pn(Sg,{key:4,trigger:"hover",class:"sd-editor-toolbar-tooltip","content-style":{fontFamily:s.uiFontFamily}},{trigger:ho(()=>[on(F1,{"toolbar-item":be,"is-overflow-item":e.fromOverflow,onTextSubmit:I=>x(be,I),onButtonClick:I=>k(be)},null,8,["toolbar-item","is-overflow-item","onTextSubmit","onButtonClick"])]),default:ho(()=>[be.tooltip?(pe(),we("div",BG,[Ai(Et(be.tooltip)+" ",1),be.disabled.value?(pe(),we("span",zG,"(disabled)")):dt("",!0)])):dt("",!0)]),_:2},1032,["content-style"])):dt("",!0),C(be)&&e.overflowItems.length?(pe(),pn(cG,{key:5,"toolbar-item":be,"ui-font-family":s.uiFontFamily,onButtonClick:I=>k(be),"overflow-items":e.overflowItems,onClose:z,onCommand:se[2]||(se[2]=I=>n("command",I))},null,8,["toolbar-item","ui-font-family","onButtonClick","overflow-items"])):dt("",!0)],42,DG))),128))],36))}},_g=vn(jG,[["__scopeId","data-v-8d7a9de1"]]),VG=[["Arial","sans-serif"],["Arial Black","sans-serif"],["Arial Narrow","sans-serif"],["Baskerville Old Face","serif"],["Bookman Old Style","serif"],["Brush Script MT","cursive"],["Calibri","sans-serif"],["Century","serif"],["Century Gothic","sans-serif"],["Comic Sans MS","sans-serif"],["Cooper Black","serif"],["Courier New","monospace"],["Garamond","serif"],["Georgia","serif"],["Gill Sans MT Condensed","sans-serif"],["Helvetica","sans-serif"],["Lucida Console","monospace"],["Segoe UI","sans-serif"],["Tahoma","sans-serif"],["Times New Roman","serif"],["Trebuchet MS","sans-serif"],["Verdana","sans-serif"]],UG=VG.map(([e,t])=>({label:e,key:e,props:{style:{fontFamily:`${e}, ${t}`},"data-item":"btn-fontFamily-option"}}));function $G(e){if(e?.length)return e.map(t=>({label:t.label,key:t.value,props:{style:{fontFamily:t.previewFamily||t.label},"data-item":"btn-fontFamily-option"}}))}var HG=[{label:"8",key:"8pt",props:{"data-item":"btn-fontSize-option"}},{label:"9",key:"9pt",props:{"data-item":"btn-fontSize-option"}},{label:"10",key:"10pt",props:{"data-item":"btn-fontSize-option"}},{label:"11",key:"11pt",props:{"data-item":"btn-fontSize-option"}},{label:"12",key:"12pt",props:{"data-item":"btn-fontSize-option"}},{label:"14",key:"14pt",props:{"data-item":"btn-fontSize-option"}},{label:"18",key:"18pt",props:{"data-item":"btn-fontSize-option"}},{label:"24",key:"24pt",props:{"data-item":"btn-fontSize-option"}},{label:"30",key:"30pt",props:{"data-item":"btn-fontSize-option"}},{label:"36",key:"36pt",props:{"data-item":"btn-fontSize-option"}},{label:"48",key:"48pt",props:{"data-item":"btn-fontSize-option"}},{label:"60",key:"60pt",props:{"data-item":"btn-fontSize-option"}},{label:"72",key:"72pt",props:{"data-item":"btn-fontSize-option"}},{label:"96",key:"96pt",props:{"data-item":"btn-fontSize-option"}}],Th={sm:768,md:1024,lg:1280,xl:1410},N1={undo:"undo",redo:"redo",bold:"bold",italic:"italic",underline:"underline",strike:"strikethrough",acceptTrackedChangeBySelection:"track-changes-accept-selection",rejectTrackedChangeOnSelection:"track-changes-reject-selection",ruler:"ruler",formattingMarks:"formatting-marks",zoom:"zoom",measurementUnit:"measurement-unit",documentMode:"document-mode",link:"link",fontFamily:"font-family",fontSize:"font-size",list:"bullet-list",numberedlist:"numbered-list",table:"table-insert",image:"image",tableOfContents:"table-of-contents-insert",color:"text-color",highlight:"highlight-color",textAlign:"text-align",lineHeight:"line-height",linkedStyles:"linked-style",indentleft:"indent-decrease",indentright:"indent-increase",directionLtr:"direction-ltr",directionRtl:"direction-rtl",clearFormatting:"clear-formatting",copyFormat:"copy-format"},zE={addRowBefore:"table-add-row-before",addRowAfter:"table-add-row-after",deleteRow:"table-delete-row",addColumnBefore:"table-add-column-before",addColumnAfter:"table-add-column-after",deleteColumn:"table-delete-column",deleteTable:"table-delete",deleteCellAndTableBorders:"table-remove-borders",mergeCells:"table-merge-cells",splitCell:"table-split-cell",fixTables:"table-fix"},jE=Object.values(zE),ZX=[...new Set([...Object.values(N1),...jE])],GG=new Set(["link"]),QX=new Set(Object.keys(N1).filter(e=>!GG.has(e)));Nt(),yn();var WG="Arial, Helvetica, sans-serif",KG={__name:"Toolbar",emits:["command","toggle","select"],setup(e,{emit:t}){const{proxy:n}=Cr();let r=ne(1);const o=ne(null),i=ne(0),s=ne(!1);let a=null,l=null,u=n.$toolbar.getAvailableWidth();const d=ke(()=>{const V=n?.$toolbar?.config?.uiDisplayFallbackFont;return typeof V=="string"&&V.trim()?V.trim():WG}),f=n.$toolbar.config?.toolbarGroups?.includes("left"),p=n.$toolbar.config?.toolbarGroups?.includes("right"),g=V=>(i.value,n.$toolbar.getToolbarItemByGroup(V)),m=()=>{s.value=n.$toolbar.getAvailableWidth()<=Th.lg},v=()=>{const V=o.value,T=V?.ownerDocument,$=T?.activeElement;if(!V?.contains($))return null;const R=$.closest('[data-sd-part="toolbar-item"]')??$.querySelector('[data-sd-part="toolbar-item"]');if(!R||$!==R&&!$.contains(R))return null;const H=R.querySelector("[data-item]")?.getAttribute("data-item");return H?()=>{const G=o.value;if(!G?.isConnected||$.isConnected||T.activeElement!==T.body)return;const ee=[...G.querySelectorAll("[data-item]")];for(const J of[H,"btn-overflow"]){const X=ee.find(xe=>xe.getAttribute("data-item")===J)?.closest('[data-sd-part="toolbar-item"]');if(X&&X.getAttribute("aria-disabled")!=="true"){X.focus({preventScroll:!0});return}}}:null},C=async V=>{r.value+=1,await kt(),V?.()},S=BH(async()=>{const V=n.$toolbar.getAvailableWidth();if(V===u)return;u=V;const T=v();await n.$toolbar.onToolbarResize(),m(),await C(T)},300),y=()=>{const V=v();u=n.$toolbar.getAvailableWidth(),m(),C(V)},k=()=>{i.value+=1};function x(){S.cancel(),window.removeEventListener("resize",S),n.$toolbar.off?.("toolbar-items-changed",y),n.$toolbar.off?.("toolbar-state-change",k),a?.disconnect(),a=null}function M(){x(),window.addEventListener("resize",S),n.$toolbar.on?.("toolbar-items-changed",y),n.$toolbar.on?.("toolbar-state-change",k),typeof ResizeObserver<"u"&&n.$toolbar.config?.responsiveToContainer&&n.$toolbar.toolbarContainer&&(a=new ResizeObserver(()=>{S()}),a.observe(n.$toolbar.toolbarContainer)),m()}Nn(M),$v(M),Hv(x),hr(x);const z=()=>{if(!n.$toolbar.activeEditor){l=null,n.$toolbar.pendingSelectionCapture=null;return}l=n.$toolbar.ui?.selection?.capture?.()??null,n.$toolbar.pendingSelectionCapture=l},q=({item:V,argument:T,option:$})=>{B(),n.$toolbar.emitCommand({item:V,argument:T,option:$})},B=()=>{const V=n.$toolbar.activeEditor;if(!V)return;const T=n.$toolbar.pendingSelectionCapture??l;if(T&&typeof n.$toolbar.ui?.selection?.restore=="function"){n.$toolbar.ui.selection.restore(T);return}V.commands?.restoreSelection?.()},L=V=>{z(),FE(V)};return(V,T)=>(pe(),we("div",{class:"superdoc-toolbar",ref_key:"toolbarRoot",ref:o,key:Je(r),role:"toolbar","aria-label":"Toolbar","data-sd-part":"toolbar","data-editor-ui-surface":"",onMousedown:L},[Je(f)?(pe(),pn(_g,{key:0,tabindex:"0","toolbar-items":g("left"),"overflow-items":Je(n).$toolbar.overflowItems,"compact-side-groups":s.value,"ui-font-family":d.value,position:"left",onCommand:q,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):dt("",!0),on(_g,{tabindex:"0","toolbar-items":g("center"),"overflow-items":Je(n).$toolbar.overflowItems,"compact-side-groups":s.value,"ui-font-family":d.value,position:"center",onCommand:q},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"]),Je(p)?(pe(),pn(_g,{key:1,tabindex:"0","toolbar-items":g("right"),"overflow-items":Je(n).$toolbar.overflowItems,"compact-side-groups":s.value,"ui-font-family":d.value,position:"right",onCommand:q,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):dt("",!0)],32))}},qG=vn(KG,[["__scopeId","data-v-0d00bc5b"]]),YG=e=>{if(!e)return e;const t=e.props?.style?.fontFamily??e.label??e.key;return{...e,props:{...e.props,style:{...e.props?.style,fontFamily:t},"data-item":e.props?.["data-item"]??"btn-fontFamily-option"}}};Nt();var xn=e=>{if(!["button","options","separator","dropdown","overflow"].includes(e.type))throw new Error("Invalid toolbar item type - "+e.type);if(e.type==="button"&&!e.defaultLabel&&!e.icon)throw new Error(`Toolbar button item needs either "icon" or "defaultLabel" - ${e.name}. "label" is the live label and is not a substitute for "defaultLabel".`);if(!e.name)throw new Error("Invalid toolbar item name - "+e.name);const t=ne(cl()),n=e.type,r=ne(e.name),o=e.command,i=e.noArgumentCommand,s=ne(e.icon),a=ne(e.group||"center"),l=ne(e.allowWithoutEditor),u=ne(e.attributes||{}),d=!!e.disabled,f=ne(e.disabled),p=ne(!1),g=ne(!1),m=ne(e.style),v=ne(e.isNarrow),C=ne(e.isWide),w=ne(e.minWidth),S=ne(e.layoutWidth),y=ne(e.suppressActiveHighlight||!1),k=ne(e.argument),x=ne(null),M=ne(null),z=ne(e.iconColor),q=ne(e.hasCaret),B=ne(!!e.splitButton),L=e.splitButtonCommand,V=!!e.restoreEditorFocus,T=ne(e.dropdownStyles),$=ne(e.tooltip),R=ne(e.tooltipVisible),H=ne(e.tooltipTimeout),G=ne(e.defaultLabel),ee=ne(e.label),J=ne(e.hideLabel),X=ne(e.inlineTextInputVisible),xe=ne(e.hasInlineTextInput),fe=ne(e.markName),ye=ne(e.labelAttr),ve=ne(e.selectedValue),Le=ne(e.dropdownValueKey),je=ne(e.inputRef||null),nt=ne([]);if(e.options){if(!Array.isArray(e.options))throw new Error("Invalid toolbar item options - "+e.options);let ie=0;for(let j=0;j<e.options.length;j+=1){const Z=e.options[j];(!Z||typeof Z!="object")&&(ie+=1)}if(ie)throw new Error(`Toolbar item options must all be objects - ${e.name}. ${ie} row(s) are not, so this item is skipped.`);nt.value?.push(...e.options)}const ut=(ie={},...j)=>{se(ie,...j),!y.value&&(p.value=!0)},ft=()=>{be(),p.value=!1},At=ie=>{f.value=ie},Re=()=>{f.value=d},se=e.onActivate||(()=>null),be=e.onDeactivate||(()=>null),Q=()=>{const ie={};return Object.keys(I).forEach(j=>{I[j].value!==void 0&&(ie[j]=I[j].value)}),ie},I={id:t,name:r,type:n,command:o,noArgumentCommand:i,icon:s,tooltip:$,group:a,attributes:u,disabled:f,active:p,expand:g,nestedOptions:nt,style:m,isNarrow:v,isWide:C,minWidth:w,layoutWidth:S,argument:k,parentItem:M,iconColor:z,hasCaret:q,splitButton:B,splitButtonCommand:L,dropdownStyles:T,tooltipVisible:R,tooltipTimeout:H,defaultLabel:G,label:ee,hideLabel:J,inlineTextInputVisible:X,hasInlineTextInput:xe,restoreEditorFocus:V,markName:fe,labelAttr:ye,childItem:x,allowWithoutEditor:l,dropdownValueKey:Le,selectedValue:ve,inputRef:je};return{...I,initiallyDisabled:d,unref:Q,activate:ut,deactivate:ft,setDisabled:At,resetDisabled:Re,onActivate:se,onDeactivate:be}};Nt(),yn();var XG=["onClick","innerHTML","aria-label","onKeydown"],ZG={__name:"AlignmentButtons",emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=Wi(),r=t,o=ne([]),i=[{key:"left",ariaLabel:"Align left",icon:pr.alignLeft},{key:"center",ariaLabel:"Align center",icon:pr.alignCenter},{key:"right",ariaLabel:"Align right",icon:pr.alignRight},{key:"justify",ariaLabel:"Justify",icon:pr.alignJustify}],s=d=>{r("select",d)},a=d=>{if(d===o.value.length-1)return;const f=o.value[d+1];f&&(f.setAttribute("tabindex","0"),f.focus())},l=d=>{if(d===0)return;const f=o.value[d-1];f&&(f.setAttribute("tabindex","0"),f.focus())},u=(d,f)=>{switch(d.key){case"ArrowLeft":l(f);break;case"ArrowRight":a(f);break;case"Enter":s(i[f].key);break;default:break}};return Nn(()=>{const d=o.value[0];d&&(d.setAttribute("tabindex","0"),d.focus())}),(d,f)=>(pe(),we("div",{class:tn(["alignment-buttons",{"high-contrast":Je(n)}])},[(pe(),we(zt,null,Mn(i,(p,g)=>ue("div",{key:p.key,class:"sd-button-icon",onClick:m=>s(p.key),innerHTML:p.icon,"data-item":"btn-textAlign-option",role:"menuitem","aria-label":p.ariaLabel,ref_for:!0,ref_key:"alignmentButtonsRefs",ref:o,onKeydown:sn(m=>u(m,g),["prevent"])},null,40,XG)),64))],2))}},QG=vn(ZG,[["__scopeId","data-v-13e5f7a4"]]);Nt(),yn();var JG=["onClick","innerHTML","aria-label","onKeydown"],eW={__name:"StyleButtonsList",props:{buttons:{type:Array,required:!0},selectedStyle:{type:String,default:null},iconSize:{type:Number,default:25}},emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=Wi(),r=t,o=e,i=ne([]),s=ke(()=>({width:`${o.iconSize}px`,height:`${o.iconSize}px`})),a=f=>{r("select",f)},l=f=>{if(f===i.value.length-1)return;const p=i.value[f+1];p&&(p.setAttribute("tabindex","0"),p.focus())},u=f=>{if(f===0)return;const p=i.value[f-1];p&&(p.setAttribute("tabindex","0"),p.focus())},d=(f,p)=>{switch(f.key){case"ArrowLeft":u(p);break;case"ArrowRight":l(p);break;case"Enter":a(o.buttons[p].key);break;default:break}};return Nn(()=>{const f=i.value[0];f&&(f.setAttribute("tabindex","0"),f.focus())}),(f,p)=>(pe(),we("div",{class:tn(["style-buttons-list",{"high-contrast":Je(n)}])},[(pe(!0),we(zt,null,Mn(o.buttons,(g,m)=>(pe(),we("div",{key:g.key,class:tn(["sd-button-icon",{"sd-selected":o.selectedStyle===g.key}]),style:An(s.value),onClick:v=>a(g.key),innerHTML:g.icon,role:"menuitem","aria-label":g.ariaLabel,ref_for:!0,ref_key:"buttonRefs",ref:i,onKeydown:sn(v=>d(v,m),["prevent"])},null,46,JG))),128))],2))}},VE=vn(eW,[["__scopeId","data-v-44f37ff6"]]),tW=[{key:"disc",icon:pr.bulletListDisc,ariaLabel:"Opaque circle"},{key:"circle",icon:pr.bulletListCircle,ariaLabel:"Outline circle"},{key:"square",icon:pr.bulletListSquare,ariaLabel:"Opaque square"}],nW=[{key:"decimal",icon:pr.numberedListDecimal,ariaLabel:"1. 2. 3."},{key:"decimal-paren",icon:pr.numberedListDecimalParen,ariaLabel:"1) 2) 3)"},{key:"upper-roman",icon:pr.numberedListUpperRoman,ariaLabel:"I. II. III."},{key:"lower-roman",icon:pr.numberedListLowerRoman,ariaLabel:"i. ii. iii."},{key:"upper-alpha",icon:pr.numberedListUpperAlpha,ariaLabel:"A. B. C."},{key:"upper-alpha-paren",icon:pr.numberedListUpperAlphaParen,ariaLabel:"A) B) C)"},{key:"lower-alpha",icon:pr.numberedListLowerAlpha,ariaLabel:"a. b. c."},{key:"lower-alpha-paren",icon:pr.numberedListLowerAlphaParen,ariaLabel:"a) b) c)"}];Nt(),yn();var rW=["onClick","onKeydown"],oW={class:"document-mode-column icon-column"},iW=["innerHTML"],sW={class:"document-mode-column text-column"},aW={class:"document-mode-type"},lW={class:"document-mode-description"},cW={__name:"DocumentMode",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=ne([]),{isHighContrastMode:o}=Wi(),i=e,s=d=>{n("select",d)},a=d=>{if(d===r.value.length-1)return;const f=r.value[d+1];f&&(f.setAttribute("tabindex","0"),f.focus())},l=d=>{if(d===0)return;const f=r.value[d-1];f&&(f.setAttribute("tabindex","0"),f.focus())},u=(d,f)=>{switch(d.key){case"ArrowDown":a(f);break;case"ArrowUp":l(f);break;case"Enter":s(i.options[f]);break;default:break}};return Nn(()=>{r.value[0].setAttribute("tabindex","0"),r.value[0].focus()}),(d,f)=>(pe(),we("div",{class:tn(["document-mode",{"high-contrast":Je(o)}])},[(pe(!0),we(zt,null,Mn(e.options,(p,g)=>(pe(),we("div",{class:tn(["sd-option-item",{"sd-disabled":p.disabled}]),onClick:m=>s(p),"data-item":"btn-documentMode-option",role:"menuitem",ref_for:!0,ref_key:"documentModeRefs",ref:r,onKeydown:sn(m=>u(m,g),["prevent"])},[ue("div",oW,[ue("div",{class:"icon-column__icon",innerHTML:p.icon},null,8,iW)]),ue("div",sW,[ue("div",aW,Et(p.label),1),ue("div",lW,Et(p.description),1)])],42,rW))),256))],2))}},uW=vn(cW,[["__scopeId","data-v-bee14d7a"]]);Nt(),yn();var dW={class:"linked-style-buttons","data-editor-ui-surface":""},fW=["onClick","onKeydown","aria-label"],hW={__name:"LinkedStyle",props:{styles:{type:Array,default:()=>[]},selectedOption:{type:String,default:null}},emits:["select"],setup(e,{emit:t}){const n=t,r=ne([]),o=e,i=p=>{n("select",p)},s=p=>{if(p===r.value.length-1)return;const g=r.value[p+1];g.setAttribute("tabindex","0"),g.focus()},a=p=>{if(p===0)return;const g=r.value[p-1];g.setAttribute("tabindex","0"),g.focus()},l=(p,g,m)=>{switch(p.key){case"ArrowDown":s(g);break;case"ArrowUp":a(g);break;case"Enter":p.preventDefault(),i(m);break;default:break}},u=p=>p?.name??p?.id??"",d=p=>{const g=p?.preview?.css;return g&&typeof g=="object"?g:void 0},f=()=>{r.value[0]&&(r.value[0].setAttribute("tabindex","0"),r.value[0].focus())};return Nn(f),Vt(()=>o.styles.length,async(p,g)=>{p===0||g!==0||(await kt(),f())}),(p,g)=>(pe(),we("div",dW,[(pe(!0),we(zt,null,Mn(o.styles,(m,v)=>(pe(),we("div",{key:m.id??v,class:tn(["style-item",{selected:e.selectedOption===m.id}]),onClick:C=>i(m),onKeydown:C=>l(C,v,m),"aria-label":`Linked style - ${m.id??u(m)}`,ref_for:!0,ref_key:"styleRefs",ref:r},[ue("div",{class:"style-name","data-item":"btn-linkedStyles-option",style:An(d(m))},Et(u(m)),5)],42,fW))),128))]))}},pW=vn(hW,[["__scopeId","data-v-74c8924b"]]);Nt(),yn();var mW=["placeholder"],gW={class:"sd-ai-writer__footer"},vW={key:0,class:"sd-ai-writer__error",role:"alert"},yW=["disabled"],bW="https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights",wW="You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.",CW={__name:"AIWriter",props:{selectedText:{type:String,default:""},target:{type:Object,default:null},doc:{type:Object,default:null},apiKey:{type:String,default:""},endpoint:{type:String,default:""},restoreSelection:{type:Function,default:null},handleClose:{type:Function,required:!0}},setup(e){const t=e,n=ne(""),r=ne(!1),o=ne(""),i=ne(null),s=ke(()=>t.selectedText?"Insert prompt to update text":"Insert prompt to generate text"),a=ke(()=>n.value.trim().length>0&&!r.value);Nn(()=>{kt(()=>{i.value?.focus()})});function l(m){if(typeof m=="string")return m;if(!m||typeof m!="object")return"";const v=m.custom_prompt;if(Array.isArray(v)){const C=v[0];if(C&&typeof C.value=="string")return C.value}return v&&typeof v=="object"&&typeof v.value=="string"?v.value:typeof m.value=="string"?m.value:typeof m.text=="string"?m.text:""}async function u(m){const v={"Content-Type":"application/json"};t.apiKey&&(v["x-api-key"]=t.apiKey);const C=t.selectedText.trim(),w=C?`Rewrite the following text: "${C}" using these instructions: ${m}`:`Generate text based on the following prompt: ${m}`,S=await fetch(t.endpoint||bW,{method:"POST",headers:v,body:JSON.stringify({stream:!1,context:wW,insights:[{type:"custom_prompt",name:C?"text_rewrite":"text_generation",message:w,format:[{value:""}]}]})});if(!S.ok){const k=await S.text().catch(()=>"");throw new Error(k||`AI request failed with ${S.status}`)}const y=l((S.headers.get("content-type")||"").includes("application/json")?await S.json():await S.text()).trim();if(!y)throw new Error("AI returned no text.");return y}function d(m){return!m||typeof m!="object"?!0:!(m.success===!1||m.ok===!1)}function f(m){const v=t.doc;if(!v)throw new Error("Document API is unavailable.");t.restoreSelection?.();let C=null,w=!1;if(t.selectedText&&t.target&&typeof v.replace=="function"?(C=v.replace({target:t.target,text:m}),w=!0):t.target&&typeof v.insert=="function"?(C=v.insert({target:t.target,value:m,type:"text"}),w=!0):typeof v.insert=="function"&&(C=v.insert({value:m,type:"text"}),w=!0),!w)throw new Error("Document text insertion is unavailable.");if(!d(C))throw new Error("Unable to insert generated text.")}async function p(){if(a.value){o.value="",r.value=!0;try{f(await u(n.value.trim())),t.handleClose()}catch(m){o.value=m instanceof Error?m.message:String(m)}finally{r.value=!1}}}function g(m){m.key!=="Enter"||m.shiftKey||(m.preventDefault(),p())}return(m,v)=>(pe(),we("form",{class:"sd-ai-writer","data-item":"ai-writer",onSubmit:sn(p,["prevent"])},[_i(ue("textarea",{ref_key:"textareaRef",ref:i,"onUpdate:modelValue":v[0]||(v[0]=C=>n.value=C),class:"sd-ai-writer__input",placeholder:s.value,rows:"4",onKeydown:g},null,40,mW),[[Ti,n.value]]),ue("div",gW,[o.value?(pe(),we("p",vW,Et(o.value),1)):dt("",!0),ue("button",{class:"sd-ai-writer__submit",type:"submit",disabled:!a.value},Et(r.value?"Generating":"Generate"),9,yW)])],32))}},kW=vn(CW,[["__scopeId","data-v-67f6c6f7"]]);Nt(),yn();var SW=["aria-label","onClick","onKeydown"],_W=["innerHTML"],AW=["innerHTML"],Ag=7,IW={__name:"IconGridRow",props:{icons:{type:Array,required:!0},activeColor:{type:Object,required:!1}},emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=e,o=ke(()=>m=>r.activeColor.value?r.activeColor.value.toUpperCase()===m.value:!1),i=(m,v)=>v===5||["#FFFFFF","#FAFF09"].includes(m)?{color:"#000"}:{color:"#FFF"},s=m=>{n("select",m.value)},a=ne([]),l=ne([]);Nn(()=>{if(!r.icons.every(v=>Array.isArray(v)))throw new Error("icon props must be 2d array");const m=l.value[0];m&&(m.setAttribute("tabindex","0"),m.focus({preventScroll:!0}))});const u=(m,v)=>{const C=Ag*m+v+1,w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},d=(m,v)=>{const C=Ag*m+v-1,w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},f=(m,v)=>{const C=v+Ag*(m+1),w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},p=(m,v)=>{const C=v+Ag*(m-1),w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},g=(m,v,C,w)=>{switch(m.key){case"ArrowRight":u(v,C);break;case"ArrowLeft":d(v,C);break;case"ArrowDown":f(v,C);break;case"ArrowUp":p(v,C);break;case"Enter":s(w);break;case"Escape":n("clickoutside");break;default:break}};return(m,v)=>(pe(!0),we(zt,null,Mn(e.icons,(C,w)=>(pe(),we("div",{class:"sd-option-row",key:w,role:"group",ref_for:!0,ref_key:"rowRefs",ref:a},[(pe(!0),we(zt,null,Mn(C,(S,y)=>(pe(),we("div",{class:"sd-option",key:y,"aria-label":S.label,role:"menuitem",ref_for:!0,ref_key:"iconRefs",ref:l,onClick:sn(k=>s(S),["stop","prevent"]),onKeydown:sn(k=>g(k,w,y,S),["prevent"])},[ue("div",{class:"sd-option__icon",innerHTML:S.icon,style:An(S.style)},null,12,_W),o.value(S)?(pe(),we("div",{key:0,class:"sd-option__check",innerHTML:Je(pr).colorOptionCheck,style:An(i(S.value,y))},null,12,AW)):dt("",!0)],40,SW))),128))]))),128))}},UE=vn(IW,[["__scopeId","data-v-05eb02fc"]]),EW=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M320 512c53.2 0 101.4-21.6 136.1-56.6l-298.3-235C140 257.1 128 292.3 128 320c0 106 86 192 192 192zM505.2 370.7c4.4-16.2 6.8-33.1 6.8-50.7c0-91.2-130.2-262.3-166.6-308.3C339.4 4.2 330.5 0 320.9 0l-1.8 0c-9.6 0-18.5 4.2-24.5 11.7C277.8 33 240.7 81.3 205.8 136L38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L505.2 370.7zM224 336c0 44.2 35.8 80 80 80c8.8 0 16 7.2 16 16s-7.2 16-16 16c-61.9 0-112-50.1-112-112c0-8.8 7.2-16 16-16s16 7.2 16 16z"/></svg>
|
|
106
106
|
`;Nt(),yn();var TW={class:"options-grid-wrap"},xW=["innerHTML"],RW={class:"option-grid-ctn"},MW={__name:"IconGrid",props:{icons:{type:Array,required:!0},customIcons:{type:Array,required:!1},activeColor:{type:Object,required:!1},hasNoneIcon:{type:Boolean,required:!1}},emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=o=>{n("select",o)};return(o,i)=>(pe(),we("div",TW,[e.hasNoneIcon?(pe(),we("div",{key:0,class:"none-option",role:"menuitem","aria-label":"Clear color selection",onClick:i[0]||(i[0]=s=>r("none"))},[ue("span",{innerHTML:Je(EW),class:"none-icon"},null,8,xW),i[1]||(i[1]=Ai(" None ",-1))])):dt("",!0),ue("div",RW,[on(UE,{icons:e.icons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"]),e.customIcons.flat().length?(pe(),we(zt,{key:0},[i[2]||(i[2]=ue("span",{class:"option-grid-ctn__subtitle"},"Custom colors",-1)),on(UE,{icons:e.customIcons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"])],64)):dt("",!0)])]))}},LW=vn(MW,[["__scopeId","data-v-52b0283a"]]);Nt();var PW=e=>{e.expand.value=!1},Wt=(e,t=null)=>({label:t,icon:pr.colorOption,value:e,style:{color:e,boxShadow:"0 0 5px 1px rgba(0, 0, 0, 0.1)",borderRadius:"50%"}}),B1=(e,t,n=[],r=!1)=>{const o=i=>{t.iconColor.value=i,e.emitCommand({item:t,argument:i}),PW(t),Gl(e)};return Nr("div",{},[Nr(LW,{icons:DW,customIcons:n,activeColor:t.iconColor,hasNoneIcon:r,onSelect:o})])},DW=[[Wt("#111111","black"),Wt("#333333","dark gray"),Wt("#5C5C5C","medium gray"),Wt("#858585","light gray"),Wt("#ADADAD","very light gray"),Wt("#D6D6D6","transparent gray"),Wt("#FFFFFF","white")],[Wt("#860028","dark red"),Wt("#D2003F","red"),Wt("#DB3365","coral red"),Wt("#E4668C","light red"),Wt("#ED99B2","pale pink"),Wt("#F6CCD9","transparent pink"),Wt("#FF004D","bright pink")],[Wt("#83015E","dark purple"),Wt("#CD0194","purple"),Wt("#D734A9","orchid"),Wt("#E167BF","light purple"),Wt("#EB99D4","lavender"),Wt("#F5CCEA","transparent pink"),Wt("#FF00A8","neon pink")],[Wt("#8E220A","maroon"),Wt("#DD340F","red-orange"),Wt("#E45C3F","burnt orange"),Wt("#EB856F","peach"),Wt("#F1AE9F","pale peach"),Wt("#F8D6CF","transparent peach"),Wt("#FF7A00","orange")],[Wt("#947D02","olive"),Wt("#E7C302","mustard yellow"),Wt("#ECCF35","yellow"),Wt("#F1DB67","light yellow"),Wt("#F5E79A","very pale yellow"),Wt("#FAF3CC","transparent yellow"),Wt("#FAFF09","neon yellow")],[Wt("#055432","forest green"),Wt("#07834F","green"),Wt("#399C72","medium green"),Wt("#6AB595","light green"),Wt("#9CCDB9","mint"),Wt("#CDE6DC","transparent mint"),Wt("#05F38F","bright teal")],[Wt("#063E7E","navy blue"),Wt("#0A60C5","blue"),Wt("#3B80D1","sky blue"),Wt("#6CA0DC","cornflower blue"),Wt("#9DBFE8","light blue"),Wt("#CEDFF3","very light blue"),Wt("#21c8ce","cyan")],[Wt("#3E027A","deep purple"),Wt("#6103BF","indigo"),Wt("#8136CC","violet"),Wt("#A068D9","lavender pink"),Wt("#C09AE6","light lilac"),Wt("#DFCDF2","transparent lilac"),Wt("#A91DFF","neon purple")]];Nt(),yn();var OW=["data-cols","data-rows","onKeydown","onClick"],FW=["aria-valuetext"],Ig=5,NW={__name:"TableGrid",emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=ne(0),o=ne(0),{isHighContrastMode:i}=Wi(),s=ne([]),a=f=>{let p=f.target;if(p.dataset.grid)return;let g=[...p.parentElement.querySelectorAll("[data-item]")],m=parseInt(p.dataset.cols,10),v=parseInt(p.dataset.rows,10);l(g,m,v)},l=(f,p,g)=>{o.value=p,r.value=g;for(let m=0;m<f.length;m++){let v=f[m],C=parseInt(v.dataset.cols,10),w=parseInt(v.dataset.rows,10);C<=p&&w<=g?v.classList.add("sd-selected"):v.classList.remove("sd-selected")}},u=({cols:f,rows:p})=>{n("select",{cols:f,rows:p})},d=(f,p,g)=>{let m=p-1,v=g-1;switch(f.key){case"ArrowRight":{if(m>=4)return;const C=v*Ig;s.value[C+m+1].setAttribute("tabindex","0"),s.value[C+m+1].focus(),l(s.value,p+1,g);break}case"ArrowLeft":{if(m<=0)return;const C=v*Ig;s.value[C+m-1].setAttribute("tabindex","0"),s.value[C+m-1].focus(),l(s.value,p-1,g);break}case"ArrowDown":{if(v>=4)return;const C=(v+1)*Ig;s.value[C+m].setAttribute("tabindex","0"),s.value[C+m].focus(),l(s.value,p,g+1);break}case"ArrowUp":{if(v<=0)return;const C=(v-1)*Ig;s.value[C+m].setAttribute("tabindex","0"),s.value[C+m].focus(),l(s.value,p,g-1);break}case"Enter":u({cols:p,rows:g});break;default:break}};return Nn(()=>{s.value[0].setAttribute("tabindex","0"),s.value[0].focus(),l(s.value,1,1)}),(f,p)=>(pe(),we("div",{class:tn(["toolbar-table-grid-wrapper",{"high-contrast":Je(i)}])},[ue("div",{class:"toolbar-table-grid",onMouseover:a,"data-grid":"true"},[(pe(),we(zt,null,Mn(5,g=>(pe(),we(zt,{key:g},[(pe(),we(zt,null,Mn(5,m=>ue("div",{class:"toolbar-table-grid__item",key:`${g}_${m}`,"data-cols":m,"data-rows":g,"data-item":"true",ref_for:!0,ref_key:"tableGridItems",ref:s,onKeydown:sn(v=>d(v,m,g),["prevent"]),onClick:sn(v=>u({cols:m,rows:g}),["stop","prevent"])},null,40,OW)),64))],64))),64))],32),ue("div",{class:"toolbar-table-grid-value","aria-valuetext":`${r.value} x ${o.value}`},Et(r.value)+" x "+Et(o.value),9,FW)],2))}},BW=vn(NW,[["__scopeId","data-v-b87d6ca2"]]);Nt(),yn();var zW={class:"toolbar-table-actions"},jW=["onClick","data-item","ariaLabel"],VW={class:"toolbar-table-actions__icon"},UW=["innerHTML"],$W={class:"toolbar-table-actions__label"},HW={__name:"TableActions",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=o=>{n("select",{command:o.command})};return(o,i)=>(pe(),we("div",zW,[(pe(!0),we(zt,null,Mn(e.options,s=>(pe(),we("div",{class:tn(["toolbar-table-actions__item",{"toolbar-table-actions__item--border":s.bottomBorder}]),onClick:a=>r(s),"data-item":s.props?.["data-item"]||"",ariaLabel:s.props?.ariaLabel,role:"menuitem"},[ue("div",VW,[ue("div",{class:"toolbar-table-actions__icon-wrapper",innerHTML:s.icon},null,8,UW)]),ue("div",$W,Et(s.label),1)],10,jW))),256))]))}},GW=vn(HW,[["__scopeId","data-v-0cdad084"]]);Nt(),yn();var WW=["aria-busy"],KW=["aria-disabled"],qW={class:"sd-page-number-menu__row-label","aria-hidden":"true"},YW=["aria-checked","aria-label","title","tabindex","data-position","data-alignment","onClick"],XW={class:"sd-page-number-menu__page",viewBox:"0 0 36 46","aria-hidden":"true",focusable:"false"},ZW=["x","y"],QW={class:"sd-page-number-menu__check"},JW=["disabled"],eK={class:"sd-page-number-menu__format"},tK={class:"sd-page-number-menu__field"},nK=["disabled"],rK=["value"],oK={class:"sd-page-number-menu__start"},iK={class:"sd-page-number-menu__check"},sK=["disabled"],aK=["disabled","onKeydown"],lK={key:0,class:"sd-page-number-menu__error",role:"alert"},cK={key:1,class:"sd-page-number-menu__note",role:"status"},uK={class:"sd-page-number-menu__actions"},dK=["disabled"],fK=["disabled"],hK=["disabled"],pK={class:"sd-page-number-menu__cursor-text"},mK={__name:"PageNumberMenu",props:{pageNumbersState:{type:Object,default:null},atCursorState:{type:Object,default:null},suggesting:{type:Boolean,default:!1},inHeaderFooter:{type:Boolean,default:!1},loadCurrent:{type:Function,default:null},applyPageNumbers:{type:Function,required:!0},removePageNumbers:{type:Function,required:!0},insertAtCursor:{type:Function,required:!0},close:{type:Function,required:!0},initialChoice:{type:Object,default:null}},setup(e){const t=e,n=[{value:"top",label:"Top of page",kind:"header"},{value:"bottom",label:"Bottom of page",kind:"footer"}],r=[{value:"left",label:"left"},{value:"center",label:"center"},{value:"right",label:"right"}],o=n.flatMap(se=>r.map(be=>({position:se.value,alignment:be.value,label:`${se.label}, ${be.label}`}))),i=[{value:"decimal",label:"1, 2, 3"},{value:"lowerLetter",label:"a, b, c"},{value:"upperLetter",label:"A, B, C"},{value:"lowerRoman",label:"i, ii, iii"},{value:"upperRoman",label:"I, II, III"},{value:"numberInDash",label:"- 1 -, - 2 -"}],s=[{value:"hebrew1",label:"Χ, Χ, Χ"},{value:"hebrew2",label:"Χ, Χ, Χ (alphabet)"}],a={left:6,center:14,right:22},l={top:4,bottom:37},{isHighContrastMode:u}=Wi(),d=t.initialChoice??{},f=ne(d.position==="top"?"top":"bottom"),p=ne(r.some(se=>se.value===d.alignment)?d.alignment:"right"),g=ne(d.showOnFirstPage!==!1),m=ne("decimal"),v=ne(!1),C=ne(1),w=ne(null),S=ne(typeof t.loadCurrent=="function");let y=Promise.resolve();const k=ne(!1),x=ne(!1),M=ne(""),z=ne([]),q=ke(()=>t.pageNumbersState?.enabled===!0),B=ke(()=>t.atCursorState?.enabled===!0),L=ke(()=>(w.value?.placements?.length??0)>0),V=ke(()=>s.some(se=>se.value===m.value)?[...i,...s]:i),T=ke(()=>o.findIndex(se=>se.position===f.value&&se.alignment===p.value)),$=ke(()=>{if(T.value>=0)return T.value;const se=n.findIndex(be=>be.value===f.value);return Math.max(0,se)*r.length}),R=ke(()=>L.value?"Apply":"Add page numbers"),H=ke(()=>q.value?"":t.suggesting?"Page numbers canβt be changed as a suggestion. Switch to Editing to change them.":"Page numbers canβt be changed right now."),G=ke(()=>B.value?"In the header or footer youβre editing":t.inHeaderFooter?"Place the cursor without selecting text":"Click into a header or footer first"),ee=ke(()=>{const se=typeof navigator>"u"?"":navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad/i.test(se)?"β₯β§βP":"Ctrl+Alt+Shift+P"});function J(se){return se.position===f.value&&se.alignment===p.value}function X(){k.value=!0,M.value=""}function xe(se,{focus:be=!1}={}){f.value=se.position,p.value=se.alignment,X(),be&&kt(()=>z.value[o.indexOf(se)]?.focus())}function fe(se){const be=$.value,Q=Math.floor(be/r.length),I=be%r.length,ie={ArrowLeft:[Q,Math.max(0,I-1)],ArrowRight:[Q,Math.min(r.length-1,I+1)],ArrowUp:[Math.max(0,Q-1),I],ArrowDown:[Math.min(n.length-1,Q+1),I],Home:[Q,0],End:[Q,r.length-1]}[se.key];return ie?(se.preventDefault(),xe(o[ie[0]*r.length+ie[1]],{focus:!0}),!0):!1}function ye(se){fe(se)||(se.key==="Enter"?(se.preventDefault(),ft()):se.key===" "&&se.preventDefault())}function ve(se){if(w.value=se&&Array.isArray(se.placements)?se:null,!w.value||k.value)return;const be=w.value.placements.find(Q=>Q.kind==="footer"&&Q.alignment)??w.value.placements.find(Q=>Q.alignment)??w.value.placements[0];be&&(f.value=be.kind==="header"?"top":"bottom",p.value=be.alignment??null,g.value=w.value.showOnFirstPage!==!1),m.value=w.value.format??"decimal",v.value=typeof w.value.start=="number",C.value=typeof w.value.start=="number"?w.value.start:1,kt(()=>z.value[$.value]?.focus({preventScroll:!0}))}function Le(){const se=w.value,be=f.value==="top"?"header":"footer",Q=se?.placements?.find(j=>j.kind===be)??null,I={position:f.value};p.value&&(!Q||Q.alignment!==p.value)&&(I.alignment=p.value),(!L.value||g.value!==(se?.showOnFirstPage!==!1))&&(I.showOnFirstPage=g.value),m.value!==(se?.format??"decimal")&&(I.format=m.value);const ie=v.value?je():null;return ie!==(se?.start??null)&&(I.start=ie),I}function je(){const se=Math.floor(Number(C.value));return Number.isFinite(se)&&se>=0?se:1}function nt(se,be){const Q=se?.failure?.details;return Q?.reason==="page-number-has-content"?`A page number shares its line with other text. Edit the ${Q.kind==="header"?"header":"footer"} directly to change it.`:Q?.reason==="page-number-exists"?"This section already has page numbers.":be==="remove"?"Page numbers couldnβt be removed. Try again.":L.value?"Page numbers couldnβt be changed. Try again.":"Page numbers couldnβt be added. Try again."}async function ut(se,be){if(!(!q.value||x.value)){x.value=!0,M.value="";try{await y;const{execute:Q,outcome:I}=be(),ie=await Q();if(ie===!0||ie?.success===!0){t.close(I);return}M.value=nt(ie,se)}catch{M.value=nt(null,se)}finally{x.value=!1}}}function ft(){return ut("apply",()=>{const se=Le();return{execute:()=>t.applyPageNumbers(se),outcome:{action:"apply",choice:{position:f.value,alignment:p.value,showOnFirstPage:g.value}}}})}function At(){return ut("remove",()=>({execute:()=>t.removePageNumbers(),outcome:{action:"remove",kinds:(w.value?.placements??[]).map(se=>se.kind)}}))}function Re(){if(!B.value||x.value)return;x.value=!0;let se;try{se=t.insertAtCursor()}catch{se=void 0}t.close({action:"cursor"}),Promise.resolve(se).catch(()=>{})}return Nn(()=>{kt(()=>z.value[$.value]?.focus({preventScroll:!0})),typeof t.loadCurrent=="function"&&(y=Promise.resolve().then(()=>t.loadCurrent()).then(ve,()=>ve(null)).finally(()=>{S.value=!1}))}),(se,be)=>(pe(),we("div",{class:tn(["sd-page-number-menu",{"high-contrast":Je(u)}]),role:"group","aria-labelledby":"sd-page-number-menu-title","aria-busy":S.value||void 0,"data-sd-page-number-menu":""},[be[9]||(be[9]=ue("div",{id:"sd-page-number-menu-title",class:"sd-page-number-menu__title"},"Page numbers",-1)),ue("div",{class:"sd-page-number-menu__grid",role:"radiogroup","aria-label":"Position","aria-disabled":!q.value||void 0},[(pe(),we(zt,null,Mn(n,(Q,I)=>(pe(),we(zt,{key:Q.value},[ue("div",qW,Et(Q.label),1),(pe(!0),we(zt,null,Mn(Je(o).slice(I*3,I*3+3),ie=>(pe(),we("button",{key:`${ie.position}-${ie.alignment}`,ref_for:!0,ref:j=>z.value[Je(o).indexOf(ie)]=j,type:"button",role:"radio",class:tn(["sd-page-number-menu__tile",{"is-selected":J(ie)}]),"aria-checked":J(ie),"aria-label":ie.label,title:ie.label,tabindex:Je(o).indexOf(ie)===$.value?0:-1,"data-position":ie.position,"data-alignment":ie.alignment,onClick:j=>xe(ie),onDblclick:ft,onKeydown:ye},[(pe(),we("svg",XW,[be[4]||(be[4]=lC('<rect class="sd-page-number-menu__sheet" x="0.75" y="0.75" width="34.5" height="44.5" rx="2.5" data-v-30327fd0></rect><rect class="sd-page-number-menu__line" x="7" y="14" width="22" height="2" rx="1" data-v-30327fd0></rect><rect class="sd-page-number-menu__line" x="7" y="19" width="18" height="2" rx="1" data-v-30327fd0></rect><rect class="sd-page-number-menu__line" x="7" y="24" width="22" height="2" rx="1" data-v-30327fd0></rect><rect class="sd-page-number-menu__line" x="7" y="29" width="14" height="2" rx="1" data-v-30327fd0></rect>',5)),ue("rect",{class:"sd-page-number-menu__chip",x:a[ie.alignment],y:l[ie.position],width:"8",height:"5",rx:"1.5"},null,8,ZW)]))],42,YW))),128))],64))),64))],8,KW),ue("label",QW,[_i(ue("input",{"onUpdate:modelValue":be[0]||(be[0]=Q=>g.value=Q),type:"checkbox",disabled:!q.value,"data-sd-page-number-first-page":"",onChange:X},null,40,JW),[[Ru,g.value]]),be[5]||(be[5]=ue("span",null,"Show on first page",-1))]),ue("div",eK,[ue("label",tK,[be[6]||(be[6]=ue("span",null,"Format",-1)),_i(ue("select",{"onUpdate:modelValue":be[1]||(be[1]=Q=>m.value=Q),disabled:!q.value,"data-sd-page-number-format":"",onChange:X},[(pe(!0),we(zt,null,Mn(V.value,Q=>(pe(),we("option",{key:Q.value,value:Q.value},Et(Q.label),9,rK))),128))],40,nK),[[Kp,m.value]])]),ue("div",oK,[ue("label",iK,[_i(ue("input",{"onUpdate:modelValue":be[2]||(be[2]=Q=>v.value=Q),type:"checkbox",disabled:!q.value,"data-sd-page-number-restart":"",onChange:X},null,40,sK),[[Ru,v.value]]),be[7]||(be[7]=ue("span",null,"Start at",-1))]),_i(ue("input",{"onUpdate:modelValue":be[3]||(be[3]=Q=>C.value=Q),type:"number",min:"0",step:"1",inputmode:"numeric","aria-label":"First page number",disabled:!q.value||!v.value,"data-sd-page-number-start":"",onInput:X,onKeydown:Jo(sn(ft,["prevent"]),["enter"])},null,40,aK),[[Ti,C.value,void 0,{number:!0}]])])]),M.value?(pe(),we("p",lK,Et(M.value),1)):H.value?(pe(),we("p",cK,Et(H.value),1)):dt("",!0),ue("div",uK,[L.value?(pe(),we("button",{key:0,type:"button",class:"sd-page-number-menu__remove",disabled:!q.value||x.value,"aria-label":"Remove page numbers","data-sd-page-number-remove":"",onClick:At}," Remove ",8,dK)):dt("",!0),ue("button",{type:"button",class:"sd-page-number-menu__add",disabled:!q.value||x.value,"data-sd-page-number-add":"",onClick:ft},Et(R.value),9,fK)]),be[10]||(be[10]=ue("div",{class:"sd-page-number-menu__divider",role:"separator"},null,-1)),ue("button",{type:"button",class:"sd-page-number-menu__cursor",disabled:!B.value||x.value,"data-sd-page-number-at-cursor":"",onClick:Re},[ue("span",pK,[be[8]||(be[8]=ue("span",null,"Insert at cursor",-1)),ue("small",null,Et(G.value),1)]),ue("kbd",null,Et(ee.value),1)],8,hK)],10,WW))}},gK=vn(mK,[["__scopeId","data-v-30327fd0"]]),z1="sd-page-number-flash",vK=1400,$E=e=>new Promise(t=>{typeof e?.requestAnimationFrame=="function"?e.requestAnimationFrame(()=>t()):setTimeout(t,16)});async function HE(e,t){const n=e?.ownerDocument?.defaultView;if(!e||!n)return;await $E(n),await $E(n);const r=n.innerHeight,o=[...e.querySelectorAll(`[data-sd-headerfooter-kind="${t}"]`)].filter(i=>{const s=i.getBoundingClientRect();return s.height>0&&s.bottom>0&&s.top<r});for(const i of o)i.classList.remove(z1),i.classList.add(z1),n.setTimeout(()=>i.classList.remove(z1),vK)}var yK=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--!Font Awesome Free 6.7.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2025 Fonticons, Inc.--><path d="M438.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L160 338.7 393.4 105.4c12.5-12.5 32.8-12.5 45.3 0z"/></svg>
|
|
107
|
-
`;Nt();var Yi=e=>{e.expand.value=!1},j1=(e,t)=>{const n=e.layoutWidth?.value;return Number.isFinite(n)&&n>0?n:e.type==="separator"?t.get("separator"):t.get(e.name.value)||t.get("default")},bK=e=>{const t=[];for(const n of e){if(n.type==="separator"){const r=t[t.length-1];if(!r||r.type==="separator")continue}t.push(n)}for(;t.length&&t[t.length-1].type==="separator";)t.pop();return t},GE=e=>{const t=new Map;for(const r of e){const o=r.group?.value||"center";t.has(o)||t.set(o,[]),t.get(o).push(r)}const n=new Set;for(const r of t.values())for(const o of bK(r))n.add(o);return e.filter(r=>n.has(r))},wK=e=>{const t=e.find(o=>o.type==="overflow"),n=e.filter(o=>o!==t),r=new Set(GE(n));return e.filter(o=>o===t||r.has(o))};function V1(e,t){const n={...e};return t?n.href=t:delete n.href,n}function WE(e){const t=Array.isArray(e?.segments)?e.segments:[];if(e?.kind!=="text"||!t.length)return null;const n=t[0],r=t[t.length-1];if(!n?.blockId||!r?.blockId||!n.range||!r.range)return null;const o=e.story;return{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.range.start??0,...o?{story:o}:{}},end:{kind:"text",blockId:r.blockId,offset:r.range.end??0,...o?{story:o}:{}},...o?{story:o}:{}}}function CK(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function U1(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function kK(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function SK(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var _K=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,configuredItemOrder:u,excludedItemNames:d,additionalItems:f=[]}={})=>{const p=xn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),g=(r??UG).map(YG),m=xn({type:"dropdown",name:"fontFamily",tooltip:n.fontFamily,command:"setFontFamily",defaultLabel:"Arial",label:"Arial",markName:"textStyle",labelAttr:"fontFamily",hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,isWide:!0,style:{width:"116px"},suppressActiveHighlight:!0,attributes:{ariaLabel:"Font family"},options:g,onActivate:({fontFamily:ot}={},Ct=!1)=>{if(Ct){m.label.value="",m.selectedValue.value="";return}if(!ot)return;ot=ot.split(",")[0];const Rt=Ut=>Ut.value??Ut.label,an=g.find(Ut=>Rt(Ut)===m.defaultLabel.value),Kt=g.find(Ut=>Rt(Ut)===ot);Kt?(m.label.value=Kt.label,m.selectedValue.value=Kt.key):an?(m.label.value=ot,m.selectedValue.value=an.key):(m.label.value=ot,m.selectedValue.value="")},onDeactivate:()=>{const ot=g.find(Ct=>(Ct.value??Ct.label)===m.defaultLabel.value);m.label.value=ot?.label??m.defaultLabel.value,m.selectedValue.value=ot?.key??""}}),v=xn({type:"dropdown",name:"ai",dropdownStyles:{padding:0,outline:"none"},tooltip:n.ai,icon:t.ai,hideLabel:!0,hasCaret:!1,isWide:!0,suppressActiveHighlight:!0,attributes:{ariaLabel:"AI"},options:[{type:"render",key:"ai",render:()=>C(v)}]});function C(ot){const Ct=U1(e),Rt=Ct?.selectionTarget??WE(Ct?.target),an=Ct?.empty?"":CK(Ct),Kt=SK(e),Ut=()=>Yi(ot),mn=()=>{const ze=e.pendingSelectionCapture;ze&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(ze)};return Nr("div",{},[Nr(kW,{handleClose:Ut,selectedText:an,target:Rt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:Kt?.apiKey||e.config?.aiApiKey||"",endpoint:Kt?.endpoint||e.config?.aiEndpoint||"",restoreSelection:mn})])}const w=HG,S=xn({type:"dropdown",name:"fontSize",defaultLabel:"12",label:"12",style:{width:"56px"},markName:"textStyle",labelAttr:"fontSize",tooltip:n.fontSize,hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,suppressActiveHighlight:!0,isWide:!0,command:"setFontSize",attributes:{ariaLabel:"Font size"},options:w,onActivate:({fontSize:ot},Ct=!1)=>{if(Ct){S.label.value="",S.selectedValue.value="";return}const Rt=w.find(mn=>mn.label===String(S.defaultLabel.value));if(!ot){S.label.value=S.defaultLabel.value,Rt?S.selectedValue.value=Rt.key:S.selectedValue.value="";return}let an=NH(ot,12);an<8&&(an=8),an>96&&(an=96);let Kt=String(an);const Ut=w.find(mn=>mn.label===Kt||mn.key===Kt);Ut?S.selectedValue.value=Ut.key:S.selectedValue.value="",S.label.value=Kt},onDeactivate:()=>{S.label.value=S.defaultLabel.value;const ot=w.find(Ct=>Ct.label===String(S.defaultLabel.value));ot?S.selectedValue.value=ot.key:S.selectedValue.value=""}}),y=()=>xn({type:"separator",name:"separator",isNarrow:!0}),k=xn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),x=xn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),M=xn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),z=xn({type:"dropdown",name:"highlight",icon:t.highlight,hideLabel:!0,markName:"highlight",labelAttr:"color",active:!1,tooltip:n.highlight,command:"setHighlight",noArgumentCommand:"unsetHighlight",suppressActiveHighlight:!0,attributes:{ariaLabel:"Highlight"},options:[{key:"color",type:"render",render:()=>B1(e,z,[],!0)}],onActivate:({color:ot})=>{z.iconColor.value=ot||""},onDeactivate:()=>z.iconColor.value=""}),q=xn({type:"dropdown",name:"color",icon:t.color,hideLabel:!0,markName:"textStyle",labelAttr:"color",active:!1,tooltip:n.color,command:"setColor",suppressActiveHighlight:!0,attributes:{ariaLabel:"Color"},options:[{key:"color",type:"render",render:()=>B1(e,q)}],onActivate:({color:ot})=>{q.iconColor.value=ot},onDeactivate:()=>q.iconColor.value="#000"}),B=xn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),L=xn({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>V(L)}],onActivate:({href:ot})=>{L.attributes.value=V1(L.attributes.value,ot)},onDeactivate:()=>{L.attributes.value=V1(L.attributes.value,null),L.expand.value=!1}});function V(ot){const Ct=e.pendingSelectionCapture,Rt=U1(e),an=Rt?.quotedText&&JSON.stringify(Rt.selectionTarget??Rt.target)!==JSON.stringify(Ct?.selectionTarget??Ct?.target)?Rt:Ct??Rt,Kt=an?.selectionTarget??WE(an?.target)??an?.target,Ut=()=>{an===Ct&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(Ct)};return Nr("div",{},[Nr(u4,{ui:e.ui,linkItem:ot,textTarget:Kt,selectedText:an?.quotedText??null,restoreSelection:Ut,closePopover:()=>{Yi(ot),Gl(e)},goToAnchor:()=>{Yi(ot);const mn=ot.attributes.value?.href;if(!mn)return;const ze=mn.slice(1),He=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${ze}']`);He&&d4(He)}})])}const T=xn({type:"options",name:"linkInput",command:"toggleLink",active:!1});L.childItem=T,T.parentItem=L;const $=xn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),R=xn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),H=xn({type:"button",name:"watermark",icon:t.watermark,tooltip:n.watermark,allowWithoutEditor:!0,disabled:!0,attributes:{ariaLabel:n.watermark}}),G=xn({type:"dropdown",name:"pageNumber",icon:t.pageNumber,hideLabel:!0,tooltip:n.pageNumber,disabled:!0,suppressActiveHighlight:!0,attributes:{ariaLabel:n.pageNumber},options:[{key:"pageNumber",type:"render",label:"Page number options",render:()=>J(G)}]});let ee=null;function J(ot){const Ct=e.ui,Rt=mn=>Ct?.commands?.get?.(mn)?.getState?.()??null,an=()=>{Yi(ot),Re.expand.value&&Yi(Re),Gl(e)},Kt=U1(e),Ut=Kt?.selectionTarget?.story??Kt?.selectionTarget?.start?.story??Kt?.target?.story??null;return Nr(gK,{pageNumbersState:Rt("page-numbers-apply"),atCursorState:Rt("page-number-insert"),inHeaderFooter:Ut?.storyType==="headerFooterPart"||Ut?.storyType==="headerFooterSlot",suggesting:Ct?.document?.getSnapshot?.()?.mode==="suggesting",initialChoice:ee,loadCurrent:()=>Ct?V9(Ct):Promise.resolve(null),applyPageNumbers:mn=>Pc(Ct,"page-numbers-apply",mn),removePageNumbers:()=>Pc(Ct,"page-numbers-remove"),insertAtCursor:()=>Pc(Ct,"page-number-insert"),close:mn=>{an();const ze=Ct?.viewport?.getHost?.();if(mn?.action==="apply")ee=mn.choice,HE(ze,mn.choice.position==="top"?"header":"footer");else if(mn?.action==="remove")for(const He of new Set(mn.kinds))HE(ze,He)}})}const X=xn({type:"dropdown",name:"table",icon:t.table,hideLabel:!0,labelAttr:"table",active:!1,tooltip:n.table,command:"insertTable",suppressActiveHighlight:!0,attributes:{ariaLabel:"Table"},options:[{key:"table",type:"render",render:()=>xe(X)}]});function xe(ot){return Nr("div",{},[Nr(BW,{onSelect:Rt=>{e.emitCommand({item:ot,argument:Rt}),Yi(ot),Gl(e)}})])}const fe=xn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>ve(fe)}]}),ye=[{label:n.addRowBefore,command:"addRowBefore",icon:t.addRowBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row before"}},{label:n.addRowAfter,command:"addRowAfter",icon:t.addRowAfter,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row after"}},{label:n.addColumnBefore,command:"addColumnBefore",icon:t.addColumnBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column before"}},{label:n.addColumnAfter,command:"addColumnAfter",icon:t.addColumnAfter,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column after"}},{label:n.deleteRow,command:"deleteRow",icon:t.deleteRow,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete row"}},{label:n.deleteColumn,command:"deleteColumn",icon:t.deleteColumn,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete column"}},{label:n.deleteTable,command:"deleteTable",icon:t.deleteTable,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete table"}},{label:n.removeBorders,command:"deleteCellAndTableBorders",icon:t.deleteBorders,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete cell and table borders"}},{label:n.mergeCells,command:"mergeCells",icon:t.mergeCells,props:{"data-item":"btn-tableActions-option",ariaLabel:"Merge cells"}},{label:n.splitCell,command:"splitCell",icon:t.splitCell,props:{"data-item":"btn-tableActions-option",ariaLabel:"Split cells"}},{label:n.fixTables,command:"fixTables",icon:t.fixTables,props:{"data-item":"btn-tableActions-option",ariaLabel:"Fix tables"}}];function ve(ot){return Nr(GW,{options:ye,onSelect:Ct=>{Yi(ot);const{command:Rt}=Ct;e.emitCommand({item:ot,argument:{command:Rt}}),Gl(e)}})}const Le=xn({type:"dropdown",name:"textAlign",tooltip:n.textAlign,icon:t.alignLeft,command:"setTextAlign",hasCaret:!0,markName:"textAlign",labelAttr:"textAlign",suppressActiveHighlight:!0,attributes:{ariaLabel:"Text align"},options:[{type:"render",render:()=>Nr("div",{},[Nr(QG,{onSelect:Ct=>{Yi(Le);const Rt={...Le,command:"setTextAlign"};Rt.command="setTextAlign",e.emitCommand({item:Rt,argument:Ct}),je(Le,Ct),Gl(e)}})]),key:"alignment"}],onActivate:({textAlign:ot})=>{je(Le,ot)},onDeactivate:()=>{je(Le,"left")}}),je=(ot,Ct)=>{let Rt=Ct==="both"?"justify":Ct,an={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},Kt=an[Rt]??an.left;ot.icon.value=Kt},nt=xn({type:"dropdown",name:"list",command:"toggleBulletListStyle",splitButton:!0,splitButtonCommand:"toggleBulletList",icon:t.bulletList,hasCaret:!0,tooltip:n.bulletList,restoreEditorFocus:!0,attributes:{ariaLabel:"Bullet list"},options:[{type:"render",key:"bullet-style-buttons",render:()=>{const ot=Ct=>{Yi(nt);const Rt={...nt,command:"toggleBulletListStyle"};e.emitCommand({item:Rt,argument:Ct})};return Nr(VE,{buttons:tW,iconSize:25,selectedStyle:nt.selectedValue.value,onSelect:ot})}}]}),ut=xn({type:"dropdown",name:"numberedlist",command:"toggleOrderedListStyle",splitButton:!0,splitButtonCommand:"toggleOrderedList",icon:t.numberedList,hasCaret:!0,tooltip:n.numberedList,restoreEditorFocus:!0,attributes:{ariaLabel:"Numbered list"},options:[{type:"render",key:"numbered-style-buttons",render:()=>{const ot=Ct=>{Yi(ut);const Rt={...ut,command:"toggleOrderedListStyle"};e.emitCommand({item:Rt,argument:Ct})};return Nr(VE,{buttons:nW,iconSize:30,selectedStyle:ut.selectedValue.value,onSelect:ot})}}]}),ft=xn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),At=xn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Re=xn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),se=xn({type:"dropdown",name:"zoom",allowWithoutEditor:!0,tooltip:n.zoom,defaultLabel:"100%",label:"100%",hasCaret:!0,command:"setZoom",isWide:!0,style:{width:"71px",minWidth:"71px"},inlineTextInputVisible:!1,hasInlineTextInput:!0,attributes:{ariaLabel:"Zoom"},options:[{label:"50%",key:.5,props:{"data-item":"btn-zoom-option"}},{label:"75%",key:.75,props:{"data-item":"btn-zoom-option"}},{label:"90%",key:.9,props:{"data-item":"btn-zoom-option"}},{label:"100%",key:1,props:{"data-item":"btn-zoom-option"}},{label:"125%",key:1.25,props:{"data-item":"btn-zoom-option"}},{label:"150%",key:1.5,props:{"data-item":"btn-zoom-option"}},{label:"200%",key:2,props:{"data-item":"btn-zoom-option"}}],onActivate:({zoom:ot})=>{ot&&(se.label.value=ot)}}),be=xn({type:"dropdown",name:"measurementUnit",allowWithoutEditor:!0,tooltip:n.measurementUnit,defaultLabel:"in",label:"in",hasCaret:!0,command:"setMeasurementUnit",group:"right",style:{width:"52px",minWidth:"52px"},inlineTextInputVisible:!1,hasInlineTextInput:!1,attributes:{ariaLabel:"Measurement unit"},options:[{label:"Inches",key:"in",props:{"data-item":"btn-measurement-unit-option"}},{label:"Centimeters",key:"cm",props:{"data-item":"btn-measurement-unit-option"}}],onActivate:({measurementUnit:ot})=>{ot&&(be.label.value=ot)}}),Q=xn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),I=xn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),ie=xn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),j=xn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Z=xn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),K=xn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),ae=(ot,Ct)=>ot==="editor"?Ct:ot==="suggester"?Ct.filter(Rt=>Rt.value==="suggesting"):Ct.filter(Rt=>Rt.value==="viewing"),Ce=ot=>ot==="editor"?"Editing":ot==="suggester"?"Suggesting":"Viewing",D=xn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:Ce(s),label:Ce(s),hasCaret:s==="editor",isWide:!0,style:{display:"flex",justifyContent:"flex-end"},inlineTextInputVisible:!1,hasInlineTextInput:!1,group:"right",disabled:s!=="editor",attributes:{dropdownPosition:"right",className:"sd-toolbar-item--doc-mode",ariaLabel:"Document mode"},options:[{type:"render",render:()=>me(D)}]}),N=[{label:n.documentEditingMode,value:"editing",icon:t.documentEditingMode,description:n.documentEditingModeDescription},{label:n.documentSuggestingMode,value:"suggesting",icon:t.documentSuggestingMode,description:n.documentSuggestingModeDescription},{label:n.documentViewingMode,value:"viewing",icon:t.documentViewingMode,description:n.documentViewingModeDescription}];function me(ot){return Nr(uW,{options:ae(s,N),onSelect:Ct=>{const Rt=e.superdoc?.activeEditor??e.activeEditor;Yi(ot);const{label:an,icon:Kt,value:Ut}=Ct;D.label.value=an,D.icon.value=Kt,e.emitCommand({item:D,argument:Ut}),Gl(e,Rt)}})}const Se=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),Te=["search","ruler","undo","overflow","documentMode"],Ne=xn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),Ge=xn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),rt=xn({type:"dropdown",name:"linkedStyles",command:"setLinkedStyle",tooltip:n.linkedStyles,icon:t.paintbrush,defaultLabel:n.formatText,label:n.formatText,hasCaret:!0,isWide:!0,style:{width:"140px"},suppressActiveHighlight:!0,disabled:!1,attributes:{className:"sd-toolbar-item--linked-styles",ariaLabel:"Linked styles"},options:[{type:"render",key:"linkedStyle",render:()=>{const ot=Rt=>{Yi(rt);const an=typeof Rt=="string"?Rt:Rt?.id??null;if(!an)return;const Kt={...rt,command:"setLinkedStyle"};e.emitCommand({item:Kt,argument:an})},Ct=e.getActiveLinkedStyleId?.()??null;return Nr("div",{},[Nr(pW,{styles:e.getLinkedStyleOptions?.()??[],onSelect:ot,selectedOption:Ct})])}}],onActivate:({styleId:ot,styleName:Ct})=>{const Rt=Ct||ot;rt.label.value=ot&&ot!=="Normal"?String(Rt):n.formatText,rt.disabled.value=!1},onDeactivate:()=>{rt.disabled.value=!0,rt.label.value=n.formatText}}),vt=(ot,Ct)=>{if(Ct.value==ot)return Nr("div",{innerHTML:yK,class:"dropdown-select-icon"})},Ot=xn({type:"dropdown",name:"lineHeight",tooltip:n.lineHeight,icon:t.lineHeight,hasCaret:!1,hasInlineTextInput:!1,hideLabel:!0,inlineTextInputVisible:!1,suppressActiveHighlight:!0,restoreEditorFocus:!0,isWide:!1,command:"setLineHeight",dropdownValueKey:"key",selectedValue:"1",attributes:{ariaLabel:"Line height"},options:[1,1.15,1.5,2,2.5,3].map(ot=>({label:ot.toFixed(2),key:ot,icon:()=>vt(ot,Ot.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),Mt=20,Yt=32,Ue=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],nn=["zoom","fontFamily","fontSize","redo"],Un=i<=Th.lg,Xt=e.config?.showFormattingMarksButton===!0,Bn=e.config?.showTableOfContentsButton===!0;Un&&(D.attributes.value={...D.attributes.value,className:`${D.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),Un&&(rt.attributes.value={...rt.attributes.value,className:`${rt.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let Ln=[Q,I,ie,j,B,se,m,y(),S,y(),p,k,x,M,q,z,y(),L,$,...Bn?[R]:[],...e.config?.showWatermarkButton||l?.has("watermark")?[H]:[],...e.config?.showPageNumberButton||l?.has("pageNumber")?[G]:[],X,fe,y(),Le,nt,ut,ft,At,Ot,y(),rt,y(),Ne,be,...Xt?[Ge]:[],K,Z,...kK(e)?[v]:[],Re,D,...f];if(i<=Th.md&&o&&(Ln=Ln.filter(ot=>ot.type!=="separator")),e.config.mode!=="docx"){const ot=Ln.findIndex(Rt=>Rt.name.value==="linkedStyles");Ln.splice(ot-1,2);const Ct=["ruler","zoom","undo","redo"];Ln=Ln.filter(Rt=>!Ct.includes(Rt.name.value))}const jr=[];a||(s==="viewer"&&jr.push(ie,j),Ln=Ln.filter(ot=>!jr.includes(ot))),l&&(Ln=Ln.filter(ot=>ot.name.value==="overflow"||ot.isCustomToolbarItem||l.has(ot.name.value))),d?.size&&(Ln=Ln.filter(ot=>!d.has(ot.name.value))),Ln=wK(Ln);const qr=ot=>Te.includes(ot.name.value),wr=Ln.find(ot=>ot.name.value==="overflow"),Tn=Ln.filter(ot=>ot!==wr);if(u){const ot=new Map(u.map((Rt,an)=>[Rt,an])),Ct=Rt=>ot.get(Rt.name.value)??Number.MAX_SAFE_INTEGER;Tn.sort((Rt,an)=>Ct(Rt)-Ct(an))}const er=ot=>{const Ct=[],Rt=[],an=Tn.filter(qr).reduce((Ut,mn)=>Ut+j1(mn,Se),0);let Kt=Yt+an+(ot&&wr?j1(wr,Se):0);return Tn.forEach((Ut,mn)=>{const ze=j1(Ut,Se);if(Ut.type==="separator"&&Tn[mn-1]?.name.value==="linkedStyles"&&Ct.includes(Tn[mn-1])){Ct.push(Ut);return}if(i<Th.xl+Mt&&Ue.includes(Ut.name.value)&&o){Ct.push(Ut);return}if(i<Th.sm&&nn.includes(Ut.name.value)&&o){Ct.push(Ut);return}if(qr(Ut)){Rt.push(Ut);return}Kt+ze<=i||!o?(Rt.push(Ut),Kt+=ze):Ct.push(Ut)}),{visibleItems:Rt,overflowItems:Ct}};let{visibleItems:Rr,overflowItems:Wn}=er(!1);if(o&&wr&&Wn.some(ot=>ot.type!=="separator")){({visibleItems:Rr,overflowItems:Wn}=er(!0));const ot=Ln.indexOf(wr),Ct=Rr.findIndex(Rt=>Ln.indexOf(Rt)>ot);Ct===-1?Rr.push(wr):Rr.splice(Ct,0,wr)}return Rr=GE(Rr),{defaultItems:Rr,overflowItems:Wn.filter(ot=>ot.type!=="separator")}},KE={bold:"Bold",fontFamily:"Font family",ai:"AI text generation",fontSize:"Font size",italic:"Italic",underline:"Underline",highlight:"Highlight color",strikethrough:"Strikethrough",color:"Text color",search:"Search",link:"Link",image:"Image",tableOfContents:"Table of contents",watermark:"Watermark",pageNumber:"Page number",table:"Insert table",tableActions:"Table options",addRowBefore:"Insert row above",addRowAfter:"Insert row below",addColumnBefore:"Insert column left",addColumnAfter:"Insert column right",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",removeBorders:"Remove borders",mergeCells:"Merge cells",splitCell:"Split cell",fixTables:"Fix tables",textAlign:"Alignment",bulletList:"Bullet list",numberedList:"Numbered list",indentLeft:"Left indent",indentRight:"Right indent",directionLtr:"Left-to-right",directionRtl:"Right-to-left",zoom:"Zoom",measurementUnit:"Measurement unit",undo:"Undo",redo:"Redo",trackChanges:"Track Changes",trackChangesAccept:"Accept changes under selection",trackChangesReject:"Reject changes under selection",trackChangesOriginal:"Toggle Show Original",trackChangesFinal:"Toggle Show Final",clearFormatting:"Clear formatting",copyFormat:"Format painter",lineHeight:"Line height",formatText:"Format text",ruler:"Show or hide ruler",formattingMarks:"Show or hide formatting marks",pageBreak:"Insert page break",documentEditingMode:"Editing",documentSuggestingMode:"Suggesting",documentViewingMode:"Viewing",documentEditingModeDescription:"Edit document directly",documentSuggestingModeDescription:"Edits become suggestions",documentViewingModeDescription:"View clean version of document only",linkedStyles:"Linked styles"},AK=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Nt();function qE(e){return FH(e)??N1[e]??null}function Eg(e,t,n,r={}){if(!e?.commands||!t||typeof e.commands.has=="function"&&!e.commands.has(t))return!1;const o=typeof e.commands.executeAsync=="function"?e.commands.executeAsync:e.commands.execute;if(typeof o!="function")return!1;const i=r.firstParty?Pc(e,t,n):n===void 0?o.call(e.commands,t):o.call(e.commands,t,n),s=a=>{!r.reportUnhandled||a!==!1||r.onError?.(new Error(`[superdoc toolbar] Command "${t}" did not run. Check that it is enabled and has the required input.`))};return i&&typeof i.then=="function"?Promise.resolve(i).then(a=>{s(a),r.onSettled?.()},a=>{r.onError?.(a),r.onSettled?.()}):(s(i),r.onSettled?.()),!0}var IK=["page-numbers-apply","page-number-insert"],EK=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),TK=new Set(["list","numberedlist"]);function xK(e,t){if(e==="fontFamily"||e==="fontSize"||TK.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!EK.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function YE(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function RK(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var MK=new Set([...OH,...Object.keys(yg),"ai","overflow","tableOfContents"]),LK=class extends av.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...pr},texts:{...KE},fonts:null,hideButtons:!0,responsiveToContainer:!1,mode:"docx",excludeItems:[],toolbarButtonsExclude:[],groups:null,customButtons:[],showFormattingMarksButton:!1,showTableOfContentsButton:!1,showWatermarkButton:!1,showPageNumberButton:!1};toolbarItems=[];overflowItems=[];#e=null;#n=null;isDev=!1;role="editor";superdoc;toolbarContainer=null;toolbar=null;_detachFontsChanged=null;_linkedStyleOptions=Fr([]);constructor(e={}){if(super(),this.config={...this.config,...e},this.toolbarItems=[],this.overflowItems=[],this.isDev=e.isDev||!1,this.superdoc=e.superdoc,this.role=e.role||"editor",this.toolbarContainer=null,this.config.icons={...pr,...e.icons},this.config.texts={...KE,...e.texts},this.config.hideButtons=e.hideButtons??!0,this.config.responsiveToContainer=e.responsiveToContainer??!1,this.activeEditor=e.editor??this.superdoc?.activeEditor??null,this.ui=null,this.snapshot=null,this._unsubscribeController=null,this._detachFormatPainterModeChange=null,this._customCommandRegs=new Map,this._reportedInvalidCustomItems=new Set,this._lastFontOptionsSignature="",!this.config.selector&&this.config.element&&(this.config.selector=this.config.element),this.toolbarContainer=AK(this.config.selector),this.toolbarContainer){const t=(this.config?.uiDisplayFallbackFont||"").toString().trim()||"Arial, Helvetica, sans-serif";this.toolbarContainer.style.setProperty("--sd-ui-font-family",t)}try{if(this.#t(),this.#u(),this.#c(),this.#i(),this._lastFontOptionsSignature=this.#r(),!this.toolbarContainer){this.updateToolbarState();return}this.app=Ic(qG),this.app.directive("click-outside",cb),this.app.config.globalProperties.$toolbar=this,this.toolbar=this.app.mount(this.toolbarContainer),this.updateToolbarState()}catch(t){try{this.destroy()}catch{}throw t}}#t(){this.ui=this.superdoc?.ui??null,this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot(),this._unsubscribeController=this.ui.toolbar.subscribe(()=>{this.snapshot=this.ui.toolbar.getSnapshot(),this.getToolbarItemByName("linkedStyles")?.expand.value&&this.#m(),this.updateToolbarState()}),this._detachFormatPainterModeChange=this.ui.formatPainter.onModeChange(e=>{e==="armed"||e==="persistent"?this.#w():this.#y()}))}#o(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#y();for(const e of this._customCommandRegs.values())try{e.unregister?.()}catch{}this._customCommandRegs.clear(),this.ui=null,this.snapshot=null}#i(){if(!this.superdoc||typeof this.superdoc.on!="function"||typeof this.superdoc.off!="function")return;const e=()=>{const t=this.#r();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#p()),this.updateToolbarState()};this.superdoc.on("fonts-changed",e),this._detachFontsChanged=()=>{this.superdoc?.off?.("fonts-changed",e)}}#a(){this._detachFontsChanged?.(),this._detachFontsChanged=null}#u(){if(Array.isArray(this.config.groups)){this.config.toolbarGroups=this.config.groups,this.config.groups=null;return}this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length&&(this.config.toolbarGroups=Object.keys(this.config.groups))}getAvailableWidth(){const e=document.documentElement.clientWidth,t=this.toolbarContainer?.offsetWidth??0;return this.config.responsiveToContainer?t:e}#h(e){return e||$G(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#c(){const e=this.getAvailableWidth(),t=new Map(this.#s().filter(C=>C.isCustomToolbarItem&&C.type==="dropdown").map(C=>[C.name.value,C.selectedValue.value])),n=this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length>0,r=n?new Set(Object.values(this.config.groups).flatMap(C=>C)):null,o=new Set([...this.config.excludeItems??[],...this.config.toolbarButtonsExclude??[]]),i=this.config.customButtons||[],s=new Set(MK),a=i.map((C,w)=>{try{if(C?.name&&s.has(C.name))throw new Error(`Toolbar item name "${C.name}" is already taken by another item, so this entry is skipped.`);const S=this.#d(C);return t.has(S.name.value)&&(S.selectedValue.value=t.get(S.name.value)),s.add(S.name?.value),S}catch(S){const y=`${C?.name??`<unnamed@${w}>`}::${S?.message??String(S)}`;return this._reportedInvalidCustomItems.has(y)||(this._reportedInvalidCustomItems.add(y),this.#v(S,C?.name??null)),null}}).filter(Boolean),l=n?new Set(Object.keys(this.config.groups)):null,u=l?a.filter(C=>l.has(C.group?.value||"center")):a;let d=null;if(n){const C=Object.values(this.config.groups).flatMap(S=>S),w=a.filter(S=>l.has(S.group?.value||"center")).map(S=>S.name.value);d=[...new Set([...C,...w])]}const{defaultItems:f,overflowItems:p}=_K({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#h(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev,configuredItemNames:r,configuredItemOrder:d,excludedItemNames:o,additionalItems:u});n||(d=[...f.map(C=>C.name.value),...p.map(C=>C.name.value)]);const g=p.filter(C=>d.includes(C.name.value)&&!o.has(C.name.value)),m=g.length?[...d,"overflow"]:d,v=f.filter(C=>m.includes(C.name.value)).filter(C=>!o.has(C.name.value));if(n){const C=new Map(d.map((x,M)=>[x,M])),w=x=>C.get(x.name.value)??Number.MAX_SAFE_INTEGER,S=v.find(x=>x.name.value==="overflow"),y=new Map(v.map((x,M)=>[x,M])),k=v.filter(x=>x!==S);if(k.sort((x,M)=>w(x)-w(M)),S){const x=y.get(S),M=k.findIndex(z=>y.get(z)>x);M===-1?k.push(S):k.splice(M,0,S)}v.splice(0,v.length,...k),g.sort((x,M)=>w(x)-w(M))}if(n)for(const[C,w]of Object.entries(this.config.groups))for(const S of v)w.includes(S.name.value)&&(S.group.value=C);this.toolbarItems=v,this.overflowItems=g}#d(e){const t=xn({...e});t.isCustomToolbarItem=!0;const n=e.command;if(typeof n=="function"&&this.ui?.commands?.register){const r=`__builtin_toolbar__${e.name}`;if(!this._customCommandRegs.has(r)){const o=this.ui.commands.register({id:r,execute:i=>{const s=i?.payload&&typeof i.payload=="object"?i.payload:{};try{const a=n({...i,item:t,argument:s.argument,option:s.option});return a&&typeof a.then=="function"?Promise.resolve(a).catch(l=>(this.#v(l,e.name),!1)):a}catch(a){return this.#v(a,e.name),!1}}});this._customCommandRegs.set(r,o)}}return t}#p(){this.#c(),this.emit("toolbar-items-changed")}#r(){if(this.config.fonts)return"custom-fonts";const e=this.superdoc?.fonts?.getFontFamilyOptions?.()??[];return JSON.stringify(e.map(t=>[t.label,t.value,t.previewFamily]))}getToolbarItemByGroup(e){return this.toolbarItems.filter(t=>(t.group?.value||"center")===e)}getToolbarItemByName(e){return this.#s().find(t=>t.name.value===e)}#s(){return[...this.toolbarItems,...this.overflowItems]}getLinkedStyleOptions(){return this.#m(),this._linkedStyleOptions.value}#m(){this.ui?.styles?.getCatalog?.({includePreview:!0});const e=this.ui?.styles?.getCatalog?.({view:"quickGallery",includePreview:!0})?.items??this.ui?.styles?.getQuickGallery?.()??[];e!==this._linkedStyleOptions.value&&(this._linkedStyleOptions.value=e)}getActiveLinkedStyleId(){return this.ui?.styles?.getActiveParagraphStyle?.()?.styleId??null}setActiveEditor(e){this.activeEditor=e;const t=this.#r();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#p()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}onToolbarResize=()=>{this.#c(),this.updateToolbarState()};#_(e){return e==="ruler"?!!this.superdoc?.config?.rulers:e==="formattingMarks"?!!this.superdoc?.config?.layoutEngineOptions?.showFormattingMarks:!1}#k(e){return e==="watermark"?this.ui?.document?.getSnapshot?.().ready===!0&&typeof this.ui?.watermark?.open=="function":e==="ruler"?typeof this.superdoc?.toggleRuler=="function":e==="formattingMarks"?typeof this.superdoc?.toggleFormattingMarks=="function"||typeof this.superdoc?.setShowFormattingMarks=="function":!1}#g(){const e=this.getToolbarItemByName("documentMode");if(!e)return;const t=(this.snapshot?.commands?.["document-mode"]?.value||"editing").toLowerCase(),n=this.config.texts||{},r=this.config.icons||{},o={editing:{label:n.documentEditingMode||"Editing",icon:r.documentEditingMode||r.documentMode},suggesting:{label:n.documentSuggestingMode||"Suggesting",icon:r.documentSuggestingMode||r.documentMode},viewing:{label:n.documentViewingMode||"Viewing",icon:r.documentViewingMode||r.documentMode}},i=o[t]||o.editing;e.label?.value!==void 0&&(e.label.value=i.label),e.defaultLabel?.value!==void 0&&(e.defaultLabel.value=i.label),e.icon?.value!==void 0&&i.icon&&(e.icon.value=i.icon)}#b(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>B1(this,e,[],!0)};e.nestedOptions.value=[t]}#A(e){return!!e?.active&&e?.value==null}#T(e){return!!e&&e.disabled===!1&&e.value==null}#I(e){const t=e.name.value;if(e.isCustomToolbarItem&&typeof e.command=="string"){const i=this.snapshot?.commands?.[e.command];return e.setDisabled(e.initiallyDisabled||!i||!!i.disabled),i?.active?e.activate():e.deactivate(),!0}if(t==="tableActions"){const i=jE.map(s=>this.snapshot?.commands?.[s]).some(s=>s&&!s.disabled);return e.setDisabled(!i),!0}if(t==="search")return e.setDisabled(this.superdoc?.uiConfig?.search?.enabled!==!0),!0;if(t==="pageNumber"){const i=IK.map(a=>this.snapshot?.commands?.[a]),s=this.ui?.document?.getSnapshot?.()?.mode==="suggesting";return e.setDisabled(!s&&!i.some(a=>a&&!a.disabled)),!0}if(O1(t)?.disposition==="host-routed")return e.setDisabled(!this.#k(t)),this.#_(t)?e.activate():e.deactivate(),!0;const n=qE(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];xK(t,r)?e.setDisabled(!1):e.setDisabled(!!r?.disabled);const o={textAlign:()=>{r?.value?e.activate({textAlign:r.value}):e.deactivate()},lineHeight:()=>{e.selectedValue.value=r?.value!=null?r.value:""},zoom:()=>{if(r?.value!=null){const i=typeof r.value=="number"?`${r.value}%`:String(r.value);e.onActivate({zoom:i})}},measurementUnit:()=>{r?.value!=null&&e.onActivate({measurementUnit:String(r.value)})},documentMode:()=>{this.#g()},link:()=>{e.active.value=!!r?.active,e.attributes.value=V1(e.attributes.value,r?.value??null)},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#T(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#A(r)){e.activate({},!0);return}e.deactivate()},color:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},highlight:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},linkedStyles:()=>{const i=r?.value,s=typeof i=="string"?i:i?.styleId,a=i&&typeof i=="object"?i.styleName:null;s?e.activate({styleId:s,styleName:a}):e.label.value=this.config.texts?.formatText||"Format text"},list:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},numberedlist:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},default:()=>{r?.active?e.activate():e.deactivate()}};return(o[t]??o.default)(),!0}updateToolbarState(){this.#g(),this.#b();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#F(),this.#s().forEach(n=>{const r=n.isCustomToolbarItem&&typeof n.command=="string";(n.allowWithoutEditor?.value||r)&&this.#I(n)})):this.#s().forEach(n=>{n.resetDisabled(),this.#I(n)}),this.getToolbarItemByName("overflow")?.setDisabled(!this.overflowItems.some(n=>n.type!=="separator"&&!n.disabled.value));const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#F(){this.#s().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#x(e,t){const n=this.superdoc;if(e==="watermark"){if(!this.#k(e))return!1;const r=this.ui.watermark.open();if(!r.ok)throw new Error(`[superdoc toolbar] Watermark dialog unavailable: ${r.reason}`);return!0}if(e==="ruler")return typeof n?.toggleRuler=="function"?(n.toggleRuler(),!0):!1;if(e==="formattingMarks"){if(typeof t=="boolean"&&typeof n?.setShowFormattingMarks=="function")return n.setShowFormattingMarks(t),!0;if(typeof n?.toggleFormattingMarks=="function")return n.toggleFormattingMarks(),!0}return!1}#P(e,t){const n=e?.name?.value;if(!n)return!1;const r={firstParty:!0,onSettled:()=>this.updateToolbarState(),onError:i=>this.#v(i,n)};if(n==="image"&&t==null)return this.#D();if(n==="tableActions"){const i=zE[t?.command];return i?Eg(this.ui,i,void 0,r):!1}if(O1(n)?.disposition==="unsupported")return!0;const o=qE(n);return o?Eg(this.ui,o,t,r):!1}#D(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=TD({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await ID(e,this.superdoc?.config?.handleImageUpload);Eg(this.ui,"image",{src:t},{firstParty:!0,onSettled:()=>this.updateToolbarState(),onError:n=>this.#v(n,"image")})},onError:e=>this.#v(e,"image")})),this.#e.open()),!0}#w(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{YE(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!YE(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}RK(i)&&this.ui.formatPainter.setKeyboardSelecting(!0)},o=()=>{this.ui.formatPainter.setKeyboardSelecting(!1),this.ui.formatPainter.notifyKeyUp()};e.addEventListener("pointerdown",t),e.addEventListener("pointerup",n),e.addEventListener("keydown",r),e.addEventListener("keyup",o),this.#n=()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("pointerup",n),e.removeEventListener("keydown",r),e.removeEventListener("keyup",o)}}#y(){this.#n&&(this.#n(),this.#n=null)}#v(e,t){const n={error:e instanceof Error?e:new Error(String(e)),originalError:e,itemName:t??null,editor:this.superdoc?.activeEditor??this.activeEditor??null},r={...n};this.emit("exception",n),this.superdoc?.emit?.("exception",r)}emitCommand({item:e,argument:t,option:n}){const r=e?.name?.value,{command:o}=e,i=t!=null;if(!(e?.type==="dropdown"&&!i&&(o==="setFontFamily"||o==="setFontSize"))){if(r==="search"){this.superdoc?.emit?.("search:open");return}try{if(O1(r)?.disposition==="host-routed"){this.#x(r,t),this.updateToolbarState();return}if(typeof o=="function"){const s=`__builtin_toolbar__${r}`;if(this._customCommandRegs.has(s)&&this.ui?.commands?.execute)this.ui.commands.execute(s,{argument:t,option:n});else{const a=o({item:e,argument:t,option:n,ui:this.ui,superdoc:this.superdoc});a&&typeof a.then=="function"&&Promise.resolve(a).catch(l=>this.#v(l,r))}this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!Eg(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#v(s,r),reportUnhandled:!0}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#P(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#v(s,r)}}}destroy(){this.#y(),this.#e?.destroy(),this.#e=null,this.#a(),this.#o(),this.app?.unmount(),this.app=null,this.toolbar=null}};function PK(e){return new LK(e)}Nt();var DK=['[data-sdt-type="structuredContent"][data-sdt-id]','[data-sdt-type="structuredContent"][data-sdt-container-id]','[data-sdt-container-type="structuredContent"][data-sdt-container-id]'].join(", "),OK=800,XE=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,ZE=e=>{if(!XE)return!1;try{return XE.call(e),!0}catch{return!1}};function FK(e){return e.key==="Alt"||e.key==="Control"||e.key==="Meta"||e.key==="Shift"||(e.ctrlKey||e.metaKey)&&e.shiftKey&&!e.altKey&&(e.code==="Digit8"||e.key==="8"||e.key==="*")?!0:(e.ctrlKey||e.metaKey)&&["b","c","f","i","s","u"].includes(e.key.toLowerCase())}var NK=Object.freeze(["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F","#BB8FCE","#85C1E2","#F1948A","#82E0AA","#F8C471","#AED6F1","#D7BDE2","#A3E4D7","#F0B27A","#AEB6BF","#E74C3C","#2ECC71","#3498DB","#E67E22","#1ABC9C","#9B59B6","#34495E","#F39C12"]),BK=["original","markup","final"],zK=["review","original","final","off"];function QE(e){return BK.includes(e)}function jK(e){return e==="markup"?"review":e}function JE(e){return zK.includes(e)}function VK(e){const t=e.modules?.trackChanges?.mode;if(JE(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return JE(n)?n:null}function Tg(e,t){const n=e.viewing,r=QE(n?.trackedChanges)?n.trackedChanges:null,o=r?jK(r):t||(e.trackChanges?.visible===!0?"review":"original");return{comments:typeof n?.comments=="boolean"?n.comments:e.comments?.visible===!0,renderMode:o,trackChangesVisible:r?r==="markup":e.trackChanges?.visible===!0}}async function UK(e,t){const n=new f6.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function $1(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function eT(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function $K(e,t){if(!e)return()=>{};if($1(e))return t(),()=>{};const n=typeof e.on=="function"?e.on.bind(e):null,r=typeof e.off=="function"?e.off.bind(e):null;if(!n)return t(),()=>{};let o=!1;const i=()=>{o||(o=!0,r?.("synced",a),r?.("sync",l))},s=()=>{o||(i(),t())},a=()=>{eT(e),s()},l=u=>{u!==!1&&(u===!0||$1(e))&&(eT(e),s())};return n("synced",a),n("sync",l),$1(e)&&s(),i}function HK(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(DK));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(Qp.BLOCK_SDT_LABEL)),i=r.getAttribute("data-sdt-container-id")?.trim()||null,s=r.getAttribute("data-sdt-id")?.trim()||null;return o?i??s:s??i}function GK(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function tT(e){if(!e||typeof e.id!="string"||e.kind!=="inline"&&e.kind!=="block"||typeof e.controlType!="string")return null;const t=e.properties?.tag,n=e.properties?.alias;return{id:e.id,controlType:e.controlType,scope:e.kind,...typeof t=="string"&&t?{tag:t}:{},...typeof n=="string"&&n?{alias:n}:{}}}function nT(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function WK(e,t){switch(e.state){case"failed":return"failed";case"degraded":return e.detail==="reconnecting"?"reconnecting":"lost";case"synced":return t?"recovered":"initial";default:return t?"reconnecting":"initial"}}function ni(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function rT(e){return typeof e=="string"&&e.length>0?e:null}function oT(e){return e?ni(e)?rT(e.documentId??e.options?.documentId??null):rT(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function KK(e){if(!e||ni(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function _s(e){if(!e)return null;if(ni(e))return e.fonts??null;const t=KK(e);return t?{getReport:()=>t.getFontReport?.()??[],getMissingFonts:()=>t.getMissingFonts?.()??[],getDocumentFonts:()=>[...new Set((t.getFontReport?.()??[]).map(n=>n.logicalFamily))],getDocumentFontOptions:()=>t.getDocumentFontOptions?.()??[],getFontFamilyOptions:()=>t.getFontFamilyOptions?.()??[],getLastFontsChangedPayload:()=>t.getLastFontsChangedPayload?.()??null,map:n=>t.mapFonts(n),unmap:n=>t.unmapFonts(n),add:n=>t.addFonts(Array.isArray(n)?n:[n]),preload:n=>t.preloadFonts(n)}:null}var xh=class extends av.default{static{this.allowedTypes=[kr,Ra,Mu]}#e;#n;#t;#o;#i;#a;#u;#h;#c;#d;#p;#r;#s;#m;#_;#k;#g;#b;#A;#T;#I;#F;#x;#P;#D;#w;#y;get uiConfig(){return this.#y}#v;get interactionConfig(){return this.#v}#N;get surfacesConfig(){return this.#N}#E;#f;#R;#M;#L;constructor(e){if(super(),this.#e=!1,this.#t=!1,this.#o=null,this.#i=null,this.#a=null,this.#u=null,this.#h=null,this.#c=null,this.#d=!1,this.#p=null,this.#r=null,this.#s=null,this.#m=null,this.#_=!1,this.#k=!1,this.#g=null,this.#b=null,this.#A=!1,this.#T=null,this.#I=null,this.#F=n=>{this.listenerCount("content-control:active-change")>0&&(this.#A||(this.#T=n.pointerId),this.#A=!0,this.#g="pointer",this.#b=null)},this.#x=n=>{n.pointerId===this.#T&&(this.#A=!1,this.#T=null,this.#g??="pointer",this.#g==="pointer"&&(this.#b=Date.now()+OK))},this.#P=n=>{this.listenerCount("content-control:active-change")>0&&!FK(n)&&(this.#g="keyboard",this.#b=null)},this.#D=n=>{this.#X(n)},this.#w=null,this.#y=TE({}),this.#v=xE({}),this.#N=ME({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.#f=new PH,this.#R=null,this.#M=!1,this.#L=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...P1},layoutEngineOptions:{},modules:{},licenseKey:void 0,telemetry:{enabled:!0},title:"SuperDoc",conversations:[],isInternal:!1,comments:{visible:!1},toolbarGroups:["left","center","right"],toolbarIcons:{},toolbarTexts:{},uiDisplayFallbackFont:"Arial, Helvetica, sans-serif",isDev:!1,disablePiniaDevtools:!1,onEditorBeforeCreate:()=>null,onEditorCreate:()=>null,onEditorDestroy:()=>null,onSourceComplete:()=>null,onSourceSignalsComplete:()=>null,onContentError:()=>null,onReady:()=>null,onCommentsUpdate:()=>null,onContentControlActiveChange:()=>null,onContentControlClick:()=>null,onAwarenessUpdate:()=>null,onLocked:()=>null,onPdfDocumentReady:()=>null,onSidebarToggle:()=>null,onCollaborationReady:()=>null,onEditorUpdate:()=>null,onCommentsListChange:()=>null,onException:()=>null,onListDefinitionsChange:()=>null,onPaginationUpdate:()=>null,onTransaction:()=>null,disableContextMenu:!1,viewOptions:{layout:"print"},useLayoutEngine:!0},this.#ne=new WeakSet,this.#re=new WeakMap,this.#oe=null,this.#K=null,this.#j=null,!e.selector)throw new Error("SuperDoc: selector is required");const t=typeof e.selector=="string"?document.querySelector(e.selector):e.selector;if(!(t instanceof HTMLElement))throw new Error("SuperDoc: selector must be a valid CSS selector string or DOM element");this.#n=lx(this,e,()=>this.version,t),this.#E=new rH({getModuleConfig:()=>this.#N}),this.#s=t,t.addEventListener("pointerdown",this.#F,!0),t.ownerDocument.addEventListener("pointerup",this.#x,!0),t.ownerDocument.addEventListener("pointercancel",this.#x,!0),t.addEventListener("keydown",this.#P,!0),t.addEventListener("click",this.#D,!0),this.#l("content-control:active-change",e.onContentControlActiveChange),this.#S(e,t),this.#k=!0,this.listenerCount("content-control:active-change")>0&&this.ui}async#X(e){const t=this.#s;if(!t)return;const n=HK(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=tT(GK(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#S(e,t){this.#L=VK(e),this.config={...this.config,...e,modules:{...this.config.modules,...e.modules},layoutEngineOptions:{...this.config.layoutEngineOptions,...e.layoutEngineOptions}},typeof this.config.viewing?.comments=="boolean"&&(this.config.comments={...this.config.comments,visible:this.config.viewing.comments}),!this.config.comments||typeof this.config.comments!="object"?this.config.comments={visible:!1}:typeof this.config.comments.visible!="boolean"&&(this.config.comments.visible=!1),L1(this.config),this.config.documents=this.config.documents||[],this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};const n=this.config.viewOptions?.layout==="web",r=this.config.layoutEngineOptions?.flowMode==="semantic";if(!n&&r&&(console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'."),this.config.layoutEngineOptions.flowMode="paginated"),this.editorVersion=2,this.#Ue(),this.config.user=mH(this.config.user),this.config.layoutEngineOptions.virtualization||(this.config.layoutEngineOptions.virtualization={enabled:!0,window:5,overscan:1}),this.config.modules=this.config.modules||{},Object.prototype.hasOwnProperty.call(this.config.modules,"comments")||(this.config.modules.comments={}),this.config.modules.comments=pA(this.config.modules.comments),this.#y=TE(this.config),this.#v=xE(this.config),this.#N=ME(this.config),this.config.disableContextMenu=!this.#y.contextMenu.enabled,this.config.rulers=this.#y.ruler.enabled,this.#y.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#y.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&(i.readOnly=this.#v.comments.readOnly,i.allowResolve=this.#v.comments.allowResolve)}if(this.userColorMap=new Map,this.colorIndex=0,this.version="2.23.1-next.3",this.#ie("π¦ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||cl(),this.colors=this.config.colors??[],this.#de(),this.#Z(),await zM(),this.#e)return;if(await this.#ee(this.config.modules),this.#e){this.#Ce();return}this.user=this.config.user,this.users=this.config.users||[],this.socket=null,this.isDev=this.config.isDev||!1,this.activeEditor=null,this.comments=[],this.#R||(this.#R=this.#f.subscribe(i=>{this.#He(i.nextRuntimeId,i.legacyEditorProjection)})),this.isLocked=this.config.isLocked||!1,this.lockedBy=this.config.lockedBy||null;const o=document.createElement("div");o.style.display="contents",t.appendChild(o),this.#r=o,this.#J(),this.#V(),this.#Ge(),this.#O()}#O(){if(this.#Q(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#r)}#V(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new xV({Renderer:eH,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#C("requiredNumberOfEditors").documents.filter(e=>e.type===kr).length}get ui(){return this.#w||(this.#w=LF({superdoc:this}),this.#e&&this.#w.destroy()),this.#U(),this.#w}get diagnostics(){return this.#n}emit(e,...t){return(e==="exception"||e==="document-replaced"||e==="ready"||e==="active-editor-change"||e==="collaboration-ready"||e==="collaboration-connection-change"||e==="locked")&&qd(this,e,()=>t[0]),super.emit(e,...t)}on(e,t,n){return super.on(e,t,n),e==="content-control:active-change"&&this.#k&&this.ui,this}addListener(e,t,n){return super.addListener(e,t,n),e==="content-control:active-change"&&this.#k&&this.ui,this}once(e,t,n){return super.once(e,t,n),e==="content-control:active-change"&&this.#k&&this.ui,this}removeListener(e,t,n,r){return super.removeListener(e,t,n,r),this.#B(),this}off(e,t,n,r){return super.off(e,t,n,r),this.#B(),this}removeAllListeners(e){return super.removeAllListeners(e),this.#B(),this}#B(){this.listenerCount("content-control:active-change")>0||(this.#m?.(),this.#m=null,this.#I=null,this.#g=null,this.#b=null,this.#A=!1,this.#T=null)}#U(){if(this.#m||this.#_||!this.#w||this.#e||this.listenerCount("content-control:active-change")===0)return;let e=null,t=[],n=null,r=null,o=!0;this.#_=!0;try{n=this.#w.selection.observe(s=>{if(o){o=!1;return}if(s.status!=="ready")return;const a=nT(s);if(!a)return;this.#g==="pointer"&&this.#b!==null&&Date.now()>this.#b&&(this.#g=null,this.#b=null);const l=this.#g??(this.#A?"pointer":null),u=this.activeEditor;(l||this.#I?.editor!==u||this.#I.key!==a)&&(this.#I={editor:u,key:a,source:l??"keyboard"}),this.#g=null,this.#b=null}),r=this.#w.contentControls.observeActivePath(s=>{const a=this.activeEditor,l=s.activeIds.map(v=>tT(s.items.find(C=>C.id===v)));if(l.some(v=>v===null))return;const u=l,d=a===e,f=u.length===t.length&&u.every((v,C)=>v.id===t[C]?.id);if(d&&f)return;if(u.length===0&&t.length===0){e=a;return}const p=d?t[0]??null:null;e=a,t=u;const g=nT(this.#w.selection.getSnapshot()),m=this.#I;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:g&&m?.editor===a&&m.key===g?m.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#m=i}catch(i){throw n?.(),r?.(),i}finally{this.#_=!1}}get state(){return{documents:this.#C("state").documents.map(e=>Al(e.data)?{...e,data:vb(e.data,e.type||"application/vnd.openxmlformats-officedocument.wordprocessingml.document")}:e),users:this.users}}getDocumentRuntimeForDocument(e){return typeof e!="string"||e.length===0?null:(this.superdocStore?.documents??[]).find(t=>t?.getEditor?.()?.options?.documentId===e)?.getDocumentRuntime?.()??null}getComment(e){return typeof e!="string"||e.length===0?null:this.commentsStore?.getComment?.(e)??null}get element(){return typeof this.config.selector=="string"?document.querySelector(this.config.selector):this.config.selector}#Z(){const e=this.config.document,t=!!e&&typeof e=="object"&&(Al(e)||typeof Blob=="function"&&e instanceof Blob||Object.keys(e).length>0),n=typeof e=="string"&&e.length>0,r=this.config.documents&&this.config.documents?.length;if((t||n)&&r&&console.warn("π¦ [superdoc] You can only provide one of document or documents"),t){const o=bb(e);this.config.documents=[{id:cl(),...o}]}else n&&(this.config.documents=[{id:cl(),type:kr,url:this.config.document,name:"document.docx"}]);Array.isArray(this.config.documents)&&this.config.documents.length>0&&(this.config.documents=this.config.documents.map(o=>{const i=bb(o);if(!i||typeof i!="object")return i;const s=typeof i=="object"&&"id"in i&&i.id||o&&typeof o=="object"&&"id"in o&&o.id;return{...i,id:s||cl()}}))}#Q(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=gV({disablePiniaDevtools:!!this.config.disablePiniaDevtools});this.app=e,this.pinia=t,this.app.config.globalProperties.$config=this.config,this.app.config.globalProperties.$documentMode=this.config.documentMode,this.app.config.globalProperties.$superdoc=this,this.app.provide("surfaceManager",this.#E),this.superdocStore=n,this.commentsStore=r,this.highContrastModeStore=o,typeof this.superdocStore.setExceptionHandler=="function"&&this.superdocStore.setExceptionHandler(s=>this.emit("exception",s)),this.superdocStore.init(this.config);const i=this.config.modules.comments;this.commentsStore.init(i||{}),this.isCollaborative&&_M(this),this.#le()}#l(e,t){t&&this.on(e,t)}#J(){this.#l("editorBeforeCreate",this.config.onEditorBeforeCreate),this.#l("editorCreate",this.config.onEditorCreate),this.#l("editorDestroy",this.config.onEditorDestroy),this.#l("source:complete",this.config.onSourceComplete),this.#l("source:signals-complete",this.config.onSourceSignalsComplete),this.#l("ready",this.config.onReady),this.#l("comments-update",this.config.onCommentsUpdate),this.#l("content-control:click",this.config.onContentControlClick),this.#l("awareness-update",this.config.onAwarenessUpdate),this.#l("locked",this.config.onLocked),this.#l("pdf:document-ready",this.config.onPdfDocumentReady),this.#l("sidebar-toggle",this.config.onSidebarToggle),this.#l("collaboration-ready",this.config.onCollaborationReady),this.#l("collaboration-connection-change",this.config.onCollaborationConnectionChange),this.on("collaboration-ready",e=>this.#Se(e?.editor??null)),this.#l("editor-update",this.config.onEditorUpdate),this.#l("tracked-changes:bulk-decision",this.config.onTrackedChangesBulkDecision),this.on("content-error",this.onContentError),this.#l("exception",this.config.onException),this.#l("list-definitions-change",this.config.onListDefinitionsChange),this.#l("pagination-update",this.config.onPaginationUpdate),this.#l("fonts-resolved",this.config.onFontsResolved),this.#l("fonts-changed",this.config.onFontsChanged),this.#l("zoomChange",this.config.onZoomChange),this.#l("viewport-change",this.config.onViewportChange),this.#l("page-margins-change",this.config.onPageMarginsChange)}async#ee({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:cl(),type:kr,name:"document.docx"}]),this.config.v2CollaborationPreflightFailure={code:"collaboration-v1-config-unsupported",message:"SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.v2Collaboration with a v2 room instead."},this.config.documents):this.config.documents}#ce(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=Xr(e),this.provider=Xr(t),this.#de();const n=this.config;this._cleanupAwareness=bM(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#ke(){this.#p=null,this.#te(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null),this.isCollaborative=!1,this._commentsCollabInitialized=!1,this.ydoc=void 0,this.provider=void 0;const e=this.config;delete e.modules.collaboration,e.documents.forEach(t=>{delete t.ydoc,delete t.provider})}#te(){if(this.#a){try{this.#a()}catch{}this.#a=null}if(this.#u){try{this.#u()}catch{}this.#u=null}if(this.#h){try{this.#h()}catch{}this.#h=null}}#Se(e){this.#te(),ni(e)&&(this.#Ae(e),this.#Ie(e),this.#_e(e))}#_e(e){const t=e.connection;if(!t||typeof t.subscribe!="function")return;const{documentId:n}=t;this.#c?.documentId!==n&&(this.#c=null,this.#d=!1);const r=o=>{if(this.#e)return;const i=this.#c;if(i&&i.state===o.state&&i.detail===(o.detail??null))return;const s={documentId:n,state:o.state,previousState:i?.state??null,kind:WK(o,this.#d),detail:o.detail??null,superdoc:this};this.#c=s,o.state==="synced"&&(this.#d=!0),this.emit("collaboration-connection-change",s)};try{const o=t.getSnapshot?.();o&&r(o),this.#h=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 connection bridge failed to subscribe",o)}}getCollaborationConnectionState(){return this.#c}#Ae(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=AV(()=>this.user),r=o=>{if(this.#e)return;const i=n.next(o);this.emit("awareness-update",{...i,superdoc:this})};try{const o=t.getSnapshot?.();o&&r(o),this.#a=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#Ie(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#$(!!r.isLocked,this.#ue(r.lockedBy??null))};try{if(this.#p&&typeof t.setLocked=="function"){const o=this.#p;t.setLocked(o.isLocked,o.isLocked?o.lockedBy:null),this.#p=null}const r=t.getSnapshot?.();r&&n(r),this.#u=t.subscribe(n)}catch(r){console.warn("[SuperDoc] v2 lock bridge failed to subscribe",r)}}#ue(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#Ee(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#$(e,t){this.isLocked===e&&this.#Ee(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#ie("π¦ [superdoc] Locking superdoc:",e,t,`
|
|
107
|
+
`;Nt();var Yi=e=>{e.expand.value=!1},j1=(e,t)=>{const n=e.layoutWidth?.value;return Number.isFinite(n)&&n>0?n:e.type==="separator"?t.get("separator"):t.get(e.name.value)||t.get("default")},bK=e=>{const t=[];for(const n of e){if(n.type==="separator"){const r=t[t.length-1];if(!r||r.type==="separator")continue}t.push(n)}for(;t.length&&t[t.length-1].type==="separator";)t.pop();return t},GE=e=>{const t=new Map;for(const r of e){const o=r.group?.value||"center";t.has(o)||t.set(o,[]),t.get(o).push(r)}const n=new Set;for(const r of t.values())for(const o of bK(r))n.add(o);return e.filter(r=>n.has(r))},wK=e=>{const t=e.find(o=>o.type==="overflow"),n=e.filter(o=>o!==t),r=new Set(GE(n));return e.filter(o=>o===t||r.has(o))};function V1(e,t){const n={...e};return t?n.href=t:delete n.href,n}function WE(e){const t=Array.isArray(e?.segments)?e.segments:[];if(e?.kind!=="text"||!t.length)return null;const n=t[0],r=t[t.length-1];if(!n?.blockId||!r?.blockId||!n.range||!r.range)return null;const o=e.story;return{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.range.start??0,...o?{story:o}:{}},end:{kind:"text",blockId:r.blockId,offset:r.range.end??0,...o?{story:o}:{}},...o?{story:o}:{}}}function CK(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function U1(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function kK(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function SK(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var _K=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,configuredItemOrder:u,excludedItemNames:d,additionalItems:f=[]}={})=>{const p=xn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),g=(r??UG).map(YG),m=xn({type:"dropdown",name:"fontFamily",tooltip:n.fontFamily,command:"setFontFamily",defaultLabel:"Arial",label:"Arial",markName:"textStyle",labelAttr:"fontFamily",hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,isWide:!0,style:{width:"116px"},suppressActiveHighlight:!0,attributes:{ariaLabel:"Font family"},options:g,onActivate:({fontFamily:ot}={},Ct=!1)=>{if(Ct){m.label.value="",m.selectedValue.value="";return}if(!ot)return;ot=ot.split(",")[0];const Rt=Ut=>Ut.value??Ut.label,an=g.find(Ut=>Rt(Ut)===m.defaultLabel.value),Kt=g.find(Ut=>Rt(Ut)===ot);Kt?(m.label.value=Kt.label,m.selectedValue.value=Kt.key):an?(m.label.value=ot,m.selectedValue.value=an.key):(m.label.value=ot,m.selectedValue.value="")},onDeactivate:()=>{const ot=g.find(Ct=>(Ct.value??Ct.label)===m.defaultLabel.value);m.label.value=ot?.label??m.defaultLabel.value,m.selectedValue.value=ot?.key??""}}),v=xn({type:"dropdown",name:"ai",dropdownStyles:{padding:0,outline:"none"},tooltip:n.ai,icon:t.ai,hideLabel:!0,hasCaret:!1,isWide:!0,suppressActiveHighlight:!0,attributes:{ariaLabel:"AI"},options:[{type:"render",key:"ai",render:()=>C(v)}]});function C(ot){const Ct=U1(e),Rt=Ct?.selectionTarget??WE(Ct?.target),an=Ct?.empty?"":CK(Ct),Kt=SK(e),Ut=()=>Yi(ot),mn=()=>{const ze=e.pendingSelectionCapture;ze&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(ze)};return Nr("div",{},[Nr(kW,{handleClose:Ut,selectedText:an,target:Rt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:Kt?.apiKey||e.config?.aiApiKey||"",endpoint:Kt?.endpoint||e.config?.aiEndpoint||"",restoreSelection:mn})])}const w=HG,S=xn({type:"dropdown",name:"fontSize",defaultLabel:"12",label:"12",style:{width:"56px"},markName:"textStyle",labelAttr:"fontSize",tooltip:n.fontSize,hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,suppressActiveHighlight:!0,isWide:!0,command:"setFontSize",attributes:{ariaLabel:"Font size"},options:w,onActivate:({fontSize:ot},Ct=!1)=>{if(Ct){S.label.value="",S.selectedValue.value="";return}const Rt=w.find(mn=>mn.label===String(S.defaultLabel.value));if(!ot){S.label.value=S.defaultLabel.value,Rt?S.selectedValue.value=Rt.key:S.selectedValue.value="";return}let an=NH(ot,12);an<8&&(an=8),an>96&&(an=96);let Kt=String(an);const Ut=w.find(mn=>mn.label===Kt||mn.key===Kt);Ut?S.selectedValue.value=Ut.key:S.selectedValue.value="",S.label.value=Kt},onDeactivate:()=>{S.label.value=S.defaultLabel.value;const ot=w.find(Ct=>Ct.label===String(S.defaultLabel.value));ot?S.selectedValue.value=ot.key:S.selectedValue.value=""}}),y=()=>xn({type:"separator",name:"separator",isNarrow:!0}),k=xn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),x=xn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),M=xn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),z=xn({type:"dropdown",name:"highlight",icon:t.highlight,hideLabel:!0,markName:"highlight",labelAttr:"color",active:!1,tooltip:n.highlight,command:"setHighlight",noArgumentCommand:"unsetHighlight",suppressActiveHighlight:!0,attributes:{ariaLabel:"Highlight"},options:[{key:"color",type:"render",render:()=>B1(e,z,[],!0)}],onActivate:({color:ot})=>{z.iconColor.value=ot||""},onDeactivate:()=>z.iconColor.value=""}),q=xn({type:"dropdown",name:"color",icon:t.color,hideLabel:!0,markName:"textStyle",labelAttr:"color",active:!1,tooltip:n.color,command:"setColor",suppressActiveHighlight:!0,attributes:{ariaLabel:"Color"},options:[{key:"color",type:"render",render:()=>B1(e,q)}],onActivate:({color:ot})=>{q.iconColor.value=ot},onDeactivate:()=>q.iconColor.value="#000"}),B=xn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),L=xn({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>V(L)}],onActivate:({href:ot})=>{L.attributes.value=V1(L.attributes.value,ot)},onDeactivate:()=>{L.attributes.value=V1(L.attributes.value,null),L.expand.value=!1}});function V(ot){const Ct=e.pendingSelectionCapture,Rt=U1(e),an=Rt?.quotedText&&JSON.stringify(Rt.selectionTarget??Rt.target)!==JSON.stringify(Ct?.selectionTarget??Ct?.target)?Rt:Ct??Rt,Kt=an?.selectionTarget??WE(an?.target)??an?.target,Ut=()=>{an===Ct&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(Ct)};return Nr("div",{},[Nr(u4,{ui:e.ui,linkItem:ot,textTarget:Kt,selectedText:an?.quotedText??null,restoreSelection:Ut,closePopover:()=>{Yi(ot),Gl(e)},goToAnchor:()=>{Yi(ot);const mn=ot.attributes.value?.href;if(!mn)return;const ze=mn.slice(1),He=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${ze}']`);He&&d4(He)}})])}const T=xn({type:"options",name:"linkInput",command:"toggleLink",active:!1});L.childItem=T,T.parentItem=L;const $=xn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),R=xn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),H=xn({type:"button",name:"watermark",icon:t.watermark,tooltip:n.watermark,allowWithoutEditor:!0,disabled:!0,attributes:{ariaLabel:n.watermark}}),G=xn({type:"dropdown",name:"pageNumber",icon:t.pageNumber,hideLabel:!0,tooltip:n.pageNumber,disabled:!0,suppressActiveHighlight:!0,attributes:{ariaLabel:n.pageNumber},options:[{key:"pageNumber",type:"render",label:"Page number options",render:()=>J(G)}]});let ee=null;function J(ot){const Ct=e.ui,Rt=mn=>Ct?.commands?.get?.(mn)?.getState?.()??null,an=()=>{Yi(ot),Re.expand.value&&Yi(Re),Gl(e)},Kt=U1(e),Ut=Kt?.selectionTarget?.story??Kt?.selectionTarget?.start?.story??Kt?.target?.story??null;return Nr(gK,{pageNumbersState:Rt("page-numbers-apply"),atCursorState:Rt("page-number-insert"),inHeaderFooter:Ut?.storyType==="headerFooterPart"||Ut?.storyType==="headerFooterSlot",suggesting:Ct?.document?.getSnapshot?.()?.mode==="suggesting",initialChoice:ee,loadCurrent:()=>Ct?V9(Ct):Promise.resolve(null),applyPageNumbers:mn=>Pc(Ct,"page-numbers-apply",mn),removePageNumbers:()=>Pc(Ct,"page-numbers-remove"),insertAtCursor:()=>Pc(Ct,"page-number-insert"),close:mn=>{an();const ze=Ct?.viewport?.getHost?.();if(mn?.action==="apply")ee=mn.choice,HE(ze,mn.choice.position==="top"?"header":"footer");else if(mn?.action==="remove")for(const He of new Set(mn.kinds))HE(ze,He)}})}const X=xn({type:"dropdown",name:"table",icon:t.table,hideLabel:!0,labelAttr:"table",active:!1,tooltip:n.table,command:"insertTable",suppressActiveHighlight:!0,attributes:{ariaLabel:"Table"},options:[{key:"table",type:"render",render:()=>xe(X)}]});function xe(ot){return Nr("div",{},[Nr(BW,{onSelect:Rt=>{e.emitCommand({item:ot,argument:Rt}),Yi(ot),Gl(e)}})])}const fe=xn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>ve(fe)}]}),ye=[{label:n.addRowBefore,command:"addRowBefore",icon:t.addRowBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row before"}},{label:n.addRowAfter,command:"addRowAfter",icon:t.addRowAfter,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row after"}},{label:n.addColumnBefore,command:"addColumnBefore",icon:t.addColumnBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column before"}},{label:n.addColumnAfter,command:"addColumnAfter",icon:t.addColumnAfter,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column after"}},{label:n.deleteRow,command:"deleteRow",icon:t.deleteRow,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete row"}},{label:n.deleteColumn,command:"deleteColumn",icon:t.deleteColumn,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete column"}},{label:n.deleteTable,command:"deleteTable",icon:t.deleteTable,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete table"}},{label:n.removeBorders,command:"deleteCellAndTableBorders",icon:t.deleteBorders,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete cell and table borders"}},{label:n.mergeCells,command:"mergeCells",icon:t.mergeCells,props:{"data-item":"btn-tableActions-option",ariaLabel:"Merge cells"}},{label:n.splitCell,command:"splitCell",icon:t.splitCell,props:{"data-item":"btn-tableActions-option",ariaLabel:"Split cells"}},{label:n.fixTables,command:"fixTables",icon:t.fixTables,props:{"data-item":"btn-tableActions-option",ariaLabel:"Fix tables"}}];function ve(ot){return Nr(GW,{options:ye,onSelect:Ct=>{Yi(ot);const{command:Rt}=Ct;e.emitCommand({item:ot,argument:{command:Rt}}),Gl(e)}})}const Le=xn({type:"dropdown",name:"textAlign",tooltip:n.textAlign,icon:t.alignLeft,command:"setTextAlign",hasCaret:!0,markName:"textAlign",labelAttr:"textAlign",suppressActiveHighlight:!0,attributes:{ariaLabel:"Text align"},options:[{type:"render",render:()=>Nr("div",{},[Nr(QG,{onSelect:Ct=>{Yi(Le);const Rt={...Le,command:"setTextAlign"};Rt.command="setTextAlign",e.emitCommand({item:Rt,argument:Ct}),je(Le,Ct),Gl(e)}})]),key:"alignment"}],onActivate:({textAlign:ot})=>{je(Le,ot)},onDeactivate:()=>{je(Le,"left")}}),je=(ot,Ct)=>{let Rt=Ct==="both"?"justify":Ct,an={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},Kt=an[Rt]??an.left;ot.icon.value=Kt},nt=xn({type:"dropdown",name:"list",command:"toggleBulletListStyle",splitButton:!0,splitButtonCommand:"toggleBulletList",icon:t.bulletList,hasCaret:!0,tooltip:n.bulletList,restoreEditorFocus:!0,attributes:{ariaLabel:"Bullet list"},options:[{type:"render",key:"bullet-style-buttons",render:()=>{const ot=Ct=>{Yi(nt);const Rt={...nt,command:"toggleBulletListStyle"};e.emitCommand({item:Rt,argument:Ct})};return Nr(VE,{buttons:tW,iconSize:25,selectedStyle:nt.selectedValue.value,onSelect:ot})}}]}),ut=xn({type:"dropdown",name:"numberedlist",command:"toggleOrderedListStyle",splitButton:!0,splitButtonCommand:"toggleOrderedList",icon:t.numberedList,hasCaret:!0,tooltip:n.numberedList,restoreEditorFocus:!0,attributes:{ariaLabel:"Numbered list"},options:[{type:"render",key:"numbered-style-buttons",render:()=>{const ot=Ct=>{Yi(ut);const Rt={...ut,command:"toggleOrderedListStyle"};e.emitCommand({item:Rt,argument:Ct})};return Nr(VE,{buttons:nW,iconSize:30,selectedStyle:ut.selectedValue.value,onSelect:ot})}}]}),ft=xn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),At=xn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Re=xn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),se=xn({type:"dropdown",name:"zoom",allowWithoutEditor:!0,tooltip:n.zoom,defaultLabel:"100%",label:"100%",hasCaret:!0,command:"setZoom",isWide:!0,style:{width:"71px",minWidth:"71px"},inlineTextInputVisible:!1,hasInlineTextInput:!0,attributes:{ariaLabel:"Zoom"},options:[{label:"50%",key:.5,props:{"data-item":"btn-zoom-option"}},{label:"75%",key:.75,props:{"data-item":"btn-zoom-option"}},{label:"90%",key:.9,props:{"data-item":"btn-zoom-option"}},{label:"100%",key:1,props:{"data-item":"btn-zoom-option"}},{label:"125%",key:1.25,props:{"data-item":"btn-zoom-option"}},{label:"150%",key:1.5,props:{"data-item":"btn-zoom-option"}},{label:"200%",key:2,props:{"data-item":"btn-zoom-option"}}],onActivate:({zoom:ot})=>{ot&&(se.label.value=ot)}}),be=xn({type:"dropdown",name:"measurementUnit",allowWithoutEditor:!0,tooltip:n.measurementUnit,defaultLabel:"in",label:"in",hasCaret:!0,command:"setMeasurementUnit",group:"right",style:{width:"52px",minWidth:"52px"},inlineTextInputVisible:!1,hasInlineTextInput:!1,attributes:{ariaLabel:"Measurement unit"},options:[{label:"Inches",key:"in",props:{"data-item":"btn-measurement-unit-option"}},{label:"Centimeters",key:"cm",props:{"data-item":"btn-measurement-unit-option"}}],onActivate:({measurementUnit:ot})=>{ot&&(be.label.value=ot)}}),Q=xn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),I=xn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),ie=xn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),j=xn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Z=xn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),K=xn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),ae=(ot,Ct)=>ot==="editor"?Ct:ot==="suggester"?Ct.filter(Rt=>Rt.value==="suggesting"):Ct.filter(Rt=>Rt.value==="viewing"),Ce=ot=>ot==="editor"?"Editing":ot==="suggester"?"Suggesting":"Viewing",D=xn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:Ce(s),label:Ce(s),hasCaret:s==="editor",isWide:!0,style:{display:"flex",justifyContent:"flex-end"},inlineTextInputVisible:!1,hasInlineTextInput:!1,group:"right",disabled:s!=="editor",attributes:{dropdownPosition:"right",className:"sd-toolbar-item--doc-mode",ariaLabel:"Document mode"},options:[{type:"render",render:()=>me(D)}]}),N=[{label:n.documentEditingMode,value:"editing",icon:t.documentEditingMode,description:n.documentEditingModeDescription},{label:n.documentSuggestingMode,value:"suggesting",icon:t.documentSuggestingMode,description:n.documentSuggestingModeDescription},{label:n.documentViewingMode,value:"viewing",icon:t.documentViewingMode,description:n.documentViewingModeDescription}];function me(ot){return Nr(uW,{options:ae(s,N),onSelect:Ct=>{const Rt=e.superdoc?.activeEditor??e.activeEditor;Yi(ot);const{label:an,icon:Kt,value:Ut}=Ct;D.label.value=an,D.icon.value=Kt,e.emitCommand({item:D,argument:Ut}),Gl(e,Rt)}})}const Se=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),Te=["search","ruler","undo","overflow","documentMode"],Ne=xn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),Ge=xn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),rt=xn({type:"dropdown",name:"linkedStyles",command:"setLinkedStyle",tooltip:n.linkedStyles,icon:t.paintbrush,defaultLabel:n.formatText,label:n.formatText,hasCaret:!0,isWide:!0,style:{width:"140px"},suppressActiveHighlight:!0,disabled:!1,attributes:{className:"sd-toolbar-item--linked-styles",ariaLabel:"Linked styles"},options:[{type:"render",key:"linkedStyle",render:()=>{const ot=Rt=>{Yi(rt);const an=typeof Rt=="string"?Rt:Rt?.id??null;if(!an)return;const Kt={...rt,command:"setLinkedStyle"};e.emitCommand({item:Kt,argument:an})},Ct=e.getActiveLinkedStyleId?.()??null;return Nr("div",{},[Nr(pW,{styles:e.getLinkedStyleOptions?.()??[],onSelect:ot,selectedOption:Ct})])}}],onActivate:({styleId:ot,styleName:Ct})=>{const Rt=Ct||ot;rt.label.value=ot&&ot!=="Normal"?String(Rt):n.formatText,rt.disabled.value=!1},onDeactivate:()=>{rt.disabled.value=!0,rt.label.value=n.formatText}}),vt=(ot,Ct)=>{if(Ct.value==ot)return Nr("div",{innerHTML:yK,class:"dropdown-select-icon"})},Ot=xn({type:"dropdown",name:"lineHeight",tooltip:n.lineHeight,icon:t.lineHeight,hasCaret:!1,hasInlineTextInput:!1,hideLabel:!0,inlineTextInputVisible:!1,suppressActiveHighlight:!0,restoreEditorFocus:!0,isWide:!1,command:"setLineHeight",dropdownValueKey:"key",selectedValue:"1",attributes:{ariaLabel:"Line height"},options:[1,1.15,1.5,2,2.5,3].map(ot=>({label:ot.toFixed(2),key:ot,icon:()=>vt(ot,Ot.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),Mt=20,Yt=32,Ue=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],nn=["zoom","fontFamily","fontSize","redo"],Un=i<=Th.lg,Xt=e.config?.showFormattingMarksButton===!0,Bn=e.config?.showTableOfContentsButton===!0;Un&&(D.attributes.value={...D.attributes.value,className:`${D.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),Un&&(rt.attributes.value={...rt.attributes.value,className:`${rt.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let Ln=[Q,I,ie,j,B,se,m,y(),S,y(),p,k,x,M,q,z,y(),L,$,...Bn?[R]:[],...e.config?.showWatermarkButton||l?.has("watermark")?[H]:[],...e.config?.showPageNumberButton||l?.has("pageNumber")?[G]:[],X,fe,y(),Le,nt,ut,ft,At,Ot,y(),rt,y(),Ne,be,...Xt?[Ge]:[],K,Z,...kK(e)?[v]:[],Re,D,...f];if(i<=Th.md&&o&&(Ln=Ln.filter(ot=>ot.type!=="separator")),e.config.mode!=="docx"){const ot=Ln.findIndex(Rt=>Rt.name.value==="linkedStyles");Ln.splice(ot-1,2);const Ct=["ruler","zoom","undo","redo"];Ln=Ln.filter(Rt=>!Ct.includes(Rt.name.value))}const jr=[];a||(s==="viewer"&&jr.push(ie,j),Ln=Ln.filter(ot=>!jr.includes(ot))),l&&(Ln=Ln.filter(ot=>ot.name.value==="overflow"||ot.isCustomToolbarItem||l.has(ot.name.value))),d?.size&&(Ln=Ln.filter(ot=>!d.has(ot.name.value))),Ln=wK(Ln);const qr=ot=>Te.includes(ot.name.value),wr=Ln.find(ot=>ot.name.value==="overflow"),Tn=Ln.filter(ot=>ot!==wr);if(u){const ot=new Map(u.map((Rt,an)=>[Rt,an])),Ct=Rt=>ot.get(Rt.name.value)??Number.MAX_SAFE_INTEGER;Tn.sort((Rt,an)=>Ct(Rt)-Ct(an))}const er=ot=>{const Ct=[],Rt=[],an=Tn.filter(qr).reduce((Ut,mn)=>Ut+j1(mn,Se),0);let Kt=Yt+an+(ot&&wr?j1(wr,Se):0);return Tn.forEach((Ut,mn)=>{const ze=j1(Ut,Se);if(Ut.type==="separator"&&Tn[mn-1]?.name.value==="linkedStyles"&&Ct.includes(Tn[mn-1])){Ct.push(Ut);return}if(i<Th.xl+Mt&&Ue.includes(Ut.name.value)&&o){Ct.push(Ut);return}if(i<Th.sm&&nn.includes(Ut.name.value)&&o){Ct.push(Ut);return}if(qr(Ut)){Rt.push(Ut);return}Kt+ze<=i||!o?(Rt.push(Ut),Kt+=ze):Ct.push(Ut)}),{visibleItems:Rt,overflowItems:Ct}};let{visibleItems:Rr,overflowItems:Wn}=er(!1);if(o&&wr&&Wn.some(ot=>ot.type!=="separator")){({visibleItems:Rr,overflowItems:Wn}=er(!0));const ot=Ln.indexOf(wr),Ct=Rr.findIndex(Rt=>Ln.indexOf(Rt)>ot);Ct===-1?Rr.push(wr):Rr.splice(Ct,0,wr)}return Rr=GE(Rr),{defaultItems:Rr,overflowItems:Wn.filter(ot=>ot.type!=="separator")}},KE={bold:"Bold",fontFamily:"Font family",ai:"AI text generation",fontSize:"Font size",italic:"Italic",underline:"Underline",highlight:"Highlight color",strikethrough:"Strikethrough",color:"Text color",search:"Search",link:"Link",image:"Image",tableOfContents:"Table of contents",watermark:"Watermark",pageNumber:"Page number",table:"Insert table",tableActions:"Table options",addRowBefore:"Insert row above",addRowAfter:"Insert row below",addColumnBefore:"Insert column left",addColumnAfter:"Insert column right",deleteRow:"Delete row",deleteColumn:"Delete column",deleteTable:"Delete table",removeBorders:"Remove borders",mergeCells:"Merge cells",splitCell:"Split cell",fixTables:"Fix tables",textAlign:"Alignment",bulletList:"Bullet list",numberedList:"Numbered list",indentLeft:"Left indent",indentRight:"Right indent",directionLtr:"Left-to-right",directionRtl:"Right-to-left",zoom:"Zoom",measurementUnit:"Measurement unit",undo:"Undo",redo:"Redo",trackChanges:"Track Changes",trackChangesAccept:"Accept changes under selection",trackChangesReject:"Reject changes under selection",trackChangesOriginal:"Toggle Show Original",trackChangesFinal:"Toggle Show Final",clearFormatting:"Clear formatting",copyFormat:"Format painter",lineHeight:"Line height",formatText:"Format text",ruler:"Show or hide ruler",formattingMarks:"Show or hide formatting marks",pageBreak:"Insert page break",documentEditingMode:"Editing",documentSuggestingMode:"Suggesting",documentViewingMode:"Viewing",documentEditingModeDescription:"Edit document directly",documentSuggestingModeDescription:"Edits become suggestions",documentViewingModeDescription:"View clean version of document only",linkedStyles:"Linked styles"},AK=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Nt();function qE(e){return FH(e)??N1[e]??null}function Eg(e,t,n,r={}){if(!e?.commands||!t||typeof e.commands.has=="function"&&!e.commands.has(t))return!1;const o=typeof e.commands.executeAsync=="function"?e.commands.executeAsync:e.commands.execute;if(typeof o!="function")return!1;const i=r.firstParty?Pc(e,t,n):n===void 0?o.call(e.commands,t):o.call(e.commands,t,n),s=a=>{!r.reportUnhandled||a!==!1||r.onError?.(new Error(`[superdoc toolbar] Command "${t}" did not run. Check that it is enabled and has the required input.`))};return i&&typeof i.then=="function"?Promise.resolve(i).then(a=>{s(a),r.onSettled?.()},a=>{r.onError?.(a),r.onSettled?.()}):(s(i),r.onSettled?.()),!0}var IK=["page-numbers-apply","page-number-insert"],EK=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),TK=new Set(["list","numberedlist"]);function xK(e,t){if(e==="fontFamily"||e==="fontSize"||TK.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!EK.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function YE(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function RK(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var MK=new Set([...OH,...Object.keys(yg),"ai","overflow","tableOfContents"]),LK=class extends av.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...pr},texts:{...KE},fonts:null,hideButtons:!0,responsiveToContainer:!1,mode:"docx",excludeItems:[],toolbarButtonsExclude:[],groups:null,customButtons:[],showFormattingMarksButton:!1,showTableOfContentsButton:!1,showWatermarkButton:!1,showPageNumberButton:!1};toolbarItems=[];overflowItems=[];#e=null;#n=null;isDev=!1;role="editor";superdoc;toolbarContainer=null;toolbar=null;_detachFontsChanged=null;_linkedStyleOptions=Fr([]);constructor(e={}){if(super(),this.config={...this.config,...e},this.toolbarItems=[],this.overflowItems=[],this.isDev=e.isDev||!1,this.superdoc=e.superdoc,this.role=e.role||"editor",this.toolbarContainer=null,this.config.icons={...pr,...e.icons},this.config.texts={...KE,...e.texts},this.config.hideButtons=e.hideButtons??!0,this.config.responsiveToContainer=e.responsiveToContainer??!1,this.activeEditor=e.editor??this.superdoc?.activeEditor??null,this.ui=null,this.snapshot=null,this._unsubscribeController=null,this._detachFormatPainterModeChange=null,this._customCommandRegs=new Map,this._reportedInvalidCustomItems=new Set,this._lastFontOptionsSignature="",!this.config.selector&&this.config.element&&(this.config.selector=this.config.element),this.toolbarContainer=AK(this.config.selector),this.toolbarContainer){const t=(this.config?.uiDisplayFallbackFont||"").toString().trim()||"Arial, Helvetica, sans-serif";this.toolbarContainer.style.setProperty("--sd-ui-font-family",t)}try{if(this.#t(),this.#u(),this.#c(),this.#i(),this._lastFontOptionsSignature=this.#r(),!this.toolbarContainer){this.updateToolbarState();return}this.app=Ic(qG),this.app.directive("click-outside",cb),this.app.config.globalProperties.$toolbar=this,this.toolbar=this.app.mount(this.toolbarContainer),this.updateToolbarState()}catch(t){try{this.destroy()}catch{}throw t}}#t(){this.ui=this.superdoc?.ui??null,this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot(),this._unsubscribeController=this.ui.toolbar.subscribe(()=>{this.snapshot=this.ui.toolbar.getSnapshot(),this.getToolbarItemByName("linkedStyles")?.expand.value&&this.#m(),this.updateToolbarState()}),this._detachFormatPainterModeChange=this.ui.formatPainter.onModeChange(e=>{e==="armed"||e==="persistent"?this.#w():this.#y()}))}#o(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#y();for(const e of this._customCommandRegs.values())try{e.unregister?.()}catch{}this._customCommandRegs.clear(),this.ui=null,this.snapshot=null}#i(){if(!this.superdoc||typeof this.superdoc.on!="function"||typeof this.superdoc.off!="function")return;const e=()=>{const t=this.#r();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#p()),this.updateToolbarState()};this.superdoc.on("fonts-changed",e),this._detachFontsChanged=()=>{this.superdoc?.off?.("fonts-changed",e)}}#a(){this._detachFontsChanged?.(),this._detachFontsChanged=null}#u(){if(Array.isArray(this.config.groups)){this.config.toolbarGroups=this.config.groups,this.config.groups=null;return}this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length&&(this.config.toolbarGroups=Object.keys(this.config.groups))}getAvailableWidth(){const e=document.documentElement.clientWidth,t=this.toolbarContainer?.offsetWidth??0;return this.config.responsiveToContainer?t:e}#h(e){return e||$G(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#c(){const e=this.getAvailableWidth(),t=new Map(this.#s().filter(C=>C.isCustomToolbarItem&&C.type==="dropdown").map(C=>[C.name.value,C.selectedValue.value])),n=this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length>0,r=n?new Set(Object.values(this.config.groups).flatMap(C=>C)):null,o=new Set([...this.config.excludeItems??[],...this.config.toolbarButtonsExclude??[]]),i=this.config.customButtons||[],s=new Set(MK),a=i.map((C,w)=>{try{if(C?.name&&s.has(C.name))throw new Error(`Toolbar item name "${C.name}" is already taken by another item, so this entry is skipped.`);const S=this.#d(C);return t.has(S.name.value)&&(S.selectedValue.value=t.get(S.name.value)),s.add(S.name?.value),S}catch(S){const y=`${C?.name??`<unnamed@${w}>`}::${S?.message??String(S)}`;return this._reportedInvalidCustomItems.has(y)||(this._reportedInvalidCustomItems.add(y),this.#v(S,C?.name??null)),null}}).filter(Boolean),l=n?new Set(Object.keys(this.config.groups)):null,u=l?a.filter(C=>l.has(C.group?.value||"center")):a;let d=null;if(n){const C=Object.values(this.config.groups).flatMap(S=>S),w=a.filter(S=>l.has(S.group?.value||"center")).map(S=>S.name.value);d=[...new Set([...C,...w])]}const{defaultItems:f,overflowItems:p}=_K({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#h(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev,configuredItemNames:r,configuredItemOrder:d,excludedItemNames:o,additionalItems:u});n||(d=[...f.map(C=>C.name.value),...p.map(C=>C.name.value)]);const g=p.filter(C=>d.includes(C.name.value)&&!o.has(C.name.value)),m=g.length?[...d,"overflow"]:d,v=f.filter(C=>m.includes(C.name.value)).filter(C=>!o.has(C.name.value));if(n){const C=new Map(d.map((x,M)=>[x,M])),w=x=>C.get(x.name.value)??Number.MAX_SAFE_INTEGER,S=v.find(x=>x.name.value==="overflow"),y=new Map(v.map((x,M)=>[x,M])),k=v.filter(x=>x!==S);if(k.sort((x,M)=>w(x)-w(M)),S){const x=y.get(S),M=k.findIndex(z=>y.get(z)>x);M===-1?k.push(S):k.splice(M,0,S)}v.splice(0,v.length,...k),g.sort((x,M)=>w(x)-w(M))}if(n)for(const[C,w]of Object.entries(this.config.groups))for(const S of v)w.includes(S.name.value)&&(S.group.value=C);this.toolbarItems=v,this.overflowItems=g}#d(e){const t=xn({...e});t.isCustomToolbarItem=!0;const n=e.command;if(typeof n=="function"&&this.ui?.commands?.register){const r=`__builtin_toolbar__${e.name}`;if(!this._customCommandRegs.has(r)){const o=this.ui.commands.register({id:r,execute:i=>{const s=i?.payload&&typeof i.payload=="object"?i.payload:{};try{const a=n({...i,item:t,argument:s.argument,option:s.option});return a&&typeof a.then=="function"?Promise.resolve(a).catch(l=>(this.#v(l,e.name),!1)):a}catch(a){return this.#v(a,e.name),!1}}});this._customCommandRegs.set(r,o)}}return t}#p(){this.#c(),this.emit("toolbar-items-changed")}#r(){if(this.config.fonts)return"custom-fonts";const e=this.superdoc?.fonts?.getFontFamilyOptions?.()??[];return JSON.stringify(e.map(t=>[t.label,t.value,t.previewFamily]))}getToolbarItemByGroup(e){return this.toolbarItems.filter(t=>(t.group?.value||"center")===e)}getToolbarItemByName(e){return this.#s().find(t=>t.name.value===e)}#s(){return[...this.toolbarItems,...this.overflowItems]}getLinkedStyleOptions(){return this.#m(),this._linkedStyleOptions.value}#m(){this.ui?.styles?.getCatalog?.({includePreview:!0});const e=this.ui?.styles?.getCatalog?.({view:"quickGallery",includePreview:!0})?.items??this.ui?.styles?.getQuickGallery?.()??[];e!==this._linkedStyleOptions.value&&(this._linkedStyleOptions.value=e)}getActiveLinkedStyleId(){return this.ui?.styles?.getActiveParagraphStyle?.()?.styleId??null}setActiveEditor(e){this.activeEditor=e;const t=this.#r();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#p()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}onToolbarResize=()=>{this.#c(),this.updateToolbarState()};#_(e){return e==="ruler"?!!this.superdoc?.config?.rulers:e==="formattingMarks"?!!this.superdoc?.config?.layoutEngineOptions?.showFormattingMarks:!1}#k(e){return e==="watermark"?this.ui?.document?.getSnapshot?.().ready===!0&&typeof this.ui?.watermark?.open=="function":e==="ruler"?typeof this.superdoc?.toggleRuler=="function":e==="formattingMarks"?typeof this.superdoc?.toggleFormattingMarks=="function"||typeof this.superdoc?.setShowFormattingMarks=="function":!1}#g(){const e=this.getToolbarItemByName("documentMode");if(!e)return;const t=(this.snapshot?.commands?.["document-mode"]?.value||"editing").toLowerCase(),n=this.config.texts||{},r=this.config.icons||{},o={editing:{label:n.documentEditingMode||"Editing",icon:r.documentEditingMode||r.documentMode},suggesting:{label:n.documentSuggestingMode||"Suggesting",icon:r.documentSuggestingMode||r.documentMode},viewing:{label:n.documentViewingMode||"Viewing",icon:r.documentViewingMode||r.documentMode}},i=o[t]||o.editing;e.label?.value!==void 0&&(e.label.value=i.label),e.defaultLabel?.value!==void 0&&(e.defaultLabel.value=i.label),e.icon?.value!==void 0&&i.icon&&(e.icon.value=i.icon)}#b(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>B1(this,e,[],!0)};e.nestedOptions.value=[t]}#A(e){return!!e?.active&&e?.value==null}#T(e){return!!e&&e.disabled===!1&&e.value==null}#I(e){const t=e.name.value;if(e.isCustomToolbarItem&&typeof e.command=="string"){const i=this.snapshot?.commands?.[e.command];return e.setDisabled(e.initiallyDisabled||!i||!!i.disabled),i?.active?e.activate():e.deactivate(),!0}if(t==="tableActions"){const i=jE.map(s=>this.snapshot?.commands?.[s]).some(s=>s&&!s.disabled);return e.setDisabled(!i),!0}if(t==="search")return e.setDisabled(this.superdoc?.uiConfig?.search?.enabled!==!0),!0;if(t==="pageNumber"){const i=IK.map(a=>this.snapshot?.commands?.[a]),s=this.ui?.document?.getSnapshot?.()?.mode==="suggesting";return e.setDisabled(!s&&!i.some(a=>a&&!a.disabled)),!0}if(O1(t)?.disposition==="host-routed")return e.setDisabled(!this.#k(t)),this.#_(t)?e.activate():e.deactivate(),!0;const n=qE(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];xK(t,r)?e.setDisabled(!1):e.setDisabled(!!r?.disabled);const o={textAlign:()=>{r?.value?e.activate({textAlign:r.value}):e.deactivate()},lineHeight:()=>{e.selectedValue.value=r?.value!=null?r.value:""},zoom:()=>{if(r?.value!=null){const i=typeof r.value=="number"?`${r.value}%`:String(r.value);e.onActivate({zoom:i})}},measurementUnit:()=>{r?.value!=null&&e.onActivate({measurementUnit:String(r.value)})},documentMode:()=>{this.#g()},link:()=>{e.active.value=!!r?.active,e.attributes.value=V1(e.attributes.value,r?.value??null)},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#T(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#A(r)){e.activate({},!0);return}e.deactivate()},color:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},highlight:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},linkedStyles:()=>{const i=r?.value,s=typeof i=="string"?i:i?.styleId,a=i&&typeof i=="object"?i.styleName:null;s?e.activate({styleId:s,styleName:a}):e.label.value=this.config.texts?.formatText||"Format text"},list:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},numberedlist:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},default:()=>{r?.active?e.activate():e.deactivate()}};return(o[t]??o.default)(),!0}updateToolbarState(){this.#g(),this.#b();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#F(),this.#s().forEach(n=>{const r=n.isCustomToolbarItem&&typeof n.command=="string";(n.allowWithoutEditor?.value||r)&&this.#I(n)})):this.#s().forEach(n=>{n.resetDisabled(),this.#I(n)}),this.getToolbarItemByName("overflow")?.setDisabled(!this.overflowItems.some(n=>n.type!=="separator"&&!n.disabled.value));const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#F(){this.#s().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#x(e,t){const n=this.superdoc;if(e==="watermark"){if(!this.#k(e))return!1;const r=this.ui.watermark.open();if(!r.ok)throw new Error(`[superdoc toolbar] Watermark dialog unavailable: ${r.reason}`);return!0}if(e==="ruler")return typeof n?.toggleRuler=="function"?(n.toggleRuler(),!0):!1;if(e==="formattingMarks"){if(typeof t=="boolean"&&typeof n?.setShowFormattingMarks=="function")return n.setShowFormattingMarks(t),!0;if(typeof n?.toggleFormattingMarks=="function")return n.toggleFormattingMarks(),!0}return!1}#P(e,t){const n=e?.name?.value;if(!n)return!1;const r={firstParty:!0,onSettled:()=>this.updateToolbarState(),onError:i=>this.#v(i,n)};if(n==="image"&&t==null)return this.#D();if(n==="tableActions"){const i=zE[t?.command];return i?Eg(this.ui,i,void 0,r):!1}if(O1(n)?.disposition==="unsupported")return!0;const o=qE(n);return o?Eg(this.ui,o,t,r):!1}#D(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=TD({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await ID(e,this.superdoc?.config?.handleImageUpload);Eg(this.ui,"image",{src:t},{firstParty:!0,onSettled:()=>this.updateToolbarState(),onError:n=>this.#v(n,"image")})},onError:e=>this.#v(e,"image")})),this.#e.open()),!0}#w(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{YE(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!YE(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}RK(i)&&this.ui.formatPainter.setKeyboardSelecting(!0)},o=()=>{this.ui.formatPainter.setKeyboardSelecting(!1),this.ui.formatPainter.notifyKeyUp()};e.addEventListener("pointerdown",t),e.addEventListener("pointerup",n),e.addEventListener("keydown",r),e.addEventListener("keyup",o),this.#n=()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("pointerup",n),e.removeEventListener("keydown",r),e.removeEventListener("keyup",o)}}#y(){this.#n&&(this.#n(),this.#n=null)}#v(e,t){const n={error:e instanceof Error?e:new Error(String(e)),originalError:e,itemName:t??null,editor:this.superdoc?.activeEditor??this.activeEditor??null},r={...n};this.emit("exception",n),this.superdoc?.emit?.("exception",r)}emitCommand({item:e,argument:t,option:n}){const r=e?.name?.value,{command:o}=e,i=t!=null;if(!(e?.type==="dropdown"&&!i&&(o==="setFontFamily"||o==="setFontSize"))){if(r==="search"){this.superdoc?.emit?.("search:open");return}try{if(O1(r)?.disposition==="host-routed"){this.#x(r,t),this.updateToolbarState();return}if(typeof o=="function"){const s=`__builtin_toolbar__${r}`;if(this._customCommandRegs.has(s)&&this.ui?.commands?.execute)this.ui.commands.execute(s,{argument:t,option:n});else{const a=o({item:e,argument:t,option:n,ui:this.ui,superdoc:this.superdoc});a&&typeof a.then=="function"&&Promise.resolve(a).catch(l=>this.#v(l,r))}this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!Eg(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#v(s,r),reportUnhandled:!0}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#P(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#v(s,r)}}}destroy(){this.#y(),this.#e?.destroy(),this.#e=null,this.#a(),this.#o(),this.app?.unmount(),this.app=null,this.toolbar=null}};function PK(e){return new LK(e)}Nt();var DK=['[data-sdt-type="structuredContent"][data-sdt-id]','[data-sdt-type="structuredContent"][data-sdt-container-id]','[data-sdt-container-type="structuredContent"][data-sdt-container-id]'].join(", "),OK=800,XE=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,ZE=e=>{if(!XE)return!1;try{return XE.call(e),!0}catch{return!1}};function FK(e){return e.key==="Alt"||e.key==="Control"||e.key==="Meta"||e.key==="Shift"||(e.ctrlKey||e.metaKey)&&e.shiftKey&&!e.altKey&&(e.code==="Digit8"||e.key==="8"||e.key==="*")?!0:(e.ctrlKey||e.metaKey)&&["b","c","f","i","s","u"].includes(e.key.toLowerCase())}var NK=Object.freeze(["#FF6B6B","#4ECDC4","#45B7D1","#FFA07A","#98D8C8","#F7DC6F","#BB8FCE","#85C1E2","#F1948A","#82E0AA","#F8C471","#AED6F1","#D7BDE2","#A3E4D7","#F0B27A","#AEB6BF","#E74C3C","#2ECC71","#3498DB","#E67E22","#1ABC9C","#9B59B6","#34495E","#F39C12"]),BK=["original","markup","final"],zK=["review","original","final","off"];function QE(e){return BK.includes(e)}function jK(e){return e==="markup"?"review":e}function JE(e){return zK.includes(e)}function VK(e){const t=e.modules?.trackChanges?.mode;if(JE(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return JE(n)?n:null}function Tg(e,t){const n=e.viewing,r=QE(n?.trackedChanges)?n.trackedChanges:null,o=r?jK(r):t||(e.trackChanges?.visible===!0?"review":"original");return{comments:typeof n?.comments=="boolean"?n.comments:e.comments?.visible===!0,renderMode:o,trackChangesVisible:r?r==="markup":e.trackChanges?.visible===!0}}async function UK(e,t){const n=new f6.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function $1(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function eT(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function $K(e,t){if(!e)return()=>{};if($1(e))return t(),()=>{};const n=typeof e.on=="function"?e.on.bind(e):null,r=typeof e.off=="function"?e.off.bind(e):null;if(!n)return t(),()=>{};let o=!1;const i=()=>{o||(o=!0,r?.("synced",a),r?.("sync",l))},s=()=>{o||(i(),t())},a=()=>{eT(e),s()},l=u=>{u!==!1&&(u===!0||$1(e))&&(eT(e),s())};return n("synced",a),n("sync",l),$1(e)&&s(),i}function HK(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(DK));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(Qp.BLOCK_SDT_LABEL)),i=r.getAttribute("data-sdt-container-id")?.trim()||null,s=r.getAttribute("data-sdt-id")?.trim()||null;return o?i??s:s??i}function GK(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function tT(e){if(!e||typeof e.id!="string"||e.kind!=="inline"&&e.kind!=="block"||typeof e.controlType!="string")return null;const t=e.properties?.tag,n=e.properties?.alias;return{id:e.id,controlType:e.controlType,scope:e.kind,...typeof t=="string"&&t?{tag:t}:{},...typeof n=="string"&&n?{alias:n}:{}}}function nT(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function WK(e,t){switch(e.state){case"failed":return"failed";case"degraded":return e.detail==="reconnecting"?"reconnecting":"lost";case"synced":return t?"recovered":"initial";default:return t?"reconnecting":"initial"}}function ni(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function rT(e){return typeof e=="string"&&e.length>0?e:null}function oT(e){return e?ni(e)?rT(e.documentId??e.options?.documentId??null):rT(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function KK(e){if(!e||ni(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function _s(e){if(!e)return null;if(ni(e))return e.fonts??null;const t=KK(e);return t?{getReport:()=>t.getFontReport?.()??[],getMissingFonts:()=>t.getMissingFonts?.()??[],getDocumentFonts:()=>[...new Set((t.getFontReport?.()??[]).map(n=>n.logicalFamily))],getDocumentFontOptions:()=>t.getDocumentFontOptions?.()??[],getFontFamilyOptions:()=>t.getFontFamilyOptions?.()??[],getLastFontsChangedPayload:()=>t.getLastFontsChangedPayload?.()??null,map:n=>t.mapFonts(n),unmap:n=>t.unmapFonts(n),add:n=>t.addFonts(Array.isArray(n)?n:[n]),preload:n=>t.preloadFonts(n)}:null}var xh=class extends av.default{static{this.allowedTypes=[kr,Ra,Mu]}#e;#n;#t;#o;#i;#a;#u;#h;#c;#d;#p;#r;#s;#m;#_;#k;#g;#b;#A;#T;#I;#F;#x;#P;#D;#w;#y;get uiConfig(){return this.#y}#v;get interactionConfig(){return this.#v}#N;get surfacesConfig(){return this.#N}#E;#f;#R;#M;#L;constructor(e){if(super(),this.#e=!1,this.#t=!1,this.#o=null,this.#i=null,this.#a=null,this.#u=null,this.#h=null,this.#c=null,this.#d=!1,this.#p=null,this.#r=null,this.#s=null,this.#m=null,this.#_=!1,this.#k=!1,this.#g=null,this.#b=null,this.#A=!1,this.#T=null,this.#I=null,this.#F=n=>{this.listenerCount("content-control:active-change")>0&&(this.#A||(this.#T=n.pointerId),this.#A=!0,this.#g="pointer",this.#b=null)},this.#x=n=>{n.pointerId===this.#T&&(this.#A=!1,this.#T=null,this.#g??="pointer",this.#g==="pointer"&&(this.#b=Date.now()+OK))},this.#P=n=>{this.listenerCount("content-control:active-change")>0&&!FK(n)&&(this.#g="keyboard",this.#b=null)},this.#D=n=>{this.#X(n)},this.#w=null,this.#y=TE({}),this.#v=xE({}),this.#N=ME({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.#f=new PH,this.#R=null,this.#M=!1,this.#L=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...P1},layoutEngineOptions:{},modules:{},licenseKey:void 0,telemetry:{enabled:!0},title:"SuperDoc",conversations:[],isInternal:!1,comments:{visible:!1},toolbarGroups:["left","center","right"],toolbarIcons:{},toolbarTexts:{},uiDisplayFallbackFont:"Arial, Helvetica, sans-serif",isDev:!1,disablePiniaDevtools:!1,onEditorBeforeCreate:()=>null,onEditorCreate:()=>null,onEditorDestroy:()=>null,onSourceComplete:()=>null,onSourceSignalsComplete:()=>null,onContentError:()=>null,onReady:()=>null,onCommentsUpdate:()=>null,onContentControlActiveChange:()=>null,onContentControlClick:()=>null,onAwarenessUpdate:()=>null,onLocked:()=>null,onPdfDocumentReady:()=>null,onSidebarToggle:()=>null,onCollaborationReady:()=>null,onEditorUpdate:()=>null,onCommentsListChange:()=>null,onException:()=>null,onListDefinitionsChange:()=>null,onPaginationUpdate:()=>null,onTransaction:()=>null,disableContextMenu:!1,viewOptions:{layout:"print"},useLayoutEngine:!0},this.#ne=new WeakSet,this.#re=new WeakMap,this.#oe=null,this.#K=null,this.#j=null,!e.selector)throw new Error("SuperDoc: selector is required");const t=typeof e.selector=="string"?document.querySelector(e.selector):e.selector;if(!(t instanceof HTMLElement))throw new Error("SuperDoc: selector must be a valid CSS selector string or DOM element");this.#n=lx(this,e,()=>this.version,t),this.#E=new rH({getModuleConfig:()=>this.#N}),this.#s=t,t.addEventListener("pointerdown",this.#F,!0),t.ownerDocument.addEventListener("pointerup",this.#x,!0),t.ownerDocument.addEventListener("pointercancel",this.#x,!0),t.addEventListener("keydown",this.#P,!0),t.addEventListener("click",this.#D,!0),this.#l("content-control:active-change",e.onContentControlActiveChange),this.#S(e,t),this.#k=!0,this.listenerCount("content-control:active-change")>0&&this.ui}async#X(e){const t=this.#s;if(!t)return;const n=HK(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=tT(GK(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#S(e,t){this.#L=VK(e),this.config={...this.config,...e,modules:{...this.config.modules,...e.modules},layoutEngineOptions:{...this.config.layoutEngineOptions,...e.layoutEngineOptions}},typeof this.config.viewing?.comments=="boolean"&&(this.config.comments={...this.config.comments,visible:this.config.viewing.comments}),!this.config.comments||typeof this.config.comments!="object"?this.config.comments={visible:!1}:typeof this.config.comments.visible!="boolean"&&(this.config.comments.visible=!1),L1(this.config),this.config.documents=this.config.documents||[],this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};const n=this.config.viewOptions?.layout==="web",r=this.config.layoutEngineOptions?.flowMode==="semantic";if(!n&&r&&(console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'."),this.config.layoutEngineOptions.flowMode="paginated"),this.editorVersion=2,this.#Ue(),this.config.user=mH(this.config.user),this.config.layoutEngineOptions.virtualization||(this.config.layoutEngineOptions.virtualization={enabled:!0,window:5,overscan:1}),this.config.modules=this.config.modules||{},Object.prototype.hasOwnProperty.call(this.config.modules,"comments")||(this.config.modules.comments={}),this.config.modules.comments=pA(this.config.modules.comments),this.#y=TE(this.config),this.#v=xE(this.config),this.#N=ME(this.config),this.config.disableContextMenu=!this.#y.contextMenu.enabled,this.config.rulers=this.#y.ruler.enabled,this.#y.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#y.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&(i.readOnly=this.#v.comments.readOnly,i.allowResolve=this.#v.comments.allowResolve)}if(this.userColorMap=new Map,this.colorIndex=0,this.version="2.23.1-next.4",this.#ie("π¦ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||cl(),this.colors=this.config.colors??[],this.#de(),this.#Z(),await zM(),this.#e)return;if(await this.#ee(this.config.modules),this.#e){this.#Ce();return}this.user=this.config.user,this.users=this.config.users||[],this.socket=null,this.isDev=this.config.isDev||!1,this.activeEditor=null,this.comments=[],this.#R||(this.#R=this.#f.subscribe(i=>{this.#He(i.nextRuntimeId,i.legacyEditorProjection)})),this.isLocked=this.config.isLocked||!1,this.lockedBy=this.config.lockedBy||null;const o=document.createElement("div");o.style.display="contents",t.appendChild(o),this.#r=o,this.#J(),this.#V(),this.#Ge(),this.#O()}#O(){if(this.#Q(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#r)}#V(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new xV({Renderer:eH,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#C("requiredNumberOfEditors").documents.filter(e=>e.type===kr).length}get ui(){return this.#w||(this.#w=LF({superdoc:this}),this.#e&&this.#w.destroy()),this.#U(),this.#w}get diagnostics(){return this.#n}emit(e,...t){return(e==="exception"||e==="document-replaced"||e==="ready"||e==="active-editor-change"||e==="collaboration-ready"||e==="collaboration-connection-change"||e==="locked")&&qd(this,e,()=>t[0]),super.emit(e,...t)}on(e,t,n){return super.on(e,t,n),e==="content-control:active-change"&&this.#k&&this.ui,this}addListener(e,t,n){return super.addListener(e,t,n),e==="content-control:active-change"&&this.#k&&this.ui,this}once(e,t,n){return super.once(e,t,n),e==="content-control:active-change"&&this.#k&&this.ui,this}removeListener(e,t,n,r){return super.removeListener(e,t,n,r),this.#B(),this}off(e,t,n,r){return super.off(e,t,n,r),this.#B(),this}removeAllListeners(e){return super.removeAllListeners(e),this.#B(),this}#B(){this.listenerCount("content-control:active-change")>0||(this.#m?.(),this.#m=null,this.#I=null,this.#g=null,this.#b=null,this.#A=!1,this.#T=null)}#U(){if(this.#m||this.#_||!this.#w||this.#e||this.listenerCount("content-control:active-change")===0)return;let e=null,t=[],n=null,r=null,o=!0;this.#_=!0;try{n=this.#w.selection.observe(s=>{if(o){o=!1;return}if(s.status!=="ready")return;const a=nT(s);if(!a)return;this.#g==="pointer"&&this.#b!==null&&Date.now()>this.#b&&(this.#g=null,this.#b=null);const l=this.#g??(this.#A?"pointer":null),u=this.activeEditor;(l||this.#I?.editor!==u||this.#I.key!==a)&&(this.#I={editor:u,key:a,source:l??"keyboard"}),this.#g=null,this.#b=null}),r=this.#w.contentControls.observeActivePath(s=>{const a=this.activeEditor,l=s.activeIds.map(v=>tT(s.items.find(C=>C.id===v)));if(l.some(v=>v===null))return;const u=l,d=a===e,f=u.length===t.length&&u.every((v,C)=>v.id===t[C]?.id);if(d&&f)return;if(u.length===0&&t.length===0){e=a;return}const p=d?t[0]??null:null;e=a,t=u;const g=nT(this.#w.selection.getSnapshot()),m=this.#I;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:g&&m?.editor===a&&m.key===g?m.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#m=i}catch(i){throw n?.(),r?.(),i}finally{this.#_=!1}}get state(){return{documents:this.#C("state").documents.map(e=>Al(e.data)?{...e,data:vb(e.data,e.type||"application/vnd.openxmlformats-officedocument.wordprocessingml.document")}:e),users:this.users}}getDocumentRuntimeForDocument(e){return typeof e!="string"||e.length===0?null:(this.superdocStore?.documents??[]).find(t=>t?.getEditor?.()?.options?.documentId===e)?.getDocumentRuntime?.()??null}getComment(e){return typeof e!="string"||e.length===0?null:this.commentsStore?.getComment?.(e)??null}get element(){return typeof this.config.selector=="string"?document.querySelector(this.config.selector):this.config.selector}#Z(){const e=this.config.document,t=!!e&&typeof e=="object"&&(Al(e)||typeof Blob=="function"&&e instanceof Blob||Object.keys(e).length>0),n=typeof e=="string"&&e.length>0,r=this.config.documents&&this.config.documents?.length;if((t||n)&&r&&console.warn("π¦ [superdoc] You can only provide one of document or documents"),t){const o=bb(e);this.config.documents=[{id:cl(),...o}]}else n&&(this.config.documents=[{id:cl(),type:kr,url:this.config.document,name:"document.docx"}]);Array.isArray(this.config.documents)&&this.config.documents.length>0&&(this.config.documents=this.config.documents.map(o=>{const i=bb(o);if(!i||typeof i!="object")return i;const s=typeof i=="object"&&"id"in i&&i.id||o&&typeof o=="object"&&"id"in o&&o.id;return{...i,id:s||cl()}}))}#Q(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=gV({disablePiniaDevtools:!!this.config.disablePiniaDevtools});this.app=e,this.pinia=t,this.app.config.globalProperties.$config=this.config,this.app.config.globalProperties.$documentMode=this.config.documentMode,this.app.config.globalProperties.$superdoc=this,this.app.provide("surfaceManager",this.#E),this.superdocStore=n,this.commentsStore=r,this.highContrastModeStore=o,typeof this.superdocStore.setExceptionHandler=="function"&&this.superdocStore.setExceptionHandler(s=>this.emit("exception",s)),this.superdocStore.init(this.config);const i=this.config.modules.comments;this.commentsStore.init(i||{}),this.isCollaborative&&_M(this),this.#le()}#l(e,t){t&&this.on(e,t)}#J(){this.#l("editorBeforeCreate",this.config.onEditorBeforeCreate),this.#l("editorCreate",this.config.onEditorCreate),this.#l("editorDestroy",this.config.onEditorDestroy),this.#l("source:complete",this.config.onSourceComplete),this.#l("source:signals-complete",this.config.onSourceSignalsComplete),this.#l("ready",this.config.onReady),this.#l("comments-update",this.config.onCommentsUpdate),this.#l("content-control:click",this.config.onContentControlClick),this.#l("awareness-update",this.config.onAwarenessUpdate),this.#l("locked",this.config.onLocked),this.#l("pdf:document-ready",this.config.onPdfDocumentReady),this.#l("sidebar-toggle",this.config.onSidebarToggle),this.#l("collaboration-ready",this.config.onCollaborationReady),this.#l("collaboration-connection-change",this.config.onCollaborationConnectionChange),this.on("collaboration-ready",e=>this.#Se(e?.editor??null)),this.#l("editor-update",this.config.onEditorUpdate),this.#l("tracked-changes:bulk-decision",this.config.onTrackedChangesBulkDecision),this.on("content-error",this.onContentError),this.#l("exception",this.config.onException),this.#l("list-definitions-change",this.config.onListDefinitionsChange),this.#l("pagination-update",this.config.onPaginationUpdate),this.#l("fonts-resolved",this.config.onFontsResolved),this.#l("fonts-changed",this.config.onFontsChanged),this.#l("zoomChange",this.config.onZoomChange),this.#l("viewport-change",this.config.onViewportChange),this.#l("page-margins-change",this.config.onPageMarginsChange)}async#ee({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:cl(),type:kr,name:"document.docx"}]),this.config.v2CollaborationPreflightFailure={code:"collaboration-v1-config-unsupported",message:"SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.v2Collaboration with a v2 room instead."},this.config.documents):this.config.documents}#ce(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=Xr(e),this.provider=Xr(t),this.#de();const n=this.config;this._cleanupAwareness=bM(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#ke(){this.#p=null,this.#te(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null),this.isCollaborative=!1,this._commentsCollabInitialized=!1,this.ydoc=void 0,this.provider=void 0;const e=this.config;delete e.modules.collaboration,e.documents.forEach(t=>{delete t.ydoc,delete t.provider})}#te(){if(this.#a){try{this.#a()}catch{}this.#a=null}if(this.#u){try{this.#u()}catch{}this.#u=null}if(this.#h){try{this.#h()}catch{}this.#h=null}}#Se(e){this.#te(),ni(e)&&(this.#Ae(e),this.#Ie(e),this.#_e(e))}#_e(e){const t=e.connection;if(!t||typeof t.subscribe!="function")return;const{documentId:n}=t;this.#c?.documentId!==n&&(this.#c=null,this.#d=!1);const r=o=>{if(this.#e)return;const i=this.#c;if(i&&i.state===o.state&&i.detail===(o.detail??null))return;const s={documentId:n,state:o.state,previousState:i?.state??null,kind:WK(o,this.#d),detail:o.detail??null,superdoc:this};this.#c=s,o.state==="synced"&&(this.#d=!0),this.emit("collaboration-connection-change",s)};try{const o=t.getSnapshot?.();o&&r(o),this.#h=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 connection bridge failed to subscribe",o)}}getCollaborationConnectionState(){return this.#c}#Ae(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=AV(()=>this.user),r=o=>{if(this.#e)return;const i=n.next(o);this.emit("awareness-update",{...i,superdoc:this})};try{const o=t.getSnapshot?.();o&&r(o),this.#a=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#Ie(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#$(!!r.isLocked,this.#ue(r.lockedBy??null))};try{if(this.#p&&typeof t.setLocked=="function"){const o=this.#p;t.setLocked(o.isLocked,o.isLocked?o.lockedBy:null),this.#p=null}const r=t.getSnapshot?.();r&&n(r),this.#u=t.subscribe(n)}catch(r){console.warn("[SuperDoc] v2 lock bridge failed to subscribe",r)}}#ue(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#Ee(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#$(e,t){this.isLocked===e&&this.#Ee(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#ie("π¦ [superdoc] Locking superdoc:",e,t,`
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
`),this.emit("locked",{isLocked:e,lockedBy:t}))}#de(){const e=this.config.user;if(!e||e.color)return;const t=this.colors.length>0?this.colors:NK,n=e.id||e.email||e.name||"";let r=5381;for(let o=0;o<n.length;o++)r=(r<<5)+r^n.charCodeAt(o);e.color=t[Math.abs(r)%t.length]}async upgradeToCollaboration(e){if(this.#o){const{target:r}=this.#pe(e);if(this.#Te(r,this.#o.target))return this.#o.promise;throw Object.assign(new Error("SuperDoc: a different collaboration target is already upgrading"),{code:"collaboration-upgrade-target-conflict"})}const{target:t}=this.#Be(e);this.#t=!0;const n=(async()=>{try{const r=await this.#Ne(),o=this.#Re(),i=this.#xe();this.#Le();try{this.#p=i;const s=await this.#Oe(t,r);this.#Fe(s,t),this.#p=null;const a=this.activeEditor?.options?.documentId,l=s.configDoc.v2Collaboration?.documentId;if(typeof a!="string"||a!==s.configDoc.id||typeof l!="string"||l!==t.documentId)throw new Error("SuperDoc: collaboration upgrade did not attach the expected room and document");return{roomId:l,documentId:a}}catch(s){throw this.#Me(o),s}}finally{this.#i=null,this.#t=!1,this.#o=null}})();return this.#o={target:t,promise:n},n}#Te(e,t){if(e.token!==t.token)return!1;const n=new WeakMap,r=(o,i)=>{if(Object.is(o,i))return!0;if(!o||!i||typeof o!="object"||typeof i!="object"||Object.getPrototypeOf(o)!==Object.getPrototypeOf(i))return!1;if(n.has(o))return n.get(o)===i;if(n.set(o,i),o instanceof Date&&i instanceof Date)return o.getTime()===i.getTime();if(o instanceof RegExp&&i instanceof RegExp)return o.source===i.source&&o.flags===i.flags;if(o instanceof ArrayBuffer&&i instanceof ArrayBuffer)return r(Array.from(new Uint8Array(o)),Array.from(new Uint8Array(i)));if(ArrayBuffer.isView(o)&&ArrayBuffer.isView(i))return o.constructor===i.constructor&&r(Array.from(new Uint8Array(o.buffer,o.byteOffset,o.byteLength)),Array.from(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)));if(o instanceof Map&&i instanceof Map)return o.size===i.size&&r(Array.from(o.entries()),Array.from(i.entries()));if(o instanceof Set&&i instanceof Set)return o.size===i.size&&r(Array.from(o.values()),Array.from(i.values()));if(Array.isArray(o)&&Array.isArray(i))return o.length===i.length&&o.every((l,u)=>r(l,i[u]));if(Object.getPrototypeOf(o)!==Object.prototype&&Object.getPrototypeOf(o)!==null)return!1;const s=Object.keys(o).sort(),a=Object.keys(i).sort();return s.length===a.length&&s.every((l,u)=>l===a[u]&&r(o[l],i[l]))};return r({...e,token:void 0},{...t,token:void 0})}#xe(){return{isLocked:this.isLocked,lockedBy:this.lockedBy?{...this.lockedBy}:null}}#Re(){const e=this.config.documents.find(r=>r.type===kr),t=this.superdocStore?.documents.find(r=>r.id===e.id)??null,n=t?kn(t):null;return{isCollaborative:this.isCollaborative,configV2Collaboration:e.v2Collaboration??null,configData:e.data,storeDoc:t,storeV2Collaboration:this.#De(n),storeData:t?.data}}#Me(e){this.#p=null;const t=this.config.documents.find(n=>n.type===kr);t.v2Collaboration=e.configV2Collaboration,t.data=e.configData,this.isCollaborative=e.isCollaborative,e.storeDoc&&(e.storeDoc.data=e.storeData,this.#G(e.storeDoc,e.storeV2Collaboration))}#Le(){if(this.#e)throw new Error("SuperDoc: instance was destroyed during upgrade")}#C(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`);return this.superdocStore}#Ke(e){if(!this.commentsStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`);return this.commentsStore}#H(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`)}#Pe(e,t){const n=this.superdocStore?.documents;if(Array.isArray(n))for(const r of n){const o=kn(r);o.ydoc&&typeof o.ydoc=="object"&&"value"in o.ydoc&&(o.ydoc.value=e),o.provider&&typeof o.provider=="object"&&"value"in o.provider&&(o.provider.value=t)}}#De(e){if(!e)return null;const t=e.v2Collaboration;return t&&typeof t=="object"&&"value"in t?t.value:t??null}#G(e,t){const n=kn(e).v2Collaboration;if(n&&typeof n=="object"&&"value"in n){n.value=t;return}e.v2Collaboration=t}#fe(e){const t=e.syncTimeoutMs===void 0?{}:{syncTimeoutMs:e.syncTimeoutMs};return e.providerFamily==="extension"?{providerType:"extension",adapterId:e.adapterId,documentId:e.documentId,roomMode:e.roomMode,...t,...e.providerOptions!==void 0?{providerOptions:e.providerOptions}:{},...e.token?{token:e.token}:{}}:e.providerFamily==="liveblocks"?{providerType:"liveblocks",documentId:e.documentId,roomMode:e.roomMode,...t,...e.publicApiKey?{publicApiKey:e.publicApiKey}:{},...e.authEndpoint?{authEndpoint:e.authEndpoint}:{}}:e.providerFamily==="hocuspocus"?{providerType:"hocuspocus",documentId:e.documentId,roomMode:e.roomMode,...t,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{},...e.token?{token:e.token}:{}}:{providerType:"y-websocket",documentId:e.documentId,roomMode:e.roomMode,...t,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{}}}async#Oe(e,t){const n=this.config.documents.find(s=>s.type===kr),r=this.#C("upgradeToCollaboration").documents.find(s=>s.id===n.id);if(!r)throw new Error("SuperDoc: source document store entry is not available for upgrade");const o=r.getEditor?.();if(!ni(o)||typeof o.upgradeToCollaboration!="function")throw new Error("SuperDoc: live v2 editor cannot attach collaboration in place");const i=this.#fe({...e,roomMode:"create"});return n.v2Collaboration=i,this.#G(r,i),this.isCollaborative=!0,await o.upgradeToCollaboration(t,i),n.data=t,r.data=t,{configDoc:n,storeDoc:r}}#Fe(e,t){const n=this.#fe({...t,roomMode:"join"});e.configDoc.v2Collaboration=n,this.#G(e.storeDoc,n)}async#Ne(){const e=this.activeEditor;if(ni(e)&&typeof e.save=="function"){const r=await e.save();return this.#z(r)}const t=this.config.documents.find(r=>r.type===kr),n=(this.superdocStore?.documents.find(r=>r.id===t.id)??null)?.data??t.data;if(n instanceof Blob)return n;if(Al(n))return this.#z(n);throw new Error("SuperDoc: upgradeToCollaboration() requires a live v2 editor save or DOCX Blob source")}#z(e){if(e instanceof Blob)return e;if(Al(e))return vb(e,kr);throw new Error("SuperDoc: active v2 editor returned an unsupported DOCX save payload")}#he(e,t){const n=oT(e),r=(n?this.config.documents.find(a=>a.id===n):null)??this.config.documents.find(a=>a.type==="application/vnd.openxmlformats-officedocument.wordprocessingml.document");if(!r)return;const o=this.#z(t),i=r.v2Collaboration&&typeof r.v2Collaboration=="object"&&r.v2Collaboration.roomMode==="create"?{...r.v2Collaboration,roomMode:"join"}:null;r.data=o,r.fieldContext={},i&&(r.v2Collaboration=i);const s=this.superdocStore?.documents.find(a=>a.id===r.id)??null;s&&(s.data=o,s.fieldContext={},i&&this.#G(s,i))}#qe(){const e=this.superdocStore?.documents;if(!e?.length)throw new Error("SuperDoc: no store documents available for upgrade");const t=e[0].getDocumentRuntime?.()||e[0].getEditor?.();if(!t?.attachCollaboration)throw new Error("SuperDoc: editor does not support attachCollaboration");return t}#Ye(){this.#ke(),this.#Pe(null,null)}#Xe(e){const n=e.editor??e;return n.options?.collaborationIsReady?Promise.resolve():new Promise(r=>{let o=!1;const i=()=>{o||(o=!0,clearTimeout(s),typeof n.off=="function"&&n.off("collaborationReady",a))},s=setTimeout(()=>{i(),console.warn("[SuperDoc] collaborationReady did not fire within 10 s after collaboration attach. Continuing β collaboration is active but cursor/presence setup may be delayed."),r(void 0)},1e4),a=()=>{i(),r(void 0)};this.#i=()=>{i(),r(void 0)},typeof n.on=="function"?n.on("collaborationReady",a):(i(),r(void 0))})}#Ze(e){return new Promise((n,r)=>{let o,i=!1,s=()=>{};const a=()=>{i=!0,clearTimeout(o),s()};s=$K(e,()=>{i||(a(),n())}),i||(o=setTimeout(()=>{a(),r(new Error("SuperDoc: collaboration provider did not sync within 10000 ms. The provider exposes on/off but never emitted sync(true) or synced."))},1e4)),this.#i=()=>{i||(a(),r(new Error("SuperDoc: instance was destroyed during upgrade")))}})}#Be(e){if(this.#e)throw new Error("SuperDoc: cannot upgrade a destroyed instance");if(this.#t)throw new Error("SuperDoc: upgrade already in progress");if(this.isCollaborative)throw new Error("SuperDoc: instance is already collaborative");const t=this.config,n=t.documents.filter(o=>o.type===kr);if(n.length===0)throw new Error("SuperDoc: no DOCX document found for upgrade");if(n.length>1)throw new Error("SuperDoc: upgradeToCollaboration() only supports a single DOCX document");if(t.documents.length!==n.length)throw new Error("SuperDoc: upgradeToCollaboration() only supports single-DOCX instances");if(!ni(this.#je()))throw new Error("SuperDoc: upgradeToCollaboration() requires a ready v2 DOCX editor");const r=n[0].id;if(typeof r!="string"||r.length===0)throw new Error("SuperDoc: source document is missing its mounted document identity");return this.#pe(e)}#pe(e){const t=this.config,n=t.documents.find(a=>a.type===kr),r=t.modules?.collaboration,o=e.ydoc||e.provider?{ydoc:e.ydoc,provider:e.provider}:r?{...r}:null,i=e.v2Collaboration??this.#ze(n.v2Collaboration)??r?.v2Collaboration??r?.v2??null,s=t3({collaboration:e.collaboration,v2Collaboration:i,legacyCollaboration:o,documentType:kr,documentCount:t.documents.length,...typeof window<"u"?{authEndpointBaseUrl:window.location.href}:{}});if(!s.ok)throw new Error(`SuperDoc: upgradeToCollaboration() ${s.reason}: ${s.message}`);return{target:{...s.target,roomMode:"create"}}}#ze(e){return e&&typeof e=="object"&&"value"in e?e.value:e}#je(){const e=this.config.documents.find(n=>n.type===kr),t=this.#C("upgradeToCollaboration").documents.find(n=>n.id===e.id)?.getEditor?.();if(!t)throw new Error("SuperDoc: source editor not yet created β wait for the ready event before upgrading");return t}addSharedUser(e){this.#H("addSharedUser");const t=Lu({actor:e});t&&this.users.some(n=>Lu({actor:n})===t)||this.users.push(e)}removeSharedUser(e){this.#H("removeSharedUser");const t=typeof e=="string"?ab(e):"",n=typeof e=="string"?`email:${t}`:Lu({actor:e});this.users=this.users.filter(r=>{const o=Lu({actor:r});return n?o!==n:t?ab(r.email)!==t:!0})}onContentError({error:e,editor:t}){const n=t.options?.documentId,r=this.#C("onContentError").documents.find(a=>a.id===n),o=typeof r?.id=="string"?r.id:typeof n=="string"?n:"",i=r?.data,s=ZE(i)?i:Al(i)?this.#z(i):i==null?i:void 0;this.config.onContentError?.({error:e,editor:t,documentId:o,file:s})}broadcastPdfDocumentReady(){this.emit("pdf:document-ready")}broadcastReady(){this.readyEditors===this.requiredNumberOfEditors&&this.emit("ready",{superdoc:this})}broadcastEditorBeforeCreate(e){this.emit("editorBeforeCreate",{editor:pE(e)})}broadcastEditorCreate(e){this.readyEditors++,this.broadcastReady(),this.#Ve(e),this.emit("editorCreate",{editor:pE(e)})}broadcastSourceComplete(){this.emit("source:complete")}broadcastSourceSignalsComplete(){this.emit("source:signals-complete")}#ne;#re;#Ve(e){if(!e||typeof e.on!="function"||this.#ne.has(e))return;this.#ne.add(e),e.on("fonts-changed",n=>{this.#me(e)&&this.#W(e,n)});const t=(e.documentRenderer??e.presentationEditor)?.getLastFontsChangedPayload?.();t&&this.#me(e)&&this.#W(e,t)}#me(e){return!this.activeEditor||e===this.activeEditor}#oe;#W(e,t){if(this.#oe=t,e.editorVersion===2){let n=this.#re.get(e);n||(n=new Set,this.#re.set(e,n)),LH(t.missingFonts,n)}this.emit("fonts-changed",t)}broadcastEditorDestroy(){this.emit("editorDestroy")}broadcastSidebarToggle(e){this.emit("sidebar-toggle",e)}#Ue(){Array.isArray(this.config.editorExtensions)&&this.config.editorExtensions.length>0&&console.warn("[SuperDoc] `editorExtensions` is ignored by superdoc@2. Use `extensions` with `defineSuperDocExtension`. ProseMirror APIs such as `Node.create`, `Mark.create`, `addPmPlugins`, and custom schemas do not run in v2."),this.config.modules.ai&&console.warn("[SuperDoc] `modules.ai` is deprecated and will be removed in v3. Use `ui.toolbar.customItems` for the action, make the model request in your application, and apply the result with `doc.insert()` or `doc.replace()`.")}#ie(...e){(console.debug?console.debug:console.log)("π¦ π¦ΈββοΈ [superdoc]",...e)}#K;get fonts(){return this.#K||(this.#K={getReport:()=>_s(this.activeEditor)?.getReport()??[],getMissingFonts:()=>_s(this.activeEditor)?.getMissingFonts()??[],getDocumentFontOptions:()=>_s(this.activeEditor)?.getDocumentFontOptions()??[],getFontFamilyOptions:()=>_s(this.activeEditor)?.getFontFamilyOptions()??[],getDocumentFonts:()=>_s(this.activeEditor)?.getDocumentFonts()??[],onReport:e=>{const t=this.activeEditor,n=t?_s(t)?.getLastFontsChangedPayload?.()??null:this.#oe??null;return n&&e(n),this.on("fonts-changed",e),()=>this.off("fonts-changed",e)},map:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new TypeError("superdoc.fonts.map requires a mapping object, for example { Aptos: 'Carlito' }");const t=_s(this.activeEditor);if(!t)throw new Error("superdoc.fonts.map requires an active editor");t.map(e)},unmap:e=>{const t=_s(this.activeEditor);if(!t)throw new Error("superdoc.fonts.unmap requires an active editor");t.unmap(e)},add:e=>{const t=_s(this.activeEditor);if(!t)throw new Error("superdoc.fonts.add requires an active editor");t.add(e)},preload:e=>{const t=_s(this.activeEditor);if(!t)throw new Error("superdoc.fonts.preload requires an active editor");return t.preload(e)}}),this.#K}#q(){const e=this.activeEditor!==null;this.#ge(),this.activeEditor=null,this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null),e&&this.emit("active-editor-change")}#j;#ge(){if(this.#j){try{this.#j()}catch{}this.#j=null}}#$e(e){this.#ge();const t=_s(e);if(!e||!t?.onChanged)return;const n=t.getLastFontsChangedPayload?.();n&&this.#W(e,n),this.#j=t.onChanged(r=>this.#W(e,r))}#He(e,t){this.#M=!0;try{if(e===null){this.#q();return}this.#f.get(e)?.kind==="v2"&&ni(t)?this.#ve(t):this.#q()}finally{this.#M=!1}}#ve(e){if(ni(e)){!this.#M&&this.#f.getActive()&&this.#f.setActive(null,"set-active-v2-facade");const t=this.activeEditor;this.activeEditor=e,this.#$e(e),this.toolbar?.setActiveEditor?.(e),t!==this.activeEditor&&this.emit("active-editor-change");return}this.#q()}setActiveEditor(e){this.#ve(e)}getV2FeatureMatrix(){return[{feature:"source.docx-bytes",status:"supported",reason:"SuperDoc normalizes File/Blob/ArrayBuffer/Uint8Array DOCX inputs for the separate DOCX Engine dependency"},{feature:"source.url",status:"supported",reason:"shell-owned source normalization resolves URL-backed DOCX inputs before opening the injected v2 editor"},{feature:"source.blank",status:"supported",reason:"shell-owned blank-document seeding resolves to DOCX bytes before mounting the injected v2 editor"},{feature:"execution.browser-worker",status:"supported",reason:"the shipped public v2 shell opens DOCX documents through the browser-worker path by default when collaboration is not active"},{feature:"distribution.cdn-iife",status:"supported",reason:"the CDN/IIFE distribution ships the public bundle plus the emitted v2 browser-worker asset and opens DOCX documents through the worker-backed v2 runtime"},{feature:"docx.open-render",status:"supported",reason:"superdoc@2 opens and renders DOCX documents through its DOCX Engine dependency"},{feature:"docx.review-handles",status:"supported",reason:"Comment/tracked-change list + decide via v2 host handles"},{feature:"shell.toolbar",status:"supported",reason:"new SuperDoc({ toolbar }) mounts the rendered built-in toolbar shell and the superdoc.toolbar handle, both backed by the V2 command controller and the internal compatibility catalog. Explicit item-level limits stay fail-closed in the shared command matrix (for example search replace and copyFormat)."},{feature:"shell.rich-formatting",status:"supported",reason:"Rich inline, paragraph, and list formatting route through the V2 command controller and public Document API (format.* / styles.* / lists.*): bold, italic, underline, strikethrough, font family/size, text/highlight color, alignment, line spacing, linked styles, bullet/numbered lists, indent, and clear formatting."},{feature:"shell.comments-sidebar",status:"supported",reason:"ui-phase3-002: v2 comments adapter routes create/reply/edit/resolve/delete through V2EditorHost.dispatch"},{feature:"shell.comments-sidebar.reopen",status:"supported",reason:'ui-phase3-002: v2 comments sidebar reopens resolved threads through the v2 comments adapter (activeEditor.doc.comments.patch({ status: "active" }))'},{feature:"shell.tracked-change-sidebar",status:"supported",reason:"SD-3722: v2 tracked-change adapter lists and decides exact body, header/footer-part, and note targets"},{feature:"shell.tracked-change-sidebar.bulk",status:"supported",reason:"SD-4039/SD-4040: the shipped v2 command posture exposes all-story Accept All and Reject All through the canonical doc.trackChanges.decide({ target: { kind: 'all' } }) mutation"},{feature:"shell.tracked-change-sidebar.non-body",status:"supported",reason:"SD-3722: public v2 shell hydrates and targets header/footer-part and note tracked changes"},{feature:"shell.comments-sidebar.persistence",status:"supported",reason:"ui-phase3-004: comment create/reply/edit/resolve/delete persist through SuperDoc.export() β re-mount via the v2 host save bridge"},{feature:"shell.tracked-change-sidebar.persistence",status:"supported",reason:"ui-phase3-004: tracked-change accept/reject persist through SuperDoc.export() β re-mount via the v2 host save bridge"},{feature:"shell.comments-sidebar.author-required",status:"supported",reason:"ui-phase3-004: v2 comments adapter surfaces commentCommandsReason=author-required from the host capability matrix; write controls disable and forced dispatch reports ok:false"},{feature:"shell.find-replace",status:"supported",reason:"Ctrl/Cmd+F opens the SuperDoc find/replace surface in v2; find/navigation/replace/replaceAll route through the single host search session (host.search) via ui.search, with replace failing closed in viewing/read-only mode"},{feature:"shell.ai-writer",status:"supported",reason:"built-in toolbar renders the modules.ai-gated AI writer and applies generated text through the public Document API facade"},{feature:"shell.collaboration",status:"supported",reason:"v2 single-doc collaboration (hocuspocus, y-websocket, liveblocks, and registered provider extensions) is wired through document.collaboration, including collaboration-ready, awareness-update, and locked event bridges; external { ydoc, provider } instances remain unsupported"},{feature:"shell.context-menu",status:"supported",reason:"v2 renders the built-in right-click and slash context menu, forwards ui.contextMenu custom items, and honors ui.contextMenu: false for application-owned replacements"},{feature:"shell.page-metrics",status:"supported",reason:"ui-phase4-001: v2 page metrics snapshot (editorVersion: 2, documentId, renderEpoch, layoutGeneration, zoom, pages[], capabilities) available via superdoc.activeEditor.pageMetrics.{ getSnapshot, subscribe, setZoom, scrollToPage, revealBodyTarget, pageIndexForBodyTarget }"},{feature:"shell.zoom",status:"supported",reason:"ui-phase4-001: SuperDoc.setZoom routes to V2EditorHost.setZoom in v2 mode; single CSS-transform wrapper applies scale to the painted document, page metrics viewport coords scale with the same zoom value"},{feature:"shell.ruler-page-margins",status:"supported",reason:"ui-phase4-002: v2 ruler renders against the V2PageMetricsSnapshot and dispatches margin drags through a narrow v2 page-layout bridge (`activeEditor.pageLayout.setMargins(...)`) backed by `doc.sections.setPageMargins(...)`. The v2 page metrics snapshot now reports `capabilities.marginEdit = { supported: true }`"},{feature:"shell.custom-extensions",status:"supported",reason:"superdoc@2 supports customer extensions through `extensions` + `defineSuperDocExtension`; command execution and diagnostics are exposed through the narrow `activeEditor.extensions` facet. Legacy ProseMirror `editorExtensions` are ignored in v2."},{feature:"pdf.viewer",status:"supported",reason:"editorVersion ignored for PDF documents"},{feature:"html.viewer",status:"supported",reason:"editorVersion ignored for HTML documents"}]}get v2(){return this.editorVersion!==2?null:{version:2,featureMatrix:this.getV2FeatureMatrix()}}registerEditorRuntime(e){this.#f.register(e);const t=this.config.layoutEngineOptions?.showFormattingMarks;typeof t=="boolean"&&e.setShowFormattingMarks(t)}unregisterEditorRuntime(e){return this.#f.unregister(e)}getActiveRuntime(){return this.#f.getActive()}setActiveRuntime(e,t){this.#f.setActive(e,t)}resolveRuntimeFromEventTarget(e){return this.#f.resolveFromEventTarget(e)}activateRuntimeFromEventTarget(e,t){const n=this.#f.resolveFromEventTarget(e);return n?(this.#f.setActive(n.id,t),!0):!1}toggleRuler(){const e=this.#C("toggleRuler");this.config.rulers=!this.config.rulers,e.documents.forEach(t=>{t.rulers=this.config.rulers}),this.toolbar?.updateToolbarState?.()}canPerformPermission({permission:e,role:t=this.config.role,isInternal:n=this.config.isInternal,comment:r=null,trackedChange:o=null}={}){if(!e)return!1;let i=r??o?.comment??null;const s=o?.commentId||o?.id;if(!i&&s&&this.commentsStore?.getComment){const a=this.commentsStore.getComment(s),l=a?.getValues;i=typeof l=="function"?l.call(a):a}return za(e,t,n,{superdoc:this,currentUser:this.config.user,comment:i??null,trackedChange:o??null})}#Ge(){const e=this.config.modules?.toolbar,t=e&&typeof e=="object"?e:{},n=this.#y.toolbar;this.toolbarElement=n.container??void 0;const r=this.config.ui,o=typeof r=="object"&&r!==null&&r.toolbar!==void 0;if(!(n.enabled&&(n.container||e===!0||e!=null&&typeof e=="object"||o))){this.toolbar=null;return}try{this.toolbar=PK({...t,...n.options,selector:this.toolbarElement,superdoc:this,editor:this.activeEditor,role:this.config.role,isDev:this.isDev,documentMode:this.config.documentMode,groups:n.options.groups,toolbarGroups:n.options.toolbarGroups,icons:n.options.icons,texts:n.options.texts,uiDisplayFallbackFont:this.config.uiDisplayFallbackFont})}catch(i){console.warn("[SuperDoc] built-in toolbar mount failed",i),this.toolbar=null}}addCommentsList(e){!this.config?.modules?.comments||this.config.role==="viewer"||(this.commentsList?.close(),e&&(this.config.modules.comments.element=e),this.commentsList=new gD(this.config.modules?.comments,this),this.config.onCommentsListChange&&this.config.onCommentsListChange({isRendered:!0}),this.emit("comments-list-change",{isRendered:!0}))}removeCommentsList(){this.commentsList&&(this.commentsList.close(),this.commentsList=null,this.config.onCommentsListChange&&this.config.onCommentsListChange({isRendered:!1}),this.emit("comments-list-change",{isRendered:!1}))}scrollToComment(e,t={}){if(!this.config?.modules?.comments||!e||typeof e!="string")return!1;const n=this.element||document,r=globalThis.CSS?.escape?globalThis.CSS.escape(e):e.replace(/"/g,'\\"'),o=n.querySelector(`[data-comment-ids*="${r}"]`);if(!o)return!1;const{behavior:i="smooth",block:s="start"}=t??{};return o.scrollIntoView({behavior:i,block:s}),this.commentsStore?.setActiveComment?.(this,e),!0}async navigateTo(e){const t=this.superdocStore?.documents;if(!t?.length)return!1;const n=t[0].getDocumentRuntime?.();return n?.navigateTo?n.navigateTo(e):!1}async scrollToElement(e){const t=this.superdocStore?.documents;if(!t?.length)return!1;const n=t[0].getDocumentRuntime?.();return n?.scrollToElement?n.scrollToElement(e):!1}setDisableContextMenu(e=!0){if(!e&&this.#y.contextMenu.suppressed)return;const t=!!e;this.config.disableContextMenu!==t&&(this.config.disableContextMenu=t,this.superdocStore?.documents?.forEach(n=>{const r=n.getDocumentRuntime?.();r?.setContextMenuDisabled&&r.setContextMenuDisabled(t);const o=n.getEditor?.();o?.setOptions&&o.setOptions({disableContextMenu:t})}))}setShowBookmarks(e=!0){const t=!!e,n=this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};n.showBookmarks!==t&&(n.showBookmarks=t,this.superdocStore?.documents?.forEach(r=>{r.getDocumentRuntime?.()?.setShowBookmarks?.(t)}))}setShowFormattingMarks(e=!0){const t=!!e,n=this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};n.showFormattingMarks!==t&&(n.showFormattingMarks=t,this.superdocStore?.documents?.forEach(r=>{const o=typeof r.id=="string"?this.#f.getAllByDocumentId(r.id):[];if(o.length){for(const i of o)i.setShowFormattingMarks(t);return}r.getDocumentRuntime?.()?.setShowFormattingMarks?.(t)}),this.emit("formatting-marks-change",{showFormattingMarks:t,superdoc:this}),this.toolbar?.updateToolbarState?.())}toggleFormattingMarks(){const e=!!this.config.layoutEngineOptions?.showFormattingMarks;this.setShowFormattingMarks(!e)}setDocumentMode(e){if(!e)return;this.#H("setDocumentMode");const t=e.toLowerCase(),n=this.config.role==="viewer"?"viewing":this.config.role==="suggester"&&t==="editing"?"suggesting":t;this.config.documentMode=n,L1(this.config),this.#le();const r={viewing:()=>this.#ae(),editing:()=>this.#We(),suggesting:()=>this.#be()};r[n]&&(r[n](),this.emit("document-mode-change",{documentMode:n}))}#se(e,t){const n=typeof e.id=="string"&&e.id.length>0?e.id:null;if(n){const i=this.#f.getAllByDocumentId(n);if(i.length>0){for(const s of i)s.setDocumentMode(t);return}}const r=typeof e.getDocumentRuntime=="function"?e.getDocumentRuntime():null;if(typeof r?.setDocumentMode=="function"){r.setDocumentMode(t);return}const o=typeof e.getEditor=="function"?e.getEditor():null;o&&typeof o.setDocumentMode=="function"&&o.setDocumentMode(t)}setTrackedChangesPreferences(e){typeof e?.enabled=="boolean"&&(this.config.trackChanges={...this.config.trackChanges,enabled:e.enabled},this.config.modules.trackChanges={...this.config.modules.trackChanges,enabled:e.enabled}),this.#Y(e)}#ye(){return typeof this.config.trackChanges?.enabled=="boolean"?this.config.trackChanges.enabled:typeof this.config.modules?.trackChanges?.enabled=="boolean"?this.config.modules.trackChanges.enabled:!0}#Y(e){const t=e&&Object.keys(e).length?{...e}:void 0;this.config.layoutEngineOptions||(this.config.layoutEngineOptions={}),this.config.layoutEngineOptions.trackedChanges=t,this.superdocStore?.documents?.forEach(n=>{let r=!1;const o=typeof n.id=="string"&&n.id.length>0?n.id:null;if(o)for(const s of this.#f.getAllByDocumentId(o))s.setTrackedChangesRenderOptions(t),r=!0;if(r)return;const i=typeof n.getDocumentRuntime=="function"?n.getDocumentRuntime():null;i?.setTrackedChangesOverrides&&i.setTrackedChangesOverrides(t)})}setViewingOptions(e){if(!e||typeof e!="object")return;this.#H("setViewingOptions");const t=Tg(this.config,this.#L),n={...this.config.viewing},r=typeof e.comments=="boolean",o=QE(e.trackedChanges);if(!(!r&&!o)&&(r&&(n.comments=e.comments),o&&(n.trackedChanges=e.trackedChanges),this.config.viewing=n,typeof n.comments=="boolean"&&(this.config.comments={...this.config.comments,visible:n.comments}),o&&L1(this.config),this.#le(),this.config.documentMode==="viewing")){const i=Tg(this.config,this.#L),s=t.comments||t.trackChangesVisible,a=i.comments||i.trackChangesVisible;this.#ae({updateTrackedChangesProjection:o,updateCommentVisibility:s!==a})}}#We(){if(this.config.role!=="editor")return this.#be();const e=this.#C("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#Y({mode:"review",enabled:this.#ye()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#se(t,"editing")})}#be(){if(!["editor","suggester"].includes(this.config.role??""))return this.#ae();const e=this.#C("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#Y({mode:"review",enabled:this.#ye()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#se(t,"suggesting")})}#ae(e={}){const t=this.#C("setDocumentMode");this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null);const n=Tg(this.config,this.#L),r=n.comments,o=n.trackChangesVisible;e.updateTrackedChangesProjection!==!1&&this.#Y({mode:n.renderMode,enabled:this.config.modules.trackChanges?.enabled??!0}),e.updateCommentVisibility!==!1&&!r&&!o&&this.commentsStore?.clearEditorCommentPositions?.(),t.documents.forEach(i=>{e.updateCommentVisibility!==!1&&(r||o?i.restoreComments?.():i.removeComments?.()),this.#se(i,"viewing")})}#le(){const e=Tg(this.config,this.#L),t=e.comments,n=e.trackChangesVisible,r=this.config.documentMode==="viewing",o=t||n;this.commentsStore?.setViewingVisibility&&this.commentsStore.setViewingVisibility({documentMode:this.config.documentMode,commentsVisible:t,trackChangesVisible:n});const i=this.superdocStore?.documents;Array.isArray(i)&&i.length>0&&i.forEach(s=>{const a=typeof s.getDocumentRuntime=="function"?s.getDocumentRuntime():null;a?.setViewingCommentOptions&&a.setViewingCommentOptions({emitCommentPositionsInViewing:r&&o,enableCommentsInViewing:r&&t})})}search(e){const t=this.activeEditor?.commands,n=t?.search;if(typeof n=="function")return n.call(t,e,{searchModel:"visible"})}goToSearchResult(e){const t=this.activeEditor?.commands,n=t?.goToSearchResult;if(typeof n=="function")return!!n.call(t,e)}getZoom(){return this.superdocStore?.activeZoom??100}setZoom(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0){console.warn("[SuperDoc] setZoom expects a positive number representing percentage");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoom called before initialization; use config.zoom.initial for the starting zoom");return}this.superdocStore.activeZoom=e,this.superdocStore.zoomMode="manual",this.emit("zoomChange",{zoom:e,mode:"manual"})}setZoomMode(e){if(e!=="manual"&&e!=="fit-width"){console.warn("[SuperDoc] setZoomMode expects 'manual' or 'fit-width'");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoomMode called before initialization; use config.zoom.mode for the starting mode");return}if(this.superdocStore.zoomMode!==e){if(this.superdocStore.zoomMode=e,e==="fit-width"){const t=this.superdocStore.viewportMetrics;if(t){const n=k_(t.availableWidth,t.documentWidth,L0(this.config.zoom?.fitWidth));n!==null&&(this.superdocStore.activeZoom=n)}}this.emit("zoomChange",{zoom:this.getZoom(),mode:e})}}getZoomState(){const e=L0(this.config.zoom?.fitWidth);return{mode:this.superdocStore?.zoomMode??"manual",value:this.superdocStore?.activeZoom??100,fitZoom:this.superdocStore?.viewportMetrics?.fitZoom??null,min:e.min,max:e.max}}getViewportMetrics(){return this.superdocStore?.viewportMetrics??null}getMeasurementUnit(){return this.superdocStore?.measurementUnit??"in"}setMeasurementUnit(e){if(e!=="in"&&e!=="cm"){console.warn("[SuperDoc] setMeasurementUnit expects 'in' or 'cm'");return}if(!this.superdocStore){console.warn("[SuperDoc] setMeasurementUnit called before initialization; use config.measurementUnit for the starting unit");return}this.superdocStore.measurementUnit!==e&&(this.superdocStore.measurementUnit=e,this.emit("measurement-unit-change",{unit:e}))}setLocked(e=!0){const t=this.activeEditor;if(ni(t)&&typeof t.lock?.setLocked=="function"){t.lock.setLocked(e,e?{...this.user}:null);const n=t.lock.getSnapshot?.();n&&this.#$(!!n.isLocked,this.#ue(n.lockedBy??null));return}this.config.documents.forEach(n=>{const r=n.ydoc;if(!r)return;const o=r.getMap("meta");r.transact(()=>{o.set("locked",e),e?o.set("lockedBy",this.user):o.delete("lockedBy")})}),this.#$(e,e?this.user:null)}getHTML(e={}){const t=[];return this.#C("getHTML").documents.forEach(n=>{const r=n.getEditor?.();r&&t.push(r)}),t.map(n=>n.getHTML(e))}lockSuperdoc(e=!1,t=null){this.#$(e,t)}async export({exportType:e=["docx"],commentsType:t="external",exportedName:n,additionalFiles:r=[],additionalFileNames:o=[],isFinalDoc:i=!1,triggerDownload:s=!0,fieldsHighlightColor:a=null}={}){if(!Array.isArray(e)||e.length!==1||e[0]!=="docx")throw new TypeError('SuperDoc.export() only supports exportType: ["docx"].');const l=nI(n||this.config.title),u=await this.exportEditorsToDOCX({commentsType:t,isFinalDoc:i,fieldsHighlightColor:a}),d=[...r],f=[...o];if(e.includes("docx")&&u.forEach(g=>{d.push(g),f.push(`${l}.docx`)}),d.length===1)return s?tI(d[0],l,e[0]):d[0];const p=await UK(d,f);return s?tI(p,l,"zip"):p}async replaceFile(e){return(await this.#we(e)).raw}async replaceDocument(e){const{raw:t,confirmed:n}=await this.#we(e);if(n)return{ok:!0};const r={ok:!1};return t&&typeof t=="object"&&("reason"in t&&typeof t.reason=="string"&&(r.reason=t.reason),"detail"in t&&typeof t.detail=="string"&&(r.detail=t.detail)),r}async#we(e){const t=this.activeEditor;if(ni(t)&&typeof t.replaceFile=="function"){const r=await t.replaceFile(e),o=r&&typeof r=="object"?r.state:null,i=o===null||o==="review-ready"||o==="editing-ready";return i&&(this.#he(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),{raw:r,confirmed:i}}const n=t&&!ni(t)?t.replaceFile:null;if(typeof n=="function"){const r=await n.call(t,e),o=r&&typeof r=="object"?r.state:void 0,i=o==null||o==="review-ready"||o==="editing-ready";return i&&(this.#he(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),{raw:r,confirmed:i}}throw new Error("SuperDoc: replaceFile is unavailable for the active editor")}async exportEditorsToDOCX({commentsType:e,isFinalDoc:t,fieldsHighlightColor:n}={}){const r=this.config?.modules?.comments!==!1;let o,i=!1;const s=()=>(i||(i=!0,e==="clean"?o=[]:r&&this.commentsStore&&typeof this.commentsStore.translateCommentsForExport=="function"&&(o=this.commentsStore.translateCommentsForExport(),Array.isArray(o)||(o=[]))),o),a=new WeakSet,l=u=>{"editor"in u&&u.error&&typeof u.error=="object"&&a.add(u.error)};this.on("exception",l);try{const u=this.#C("exportEditorsToDOCX").documents.map(async d=>{if(!d||d.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return null;const f=typeof d.getEditor=="function"?d.getEditor():null,p=()=>ZE(d.data)?d.data.type&&d.data.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?null:d.data:Al(d.data)?this.#z(d.data):null;if(!f||typeof f.exportDocx!="function")return p();const g=f.editorVersion===2;try{const m=await f.exportDocx(g?{isFinalDoc:t,commentsType:e,fieldsHighlightColor:n}:{isFinalDoc:t,comments:s(),commentsType:e,fieldsHighlightColor:n});if(m)return m}catch(m){if((!m||typeof m!="object"||!a.has(m))&&(this.emit("exception",{error:m,document:d}),this.emit("exception",Ij(m,{documentId:d.id,editor:null}))),g)throw m}return p()});return(await Promise.all(u)).filter(d=>d!=null)}finally{this.off("exception",l)}}async save(){const e=this.#C("save").documents;await Promise.all(e.map(async t=>{if(t.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return;const n=t.getEditor?.();if(!ni(n)||typeof n.save!="function")throw new Error(`SuperDoc: save is unavailable for document "${t.id}"`);await n.save()}))}#Ce(){this.#p=null,this.#te(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null);const e=this.config;e.socket?.cancelWebsocketRetry?.(),e.socket?.disconnect(),e.socket?.destroy(),this.ydoc?.destroy(),this.provider?.disconnect?.(),this.provider?.destroy?.()}openSurface(e){return this.#E.open(e)}closeSurface(e){this.#E.close(e)}async removeDocument(e){const t=typeof e=="string"?e:String(e??"");if(!t)return!1;const n=this.#C("removeDocument"),r=this.activeEditor,o=oT(r);for(const i of this.#f.getAllByDocumentId(t))this.#f.unregister(i.id);return o===t&&r!==null&&this.#q(),n.removeDocument(t)?(await kt(),!0):!1}destroy(){ux(this),this.#e=!0,this.#s?.removeEventListener("click",this.#D,!0),this.#s?.removeEventListener("pointerdown",this.#F,!0),this.#s?.ownerDocument.removeEventListener("pointerup",this.#x,!0),this.#s?.ownerDocument.removeEventListener("pointercancel",this.#x,!0),this.#s?.removeEventListener("keydown",this.#P,!0),this.#s=null,this.#m?.(),this.#m=null,this.#i&&(this.#i(),this.#i=null),this.#E&&this.#E.destroy(),this.toolbar?.destroy?.(),this.commentsList?.close(),this.commentsList=null,this.app&&(this.#ie("[superdoc] Unmounting app"),this.superdocStore?.reset(),this.app.unmount(),this.removeAllListeners(),delete this.app.config.globalProperties.$config,delete this.app.config.globalProperties.$superdoc),this.#w?.destroy(),this.#Ce(),this.#R?.(),this.#R=null,this.#f.clear(),this.#r&&(this.#r.remove(),this.#r=null)}focus(e={}){const t=this.getActiveRuntime();if(t?.getCapabilities().lifecycle.canFocus){t.focus(e).catch(n=>{console.warn("[SuperDoc] active editor runtime focus failed",n)});return}this.activeEditor?ni(this.activeEditor)?this.activeEditor.focus?.(e):this.activeEditor.focus?.():this.#C("focus").documents.find(n=>{const r=n.getEditor?.();return r?(ni(r)?r.focus?.(e):r.focus?.(),!0):!1})}setHighContrastMode(e){this.activeEditor&&(this.activeEditor.setHighContrastMode?.(e),this.highContrastModeStore?.setHighContrastMode(e))}};Object.defineProperty(xh.prototype.canPerformPermission,Symbol.for("superdoc.internal.permission-method.builtin"),{value:!0}),Nt();var iT="__SUPERDOC_V2_BROWSER_RUNTIME__";function qK(e=globalThis){const t=e[iT];return t&&typeof t=="object"?t:null}function YK(e={},t=globalThis){const n=qK(t)??{},r={...n,...e,vue:e.vue??n.vue??c6};return t[iT]=r,r}YK();var XK={action:"--sd-ui-action",actionHover:"--sd-ui-action-hover",actionText:"--sd-ui-action-text",bg:"--sd-ui-bg",hoverBg:"--sd-ui-hover-bg",activeBg:"--sd-ui-active-bg",disabledBg:"--sd-ui-disabled-bg",text:"--sd-ui-text",textMuted:"--sd-ui-text-muted",textDisabled:"--sd-ui-text-disabled",border:"--sd-ui-border"},ZK=0;function sT(e){const{name:t,font:n,radius:r,shadow:o,colors:i,vars:s}=e,a=`sd-theme-${(t?t.replace(/[^a-zA-Z0-9-_]/g,"-"):null)||`custom-${++ZK}`}`,l=[];if(i)for(const[u,d]of Object.entries(i)){if(d==null)continue;const f=XK[u];f&&l.push(` ${f}: ${d};`)}if(n!=null&&l.push(` --sd-ui-font-family: ${n};`),r!=null&&l.push(` --sd-ui-radius: ${r};`),o!=null&&l.push(` --sd-ui-shadow: ${o};`),s)for(const[u,d]of Object.entries(s))d!=null&&l.push(` ${u}: ${d};`);return{className:a,css:l.length>0?`.${a} {
|
|
111
111
|
${l.join(`
|
|
112
112
|
`)}
|
|
113
|
-
}`:""}}function QK(e,t){if(typeof document>"u"||!t)return;let n=document.querySelector(`[data-sd-theme="${e}"]`);n||(n=document.createElement("style"),n.setAttribute("data-sd-theme",e),document.head.appendChild(n)),n.textContent=t}function JK(e){const{className:t,css:n}=sT(e);return QK(t,n),t}function eq(e){return sT(e)}function tq(e){if(!e||typeof e!="object")throw new Error("defineSuperDocExtension requires an extension object.");if(typeof e.id!="string"||e.id.length===0)throw new Error("defineSuperDocExtension requires a non-empty string `id`.");if(typeof e.activate!="function")throw new Error(`defineSuperDocExtension("${e.id}") requires an \`activate(ctx)\` function.`);if(e.storage!==void 0&&typeof e.storage!="function")throw new Error(`defineSuperDocExtension("${e.id}") \`storage\` must be a function returning the initial storage object.`);return e}var nq=Kd({BlankDOCX:()=>XS,DOCX:()=>kr,HTML:()=>Mu,PDF:()=>Ra,SuperDoc:()=>xh,buildTheme:()=>eq,compareVersions:()=>v6,createTheme:()=>JK,defineSuperDocExtension:()=>tq,getFileObject:()=>lb}),rq="SUPERDOC_ENGINE_CDN_BASE_URL",aT=Symbol.for("superdoc.docx-engine.cdn-load-state"),xg="superdocDocxEngineStatus";function oq(e,t,n=null){const r=e?.[rq],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return iq(o);if(!t)throw new Error("SuperDoc: the CDN build is missing its exact DOCX Engine version");return`https://cdn.jsdelivr.net/npm/@superdoc/docx-engine@${t}`}function iq(e){const t=e.trim().replace(/\/+$/,""),n=t.match(/^([a-z][a-z\d+.-]*):/iu)?.[1]?.toLowerCase();if(n&&n!=="http"&&n!=="https")throw new TypeError(`SuperDoc: unsupported DOCX Engine CDN URL scheme ${n}:`);return t}function sq({engineVersion:e,buildBaseUrl:t}){NM(()=>{const n=oq(globalThis,e,t),r=globalThis[aT],o=r instanceof Map?r:new Map;if(globalThis[aT]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),aq(`${n}/dist-cdn/style.css`)]).then(([s])=>s);o.set(n,i),i.catch(()=>{o.get(n)===i&&o.delete(n)})}return o.get(n)})}function aq(e){if(typeof document>"u")return Promise.resolve();const t=new URL(e,document.baseURI).href,n=Array.from(document.querySelectorAll('link[rel~="stylesheet"]')).find(o=>o.href===t);if(n?.sheet||n?.dataset[xg]==="loaded")return Promise.resolve();const r=n?.dataset[xg]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(g,m)=>{a||(a=!0,l?.disconnect(),s.dataset[xg]=g,m())},d=()=>u("loaded",o),f=()=>u("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),p=()=>{s.isConnected||u("error",()=>i(new Error(`SuperDoc: DOCX Engine stylesheet was removed while loading from ${t}`)))};s.addEventListener("load",d,{once:!0}),s.addEventListener("error",f,{once:!0}),typeof globalThis.MutationObserver=="function"&&(l=new globalThis.MutationObserver(p),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[xg]="loading",document.head.appendChild(s))})}sq({engineVersion:"0.22.1-next.
|
|
113
|
+
}`:""}}function QK(e,t){if(typeof document>"u"||!t)return;let n=document.querySelector(`[data-sd-theme="${e}"]`);n||(n=document.createElement("style"),n.setAttribute("data-sd-theme",e),document.head.appendChild(n)),n.textContent=t}function JK(e){const{className:t,css:n}=sT(e);return QK(t,n),t}function eq(e){return sT(e)}function tq(e){if(!e||typeof e!="object")throw new Error("defineSuperDocExtension requires an extension object.");if(typeof e.id!="string"||e.id.length===0)throw new Error("defineSuperDocExtension requires a non-empty string `id`.");if(typeof e.activate!="function")throw new Error(`defineSuperDocExtension("${e.id}") requires an \`activate(ctx)\` function.`);if(e.storage!==void 0&&typeof e.storage!="function")throw new Error(`defineSuperDocExtension("${e.id}") \`storage\` must be a function returning the initial storage object.`);return e}var nq=Kd({BlankDOCX:()=>XS,DOCX:()=>kr,HTML:()=>Mu,PDF:()=>Ra,SuperDoc:()=>xh,buildTheme:()=>eq,compareVersions:()=>v6,createTheme:()=>JK,defineSuperDocExtension:()=>tq,getFileObject:()=>lb}),rq="SUPERDOC_ENGINE_CDN_BASE_URL",aT=Symbol.for("superdoc.docx-engine.cdn-load-state"),xg="superdocDocxEngineStatus";function oq(e,t,n=null){const r=e?.[rq],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return iq(o);if(!t)throw new Error("SuperDoc: the CDN build is missing its exact DOCX Engine version");return`https://cdn.jsdelivr.net/npm/@superdoc/docx-engine@${t}`}function iq(e){const t=e.trim().replace(/\/+$/,""),n=t.match(/^([a-z][a-z\d+.-]*):/iu)?.[1]?.toLowerCase();if(n&&n!=="http"&&n!=="https")throw new TypeError(`SuperDoc: unsupported DOCX Engine CDN URL scheme ${n}:`);return t}function sq({engineVersion:e,buildBaseUrl:t}){NM(()=>{const n=oq(globalThis,e,t),r=globalThis[aT],o=r instanceof Map?r:new Map;if(globalThis[aT]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),aq(`${n}/dist-cdn/style.css`)]).then(([s])=>s);o.set(n,i),i.catch(()=>{o.get(n)===i&&o.delete(n)})}return o.get(n)})}function aq(e){if(typeof document>"u")return Promise.resolve();const t=new URL(e,document.baseURI).href,n=Array.from(document.querySelectorAll('link[rel~="stylesheet"]')).find(o=>o.href===t);if(n?.sheet||n?.dataset[xg]==="loaded")return Promise.resolve();const r=n?.dataset[xg]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(g,m)=>{a||(a=!0,l?.disconnect(),s.dataset[xg]=g,m())},d=()=>u("loaded",o),f=()=>u("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),p=()=>{s.isConnected||u("error",()=>i(new Error(`SuperDoc: DOCX Engine stylesheet was removed while loading from ${t}`)))};s.addEventListener("load",d,{once:!0}),s.addEventListener("error",f,{once:!0}),typeof globalThis.MutationObserver=="function"&&(l=new globalThis.MutationObserver(p),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[xg]="loading",document.head.appendChild(s))})}sq({engineVersion:"0.22.1-next.4",buildBaseUrl:null});for(const[e,t]of Object.entries(nq))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(xh,e)||(xh[e]=t);var lq=xh;return lq})();
|